public class GeneralFunction extends Object implements FunctionTerm
| Constructor and Description |
|---|
GeneralFunction(boolean nonNegative,
boolean squared,
int maxSize) |
| Modifier and Type | Method and Description |
|---|---|
void |
add(double value)
Add a constant to the sum.
|
void |
add(double coefficient,
FunctionTerm term)
Add a general term to the sum.
|
double |
getCoefficient(int index) |
double |
getConstant() |
FunctionTerm |
getTerm(int index) |
double |
getValue()
Returns the term's value
|
double |
getValue(double[] values)
Get the value of this sum, but using the values passed in place of non-constants for the term.
|
double |
getValue(GroundAtom replacementAtom,
double replacementValue)
Get the value of the sum, but replace the value of a single RVA with the given value.
|
boolean |
isConstant()
Returns whether the term is constant.
|
boolean |
isLinear()
Returns whether the term is linear in its
Variables. |
boolean |
isNonNegative() |
boolean |
isSquared() |
void |
setNonNegative(boolean nonNegative) |
void |
setSquared(boolean squared) |
int |
size() |
String |
toString() |
public GeneralFunction(boolean nonNegative,
boolean squared,
int maxSize)
public double getConstant()
public boolean isSquared()
public boolean isNonNegative()
public boolean isLinear()
FunctionTermVariables.
Returns true if the term is a constant.isLinear in interface FunctionTermpublic boolean isConstant()
FunctionTermisConstant in interface FunctionTermpublic void setSquared(boolean squared)
public void setNonNegative(boolean nonNegative)
public void add(double value)
public void add(double coefficient,
FunctionTerm term)
public int size()
public double getCoefficient(int index)
public FunctionTerm getTerm(int index)
public double getValue()
FunctionTermgetValue in interface FunctionTermpublic double getValue(double[] values)
public double getValue(GroundAtom replacementAtom, double replacementValue)
Copyright © 2018 University of California, Santa Cruz. All rights reserved.