ObjectIdentifierValue (Mibble 2.9.4 Documentation)
Date: 2016-09-27

net.percederberg.mibble.value

## Class ObjectIdentifierValue

- java.lang.Object
- - net.percederberg.mibble.MibValue
  - - net.percederberg.mibble.value.ObjectIdentifierValue

- All Implemented Interfaces:
    java.lang.Comparable

      public class ObjectIdentifierValue
      extends MibValue

  An object identifier value. This class stores the component identifier values in a tree hierarchy.
  Since:
    2.0

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `ObjectIdentifierValue(FileLocation location, ObjectIdentifierValue parent, java.lang.String name, int value)` Creates a new object identifier value.
    `ObjectIdentifierValue(FileLocation location, ValueReference parent, java.lang.String name, int value)` Creates a new object identifier value.
    `ObjectIdentifierValue(java.lang.String name, int value)` Creates a new root object identifier value.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected void` | `clear()` Clears and prepares this value for garbage collection.
    `int` | `compareTo(java.lang.Object obj)` Compares this object with the specified object for order.
    `MibValue` | `createReference()` Creates a value reference to this value.
    `boolean` | `equals(java.lang.Object obj)` Checks if this object equals another object.
    `ObjectIdentifierValue[]` | `getAllChildren()` Returns an array of all child object identifier values.
    `ObjectIdentifierValue` | `getChild(int index)` Returns a child object identifier value.
    `ObjectIdentifierValue` | `getChildByName(java.lang.String name)` Returns a child object identifier value.
    `ObjectIdentifierValue` | `getChildByValue(int value)` Returns a child object identifier value.
    `int` | `getChildCount()` Returns the number of child object identifier values.
    `java.lang.String` | `getName()` Returns this object identifier component name.
    `ObjectIdentifierValue` | `getParent()` Returns the parent object identifier value.
    `MibValueSymbol` | `getSymbol()` Returns the symbol connected to this object identifier.
    `int` | `getValue()` Returns this object identifier component value.
    `int` | `hashCode()` Returns a hash code for this object.
    `MibValue` | `initialize(MibLoaderLog log, MibType type)` Initializes the MIB value.
    `void` | `setSymbol(MibValueSymbol symbol)` Sets the symbol connected to this object identifier.
    `java.lang.String` | `toAsn1String()` Returns an ASN.1 representation of this value.
    `java.lang.String` | `toDetailString()` Returns a detailed string representation of this value.
    `java.lang.Object` | `toObject()` Returns a string representation of this value.
    `java.lang.String` | `toString()` Returns a string representation of this value.

    - ### Methods inherited from class net.percederberg.mibble.MibValue

      `getReferenceSymbol, isReferenceTo, isReferenceTo, setReferenceSymbol`

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

      `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### ObjectIdentifierValue

          public ObjectIdentifierValue(java.lang.String name,
                                       int value)

      Creates a new root object identifier value.
      Parameters:
        `name` - the component name, or null
        `value` - the component value

    - #### ObjectIdentifierValue

          public ObjectIdentifierValue(FileLocation location,
                                       ObjectIdentifierValue parent,
                                       java.lang.String name,
                                       int value)
                                throws MibException

      Creates a new object identifier value.
      Parameters:
        `location` - the declaration file location
        `parent` - the component parent
        `name` - the component name, or null
        `value` - the component value
      Throws:
        `MibException` - if the object identifier parent already had a child with the specified value

    - #### ObjectIdentifierValue

          public ObjectIdentifierValue(FileLocation location,
                                       ValueReference parent,
                                       java.lang.String name,
                                       int value)

      Creates a new object identifier value.
      Parameters:
        `location` - the declaration file location
        `parent` - the component parent
        `name` - the component name, or null
        `value` - the component value

  - ### Method Detail

    - #### initialize

          public MibValue initialize(MibLoaderLog log,
                                     MibType type)
                              throws MibException

      Initializes the MIB value. This will remove all levels of indirection present, such as references to other values. No value information is lost by this operation. This method may modify this object as a side-effect, and will return the basic value.

      NOTE: This is an internal method that should only be called by the MIB loader.

      Specified by:
        `initialize` in class `MibValue`
      Parameters:
        `log` - the MIB loader log
        `type` - the value type
      Returns:
        the basic MIB value
      Throws:
        `MibException` - if an error was encountered during the initialization

    - #### createReference

          public MibValue createReference()

      Creates a value reference to this value. The value reference is normally an identical value. Only certain values support being referenced, and the default implementation of this method throws an exception.

      NOTE: This is an internal method that should only be called by the MIB loader.

      Overrides:
        `createReference` in class `MibValue`
      Returns:
        the MIB value reference
      Since:
        2.2

    - #### clear

          protected void clear()

      Clears and prepares this value for garbage collection. This method will recursively clear any associated types or values, making sure that no data structures references this object.

      NOTE: This is an internal method that should only be called by the MIB loader.

      Overrides:
        `clear` in class `MibValue`

    - #### compareTo

          public int compareTo(java.lang.Object obj)

      Compares this object with the specified object for order. This method will only compare the string representations with each other.
      Parameters:
        `obj` - the object to compare to
      Returns:
        less than zero if this object is less than the specified, zero if the objects are equal, or greater than zero otherwise
      Since:
        2.6

    - #### equals

          public boolean equals(java.lang.Object obj)

      Checks if this object equals another object. This method will compare the string representations for equality.
      Overrides:
        `equals` in class `java.lang.Object`
      Parameters:
        `obj` - the object to compare with
      Returns:
        true if the objects are equal, or false otherwise

    - #### hashCode

          public int hashCode()

      Returns a hash code for this object.
      Overrides:
        `hashCode` in class `java.lang.Object`
      Returns:
        a hash code for this object

    - #### getParent

          public ObjectIdentifierValue getParent()

      Returns the parent object identifier value.
      Returns:
        the parent object identifier value, or null if no parent exists

    - #### getName

          public java.lang.String getName()

      Returns this object identifier component name.
      Overrides:
        `getName` in class `MibValue`
      Returns:
        the object identifier component name, or null if the component has no name

    - #### getValue

          public int getValue()

      Returns this object identifier component value.
      Returns:
        the object identifier component value

    - #### getSymbol

          public MibValueSymbol getSymbol()

      Returns the symbol connected to this object identifier.
      Returns:
        the symbol connected to this object identifier, or null if no value symbol is connected

    - #### setSymbol

          public void setSymbol(MibValueSymbol symbol)

      Sets the symbol connected to this object identifier.

      NOTE: This is an internal method that should only be called by the MIB loader.

      Parameters:
        `symbol` - the value symbol

    - #### getChildCount

          public int getChildCount()

      Returns the number of child object identifier values.
      Returns:
        the number of child object identifier values

    - #### getChild

          public ObjectIdentifierValue getChild(int index)

      Returns a child object identifier value. The children are ordered by their value, not necessarily in the order in which they appear in the original MIB file.
      Parameters:
        `index` - the child position, starting from 0
      Returns:
        the child object identifier value, or null if not found

    - #### getChildByName

          public ObjectIdentifierValue getChildByName(java.lang.String name)

      Returns a child object identifier value. The children are searched by their component names. This method uses linear search and therefore has time complexity O(n). Note that most OID:s don't have a component name, but only an associated symbol.
      Parameters:
        `name` - the child name
      Returns:
        the child object identifier value, or null if not found
      Since:
        2.5

    - #### getChildByValue

          public ObjectIdentifierValue getChildByValue(int value)

      Returns a child object identifier value. The children are searched by their numerical value. This method uses binary search and therefore has time complexity O(log(n)).
      Parameters:
        `value` - the child value
      Returns:
        the child object identifier value, or null if not found
      Since:
        2.5

    - #### getAllChildren

          public ObjectIdentifierValue[] getAllChildren()

      Returns an array of all child object identifier values. The children are ordered by their value, not necessarily in the order in which they appear in the original MIB file.
      Returns:
        the child object identifier values
      Since:
        2.3

    - #### toObject

          public java.lang.Object toObject()

      Returns a string representation of this value. The string will contain the full numeric object identifier value with each component separated with a dot ('.').
      Specified by:
        `toObject` in class `MibValue`
      Returns:
        a string representation of this value

    - #### toString

          public java.lang.String toString()

      Returns a string representation of this value. The string will contain the full numeric object identifier value with each component separated with a dot ('.').
      Overrides:
        `toString` in class `java.lang.Object`
      Returns:
        a string representation of this value

    - #### toDetailString

          public java.lang.String toDetailString()

      Returns a detailed string representation of this value. The string will contain the full numeric object identifier value with optional names for each component.
      Returns:
        a detailed string representation of this value

    - #### toAsn1String

          public java.lang.String toAsn1String()

      Returns an ASN.1 representation of this value. The string will contain references to any parent OID value that can be found.
      Returns:
        an ASN.1 representation of this value
      Since:
        2.6