Package com.google.common.graph
Class ImmutableValueGraph<N,V>
- java.lang.Object
-
- com.google.common.graph.AbstractGraph<N>
-
- com.google.common.graph.ForwardingGraph<N>
-
- com.google.common.graph.ImmutableGraph<N>
-
- com.google.common.graph.ImmutableGraph.ValueBackedImpl<N,V>
-
- com.google.common.graph.ImmutableValueGraph<N,V>
-
- Type Parameters:
N- Node parameter typeV- Value parameter type
- All Implemented Interfaces:
Graph<N>,ValueGraph<N,V>
@Beta public final class ImmutableValueGraph<N,V> extends ImmutableGraph.ValueBackedImpl<N,V> implements ValueGraph<N,V>
AValueGraphwhose elements and structural relationships will never change. Instances of this class may be obtained withcopyOf(ValueGraph).See the Guava User's Guide's discussion of the
Immutable*types for more information on the properties and guarantees provided by this class.- Since:
- 20.0
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.google.common.graph.ImmutableGraph
ImmutableGraph.ValueBackedImpl<N,V>
-
-
Field Summary
-
Fields inherited from class com.google.common.graph.ImmutableGraph.ValueBackedImpl
backingValueGraph
-
-
Constructor Summary
Constructors Modifier Constructor Description privateImmutableValueGraph(ValueGraph<N,V> graph)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description private static <N,V>
GraphConnections<N,V>connectionsOf(ValueGraph<N,V> graph, N node)static <N,V>
ImmutableValueGraph<N,V>copyOf(ImmutableValueGraph<N,V> graph)Deprecated.no need to use thisstatic <N,V>
ImmutableValueGraph<N,V>copyOf(ValueGraph<N,V> graph)Returns an immutable copy ofgraph.VedgeValue(java.lang.Object nodeU, java.lang.Object nodeV)If there is an edge connectingnodeUtonodeV, returns the non-null value associated with that edge.VedgeValueOrDefault(java.lang.Object nodeU, java.lang.Object nodeV, V defaultValue)If there is an edge connectingnodeUtonodeV, returns the non-null value associated with that edge; otherwise, returnsdefaultValue.private static <N,V>
ImmutableMap<N,GraphConnections<N,V>>getNodeConnections(ValueGraph<N,V> graph)java.lang.StringtoString()Returns a string representation of this graph.-
Methods inherited from class com.google.common.graph.ImmutableGraph.ValueBackedImpl
delegate
-
Methods inherited from class com.google.common.graph.ImmutableGraph
copyOf, copyOf
-
Methods inherited from class com.google.common.graph.ForwardingGraph
adjacentNodes, allowsSelfLoops, degree, edges, inDegree, isDirected, nodeOrder, nodes, outDegree, predecessors, successors
-
Methods inherited from class com.google.common.graph.AbstractGraph
edgeCount
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.google.common.graph.Graph
adjacentNodes, allowsSelfLoops, degree, edges, inDegree, isDirected, nodeOrder, nodes, outDegree, predecessors, successors
-
Methods inherited from interface com.google.common.graph.ValueGraph
equals, hashCode
-
-
-
-
Constructor Detail
-
ImmutableValueGraph
private ImmutableValueGraph(ValueGraph<N,V> graph)
-
-
Method Detail
-
copyOf
public static <N,V> ImmutableValueGraph<N,V> copyOf(ValueGraph<N,V> graph)
Returns an immutable copy ofgraph.
-
copyOf
@Deprecated public static <N,V> ImmutableValueGraph<N,V> copyOf(ImmutableValueGraph<N,V> graph)
Deprecated.no need to use thisSimply returns its argument.
-
getNodeConnections
private static <N,V> ImmutableMap<N,GraphConnections<N,V>> getNodeConnections(ValueGraph<N,V> graph)
-
connectionsOf
private static <N,V> GraphConnections<N,V> connectionsOf(ValueGraph<N,V> graph, N node)
-
edgeValue
public V edgeValue(java.lang.Object nodeU, java.lang.Object nodeV)
Description copied from interface:ValueGraphIf there is an edge connectingnodeUtonodeV, returns the non-null value associated with that edge.In an undirected graph, this is equal to
edgeValue(nodeV, nodeU).- Specified by:
edgeValuein interfaceValueGraph<N,V>
-
edgeValueOrDefault
public V edgeValueOrDefault(java.lang.Object nodeU, java.lang.Object nodeV, @Nullable V defaultValue)
Description copied from interface:ValueGraphIf there is an edge connectingnodeUtonodeV, returns the non-null value associated with that edge; otherwise, returnsdefaultValue.In an undirected graph, this is equal to
edgeValueOrDefault(nodeV, nodeU, defaultValue).- Specified by:
edgeValueOrDefaultin interfaceValueGraph<N,V>
-
toString
public java.lang.String toString()
Description copied from class:AbstractGraphReturns a string representation of this graph.- Overrides:
toStringin classAbstractGraph<N>
-
-