Package snap.util

Class ListSel

java.lang.Object
snap.util.ListSel
All Implemented Interfaces:
Cloneable

public class ListSel extends Object implements Cloneable
Represents a selection for a List.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final ListSel
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    ListSel(int anch, int lead)
    Constructor.
  • Method Summary

    Modifier and Type
    Method
    Description
    protected ListSel
    Standard clone implementation.
    copyForMaxSize(int aSize)
    Returns a ListSel with anything above max trimmed.
    copyForMetaAdd(int anch, int lead)
    Returns a copy of this ListSel resulting from 'Meta-adding' new selection (short-cut key is down).
    copyForShiftAdd(int anch, int lead)
    Returns a copy of this ListSel resulting from 'Shift-adding' new selection (shift key is down).
    Returns a ListSel guaranteed to have no more than one selection.
    boolean
    Standard equals implementation.
    int
    Returns the anchor.
    static int[]
    Returns the changed indexes for two ListSels.
    int[]
    Returns the selected indexes.
    int
    Returns the lead.
    int
    Return the max.
    int
    Return the min.
    Returns the selection encompassing all.
    static ListSel
    getSelForIndexArray(int[] theIndexes)
    Returns a ListSel for array of indexes.
    Returns the tail selection.
    int
    Standard hashCode implementation.
    boolean
    Returns whether the selection is empty.
    boolean
    isSel(int anIndex)
    Returns whether given index is selected.
    Standard toString implementation.

    Methods inherited from class java.lang.Object

    finalize, getClass, notify, notifyAll, wait, wait, wait
  • Field Details

    • EMPTY

      public static final ListSel EMPTY
  • Constructor Details

    • ListSel

      public ListSel(int anch, int lead)
      Constructor.
  • Method Details

    • isEmpty

      public boolean isEmpty()
      Returns whether the selection is empty.
    • isSel

      public boolean isSel(int anIndex)
      Returns whether given index is selected.
    • getAnchor

      public int getAnchor()
      Returns the anchor.
    • getLead

      public int getLead()
      Returns the lead.
    • getMin

      public int getMin()
      Return the min.
    • getMax

      public int getMax()
      Return the max.
    • getSelAll

      public ListSel getSelAll()
      Returns the selection encompassing all.
    • getTail

      public ListSel getTail()
      Returns the tail selection.
    • getIndexes

      public int[] getIndexes()
      Returns the selected indexes.
    • copyForSingleSel

      public ListSel copyForSingleSel()
      Returns a ListSel guaranteed to have no more than one selection.
    • copyForShiftAdd

      public ListSel copyForShiftAdd(int anch, int lead)
      Returns a copy of this ListSel resulting from 'Shift-adding' new selection (shift key is down).
    • copyForMetaAdd

      public ListSel copyForMetaAdd(int anch, int lead)
      Returns a copy of this ListSel resulting from 'Meta-adding' new selection (short-cut key is down).
    • copyForMaxSize

      public ListSel copyForMaxSize(int aSize)
      Returns a ListSel with anything above max trimmed.
    • clone

      protected ListSel clone()
      Standard clone implementation.
      Overrides:
      clone in class Object
    • hashCode

      public int hashCode()
      Standard hashCode implementation.
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object o)
      Standard equals implementation.
      Overrides:
      equals in class Object
    • toString

      public String toString()
      Standard toString implementation.
      Overrides:
      toString in class Object
    • getSelForIndexArray

      public static ListSel getSelForIndexArray(int[] theIndexes)
      Returns a ListSel for array of indexes.
    • getChangedIndexes

      public static int[] getChangedIndexes(ListSel aSel1, ListSel aSel2)
      Returns the changed indexes for two ListSels.