Skip to content

Commit

Permalink
Patched /tmp/tmpkll84x0y/src/test/java/com/falkordb/test/utils/PathBu…
Browse files Browse the repository at this point in the history
…ilder.java
  • Loading branch information
patched.codes[bot] committed Oct 4, 2024
1 parent 7a8614d commit e283412
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions src/test/java/com/falkordb/test/utils/PathBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,13 @@ public PathBuilder(int nodesCount){
this.edges = new ArrayList<>(nodesCount > 0 ? nodesCount - 1 : 0);
}

/**
* Appends an object to the path builder.
*
* @param object The object to append, must be of the expected class type (Node or Edge)
* @return The updated PathBuilder instance
* @throws IllegalArgumentException if the object's class does not match the expected class
*/
public PathBuilder append(Object object){
Class<? extends Object> c = object.getClass();
if(!currentAppendClass.equals(c)){
Expand All @@ -32,6 +39,24 @@ public PathBuilder append(Object object){
return appendEdge((Edge)object);
}

/**
* Appends an edge to the path and updates the current append class.
*
* @param edge The Edge object to be added to the path
* @return The current PathBuilder instance for method chaining
*/
/**
* Appends a node to the path and updates the current append class.
*
* @param node The Node object to be added to the path
* @return The current PathBuilder instance for method chaining
*/
/**
* Builds and returns a Path object based on the collected nodes and edges.
*
* @return A new Path object constructed from the collected nodes and edges
* @throws IllegalArgumentException if the number of nodes is not equal to the number of edges plus one
*/
private PathBuilder appendEdge(Edge edge) {
edges.add(edge);
currentAppendClass = Node.class;
Expand Down

0 comments on commit e283412

Please sign in to comment.