Child pages
  • Practical Java Algorithm Development

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

On the second Algorithm Properties page we'll be doing something new, which requires a bit of explanation. in_data for a CIShell algorithm can be either files or Java objects. in_data for files is in the form of a MIME type, like "file:text/nwb" for the Network Workbench network format. in_data for Java objects is the class name of the object, such as prefuse.data.Graph for the prefuse Graph object. For this tutorial we will be using the data type "edu.uci.ics.jung.graph.Graph", which is the full class name for the Graph object in the Jung graph library. You should also check the checkbox for "On the menu", and set the menu path to be "Analysis".


Figure 1: Setting the input and output data type.

To make our Attack Tolerance algorithm more flexible, we would like to allow our users to choose how many of the highest degree nodes they wish to remove. On the Algorithm Parameters page, click "Add...". Set Unique ID to "numNodesToDelete", Name to "Number of Nodes to Delete", Description to "The number of highest degree nodes to delete from the input graph", Default Value to "1", and Input Type to "Integer". Click OK to finish adding this parameter. This will create a field in the user-input parameters GUI which will appear whenever a user runs our Attack Tolerance algorithm. Later we'll show you how to access these values from the AttackToleranceAlgorithm class.


Figure 2: Setting the algorithm parameters to allow user interaction.

...

To make the JUNG packages available to our plugin, double-click on META-INF/MANIFEST.MF in your attacktolerance plugin, and click the "Dependencies" tab at the bottom of the Manifest's window. You should see something like this:


Figure 3: Manifest dependencies.

Notice that under "Import Packages" several packages are already listed. The CIShell algorithm wizard automatically imports several core CIShell packages.

To import the Jung packages, click "Add...". A dialog box that looks like this should appear:


Figure 4: Importing the Jung packages.

...

To see the result of this operation, click the "MANIFEST.MF" tab at the bottom of the Manifest's window. You should see something like this:


Figure 5: The MANIFEST.MF file.

...