Class LongAttribute<T extends KeyedObject>


  • public class LongAttribute<T extends KeyedObject>
    extends Attribute<T>
    This class provides a storage mechanism for long-valued information about the elements of a KeyIndexableSet, e.g. the vertices of a DirectedGraph.
    • Constructor Detail

      • LongAttribute

        public LongAttribute​(java.lang.String name,
                             KeyIndexableSet<T> set)
        Constructor.
        Parameters:
        name - The name used to identify this attribute.
        set - The KeyIndexableSet whose elements can be assigned a value within this attribute.
    • Method Detail

      • setValue

        public void setValue​(KeyedObject o,
                             long value)
        Set the value of this attribute for the specified KeyedObject.
        Parameters:
        o - The KeyedObject that is assigned the value. Should be a member of the owningSet.
        value - The value to associate with the specified KeyedObject.
      • getValue

        public long getValue​(KeyedObject o)
                      throws NoValueException
        Return the value associated to the specified KeyedObject.
        Throws:
        NoValueException - if the value has not been set or the KeyedObject does not belong to the owningSet.
      • toSortedArray

        public KeyedObject[] toSortedArray()
        Returns the elements of the owningSet sorted by their values of this Attribute.
      • toSortedArray

        public KeyedObject[] toSortedArray​(KeyedObject[] keyedObjects)
        Sorts the array of keyedObjects by their values of this Attribute.
      • attributeType

        public java.lang.String attributeType()
        Return the type of Attribute, i.e. what kind of values does this attribute hold. "Long", "Object", "Double" are examples.
        Specified by:
        attributeType in class Attribute<T extends KeyedObject>
      • clear

        public void clear()
        Removes all assigned values of this attribute.
        Specified by:
        clear in class Attribute<T extends KeyedObject>