gov.sandia.cognition.learning.data
Class DefaultValueDiscriminantPair<ValueType,DiscriminantType extends Comparable<? super DiscriminantType>>

java.lang.Object
  extended by gov.sandia.cognition.util.AbstractCloneableSerializable
      extended by gov.sandia.cognition.learning.data.AbstractValueDiscriminantPair<ValueType,DiscriminantType>
          extended by gov.sandia.cognition.learning.data.DefaultValueDiscriminantPair<ValueType,DiscriminantType>
Type Parameters:
ValueType - The general value stored in the pair.
DiscriminantType - The discriminant comparable object used for ordering objects.
All Implemented Interfaces:
ValueDiscriminantPair<ValueType,DiscriminantType>, CloneableSerializable, Pair<ValueType,DiscriminantType>, Serializable, Cloneable

public class DefaultValueDiscriminantPair<ValueType,DiscriminantType extends Comparable<? super DiscriminantType>>
extends AbstractValueDiscriminantPair<ValueType,DiscriminantType>

A default implementation of the ValueDiscriminantPair interface. Stores the value and discriminant values as fields.

Since:
3.1
Author:
Justin Basilico
See Also:
Serialized Form

Field Summary
protected  DiscriminantType discriminant
          The discriminant.
protected  ValueType value
          The value.
 
Constructor Summary
DefaultValueDiscriminantPair()
          Creates a new DefaultValueDiscriminantPair with null value and discriminant.
DefaultValueDiscriminantPair(ValueType value, DiscriminantType discriminant)
          Creates a new DefaultValueDiscriminantPair with the given value and discriminant.
 
Method Summary
 DefaultValueDiscriminantPair<ValueType,DiscriminantType> clone()
          This makes public the clone method on the Object class and removes the exception that it throws.
static
<ValueType,DiscriminantType extends Comparable<? super DiscriminantType>>
DefaultValueDiscriminantPair<ValueType,DiscriminantType>
create(ValueType value, DiscriminantType discriminant)
          Convenience method for creating a new DefaultValueDiscriminantPair with the given value and discriminant.
 DiscriminantType getDiscriminant()
          Gets the discriminant for ordering instances of the same value.
 ValueType getValue()
          Gets the value in the pair.
 void setDiscriminant(DiscriminantType discriminant)
          Sets the discriminant.
 void setValue(ValueType value)
          Sets the value.
 
Methods inherited from class gov.sandia.cognition.learning.data.AbstractValueDiscriminantPair
getFirst, getSecond
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

value

protected ValueType value
The value.


discriminant

protected DiscriminantType extends Comparable<? super DiscriminantType> discriminant
The discriminant.

Constructor Detail

DefaultValueDiscriminantPair

public DefaultValueDiscriminantPair()
Creates a new DefaultValueDiscriminantPair with null value and discriminant.


DefaultValueDiscriminantPair

public DefaultValueDiscriminantPair(ValueType value,
                                    DiscriminantType discriminant)
Creates a new DefaultValueDiscriminantPair with the given value and discriminant.

Parameters:
value - The value.
discriminant - The discriminant.
Method Detail

clone

public DefaultValueDiscriminantPair<ValueType,DiscriminantType> clone()
Description copied from class: AbstractCloneableSerializable
This makes public the clone method on the Object class and removes the exception that it throws. Its default behavior is to automatically create a clone of the exact type of object that the clone is called on and to copy all primitives but to keep all references, which means it is a shallow copy. Extensions of this class may want to override this method (but call super.clone() to implement a "smart copy". That is, to target the most common use case for creating a copy of the object. Because of the default behavior being a shallow copy, extending classes only need to handle fields that need to have a deeper copy (or those that need to be reset). Some of the methods in ObjectUtil may be helpful in implementing a custom clone method. Note: The contract of this method is that you must use super.clone() as the basis for your implementation.

Specified by:
clone in interface CloneableSerializable
Overrides:
clone in class AbstractCloneableSerializable
Returns:
A clone of this object.

getValue

public ValueType getValue()
Description copied from interface: ValueDiscriminantPair
Gets the value in the pair.

Returns:
The value in the pair.

setValue

public void setValue(ValueType value)
Sets the value.

Parameters:
value - The value.

getDiscriminant

public DiscriminantType getDiscriminant()
Description copied from interface: ValueDiscriminantPair
Gets the discriminant for ordering instances of the same value.

Returns:
The discriminant in the pair.

setDiscriminant

public void setDiscriminant(DiscriminantType discriminant)
Sets the discriminant.

Parameters:
discriminant - The discriminant.

create

public static <ValueType,DiscriminantType extends Comparable<? super DiscriminantType>> DefaultValueDiscriminantPair<ValueType,DiscriminantType> create(ValueType value,
                                                                                                                                                        DiscriminantType discriminant)
Convenience method for creating a new DefaultValueDiscriminantPair with the given value and discriminant.

Type Parameters:
ValueType - The general value stored in the pair.
DiscriminantType - The discriminant comparable object used for ordering objects.
Parameters:
value - The value.
discriminant - The discriminant.
Returns:
A new DefaultValueDiscriminantPair.