1 /** 2 * Copyright (C) 2008 Google Inc. 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 package com.google.inject.grapher.graphviz; 18 19 import com.google.common.collect.ImmutableList; 20 import com.google.inject.grapher.NodeId; 21 22 import java.util.List; 23 24 /** 25 * Data object to encapsulate the attributes of Graphviz edges that we're 26 * interested in drawing. 27 * 28 * @author phopkins@gmail.com (Pete Hopkins) 29 */ 30 public class GraphvizEdge { 31 private final NodeId headNodeId; 32 private String headPortId; 33 private CompassPoint headCompassPoint; 34 private List<ArrowType> arrowHead = ImmutableList.of(ArrowType.NORMAL); 35 36 private final NodeId tailNodeId; 37 private String tailPortId; 38 private CompassPoint tailCompassPoint; 39 private List<ArrowType> arrowTail = ImmutableList.of(ArrowType.NONE); 40 41 private EdgeStyle style = EdgeStyle.SOLID; 42 GraphvizEdge(NodeId tailNodeId, NodeId headNodeId)43 public GraphvizEdge(NodeId tailNodeId, NodeId headNodeId) { 44 this.tailNodeId = tailNodeId; 45 this.headNodeId = headNodeId; 46 } 47 48 /** @since 4.0 */ getHeadNodeId()49 public NodeId getHeadNodeId() { 50 return headNodeId; 51 } 52 getHeadPortId()53 public String getHeadPortId() { 54 return headPortId; 55 } 56 setHeadPortId(String headPortId)57 public void setHeadPortId(String headPortId) { 58 this.headPortId = headPortId; 59 } 60 getHeadCompassPoint()61 public CompassPoint getHeadCompassPoint() { 62 return headCompassPoint; 63 } 64 setHeadCompassPoint(CompassPoint headCompassPoint)65 public void setHeadCompassPoint(CompassPoint headCompassPoint) { 66 this.headCompassPoint = headCompassPoint; 67 } 68 getArrowHead()69 public List<ArrowType> getArrowHead() { 70 return arrowHead; 71 } 72 setArrowHead(List<ArrowType> arrowHead)73 public void setArrowHead(List<ArrowType> arrowHead) { 74 this.arrowHead = ImmutableList.copyOf(arrowHead); 75 } 76 77 /** @since 4.0 */ getTailNodeId()78 public NodeId getTailNodeId() { 79 return tailNodeId; 80 } 81 getTailPortId()82 public String getTailPortId() { 83 return tailPortId; 84 } 85 setTailPortId(String tailPortId)86 public void setTailPortId(String tailPortId) { 87 this.tailPortId = tailPortId; 88 } 89 getTailCompassPoint()90 public CompassPoint getTailCompassPoint() { 91 return tailCompassPoint; 92 } 93 setTailCompassPoint(CompassPoint tailCompassPoint)94 public void setTailCompassPoint(CompassPoint tailCompassPoint) { 95 this.tailCompassPoint = tailCompassPoint; 96 } 97 getArrowTail()98 public List<ArrowType> getArrowTail() { 99 return arrowTail; 100 } 101 setArrowTail(List<ArrowType> arrowTail)102 public void setArrowTail(List<ArrowType> arrowTail) { 103 this.arrowTail = ImmutableList.copyOf(arrowTail); 104 } 105 getStyle()106 public EdgeStyle getStyle() { 107 return style; 108 } 109 setStyle(EdgeStyle style)110 public void setStyle(EdgeStyle style) { 111 this.style = style; 112 } 113 } 114