Class DefaultPropertyMap

  • All Implemented Interfaces:
    PropertyMap
    Direct Known Subclasses:
    DefaultIntPropertyMap, DefaultLongPropertyMap, DefaultObjectPropertyMap, DefaultSettingsPropertyMap, DefaultStringPropertyMap, DefaultVoidPropertyMap

    public abstract class DefaultPropertyMap
    extends java.lang.Object
    implements PropertyMap
    PropertyMap is used to store values for a fixed property at address locations given as longs. The values for the property must be homogeneous, i.e. all have the same type, and are determined by which subclass of PropertyMap is instantiated. For any long the property manager can be used to tell if the property exists there and what its value is. It also maintains information that allows it to efficiently search for the next and previous occurrence of the property relative to a given address. The subclass provides the createPage() method that dictates the type of PropertyPage that will be managed.
    • Field Detail

      • description

        protected java.lang.String description
    • Constructor Detail

      • DefaultPropertyMap

        public DefaultPropertyMap​(PropertySet propertyMgr)
        Construct a PropertyMap
        Parameters:
        propertyMgr - property manager that manages storage of properties
    • Method Detail

      • getName

        public java.lang.String getName()
        Get the name for this property manager.
        Specified by:
        getName in interface PropertyMap
      • setDescription

        public void setDescription​(java.lang.String description)
        Set the description for this property.
        Parameters:
        description - property description
      • getDescription

        public java.lang.String getDescription()
        Return the property description.
        Returns:
        the property description
      • intersects

        public boolean intersects​(Address start,
                                  Address end)
        Given two addresses, indicate whether there is an address in that range (inclusive) having the property.

        Specified by:
        intersects in interface PropertyMap
        Parameters:
        start - the start of the range.
        end - the end of the range.
        Returns:
        boolean true if at least one address in the range has the property, false otherwise.
      • intersects

        public boolean intersects​(AddressSetView set)
        Description copied from interface: PropertyMap
        Indicate whether there is an address within the set which exists within this map.

        Specified by:
        intersects in interface PropertyMap
        Parameters:
        set - set of addresses
        Returns:
        boolean true if at least one address in the set has the property, false otherwise.
      • removeRange

        public boolean removeRange​(Address start,
                                   Address end)
        Removes all property values within a given range.
        Specified by:
        removeRange in interface PropertyMap
        Parameters:
        start - begin range
        end - end range, inclusive
        Returns:
        true if any property value was removed; return false otherwise.
      • remove

        public boolean remove​(Address addr)
        Remove the property value at the given address.
        Specified by:
        remove in interface PropertyMap
        Parameters:
        addr - the address where the property should be removed
        Returns:
        true if the property value was removed, false otherwise.
      • hasProperty

        public boolean hasProperty​(Address addr)
        returns whether there is a property value at addr.
        Specified by:
        hasProperty in interface PropertyMap
        Parameters:
        addr - the address in question
      • getNextPropertyAddress

        public Address getNextPropertyAddress​(Address addr)
        Get the next address where the property value exists.
        Specified by:
        getNextPropertyAddress in interface PropertyMap
        Parameters:
        addr - the address from which to begin the search (exclusive).
      • getPreviousPropertyAddress

        public Address getPreviousPropertyAddress​(Address addr)
        Get the previous Address where a property value exists.
        Specified by:
        getPreviousPropertyAddress in interface PropertyMap
        Parameters:
        addr - the address from which to begin the search (exclusive).
      • getSize

        public int getSize()
        Get the number of properties in the map.
        Specified by:
        getSize in interface PropertyMap
      • getPropertyIterator

        public AddressIterator getPropertyIterator​(Address start,
                                                   Address end)
        Returns an iterator over addresses that have a property value within the given address range.
        Specified by:
        getPropertyIterator in interface PropertyMap
        Parameters:
        start - the first address in the range.
        end - the last address in the range.
        Throws:
        TypeMismatchException - thrown if the property does not have values of type Object.
      • getPropertyIterator

        public AddressIterator getPropertyIterator​(AddressSetView asv)
        Returns an iterator over the addresses that have a property value and are in the given address set.
        Specified by:
        getPropertyIterator in interface PropertyMap
        Parameters:
        asv - the set of addresses to iterate over.
      • saveProperties

        public void saveProperties​(java.io.ObjectOutputStream oos,
                                   Address start,
                                   Address end)
                            throws java.io.IOException
        Save the properties in the given range to output stream.
        Parameters:
        oos - output stream to write to
        start - start address in the range
        end - end address in the range
        Throws:
        java.io.IOException - if there a problem doing the write
      • restoreProperties

        public void restoreProperties​(java.io.ObjectInputStream ois)
                               throws java.io.IOException,
                                      java.lang.ClassNotFoundException
        Restore properties from the given input stream.
        Parameters:
        ois - input stream
        Throws:
        java.io.IOException - if there is a problem reading from the stream
        java.lang.ClassNotFoundException - if the class for the object being read is not in the class path