public FormatTokenPosition getPreviousPosition(TokenItem token, int offset) { return getPreviousPosition(token, offset, Position.Bias.Forward); }
public FormatTokenPosition getPreviousPosition(TokenItem token, int offset) { return getPreviousPosition(token, offset, Position.Bias.Forward); }
/** 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); }
/** * 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); }
/** * 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 first EOL in backward direction. The current position is ignored * by the search. * * @return first EOL in backward direction or null if there is no such * token. */ public FormatTokenPosition findPreviousEOL(FormatTokenPosition pos) { pos = getPreviousPosition(pos); if (pos == null) { // was the start position return null; } TokenItem token = pos.getToken(); int offset = pos.getOffset(); while (true) { String text = token.getImage(); while (offset >= 0) { if (text.charAt(offset) == '\n') { return getPosition(token, offset); } offset--; } if (token.getPrevious() == null) { return null; } token = token.getPrevious(); offset = token.getImage().length() - 1; } }
/** Get the first EOL in backward direction. The current position * is ignored by the search. * @return first EOL in backward direction or null if there * is no such token. */ public FormatTokenPosition findPreviousEOL(FormatTokenPosition pos) { pos = getPreviousPosition(pos); if (pos == null) { // was the start position return null; } TokenItem token = pos.getToken(); int offset = pos.getOffset(); while (true) { String text = token.getImage(); while (offset >= 0) { if (text.charAt(offset) == '\n') { return getPosition(token, offset); } offset--; } if (token.getPrevious() == null) { return null; } token = token.getPrevious(); offset = token.getImage().length() - 1; } }
pos = getPreviousPosition(pos);
pos = getPreviousPosition(pos);
limitPosition = getPreviousPosition(limitPosition); if (limitPosition == null) { limitToken = null; startPosition = getPreviousPosition(startPosition); if (startPosition == null) { return null;
limitPosition = getPreviousPosition(limitPosition); if (limitPosition == null) { limitToken = null; startPosition = getPreviousPosition(startPosition); if (startPosition == null) { return null;