Search in sources :

Example 41 with IntegerParameterValue

use of au.gov.asd.tac.constellation.plugins.parameters.types.IntegerParameterType.IntegerParameterValue in project constellation by constellation-app.

the class AddBlazePlugin method createParameters.

@Override
public PluginParameters createParameters() {
    final PluginParameters parameters = new PluginParameters();
    final PluginParameter<IntegerParameterValue> vertexIdParam = IntegerParameterType.build(VERTEX_ID_PARAMETER_ID);
    vertexIdParam.setName("Vertex Id");
    vertexIdParam.setDescription("The vertex id of the node to set a blaze");
    vertexIdParam.setObjectValue(Graph.NOT_FOUND);
    parameters.addParameter(vertexIdParam);
    final PluginParameter<ObjectParameterValue> vertexIdsParam = ObjectParameterType.build(VERTEX_IDS_PARAMETER_ID);
    vertexIdsParam.setObjectValue(null);
    vertexIdsParam.setName("Vertex Ids");
    vertexIdsParam.setDescription("The list of vertex ids to set a blaze for in bulk");
    parameters.addParameter(vertexIdsParam);
    return parameters;
}
Also used : IntegerParameterValue(au.gov.asd.tac.constellation.plugins.parameters.types.IntegerParameterType.IntegerParameterValue) PluginParameters(au.gov.asd.tac.constellation.plugins.parameters.PluginParameters) ObjectParameterValue(au.gov.asd.tac.constellation.plugins.parameters.types.ObjectParameterType.ObjectParameterValue)

Example 42 with IntegerParameterValue

use of au.gov.asd.tac.constellation.plugins.parameters.types.IntegerParameterType.IntegerParameterValue in project constellation by constellation-app.

the class HopOutPlugin method createParameters.

@Override
public PluginParameters createParameters() {
    final PluginParameters parameters = new PluginParameters();
    final PluginParameter<IntegerParameterValue> hopsParam = IntegerParameterType.build(HOPS_PARAMETER_ID);
    hopsParam.setName("Hops");
    hopsParam.setDescription("The number of hops. 0 is hop out half, 1 is hop out 1 and 2 to hop out full.");
    hopsParam.setIntegerValue(HopUtilities.HOP_OUT_HALF);
    parameters.addParameter(hopsParam);
    final PluginParameter<BooleanParameterValue> outgoingParam = BooleanParameterType.build(OUTGOING_PARAMETER_ID);
    outgoingParam.setName("Outgoing");
    outgoingParam.setDescription("True if outgoing transactions should be included, default is True");
    outgoingParam.setBooleanValue(true);
    parameters.addParameter(outgoingParam);
    final PluginParameter<BooleanParameterValue> incomingParam = BooleanParameterType.build(INCOMING_PARAMETER_ID);
    incomingParam.setName("Incoming");
    incomingParam.setDescription("True is incoming transactions should be included, default is True");
    incomingParam.setBooleanValue(true);
    parameters.addParameter(incomingParam);
    final PluginParameter<BooleanParameterValue> undirectedParam = BooleanParameterType.build(UNDIRECTED_PARAMETER_ID);
    undirectedParam.setName("Undirected");
    undirectedParam.setDescription("True is undirected transactions should be included, default is True");
    undirectedParam.setBooleanValue(true);
    parameters.addParameter(undirectedParam);
    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 43 with IntegerParameterValue

use of au.gov.asd.tac.constellation.plugins.parameters.types.IntegerParameterType.IntegerParameterValue in project constellation by constellation-app.

the class IntegerParameterTypeNGTest method testSetStep.

/**
 * Test of setStep method, of class IntegerParameterType.
 */
@Test
public void testSetStep() {
    System.out.println("setStep");
    // Step shouldnt be allowed to be 0
    // unsure if it could be negative and go backwards?
    // step shouldn't be able to be greater than maximum value
    String id = "Step";
    PluginParameter<IntegerParameterType.IntegerParameterValue> parameter = new PluginParameter<>(new IntegerParameterValue(), INSTANCE, id);
    // step shouldn't be allowed to be 0
    int step = 0;
    IntegerParameterType.setStep(parameter, step);
    assertEquals(parameter.getParameterValue().getStepValue(), step);
    // step should be allowed to be positive
    step = 6;
    IntegerParameterType.setStep(parameter, step);
    assertEquals(parameter.getParameterValue().getStepValue(), step);
    // step shouldn't be allowed to be negative
    step = -4;
    IntegerParameterType.setStep(parameter, step);
    assertEquals(parameter.getParameterValue().getStepValue(), step);
}
Also used : IntegerParameterValue(au.gov.asd.tac.constellation.plugins.parameters.types.IntegerParameterType.IntegerParameterValue) PluginParameter(au.gov.asd.tac.constellation.plugins.parameters.PluginParameter) Test(org.testng.annotations.Test)

Example 44 with IntegerParameterValue

use of au.gov.asd.tac.constellation.plugins.parameters.types.IntegerParameterType.IntegerParameterValue in project constellation by constellation-app.

the class IntegerParameterTypeNGTest method testSetMinimum.

/**
 * Test of setMinimum method, of class IntegerParameterType.
 */
@Test
public void testSetMinimum() {
    System.out.println("setMinimum");
    String id = "Minimum";
    PluginParameter<IntegerParameterType.IntegerParameterValue> parameter = new PluginParameter<>(new IntegerParameterValue(), INSTANCE, id);
    int min = 0;
    IntegerParameterType.setMinimum(parameter, min);
    assertEquals(parameter.getParameterValue().getMinimumValue(), min);
    min = -5;
    IntegerParameterType.setMinimum(parameter, min);
    assertEquals(parameter.getParameterValue().getMinimumValue(), min);
    min = 64;
    IntegerParameterType.setMinimum(parameter, min);
    assertEquals(parameter.getParameterValue().getMinimumValue(), min);
}
Also used : IntegerParameterValue(au.gov.asd.tac.constellation.plugins.parameters.types.IntegerParameterType.IntegerParameterValue) PluginParameter(au.gov.asd.tac.constellation.plugins.parameters.PluginParameter) Test(org.testng.annotations.Test)

Example 45 with IntegerParameterValue

use of au.gov.asd.tac.constellation.plugins.parameters.types.IntegerParameterType.IntegerParameterValue in project constellation by constellation-app.

the class IntegerParameterTypeNGTest method testBuild_String.

/**
 * Test of build method, of class IntegerParameterType.
 */
@Test
public void testBuild_String() {
    System.out.println("build");
    String id = "integerParameter";
    PluginParameter result = IntegerParameterType.build(id);
    IntegerParameterValue expResult = new IntegerParameterValue();
    assertEquals(result.getId(), id);
    assertTrue(result.getType() instanceof IntegerParameterType);
    assertEquals(result.getParameterValue(), expResult);
}
Also used : IntegerParameterValue(au.gov.asd.tac.constellation.plugins.parameters.types.IntegerParameterType.IntegerParameterValue) PluginParameter(au.gov.asd.tac.constellation.plugins.parameters.PluginParameter) Test(org.testng.annotations.Test)

Aggregations

IntegerParameterValue (au.gov.asd.tac.constellation.plugins.parameters.types.IntegerParameterType.IntegerParameterValue)51 PluginParameters (au.gov.asd.tac.constellation.plugins.parameters.PluginParameters)44 BooleanParameterValue (au.gov.asd.tac.constellation.plugins.parameters.types.BooleanParameterType.BooleanParameterValue)27 SingleChoiceParameterValue (au.gov.asd.tac.constellation.plugins.parameters.types.SingleChoiceParameterType.SingleChoiceParameterValue)13 PluginParameter (au.gov.asd.tac.constellation.plugins.parameters.PluginParameter)11 FloatParameterValue (au.gov.asd.tac.constellation.plugins.parameters.types.FloatParameterType.FloatParameterValue)8 ArrayList (java.util.ArrayList)8 Test (org.testng.annotations.Test)8 MultiChoiceParameterValue (au.gov.asd.tac.constellation.plugins.parameters.types.MultiChoiceParameterType.MultiChoiceParameterValue)5 ObjectParameterValue (au.gov.asd.tac.constellation.plugins.parameters.types.ObjectParameterType.ObjectParameterValue)5 ParameterChange (au.gov.asd.tac.constellation.plugins.parameters.ParameterChange)4 Map (java.util.Map)4 StringParameterValue (au.gov.asd.tac.constellation.plugins.parameters.types.StringParameterValue)3 LinkedHashMap (java.util.LinkedHashMap)3 ColorParameterValue (au.gov.asd.tac.constellation.plugins.parameters.types.ColorParameterType.ColorParameterValue)2 LocalDateParameterValue (au.gov.asd.tac.constellation.plugins.parameters.types.LocalDateParameterType.LocalDateParameterValue)2 GraphElementType (au.gov.asd.tac.constellation.graph.GraphElementType)1 SchemaTransactionType (au.gov.asd.tac.constellation.graph.schema.type.SchemaTransactionType)1 SchemaVertexType (au.gov.asd.tac.constellation.graph.schema.type.SchemaVertexType)1 PluginParametersPane (au.gov.asd.tac.constellation.plugins.gui.PluginParametersPane)1