|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sf.javailp.Linear
public class Linear
The class Linear
is a linear expression consisting of variables and
their coefficients.
Constructor Summary | |
---|---|
Linear()
Constructs an empty linear expression. |
|
Linear(Iterable<Term> terms)
Constructs a linear expression from the terms. |
|
Linear(List<Number> coefficients,
List<Object> variables)
Constructs a linear expression with the predefined variables and their coefficients. |
Method Summary | |
---|---|
void |
add(Number coefficient,
Object variable)
Adds an element to the linear expression. |
void |
add(Term... terms)
Adds terms. |
void |
clear()
Removes all elements. |
Number |
evaluate(Map<Object,Number> result)
Evaluates the value of the linear expression. |
Term |
get(int i)
Returns the i -th Term . |
List<Number> |
getCoefficients()
Returns the coefficients. |
List<Object> |
getVariables()
Returns the variables. |
Iterator<Term> |
iterator()
|
int |
size()
Returns the size (number of variables) of the linear expression. |
String |
toString()
|
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public Linear()
public Linear(List<Number> coefficients, List<Object> variables)
coefficients
- the coefficientsvariables
- the variablespublic Linear(Iterable<Term> terms)
terms
- the terms to be addedMethod Detail |
---|
public List<Number> getCoefficients()
public List<Object> getVariables()
public void add(Number coefficient, Object variable)
coefficient
- the coefficientvariable
- the variablepublic void add(Term... terms)
terms
- the terms to be addedpublic int size()
public void clear()
public String toString()
toString
in class Object
public Number evaluate(Map<Object,Number> result)
result
- the result
public Iterator<Term> iterator()
iterator
in interface Iterable<Term>
public Term get(int i)
i
-th Term
.
i
- the index
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |