gov.nist.microanalysis.EPQLibrary
Class EditableSpectrum

java.lang.Object
  extended by gov.nist.microanalysis.EPQLibrary.BaseSpectrum
      extended by gov.nist.microanalysis.EPQLibrary.EditableSpectrum
All Implemented Interfaces:
ISpectrumData, java.lang.Comparable
Direct Known Subclasses:
EDSDetector, Microcalorimeter

public class EditableSpectrum
extends BaseSpectrum

A base implementation of the ISpectrumData interface for spectra in which the channel data should be mutable.

Copyright: Pursuant to title 17 Section 105 of the United States Code this software is not subject to copyright protection and is in the public domain

Company: National Institute of Standards and Technology

Version:
1.0
Author:
Nicholas W. M. Ritchie

Field Summary
 
Fields inherited from class gov.nist.microanalysis.EPQLibrary.BaseSpectrum
mHashCode, NULL_HASH, NullSpectrum
 
Constructor Summary
EditableSpectrum(double chWidth, double zeroOffset, double[] chData)
          Constructs a EditableSpectrum from an array of channel data as doubles
EditableSpectrum(double chWidth, double zeroOffset, int[] chData)
          Constructs a EditableSpectrum from an array of channel data as integers
EditableSpectrum(int nChannels, double chWidth, double zeroOffset)
          EditableSpectrum - Create a blank editable spectrum.
EditableSpectrum(ISpectrumData sd)
          EditableSpectrum - Create an editable spectrum that is a duplicate of the specified spectrum.
 
Method Summary
 void clearChannels()
          clearChannels - Set all channel data to 0.0
 int getChannelCount()
          getChannelCount - See ISpectrumData
 double getChannelWidth()
          getChannelWidth
protected  double[] getCounts()
          getCounts - Get the channel data as a raw double array.
 double getCounts(int i)
          getCounts - See ISpectrumData
 SpectrumProperties getProperties()
          getProperties - See ISpectrumData
 double getZeroOffset()
          getZeroOffset - See ISpectrumData
protected  void setCounts(int i, double counts)
          setCounts - Set the counts for the specified channel.
 void setProperties(SpectrumProperties sp)
          setProperties - Set the SpectrumProperty object assigned to this spectrum to the specified SpectrumProperty set.
 
Methods inherited from class gov.nist.microanalysis.EPQLibrary.BaseSpectrum
compareTo, equals, hashCode, initializeSpectrumIndex, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

EditableSpectrum

public EditableSpectrum(int nChannels,
                        double chWidth,
                        double zeroOffset)
EditableSpectrum - Create a blank editable spectrum.

Parameters:
nChannels - int
chWidth - double
zeroOffset - double

EditableSpectrum

public EditableSpectrum(double chWidth,
                        double zeroOffset,
                        double[] chData)
Constructs a EditableSpectrum from an array of channel data as doubles

Parameters:
chWidth -
zeroOffset -
chData -

EditableSpectrum

public EditableSpectrum(double chWidth,
                        double zeroOffset,
                        int[] chData)
Constructs a EditableSpectrum from an array of channel data as integers

Parameters:
chWidth -
zeroOffset -
chData -

EditableSpectrum

public EditableSpectrum(ISpectrumData sd)
EditableSpectrum - Create an editable spectrum that is a duplicate of the specified spectrum.

Parameters:
sd - ISpectrumData
Method Detail

setProperties

public void setProperties(SpectrumProperties sp)
setProperties - Set the SpectrumProperty object assigned to this spectrum to the specified SpectrumProperty set.

Parameters:
sp -

getChannelCount

public final int getChannelCount()
getChannelCount - See ISpectrumData

Returns:
int

getChannelWidth

public final double getChannelWidth()
getChannelWidth

Returns:
double

getCounts

public double getCounts(int i)
getCounts - See ISpectrumData

Parameters:
i - int
Returns:
double

getCounts

protected double[] getCounts()
getCounts - Get the channel data as a raw double array.

Returns:
double[]

setCounts

protected void setCounts(int i,
                         double counts)
setCounts - Set the counts for the specified channel.

Parameters:
i - int
counts - double

getProperties

public final SpectrumProperties getProperties()
getProperties - See ISpectrumData

Returns:
SpectrumProperties

getZeroOffset

public final double getZeroOffset()
getZeroOffset - See ISpectrumData

Returns:
double

clearChannels

public final void clearChannels()
clearChannels - Set all channel data to 0.0