cleanup schema diffing code, add comments by andimarek · Pull Request #3170 · graphql-java/graphql-java · GitHub
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
72 changes: 30 additions & 42 deletions src/main/java/graphql/schema/diffing/DiffImpl.java
14 changes: 11 additions & 3 deletions src/main/java/graphql/schema/diffing/EditOperation.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,15 @@

import java.util.Objects;

/**
* An edit operation between two graphs can be one of six types:
* insert vertex,
* delete vertex,
* change vertex,
* insert edge,
* delete edge,
* change edge
*/
@Internal
public class EditOperation {

Expand All @@ -21,11 +30,11 @@ private EditOperation(Operation operation,
this.targetEdge = targetEdge;
}

public static EditOperation deleteVertex(String description, Vertex sourceVertex,Vertex targetVertex) {
public static EditOperation deleteVertex(String description, Vertex sourceVertex, Vertex targetVertex) {
return new EditOperation(Operation.DELETE_VERTEX, description, sourceVertex, targetVertex, null, null);
}

public static EditOperation insertVertex(String description,Vertex sourceVertex, Vertex targetVertex) {
public static EditOperation insertVertex(String description, Vertex sourceVertex, Vertex targetVertex) {
return new EditOperation(Operation.INSERT_VERTEX, description, sourceVertex, targetVertex, null, null);
}

Expand Down Expand Up @@ -87,7 +96,6 @@ public String toString() {
}



@Override
public boolean equals(Object o) {
if (this == o) {
Expand Down
6 changes: 6 additions & 0 deletions src/main/java/graphql/schema/diffing/Mapping.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@
import java.util.List;
import java.util.Objects;

/**
* A mapping (in the math sense) from a list of vertices to another list of
* vertices.
* A mapping can semantically mean a change, but doesn't have to: a vertex
* can be mapped to the same vertex (semantically the same, Java object wise they are different).
*/
@Internal
public class Mapping {
private BiMap<Vertex, Vertex> map = HashBiMap.create();
Expand Down
Loading