Module swim.codec
Package swim.codec

Class Span

All Implemented Interfaces:
Debug, Display

public final class Span extends Tag
Description of a source range, identified by a closed interval between start and end marks.
  • Method Summary

    Modifier and Type
    Method
    Description
    <T> Output<T>
    debug(Output<T> output)
    Writes a developer readable, debug-formatted string representation of this object to output.
    <T> Output<T>
    display(Output<T> output)
    Writes a human readable, display-formatted string representation of this object to output.
    end()
    Returns the last source position covered by this Tag.
    boolean
    equals(Object other)
     
    static Span
    from(Mark start, Mark end)
    Returns a new Span representing the closed interval between the given start and end marks.
    int
     
    shift(Mark mark)
    Returns the position of this Tag relative to the given mark.
    Returns the first source position covered by this Tag.
     
    union(Tag other)
    Returns a Tag that includes all source locations covered by both this tag, and some other tag.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Method Details

    • start

      public Mark start()
      Description copied from class: Tag
      Returns the first source position covered by this Tag.
      Specified by:
      start in class Tag
    • end

      public Mark end()
      Description copied from class: Tag
      Returns the last source position covered by this Tag.
      Specified by:
      end in class Tag
    • union

      public Tag union(Tag other)
      Description copied from class: Tag
      Returns a Tag that includes all source locations covered by both this tag, and some other tag.
      Specified by:
      union in class Tag
    • shift

      public Span shift(Mark mark)
      Description copied from class: Tag
      Returns the position of this Tag relative to the given mark.
      Specified by:
      shift in class Tag
    • equals

      public boolean equals(Object other)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • display

      public <T> Output<T> display(Output<T> output)
      Description copied from interface: Display
      Writes a human readable, display-formatted string representation of this object to output.
      Returns:
      the continuation of the output.
    • debug

      public <T> Output<T> debug(Output<T> output)
      Description copied from interface: Debug
      Writes a developer readable, debug-formatted string representation of this object to output.
      Returns:
      the continuation of the output.
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • from

      public static Span from(Mark start, Mark end)
      Returns a new Span representing the closed interval between the given start and end marks.