Coverage Report - com.buckosoft.PicMan.domain.SetSize
 
Classes in this File Line Coverage Branch Coverage Complexity
SetSize
0%
0/33
0%
0/4
1.364
 
 1  
 /******************************************************************************
 2  
  * SetSize - Convienence class to manipulate a Set/Size pair as a single entity
 3  
  * 
 4  
  * PicMan - The BuckoSoft Picture Manager in Java
 5  
  * Copyright(c) 2006 - Dick Balaska
 6  
  * 
 7  
  */
 8  
 package com.buckosoft.PicMan.domain;
 9  
 
 10  
 import java.text.DecimalFormat;
 11  
 
 12  
 /** Convienence class to manipulate a Set/Size pair as a single entity.
 13  
  * Size = 0 = wildcard and matches anyother SetSize
 14  
  */
 15  
 public class SetSize {
 16  
         private String        setName;
 17  
         private        int                size;
 18  
 
 19  0
         private static final DecimalFormat df3 = new DecimalFormat("000");
 20  
 
 21  
         /** Default Constructor. */
 22  0
         public        SetSize() {}
 23  
         
 24  
         /** Construct a SetSize from this string of the form SetName_075
 25  
          * @param setSizeName The string to convert to a SetSize.
 26  
          */
 27  0
         public        SetSize(String setSizeName) {
 28  0
                 setSetSize(setSizeName);
 29  0
         }
 30  
 
 31  
         /** Construct a SetSize from this setName and size 
 32  
          * @param setName The name of the Set
 33  
          * @param size The size of the new SetSize
 34  
          */
 35  0
         public SetSize(String setName, int size) {
 36  0
                 this.setName = setName;
 37  0
                 this.size = size;
 38  0
         }
 39  
 
 40  
         public        String        getGuiSetSize() {
 41  0
                 return(new String(getSetName() 
 42  0
                                                         + "_" + df3.format(getSize())));
 43  
         }
 44  
         public        String        getSetSizeDash() {
 45  0
                 return(new String(getSetName() 
 46  0
                                                         + "-" + df3.format(getSize())));
 47  
         }
 48  
         public        void setSetSize(String setSize) {
 49  0
                 int i = setSize.indexOf('_');
 50  0
                 if (i != -1) {
 51  0
                         setSetName(setSize.substring(0,i));
 52  0
                         setSize(Integer.parseInt(setSize.substring(i+1,setSize.length())));
 53  0
                         return;
 54  
                 }
 55  0
                 i = setSize.indexOf('-');
 56  0
                 if (i != -1) {
 57  0
                         setSetName(setSize.substring(0,i));
 58  0
                         setSize(Integer.parseInt(setSize.substring(i+1,setSize.length())));
 59  0
                         return;
 60  
                 }
 61  
                 
 62  0
                 setSetName(setSize);
 63  0
                 setSize(0);
 64  0
         }
 65  
 
 66  
         public String getSetSize() {
 67  0
                 return(setName + "_" + size);
 68  
         }
 69  
 
 70  
         public String getSetName() {
 71  0
                 return setName;
 72  
         }
 73  
         public void setSetName(String set) {
 74  0
                 this.setName = set;
 75  0
         }
 76  
         public int getSize() {
 77  0
                 return size;
 78  
         }
 79  
         public void setSize(int size) {
 80  0
                 this.size = size;
 81  0
         }
 82  
 }