Search in sources :

Example 26 with PluginParameters

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

the class AverageDegreeNGTest method testNoDirectionAverageDegree.

@Test
public void testNoDirectionAverageDegree() throws Exception {
    final AverageDegreePlugin instance = new AverageDegreePlugin();
    final PluginParameters parameters = instance.createParameters();
    parameters.setBooleanValue(AverageDegreePlugin.INCLUDE_CONNECTIONS_IN_PARAMETER_ID, false);
    parameters.setBooleanValue(AverageDegreePlugin.INCLUDE_CONNECTIONS_OUT_PARAMETER_ID, false);
    parameters.setBooleanValue(AverageDegreePlugin.TREAT_UNDIRECTED_BIDIRECTIONAL, false);
    PluginExecution.withPlugin(instance).withParameters(parameters).executeNow(graph);
    assertEquals(graph.getFloatValue(graphAttribute, 0), 0 / 0F);
}
Also used : PluginParameters(au.gov.asd.tac.constellation.plugins.parameters.PluginParameters) Test(org.testng.annotations.Test)

Example 27 with PluginParameters

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

the class GraphDensityNGTest method testAverageDegree.

@Test
public void testAverageDegree() throws Exception {
    final GraphDensityPlugin instance = new GraphDensityPlugin();
    final PluginParameters parameters = instance.createParameters();
    PluginExecution.withPlugin(instance).withParameters(parameters).executeNow(graph);
    assertEquals(graph.getFloatValue(graphAttribute, 0), 0.15f);
}
Also used : PluginParameters(au.gov.asd.tac.constellation.plugins.parameters.PluginParameters) Test(org.testng.annotations.Test)

Example 28 with PluginParameters

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

the class ConnectivityDegreePluginNGTest method testConnectivityDegreeSingletons.

@Test
public void testConnectivityDegreeSingletons() throws Exception {
    final ConnectivityDegreePlugin instance = new ConnectivityDegreePlugin();
    final PluginParameters parameters = instance.createParameters();
    parameters.setBooleanValue(ConnectivityDegreePlugin.INCLUDE_CONNECTIONS_IN_PARAMETER_ID, true);
    parameters.setBooleanValue(ConnectivityDegreePlugin.INCLUDE_CONNECTIONS_OUT_PARAMETER_ID, true);
    parameters.setBooleanValue(ConnectivityDegreePlugin.TREAT_UNDIRECTED_BIDIRECTIONAL, true);
    parameters.setBooleanValue(ConnectivityDegreePlugin.IGNORE_SINGLETONS, false);
    parameters.setBooleanValue(ConnectivityDegreePlugin.NORMALISE, false);
    PluginExecution.withPlugin(instance).withParameters(parameters).executeNow(graph);
    assertEquals(graph.getFloatValue(connectivityDegreeAttribute, vxId13), 2.0f);
    assertEquals(graph.getFloatValue(componentSizeAttribute, vxId13), 5.0f);
    assertEquals(graph.getFloatValue(connectivityDegreeAttribute, vxId1), 0.0f);
    assertEquals(graph.getFloatValue(componentSizeAttribute, vxId1), 1.0f);
    assertEquals(graph.getFloatValue(connectivityDegreeAttribute, vxId5), 0.0f);
    assertEquals(graph.getFloatValue(componentSizeAttribute, vxId5), 3.0f);
}
Also used : PluginParameters(au.gov.asd.tac.constellation.plugins.parameters.PluginParameters) Test(org.testng.annotations.Test)

Example 29 with PluginParameters

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

the class ConnectivityDegreePluginNGTest method testConnectivityDegree.

@Test
public void testConnectivityDegree() throws Exception {
    final ConnectivityDegreePlugin instance = new ConnectivityDegreePlugin();
    final PluginParameters parameters = instance.createParameters();
    parameters.setBooleanValue(ConnectivityDegreePlugin.INCLUDE_CONNECTIONS_IN_PARAMETER_ID, true);
    parameters.setBooleanValue(ConnectivityDegreePlugin.INCLUDE_CONNECTIONS_OUT_PARAMETER_ID, true);
    parameters.setBooleanValue(ConnectivityDegreePlugin.TREAT_UNDIRECTED_BIDIRECTIONAL, true);
    parameters.setBooleanValue(ConnectivityDegreePlugin.IGNORE_SINGLETONS, true);
    parameters.setBooleanValue(ConnectivityDegreePlugin.NORMALISE, false);
    PluginExecution.withPlugin(instance).withParameters(parameters).executeNow(graph);
    assertEquals(graph.getFloatValue(connectivityDegreeAttribute, vxId13), 1.0f);
    assertEquals(graph.getFloatValue(componentSizeAttribute, vxId13), 5.0f);
    assertEquals(graph.getFloatValue(connectivityDegreeAttribute, vxId1), 0.0f);
    assertEquals(graph.getFloatValue(componentSizeAttribute, vxId1), 1.0f);
    assertEquals(graph.getFloatValue(connectivityDegreeAttribute, vxId5), 0.0f);
    assertEquals(graph.getFloatValue(componentSizeAttribute, vxId5), 3.0f);
}
Also used : PluginParameters(au.gov.asd.tac.constellation.plugins.parameters.PluginParameters) Test(org.testng.annotations.Test)

Example 30 with PluginParameters

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

the class JaccardIndexPlugin 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)

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