Package org.jamesii.model.cacore.neighborhood

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


  public final INeighborhood neighborhood() throws RecognitionException {
    INeighborhood neighborhood = null;

    Token NEIGHBORHOOD2 = null;
    Token MOORE3 = null;
    FreeNeighborhood f = 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:214:9:
      // ( NEIGHBORHOOD ( COLON )? ( MOORE | NEUMANN | ( FREE )? f=
View Full Code Here


  // freeneighborhood[String comment] returns [FreeNeighborhood neighborhood] :
  // LEFT_CURLEY ( ( LEFT_BRACE i= INTEGER ( ( COMMA )? j= INTEGER )*
  // RIGHT_BRACE ) )+ RIGHT_CURLEY ;
  public final FreeNeighborhood freeneighborhood(String comment)
      throws RecognitionException {
    FreeNeighborhood neighborhood = null;

    Token i = null;
    Token j = null;
    Token LEFT_BRACE4 = null;

    neighborhood = new FreeNeighborhood(dimensions, comment);
    List<Integer> l = new ArrayList<>();
    int d = 0;

    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:243:9:
      // ( LEFT_CURLEY ( ( LEFT_BRACE i= INTEGER ( ( COMMA )? j= INTEGER )*
      // RIGHT_BRACE ) )+ RIGHT_CURLEY )
      // 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:243:11:
      // LEFT_CURLEY ( ( LEFT_BRACE i= INTEGER ( ( COMMA )? j= INTEGER )*
      // RIGHT_BRACE ) )+ RIGHT_CURLEY
      {
        match(input, LEFT_CURLEY, FOLLOW_LEFT_CURLEY_in_freeneighborhood562);
        // 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:243:23:
        // ( ( LEFT_BRACE i= INTEGER ( ( COMMA )? j= INTEGER )* RIGHT_BRACE ) )+
        int cnt13 = 0;
        loop13: do {
          int alt13 = 2;
          int LA13_0 = input.LA(1);

          if ((LA13_0 == LEFT_BRACE)) {
            alt13 = 1;
          }

          switch (alt13) {
          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:243:24:
          // ( LEFT_BRACE i= INTEGER ( ( COMMA )? j= INTEGER )* RIGHT_BRACE )
          {
            // 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:243:24:
            // ( LEFT_BRACE i= INTEGER ( ( COMMA )? j= INTEGER )* RIGHT_BRACE )
            // 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:243:25:
            // LEFT_BRACE i= INTEGER ( ( COMMA )? j= INTEGER )* RIGHT_BRACE
            {
              LEFT_BRACE4 =
                  (Token) match(input, LEFT_BRACE,
                      FOLLOW_LEFT_BRACE_in_freeneighborhood566);
              i =
                  (Token) match(input, INTEGER,
                      FOLLOW_INTEGER_in_freeneighborhood607);

              try {
                l.add(Integer.valueOf((i != null ? i.getText() : null)));
                d++;
              } catch (NumberFormatException e) {
              }

              // 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:251:37:
              // ( ( COMMA )? j= INTEGER )*
              loop12: do {
                int alt12 = 2;
                int LA12_0 = input.LA(1);

                if ((LA12_0 == INTEGER || LA12_0 == COMMA)) {
                  alt12 = 1;
                }

                switch (alt12) {
                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:251:38:
                // ( COMMA )? j= INTEGER
                {
                  // 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:251:38:
                  // ( COMMA )?
                  int alt11 = 2;
                  int LA11_0 = input.LA(1);

                  if ((LA11_0 == COMMA)) {
                    alt11 = 1;
                  }
                  switch (alt11) {
                  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:251:38:
                  // COMMA
                  {
                    match(input, COMMA, FOLLOW_COMMA_in_freeneighborhood649);

                  }
                    break;

                  }

                  j =
                      (Token) match(input, INTEGER,
                          FOLLOW_INTEGER_in_freeneighborhood654);

                  if (d >= dimensions) {
                    addProblemToken(CAProblemToken.VALUE_OUT_OF_RANGE,
                        (j != null ? j.getTokenIndex() : 0),
                        "Too many arguments for the specified dimension.");
                  } else {
                    try {
                      l.add(Integer.valueOf((j != null ? j.getText() : null)));
                      d++;
                    } catch (NumberFormatException e) {
                    }
                  }

                }
                  break;

                default:
                  break loop12;
                }
              } while (true);

              match(input, RIGHT_BRACE,
                  FOLLOW_RIGHT_BRACE_in_freeneighborhood685);

            }

            if (l.size() < dimensions) {
              addProblemToken(CAProblemToken.VALUE_OUT_OF_RANGE,
                  (LEFT_BRACE4 != null ? LEFT_BRACE4.getTokenIndex() : 0),
                  "Not enough arguments for specified dimension.");
            } else {
              try {
                Integer[] cell = l.toArray(new Integer[0]);
                int[] c = new int[cell.length];
                for (int k = 0; k < c.length; k++) {
                  c[k] = cell[k].intValue();
                }
                if (neighborhood.containsCell(c)) {
                  addProblemToken(CAProblemToken.VALUE_OUT_OF_RANGE,
                      (LEFT_BRACE4 != null ? LEFT_BRACE4.getTokenIndex() : 0),
                      "Cell already in neighborhood.");
                } else {
                  neighborhood.addCell(c);
                }
              } catch (IllegalArgumentException e) {
              }
            }
            l.clear();
View Full Code Here

TOP

Related Classes of org.jamesii.model.cacore.neighborhood.FreeNeighborhood

Copyright © 2018 www.massapicom. 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.