Package com.netrics.likeit

## Class NetricsBaseRecord

- java.lang.Object
- - com.netrics.likeit.NetricsBaseRecord

- All Implemented Interfaces:
    `java.io.Serializable`
  Direct Known Subclasses:
    `NetricsCompoundRecord`, `NetricsRecord`

      public abstract class NetricsBaseRecord
      extends java.lang.Object
      implements java.io.Serializable

  This is the base class for all types of records used in the ibi™ Patterns - Search interface. Records can be single table records (@see NetricsRecord) or compound records (@see NetricsCompoundRecord) consisting of a parent record and one or more child records. If a single table record is required the NetricsRecord class should be used. If compound records are required the NetricsCompoundRecord class should be used. If a method handles either type of record this class should be used. In general only generic utilities or applications that simply pass data through should use this base class.

  This class contains the implementation for the common properties of all record types. All records have field structure. The field structure in the record must match the field structure of the table it is loaded into.

  See Also:
    Serialized Form

- - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `java.lang.String` | `compare​(NetricsBaseRecord rec)` | Compare two records.
    `java.lang.String` | `getAttribute​(java.lang.String attr_name)` | Gets the specified attribute value of the record.
    `java.lang.String[]` | `getAttrNames()` | Returns the names of name/value attributes of the record.
    `java.lang.String[]` | `getAttrValues()` | Returns the values of name/value attributes of the record.
    `java.lang.String[]` | `getFields()` | Gets the field values of the record.
    `java.lang.String` | `getKey()` | Retrieve the record key of a record.
    `java.lang.String` | `getParentKey()` | Retrieve the parent key of a record.
    `int` | `numBytes()` | Return the number of bytes of data in this record.
    `java.lang.String` | `toString()` | Return a human readable string representation of the record.

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

      `equals, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Method Detail

    - #### getKey

          public java.lang.String getKey()

      Retrieve the record key of a record. This does not contain any parent record key if this is a child table.
      Returns:
        the record key

    - #### getParentKey

          public java.lang.String getParentKey()

      Retrieve the parent key of a record. If this is not a child record this returns null.
      Returns:
        the parent key

    - #### numBytes

          public int numBytes()

      Return the number of bytes of data in this record.
      Returns:
        the number of bytes of data in this record.

    - #### getFields

          public java.lang.String[] getFields()

      Gets the field values of the record.
      Returns:
        the content of the record returned by a tbldump.

    - #### getAttrNames

          public java.lang.String[] getAttrNames()

      Returns the names of name/value attributes of the record.

      This assumes the last field of the record contains the encoded attribute values and attempts to decode them. If the decode fails it returns null, otherwise it returns the list of attribute names in the order they appeared in the record.

      Returns:
        null if no attributes in this record, array of attribute names otherwise.

    - #### getAttrValues

          public java.lang.String[] getAttrValues()

      Returns the values of name/value attributes of the record.

      This assumes the last field of the record contains the encoded attribute values and attempts to decode them. If the decode fails it returns null, otherwise if returns the list of attribute values in the order they appeared in the record.

      Returns:
        null if no attributes in this record, array of attribute values otherwise.

    - #### getAttribute

          public java.lang.String getAttribute​(java.lang.String attr_name)

      Gets the specified attribute value of the record.

      This assumes the last field of the record contains the encoded attribute values and attempts to decode them. If the decode fails it returns null, otherwise it attempts to retrieve the named attribute, returning the value if found, null if not.

      Parameters:
        `attr_name` - Name of the attribute to retrieve.
      Returns:
        attribute value for given name if it exists, null otherwise.

    - #### compare

          public java.lang.String compare​(NetricsBaseRecord rec)

      Compare two records. This is intended for internal use by the interface.
      Parameters:
        `rec` - the record to compare to
      Returns:
        null if the records are identical, description of difference otherwise.

    - #### toString

          public java.lang.String toString()

      Return a human readable string representation of the record. This returns a string version of the record. The format is a single CSV format record where the first field is the record key, the second field is the parent key, and the following fields are are the data fields of the record, including the string encoded attributes field if the record contains attributes. All values are double quoted unless the value was null, in which case the value is the empty string with no double quotes.
      Overrides:
        `toString` in class `java.lang.Object`
      Returns:
        this string representation as described above.