inpro.nlu
Class AVPair

java.lang.Object
  extended by inpro.nlu.AVPair

public class AVPair
extends java.lang.Object

A simple attribute-value pair. Attributes are always strings, values can be any object.

Author:
okko

Field Summary
private  java.lang.String attribute
          Attribute and values
private  java.lang.Object value
           
 
Constructor Summary
AVPair(AVPair avp)
          Copy constructor
AVPair(java.lang.String attval)
          Handles interfacing AVM construction/unification Convenience constructor to create AVPair from one string, where A and V are separated by a colon, like "size:big" or from attribute-value input for more complex AVMs.
AVPair(java.lang.String attribute, java.lang.Object value)
          Constructor building AVPair from attribute String and Object value
AVPair(java.lang.String attribute, java.lang.String value)
          Constructor building AVPair from two strings for attribute and value
 
Method Summary
 void clearValue()
          Clears this AVPair's value
 boolean equals(java.lang.Object o)
          Compares this AVPair to another
 boolean equals(java.lang.String string)
          Checks if this AVP matches a string representation
 java.lang.String getAttribute()
           
 java.lang.Object getValue()
          Gets this AVPair's value
 int hashCode()
           
 void setValue(java.lang.Object value)
          Sets this AVPair's value
 java.lang.String toString()
          Builds a string representation of this AVPair in the form of "attribute : value".
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

attribute

private final java.lang.String attribute
Attribute and values


value

private java.lang.Object value
Constructor Detail

AVPair

public AVPair(java.lang.String attribute,
              java.lang.String value)
Constructor building AVPair from two strings for attribute and value


AVPair

public AVPair(java.lang.String attribute,
              java.lang.Object value)
Constructor building AVPair from attribute String and Object value


AVPair

public AVPair(AVPair avp)
Copy constructor

Parameters:
avp - to copy

AVPair

public AVPair(java.lang.String attval)
Handles interfacing AVM construction/unification Convenience constructor to create AVPair from one string, where A and V are separated by a colon, like "size:big" or from attribute-value input for more complex AVMs.

Method Detail

getAttribute

public java.lang.String getAttribute()

getValue

public java.lang.Object getValue()
Gets this AVPair's value

Returns:
this avp's value

setValue

public void setValue(java.lang.Object value)
Sets this AVPair's value

Parameters:
value -

clearValue

public void clearValue()
Clears this AVPair's value


toString

public java.lang.String toString()
Builds a string representation of this AVPair in the form of "attribute : value".

Overrides:
toString in class java.lang.Object
Returns:
this avp's string rep

equals

public boolean equals(java.lang.Object o)
Compares this AVPair to another

Overrides:
equals in class java.lang.Object
Parameters:
avp - the AVPair to compare to
Returns:
true if they have the same attribute and value, else false

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(java.lang.String string)
Checks if this AVP matches a string representation

Parameters:
string - the string to compare to
Returns:
true if this AVPair's string representation matches the string.