public class Position
extends java.lang.Object
invariant: line() >= 0 && column() >= 0
This class follows DbC(tm) methodology. Where possible, contracts are implement with JML and native's Java assert.
Constructor and Description |
---|
Position(int line,
int column)
Constructs a new Position (line x column).
|
Modifier and Type | Method and Description |
---|---|
int |
column()
Column.
|
boolean |
isEqual(int line,
int column)
Is equal?
|
boolean |
isEqual(Position other)
Is equal?
|
boolean |
isGreater(int line,
int column)
this.line() > line && this.column() >= column ||
this.line() >= line && this.column() > column |
boolean |
isGreater(Position other)
this.line() > other.line() && this.column() >= other.column() ||
this.line() >= other.line() && this.column() > other.column() |
boolean |
isGreaterOrEqual(int line,
int column)
this.line() >= line && this.column() >= column ||
this.line() >= line && this.column() >= column |
boolean |
isGreaterOrEqual(Position other)
this.line() >= other.line() && this.column() >= other.column() ||
this.line() >= other.line() && this.column() >= other.column() |
boolean |
isLower(int line,
int column)
this.line() < line && this.column() <= column ||
this.line() <= line && this.column() < column |
boolean |
isLower(Position other)
this.line() < other.line() && this.column() <= other.column() ||
this.line() <= other.line() && this.column() < other.column() |
boolean |
isLowerOrEqual(int line,
int column)
this.line() <= line && this.column() <= column ||
this.line() <= line && this.column() <= column |
boolean |
isLowerOrEqual(Position other)
this.line() <= other.line() && this.column() <= other.column() ||
this.line() <= other.line() && this.column() <= other.column() |
int |
line()
Line.
|
java.lang.String |
toString() |
public Position(int line, int column)
requires: line >= 0 && column >= 0
line
- line positioncolumn
- column positionpublic int line()
int
line positionpublic int column()
int
column positionpublic boolean isEqual(Position other)
requires: other != null
other
- other positionboolean
true if equalpublic boolean isEqual(int line, int column)
requires: line >= 0 && column >= 0
line
- line positioncolumn
- column positionboolean
true if equalpublic boolean isGreater(Position other)
this.line() > other.line() && this.column() >= other.column() ||
this.line() >= other.line() && this.column() > other.column()
requires: other != null
other
- other positionboolean
true if greater thanpublic boolean isGreater(int line, int column)
this.line() > line && this.column() >= column ||
this.line() >= line && this.column() > column
requires: line >= 0 && column >= 0
line
- line positioncolumn
- column positionboolean
true if greater thanpublic boolean isLower(Position other)
this.line() < other.line() && this.column() <= other.column() ||
this.line() <= other.line() && this.column() < other.column()
requires: other != null
other
- other positionboolean
true if lower thanpublic boolean isLower(int line, int column)
this.line() < line && this.column() <= column ||
this.line() <= line && this.column() < column
requires: line >= 0 && column >= 0
line
- line positioncolumn
- column positionboolean
true if lower thanpublic boolean isGreaterOrEqual(Position other)
this.line() >= other.line() && this.column() >= other.column() ||
this.line() >= other.line() && this.column() >= other.column()
requires: other != null
other
- other positionboolean
true if greater thanpublic boolean isGreaterOrEqual(int line, int column)
this.line() >= line && this.column() >= column ||
this.line() >= line && this.column() >= column
requires: line >= 0 && column >= 0
line
- line positioncolumn
- column positionboolean
true if greater thanpublic boolean isLowerOrEqual(Position other)
this.line() <= other.line() && this.column() <= other.column() ||
this.line() <= other.line() && this.column() <= other.column()
requires: other != null
other
- other positionboolean
true if lower thanpublic boolean isLowerOrEqual(int line, int column)
this.line() <= line && this.column() <= column ||
this.line() <= line && this.column() <= column
requires: line >= 0 && column >= 0
line
- line positioncolumn
- column positionboolean
true if lower thanpublic java.lang.String toString()
toString
in class java.lang.Object