public EnumMultiMap<FlowElement> getAnnotations() { if( annotations == null ) annotations = new EnumMultiMap<>(); return annotations; }
public FlowElementGraph( FlowElementGraph flowElementGraph ) { this(); this.platformInfo = flowElementGraph.platformInfo; this.sources = flowElementGraph.sources; this.sinks = flowElementGraph.sinks; this.traps = flowElementGraph.traps; this.checkpoints = flowElementGraph.checkpoints; this.requireUniqueCheckpoints = flowElementGraph.requireUniqueCheckpoints; if( flowElementGraph.annotations != null ) this.annotations = new EnumMultiMap<>( flowElementGraph.annotations ); copyFrom( flowElementGraph ); }
public FlowElementGraph( PlatformInfo platformInfo, ElementGraph elementGraph, Map<String, Tap> sources, Map<String, Tap> sinks, Map<String, Tap> traps, Map<String, Tap> checkpoints ) { this(); this.platformInfo = platformInfo; if( elementGraph == null ) elementGraph = BaseElementGraph.NULL; if( sources == null || sources.isEmpty() ) throw new IllegalArgumentException( "sources may not be null or empty" ); if( sinks == null || sinks.isEmpty() ) throw new IllegalArgumentException( "sinks may not be null or empty" ); this.sources = new HashMap<>( sources ); this.sinks = new HashMap<>( sinks ); this.traps = new HashMap<>( traps == null ? Collections.<String, Tap>emptyMap() : traps ); this.checkpoints = new HashMap<>( checkpoints == null ? Collections.<String, Tap>emptyMap() : checkpoints ); EnumMultiMap<FlowElement> annotations = ElementGraphs.annotations( elementGraph ); if( annotations != null ) this.annotations = new EnumMultiMap<>( annotations ); // prevents multiple edge from head and to tail extents copyFrom( ElementGraphs.asExtentMaskedSubGraph( elementGraph ) ); bindExtents(); }
public Partitions partition( PlannerContext plannerContext, ElementGraph elementGraph, Collection<FlowElement> excludes ) { Map<ElementGraph, EnumMultiMap> annotatedSubGraphs = new LinkedHashMap<>(); // need a safe copy if( elementGraph.containsVertex( Extent.head ) ) elementGraph = new ElementMaskSubGraph( elementGraph, Extent.head, Extent.tail ); annotatedSubGraphs.put( new ElementMultiGraph( elementGraph ), new EnumMultiMap() ); return new Partitions( this, elementGraph, annotatedSubGraphs ); } }
public EnumMultiMap<FlowElement> getCaptureMap() { if( captureMap != null ) return captureMap; captureMap = new EnumMultiMap<>(); Map<FlowElement, ElementExpression> reversed = new LinkedHashMap<>(); if( Util.reverseMap( vertexMapping, reversed ) ) throw new IllegalStateException( "duplicates found in mapping" ); // returns a Set ordered topologically by the matched graph. retains this first, this second ordering for simple cases Iterator<FlowElement> iterator = ElementGraphs.getTopologicalIterator( getMatchedGraph() ); while( iterator.hasNext() ) { FlowElement next = iterator.next(); ElementExpression elementExpression = reversed.get( next ); // matchedGraph may be a super-set of what's in the mapping, so elementExpression may be null if( elementExpression == null ) continue; captureMap.addAll( elementExpression.getCapture(), next ); } return captureMap; }
public EnumMultiMap<FlowElement> getAnnotations() { EnumMultiMap<FlowElement> annotations = new EnumMultiMap<>(); for( Process process : vertexSet() ) { ElementGraph elementGraph = process.getElementGraph(); if( elementGraph instanceof AnnotatedGraph ) annotations.addAll( ( (AnnotatedGraph) elementGraph ).getAnnotations() ); } return annotations; }
@Override public EnumMultiMap getAnnotationMap( ElementAnnotation[] annotations ) { EnumMultiMap annotationsMap = new EnumMultiMap(); if( annotations.length == 0 ) return annotationsMap; Match match = getLastMatch(); for( ElementAnnotation annotation : annotations ) annotationsMap.addAll( annotation.getAnnotation(), match.getCapturedElements( annotation.getCapture() ) ); return annotationsMap; }
EnumMultiMap<FlowElement> captureMap = new EnumMultiMap<>();