use of au.gov.asd.tac.constellation.plugins.parameters.PluginParameters in project constellation by constellation-app.
the class MultiplexityPluginNGTest method testMultiplexity.
@Test
public void testMultiplexity() throws Exception {
final MultiplexityPlugin instance = new MultiplexityPlugin();
final PluginParameters parameters = instance.createParameters();
parameters.setBooleanValue(MultiplexityPlugin.GROUP_BY_TOP_LEVEL_TYPE, false);
parameters.setBooleanValue(MultiplexityPlugin.NORMALISE_AVAILABLE_PARAMETER_ID, false);
PluginExecution.withPlugin(instance).withParameters(parameters).executeNow(graph);
assertEquals(graph.getFloatValue(transactionMultiplexityAttribute, txId0), 1.0f);
assertEquals(graph.getFloatValue(transactionMultiplexityAttribute, txId1), 2.0f);
assertEquals(graph.getFloatValue(transactionMultiplexityAttribute, txId2), 3.0f);
assertEquals(graph.getFloatValue(transactionMultiplexityAttribute, txId3), 3.0f);
assertEquals(graph.getFloatValue(transactionMultiplexityAttribute, txId4), 2.0f);
assertEquals(graph.getFloatValue(transactionMultiplexityAttribute, txId5), 1.0f);
assertEquals(graph.getFloatValue(transactionMultiplexityAttribute, txId6), 2.0f);
assertEquals(graph.getFloatValue(transactionMultiplexityAttribute, txId7), 3.0f);
assertEquals(graph.getFloatValue(transactionMultiplexityAttribute, txId8), 3.0f);
assertEquals(graph.getFloatValue(transactionMultiplexityAttribute, txId9), 2.0f);
assertEquals(graph.getFloatValue(transactionMultiplexityAttribute, txId10), 1.0f);
assertEquals(graph.getFloatValue(transactionMultiplexityAttribute, txId11), 2.0f);
assertEquals(graph.getFloatValue(transactionMultiplexityAttribute, txId12), 3.0f);
assertEquals(graph.getFloatValue(transactionMultiplexityAttribute, txId13), 3.0f);
}
use of au.gov.asd.tac.constellation.plugins.parameters.PluginParameters in project constellation by constellation-app.
the class RatioOfReciprocityPluginNGTest method testRatioOfReciprocity.
@Test
public void testRatioOfReciprocity() throws Exception {
final RatioOfReciprocityPlugin instance = new RatioOfReciprocityPlugin();
final PluginParameters parameters = instance.createParameters();
parameters.setBooleanValue(RatioOfReciprocityPlugin.TREAT_UNDIRECTED_BIDIRECTIONAL_PARAMETER_ID, true);
parameters.setBooleanValue(RatioOfReciprocityPlugin.NORMALISE_AVAILABLE_PARAMETER_ID, false);
PluginExecution.withPlugin(instance).withParameters(parameters).executeNow(graph);
assertEquals(graph.getFloatValue(transactionReciprocityAttribute, txId0), 0f);
assertEquals(graph.getFloatValue(transactionReciprocityAttribute, txId1), 0.5f);
assertEquals(graph.getFloatValue(transactionReciprocityAttribute, txId2), 0.33333334f);
assertEquals(graph.getFloatValue(transactionReciprocityAttribute, txId3), 0.25f);
assertEquals(graph.getFloatValue(transactionReciprocityAttribute, txId4), 0f);
assertEquals(graph.getFloatValue(transactionReciprocityAttribute, txId5), 0.5f);
assertEquals(graph.getFloatValue(transactionReciprocityAttribute, txId6), 0.5f);
assertEquals(graph.getFloatValue(transactionReciprocityAttribute, txId7), 0.33333334f);
assertEquals(graph.getFloatValue(transactionReciprocityAttribute, txId8), 0.33333334f);
assertEquals(graph.getFloatValue(transactionReciprocityAttribute, txId9), 0.33333334f);
assertEquals(graph.getFloatValue(transactionReciprocityAttribute, txId10), 0.25f);
assertEquals(graph.getFloatValue(transactionReciprocityAttribute, txId11), 0.25f);
assertEquals(graph.getFloatValue(transactionReciprocityAttribute, txId12), 0.25f);
assertEquals(graph.getFloatValue(transactionReciprocityAttribute, txId13), 0.25f);
}
use of au.gov.asd.tac.constellation.plugins.parameters.PluginParameters in project constellation by constellation-app.
the class WeightActionNGTest method testRatioOfReciprocity.
@Test
public void testRatioOfReciprocity() throws Exception {
final WeightPlugin instance = new WeightPlugin();
final PluginParameters parameters = instance.createParameters();
parameters.setBooleanValue(WeightPlugin.NORMALISE_AVAILABLE_PARAMETER_ID, false);
PluginExecution.withPlugin(instance).withParameters(parameters).executeNow(graph);
assertEquals(graph.getFloatValue(transactionWeightAttribute, txId0), 1.0f);
assertEquals(graph.getFloatValue(transactionWeightAttribute, txId1), 2.0f);
assertEquals(graph.getFloatValue(transactionWeightAttribute, txId2), 3.0f);
assertEquals(graph.getFloatValue(transactionWeightAttribute, txId3), 4.0f);
assertEquals(graph.getFloatValue(transactionWeightAttribute, txId4), 4.0f);
assertEquals(graph.getFloatValue(transactionWeightAttribute, txId5), 2.0f);
assertEquals(graph.getFloatValue(transactionWeightAttribute, txId6), 3.0f);
assertEquals(graph.getFloatValue(transactionWeightAttribute, txId7), 3.0f);
assertEquals(graph.getFloatValue(transactionWeightAttribute, txId8), 4.0f);
assertEquals(graph.getFloatValue(transactionWeightAttribute, txId9), 4.0f);
assertEquals(graph.getFloatValue(transactionWeightAttribute, txId10), 4.0f);
assertEquals(graph.getFloatValue(transactionWeightAttribute, txId11), 4.0f);
assertEquals(graph.getFloatValue(transactionWeightAttribute, txId12), 4.0f);
assertEquals(graph.getFloatValue(transactionWeightAttribute, txId13), 4.0f);
}
use of au.gov.asd.tac.constellation.plugins.parameters.PluginParameters in project constellation by constellation-app.
the class CosineSimilarityPluginNGTest method testUndirectedCosine.
@Test
public void testUndirectedCosine() throws Exception {
final CosineSimilarityPlugin instance = new CosineSimilarityPlugin();
final PluginParameters parameters = instance.createParameters();
parameters.setBooleanValue(CosineSimilarityPlugin.INCLUDE_CONNECTIONS_IN_PARAMETER_ID, true);
parameters.setBooleanValue(CosineSimilarityPlugin.INCLUDE_CONNECTIONS_OUT_PARAMETER_ID, true);
parameters.setBooleanValue(CosineSimilarityPlugin.TREAT_UNDIRECTED_BIDIRECTIONAL_PARAMETER_ID, true);
parameters.setIntegerValue(CosineSimilarityPlugin.MINIMUM_COMMON_FEATURES_PARAMETER_ID, 1);
parameters.setBooleanValue(CosineSimilarityPlugin.SELECTED_ONLY_PARAMETER_ID, false);
PluginExecution.withPlugin(instance).withParameters(parameters).executeNow(graph);
int transactionCount = graph.getTransactionCount();
for (int transactionId = 0; transactionId < transactionCount; transactionId++) {
int transaction = graph.getTransaction(transactionId);
String identifier = graph.getStringValue(transactionIdentifier, transactionId);
if ("2 == similarity == 4".equals(identifier)) {
assertEquals(graph.getFloatValue(transactionCosineAttribute, transactionId), 0.70710677f);
}
if ("2 == similarity == 3".equals(identifier)) {
assertEquals(graph.getFloatValue(transactionCosineAttribute, transactionId), 0.4082483f);
}
if ("1 == similarity == 3".equals(identifier)) {
assertEquals(graph.getFloatValue(transactionCosineAttribute, transactionId), 0.33333334f);
}
}
}
use of au.gov.asd.tac.constellation.plugins.parameters.PluginParameters in project constellation by constellation-app.
the class DiceSimilarityPluginNGTest method testUndirectedDice.
@Test
public void testUndirectedDice() throws Exception {
final DiceSimilarityPlugin instance = new DiceSimilarityPlugin();
final PluginParameters parameters = instance.createParameters();
parameters.setBooleanValue(DiceSimilarityPlugin.INCLUDE_CONNECTIONS_IN_PARAMETER_ID, true);
parameters.setBooleanValue(DiceSimilarityPlugin.INCLUDE_CONNECTIONS_OUT_PARAMETER_ID, true);
parameters.setBooleanValue(DiceSimilarityPlugin.TREAT_UNDIRECTED_BIDIRECTIONAL_PARAMETER_ID, true);
parameters.setIntegerValue(DiceSimilarityPlugin.MINIMUM_COMMON_FEATURES_PARAMETER_ID, 1);
parameters.setBooleanValue(DiceSimilarityPlugin.SELECTED_ONLY_PARAMETER_ID, false);
PluginExecution.withPlugin(instance).withParameters(parameters).executeNow(graph);
int transactionCount = graph.getTransactionCount();
for (int transactionId = 0; transactionId < transactionCount; transactionId++) {
int transaction = graph.getTransaction(transactionId);
String identifier = graph.getStringValue(transactionIdentifier, transactionId);
if ("0 == similarity == 2".equals(identifier)) {
assertEquals(graph.getFloatValue(transactionDiceAttribute, transactionId), 0.66666667f);
}
if ("2 == similarity == 4".equals(identifier)) {
assertEquals(graph.getFloatValue(transactionDiceAttribute, transactionId), 0.66666667f);
}
if ("0 == similarity == 3".equals(identifier)) {
assertEquals(graph.getFloatValue(transactionDiceAttribute, transactionId), 0.5f);
}
if ("1 == similarity == 4".equals(identifier)) {
assertEquals(graph.getFloatValue(transactionDiceAttribute, transactionId), 0.5f);
}
if ("1 == similarity == 2".equals(identifier)) {
assertEquals(graph.getFloatValue(transactionDiceAttribute, transactionId), 0.4f);
}
if ("2 == similarity == 3".equals(identifier)) {
assertEquals(graph.getFloatValue(transactionDiceAttribute, transactionId), 0.4f);
}
if ("1 == similarity == 3".equals(identifier)) {
assertEquals(graph.getFloatValue(transactionDiceAttribute, transactionId), 0.33333334f);
}
}
}
Aggregations