@Override public List<AIdentifierPattern> caseAMapUnionPattern( AMapUnionPattern pattern) throws AnalysisException { List<AIdentifierPattern> list = new Vector<AIdentifierPattern>(); list.addAll(pattern.getLeft().apply(THIS)); list.addAll(pattern.getRight().apply(THIS)); return list; }
@Override public Boolean caseAMapUnionPattern(AMapUnionPattern pattern) throws AnalysisException { return pattern.getLeft().apply(THIS) && pattern.getRight().apply(THIS); }
@Override public Integer caseAMapUnionPattern(AMapUnionPattern pattern) throws AnalysisException { int llen = pattern.getLeft().apply(THIS);// PPatternAssistantInterpreter.getLength(pattern.getLeft()); int rlen = pattern.getRight().apply(THIS);// PPatternAssistantInterpreter.getLength(pattern.getRight()); return llen == PPatternAssistantInterpreter.ANY || rlen == PPatternAssistantInterpreter.ANY ? PPatternAssistantInterpreter.ANY : llen + rlen; }
@Override public Boolean caseAMapUnionPattern(AMapUnionPattern pattern) throws AnalysisException { return pattern.getLeft().apply(THIS) || pattern.getRight().apply(THIS); }
/** * Called by the {@link AMapUnionPattern} node from {@link AMapUnionPattern#apply(IAnalysis)}. * @param node the calling {@link AMapUnionPattern} node */ public void caseAMapUnionPattern(AMapUnionPattern node, Q question) throws AnalysisException { _visitedNodes.add(node); inAMapUnionPattern(node, question); { List<PDefinition> copy = new ArrayList<PDefinition>(node.getDefinitions()); for( PDefinition e : copy) { if(!_visitedNodes.contains(e)) { e.apply(this, question); } } } if(node.getLeft() != null && !_visitedNodes.contains(node.getLeft())) { node.getLeft().apply(this, question); } if(node.getRight() != null && !_visitedNodes.contains(node.getRight())) { node.getRight().apply(this, question); } outAMapUnionPattern(node, question); }
/** * Called by the {@link AMapUnionPattern} node from {@link AMapUnionPattern#apply(IPOFAnalysis)}. * @param node the calling {@link AMapUnionPattern} node */ public void caseAMapUnionPattern(AMapUnionPattern node) throws AnalysisException { _visitedNodes.add(node); inAMapUnionPattern(node); { List<PDefinition> copy = new ArrayList<PDefinition>(node.getDefinitions()); for( PDefinition e : copy) { if(!_visitedNodes.contains(e)) { e.apply(this); } } } if(node.getLeft() != null && !_visitedNodes.contains(node.getLeft())) { node.getLeft().apply(this); } if(node.getRight() != null && !_visitedNodes.contains(node.getRight())) { node.getRight().apply(this); } outAMapUnionPattern(node); }
/** * Called by the {@link AMapUnionPattern} node from {@link AMapUnionPattern#apply(IAnalysis)}. * @param node the calling {@link AMapUnionPattern} node */ public void caseAMapUnionPattern(AMapUnionPattern node) throws AnalysisException { _visitedNodes.add(node); inAMapUnionPattern(node); { List<PDefinition> copy = new ArrayList<PDefinition>(node.getDefinitions()); for( PDefinition e : copy) { if(!_visitedNodes.contains(e)) { e.apply(this); } } } if(node.getLeft() != null && !_visitedNodes.contains(node.getLeft())) { node.getLeft().apply(this); } if(node.getRight() != null && !_visitedNodes.contains(node.getRight())) { node.getRight().apply(this); } outAMapUnionPattern(node); }
@Override public void caseAMapUnionPattern(AMapUnionPattern pattern) throws AnalysisException { pattern.getLeft().apply(THIS); pattern.getRight().apply(THIS); pattern.setResolved(false); }
@Override public List<PDefinition> caseAMapUnionPattern(AMapUnionPattern pattern, NewQuestion question) throws AnalysisException { List<PDefinition> defs = new Vector<PDefinition>(); if (!af.createPTypeAssistant().isMap(question.ptype)) { TypeCheckerErrors.report(3315, "Matching expression is not a map type", pattern.getLocation(), pattern); } defs.addAll(af.createPPatternAssistant().getDefinitions(pattern.getLeft(), question.ptype, question.scope)); defs.addAll(af.createPPatternAssistant().getDefinitions(pattern.getRight(), question.ptype, question.scope)); return defs; }
/** * Called by the {@link AMapUnionPattern} node from {@link AMapUnionPattern#apply(IAnalysis)}. * @param node the calling {@link AMapUnionPattern} node */ public A caseAMapUnionPattern(AMapUnionPattern node) throws AnalysisException { _visitedNodes.add(node); A retVal = createNewReturnValue(node); mergeReturns(retVal,inAMapUnionPattern(node)); { List<PDefinition> copy = new ArrayList<PDefinition>(node.getDefinitions()); for( PDefinition e : copy) { if(!_visitedNodes.contains(e)) { mergeReturns(retVal,e.apply(this)); } } } if(node.getLeft() != null && !_visitedNodes.contains(node.getLeft())) { mergeReturns(retVal,node.getLeft().apply(this)); } if(node.getRight() != null && !_visitedNodes.contains(node.getRight())) { mergeReturns(retVal,node.getRight().apply(this)); } mergeReturns(retVal,outAMapUnionPattern(node)); return retVal; }
/** * Called by the {@link AMapUnionPattern} node from {@link AMapUnionPattern#apply(IAnalysis)}. * @param node the calling {@link AMapUnionPattern} node */ public A caseAMapUnionPattern(AMapUnionPattern node, Q question) throws AnalysisException { _visitedNodes.add(node); A retVal = createNewReturnValue(node, question); mergeReturns(retVal,inAMapUnionPattern(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.getLeft() != null && !_visitedNodes.contains(node.getLeft())) { mergeReturns(retVal,node.getLeft().apply(this, question)); } if(node.getRight() != null && !_visitedNodes.contains(node.getRight())) { mergeReturns(retVal,node.getRight().apply(this, question)); } mergeReturns(retVal,outAMapUnionPattern(node, question)); return retVal; }
int rlen = af.createPPatternAssistant().getLength(pattern.getRight()); int size = values.size(); counts[0] = lnvps.size(); List<NameValuePairList> rnvps = af.createPPatternAssistant().getAllNamedValues(pattern.getRight(), new MapValue(second), question.ctxt); nvplists.add(rnvps); counts[1] = rnvps.size();
@Override public void caseAMapUnionPattern(AMapUnionPattern pattern, NewQuestion question) throws AnalysisException { if (pattern.getResolved()) { return; } else { pattern.setResolved(true); } try { pattern.getLeft().apply(THIS, question); pattern.getRight().apply(THIS, question); } catch (TypeCheckException e) { // af.createAMapUnionPatternAssistant().unResolve(pattern); pattern.apply(af.getPatternUnresolver()); throw e; } }
public PExp caseAMapUnionPattern(AMapUnionPattern node) throws AnalysisException { AMapUnionBinaryExp union = new AMapUnionBinaryExp(); union.setLeft(node.getLeft().apply(this).clone()); union.setOp(new LexKeywordToken(VDMToken.MUNION, null)); union.setRight(node.getRight().apply(this).clone()); return addPossibleType(union, node); }