- java.lang.Object
-
- swim.codec.Tag
-
- swim.codec.Mark
-
- All Implemented Interfaces:
Comparable<Mark>,Debug,Display
public final class Mark extends Tag implements Comparable<Mark>
Description of a source position, identified by byte offset, line, and column number, with an optional note.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static Markat(long offset, int line, int column)Returns a newMarkat the given zero-based byteoffset, one-basedlinenumber, and one-basedcolumnnumber, with no attached note.static Markat(long offset, int line, int column, String note)Returns a newMarkat the given zero-based byteoffset, one-basedlinenumber, and one-basedcolumnnumber, with the attachednote.intcolumn()Returns the one-based column number of this position.intcompareTo(Mark that)<T> Output<T>debug(Output<T> output)Writes a developer readable, debug-formatted string representation of this object tooutput.<T> Output<T>display(Output<T> output)Writes a human readable, display-formatted string representation of this object tooutput.Markend()Returns the last source position covered by thisTag.booleanequals(Object other)inthashCode()intline()Returns the one-based line number of this position.Markmax(Mark that)Returnsthisposition, if its byte offset is greater than or equal tothatposition; otherwise returnsthatposition.Markmin(Mark that)Returnsthisposition, if its byte offset is less than or equal tothatposition; otherwise returnsthatposition.Stringnote()Returns the note attached to the marked position, ornullif this position has no attached note.longoffset()Returns the zero-based byte offset of this position.Markshift(Mark mark)Returns the position of thisTagrelative to the givenmark.Markstart()Returns the first source position covered by thisTag.StringtoString()Tagunion(Tag other)Returns aTagthat includes all source locations covered by both this tag, and someothertag.static Markzero()Returns aMarkat byte offset0, line1, and column1, with no attached note.
-
-
-
Method Detail
-
offset
public long offset()
Returns the zero-based byte offset of this position.
-
line
public int line()
Returns the one-based line number of this position.
-
column
public int column()
Returns the one-based column number of this position.
-
note
public String note()
Returns the note attached to the marked position, ornullif this position has no attached note.
-
min
public Mark min(Mark that)
Returnsthisposition, if its byte offset is less than or equal tothatposition; otherwise returnsthatposition.
-
max
public Mark max(Mark that)
Returnsthisposition, if its byte offset is greater than or equal tothatposition; otherwise returnsthatposition.
-
start
public Mark start()
Description copied from class:TagReturns the first source position covered by thisTag.
-
end
public Mark end()
Description copied from class:TagReturns the last source position covered by thisTag.
-
union
public Tag union(Tag other)
Description copied from class:TagReturns aTagthat includes all source locations covered by both this tag, and someothertag.
-
shift
public Mark shift(Mark mark)
Description copied from class:TagReturns the position of thisTagrelative to the givenmark.
-
compareTo
public int compareTo(Mark that)
- Specified by:
compareToin interfaceComparable<Mark>
-
display
public <T> Output<T> display(Output<T> output)
Description copied from interface:DisplayWrites a human readable, display-formatted string representation of this object tooutput.
-
debug
public <T> Output<T> debug(Output<T> output)
Description copied from interface:DebugWrites a developer readable, debug-formatted string representation of this object tooutput.
-
zero
public static Mark zero()
Returns aMarkat byte offset0, line1, and column1, with no attached note.
-
at
public static Mark at(long offset, int line, int column, String note)
Returns a newMarkat the given zero-based byteoffset, one-basedlinenumber, and one-basedcolumnnumber, with the attachednote.
-
at
public static Mark at(long offset, int line, int column)
Returns a newMarkat the given zero-based byteoffset, one-basedlinenumber, and one-basedcolumnnumber, with no attached note.
-
-