@Override public String caseARealLiteralExp(ARealLiteralExp node, IndentTracker question) throws AnalysisException { return Double.toString(node.getValue().getValue()); }
/** * Sets the {@code _value} child of this {@link ARealLiteralExp} node. * @param value the new {@code _value} child of this {@link ARealLiteralExp} node */ public void setValue(ILexRealToken value) { if (this._value != null) { this._value.parent(null); } if (value != null) { if (value.parent() != null) { value.parent().removeChild(value); } value.parent(this); } this._value = value; }
/** * Called by the {@link ARealPattern} node from {@link ARealPattern#apply(IAnalysis)}. * @param node the calling {@link ARealPattern} node */ public void caseARealPattern(ARealPattern node, Q question) throws AnalysisException { _visitedNodes.add(node); inARealPattern(node, question); { List<PDefinition> copy = new ArrayList<PDefinition>(node.getDefinitions()); for( PDefinition e : copy) { if(!_visitedNodes.contains(e)) { e.apply(this, question); } } } if(node.getValue() != null ) { node.getValue().apply(this, question); } outARealPattern(node, question); }
public PExp caseARealPattern(ARealPattern node) throws AnalysisException { ARealLiteralExp exp = new ARealLiteralExp(); exp.setValue(node.getValue().clone()); addPossibleType(exp, node); return exp; }
/** * Called by the {@link ARealPattern} node from {@link ARealPattern#apply(IAnalysis)}. * @param node the calling {@link ARealPattern} node */ public void caseARealPattern(ARealPattern node) throws AnalysisException { _visitedNodes.add(node); inARealPattern(node); { List<PDefinition> copy = new ArrayList<PDefinition>(node.getDefinitions()); for( PDefinition e : copy) { if(!_visitedNodes.contains(e)) { e.apply(this); } } } if(node.getValue() != null ) { node.getValue().apply(this); } outARealPattern(node); }
@Override public SPatternIR caseARealPattern(ARealPattern node, IRInfo question) throws AnalysisException { double value = node.getValue().getValue(); ARealPatternIR realPatternCg = new ARealPatternIR(); realPatternCg.setValue(value); return realPatternCg; }
/** * Called by the {@link ARealPattern} node from {@link ARealPattern#apply(IPOFAnalysis)}. * @param node the calling {@link ARealPattern} node */ public void caseARealPattern(ARealPattern node) throws AnalysisException { _visitedNodes.add(node); inARealPattern(node); { List<PDefinition> copy = new ArrayList<PDefinition>(node.getDefinitions()); for( PDefinition e : copy) { if(!_visitedNodes.contains(e)) { e.apply(this); } } } if(node.getValue() != null ) { node.getValue().apply(this); } outARealPattern(node); }
/** * Sets the {@code _value} child of this {@link ARealPattern} node. * @param value the new {@code _value} child of this {@link ARealPattern} node */ public void setValue(ILexRealToken value) { if (this._value != null) { this._value.parent(null); } if (value != null) { if (value.parent() != null) { value.parent().removeChild(value); } value.parent(this); } this._value = value; }
private boolean neverZero(PExp exp) { if (exp instanceof AIntLiteralExp) { AIntLiteralExp il_Exp = (AIntLiteralExp) exp; if (il_Exp.getValue().getValue() != 0) { return true; } } if (exp instanceof ARealLiteralExp) { ARealLiteralExp rl_Exp = (ARealLiteralExp) exp; if (rl_Exp.getValue().getValue() != 0) { return true; } } return false; }
/** * Called by the {@link ARealLiteralExp} node from {@link ARealLiteralExp#apply(IPOFAnalysis)}. * @param node the calling {@link ARealLiteralExp} node */ public void caseARealLiteralExp(ARealLiteralExp node) throws AnalysisException { _visitedNodes.add(node); inARealLiteralExp(node); if(node.getType() != null && !_visitedNodes.contains(node.getType())) { node.getType().apply(this); } if(node.getValue() != null ) { node.getValue().apply(this); } outARealLiteralExp(node); }
@Override public List<NameValuePairList> caseARealPattern(ARealPattern pattern, Newquestion question) throws AnalysisException { List<NameValuePairList> result = new Vector<NameValuePairList>(); try { if (question.expval.realValue(question.ctxt) != pattern.getValue().getValue()) { VdmRuntimeError.patternFail(4113, "Real pattern match failed", pattern.getLocation()); } } catch (ValueException e) { VdmRuntimeError.patternFail(e, pattern.getLocation()); } result.add(new NameValuePairList()); return result; }
/** * Called by the {@link ARealLiteralExp} node from {@link ARealLiteralExp#apply(IAnalysis)}. * @param node the calling {@link ARealLiteralExp} node */ public void caseARealLiteralExp(ARealLiteralExp node) throws AnalysisException { _visitedNodes.add(node); inARealLiteralExp(node); if(node.getType() != null && !_visitedNodes.contains(node.getType())) { node.getType().apply(this); } if(node.getValue() != null ) { node.getValue().apply(this); } outARealLiteralExp(node); }
@Override public PType caseARealLiteralExp(ARealLiteralExp node, TypeCheckInfo question) { ILexRealToken value = node.getValue(); if (Math.round(value.getValue()) == value.getValue()) { if (value.getValue() < 0) { node.setType(AstFactory.newAIntNumericBasicType(node.getLocation())); } else if (value.getValue() == 0) { node.setType(AstFactory.newANatNumericBasicType(node.getLocation())); } else { node.setType(AstFactory.newANatOneNumericBasicType(node.getLocation())); } } else { node.setType(AstFactory.newARationalNumericBasicType(node.getLocation())); } return question.assistantFactory.createPTypeAssistant().checkConstraint(question.constraint, node.getType(), node.getLocation()); }
/** * Called by the {@link ARealLiteralExp} node from {@link ARealLiteralExp#apply(IAnalysis)}. * @param node the calling {@link ARealLiteralExp} node */ public void caseARealLiteralExp(ARealLiteralExp node, Q question) throws AnalysisException { _visitedNodes.add(node); inARealLiteralExp(node, question); if(node.getType() != null && !_visitedNodes.contains(node.getType())) { node.getType().apply(this, question); } if(node.getValue() != null ) { node.getValue().apply(this, question); } outARealLiteralExp(node, question); }
@Override public Value caseARealLiteralExp(ARealLiteralExp node, Context ctxt) throws AnalysisException { BreakpointManager.getBreakpoint(node).check(node.getLocation(), ctxt); try { return NumericValue.valueOf(node.getValue().getValue(), ctxt); } catch (ValueException e) { return VdmRuntimeError.abort(node.getLocation(), e); } }
/** * Called by the {@link ARealPattern} node from {@link ARealPattern#apply(IAnalysis)}. * @param node the calling {@link ARealPattern} node */ public A caseARealPattern(ARealPattern node, Q question) throws AnalysisException { _visitedNodes.add(node); A retVal = createNewReturnValue(node, question); mergeReturns(retVal,inARealPattern(node, question)); { List<PDefinition> copy = new ArrayList<PDefinition>(node.getDefinitions()); for( PDefinition e : copy) { if(!_visitedNodes.contains(e)) { mergeReturns(retVal,e.apply(this, question)); } } } if(node.getValue() != null ) { mergeReturns(retVal,node.getValue().apply(this, question)); } mergeReturns(retVal,outARealPattern(node, question)); return retVal; }
@Override public SExpIR caseARealLiteralExp(ARealLiteralExp node, IRInfo question) throws AnalysisException { PType type = node.getType(); double value = node.getValue().getValue(); STypeIR typeCg = type.apply(question.getTypeVisitor(), question); ARealLiteralExpIR realLitCg = new ARealLiteralExpIR(); realLitCg.setType(typeCg); realLitCg.setValue(value); return realLitCg; }
/** * Called by the {@link ARealPattern} node from {@link ARealPattern#apply(IAnalysis)}. * @param node the calling {@link ARealPattern} node */ public A caseARealPattern(ARealPattern node) throws AnalysisException { _visitedNodes.add(node); A retVal = createNewReturnValue(node); mergeReturns(retVal,inARealPattern(node)); { List<PDefinition> copy = new ArrayList<PDefinition>(node.getDefinitions()); for( PDefinition e : copy) { if(!_visitedNodes.contains(e)) { mergeReturns(retVal,e.apply(this)); } } } if(node.getValue() != null ) { mergeReturns(retVal,node.getValue().apply(this)); } mergeReturns(retVal,outARealPattern(node)); return retVal; }
speed = frequencyExp.getValue().getValue();
/** * Called by the {@link ARealLiteralExp} node from {@link ARealLiteralExp#apply(IAnalysis)}. * @param node the calling {@link ARealLiteralExp} node */ public A caseARealLiteralExp(ARealLiteralExp node, Q question) throws AnalysisException { _visitedNodes.add(node); A retVal = createNewReturnValue(node, question); mergeReturns(retVal,inARealLiteralExp(node, question)); if(node.getType() != null && !_visitedNodes.contains(node.getType())) { mergeReturns(retVal,node.getType().apply(this, question)); } if(node.getValue() != null ) { mergeReturns(retVal,node.getValue().apply(this, question)); } mergeReturns(retVal,outARealLiteralExp(node, question)); return retVal; }