001/* 002 * Copyright (c) 2007-2015 Concurrent, Inc. All Rights Reserved. 003 * 004 * Project and contact information: http://www.cascading.org/ 005 * 006 * This file is part of the Cascading project. 007 * 008 * Licensed under the Apache License, Version 2.0 (the "License"); 009 * you may not use this file except in compliance with the License. 010 * You may obtain a copy of the License at 011 * 012 * http://www.apache.org/licenses/LICENSE-2.0 013 * 014 * Unless required by applicable law or agreed to in writing, software 015 * distributed under the License is distributed on an "AS IS" BASIS, 016 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 017 * See the License for the specific language governing permissions and 018 * limitations under the License. 019 */ 020 021package cascading.flow.planner.process; 022 023import java.io.Serializable; 024import java.util.Collection; 025import java.util.Comparator; 026import java.util.Iterator; 027import java.util.List; 028import java.util.Map; 029import java.util.Set; 030 031import cascading.flow.FlowElement; 032import cascading.flow.planner.Scope; 033import cascading.flow.planner.graph.ElementGraph; 034import cascading.tap.Tap; 035import cascading.util.EnumMultiMap; 036 037/** 038 * 039 */ 040public interface ProcessGraph<Process extends ProcessModel> extends Serializable 041 { 042 boolean addVertex( Process process ); 043 044 Set<ProcessEdge> getAllEdges( Process lhs, Process rhs ); 045 046 ProcessEdge getEdge( Process lhs, Process rhs ); 047 048 ProcessEdge addEdge( Process lhs, Process rhs ); 049 050 boolean addEdge( Process lhs, Process rhs, ProcessEdge processEdge ); 051 052 boolean containsEdge( Process lhs, Process rhs ); 053 054 boolean containsEdge( ProcessEdge processEdge ); 055 056 boolean containsVertex( Process process ); 057 058 Set<ProcessEdge> edgeSet(); 059 060 Set<ProcessEdge> edgesOf( Process process ); 061 062 boolean removeAllEdges( Collection<? extends ProcessEdge> processEdges ); 063 064 Set<ProcessEdge> removeAllEdges( Process lhs, Process rhs ); 065 066 boolean removeAllVertices( Collection<? extends Process> processes ); 067 068 ProcessEdge removeEdge( Process lhs, Process rhs ); 069 070 boolean removeEdge( ProcessEdge processEdge ); 071 072 boolean removeVertex( Process process ); 073 074 Set<Process> vertexSet(); 075 076 Process getEdgeSource( ProcessEdge processEdge ); 077 078 Process getEdgeTarget( ProcessEdge processEdge ); 079 080 double getEdgeWeight( ProcessEdge processEdge ); 081 082 int inDegreeOf( Process process ); 083 084 Set<ProcessEdge> incomingEdgesOf( Process process ); 085 086 int outDegreeOf( Process process ); 087 088 Set<ProcessEdge> outgoingEdgesOf( Process process ); 089 090 Set<FlowElement> getSourceElements(); 091 092 Set<FlowElement> getSinkElements(); 093 094 Set<Tap> getSourceTaps(); 095 096 Set<Tap> getSinkTaps(); 097 098 Map<String, Tap> getTrapsMap(); 099 100 Iterator<Process> getTopologicalIterator(); 101 102 Iterator<Process> getOrdinalTopologicalIterator(); 103 104 Iterator<Process> getOrderedTopologicalIterator( Comparator<Process> comparator ); 105 106 List<ElementGraph> getElementGraphs( FlowElement flowElement ); 107 108 List<Process> getElementProcesses( FlowElement flowElement ); 109 110 List<ElementGraph> getElementGraphs( Scope scope ); 111 112 List<Process> getElementProcesses( Scope scope ); 113 114 List<Process> getElementSourceProcesses( FlowElement flowElement ); 115 116 List<Process> getElementSinkProcesses( FlowElement flowElement ); 117 118 Set<FlowElement> getAllSourceElements(); 119 120 Set<FlowElement> getAllSinkElements(); 121 122 EnumMultiMap<FlowElement> getAnnotations(); 123 124 Set<FlowElement> getDuplicatedElements( ElementGraph elementGraph ); 125 126 Set<ElementGraph> getIdentityElementGraphs(); 127 128 Set<Process> getIdentityProcesses(); 129 130 void writeDOT( String filename ); 131 132 void writeDOTNested( String filename, ElementGraph graph ); 133 }