001package org.apache.maven.doxia.module.itext; 002 003/* 004 * Licensed to the Apache Software Foundation (ASF) under one 005 * or more contributor license agreements. See the NOTICE file 006 * distributed with this work for additional information 007 * regarding copyright ownership. The ASF licenses this file 008 * to you under the Apache License, Version 2.0 (the 009 * "License"); you may not use this file except in compliance 010 * with the License. You may obtain a copy of the License at 011 * 012 * http://www.apache.org/licenses/LICENSE-2.0 013 * 014 * Unless required by applicable law or agreed to in writing, 015 * software distributed under the License is distributed on an 016 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 017 * KIND, either express or implied. See the License for the 018 * specific language governing permissions and limitations 019 * under the License. 020 */ 021 022import java.util.Stack; 023 024/** 025 * <p>SinkActionContext class.</p> 026 * 027 * @author Jason van Zyl 028 * @version $Id: SinkActionContext.html 905940 2014-04-12 16:27:29Z hboutemy $ 029 */ 030public class SinkActionContext 031{ 032 /** Constant <code>TITLE=0</code> */ 033 public static final int TITLE = 0; 034 /** Constant <code>AUTHOR=1</code> */ 035 public static final int AUTHOR = 1; 036 /** Constant <code>DATE=2</code> */ 037 public static final int DATE = 2; 038 /** Constant <code>HEAD=3</code> */ 039 public static final int HEAD = 3; 040 /** Constant <code>BODY=4</code> */ 041 public static final int BODY = 4; 042 043 /** Constant <code>SECTION_TITLE=10</code> */ 044 public static final int SECTION_TITLE = 10; 045 /** Constant <code>SECTION_TITLE_1=11</code> */ 046 public static final int SECTION_TITLE_1 = 11; 047 /** Constant <code>SECTION_TITLE_2=12</code> */ 048 public static final int SECTION_TITLE_2 = 12; 049 /** Constant <code>SECTION_TITLE_3=13</code> */ 050 public static final int SECTION_TITLE_3 = 13; 051 /** Constant <code>SECTION_TITLE_4=14</code> */ 052 public static final int SECTION_TITLE_4 = 14; 053 /** Constant <code>SECTION_TITLE_5=15</code> */ 054 public static final int SECTION_TITLE_5 = 15; 055 056 /** Constant <code>SECTION_1=20</code> */ 057 public static final int SECTION_1 = 20; 058 /** Constant <code>SECTION_2=21</code> */ 059 public static final int SECTION_2 = 21; 060 /** Constant <code>SECTION_3=22</code> */ 061 public static final int SECTION_3 = 22; 062 /** Constant <code>SECTION_4=23</code> */ 063 public static final int SECTION_4 = 23; 064 /** Constant <code>SECTION_5=24</code> */ 065 public static final int SECTION_5 = 24; 066 067 /** Constant <code>DEFINITION_LIST=30</code> */ 068 public static final int DEFINITION_LIST = 30; 069 /** Constant <code>DEFINITION_LIST_ITEM=31</code> */ 070 public static final int DEFINITION_LIST_ITEM = 31; 071 /** Constant <code>DEFINED_TERM=32</code> */ 072 public static final int DEFINED_TERM = 32; 073 074 /** Constant <code>LIST_ITEM=40</code> */ 075 public static final int LIST_ITEM = 40; 076 /** Constant <code>NUMBERED_LIST_ITEM=41</code> */ 077 public static final int NUMBERED_LIST_ITEM = 41; 078 /** Constant <code>NUMBERED_LIST=42</code> */ 079 public static final int NUMBERED_LIST = 42; 080 /** Constant <code>DEFINITION=43</code> */ 081 public static final int DEFINITION = 43; 082 /** Constant <code>PARAGRAPH=44</code> */ 083 public static final int PARAGRAPH = 44; 084 /** Constant <code>LIST=45</code> */ 085 public static final int LIST = 45; 086 087 /** Constant <code>TABLE=50</code> */ 088 public static final int TABLE = 50; 089 /** Constant <code>TABLE_CAPTION=51</code> */ 090 public static final int TABLE_CAPTION = 51; 091 /** Constant <code>TABLE_CELL=52</code> */ 092 public static final int TABLE_CELL = 52; 093 /** Constant <code>TABLE_HEADER_CELL=53</code> */ 094 public static final int TABLE_HEADER_CELL = 53; 095 /** Constant <code>TABLE_ROW=54</code> */ 096 public static final int TABLE_ROW = 54; 097 /** Constant <code>TABLE_ROWS=55</code> */ 098 public static final int TABLE_ROWS = 55; 099 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}