1 /* ZNet - Java Compression Layer for a new Socket Factory
2 Copyright (C) 1999, Free Software Rulez
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
13
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17
18 The author of this program may be contacted at morgiaclaudio@yahoo.it. */
19
20 package java.net;
21
22 import java.lang;
23
24 /**
25 * This is the common interface of every statistical modeler, from here <b>interpolator</b>.
26 * It provides a common yet simple framework based on the tecnique of <b>stop-and-go</b>.
27 * When the layer sends a packet it makes a first half of measurement and stops.
28 * When the ack for the previous packet arrives, the interpolator is update with data from the second
29 * half of measurement, thus completing it.
30 * @see java.net.LinearInterpolator
31 * @author <a href="mailto:morgiaclaudio@yahoo.it">Claudio Morgia</a>
32 * @version 1.0
33 */
34 public interface Interpolator {
35 /**
36 * This method is the <b>real</b> constructor. Interface cannot have constructor but we want to
37 * underline that you must provide a constructor.
38 * @param num the number of levels supported by the compression engine, upon which this interpolator should build its model
39 * @return true if everything goes right, otherwise false
40 */
41 public abstract boolean create(Integer num);
42
43 /**
44 * This method is used to ask the interpolator which is the best level to use to compress the passed data.
45 * The level choosen depends on data dimension and other parameters kept internal to the interpolator.
46 * @return the best level to choose
47 */
48 public abstract int computeLevel(int dim);
49
50 /**
51 * This method is for internal use only.
52 */
53 public abstract boolean updateLine(int dim,double trans_time,double Xprec);
54
55 /**
56 * This method is the second half of the measurement. It takes measured parameters as arguments
57 * and update the internal data representation.
58 * @return true if everything goes right, otherwise false
59 */
60 public abstract boolean update(int level,int dim,double compress_time,double compress_dim, double trans_time);
61
62 /**
63 * Destructor and clean up.
64 */
65 public abstract boolean destroy();
66 }