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 * @version $Id: SinkActionContext.java 1438263 2013-01-24 23:28:22Z olamy $
29 */
30 public class SinkActionContext
31 {
32 /** Constant <code>TITLE=0</code> */
33 public static final int TITLE = 0;
34 /** Constant <code>AUTHOR=1</code> */
35 public static final int AUTHOR = 1;
36 /** Constant <code>DATE=2</code> */
37 public static final int DATE = 2;
38 /** Constant <code>HEAD=3</code> */
39 public static final int HEAD = 3;
40 /** Constant <code>BODY=4</code> */
41 public static final int BODY = 4;
42
43 /** Constant <code>SECTION_TITLE=10</code> */
44 public static final int SECTION_TITLE = 10;
45 /** Constant <code>SECTION_TITLE_1=11</code> */
46 public static final int SECTION_TITLE_1 = 11;
47 /** Constant <code>SECTION_TITLE_2=12</code> */
48 public static final int SECTION_TITLE_2 = 12;
49 /** Constant <code>SECTION_TITLE_3=13</code> */
50 public static final int SECTION_TITLE_3 = 13;
51 /** Constant <code>SECTION_TITLE_4=14</code> */
52 public static final int SECTION_TITLE_4 = 14;
53 /** Constant <code>SECTION_TITLE_5=15</code> */
54 public static final int SECTION_TITLE_5 = 15;
55
56 /** Constant <code>SECTION_1=20</code> */
57 public static final int SECTION_1 = 20;
58 /** Constant <code>SECTION_2=21</code> */
59 public static final int SECTION_2 = 21;
60 /** Constant <code>SECTION_3=22</code> */
61 public static final int SECTION_3 = 22;
62 /** Constant <code>SECTION_4=23</code> */
63 public static final int SECTION_4 = 23;
64 /** Constant <code>SECTION_5=24</code> */
65 public static final int SECTION_5 = 24;
66
67 /** Constant <code>DEFINITION_LIST=30</code> */
68 public static final int DEFINITION_LIST = 30;
69 /** Constant <code>DEFINITION_LIST_ITEM=31</code> */
70 public static final int DEFINITION_LIST_ITEM = 31;
71 /** Constant <code>DEFINED_TERM=32</code> */
72 public static final int DEFINED_TERM = 32;
73
74 /** Constant <code>LIST_ITEM=40</code> */
75 public static final int LIST_ITEM = 40;
76 /** Constant <code>NUMBERED_LIST_ITEM=41</code> */
77 public static final int NUMBERED_LIST_ITEM = 41;
78 /** Constant <code>NUMBERED_LIST=42</code> */
79 public static final int NUMBERED_LIST = 42;
80 /** Constant <code>DEFINITION=43</code> */
81 public static final int DEFINITION = 43;
82 /** Constant <code>PARAGRAPH=44</code> */
83 public static final int PARAGRAPH = 44;
84 /** Constant <code>LIST=45</code> */
85 public static final int LIST = 45;
86
87 /** Constant <code>TABLE=50</code> */
88 public static final int TABLE = 50;
89 /** Constant <code>TABLE_CAPTION=51</code> */
90 public static final int TABLE_CAPTION = 51;
91 /** Constant <code>TABLE_CELL=52</code> */
92 public static final int TABLE_CELL = 52;
93 /** Constant <code>TABLE_HEADER_CELL=53</code> */
94 public static final int TABLE_HEADER_CELL = 53;
95 /** Constant <code>TABLE_ROW=54</code> */
96 public static final int TABLE_ROW = 54;
97 /** Constant <code>TABLE_ROWS=55</code> */
98 public static final int TABLE_ROWS = 55;
99
100 /** Constant <code>VERBATIM=60</code> */
101 public static final int VERBATIM = 60;
102
103 /** Constant <code>FIGURE=70</code> */
104 public static final int FIGURE = 70;
105 /** Constant <code>FIGURE_CAPTION=71</code> */
106 public static final int FIGURE_CAPTION = 71;
107 /** Constant <code>FIGURE_GRAPHICS=72</code> */
108 public static final int FIGURE_GRAPHICS = 72;
109
110 /** Constant <code>LINK=80</code> */
111 public static final int LINK = 80;
112 /** Constant <code>ANCHOR=81</code> */
113 public static final int ANCHOR = 81;
114 /** Constant <code>UNDEFINED=82</code> */
115 public static final int UNDEFINED = 82;
116
117 private Stack<Integer> stack = new Stack<Integer>();
118
119 private int currentAction;
120
121 /**
122 * <p>Getter for the field <code>currentAction</code>.</p>
123 *
124 * @return a int.
125 */
126 public int getCurrentAction()
127 {
128 //return currentAction;
129 if ( stack.empty() )
130 {
131 return UNDEFINED;
132 }
133 else
134 {
135 return stack.peek().intValue();
136 }
137 }
138
139 /**
140 * release.
141 */
142 public void release()
143 {
144 //currentAction = -1;
145 stack.pop();
146 }
147
148 /**
149 * setAction.
150 *
151 * @param action a int.
152 */
153 public void setAction( int action )
154 {
155 //currentAction = action;
156
157 stack.push( Integer.valueOf( action ) );
158 }
159 }