001: package org.griphyn.cPlanner.visualize.nodeusage;
002:
003: import org.griphyn.cPlanner.visualize.Measurement;
004:
005: import java.util.Date;
006:
007: /**
008: * Stores the number of jobs as an integer.
009: *
010: * @author Karan Vahi vahi@isi.edu
011: * @version $Revision: 50 $
012: */
013:
014: public class NumJobsMeasurement implements Measurement {
015:
016: /**
017: * Holds the timestamp when usage was taken.
018: */
019: private Date mDate;
020:
021: /**
022: * The number of jobs.
023: */
024: private Integer mNum;
025:
026: /**
027: * The jobname for which the reading was taken.
028: */
029: private String mAssociatedJob;
030:
031: /**
032: * The overloaded constructor.
033: *
034: * @param d the date.
035: * @param num the number
036: * @param name the jobname.
037: */
038: public NumJobsMeasurement(Date d, Integer num, String name) {
039: mDate = d;
040: mNum = num;
041: mAssociatedJob = name;
042: }
043:
044: /**
045: * Returns the job for which the measurement was taken.
046: *
047: * @return the name of the job.
048: */
049: public String getJobName() {
050: return this .mAssociatedJob;
051: }
052:
053: /**
054: * Returns the time at which the measurement was taken.
055: *
056: * @return the Date object representing the time.
057: */
058: public Date getTime() {
059: return mDate;
060: }
061:
062: /**
063: * Returns the value of the measurement.
064: *
065: * @return the value.
066: */
067: public Object getValue() {
068: return mNum;
069: }
070:
071: /**
072: * Sets the job for which the measurement was taken.
073: *
074: * @param sets the name of the job.
075: */
076: public void setJobName(String name) {
077: this .mAssociatedJob = name;
078: }
079:
080: /**
081: * Sets the time at which the measurement was taken.
082: *
083: * @param time the Date object representing the time.
084: */
085: public void setTime(Date time) {
086: this .mDate = time;
087: }
088:
089: /**
090: * Sets the value of the measurement.
091: *
092: * @param value the value to be associated with measurement.
093: */
094: public void setValue(Object value) {
095: this .mNum = (Integer) value;
096: }
097:
098: /**
099: * Returns textual description.
100: *
101: * @return String
102: */
103: public String toString() {
104: StringBuffer sb = new StringBuffer();
105: sb.append(mDate).append(" ").append(getValue());
106: sb.append(" ").append(getJobName());
107: return sb.toString();
108:
109: }
110: }
|