Coverage Report - org.dishevelled.graph.io.ygraphml.NodeLabel
 
Classes in this File Line Coverage Branch Coverage Complexity
NodeLabel
78%
30/38
50%
8/16
2.455
 
 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  
  * Node label.
 28  
  *
 29  
  * @author  Michael Heuer
 30  
  * @version $Revision$ $Date$
 31  
  */
 32  
 public final class NodeLabel
 33  
 {
 34  
     /** True if this node label is visible. */
 35  
     private final boolean visible;
 36  
 
 37  
     /** Alignment for this node label. */
 38  
     private final String alignment;
 39  
 
 40  
     /** Font family for this node label. */
 41  
     private final String fontFamily;
 42  
 
 43  
     /** Font size for this node label. */
 44  
     private final int fontSize;
 45  
 
 46  
     /** Font style for this node label. */
 47  
     private final String fontStyle;
 48  
 
 49  
     /** Text color for this node label. */
 50  
     private final String textColor;
 51  
 
 52  
     /** Model name for this node label. */
 53  
     private final String modelName;
 54  
 
 55  
     /** Model position for this node label. */
 56  
     private final String modelPosition;
 57  
 
 58  
     /** Auto size policy for this node label. */
 59  
     private final String autoSizePolicy;
 60  
 
 61  
     /** Text for this node label. */
 62  
     private final String text;
 63  
 
 64  
 
 65  
     /**
 66  
      * Create a new node label from the specified parameters.
 67  
      *
 68  
      * @param visible true if this node label is visible
 69  
      * @param alignment alignment for this node label, must not be null
 70  
      * @param fontFamily font family for this node label, must not be null
 71  
      * @param fontSize font size for this node label
 72  
      * @param fontStyle font style for this node label, must not be null
 73  
      * @param textColor text color for this node label, must not be null
 74  
      * @param modelName model name for this node label, must not be null
 75  
      * @param modelPosition model position for this node label, must not be null
 76  
      * @param autoSizePolicy auto size policy for this node label, must not be null
 77  
      * @param text text for this node label, must not be null
 78  
      */
 79  
     public NodeLabel(final boolean visible,
 80  
                      final String alignment,
 81  
                      final String fontFamily,
 82  
                      final int fontSize,
 83  
                      final String fontStyle,
 84  
                      final String textColor,
 85  
                      final String modelName,
 86  
                      final String modelPosition,
 87  
                      final String autoSizePolicy,
 88  
                      final String text)
 89  35
     {
 90  35
         if (alignment == null)
 91  
         {
 92  0
             throw new IllegalArgumentException("alignment must not be null");
 93  
         }
 94  35
         if (fontFamily == null)
 95  
         {
 96  0
             throw new IllegalArgumentException("fontFamily must not be null");
 97  
         }
 98  35
         if (fontStyle == null)
 99  
         {
 100  0
             throw new IllegalArgumentException("fontStyle must not be null");
 101  
         }
 102  35
         if (textColor == null)
 103  
         {
 104  0
             throw new IllegalArgumentException("textColor must not be null");
 105  
         }
 106  35
         if (modelName == null)
 107  
         {
 108  0
             throw new IllegalArgumentException("modelName must not be null");
 109  
         }
 110  35
         if (modelPosition == null)
 111  
         {
 112  0
             throw new IllegalArgumentException("modelPosition must not be null");
 113  
         }
 114  35
         if (autoSizePolicy == null)
 115  
         {
 116  0
             throw new IllegalArgumentException("autoSizePolicy must not be null");
 117  
         }
 118  35
         if (text == null)
 119  
         {
 120  0
             throw new IllegalArgumentException("text must not be null");
 121  
         }
 122  35
         this.visible = visible;
 123  35
         this.alignment = alignment;
 124  35
         this.fontFamily = fontFamily;
 125  35
         this.fontSize = fontSize;
 126  35
         this.fontStyle = fontStyle;
 127  35
         this.textColor = textColor;
 128  35
         this.modelName = modelName;
 129  35
         this.modelPosition = modelPosition;
 130  35
         this.autoSizePolicy = autoSizePolicy;
 131  35
         this.text = text;
 132  35
     }
 133  
 
 134  
 
 135  
     /**
 136  
      * Return true if this node label is visible.
 137  
      *
 138  
      * @return true if this node label is visible
 139  
      */
 140  
     public boolean isVisible()
 141  
     {
 142  12
         return visible;
 143  
     }
 144  
 
 145  
     /**
 146  
      * Return the alignment for this node label.
 147  
      * The alignment will not be null.
 148  
      *
 149  
      * @return the alignment for this node label
 150  
      */
 151  
     public String getAlignment()
 152  
     {
 153  12
         return alignment;
 154  
     }
 155  
 
 156  
     /**
 157  
      * Return the font family for this node label.
 158  
      * The font family will not be null.
 159  
      *
 160  
      * @return the font family for this node label
 161  
      */
 162  
     public String getFontFamily()
 163  
     {
 164  12
         return fontFamily;
 165  
     }
 166  
 
 167  
     /**
 168  
      * Return the font size for this node label.
 169  
      *
 170  
      * @return the font size for this node label
 171  
      */
 172  
     public int getFontSize()
 173  
     {
 174  12
         return fontSize;
 175  
     }
 176  
 
 177  
     /**
 178  
      * Return the font style for this node label.
 179  
      * The font style will not be null.
 180  
      *
 181  
      * @return the font style for this node label
 182  
      */
 183  
     public String getFontStyle()
 184  
     {
 185  12
         return fontStyle;
 186  
     }
 187  
 
 188  
     /**
 189  
      * Return the text color for this node label.
 190  
      * The text color will not be null.
 191  
      *
 192  
      * @return the text color for this node label
 193  
      */
 194  
     public String getTextColor()
 195  
     {
 196  12
         return textColor;
 197  
     }
 198  
 
 199  
     /**
 200  
      * Return the model name for this node label.
 201  
      * The model name will not be null.
 202  
      *
 203  
      * @return the model name for this node label
 204  
      */
 205  
     public String getModelName()
 206  
     {
 207  12
         return modelName;
 208  
     }
 209  
 
 210  
     /**
 211  
      * Return the model position for this node label.
 212  
      * The model position will not be null.
 213  
      *
 214  
      * @return the model position for this node label
 215  
      */
 216  
     public String getModelPosition()
 217  
     {
 218  12
         return modelPosition;
 219  
     }
 220  
 
 221  
     /**
 222  
      * Return the auto size policy for this node label.
 223  
      * The auto size policy will not be null.
 224  
      *
 225  
      * @return the auto size policy for this node label
 226  
      */
 227  
     public String getAutoSizePolicy()
 228  
     {
 229  12
         return autoSizePolicy;
 230  
     }
 231  
 
 232  
     /**
 233  
      * Return the text for this node label.
 234  
      * The text will not be null.
 235  
      *
 236  
      * @return the text for this node label
 237  
      */
 238  
     public String getText()
 239  
     {
 240  13
         return text;
 241  
     }
 242  
 }