Tabnine Logo
AssignmentExpression
Code IndexAdd Tabnine to your IDE (free)

How to use
AssignmentExpression
in
se.cambio.cds.gdl.model.expression

Best Java code snippets using se.cambio.cds.gdl.model.expression.AssignmentExpression (Showing top 15 results out of 315)

origin: org.gdl-lang.gdl-tools/gdl-parser

final public AssignmentExpression assignmentExpression() throws ParseException {
 ExpressionItem item = null;
 ExpressionItem item2 = null;
 item = expression_leaf();
 jj_consume_token(SYM_ASSIGNMENT);
 item2 = expression_leaf();
   {if (true) return new AssignmentExpression((Variable) item, item2);}
 throw new Error("Missing return statement in function");
}
origin: org.gdl-lang.gdl-tools/cds-core

private static void addGTCodesInWrites(ExpressionItem expressionItem, Set<String> gtCodes) {
  if (expressionItem instanceof CreateInstanceExpression) {
    MultipleAssignmentExpression multipleAssignmentExpression = ((CreateInstanceExpression) expressionItem).getAssignment();
    for (AssignmentExpression assignmentExpression : multipleAssignmentExpression.getAssignmentExpressions()) {
      addGTCodesInWrites(assignmentExpression, gtCodes);
    }
  } else if (expressionItem instanceof AssignmentExpression) {
    gtCodes.add(((AssignmentExpression) expressionItem).getVariable().getCode());
  } else {
    throw new RuntimeException("Unknown expression '" + expressionItem.getClass().getName() + "'");
  }
}
origin: org.gdl-lang.gdl-tools/gdl-graph

@Override
public boolean equals(Object obj) {
  if (this == obj) {
    return true;
  }
  if (!(obj instanceof GuideAssignmentExpression)) {
    return false;
  }
  GuideAssignmentExpression that = (GuideAssignmentExpression) obj;
  return assignmentExpression.equals(that.assignmentExpression) && guideId.equals(that.guideId);
}
origin: org.gdl-lang.gdl-tools/gdl-graph

  throw new InternalErrorException(new Exception("Element for binary expression " + guideAssignmentExpression + " not found!"));
gtCode = guideAssignmentExpression.getAssignmentExpression().getVariable().getCode();
ruleReference = new RuleReference(guideAssignmentExpression.getGuideId(), gtCode);
ElementInstance assignmentElementInstance = getElementInstanceByRuleReferenceMap().get(ruleReference);
  return false;
ExpressionItem assignmentExpressionItem = guideAssignmentExpression.getAssignmentExpression().getAssignment();
if (assignmentExpressionItem instanceof ConstantExpression) {
  ConstantExpression constantExpression = (ConstantExpression) assignmentExpressionItem;
origin: org.gdl-lang.gdl-tools/cds-core

private static void addGTCodesInReads(ExpressionItem expressionItem, Set<String> gtCodes) {
  if (expressionItem instanceof BinaryExpression) {
    BinaryExpression binaryExpression = (BinaryExpression) expressionItem;
    addGTCodesInReads(binaryExpression.getLeft(), gtCodes);
    addGTCodesInReads(binaryExpression.getRight(), gtCodes);
  } else if (expressionItem instanceof UnaryExpression) {
    UnaryExpression unaryExpression = (UnaryExpression) expressionItem;
    addGTCodesInReads(unaryExpression.getOperand(), gtCodes);
  } else if (expressionItem instanceof FunctionalExpression) {
    FunctionalExpression functionalExpression = (FunctionalExpression) expressionItem;
    for (ExpressionItem expressionItemAux : functionalExpression.getItems()) {
      addGTCodesInReads(expressionItemAux, gtCodes);
    }
  } else if (expressionItem instanceof AssignmentExpression) {
    AssignmentExpression assignmentExpression = (AssignmentExpression) expressionItem;
    addGTCodesInReads(assignmentExpression.getAssignment(), gtCodes);
  } else if (expressionItem instanceof MultipleAssignmentExpression) {
    MultipleAssignmentExpression multipleAssignmentExpression = (MultipleAssignmentExpression) expressionItem;
    for (AssignmentExpression assignmentExpression : multipleAssignmentExpression.getAssignmentExpressions()) {
      addGTCodesInReads(assignmentExpression, gtCodes);
    }
  } else if (expressionItem instanceof Variable) {
    Variable variable = (Variable) expressionItem;
    gtCodes.add(variable.getCode());
  } else if (expressionItem instanceof ConstantExpression) {
    //Do nothing
  } else {
    throw new RuntimeException("Unkown expression '" + expressionItem.getClass().getName() + "'");
  }
}
origin: org.gdl-lang.gdl-tools/gdl-graph

@Override
public int hashCode() {
  int result = guideId.hashCode();
  result = 31 * result + assignmentExpression.hashCode();
  return result;
}
origin: org.gdl-lang.gdl-tools/cds-core

protected void processAssignmentExpression(
    RuleLineCollection ruleLines,
    AssignmentExpression assignmentExpression) {
  String gtCode = assignmentExpression.getVariable().getCode();
  ExpressionItem expressionItemAux = assignmentExpression.getAssignment();
  String attribute = assignmentExpression.getVariable().getAttribute();
  GTCodeRuleLineElement gtCodeRuleLineElement =
      gtCodeElementMap.get(gtCode).getGTCodeRuleLineElement();
origin: org.gdl-lang.gdl-tools/gdl-graph

private void addSimpleConditionsFromExpressionItems(ExpressionItem expressionItem, Collection<BinaryExpression> simpleConditionsExpressionItems) {
  if (expressionItem instanceof BinaryExpression) {
    BinaryExpression binaryExpression = (BinaryExpression) expressionItem;
    if (OperatorKind.AND.equals(binaryExpression.getOperator())
        || OperatorKind.OR.equals(binaryExpression.getOperator())) {
      addSimpleConditionsFromExpressionItems(binaryExpression.getLeft(), simpleConditionsExpressionItems);
      addSimpleConditionsFromExpressionItems(binaryExpression.getRight(), simpleConditionsExpressionItems);
      return;
    } else {
      if (isArithmeticOperator(binaryExpression.getOperator())) {
        addSimpleConditionsFromComplexExpressions(binaryExpression.getLeft(), simpleConditionsExpressionItems);
        addSimpleConditionsFromComplexExpressions(binaryExpression.getRight(), simpleConditionsExpressionItems);
      }
      if (!(binaryExpression.getLeft() instanceof Variable) || !(binaryExpression.getRight() instanceof ConstantExpression)) {
        return; //Skip conditions that are not like format 'variable op constant'
      }
    }
    simpleConditionsExpressionItems.add(binaryExpression);
  } else if (expressionItem instanceof AssignmentExpression) {
    AssignmentExpression assignmentExpression = (AssignmentExpression) expressionItem;
    addSimpleConditionsFromExpressionItems(assignmentExpression.getAssignment(), simpleConditionsExpressionItems);
  }
}
origin: org.gdl-lang.gdl-tools/cds-core

  public AssignmentExpression toAssignmentExpression() throws IllegalStateException {
    if (archetypeElementRuleLineElement.getValue() == null) {
      throw new IllegalStateException("No variable set");
    }
    Variable var = new Variable(
        archetypeElementRuleLineElement.getValue().getValue(),
        null,
        null,
        OpenEHRConst.NULL_FLAVOR_ATTRIBUTE);
    DvCodedText nullValue = nullValueRuleLineElement.getValue();
    if (nullValue == null) {
      throw new IllegalStateException("No null value set");
    }
    String dataValueStr = nullValue.toString();
    LoggerFactory.getLogger(SetElementAttributeActionRuleLine.class).debug("dataValueStr: " + dataValueStr);
    return new AssignmentExpression(
        var,
        new ConstantExpression(dataValueStr));
  }
}
origin: org.gdl-lang.gdl-tools/gdl-graph

private void addExpressionNodes(String guideId, ExpressionItem currentExpressionItem, GraphNode graphNode) throws InternalErrorException {
  if (currentExpressionItem instanceof BinaryExpression) {
    BinaryExpression binaryExpression = (BinaryExpression) currentExpressionItem;
    if (OperatorKind.OR.equals(binaryExpression.getOperator())
        || OperatorKind.AND.equals(binaryExpression.getOperator())) {
      addExpressionNodes(guideId, binaryExpression.getLeft(), graphNode);
      addExpressionNodes(guideId, binaryExpression.getRight(), graphNode);
      return;
    } else if (isArithmeticOperator(binaryExpression.getOperator())) {
      addSimpleConditionsFromComplexExpressions(guideId, binaryExpression.getLeft(), graphNode);
      addSimpleConditionsFromComplexExpressions(guideId, binaryExpression.getRight(), graphNode);
    }
  } else if (currentExpressionItem instanceof AssignmentExpression) {
    AssignmentExpression assignmentExpression = (AssignmentExpression) currentExpressionItem;
    addExpressionNodes(guideId, assignmentExpression.getAssignment(), graphNode);
  }
  addExpressionToNode(guideId, currentExpressionItem, graphNode);
}
origin: org.gdl-lang.gdl-tools/gdl-graph

private Map<String, Collection<GuideAssignmentExpression>> generateAllAssignmentsByElementIdMap() {
  Map<String, Collection<GuideAssignmentExpression>> allAssignmentsByElementId = new HashMap<>();
  for (Guide guide : guideMap.values()) {
    if (guide.getDefinition() != null) {
      for (Rule rule : guide.getDefinition().getRules().values()) {
        Collection<AssignmentExpression> simpleAssignmentsFromExpressionItems =
            getSimpleAssignmentsFromExpressionItems(rule.getThenStatements());
        for (AssignmentExpression assignmentExpression : simpleAssignmentsFromExpressionItems) {
          Variable variable = assignmentExpression.getVariable();
          RuleReference ruleReference = new RuleReference(guide.getId(), variable.getCode());
          ElementInstance elementInstance = getElementInstanceByRuleReferenceMap().get(ruleReference);
          if (elementInstance == null) {
            logger.warn("ElementInstance not found for " + ruleReference);
          } else {
            Collection<GuideAssignmentExpression> guideAssignmentExpression =
                allAssignmentsByElementId.computeIfAbsent(elementInstance.getId(), k -> new ArrayList<>());
            guideAssignmentExpression.add(new GuideAssignmentExpression(guide.getId(), assignmentExpression));
          }
        }
      }
    }
  }
  return allAssignmentsByElementId;
}
origin: org.gdl-lang.gdl-tools/cds-core

public AssignmentExpression toAssignmentExpression() throws IllegalStateException {
  if (archetypeElementAttributeRuleLineElement.getValue() == null || archetypeElementAttributeRuleLineElement.getValue().getValue() == null) {
    throw new IllegalStateException("No variable set");
  }
  Variable var = new Variable(
      archetypeElementAttributeRuleLineElement.getValue().getValue().getValue(),
      null,
      null,
      archetypeElementAttributeRuleLineElement.getAttribute());
  return new AssignmentExpression(
      var,
      expressionRuleLineElement.getValue());
}
origin: org.gdl-lang.gdl-tools/cds-core

  public AssignmentExpression toAssignmentExpression() throws IllegalStateException {
    ArchetypeElementVO archetypeElementVO = getArchetypeElementRuleLineElement().getArchetypeElementVO();
    if (archetypeElementVO == null) {
      log.debug("No variable set on assignment expression");
      return null;
    }
    String name = getArchetypeManager().getArchetypeElements().getText(archetypeElementVO, getLanguage());
    Variable var = new Variable(
        archetypeElementRuleLineElement.getValue().getValue(),
        null, name);
    DataValue dataValue = archetypeDataValueRuleLineElement.getValue();
    ConstantExpression constantExpression;
    if (dataValue != null) {
      constantExpression = DVUtil.convertToExpression(dataValue);
    } else {
      log.debug("No data value set");
      return null;
    }
    return new AssignmentExpression(
        var,
        constantExpression);
  }
}
origin: org.gdl-lang.gdl-tools/cds-core

public AssignmentExpression toAssignmentExpression() throws IllegalStateException {
  ArchetypeElementVO archetypeElementVO = getArchetypeElementRuleLineElement().getArchetypeElementVO();
  if (archetypeElementVO == null) {
    throw new IllegalStateException("No variable set");
  }
  String name = getArchetypeManager().getArchetypeElements().getText(archetypeElementVO, getLanguage());
  Variable var = new Variable(
      archetypeElementRuleLineElement.getValue().getValue(),
      null, name);
  ArchetypeElementVO archetypeElementVO2 = getSecondArchetypeElementRuleLineElement().getArchetypeElementVO();
  if (archetypeElementVO2 == null) {
    throw new IllegalStateException("No variable to assign set");
  }
  Variable varAux = new Variable(
      archetypeElementRuleLineElement2.getValue().getValue(),
      null, name);
  return new AssignmentExpression(var, varAux);//TODO
}
origin: org.gdl-lang.gdl-tools/gdl-parser

 op = OperatorKind.ASSIGNMENT;
 item2 = expression_leaf();
 {if (true) return new AssignmentExpression((Variable) item, item2);}
} else {
 switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
se.cambio.cds.gdl.model.expressionAssignmentExpression

Most used methods

  • <init>
  • getAssignment
  • getVariable
  • equals
  • hashCode

Popular in Java

  • Making http post requests using okhttp
  • getApplicationContext (Context)
  • setScale (BigDecimal)
  • requestLocationUpdates (LocationManager)
  • System (java.lang)
    Provides access to system-related information and resources including standard input and output. Ena
  • Socket (java.net)
    Provides a client-side TCP socket.
  • Comparator (java.util)
    A Comparator is used to compare two objects to determine their ordering with respect to each other.
  • HashMap (java.util)
    HashMap is an implementation of Map. All optional operations are supported.All elements are permitte
  • Callable (java.util.concurrent)
    A task that returns a result and may throw an exception. Implementors define a single method with no
  • Response (javax.ws.rs.core)
    Defines the contract between a returned instance and the runtime when an application needs to provid
  • Top Vim plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now