Search in sources :

Example 81 with GraphElementType

use of au.gov.asd.tac.constellation.graph.GraphElementType in project constellation by constellation-app.

the class ChangeSelectionPlugin method edit.

@Override
protected void edit(final GraphWriteMethods graph, final PluginInteraction interaction, final PluginParameters parameters) throws InterruptedException, PluginException {
    final BitSet elementBitSet = (BitSet) parameters.getParameters().get(ELEMENT_BIT_SET_PARAMETER_ID).getObjectValue();
    final GraphElementType elementType = (GraphElementType) ((ElementTypeParameterValue) parameters.getSingleChoice(ELEMENT_TYPE_PARAMETER_ID)).getObjectValue();
    final SelectionMode selectionMode = (SelectionMode) parameters.getParameters().get(SELECTION_MODE_PARAMETER_ID).getObjectValue();
    final int selectedAttribute = graph.getAttribute(elementType, "selected");
    if (selectedAttribute == Graph.NOT_FOUND) {
        return;
    }
    final int elementCount = elementType.getElementCount(graph);
    for (int elementPosition = 0; elementPosition < elementCount; elementPosition++) {
        final int elementId = elementType.getElement(graph, elementPosition);
        final boolean currentlySelected = graph.getBooleanValue(selectedAttribute, elementId);
        final boolean newSelected = elementBitSet.get(elementId);
        graph.setBooleanValue(selectedAttribute, elementId, selectionMode.calculateSelection(currentlySelected, newSelected));
    }
}
Also used : BitSet(java.util.BitSet) GraphElementType(au.gov.asd.tac.constellation.graph.GraphElementType)

Example 82 with GraphElementType

use of au.gov.asd.tac.constellation.graph.GraphElementType in project constellation by constellation-app.

the class ElementTypeParameterValue method setObjectValue.

@Override
public boolean setObjectValue(final Object o) {
    if (o instanceof GraphElementType) {
        final GraphElementType type = (GraphElementType) o;
        final boolean equal = Objects.equals(type, elementType);
        if (!equal) {
            elementType = type;
        }
        return equal;
    }
    return false;
}
Also used : GraphElementType(au.gov.asd.tac.constellation.graph.GraphElementType)

Example 83 with GraphElementType

use of au.gov.asd.tac.constellation.graph.GraphElementType in project constellation by constellation-app.

the class ElementTypeParameterValue method setStringValue.

@Override
public boolean setStringValue(final String s) {
    final GraphElementType stringElementType = GraphElementType.getValue(s);
    final boolean equal = Objects.equals(stringElementType, elementType);
    if (!equal) {
        elementType = stringElementType;
    }
    return equal;
}
Also used : GraphElementType(au.gov.asd.tac.constellation.graph.GraphElementType)

Example 84 with GraphElementType

use of au.gov.asd.tac.constellation.graph.GraphElementType in project constellation by constellation-app.

the class AttributeFillBuilder method fillAttribute.

public static AttributeFillBuilder fillAttribute(final GraphWriteMethods graph, final int attrID, final Object lower, final Object upper) {
    final GraphElementType elementType = graph.getAttributeElementType(attrID);
    final int[] elementsToFill = elementType == GraphElementType.VERTEX ? new int[graph.getVertexCount()] : new int[graph.getTransactionCount()];
    for (int i = 0; i < elementsToFill.length; i++) {
        elementsToFill[i] = elementType == GraphElementType.VERTEX ? graph.getVertex(i) : graph.getTransaction(i);
    }
    return fillAttribute(graph, attrID, elementsToFill, lower, upper);
}
Also used : GraphElementType(au.gov.asd.tac.constellation.graph.GraphElementType)

Example 85 with GraphElementType

use of au.gov.asd.tac.constellation.graph.GraphElementType in project constellation by constellation-app.

the class AttributeFillBuilder method fillAttribute.

public static AttributeFillBuilder fillAttribute(final GraphWriteMethods graph, final int attrID, final List<Object> options, final boolean sequential) {
    final GraphElementType elementType = graph.getAttributeElementType(attrID);
    final int[] elementsToFill = elementType == GraphElementType.VERTEX ? new int[graph.getVertexCount()] : new int[graph.getTransactionCount()];
    for (int i = 0; i < elementsToFill.length; i++) {
        elementsToFill[i] = elementType == GraphElementType.VERTEX ? graph.getVertex(i) : graph.getTransaction(i);
    }
    return fillAttribute(graph, attrID, elementsToFill, options, sequential);
}
Also used : GraphElementType(au.gov.asd.tac.constellation.graph.GraphElementType)

Aggregations

GraphElementType (au.gov.asd.tac.constellation.graph.GraphElementType)85 Test (org.testng.annotations.Test)34 ArrayList (java.util.ArrayList)28 GraphAttribute (au.gov.asd.tac.constellation.graph.GraphAttribute)17 Attribute (au.gov.asd.tac.constellation.graph.Attribute)16 ReadableGraph (au.gov.asd.tac.constellation.graph.ReadableGraph)12 HashMap (java.util.HashMap)11 AdvancedFindTab (au.gov.asd.tac.constellation.views.find2.components.AdvancedFindTab)10 FindCriteriaValues (au.gov.asd.tac.constellation.views.find2.components.advanced.criteriavalues.FindCriteriaValues)9 GraphManager (au.gov.asd.tac.constellation.graph.manager.GraphManager)8 PluginParameters (au.gov.asd.tac.constellation.plugins.parameters.PluginParameters)8 Graph (au.gov.asd.tac.constellation.graph.Graph)7 StoreGraph (au.gov.asd.tac.constellation.graph.StoreGraph)5 SchemaAttribute (au.gov.asd.tac.constellation.graph.schema.attribute.SchemaAttribute)5 PluginInteraction (au.gov.asd.tac.constellation.plugins.PluginInteraction)5 PluginParameter (au.gov.asd.tac.constellation.plugins.parameters.PluginParameter)5 FindViewController (au.gov.asd.tac.constellation.views.find2.FindViewController)5 AdvancedCriteriaBorderPane (au.gov.asd.tac.constellation.views.find2.components.advanced.AdvancedCriteriaBorderPane)5 BasicFindReplaceParameters (au.gov.asd.tac.constellation.views.find2.utilities.BasicFindReplaceParameters)5 List (java.util.List)5