public static AMapMapType newAMapMapType(ILexLocation location, PType from, PType to) { AMapMapType result = new AMapMapType(); initType(result, location); result.setFrom(from); result.setTo(to); result.setEmpty(false); return result; }
/** * Called by the {@link AMapMapType} node from {@link AMapMapType#apply(IAnalysis)}. * @param node the calling {@link AMapMapType} node */ public void caseAMapMapType(AMapMapType node, Q question) throws AnalysisException { _visitedNodes.add(node); inAMapMapType(node, question); { List<PDefinition> copy = new ArrayList<PDefinition>(node.getDefinitions()); for( PDefinition e : copy) { if(!_visitedNodes.contains(e)) { e.apply(this, question); } } } if(node.getFrom() != null && !_visitedNodes.contains(node.getFrom())) { node.getFrom().apply(this, question); } if(node.getTo() != null && !_visitedNodes.contains(node.getTo())) { node.getTo().apply(this, question); } outAMapMapType(node, question); }
public FiniteMapObligation(AMapCompMapExp exp, PType mapType, IPOContextStack ctxt, IPogAssistantFactory af) throws AnalysisException { super(exp, POType.FINITE_MAP, ctxt, exp.getLocation(), af); ILexNameToken finmap = getUnique("finmap"); ILexNameToken findex = getUnique("findex"); // eg. { a |-> b | a:A, b:B & p(a,b) }, gives... // // exists m:map nat to map A to B & // forall a:A, b:B & // p(a,b) => exists idx in set dom m & // m(idx) = { a |-> b } AExistsExp existsExp = new AExistsExp(); AMapMapType natmaptype = new AMapMapType(); natmaptype.setFrom(new ANatNumericBasicType()); natmaptype.setTo(mapType.clone()); existsExp.setBindList(getMultipleTypeBindList(natmaptype, finmap)); existsExp.setPredicate(getForallExp(exp.clone(), finmap, findex)); stitch = existsExp.clone(); valuetree.setPredicate(ctxt.getPredWithContext(existsExp)); }
/** * Returns a deep clone of this {@link AMapMapType} node. * @return a deep clone of this {@link AMapMapType} node */ public AMapMapType clone() { return new AMapMapType( _location, _resolved, _definitions, _from, _to, _empty ); }
/** * Called by the {@link AMapMapType} node from {@link AMapMapType#apply(IAnalysis)}. * @param node the calling {@link AMapMapType} node */ public void caseAMapMapType(AMapMapType node) throws AnalysisException { _visitedNodes.add(node); inAMapMapType(node); { List<PDefinition> copy = new ArrayList<PDefinition>(node.getDefinitions()); for( PDefinition e : copy) { if(!_visitedNodes.contains(e)) { e.apply(this); } } } if(node.getFrom() != null && !_visitedNodes.contains(node.getFrom())) { node.getFrom().apply(this); } if(node.getTo() != null && !_visitedNodes.contains(node.getTo())) { node.getTo().apply(this); } outAMapMapType(node); }
AMapMapType mapType = new AMapMapType(); mapType.setFrom(new ANatNumericBasicType()); mapType.setTo(settype.getSetof().clone());
/** * Creates a deep clone of this {@link AMapMapType} node while putting all * old node-new node relations in the map {@code oldToNewMap}. * @param oldToNewMap the map filled with the old node-new node relation * @return a deep clone of this {@link AMapMapType} node */ public AMapMapType clone(Map<INode,INode> oldToNewMap) { AMapMapType node = new AMapMapType( _location, _resolved, _definitions, _from, _to, _empty ); oldToNewMap.put(this, node); return node; }
/** * Called by the {@link AMapMapType} node from {@link AMapMapType#apply(IPOFAnalysis)}. * @param node the calling {@link AMapMapType} node */ public void caseAMapMapType(AMapMapType node) throws AnalysisException { _visitedNodes.add(node); inAMapMapType(node); { List<PDefinition> copy = new ArrayList<PDefinition>(node.getDefinitions()); for( PDefinition e : copy) { if(!_visitedNodes.contains(e)) { e.apply(this); } } } if(node.getFrom() != null && !_visitedNodes.contains(node.getFrom())) { node.getFrom().apply(this); } if(node.getTo() != null && !_visitedNodes.contains(node.getTo())) { node.getTo().apply(this); } outAMapMapType(node); }
public static AMapMapType newAMapMapType(ILexLocation location) { AMapMapType result = new AMapMapType(); initType(result, location); result.setFrom(AstFactory.newAUnknownType(location)); result.setTo(AstFactory.newAUnknownType(location)); result.setEmpty(true); return result; }
/** * Called by the {@link AMapMapType} node from {@link AMapMapType#apply(IAnalysis)}. * @param node the calling {@link AMapMapType} node */ public A caseAMapMapType(AMapMapType node) throws AnalysisException { _visitedNodes.add(node); A retVal = createNewReturnValue(node); mergeReturns(retVal,inAMapMapType(node)); { List<PDefinition> copy = new ArrayList<PDefinition>(node.getDefinitions()); for( PDefinition e : copy) { if(!_visitedNodes.contains(e)) { mergeReturns(retVal,e.apply(this)); } } } if(node.getFrom() != null && !_visitedNodes.contains(node.getFrom())) { mergeReturns(retVal,node.getFrom().apply(this)); } if(node.getTo() != null && !_visitedNodes.contains(node.getTo())) { mergeReturns(retVal,node.getTo().apply(this)); } mergeReturns(retVal,outAMapMapType(node)); return retVal; }
/** * Called by the {@link AMapMapType} node from {@link AMapMapType#apply(IAnalysis)}. * @param node the calling {@link AMapMapType} node */ public A caseAMapMapType(AMapMapType node, Q question) throws AnalysisException { _visitedNodes.add(node); A retVal = createNewReturnValue(node, question); mergeReturns(retVal,inAMapMapType(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.getFrom() != null && !_visitedNodes.contains(node.getFrom())) { mergeReturns(retVal,node.getFrom().apply(this, question)); } if(node.getTo() != null && !_visitedNodes.contains(node.getTo())) { mergeReturns(retVal,node.getTo().apply(this, question)); } mergeReturns(retVal,outAMapMapType(node, question)); return retVal; }