Class SaveableObjectPropertySet

  • All Implemented Interfaces:
    java.io.Serializable

    public class SaveableObjectPropertySet
    extends PropertySet
    Handles general storage and retrieval of saveable objects indexed by long keys.
    See Also:
    Serialized Form
    • Constructor Detail

      • SaveableObjectPropertySet

        public SaveableObjectPropertySet​(java.lang.String name,
                                         java.lang.Class<?> objectClass)
        Constructor for SaveableObjectPropertySet.
        Parameters:
        name - the name associated with this property set.
    • Method Detail

      • getDataSize

        public int getDataSize()
        Description copied from class: PropertySet
        Returns the size (in bytes) of the data that is stored in this property set.
        Specified by:
        getDataSize in class PropertySet
        Returns:
        the size (in bytes) of the data that is stored in this property set.
        See Also:
        PropertySet.getDataSize()
      • putObject

        public void putObject​(long index,
                              Saveable value)
        Stores a saveable object at the given index. Any object currently at that index will be replaced by the new object.
        Parameters:
        index - the index at which to store the saveable object.
        value - the saveable object to store.
      • getObject

        public Saveable getObject​(long index)
        Retrieves the saveable object stored at the given index.
        Parameters:
        index - the index at which to retrieve the saveable object.
        Returns:
        the saveable object stored at the given index or null if no object is stored at the index.
      • moveIndex

        protected void moveIndex​(long from,
                                 long to)
        Specified by:
        moveIndex in class PropertySet
      • saveProperty

        protected void saveProperty​(java.io.ObjectOutputStream oos,
                                    long index)
                             throws java.io.IOException
        saves the property at the given index to the given output stream.
        Specified by:
        saveProperty in class PropertySet
        Throws:
        java.io.IOException
      • restoreProperty

        protected void restoreProperty​(java.io.ObjectInputStream ois,
                                       long index)
                                throws java.io.IOException,
                                       java.lang.ClassNotFoundException
        restores the property from the input stream to the given index.
        Specified by:
        restoreProperty in class PropertySet
        Throws:
        java.io.IOException
        java.lang.ClassNotFoundException
      • applyValue

        public void applyValue​(PropertyVisitor visitor,
                               long addr)
        Description copied from class: PropertySet
        Based upon the type of property manager that this is, the appropriate visit() method will be called within the PropertyVisitor.
        Specified by:
        applyValue in class PropertySet
        Parameters:
        visitor - object implementing the PropertyVisitor interface.
        addr - the address of where to visit (get) the property.
        See Also:
        PropertySet.applyValue(PropertyVisitor, long)