de.rwth.domains.templates
Class ComposedFunction

java.lang.Object
  |
  +--de.rwth.domains.templates.ComposedFunction
All Implemented Interfaces:
Function

public class ComposedFunction
extends java.lang.Object
implements Function

Implements functions by composition of two functions.

Version:
$Id: ComposedFunction.java,v 1.2 2002/09/17 06:53:53 mohnen Exp $
Author:
Markus Mohnen

Inner classes inherited from class de.rwth.domains.Function
Function.Tools
 
Field Summary
protected  Function f
          The second function in this composition.
protected  Function g
          The first function in this composition.
 
Constructor Summary
ComposedFunction(Function f, Function g)
          Creates a new ComposedFunction instance.
 
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.
static void main(java.lang.String[] args)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

f

protected Function f
The second function in this composition.

g

protected Function g
The first function in this composition.
Constructor Detail

ComposedFunction

public ComposedFunction(Function f,
                        Function g)
                 throws java.lang.IllegalArgumentException
Creates a new ComposedFunction instance. Read as "f o g" in the usual mathematical sense: The resulting function applies g to an argument and subsequently f to the result.
Parameters:
f - a Function value: The second function.
g - a Function value: The first function.
Throws:
java.lang.IllegalArgumentException - if the range of g is not the domain of f
Method Detail

apply

public java.lang.Object apply(java.lang.Object x)
                       throws FunctionException
Description copied from interface: Function
Applies this function to an argument and returns the result.
Specified by:
apply in interface Function
Following copied from interface: de.rwth.domains.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.

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

equals

public boolean equals(java.lang.Object o)
Overrides:
equals in class java.lang.Object

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

main

public static void main(java.lang.String[] args)