corina.cross
Class Trend

java.lang.Object
  |
  +--corina.cross.Cross
        |
        +--corina.cross.Trend
All Implemented Interfaces:
Runnable

public class Trend
extends Cross

Class representing a "trend" algorithm for crossdating, whereby scores are the ratio of matching trends to total 1-year intervals.

Version:
$Id: Trend.java,v 1.3 2002/10/29 15:33:10 bitpoet Exp $
Author:
Ken Harris

Fields inherited from class corina.cross.Cross
data, fixed, highScores, moving, msg
 
Constructor Summary
protected Trend()
           
  Trend(Sample fixed, Sample moving)
          Create a new Trend from given samples.
 
Method Summary
 double compute(int offset_fixed, int offset_moving)
          Compute a single trend, i.e., the trend between the two samples for a given possible position.
 String getFormat()
          A format string for trends.
 double getMinimumSignificant()
           
 String getName()
          This algorithm's name ("Trend", hopefully localized).
 boolean isSignificant(double score, int overlap)
           
protected  void preamble()
          Crossdate preamble: any setup that needs to be done before the main loop to compute individual scores.
 
Methods inherited from class corina.cross.Cross
getFixed, getMinimumOverlap, getMoving, isFinished, run, single, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Trend

protected Trend()

Trend

public Trend(Sample fixed,
             Sample moving)
Create a new Trend from given samples.
Parameters:
fixed - fixed sample to use
moving - moving sample to use
Method Detail

isSignificant

public boolean isSignificant(double score,
                             int overlap)
Overrides:
isSignificant in class Cross

getMinimumSignificant

public double getMinimumSignificant()
Overrides:
getMinimumSignificant in class Cross

getName

public String getName()
This algorithm's name ("Trend", hopefully localized).
Overrides:
getName in class Cross
Returns:
the name of this cross

getFormat

public String getFormat()
A format string for trends.
Overrides:
getFormat in class Cross
Returns:
a format string for trends

preamble

protected void preamble()
Description copied from class: Cross
Crossdate preamble: any setup that needs to be done before the main loop to compute individual scores.
Overrides:
preamble in class Cross

compute

public double compute(int offset_fixed,
                      int offset_moving)
Compute a single trend, i.e., the trend between the two samples for a given possible position.
Overrides:
compute in class Cross
Parameters:
offset_fixed - index into the fixed sample to start
offset_moving - index into the moving sample to start
Returns:
trend score for these offsets