sjm.examples.string
Class StringFunction
java.lang.Object
|
+--sjm.examples.string.StringFunction
- Direct Known Subclasses:
- Identity, LowerCase, Substring, Trim, UpperCase
- public abstract class StringFunction
- extends java.lang.Object
A StringFunction implements the method f() to
accept a string, apply a function to it, and return a
string. This class is abstract, and each subclass
represents a different function to apply. The functions
wrap each other, to allow runtime composition of new
functions.
|
Constructor Summary |
StringFunction()
Construct a function whose source function is identity,
which does not change a string. |
StringFunction(StringFunction source)
Construct a function whose source is the given function. |
|
Method Summary |
abstract java.lang.String |
f(java.lang.String s)
Each subclass should implement this method in manner
that applies a function to the input string. |
| Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
source
protected StringFunction source
StringFunction
public StringFunction()
- Construct a function whose source function is identity,
which does not change a string.
StringFunction
public StringFunction(StringFunction source)
- Construct a function whose source is the given function.
f
public abstract java.lang.String f(java.lang.String s)
- Each subclass should implement this method in manner
that applies a function to the input string. The class
name should represent the function applied here.