public abstract class MultipleChannel extends GraphType implements AsciiComm
The 2 subclasses which use this class are MultipleAudio and MultipleSpectra. MultipleAudio is a type to store multiple channels of time-series data. This could be used to store stereo music or multiple channels from a recording device. MultipleSpectra is used to contain multiple channels of frequency domain data.
GraphType
,
ChannelFormat
,
MultipleAudio
,
MultipleSpectra
,
Serialized FormModifier and Type | Field and Description |
---|---|
protected java.util.Vector |
channelFormat
Used to store the audio format for each channel (for data or real data)
|
NOT_CONNECTED, NOT_READY, OUT_OF_RANGE
Constructor and Description |
---|
MultipleChannel()
Creates an empty non-complex MultipleChannel Object.
|
MultipleChannel(int channels)
Creates a MultipleChannel object with a specific number of channels
|
Modifier and Type | Method and Description |
---|---|
TrianaType |
copyMe()
This is one of the most important methods of Triana data.
|
protected void |
copyParameters(TrianaType source)
Copies modifiable parameters from the argument object to the current object.
|
abstract ChannelFormat |
createChannelFormatFrom(java.lang.String line)
This function creates a ChannelFormat object from the given String using the toString and setFromString()
functions with a ChannelFormat
|
boolean |
equals(TrianaType obj)
Determines whether the argument TrianaType is equal to the current MultipleChannel.
|
java.lang.Object |
getChannel(int channelNo) |
ChannelFormat |
getChannelFormat(int channelNo) |
java.util.Vector |
getChannelFormatContainer() |
java.lang.Object |
getChannelImag(int channelNo) |
int |
getChannelLength(int channelNo) |
int |
getChannelLengthImag(int channelNo) |
int |
getChannels() |
void |
inputFromStream(java.io.BufferedReader dis)
Used when Triana types want to be able to receive ASCII data from the output of other programs.
|
boolean |
isCompatible(TrianaType obj)
Tests the argument object to determine if it makes sense to perform arithmetic operations between it and the
current object.
|
void |
outputToStream(java.io.PrintWriter dos)
Used when Triana types want to be able to send ASCII data to other programs using strings.
|
void |
setChannel(int channelNo,
byte[] data,
ChannelFormat format)
Inserts a channel whose data contains bytes into this MultipleChannel object at the particular position
|
void |
setChannel(int channelNo,
double[] data,
ChannelFormat format)
Inserts a channel whose data contains doubles into this MultipleChannel object at the particular position
|
void |
setChannel(int channelNo,
int[] data,
ChannelFormat format)
Inserts a channel whose data contains ints into this MultipleChannel object at the particular position
|
void |
setChannel(int channelNo,
java.lang.Object data,
ChannelFormat format)
Inserts a channel into this MultipleChannel Type at the particular position
|
void |
setChannel(int channelNo,
short[] data,
ChannelFormat format)
Inserts a channel whose data contains shorts into this MultipleChannel object at the particular position
|
void |
setChannelImag(int channelNo,
byte[] data)
Inserts the imaginary part of the given channel whose data contains bytes into this MultipleChannel object at the
particular position
|
void |
setChannelImag(int channelNo,
double[] data)
Inserts the imaginary part of the given channel whose data contains doubles into this MultipleChannel object at
the particular position
|
void |
setChannelImag(int channelNo,
int[] data)
Inserts the imaginary part of the given channel whose data contains ints into this MultipleChannel object at the
particular position
|
void |
setChannelImag(int channelNo,
java.lang.Object data)
Inserts a imaginary part of the given channel into this MultipleChannel Type at the particular position.
|
void |
setChannelImag(int channelNo,
short[] data)
Inserts the imaginary part of the given channel whose data contains shorts into this MultipleChannel object at
the particular position
|
void |
setDimensions(int indChans,
int channels)
Sets the number of data channels.
|
add, addToTitle, convertDependentDataArraysToBytes, convertDependentDataArraysToDoubles, convertDependentDataArraysToFloats, convertDependentDataArraysToInts, convertDependentDataArraysToLongs, convertDependentDataArraysToShorts, copyData, copyLabels, divide, equals, getDataArrayClass, getDataArrayImag, getDataArrayImag, getDataArrayImagAsBytes, getDataArrayImagAsDoubles, getDataArrayImagAsFloats, getDataArrayImagAsInts, getDataArrayImagAsLongs, getDataArrayImagAsShorts, getDataArrayReal, getDataArrayReal, getDataArrayRealAsBytes, getDataArrayRealAsDoubles, getDataArrayRealAsFloats, getDataArrayRealAsInts, getDataArrayRealAsLongs, getDataArrayRealAsShorts, getDataArrayTypeNames, getDependentLabels, getDependentVariableDimensions, getDependentVariables, getDimensionLengths, getDimensionLengths, getGraphArrayImag, getGraphArrayImagLog10, getGraphArrayReal, getGraphArrayRealLog10, getIndependentArrayImag, getIndependentArrayReal, getIndependentLabels, getIndependentScaleImag, getIndependentScaleImagLog10, getIndependentScaleReal, getIndependentScaleRealLog10, getIndependentTriplet, getIndependentVariables, getLabels, getLabelsColumn, getTitle, isArithmeticArray, isArithmeticData, isCompatible, isDependentComplex, isIndependentComplex, isPrimitiveArray, isPrimitiveData, isTriplet, isUniform, maxDependentGraphingValuesImag, maxDependentGraphingValuesReal, maxDependentVariablesImag, maxDependentVariablesReal, maxIndependentScalesImag, maxIndependentScalesReal, maxIndependentVariablesImag, maxIndependentVariablesReal, minDependentGraphingValuesImag, minDependentGraphingValuesReal, minDependentVariablesImag, minDependentVariablesReal, minIndependentScalesImag, minIndependentScalesReal, minIndependentVariablesImag, minIndependentVariablesReal, multiply, resetDependent, resetIndependent, restrictToSubdomain, restrictToSubdomain, setDataArrayImag, setDataArrayReal, setDefaultAxisLabelling, setDependentLabels, setDependentVariableDimensions, setDimensionLengths, setDimensionLengths, setIndependentArrayImag, setIndependentArrayReal, setIndependentLabels, setIndependentTriplet, setIndependentTriplet, setLabels, setTitle, subtract, testDataModel
containerSize, dataExists, deleteFromContainer, getDataContainer, getFromContainer, getSequenceNumber, insertIntoContainer, inspectDataContainer, setDataContainer, setSequenceNumber, updateObsoletePointers
protected java.util.Vector channelFormat
public MultipleChannel()
public MultipleChannel(int channels)
public void setDimensions(int indChans, int channels)
setDimensions
in class GraphType
indChans
- The number of independent variables (must be positive)channels
- The number of dependent variables (must be positive)public void setChannel(int channelNo, java.lang.Object data, ChannelFormat format)
public void setChannelImag(int channelNo, java.lang.Object data)
public void setChannel(int channelNo, short[] data, ChannelFormat format)
public void setChannel(int channelNo, byte[] data, ChannelFormat format)
public void setChannel(int channelNo, int[] data, ChannelFormat format)
public void setChannel(int channelNo, double[] data, ChannelFormat format)
public void setChannelImag(int channelNo, short[] data)
public void setChannelImag(int channelNo, byte[] data)
public void setChannelImag(int channelNo, int[] data)
public void setChannelImag(int channelNo, double[] data)
public java.lang.Object getChannel(int channelNo)
public java.lang.Object getChannelImag(int channelNo)
public int getChannelLength(int channelNo)
public int getChannelLengthImag(int channelNo)
public ChannelFormat getChannelFormat(int channelNo)
public java.util.Vector getChannelFormatContainer()
public int getChannels()
public TrianaType copyMe()
GraphType
To override, the programmer should not invoke the super.copyMe method. Instead, create an object of the current type and call methods copyData and copyParameters. If these have been written correctly, then they will do the copying. The code should createTool, for type YourType:
YourType y = null; try { y = (YourType)getClass().newInstance(); y.copyData( this ); y.copyParameters( this ); y.setLegend( this.getLegend() ); } catch (IllegalAccessException ee) { System.out.println("Illegal Access: " + ee.getMessage()); } catch (InstantiationException ee) { System.out.println("Couldn't be instantiated: " + ee.getMessage()); } return y;
The copied object's data should be identical to the original. The method here modifies only one item: a String indicating that the object was created as a copy is added to the description StringVector.
protected void copyParameters(TrianaType source)
In MultipleChannel, only the parameters samplingRate, acquisitionTime, and uniformlySampled need to be copied. The obsolete parameter samplingFrequency is generated automatically when the other parameters are copied and set.
This must be overridden by any subclass that defines new parameters. The overriding method should invoke its super method. It should use the set... and get... methods for the parameters in question. This method is protected so that it cannot be called except by objects that inherit from this one. It is called by copyMe.
copyParameters
in class GraphType
source
- Data object that contains the data to be copied.public void outputToStream(java.io.PrintWriter dos) throws java.io.IOException
This method must be overridden in every subclass that defines new data or parameters. The overriding method should first call<
super.outputToStream(dos)to get output from superior classes, and then new parameters defined for the current subclass must be output. Moreover, subclasses that first dimension their data arrays must explicitly transfer these data arrays.
outputToStream
in interface AsciiComm
outputToStream
in class GraphType
dos
- The data output streamjava.io.IOException
public void inputFromStream(java.io.BufferedReader dis) throws java.io.IOException
This method must be overridden in every subclass that defines new data or parameters. The overriding method should first call
super.inputFromStream(dis)to get input from superior classes, and then new parameters defined for the current subclass must be input. Moreover, subclasses that first dimension their data arrays must explicitly transfer these data arrays.
inputFromStream
in interface AsciiComm
inputFromStream
in class GraphType
dis
- The data input streamjava.io.IOException
public abstract ChannelFormat createChannelFormatFrom(java.lang.String line)
public boolean isCompatible(TrianaType obj)
In Mutiple Audio, this method first tests for compatibility with superior classes, and then (if the input object is a Mutiple Audio) tests that the input has the same channel count.
Classes derived from this should over-ride this method with further tests as appropriate. The over-riding method should normally have the first lines
boolean test = super.isCompatible( obj );followed by other tests. If other types not subclassed from GraphType or Const should be allowed to be compatible then other tests must be implemented.
obj
- The data object to be compared with the current onepublic boolean equals(TrianaType obj)
This method must be over-ridden in derived types. In a derived type called xxx the method should begin
if ( !( obj instanceof xxx ) ) return false; if ( !isCompatible( obj ) ) return false;followed by tests that are specific to type xxx (testing its own parameters) and then as a last line
return super.equals( obj );This line invokes the other equals methods up the chain to GraphType. Each superior object tests its own parameters.
obj
- The object being tested