|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object de.cm.frw.core.fun.impl.Function
public class Function
Nested Class Summary | |
---|---|
static class |
Function.InvalidArguments
|
Constructor Summary | |
---|---|
Function()
The default constructor creates an unary function, i.e. |
Method Summary | |
---|---|
java.lang.Object |
apply()
|
java.lang.Object |
apply(boolean arg)
Apply this function to a boolean |
java.lang.Object |
apply(boolean[] arg)
Apply this function to a boolean array |
java.lang.Object |
apply(byte arg)
Apply this function to a byte |
java.lang.Object |
apply(byte[] arg)
Apply this function to a byte array |
java.lang.Object |
apply(char arg)
Apply this function to a char |
java.lang.Object |
apply(char[] arg)
Apply this function to a char array |
java.lang.Object |
apply(java.util.Collection args)
Applies the implemented function to the passed in collection of arguments. |
java.lang.Object |
apply(double arg)
Apply this function to a double |
java.lang.Object |
apply(double[] arg)
Apply this function to a double array |
java.lang.Object |
apply(float arg)
Apply this function to a float |
java.lang.Object |
apply(float[] arg)
Apply this function to a float array |
java.lang.Object |
apply(int arg)
Apply this function to an int |
java.lang.Object |
apply(int[] arg)
Apply this function to an int array |
java.lang.Object |
apply(long arg)
Apply this function to a long |
java.lang.Object |
apply(long[] arg)
Apply this function to a long array |
java.lang.Object |
apply(java.lang.Object arg)
|
java.lang.Object |
apply(java.lang.Object[] arg)
Apply this function to an array of objects |
int |
arity()
|
static java.lang.Boolean |
box(boolean x)
Create a Boolean instance from a given boolean value (aka boxing) |
static java.util.Collection |
box(boolean[] a)
Box a boolean array into a Bag of Booleans |
static java.lang.Byte |
box(byte x)
Create a Byte instance from a given byte value (aka boxing) |
static java.util.Collection |
box(byte[] a)
Box a byte array into a Bag of Bytes |
static java.lang.Character |
box(char c)
Create a Character instance from a given char value (aka boxing) |
static java.util.Collection |
box(char[] a)
Box a char array into a Bag of Characters |
static java.lang.Double |
box(double x)
Create a Double instance from a given double value (aka boxing) |
static java.util.Collection |
box(double[] a)
Box a double array into a Bag of Doubles |
static java.lang.Float |
box(float x)
Create a Float instance from a given float value (aka boxing) |
static java.util.Collection |
box(float[] a)
Box a float array into a Bag of Floats |
static java.lang.Integer |
box(int x)
Create a Integer instance from a given int value (aka boxing) |
static java.util.Collection |
box(int[] a)
Box an int array into a Bag of Integers |
static java.lang.Long |
box(long x)
Create a Long instance from a given long value (aka boxing) |
static java.util.Collection |
box(long[] a)
Box a long array into a Bag of Longs |
static java.util.Collection |
box(java.lang.Object[] a)
Box an array of objects into a Bag |
void |
checkArguments(java.util.Collection args)
Override this method to check conditions on the arguments (like types) passed to the function in apply before the operate method is called. |
static boolean |
is(java.lang.Object x)
Return the boolean value of a given Boolean x as double |
static void |
main(java.lang.String[] args)
|
java.lang.Iterable |
map(java.util.Collection args)
|
static java.lang.Iterable |
map(Function f,
java.lang.Iterable args)
|
java.lang.Object |
operate(java.lang.Object[] operands)
Override this to implement the actual operation realized by this function. |
static java.lang.Object |
reduce(java.lang.Iterable args,
Function f,
java.lang.Object initial)
|
static int |
unbox(java.lang.Integer i)
|
static double |
val(java.lang.Object x)
Return the value of a given number x as double |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Function()
Method Detail |
---|
public java.lang.Object apply(java.util.Collection args) throws Function.InvalidArguments
args
- A collection of arguments
Function.InvalidArguments
public java.lang.Object apply() throws Function.InvalidArguments
Function.InvalidArguments
public java.lang.Object apply(java.lang.Object arg) throws Function.InvalidArguments
Function.InvalidArguments
public final java.lang.Object apply(boolean arg) throws Function.InvalidArguments
boolean
arg
- a boolean
Object
Function.InvalidArguments
- if this function is not applicable to argpublic final java.lang.Object apply(boolean[] arg) throws Function.InvalidArguments
boolean
array
arg
- a boolean
array
Object
Function.InvalidArguments
- if this function is not applicable to argpublic final java.lang.Object apply(byte arg) throws Function.InvalidArguments
byte
arg
- a byte
Object
Function.InvalidArguments
- if this function is not applicable to argpublic final java.lang.Object apply(byte[] arg) throws Function.InvalidArguments
byte
array
arg
- a byte
array
Object
Function.InvalidArguments
- if this function is not applicable to argpublic final java.lang.Object apply(char arg) throws Function.InvalidArguments
char
arg
- a char
Object
Function.InvalidArguments
- if this function is not applicable to argpublic final java.lang.Object apply(char[] arg) throws Function.InvalidArguments
char
array
arg
- a char
array
Object
Function.InvalidArguments
- if this function is not applicable to argpublic final java.lang.Object apply(float arg) throws Function.InvalidArguments
float
arg
- a fload
Object
Function.InvalidArguments
- if this function is not applicable to argpublic final java.lang.Object apply(float[] arg) throws Function.InvalidArguments
float
array
arg
- a float
array
Object
Function.InvalidArguments
- if this function is not applicable to argpublic final java.lang.Object apply(double arg) throws Function.InvalidArguments
double
arg
- a double
Object
Function.InvalidArguments
- if this function is not applicable to argpublic final java.lang.Object apply(double[] arg) throws Function.InvalidArguments
double
array
arg
- a double
array
Object
Function.InvalidArguments
- if this function is not applicable to argpublic final java.lang.Object apply(int arg) throws Function.InvalidArguments
int
arg
- an int
Object
Function.InvalidArguments
- if this function is not applicable to argpublic final java.lang.Object apply(int[] arg) throws Function.InvalidArguments
int
array
arg
- an int
array
Object
Function.InvalidArguments
- if this function is not applicable to argpublic final java.lang.Object apply(long arg) throws Function.InvalidArguments
long
arg
- a long
Object
Function.InvalidArguments
- if this function is not applicable to argpublic final java.lang.Object apply(long[] arg) throws Function.InvalidArguments
long
array
arg
- a long
array
Object
Function.InvalidArguments
- if this function is not applicable to argpublic final java.lang.Object apply(java.lang.Object[] arg) throws Function.InvalidArguments
arg
- the array of objects
Object
Function.InvalidArguments
- if this function is not applicable to argpublic void checkArguments(java.util.Collection args) throws Function.InvalidArguments
args
-
Function.InvalidArguments
public java.lang.Object operate(java.lang.Object[] operands) throws Function.InvalidArguments
Remember to document the number and types of the operands
and any other conditions for running the operate method.
Or implement checkArguments
instead.
Default implementation returns first argument passed in, realizing sort of an unary identity function.
operands
- An array of the arguments that where passed to apply
Function.InvalidArguments
- when you implement it to do so ...public static java.lang.Iterable map(Function f, java.lang.Iterable args) throws Function.InvalidArguments
Function.InvalidArguments
public static java.lang.Object reduce(java.lang.Iterable args, Function f, java.lang.Object initial) throws Function.InvalidArguments
Function.InvalidArguments
public static void main(java.lang.String[] args)
args
- public static int unbox(java.lang.Integer i)
public java.lang.Iterable map(java.util.Collection args) throws Function.InvalidArguments
Function.InvalidArguments
public int arity()
public static java.lang.Boolean box(boolean x)
x
- a boolean value
public static java.util.Collection box(boolean[] a)
a
- a boolean array
Bag
instance containing a Boolean
for each member of a
public static java.lang.Byte box(byte x)
x
- a byte value
public static java.util.Collection box(byte[] a)
a
- a byte array
Bag
instance containing a Byte
for each member of a
public static java.lang.Character box(char c)
x
- a chat value
public static java.util.Collection box(char[] a)
a
- a char array
Bag
instance containing a Character
for each member of a
public static java.lang.Double box(double x)
x
- an double value
public static java.util.Collection box(double[] a)
a
- a double array
Bag
instance containing a Double
for each member of a
public static java.lang.Float box(float x)
x
- a float value
public static java.util.Collection box(float[] a)
a
- a float array
Bag
instance containing a Float
for each member of a
public static java.lang.Integer box(int x)
x
- an int value
public static java.util.Collection box(int[] a)
a
- an integer array
a
public static java.lang.Long box(long x)
x
- a lonv value
public static java.util.Collection box(long[] a)
a
- a long array
Bag
instance containing a Long
for each member of a
public static double val(java.lang.Object x) throws Function.InvalidArguments
x
- the number (instance of Number)
Function.InvalidArguments
- if x is not a Number instancepublic static boolean is(java.lang.Object x) throws Function.InvalidArguments
x
- the Boolean instance
Function.InvalidArguments
- if x is not a Boolean instancepublic static java.util.Collection box(java.lang.Object[] a)
a
- the array of objects
Bag
instance containing each member of a
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |