@Test public void testContains() { Location location1 = new Location(0, 0, 10, 1); Location location2 = new Location(0, 0, 9, 1); assertTrue(location1.contains(location2)); location2.endLine = 10; assertTrue(location1.contains(location2)); location2.endOffset = 2; assertFalse(location1.contains(location2)); }
public boolean contains(Location other) { if (startLine > other.startLine) { return false; } if (startLine == other.startLine && startOffset > other.startOffset) { return false; } if (endLine < other.endLine) { return false; } return !(endLine == other.endLine && endOffset < other.endOffset); }
Location { public boolean contains(Location other) { if (startLine > other.startLine) { return false; } if (startLine == other.startLine && startOffset > other.startOffset) { return false; } if (endLine < other.endLine) { return false; } return !(endLine == other.endLine && endOffset < other.endOffset); } }
Location { public boolean contains(Location other) { if (startLine > other.startLine) { return false; } if (startLine == other.startLine && startOffset > other.startOffset) { return false; } if (endLine < other.endLine) { return false; } return !(endLine == other.endLine && endOffset < other.endOffset); } Location();  Location(Location other);  Location(Token start, Token end);  Location(ParserRuleContext context);  Location(int startLine, int startOffset, int endLine, int endOffset); }
Location { public boolean contains(Location other) { if (startLine > other.startLine) { return false; } if (startLine == other.startLine && startOffset > other.startOffset) { return false; } if (endLine < other.endLine) { return false; } return !(endLine == other.endLine && endOffset < other.endOffset); } Location();  Location(Location other);  Location(Token start, Token end);  Location(ParserRuleContext context);  Location(int startLine, int startOffset, int endLine, int endOffset); @Override String toString(); void setParentLocation(Location parentLocation); @Override boolean equals(Object o); @Override int hashCode(); boolean isValid(); boolean contains(Location other); Location toAbsoluteLocation(); String toUserReadableString(); static Location fromUserReadableString(String str); LocationScopeProvider createScope(); }
Location { public boolean contains(Location other) { if (startLine > other.startLine) { return false; } if (startLine == other.startLine && startOffset > other.startOffset) { return false; } if (endLine < other.endLine) { return false; } return !(endLine == other.endLine && endOffset < other.endOffset); } Location();  Location(Location other);  Location(Token start, Token end);  Location(ParserRuleContext context);  Location(int startLine, int startOffset, int endLine, int endOffset); @Override String toString(); void setParentLocation(Location parentLocation); @Override boolean equals(Object o); @Override int hashCode(); boolean isValid(); boolean contains(Location other); Location toAbsoluteLocation(); String toUserReadableString(); static Location fromUserReadableString(String str); LocationScopeProvider createScope(); static final int NaN; @XmlAttribute(name = "startLine")
    public int startLine; @XmlAttribute(name = "startOffset")
    public int startOffset; @XmlAttribute(name = "endLine")
    public int endLine; @XmlAttribute(name = "endOffset")
    public int endOffset; @XmlElement(name = "parentLocation")
    public Location parentLocation; }