Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

java.net
Class LinearInterpolator  view LinearInterpolator download LinearInterpolator.java

java.lang.Object
  extended byjava.net.LinearInterpolator
All Implemented Interfaces:
Interpolator

public class LinearInterpolator
extends java.lang.Object
implements Interpolator

This class is an implementation of the Interpolator interface and it uses a statistical approach called fixed point interpolation that I created during my master degree thesis. The transmission line model and the level model are described by a linear curve like the following:
y=A*x+b
The model is composed of two interpolation curve:

The model is completed by the preceding sample point. So every model keeps five coefficients: A and B for compression time, A and B for compression ratio, and X for the last sample point. This interpolator keeps a model for the transmission line and a model for every compression level. For a complete description of the approach see my thesis.

Version:
1.0

Field Summary
protected static int Ac
           
protected static int At
           
protected static int Bc
           
protected static int Bt
           
protected  double[][] levels
          Data needed to model levels.
protected  double[] line
          Data needed to model the transmission line.
protected  int num_levels
          The number of supported levels as reported by the compression engine.
protected static int Xprec
           
 
Constructor Summary
LinearInterpolator()
          Empty constructor.
LinearInterpolator(java.lang.Integer num)
          Real constructor.
 
Method Summary
 int computeLevel(int dim)
          This method choose the best level to use to compress data based on an iterative algorithm I did in my thesis.
 boolean create(java.lang.Integer num)
          This method is the real constructor and it's responsible for data allocation and initialization.
 boolean destroy()
          Entry point for some explicit and synchronous clean up.
 void finalize()
          Called on an object by the Virtual Machine at most once, at some point after the Object is determined unreachable but before it is destroyed.
 boolean update(int level, int dim, double compress_time, double compress_dim, double trans_time)
          This method is responsible for updating the selected level model.
 boolean updateLine(int dim, double trans_time, double Xprec)
          This method is responsible for updating the transmission line model.
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

line

protected double[] line
Data needed to model the transmission line. It's an array composed of five elements.


levels

protected double[][] levels
Data needed to model levels. It's an array with the same number of elements as the supported levels and every entry is an array of five elements like the line 55 field.


num_levels

protected int num_levels
The number of supported levels as reported by the compression engine.


At

protected static int At

Bt

protected static int Bt

Ac

protected static int Ac

Bc

protected static int Bc

Xprec

protected static int Xprec
Constructor Detail

LinearInterpolator

public LinearInterpolator()
Empty constructor. Don't forget to call create 55 .


LinearInterpolator

public LinearInterpolator(java.lang.Integer num)
Real constructor.

Method Detail

destroy

public boolean destroy()
Entry point for some explicit and synchronous clean up.

Specified by:
destroy in interface Interpolator

create

public boolean create(java.lang.Integer num)
This method is the real constructor and it's responsible for data allocation and initialization.

Specified by:
create in interface Interpolator

computeLevel

public int computeLevel(int dim)
This method choose the best level to use to compress data based on an iterative algorithm I did in my thesis. Basically it's a loop starting from the most compressing level downward and during every step it calculates a threshold for the level and compares it with the dimension of the object to compress. If the dimension is over the threshold, the level is selected.
If you are interested in the mathematical background behind the choice, see my mythesis.

Specified by:
computeLevel in interface Interpolator

updateLine

public boolean updateLine(int dim,
                          double trans_time,
                          double Xprec)
This method is responsible for updating the transmission line model. If you are interested in the mathematical aspect, see my thesis.

Specified by:
updateLine in interface Interpolator

update

public boolean update(int level,
                      int dim,
                      double compress_time,
                      double compress_dim,
                      double trans_time)
This method is responsible for updating the selected level model. If you are interested in the mathematical aspect, see my thesis.

Specified by:
update in interface Interpolator

finalize

public void finalize()
              throws java.lang.Throwable
Description copied from class: java.lang.Object
Called on an object by the Virtual Machine at most once, at some point after the Object is determined unreachable but before it is destroyed. You would think that this means it eventually is called on every Object, but this is not necessarily the case. If execution terminates abnormally, garbage collection does not always happen. Thus you cannot rely on this method to always work. For finer control over garbage collection, use references from the java.lang.ref package.

Virtual Machines are free to not call this method if they can determine that it does nothing important; for example, if your class extends Object and overrides finalize to do simply super.finalize().

finalize() will be called by a java.lang.Thread that has no locks on any Objects, and may be called concurrently. There are no guarantees on the order in which multiple objects are finalized. This means that finalize() is usually unsuited for performing actions that must be thread-safe, and that your implementation must be use defensive programming if it is to always work.

If an Exception is thrown from finalize() during garbage collection, it will be patently ignored and the Object will still be destroyed.

It is allowed, although not typical, for user code to call finalize() directly. User invocation does not affect whether automatic invocation will occur. It is also permitted, although not recommended, for a finalize() method to "revive" an object by making it reachable from normal code again.

Unlike constructors, finalize() does not get called for an object's superclass unless the implementation specifically calls super.finalize().

The default implementation does nothing.