@Override public Boolean caseAMapPattern(AMapPattern pattern) throws AnalysisException { for (AMapletPatternMaplet p : pattern.getMaplets()) { if (p.apply(THIS)) { return true; } } return false; }
/** * Called by the {@link AMapletPatternMaplet} node from {@link AMapletPatternMaplet#apply(IAnalysis)}. * @param node the calling {@link AMapletPatternMaplet} node */ public void caseAMapletPatternMaplet(AMapletPatternMaplet node, Q question) throws AnalysisException { _visitedNodes.add(node); inAMapletPatternMaplet(node, 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); } outAMapletPatternMaplet(node, question); }
public static AMapletPatternMaplet newAMapletPatternMaplet(PPattern from, PPattern to) { AMapletPatternMaplet result = new AMapletPatternMaplet(); result.setResolved(false); result.setFrom(from); result.setTo(to); return result; }
/** * Returns a deep clone of this {@link AMapletPatternMaplet} node. * @return a deep clone of this {@link AMapletPatternMaplet} node */ public AMapletPatternMaplet clone() { return new AMapletPatternMaplet( cloneNode(_from), cloneNode(_to), _resolved ); }
/** * Creates a new complete constructor {@code AMapletPatternMaplet} node with the given nodes as children. * @deprecated This method should not be used, use AstFactory instead. * The basic child nodes are removed from their previous parents. * @param from_ the {@link PPattern} node for the {@code from} child of this {@link AMapletPatternMaplet} node * @param to_ the {@link PPattern} node for the {@code to} child of this {@link AMapletPatternMaplet} node * @param resolved_ the {@link Boolean} node for the {@code resolved} child of this {@link AMapletPatternMaplet} node */ public AMapletPatternMaplet(PPattern from_, PPattern to_, Boolean resolved_) { super(); this.setFrom(from_); this.setTo(to_); this.setResolved(resolved_); }
/** * Creates a deep clone of this {@link AMapletPatternMaplet} 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 AMapletPatternMaplet} node */ public AMapletPatternMaplet clone(Map<INode,INode> oldToNewMap) { AMapletPatternMaplet node = new AMapletPatternMaplet( cloneNode(_from, oldToNewMap), cloneNode(_to, oldToNewMap), _resolved ); oldToNewMap.put(this, node); return node; }
/** * Called by the {@link AMapletPatternMaplet} node from {@link AMapletPatternMaplet#apply(IAnalysis)}. * @param node the calling {@link AMapletPatternMaplet} node */ public void caseAMapletPatternMaplet(AMapletPatternMaplet node) throws AnalysisException { _visitedNodes.add(node); inAMapletPatternMaplet(node); if(node.getFrom() != null && !_visitedNodes.contains(node.getFrom())) { node.getFrom().apply(this); } if(node.getTo() != null && !_visitedNodes.contains(node.getTo())) { node.getTo().apply(this); } outAMapletPatternMaplet(node); }
@Override public Boolean caseAMapPattern(AMapPattern pattern) throws AnalysisException { for (AMapletPatternMaplet mp : pattern.getMaplets()) { // if (!AMapletPatternMapletAssistantTC.isSimple(mp)) // Original code. if (!mp.apply(THIS)) { return false; } } return true; }
/** * Called by the {@link AMapletPatternMaplet} node from {@link AMapletPatternMaplet#apply(IPOFAnalysis)}. * @param node the calling {@link AMapletPatternMaplet} node */ public void caseAMapletPatternMaplet(AMapletPatternMaplet node) throws AnalysisException { _visitedNodes.add(node); inAMapletPatternMaplet(node); if(node.getFrom() != null && !_visitedNodes.contains(node.getFrom())) { node.getFrom().apply(this); } if(node.getTo() != null && !_visitedNodes.contains(node.getTo())) { node.getTo().apply(this); } outAMapletPatternMaplet(node); }
@Override public void caseAMapPattern(AMapPattern pattern) throws AnalysisException { for (AMapletPatternMaplet mp : pattern.getMaplets()) { // af.createAMapletPatternMapletAssistant().unResolve(mp); mp.apply(THIS); } pattern.setResolved(false); }
public PExp caseAMapPattern(AMapPattern node) throws AnalysisException { AMapEnumMapExp map = new AMapEnumMapExp(); List<AMapletExp> values = new Vector<AMapletExp>(); for (AMapletPatternMaplet p : node.getMaplets()) { values.add((AMapletExp) p.apply(this).clone()); } map.setMembers(values); return addPossibleType(map, node); }
/** * Called by the {@link AMapletPatternMaplet} node from {@link AMapletPatternMaplet#apply(IAnalysis)}. * @param node the calling {@link AMapletPatternMaplet} node */ public A caseAMapletPatternMaplet(AMapletPatternMaplet node) throws AnalysisException { _visitedNodes.add(node); A retVal = createNewReturnValue(node); mergeReturns(retVal,inAMapletPatternMaplet(node)); 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,outAMapletPatternMaplet(node)); return retVal; }
/** * Called by the {@link AMapPattern} node from {@link AMapPattern#apply(IAnalysis)}. * @param node the calling {@link AMapPattern} node */ public void caseAMapPattern(AMapPattern node) throws AnalysisException { _visitedNodes.add(node); inAMapPattern(node); { List<PDefinition> copy = new ArrayList<PDefinition>(node.getDefinitions()); for( PDefinition e : copy) { if(!_visitedNodes.contains(e)) { e.apply(this); } } } { List<AMapletPatternMaplet> copy = new ArrayList<AMapletPatternMaplet>(node.getMaplets()); for( AMapletPatternMaplet e : copy) { if(!_visitedNodes.contains(e)) { e.apply(this); } } } outAMapPattern(node); }
/** * Called by the {@link AMapletPatternMaplet} node from {@link AMapletPatternMaplet#apply(IAnalysis)}. * @param node the calling {@link AMapletPatternMaplet} node */ public A caseAMapletPatternMaplet(AMapletPatternMaplet node, Q question) throws AnalysisException { _visitedNodes.add(node); A retVal = createNewReturnValue(node, question); mergeReturns(retVal,inAMapletPatternMaplet(node, 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,outAMapletPatternMaplet(node, question)); return retVal; }
/** * Called by the {@link AMapPattern} node from {@link AMapPattern#apply(IPOFAnalysis)}. * @param node the calling {@link AMapPattern} node */ public void caseAMapPattern(AMapPattern node) throws AnalysisException { _visitedNodes.add(node); inAMapPattern(node); { List<PDefinition> copy = new ArrayList<PDefinition>(node.getDefinitions()); for( PDefinition e : copy) { if(!_visitedNodes.contains(e)) { e.apply(this); } } } { List<AMapletPatternMaplet> copy = new ArrayList<AMapletPatternMaplet>(node.getMaplets()); for( AMapletPatternMaplet e : copy) { if(!_visitedNodes.contains(e)) { e.apply(this); } } } outAMapPattern(node); }
public Collection<? extends PDefinition> getDefinitions( AMapletPatternMaplet p, SMapType map, NameScope scope) { List<PDefinition> list = new Vector<PDefinition>(); list.addAll(af.createPPatternAssistant().getDefinitions(p.getFrom(), map.getFrom(), scope)); list.addAll(af.createPPatternAssistant().getDefinitions(p.getTo(), map.getTo(), scope)); return list; } }
/** * Called by the {@link AMapPattern} node from {@link AMapPattern#apply(IAnalysis)}. * @param node the calling {@link AMapPattern} node */ public void caseAMapPattern(AMapPattern node, Q question) throws AnalysisException { _visitedNodes.add(node); inAMapPattern(node, question); { List<PDefinition> copy = new ArrayList<PDefinition>(node.getDefinitions()); for( PDefinition e : copy) { if(!_visitedNodes.contains(e)) { e.apply(this, question); } } } { List<AMapletPatternMaplet> copy = new ArrayList<AMapletPatternMaplet>(node.getMaplets()); for( AMapletPatternMaplet e : copy) { if(!_visitedNodes.contains(e)) { e.apply(this, question); } } } outAMapPattern(node, question); }
public List<NameValuePairList> getAllNamedValues(AMapletPatternMaplet p, Entry<Value, Value> maplet, Context ctxt) throws AnalysisException { List<NameValuePairList> flist = af.createPPatternAssistant().getAllNamedValues(p.getFrom(), maplet.getKey(), ctxt); List<NameValuePairList> tlist = af.createPPatternAssistant().getAllNamedValues(p.getTo(), maplet.getValue(), ctxt); List<NameValuePairList> results = new Vector<NameValuePairList>(); for (NameValuePairList f : flist) { for (NameValuePairList t : tlist) { NameValuePairList both = new NameValuePairList(); both.addAll(f); both.addAll(t); results.add(both); // Every combination of from/to mappings } } return results; }
mergeReturns(retVal,e.apply(this));