|
From: <sa...@us...> - 2003-11-27 10:54:11
|
Update of /cvsroot/jrobin/src/org/jrobin/core
In directory sc8-pr-cvs1:/tmp/cvs-serv10180/org/jrobin/core
Modified Files:
ArcState.java Archive.java
Log Message:
Related classes (RrdInt, RrdLong, etc) are now properly rooted. RrdPrimtive class introduced as a base class for all classes mapped to a RRD file. Code should run slightly faster.
Index: ArcState.java
===================================================================
RCS file: /cvsroot/jrobin/src/org/jrobin/core/ArcState.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** ArcState.java 10 Nov 2003 08:52:27 -0000 1.2
--- ArcState.java 27 Nov 2003 10:54:07 -0000 1.3
***************
*** 42,50 ****
// create for the first time
! ArcState(Archive parentArc, boolean newState) throws IOException {
this.parentArc = parentArc;
! accumValue = new RrdDouble(this);
! nanSteps = new RrdLong(this);
! if(newState) {
// should initialize
Header header = parentArc.getParentDb().getHeader();
--- 42,48 ----
// create for the first time
! ArcState(Archive parentArc) throws IOException {
this.parentArc = parentArc;
! if(getRrdFile().getMode() == RrdFile.MODE_CREATE) {
// should initialize
Header header = parentArc.getParentDb().getHeader();
***************
*** 54,59 ****
long nan = (Util.normalize(lastUpdateTime, step) -
Util.normalize(lastUpdateTime, arcStep)) / step;
! nanSteps.set(nan);
! accumValue.set(Double.NaN);
}
}
--- 52,61 ----
long nan = (Util.normalize(lastUpdateTime, step) -
Util.normalize(lastUpdateTime, arcStep)) / step;
! nanSteps = new RrdLong(nan, this);
! accumValue = new RrdDouble(Double.NaN, this);
! }
! else {
! accumValue = new RrdDouble(this);
! nanSteps = new RrdLong(this);
}
}
Index: Archive.java
===================================================================
RCS file: /cvsroot/jrobin/src/org/jrobin/core/Archive.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** Archive.java 27 Nov 2003 10:22:58 -0000 1.3
--- Archive.java 27 Nov 2003 10:54:07 -0000 1.4
***************
*** 59,63 ****
states = new ArcState[n];
for(int i = 0; i < n; i++) {
! states[i] = new ArcState(this, true);
robins[i] = new Robin(this, rows.get());
}
--- 59,63 ----
states = new ArcState[n];
for(int i = 0; i < n; i++) {
! states[i] = new ArcState(this);
robins[i] = new Robin(this, rows.get());
}
***************
*** 75,79 ****
robins = new Robin[n];
for(int i = 0; i < n; i++) {
! states[i] = new ArcState(this, false);
robins[i] = new Robin(this, rows.get());
}
--- 75,79 ----
robins = new Robin[n];
for(int i = 0; i < n; i++) {
! states[i] = new ArcState(this);
robins[i] = new Robin(this, rows.get());
}
***************
*** 91,95 ****
for(int dsIndex = 0; dsIndex < dsCount; dsIndex++) {
// restore state
! states[dsIndex] = new ArcState(this, true);
states[dsIndex].setAccumValue(reader.getStateAccumValue(arcIndex, dsIndex));
states[dsIndex].setNanSteps(reader.getStateNanSteps(arcIndex, dsIndex));
--- 91,95 ----
for(int dsIndex = 0; dsIndex < dsCount; dsIndex++) {
// restore state
! states[dsIndex] = new ArcState(this);
states[dsIndex].setAccumValue(reader.getStateAccumValue(arcIndex, dsIndex));
states[dsIndex].setNanSteps(reader.getStateNanSteps(arcIndex, dsIndex));
|