Class ArrayStateImage


  • public class ArrayStateImage
    extends java.lang.Object
    Utilities for dealing with a simple state image consisting of an Object[] of field values with one extra index containing a BitSet of loaded fields. This simplistic state image might be used for optimistic versioning.
    Author:
    Abe White
    • Constructor Summary

      Constructors 
      Constructor Description
      ArrayStateImage()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.Object[] clone​(java.lang.Object[] state)
      Clone a state array.
      static java.util.BitSet getLoaded​(java.lang.Object[] state)
      Get the loaded mask from a state image.
      static boolean isImage​(java.lang.Object obj)
      Return true if the given version object appears to be an array state image.
      static java.lang.Object[] newImage​(int numFields)
      Create a new state image for the given number of fields.
      static boolean sameVersion​(java.lang.Object[] state1, java.lang.Object[] state2)
      Return whether the given images are equivalent from an optimistic locking perspective.
      static void setLoaded​(java.lang.Object[] state, java.util.BitSet loaded)
      Set the loaded mask into a state image.
      • Methods inherited from class java.lang.Object

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

      • ArrayStateImage

        public ArrayStateImage()
    • Method Detail

      • newImage

        public static java.lang.Object[] newImage​(int numFields)
        Create a new state image for the given number of fields.
      • isImage

        public static boolean isImage​(java.lang.Object obj)
        Return true if the given version object appears to be an array state image.
      • getLoaded

        public static java.util.BitSet getLoaded​(java.lang.Object[] state)
        Get the loaded mask from a state image.
      • setLoaded

        public static void setLoaded​(java.lang.Object[] state,
                                     java.util.BitSet loaded)
        Set the loaded mask into a state image.
      • clone

        public static java.lang.Object[] clone​(java.lang.Object[] state)
        Clone a state array.
      • sameVersion

        public static boolean sameVersion​(java.lang.Object[] state1,
                                          java.lang.Object[] state2)
        Return whether the given images are equivalent from an optimistic locking perspective.