コード例 #1
0
ファイル: ExpParser.java プロジェクト: altal22/jaamsim
  public static Assignment parseAssignment(ParseContext context, String input) throws ExpError {
    ArrayList<ExpTokenizer.Token> ts;
    ts = ExpTokenizer.tokenize(input);

    TokenList tokens = new TokenList(ts);

    ExpTokenizer.Token nextTok = tokens.next();
    if (nextTok == null
        || (nextTok.type != ExpTokenizer.SQ_TYPE && !nextTok.value.equals("this"))) {
      throw new ExpError(input, 0, "Assignments must start with an identifier");
    }

    String[] destination = parseIdentifier(nextTok, tokens, new Expression(input));

    nextTok = tokens.next();
    if (nextTok == null || nextTok.type != ExpTokenizer.SYM_TYPE || !nextTok.value.equals("=")) {
      throw new ExpError(input, nextTok.pos, "Expected '=' in assignment");
    }

    Assignment ret = new Assignment();
    ret.destination = destination;
    ret.value = new Expression(input);

    ExpNode expNode = parseExp(context, tokens, 0, ret.value);

    expNode.walk(CONST_OP);
    expNode =
        CONST_OP.updateRef(
            expNode); // Finally, give the entire expression a chance to optimize itself into a
                      // constant

    ret.value.setRootNode(expNode);

    return ret;
  }
コード例 #2
0
ファイル: Agent.java プロジェクト: RonBarabash/DisCSP
  private void backtrack(CPA cpa) throws InterruptedException {
    if (IA()) {
      Stop();
    } else {
      System.out.println(
          ID
              + "is running and AV is "
              + AgentView
              + " and cpa  is "
              + cpa
              + " from func backtrack");
      Assignment last = cpa.Last_Assignment();
      if (last != null) {
        cpa = cpa.shortest_inconsistent_partail_assignment(AgentView);
        System.out.println(
            ID
                + "is running and AV is "
                + AgentView
                + " and cpa  is "
                + cpa
                + " from func backtrack");
        int backto = last.getID();
        AgentView_consistent = false;
        initilize_domain();

        send(new Message("Backtrack_CPA", cpa), backto);
      } else {
        System.out.println("last message is null and got backtrack - SHOULDNT HAPPEN");
      }
    }
  }
コード例 #3
0
 /*
  * @see ASTVisitor#visit(Assignment)
  */
 @Override
 public boolean visit(Assignment node) {
   node.getLeftHandSide().accept(this);
   this.fBuffer.append(node.getOperator().toString());
   node.getRightHandSide().accept(this);
   return false;
 }
  public Map<RouteDirectionStopKey, String> getStopMatches(
      Map<NBRoute, Route> routeMatches,
      Map<NBStop, List<Stop>> potentialStopMatches,
      GtfsRelationalDao dao) {

    Map<RouteDirectionStopKey, String> stopIdMappings =
        new HashMap<RouteDirectionStopKey, String>();

    for (Map.Entry<NBRoute, Route> entry : routeMatches.entrySet()) {

      NBRoute nbRoute = entry.getKey();
      Route gtfsRoute = entry.getValue();

      Set<List<Stop>> stopSequences = getStopSequencesForRoute(dao, gtfsRoute);

      List<Map<Stop, Integer>> stopSequenceIndices = new ArrayList<Map<Stop, Integer>>();
      for (List<Stop> stopSequence : stopSequences) {
        Map<Stop, Integer> index = new HashMap<Stop, Integer>();
        for (int i = 0; i < stopSequence.size(); ++i) {
          index.put(stopSequence.get(i), i);
        }
        stopSequenceIndices.add(index);
      }

      for (NBDirection direction : nbRoute.getDirections()) {

        List<Match> matches = new ArrayList<Match>();
        for (NBStop fromStop : direction.getStops()) {
          List<Stop> toStops = potentialStopMatches.get(fromStop);
          if (toStops.isEmpty()) {
            continue;
          }
          Match m = new Match(fromStop, toStops);
          matches.add(m);
        }

        Min<Assignment> m = new Min<Assignment>();
        Assignment assignment = new Assignment(direction.getStops(), stopSequenceIndices);
        matches = applyDirectMatchesToAssignment(matches, assignment);
        recursivelyBuildAndScoreAssignment(matches, 0, assignment, m);
        Assignment bestAssignment = m.getMinElement();

        if (bestAssignment == null) {
          throw new IllegalStateException();
        }

        for (NBStop stop : direction.getStops()) {
          Stop gtfsStop = bestAssignment.getGtfsStopForNBStop(stop);
          if (gtfsStop == null) {
            continue;
          }
          String stopId = gtfsStop.getId().getId();
          RouteDirectionStopKey key =
              new RouteDirectionStopKey(nbRoute.getTag(), direction.getTag(), stop.getTag());
          stopIdMappings.put(key, stopId);
        }
      }
    }
    return stopIdMappings;
  }
コード例 #5
0
  public class CompositeTypeElements extends AbstractParserRuleElementFinder {
    private final ParserRule rule =
        (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "CompositeType");
    private final Group cGroup = (Group) rule.eContents().get(1);
    private final Keyword cCompositeKeyword_0 = (Keyword) cGroup.eContents().get(0);
    private final Assignment cNameAssignment_1 = (Assignment) cGroup.eContents().get(1);
    private final RuleCall cNameIDTerminalRuleCall_1_0 =
        (RuleCall) cNameAssignment_1.eContents().get(0);
    private final Keyword cBaseKeyword_2 = (Keyword) cGroup.eContents().get(2);
    private final Assignment cBaseTypeAssignment_3 = (Assignment) cGroup.eContents().get(3);
    private final RuleCall cBaseTypeCompositeTypeEntryParserRuleCall_3_0 =
        (RuleCall) cBaseTypeAssignment_3.eContents().get(0);
    private final Keyword cSemicolonKeyword_4 = (Keyword) cGroup.eContents().get(4);

    // CompositeType:
    //	"Composite" name=ID "base" baseType=CompositeTypeEntry ";";
    public ParserRule getRule() {
      return rule;
    }

    // "Composite" name=ID "base" baseType=CompositeTypeEntry ";"
    public Group getGroup() {
      return cGroup;
    }

    // "Composite"
    public Keyword getCompositeKeyword_0() {
      return cCompositeKeyword_0;
    }

    // name=ID
    public Assignment getNameAssignment_1() {
      return cNameAssignment_1;
    }

    // ID
    public RuleCall getNameIDTerminalRuleCall_1_0() {
      return cNameIDTerminalRuleCall_1_0;
    }

    // "base"
    public Keyword getBaseKeyword_2() {
      return cBaseKeyword_2;
    }

    // baseType=CompositeTypeEntry
    public Assignment getBaseTypeAssignment_3() {
      return cBaseTypeAssignment_3;
    }

    // CompositeTypeEntry
    public RuleCall getBaseTypeCompositeTypeEntryParserRuleCall_3_0() {
      return cBaseTypeCompositeTypeEntryParserRuleCall_3_0;
    }

    // ";"
    public Keyword getSemicolonKeyword_4() {
      return cSemicolonKeyword_4;
    }
  }
コード例 #6
0
  public class EnumerationElements extends AbstractParserRuleElementFinder {
    private final ParserRule rule =
        (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "Enumeration");
    private final Group cGroup = (Group) rule.eContents().get(1);
    private final Keyword cEnumKeyword_0 = (Keyword) cGroup.eContents().get(0);
    private final Assignment cValAssignment_1 = (Assignment) cGroup.eContents().get(1);
    private final RuleCall cValEnum1EnumRuleCall_1_0 =
        (RuleCall) cValAssignment_1.eContents().get(0);
    private final Group cGroup_2 = (Group) cGroup.eContents().get(2);
    private final Keyword cCommaKeyword_2_0 = (Keyword) cGroup_2.eContents().get(0);
    private final Assignment cValAssignment_2_1 = (Assignment) cGroup_2.eContents().get(1);
    private final RuleCall cValEnum1EnumRuleCall_2_1_0 =
        (RuleCall) cValAssignment_2_1.eContents().get(0);

    // Enumeration:
    //	"enum" val+=Enum1+ ("," val+=Enum1)*;
    public ParserRule getRule() {
      return rule;
    }

    // "enum" val+=Enum1+ ("," val+=Enum1)*
    public Group getGroup() {
      return cGroup;
    }

    // "enum"
    public Keyword getEnumKeyword_0() {
      return cEnumKeyword_0;
    }

    // val+=Enum1+
    public Assignment getValAssignment_1() {
      return cValAssignment_1;
    }

    // Enum1
    public RuleCall getValEnum1EnumRuleCall_1_0() {
      return cValEnum1EnumRuleCall_1_0;
    }

    // ("," val+=Enum1)*
    public Group getGroup_2() {
      return cGroup_2;
    }

    // ","
    public Keyword getCommaKeyword_2_0() {
      return cCommaKeyword_2_0;
    }

    // val+=Enum1
    public Assignment getValAssignment_2_1() {
      return cValAssignment_2_1;
    }

    // Enum1
    public RuleCall getValEnum1EnumRuleCall_2_1_0() {
      return cValEnum1EnumRuleCall_2_1_0;
    }
  }
コード例 #7
0
  public void modifyAssignment(
      final Assignment assignment, final String operation, final String successMessage) {
    String serverGroup = assignment.getServerGroup();
    ResourceAddress address =
        new ResourceAddress()
            .add("server-group", serverGroup)
            .add("deployment", assignment.getName());
    Operation op = new Operation.Builder(operation, address).build();

    // wrap the operation in a single flow to show the progress indicator in the footer
    new Async<FunctionContext>(Footer.PROGRESS_ELEMENT)
        .single(
            new FunctionContext(),
            control -> dispatcher.execute(new DMRAction(op), new FunctionCallback(control)),
            new Outcome<FunctionContext>() {
              @Override
              public void onFailure(final FunctionContext context) {
                Console.error("Unable to modify deployment.", context.getErrorMessage());
              }

              @Override
              public void onSuccess(final FunctionContext context) {
                Console.info(successMessage);
                loadAssignments(serverGroup);
              }
            });
  }
コード例 #8
0
 public void printTreeAsHTML(StringBuilder sb) {
   if (scope != null) {
     sb.append("<li><b>")
         .append(scope.getClass().getSimpleName())
         .append("</b> <i>")
         .append(scope.getFullName())
         .append("</i>");
   }
   if (!assignments.isEmpty()) {
     sb.append("<ul>");
     for (Assignment a : assignments) {
       sb.append("<li><font color='blue'>")
           .append(a.getClass().getSimpleName())
           .append(" : <u>")
           .append(a.getIdentifier())
           .append("</u></font></li>");
     }
     sb.append("</ul>");
   }
   if (!children.isEmpty()) {
     sb.append("<ul>");
     for (ScopeTreeNode stn : children) {
       stn.printTreeAsHTML(sb);
     }
     sb.append("</ul>");
   }
 }
コード例 #9
0
 // Delete
 public void deleteAssignment(Assignment assignment) {
   SQLiteDatabase db = this.getWritableDatabase();
   db.delete(TABLE_ASSIGNMENT, A_ID + "=?", new String[] {String.valueOf(assignment.getaid())});
   db.close();
   deletePartners(assignment.getpartners());
   deleteGrade(assignment.getgrade());
 }
コード例 #10
0
  @Override
  public boolean process() {
    uniqueRows = new ArrayList<K>(new HashSet<K>(rows));
    Collections.sort(uniqueRows);
    uniqueCols = new ArrayList<J>(new HashSet<J>(cols));
    Collections.sort(uniqueCols);

    final List<Assignment> assignments = new ArrayList<Assignment>(costs.length);
    for (int i = 0; i < costs.length; i++) {
      final K rowObj = rows.get(i);
      final J colObj = cols.get(i);
      final int r = Collections.binarySearch(uniqueRows, rowObj);
      final int c = Collections.binarySearch(uniqueCols, colObj);
      assignments.add(new Assignment(r, c, costs[i]));
    }
    Collections.sort(assignments);

    // Test we do not have duplicates.
    Assignment previousAssgn = assignments.get(0);
    for (int i = 1; i < assignments.size(); i++) {
      final Assignment assgn = assignments.get(i);
      if (assgn.equals(previousAssgn)) {
        errorMessage = BASE_ERROR_MESSAGE + "Found duplicate assignment at index: " + assgn + ".";
        return false;
      }
      previousAssgn = assgn;
    }

    final int nRows = uniqueRows.size();
    final int nCols = uniqueCols.size();
    final int[] kk = new int[costs.length];
    final int[] number = new int[nRows];
    final double[] cc = new double[costs.length];

    Assignment a = assignments.get(0);
    kk[0] = a.c;
    cc[0] = a.cost;
    int currentRow = a.r;
    int nOfEl = 0;
    for (int i = 1; i < assignments.size(); i++) {
      a = assignments.get(i);

      kk[i] = a.c;
      cc[i] = a.cost;
      nOfEl++;

      if (a.r != currentRow) {
        number[currentRow] = nOfEl;
        nOfEl = 0;
        currentRow = a.r;
      }
    }
    number[currentRow] = nOfEl + 1;

    scm = new SparseCostMatrix(cc, kk, number, nCols);

    alternativeCost = computeAlternativeCosts();

    return true;
  }
コード例 #11
0
  public class Scenario5Elements extends AbstractParserRuleElementFinder {
    private final ParserRule rule =
        (ParserRule)
            GrammarUtil.findRuleForName(
                getGrammar(),
                "org.eclipse.xtext.parser.parameters.TwoParametersTestLanguage.Scenario5");
    private final Alternatives cAlternatives = (Alternatives) rule.eContents().get(1);
    private final Group cGroup_0 = (Group) cAlternatives.eContents().get(0);
    private final Assignment cFirstAssignment_0_0 = (Assignment) cGroup_0.eContents().get(0);
    private final RuleCall cFirstIDTerminalRuleCall_0_0_0 =
        (RuleCall) cFirstAssignment_0_0.eContents().get(0);
    private final Group cGroup_1 = (Group) cAlternatives.eContents().get(1);
    private final Assignment cSecondAssignment_1_0 = (Assignment) cGroup_1.eContents().get(0);
    private final RuleCall cSecondIDTerminalRuleCall_1_0_0 =
        (RuleCall) cSecondAssignment_1_0.eContents().get(0);

    // Scenario5 <A, B Scenario:
    //	<A & B> first=ID
    //	| <!A | !B> second=ID
    @Override
    public ParserRule getRule() {
      return rule;
    }

    // <A & B> first=ID | <!A | !B> second=ID
    public Alternatives getAlternatives() {
      return cAlternatives;
    }

    // <A & B> first=ID
    public Group getGroup_0() {
      return cGroup_0;
    }

    // first=ID
    public Assignment getFirstAssignment_0_0() {
      return cFirstAssignment_0_0;
    }

    // ID
    public RuleCall getFirstIDTerminalRuleCall_0_0_0() {
      return cFirstIDTerminalRuleCall_0_0_0;
    }

    // <!A | !B> second=ID
    public Group getGroup_1() {
      return cGroup_1;
    }

    // second=ID
    public Assignment getSecondAssignment_1_0() {
      return cSecondAssignment_1_0;
    }

    // ID
    public RuleCall getSecondIDTerminalRuleCall_1_0_0() {
      return cSecondIDTerminalRuleCall_1_0_0;
    }
  }
コード例 #12
0
  public class NamespaceElements extends AbstractParserRuleElementFinder {
    private final ParserRule rule =
        (ParserRule)
            GrammarUtil.findRuleForName(
                getGrammar(), "org.eclipse.xtext.idea.sdomain.SDomain.Namespace");
    private final Group cGroup = (Group) rule.eContents().get(1);
    private final Assignment cNameAssignment_0 = (Assignment) cGroup.eContents().get(0);
    private final RuleCall cNameQualifiedNameParserRuleCall_0_0 =
        (RuleCall) cNameAssignment_0.eContents().get(0);
    private final Keyword cLeftCurlyBracketKeyword_1 = (Keyword) cGroup.eContents().get(1);
    private final Assignment cElementsAssignment_2 = (Assignment) cGroup.eContents().get(2);
    private final RuleCall cElementsElementParserRuleCall_2_0 =
        (RuleCall) cElementsAssignment_2.eContents().get(0);
    private final Keyword cRightCurlyBracketKeyword_3 = (Keyword) cGroup.eContents().get(3);

    // Namespace:
    //	name=QualifiedName '{'
    //	elements+=Element*
    //	'}';
    @Override
    public ParserRule getRule() {
      return rule;
    }

    // name=QualifiedName '{' elements+=Element* '}'
    public Group getGroup() {
      return cGroup;
    }

    // name=QualifiedName
    public Assignment getNameAssignment_0() {
      return cNameAssignment_0;
    }

    // QualifiedName
    public RuleCall getNameQualifiedNameParserRuleCall_0_0() {
      return cNameQualifiedNameParserRuleCall_0_0;
    }

    // '{'
    public Keyword getLeftCurlyBracketKeyword_1() {
      return cLeftCurlyBracketKeyword_1;
    }

    // elements+=Element*
    public Assignment getElementsAssignment_2() {
      return cElementsAssignment_2;
    }

    // Element
    public RuleCall getElementsElementParserRuleCall_2_0() {
      return cElementsElementParserRuleCall_2_0;
    }

    // '}'
    public Keyword getRightCurlyBracketKeyword_3() {
      return cRightCurlyBracketKeyword_3;
    }
  }
コード例 #13
0
  public boolean visit(Assignment assignment) throws Exception {
    Expression left = assignment.getVariable();
    if (left instanceof FieldAccess) { // class variable ($this->a = .)
      FieldAccess fieldAccess = (FieldAccess) left;
      Expression dispatcher = fieldAccess.getDispatcher();
      if (dispatcher instanceof VariableReference
          && "$this" //$NON-NLS-1$
              .equals(((VariableReference) dispatcher).getName())) {
        Expression field = fieldAccess.getField();
        if (field instanceof SimpleReference) {
          SimpleReference ref = (SimpleReference) field;
          ISourceElementRequestor.FieldInfo info = new ISourceElementRequestor.FieldInfo();
          info.modifiers = Modifiers.AccPublic;
          info.name = '$' + ref.getName();
          info.nameSourceEnd = ref.sourceEnd() - 1;
          info.nameSourceStart = ref.sourceStart();
          info.declarationStart = assignment.sourceStart();
          fInfoStack.push(info);
          fRequestor.enterField(info);
          fNodes.push(assignment);
        }
      }
    } else if (left instanceof VariableReference && !(left instanceof ArrayVariableReference)) {
      if (!declarations.empty()) {
        ASTNode parentDeclaration = declarations.peek();
        if (parentDeclaration instanceof MethodDeclaration
                && methodGlobalVars.peek().contains(((VariableReference) left).getName())
            || parentDeclaration == fLastNamespace) {
          deferredDeclarations.add(assignment);
          return false;
        }
      }
      if (!fInfoStack.isEmpty() && fInfoStack.peek() instanceof ISourceElementRequestor.FieldInfo) {
        if (!fDeferredVariables.containsKey(fInfoStack.peek())) {
          fDeferredVariables.put(fInfoStack.peek(), new LinkedList<Assignment>());
        }
        fDeferredVariables.get(fInfoStack.peek()).add(assignment);
        return false;
      }
      ISourceElementRequestor.FieldInfo info = new ISourceElementRequestor.FieldInfo();
      info.modifiers = Modifiers.AccPublic;
      info.name = ((VariableReference) left).getName();
      info.nameSourceEnd = left.sourceEnd() - 1;
      info.nameSourceStart = left.sourceStart();
      info.declarationStart = assignment.sourceStart();

      fInfoStack.push(info);
      if (assignment.getOperatorType() == Assignment.OP_EQUAL) {
        fRequestor.enterField(info);
      } else {
        ISourceElementRequestor sourceElementRequestor = (ISourceElementRequestor) fRequestor;
        sourceElementRequestor.enterFieldCheckDuplicates(info);
      }
      fNodes.push(assignment);
    }
    return true;
  }
コード例 #14
0
 public void loopThrough(HashMap<Variable, Guard> map, Assignment a) {
   for (Map.Entry<Variable, Guard> entry : map.entrySet()) {
     while (checkGuardCondition(
         entry.getValue().getCondition(), entry.getKey(), entry.getValue())) {
       a.update(entry.getKey(), a.getUpdateVal(), a.getCondition());
       System.out.println(entry.getKey().getVarName() + "  :  " + entry.getKey().getVarValue());
     }
   }
 }
コード例 #15
0
ファイル: ERD2WUtilities.java プロジェクト: algodata44/wonder
 public static boolean assignmentsAreEqual(Assignment a1, Assignment a2) {
   boolean areEqual = false;
   if (a1.getClass().equals(a2.getClass())
       && a1.keyPath() != null
       && a2.keyPath() != null
       && a1.value() != null
       && a2.value() != null) {
     areEqual = a1.keyPath().equals(a2.keyPath()) && a1.value().equals(a2.value());
   }
   return areEqual;
 }
コード例 #16
0
 @Override
 public int visit(IVisitableNode node) {
   if (node instanceof Scope) {
     Scope scope = (Scope) node;
     scopeTree.add(scope, null);
   } else if (node instanceof Assignment) {
     Assignment ass = (Assignment) node;
     scopeTree.add(ass.getMyScope(), ass);
   }
   return V_CONTINUE;
 }
コード例 #17
0
  public void testLinenoPlusEq() {
    AstRoot root = parse("\na\n" + "+=\n" + "b\n");
    ExpressionStatement expr = (ExpressionStatement) root.getFirstChild();
    Assignment assign = (Assignment) expr.getExpression();
    AstNode lhs = assign.getLeft();
    AstNode rhs = assign.getRight();

    assertEquals(1, lhs.getLineno());
    assertEquals(1, assign.getLineno());
    assertEquals(3, rhs.getLineno());
  }
コード例 #18
0
  private Assignment doOnePass(FactorGraph mdl, Assignment initial) {
    Assignment ret = (Assignment) initial.duplicate();
    for (int vidx = 0; vidx < ret.size(); vidx++) {
      Variable var = mdl.get(vidx);
      DiscreteFactor subcpt = constructConditionalCpt(mdl, var, ret);
      int value = subcpt.sampleLocation(r);
      ret.setValue(var, value);
    }

    return ret;
  }
コード例 #19
0
ファイル: PropNetFlattener.java プロジェクト: pkuzhf/ggp-base
    public void addAssignmentToIndex(Assignment assignment) {
      for (int i = 0; i < assignment.size(); i++) {
        GdlConstant c = assignment.get(i);
        if (indices.size() <= i) indices.add(new Index());
        Index index = indices.get(i);

        if (!index.containsKey(c)) index.put(c, new Assignments());
        Assignments val = index.get(c);
        val.add(assignment);
      }
    }
コード例 #20
0
 // Warning: destructively modifies ret's assignment to fullAssn (I could save and restore, but I
 // don't care
 private DiscreteFactor constructConditionalCpt(
     FactorGraph mdl, Variable var, Assignment fullAssn) {
   List ptlList = mdl.allFactorsContaining(var);
   LogTableFactor ptl = new LogTableFactor(var);
   for (AssignmentIterator it = ptl.assignmentIterator(); it.hasNext(); it.advance()) {
     Assignment varAssn = it.assignment();
     fullAssn.setValue(var, varAssn.get(var));
     ptl.setRawValue(varAssn, sumValues(ptlList, fullAssn));
   }
   ptl.normalize();
   return ptl;
 }
コード例 #21
0
ファイル: WPGenerator.java プロジェクト: bananen/faehrmann
  /**
   * Uses a VariableReplacer to replace the appropriate variable in the term which is calculated
   * until now.
   */
  @Override
  public Assignment assign(Assignment assignment) {
    if (assignment == null || assignment.getTerm() == null) {
      return null;
    }

    Replacement replacement = new Replacement(assignment.getVariable(), assignment.getTerm());
    VariableReplacer variableReplacer = new VariableReplacer(replacement);
    wp = variableReplacer.replace(wp);

    return null;
  }
コード例 #22
0
  public class PropertyElements extends AbstractParserRuleElementFinder {
    private final ParserRule rule =
        (ParserRule)
            GrammarUtil.findRuleForName(
                getGrammar(), "org.eclipse.xtext.idea.sdomain.SDomain.Property");
    private final Group cGroup = (Group) rule.eContents().get(1);
    private final Assignment cTypeAssignment_0 = (Assignment) cGroup.eContents().get(0);
    private final CrossReference cTypeTypeCrossReference_0_0 =
        (CrossReference) cTypeAssignment_0.eContents().get(0);
    private final RuleCall cTypeTypeQualifiedNameParserRuleCall_0_0_1 =
        (RuleCall) cTypeTypeCrossReference_0_0.eContents().get(1);
    private final Assignment cNameAssignment_1 = (Assignment) cGroup.eContents().get(1);
    private final RuleCall cNameIDTerminalRuleCall_1_0 =
        (RuleCall) cNameAssignment_1.eContents().get(0);

    // Property:
    //	type=[Type|QualifiedName] name=ID;
    @Override
    public ParserRule getRule() {
      return rule;
    }

    // type=[Type|QualifiedName] name=ID
    public Group getGroup() {
      return cGroup;
    }

    // type=[Type|QualifiedName]
    public Assignment getTypeAssignment_0() {
      return cTypeAssignment_0;
    }

    // [Type|QualifiedName]
    public CrossReference getTypeTypeCrossReference_0_0() {
      return cTypeTypeCrossReference_0_0;
    }

    // QualifiedName
    public RuleCall getTypeTypeQualifiedNameParserRuleCall_0_0_1() {
      return cTypeTypeQualifiedNameParserRuleCall_0_0_1;
    }

    // name=ID
    public Assignment getNameAssignment_1() {
      return cNameAssignment_1;
    }

    // ID
    public RuleCall getNameIDTerminalRuleCall_1_0() {
      return cNameIDTerminalRuleCall_1_0;
    }
  }
コード例 #23
0
ファイル: PropNetFlattener.java プロジェクト: pkuzhf/ggp-base
  private Assignment getConstantList(GdlTerm term) {
    Assignment rval = new Assignment();
    if (term instanceof GdlConstant) {
      rval.add((GdlConstant) term);
      return rval;
    } else if (term instanceof GdlVariable)
      throw new RuntimeException("Called getConstantList on something containing a variable.");

    GdlFunction func = (GdlFunction) term;
    for (GdlTerm t : func.getBody()) rval.addAll(getConstantList(t));

    return rval;
  }
コード例 #24
0
ファイル: RAst.java プロジェクト: baihualong/statet
 @Override
 public void visit(final Assignment node) throws InvocationTargetException {
   if (fInAssignment) {
     node.getSourceChild().acceptInR(this);
     return;
   }
   if (node.getStopOffset() >= fStartOffset && fStopOffset >= node.getOffset()) {
     fInAssignment = true;
     node.getSourceChild().acceptInR(this);
     fInAssignment = false;
     return;
   }
 }
コード例 #25
0
 public void completeTransaction_Server(
     EObject model,
     Assignment assignment,
     ContentAssistContext context,
     ICompletionProposalAcceptor acceptor) {
   completeRuleCall(
       ((RuleCall) ((Alternatives) assignment.getTerminal()).getElements().get(0)),
       context,
       acceptor);
   completeRuleCall(
       ((RuleCall) ((Alternatives) assignment.getTerminal()).getElements().get(1)),
       context,
       acceptor);
 }
コード例 #26
0
 public void completeAttributeSelector_Value(
     EObject model,
     Assignment assignment,
     ContentAssistContext context,
     ICompletionProposalAcceptor acceptor) {
   completeRuleCall(
       ((RuleCall) ((Alternatives) assignment.getTerminal()).getElements().get(0)),
       context,
       acceptor);
   completeRuleCall(
       ((RuleCall) ((Alternatives) assignment.getTerminal()).getElements().get(1)),
       context,
       acceptor);
 }
コード例 #27
0
  public class ObjectPropertyElements extends AbstractParserRuleElementFinder {
    private final ParserRule rule =
        (ParserRule) GrammarUtil.findRuleForName(getGrammar(), "ObjectProperty");
    private final Group cGroup = (Group) rule.eContents().get(1);
    private final Assignment cPropNameAssignment_0 = (Assignment) cGroup.eContents().get(0);
    private final RuleCall cPropNameSTRINGTerminalRuleCall_0_0 =
        (RuleCall) cPropNameAssignment_0.eContents().get(0);
    private final RuleCall cNAME_SEPTerminalRuleCall_1 = (RuleCall) cGroup.eContents().get(1);
    private final Assignment cPropValueAssignment_2 = (Assignment) cGroup.eContents().get(2);
    private final RuleCall cPropValueValueParserRuleCall_2_0 =
        (RuleCall) cPropValueAssignment_2.eContents().get(0);

    // ObjectProperty:
    //	propName=STRING NAME_SEP propValue=Value;
    public ParserRule getRule() {
      return rule;
    }

    // propName=STRING NAME_SEP propValue=Value
    public Group getGroup() {
      return cGroup;
    }

    // propName=STRING
    public Assignment getPropNameAssignment_0() {
      return cPropNameAssignment_0;
    }

    // STRING
    public RuleCall getPropNameSTRINGTerminalRuleCall_0_0() {
      return cPropNameSTRINGTerminalRuleCall_0_0;
    }

    // NAME_SEP
    public RuleCall getNAME_SEPTerminalRuleCall_1() {
      return cNAME_SEPTerminalRuleCall_1;
    }

    // propValue=Value
    public Assignment getPropValueAssignment_2() {
      return cPropValueAssignment_2;
    }

    // Value
    public RuleCall getPropValueValueParserRuleCall_2_0() {
      return cPropValueValueParserRuleCall_2_0;
    }
  }
コード例 #28
0
 public void completeLoadTest_Purpose(
     EObject model,
     Assignment assignment,
     ContentAssistContext context,
     ICompletionProposalAcceptor acceptor) {
   completeRuleCall(((RuleCall) assignment.getTerminal()), context, acceptor);
 }
コード例 #29
0
 public void completeLoadTest_Loadgroups(
     EObject model,
     Assignment assignment,
     ContentAssistContext context,
     ICompletionProposalAcceptor acceptor) {
   lookupCrossReference(((CrossReference) assignment.getTerminal()), context, acceptor);
 }
コード例 #30
0
 public void completeManifest_Modelinstancedpath(
     EObject model,
     Assignment assignment,
     ContentAssistContext context,
     ICompletionProposalAcceptor acceptor) {
   completeRuleCall(((RuleCall) assignment.getTerminal()), context, acceptor);
 }