Examples of OMVRBTreeRIDSet


Examples of com.orientechnologies.orient.core.type.tree.OMVRBTreeRIDSet

      for (String fieldName : vertex.fieldNames()) {
        if (fieldName.startsWith(OrientVertex.CONNECTION_IN_PREFIX) || fieldName.startsWith(OrientVertex.CONNECTION_OUT_PREFIX)) {
          Object oldValue = vertex.field(fieldName);
          if (oldValue instanceof OMVRBTreeRIDSet) {
            OMVRBTreeRIDSet oldTree = (OMVRBTreeRIDSet) oldValue;
            ORidBag bag = new ORidBag();
            bag.addAll(oldTree);

            vertex.field(fieldName, bag);
          }
View Full Code Here

Examples of com.orientechnologies.orient.core.type.tree.OMVRBTreeRIDSet

      else if (((OMVRBTreeRIDSet) iFieldValue).size() == 0)
        iVertex.removeField(iFieldName);

    } else if (iFieldValue instanceof Collection<?>) {
      // CONVERT COLLECTION IN TREE-SET AND REMOVE THE EDGE
      final OMVRBTreeRIDSet out = new OMVRBTreeRIDSet(iVertex,
          (Collection<OIdentifiable>) iFieldValue);
      if (!out.remove(iEdge))
        OLogManager
            .instance()
            .warn(this,
                "Edge not found in vertex's property %s.%s collection while removing the edge %s",
                iVertex.getIdentity(), iFieldName,
View Full Code Here

Examples of com.orientechnologies.orient.core.type.tree.OMVRBTreeRIDSet

      if (found.equals(iTo))
        // SAME LINK, SKIP IT
        return found;

      // DOUBLE: SCALE UP THE LINK INTO A COLLECTION
      out = new OMVRBTreeRIDSet(iFromVertex);
      ((OMVRBTreeRIDSet) out).add((OIdentifiable) found);
      ((OMVRBTreeRIDSet) out).add(iTo);
    } else if (found instanceof OMVRBTreeRIDSet) {
      // ADD THE LINK TO THE COLLECTION
      out = null;
      ((OMVRBTreeRIDSet) found).add(iTo);
    } else if (found instanceof Collection<?>) {
      // CONVERT IT IN SET
      out = new OMVRBTreeRIDSet(((Collection<?>) found).size());
      ((OMVRBTreeRIDSet) out)
          .addAll((Collection<? extends OIdentifiable>) found);
      ((OMVRBTreeRIDSet) out).add(iTo);

    } else
View Full Code Here

Examples of com.orientechnologies.orient.core.type.tree.OMVRBTreeRIDSet

      deleteEdgeIfAny((OIdentifiable) fieldValue);

    } else if (fieldValue instanceof OMVRBTreeRIDSet) {
      // COLLECTION OF RECORDS: REMOVE THE ENTRY
      final OMVRBTreeRIDSet set = (OMVRBTreeRIDSet) fieldValue;

      if (iVertexToRemove != null) {
        if (!set.remove(iVertexToRemove)) {
          // SEARCH SEQUENTIALLY (SLOWER)
          boolean found = false;
          for (OLazyIterator<OIdentifiable> it = set
              .iterator(false); it.hasNext(); ) {
            final ODocument curr = it.next().getRecord();

            if (iVertexToRemove.equals(curr)) {
              // FOUND AS VERTEX
              it.remove();
              if (iAlsoInverse)
                removeInverseEdge(iVertex, iFieldName,
                    iVertexToRemove, curr,
                    useVertexFieldsForEdgeLabels);
              found = true;
              break;

            } else if (curr.getSchemaClass().isSubClassOf(
                OrientEdge.CLASS_NAME)) {
              // EDGE
              if (curr.getSchemaClass().isSubClassOf(
                  OrientEdge.CLASS_NAME)) {
                final Direction direction = getConnectionDirection(
                    iFieldName,
                    useVertexFieldsForEdgeLabels);

                // EDGE, REMOVE THE EDGE
                if (iVertexToRemove.equals(OrientEdge
                    .getConnection(curr,
                        direction.opposite()))) {
                  it.remove();
                  if (iAlsoInverse)
                    removeInverseEdge(iVertex,
                        iFieldName,
                        iVertexToRemove, curr,
                        useVertexFieldsForEdgeLabels);
                  found = true;
                  break;
                }
              }
            }
          }

          if (!found)
            OLogManager
                .instance()
                .warn(null,
                    "[OrientVertex.removeEdges] edge %s not found in field %s",
                    iVertexToRemove, iFieldName);
        }

        deleteEdgeIfAny(iVertexToRemove);

      } else {

        // DELETE ALL THE EDGES
        for (OLazyIterator<OIdentifiable> it = set.iterator(false); it
            .hasNext(); ) {
          final OIdentifiable edge = it.next();

          if (iAlsoInverse)
            removeInverseEdge(iVertex, iFieldName, null, edge,
                useVertexFieldsForEdgeLabels);

          deleteEdgeIfAny(edge);
        }
      }

      if (set.isEmpty())
        // FORCE REMOVAL OF ENTIRE FIELD
        iVertex.removeField(iFieldName);
    }

    iVertex.save();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.