1 package org.apache.maven.doxia.module.itext;
2
3 /*
4 * Licensed to the Apache Software Foundation (ASF) under one
5 * or more contributor license agreements. See the NOTICE file
6 * distributed with this work for additional information
7 * regarding copyright ownership. The ASF licenses this file
8 * to you under the Apache License, Version 2.0 (the
9 * "License"); you may not use this file except in compliance
10 * with the License. You may obtain a copy of the License at
11 *
12 * http://www.apache.org/licenses/LICENSE-2.0
13 *
14 * Unless required by applicable law or agreed to in writing,
15 * software distributed under the License is distributed on an
16 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17 * KIND, either express or implied. See the License for the
18 * specific language governing permissions and limitations
19 * under the License.
20 */
21
22 import java.util.Stack;
23
24 /**
25 * <p>SinkActionContext class.</p>
26 *
27 * @author Jason van Zyl
28 */
29 public class SinkActionContext
30 {
31 /** Constant <code>TITLE=0</code> */
32 public static final int TITLE = 0;
33 /** Constant <code>AUTHOR=1</code> */
34 public static final int AUTHOR = 1;
35 /** Constant <code>DATE=2</code> */
36 public static final int DATE = 2;
37 /** Constant <code>HEAD=3</code> */
38 public static final int HEAD = 3;
39 /** Constant <code>BODY=4</code> */
40 public static final int BODY = 4;
41
42 /** Constant <code>SECTION_TITLE=10</code> */
43 public static final int SECTION_TITLE = 10;
44 /** Constant <code>SECTION_TITLE_1=11</code> */
45 public static final int SECTION_TITLE_1 = 11;
46 /** Constant <code>SECTION_TITLE_2=12</code> */
47 public static final int SECTION_TITLE_2 = 12;
48 /** Constant <code>SECTION_TITLE_3=13</code> */
49 public static final int SECTION_TITLE_3 = 13;
50 /** Constant <code>SECTION_TITLE_4=14</code> */
51 public static final int SECTION_TITLE_4 = 14;
52 /** Constant <code>SECTION_TITLE_5=15</code> */
53 public static final int SECTION_TITLE_5 = 15;
54
55 /** Constant <code>SECTION_1=20</code> */
56 public static final int SECTION_1 = 20;
57 /** Constant <code>SECTION_2=21</code> */
58 public static final int SECTION_2 = 21;
59 /** Constant <code>SECTION_3=22</code> */
60 public static final int SECTION_3 = 22;
61 /** Constant <code>SECTION_4=23</code> */
62 public static final int SECTION_4 = 23;
63 /** Constant <code>SECTION_5=24</code> */
64 public static final int SECTION_5 = 24;
65
66 /** Constant <code>DEFINITION_LIST=30</code> */
67 public static final int DEFINITION_LIST = 30;
68 /** Constant <code>DEFINITION_LIST_ITEM=31</code> */
69 public static final int DEFINITION_LIST_ITEM = 31;
70 /** Constant <code>DEFINED_TERM=32</code> */
71 public static final int DEFINED_TERM = 32;
72
73 /** Constant <code>LIST_ITEM=40</code> */
74 public static final int LIST_ITEM = 40;
75 /** Constant <code>NUMBERED_LIST_ITEM=41</code> */
76 public static final int NUMBERED_LIST_ITEM = 41;
77 /** Constant <code>NUMBERED_LIST=42</code> */
78 public static final int NUMBERED_LIST = 42;
79 /** Constant <code>DEFINITION=43</code> */
80 public static final int DEFINITION = 43;
81 /** Constant <code>PARAGRAPH=44</code> */
82 public static final int PARAGRAPH = 44;
83 /** Constant <code>LIST=45</code> */
84 public static final int LIST = 45;
85
86 /** Constant <code>TABLE=50</code> */
87 public static final int TABLE = 50;
88 /** Constant <code>TABLE_CAPTION=51</code> */
89 public static final int TABLE_CAPTION = 51;
90 /** Constant <code>TABLE_CELL=52</code> */
91 public static final int TABLE_CELL = 52;
92 /** Constant <code>TABLE_HEADER_CELL=53</code> */
93 public static final int TABLE_HEADER_CELL = 53;
94 /** Constant <code>TABLE_ROW=54</code> */
95 public static final int TABLE_ROW = 54;
96 /** Constant <code>TABLE_ROWS=55</code> */
97 public static final int TABLE_ROWS = 55;
98
99 /** Constant <code>VERBATIM=60</code> */
100 public static final int VERBATIM = 60;
101
102 /** Constant <code>FIGURE=70</code> */
103 public static final int FIGURE = 70;
104 /** Constant <code>FIGURE_CAPTION=71</code> */
105 public static final int FIGURE_CAPTION = 71;
106 /** Constant <code>FIGURE_GRAPHICS=72</code> */
107 public static final int FIGURE_GRAPHICS = 72;
108
109 /** Constant <code>LINK=80</code> */
110 public static final int LINK = 80;
111 /** Constant <code>ANCHOR=81</code> */
112 public static final int ANCHOR = 81;
113 /** Constant <code>UNDEFINED=82</code> */
114 public static final int UNDEFINED = 82;
115
116 private Stack<Integer> stack = new Stack<>();
117
118 private int currentAction;
119
120 /**
121 * <p>Getter for the field <code>currentAction</code>.</p>
122 *
123 * @return a int.
124 */
125 public int getCurrentAction()
126 {
127 //return currentAction;
128 if ( stack.empty() )
129 {
130 return UNDEFINED;
131 }
132 else
133 {
134 return stack.peek();
135 }
136 }
137
138 /**
139 * release.
140 */
141 public void release()
142 {
143 //currentAction = -1;
144 stack.pop();
145 }
146
147 /**
148 * setAction.
149 *
150 * @param action a int.
151 */
152 public void setAction( int action )
153 {
154 //currentAction = action;
155
156 stack.push( action );
157 }
158 }