QPair
- java.lang.Object
-
- com.dashoptimization.maps.MapKey2<K1,K2>
-
- com.dashoptimization.maps.ComparableMapKey2<Variable,Variable>
-
- com.dashoptimization.objects.QPair
-
- All Implemented Interfaces:
-
java.lang.Comparable<ComparableMapKey2<Variable,Variable>>
public final class QPair extends ComparableMapKey2<Variable,Variable>
Pair of variables in a quadratic expression. Instances of this class are used to represent pairs of variables in quadratic expressions. Variables in this instance are always ordered according to a canonical ordering, so(v1,v2)
and(v2,v1)
will map to the same representation. Instances can represent linear terms as well. In that casevar2
is invalid andisLinear()
returnstrue
. Instances can also represent constant terms. In that casevar1
andvar2
are both invalid andisConstant()
returnstrue
.- Since:
- 43.00
-
-
Method Summary
Modifier and Type Method Description Variable
getVar1()
First variable in this pair.Variable
getVar2()
Second variable in this pair.boolean
isConstant()
Test whether this pair represents a constant term.boolean
isLinear()
Test whether this pair represents a linear term.java.lang.String
toString()
-
Methods inherited from class com.dashoptimization.maps.ComparableMapKey2
compareTo
-
-
-
-
Constructor Detail
-
QPair
public QPair(Variable v1, Variable v2)
Create a new pair of variables. The variables passed to this constructor will be ordered canonically, i.e., a pair(v1,v2)
may be stored as(v2,v1)
ifv2
comes beforev1
in the ordering of variables.- Parameters:
-
v1
- First variable. -
v2
- Second variable. - Since:
- 43.00
-
QPair
public QPair(QPair q)
Copy an instance.- Parameters:
-
q
- The instance to copy. - Since:
- 44.00
-
-
Method Detail
-
getVar1
public Variable getVar1()
First variable in this pair.- Since:
- 43.00
-
getVar2
public Variable getVar2()
Second variable in this pair.- Since:
- 43.00
-
isLinear
public boolean isLinear()
Test whether this pair represents a linear term.- Returns:
-
true
if this instance represents a linear term,false
otherwise. - Since:
- 43.00
-
isConstant
public boolean isConstant()
Test whether this pair represents a constant term.- Returns:
-
true
if this instance represents a constant term,false
otherwise. - Since:
- 43.00
-
toString
public java.lang.String toString()
- Overrides:
-
toString
in classjava.lang.Object
- Since:
- 44.00
-
-
© 2001-2025 Fair Isaac Corporation. All rights reserved. This documentation is the property of Fair Isaac Corporation (“FICO”). Receipt or possession of this documentation does not convey rights to disclose, reproduce, make derivative works, use, or allow others to use it except solely for internal evaluation purposes to determine whether to purchase a license to the software described in this documentation, or as otherwise set forth in a written software license agreement between you and FICO (or a FICO affiliate). Use of this documentation and the software described in it must conform strictly to the foregoing permitted uses, and no other use is permitted.