geneticWedge.gp.function
Class XORFunction

java.lang.Object
  extended by geneticWedge.gp.Component
      extended by geneticWedge.gp.function.Function
          extended by geneticWedge.gp.function.TwoInputFunction
              extended by geneticWedge.gp.function.XORFunction

public class XORFunction
extends TwoInputFunction

XORFunction is the 'exclusive or' function. It that takes 2 inputs and outputs +1 if just one of them is positive, -1 otherwise.


Constructor Summary
XORFunction()
          constructor
 
Method Summary
 double getOutput(double[] input)
          getOutput() throws InvalidInputSizeException if the length of the input array is not 2.
 boolean isCommutative()
          Returns true
 java.lang.String toString()
          Returns a String representation of an ORFunction object ('XOR').
 
Methods inherited from class geneticWedge.gp.function.Function
getComplexity, getNoOfInputs
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

XORFunction

public XORFunction()
constructor

Method Detail

getOutput

public double getOutput(double[] input)
                 throws InvalidInputSizeException
getOutput() throws InvalidInputSizeException if the length of the input array is not 2.

Specified by:
getOutput in class Function
Throws:
InvalidInputSizeException

toString

public java.lang.String toString()
Returns a String representation of an ORFunction object ('XOR').

Specified by:
toString in class Function

isCommutative

public boolean isCommutative()
Returns true

Specified by:
isCommutative in class TwoInputFunction