Coverage Report - com.buckosoft.PicMan.domain.Chain
 
Classes in this File Line Coverage Branch Coverage Complexity
Chain
0%
0/86
0%
0/14
1.229
 
 1  
 /******************************************************************************
 2  
  * Chain.java - a chain bean, define a chain of attributes to make one set of contacts
 3  
  * 
 4  
  * PicMan - The BuckoSoft Picture Manager in Java
 5  
  * Copyright(c) 2005 - Dick Balaska
 6  
  * 
 7  
  */
 8  
 package com.buckosoft.PicMan.domain;
 9  
 
 10  
 import java.io.Serializable;
 11  
 import java.util.Iterator;
 12  
 import java.util.LinkedList;
 13  
 import java.util.List;
 14  
 
 15  
 /** Define the attributes required to make one set of contacts
 16  
  * @author Dick Balaska
 17  
  * @since 2005/07/30
 18  
  * @see <a href="http://cvs.buckosoft.com/Projects/PicMan/PicMan/src/main/java/com/buckosoft/PicMan/domain/Chain.java">Chain.java</a>
 19  
  */
 20  0
 public class Chain implements Serializable, DataStrings {
 21  
         private static final long serialVersionUID = 1L;
 22  
         
 23  0
         private        int                cid = -1;
 24  
         private        String        name;
 25  0
         private        String        shortName = "";
 26  0
         private        String        contactPrefix = "";
 27  0
         private        String        description = "";
 28  0
         private        boolean        active = false;
 29  0
         private        String        engine = "";
 30  0
         private        String        contactDirectory = "";
 31  0
         private        int                contactCount = 4;
 32  0
         private        int                contactWidth = 640;
 33  0
         private        int                contactHeight = 480;
 34  0
         private        int                picSelector = PICSELECTOR_SORT;
 35  0
         private        int                ratingMin = 1;
 36  0
         private        int                ratingMax = 9;
 37  0
         private        boolean        showUnusedSets = true;
 38  
         
 39  0
         private        LinkedList<SetSize>        setSizes = new LinkedList<SetSize>();
 40  
         
 41  0
         public        void        setName(String name) { this.name = name; }
 42  0
         public        String        getName() { return(name); }
 43  
         
 44  0
         public        void        setDescription(String desc) { this.description = desc; }
 45  0
         public        String        getDescription() { return(description); }
 46  
 
 47  
         
 48  
         /**
 49  
          * @return Returns the cid.
 50  
          */
 51  
         public int getCid() {
 52  0
                 return cid;
 53  
         }
 54  
         /**
 55  
          * @param cid The cid to set.
 56  
          */
 57  
         public void setCid(int cid) {
 58  0
                 this.cid = cid;
 59  0
         }
 60  
 
 61  
         /**
 62  
          * @return Returns the shortName.
 63  
          */
 64  
         public String getShortName() {
 65  0
                 return shortName;
 66  
         }
 67  
         /**
 68  
          * @param shortName The shortName to set.
 69  
          */
 70  
         public void setShortName(String shortName) {
 71  0
                 this.shortName = shortName;
 72  0
         }
 73  
 
 74  
         /**
 75  
          * @return Returns whether this chain is active.
 76  
          */
 77  
         public boolean isActive() {
 78  0
                 return active;
 79  
         }
 80  
         /**
 81  
          * @param active Set whether this chain is active.
 82  
          */
 83  
         public void setActive(boolean active) {
 84  0
                 this.active = active;
 85  0
         }
 86  
 
 87  0
         public String getContactPrefix() { return(contactPrefix); }
 88  0
         public void setContactPrefix(String contactPrefix) { this.contactPrefix = contactPrefix; }
 89  
         
 90  
         
 91  
         public int getContactCount() {
 92  0
                 return contactCount;
 93  
         }
 94  
         public void setContactCount(int contactCount) {
 95  0
                 this.contactCount = contactCount;
 96  0
         }
 97  
         public String getContactDirectory() {
 98  0
                 return contactDirectory;
 99  
         }
 100  
         public void setContactDirectory(String contactDirectory) {
 101  0
                 this.contactDirectory = contactDirectory;
 102  0
         }
 103  
         public int getContactHeight() {
 104  0
                 return contactHeight;
 105  
         }
 106  
         public void setContactHeight(int contactHeight) {
 107  0
                 this.contactHeight = contactHeight;
 108  0
         }
 109  
         public int getContactWidth() {
 110  0
                 return contactWidth;
 111  
         }
 112  
         public void setContactWidth(int contactWidth) {
 113  0
                 this.contactWidth = contactWidth;
 114  0
         }
 115  
         public String getEngine() {
 116  0
                 return engine;
 117  
         }
 118  
         public void setEngine(String engine) {
 119  0
                 this.engine = engine;
 120  0
         }
 121  
         public LinkedList<SetSize> getSetSizes() { 
 122  0
                 return setSizes;
 123  
         }
 124  
 
 125  
         public        void        addSetSize(SetSize ss) {
 126  0
                 setSizes.add(ss);
 127  0
         }
 128  
         public        void        setSetSizes(LinkedList<SetSize> setSizes) {
 129  0
                 this.setSizes = setSizes;
 130  0
         }
 131  
         
 132  
         /** Get a list of the Set names used in this chain
 133  
          * @return a list of Strings
 134  
          */
 135  
         public        List<String>        getSetNames() {
 136  0
                 LinkedList<String> theList = new LinkedList<String>();
 137  0
                 Iterator<SetSize> iter = this.setSizes.iterator();
 138  0
                 while (iter.hasNext()) {
 139  0
                         SetSize ss = (SetSize)iter.next();
 140  0
                         boolean match = false;
 141  0
                         Iterator<String> iterThe = theList.iterator();
 142  0
                         while (iterThe.hasNext()) {
 143  0
                                 String s = (String)iterThe.next();
 144  0
                                 if (s.equals(ss.getSetName())) {
 145  0
                                         match = true;
 146  0
                                         break;
 147  
                                 }
 148  0
                         }
 149  0
                         if (match == false) {
 150  0
                                 theList.add(ss.getSetName());
 151  
                         }
 152  0
                 }
 153  0
                 return(theList);
 154  
         }
 155  
         
 156  
         /** Determine whether this set/size is in this chain
 157  
          * @return true if this set/size is in the chain
 158  
          */
 159  
         public        boolean        hasSetSize(String setName, int size) {
 160  0
                 Iterator<SetSize> iter = this.setSizes.iterator();
 161  0
                 while (iter.hasNext()) {
 162  0
                         SetSize ss = (SetSize)iter.next();
 163  0
                         if (ss.getSetName().equals(setName) && ss.getSize() == size)
 164  0
                                 return(true);
 165  0
                 }
 166  0
                 return(false);
 167  
         }
 168  
 
 169  
         /**
 170  
          * @return Returns the picSelector.
 171  
          */
 172  
         public int getPicSelector() {
 173  0
                 return picSelector;
 174  
         }
 175  
 
 176  
         /**
 177  
          * @param picSelector The picSelector to set.
 178  
          */
 179  
         public void setPicSelector(int picSelector) {
 180  0
                 this.picSelector = picSelector;
 181  0
         }
 182  
 
 183  
         /** Get the maximum rating of a pic that can be used in this chain.
 184  
          * @return Returns the ratingMax.
 185  
          */
 186  
         public int getRatingMax() {
 187  0
                 return ratingMax;
 188  
         }
 189  
 
 190  
         /** Set the maximum rating of a pic that can be used in this chain.
 191  
          * @param ratingMax The ratingMax to set.
 192  
          */
 193  
         public void setRatingMax(int ratingMax) {
 194  0
                 this.ratingMax = ratingMax;
 195  0
         }
 196  
 
 197  
         /** Get the minimum rating of a pic that can be used in this chain.
 198  
          * @return Returns the ratingsMin.
 199  
          */
 200  
         public int getRatingMin() {
 201  0
                 return ratingMin;
 202  
         }
 203  
 
 204  
         /** Set the minimum rating of a pic that can be used in this chain.
 205  
          * @param ratingMin The ratingsMin to set.
 206  
          */
 207  
         public void setRatingMin(int ratingMin) {
 208  0
                 this.ratingMin = ratingMin;
 209  0
         }
 210  
 
 211  
         /** Do we show or hide the unused sets during Chain editing?
 212  
          * @return the showUnusedSets
 213  
          */
 214  
         public boolean isShowUnusedSets() {
 215  0
                 return showUnusedSets;
 216  
         }
 217  
         /** Set do we show or hide the unused sets during Chain editing?
 218  
          * @param showUnusedSets the showUnusedSets to set
 219  
          */
 220  
         public void setShowUnusedSets(boolean showUnusedSets) {
 221  0
                 this.showUnusedSets = showUnusedSets;
 222  0
         }
 223  
         
 224  
 
 225  
 }