fsmvis.engine
Class NeighbourAndSampleModel

java.lang.Object
  |
  +--fsmvis.engine.SpringModel
        |
        +--fsmvis.engine.NeighbourAndSampleModel

public class NeighbourAndSampleModel
extends SpringModel

See Also:
Serialized Form

Field Summary
static java.lang.String NEIGHBOUR_SIZE
           
protected  java.util.ArrayList neighbours
           
static int neighbourSize
           
static java.lang.String SAMPLE_SIZE
           
protected  java.util.ArrayList samples
           
static int sampleSize
           
 
Fields inherited from class fsmvis.engine.SpringModel
dampingFactor, dataItems, dataSizeFactor, deltaTime, endC, force, freeness, gravityDampingForce, gravityForce, layoutBounds, numIterations, position, properties, rangeHi, rangeLo, runningTime, springForce, startTime, timeDampingForce, timeForce, unrelatedDist, velocity, viewParent
 
Constructor Summary
NeighbourAndSampleModel(DataItemCollection dataItems, EndCriteria ec, Viewer v)
          constructor: takes a DataItemCollection as argument, this is the data that will be used with this layout model
NeighbourAndSampleModel(DataItemCollection dataItems, EndCriteria ec, Viewer v, int neigh, int samp)
          constructor: takes a DataItemCollection as argument, this is the data that will be used with this layout model
 
Method Summary
 void calcForces(int index)
          Calculates the forces that will be exerted on dataItem with index index Calcs forces only by looking at neighbours and samples lists.
 void doNormalise()
          Instruction to normalise data for spring model
 void findNewNeighbours(int index)
          For the object at index point, check thro' its samples list to check if any of those objects would make better neighbours than the ones currently in the neighbours list.
 void initValues()
          Initialises the values for this class, over rides the method in Spring model.
protected  void loadProperties()
          Initialises the properties for this object to be the properties held for this object
protected  void randomizeSample(int index)
          Creates a new arrayList of random numbers to be used by the samples ArrayList.
protected  void randomizeSample(int index, java.lang.String s)
          To ensure this version runs for final iterations of interp model - should run on whole set, rather than version in SubsetNeighb+Samp
 void setSizes(int v, int s)
           
 
Methods inherited from class fsmvis.engine.SpringModel
addForces, calcGravityForce, calcTimeForce, doIteration, getApproxError, getApproxVelocity, getAvgError, getAvgVelocity, getDataItem, getDataItemCollection, getDisplayableItems, getExecutionTime, getNumIterations, getPosition, getProperties, getStress, init, integrateChanges, randomizePositions, resetIterations, setDataItemCollection, updateValues
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

neighbours

protected java.util.ArrayList neighbours

samples

protected java.util.ArrayList samples

neighbourSize

public static int neighbourSize

sampleSize

public static int sampleSize

NEIGHBOUR_SIZE

public static final java.lang.String NEIGHBOUR_SIZE

SAMPLE_SIZE

public static final java.lang.String SAMPLE_SIZE
Constructor Detail

NeighbourAndSampleModel

public NeighbourAndSampleModel(DataItemCollection dataItems,
                               EndCriteria ec,
                               Viewer v)
constructor: takes a DataItemCollection as argument, this is the data that will be used with this layout model
Parameters:
dataItems -  

NeighbourAndSampleModel

public NeighbourAndSampleModel(DataItemCollection dataItems,
                               EndCriteria ec,
                               Viewer v,
                               int neigh,
                               int samp)
constructor: takes a DataItemCollection as argument, this is the data that will be used with this layout model
Parameters:
dataItems -  
Method Detail

loadProperties

protected void loadProperties()
Initialises the properties for this object to be the properties held for this object
Overrides:
loadProperties in class SpringModel

initValues

public void initValues()
Initialises the values for this class, over rides the method in Spring model. Makes a call to super first.
Overrides:
initValues in class SpringModel

doNormalise

public void doNormalise()
Instruction to normalise data for spring model
Overrides:
doNormalise in class SpringModel

calcForces

public void calcForces(int index)
Calculates the forces that will be exerted on dataItem with index index Calcs forces only by looking at neighbours and samples lists. Overrides the method in SpringModel
Parameters:
index - The index of the dataItem that forces are to be calculated on
Overrides:
calcForces in class SpringModel

findNewNeighbours

public void findNewNeighbours(int index)
For the object at index point, check thro' its samples list to check if any of those objects would make better neighbours than the ones currently in the neighbours list.
Parameters:
index - The index of the element whose samples list should be examined for better neighbours

randomizeSample

protected void randomizeSample(int index)
Creates a new arrayList of random numbers to be used by the samples ArrayList. This list will contain a sampleSize random numbers, corresponding to dataItem indices, such that none of the values are the same as ones already in the sample or already in the neighbours list and are between 0 and dataItems.getSize(). THe resulting list will be stored in samples[index].
Parameters:
index - The index of the samples arrayList to store the result

randomizeSample

protected void randomizeSample(int index,
                               java.lang.String s)
To ensure this version runs for final iterations of interp model - should run on whole set, rather than version in SubsetNeighb+Samp
Parameters:
index - The index of the samples arrayList to store the result
s - No purpose

setSizes

public void setSizes(int v,
                     int s)