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 import java.util.List; 22 23 /** 24 * Data object to encapsulate the attributes of Graphviz edges that we're interested in drawing. 25 * 26 * @author phopkins@gmail.com (Pete Hopkins) 27 */ 28 public class GraphvizEdge { 29 private final NodeId headNodeId; 30 private String headPortId; 31 private CompassPoint headCompassPoint; 32 private List<ArrowType> arrowHead = ImmutableList.of(ArrowType.NORMAL); 33 34 private final NodeId tailNodeId; 35 private String tailPortId; 36 private CompassPoint tailCompassPoint; 37 private List<ArrowType> arrowTail = ImmutableList.of(ArrowType.NONE); 38 39 private EdgeStyle style = EdgeStyle.SOLID; 40 GraphvizEdge(NodeId tailNodeId, NodeId headNodeId)41 public GraphvizEdge(NodeId tailNodeId, NodeId headNodeId) { 42 this.tailNodeId = tailNodeId; 43 this.headNodeId = headNodeId; 44 } 45 46 /** @since 4.0 */ getHeadNodeId()47 public NodeId getHeadNodeId() { 48 return headNodeId; 49 } 50 getHeadPortId()51 public String getHeadPortId() { 52 return headPortId; 53 } 54 setHeadPortId(String headPortId)55 public void setHeadPortId(String headPortId) { 56 this.headPortId = headPortId; 57 } 58 getHeadCompassPoint()59 public CompassPoint getHeadCompassPoint() { 60 return headCompassPoint; 61 } 62 setHeadCompassPoint(CompassPoint headCompassPoint)63 public void setHeadCompassPoint(CompassPoint headCompassPoint) { 64 this.headCompassPoint = headCompassPoint; 65 } 66 getArrowHead()67 public List<ArrowType> getArrowHead() { 68 return arrowHead; 69 } 70 setArrowHead(List<ArrowType> arrowHead)71 public void setArrowHead(List<ArrowType> arrowHead) { 72 this.arrowHead = ImmutableList.copyOf(arrowHead); 73 } 74 75 /** @since 4.0 */ getTailNodeId()76 public NodeId getTailNodeId() { 77 return tailNodeId; 78 } 79 getTailPortId()80 public String getTailPortId() { 81 return tailPortId; 82 } 83 setTailPortId(String tailPortId)84 public void setTailPortId(String tailPortId) { 85 this.tailPortId = tailPortId; 86 } 87 getTailCompassPoint()88 public CompassPoint getTailCompassPoint() { 89 return tailCompassPoint; 90 } 91 setTailCompassPoint(CompassPoint tailCompassPoint)92 public void setTailCompassPoint(CompassPoint tailCompassPoint) { 93 this.tailCompassPoint = tailCompassPoint; 94 } 95 getArrowTail()96 public List<ArrowType> getArrowTail() { 97 return arrowTail; 98 } 99 setArrowTail(List<ArrowType> arrowTail)100 public void setArrowTail(List<ArrowType> arrowTail) { 101 this.arrowTail = ImmutableList.copyOf(arrowTail); 102 } 103 getStyle()104 public EdgeStyle getStyle() { 105 return style; 106 } 107 setStyle(EdgeStyle style)108 public void setStyle(EdgeStyle style) { 109 this.style = style; 110 } 111 } 112