jcommon.graph.impl
Class TopologicalSortInput<TValue>

java.lang.Object
  extended by jcommon.graph.impl.TopologicalSortInput<TValue>
All Implemented Interfaces:
ITopologicalSortInput<TValue>

public class TopologicalSortInput<TValue>
extends Object
implements ITopologicalSortInput<TValue>

See Also:
ITopologicalSortInput

Constructor Summary
TopologicalSortInput(boolean starting, Map<IVertex,TValue> inputs)
          Instantiates a new instance of TopologicalSortInput.
 
Method Summary
 boolean containsVertex(IVertex vertex)
          Returns a boolean indicating if the input contains a key for the provided vertex.
 TValue first()
          Retrieves the value of the first provided input.
 TValue get(IVertex vertex)
          Gets the output of an out neighbor vertex.
 Iterable<TValue> inputs()
          Generates an instance of Iterable that allows traversing the contents of the input.
 boolean isEmpty()
          Determines if the input is empty.
 boolean isStart()
          Indicates if this is a starting vertex (one with an in-degree of zero) we're processing.
 int size()
          The size of the ITopologicalSortInput.
 String toString()
           
 Set<IVertex> vertices()
          Returns the set of vertices that generated the input.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TopologicalSortInput

public TopologicalSortInput(boolean starting,
                            Map<IVertex,TValue> inputs)
Instantiates a new instance of TopologicalSortInput.

Parameters:
inputs - An instance of a Map that maps between a IVertex and the output from processing it.
Method Detail

isStart

public boolean isStart()
Description copied from interface: ITopologicalSortInput
Indicates if this is a starting vertex (one with an in-degree of zero) we're processing.

Specified by:
isStart in interface ITopologicalSortInput<TValue>
Returns:
true if this represents a starting vertex (one with an in-degree of zero).
See Also:
ITopologicalSortInput.isStart()

isEmpty

public boolean isEmpty()
Description copied from interface: ITopologicalSortInput
Determines if the input is empty.

Specified by:
isEmpty in interface ITopologicalSortInput<TValue>
Returns:
true if the input is empty; false otherwise.
See Also:
ITopologicalSortInput.isEmpty()

get

public TValue get(IVertex vertex)
Description copied from interface: ITopologicalSortInput
Gets the output of an out neighbor vertex.

Specified by:
get in interface ITopologicalSortInput<TValue>
Parameters:
vertex - The vertex whose output is desired.
Returns:
The output of an out neighbor vertex.
See Also:
ITopologicalSortInput.get(IVertex)

first

public TValue first()
Description copied from interface: ITopologicalSortInput
Retrieves the value of the first provided input. If there is more than one input vertex, this method is not guaranteed to provide the same answer with every invocation. If there is more than one result, you should use the ITopologicalSortInput.get(IVertex) method.

Specified by:
first in interface ITopologicalSortInput<TValue>
Returns:
The value of the first provided input. null if there are no values in the input list.
See Also:
ITopologicalSortInput.first()

size

public int size()
Description copied from interface: ITopologicalSortInput
The size of the ITopologicalSortInput. This is the same as the number of in-degree vertices in the IAdjacencyList.

Specified by:
size in interface ITopologicalSortInput<TValue>
Returns:
An int representing the size of the ITopologicalSortInput.
See Also:
ITopologicalSortInput.size()

containsVertex

public boolean containsVertex(IVertex vertex)
Description copied from interface: ITopologicalSortInput
Returns a boolean indicating if the input contains a key for the provided vertex.

Specified by:
containsVertex in interface ITopologicalSortInput<TValue>
Parameters:
vertex - The vertex for whom membership will be tested.
Returns:
true if the provided vertex instance is a member of the input; false otherwise.
See Also:
ITopologicalSortInput.containsVertex(IVertex)

inputs

public Iterable<TValue> inputs()
Description copied from interface: ITopologicalSortInput
Generates an instance of Iterable that allows traversing the contents of the input.

Specified by:
inputs in interface ITopologicalSortInput<TValue>
Returns:
An instance of Iterable for traversing the contents of the input.
See Also:
ITopologicalSortInput.inputs()

vertices

public Set<IVertex> vertices()
Description copied from interface: ITopologicalSortInput
Returns the set of vertices that generated the input.

Specified by:
vertices in interface ITopologicalSortInput<TValue>
Returns:
A Set containing the set of vertices that generated the input.
See Also:
ITopologicalSortInput.vertices()

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2012-2013. All Rights Reserved.