Make sure, that within the same directory of SWT.jar
, there exists a folder called Output_Modules/
and Aggregation_Modules/
each containing jar-modules (e.g. AGGREGATE_Ger_Satellite.jar
). Optionally the input file called data.json
can be placed in this directory. A zip-file representing this required folder-architecture is provided in the moodle-filing.
java -jar SWT.jar
(if the data.json is not placed in the directory of the SWT.jar, you’ll be greeted with a file-dialog)
java -jar SWT.jar [PATH_TO_data.json]
Then you should see a GUI like this.
Description of the modules are shown by hovering over the combobox.
Output_Modules/
or Aggregation_Modules/
and can be loaded dynamically into the program by clicking the Reload Modules
button.Class | Description |
---|---|
AGGREGATE_Ger_Satellite | Aggregates all Satellites that have german channels implements IAggregate. |
AGGREGATE_Radio_Channels | Aggregates all Satellites with radio channels implements IAggregate. |
AGGREGATE_Satellite_Channels_HD | Aggregates all Satellites with HD channels implements IAggregate. |
AGGREGATE_Satellite_Eng_Channel | Aggregates all Satellites with english channels implements IAggregate. |
AGGREGATE_Satellite_Ger_Channel | Aggregates all Satellites with german channels implements IAggregate. |
AGGREGATE_Satellite_Transponder_Count_Channels | Aggregates all Satellites with their respective count of radio and TV channels implements IAggregate. |
Class | Description |
---|---|
JSONFileWriter | JSONFileWriter class implements IOutput. |
SimpleFileWriter | SimpleFileWriter class implements IOutput. |
TextBoxWriter | TextBoxWriter class inherits JFrame implements IOutput. |
public interface IAggregate extends IDescriptor {
/**
* Creates composite structure to store the aggregate.
*
* @param satellitesList list of all Satellite objects
* @return CompositeContainer Root composite container
*/
public CompositeContainer aggregate(ArrayList<Satellite> satellitesList);
}
This interface needs to be implemented in any further aggregation-module, written by any developer. The Input of any aggregation is a list, containing all satellite data, including their transponders and channels. Any aggregation-module must return a compositum-instance (can be hierarchically indefinitely deep) containing the results of the particular aggregation.
public interface IOutput extends IDescriptor {
/**
* Outputs the contents of the composite structure
*
* @param container Root composite container
*/
public void output(CompositeContainer container);
/**
* Resets the Output module object to its initial state.
*
*/
public void reset();
}
This interface needs to be implemented in any further output-module, written by any developer. Input of any output is a head-container of a compositum-structure, containing all aggregated key-value-data. Furthermore, the method void reset()
needs to be implemented to make sure, the state of any output module can be set to its initial state afterwards.
Create a project for your module and include SWT.jar as external dependency.
MyModule.jar
must match the class (e.g. MyModule.java
) implementing the interface
import java.util.ArrayList;
import model.Satellite;
import model.aggregations.IAggregate;
import model.container.CompositeContainer;
public class AGGREGATE_Template_Module implements IAggregate {
private static final String NAME = "Decent Name of Class";
private static final String DESCRIPTION = "<HTML><pre width=220px>"
+ "- Description: A\n"
+ " - of: i\n"
+ " - implemented: ii\n"
+ " - Module: iii\n"
+ "</pre></HTML>";
@Override
public String getName() {
return NAME;
}
@Override
public String getDescription() {
return DESCRIPTION;
}
@Override
public CompositeContainer aggregate(ArrayList<Satellite> satellites) {
// TODO Auto-generated method stub
return null;
}
}
import model.container.CompositeContainer;
import view.output.IOutput;
public class OUTPUT_Template_Module implements IOutput {
private static final String NAME = "Decent Name of Class";
private static final String DESCRIPTION = "<HTML><pre width=300px>Description of implemented module.</pre></HTML>";
@Override
public String getDescription() {
return DESCRIPTION;
}
@Override
public String getName() {
return NAME;
}
@Override
public void output(CompositeContainer root) {
// TODO Auto-generated method stub
}
@Override
public void reset() {
// TODO Auto-generated method stub
}
}