Class SelectionRange


  • @Immutable
    public class SelectionRange
    extends java.lang.Object
    Selection range is selection between two positions where begin represents origin point and end of the selection can be before or after begin.
    • Constructor Summary

      Constructors 
      Constructor Description
      SelectionRange()
      Creates empty selection range.
      SelectionRange​(long start, long end)
      Creates selection range from start to end including the start and not including the end position.
      SelectionRange​(SelectionRange selectionRange)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean equals​(java.lang.Object obj)  
      long getEnd()  
      long getFirst()
      Returns first data position of the selection.
      long getLast()
      Returns last data position of the selection.
      long getLength()
      Returns length of the selected area.
      long getStart()  
      int hashCode()  
      boolean isEmpty()
      Returns true if selection is empty.
      boolean isInSelection​(long position)
      Checks if position belongs to this selection.
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • SelectionRange

        public SelectionRange()
        Creates empty selection range.
      • SelectionRange

        public SelectionRange​(@Nullable
                              SelectionRange selectionRange)
      • SelectionRange

        public SelectionRange​(long start,
                              long end)
        Creates selection range from start to end including the start and not including the end position.
        Parameters:
        start - selection start position
        end - selection end position without actual end position itself
    • Method Detail

      • getStart

        public long getStart()
      • getEnd

        public long getEnd()
      • getFirst

        public long getFirst()
        Returns first data position of the selection.
        Returns:
        data position
      • getLast

        public long getLast()
        Returns last data position of the selection.
        Returns:
        data position
      • getLength

        public long getLength()
        Returns length of the selected area.
        Returns:
        length in bytes
      • isEmpty

        public boolean isEmpty()
        Returns true if selection is empty.
        Returns:
        true if selection is empty
      • isInSelection

        public boolean isInSelection​(long position)
        Checks if position belongs to this selection.
        Parameters:
        position - position
        Returns:
        true if position belongs to current selection range.
      • equals

        public boolean equals​(@Nullable
                              java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object