Class ObjectArrayMapping<T>

  • All Implemented Interfaces:
    OrdinalSetMapping<T>, java.lang.Iterable<T>

    public class ObjectArrayMapping<T>
    extends java.lang.Object
    implements OrdinalSetMapping<T>
    A bit set mapping based on an immutable object array. This is not terribly efficient, but is useful for prototyping.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int add​(java.lang.Object o)
      Add an Object to the set of mapped objects.
      int getMappedIndex​(java.lang.Object o)  
      T getMappedObject​(int n)  
      int getMaximumIndex()  
      int getSize()  
      boolean hasMappedIndex​(java.lang.Object o)  
      java.util.Iterator<T> iterator()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface java.lang.Iterable

        forEach, spliterator
    • Constructor Detail

      • ObjectArrayMapping

        public ObjectArrayMapping​(T[] array)
    • Method Detail

      • getMappedObject

        public T getMappedObject​(int n)
                          throws java.util.NoSuchElementException
        Specified by:
        getMappedObject in interface OrdinalSetMapping<T>
        Returns:
        the object numbered n.
        Throws:
        java.util.NoSuchElementException
      • getMappedIndex

        public int getMappedIndex​(java.lang.Object o)
        Specified by:
        getMappedIndex in interface OrdinalSetMapping<T>
        Returns:
        the number of a given object, or -1 if the object is not currently in the range.
      • hasMappedIndex

        public boolean hasMappedIndex​(java.lang.Object o)
        Specified by:
        hasMappedIndex in interface OrdinalSetMapping<T>
        Returns:
        whether the given object is mapped by this mapping
      • iterator

        public java.util.Iterator<T> iterator()
        Specified by:
        iterator in interface java.lang.Iterable<T>
      • getSize

        public int getSize()
        Specified by:
        getSize in interface OrdinalSetMapping<T>
        Returns:
        the current size of the bijection