I have two questions - I'm a beginner in Java but have a huge java project :(
If I implement a class (which is an interface that has two void methods) and I try to write another method in my class, it compiles but at run time the method is skipped? What could I be doing wrong?
How do I run a class from another class that is not the main. So basically the main runs a class which then calls another class...
I know these questions are pretty limited in terms of content but the program is really complexed at its just impossible to explain everything :(
Any help would be greatly Appreciated :) Thanks!!
--- updated - as requested
class FriendLists implements Results {
public void processCommunication (Communication d) {...}
public void postProcess() {...}
//the above two run perfectly
//I don't know what to do next.
//I'm trying to create a link to my other class, to use the values values
//but when compiled and running it skips this method (and all other methods except the above two
public void processCommunication(AggregatedDirect f) {
//does something from the class I'm trying to run
man = f.getNumTargets(); //getNumTargets is a value in the AggregatedDirect Class
}
,
interface Results {
void processCommunication (Communication c) throws SAXException;
void postProcess();
}
,
public class AggregatedDirect extends Communication {
ArrayList<Integer> targets;
public AggregatedDirect(Direct d) {
super();
targets = new ArrayList<Integer>();
this.type = d.getType();
this.invocSerial = d.getInvocSerial();
this.serial = d.getSerial();
this.usage = d.getUsage();
this.messageType = d.getMessageType();
this.characterID = d.getCharacterID();
this.characterStatus = d.getCharacterStatus();
this.locationID = d.getLocationID();
targets.add(d.getTargetCharacterID());
this.targetCharacterID = -1;
this.targetCharacterStatus = -1;
this.targetCharacterLocationID = -1;
this.message = d.getMessage();
this.time = d.getTime();
this.annotation = d.getAnnotation();
}
public void addTarget(int targetCharacterID) {
targets.add(targetCharacterID);
}
public void addTarget(Direct d){
addTarget(d.getTargetCharacterID());
}
public int getNumTargets() {
if (targets == null)
return -1;
else
return targets.size();
}
public ArrayList<Integer> getTargets() {
return targets;
}
}
- Describe class
Communication
here. - Abstract superclass of all the communication
- subclasses.
in effect - processes an XML file and separates it
- Direct extends communications // it basically one of the String Values in the XML file