if (true) {
boolean ok = verify(beginFromStartOfDocument, endFromStartOfDocument, offsetAdjustment);
if (!ok) {
System.err.println("ERROR: so creating a BaseToken with begin = 0 end = 0 just to avoid exception");
if (jcas!=null) token = new BaseToken(jcas, 0, 0); else token = new Token(0,0);
return token;
}
}
if (clas == null) { // determine the type for the caller
Class<? extends BaseToken> clss = determineTokenType(s, begin, end);
if (clss==null) throw new RuntimeException(" still is null");
if (jcas!=null)
token = createToken(clss, s, jcas, begin, end, offsetAdjustment);
else {
token = new Token(begin, end);
((Token)token).setText(s.substring(begin, end));
}
} else if (clas.equals(NewlineToken.class)) {
if (jcas!=null)
token = new NewlineToken(jcas, beginFromStartOfDocument, endFromStartOfDocument);
else {
token = new Token(beginFromStartOfDocument, endFromStartOfDocument);
((Token)token).setText(s.substring(begin, end));
}
} else if (clas.equals(NumToken.class)) {
if (jcas!=null) {
token = new NumToken(jcas, beginFromStartOfDocument, endFromStartOfDocument);
String tokenText = s.substring(begin, end);
setNumType((NumToken)token, tokenText);
}
else {
token = new Token(beginFromStartOfDocument, endFromStartOfDocument);
((Token)token).setText(s.substring(begin, end));
}
} else if (clas.equals(WordToken.class)) {
if (jcas!=null) {
token = new WordToken(jcas, beginFromStartOfDocument, endFromStartOfDocument);
String tokenText = s.substring(begin, end);
setCapitalization((WordToken)token, tokenText);
setNumPosition((WordToken)token, tokenText);
}
else {
token = new Token(beginFromStartOfDocument, endFromStartOfDocument);
((Token)token).setText(s.substring(begin, end));
}
} else if (clas.equals(SymbolToken.class)) {
if (jcas!=null)
token = new SymbolToken(jcas, beginFromStartOfDocument, endFromStartOfDocument);
else {
token = new Token(beginFromStartOfDocument, endFromStartOfDocument);
((Token)token).setText(s.substring(begin, end));
}
} else if (clas.equals(PunctuationToken.class)) {
if (jcas!=null)
token = new PunctuationToken(jcas, beginFromStartOfDocument, endFromStartOfDocument);
else {
token = new Token(beginFromStartOfDocument, endFromStartOfDocument);
((Token)token).setText(s.substring(begin, end));
}
} else if (clas.equals(ContractionToken.class)) {
if (jcas!=null)
token = new ContractionToken(jcas, beginFromStartOfDocument, endFromStartOfDocument);
else {
token = new Token(beginFromStartOfDocument, endFromStartOfDocument);
((Token)token).setText(s.substring(begin, end));
}
} else if (clas.equals(BaseToken.class)) {
if (jcas!=null)
token = new BaseToken(jcas, beginFromStartOfDocument, endFromStartOfDocument);
else {
token = new Token(beginFromStartOfDocument, endFromStartOfDocument);
((Token)token).setText(s.substring(begin, end));
}