Class StoredIndexedBipartiteSet

  • Direct Known Subclasses:
    StoredIndexedBipartiteSetWithOffset

    public class StoredIndexedBipartiteSet
    extends Object
    A stored list dedicated to positive integers and three operations : - iteration - removal of an element - check if an element is or not within the list It only requires a StoredInt to denote the first element of the list and proceeds by swapping element with the first one to remove them and incrementing the index of the first element. IT DOES NOT PRESERVE THE ORDER OF THE LIST
    • Field Detail

      • list

        protected int[] list
        The list of values
      • position

        protected int[] position
        The position of each element within the list. indexes[3] = k <=> list[k] = 3 we assume that elements ranges from 0 ... list.lenght in other words the elements must be indexed.
      • idxToObjects

        protected IndexedObject[] idxToObjects
        If objects are added to the list, a mapping from their indexes is needed. idxToObjects[i] = o <=> o.getObjectIdx() == i
      • last

        protected IStateInt last
        The first element of the list
    • Constructor Detail

      • StoredIndexedBipartiteSet

        public StoredIndexedBipartiteSet​(IEnvironment environment,
                                         int[] values)
        Parameters:
        environment - the environment
        values - a set of DIFFERENT positive integer values !
    • Method Detail

      • buildList

        public void buildList​(IEnvironment environment,
                              int[] values)
      • size

        public final int size()
      • isEmpty

        public final boolean isEmpty()
      • remove

        public void remove​(int object)
      • contains

        public boolean contains​(int object)
      • pretty

        public final String pretty()
      • _getStructure

        public final int[] _getStructure()
        DO NOT USE : FOR MEMORY OPTIM ONLY