001 /*
002 * Created on Sep 4, 2007
003 */
004 package com.x8ing.mc.bp;
005
006 import java.util.Calendar;
007
008 /**
009 * Data object to store the characteristics of a bug.
010 *
011 * @author Patrick Heusser
012 */
013 public class Bug {
014
015 private int bugID = 0;
016
017 private BugState bugState = null;
018
019 /**
020 * the date we found the bug.
021 */
022 private Calendar discoveryDate = null;
023
024 /**
025 * what's is the impact on the business process and the loss of profitability.
026 */
027 private double negativImpactOnBusinessProcess = 0;
028
029 /**
030 * what are the cost to fix the bug.
031 */
032 private double estimatedCostToFixBug = 0;
033
034 /**
035 * @param discoveryDate
036 * @param negativImpactOnBusinessProcess
037 * @param estimatedCostToFixBug
038 * @param bugID
039 * will be given by BugList.
040 */
041 public Bug(Calendar discoveryDate, double negativImpactOnBusinessProcess, double estimatedCostToFixBug, int bugID) {
042 super();
043 this.discoveryDate = discoveryDate;
044 this.negativImpactOnBusinessProcess = negativImpactOnBusinessProcess;
045 this.estimatedCostToFixBug = estimatedCostToFixBug;
046 this.bugID = bugID;
047 this.bugState = Bug.BugState.STATE_BUG_NEW;
048 }
049
050 private Bug() {
051
052 }
053
054 public Calendar getDiscoveryDate() {
055 return discoveryDate;
056 }
057
058 public void setDiscoveryDate(Calendar discoveryDate) {
059 this.discoveryDate = discoveryDate;
060 }
061
062 public double getEstimatedCostToFixBug() {
063 return estimatedCostToFixBug;
064 }
065
066 public void setEstimatedCostToFixBug(double estimatedCostToFixBug) {
067 this.estimatedCostToFixBug = estimatedCostToFixBug;
068 }
069
070 public double getNegativImpactOnBusinessProcess() {
071 return negativImpactOnBusinessProcess;
072 }
073
074 public void setNegativImpactOnBusinessProcess(double negativImpaceOnBusinessProcess) {
075 this.negativImpactOnBusinessProcess = negativImpaceOnBusinessProcess;
076 }
077
078 public int getBugID() {
079 return bugID;
080 }
081
082 /**
083 * kind of an enum.
084 *
085 * @author Patrick Heusser
086 *
087 */
088 public static class BugState {
089
090 private String bugState = null;
091
092 private BugState(String state) {
093 this.bugState = state;
094 }
095
096 public static final BugState STATE_BUG_NEW = new BugState("new");
097
098 public static final BugState STATE_BUG_FIX_LATER = new BugState("fixLater");
099
100 public static final BugState STATE_BUG_FIXED = new BugState("fixed");
101
102 public static final BugState STATE_BUG_DEPLOYED = new BugState("deployed");
103
104 public static final BugState STATE_BUG_TEST_FAILED = new BugState("testFailed");
105
106 public static final BugState STATE_BUG_TEST_SUCESS = new BugState("testSuccess");
107
108 public boolean equals(Object obj) {
109
110 if (obj == null || !(obj instanceof BugState)) {
111 return false;
112 }
113
114 BugState state2 = (BugState) obj;
115
116 return state2.bugState.equals(this.bugState);
117
118 }
119
120 public int hashCode() {
121 return bugState.hashCode();
122 }
123
124 public String toString() {
125 return bugState;
126 }
127
128 }
129
130 public BugState getBugState() {
131 return bugState;
132 }
133
134 public void setBugState(BugState bugState) {
135 this.bugState = bugState;
136 }
137
138 public String toString() {
139 return "bugID=" + bugID + " bugState=" + bugState;
140 }
141 }
|