Search in sources :

Example 31 with PluginParameters

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

the class LevenshteinDistancePlugin method createParameters.

@Override
public PluginParameters createParameters() {
    final PluginParameters parameters = new PluginParameters();
    final PluginParameter<SingleChoiceParameterType.SingleChoiceParameterValue> attributeType = SingleChoiceParameterType.build(ATTRIBUTE_PARAMETER_ID);
    attributeType.setName("Compare Attribute");
    attributeType.setDescription("The node attribute to compare");
    parameters.addParameter(attributeType);
    final PluginParameter<IntegerParameterValue> maxDistance = IntegerParameterType.build(MAXIMUM_DISTANCE_PARAMETER_ID);
    maxDistance.setName("Maximum Distance");
    maxDistance.setDescription("Only draws links between nodes whose attributes are at most this far apart");
    maxDistance.setIntegerValue(1);
    IntegerParameterType.setMinimum(maxDistance, 0);
    parameters.addParameter(maxDistance);
    final PluginParameter<BooleanParameterValue> caseInsensitiveParameter = BooleanParameterType.build(CASE_INSENSITIVE_PARAMETER_ID);
    caseInsensitiveParameter.setName("Case Insensitive");
    caseInsensitiveParameter.setDescription("Ignore case when comparing attribute");
    caseInsensitiveParameter.setBooleanValue(false);
    parameters.addParameter(caseInsensitiveParameter);
    final PluginParameter<BooleanParameterValue> selectedOnlyParameter = BooleanParameterType.build(SELECTED_ONLY_PARAMETER_ID);
    selectedOnlyParameter.setName("Selected Only");
    selectedOnlyParameter.setDescription("Compare selected nodes only");
    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) SingleChoiceParameterValue(au.gov.asd.tac.constellation.plugins.parameters.types.SingleChoiceParameterType.SingleChoiceParameterValue)

Example 32 with PluginParameters

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

the class PreferentialAttachmentPlugin 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<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) PluginParameters(au.gov.asd.tac.constellation.plugins.parameters.PluginParameters)

Example 33 with PluginParameters

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

the class EccentricityPluginNGTest method testNormalisedEccentricity.

@Test
public void testNormalisedEccentricity() throws Exception {
    final EccentricityPlugin instance = new EccentricityPlugin();
    final PluginParameters parameters = instance.createParameters();
    parameters.setBooleanValue(EccentricityPlugin.INCLUDE_CONNECTIONS_IN_PARAMETER_ID, true);
    parameters.setBooleanValue(EccentricityPlugin.INCLUDE_CONNECTIONS_OUT_PARAMETER_ID, true);
    parameters.setBooleanValue(EccentricityPlugin.TREAT_UNDIRECTED_BIDIRECTIONAL, true);
    parameters.setBooleanValue(EccentricityPlugin.NORMALISE_AVAILABLE_PARAMETER_ID, true);
    parameters.setBooleanValue(EccentricityPlugin.NORMALISE_CONNECTED_COMPONENTS_PARAMETER_ID, false);
    PluginExecution.withPlugin(instance).withParameters(parameters).executeNow(graph);
    assertEquals(graph.getFloatValue(vertexEccentricityAttribute, vxId0), 1.0f - (3.0f / 3.0f));
    assertEquals(graph.getFloatValue(vertexEccentricityAttribute, vxId1), 1.0f - (2.0f / 3.0f));
    assertEquals(graph.getFloatValue(vertexEccentricityAttribute, vxId2), 1.0f - (2.0f / 3.0f));
    assertEquals(graph.getFloatValue(vertexEccentricityAttribute, vxId3), 1.0f - (2.0f / 3.0f));
    assertEquals(graph.getFloatValue(vertexEccentricityAttribute, vxId4), 1.0f - (3.0f / 3.0f));
}
Also used : PluginParameters(au.gov.asd.tac.constellation.plugins.parameters.PluginParameters) Test(org.testng.annotations.Test)

Example 34 with PluginParameters

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

the class EccentricityPluginNGTest method testEccentricity.

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

Example 35 with PluginParameters

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

the class LocalClusteringCoefficientPluginNGTest method testNormalisedLocalClusteringCoefficient.

@Test
public void testNormalisedLocalClusteringCoefficient() throws Exception {
    final LocalClusteringCoefficientPlugin instance = new LocalClusteringCoefficientPlugin();
    final PluginParameters parameters = instance.createParameters();
    parameters.setBooleanValue(LocalClusteringCoefficientPlugin.NORMALISE_AVAILABLE_PARAMETER_ID, true);
    PluginExecution.withPlugin(instance).withParameters(parameters).executeNow(graph);
    assertEquals(graph.getFloatValue(vertexLocalClusteringCoefficientAttribute, vxId0), 0f / 1.0f);
    assertEquals(graph.getFloatValue(vertexLocalClusteringCoefficientAttribute, vxId1), 0.33333334f / 1.0f);
    assertEquals(graph.getFloatValue(vertexLocalClusteringCoefficientAttribute, vxId2), 1.0f / 1.0f);
    assertEquals(graph.getFloatValue(vertexLocalClusteringCoefficientAttribute, vxId3), 0.33333334f / 1.0f);
    assertEquals(graph.getFloatValue(vertexLocalClusteringCoefficientAttribute, vxId4), 0f / 1.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