edu.sc.seis.fissuresUtil.display.registrar
Class BasicTimeConfig

java.lang.Object
  extended by edu.sc.seis.fissuresUtil.display.registrar.BasicTimeConfig
All Implemented Interfaces:
DataSetSeismogramReceptacle, TimeConfig
Direct Known Subclasses:
RelativeTimeConfig

public class BasicTimeConfig
extends java.lang.Object
implements TimeConfig

BasicTimeConfig synchronizes all the seismograms it holds around their initial times. It gets the first added seismogram's time interval and uses it to initialize the display interval of subsequently added seismograms. Any time shifts or interval adjustments that occur are recorded so that added seismograms will be the same distance from their begin times and displayed over the same amount of time. Created: Thu Aug 29 11:00:31 2002


Field Summary
protected  MicroSecondTimeRange initialTime
           
protected  double scale
           
protected  DataSetSeismogram[] seismograms
           
protected  java.util.Map seismoTimes
          seismoTimes contains all of the seismograms held by this config with their current TimeRange
protected  double shift
           
protected  MicroSecondTimeRange time
           
 
Constructor Summary
BasicTimeConfig()
           
BasicTimeConfig(DataSetSeismogram[] seismos)
          Creates a new BasicTimeConfig instance.
 
Method Summary
 void add(DataSetSeismogram[] seismos)
          add adds a seismogram to the config
 void addListener(TimeListener listener)
          add adds the listener to the group of objects that are updated when this time config changes
 void clear()
          clear removes all seismograms from this receptacle
 boolean contains(DataSetSeismogram seismo)
          contains checks the receptacle for the presence of seismo
 TimeEvent fireTimeEvent()
          fireTimeEvent causes the config to prepare a time event and fire it to all of its TimeEvent objects
protected  TimeEvent fireTimeEvent(TimeEvent event)
           
protected  MicroSecondTimeRange getInitialTime(DataSetSeismogram seis)
           
protected  edu.iris.Fissures.model.TimeInterval getInterval(DataSetSeismogram seismo)
           
 double getScale()
           
 DataSetSeismogram[] getSeismograms()
          returns all of the seismograms held by this receptacle
 double getShift()
           
 MicroSecondTimeRange getTime()
           
 MicroSecondTimeRange getTime(DataSetSeismogram seis)
           
 void remove(DataSetSeismogram[] seismos)
          remove removes a seismogram from this object
 void removeListener(TimeListener listener)
          remove removes listener from the update group
 void reset()
          reset causes the interval of the config to be set to the total time interval of one of the seismograms and the rest of the seismograms to be set as if they were just added based on that interval
 void reset(DataSetSeismogram[] seismos)
          reset causes this seismogram to be set around the current shift and interval
 void shaleTime(double shift, double scale)
          shaleTime shifts then scales all the seismograms in the config.
 void shaleTime(double shift, double scale, DataSetSeismogram[] seismos)
          shaleTime performs a shale on the seismograms in the array
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

seismoTimes

protected java.util.Map seismoTimes
seismoTimes contains all of the seismograms held by this config with their current TimeRange


seismograms

protected DataSetSeismogram[] seismograms

shift

protected double shift

scale

protected double scale

time

protected MicroSecondTimeRange time

initialTime

protected MicroSecondTimeRange initialTime
Constructor Detail

BasicTimeConfig

public BasicTimeConfig()

BasicTimeConfig

public BasicTimeConfig(DataSetSeismogram[] seismos)
Creates a new BasicTimeConfig instance. The display interval is initialized to be the same as the seismogram being passed

Parameters:
seismo - the initial seismogram
Method Detail

add

public void add(DataSetSeismogram[] seismos)
add adds a seismogram to the config

Specified by:
add in interface DataSetSeismogramReceptacle
Parameters:
seismo - the seismogram to be added

getInitialTime

protected MicroSecondTimeRange getInitialTime(DataSetSeismogram seis)

remove

public void remove(DataSetSeismogram[] seismos)
remove removes a seismogram from this object

Specified by:
remove in interface DataSetSeismogramReceptacle
Parameters:
seismo - the seismogram to be removed

clear

public void clear()
Description copied from interface: DataSetSeismogramReceptacle
clear removes all seismograms from this receptacle

Specified by:
clear in interface DataSetSeismogramReceptacle

contains

public boolean contains(DataSetSeismogram seismo)
contains checks the receptacle for the presence of seismo

Specified by:
contains in interface DataSetSeismogramReceptacle
Parameters:
seismo - the seismogram whose presence is to be tested
Returns:
true if the receptacle contains seismo, false otherwise

getSeismograms

public DataSetSeismogram[] getSeismograms()
Description copied from interface: DataSetSeismogramReceptacle
returns all of the seismograms held by this receptacle

Specified by:
getSeismograms in interface DataSetSeismogramReceptacle
Returns:
an array containing all of this receptacles seismograms

reset

public void reset()
reset causes the interval of the config to be set to the total time interval of one of the seismograms and the rest of the seismograms to be set as if they were just added based on that interval

Specified by:
reset in interface DataSetSeismogramReceptacle

reset

public void reset(DataSetSeismogram[] seismos)
reset causes this seismogram to be set around the current shift and interval

Specified by:
reset in interface DataSetSeismogramReceptacle
Parameters:
seismo - a DataSetSeismogram to be reset

shaleTime

public void shaleTime(double shift,
                      double scale)
Description copied from interface: TimeConfig
shaleTime shifts then scales all the seismograms in the config. First, the shift value is used to move the begin time by shift*timeWidth. Then the scale value is used to adjust the end time so that the new timeWidth is scale*timeWidth. So, if shift = 1 and scale = 2, the shift is applied and the new begin time is equal to the old end time. Then the time width is modified to be two times its original size. The new time starts at the old begin time and lasts twice as long. An adjustment of shift = 0, scale = 1 will leave the seismograms unchanged. A scale value must be greater than 0, or it will reduce the time width to nothing.

Specified by:
shaleTime in interface TimeConfig
Parameters:
shift - the percentage of current time width by which the seismograms will be shifted
scale - the percentage of the current time width that will exist after the end time is moved

shaleTime

public void shaleTime(double shift,
                      double scale,
                      DataSetSeismogram[] seismos)
Description copied from interface: TimeConfig
shaleTime performs a shale on the seismograms in the array

Specified by:
shaleTime in interface TimeConfig

getShift

public double getShift()
Specified by:
getShift in interface TimeConfig

getScale

public double getScale()
Specified by:
getScale in interface TimeConfig

fireTimeEvent

public TimeEvent fireTimeEvent()
Description copied from interface: TimeConfig
fireTimeEvent causes the config to prepare a time event and fire it to all of its TimeEvent objects

Specified by:
fireTimeEvent in interface TimeConfig
Returns:
the ConfigEvent fired

fireTimeEvent

protected TimeEvent fireTimeEvent(TimeEvent event)

getTime

public MicroSecondTimeRange getTime()
Specified by:
getTime in interface TimeConfig
Returns:
a MicroSecondTimeRange that covers the current generic time range of this TimeConfig

getTime

public MicroSecondTimeRange getTime(DataSetSeismogram seis)
Specified by:
getTime in interface TimeConfig
Parameters:
seis - a DataSetSeismogram a time is desired for
Returns:
a MicroSecondTimeRange describing the current time of the given seismogram in the time config

addListener

public void addListener(TimeListener listener)
Description copied from interface: TimeConfig
add adds the listener to the group of objects that are updated when this time config changes

Specified by:
addListener in interface TimeConfig
Parameters:
listener - a TimeEventListener that will be updated as this config changes

removeListener

public void removeListener(TimeListener listener)
Description copied from interface: TimeConfig
remove removes listener from the update group

Specified by:
removeListener in interface TimeConfig
Parameters:
listener - a TimeEventListener that will no longer receive updates from this config

getInterval

protected edu.iris.Fissures.model.TimeInterval getInterval(DataSetSeismogram seismo)