Class LinearTerm
- java.lang.Object
-
- org.jreliability.booleanfunction.AbstractHierarchicalTerm
-
- org.jreliability.booleanfunction.common.LinearTerm
-
- All Implemented Interfaces:
Term
public class LinearTerm extends AbstractHierarchicalTerm
TheLinearTerm
represents a linear constraint of the form:
left-hand-side comparator right-hand-side
.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
LinearTerm.Comparator
TheLinearTerm.Comparator
determines the comparator in theLinearTerm
, i.e.
-
Field Summary
Fields Modifier and Type Field Description protected java.util.List<java.lang.Integer>
coefficients
The coefficients of the embedded terms.protected LinearTerm.Comparator
comparator
The usedLinearTerm.Comparator
.protected int
rhs
The right-hand-side of theLinearTerm
.-
Fields inherited from class org.jreliability.booleanfunction.AbstractHierarchicalTerm
terms
-
-
Constructor Summary
Constructors Constructor Description LinearTerm(java.util.List<java.lang.Integer> coefficients, java.util.List<Term> terms, LinearTerm.Comparator comparator, int rhs)
Constructs aLinearTerm
with a given list of coefficients, the embeddedTerm
s, theLinearTerm.Comparator
, and the right-hand-side.LinearTerm(LinearTerm.Comparator comparator, int rhs)
Constructs aLinearTerm
with a givenLinearTerm.Comparator
, and the right-hand-side.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
add(int coefficient, Term term)
Adds aTerm
and its coefficient.void
add(Term term)
java.util.List<java.lang.Integer>
getCoefficients()
Returns the coefficients of theTerm
s.LinearTerm.Comparator
getComparator()
Returns theLinearTerm.Comparator
of theLinearTerm
.int
getRHS()
Returns the right-hand-side.java.lang.String
toString()
-
Methods inherited from class org.jreliability.booleanfunction.AbstractHierarchicalTerm
add, getTerms, size
-
-
-
-
Field Detail
-
coefficients
protected final java.util.List<java.lang.Integer> coefficients
The coefficients of the embedded terms.
-
comparator
protected final LinearTerm.Comparator comparator
The usedLinearTerm.Comparator
.
-
rhs
protected int rhs
The right-hand-side of theLinearTerm
.
-
-
Constructor Detail
-
LinearTerm
public LinearTerm(LinearTerm.Comparator comparator, int rhs)
Constructs aLinearTerm
with a givenLinearTerm.Comparator
, and the right-hand-side.- Parameters:
comparator
- the used comparatorrhs
- the right-hand-side
-
LinearTerm
public LinearTerm(java.util.List<java.lang.Integer> coefficients, java.util.List<Term> terms, LinearTerm.Comparator comparator, int rhs)
Constructs aLinearTerm
with a given list of coefficients, the embeddedTerm
s, theLinearTerm.Comparator
, and the right-hand-side.- Parameters:
coefficients
- the coefficients of the termsterms
- the termscomparator
- the used comparatorrhs
- the right-hand-side
-
-
Method Detail
-
getCoefficients
public java.util.List<java.lang.Integer> getCoefficients()
Returns the coefficients of theTerm
s.- Returns:
- the coefficients of the terms
-
getRHS
public int getRHS()
Returns the right-hand-side.- Returns:
- the right-hand-side
-
add
public void add(Term term)
Description copied from class:AbstractHierarchicalTerm
- Overrides:
add
in classAbstractHierarchicalTerm
- Parameters:
term
- the term to add
-
add
public void add(int coefficient, Term term)
Adds aTerm
and its coefficient.- Parameters:
coefficient
- the coefficientterm
- the term
-
getComparator
public LinearTerm.Comparator getComparator()
Returns theLinearTerm.Comparator
of theLinearTerm
.- Returns:
- the comparator of the linear term
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-