Search in sources :

Example 46 with IntegerParameterValue

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

the class IntegerParameterTypeNGTest method testSetShrinkInputWidth.

/**
 * Test of setShrinkInputWidth method, of class IntegerParameterType.
 */
@Test
public void testSetShrinkInputWidth() {
    System.out.println("setShrinkInputWidth");
    String id = "Shrink";
    PluginParameter<IntegerParameterType.IntegerParameterValue> parameter = new PluginParameter<>(new IntegerParameterValue(), INSTANCE, id);
    // Check setting shrink to false
    boolean expected = false;
    IntegerParameterType.setShrinkInputWidth(parameter, false);
    assertEquals(parameter.getProperty(SHRINK_VAL), expected);
    // Check setting shrink to the same value that it already is
    expected = false;
    IntegerParameterType.setShrinkInputWidth(parameter, expected);
    assertEquals(parameter.getProperty(SHRINK_VAL), expected);
    // Check setting shrink to true
    expected = true;
    IntegerParameterType.setShrinkInputWidth(parameter, expected);
    assertEquals(parameter.getProperty(SHRINK_VAL), expected);
}
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 47 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_IntegerParameterTypeIntegerParameterValue.

/**
 * Test of build method, of class IntegerParameterType.
 */
@Test
public void testBuild_String_IntegerParameterTypeIntegerParameterValue() {
    System.out.println("build");
    IntegerParameterValue instance = new IntegerParameterValue(2);
    int instanceValue = instance.get();
    int expResult = 2;
    assertEquals(instanceValue, expResult);
    instance = new IntegerParameterValue(-5);
    instanceValue = instance.get();
    expResult = -5;
    assertEquals(instanceValue, expResult);
    instance = new IntegerParameterValue();
    instanceValue = instance.get();
    expResult = 0;
    assertEquals(instanceValue, expResult);
}
Also used : IntegerParameterValue(au.gov.asd.tac.constellation.plugins.parameters.types.IntegerParameterType.IntegerParameterValue) Test(org.testng.annotations.Test)

Example 48 with IntegerParameterValue

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

the class IntegerParameterTypeNGTest method testSetMaximum.

/**
 * Test of setMaximum method, of class IntegerParameterType.
 */
@Test
public void testSetMaximum() {
    System.out.println("setMaximum");
    String id = "Maxiumum";
    PluginParameter<IntegerParameterType.IntegerParameterValue> parameter = new PluginParameter<>(new IntegerParameterValue(), INSTANCE, id);
    int max = 0;
    IntegerParameterType.setMaximum(parameter, max);
    assertEquals(parameter.getParameterValue().getMaximumValue(), max);
    max = -5;
    IntegerParameterType.setMaximum(parameter, max);
    assertEquals(parameter.getParameterValue().getMaximumValue(), max);
    max = 64;
    IntegerParameterType.setMaximum(parameter, max);
    assertEquals(parameter.getParameterValue().getMaximumValue(), max);
}
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 49 with IntegerParameterValue

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

the class SleepReadPlugin method createParameters.

@Override
public PluginParameters createParameters() {
    final PluginParameters params = new PluginParameters();
    final PluginParameter<IntegerParameterValue> secondsParam = IntegerParameterType.build(SECONDS_PARAMETER_ID);
    secondsParam.setName("Seconds to sleep");
    secondsParam.setDescription("The number of seconds to sleep on the graph");
    secondsParam.setIntegerValue(10);
    IntegerParameterType.setMinimum(secondsParam, 0);
    params.addParameter(secondsParam);
    return params;
}
Also used : IntegerParameterValue(au.gov.asd.tac.constellation.plugins.parameters.types.IntegerParameterType.IntegerParameterValue) PluginParameters(au.gov.asd.tac.constellation.plugins.parameters.PluginParameters)

Example 50 with IntegerParameterValue

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

the class PreferentialAttachmentGraphBuilderPlugin method createParameters.

@Override
public PluginParameters createParameters() {
    final PluginParameters params = new PluginParameters();
    final PluginParameter<IntegerParameterValue> n = IntegerParameterType.build(N_PARAMETER_ID);
    n.setName("Number of nodes");
    n.setDescription("The number of nodes on the graph");
    n.setIntegerValue(10);
    IntegerParameterType.setMinimum(n, 0);
    params.addParameter(n);
    final PluginParameter<IntegerParameterValue> m = IntegerParameterType.build(M_PARAMETER_ID);
    m.setName("Number of edges to attach");
    m.setDescription("The number of edges to attach to each node");
    m.setIntegerValue(1);
    IntegerParameterType.setMinimum(m, 0);
    params.addParameter(m);
    final PluginParameter<BooleanParameterValue> randomWeights = BooleanParameterType.build(RANDOM_WEIGHTS_PARAMETER_ID);
    randomWeights.setName("Random edge weight/direction");
    randomWeights.setDescription("Edges have a random number of transactions going in random directions");
    randomWeights.setBooleanValue(true);
    params.addParameter(randomWeights);
    final PluginParameter<MultiChoiceParameterValue> nodeTypes = MultiChoiceParameterType.build(NODE_TYPES_PARAMETER_ID);
    nodeTypes.setName("Node Types");
    nodeTypes.setDescription("Node types to add to the graph");
    params.addParameter(nodeTypes);
    final PluginParameter<MultiChoiceParameterValue> transactionTypes = MultiChoiceParameterType.build(TRANSACTION_TYPES_PARAMETER_ID);
    transactionTypes.setName("Transaction Types");
    transactionTypes.setDescription("Transaction types to add to the graph");
    params.addParameter(transactionTypes);
    return params;
}
Also used : BooleanParameterValue(au.gov.asd.tac.constellation.plugins.parameters.types.BooleanParameterType.BooleanParameterValue) IntegerParameterValue(au.gov.asd.tac.constellation.plugins.parameters.types.IntegerParameterType.IntegerParameterValue) MultiChoiceParameterValue(au.gov.asd.tac.constellation.plugins.parameters.types.MultiChoiceParameterType.MultiChoiceParameterValue) PluginParameters(au.gov.asd.tac.constellation.plugins.parameters.PluginParameters)

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