I just try to write a class, that should create and manage data entries. Until now no methods for later use are enclosed. At the moment only target is creating that array.
Unfortunately Java compiler throws a NullPointerEcxeption and I don't find out why.
So I'd be very happy for any help.
Roland
This is the code:
Code: Select all
RingSpeicher rs = new RingSpeicher(8, 11);
//============================================================
public class RingSpeicher
{
int
dataUsed=0, // number of filled data places
dataLen=1, // total number of data places
chs=1, // number of channels
initialXpos=-1;
ChannelData[] waveData; // creates a variable for channel data arrays
public RingSpeicher (int channelCount, int dataCount)
{
this.chs = channelCount;
this.dataLen = dataCount;
if (rslog) Log("rs has got parameters: ch="+this.chs+" len="+this.dataLen);
this.waveData = new ChannelData[this.chs]; // initializes the variable for an array of channel data arrays
for (int c=0; c<this.chs; ++c) {
this.waveData[c].channelData = new DataSet[dataLen]; // fill each array element with a data array
for (int index=0; index<dataLen; ++index) { // set initial values
this.waveData[c].channelData[index].logicalState = false;
this.waveData[c].channelData[index].xPos = initialXpos;
}
}
}
//-----------------------------------
public abstract class DataSet
{
boolean logicalState;
int xPos;
}
//------------------------------------
public abstract class ChannelData { // creates a data array
DataSet[] channelData;
}
//------------------------------------
public static void main (String[] args)
{
}
} // class RingSpeicher