| Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
| EdgeLabel |
|
| 2.230769230769231;2.231 |
| 1 | /* | |
| 2 | ||
| 3 | dsh-graph-io Directed graph readers and writers. | |
| 4 | Copyright (c) 2008-2013 held jointly by the individual authors. | |
| 5 | ||
| 6 | This library is free software; you can redistribute it and/or modify it | |
| 7 | under the terms of the GNU Lesser General Public License as published | |
| 8 | by the Free Software Foundation; either version 3 of the License, or (at | |
| 9 | your option) any later version. | |
| 10 | ||
| 11 | This library is distributed in the hope that it will be useful, but WITHOUT | |
| 12 | ANY WARRANTY; with out even the implied warranty of MERCHANTABILITY or | |
| 13 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public | |
| 14 | License for more details. | |
| 15 | ||
| 16 | You should have received a copy of the GNU Lesser General Public License | |
| 17 | along with this library; if not, write to the Free Software Foundation, | |
| 18 | Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. | |
| 19 | ||
| 20 | > http://www.fsf.org/licensing/licenses/lgpl.html | |
| 21 | > http://www.opensource.org/licenses/lgpl-license.php | |
| 22 | ||
| 23 | */ | |
| 24 | package org.dishevelled.graph.io.ygraphml; | |
| 25 | ||
| 26 | /** | |
| 27 | * Edge label. | |
| 28 | * | |
| 29 | * @author Michael Heuer | |
| 30 | * @version $Revision$ $Date$ | |
| 31 | */ | |
| 32 | public final class EdgeLabel | |
| 33 | { | |
| 34 | /** True if this edge label is visible. */ | |
| 35 | private final boolean visible; | |
| 36 | ||
| 37 | /** Alignment for this edge label. */ | |
| 38 | private final String alignment; | |
| 39 | ||
| 40 | /** Font family for this edge label. */ | |
| 41 | private final String fontFamily; | |
| 42 | ||
| 43 | /** Font size for this edge label. */ | |
| 44 | private final int fontSize; | |
| 45 | ||
| 46 | /** Font style for this edge label. */ | |
| 47 | private final String fontStyle; | |
| 48 | ||
| 49 | /** Text color for this edge label. */ | |
| 50 | private final String textColor; | |
| 51 | ||
| 52 | /** Model name for this edge label. */ | |
| 53 | private final String modelName; | |
| 54 | ||
| 55 | /** Model position for this edge label. */ | |
| 56 | private final String modelPosition; | |
| 57 | ||
| 58 | /** Preferred placement for this edge label. */ | |
| 59 | private final String preferredPlacement; | |
| 60 | ||
| 61 | /** Distance for this edge label. */ | |
| 62 | private final double distance; | |
| 63 | ||
| 64 | /** Ratio for this edge label. */ | |
| 65 | private final double ratio; | |
| 66 | ||
| 67 | /** Text for this edge label. */ | |
| 68 | private final String text; | |
| 69 | ||
| 70 | ||
| 71 | /** | |
| 72 | * Create a new edge label from the specified parameters. | |
| 73 | * | |
| 74 | * @param visible true if this edge label is visible | |
| 75 | * @param alignment alignment for this edge label, must not be null | |
| 76 | * @param fontFamily font family for this edge label, must not be null | |
| 77 | * @param fontSize font size for this edge label | |
| 78 | * @param fontStyle font style for this edge label, must not be null | |
| 79 | * @param textColor text color for this edge label, must not be null | |
| 80 | * @param modelName model name for this edge label, must not be null | |
| 81 | * @param modelPosition model position for this edge label, must not be null | |
| 82 | * @param preferredPlacement preferred placement for this edge label, must not be null | |
| 83 | * @param distance distance for this edge label | |
| 84 | * @param ratio ratio for this edge label | |
| 85 | * @param text text for this edge label, must not be null | |
| 86 | */ | |
| 87 | public EdgeLabel(final boolean visible, | |
| 88 | final String alignment, | |
| 89 | final String fontFamily, | |
| 90 | final int fontSize, | |
| 91 | final String fontStyle, | |
| 92 | final String textColor, | |
| 93 | final String modelName, | |
| 94 | final String modelPosition, | |
| 95 | final String preferredPlacement, | |
| 96 | final double distance, | |
| 97 | final double ratio, | |
| 98 | final String text) | |
| 99 | 108 | { |
| 100 | 108 | if (alignment == null) |
| 101 | { | |
| 102 | 0 | throw new IllegalArgumentException("alignment must not be null"); |
| 103 | } | |
| 104 | 108 | if (fontFamily == null) |
| 105 | { | |
| 106 | 0 | throw new IllegalArgumentException("fontFamily must not be null"); |
| 107 | } | |
| 108 | 108 | if (fontStyle == null) |
| 109 | { | |
| 110 | 0 | throw new IllegalArgumentException("fontStyle must not be null"); |
| 111 | } | |
| 112 | 108 | if (textColor == null) |
| 113 | { | |
| 114 | 0 | throw new IllegalArgumentException("textColor must not be null"); |
| 115 | } | |
| 116 | 108 | if (modelName == null) |
| 117 | { | |
| 118 | 0 | throw new IllegalArgumentException("modelName must not be null"); |
| 119 | } | |
| 120 | 108 | if (modelPosition == null) |
| 121 | { | |
| 122 | 0 | throw new IllegalArgumentException("modelPosition must not be null"); |
| 123 | } | |
| 124 | 108 | if (preferredPlacement == null) |
| 125 | { | |
| 126 | 0 | throw new IllegalArgumentException("preferredPlacement must not be null"); |
| 127 | } | |
| 128 | 108 | if (text == null) |
| 129 | { | |
| 130 | 0 | throw new IllegalArgumentException("text must not be null"); |
| 131 | } | |
| 132 | 108 | this.visible = visible; |
| 133 | 108 | this.alignment = alignment; |
| 134 | 108 | this.fontFamily = fontFamily; |
| 135 | 108 | this.fontSize = fontSize; |
| 136 | 108 | this.fontStyle = fontStyle; |
| 137 | 108 | this.textColor = textColor; |
| 138 | 108 | this.modelName = modelName; |
| 139 | 108 | this.modelPosition = modelPosition; |
| 140 | 108 | this.preferredPlacement = preferredPlacement; |
| 141 | 108 | this.distance = distance; |
| 142 | 108 | this.ratio = ratio; |
| 143 | 108 | this.text = text; |
| 144 | 108 | } |
| 145 | ||
| 146 | ||
| 147 | /** | |
| 148 | * Return true if this edge label is visible. | |
| 149 | * | |
| 150 | * @return true if this edge label is visible | |
| 151 | */ | |
| 152 | public boolean isVisible() | |
| 153 | { | |
| 154 | 41 | return visible; |
| 155 | } | |
| 156 | ||
| 157 | /** | |
| 158 | * Return the alignment for this edge label. | |
| 159 | * The alignment will not be null. | |
| 160 | * | |
| 161 | * @return the alignment for this edge label | |
| 162 | */ | |
| 163 | public String getAlignment() | |
| 164 | { | |
| 165 | 41 | return alignment; |
| 166 | } | |
| 167 | ||
| 168 | /** | |
| 169 | * Return the font family for this edge label. | |
| 170 | * The font family will not be null. | |
| 171 | * | |
| 172 | * @return the font family for this edge label | |
| 173 | */ | |
| 174 | public String getFontFamily() | |
| 175 | { | |
| 176 | 41 | return fontFamily; |
| 177 | } | |
| 178 | ||
| 179 | /** | |
| 180 | * Return the font size for this edge label. | |
| 181 | * | |
| 182 | * @return the font size for this edge label | |
| 183 | */ | |
| 184 | public int getFontSize() | |
| 185 | { | |
| 186 | 41 | return fontSize; |
| 187 | } | |
| 188 | ||
| 189 | /** | |
| 190 | * Return the font style for this edge label. | |
| 191 | * The font style will not be null. | |
| 192 | * | |
| 193 | * @return the font style for this edge label | |
| 194 | */ | |
| 195 | public String getFontStyle() | |
| 196 | { | |
| 197 | 41 | return fontStyle; |
| 198 | } | |
| 199 | ||
| 200 | /** | |
| 201 | * Return the text color for this edge label. | |
| 202 | * The text color will not be null. | |
| 203 | * | |
| 204 | * @return the text color for this edge label | |
| 205 | */ | |
| 206 | public String getTextColor() | |
| 207 | { | |
| 208 | 41 | return textColor; |
| 209 | } | |
| 210 | ||
| 211 | /** | |
| 212 | * Return the model name for this edge label. | |
| 213 | * The model name will not be null. | |
| 214 | * | |
| 215 | * @return the model name for this edge label | |
| 216 | */ | |
| 217 | public String getModelName() | |
| 218 | { | |
| 219 | 41 | return modelName; |
| 220 | } | |
| 221 | ||
| 222 | /** | |
| 223 | * Return the model position for this edge label. | |
| 224 | * The model position will not be null. | |
| 225 | * | |
| 226 | * @return the model position for this edge label | |
| 227 | */ | |
| 228 | public String getModelPosition() | |
| 229 | { | |
| 230 | 41 | return modelPosition; |
| 231 | } | |
| 232 | ||
| 233 | /** | |
| 234 | * Return the preferred placement for this edge label. | |
| 235 | * The preferred placement will not be null. | |
| 236 | * | |
| 237 | * @return the preferred placement for this edge label | |
| 238 | */ | |
| 239 | public String getPreferredPlacement() | |
| 240 | { | |
| 241 | 41 | return preferredPlacement; |
| 242 | } | |
| 243 | ||
| 244 | /** | |
| 245 | * Return the distance for this edge label. | |
| 246 | * | |
| 247 | * @return the distance for this edge label | |
| 248 | */ | |
| 249 | public double getDistance() | |
| 250 | { | |
| 251 | 41 | return distance; |
| 252 | } | |
| 253 | ||
| 254 | /** | |
| 255 | * Return the ratio for this edge label. | |
| 256 | * | |
| 257 | * @return the ratio for this edge label | |
| 258 | */ | |
| 259 | public double getRatio() | |
| 260 | { | |
| 261 | 41 | return ratio; |
| 262 | } | |
| 263 | ||
| 264 | /** | |
| 265 | * Return the text for this edge label. | |
| 266 | * The text will not be null. | |
| 267 | * | |
| 268 | * @return the text for this edge label | |
| 269 | */ | |
| 270 | public String getText() | |
| 271 | { | |
| 272 | 40 | return text; |
| 273 | } | |
| 274 | } |