Update of /cvsroot/jrobin/src/org/jrobin/data
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8322/org/jrobin/data
Modified Files:
Aggregates.java DataProcessor.java
Log Message:
- First support of DataProcessor into Graph.* package.
Index: DataProcessor.java
===================================================================
RCS file: /cvsroot/jrobin/src/org/jrobin/data/DataProcessor.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** DataProcessor.java 23 Jan 2005 20:31:25 -0000 1.10
--- DataProcessor.java 6 Apr 2005 20:10:09 -0000 1.11
***************
*** 72,77 ****
private boolean poolUsed = DEFAULT_POOL_USAGE_POLICY;
! private final long tStart;
! private long tEnd, timestamps[];
private double dblTimestamps[];
// this will be adjusted later
--- 72,78 ----
private boolean poolUsed = DEFAULT_POOL_USAGE_POLICY;
! private long generationTime = 0;
!
! private long tStart, tEnd, timestamps[];
private double dblTimestamps[];
// this will be adjusted later
***************
*** 85,88 ****
--- 86,94 ----
private Def[] defSources;
+ public DataProcessor()
+ {
+ // TODO Insert a check on valid timestamps later on
+ }
+
/**
* Creates new DataProcessor object for the given time span. Ending timestamp may be set to zero.
***************
*** 94,105 ****
* @throws RrdException Thrown if invalid timestamps are supplied
*/
! public DataProcessor(long t1, long t2) throws RrdException {
! if ((t1 < t2 && t1 > 0 && t2 > 0) || (t1 > 0 && t2 == 0)) {
! this.tStart = t1;
! this.tEnd = t2;
! }
! else {
! throw new RrdException("Invalid timestamps specified: " + t1 + ", " + t2);
! }
}
--- 100,106 ----
* @throws RrdException Thrown if invalid timestamps are supplied
*/
! public DataProcessor(long t1, long t2) throws RrdException
! {
! setTimePeriod( t1, t2 );
}
***************
*** 130,133 ****
--- 131,145 ----
}
+ public void setTimePeriod( long t1, long t2 ) throws RrdException
+ {
+ if ((t1 < t2 && t1 > 0 && t2 > 0) || (t1 > 0 && t2 == 0)) {
+ tStart = t1;
+ tEnd = t2;
+ }
+ else {
+ throw new RrdException("Invalid timestamps specified: " + t1 + ", " + t2);
+ }
+ }
+
/**
* Returns boolean value representing {@link org.jrobin.core.RrdDbPool RrdDbPool} usage policy.
***************
*** 244,247 ****
--- 256,268 ----
/**
+ * Returns the starting timestamp.
+ *
+ * @return Starting timestamp in seconds
+ */
+ public long getStartingTimestamp() {
+ return tStart;
+ }
+
+ /**
* Returns consolidated timestamps created with the {@link #processData()} method.
*
***************
*** 572,575 ****
--- 593,597 ----
*/
public void processData() throws IOException, RrdException {
+ generationTime = System.currentTimeMillis();
extractDefs();
fetchRrdData();
***************
*** 689,692 ****
--- 711,718 ----
}
+ public long getGenerationTime() {
+ return generationTime;
+ }
+
// PRIVATE METHODS
Index: Aggregates.java
===================================================================
RCS file: /cvsroot/jrobin/src/org/jrobin/data/Aggregates.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** Aggregates.java 15 Dec 2004 14:55:40 -0000 1.1
--- Aggregates.java 6 Apr 2005 20:10:09 -0000 1.2
***************
*** 102,106 ****
*/
public double getAggregate(String consolFun) throws RrdException {
! if(consolFun.equals(CF_AVERAGE)) {
return average;
}
--- 102,106 ----
*/
public double getAggregate(String consolFun) throws RrdException {
! if(consolFun.equals(CF_AVERAGE) || consolFun.equalsIgnoreCase( "AVG" ) ) {
return average;
}
***************
*** 111,118 ****
return last;
}
! else if(consolFun.equals(CF_MAX)) {
return max;
}
! else if(consolFun.equals(CF_MIN)) {
return min;
}
--- 111,118 ----
return last;
}
! else if(consolFun.equals(CF_MAX) || consolFun.equalsIgnoreCase( "MAXIMUM" ) ) {
return max;
}
! else if(consolFun.equals(CF_MIN) || consolFun.equalsIgnoreCase( "MINIMUM" ) ) {
return min;
}
|