Skip to content

Commit

Permalink
Filled some javadocs, no functional modifications
Browse files Browse the repository at this point in the history
  • Loading branch information
marcosperanza committed Jul 13, 2012
1 parent c6997b0 commit ba9310d
Show file tree
Hide file tree
Showing 6 changed files with 93 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 );

}
27 changes: 24 additions & 3 deletions src/main/java/org/apache/commons/graph/model/BaseGraph.java
Original file line number Diff line number Diff line change
Expand Up @@ -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 )
Expand Down
32 changes: 24 additions & 8 deletions src/main/java/org/apache/commons/graph/model/BaseMutableGraph.java
Original file line number Diff line number Diff line change
Expand Up @@ -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 );

Expand All @@ -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 );

Expand All @@ -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 );
Expand All @@ -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 );
Expand All @@ -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 );

Expand All @@ -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 );

Expand Down
19 changes: 19 additions & 0 deletions src/main/java/org/apache/commons/graph/model/InMemoryPath.java
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,11 @@ public class InMemoryPath<V, E>

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" );
Expand Down Expand Up @@ -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 ) )
Expand All @@ -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 );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,6 @@ public final class InMemoryWeightedPath<V, WE, W>
implements WeightedPath<V, WE, W>
{

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

private final Monoid<W> weightOperations;
Expand All @@ -50,6 +47,14 @@ public final class InMemoryWeightedPath<V, WE, W>

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 );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,12 @@ public final class MutableSpanningTree<V, WE, W>

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;
Expand Down

0 comments on commit ba9310d

Please sign in to comment.