/** * Get the character at the given position. The caller must care about not * to pass the end-of-chain position to this method. */ public char getChar(FormatTokenPosition pos) { return pos.getToken().getImage().charAt(pos.getOffset()); }
/** Get the character at the given position. The caller must care * about not to pass the end-of-chain position to this method. */ public char getChar(FormatTokenPosition pos) { return pos.getToken().getImage().charAt(pos.getOffset()); }
/** * Get the token-position preceeding the given one. * * @param bias * bias that the returned position will have. */ public FormatTokenPosition getNextPosition(FormatTokenPosition pos, Position.Bias bias) { return getNextPosition(pos.getToken(), pos.getOffset(), bias); }
/** * Get the token-position preceeding the given one. * * @param bias * bias that the returned position will have. */ public FormatTokenPosition getPreviousPosition(FormatTokenPosition pos, Position.Bias bias) { return getPreviousPosition(pos.getToken(), pos.getOffset(), bias); }
public boolean equals(Object o, boolean ignoreBias) { if (o instanceof FormatTokenPosition) { FormatTokenPosition tp = (FormatTokenPosition) o; return token == tp.getToken() && offset == tp.getOffset() && (ignoreBias || bias == tp.getBias()); } return false; }
public boolean equals(Object o, boolean ignoreBias) { if (o instanceof FormatTokenPosition) { FormatTokenPosition tp = (FormatTokenPosition)o; return token == tp.getToken() && offset == tp.getOffset() && (ignoreBias || bias == tp.getBias()); } return false; }
/** Get the token-position preceeding the given one. * @param bias bias that the returned position will have. */ public FormatTokenPosition getNextPosition(FormatTokenPosition pos, Position.Bias bias) { return getNextPosition(pos.getToken(), pos.getOffset(), bias); }
public boolean isWhitespace(FormatTokenPosition pos) { return isWhitespace(pos.getToken(), pos.getOffset()); }
/** Get the token-position preceeding the given one. * @param bias bias that the returned position will have. */ public FormatTokenPosition getPreviousPosition(FormatTokenPosition pos, Position.Bias bias) { return getPreviousPosition(pos.getToken(), pos.getOffset(), bias); }
public boolean isImportant(FormatTokenPosition pos) { return isImportant(pos.getToken(), pos.getOffset()); }
public void insertString(FormatTokenPosition pos, String text) { TokenItem token = pos.getToken(); int offset = pos.getOffset(); if (token == null) { // ending position token = getLastToken(); if (token == null) { throw new IllegalStateException("Cannot insert string. No tokens."); // NOI18N } offset = token.getImage().length(); } insertString(token, offset, text); }
public void insertString(FormatTokenPosition pos, String text) { TokenItem token = pos.getToken(); int offset = pos.getOffset(); if (token == null) { // ending position token = getLastToken(); if (token == null) { throw new IllegalStateException("Cannot insert string. No tokens."); } offset = token.getImage().length(); } insertString(token, offset, text); }
/** Checks whether the tested position is after some other position. */ public boolean isAfter(FormatTokenPosition testedPosition, FormatTokenPosition afterPosition) { if (testedPosition.getToken() == afterPosition.getToken()) { return (testedPosition.getOffset() > afterPosition.getOffset()); } else { // different tokens return isAfter(testedPosition.getToken(), afterPosition.getToken()); } }
/** Checks whether the tested position is after some other position. */ public boolean isAfter(FormatTokenPosition testedPosition, FormatTokenPosition afterPosition) { if (testedPosition.getToken() == afterPosition.getToken()) { return (testedPosition.getOffset() > afterPosition.getOffset()); } else { // different tokens return isAfter(testedPosition.getToken(), afterPosition.getToken()); } }
/** * Get the token-position preceeding the given one. Use the same bias like * the given position has. */ public FormatTokenPosition getPreviousPosition(FormatTokenPosition pos) { return getPreviousPosition(pos.getToken(), pos.getOffset(), pos.getBias()); }
/** Get the token-position preceeding the given one. Use the same * bias like the given position has. */ public FormatTokenPosition getPreviousPosition(FormatTokenPosition pos) { return getPreviousPosition(pos.getToken(), pos.getOffset(), pos.getBias()); }
/** * Get the next successive token-position after the given one. Use the same * bias like the given position has. */ public FormatTokenPosition getNextPosition(FormatTokenPosition pos) { return getNextPosition(pos.getToken(), pos.getOffset(), pos.getBias()); }
/** Check whether this is the first position in the chain of tokens. */ public boolean isChainStartPosition(FormatTokenPosition pos) { TokenItem token = pos.getToken(); return (pos.getOffset() == 0) && ((token == null && getLastToken() == null) // no tokens || (token != null && token.getPrevious() == null)); }
/** Get the next successive token-position after the given one. * Use the same bias like the given position has. */ public FormatTokenPosition getNextPosition(FormatTokenPosition pos) { return getNextPosition(pos.getToken(), pos.getOffset(), pos.getBias()); }
/** Check whether this is the first position in the chain of tokens. */ public boolean isChainStartPosition(FormatTokenPosition pos) { TokenItem token = pos.getToken(); return (pos.getOffset() == 0) && ((token == null && getLastToken() == null) // no // tokens || (token != null && token.getPrevious() == null)); }