@Beta @Immutable public final class ElementOrder<T> extends java.lang.Object
Example usage:
MutableGraph<Integer> graph =
GraphBuilder.directed().nodeOrder(ElementOrder.<Integer>natural()).build();
Modifier and Type | Class and Description |
---|---|
static class |
ElementOrder.Type
The type of ordering that this object specifies.
|
Modifier and Type | Method and Description |
---|---|
java.util.Comparator<T> |
comparator()
Returns the
Comparator used. |
boolean |
equals(@Nullable java.lang.Object obj) |
int |
hashCode() |
static <S> ElementOrder<S> |
insertion()
Returns an instance which specifies that insertion ordering is guaranteed.
|
static <S extends java.lang.Comparable<? super S>> |
natural()
Returns an instance which specifies that the natural ordering of the elements is guaranteed.
|
static <S> ElementOrder<S> |
sorted(java.util.Comparator<S> comparator)
Returns an instance which specifies that the ordering of the elements is guaranteed to be
determined by
comparator . |
static <S> ElementOrder<S> |
stable()
Returns an instance which specifies that ordering is guaranteed to be always be the same across
iterations, and across releases.
|
java.lang.String |
toString() |
ElementOrder.Type |
type()
Returns the type of ordering used.
|
static <S> ElementOrder<S> |
unordered()
Returns an instance which specifies that no ordering is guaranteed.
|
public static <S> ElementOrder<S> unordered()
public static <S> ElementOrder<S> stable()
This instance is only useful in combination with incidentEdgeOrder
, e.g. graphBuilder.incidentEdgeOrder(ElementOrder.stable())
.
incidentEdgeOrder
incidentEdgeOrder(ElementOrder.stable())
guarantees the ordering of the returned
collections of the following methods:
Graph
and ValueGraph
:
edges()
: Stable order
adjacentNodes(node)
: Connecting edge insertion order
predecessors(node)
: Connecting edge insertion order
successors(node)
: Connecting edge insertion order
incidentEdges(node)
: Edge insertion order
Network
:
adjacentNodes(node)
: Stable order
predecessors(node)
: Connecting edge insertion order
successors(node)
: Connecting edge insertion order
incidentEdges(node)
: Stable order
inEdges(node)
: Edge insertion order
outEdges(node)
: Edge insertion order
adjacentEdges(edge)
: Stable order
edgesConnecting(nodeU, nodeV)
: Edge insertion order
public static <S> ElementOrder<S> insertion()
public static <S extends java.lang.Comparable<? super S>> ElementOrder<S> natural()
public static <S> ElementOrder<S> sorted(java.util.Comparator<S> comparator)
comparator
.public ElementOrder.Type type()
public java.util.Comparator<T> comparator()
Comparator
used.java.lang.UnsupportedOperationException
- if comparator is not definedpublic boolean equals(@Nullable java.lang.Object obj)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object
Copyright © 2010–2021 JBoss by Red Hat. All rights reserved.