Search in sources :

Example 6 with PluginParameters

use of au.gov.asd.tac.constellation.plugins.parameters.PluginParameters in project constellation by constellation-app.

the class WeightPlugin method createParameters.

@Override
public PluginParameters createParameters() {
    final PluginParameters parameters = new PluginParameters();
    final PluginParameter<BooleanParameterValue> normaliseToScoresParameter = BooleanParameterType.build(NORMALISE_AVAILABLE_PARAMETER_ID);
    normaliseToScoresParameter.setName("Normalise By Max Available Score");
    normaliseToScoresParameter.setDescription("Normalise calculated scores by the maximum calculated score");
    normaliseToScoresParameter.setBooleanValue(false);
    parameters.addParameter(normaliseToScoresParameter);
    return parameters;
}
Also used : BooleanParameterValue(au.gov.asd.tac.constellation.plugins.parameters.types.BooleanParameterType.BooleanParameterValue) PluginParameters(au.gov.asd.tac.constellation.plugins.parameters.PluginParameters)

Example 7 with PluginParameters

use of au.gov.asd.tac.constellation.plugins.parameters.PluginParameters in project constellation by constellation-app.

the class CosineSimilarityPlugin method createParameters.

@Override
public PluginParameters createParameters() {
    final PluginParameters parameters = new PluginParameters();
    final PluginParameter<BooleanParameterValue> includeConnectionsInParameter = BooleanParameterType.build(INCLUDE_CONNECTIONS_IN_PARAMETER_ID);
    includeConnectionsInParameter.setName("Include Incoming");
    includeConnectionsInParameter.setDescription("Include incoming connections");
    includeConnectionsInParameter.setBooleanValue(true);
    parameters.addParameter(includeConnectionsInParameter);
    final PluginParameter<BooleanParameterValue> includeConnectionsOutParameter = BooleanParameterType.build(INCLUDE_CONNECTIONS_OUT_PARAMETER_ID);
    includeConnectionsOutParameter.setName("Include Outgoing");
    includeConnectionsOutParameter.setDescription("Include outgoing connections");
    includeConnectionsOutParameter.setBooleanValue(true);
    parameters.addParameter(includeConnectionsOutParameter);
    final PluginParameter<BooleanParameterValue> treatUndirectedBidirectionalParameter = BooleanParameterType.build(TREAT_UNDIRECTED_BIDIRECTIONAL_PARAMETER_ID);
    treatUndirectedBidirectionalParameter.setName("Include Undirected");
    treatUndirectedBidirectionalParameter.setDescription("Treat undirected connections as bidirectional connections");
    treatUndirectedBidirectionalParameter.setBooleanValue(true);
    parameters.addParameter(treatUndirectedBidirectionalParameter);
    final PluginParameter<IntegerParameterValue> minCommonFeatures = IntegerParameterType.build(MINIMUM_COMMON_FEATURES_PARAMETER_ID);
    minCommonFeatures.setName("Minimum Common Features");
    minCommonFeatures.setDescription("Only calculate similarity between nodes that share at least this many features");
    minCommonFeatures.setIntegerValue(3);
    IntegerParameterType.setMinimum(minCommonFeatures, 1);
    parameters.addParameter(minCommonFeatures);
    final PluginParameter<BooleanParameterValue> selectedOnlyParameter = BooleanParameterType.build(SELECTED_ONLY_PARAMETER_ID);
    selectedOnlyParameter.setName("Selected Only");
    selectedOnlyParameter.setDescription("Calculate using only selected elements");
    selectedOnlyParameter.setBooleanValue(false);
    parameters.addParameter(selectedOnlyParameter);
    return parameters;
}
Also used : BooleanParameterValue(au.gov.asd.tac.constellation.plugins.parameters.types.BooleanParameterType.BooleanParameterValue) IntegerParameterValue(au.gov.asd.tac.constellation.plugins.parameters.types.IntegerParameterType.IntegerParameterValue) PluginParameters(au.gov.asd.tac.constellation.plugins.parameters.PluginParameters)

Example 8 with PluginParameters

use of au.gov.asd.tac.constellation.plugins.parameters.PluginParameters in project constellation by constellation-app.

the class DirectedShortestPathsPluginNGTest method testCreateParameters.

/**
 * Test of createParameters method, of class DirectedShortestPathsPlugin.
 */
@Test
public void testCreateParameters() {
    System.out.println("createParameters");
    final DirectedShortestPathsPlugin instance = new DirectedShortestPathsPlugin();
    final PluginParameters params = instance.createParameters();
    assertEquals(params.getParameters().size(), 1);
    assertTrue(params.getParameters().containsKey(SOURCE_NODE_PARAMETER_ID));
}
Also used : PluginParameters(au.gov.asd.tac.constellation.plugins.parameters.PluginParameters) Test(org.testng.annotations.Test)

Example 9 with PluginParameters

use of au.gov.asd.tac.constellation.plugins.parameters.PluginParameters in project constellation by constellation-app.

the class DirectedShortestPathsPluginNGTest method testUpdateParametersNullGraph.

/**
 * Test of updateParameters method, of class DirectedShortestPathsPlugin. Null Graph
 */
@Test
public void testUpdateParametersNullGraph() {
    System.out.println("updateParametersNullGraph");
    final DirectedShortestPathsPlugin instance = new DirectedShortestPathsPlugin();
    final PluginParameters params = instance.createParameters();
    final PluginParameter<SingleChoiceParameterValue> sourceNode = (PluginParameter<SingleChoiceParameterValue>) params.getParameters().get(SOURCE_NODE_PARAMETER_ID);
    assertTrue(SingleChoiceParameterType.getOptions(sourceNode).isEmpty());
    instance.updateParameters(null, params);
    assertTrue(SingleChoiceParameterType.getOptions(sourceNode).isEmpty());
}
Also used : PluginParameters(au.gov.asd.tac.constellation.plugins.parameters.PluginParameters) PluginParameter(au.gov.asd.tac.constellation.plugins.parameters.PluginParameter) SingleChoiceParameterValue(au.gov.asd.tac.constellation.plugins.parameters.types.SingleChoiceParameterType.SingleChoiceParameterValue) Test(org.testng.annotations.Test)

Example 10 with PluginParameters

use of au.gov.asd.tac.constellation.plugins.parameters.PluginParameters in project constellation by constellation-app.

the class BetweennessCentralityPluginNGTest method testDirectedBetweenness.

@Test
public void testDirectedBetweenness() throws Exception {
    final BetweennessCentralityPlugin instance = new BetweennessCentralityPlugin();
    final PluginParameters parameters = instance.createParameters();
    parameters.setBooleanValue(BetweennessCentralityPlugin.INCLUDE_CONNECTIONS_IN_PARAMETER_ID, false);
    parameters.setBooleanValue(BetweennessCentralityPlugin.INCLUDE_CONNECTIONS_OUT_PARAMETER_ID, true);
    parameters.setBooleanValue(BetweennessCentralityPlugin.TREAT_UNDIRECTED_BIDIRECTIONAL, true);
    parameters.setBooleanValue(BetweennessCentralityPlugin.NORMALISE_AVAILABLE_PARAMETER_ID, false);
    parameters.setBooleanValue(BetweennessCentralityPlugin.NORMALISE_POSSIBLE_PARAMETER_ID, false);
    parameters.setBooleanValue(BetweennessCentralityPlugin.NORMALISE_CONNECTED_COMPONENTS_PARAMETER_ID, false);
    parameters.setBooleanValue(BetweennessCentralityPlugin.SELECTED_ONLY_PARAMETER_ID, false);
    PluginExecution.withPlugin(instance).withParameters(parameters).executeNow(graph);
    assertEquals(graph.getFloatValue(vertexOutBetweennessAttribute, vxId0), 0f);
    assertEquals(graph.getFloatValue(vertexOutBetweennessAttribute, vxId1), 3f);
    assertEquals(graph.getFloatValue(vertexOutBetweennessAttribute, vxId2), 0f);
    assertEquals(graph.getFloatValue(vertexOutBetweennessAttribute, vxId3), 3f);
    assertEquals(graph.getFloatValue(vertexOutBetweennessAttribute, vxId4), 0f);
}
Also used : PluginParameters(au.gov.asd.tac.constellation.plugins.parameters.PluginParameters) Test(org.testng.annotations.Test)

Aggregations

PluginParameters (au.gov.asd.tac.constellation.plugins.parameters.PluginParameters)377 Test (org.testng.annotations.Test)185 Plugin (au.gov.asd.tac.constellation.plugins.Plugin)60 BooleanParameterValue (au.gov.asd.tac.constellation.plugins.parameters.types.BooleanParameterType.BooleanParameterValue)60 PluginInteraction (au.gov.asd.tac.constellation.plugins.PluginInteraction)58 PluginParameter (au.gov.asd.tac.constellation.plugins.parameters.PluginParameter)58 StringParameterValue (au.gov.asd.tac.constellation.plugins.parameters.types.StringParameterValue)52 IntegerParameterValue (au.gov.asd.tac.constellation.plugins.parameters.types.IntegerParameterType.IntegerParameterValue)48 ArrayList (java.util.ArrayList)47 Graph (au.gov.asd.tac.constellation.graph.Graph)37 SingleChoiceParameterValue (au.gov.asd.tac.constellation.plugins.parameters.types.SingleChoiceParameterType.SingleChoiceParameterValue)34 PluginException (au.gov.asd.tac.constellation.plugins.PluginException)32 MultiChoiceParameterValue (au.gov.asd.tac.constellation.plugins.parameters.types.MultiChoiceParameterType.MultiChoiceParameterValue)24 List (java.util.List)20 Map (java.util.Map)20 GraphWriteMethods (au.gov.asd.tac.constellation.graph.GraphWriteMethods)19 GraphRecordStore (au.gov.asd.tac.constellation.graph.processing.GraphRecordStore)19 ObjectParameterValue (au.gov.asd.tac.constellation.plugins.parameters.types.ObjectParameterType.ObjectParameterValue)19 ReadableGraph (au.gov.asd.tac.constellation.graph.ReadableGraph)17 IOException (java.io.IOException)17