gov.sandia.cognition.util
Class DefaultWeightedPair<FirstType,SecondType>

java.lang.Object
  extended by gov.sandia.cognition.util.AbstractCloneableSerializable
      extended by gov.sandia.cognition.util.DefaultPair<FirstType,SecondType>
          extended by gov.sandia.cognition.util.DefaultWeightedPair<FirstType,SecondType>
Type Parameters:
FirstType - Type of the first object in the pair.
SecondType - Type of the second object in the pair.
All Implemented Interfaces:
CloneableSerializable, Pair<FirstType,SecondType>, Weighted, WeightedPair<FirstType,SecondType>, Serializable, Cloneable

public class DefaultWeightedPair<FirstType,SecondType>
extends DefaultPair<FirstType,SecondType>
implements WeightedPair<FirstType,SecondType>

The DefaultWeightedPair class extends the DefaultPair class to add a weight to the pair.

Since:
2.0
Author:
Justin Basilico, Kevin R. Dixon
See Also:
Serialized Form

Field Summary
static double DEFAULT_WEIGHT
          The default weight for the pair is 0.0.
protected  double weight
          The weight for the pair.
 
Fields inherited from class gov.sandia.cognition.util.DefaultPair
first, second
 
Constructor Summary
DefaultWeightedPair()
          Creates a new instance of DefaultWeightedPair.
DefaultWeightedPair(FirstType first, SecondType second, double weight)
          Creates a new instance of DefaultWeightedPair.
 
Method Summary
 double getWeight()
          Sets the weight of the pair.
 void setWeight(double weight)
          Gets the weight of the pair.
 
Methods inherited from class gov.sandia.cognition.util.DefaultPair
clone, create, create, equals, equals, getFirst, getSecond, hashCode, mergeCollections, setFirst, setSecond
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface gov.sandia.cognition.util.Pair
getFirst, getSecond
 

Field Detail

DEFAULT_WEIGHT

public static final double DEFAULT_WEIGHT
The default weight for the pair is 0.0.

See Also:
Constant Field Values

weight

protected double weight
The weight for the pair.

Constructor Detail

DefaultWeightedPair

public DefaultWeightedPair()
Creates a new instance of DefaultWeightedPair.


DefaultWeightedPair

public DefaultWeightedPair(FirstType first,
                           SecondType second,
                           double weight)
Creates a new instance of DefaultWeightedPair.

Parameters:
first - The first object in the pair.
second - The second object in the pair.
weight - The weight for the pair.
Method Detail

getWeight

public double getWeight()
Sets the weight of the pair.

Specified by:
getWeight in interface Weighted
Returns:
The weight of the pair.

setWeight

public void setWeight(double weight)
Gets the weight of the pair.

Parameters:
weight - The weight of the pair.