Skip to content
Permalink
Browse files
Filled some javadocs, no functional modifications
  • Loading branch information
marcosperanza committed Jul 13, 2012
1 parent c6997b0 commit ba9310d22cdc9eb0084523705fb6bb6cb690e97e
Show file tree
Hide file tree
Showing 6 changed files with 93 additions and 14 deletions.
@@ -21,9 +21,21 @@

import org.apache.commons.graph.Mapper;

/**
* TODO Fill Me!
*
* @param <V> the Graph vertices type
* @param <WE> the Graph edges type
*/
public interface FlowWeightedEdgesBuilder<V, WE>
{

/**
* TODO Fill me!!
*
* @param weightedEdges
* @return
*/
<W, M extends Mapper<WE, W>> FromHeadBuilder<V, WE, W> whereEdgesHaveWeights( M weightedEdges );

}
@@ -186,29 +186,50 @@ public String toString()
}

/**
* @return
* Return the edge {@link Set}
* @return the edge {@link Set}
*/
protected Set<E> getAllEdges()
{
return allEdges;
}

/**
* @return the indexedEdges
* Returns the {@code Map} of indexed edges.
*
* @return the {@link Map} of indexed edges
*/
protected Map<VertexPair<V>, E> getIndexedEdges()
{
return indexedEdges;
}

/**
* @return the indexedVertices
* Returns the {@code Map} of indexed vertices.
*
* @return the indexed vertices {@link Map}
*/
protected Map<E, VertexPair<V>> getIndexedVertices()
{
return indexedVertices;
}

/**
* Ensures the truth of an expression involving one or more parameters to the
* calling method.
*
* @param expression a boolean expression
* @param errorMessageTemplate a template for the exception message should the
* check fail. The message is formed by replacing each {@code %s}
* placeholder in the template with an argument. These are matched by
* position - the first {@code %s} gets {@code errorMessageArgs[0]}, etc.
* Unmatched arguments will be appended to the formatted message in square
* braces. Unmatched placeholders will be left as-is.
* @param errorMessageArgs the arguments to be substituted into the message
* template. Arguments are converted to strings using
* {@link String#valueOf(Object)}.
* @throws GraphException if {@code expression} is false
*/
protected static void checkGraphCondition( boolean expression, String errorMessageTemplate, Object...errorMessageArgs )
{
if ( !expression )
@@ -53,7 +53,8 @@ public final void addVertex( V v )
}

/**
* @param v
* Executes additional actions to vertex that will be added
* @param v the vertex
*/
protected abstract void decorateAddVertex( V v );

@@ -75,9 +76,8 @@ public final void removeVertex( V v )
}

/**
*
*
* @param v
* Executes additional actions to vertex that will be removed
* @param v the vertex
*/
protected abstract void decorateRemoveVertex( V v );

@@ -100,6 +100,13 @@ public void addEdge( V head, E e, V tail )
decorateAddEdge( head, e, tail );
}

/**
* Performs the internal operations to add the edge
*
* @param head the head vertex
* @param e the edge
* @param tail the tail vertex
*/
protected void internalAddEdge( V head, E e, V tail )
{
getAdjacencyList().get( head ).add( tail );
@@ -113,6 +120,13 @@ protected void internalAddEdge( V head, E e, V tail )
}
}

/**
* Performs the internal operations to remove the edge.
*
* @param head the head vertex
* @param e the edge
* @param tail the tail vertex
*/
protected void internalRemoveEdge( V head, E e, V tail )
{
final VertexPair<V> vertexPair = new VertexPair<V>( head, tail );
@@ -122,7 +136,10 @@ protected void internalRemoveEdge( V head, E e, V tail )
}

/**
* @param e
* Executes additional actions to edge that will be added
* @param head the head vertex
* @param e the edge
* @param tail the tail vertex
*/
protected abstract void decorateAddEdge( V head, E e, V tail );

@@ -141,9 +158,8 @@ public final void removeEdge( E e )
}

/**
*
*
* @param e
* Executes additional actions to edge that will be removed
* @param e the edge
*/
protected abstract void decorateRemoveEdge( E e );

@@ -62,6 +62,11 @@

private final Map<E, VertexPair<V>> indexedVertices = new HashMap<E, VertexPair<V>>();

/**
* Creates a new instance of {@link InMemoryPath} from {@code start} vertex to {@code taget} vertex
* @param start the start vertex.
* @param target the target vertex.
*/
public InMemoryPath( V start, V target )
{
this.source = checkNotNull( start, "Path source cannot be null" );
@@ -100,6 +105,13 @@ public int getOrder()
return vertices.size();
}

/**
* Adds the edge in head.
*
* @param head the head vertex
* @param edge the edge
* @param tail the tail vertex
*/
public void addConnectionInHead( V head, E edge, V tail )
{
if ( target.equals( tail ) )
@@ -113,6 +125,13 @@ public void addConnectionInHead( V head, E edge, V tail )
addConnection( head, edge, tail );
}

/**
* Adds the edge in tail.
*
* @param head the head vertex
* @param edge the edge
* @param tail the tail vertex
*/
public void addConnectionInTail( V head, E edge, V tail )
{
vertices.addLast( head );
@@ -39,9 +39,6 @@
implements WeightedPath<V, WE, W>
{

/**
*
*/
private static final long serialVersionUID = 7937494144459068796L;

private final Monoid<W> weightOperations;
@@ -50,6 +47,14 @@

private W weight;

/**
* Creates a new instance of {@link InMemoryWeightedPath}.
*
* @param start the start vertex
* @param target the target vertex
* @param weightOperations
* @param weightedEdges
*/
public InMemoryWeightedPath( V start, V target, Monoid<W> weightOperations, Mapper<WE, W> weightedEdges )
{
super( start, target );
@@ -45,6 +45,12 @@

private W weight;

/**
* Creates a new instance of {@link MutableSpanningTree}
*
* @param weightOperations
* @param weightedEdges
*/
public MutableSpanningTree( Monoid<W> weightOperations, Mapper<WE, W> weightedEdges )
{
this.weightOperations = weightOperations;

0 comments on commit ba9310d

Please sign in to comment.