private static List<PType> getTypeList(APatternListTypePair node) { List<PType> list = new Vector<PType>(); for (int i = 0; i < node.getPatterns().size(); i++) { PType type = (PType) node.getType();// .clone();//Use clone since we // don't want to make a switch // for all // types. // type.parent(null);//new new type not in the tree yet. list.add(type); } return list; }
@Override public void caseAPatternListTypePair(APatternListTypePair pltp, NewQuestion question) throws AnalysisException { af.createPPatternListAssistant().typeResolve(pltp.getPatterns(), question.rootVisitor, question.question); PType type = af.createPTypeAssistant().typeResolve(pltp.getType(), null, question.rootVisitor, question.question); pltp.setType(type); }
public static APatternListTypePair newAPatternListTypePair( List<PPattern> patterns, PType type) { APatternListTypePair result = new APatternListTypePair(); result.setPatterns(patterns); result.setType(type); return result; }
/** * Returns a deep clone of this {@link APatternListTypePair} node. * @return a deep clone of this {@link APatternListTypePair} node */ public APatternListTypePair clone() { return new APatternListTypePair( _resolved, cloneList(_patterns), _type ); }
/** * Creates a new complete constructor {@code APatternListTypePair} 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 patterns_ the {@link NodeList} node for the {@code patterns} child of this {@link APatternListTypePair} node * @param type_ the {@link PType} <b>graph</a> node for the {@code type} child of this {@link APatternListTypePair} node. * <i>The parent of this {@code type } will not be changed by adding it to this node.</i> */ public APatternListTypePair(Boolean resolved_, List<? extends PPattern> patterns_, PType type_) { super(resolved_); this.setPatterns(patterns_); this.setType(type_); }
public List<List<PPattern>> getListParamPatternList( AImplicitOperationDefinition func) { List<List<PPattern>> parameters = new ArrayList<List<PPattern>>(); List<PPattern> plist = new ArrayList<PPattern>(); for (APatternListTypePair pl : func.getParameterPatterns()) { plist.addAll(pl.getPatterns()); } parameters.add(plist); return parameters; }
e.apply(this);
public List<PPattern> getParamPatternList( AImplicitOperationDefinition definition) { List<PPattern> plist = new ArrayList<PPattern>(); for (APatternListTypePair pl : definition.getParameterPatterns()) { plist.addAll(pl.getPatterns()); } return plist; }
e.apply(this, question);
/** * Creates a deep clone of this {@link APatternListTypePair} 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 APatternListTypePair} node */ public APatternListTypePair clone(Map<INode,INode> oldToNewMap) { APatternListTypePair node = new APatternListTypePair( _resolved, cloneList(_patterns, oldToNewMap), _type ); oldToNewMap.put(this, node); return node; }
private static List<String> getString(List<APatternListTypePair> node) { List<String> list = new Vector<String>(); for (APatternListTypePair pl : node) { list.add("(" + getStringPattern(pl.getPatterns()) + ":" + pl.getType() + ")"); } return list; }
@SuppressWarnings("unchecked") public List<List<PPattern>> getParamPatternList( AImplicitFunctionDefinition d) { List<List<PPattern>> parameters = new ArrayList<List<PPattern>>(); List<PPattern> plist = new ArrayList<PPattern>(); for (APatternListTypePair pl : d.getParamPatterns()) { plist.addAll((Collection<PPattern>) pl.getPatterns().clone()); } parameters.add(plist); return parameters; } }
e.apply(this);
private List<PDefinition> getDefinitions(APatternListTypePair pltp, NameScope scope) { List<PDefinition> list = new Vector<PDefinition>(); for (PPattern p : pltp.getPatterns()) { list.addAll(af.createPPatternAssistant().getDefinitions(p, pltp.getType(), scope)); } return list; } }
private PExp buildMeasureLeft(AImplicitFunctionDefinition def, AApplyExp apply) throws AnalysisException { List<PPattern> paramPatterns = new LinkedList<PPattern>(); for (APatternListTypePair pair : def.getParamPatterns()) { paramPatterns.addAll(pair.getPatterns()); } return buildMeasureLeftParams(apply, def.getTypeParams(), def.getActualResult(), def.getMeasureName(), paramPatterns); }
e.apply(this, question);
public Collection<? extends PDefinition> getDefinitions( APatternListTypePair pltp, NameScope scope, ITypeCheckerAssistantFactory assistantFactory) { List<PDefinition> list = new Vector<PDefinition>(); for (PPattern p : pltp.getPatterns()) { list.addAll(assistantFactory.createPPatternAssistant().getDefinitions(p, pltp.getType(), scope)); } return list; }
private OperationValue(AImplicitOperationDefinition def, FunctionValue precondition, FunctionValue postcondition, AStateDefinition state, boolean async) { this.impldef = def; this.expldef = null; this.name = def.getName(); this.type = (AOperationType) def.getType(); this.paramPatterns = new Vector<PPattern>(); for (APatternListTypePair ptp : def.getParameterPatterns()) { paramPatterns.addAll(ptp.getPatterns()); } this.body = def.getBody(); this.precondition = precondition; this.postcondition = postcondition; this.state = state; this.classdef = def.getClassDefinition(); this.isAsync = async; traceRT = Settings.dialect == Dialect.VDM_RT && classdef != null && !(classdef instanceof ASystemClassDefinition) && !classdef.getName().getName().equals("CPU") && !classdef.getName().getName().equals("BUS") && !name.getName().equals("thread"); }
e.apply(this);
/** * Called by the {@link APatternListTypePair} node from {@link APatternListTypePair#apply(IAnalysis)}. * @param node the calling {@link APatternListTypePair} node */ public void caseAPatternListTypePair(APatternListTypePair node) throws AnalysisException { _visitedNodes.add(node); inAPatternListTypePair(node); { List<PPattern> copy = new ArrayList<PPattern>(node.getPatterns()); for( PPattern e : copy) { if(!_visitedNodes.contains(e)) { e.apply(this); } } } if(node.getType() != null && !_visitedNodes.contains(node.getType())) { node.getType().apply(this); } outAPatternListTypePair(node); }