001 // 002 // This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.1.5-b01-fcs 003 // See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> 004 // Any modifications to this file will be lost upon recompilation of the source schema. 005 // Generated on: 2008.07.28 at 12:01:56 PM GMT-10:00 006 // 007 008 009 package org.hackystat.dailyprojectdata.resource.coverage.jaxb; 010 011 import java.io.Serializable; 012 import java.util.ArrayList; 013 import java.util.List; 014 import javax.xml.bind.annotation.XmlAccessType; 015 import javax.xml.bind.annotation.XmlAccessorType; 016 import javax.xml.bind.annotation.XmlAttribute; 017 import javax.xml.bind.annotation.XmlElement; 018 import javax.xml.bind.annotation.XmlRootElement; 019 import javax.xml.bind.annotation.XmlSchemaType; 020 import javax.xml.bind.annotation.XmlType; 021 import javax.xml.datatype.XMLGregorianCalendar; 022 023 024 /** 025 * <p>Java class for anonymous complex type. 026 * 027 * <p>The following schema fragment specifies the expected content contained within this class. 028 * 029 * <pre> 030 * <complexType> 031 * <complexContent> 032 * <restriction base="{http://www.w3.org/2001/XMLSchema}anyType"> 033 * <sequence> 034 * <element ref="{}ConstructData" maxOccurs="unbounded" minOccurs="0"/> 035 * </sequence> 036 * <attribute ref="{}Project"/> 037 * <attribute ref="{}Owner"/> 038 * <attribute ref="{}StartTime"/> 039 * <attribute ref="{}Granularity"/> 040 * <attribute ref="{}Tool"/> 041 * </restriction> 042 * </complexContent> 043 * </complexType> 044 * </pre> 045 * 046 * 047 */ 048 @XmlAccessorType(XmlAccessType.FIELD) 049 @XmlType(name = "", propOrder = { 050 "constructData" 051 }) 052 @XmlRootElement(name = "CoverageDailyProjectData") 053 public class CoverageDailyProjectData 054 implements Serializable 055 { 056 057 private final static long serialVersionUID = 12343L; 058 @XmlElement(name = "ConstructData") 059 protected List<ConstructData> constructData; 060 @XmlAttribute(name = "Project") 061 protected String project; 062 @XmlAttribute(name = "Owner") 063 protected String owner; 064 @XmlAttribute(name = "StartTime") 065 @XmlSchemaType(name = "dateTime") 066 protected XMLGregorianCalendar startTime; 067 @XmlAttribute(name = "Granularity") 068 protected String granularity; 069 @XmlAttribute(name = "Tool") 070 protected String tool; 071 072 /** 073 * Gets the value of the constructData property. 074 * 075 * <p> 076 * This accessor method returns a reference to the live list, 077 * not a snapshot. Therefore any modification you make to the 078 * returned list will be present inside the JAXB object. 079 * This is why there is not a <CODE>set</CODE> method for the constructData property. 080 * 081 * <p> 082 * For example, to add a new item, do as follows: 083 * <pre> 084 * getConstructData().add(newItem); 085 * </pre> 086 * 087 * 088 * <p> 089 * Objects of the following type(s) are allowed in the list 090 * {@link ConstructData } 091 * 092 * 093 */ 094 public List<ConstructData> getConstructData() { 095 if (constructData == null) { 096 constructData = new ArrayList<ConstructData>(); 097 } 098 return this.constructData; 099 } 100 101 public boolean isSetConstructData() { 102 return ((this.constructData!= null)&&(!this.constructData.isEmpty())); 103 } 104 105 public void unsetConstructData() { 106 this.constructData = null; 107 } 108 109 /** 110 * Gets the value of the project property. 111 * 112 * @return 113 * possible object is 114 * {@link String } 115 * 116 */ 117 public String getProject() { 118 return project; 119 } 120 121 /** 122 * Sets the value of the project property. 123 * 124 * @param value 125 * allowed object is 126 * {@link String } 127 * 128 */ 129 public void setProject(String value) { 130 this.project = value; 131 } 132 133 public boolean isSetProject() { 134 return (this.project!= null); 135 } 136 137 /** 138 * Gets the value of the owner property. 139 * 140 * @return 141 * possible object is 142 * {@link String } 143 * 144 */ 145 public String getOwner() { 146 return owner; 147 } 148 149 /** 150 * Sets the value of the owner property. 151 * 152 * @param value 153 * allowed object is 154 * {@link String } 155 * 156 */ 157 public void setOwner(String value) { 158 this.owner = value; 159 } 160 161 public boolean isSetOwner() { 162 return (this.owner!= null); 163 } 164 165 /** 166 * Gets the value of the startTime property. 167 * 168 * @return 169 * possible object is 170 * {@link XMLGregorianCalendar } 171 * 172 */ 173 public XMLGregorianCalendar getStartTime() { 174 return startTime; 175 } 176 177 /** 178 * Sets the value of the startTime property. 179 * 180 * @param value 181 * allowed object is 182 * {@link XMLGregorianCalendar } 183 * 184 */ 185 public void setStartTime(XMLGregorianCalendar value) { 186 this.startTime = value; 187 } 188 189 public boolean isSetStartTime() { 190 return (this.startTime!= null); 191 } 192 193 /** 194 * Gets the value of the granularity property. 195 * 196 * @return 197 * possible object is 198 * {@link String } 199 * 200 */ 201 public String getGranularity() { 202 return granularity; 203 } 204 205 /** 206 * Sets the value of the granularity property. 207 * 208 * @param value 209 * allowed object is 210 * {@link String } 211 * 212 */ 213 public void setGranularity(String value) { 214 this.granularity = value; 215 } 216 217 public boolean isSetGranularity() { 218 return (this.granularity!= null); 219 } 220 221 /** 222 * Gets the value of the tool property. 223 * 224 * @return 225 * possible object is 226 * {@link String } 227 * 228 */ 229 public String getTool() { 230 return tool; 231 } 232 233 /** 234 * Sets the value of the tool property. 235 * 236 * @param value 237 * allowed object is 238 * {@link String } 239 * 240 */ 241 public void setTool(String value) { 242 this.tool = value; 243 } 244 245 public boolean isSetTool() { 246 return (this.tool!= null); 247 } 248 249 // Custom methods follow. 250 251 /** 252 * Returns the percentage coverage as an integer between 0 and 100, or 0 if not coverage 253 * data is present. 254 * @return The percentage coverage as an integer between 0 and 100. 255 */ 256 public int getPercentageCoverage() { 257 if (!hasCoverageData()) { 258 return 0; 259 } 260 // Otherwise we have coverage data, so get the total covered and uncovered values. 261 int totalCovered = 0; 262 int totalUncovered = 0; 263 for (ConstructData data : this.getConstructData()) { 264 totalCovered += data.getNumCovered(); 265 totalUncovered += data.getNumUncovered(); 266 } 267 double total = totalCovered + totalUncovered; 268 return (int)((totalCovered / total) * 100.0); 269 270 } 271 272 /** 273 * Returns true if there is actual coverage data in this instance. 274 * @return True if coverage data is in this instance. 275 */ 276 public boolean hasCoverageData() { 277 return ((this.constructData != null) && (!this.constructData.isEmpty())); 278 } 279 280 }