de.rwth.domains.templates
Class TabledFunction
java.lang.Object
|
+--de.rwth.domains.templates.TabledFunction
- All Implemented Interfaces:
- Function
- public class TabledFunction
- extends java.lang.Object
- implements Function
This class represents functions by the table of their function values.
- Version:
- $Id: TabledFunction.java,v 1.2 2002/09/17 06:53:53 mohnen Exp $
- Author:
- Markus Mohnen
Field Summary |
protected Set |
domain
The domain of this function. |
protected java.lang.Object[] |
fValues
This function's values in the sequence in which the elements of the
domain occur with domains.iterator() . |
protected Set |
range
The range of this function. |
Constructor Summary |
TabledFunction(Set domain,
Set range,
java.lang.Object[] fValues)
Create a new function from domain, range, and function table. |
Method Summary |
java.lang.Object |
apply(java.lang.Object x)
Applies this function to an argument and returns the result. |
boolean |
equals(java.lang.Object o)
|
Set |
getDomain()
Returns the domain of this function. |
Set |
getRange()
Returns the range (co-domain) of this function. |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
domain
protected Set domain
- The domain of this function.
range
protected Set range
- The range of this function.
fValues
protected java.lang.Object[] fValues
- This function's values in the sequence in which the elements of the
domain occur with
domains.iterator()
.
TabledFunction
public TabledFunction(Set domain,
Set range,
java.lang.Object[] fValues)
throws java.lang.IllegalArgumentException
- Create a new function from domain, range, and function table.
- Parameters:
domain
- a value of type Set
range
- a value of type Set
fValues
:
- The function's values in the sequence
in which the elements of the domain occur with
domains.iterator()
.- Throws:
IllegalArgumentException
- if
- an element of
fvalues
is not in range
-
fValues
has not enough values
-
fValues
has too many values
toString
public java.lang.String toString()
- Overrides:
toString
in class java.lang.Object
equals
public boolean equals(java.lang.Object o)
- Overrides:
equals
in class java.lang.Object
getDomain
public Set getDomain()
- Description copied from interface:
Function
- Returns the domain of this function.
- Specified by:
getDomain
in interface Function
- Following copied from interface:
de.rwth.domains.Function
- Returns:
- a value of type
Set
getRange
public Set getRange()
- Description copied from interface:
Function
- Returns the range (co-domain) of this function.
- Specified by:
getRange
in interface Function
- Following copied from interface:
de.rwth.domains.Function
- Returns:
- a value of type
Set
apply
public java.lang.Object apply(java.lang.Object x)
throws FunctionException
- Applies this function to an argument and returns the result.
- Specified by:
apply
in interface Function
- Parameters:
x
- the argument- Returns:
- this function's value for argument
x
- Throws:
FunctionException
- if x
is not
an element of the
functions domain.