Package ghidra.util.graph.attributes

# Class StringAttribute<T extends KeyedObject>

java.lang.Object
ghidra.util.graph.attributes.Attribute<T>
ghidra.util.graph.attributes.StringAttribute<T>

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

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `StringAttribute(String name, KeyIndexableSet<T> set)`
  Constructor.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `String`
  `attributeType()`
  Return the type of Attribute, i.e.
  `void`
  `clear()`
  Removes all assigned values of this attribute.
  `String`
  `getValue(KeyedObject o)`
  Return the value associated to the specied KeyedObject.
  `String`
  `getValueAsString(KeyedObject o)`
  Return the attribute of the specified KeyedObject as a String.
  `boolean`
  `setValue(T o, String value)`
  Set the value of this attribute for the specified KeyedObject.
  `KeyedObject[]`
  `toSortedArray()`
  Returns the elements of the owningSet sorted by their values of this Attribute.
  `KeyedObject[]`
  `toSortedArray(KeyedObject[] keyedObjects)`
  Sorts the array of keyedObjects by their values of this Attribute.

  ### Methods inherited from class ghidra.util.graph.attributes.Attribute

  `getModificationNumber, name, owningSet`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### StringAttribute

    public StringAttribute(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 Details

  - ### setValue

    public boolean setValue(T o, String 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.
    Returns:
      true if the value could be set. Return false if o is not a member of the owningSet.

  - ### getValue

    public String getValue(KeyedObject o)
    Return the value associated to the specied KeyedObject.

  - ### 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 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>`

  - ### getValueAsString

    public String getValueAsString(KeyedObject o)
    Return the attribute of the specified KeyedObject as a String.
    Specified by:
      `getValueAsString` in class `Attribute<T extends KeyedObject>`