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; }
public Set<FlowElement> getCapturedElements( ElementCapture... captures ) { return getCaptureMap().getAllValues( captures ); }
@Override public int hashCode() { int result = super.hashCode(); result = 31 * result + ( annotations != null ? annotations.hashCode() : 0 ); return result; } }
@Override protected void addParentAnnotations( ElementGraph parentElementGraph ) { if( !( parentElementGraph instanceof AnnotatedGraph ) || !( (AnnotatedGraph) parentElementGraph ).hasAnnotations() ) return; Set<FlowElement> vertexSet = vertexSet(); EnumMultiMap parentAnnotations = ( (AnnotatedGraph) parentElementGraph ).getAnnotations(); Set<Enum> allKeys = parentAnnotations.getKeys(); for( Enum annotation : allKeys ) { Set<FlowElement> flowElements = (Set<FlowElement>) parentAnnotations.getValues( annotation ); for( FlowElement flowElement : flowElements ) { if( vertexSet.contains( flowElement ) ) getAnnotations().addAll( annotation, flowElements ); } } }
public EnumMultiMap( EnumMultiMap map ) { addAll( map ); }
@Override public boolean applies( PlannerContext plannerContext, ElementGraph elementGraph, FlowElement flowElement ) { if( elementGraph instanceof AnnotatedGraph && ( (AnnotatedGraph) elementGraph ).hasAnnotations() ) return ( (AnnotatedGraph) elementGraph ).getAnnotations().getValues( annotation ).contains( flowElement ); return false; }
public EnumMultiMap<FlowElement> getAnnotations() { if( annotations == null ) annotations = new EnumMultiMap<>(); return annotations; }
@Override public boolean hasAnnotations() { return annotations != null && !annotations.isEmpty(); }
return label; Set<Enum> annotations = ( (AnnotatedGraph) elementGraph ).getAnnotations().getKeysFor( object );
private boolean hasElementAnnotation( Enum annotation, FlowElement flowElement ) { if( !( (AnnotatedGraph) elementGraph ).hasAnnotations() ) return false; return ( (AnnotatedGraph) elementGraph ).getAnnotations().hadKey( annotation, flowElement ); }
public static boolean equals( ElementGraph lhs, ElementGraph rhs ) { if( !equalsIgnoreAnnotations( lhs, rhs ) ) return false; if( !( lhs instanceof AnnotatedGraph ) && !( rhs instanceof AnnotatedGraph ) ) return true; if( !( lhs instanceof AnnotatedGraph ) || !( rhs instanceof AnnotatedGraph ) ) return false; AnnotatedGraph lhsAnnotated = (AnnotatedGraph) lhs; AnnotatedGraph rhsAnnotated = (AnnotatedGraph) rhs; if( lhsAnnotated.hasAnnotations() != rhsAnnotated.hasAnnotations() ) return false; if( !lhsAnnotated.hasAnnotations() ) return true; return lhsAnnotated.getAnnotations().equals( rhsAnnotated.getAnnotations() ); }
public ElementMultiGraph( ElementGraph parent, EnumMultiMap annotations ) { this( parent ); getAnnotations().addAll( annotations ); }
@Override public Set<? extends FlowElement> getFlowElementsFor( Enum annotation ) { if( pipelineGraphs.isEmpty() ) return ( (AnnotatedGraph) getElementGraph() ).getAnnotations().getValues( annotation ); Set<FlowElement> results = createIdentitySet(); for( ElementGraph pipelineGraph : pipelineGraphs ) results.addAll( ( (AnnotatedGraph) pipelineGraph ).getAnnotations().getValues( annotation ) ); return results; }
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 boolean hasAnnotations() { return annotations != null && !annotations.isEmpty(); }
public ProcessEdge( ElementGraph sourceElementGraph, FlowElement flowElement, ElementGraph sinkElementGraph ) { this.flowElement = flowElement; // for both set of ordinals, we only care about the edges entering the flowElement // the source may only provide a subset of the paths expected by the sink // all ordinals the source process provides this.sourceProvidedOrdinals = createOrdinals( sourceElementGraph.incomingEdgesOf( flowElement ) ); // all ordinals the sink process expects this.sinkExpectedOrdinals = createOrdinals( sinkElementGraph.incomingEdgesOf( flowElement ) ); setResolvedFields( sourceElementGraph, flowElement, sinkElementGraph ); if( sourceElementGraph instanceof AnnotatedGraph && ( (AnnotatedGraph) sourceElementGraph ).hasAnnotations() ) this.sourceAnnotations = ( (AnnotatedGraph) sourceElementGraph ).getAnnotations().getKeysFor( flowElement ); if( sinkElementGraph instanceof AnnotatedGraph && ( (AnnotatedGraph) sinkElementGraph ).hasAnnotations() ) this.sinkAnnotations = ( (AnnotatedGraph) sinkElementGraph ).getAnnotations().getKeysFor( flowElement ); }
@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; }
public ElementDirectedGraph( ElementGraph parent, EnumMultiMap annotations ) { this( parent ); getAnnotations().addAll( annotations ); }
@Override protected Set<FlowElement> addExclusions( ElementGraph graph ) { return ( (AnnotatedGraph) graph ).getAnnotations().getValues( annotation.getAnnotation() ); }
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(); }