MCPcopy Create free account
hub / github.com/GateNLP/gate-core / doState1

Method doState1

src/main/java/gate/sgml/Sgml2Xml.java:115–138  ·  view source on GitHub ↗

It analises the char that was red in state 1 If it finds '<' it then goes to state 2 Otherwise it stays in state 1 and keeps track about the text that is not white spaces.

(char currChar)

Source from the content-addressed store, hash-verified

113 * white spaces.
114 */
115 private void doState1(char currChar){
116 if ('<' == currChar){
117 // change to state 2
118 m_currState = 2;
119 if (!stack.isEmpty()){
120 // peek the element from the top of the stack
121 CustomObject o = stack.peek();
122 // set some properties for this element
123 // first test to find out if text folows this element charPos > 0
124 if (charPos > 0){
125 // this is not an empty element because there is text that follows
126 // set the element from the top of the stack to be a non empty one
127 o.setClosePos(charPos);
128 o.setEmpty(false);
129 // reset the charPos
130 charPos = 0;
131 }//if (charPos > 0)
132 }//if (!stack.isEmpty())
133 }//if ('<' == m_currChar)
134 // if currChar is not whiteSpace then save the position of the last
135 // char that was read
136 if (('<' != currChar) && !isWhiteSpace(currChar))
137 charPos = m_cursor;
138 }//doState1
139
140 /**
141 We came from state 1 and just read '<'

Callers 1

convertMethod · 0.95

Calls 5

setClosePosMethod · 0.95
setEmptyMethod · 0.95
isWhiteSpaceMethod · 0.95
peekMethod · 0.80
isEmptyMethod · 0.45

Tested by

no test coverage detected