jcommon.graph.impl
Class TopologicalSortInput<TValue,TProcessedValue>

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

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

See Also:
ITopologicalSortInput

Constructor Summary
TopologicalSortInput(boolean starting, Map<TValue,TProcessedValue> inputs)
          Instantiates a new instance of TopologicalSortInput.
 
Method Summary
 boolean contains(TValue value)
          Returns a boolean indicating if the input contains a key for the provided vertex value.
 TProcessedValue first()
          Retrieves the value of the first provided input.
 TProcessedValue get(TValue value)
          Gets the output of an out neighbor vertex value.
 Iterable<TProcessedValue> 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<TValue> values()
          Returns the set of vertex values 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<TValue,TProcessedValue> inputs)
Instantiates a new instance of TopologicalSortInput.

Parameters:
inputs - An instance of a Map that maps between a value 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,TProcessedValue>
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,TProcessedValue>
Returns:
true if the input is empty; false otherwise.
See Also:
ITopologicalSortInput.isEmpty()

get

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

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

first

public TProcessedValue first()
Description copied from interface: ITopologicalSortInput
Retrieves the value of the first provided input. If there is more than one input, 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(Object) method.

Specified by:
first in interface ITopologicalSortInput<TValue,TProcessedValue>
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,TProcessedValue>
Returns:
An int representing the size of the ITopologicalSortInput.
See Also:
ITopologicalSortInput.size()

contains

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

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

inputs

public Iterable<TProcessedValue> 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,TProcessedValue>
Returns:
An instance of Iterable for traversing the contents of the input.
See Also:
ITopologicalSortInput.inputs()

values

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

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

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2012-2013. All Rights Reserved.