Class ThreeValuedBitSet


  • public final class ThreeValuedBitSet
    extends java.lang.Object
    Inspired by BitSet but with three values.
    Author:
    Mathias Hofer
    • Constructor Summary

      Constructors 
      Constructor Description
      ThreeValuedBitSet​(int size)
      Creates a new bitset with the specified size and all values undefined.
    • Method Summary

      Modifier and Type Method Description
      boolean allTrue()  
      void clear​(int index)
      Sets the value at position to undecided resp.
      java.lang.Boolean get​(int i)  
      java.lang.Boolean increment​(int i)
      Increments the value at the specified position.
      void set​(int i, java.lang.Boolean value)  
      int size()  
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • ThreeValuedBitSet

        public ThreeValuedBitSet​(int size)
        Creates a new bitset with the specified size and all values undefined.
        Parameters:
        size - the fixed size of the bitset
    • Method Detail

      • increment

        public java.lang.Boolean increment​(int i)
        Increments the value at the specified position. If the value is already true, it resets the current position and increments the one at i + 1.

        The order of the values is Undefined < False < True.

        Parameters:
        i - the position
        Returns:
        the new value at position i
      • get

        public java.lang.Boolean get​(int i)
      • set

        public void set​(int i,
                        java.lang.Boolean value)
      • allTrue

        public boolean allTrue()
      • clear

        public void clear​(int index)
        Sets the value at position to undecided resp. null
        Parameters:
        index - the index of the bit to clear
      • size

        public int size()
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object