while (p.getLastOffset()>=0? p.getLastOffset() >= offset: p.getLastLine() >= line) { currentLine = reader.readLine(); if (p.getLastLine() == line) { lines.add(currentLine.substring(0, p.getLastCol())); } else {
while (p.getLastOffset()>=0? p.getLastOffset() >= offset: p.getLastLine() >= line) { currentLine = reader.readLine(); if (p.getLastLine() == line) { lines.add(currentLine.substring(0, p.getLastCol())); } else {
public void substitute(Position range, String newText) { int startLine = range.getFirstLine() - p.getFirstLine(); int endLine = range.getLastLine() - p.getFirstLine();
public void substitute(Position range, String newText) { int startLine = range.getFirstLine() - p.getFirstLine(); int endLine = range.getLastLine() - p.getFirstLine();
if (pos.getFirstLine() >= (Integer) assertionData[j][2] && (pos.getLastLine() != -1? pos.getLastLine(): pos.getFirstLine()) <= (Integer) assertionData[j][3]) { System.err.println("found " + inst + " of " + M + " at expected position " + pos); continue insts;
private static void findNodesAtPos(int kind, Position pos, CAstSourcePositionMap spmap, ChildPos nodep, Set<ChildPos> res) { CAstNode node = nodep.getChild(); if(node == null) return; Position ndpos = spmap.getPosition(node); if(ndpos != null) { // if we are in the wrong file or past the position pos, abort search if(!ndpos.getURL().equals(pos.getURL())) return; if(pos.getLastLine() >= 0 && ndpos.getFirstLine() > pos.getLastLine()) return; //if(node.getKind() == kind && ndpos.getFirstLine() == pos.getFirstLine() && ndpos.getLastLine() == pos.getLastLine()) if(node.getKind() == kind && ndpos.getFirstOffset() == pos.getFirstOffset() && ndpos.getLastOffset() == pos.getLastOffset()) res.add(nodep); } for(int i=0;i<node.getChildCount();++i) findNodesAtPos(kind, pos, spmap, nodep.getChildPos(i), res); }
private static void findNodesAtPos(int kind, Position pos, CAstSourcePositionMap spmap, ChildPos nodep, Set<ChildPos> res) { CAstNode node = nodep.getChild(); if(node == null) return; Position ndpos = spmap.getPosition(node); if(ndpos != null) { // if we are in the wrong file or past the position pos, abort search if(!ndpos.getURL().equals(pos.getURL())) return; if(pos.getLastLine() >= 0 && ndpos.getFirstLine() > pos.getLastLine()) return; //if(node.getKind() == kind && ndpos.getFirstLine() == pos.getFirstLine() && ndpos.getLastLine() == pos.getLastLine()) if(node.getKind() == kind && ndpos.getFirstOffset() == pos.getFirstOffset() && ndpos.getLastOffset() == pos.getLastOffset()) res.add(nodep); } for(int i=0;i<node.getChildCount();++i) findNodesAtPos(kind, pos, spmap, nodep.getChildPos(i), res); }
@Override public int compareTo(Object o) { if (o instanceof Position) { Position p = (Position)o; if (getFirstLine() != p.getFirstLine()) { return getFirstLine() - p.getFirstLine(); } else if (getFirstCol() != p.getFirstCol()) { return getFirstCol() - p.getFirstCol(); } else if (getLastLine() != p.getLastLine()) { return getLastLine() - p.getLastLine(); } else { return getLastCol() - p.getLastCol(); } } else { return 0; } }
@Override public int compareTo(Object o) { if (o instanceof Position) { Position p = (Position)o; if (getFirstLine() != p.getFirstLine()) { return getFirstLine() - p.getFirstLine(); } else if (getFirstCol() != p.getFirstCol()) { return getFirstCol() - p.getFirstCol(); } else if (getLastLine() != p.getLastLine()) { return getLastLine() - p.getLastLine(); } else { return getLastCol() - p.getLastCol(); } } else { return 0; } }
@Override public boolean equals(Object o){ if (o instanceof Position) { Position p = (Position)o; return getFirstLine() == p.getFirstLine() && getLastLine() == p.getLastLine() && getFirstCol() == p.getFirstCol() && getLastCol() == p.getLastCol() && getFirstOffset() == p.getFirstOffset() && getLastOffset() == p.getLastOffset() && ( (getURL() != null)? getURL().equals(p.getURL()): p.getURL() == null); } else { return false; } }
@Override public boolean equals(Object o){ if (o instanceof Position) { Position p = (Position)o; return getFirstLine() == p.getFirstLine() && getLastLine() == p.getLastLine() && getFirstCol() == p.getFirstCol() && getLastCol() == p.getLastCol() && getFirstOffset() == p.getFirstOffset() && getLastOffset() == p.getLastOffset() && ( (getURL() != null)? getURL().equals(p.getURL()): p.getURL() == null); } else { return false; } }
@Override public int getLastLine() { return pos.getLastLine()==-1? -1: (pos.getLastLine()-range.getStartingLine()+1); }
public boolean includes(Position offset) { return offset.getFirstOffset() != -1? rangeStart <= offset.getFirstOffset() && offset.getLastOffset() <= rangeEnd: rangeStartingLine <= offset.getFirstLine() && (offset.getLastLine() == -1? offset.getFirstLine(): offset.getLastLine()) <= rangeEndingLine; }
@Override public int getLastLine() { return pos.getLastLine()==-1? -1: (pos.getLastLine()-range.getStartingLine()+1); }
public boolean includes(Position offset) { return offset.getFirstOffset() != -1? rangeStart <= offset.getFirstOffset() && offset.getLastOffset() <= rangeEnd: rangeStartingLine <= offset.getFirstLine() && (offset.getLastLine() == -1? offset.getFirstLine(): offset.getLastLine()) <= rangeEndingLine; }