I am rewriting c code to Java to run on an Android-based BeagleBone Black. Since there are not struc types in java, I'm defining the data structures using public static class methods. However, in the structures are an array of sub-structures. As a model, say we want to define a class called Satellites. In each Satellite are Transponders and for each transponder is the channel information. I am trying to figure out how to declare and then initialize the sub-classes inside the class. My basic definition is:
public static final int SATELLITE_MAX = 50;
public static final int TRANSPONDER_MAX = 24;
public static final int CHANNEL_MAX = 36;
public static class satellite_struct {
public string satId;
public string satName;
public string satLocation;
public class transponder_struct {
public int frequency;
public char polarity;
public class channels_struct {
public string channel_name;
public string encryption;
public int sid;
}
}
}
I can instantiate the satellite structure class as follows:
satellite_struct satellites[] = new satellite_struct[SATELLITE_MAX]
but, how do I initialize the x transponders and y channels inside this class?
Thanks.