/** * Creates a "null" token. The token itself is not null; rather, it * signifies that it is the last token in a linked list of tokens and * that it is not part of a "multi-line token." */ public TokenImpl() { this.text = null; this.textOffset = -1; this.textCount = -1; this.setType(NULL); setOffset(-1); hyperlink = false; nextToken = null; }
/** * Sets the value of this token to a particular segment of a document. * The "next token" value is cleared. * * @param line The segment from which to get the token. * @param beg The first character's position in <code>line</code>. * @param end The last character's position in <code>line</code>. * @param offset The offset into the document at which this token begins. * @param type A token type listed as "generic" above. */ public void set(final char[] line, final int beg, final int end, final int offset, final int type) { this.text = line; this.textOffset = beg; this.textCount = end - beg + 1; this.setType(type); this.setOffset(offset); nextToken = null; }
/** * {@inheritDoc} */ @Override public TokenImpl createToken() { TokenImpl token = tokenList[currentFreeToken]; token.text = null; token.setType(Token.NULL); token.setOffset(-1); token.setNextToken(null); currentFreeToken++; if (currentFreeToken==size) { augmentTokenList(); } return token; }
/** * Makes one token point to the same text segment, and have the same value * as another token. * * @param t2 The token from which to copy. */ public void copyFrom(Token t2) { text = t2.getTextArray(); textOffset = t2.getTextOffset(); textCount = t2.length(); setOffset(t2.getOffset()); setType(t2.getType()); hyperlink = t2.isHyperlink(); languageIndex = t2.getLanguageIndex(); nextToken = t2.getNextToken(); }
/** * Creates a "null" token. The token itself is not null; rather, it * signifies that it is the last token in a linked list of tokens and * that it is not part of a "multi-line token." */ public TokenImpl() { this.text = null; this.textOffset = -1; this.textCount = -1; this.setType(NULL); setOffset(-1); hyperlink = false; nextToken = null; }
/** * Sets the value of this token to a particular segment of a document. * The "next token" value is cleared. * * @param line The segment from which to get the token. * @param beg The first character's position in <code>line</code>. * @param end The last character's position in <code>line</code>. * @param offset The offset into the document at which this token begins. * @param type A token type listed as "generic" above. */ public void set(final char[] line, final int beg, final int end, final int offset, final int type) { this.text = line; this.textOffset = beg; this.textCount = end - beg + 1; this.setType(type); this.setOffset(offset); nextToken = null; }
/** * {@inheritDoc} */ @Override public TokenImpl createToken() { TokenImpl token = tokenList[currentFreeToken]; token.text = null; token.setType(Token.NULL); token.setOffset(-1); token.setNextToken(null); currentFreeToken++; if (currentFreeToken==size) { augmentTokenList(); } return token; }
/** * Makes one token point to the same text segment, and have the same value * as another token. * * @param t2 The token from which to copy. */ public void copyFrom(Token t2) { text = t2.getTextArray(); textOffset = t2.getTextOffset(); textCount = t2.length(); setOffset(t2.getOffset()); setType(t2.getType()); hyperlink = t2.isHyperlink(); languageIndex = t2.getLanguageIndex(); nextToken = t2.getNextToken(); }