From: Sasa M. <sa...@us...> - 2004-05-11 10:06:02
|
Update of /cvsroot/jrobin/src/org/jrobin/core In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16824/org/jrobin/core Modified Files: RrdDef.java Log Message: getEstimatedSize() method introduced to RrdDef class Index: RrdDef.java =================================================================== RCS file: /cvsroot/jrobin/src/org/jrobin/core/RrdDef.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** RrdDef.java 28 Apr 2004 11:11:47 -0000 1.10 --- RrdDef.java 11 May 2004 10:05:49 -0000 1.11 *************** *** 528,530 **** --- 528,547 ---- out.close(); } + + /** + * Returns the number of bytes required on the disk to create RRD file from this + * RrdDef object. + * @return Estimated length of the new RRD file. + */ + public long getEstimatedSize() { + int dsCount = dsDefs.size(); + int arcCount = arcDefs.size(); + int rowsCount = 0; + for(int i = 0; i < arcDefs.size(); i++) { + ArcDef arcDef = (ArcDef) arcDefs.get(i); + rowsCount += arcDef.getRows(); + } + return 64L + 128L * dsCount + 56L * arcCount + + 20L * dsCount * arcCount + 8L * dsCount * rowsCount; + } } |