Examples of ICACondition


Examples of org.jamesii.model.carules.ICACondition

      }
    }

    for (int i = 0; i < condition.getConditionCount(); i++) {

      ICACondition cond = condition.getCondition(i);

      if (i > 0) {
        tempResult += concat;
      }
View Full Code Here

Examples of org.jamesii.model.carules.ICACondition

    addParameter("seed", seed);
    Random rnd = new Random(seed);

    // condition should always return true if initialized with false, and always
    // false if initialized with true
    ICACondition con = new NotCondition(new BooleanCondition(true));
    for (int i = 0; i < 1000; i++) {
      List<Integer> list = new ArrayList<>(8);
      for (int j = 0; j < 8; j++) {
        list.add((int) (rnd.nextDouble() * 1000));
      }
      assertFalse(con.isTrue(i, new FakeNeighborStates(list)));
    }

    con = new NotCondition(new BooleanCondition(false));
    for (int i = 0; i < 1000; i++) {
      List<Integer> list = new ArrayList<>(8);
      for (int j = 0; j < 8; j++) {
        list.add((int) (rnd.nextDouble() * 1000));
      }
      assertTrue(con.isTrue(i, new FakeNeighborStates(list)));
    }
  }
View Full Code Here

Examples of org.jamesii.model.carules.ICACondition

  @Override
  public boolean isTrue(int currentState, INeighborStates<Integer> neighbors) {
    boolean result = false;
    for (int i = 0; i < getConditionCount(); i++) {
      ICACondition c = getCondition(i);
      result |= c.isTrue(currentState, neighbors);
      if (result) {
        break;
      }
    }
    return result;
View Full Code Here

Examples of org.jamesii.model.carules.ICACondition

  @Override
  public String toString() {
    StringBuilder builder = new StringBuilder();
    for (int i = 0; i < getConditionCount(); i++) {
      ICACondition c = getCondition(i);
      builder.append(" OR ");
      builder.append(c);
    }

    if (getConditionCount() > 0) {
View Full Code Here

Examples of org.jamesii.model.carules.ICACondition

    OrExpression con = null;

    String target = null;

    ICACondition preCondition = new BooleanCondition(true);

    try {
      // C:/Documents and Settings/stefan/Desktop/James II Dev/James II
      // Trunk/plugins/ca_rules_f_antlr/src/model/carules/reader/antlr/parser/Carule.g:301:9:
      // (prob= rule COLON (con= orexpression )? ARROW target= state SEMICOLON )
View Full Code Here

Examples of org.jamesii.model.carules.ICACondition

  // andexpression returns [AndExpression condition] : (n= notexpression ) ( AND
  // n1= notexpression )* ;
  public final AndExpression andexpression() throws RecognitionException {
    AndExpression condition = null;

    ICACondition n = null;

    ICACondition n1 = null;

    try {
      // C:/Documents and Settings/stefan/Desktop/James II Dev/James II
      // Trunk/plugins/ca_rules_f_antlr/src/model/carules/reader/antlr/parser/Carule.g:350:9:
      // ( (n= notexpression ) ( AND n1= notexpression )* )
 
View Full Code Here

Examples of org.jamesii.model.carules.ICACondition

  // C:/Documents and Settings/stefan/Desktop/James II Dev/James II
  // Trunk/plugins/ca_rules_f_antlr/src/model/carules/reader/antlr/parser/Carule.g:353:7:
  // notexpression returns [ICACondition condition] : ( NOT co= atom | co= atom
  // );
  public final ICACondition notexpression() throws RecognitionException {
    ICACondition condition = null;

    ICACondition co = null;

    try {
      // C:/Documents and Settings/stefan/Desktop/James II Dev/James II
      // Trunk/plugins/ca_rules_f_antlr/src/model/carules/reader/antlr/parser/Carule.g:354:9:
      // ( NOT co= atom | co= atom )
View Full Code Here

Examples of org.jamesii.model.carules.ICACondition

  // C:/Documents and Settings/stefan/Desktop/James II Dev/James II
  // Trunk/plugins/ca_rules_f_antlr/src/model/carules/reader/antlr/parser/Carule.g:358:7:
  // atom returns [ICACondition condition] : (con= condition | LEFT_PAREN co=
  // orexpression RIGHT_PAREN );
  public final ICACondition atom() throws RecognitionException {
    ICACondition condition = null;

    ICACondition con = null;

    OrExpression co = null;

    try {
      // C:/Documents and Settings/stefan/Desktop/James II Dev/James II
View Full Code Here

Examples of org.jamesii.model.carules.ICACondition

  // $ANTLR start "condition"
  // C:/Documents and Settings/stefan/Desktop/James II Dev/James II
  // Trunk/plugins/ca_rules_f_antlr/src/model/carules/reader/antlr/parser/Carule.g:363:7:
  // condition returns [ICACondition condition] : ( TRUE | FALSE | id );
  public final ICACondition condition() throws RecognitionException {
    ICACondition condition = null;

    CaruleParser.id_return id6 = null;

    try {
      // C:/Documents and Settings/stefan/Desktop/James II Dev/James II
View Full Code Here

Examples of org.jamesii.model.carules.ICACondition

  @Override
  public boolean isTrue(int currentState, INeighborStates<Integer> neighbors) {
    boolean result = true;
    for (int i = 0; i < getConditionCount(); i++) {
      ICACondition c = getCondition(i);
      result &= c.isTrue(currentState, neighbors);
      if (!result) {
        break;
      }
    }
    return result;
View Full Code Here
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.