Package jcgp.backend.tests

Source Code of jcgp.backend.tests.TestFunctionSet

package jcgp.backend.tests;

import jcgp.backend.function.Function;
import jcgp.backend.function.FunctionSet;

public class TestFunctionSet extends FunctionSet {
 
  public TestFunctionSet() {
   
    registerFunctions(
      new Function() {
        @Override
        public Integer run(Object... args) {
          return (Integer) args[0] + (Integer) args[1];
        }
        @Override
        public int getArity() {
          return 2;
        }
      },
      new Function() {
        @Override
        public Integer run(Object... args) {
          return (Integer) args[0] - (Integer) args[1];
        }
        @Override
        public int getArity() {
          return 2;
        }
      },
      new Function() {
        @Override
        public Integer run(Object... args) {
          return (Integer) args[0] * (Integer) args[1];
        }
        @Override
        public int getArity() {
          return 2;
        }
      },
      new Function() {
        @Override
        public Integer run(Object... args) {
          return (Integer) args[0] / (Integer) args[1];
        }
        @Override
        public int getArity() {
          return 2;
        }
      }
    );
 
}
TOP

Related Classes of jcgp.backend.tests.TestFunctionSet

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.