de.rwth.domains.templates
Class IdentityFunction

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

public class IdentityFunction
extends java.lang.Object
implements Function

Implements functions which always return their argument.

Version:
$Id: IdentityFunction.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  Set set
          The domain and range of the function.
 
Constructor Summary
IdentityFunction(Set set)
          Creates a new IdentityFunction instance.
 
Method Summary
 java.lang.Object apply(java.lang.Object x)
          Returns the argument if it is an element of the domain.
 Set getDomain()
          Returns the domain of this function.
 Set getRange()
          Returns the range (co-domain) of this function.
 java.lang.String toString()
          Returns "id".
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

set

protected Set set
The domain and range of the function.
Constructor Detail

IdentityFunction

public IdentityFunction(Set set)
Creates a new IdentityFunction instance.
Parameters:
set - a Set value
Method Detail

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
Returns the argument if it is an element of the domain.
Specified by:
apply in interface Function
Parameters:
x - an Object value
Returns:
an Object value
Throws:
FunctionException - if the argument is not an element of the domain.

toString

public java.lang.String toString()
Returns "id".
Overrides:
toString in class java.lang.Object
Returns:
a String value