KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jrobin > graph > Def


1 /* ============================================================
2  * JRobin : Pure java implementation of RRDTool's functionality
3  * ============================================================
4  *
5  * Project Info: http://www.jrobin.org
6  * Project Lead: Sasa Markovic (saxon@jrobin.org)
7  *
8  * Developers: Sasa Markovic (saxon@jrobin.org)
9  * Arne Vandamme (cobralord@jrobin.org)
10  *
11  * (C) Copyright 2003, by Sasa Markovic.
12  *
13  * This library is free software; you can redistribute it and/or modify it under the terms
14  * of the GNU Lesser General Public License as published by the Free Software Foundation;
15  * either version 2.1 of the License, or (at your option) any later version.
16  *
17  * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
18  * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
19  * See the GNU Lesser General Public License for more details.
20  *
21  * You should have received a copy of the GNU Lesser General Public License along with this
22  * library; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
23  * Boston, MA 02111-1307, USA.
24  */

25 package org.jrobin.graph;
26
27 /**
28  * <p>Represents a fetched datasource for a graph. A Def collects all his datavalues from an existing
29  * RRD file.</p>
30  *
31  * @author Arne Vandamme (cobralord@jrobin.org)
32  */

33 class Def extends Source
34 {
35     // ================================================================
36
// -- Constructors
37
// ================================================================
38
/**
39      * Constructs a new Def object holding a number of fetched datapoints for a graph.
40      * @param name Name of the datasource in the graph definition.
41      * @param numPoints Number of points used as graph resolution (size of the value table).
42      */

43     Def( String JavaDoc name, int numPoints, int aggregatePoints )
44     {
45         super(name);
46         values = new double[ numPoints ];
47         this.aggregatePoints = aggregatePoints;
48     }
49     
50     
51     // ================================================================
52
// -- Protected methods
53
// ================================================================
54
/**
55      * Sets the value of a specific datapoint for this Def.
56      * @param pos Position (index in the value table) of the new datapoint.
57      * @param timestamp Timestamp of the new datapoint in number of seconds.
58      * @param val Double value of the new datapoint.
59      */

60     void set( int pos, long timestamp, double val )
61     {
62         super.set( pos, timestamp, val );
63         values[pos] = val;
64     }
65
66 }
67
Popular Tags