Class PropertyEdge<T extends Node>

  • All Implemented Interfaces:
    Persistable

    public class PropertyEdge<T extends Node>
    extends java.lang.Object
    implements Persistable
    • Field Detail

      • log

        protected static final org.slf4j.Logger log
    • Constructor Detail

      • PropertyEdge

        public PropertyEdge​(Node start,
                            T end)
      • PropertyEdge

        public PropertyEdge​(PropertyEdge<T> propertyEdge)
      • PropertyEdge

        public PropertyEdge​(Node start,
                            T end,
                            java.util.Map<Properties,​java.lang.Object> properties)
    • Method Detail

      • findPropertyEdgesByPredicate

        public static <S extends PropertyEdge<?>> java.util.List<S> findPropertyEdgesByPredicate​(java.util.Collection<S> edges,
                                                                                                 java.util.function.Predicate<S> predicate)
      • getProperty

        public java.lang.Object getProperty​(Properties property)
      • addProperty

        public void addProperty​(Properties property,
                                java.lang.Object value)
        Adds a property to a PropertyEdge If the object is not a built-in type you must provide a serializer and deserializer in the PropertyEdgeConverter
        Parameters:
        property - String containing the name of the property
        value - Object containing the value of the property
      • addProperties

        public void addProperties​(java.util.Map<Properties,​java.lang.Object> propertyMap)
      • getEnd

        public T getEnd()
      • getStart

        public Node getStart()
      • setEnd

        public void setEnd​(T end)
      • setStart

        public void setStart​(Node start)
      • applyIndexProperty

        public static <T extends Node> java.util.List<PropertyEdge<T>> applyIndexProperty​(java.util.List<PropertyEdge<T>> propertyEdges)
        Add/Update index element of list of PropertyEdges
        Parameters:
        propertyEdges - propertyEdge list
        Returns:
        new PropertyEdge list with updated index property
      • transformIntoOutgoingPropertyEdgeList

        public static <T extends Node> java.util.List<PropertyEdge<T>> transformIntoOutgoingPropertyEdgeList​(java.util.List<T> nodes,
                                                                                                             Node commonRelationshipNode)
        Transforms a List of Nodes into targets of PropertyEdges. Include Index Property as Lists are indexed
        Parameters:
        nodes - List of nodes that should be transformed into PropertyEdges
        commonRelationshipNode - node where all the Edges should start
        Returns:
        List of PropertyEdges with the targets of the nodes and index property.
      • transformIntoIncomingPropertyEdgeList

        public static <T extends Node> java.util.List<PropertyEdge<T>> transformIntoIncomingPropertyEdgeList​(java.util.List<? extends Node> nodes,
                                                                                                             T commonRelationshipNode)
        Transforms a List of Nodes into sources of PropertyEdges. Include Index Property as Lists are indexed
        Parameters:
        nodes - List of nodes that should be transformed into PropertyEdges
        commonRelationshipNode - node where all the Edges should end.
        Returns:
        List of PropertyEdges with the nodes as sources and index property.
      • unwrap

        public static <T extends Node> java.util.List<T> unwrap​(@NonNull java.util.List<PropertyEdge<T>> collection)
        Unwraps this outgoing property edge into a list of its target nodes.
        Type Parameters:
        T - the type of the edges
        Parameters:
        collection - the collection of edges
        Returns:
        the list of target nodes
      • unwrap

        public static <T extends Node> java.util.List<T> unwrap​(@NonNull java.util.List<PropertyEdge<T>> collection,
                                                                boolean outgoing)
        Unwraps this property edge into a list of its target nodes.
        Type Parameters:
        T - the type of the edges
        Parameters:
        collection - the collection of edges
        outgoing - whether it is outgoing or not
        Returns:
        the list of target nodes
      • unwrapPropertyEdge

        public static java.lang.Object unwrapPropertyEdge​(java.lang.Object obj,
                                                          boolean outgoing)
        Parameters:
        obj - PropertyEdge or collection of property edges that must be unwrapped
        outgoing - direction of the edge
        Returns:
        node or collection representing target of edge
      • checkForPropertyEdge

        public static boolean checkForPropertyEdge​(java.lang.reflect.Field f,
                                                   java.lang.Object obj)
        Checks if an Object is a PropertyEdge or a collection of PropertyEdges
        Parameters:
        f - Field containing the object
        obj - object that is checked if it is a PropertyEdge
        Returns:
        true if obj is/contains a PropertyEdge
      • getTarget

        public static <T extends Node> java.util.List<T> getTarget​(java.util.List<PropertyEdge<T>> propertyEdges)
        Parameters:
        propertyEdges - List of PropertyEdges
        Returns:
        List of nodes corresponding to the targets of the edges
      • getSource

        public static <T extends Node> java.util.List<Node> getSource​(java.util.List<PropertyEdge<T>> propertyEdges)
        Parameters:
        propertyEdges - List of PropertyEdges
        Returns:
        List of nodes corresponding to the targets of the edges
      • removeElementFromList

        public static <T extends Node> java.util.List<PropertyEdge<T>> removeElementFromList​(java.util.List<PropertyEdge<T>> propertyEdges,
                                                                                             T element,
                                                                                             boolean end)
      • equals

        public boolean equals​(java.lang.Object obj)
        Note that the start and end node cannot be checked for equality here, as it would create an endless loop. Check of start and end node must be done separately.
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object