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.graph; 022 023import java.util.Collection; 024import java.util.List; 025import java.util.Set; 026 027import cascading.flow.FlowElement; 028import cascading.flow.planner.Scope; 029import cascading.util.Util; 030 031/** 032 * 033 */ 034public class DecoratedElementGraph implements ElementGraph 035 { 036 ElementGraph decorated; 037 038 public DecoratedElementGraph( ElementGraph decorated ) 039 { 040 this.decorated = decorated; 041 } 042 043 public ElementGraph getDecorated() 044 { 045 return decorated; 046 } 047 048 @Override 049 public ElementGraph copyElementGraph() 050 { 051 return decorated.copyElementGraph(); 052 } 053 054 @Override 055 public void writeDOT( String filename ) 056 { 057 boolean success = ElementGraphs.printElementGraph( filename, this, null ); 058 059 if( success ) 060 Util.writePDF( filename ); 061 } 062 063 @Override 064 public int inDegreeOf( FlowElement vertex ) 065 { 066 return decorated.inDegreeOf( vertex ); 067 } 068 069 @Override 070 public Set<Scope> incomingEdgesOf( FlowElement vertex ) 071 { 072 return decorated.incomingEdgesOf( vertex ); 073 } 074 075 @Override 076 public int outDegreeOf( FlowElement vertex ) 077 { 078 return decorated.outDegreeOf( vertex ); 079 } 080 081 @Override 082 public Set<Scope> outgoingEdgesOf( FlowElement vertex ) 083 { 084 return decorated.outgoingEdgesOf( vertex ); 085 } 086 087 @Override 088 public List<FlowElement> predecessorListOf( FlowElement flowElement ) 089 { 090 return decorated.predecessorListOf( flowElement ); 091 } 092 093 @Override 094 public List<FlowElement> successorListOf( FlowElement flowElement ) 095 { 096 return decorated.successorListOf( flowElement ); 097 } 098 099 @Override 100 public Set<Scope> getAllEdges( FlowElement sourceVertex, FlowElement targetVertex ) 101 { 102 return decorated.getAllEdges( sourceVertex, targetVertex ); 103 } 104 105 @Override 106 public Scope getEdge( FlowElement sourceVertex, FlowElement targetVertex ) 107 { 108 return decorated.getEdge( sourceVertex, targetVertex ); 109 } 110 111 @Override 112 public Scope addEdge( FlowElement sourceVertex, FlowElement targetVertex ) 113 { 114 return decorated.addEdge( sourceVertex, targetVertex ); 115 } 116 117 @Override 118 public boolean addEdge( FlowElement sourceVertex, FlowElement targetVertex, Scope scope ) 119 { 120 return decorated.addEdge( sourceVertex, targetVertex, scope ); 121 } 122 123 @Override 124 public boolean addVertex( FlowElement flowElement ) 125 { 126 return decorated.addVertex( flowElement ); 127 } 128 129 @Override 130 public boolean containsEdge( FlowElement sourceVertex, FlowElement targetVertex ) 131 { 132 return decorated.containsEdge( sourceVertex, targetVertex ); 133 } 134 135 @Override 136 public boolean containsEdge( Scope scope ) 137 { 138 return decorated.containsEdge( scope ); 139 } 140 141 @Override 142 public boolean containsVertex( FlowElement flowElement ) 143 { 144 return decorated.containsVertex( flowElement ); 145 } 146 147 @Override 148 public Set<Scope> edgeSet() 149 { 150 return decorated.edgeSet(); 151 } 152 153 @Override 154 public Set<Scope> edgesOf( FlowElement vertex ) 155 { 156 return decorated.edgesOf( vertex ); 157 } 158 159 @Override 160 public boolean removeAllEdges( Collection<? extends Scope> edges ) 161 { 162 return decorated.removeAllEdges( edges ); 163 } 164 165 @Override 166 public Set<Scope> removeAllEdges( FlowElement sourceVertex, FlowElement targetVertex ) 167 { 168 return decorated.removeAllEdges( sourceVertex, targetVertex ); 169 } 170 171 @Override 172 public boolean removeAllVertices( Collection<? extends FlowElement> vertices ) 173 { 174 return decorated.removeAllVertices( vertices ); 175 } 176 177 @Override 178 public Scope removeEdge( FlowElement sourceVertex, FlowElement targetVertex ) 179 { 180 return decorated.removeEdge( sourceVertex, targetVertex ); 181 } 182 183 @Override 184 public boolean removeEdge( Scope scope ) 185 { 186 return decorated.removeEdge( scope ); 187 } 188 189 @Override 190 public boolean removeVertex( FlowElement flowElement ) 191 { 192 return decorated.removeVertex( flowElement ); 193 } 194 195 @Override 196 public Set<FlowElement> vertexSet() 197 { 198 return decorated.vertexSet(); 199 } 200 201 @Override 202 public FlowElement getEdgeSource( Scope scope ) 203 { 204 return decorated.getEdgeSource( scope ); 205 } 206 207 @Override 208 public FlowElement getEdgeTarget( Scope scope ) 209 { 210 return decorated.getEdgeTarget( scope ); 211 } 212 213 @Override 214 public boolean equals( Object object ) 215 { 216 return ElementGraphs.equals( this, (ElementGraph) object ); 217 } 218 219 @Override 220 public int hashCode() 221 { 222 int result = decorated.hashCode(); 223 result = 31 * result; // parity with AnnotatedGraph types 224 return result; 225 } 226 }