Examples of NeumannNeighborhood


Examples of org.jamesii.model.cacore.neighborhood.NeumannNeighborhood

      throw new InvalidModelException(
          "setGrid was already called for this cell.");
    }
    this.grid = grid;
    int dim = grid.getDimensions().length;
    neighborhood = new NeumannNeighborhood(dim, null);
  }
View Full Code Here

Examples of org.jamesii.model.cacore.neighborhood.NeumannNeighborhood

            S2 }), CAModelReaderFactory.createSingleRule(S2, S1, new String[] {
        S1, S1 }, new String[] { S1, S2 }), CAModelReaderFactory
        .createSingleRule(S2, S1, new String[] { S1, S2 }, new String[] { S1,
            S2 }), CAModelReaderFactory.createSingleRule(S2, S1, new String[] {
        S2, S2 }, new String[] { S1, S2 })), Arrays.asList(S1, S2),
        new NeumannNeighborhood(1, "Well... it's a neighbourhood."),
        new ArrayList<ICACell>(), new int[] { 10 }, false);

    List<String> states = new ArrayList<>();
    states.add(S1);
    states.add(S2);
View Full Code Here

Examples of org.jamesii.model.cacore.neighborhood.NeumannNeighborhood

            addState("ALIVE");
            addRule(new CARule(new BooleanCondition(true),
                new WolframCondition(r), 1, 1));
            addRule(new CARule(new BooleanCondition(true),
                new AntiWolframCondition(r), 0, 1));
            retval.neighborhood = new NeumannNeighborhood(1, null);
            neighborhood = retval.neighborhood;
            retval.isWolfram = true;
            retval.wolframRule = r;

          }

        }
          break;
        case 2:
        // 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:159:40:
        // ( (d= dimension ) (n= neighborhood )? ( statedef )+ ( carule )+ )
        {
          // 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:159:40:
          // ( (d= dimension ) (n= neighborhood )? ( statedef )+ ( carule )+ )
          // 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:159:41:
          // (d= dimension ) (n= neighborhood )? ( statedef )+ ( carule )+
          {
            // 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:159:41:
            // (d= dimension )
            // 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:159:42:
            // d= dimension
            {
              pushFollow(FOLLOW_dimension_in_camodel136);
              d = dimension();

              state._fsp--;

              retval.dimensions = (d != null ? d.dimension : 0);
              dimensions = (d != null ? d.dimension : 0);

            }

            // 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:163:40:
            // (n= neighborhood )?
            int alt1 = 2;
            int LA1_0 = input.LA(1);

            if ((LA1_0 == NEIGHBORHOOD)) {
              alt1 = 1;
            }
            switch (alt1) {
            case 1:
            // 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:163:41:
            // n= neighborhood
            {
              pushFollow(FOLLOW_neighborhood_in_camodel184);
              n = neighborhood();

              state._fsp--;

              retval.neighborhood = n;
              neighborhood = retval.neighborhood;
              neighborhoodDefined = true;

            }
              break;

            }

            // 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:168:41:
            // ( statedef )+
            int cnt2 = 0;
            loop2: do {
              int alt2 = 2;
              int LA2_0 = input.LA(1);

              if ((LA2_0 == STATE)) {
                alt2 = 1;
              }

              switch (alt2) {
              case 1:
              // 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:168:41:
              // statedef
              {
                pushFollow(FOLLOW_statedef_in_camodel231);
                statedef();

                state._fsp--;

              }
                break;

              default:
                if (cnt2 >= 1) {
                  break loop2;
                }
                EarlyExitException eee = new EarlyExitException(2, input);
                throw eee;
              }
              cnt2++;
            } while (true);

            // 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:168:51:
            // ( carule )+
            int cnt3 = 0;
            loop3: do {
              int alt3 = 2;
              int LA3_0 = input.LA(1);

              if ((LA3_0 == RULE)) {
                alt3 = 1;
              }

              switch (alt3) {
              case 1:
              // 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:168:51:
              // carule
              {
                pushFollow(FOLLOW_carule_in_camodel234);
                carule();

                state._fsp--;

              }
                break;

              default:
                if (cnt3 >= 1) {
                  break loop3;
                }
                EarlyExitException eee = new EarlyExitException(3, input);
                throw eee;
              }
              cnt3++;
            } while (true);

          }

          if (retval.neighborhood == null && !neighborhoodDefined) {
            // use standard neumann neighborhood
            if (NeumannNeighborhood.isDimensionSupported(retval.dimensions)) {
              retval.neighborhood =
                  new NeumannNeighborhood(retval.dimensions, null);
              neighborhood = retval.neighborhood;
            } else {
              addProblemToken(CAProblemToken.VALUE_OUT_OF_RANGE,
                  (d != null ? ((Token) d.start) : null).getTokenIndex(),
                  "Default Neighborhood (Neumann) does not support the specified dimension.");
View Full Code Here

Examples of org.jamesii.model.cacore.neighborhood.NeumannNeighborhood

        {
          match(input, NEUMANN, FOLLOW_NEUMANN_in_neighborhood477);

          if (NeumannNeighborhood.isDimensionSupported(dimensions)) {
            String comment = getCommentForToken(NEIGHBORHOOD2.getTokenIndex());
            neighborhood = new NeumannNeighborhood(dimensions, null);
          } else {
            addProblemToken(CAProblemToken.VALUE_OUT_OF_RANGE,
                (MOORE3 != null ? MOORE3.getTokenIndex() : 0),
                "Neumann neighborhood not supported for specified dimension -> "
                    + dimensions);
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.