Search in sources :

Example 61 with BooleanParameterValue

use of au.gov.asd.tac.constellation.plugins.parameters.types.BooleanParameterType.BooleanParameterValue 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 62 with BooleanParameterValue

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

the class BooleanParameterTypeNGTest method testGetSet.

@Test
public void testGetSet() {
    BooleanParameterValue instance = new BooleanParameterValue();
    boolean expected = instance.get();
    assertEquals(instance.get(), expected);
    expected = true;
    instance.set(expected);
    assertEquals(instance.get(), expected);
    // Return true when value is different
    expected = false;
    assertTrue(instance.set(expected));
    assertEquals(instance.get(), expected);
    // Return false when value is set the same
    expected = false;
    assertFalse(instance.set(expected));
    assertEquals(instance.get(), expected);
}
Also used : BooleanParameterValue(au.gov.asd.tac.constellation.plugins.parameters.types.BooleanParameterType.BooleanParameterValue) Test(org.testng.annotations.Test)

Example 63 with BooleanParameterValue

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

the class BooleanParameterTypeNGTest method testSetObjectValueException.

/**
 * Test that parsing a wrong type throws an exception
 */
@Test(expectedExceptions = { IllegalArgumentException.class })
public void testSetObjectValueException() {
    // Ensure initial setup is correct
    BooleanParameterValue instance = new BooleanParameterValue();
    instance.set(true);
    assertTrue(instance.get());
    assertFalse(instance.setObjectValue(1));
}
Also used : BooleanParameterValue(au.gov.asd.tac.constellation.plugins.parameters.types.BooleanParameterType.BooleanParameterValue) Test(org.testng.annotations.Test)

Example 64 with BooleanParameterValue

use of au.gov.asd.tac.constellation.plugins.parameters.types.BooleanParameterType.BooleanParameterValue 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)

Example 65 with BooleanParameterValue

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

the class TestParameterBuildingPlugin method createParameters.

@Override
public PluginParameters createParameters() {
    final PluginParameters params = new PluginParameters();
    final PluginParameter<SingleChoiceParameterValue> fupChoiceParam = SingleChoiceParameterType.build(CHOICE_PARAMETER_ID);
    fupChoiceParam.setName(SOME_CHOICE_NAME);
    fupChoiceParam.setDescription(SOME_CHOICE_DESCRIPTION);
    SingleChoiceParameterType.setOptions(fupChoiceParam, Arrays.asList("Choice 1", "Choice 2", "Choice 3"));
    SingleChoiceParameterType.setChoice(fupChoiceParam, "Choice 1");
    params.addParameter(fupChoiceParam);
    final PluginParameter<LocalDateParameterValue> ldParam = LocalDateParameterType.build(LOCALDATE_PARAMETER_ID);
    ldParam.setName("Date");
    ldParam.setDescription("Pick a day");
    params.addParameter(ldParam);
    final PluginParameter<IntegerParameterValue> lenParam = IntegerParameterType.build(INT_PARAMETER_ID);
    lenParam.setName(SOME_INT_NAME);
    lenParam.setDescription(SOME_INT_DESCRIPTION);
    lenParam.setIntegerValue(5);
    params.addParameter(lenParam);
    final PluginParameter<FloatParameterValue> thresholdParam = FloatParameterType.build(FLOAT_PARAMETER_ID);
    thresholdParam.setName(FLOAT_NAME);
    thresholdParam.setDescription(FLOAT_DESCRIPTION);
    thresholdParam.setFloatValue(0F);
    FloatParameterType.setMinimum(thresholdParam, 0);
    FloatParameterType.setMaximum(thresholdParam, 1);
    FloatParameterType.setStep(thresholdParam, 0.1F);
    params.addParameter(thresholdParam);
    final PluginParameter<BooleanParameterValue> caseParam = BooleanParameterType.build(BOOLEAN_PARAMETER_ID);
    caseParam.setName(SOME_BOOLEAN_NAME);
    caseParam.setDescription(SOME_BOOLEAN_DESCRIPTION);
    params.addParameter(caseParam);
    for (int i = 0; i < 2; i++) {
        final PluginParameter<StringParameterValue> text = StringParameterType.build("text" + i);
        text.setName("Some text " + i);
        text.setDescription("Type some text into this thing");
        text.setStringValue("Value " + i);
        params.addParameter(text);
    }
    return params;
}
Also used : LocalDateParameterValue(au.gov.asd.tac.constellation.plugins.parameters.types.LocalDateParameterType.LocalDateParameterValue) FloatParameterValue(au.gov.asd.tac.constellation.plugins.parameters.types.FloatParameterType.FloatParameterValue) StringParameterValue(au.gov.asd.tac.constellation.plugins.parameters.types.StringParameterValue) 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)

Aggregations

BooleanParameterValue (au.gov.asd.tac.constellation.plugins.parameters.types.BooleanParameterType.BooleanParameterValue)65 PluginParameters (au.gov.asd.tac.constellation.plugins.parameters.PluginParameters)56 IntegerParameterValue (au.gov.asd.tac.constellation.plugins.parameters.types.IntegerParameterType.IntegerParameterValue)27 SingleChoiceParameterValue (au.gov.asd.tac.constellation.plugins.parameters.types.SingleChoiceParameterType.SingleChoiceParameterValue)14 StringParameterValue (au.gov.asd.tac.constellation.plugins.parameters.types.StringParameterValue)13 Test (org.testng.annotations.Test)11 FloatParameterValue (au.gov.asd.tac.constellation.plugins.parameters.types.FloatParameterType.FloatParameterValue)9 PluginParameter (au.gov.asd.tac.constellation.plugins.parameters.PluginParameter)7 ArrayList (java.util.ArrayList)7 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 ColorParameterValue (au.gov.asd.tac.constellation.plugins.parameters.types.ColorParameterType.ColorParameterValue)3 FileParameterValue (au.gov.asd.tac.constellation.plugins.parameters.types.FileParameterType.FileParameterValue)3 Graph (au.gov.asd.tac.constellation.graph.Graph)2 GraphElementType (au.gov.asd.tac.constellation.graph.GraphElementType)2 ParameterValue (au.gov.asd.tac.constellation.plugins.parameters.types.ParameterValue)2 ConstellationColor (au.gov.asd.tac.constellation.utilities.color.ConstellationColor)2 GraphAttribute (au.gov.asd.tac.constellation.graph.GraphAttribute)1