Skip to content

Commit

Permalink
chage limit type long to int
Browse files Browse the repository at this point in the history
  • Loading branch information
zyxxoo committed Oct 30, 2022
1 parent f57b4f4 commit 8dc357c
Show file tree
Hide file tree
Showing 23 changed files with 83 additions and 83 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ protected String type() {
public List<Path> get(Object sourceId, Object targetId,
Direction direction, String label,
int maxDepth, long degree,
long capacity, long limit) {
long capacity, int limit) {
String source = GraphAPI.formatVertexId(sourceId, false);
String target = GraphAPI.formatVertexId(targetId, false);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ protected String type() {
}

public List<Object> get(Object sourceId, Direction direction,
String label, int depth, long degree, long limit) {
String label, int depth, long degree, int limit) {
String source = GraphAPI.formatVertexId(sourceId, false);

checkPositive(depth, "Depth of k-neighbor");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ protected String type() {

public List<Object> get(Object sourceId, Direction direction,
String label, int depth, boolean nearest,
long degree, long capacity, long limit) {
long degree, long capacity, int limit) {
String source = GraphAPI.formatVertexId(sourceId, false);

checkPositive(depth, "Depth of k-out");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ protected String type() {
public List<Path> get(Object sourceId, Object targetId,
Direction direction, String label,
int maxDepth, long degree, long capacity,
long limit) {
int limit) {
String source = GraphAPI.formatVertexId(sourceId, false);
String target = GraphAPI.formatVertexId(targetId, false);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public static class Request {
@JsonProperty("max_degree")
public long degree = Traverser.DEFAULT_MAX_DEGREE;
@JsonProperty("limit")
private long limit = Traverser.DEFAULT_LIMIT;
private int limit = Traverser.DEFAULT_LIMIT;
@JsonProperty("max_depth")
private int maxDepth = 5;
@JsonProperty("with_label")
Expand Down Expand Up @@ -115,7 +115,7 @@ public Builder degree(long degree) {
return this;
}

public Builder limit(long limit) {
public Builder limit(int limit) {
TraversersAPI.checkLimit(limit);
this.request.limit = limit;
return this;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ protected String type() {
}

public List<Path> get(Object sourceId, Direction direction, String label,
int depth, long degree, long capacity, long limit) {
int depth, long degree, long capacity, int limit) {
String source = GraphAPI.formatVertexId(sourceId, false);

checkPositive(depth, "Max depth of path");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ protected String type() {

public List<Path> get(Object sourceId, Direction direction, String label,
int depth, boolean sourceInRing, long degree,
long capacity, long limit) {
long capacity, int limit) {
String source = GraphAPI.formatVertexId(sourceId, false);

checkPositive(depth, "Max depth of path");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ protected String type() {

public List<Object> get(Object vertexId, Object otherId,
Direction direction, String label,
long degree, long limit) {
long degree, int limit) {
this.client.checkApiVersion("0.51", "same neighbors");
String vertex = GraphAPI.formatVertexId(vertexId, false);
String other = GraphAPI.formatVertexId(otherId, false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ protected String type() {

public WeightedPaths get(Object sourceId, Direction direction, String label,
String weight, long degree, long skipDegree,
long capacity, long limit, boolean withVertex) {
long capacity, int limit, boolean withVertex) {
this.client.checkApiVersion("0.51", "single source shortest path");
String source = GraphAPI.formatVertexId(sourceId, false);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public static void checkCapacity(long capacity) {
checkLimit(capacity, "Capacity");
}

public static void checkLimit(long limit) {
public static void checkLimit(int limit) {
checkLimit(limit, "Limit");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ public List<Object> sameNeighbors(Object vertexId, Object otherId,

public List<Object> sameNeighbors(Object vertexId, Object otherId,
Direction direction, String label,
long degree, long limit) {
long degree, int limit) {
return this.sameNeighborsAPI.get(vertexId, otherId, direction,
label, degree, limit);
}
Expand Down Expand Up @@ -272,7 +272,7 @@ public WeightedPaths singleSourceShortestPath(Object sourceId,
Direction direction,
String label, String weight,
long degree, long skipDegree,
long capacity, long limit,
long capacity, int limit,
boolean withVertex) {
return this.singleSourceShortestPathAPI.get(sourceId, direction, label,
weight, degree, skipDegree,
Expand Down Expand Up @@ -317,21 +317,21 @@ public List<Path> paths(Object sourceId, Object targetId, int maxDepth) {
}

public List<Path> paths(Object sourceId, Object targetId,
Direction direction, int maxDepth, long limit) {
Direction direction, int maxDepth, int limit) {
return this.paths(sourceId, targetId, direction, null,
maxDepth, limit);
}

public List<Path> paths(Object sourceId, Object targetId,
Direction direction, String label,
int maxDepth, long limit) {
int maxDepth, int limit) {
return this.paths(sourceId, targetId, direction, label, maxDepth,
DEFAULT_MAX_DEGREE, DEFAULT_CAPACITY, limit);
}

public List<Path> paths(Object sourceId, Object targetId,
Direction direction, String label, int maxDepth,
long degree, long capacity, long limit) {
long degree, long capacity, int limit) {
return this.pathsAPI.get(sourceId, targetId, direction, label,
maxDepth, degree, capacity, limit);
}
Expand All @@ -348,22 +348,22 @@ public List<Path> crosspoint(Object sourceId, Object targetId,

public List<Path> crosspoint(Object sourceId, Object targetId,
Direction direction, int maxDepth,
long limit) {
int limit) {
return this.crosspoint(sourceId, targetId, direction, null,
maxDepth, limit);
}

public List<Path> crosspoint(Object sourceId, Object targetId,
Direction direction, String label,
int maxDepth, long limit) {
int maxDepth, int limit) {
return this.crosspoint(sourceId, targetId, direction, label, maxDepth,
DEFAULT_MAX_DEGREE, DEFAULT_CAPACITY, limit);
}

public List<Path> crosspoint(Object sourceId, Object targetId,
Direction direction, String label,
int maxDepth, long degree, long capacity,
long limit) {
int limit) {
return this.crosspointsAPI.get(sourceId, targetId, direction, label,
maxDepth, degree, capacity, limit);
}
Expand All @@ -385,7 +385,7 @@ public List<Object> kout(Object sourceId, Direction direction,

public List<Object> kout(Object sourceId, Direction direction,
String label, int depth, boolean nearest,
long degree, long capacity, long limit) {
long degree, long capacity, int limit) {
return this.koutAPI.get(sourceId, direction, label, depth, nearest,
degree, capacity, limit);
}
Expand All @@ -411,7 +411,7 @@ public List<Object> kneighbor(Object sourceId, Direction direction,

public List<Object> kneighbor(Object sourceId, Direction direction,
String label, int depth,
long degree, long limit) {
long degree, int limit) {
return this.kneighborAPI.get(sourceId, direction, label, depth,
degree, limit);
}
Expand All @@ -432,7 +432,7 @@ public List<Path> rings(Object sourceId, int depth) {

public List<Path> rings(Object sourceId, Direction direction, String label,
int depth, boolean sourceInRing, long degree,
long capacity, long limit) {
long capacity, int limit) {
return this.ringsAPI.get(sourceId, direction, label, depth,
sourceInRing, degree, capacity, limit);
}
Expand All @@ -444,7 +444,7 @@ public List<Path> rays(Object sourceId, int depth) {
}

public List<Path> rays(Object sourceId, Direction direction, String label,
int depth, long degree, long capacity, long limit) {
int depth, long degree, long capacity, int limit) {
return this.raysAPI.get(sourceId, direction, label, depth, degree,
capacity, limit);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@
public class Traverser {

public static final long DEFAULT_CAPACITY = 10_000_000L;
public static final long DEFAULT_LIMIT = 100L;
public static final long DEFAULT_ELEMENTS_LIMIT = 10_000_000L;
public static final int DEFAULT_LIMIT = 100;
public static final int DEFAULT_ELEMENTS_LIMIT = 10_000_000;
public static final long DEFAULT_MAX_DEGREE = 10_000L;
public static final long DEFAULT_CROSSPOINT_LIMIT = 10_000L;
public static final long DEFAULT_PATHS_LIMIT = 10L;
public static final int DEFAULT_CROSSPOINT_LIMIT = 10_000;
public static final int DEFAULT_PATHS_LIMIT = 10;
public static final long DEFAULT_DEDUP_SIZE = 1_000_000L;
public static final long DEFAULT_SKIP_DEGREE = 100_000L;
public static final long DEFAULT_SAMPLE = 100L;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public class CrosspointsRequest {
@JsonProperty("capacity")
private long capacity;
@JsonProperty("limit")
private long limit;
private int limit;
@JsonProperty("with_path")
private boolean withPath;
@JsonProperty("with_vertex")
Expand Down Expand Up @@ -95,7 +95,7 @@ public Builder capacity(long capacity) {
return this;
}

public Builder limit(long limit) {
public Builder limit(int limit) {
TraversersAPI.checkLimit(limit);
this.request.limit = limit;
return this;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public class CustomizedPathsRequest {
@JsonProperty("capacity")
private long capacity;
@JsonProperty("limit")
private long limit;
private int limit;
@JsonProperty("with_vertex")
private boolean withVertex;

Expand Down Expand Up @@ -103,7 +103,7 @@ public Builder capacity(long capacity) {
return this;
}

public Builder limit(long limit) {
public Builder limit(int limit) {
TraversersAPI.checkLimit(limit);
this.request.limit = limit;
return this;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public class FusiformSimilarityRequest {
@JsonProperty("capacity")
public long capacity;
@JsonProperty("limit")
public long limit;
public int limit;
@JsonProperty("with_intermediary")
public boolean withIntermediary;
@JsonProperty("with_vertex")
Expand Down Expand Up @@ -165,7 +165,7 @@ public Builder capacity(long capacity) {
return this;
}

public Builder limit(long limit) {
public Builder limit(int limit) {
TraversersAPI.checkLimit(limit);
this.request.limit = limit;
return this;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public class KneighborRequest {
@JsonProperty("count_only")
public boolean countOnly = false;
@JsonProperty("limit")
public long limit = Traverser.DEFAULT_LIMIT;
public int limit = Traverser.DEFAULT_LIMIT;
@JsonProperty("with_vertex")
public boolean withVertex = false;
@JsonProperty("with_path")
Expand Down Expand Up @@ -97,7 +97,7 @@ public Builder countOnly(boolean countOnly) {
return this;
}

public Builder limit(long limit) {
public Builder limit(int limit) {
TraversersAPI.checkLimit(limit);
this.request.limit = limit;
return this;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public class KoutRequest {
@JsonProperty("capacity")
public long capacity = Traverser.DEFAULT_CAPACITY;
@JsonProperty("limit")
public long limit = Traverser.DEFAULT_LIMIT;
public int limit = Traverser.DEFAULT_LIMIT;
@JsonProperty("with_vertex")
public boolean withVertex = false;
@JsonProperty("with_path")
Expand Down Expand Up @@ -115,7 +115,7 @@ public Builder capacity(long capacity) {
return this;
}

public Builder limit(long limit) {
public Builder limit(int limit) {
TraversersAPI.checkLimit(limit);
this.request.limit = limit;
return this;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public class PathsRequest {
@JsonProperty("capacity")
public long capacity = Traverser.DEFAULT_CAPACITY;
@JsonProperty("limit")
public long limit = Traverser.DEFAULT_LIMIT;
public int limit = Traverser.DEFAULT_LIMIT;
@JsonProperty("with_vertex")
public boolean withVertex = false;

Expand Down Expand Up @@ -102,7 +102,7 @@ public PathsRequest.Builder capacity(long capacity) {
return this;
}

public PathsRequest.Builder limit(long limit) {
public PathsRequest.Builder limit(int limit) {
TraversersAPI.checkLimit(limit);
this.request.limit = limit;
return this;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public class TemplatePathsRequest {
@JsonProperty("capacity")
public long capacity = Traverser.DEFAULT_CAPACITY;
@JsonProperty("limit")
public long limit = Traverser.DEFAULT_PATHS_LIMIT;
public int limit = Traverser.DEFAULT_PATHS_LIMIT;
@JsonProperty("with_vertex")
public boolean withVertex = false;

Expand Down Expand Up @@ -106,7 +106,7 @@ public Builder capacity(long capacity) {
return this;
}

public Builder limit(long limit) {
public Builder limit(int limit) {
TraversersAPI.checkLimit(limit);
this.request.limit = limit;
return this;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public void testKneighborGet() {
long softwareId = vertexLabelAPI.get("software").id();

List<Object> vertices = kneighborAPI.get(markoId, Direction.OUT,
null, 2, -1L, -1L);
null, 2, -1L, -1);
Assert.assertEquals(4, vertices.size());
Assert.assertTrue(vertices.contains(softwareId + ":lop"));
Assert.assertTrue(vertices.contains(softwareId + ":ripple"));
Expand Down
Loading

0 comments on commit 8dc357c

Please sign in to comment.