repo stringlengths 7 58 | path stringlengths 12 218 | func_name stringlengths 3 140 | original_string stringlengths 73 34.1k | language stringclasses 1
value | code stringlengths 73 34.1k | code_tokens list | docstring stringlengths 3 16k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 105 339 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
tvesalainen/bcc | src/main/java/org/vesalainen/bcc/Assembler.java | Assembler.ifge | public void ifge(String target) throws IOException
{
if (wideIndex)
{
out.writeByte(NOT_IFGE);
out.writeShort(WIDEFIXOFFSET);
Branch branch = createBranch(target);
out.writeByte(GOTO_W);
out.writeInt(branch);
}
else
... | java | public void ifge(String target) throws IOException
{
if (wideIndex)
{
out.writeByte(NOT_IFGE);
out.writeShort(WIDEFIXOFFSET);
Branch branch = createBranch(target);
out.writeByte(GOTO_W);
out.writeInt(branch);
}
else
... | [
"public",
"void",
"ifge",
"(",
"String",
"target",
")",
"throws",
"IOException",
"{",
"if",
"(",
"wideIndex",
")",
"{",
"out",
".",
"writeByte",
"(",
"NOT_IFGE",
")",
";",
"out",
".",
"writeShort",
"(",
"WIDEFIXOFFSET",
")",
";",
"Branch",
"branch",
"=",... | ge succeeds if and only if value >= 0
@param target
@throws IOException | [
"ge",
"succeeds",
"if",
"and",
"only",
"if",
"value",
">",
";",
"=",
"0"
] | 4e84e313018d487f1a8cca3952d71bc21e77d16b | https://github.com/tvesalainen/bcc/blob/4e84e313018d487f1a8cca3952d71bc21e77d16b/src/main/java/org/vesalainen/bcc/Assembler.java#L1067-L1083 | train |
tvesalainen/bcc | src/main/java/org/vesalainen/bcc/Assembler.java | Assembler.ifgt | public void ifgt(String target) throws IOException
{
if (wideIndex)
{
out.writeByte(NOT_IFGT);
out.writeShort(WIDEFIXOFFSET);
Branch branch = createBranch(target);
out.writeByte(GOTO_W);
out.writeInt(branch);
}
else
... | java | public void ifgt(String target) throws IOException
{
if (wideIndex)
{
out.writeByte(NOT_IFGT);
out.writeShort(WIDEFIXOFFSET);
Branch branch = createBranch(target);
out.writeByte(GOTO_W);
out.writeInt(branch);
}
else
... | [
"public",
"void",
"ifgt",
"(",
"String",
"target",
")",
"throws",
"IOException",
"{",
"if",
"(",
"wideIndex",
")",
"{",
"out",
".",
"writeByte",
"(",
"NOT_IFGT",
")",
";",
"out",
".",
"writeShort",
"(",
"WIDEFIXOFFSET",
")",
";",
"Branch",
"branch",
"=",... | gt succeeds if and only if value > 0
@param target
@throws IOException | [
"gt",
"succeeds",
"if",
"and",
"only",
"if",
"value",
">",
";",
"0"
] | 4e84e313018d487f1a8cca3952d71bc21e77d16b | https://github.com/tvesalainen/bcc/blob/4e84e313018d487f1a8cca3952d71bc21e77d16b/src/main/java/org/vesalainen/bcc/Assembler.java#L1090-L1106 | train |
tvesalainen/bcc | src/main/java/org/vesalainen/bcc/Assembler.java | Assembler.ifle | public void ifle(String target) throws IOException
{
if (wideIndex)
{
out.writeByte(NOT_IFLE);
out.writeShort(WIDEFIXOFFSET);
Branch branch = createBranch(target);
out.writeByte(GOTO_W);
out.writeInt(branch);
}
else
... | java | public void ifle(String target) throws IOException
{
if (wideIndex)
{
out.writeByte(NOT_IFLE);
out.writeShort(WIDEFIXOFFSET);
Branch branch = createBranch(target);
out.writeByte(GOTO_W);
out.writeInt(branch);
}
else
... | [
"public",
"void",
"ifle",
"(",
"String",
"target",
")",
"throws",
"IOException",
"{",
"if",
"(",
"wideIndex",
")",
"{",
"out",
".",
"writeByte",
"(",
"NOT_IFLE",
")",
";",
"out",
".",
"writeShort",
"(",
"WIDEFIXOFFSET",
")",
";",
"Branch",
"branch",
"=",... | le succeeds if and only if value <= 0
@param target
@throws IOException | [
"le",
"succeeds",
"if",
"and",
"only",
"if",
"value",
"<",
";",
"=",
"0"
] | 4e84e313018d487f1a8cca3952d71bc21e77d16b | https://github.com/tvesalainen/bcc/blob/4e84e313018d487f1a8cca3952d71bc21e77d16b/src/main/java/org/vesalainen/bcc/Assembler.java#L1113-L1129 | train |
passwordmaker/java-passwordmaker-lib | src/main/java/org/daveware/passwordmaker/RDFDatabaseReader.java | RDFDatabaseReader.createParentChildRelationships | private void createParentChildRelationships(Database db,
HashMap<String, Account> descriptionMap,
HashMap<String, ArrayList<String>> seqMap)
throws Exception {
// List of ID's used to avoid recursion
... | java | private void createParentChildRelationships(Database db,
HashMap<String, Account> descriptionMap,
HashMap<String, ArrayList<String>> seqMap)
throws Exception {
// List of ID's used to avoid recursion
... | [
"private",
"void",
"createParentChildRelationships",
"(",
"Database",
"db",
",",
"HashMap",
"<",
"String",
",",
"Account",
">",
"descriptionMap",
",",
"HashMap",
"<",
"String",
",",
"ArrayList",
"<",
"String",
">",
">",
"seqMap",
")",
"throws",
"Exception",
"{... | Iterates through the list of Seqs read in adding the parent node and
then adding children which belong to it.
@param db The database to add nodes to.
@param descriptionMap The list of RDF:Description nodes.
@param seqMap The list of RDF:Seq nodes, which contain RDF:li nodes.
@throws Exception on un... | [
"Iterates",
"through",
"the",
"list",
"of",
"Seqs",
"read",
"in",
"adding",
"the",
"parent",
"node",
"and",
"then",
"adding",
"children",
"which",
"belong",
"to",
"it",
"."
] | 18c22fca7dd9a47f08161425b85a5bd257afbb2b | https://github.com/passwordmaker/java-passwordmaker-lib/blob/18c22fca7dd9a47f08161425b85a5bd257afbb2b/src/main/java/org/daveware/passwordmaker/RDFDatabaseReader.java#L385-L445 | train |
Teddy-Zhu/SilentGo | framework/src/main/java/com/silentgo/servlet/oreilly/multipart/DefaultFileRenamePolicy.java | DefaultFileRenamePolicy.rename | public File rename(File f) {
if (createNewFile(f)) {
return f;
}
String name = f.getName();
String body = null;
String ext = null;
int dot = name.lastIndexOf(".");
if (dot != -1) {
body = name.substring(0, dot);
ext = name.substring(dot); // includes "."
}
else {
... | java | public File rename(File f) {
if (createNewFile(f)) {
return f;
}
String name = f.getName();
String body = null;
String ext = null;
int dot = name.lastIndexOf(".");
if (dot != -1) {
body = name.substring(0, dot);
ext = name.substring(dot); // includes "."
}
else {
... | [
"public",
"File",
"rename",
"(",
"File",
"f",
")",
"{",
"if",
"(",
"createNewFile",
"(",
"f",
")",
")",
"{",
"return",
"f",
";",
"}",
"String",
"name",
"=",
"f",
".",
"getName",
"(",
")",
";",
"String",
"body",
"=",
"null",
";",
"String",
"ext",
... | is atomic and used here to mark when a file name is chosen | [
"is",
"atomic",
"and",
"used",
"here",
"to",
"mark",
"when",
"a",
"file",
"name",
"is",
"chosen"
] | 27f58b0cafe56b2eb9fc6993efa9ca2b529661e1 | https://github.com/Teddy-Zhu/SilentGo/blob/27f58b0cafe56b2eb9fc6993efa9ca2b529661e1/framework/src/main/java/com/silentgo/servlet/oreilly/multipart/DefaultFileRenamePolicy.java#L27-L58 | train |
geomajas/geomajas-project-geometry | core/src/main/java/org/geomajas/geometry/service/GeometryValidationContext.java | GeometryValidationContext.getState | @Api
public GeometryValidationState getState() {
if (violations.isEmpty()) {
return GeometryValidationState.VALID;
} else {
return violations.get(0).getState();
}
} | java | @Api
public GeometryValidationState getState() {
if (violations.isEmpty()) {
return GeometryValidationState.VALID;
} else {
return violations.get(0).getState();
}
} | [
"@",
"Api",
"public",
"GeometryValidationState",
"getState",
"(",
")",
"{",
"if",
"(",
"violations",
".",
"isEmpty",
"(",
")",
")",
"{",
"return",
"GeometryValidationState",
".",
"VALID",
";",
"}",
"else",
"{",
"return",
"violations",
".",
"get",
"(",
"0",... | Get the validation state of the geometry. We take the state of the first violation encountered.
@return the invalid state or {@link GeometryValidationState.VALID} if there are no violations. | [
"Get",
"the",
"validation",
"state",
"of",
"the",
"geometry",
".",
"We",
"take",
"the",
"state",
"of",
"the",
"first",
"violation",
"encountered",
"."
] | 09a214fede69c9c01e41630828c4abbb551a557d | https://github.com/geomajas/geomajas-project-geometry/blob/09a214fede69c9c01e41630828c4abbb551a557d/core/src/main/java/org/geomajas/geometry/service/GeometryValidationContext.java#L102-L109 | train |
geomajas/geomajas-project-geometry | core/src/main/java/org/geomajas/geometry/Coordinate.java | Coordinate.equalsDelta | public boolean equalsDelta(Coordinate coordinate, double delta) {
return null != coordinate &&
(Math.abs(this.x - coordinate.x) < delta && Math.abs(this.y - coordinate.y) < delta);
} | java | public boolean equalsDelta(Coordinate coordinate, double delta) {
return null != coordinate &&
(Math.abs(this.x - coordinate.x) < delta && Math.abs(this.y - coordinate.y) < delta);
} | [
"public",
"boolean",
"equalsDelta",
"(",
"Coordinate",
"coordinate",
",",
"double",
"delta",
")",
"{",
"return",
"null",
"!=",
"coordinate",
"&&",
"(",
"Math",
".",
"abs",
"(",
"this",
".",
"x",
"-",
"coordinate",
".",
"x",
")",
"<",
"delta",
"&&",
"Ma... | Comparison using a tolerance for the equality check.
@param coordinate
coordinate to compare with
@param delta
maximum deviation (along one axis, the actual maximum distance is sqrt(2*delta^2))
@return true | [
"Comparison",
"using",
"a",
"tolerance",
"for",
"the",
"equality",
"check",
"."
] | 09a214fede69c9c01e41630828c4abbb551a557d | https://github.com/geomajas/geomajas-project-geometry/blob/09a214fede69c9c01e41630828c4abbb551a557d/core/src/main/java/org/geomajas/geometry/Coordinate.java#L115-L118 | train |
geomajas/geomajas-project-geometry | core/src/main/java/org/geomajas/geometry/Coordinate.java | Coordinate.distance | public double distance(Coordinate c) {
double dx = x - c.x;
double dy = y - c.y;
return Math.sqrt(dx * dx + dy * dy);
} | java | public double distance(Coordinate c) {
double dx = x - c.x;
double dy = y - c.y;
return Math.sqrt(dx * dx + dy * dy);
} | [
"public",
"double",
"distance",
"(",
"Coordinate",
"c",
")",
"{",
"double",
"dx",
"=",
"x",
"-",
"c",
".",
"x",
";",
"double",
"dy",
"=",
"y",
"-",
"c",
".",
"y",
";",
"return",
"Math",
".",
"sqrt",
"(",
"dx",
"*",
"dx",
"+",
"dy",
"*",
"dy",... | Computes the 2-dimensional Euclidean distance to another location.
@param c
Another coordinate
@return the 2-dimensional Euclidean distance between the locations | [
"Computes",
"the",
"2",
"-",
"dimensional",
"Euclidean",
"distance",
"to",
"another",
"location",
"."
] | 09a214fede69c9c01e41630828c4abbb551a557d | https://github.com/geomajas/geomajas-project-geometry/blob/09a214fede69c9c01e41630828c4abbb551a557d/core/src/main/java/org/geomajas/geometry/Coordinate.java#L177-L182 | train |
geomajas/geomajas-project-geometry | core/src/main/java/org/geomajas/geometry/service/GeometryService.java | GeometryService.toPolygon | public static Geometry toPolygon(Bbox bounds) {
double minX = bounds.getX();
double minY = bounds.getY();
double maxX = bounds.getMaxX();
double maxY = bounds.getMaxY();
Geometry polygon = new Geometry(Geometry.POLYGON, 0, -1);
Geometry linearRing = new Geometry(Geometry.LINEAR_RING, 0, -1);
linearRing.... | java | public static Geometry toPolygon(Bbox bounds) {
double minX = bounds.getX();
double minY = bounds.getY();
double maxX = bounds.getMaxX();
double maxY = bounds.getMaxY();
Geometry polygon = new Geometry(Geometry.POLYGON, 0, -1);
Geometry linearRing = new Geometry(Geometry.LINEAR_RING, 0, -1);
linearRing.... | [
"public",
"static",
"Geometry",
"toPolygon",
"(",
"Bbox",
"bounds",
")",
"{",
"double",
"minX",
"=",
"bounds",
".",
"getX",
"(",
")",
";",
"double",
"minY",
"=",
"bounds",
".",
"getY",
"(",
")",
";",
"double",
"maxX",
"=",
"bounds",
".",
"getMaxX",
"... | Transform the given bounding box into a polygon geometry.
@param bounds The bounding box to transform.
@return Returns the polygon equivalent of the given bounding box. | [
"Transform",
"the",
"given",
"bounding",
"box",
"into",
"a",
"polygon",
"geometry",
"."
] | 09a214fede69c9c01e41630828c4abbb551a557d | https://github.com/geomajas/geomajas-project-geometry/blob/09a214fede69c9c01e41630828c4abbb551a557d/core/src/main/java/org/geomajas/geometry/service/GeometryService.java#L140-L153 | train |
geomajas/geomajas-project-geometry | core/src/main/java/org/geomajas/geometry/service/GeometryService.java | GeometryService.toLineString | public static Geometry toLineString(Coordinate c1, Coordinate c2) {
Geometry lineString = new Geometry(Geometry.LINE_STRING, 0, -1);
lineString.setCoordinates(new Coordinate[] { (Coordinate) c1.clone(), (Coordinate) c2.clone() });
return lineString;
} | java | public static Geometry toLineString(Coordinate c1, Coordinate c2) {
Geometry lineString = new Geometry(Geometry.LINE_STRING, 0, -1);
lineString.setCoordinates(new Coordinate[] { (Coordinate) c1.clone(), (Coordinate) c2.clone() });
return lineString;
} | [
"public",
"static",
"Geometry",
"toLineString",
"(",
"Coordinate",
"c1",
",",
"Coordinate",
"c2",
")",
"{",
"Geometry",
"lineString",
"=",
"new",
"Geometry",
"(",
"Geometry",
".",
"LINE_STRING",
",",
"0",
",",
"-",
"1",
")",
";",
"lineString",
".",
"setCoo... | Create a new linestring based on the specified coordinates.
@param c1 first coordinate
@param c2 second coordinate
@return the linestring
@since 1.2.0 | [
"Create",
"a",
"new",
"linestring",
"based",
"on",
"the",
"specified",
"coordinates",
"."
] | 09a214fede69c9c01e41630828c4abbb551a557d | https://github.com/geomajas/geomajas-project-geometry/blob/09a214fede69c9c01e41630828c4abbb551a557d/core/src/main/java/org/geomajas/geometry/service/GeometryService.java#L163-L167 | train |
geomajas/geomajas-project-geometry | core/src/main/java/org/geomajas/geometry/service/GeometryService.java | GeometryService.getNumPoints | public static int getNumPoints(Geometry geometry) {
if (geometry == null) {
throw new IllegalArgumentException("Cannot get total number of points for null geometry.");
}
int count = 0;
if (geometry.getGeometries() != null) {
for (Geometry child : geometry.getGeometries()) {
count += getNumPoints(child... | java | public static int getNumPoints(Geometry geometry) {
if (geometry == null) {
throw new IllegalArgumentException("Cannot get total number of points for null geometry.");
}
int count = 0;
if (geometry.getGeometries() != null) {
for (Geometry child : geometry.getGeometries()) {
count += getNumPoints(child... | [
"public",
"static",
"int",
"getNumPoints",
"(",
"Geometry",
"geometry",
")",
"{",
"if",
"(",
"geometry",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Cannot get total number of points for null geometry.\"",
")",
";",
"}",
"int",
"count... | Return the total number of coordinates within the geometry. This add up all coordinates within the
sub-geometries.
@param geometry The geometry to calculate the total number of points for.
@return The total number of coordinates within this geometry. | [
"Return",
"the",
"total",
"number",
"of",
"coordinates",
"within",
"the",
"geometry",
".",
"This",
"add",
"up",
"all",
"coordinates",
"within",
"the",
"sub",
"-",
"geometries",
"."
] | 09a214fede69c9c01e41630828c4abbb551a557d | https://github.com/geomajas/geomajas-project-geometry/blob/09a214fede69c9c01e41630828c4abbb551a557d/core/src/main/java/org/geomajas/geometry/service/GeometryService.java#L176-L190 | train |
geomajas/geomajas-project-geometry | core/src/main/java/org/geomajas/geometry/service/GeometryService.java | GeometryService.isValid | public static boolean isValid(Geometry geometry, GeometryIndex index) {
validate(geometry, index);
return validationContext.isValid();
} | java | public static boolean isValid(Geometry geometry, GeometryIndex index) {
validate(geometry, index);
return validationContext.isValid();
} | [
"public",
"static",
"boolean",
"isValid",
"(",
"Geometry",
"geometry",
",",
"GeometryIndex",
"index",
")",
"{",
"validate",
"(",
"geometry",
",",
"index",
")",
";",
"return",
"validationContext",
".",
"isValid",
"(",
")",
";",
"}"
] | Validates a geometry, focusing on changes at a specific sub-level of the geometry. The sublevel is indicated by
passing an index. The only checks are on intersection and containment, we don't check on too few coordinates as
we want to support incremental creation of polygons.
@param geometry The geometry to check.
@pa... | [
"Validates",
"a",
"geometry",
"focusing",
"on",
"changes",
"at",
"a",
"specific",
"sub",
"-",
"level",
"of",
"the",
"geometry",
".",
"The",
"sublevel",
"is",
"indicated",
"by",
"passing",
"an",
"index",
".",
"The",
"only",
"checks",
"are",
"on",
"intersect... | 09a214fede69c9c01e41630828c4abbb551a557d | https://github.com/geomajas/geomajas-project-geometry/blob/09a214fede69c9c01e41630828c4abbb551a557d/core/src/main/java/org/geomajas/geometry/service/GeometryService.java#L276-L279 | train |
geomajas/geomajas-project-geometry | core/src/main/java/org/geomajas/geometry/service/GeometryService.java | GeometryService.validate | public static GeometryValidationState validate(Geometry geometry) {
validationContext.clear();
if (Geometry.LINE_STRING.equals(geometry.getGeometryType())) {
IndexedLineString lineString = helper.createLineString(geometry);
validateLineString(lineString);
} else if (Geometry.LINEAR_RING.equals(geometry.getG... | java | public static GeometryValidationState validate(Geometry geometry) {
validationContext.clear();
if (Geometry.LINE_STRING.equals(geometry.getGeometryType())) {
IndexedLineString lineString = helper.createLineString(geometry);
validateLineString(lineString);
} else if (Geometry.LINEAR_RING.equals(geometry.getG... | [
"public",
"static",
"GeometryValidationState",
"validate",
"(",
"Geometry",
"geometry",
")",
"{",
"validationContext",
".",
"clear",
"(",
")",
";",
"if",
"(",
"Geometry",
".",
"LINE_STRING",
".",
"equals",
"(",
"geometry",
".",
"getGeometryType",
"(",
")",
")"... | Validate this geometry.
@param geometry The geometry to check.
@return validation state.
@since 1.2.0 | [
"Validate",
"this",
"geometry",
"."
] | 09a214fede69c9c01e41630828c4abbb551a557d | https://github.com/geomajas/geomajas-project-geometry/blob/09a214fede69c9c01e41630828c4abbb551a557d/core/src/main/java/org/geomajas/geometry/service/GeometryService.java#L448-L467 | train |
geomajas/geomajas-project-geometry | core/src/main/java/org/geomajas/geometry/service/GeometryService.java | GeometryService.intersects | public static boolean intersects(Geometry one, Geometry two) {
if (one == null || two == null || isEmpty(one) || isEmpty(two)) {
return false;
}
if (Geometry.POINT.equals(one.getGeometryType())) {
return intersectsPoint(one, two);
} else if (Geometry.LINE_STRING.equals(one.getGeometryType())) {
return ... | java | public static boolean intersects(Geometry one, Geometry two) {
if (one == null || two == null || isEmpty(one) || isEmpty(two)) {
return false;
}
if (Geometry.POINT.equals(one.getGeometryType())) {
return intersectsPoint(one, two);
} else if (Geometry.LINE_STRING.equals(one.getGeometryType())) {
return ... | [
"public",
"static",
"boolean",
"intersects",
"(",
"Geometry",
"one",
",",
"Geometry",
"two",
")",
"{",
"if",
"(",
"one",
"==",
"null",
"||",
"two",
"==",
"null",
"||",
"isEmpty",
"(",
"one",
")",
"||",
"isEmpty",
"(",
"two",
")",
")",
"{",
"return",
... | Calculate whether or not two given geometries intersect each other.
@param one The first geometry to check for intersection with the second.
@param two The second geometry to check for intersection with the first.
@return Returns true or false. | [
"Calculate",
"whether",
"or",
"not",
"two",
"given",
"geometries",
"intersect",
"each",
"other",
"."
] | 09a214fede69c9c01e41630828c4abbb551a557d | https://github.com/geomajas/geomajas-project-geometry/blob/09a214fede69c9c01e41630828c4abbb551a557d/core/src/main/java/org/geomajas/geometry/service/GeometryService.java#L476-L502 | train |
geomajas/geomajas-project-geometry | core/src/main/java/org/geomajas/geometry/service/GeometryService.java | GeometryService.getLength | public static double getLength(Geometry geometry) {
double length = 0;
if (geometry.getGeometries() != null) {
for (Geometry child : geometry.getGeometries()) {
length += getLength(child);
}
}
if (geometry.getCoordinates() != null
&& (Geometry.LINE_STRING.equals(geometry.getGeometryType()) || Geom... | java | public static double getLength(Geometry geometry) {
double length = 0;
if (geometry.getGeometries() != null) {
for (Geometry child : geometry.getGeometries()) {
length += getLength(child);
}
}
if (geometry.getCoordinates() != null
&& (Geometry.LINE_STRING.equals(geometry.getGeometryType()) || Geom... | [
"public",
"static",
"double",
"getLength",
"(",
"Geometry",
"geometry",
")",
"{",
"double",
"length",
"=",
"0",
";",
"if",
"(",
"geometry",
".",
"getGeometries",
"(",
")",
"!=",
"null",
")",
"{",
"for",
"(",
"Geometry",
"child",
":",
"geometry",
".",
"... | Return the length of the geometry. This adds up the length of all edges within the geometry.
@param geometry The other geometry to calculate the length for.
@return The total length of all edges of the given geometry. | [
"Return",
"the",
"length",
"of",
"the",
"geometry",
".",
"This",
"adds",
"up",
"the",
"length",
"of",
"all",
"edges",
"within",
"the",
"geometry",
"."
] | 09a214fede69c9c01e41630828c4abbb551a557d | https://github.com/geomajas/geomajas-project-geometry/blob/09a214fede69c9c01e41630828c4abbb551a557d/core/src/main/java/org/geomajas/geometry/service/GeometryService.java#L520-L537 | train |
geomajas/geomajas-project-geometry | core/src/main/java/org/geomajas/geometry/service/GeometryService.java | GeometryService.getDistance | public static double getDistance(Geometry geometry, Coordinate coordinate) {
double minDistance = Double.MAX_VALUE;
if (coordinate != null && geometry != null) {
if (geometry.getGeometries() != null) {
for (Geometry child : geometry.getGeometries()) {
double distance = getDistance(child, coordinate);
... | java | public static double getDistance(Geometry geometry, Coordinate coordinate) {
double minDistance = Double.MAX_VALUE;
if (coordinate != null && geometry != null) {
if (geometry.getGeometries() != null) {
for (Geometry child : geometry.getGeometries()) {
double distance = getDistance(child, coordinate);
... | [
"public",
"static",
"double",
"getDistance",
"(",
"Geometry",
"geometry",
",",
"Coordinate",
"coordinate",
")",
"{",
"double",
"minDistance",
"=",
"Double",
".",
"MAX_VALUE",
";",
"if",
"(",
"coordinate",
"!=",
"null",
"&&",
"geometry",
"!=",
"null",
")",
"{... | Return the minimal distance between a coordinate and any vertex of a geometry.
@param geometry The other geometry to calculate the distance for.
@param coordinate The coordinate for which to calculate the distance to the geometry.
@return Return the minimal distance | [
"Return",
"the",
"minimal",
"distance",
"between",
"a",
"coordinate",
"and",
"any",
"vertex",
"of",
"a",
"geometry",
"."
] | 09a214fede69c9c01e41630828c4abbb551a557d | https://github.com/geomajas/geomajas-project-geometry/blob/09a214fede69c9c01e41630828c4abbb551a557d/core/src/main/java/org/geomajas/geometry/service/GeometryService.java#L572-L601 | train |
geomajas/geomajas-project-geometry | core/src/main/java/org/geomajas/geometry/service/GeometryService.java | GeometryService.intersectsPoint | private static boolean intersectsPoint(Geometry point, Geometry geometry) {
if (geometry.getGeometries() != null) {
for (Geometry child : geometry.getGeometries()) {
if (intersectsPoint(point, child)) {
return true;
}
}
}
if (geometry.getCoordinates() != null) {
Coordinate coordinate = point... | java | private static boolean intersectsPoint(Geometry point, Geometry geometry) {
if (geometry.getGeometries() != null) {
for (Geometry child : geometry.getGeometries()) {
if (intersectsPoint(point, child)) {
return true;
}
}
}
if (geometry.getCoordinates() != null) {
Coordinate coordinate = point... | [
"private",
"static",
"boolean",
"intersectsPoint",
"(",
"Geometry",
"point",
",",
"Geometry",
"geometry",
")",
"{",
"if",
"(",
"geometry",
".",
"getGeometries",
"(",
")",
"!=",
"null",
")",
"{",
"for",
"(",
"Geometry",
"child",
":",
"geometry",
".",
"getGe... | We assume neither is null or empty. | [
"We",
"assume",
"neither",
"is",
"null",
"or",
"empty",
"."
] | 09a214fede69c9c01e41630828c4abbb551a557d | https://github.com/geomajas/geomajas-project-geometry/blob/09a214fede69c9c01e41630828c4abbb551a557d/core/src/main/java/org/geomajas/geometry/service/GeometryService.java#L950-L973 | train |
eyp/serfj | src/main/java/net/sf/serfj/serializers/FileSerializer.java | FileSerializer.sendFile | public void sendFile(File file, OutputStream os) throws IOException {
FileInputStream is = null;
BufferedInputStream buf = null;;
try {
is = new FileInputStream(file);
buf = new BufferedInputStream(is);
int readBytes = 0;
if (LOGGER.isDebugEnabled(... | java | public void sendFile(File file, OutputStream os) throws IOException {
FileInputStream is = null;
BufferedInputStream buf = null;;
try {
is = new FileInputStream(file);
buf = new BufferedInputStream(is);
int readBytes = 0;
if (LOGGER.isDebugEnabled(... | [
"public",
"void",
"sendFile",
"(",
"File",
"file",
",",
"OutputStream",
"os",
")",
"throws",
"IOException",
"{",
"FileInputStream",
"is",
"=",
"null",
";",
"BufferedInputStream",
"buf",
"=",
"null",
";",
";",
"try",
"{",
"is",
"=",
"new",
"FileInputStream",
... | Write a file to an OuputStream.
@param file File that will be written.
@param os The target OutputStream.
@throws IOException if any error happens. | [
"Write",
"a",
"file",
"to",
"an",
"OuputStream",
"."
] | e617592af6f24e59ea58443f2785c44aa2312189 | https://github.com/eyp/serfj/blob/e617592af6f24e59ea58443f2785c44aa2312189/src/main/java/net/sf/serfj/serializers/FileSerializer.java#L54-L79 | train |
geomajas/geomajas-project-geometry | core/src/main/java/org/geomajas/geometry/service/WktService.java | WktService.toWkt | public static String toWkt(Geometry geometry) throws WktException {
if (Geometry.POINT.equals(geometry.getGeometryType())) {
return toWktPoint(geometry);
} else if (Geometry.LINE_STRING.equals(geometry.getGeometryType())
|| Geometry.LINEAR_RING.equals(geometry.getGeometryType())) {
return toWktLineString(... | java | public static String toWkt(Geometry geometry) throws WktException {
if (Geometry.POINT.equals(geometry.getGeometryType())) {
return toWktPoint(geometry);
} else if (Geometry.LINE_STRING.equals(geometry.getGeometryType())
|| Geometry.LINEAR_RING.equals(geometry.getGeometryType())) {
return toWktLineString(... | [
"public",
"static",
"String",
"toWkt",
"(",
"Geometry",
"geometry",
")",
"throws",
"WktException",
"{",
"if",
"(",
"Geometry",
".",
"POINT",
".",
"equals",
"(",
"geometry",
".",
"getGeometryType",
"(",
")",
")",
")",
"{",
"return",
"toWktPoint",
"(",
"geom... | Format a given geometry to Well Known Text.
@param geometry
The geometry to format.
@return Returns the WKT string.
@throws WktException
In case something went wrong while formatting. | [
"Format",
"a",
"given",
"geometry",
"to",
"Well",
"Known",
"Text",
"."
] | 09a214fede69c9c01e41630828c4abbb551a557d | https://github.com/geomajas/geomajas-project-geometry/blob/09a214fede69c9c01e41630828c4abbb551a557d/core/src/main/java/org/geomajas/geometry/service/WktService.java#L68-L84 | train |
geomajas/geomajas-project-geometry | core/src/main/java/org/geomajas/geometry/service/WktService.java | WktService.parseSrid | private static int parseSrid(String ewktPart) {
if (ewktPart != null && !"".equals(ewktPart)) {
String[] parts = ewktPart.split("=");
if (parts.length == 2) {
try {
return Integer.parseInt(parts[1]);
} catch (Exception e) {
}
}
}
return 0;
} | java | private static int parseSrid(String ewktPart) {
if (ewktPart != null && !"".equals(ewktPart)) {
String[] parts = ewktPart.split("=");
if (parts.length == 2) {
try {
return Integer.parseInt(parts[1]);
} catch (Exception e) {
}
}
}
return 0;
} | [
"private",
"static",
"int",
"parseSrid",
"(",
"String",
"ewktPart",
")",
"{",
"if",
"(",
"ewktPart",
"!=",
"null",
"&&",
"!",
"\"\"",
".",
"equals",
"(",
"ewktPart",
")",
")",
"{",
"String",
"[",
"]",
"parts",
"=",
"ewktPart",
".",
"split",
"(",
"\"=... | Get the SRID from a string like "SRDI=4326". Used in parsing EWKT. | [
"Get",
"the",
"SRID",
"from",
"a",
"string",
"like",
"SRDI",
"=",
"4326",
".",
"Used",
"in",
"parsing",
"EWKT",
"."
] | 09a214fede69c9c01e41630828c4abbb551a557d | https://github.com/geomajas/geomajas-project-geometry/blob/09a214fede69c9c01e41630828c4abbb551a557d/core/src/main/java/org/geomajas/geometry/service/WktService.java#L117-L128 | train |
geomajas/geomajas-project-geometry | core/src/main/java/org/geomajas/geometry/service/WktService.java | WktService.parseWkt | private static Geometry parseWkt(String wkt) throws WktException {
if (wkt != null) {
int i1 = wkt.indexOf('(');
int i2 = wkt.indexOf(' ');
// allow both '(' and ' ('
int i = Math.min(i1, i2);
if (i < 0) {
i = (i1 > 0 ? i1 : i2);
}
String type = null;
if (i >= 0) {
type = typeWktToGeom... | java | private static Geometry parseWkt(String wkt) throws WktException {
if (wkt != null) {
int i1 = wkt.indexOf('(');
int i2 = wkt.indexOf(' ');
// allow both '(' and ' ('
int i = Math.min(i1, i2);
if (i < 0) {
i = (i1 > 0 ? i1 : i2);
}
String type = null;
if (i >= 0) {
type = typeWktToGeom... | [
"private",
"static",
"Geometry",
"parseWkt",
"(",
"String",
"wkt",
")",
"throws",
"WktException",
"{",
"if",
"(",
"wkt",
"!=",
"null",
")",
"{",
"int",
"i1",
"=",
"wkt",
".",
"indexOf",
"(",
"'",
"'",
")",
";",
"int",
"i2",
"=",
"wkt",
".",
"indexO... | Parse a WKT string. No EWKT here! | [
"Parse",
"a",
"WKT",
"string",
".",
"No",
"EWKT",
"here!"
] | 09a214fede69c9c01e41630828c4abbb551a557d | https://github.com/geomajas/geomajas-project-geometry/blob/09a214fede69c9c01e41630828c4abbb551a557d/core/src/main/java/org/geomajas/geometry/service/WktService.java#L131-L158 | train |
btaz/data-util | src/main/java/com/btaz/util/xml/xmlpath/XmlPathParser.java | XmlPathParser.parse | public static XmlPath parse(String xmlPathQuery) {
// validations
if(xmlPathQuery == null) {
throw new XmlPathException("The XML path query can not be a null value");
}
xmlPathQuery = xmlPathQuery.trim();
// simple patterns
if(! xmlPathQuery.contains("/")) {
... | java | public static XmlPath parse(String xmlPathQuery) {
// validations
if(xmlPathQuery == null) {
throw new XmlPathException("The XML path query can not be a null value");
}
xmlPathQuery = xmlPathQuery.trim();
// simple patterns
if(! xmlPathQuery.contains("/")) {
... | [
"public",
"static",
"XmlPath",
"parse",
"(",
"String",
"xmlPathQuery",
")",
"{",
"// validations",
"if",
"(",
"xmlPathQuery",
"==",
"null",
")",
"{",
"throw",
"new",
"XmlPathException",
"(",
"\"The XML path query can not be a null value\"",
")",
";",
"}",
"xmlPathQu... | Parse XML path query
@param xmlPathQuery XML path query
@return @{code XmlPath} XML path | [
"Parse",
"XML",
"path",
"query"
] | f01de64854c456a88a31ffbe8bac6d605151b496 | https://github.com/btaz/data-util/blob/f01de64854c456a88a31ffbe8bac6d605151b496/src/main/java/com/btaz/util/xml/xmlpath/XmlPathParser.java#L18-L65 | train |
tvesalainen/bcc | src/main/java/org/vesalainen/bcc/model/Typ.java | Typ.getTypeNumber | public static int getTypeNumber(TypeKind kind)
{
switch (kind)
{
case BOOLEAN:
case BYTE:
case CHAR:
case SHORT:
case INT:
case LONG:
case FLOAT:
case DOUBLE:
case VOID:
return... | java | public static int getTypeNumber(TypeKind kind)
{
switch (kind)
{
case BOOLEAN:
case BYTE:
case CHAR:
case SHORT:
case INT:
case LONG:
case FLOAT:
case DOUBLE:
case VOID:
return... | [
"public",
"static",
"int",
"getTypeNumber",
"(",
"TypeKind",
"kind",
")",
"{",
"switch",
"(",
"kind",
")",
"{",
"case",
"BOOLEAN",
":",
"case",
"BYTE",
":",
"case",
"CHAR",
":",
"case",
"SHORT",
":",
"case",
"INT",
":",
"case",
"LONG",
":",
"case",
"... | Returns TypeKind ordinal for primitive types and DECLARED ordinal for DECLARED, ARRAY and TYPEVAR
@param kind
@return | [
"Returns",
"TypeKind",
"ordinal",
"for",
"primitive",
"types",
"and",
"DECLARED",
"ordinal",
"for",
"DECLARED",
"ARRAY",
"and",
"TYPEVAR"
] | 4e84e313018d487f1a8cca3952d71bc21e77d16b | https://github.com/tvesalainen/bcc/blob/4e84e313018d487f1a8cca3952d71bc21e77d16b/src/main/java/org/vesalainen/bcc/model/Typ.java#L113-L134 | train |
tvesalainen/bcc | src/main/java/org/vesalainen/bcc/model/Typ.java | Typ.normalizeType | public static TypeMirror normalizeType(TypeKind kind)
{
switch (kind)
{
case BOOLEAN:
case BYTE:
case CHAR:
case SHORT:
case INT:
case LONG:
case FLOAT:
case DOUBLE:
return Typ.getPrimitiv... | java | public static TypeMirror normalizeType(TypeKind kind)
{
switch (kind)
{
case BOOLEAN:
case BYTE:
case CHAR:
case SHORT:
case INT:
case LONG:
case FLOAT:
case DOUBLE:
return Typ.getPrimitiv... | [
"public",
"static",
"TypeMirror",
"normalizeType",
"(",
"TypeKind",
"kind",
")",
"{",
"switch",
"(",
"kind",
")",
"{",
"case",
"BOOLEAN",
":",
"case",
"BYTE",
":",
"case",
"CHAR",
":",
"case",
"SHORT",
":",
"case",
"INT",
":",
"case",
"LONG",
":",
"cas... | Returns primitive type for primitive and java.lang.Object type for references
@param kind
@return | [
"Returns",
"primitive",
"type",
"for",
"primitive",
"and",
"java",
".",
"lang",
".",
"Object",
"type",
"for",
"references"
] | 4e84e313018d487f1a8cca3952d71bc21e77d16b | https://github.com/tvesalainen/bcc/blob/4e84e313018d487f1a8cca3952d71bc21e77d16b/src/main/java/org/vesalainen/bcc/model/Typ.java#L140-L162 | train |
tvesalainen/bcc | src/main/java/org/vesalainen/bcc/model/Typ.java | Typ.isInteger | public static boolean isInteger(TypeMirror type)
{
switch (type.getKind())
{
case INT:
case SHORT:
case CHAR:
case BYTE:
case BOOLEAN:
return true;
default:
return false;
}
} | java | public static boolean isInteger(TypeMirror type)
{
switch (type.getKind())
{
case INT:
case SHORT:
case CHAR:
case BYTE:
case BOOLEAN:
return true;
default:
return false;
}
} | [
"public",
"static",
"boolean",
"isInteger",
"(",
"TypeMirror",
"type",
")",
"{",
"switch",
"(",
"type",
".",
"getKind",
"(",
")",
")",
"{",
"case",
"INT",
":",
"case",
"SHORT",
":",
"case",
"CHAR",
":",
"case",
"BYTE",
":",
"case",
"BOOLEAN",
":",
"r... | Returns true if type is one of int, short, char, byte or boolean
@param type
@return | [
"Returns",
"true",
"if",
"type",
"is",
"one",
"of",
"int",
"short",
"char",
"byte",
"or",
"boolean"
] | 4e84e313018d487f1a8cca3952d71bc21e77d16b | https://github.com/tvesalainen/bcc/blob/4e84e313018d487f1a8cca3952d71bc21e77d16b/src/main/java/org/vesalainen/bcc/model/Typ.java#L477-L490 | train |
tvesalainen/bcc | src/main/java/org/vesalainen/bcc/model/Typ.java | Typ.isJavaConstantType | public static boolean isJavaConstantType(TypeMirror type)
{
switch (type.getKind())
{
case INT:
case LONG:
case FLOAT:
case DOUBLE:
return true;
case DECLARED:
DeclaredType dt = (DeclaredType) type;
... | java | public static boolean isJavaConstantType(TypeMirror type)
{
switch (type.getKind())
{
case INT:
case LONG:
case FLOAT:
case DOUBLE:
return true;
case DECLARED:
DeclaredType dt = (DeclaredType) type;
... | [
"public",
"static",
"boolean",
"isJavaConstantType",
"(",
"TypeMirror",
"type",
")",
"{",
"switch",
"(",
"type",
".",
"getKind",
"(",
")",
")",
"{",
"case",
"INT",
":",
"case",
"LONG",
":",
"case",
"FLOAT",
":",
"case",
"DOUBLE",
":",
"return",
"true",
... | Returns true if type is one of int, long, float, double or java.lang.String
@param type
@return | [
"Returns",
"true",
"if",
"type",
"is",
"one",
"of",
"int",
"long",
"float",
"double",
"or",
"java",
".",
"lang",
".",
"String"
] | 4e84e313018d487f1a8cca3952d71bc21e77d16b | https://github.com/tvesalainen/bcc/blob/4e84e313018d487f1a8cca3952d71bc21e77d16b/src/main/java/org/vesalainen/bcc/model/Typ.java#L496-L512 | train |
tvesalainen/bcc | src/main/java/org/vesalainen/bcc/model/Typ.java | Typ.convert | public static Object convert(String constant, TypeKind kind)
{
switch (kind)
{
case INT:
return Integer.parseInt(constant);
case LONG:
return java.lang.Long.parseLong(constant);
case FLOAT:
return java.lang.Float.par... | java | public static Object convert(String constant, TypeKind kind)
{
switch (kind)
{
case INT:
return Integer.parseInt(constant);
case LONG:
return java.lang.Long.parseLong(constant);
case FLOAT:
return java.lang.Float.par... | [
"public",
"static",
"Object",
"convert",
"(",
"String",
"constant",
",",
"TypeKind",
"kind",
")",
"{",
"switch",
"(",
"kind",
")",
"{",
"case",
"INT",
":",
"return",
"Integer",
".",
"parseInt",
"(",
"constant",
")",
";",
"case",
"LONG",
":",
"return",
... | Returns a Object of type type converted from constant
@param constant
@param kind
@return | [
"Returns",
"a",
"Object",
"of",
"type",
"type",
"converted",
"from",
"constant"
] | 4e84e313018d487f1a8cca3952d71bc21e77d16b | https://github.com/tvesalainen/bcc/blob/4e84e313018d487f1a8cca3952d71bc21e77d16b/src/main/java/org/vesalainen/bcc/model/Typ.java#L519-L534 | train |
fcrepo4-labs/fcrepo4-client | fcrepo-client-impl/src/main/java/org/fcrepo/client/impl/FedoraObjectImpl.java | FedoraObjectImpl.getChildren | public Collection<FedoraResource> getChildren(final String mixin) throws FedoraException {
Node mixinLiteral = null;
if ( mixin != null ) {
mixinLiteral = NodeFactory.createLiteral(mixin);
}
final ExtendedIterator<Triple> it = graph.find(Node.ANY, CONTAINS.asNode(), Node.ANY)... | java | public Collection<FedoraResource> getChildren(final String mixin) throws FedoraException {
Node mixinLiteral = null;
if ( mixin != null ) {
mixinLiteral = NodeFactory.createLiteral(mixin);
}
final ExtendedIterator<Triple> it = graph.find(Node.ANY, CONTAINS.asNode(), Node.ANY)... | [
"public",
"Collection",
"<",
"FedoraResource",
">",
"getChildren",
"(",
"final",
"String",
"mixin",
")",
"throws",
"FedoraException",
"{",
"Node",
"mixinLiteral",
"=",
"null",
";",
"if",
"(",
"mixin",
"!=",
"null",
")",
"{",
"mixinLiteral",
"=",
"NodeFactory",... | Get the Object and Datastream nodes that are children of the current Object.
@param mixin If not null, limit to results that have this mixin. | [
"Get",
"the",
"Object",
"and",
"Datastream",
"nodes",
"that",
"are",
"children",
"of",
"the",
"current",
"Object",
"."
] | 21eaf27200c5b2542095f6ebb9dd8ec865b95bbd | https://github.com/fcrepo4-labs/fcrepo4-client/blob/21eaf27200c5b2542095f6ebb9dd8ec865b95bbd/fcrepo-client-impl/src/main/java/org/fcrepo/client/impl/FedoraObjectImpl.java#L61-L81 | train |
aehrc/ontology-core | ontology-model/src/main/java/au/csiro/ontology/util/Statistics.java | Statistics.getTime | public long getTime(String name) {
Long res = stats.get(name);
return (res == null) ? -1 : res.longValue();
} | java | public long getTime(String name) {
Long res = stats.get(name);
return (res == null) ? -1 : res.longValue();
} | [
"public",
"long",
"getTime",
"(",
"String",
"name",
")",
"{",
"Long",
"res",
"=",
"stats",
".",
"get",
"(",
"name",
")",
";",
"return",
"(",
"res",
"==",
"null",
")",
"?",
"-",
"1",
":",
"res",
".",
"longValue",
"(",
")",
";",
"}"
] | Gets a time for a performance measurement. If no measurement with the
specified name exists then it returns -1.
@param name
@return | [
"Gets",
"a",
"time",
"for",
"a",
"performance",
"measurement",
".",
"If",
"no",
"measurement",
"with",
"the",
"specified",
"name",
"exists",
"then",
"it",
"returns",
"-",
"1",
"."
] | 446aa691119f2bbcb8d184566084b8da7a07a44e | https://github.com/aehrc/ontology-core/blob/446aa691119f2bbcb8d184566084b8da7a07a44e/ontology-model/src/main/java/au/csiro/ontology/util/Statistics.java#L53-L56 | train |
aehrc/ontology-core | ontology-model/src/main/java/au/csiro/ontology/util/Statistics.java | Statistics.getStatistics | public String getStatistics() {
StringBuilder sb = new StringBuilder();
for(String key : stats.keySet()) {
sb.append(key);
sb.append(": ");
sb.append(stats.get(key));
sb.append("\n");
}
return sb.toString();
} | java | public String getStatistics() {
StringBuilder sb = new StringBuilder();
for(String key : stats.keySet()) {
sb.append(key);
sb.append(": ");
sb.append(stats.get(key));
sb.append("\n");
}
return sb.toString();
} | [
"public",
"String",
"getStatistics",
"(",
")",
"{",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"for",
"(",
"String",
"key",
":",
"stats",
".",
"keySet",
"(",
")",
")",
"{",
"sb",
".",
"append",
"(",
"key",
")",
";",
"sb",
".... | Returns a string with all the current statistics.
@return | [
"Returns",
"a",
"string",
"with",
"all",
"the",
"current",
"statistics",
"."
] | 446aa691119f2bbcb8d184566084b8da7a07a44e | https://github.com/aehrc/ontology-core/blob/446aa691119f2bbcb8d184566084b8da7a07a44e/ontology-model/src/main/java/au/csiro/ontology/util/Statistics.java#L71-L82 | train |
NessComputing/components-ness-jdbi | src/main/java/com/nesscomputing/jdbi/JdbiMappers.java | JdbiMappers.getDateTime | public static DateTime getDateTime(final ResultSet rs, final String columnName) throws SQLException
{
final Timestamp ts = rs.getTimestamp(columnName);
return (ts == null) ? null : new DateTime(ts);
} | java | public static DateTime getDateTime(final ResultSet rs, final String columnName) throws SQLException
{
final Timestamp ts = rs.getTimestamp(columnName);
return (ts == null) ? null : new DateTime(ts);
} | [
"public",
"static",
"DateTime",
"getDateTime",
"(",
"final",
"ResultSet",
"rs",
",",
"final",
"String",
"columnName",
")",
"throws",
"SQLException",
"{",
"final",
"Timestamp",
"ts",
"=",
"rs",
".",
"getTimestamp",
"(",
"columnName",
")",
";",
"return",
"(",
... | Returns a DateTime object representing the date or null if the input is null. | [
"Returns",
"a",
"DateTime",
"object",
"representing",
"the",
"date",
"or",
"null",
"if",
"the",
"input",
"is",
"null",
"."
] | d446217b6f29b5409e55c5e72172cf0dbeacfec3 | https://github.com/NessComputing/components-ness-jdbi/blob/d446217b6f29b5409e55c5e72172cf0dbeacfec3/src/main/java/com/nesscomputing/jdbi/JdbiMappers.java#L73-L78 | train |
NessComputing/components-ness-jdbi | src/main/java/com/nesscomputing/jdbi/JdbiMappers.java | JdbiMappers.getUTCDateTime | public static DateTime getUTCDateTime(final ResultSet rs, final String columnName) throws SQLException
{
final Timestamp ts = rs.getTimestamp(columnName);
return (ts == null) ? null : new DateTime(ts).withZone(DateTimeZone.UTC);
} | java | public static DateTime getUTCDateTime(final ResultSet rs, final String columnName) throws SQLException
{
final Timestamp ts = rs.getTimestamp(columnName);
return (ts == null) ? null : new DateTime(ts).withZone(DateTimeZone.UTC);
} | [
"public",
"static",
"DateTime",
"getUTCDateTime",
"(",
"final",
"ResultSet",
"rs",
",",
"final",
"String",
"columnName",
")",
"throws",
"SQLException",
"{",
"final",
"Timestamp",
"ts",
"=",
"rs",
".",
"getTimestamp",
"(",
"columnName",
")",
";",
"return",
"(",... | Returns a DateTime object representing the date in UTC or null if the input is null. | [
"Returns",
"a",
"DateTime",
"object",
"representing",
"the",
"date",
"in",
"UTC",
"or",
"null",
"if",
"the",
"input",
"is",
"null",
"."
] | d446217b6f29b5409e55c5e72172cf0dbeacfec3 | https://github.com/NessComputing/components-ness-jdbi/blob/d446217b6f29b5409e55c5e72172cf0dbeacfec3/src/main/java/com/nesscomputing/jdbi/JdbiMappers.java#L91-L96 | train |
NessComputing/components-ness-jdbi | src/main/java/com/nesscomputing/jdbi/JdbiMappers.java | JdbiMappers.getEnum | public static <T extends Enum<T>> T getEnum(final ResultSet rs, final Class<T> enumType, final String columnName) throws SQLException
{
final String str = rs.getString(columnName);
return (str == null) ? null : Enum.valueOf(enumType, str);
} | java | public static <T extends Enum<T>> T getEnum(final ResultSet rs, final Class<T> enumType, final String columnName) throws SQLException
{
final String str = rs.getString(columnName);
return (str == null) ? null : Enum.valueOf(enumType, str);
} | [
"public",
"static",
"<",
"T",
"extends",
"Enum",
"<",
"T",
">",
">",
"T",
"getEnum",
"(",
"final",
"ResultSet",
"rs",
",",
"final",
"Class",
"<",
"T",
">",
"enumType",
",",
"final",
"String",
"columnName",
")",
"throws",
"SQLException",
"{",
"final",
"... | Returns an Enum representing the data or null if the input is null. | [
"Returns",
"an",
"Enum",
"representing",
"the",
"data",
"or",
"null",
"if",
"the",
"input",
"is",
"null",
"."
] | d446217b6f29b5409e55c5e72172cf0dbeacfec3 | https://github.com/NessComputing/components-ness-jdbi/blob/d446217b6f29b5409e55c5e72172cf0dbeacfec3/src/main/java/com/nesscomputing/jdbi/JdbiMappers.java#L108-L113 | train |
eyp/serfj | src/main/java/net/sf/serfj/ServletHelper.java | ServletHelper.methodExists | private Method methodExists(Class<?> clazz, String method, Class<?>[] params) {
try {
return clazz.getMethod(method, params);
} catch (NoSuchMethodException e) {
return null;
}
} | java | private Method methodExists(Class<?> clazz, String method, Class<?>[] params) {
try {
return clazz.getMethod(method, params);
} catch (NoSuchMethodException e) {
return null;
}
} | [
"private",
"Method",
"methodExists",
"(",
"Class",
"<",
"?",
">",
"clazz",
",",
"String",
"method",
",",
"Class",
"<",
"?",
">",
"[",
"]",
"params",
")",
"{",
"try",
"{",
"return",
"clazz",
".",
"getMethod",
"(",
"method",
",",
"params",
")",
";",
... | Checks if a class method exists.
@param clazz
Class.
@param method
Method.
@param params
Method's params.
@return the method, or null if it doesn't exist. | [
"Checks",
"if",
"a",
"class",
"method",
"exists",
"."
] | e617592af6f24e59ea58443f2785c44aa2312189 | https://github.com/eyp/serfj/blob/e617592af6f24e59ea58443f2785c44aa2312189/src/main/java/net/sf/serfj/ServletHelper.java#L116-L122 | train |
eyp/serfj | src/main/java/net/sf/serfj/ServletHelper.java | ServletHelper.invokeAction | private Object invokeAction(Object clazz, Method method, UrlInfo urlInfo, Object... args) throws IllegalAccessException, InvocationTargetException {
if (this.isRequestMethodServed(method, urlInfo.getRequestMethod())) {
return method.invoke(clazz, args);
} else {
throw new IllegalArgumentException("Method " + ... | java | private Object invokeAction(Object clazz, Method method, UrlInfo urlInfo, Object... args) throws IllegalAccessException, InvocationTargetException {
if (this.isRequestMethodServed(method, urlInfo.getRequestMethod())) {
return method.invoke(clazz, args);
} else {
throw new IllegalArgumentException("Method " + ... | [
"private",
"Object",
"invokeAction",
"(",
"Object",
"clazz",
",",
"Method",
"method",
",",
"UrlInfo",
"urlInfo",
",",
"Object",
"...",
"args",
")",
"throws",
"IllegalAccessException",
",",
"InvocationTargetException",
"{",
"if",
"(",
"this",
".",
"isRequestMethodS... | Invokes a method checking previously if that method accepts requests
using a particular HTTP_METHOD.
@param clazz
A class.
@param method
A method to invoke.
@param urlInfo
URL information extracted by the framework.
@param args
Arguments for the method which will be invoked.
@return the object returned by the method o... | [
"Invokes",
"a",
"method",
"checking",
"previously",
"if",
"that",
"method",
"accepts",
"requests",
"using",
"a",
"particular",
"HTTP_METHOD",
"."
] | e617592af6f24e59ea58443f2785c44aa2312189 | https://github.com/eyp/serfj/blob/e617592af6f24e59ea58443f2785c44aa2312189/src/main/java/net/sf/serfj/ServletHelper.java#L264-L270 | train |
passwordmaker/java-passwordmaker-lib | src/main/java/org/daveware/passwordmaker/PasswordMaker.java | PasswordMaker.makePassword | public SecureUTF8String makePassword(final SecureUTF8String masterPassword, final Account account, final String inputText)
throws Exception {
return makePassword(masterPassword, account, inputText, account.getUsername());
} | java | public SecureUTF8String makePassword(final SecureUTF8String masterPassword, final Account account, final String inputText)
throws Exception {
return makePassword(masterPassword, account, inputText, account.getUsername());
} | [
"public",
"SecureUTF8String",
"makePassword",
"(",
"final",
"SecureUTF8String",
"masterPassword",
",",
"final",
"Account",
"account",
",",
"final",
"String",
"inputText",
")",
"throws",
"Exception",
"{",
"return",
"makePassword",
"(",
"masterPassword",
",",
"account",... | Generates a hash of the master password with settings from the account.
It will use the username assigned to the account.
@param masterPassword The password to use as a key for the various algorithms.
@param account The account with the specific settings for the hash.
@param inputText The text to use as th... | [
"Generates",
"a",
"hash",
"of",
"the",
"master",
"password",
"with",
"settings",
"from",
"the",
"account",
".",
"It",
"will",
"use",
"the",
"username",
"assigned",
"to",
"the",
"account",
"."
] | 18c22fca7dd9a47f08161425b85a5bd257afbb2b | https://github.com/passwordmaker/java-passwordmaker-lib/blob/18c22fca7dd9a47f08161425b85a5bd257afbb2b/src/main/java/org/daveware/passwordmaker/PasswordMaker.java#L377-L381 | train |
passwordmaker/java-passwordmaker-lib | src/main/java/org/daveware/passwordmaker/PasswordMaker.java | PasswordMaker.hashTheData | private SecureUTF8String hashTheData(SecureUTF8String masterPassword, SecureUTF8String data, Account account)
throws Exception {
final SecureUTF8String output = new SecureUTF8String();
final SecureUTF8String secureIteration = new SecureUTF8String();
SecureUTF8String intermediateOutpu... | java | private SecureUTF8String hashTheData(SecureUTF8String masterPassword, SecureUTF8String data, Account account)
throws Exception {
final SecureUTF8String output = new SecureUTF8String();
final SecureUTF8String secureIteration = new SecureUTF8String();
SecureUTF8String intermediateOutpu... | [
"private",
"SecureUTF8String",
"hashTheData",
"(",
"SecureUTF8String",
"masterPassword",
",",
"SecureUTF8String",
"data",
",",
"Account",
"account",
")",
"throws",
"Exception",
"{",
"final",
"SecureUTF8String",
"output",
"=",
"new",
"SecureUTF8String",
"(",
")",
";",
... | Intermediate step of generating a password. Performs constant hashing until
the resulting hash is long enough.
@param masterPassword You should know by now.
@param data Not much has changed.
@param account A donut?
@return A suitable hash.
@throws Exception if we ran out of donuts. | [
"Intermediate",
"step",
"of",
"generating",
"a",
"password",
".",
"Performs",
"constant",
"hashing",
"until",
"the",
"resulting",
"hash",
"is",
"long",
"enough",
"."
] | 18c22fca7dd9a47f08161425b85a5bd257afbb2b | https://github.com/passwordmaker/java-passwordmaker-lib/blob/18c22fca7dd9a47f08161425b85a5bd257afbb2b/src/main/java/org/daveware/passwordmaker/PasswordMaker.java#L410-L447 | train |
passwordmaker/java-passwordmaker-lib | src/main/java/org/daveware/passwordmaker/PasswordMaker.java | PasswordMaker.runAlgorithm | private SecureUTF8String runAlgorithm(SecureUTF8String masterPassword, SecureUTF8String data, Account account)
throws Exception {
SecureUTF8String output = null;
SecureCharArray digestChars = null;
SecureByteArray masterPasswordBytes = null;
SecureByteArray dataBytes = null;
... | java | private SecureUTF8String runAlgorithm(SecureUTF8String masterPassword, SecureUTF8String data, Account account)
throws Exception {
SecureUTF8String output = null;
SecureCharArray digestChars = null;
SecureByteArray masterPasswordBytes = null;
SecureByteArray dataBytes = null;
... | [
"private",
"SecureUTF8String",
"runAlgorithm",
"(",
"SecureUTF8String",
"masterPassword",
",",
"SecureUTF8String",
"data",
",",
"Account",
"account",
")",
"throws",
"Exception",
"{",
"SecureUTF8String",
"output",
"=",
"null",
";",
"SecureCharArray",
"digestChars",
"=",
... | This performs the actual hashing. It obtains an instance of the hashing algorithm
and feeds in the necessary data.
@param masterPassword The master password to use as a key.
@param data The data to be hashed.
@param account The account with the hash settings to use.
@return A SecureCharArray of the ha... | [
"This",
"performs",
"the",
"actual",
"hashing",
".",
"It",
"obtains",
"an",
"instance",
"of",
"the",
"hashing",
"algorithm",
"and",
"feeds",
"in",
"the",
"necessary",
"data",
"."
] | 18c22fca7dd9a47f08161425b85a5bd257afbb2b | https://github.com/passwordmaker/java-passwordmaker-lib/blob/18c22fca7dd9a47f08161425b85a5bd257afbb2b/src/main/java/org/daveware/passwordmaker/PasswordMaker.java#L459-L505 | train |
Teddy-Zhu/SilentGo | framework/src/main/java/com/silentgo/servlet/oreilly/multipart/BufferedServletInputStream.java | BufferedServletInputStream.fill | private void fill() throws IOException {
int i = in.read(buf, 0, buf.length);
if (i > 0) {
pos = 0;
count = i;
}
} | java | private void fill() throws IOException {
int i = in.read(buf, 0, buf.length);
if (i > 0) {
pos = 0;
count = i;
}
} | [
"private",
"void",
"fill",
"(",
")",
"throws",
"IOException",
"{",
"int",
"i",
"=",
"in",
".",
"read",
"(",
"buf",
",",
"0",
",",
"buf",
".",
"length",
")",
";",
"if",
"(",
"i",
">",
"0",
")",
"{",
"pos",
"=",
"0",
";",
"count",
"=",
"i",
"... | Fill up our buffer from the underlying input stream. Users of this
method must ensure that they use all characters in the buffer before
calling this method.
@exception IOException if an I/O error occurs. | [
"Fill",
"up",
"our",
"buffer",
"from",
"the",
"underlying",
"input",
"stream",
".",
"Users",
"of",
"this",
"method",
"must",
"ensure",
"that",
"they",
"use",
"all",
"characters",
"in",
"the",
"buffer",
"before",
"calling",
"this",
"method",
"."
] | 27f58b0cafe56b2eb9fc6993efa9ca2b529661e1 | https://github.com/Teddy-Zhu/SilentGo/blob/27f58b0cafe56b2eb9fc6993efa9ca2b529661e1/framework/src/main/java/com/silentgo/servlet/oreilly/multipart/BufferedServletInputStream.java#L64-L70 | train |
aehrc/ontology-core | ontology-import/src/main/java/au/csiro/ontology/importer/rf2/RF2Importer.java | RF2Importer.populateCDs | protected void populateCDs(Map<String, List<String[]>> cdMap, String referencedComponentId, String featureId,
String operator, String value, String unit) {
List<String[]> list;
// my ( $comp, $feature, $op, $value, $unit ) = @_;
if (!cdMap.containsKey(referencedComponentId)) {
... | java | protected void populateCDs(Map<String, List<String[]>> cdMap, String referencedComponentId, String featureId,
String operator, String value, String unit) {
List<String[]> list;
// my ( $comp, $feature, $op, $value, $unit ) = @_;
if (!cdMap.containsKey(referencedComponentId)) {
... | [
"protected",
"void",
"populateCDs",
"(",
"Map",
"<",
"String",
",",
"List",
"<",
"String",
"[",
"]",
">",
">",
"cdMap",
",",
"String",
"referencedComponentId",
",",
"String",
"featureId",
",",
"String",
"operator",
",",
"String",
"value",
",",
"String",
"u... | Populates concrete domains information.
@param cdMap
@param referencedComponentId
@param featureId
@param operator
@param value
@param unit | [
"Populates",
"concrete",
"domains",
"information",
"."
] | 446aa691119f2bbcb8d184566084b8da7a07a44e | https://github.com/aehrc/ontology-core/blob/446aa691119f2bbcb8d184566084b8da7a07a44e/ontology-import/src/main/java/au/csiro/ontology/importer/rf2/RF2Importer.java#L187-L198 | train |
aehrc/ontology-core | ontology-import/src/main/java/au/csiro/ontology/importer/rf2/RF2Importer.java | RF2Importer.getOntologyBuilder | protected OntologyBuilder getOntologyBuilder(VersionRows vr, String rootModuleId, String rootModuleVersion,
Map<String, String> metadata) {
return new OntologyBuilder(vr, rootModuleId, rootModuleVersion, metadata);
} | java | protected OntologyBuilder getOntologyBuilder(VersionRows vr, String rootModuleId, String rootModuleVersion,
Map<String, String> metadata) {
return new OntologyBuilder(vr, rootModuleId, rootModuleVersion, metadata);
} | [
"protected",
"OntologyBuilder",
"getOntologyBuilder",
"(",
"VersionRows",
"vr",
",",
"String",
"rootModuleId",
",",
"String",
"rootModuleVersion",
",",
"Map",
"<",
"String",
",",
"String",
">",
"metadata",
")",
"{",
"return",
"new",
"OntologyBuilder",
"(",
"vr",
... | Hook method for subclasses to override.
@param vr
@param rootModuleId
@param rootModuleVersion
@param includeInactiveAxioms
@return | [
"Hook",
"method",
"for",
"subclasses",
"to",
"override",
"."
] | 446aa691119f2bbcb8d184566084b8da7a07a44e | https://github.com/aehrc/ontology-core/blob/446aa691119f2bbcb8d184566084b8da7a07a44e/ontology-import/src/main/java/au/csiro/ontology/importer/rf2/RF2Importer.java#L663-L666 | train |
btaz/data-util | src/main/java/com/btaz/util/files/FileSorter.java | FileSorter.sort | public static List<File> sort(File sortDir, List<File> files, Comparator<String> comparator) {
// validations
if(sortDir == null) {
throw new DataUtilException("The sort directory parameter can't be a null value");
} else if(!sortDir.exists()) {
throw new DataUtilExceptio... | java | public static List<File> sort(File sortDir, List<File> files, Comparator<String> comparator) {
// validations
if(sortDir == null) {
throw new DataUtilException("The sort directory parameter can't be a null value");
} else if(!sortDir.exists()) {
throw new DataUtilExceptio... | [
"public",
"static",
"List",
"<",
"File",
">",
"sort",
"(",
"File",
"sortDir",
",",
"List",
"<",
"File",
">",
"files",
",",
"Comparator",
"<",
"String",
">",
"comparator",
")",
"{",
"// validations",
"if",
"(",
"sortDir",
"==",
"null",
")",
"{",
"throw"... | This method sorts every file in a list of input files
@param sortDir directory to provide the sorting in. If null, then system temp directory is used.
@param files files to sort
@param comparator comparator to use for sorting | [
"This",
"method",
"sorts",
"every",
"file",
"in",
"a",
"list",
"of",
"input",
"files"
] | f01de64854c456a88a31ffbe8bac6d605151b496 | https://github.com/btaz/data-util/blob/f01de64854c456a88a31ffbe8bac6d605151b496/src/main/java/com/btaz/util/files/FileSorter.java#L22-L91 | train |
FlyingHe/UtilsMaven | src/main/java/com/github/flyinghe/depdcy/FormatTrackingHSSFListenerPlus.java | FormatTrackingHSSFListenerPlus.processRecordInternally | public void processRecordInternally(Record record) {
if (record instanceof FormatRecord) {
FormatRecord fr = (FormatRecord) record;
_customFormatRecords.put(Integer.valueOf(fr.getIndexCode()), fr);
}
if (record instanceof ExtendedFormatRecord) {
ExtendedFormat... | java | public void processRecordInternally(Record record) {
if (record instanceof FormatRecord) {
FormatRecord fr = (FormatRecord) record;
_customFormatRecords.put(Integer.valueOf(fr.getIndexCode()), fr);
}
if (record instanceof ExtendedFormatRecord) {
ExtendedFormat... | [
"public",
"void",
"processRecordInternally",
"(",
"Record",
"record",
")",
"{",
"if",
"(",
"record",
"instanceof",
"FormatRecord",
")",
"{",
"FormatRecord",
"fr",
"=",
"(",
"FormatRecord",
")",
"record",
";",
"_customFormatRecords",
".",
"put",
"(",
"Integer",
... | Process the record ourselves, but do not pass it on to the child
Listener.
@param record the record to be processed | [
"Process",
"the",
"record",
"ourselves",
"but",
"do",
"not",
"pass",
"it",
"on",
"to",
"the",
"child",
"Listener",
"."
] | d9605b7bfe0c28a05289252e12d163e114080b4a | https://github.com/FlyingHe/UtilsMaven/blob/d9605b7bfe0c28a05289252e12d163e114080b4a/src/main/java/com/github/flyinghe/depdcy/FormatTrackingHSSFListenerPlus.java#L96-L105 | train |
FlyingHe/UtilsMaven | src/main/java/com/github/flyinghe/depdcy/FormatTrackingHSSFListenerPlus.java | FormatTrackingHSSFListenerPlus.getFormatIndex | public int getFormatIndex(CellValueRecordInterface cell) {
ExtendedFormatRecord xfr = _xfRecords.get(cell.getXFIndex());
if (xfr == null) {
logger.log(POILogger.ERROR, "Cell " + cell.getRow() + "," + cell.getColumn()
+ " uses XF with index " + cell.getXFIndex() + ", but we do... | java | public int getFormatIndex(CellValueRecordInterface cell) {
ExtendedFormatRecord xfr = _xfRecords.get(cell.getXFIndex());
if (xfr == null) {
logger.log(POILogger.ERROR, "Cell " + cell.getRow() + "," + cell.getColumn()
+ " uses XF with index " + cell.getXFIndex() + ", but we do... | [
"public",
"int",
"getFormatIndex",
"(",
"CellValueRecordInterface",
"cell",
")",
"{",
"ExtendedFormatRecord",
"xfr",
"=",
"_xfRecords",
".",
"get",
"(",
"cell",
".",
"getXFIndex",
"(",
")",
")",
";",
"if",
"(",
"xfr",
"==",
"null",
")",
"{",
"logger",
".",... | Returns the index of the format string, used by your cell, or -1 if none found
@param cell the cell
@return the index of the format string | [
"Returns",
"the",
"index",
"of",
"the",
"format",
"string",
"used",
"by",
"your",
"cell",
"or",
"-",
"1",
"if",
"none",
"found"
] | d9605b7bfe0c28a05289252e12d163e114080b4a | https://github.com/FlyingHe/UtilsMaven/blob/d9605b7bfe0c28a05289252e12d163e114080b4a/src/main/java/com/github/flyinghe/depdcy/FormatTrackingHSSFListenerPlus.java#L210-L218 | train |
btaz/data-util | src/main/java/com/btaz/util/tf/Template.java | Template.readResourceAsStream | public static String readResourceAsStream(String path) {
try {
InputStream inputStream = ResourceUtil.getResourceAsStream(path);
return ResourceUtil.readFromInputStreamIntoString(inputStream);
} catch (Exception e) {
throw new DataUtilException("Failed to load resourc... | java | public static String readResourceAsStream(String path) {
try {
InputStream inputStream = ResourceUtil.getResourceAsStream(path);
return ResourceUtil.readFromInputStreamIntoString(inputStream);
} catch (Exception e) {
throw new DataUtilException("Failed to load resourc... | [
"public",
"static",
"String",
"readResourceAsStream",
"(",
"String",
"path",
")",
"{",
"try",
"{",
"InputStream",
"inputStream",
"=",
"ResourceUtil",
".",
"getResourceAsStream",
"(",
"path",
")",
";",
"return",
"ResourceUtil",
".",
"readFromInputStreamIntoString",
"... | This method looks for a file on the provided path, attempts to load it as a stream and returns it as a string
@param path path
@return {@code String} text | [
"This",
"method",
"looks",
"for",
"a",
"file",
"on",
"the",
"provided",
"path",
"attempts",
"to",
"load",
"it",
"as",
"a",
"stream",
"and",
"returns",
"it",
"as",
"a",
"string"
] | f01de64854c456a88a31ffbe8bac6d605151b496 | https://github.com/btaz/data-util/blob/f01de64854c456a88a31ffbe8bac6d605151b496/src/main/java/com/btaz/util/tf/Template.java#L47-L54 | train |
btaz/data-util | src/main/java/com/btaz/util/tf/Template.java | Template.readResource | public static String readResource(String path) {
try {
File file = ResourceUtil.getResourceFile(path);
return ResourceUtil.readFromFileIntoString(file);
} catch (Exception e) {
throw new DataUtilException("Failed to load resource", e);
}
} | java | public static String readResource(String path) {
try {
File file = ResourceUtil.getResourceFile(path);
return ResourceUtil.readFromFileIntoString(file);
} catch (Exception e) {
throw new DataUtilException("Failed to load resource", e);
}
} | [
"public",
"static",
"String",
"readResource",
"(",
"String",
"path",
")",
"{",
"try",
"{",
"File",
"file",
"=",
"ResourceUtil",
".",
"getResourceFile",
"(",
"path",
")",
";",
"return",
"ResourceUtil",
".",
"readFromFileIntoString",
"(",
"file",
")",
";",
"}"... | This method looks for a file on the provided path and returns it as a string
@param path path
@return {@code String} text | [
"This",
"method",
"looks",
"for",
"a",
"file",
"on",
"the",
"provided",
"path",
"and",
"returns",
"it",
"as",
"a",
"string"
] | f01de64854c456a88a31ffbe8bac6d605151b496 | https://github.com/btaz/data-util/blob/f01de64854c456a88a31ffbe8bac6d605151b496/src/main/java/com/btaz/util/tf/Template.java#L61-L68 | train |
geomajas/geomajas-project-geometry | core/src/main/java/org/geomajas/geometry/Geometry.java | Geometry.cloneRecursively | private Geometry cloneRecursively(Geometry geometry) {
Geometry clone = new Geometry(geometry.geometryType, geometry.srid, geometry.precision);
if (geometry.getGeometries() != null) {
Geometry[] geometryClones = new Geometry[geometry.getGeometries().length];
for (int i = 0; i < geometry.getGeometries().length... | java | private Geometry cloneRecursively(Geometry geometry) {
Geometry clone = new Geometry(geometry.geometryType, geometry.srid, geometry.precision);
if (geometry.getGeometries() != null) {
Geometry[] geometryClones = new Geometry[geometry.getGeometries().length];
for (int i = 0; i < geometry.getGeometries().length... | [
"private",
"Geometry",
"cloneRecursively",
"(",
"Geometry",
"geometry",
")",
"{",
"Geometry",
"clone",
"=",
"new",
"Geometry",
"(",
"geometry",
".",
"geometryType",
",",
"geometry",
".",
"srid",
",",
"geometry",
".",
"precision",
")",
";",
"if",
"(",
"geomet... | Recursive cloning of geometries.
@param geometry
The geometry to clone.
@return The cloned geometry. | [
"Recursive",
"cloning",
"of",
"geometries",
"."
] | 09a214fede69c9c01e41630828c4abbb551a557d | https://github.com/geomajas/geomajas-project-geometry/blob/09a214fede69c9c01e41630828c4abbb551a557d/core/src/main/java/org/geomajas/geometry/Geometry.java#L241-L258 | train |
tvesalainen/bcc | src/main/java/org/vesalainen/bcc/SubClass.java | SubClass.resolveFieldIndex | int resolveFieldIndex(VariableElement field)
{
TypeElement declaringClass = (TypeElement) field.getEnclosingElement();
String descriptor = Descriptor.getDesriptor(field);
int index = resolveFieldIndex(declaringClass, field.getSimpleName().toString(), descriptor);
addIndexedEleme... | java | int resolveFieldIndex(VariableElement field)
{
TypeElement declaringClass = (TypeElement) field.getEnclosingElement();
String descriptor = Descriptor.getDesriptor(field);
int index = resolveFieldIndex(declaringClass, field.getSimpleName().toString(), descriptor);
addIndexedEleme... | [
"int",
"resolveFieldIndex",
"(",
"VariableElement",
"field",
")",
"{",
"TypeElement",
"declaringClass",
"=",
"(",
"TypeElement",
")",
"field",
".",
"getEnclosingElement",
"(",
")",
";",
"String",
"descriptor",
"=",
"Descriptor",
".",
"getDesriptor",
"(",
"field",
... | Returns the constant map index to field.
If entry doesn't exist it is created.
@param field
@return | [
"Returns",
"the",
"constant",
"map",
"index",
"to",
"field",
".",
"If",
"entry",
"doesn",
"t",
"exist",
"it",
"is",
"created",
"."
] | 4e84e313018d487f1a8cca3952d71bc21e77d16b | https://github.com/tvesalainen/bcc/blob/4e84e313018d487f1a8cca3952d71bc21e77d16b/src/main/java/org/vesalainen/bcc/SubClass.java#L179-L186 | train |
tvesalainen/bcc | src/main/java/org/vesalainen/bcc/SubClass.java | SubClass.resolveFieldIndex | private int resolveFieldIndex(TypeElement declaringClass, String name, String descriptor)
{
int size = 0;
int index = 0;
constantReadLock.lock();
try
{
size = getConstantPoolSize();
index = getRefIndex(Fieldref.class, declaringClass.getQualifie... | java | private int resolveFieldIndex(TypeElement declaringClass, String name, String descriptor)
{
int size = 0;
int index = 0;
constantReadLock.lock();
try
{
size = getConstantPoolSize();
index = getRefIndex(Fieldref.class, declaringClass.getQualifie... | [
"private",
"int",
"resolveFieldIndex",
"(",
"TypeElement",
"declaringClass",
",",
"String",
"name",
",",
"String",
"descriptor",
")",
"{",
"int",
"size",
"=",
"0",
";",
"int",
"index",
"=",
"0",
";",
"constantReadLock",
".",
"lock",
"(",
")",
";",
"try",
... | Returns the constant map index to field
If entry doesn't exist it is created.
@param declaringClass
@param name
@param descriptor
@return | [
"Returns",
"the",
"constant",
"map",
"index",
"to",
"field",
"If",
"entry",
"doesn",
"t",
"exist",
"it",
"is",
"created",
"."
] | 4e84e313018d487f1a8cca3952d71bc21e77d16b | https://github.com/tvesalainen/bcc/blob/4e84e313018d487f1a8cca3952d71bc21e77d16b/src/main/java/org/vesalainen/bcc/SubClass.java#L195-L217 | train |
tvesalainen/bcc | src/main/java/org/vesalainen/bcc/SubClass.java | SubClass.resolveMethodIndex | int resolveMethodIndex(ExecutableElement method)
{
int size = 0;
int index = 0;
constantReadLock.lock();
TypeElement declaringClass = (TypeElement) method.getEnclosingElement();
String declaringClassname = declaringClass.getQualifiedName().toString();
String d... | java | int resolveMethodIndex(ExecutableElement method)
{
int size = 0;
int index = 0;
constantReadLock.lock();
TypeElement declaringClass = (TypeElement) method.getEnclosingElement();
String declaringClassname = declaringClass.getQualifiedName().toString();
String d... | [
"int",
"resolveMethodIndex",
"(",
"ExecutableElement",
"method",
")",
"{",
"int",
"size",
"=",
"0",
";",
"int",
"index",
"=",
"0",
";",
"constantReadLock",
".",
"lock",
"(",
")",
";",
"TypeElement",
"declaringClass",
"=",
"(",
"TypeElement",
")",
"method",
... | Returns the constant map index to method
If entry doesn't exist it is created.
@param method
@return | [
"Returns",
"the",
"constant",
"map",
"index",
"to",
"method",
"If",
"entry",
"doesn",
"t",
"exist",
"it",
"is",
"created",
"."
] | 4e84e313018d487f1a8cca3952d71bc21e77d16b | https://github.com/tvesalainen/bcc/blob/4e84e313018d487f1a8cca3952d71bc21e77d16b/src/main/java/org/vesalainen/bcc/SubClass.java#L224-L251 | train |
tvesalainen/bcc | src/main/java/org/vesalainen/bcc/SubClass.java | SubClass.resolveNameIndex | final int resolveNameIndex(CharSequence name)
{
int size = 0;
int index = 0;
constantReadLock.lock();
try
{
size = getConstantPoolSize();
index = getNameIndex(name);
}
finally
{
constantReadLock.unlock();... | java | final int resolveNameIndex(CharSequence name)
{
int size = 0;
int index = 0;
constantReadLock.lock();
try
{
size = getConstantPoolSize();
index = getNameIndex(name);
}
finally
{
constantReadLock.unlock();... | [
"final",
"int",
"resolveNameIndex",
"(",
"CharSequence",
"name",
")",
"{",
"int",
"size",
"=",
"0",
";",
"int",
"index",
"=",
"0",
";",
"constantReadLock",
".",
"lock",
"(",
")",
";",
"try",
"{",
"size",
"=",
"getConstantPoolSize",
"(",
")",
";",
"inde... | Returns the constant map index to name
If entry doesn't exist it is created.
@param name
@return | [
"Returns",
"the",
"constant",
"map",
"index",
"to",
"name",
"If",
"entry",
"doesn",
"t",
"exist",
"it",
"is",
"created",
"."
] | 4e84e313018d487f1a8cca3952d71bc21e77d16b | https://github.com/tvesalainen/bcc/blob/4e84e313018d487f1a8cca3952d71bc21e77d16b/src/main/java/org/vesalainen/bcc/SubClass.java#L292-L314 | train |
tvesalainen/bcc | src/main/java/org/vesalainen/bcc/SubClass.java | SubClass.resolveNameAndTypeIndex | int resolveNameAndTypeIndex(String name, String descriptor)
{
int size = 0;
int index = 0;
constantReadLock.lock();
try
{
size = getConstantPoolSize();
index = getNameAndTypeIndex(name, descriptor);
}
finally
{
... | java | int resolveNameAndTypeIndex(String name, String descriptor)
{
int size = 0;
int index = 0;
constantReadLock.lock();
try
{
size = getConstantPoolSize();
index = getNameAndTypeIndex(name, descriptor);
}
finally
{
... | [
"int",
"resolveNameAndTypeIndex",
"(",
"String",
"name",
",",
"String",
"descriptor",
")",
"{",
"int",
"size",
"=",
"0",
";",
"int",
"index",
"=",
"0",
";",
"constantReadLock",
".",
"lock",
"(",
")",
";",
"try",
"{",
"size",
"=",
"getConstantPoolSize",
"... | Returns the constant map index to name and type
If entry doesn't exist it is created.
@param name
@param descriptor
@return | [
"Returns",
"the",
"constant",
"map",
"index",
"to",
"name",
"and",
"type",
"If",
"entry",
"doesn",
"t",
"exist",
"it",
"is",
"created",
"."
] | 4e84e313018d487f1a8cca3952d71bc21e77d16b | https://github.com/tvesalainen/bcc/blob/4e84e313018d487f1a8cca3952d71bc21e77d16b/src/main/java/org/vesalainen/bcc/SubClass.java#L322-L346 | train |
tvesalainen/bcc | src/main/java/org/vesalainen/bcc/SubClass.java | SubClass.defineConstantField | public void defineConstantField(int modifier, String fieldName, int constant)
{
DeclaredType dt = (DeclaredType)asType();
VariableBuilder builder = new VariableBuilder(this, fieldName, dt.getTypeArguments(), typeParameterMap);
builder.addModifiers(modifier);
builder.addModifier(... | java | public void defineConstantField(int modifier, String fieldName, int constant)
{
DeclaredType dt = (DeclaredType)asType();
VariableBuilder builder = new VariableBuilder(this, fieldName, dt.getTypeArguments(), typeParameterMap);
builder.addModifiers(modifier);
builder.addModifier(... | [
"public",
"void",
"defineConstantField",
"(",
"int",
"modifier",
",",
"String",
"fieldName",
",",
"int",
"constant",
")",
"{",
"DeclaredType",
"dt",
"=",
"(",
"DeclaredType",
")",
"asType",
"(",
")",
";",
"VariableBuilder",
"builder",
"=",
"new",
"VariableBuil... | Define constant field and set the constant value.
@param modifier
@param fieldName
@param constant | [
"Define",
"constant",
"field",
"and",
"set",
"the",
"constant",
"value",
"."
] | 4e84e313018d487f1a8cca3952d71bc21e77d16b | https://github.com/tvesalainen/bcc/blob/4e84e313018d487f1a8cca3952d71bc21e77d16b/src/main/java/org/vesalainen/bcc/SubClass.java#L636-L646 | train |
tvesalainen/bcc | src/main/java/org/vesalainen/bcc/SubClass.java | SubClass.save | public void save(ProcessingEnvironment env) throws IOException
{
Filer filer = env.getFiler();
//JavaFileObject sourceFile = filer.createClassFile(getQualifiedName(), superClass);
FileObject sourceFile = filer.createResource(
StandardLocation.CLASS_OUTPUT,
... | java | public void save(ProcessingEnvironment env) throws IOException
{
Filer filer = env.getFiler();
//JavaFileObject sourceFile = filer.createClassFile(getQualifiedName(), superClass);
FileObject sourceFile = filer.createResource(
StandardLocation.CLASS_OUTPUT,
... | [
"public",
"void",
"save",
"(",
"ProcessingEnvironment",
"env",
")",
"throws",
"IOException",
"{",
"Filer",
"filer",
"=",
"env",
".",
"getFiler",
"(",
")",
";",
"//JavaFileObject sourceFile = filer.createClassFile(getQualifiedName(), superClass);\r",
"FileObject",
"sourceFil... | Saves subclass as class file
@param env
@throws IOException | [
"Saves",
"subclass",
"as",
"class",
"file"
] | 4e84e313018d487f1a8cca3952d71bc21e77d16b | https://github.com/tvesalainen/bcc/blob/4e84e313018d487f1a8cca3952d71bc21e77d16b/src/main/java/org/vesalainen/bcc/SubClass.java#L889-L903 | train |
tvesalainen/bcc | src/main/java/org/vesalainen/bcc/SubClass.java | SubClass.write | @Override
public void write(DataOutput out) throws IOException
{
addSignatureIfNeed();
out.writeInt(magic);
out.writeShort(minor_version);
out.writeShort(major_version);
out.writeShort(constant_pool.size()+1);
for (ConstantInfo ci : constant_pool)
... | java | @Override
public void write(DataOutput out) throws IOException
{
addSignatureIfNeed();
out.writeInt(magic);
out.writeShort(minor_version);
out.writeShort(major_version);
out.writeShort(constant_pool.size()+1);
for (ConstantInfo ci : constant_pool)
... | [
"@",
"Override",
"public",
"void",
"write",
"(",
"DataOutput",
"out",
")",
"throws",
"IOException",
"{",
"addSignatureIfNeed",
"(",
")",
";",
"out",
".",
"writeInt",
"(",
"magic",
")",
";",
"out",
".",
"writeShort",
"(",
"minor_version",
")",
";",
"out",
... | Writes the class
@param out
@throws IOException | [
"Writes",
"the",
"class"
] | 4e84e313018d487f1a8cca3952d71bc21e77d16b | https://github.com/tvesalainen/bcc/blob/4e84e313018d487f1a8cca3952d71bc21e77d16b/src/main/java/org/vesalainen/bcc/SubClass.java#L910-L948 | train |
btaz/data-util | src/main/java/com/btaz/util/xml/xmlpath/XmlPath.java | XmlPath.matches | public boolean matches(LinkedList<Node> nodePath) {
if(simplePattern) {
// simple pattern
return items.get(0).matches(nodePath.getLast());
}
// match the full pattern
if(items.size() != nodePath.size()) {
// different size
return false;
... | java | public boolean matches(LinkedList<Node> nodePath) {
if(simplePattern) {
// simple pattern
return items.get(0).matches(nodePath.getLast());
}
// match the full pattern
if(items.size() != nodePath.size()) {
// different size
return false;
... | [
"public",
"boolean",
"matches",
"(",
"LinkedList",
"<",
"Node",
">",
"nodePath",
")",
"{",
"if",
"(",
"simplePattern",
")",
"{",
"// simple pattern",
"return",
"items",
".",
"get",
"(",
"0",
")",
".",
"matches",
"(",
"nodePath",
".",
"getLast",
"(",
")",... | Compare an XML node path with the path query
@param nodePath XML data path
@return {@code boolean} true if a match | [
"Compare",
"an",
"XML",
"node",
"path",
"with",
"the",
"path",
"query"
] | f01de64854c456a88a31ffbe8bac6d605151b496 | https://github.com/btaz/data-util/blob/f01de64854c456a88a31ffbe8bac6d605151b496/src/main/java/com/btaz/util/xml/xmlpath/XmlPath.java#L35-L53 | train |
sangupta/pepmint | src/main/java/com/sangupta/pepmint/Pepmint.java | Pepmint.newLexer | public Lexer newLexer(String name) {
PyObject object = pythonInterpreter.get("get_lexer_by_name");
object = object.__call__(new PyString(name));
return new Lexer(object);
} | java | public Lexer newLexer(String name) {
PyObject object = pythonInterpreter.get("get_lexer_by_name");
object = object.__call__(new PyString(name));
return new Lexer(object);
} | [
"public",
"Lexer",
"newLexer",
"(",
"String",
"name",
")",
"{",
"PyObject",
"object",
"=",
"pythonInterpreter",
".",
"get",
"(",
"\"get_lexer_by_name\"",
")",
";",
"object",
"=",
"object",
".",
"__call__",
"(",
"new",
"PyString",
"(",
"name",
")",
")",
";"... | Obtain a new lexer implementation based on the given lexer name.
@param name
@return | [
"Obtain",
"a",
"new",
"lexer",
"implementation",
"based",
"on",
"the",
"given",
"lexer",
"name",
"."
] | 2918d76b9632762e9d496c59f254c5faa83a386d | https://github.com/sangupta/pepmint/blob/2918d76b9632762e9d496c59f254c5faa83a386d/src/main/java/com/sangupta/pepmint/Pepmint.java#L58-L62 | train |
sangupta/pepmint | src/main/java/com/sangupta/pepmint/Pepmint.java | Pepmint.newHtmlFormatter | public HtmlFormatter newHtmlFormatter(String params) {
PyObject object = pythonInterpreter.eval("HtmlFormatter(" + params + ")");
return new HtmlFormatter(object);
} | java | public HtmlFormatter newHtmlFormatter(String params) {
PyObject object = pythonInterpreter.eval("HtmlFormatter(" + params + ")");
return new HtmlFormatter(object);
} | [
"public",
"HtmlFormatter",
"newHtmlFormatter",
"(",
"String",
"params",
")",
"{",
"PyObject",
"object",
"=",
"pythonInterpreter",
".",
"eval",
"(",
"\"HtmlFormatter(\"",
"+",
"params",
"+",
"\")\"",
")",
";",
"return",
"new",
"HtmlFormatter",
"(",
"object",
")",... | Create a new HTMLFormatter object using the given parameters.
@param params
@return | [
"Create",
"a",
"new",
"HTMLFormatter",
"object",
"using",
"the",
"given",
"parameters",
"."
] | 2918d76b9632762e9d496c59f254c5faa83a386d | https://github.com/sangupta/pepmint/blob/2918d76b9632762e9d496c59f254c5faa83a386d/src/main/java/com/sangupta/pepmint/Pepmint.java#L70-L73 | train |
sangupta/pepmint | src/main/java/com/sangupta/pepmint/Pepmint.java | Pepmint.highlight | public String highlight(String code, Lexer lexer, Formatter formatter) {
PyFunction function = pythonInterpreter.get("highlight", PyFunction.class);
PyString pyCode = new PyString(code);
PyObject pyLexer = lexer.getLexer();
PyObject pyFormatter = formatter.getFormatter();
return function.__call__(pyCode... | java | public String highlight(String code, Lexer lexer, Formatter formatter) {
PyFunction function = pythonInterpreter.get("highlight", PyFunction.class);
PyString pyCode = new PyString(code);
PyObject pyLexer = lexer.getLexer();
PyObject pyFormatter = formatter.getFormatter();
return function.__call__(pyCode... | [
"public",
"String",
"highlight",
"(",
"String",
"code",
",",
"Lexer",
"lexer",
",",
"Formatter",
"formatter",
")",
"{",
"PyFunction",
"function",
"=",
"pythonInterpreter",
".",
"get",
"(",
"\"highlight\"",
",",
"PyFunction",
".",
"class",
")",
";",
"PyString",... | Highlight the given code piece using the provided lexer and formatter.
@param code
@param lexer
@param formatter
@return | [
"Highlight",
"the",
"given",
"code",
"piece",
"using",
"the",
"provided",
"lexer",
"and",
"formatter",
"."
] | 2918d76b9632762e9d496c59f254c5faa83a386d | https://github.com/sangupta/pepmint/blob/2918d76b9632762e9d496c59f254c5faa83a386d/src/main/java/com/sangupta/pepmint/Pepmint.java#L83-L91 | train |
eyp/serfj | src/main/java/net/sf/serfj/RestController.java | RestController.putParam | protected void putParam(String name, Object object) {
this.response.getRequest().setAttribute(name, object);
} | java | protected void putParam(String name, Object object) {
this.response.getRequest().setAttribute(name, object);
} | [
"protected",
"void",
"putParam",
"(",
"String",
"name",
",",
"Object",
"object",
")",
"{",
"this",
".",
"response",
".",
"getRequest",
"(",
")",
".",
"setAttribute",
"(",
"name",
",",
"object",
")",
";",
"}"
] | Adds an object to the request. If a page will be renderer and it needs some objects
to work, with this method a developer can add objects to the request, so the page can
obtain them.
@param name Parameter name
@param object Object to put in the request | [
"Adds",
"an",
"object",
"to",
"the",
"request",
".",
"If",
"a",
"page",
"will",
"be",
"renderer",
"and",
"it",
"needs",
"some",
"objects",
"to",
"work",
"with",
"this",
"method",
"a",
"developer",
"can",
"add",
"objects",
"to",
"the",
"request",
"so",
... | e617592af6f24e59ea58443f2785c44aa2312189 | https://github.com/eyp/serfj/blob/e617592af6f24e59ea58443f2785c44aa2312189/src/main/java/net/sf/serfj/RestController.java#L85-L87 | train |
Teddy-Zhu/SilentGo | utils/src/main/java/com/silentgo/utils/asm/Label.java | Label.addToSubroutine | void addToSubroutine(final long id, final int nbSubroutines) {
if ((status & VISITED) == 0) {
status |= VISITED;
srcAndRefPositions = new int[nbSubroutines / 32 + 1];
}
srcAndRefPositions[(int) (id >>> 32)] |= (int) id;
} | java | void addToSubroutine(final long id, final int nbSubroutines) {
if ((status & VISITED) == 0) {
status |= VISITED;
srcAndRefPositions = new int[nbSubroutines / 32 + 1];
}
srcAndRefPositions[(int) (id >>> 32)] |= (int) id;
} | [
"void",
"addToSubroutine",
"(",
"final",
"long",
"id",
",",
"final",
"int",
"nbSubroutines",
")",
"{",
"if",
"(",
"(",
"status",
"&",
"VISITED",
")",
"==",
"0",
")",
"{",
"status",
"|=",
"VISITED",
";",
"srcAndRefPositions",
"=",
"new",
"int",
"[",
"nb... | Marks this basic block as belonging to the given subroutine.
@param id
a subroutine id.
@param nbSubroutines
the total number of subroutines in the method. | [
"Marks",
"this",
"basic",
"block",
"as",
"belonging",
"to",
"the",
"given",
"subroutine",
"."
] | 27f58b0cafe56b2eb9fc6993efa9ca2b529661e1 | https://github.com/Teddy-Zhu/SilentGo/blob/27f58b0cafe56b2eb9fc6993efa9ca2b529661e1/utils/src/main/java/com/silentgo/utils/asm/Label.java#L477-L483 | train |
Teddy-Zhu/SilentGo | utils/src/main/java/com/silentgo/utils/asm/Label.java | Label.visitSubroutine | void visitSubroutine(final Label JSR, final long id, final int nbSubroutines) {
// user managed stack of labels, to avoid using a recursive method
// (recursivity can lead to stack overflow with very large methods)
Label stack = this;
while (stack != null) {
// removes a labe... | java | void visitSubroutine(final Label JSR, final long id, final int nbSubroutines) {
// user managed stack of labels, to avoid using a recursive method
// (recursivity can lead to stack overflow with very large methods)
Label stack = this;
while (stack != null) {
// removes a labe... | [
"void",
"visitSubroutine",
"(",
"final",
"Label",
"JSR",
",",
"final",
"long",
"id",
",",
"final",
"int",
"nbSubroutines",
")",
"{",
"// user managed stack of labels, to avoid using a recursive method",
"// (recursivity can lead to stack overflow with very large methods)",
"Label... | Finds the basic blocks that belong to a given subroutine, and marks these
blocks as belonging to this subroutine. This method follows the control
flow graph to find all the blocks that are reachable from the current
block WITHOUT following any JSR target.
@param JSR
a JSR block that jumps to this subroutine. If this J... | [
"Finds",
"the",
"basic",
"blocks",
"that",
"belong",
"to",
"a",
"given",
"subroutine",
"and",
"marks",
"these",
"blocks",
"as",
"belonging",
"to",
"this",
"subroutine",
".",
"This",
"method",
"follows",
"the",
"control",
"flow",
"graph",
"to",
"find",
"all",... | 27f58b0cafe56b2eb9fc6993efa9ca2b529661e1 | https://github.com/Teddy-Zhu/SilentGo/blob/27f58b0cafe56b2eb9fc6993efa9ca2b529661e1/utils/src/main/java/com/silentgo/utils/asm/Label.java#L500-L549 | train |
eyp/serfj | src/main/java/net/sf/serfj/serializers/XmlSerializer.java | XmlSerializer.serialize | public String serialize(Object object) {
XStream xstream = new XStream();
return xstream.toXML(object);
} | java | public String serialize(Object object) {
XStream xstream = new XStream();
return xstream.toXML(object);
} | [
"public",
"String",
"serialize",
"(",
"Object",
"object",
")",
"{",
"XStream",
"xstream",
"=",
"new",
"XStream",
"(",
")",
";",
"return",
"xstream",
".",
"toXML",
"(",
"object",
")",
";",
"}"
] | Serializes an object to XML using the default XStream converter. | [
"Serializes",
"an",
"object",
"to",
"XML",
"using",
"the",
"default",
"XStream",
"converter",
"."
] | e617592af6f24e59ea58443f2785c44aa2312189 | https://github.com/eyp/serfj/blob/e617592af6f24e59ea58443f2785c44aa2312189/src/main/java/net/sf/serfj/serializers/XmlSerializer.java#L30-L33 | train |
btaz/data-util | src/main/java/com/btaz/util/files/FileMerger.java | FileMerger.merge | public static void merge(File mergeDir, List<File> sortedFiles, File mergedFile, Comparator<String> comparator) {
merge(mergeDir, sortedFiles, mergedFile, comparator, MERGE_FACTOR);
} | java | public static void merge(File mergeDir, List<File> sortedFiles, File mergedFile, Comparator<String> comparator) {
merge(mergeDir, sortedFiles, mergedFile, comparator, MERGE_FACTOR);
} | [
"public",
"static",
"void",
"merge",
"(",
"File",
"mergeDir",
",",
"List",
"<",
"File",
">",
"sortedFiles",
",",
"File",
"mergedFile",
",",
"Comparator",
"<",
"String",
">",
"comparator",
")",
"{",
"merge",
"(",
"mergeDir",
",",
"sortedFiles",
",",
"merged... | Merge multiple files into a single file. Multi-pass approach where the merge factor controls how many passes that
are required. This method uses the default merge factor for merging.
@param mergeDir merge directory. If null, then it defaults to system temp.
@param sortedFiles sorted files that are to be merged
@param m... | [
"Merge",
"multiple",
"files",
"into",
"a",
"single",
"file",
".",
"Multi",
"-",
"pass",
"approach",
"where",
"the",
"merge",
"factor",
"controls",
"how",
"many",
"passes",
"that",
"are",
"required",
".",
"This",
"method",
"uses",
"the",
"default",
"merge",
... | f01de64854c456a88a31ffbe8bac6d605151b496 | https://github.com/btaz/data-util/blob/f01de64854c456a88a31ffbe8bac6d605151b496/src/main/java/com/btaz/util/files/FileMerger.java#L27-L29 | train |
btaz/data-util | src/main/java/com/btaz/util/files/FileMerger.java | FileMerger.merge | public static void merge(File mergeDir, List<File> sortedFiles, File mergedFile, Comparator<String> comparator,
int mergeFactor) {
LinkedList<File> mergeFiles = new LinkedList<File>(sortedFiles);
// merge all files
LinkedList<BatchFile> batch = new LinkedList<BatchF... | java | public static void merge(File mergeDir, List<File> sortedFiles, File mergedFile, Comparator<String> comparator,
int mergeFactor) {
LinkedList<File> mergeFiles = new LinkedList<File>(sortedFiles);
// merge all files
LinkedList<BatchFile> batch = new LinkedList<BatchF... | [
"public",
"static",
"void",
"merge",
"(",
"File",
"mergeDir",
",",
"List",
"<",
"File",
">",
"sortedFiles",
",",
"File",
"mergedFile",
",",
"Comparator",
"<",
"String",
">",
"comparator",
",",
"int",
"mergeFactor",
")",
"{",
"LinkedList",
"<",
"File",
">",... | Merge multiple files into a single file. Multi-pass approach where the merge factor controls how many passes that
are required. If a merge factor of X is specified, then X files will be opened concurrently for merging.
@param mergeDir merge directory. If null, then it defaults to system temp.
@param sortedFiles sorted ... | [
"Merge",
"multiple",
"files",
"into",
"a",
"single",
"file",
".",
"Multi",
"-",
"pass",
"approach",
"where",
"the",
"merge",
"factor",
"controls",
"how",
"many",
"passes",
"that",
"are",
"required",
".",
"If",
"a",
"merge",
"factor",
"of",
"X",
"is",
"sp... | f01de64854c456a88a31ffbe8bac6d605151b496 | https://github.com/btaz/data-util/blob/f01de64854c456a88a31ffbe8bac6d605151b496/src/main/java/com/btaz/util/files/FileMerger.java#L40-L117 | train |
tvesalainen/bcc | src/main/java/org/vesalainen/bcc/FieldInfo.java | FieldInfo.readyToWrite | public void readyToWrite()
{
addSignatureIfNeed();
this.name_index = ((SubClass)classFile).resolveNameIndex(getSimpleName());
this.descriptor_index = ((SubClass)classFile).resolveNameIndex(Descriptor.getDesriptor(this));
readyToWrite = true;
} | java | public void readyToWrite()
{
addSignatureIfNeed();
this.name_index = ((SubClass)classFile).resolveNameIndex(getSimpleName());
this.descriptor_index = ((SubClass)classFile).resolveNameIndex(Descriptor.getDesriptor(this));
readyToWrite = true;
} | [
"public",
"void",
"readyToWrite",
"(",
")",
"{",
"addSignatureIfNeed",
"(",
")",
";",
"this",
".",
"name_index",
"=",
"(",
"(",
"SubClass",
")",
"classFile",
")",
".",
"resolveNameIndex",
"(",
"getSimpleName",
"(",
")",
")",
";",
"this",
".",
"descriptor_i... | Call to this method tells that the Attribute is ready writing. This method
must be called before constant pool is written. | [
"Call",
"to",
"this",
"method",
"tells",
"that",
"the",
"Attribute",
"is",
"ready",
"writing",
".",
"This",
"method",
"must",
"be",
"called",
"before",
"constant",
"pool",
"is",
"written",
"."
] | 4e84e313018d487f1a8cca3952d71bc21e77d16b | https://github.com/tvesalainen/bcc/blob/4e84e313018d487f1a8cca3952d71bc21e77d16b/src/main/java/org/vesalainen/bcc/FieldInfo.java#L79-L85 | train |
btaz/data-util | src/main/java/com/btaz/util/xml/model/Xml.java | Xml.bfsComparison | private boolean bfsComparison(Node root, Node other) {
if(root instanceof Content || other instanceof Content) {
return root.equals(other);
}
if(! root.equals(other)) {
return false;
}
List<Node> a = ((Element)root).getChildElements();
List<Node> ... | java | private boolean bfsComparison(Node root, Node other) {
if(root instanceof Content || other instanceof Content) {
return root.equals(other);
}
if(! root.equals(other)) {
return false;
}
List<Node> a = ((Element)root).getChildElements();
List<Node> ... | [
"private",
"boolean",
"bfsComparison",
"(",
"Node",
"root",
",",
"Node",
"other",
")",
"{",
"if",
"(",
"root",
"instanceof",
"Content",
"||",
"other",
"instanceof",
"Content",
")",
"{",
"return",
"root",
".",
"equals",
"(",
"other",
")",
";",
"}",
"if",
... | A strict breadth-first search traversal to evaluate two XML trees against each other
@param root first tree
@param other second tree
@return {@code boolean} true if the trees matches, false otherwise | [
"A",
"strict",
"breadth",
"-",
"first",
"search",
"traversal",
"to",
"evaluate",
"two",
"XML",
"trees",
"against",
"each",
"other"
] | f01de64854c456a88a31ffbe8bac6d605151b496 | https://github.com/btaz/data-util/blob/f01de64854c456a88a31ffbe8bac6d605151b496/src/main/java/com/btaz/util/xml/model/Xml.java#L179-L205 | train |
btaz/data-util | src/main/java/com/btaz/util/xml/model/Xml.java | Xml.bsfHashCode | private int bsfHashCode(Node node, int result) {
result += 31 * node.hashCode();
if(node instanceof Content) {
return result;
}
Element elem = (Element) node;
List<Node> childElements = elem.getChildElements();
for (Node childElement : childElements) {
... | java | private int bsfHashCode(Node node, int result) {
result += 31 * node.hashCode();
if(node instanceof Content) {
return result;
}
Element elem = (Element) node;
List<Node> childElements = elem.getChildElements();
for (Node childElement : childElements) {
... | [
"private",
"int",
"bsfHashCode",
"(",
"Node",
"node",
",",
"int",
"result",
")",
"{",
"result",
"+=",
"31",
"*",
"node",
".",
"hashCode",
"(",
")",
";",
"if",
"(",
"node",
"instanceof",
"Content",
")",
"{",
"return",
"result",
";",
"}",
"Element",
"e... | Recursive hash code creator
@param node root node
@param result cumulative hash code value
@return result resulting cumulative hash code value | [
"Recursive",
"hash",
"code",
"creator"
] | f01de64854c456a88a31ffbe8bac6d605151b496 | https://github.com/btaz/data-util/blob/f01de64854c456a88a31ffbe8bac6d605151b496/src/main/java/com/btaz/util/xml/model/Xml.java#L228-L251 | train |
btaz/data-util | src/main/java/com/btaz/util/xml/model/Xml.java | Xml.deepCopy | private void deepCopy(Element origElement, Element copyElement) {
List<Node> children = origElement.getChildElements();
for(Node node : children) {
try {
if(node instanceof Content) {
Content content = (Content) ((Content) node).clone();
... | java | private void deepCopy(Element origElement, Element copyElement) {
List<Node> children = origElement.getChildElements();
for(Node node : children) {
try {
if(node instanceof Content) {
Content content = (Content) ((Content) node).clone();
... | [
"private",
"void",
"deepCopy",
"(",
"Element",
"origElement",
",",
"Element",
"copyElement",
")",
"{",
"List",
"<",
"Node",
">",
"children",
"=",
"origElement",
".",
"getChildElements",
"(",
")",
";",
"for",
"(",
"Node",
"node",
":",
"children",
")",
"{",
... | Deep copy recursive helper method.
@param origElement original element
@param copyElement copy element | [
"Deep",
"copy",
"recursive",
"helper",
"method",
"."
] | f01de64854c456a88a31ffbe8bac6d605151b496 | https://github.com/btaz/data-util/blob/f01de64854c456a88a31ffbe8bac6d605151b496/src/main/java/com/btaz/util/xml/model/Xml.java#L310-L326 | train |
tvesalainen/bcc | src/main/java/org/vesalainen/bcc/model/Jav.java | Jav.makeJavaIdentifier | public String makeJavaIdentifier(String id)
{
String jid = makeJavaId(id);
String old = map.put(jid, id);
if (old != null && !old.equals(id))
{
throw new IllegalArgumentException("both "+id+" and "+old+" makes the same java id "+jid);
}
return jid;
} | java | public String makeJavaIdentifier(String id)
{
String jid = makeJavaId(id);
String old = map.put(jid, id);
if (old != null && !old.equals(id))
{
throw new IllegalArgumentException("both "+id+" and "+old+" makes the same java id "+jid);
}
return jid;
} | [
"public",
"String",
"makeJavaIdentifier",
"(",
"String",
"id",
")",
"{",
"String",
"jid",
"=",
"makeJavaId",
"(",
"id",
")",
";",
"String",
"old",
"=",
"map",
".",
"put",
"(",
"jid",
",",
"id",
")",
";",
"if",
"(",
"old",
"!=",
"null",
"&&",
"!",
... | Returns a String capable for java identifier. Throws IllegalArgumentException
if same id was already created.
<p>Same id returns always the same java id.
@param id
@return | [
"Returns",
"a",
"String",
"capable",
"for",
"java",
"identifier",
".",
"Throws",
"IllegalArgumentException",
"if",
"same",
"id",
"was",
"already",
"created",
"."
] | 4e84e313018d487f1a8cca3952d71bc21e77d16b | https://github.com/tvesalainen/bcc/blob/4e84e313018d487f1a8cca3952d71bc21e77d16b/src/main/java/org/vesalainen/bcc/model/Jav.java#L37-L46 | train |
tvesalainen/bcc | src/main/java/org/vesalainen/bcc/model/Jav.java | Jav.makeUniqueJavaIdentifier | public String makeUniqueJavaIdentifier(String id)
{
String jid = makeJavaId(id);
String old = map.put(jid, id);
if (old != null)
{
String oid = jid;
for (int ii=1;old != null;ii++)
{
jid = oid+ii;
old = map.put(jid, ... | java | public String makeUniqueJavaIdentifier(String id)
{
String jid = makeJavaId(id);
String old = map.put(jid, id);
if (old != null)
{
String oid = jid;
for (int ii=1;old != null;ii++)
{
jid = oid+ii;
old = map.put(jid, ... | [
"public",
"String",
"makeUniqueJavaIdentifier",
"(",
"String",
"id",
")",
"{",
"String",
"jid",
"=",
"makeJavaId",
"(",
"id",
")",
";",
"String",
"old",
"=",
"map",
".",
"put",
"(",
"jid",
",",
"id",
")",
";",
"if",
"(",
"old",
"!=",
"null",
")",
"... | Returns a unique String capable for java identifier.
<p>Note! Even with the same id the returned string is unique.
@param id
@return | [
"Returns",
"a",
"unique",
"String",
"capable",
"for",
"java",
"identifier",
"."
] | 4e84e313018d487f1a8cca3952d71bc21e77d16b | https://github.com/tvesalainen/bcc/blob/4e84e313018d487f1a8cca3952d71bc21e77d16b/src/main/java/org/vesalainen/bcc/model/Jav.java#L54-L68 | train |
btaz/data-util | src/main/java/com/btaz/util/mr/FileOutputCollector.java | FileOutputCollector.write | @Override
public void write(String output) throws MapReduceException {
try {
writer.write(output + DataUtilDefaults.lineTerminator);
} catch (IOException e) {
throw new MapReduceException("Failed to write to the output collector", e);
}
} | java | @Override
public void write(String output) throws MapReduceException {
try {
writer.write(output + DataUtilDefaults.lineTerminator);
} catch (IOException e) {
throw new MapReduceException("Failed to write to the output collector", e);
}
} | [
"@",
"Override",
"public",
"void",
"write",
"(",
"String",
"output",
")",
"throws",
"MapReduceException",
"{",
"try",
"{",
"writer",
".",
"write",
"(",
"output",
"+",
"DataUtilDefaults",
".",
"lineTerminator",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",... | Write to the output collector
@param output data to write
@exception MapReduceException map reduce exception | [
"Write",
"to",
"the",
"output",
"collector"
] | f01de64854c456a88a31ffbe8bac6d605151b496 | https://github.com/btaz/data-util/blob/f01de64854c456a88a31ffbe8bac6d605151b496/src/main/java/com/btaz/util/mr/FileOutputCollector.java#L62-L69 | train |
btaz/data-util | src/main/java/com/btaz/util/mr/FileOutputCollector.java | FileOutputCollector.close | public void close() throws MapReduceException {
try {
if(writer != null) {
writer.flush();
writer.close();
}
} catch (IOException e) {
throw new MapReduceException("Failed to close the output collector", e);
}
} | java | public void close() throws MapReduceException {
try {
if(writer != null) {
writer.flush();
writer.close();
}
} catch (IOException e) {
throw new MapReduceException("Failed to close the output collector", e);
}
} | [
"public",
"void",
"close",
"(",
")",
"throws",
"MapReduceException",
"{",
"try",
"{",
"if",
"(",
"writer",
"!=",
"null",
")",
"{",
"writer",
".",
"flush",
"(",
")",
";",
"writer",
".",
"close",
"(",
")",
";",
"}",
"}",
"catch",
"(",
"IOException",
... | Close the output collector
@throws MapReduceException map reduce exception | [
"Close",
"the",
"output",
"collector"
] | f01de64854c456a88a31ffbe8bac6d605151b496 | https://github.com/btaz/data-util/blob/f01de64854c456a88a31ffbe8bac6d605151b496/src/main/java/com/btaz/util/mr/FileOutputCollector.java#L83-L92 | train |
btaz/data-util | src/main/java/com/btaz/util/string/StringUtil.java | StringUtil.pad | public static String pad(int repeat, String str) {
StringBuilder sb = new StringBuilder();
for(int i=0; i < repeat; i++) {
sb.append(str);
}
return sb.toString();
} | java | public static String pad(int repeat, String str) {
StringBuilder sb = new StringBuilder();
for(int i=0; i < repeat; i++) {
sb.append(str);
}
return sb.toString();
} | [
"public",
"static",
"String",
"pad",
"(",
"int",
"repeat",
",",
"String",
"str",
")",
"{",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"repeat",
";",
"i",
"++",
")",
"{",
"sb... | This method will pad a String with a character or string
@param repeat how many times the string should be repeated
@param str character or string to be repeated
@return padded {@code String} | [
"This",
"method",
"will",
"pad",
"a",
"String",
"with",
"a",
"character",
"or",
"string"
] | f01de64854c456a88a31ffbe8bac6d605151b496 | https://github.com/btaz/data-util/blob/f01de64854c456a88a31ffbe8bac6d605151b496/src/main/java/com/btaz/util/string/StringUtil.java#L15-L21 | train |
eyp/serfj | src/main/java/net/sf/serfj/ResponseHelper.java | ResponseHelper.setFile | public void setFile(File file, String attachmentFilename, String contentType) {
this.file = file;
this.attachmentFilename = attachmentFilename;
this.contentType = contentType;
} | java | public void setFile(File file, String attachmentFilename, String contentType) {
this.file = file;
this.attachmentFilename = attachmentFilename;
this.contentType = contentType;
} | [
"public",
"void",
"setFile",
"(",
"File",
"file",
",",
"String",
"attachmentFilename",
",",
"String",
"contentType",
")",
"{",
"this",
".",
"file",
"=",
"file",
";",
"this",
".",
"attachmentFilename",
"=",
"attachmentFilename",
";",
"this",
".",
"contentType",... | Sets the file to send to the client. If a file is set then the framework will try to read it
and write it into the response using a FileSerializer.
@param file The file.
@param attachmentFilename Name for the file that will be sent.
@param contentType Content type for the response header. | [
"Sets",
"the",
"file",
"to",
"send",
"to",
"the",
"client",
".",
"If",
"a",
"file",
"is",
"set",
"then",
"the",
"framework",
"will",
"try",
"to",
"read",
"it",
"and",
"write",
"it",
"into",
"the",
"response",
"using",
"a",
"FileSerializer",
"."
] | e617592af6f24e59ea58443f2785c44aa2312189 | https://github.com/eyp/serfj/blob/e617592af6f24e59ea58443f2785c44aa2312189/src/main/java/net/sf/serfj/ResponseHelper.java#L214-L218 | train |
eyp/serfj | src/main/java/net/sf/serfj/ResponseHelper.java | ResponseHelper.existsPage | private Boolean existsPage(String page) throws MalformedURLException {
// Searching the page...
LOGGER.debug("Searching page [{}]...", page);
LOGGER.debug("Page's real path is [{}]", this.context.getRealPath(page));
File file = new File(this.context.getRealPath(page));
Boolean ex... | java | private Boolean existsPage(String page) throws MalformedURLException {
// Searching the page...
LOGGER.debug("Searching page [{}]...", page);
LOGGER.debug("Page's real path is [{}]", this.context.getRealPath(page));
File file = new File(this.context.getRealPath(page));
Boolean ex... | [
"private",
"Boolean",
"existsPage",
"(",
"String",
"page",
")",
"throws",
"MalformedURLException",
"{",
"// Searching the page...",
"LOGGER",
".",
"debug",
"(",
"\"Searching page [{}]...\"",
",",
"page",
")",
";",
"LOGGER",
".",
"debug",
"(",
"\"Page's real path is [{... | Checks if a given page exists in the container and could be served.
@param page
Page requested.
@return true if exists, false otherwise.
@throws MalformedURLException
if the page's URL is not right. | [
"Checks",
"if",
"a",
"given",
"page",
"exists",
"in",
"the",
"container",
"and",
"could",
"be",
"served",
"."
] | e617592af6f24e59ea58443f2785c44aa2312189 | https://github.com/eyp/serfj/blob/e617592af6f24e59ea58443f2785c44aa2312189/src/main/java/net/sf/serfj/ResponseHelper.java#L435-L443 | train |
btaz/data-util | src/main/java/com/btaz/util/collections/Sets.java | Sets.createSet | public static <T> Set<T> createSet(T... args) {
HashSet<T> newSet = new HashSet<T>();
Collections.addAll(newSet, args);
return newSet;
} | java | public static <T> Set<T> createSet(T... args) {
HashSet<T> newSet = new HashSet<T>();
Collections.addAll(newSet, args);
return newSet;
} | [
"public",
"static",
"<",
"T",
">",
"Set",
"<",
"T",
">",
"createSet",
"(",
"T",
"...",
"args",
")",
"{",
"HashSet",
"<",
"T",
">",
"newSet",
"=",
"new",
"HashSet",
"<",
"T",
">",
"(",
")",
";",
"Collections",
".",
"addAll",
"(",
"newSet",
",",
... | Convenience method for building a set from vararg arguments
@param args argument list
@param <T> set type
@return a new set created from var args | [
"Convenience",
"method",
"for",
"building",
"a",
"set",
"from",
"vararg",
"arguments"
] | f01de64854c456a88a31ffbe8bac6d605151b496 | https://github.com/btaz/data-util/blob/f01de64854c456a88a31ffbe8bac6d605151b496/src/main/java/com/btaz/util/collections/Sets.java#L18-L22 | train |
btaz/data-util | src/main/java/com/btaz/util/collections/Sets.java | Sets.arrayToSet | public static <T> Set<T> arrayToSet(T [] array) {
return new HashSet<T>(Arrays.asList(array));
} | java | public static <T> Set<T> arrayToSet(T [] array) {
return new HashSet<T>(Arrays.asList(array));
} | [
"public",
"static",
"<",
"T",
">",
"Set",
"<",
"T",
">",
"arrayToSet",
"(",
"T",
"[",
"]",
"array",
")",
"{",
"return",
"new",
"HashSet",
"<",
"T",
">",
"(",
"Arrays",
".",
"asList",
"(",
"array",
")",
")",
";",
"}"
] | Convenience method for building a set from an array
@param array
@param <T>
@return a new set created from var args | [
"Convenience",
"method",
"for",
"building",
"a",
"set",
"from",
"an",
"array"
] | f01de64854c456a88a31ffbe8bac6d605151b496 | https://github.com/btaz/data-util/blob/f01de64854c456a88a31ffbe8bac6d605151b496/src/main/java/com/btaz/util/collections/Sets.java#L30-L32 | train |
btaz/data-util | src/main/java/com/btaz/util/collections/Sets.java | Sets.intersection | public static <T> Set<T> intersection(Set<T> setA, Set<T> setB) {
Set<T> intersection = new HashSet<T>(setA);
intersection.retainAll(setB);
return intersection;
} | java | public static <T> Set<T> intersection(Set<T> setA, Set<T> setB) {
Set<T> intersection = new HashSet<T>(setA);
intersection.retainAll(setB);
return intersection;
} | [
"public",
"static",
"<",
"T",
">",
"Set",
"<",
"T",
">",
"intersection",
"(",
"Set",
"<",
"T",
">",
"setA",
",",
"Set",
"<",
"T",
">",
"setB",
")",
"{",
"Set",
"<",
"T",
">",
"intersection",
"=",
"new",
"HashSet",
"<",
"T",
">",
"(",
"setA",
... | This method finds the intersection between set A and set B
@param setA set A
@param setB set B
@param <T> type
@return a new set containing the intersection | [
"This",
"method",
"finds",
"the",
"intersection",
"between",
"set",
"A",
"and",
"set",
"B"
] | f01de64854c456a88a31ffbe8bac6d605151b496 | https://github.com/btaz/data-util/blob/f01de64854c456a88a31ffbe8bac6d605151b496/src/main/java/com/btaz/util/collections/Sets.java#L41-L45 | train |
btaz/data-util | src/main/java/com/btaz/util/collections/Sets.java | Sets.union | public static <T> Set<T> union(Set<T> setA, Set<T> setB) {
Set<T> union = new HashSet<T>(setA);
union.addAll(setB);
return union;
} | java | public static <T> Set<T> union(Set<T> setA, Set<T> setB) {
Set<T> union = new HashSet<T>(setA);
union.addAll(setB);
return union;
} | [
"public",
"static",
"<",
"T",
">",
"Set",
"<",
"T",
">",
"union",
"(",
"Set",
"<",
"T",
">",
"setA",
",",
"Set",
"<",
"T",
">",
"setB",
")",
"{",
"Set",
"<",
"T",
">",
"union",
"=",
"new",
"HashSet",
"<",
"T",
">",
"(",
"setA",
")",
";",
... | This method finds the union of set A and set B
@param setA set A
@param setB set B
@param <T> type
@return a new set containing the union | [
"This",
"method",
"finds",
"the",
"union",
"of",
"set",
"A",
"and",
"set",
"B"
] | f01de64854c456a88a31ffbe8bac6d605151b496 | https://github.com/btaz/data-util/blob/f01de64854c456a88a31ffbe8bac6d605151b496/src/main/java/com/btaz/util/collections/Sets.java#L54-L58 | train |
btaz/data-util | src/main/java/com/btaz/util/collections/Sets.java | Sets.difference | public static <T> Set<T> difference(Set<T> setA, Set<T> setB) {
Set<T> difference = new HashSet<T>(setA);
difference.removeAll(setB);
return difference;
} | java | public static <T> Set<T> difference(Set<T> setA, Set<T> setB) {
Set<T> difference = new HashSet<T>(setA);
difference.removeAll(setB);
return difference;
} | [
"public",
"static",
"<",
"T",
">",
"Set",
"<",
"T",
">",
"difference",
"(",
"Set",
"<",
"T",
">",
"setA",
",",
"Set",
"<",
"T",
">",
"setB",
")",
"{",
"Set",
"<",
"T",
">",
"difference",
"=",
"new",
"HashSet",
"<",
"T",
">",
"(",
"setA",
")",... | This method finds the difference between set A and set B i.e. set A minus set B
@param setA set A
@param setB set B
@param <T> type
@return a new set containing the difference | [
"This",
"method",
"finds",
"the",
"difference",
"between",
"set",
"A",
"and",
"set",
"B",
"i",
".",
"e",
".",
"set",
"A",
"minus",
"set",
"B"
] | f01de64854c456a88a31ffbe8bac6d605151b496 | https://github.com/btaz/data-util/blob/f01de64854c456a88a31ffbe8bac6d605151b496/src/main/java/com/btaz/util/collections/Sets.java#L67-L71 | train |
btaz/data-util | src/main/java/com/btaz/util/collections/Sets.java | Sets.symmetricDifference | public static <T> Set<T> symmetricDifference(Set<T> setA, Set<T> setB) {
Set<T> union = union(setA, setB);
Set<T> intersection = intersection(setA, setB);
return difference(union, intersection);
} | java | public static <T> Set<T> symmetricDifference(Set<T> setA, Set<T> setB) {
Set<T> union = union(setA, setB);
Set<T> intersection = intersection(setA, setB);
return difference(union, intersection);
} | [
"public",
"static",
"<",
"T",
">",
"Set",
"<",
"T",
">",
"symmetricDifference",
"(",
"Set",
"<",
"T",
">",
"setA",
",",
"Set",
"<",
"T",
">",
"setB",
")",
"{",
"Set",
"<",
"T",
">",
"union",
"=",
"union",
"(",
"setA",
",",
"setB",
")",
";",
"... | This method finds the symmetric difference between set A and set B i.e. which items does not exist in either
set A or set B. This is the opposite of the intersect of set A and set B.
@param setA set A
@param setB set B
@param <T> type
@return a new set containing the symmetric difference | [
"This",
"method",
"finds",
"the",
"symmetric",
"difference",
"between",
"set",
"A",
"and",
"set",
"B",
"i",
".",
"e",
".",
"which",
"items",
"does",
"not",
"exist",
"in",
"either",
"set",
"A",
"or",
"set",
"B",
".",
"This",
"is",
"the",
"opposite",
"... | f01de64854c456a88a31ffbe8bac6d605151b496 | https://github.com/btaz/data-util/blob/f01de64854c456a88a31ffbe8bac6d605151b496/src/main/java/com/btaz/util/collections/Sets.java#L81-L85 | train |
btaz/data-util | src/main/java/com/btaz/util/collections/Sets.java | Sets.isSubset | public static <T> boolean isSubset(Set<T> setA, Set<T> setB) {
return setB.containsAll(setA);
} | java | public static <T> boolean isSubset(Set<T> setA, Set<T> setB) {
return setB.containsAll(setA);
} | [
"public",
"static",
"<",
"T",
">",
"boolean",
"isSubset",
"(",
"Set",
"<",
"T",
">",
"setA",
",",
"Set",
"<",
"T",
">",
"setB",
")",
"{",
"return",
"setB",
".",
"containsAll",
"(",
"setA",
")",
";",
"}"
] | This method returns true if set A is a subset of set B
i.e. it answers the question if all items in A exists in B
@param setA set A
@param setB set B
@param <T> type
@return {@code boolean} true if A is a subset of B | [
"This",
"method",
"returns",
"true",
"if",
"set",
"A",
"is",
"a",
"subset",
"of",
"set",
"B",
"i",
".",
"e",
".",
"it",
"answers",
"the",
"question",
"if",
"all",
"items",
"in",
"A",
"exists",
"in",
"B"
] | f01de64854c456a88a31ffbe8bac6d605151b496 | https://github.com/btaz/data-util/blob/f01de64854c456a88a31ffbe8bac6d605151b496/src/main/java/com/btaz/util/collections/Sets.java#L127-L129 | train |
btaz/data-util | src/main/java/com/btaz/util/collections/Sets.java | Sets.isSuperset | public static <T> boolean isSuperset(Set<T> setA, Set<T> setB) {
return setA.containsAll(setB);
} | java | public static <T> boolean isSuperset(Set<T> setA, Set<T> setB) {
return setA.containsAll(setB);
} | [
"public",
"static",
"<",
"T",
">",
"boolean",
"isSuperset",
"(",
"Set",
"<",
"T",
">",
"setA",
",",
"Set",
"<",
"T",
">",
"setB",
")",
"{",
"return",
"setA",
".",
"containsAll",
"(",
"setB",
")",
";",
"}"
] | This method returns true if set A is a superset of set B
i.e. it answers the question if A contains all items from B
@param setA set A
@param setB set B
@param <T> type
@return {@code boolean} true if A is a superset of B | [
"This",
"method",
"returns",
"true",
"if",
"set",
"A",
"is",
"a",
"superset",
"of",
"set",
"B",
"i",
".",
"e",
".",
"it",
"answers",
"the",
"question",
"if",
"A",
"contains",
"all",
"items",
"from",
"B"
] | f01de64854c456a88a31ffbe8bac6d605151b496 | https://github.com/btaz/data-util/blob/f01de64854c456a88a31ffbe8bac6d605151b496/src/main/java/com/btaz/util/collections/Sets.java#L139-L141 | train |
Teddy-Zhu/SilentGo | utils/src/main/java/com/silentgo/utils/asm/Type.java | Type.getClassName | public String getClassName() {
switch (sort) {
case VOID:
return "void";
case BOOLEAN:
return "boolean";
case CHAR:
return "char";
case BYTE:
return "byte";
case SHORT:
return "short";
case INT:
... | java | public String getClassName() {
switch (sort) {
case VOID:
return "void";
case BOOLEAN:
return "boolean";
case CHAR:
return "char";
case BYTE:
return "byte";
case SHORT:
return "short";
case INT:
... | [
"public",
"String",
"getClassName",
"(",
")",
"{",
"switch",
"(",
"sort",
")",
"{",
"case",
"VOID",
":",
"return",
"\"void\"",
";",
"case",
"BOOLEAN",
":",
"return",
"\"boolean\"",
";",
"case",
"CHAR",
":",
"return",
"\"char\"",
";",
"case",
"BYTE",
":",... | Returns the binary name of the class corresponding to this type. This
method must not be used on method types.
@return the binary name of the class corresponding to this type. | [
"Returns",
"the",
"binary",
"name",
"of",
"the",
"class",
"corresponding",
"to",
"this",
"type",
".",
"This",
"method",
"must",
"not",
"be",
"used",
"on",
"method",
"types",
"."
] | 27f58b0cafe56b2eb9fc6993efa9ca2b529661e1 | https://github.com/Teddy-Zhu/SilentGo/blob/27f58b0cafe56b2eb9fc6993efa9ca2b529661e1/utils/src/main/java/com/silentgo/utils/asm/Type.java#L547-L578 | train |
passwordmaker/java-passwordmaker-lib | src/main/java/org/daveware/passwordmaker/AccountPatternMatcher.java | AccountPatternMatcher.matchUrl | public static boolean matchUrl(Account account, String url) {
for (AccountPatternData pattern : account.getPatterns()) {
AccountPatternType type = pattern.getType();
if (type == AccountPatternType.REGEX) {
if (regexMatch(pattern.getPattern(), url))
ret... | java | public static boolean matchUrl(Account account, String url) {
for (AccountPatternData pattern : account.getPatterns()) {
AccountPatternType type = pattern.getType();
if (type == AccountPatternType.REGEX) {
if (regexMatch(pattern.getPattern(), url))
ret... | [
"public",
"static",
"boolean",
"matchUrl",
"(",
"Account",
"account",
",",
"String",
"url",
")",
"{",
"for",
"(",
"AccountPatternData",
"pattern",
":",
"account",
".",
"getPatterns",
"(",
")",
")",
"{",
"AccountPatternType",
"type",
"=",
"pattern",
".",
"get... | Tests all patterns in an account for a match against the url string.
@param account The account to test with.
@param url THe url to test with.
@return true if one of the | [
"Tests",
"all",
"patterns",
"in",
"an",
"account",
"for",
"a",
"match",
"against",
"the",
"url",
"string",
"."
] | 18c22fca7dd9a47f08161425b85a5bd257afbb2b | https://github.com/passwordmaker/java-passwordmaker-lib/blob/18c22fca7dd9a47f08161425b85a5bd257afbb2b/src/main/java/org/daveware/passwordmaker/AccountPatternMatcher.java#L36-L53 | train |
btaz/data-util | src/main/java/com/btaz/util/files/FileDeleter.java | FileDeleter.deleteFilesByExtension | public static void deleteFilesByExtension(File dir, String extension) {
if(extension == null) {
throw new DataUtilException("Filename extension can not be a null value");
}
FilenameFilter filter = new FileExtensionFilenameFilter(extension);
FileDeleter.deleteFiles(dir, filter... | java | public static void deleteFilesByExtension(File dir, String extension) {
if(extension == null) {
throw new DataUtilException("Filename extension can not be a null value");
}
FilenameFilter filter = new FileExtensionFilenameFilter(extension);
FileDeleter.deleteFiles(dir, filter... | [
"public",
"static",
"void",
"deleteFilesByExtension",
"(",
"File",
"dir",
",",
"String",
"extension",
")",
"{",
"if",
"(",
"extension",
"==",
"null",
")",
"{",
"throw",
"new",
"DataUtilException",
"(",
"\"Filename extension can not be a null value\"",
")",
";",
"}... | Delete files in a directory matching a file extension
@param dir directory
@param extension filename extension | [
"Delete",
"files",
"in",
"a",
"directory",
"matching",
"a",
"file",
"extension"
] | f01de64854c456a88a31ffbe8bac6d605151b496 | https://github.com/btaz/data-util/blob/f01de64854c456a88a31ffbe8bac6d605151b496/src/main/java/com/btaz/util/files/FileDeleter.java#L17-L23 | train |
btaz/data-util | src/main/java/com/btaz/util/files/FileDeleter.java | FileDeleter.deleteFilesByRegex | public static void deleteFilesByRegex(File dir, String regex) {
if(regex == null) {
throw new DataUtilException("Filename regex can not be null");
}
FilenameFilter filter = new RegexFilenameFilter(regex);
FileDeleter.deleteFiles(dir, filter);
} | java | public static void deleteFilesByRegex(File dir, String regex) {
if(regex == null) {
throw new DataUtilException("Filename regex can not be null");
}
FilenameFilter filter = new RegexFilenameFilter(regex);
FileDeleter.deleteFiles(dir, filter);
} | [
"public",
"static",
"void",
"deleteFilesByRegex",
"(",
"File",
"dir",
",",
"String",
"regex",
")",
"{",
"if",
"(",
"regex",
"==",
"null",
")",
"{",
"throw",
"new",
"DataUtilException",
"(",
"\"Filename regex can not be null\"",
")",
";",
"}",
"FilenameFilter",
... | Delete files in a directory matching a regular expression
@param dir directory
@param regex regular expression | [
"Delete",
"files",
"in",
"a",
"directory",
"matching",
"a",
"regular",
"expression"
] | f01de64854c456a88a31ffbe8bac6d605151b496 | https://github.com/btaz/data-util/blob/f01de64854c456a88a31ffbe8bac6d605151b496/src/main/java/com/btaz/util/files/FileDeleter.java#L30-L36 | train |
btaz/data-util | src/main/java/com/btaz/util/files/FileDeleter.java | FileDeleter.deleteFiles | public static void deleteFiles(File dir, FilenameFilter filter) {
// validations
if(dir == null) {
throw new DataUtilException("The delete directory parameter can not be a null value");
} else if(!dir.exists() || !dir.isDirectory()) {
throw new DataUtilException("The dele... | java | public static void deleteFiles(File dir, FilenameFilter filter) {
// validations
if(dir == null) {
throw new DataUtilException("The delete directory parameter can not be a null value");
} else if(!dir.exists() || !dir.isDirectory()) {
throw new DataUtilException("The dele... | [
"public",
"static",
"void",
"deleteFiles",
"(",
"File",
"dir",
",",
"FilenameFilter",
"filter",
")",
"{",
"// validations",
"if",
"(",
"dir",
"==",
"null",
")",
"{",
"throw",
"new",
"DataUtilException",
"(",
"\"The delete directory parameter can not be a null value\""... | Delete files in a directory matching a filename filter
@param dir directory
@param filter filename filter, if null then delete all files | [
"Delete",
"files",
"in",
"a",
"directory",
"matching",
"a",
"filename",
"filter"
] | f01de64854c456a88a31ffbe8bac6d605151b496 | https://github.com/btaz/data-util/blob/f01de64854c456a88a31ffbe8bac6d605151b496/src/main/java/com/btaz/util/files/FileDeleter.java#L43-L67 | train |
btaz/data-util | src/main/java/com/btaz/util/unit/ResourceUtil.java | ResourceUtil.readFromFileIntoString | public static String readFromFileIntoString(File file) throws IOException {
FileInputStream inputStream = new FileInputStream(file);
BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream, "UTF-8"));
StringBuilder text = new StringBuilder();
String line;
wh... | java | public static String readFromFileIntoString(File file) throws IOException {
FileInputStream inputStream = new FileInputStream(file);
BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream, "UTF-8"));
StringBuilder text = new StringBuilder();
String line;
wh... | [
"public",
"static",
"String",
"readFromFileIntoString",
"(",
"File",
"file",
")",
"throws",
"IOException",
"{",
"FileInputStream",
"inputStream",
"=",
"new",
"FileInputStream",
"(",
"file",
")",
";",
"BufferedReader",
"reader",
"=",
"new",
"BufferedReader",
"(",
"... | This method reads all data from a file into a String object
@param file file to read text from
@return <code>String</code> containing all file data
@throws IOException IO exception | [
"This",
"method",
"reads",
"all",
"data",
"from",
"a",
"file",
"into",
"a",
"String",
"object"
] | f01de64854c456a88a31ffbe8bac6d605151b496 | https://github.com/btaz/data-util/blob/f01de64854c456a88a31ffbe8bac6d605151b496/src/main/java/com/btaz/util/unit/ResourceUtil.java#L43-L55 | train |
btaz/data-util | src/main/java/com/btaz/util/unit/ResourceUtil.java | ResourceUtil.writeStringToTempFile | public static File writeStringToTempFile(String prefix, String suffix, String data) throws IOException {
File testFile = File.createTempFile(prefix, suffix);
BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(
testFile.getAbsoluteFile(), false),DataUt... | java | public static File writeStringToTempFile(String prefix, String suffix, String data) throws IOException {
File testFile = File.createTempFile(prefix, suffix);
BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(
testFile.getAbsoluteFile(), false),DataUt... | [
"public",
"static",
"File",
"writeStringToTempFile",
"(",
"String",
"prefix",
",",
"String",
"suffix",
",",
"String",
"data",
")",
"throws",
"IOException",
"{",
"File",
"testFile",
"=",
"File",
".",
"createTempFile",
"(",
"prefix",
",",
"suffix",
")",
";",
"... | This method writes all data from a string to a temp file. The file will be automatically deleted on JVM shutdown.
@param prefix file prefix i.e. "abc" in abc.txt
@param suffix file suffix i.e. ".txt" in abc.txt
@param data string containing the data to write to the file
@return <code>File</code> object
@throws IOExcept... | [
"This",
"method",
"writes",
"all",
"data",
"from",
"a",
"string",
"to",
"a",
"temp",
"file",
".",
"The",
"file",
"will",
"be",
"automatically",
"deleted",
"on",
"JVM",
"shutdown",
"."
] | f01de64854c456a88a31ffbe8bac6d605151b496 | https://github.com/btaz/data-util/blob/f01de64854c456a88a31ffbe8bac6d605151b496/src/main/java/com/btaz/util/unit/ResourceUtil.java#L94-L103 | train |
btaz/data-util | src/main/java/com/btaz/util/unit/ResourceUtil.java | ResourceUtil.createRandomData | public static String createRandomData(int rows, int rowLength, boolean skipTrailingNewline) {
Random random = new Random(System.currentTimeMillis());
StringBuilder strb = new StringBuilder();
for(int i=0; i<rows; i++) {
for(int j=0; j<rowLength; j++) {
strb.append((ch... | java | public static String createRandomData(int rows, int rowLength, boolean skipTrailingNewline) {
Random random = new Random(System.currentTimeMillis());
StringBuilder strb = new StringBuilder();
for(int i=0; i<rows; i++) {
for(int j=0; j<rowLength; j++) {
strb.append((ch... | [
"public",
"static",
"String",
"createRandomData",
"(",
"int",
"rows",
",",
"int",
"rowLength",
",",
"boolean",
"skipTrailingNewline",
")",
"{",
"Random",
"random",
"=",
"new",
"Random",
"(",
"System",
".",
"currentTimeMillis",
"(",
")",
")",
";",
"StringBuilde... | This method creates test data containing letters between a-z
@param rows how many rows of data to create
@param rowLength how many characters per row
@param skipTrailingNewline if true then a trailing newline is always added
@return <code>String</code> contain all random data | [
"This",
"method",
"creates",
"test",
"data",
"containing",
"letters",
"between",
"a",
"-",
"z"
] | f01de64854c456a88a31ffbe8bac6d605151b496 | https://github.com/btaz/data-util/blob/f01de64854c456a88a31ffbe8bac6d605151b496/src/main/java/com/btaz/util/unit/ResourceUtil.java#L112-L124 | train |
btaz/data-util | src/main/java/com/btaz/util/unit/ResourceUtil.java | ResourceUtil.createTmpDir | public static File createTmpDir(String directoryName) {
File tmpDir = new File(System.getProperty("java.io.tmpdir"));
File testDir = new File(tmpDir, directoryName);
if(!testDir.mkdir()) {
throw new ResourceUtilException("Can't create directory: " + testDir.getAbsolutePath());
... | java | public static File createTmpDir(String directoryName) {
File tmpDir = new File(System.getProperty("java.io.tmpdir"));
File testDir = new File(tmpDir, directoryName);
if(!testDir.mkdir()) {
throw new ResourceUtilException("Can't create directory: " + testDir.getAbsolutePath());
... | [
"public",
"static",
"File",
"createTmpDir",
"(",
"String",
"directoryName",
")",
"{",
"File",
"tmpDir",
"=",
"new",
"File",
"(",
"System",
".",
"getProperty",
"(",
"\"java.io.tmpdir\"",
")",
")",
";",
"File",
"testDir",
"=",
"new",
"File",
"(",
"tmpDir",
"... | This method will create a new directory in the system temp folder
@param directoryName directory name | [
"This",
"method",
"will",
"create",
"a",
"new",
"directory",
"in",
"the",
"system",
"temp",
"folder"
] | f01de64854c456a88a31ffbe8bac6d605151b496 | https://github.com/btaz/data-util/blob/f01de64854c456a88a31ffbe8bac6d605151b496/src/main/java/com/btaz/util/unit/ResourceUtil.java#L130-L138 | train |
geomajas/geomajas-project-geometry | core/src/main/java/org/geomajas/geometry/service/BboxService.java | BboxService.setCenterPoint | public static Bbox setCenterPoint(Bbox bbox, Coordinate center) {
double x = center.getX() - 0.5 * bbox.getWidth();
double y = center.getY() - 0.5 * bbox.getHeight();
return new Bbox(x, y, bbox.getWidth(), bbox.getHeight());
} | java | public static Bbox setCenterPoint(Bbox bbox, Coordinate center) {
double x = center.getX() - 0.5 * bbox.getWidth();
double y = center.getY() - 0.5 * bbox.getHeight();
return new Bbox(x, y, bbox.getWidth(), bbox.getHeight());
} | [
"public",
"static",
"Bbox",
"setCenterPoint",
"(",
"Bbox",
"bbox",
",",
"Coordinate",
"center",
")",
"{",
"double",
"x",
"=",
"center",
".",
"getX",
"(",
")",
"-",
"0.5",
"*",
"bbox",
".",
"getWidth",
"(",
")",
";",
"double",
"y",
"=",
"center",
".",... | Translate a bounding box by applying a new center point.
@param bbox
The original bounding box to translate. This one will remain untouched.
@param center
The new center point.
@return The result as a new bounding box. | [
"Translate",
"a",
"bounding",
"box",
"by",
"applying",
"a",
"new",
"center",
"point",
"."
] | 09a214fede69c9c01e41630828c4abbb551a557d | https://github.com/geomajas/geomajas-project-geometry/blob/09a214fede69c9c01e41630828c4abbb551a557d/core/src/main/java/org/geomajas/geometry/service/BboxService.java#L80-L84 | train |
geomajas/geomajas-project-geometry | core/src/main/java/org/geomajas/geometry/service/BboxService.java | BboxService.contains | public static boolean contains(Bbox parent, Bbox child) {
if (child.getX() < parent.getX()) {
return false;
}
if (child.getY() < parent.getY()) {
return false;
}
if (child.getMaxX() > parent.getMaxX()) {
return false;
}
if (child.getMaxY() > parent.getMaxY()) {
return false;
}
return true;... | java | public static boolean contains(Bbox parent, Bbox child) {
if (child.getX() < parent.getX()) {
return false;
}
if (child.getY() < parent.getY()) {
return false;
}
if (child.getMaxX() > parent.getMaxX()) {
return false;
}
if (child.getMaxY() > parent.getMaxY()) {
return false;
}
return true;... | [
"public",
"static",
"boolean",
"contains",
"(",
"Bbox",
"parent",
",",
"Bbox",
"child",
")",
"{",
"if",
"(",
"child",
".",
"getX",
"(",
")",
"<",
"parent",
".",
"getX",
"(",
")",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"child",
".",
"ge... | Does one bounding box contain another?
@param parent
The parent bounding box in the relation. Does this one contain the child?
@param child
The child bounding box in the relation. Is this one contained within the parent?
@return true if the child is completely contained(surrounded) by the parent, false otherwise. | [
"Does",
"one",
"bounding",
"box",
"contain",
"another?"
] | 09a214fede69c9c01e41630828c4abbb551a557d | https://github.com/geomajas/geomajas-project-geometry/blob/09a214fede69c9c01e41630828c4abbb551a557d/core/src/main/java/org/geomajas/geometry/service/BboxService.java#L106-L120 | train |
geomajas/geomajas-project-geometry | core/src/main/java/org/geomajas/geometry/service/BboxService.java | BboxService.contains | public static boolean contains(Bbox bbox, Coordinate coordinate) {
if (bbox.getX() >= coordinate.getX()) {
return false;
}
if (bbox.getY() >= coordinate.getY()) {
return false;
}
if (bbox.getMaxX() <= coordinate.getX()) {
return false;
}
if (bbox.getMaxY() <= coordinate.getY()) {
return false;... | java | public static boolean contains(Bbox bbox, Coordinate coordinate) {
if (bbox.getX() >= coordinate.getX()) {
return false;
}
if (bbox.getY() >= coordinate.getY()) {
return false;
}
if (bbox.getMaxX() <= coordinate.getX()) {
return false;
}
if (bbox.getMaxY() <= coordinate.getY()) {
return false;... | [
"public",
"static",
"boolean",
"contains",
"(",
"Bbox",
"bbox",
",",
"Coordinate",
"coordinate",
")",
"{",
"if",
"(",
"bbox",
".",
"getX",
"(",
")",
">=",
"coordinate",
".",
"getX",
"(",
")",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"bbox",
... | Is the given coordinate contained within the bounding box or not? If the coordinate is on the bounding box
border, it is considered outside.
@param bbox
The bounding box.
@param coordinate
The coordinate to check.
@return True if the coordinate is within the bounding box, false otherwise.
@since 1.1.0 | [
"Is",
"the",
"given",
"coordinate",
"contained",
"within",
"the",
"bounding",
"box",
"or",
"not?",
"If",
"the",
"coordinate",
"is",
"on",
"the",
"bounding",
"box",
"border",
"it",
"is",
"considered",
"outside",
"."
] | 09a214fede69c9c01e41630828c4abbb551a557d | https://github.com/geomajas/geomajas-project-geometry/blob/09a214fede69c9c01e41630828c4abbb551a557d/core/src/main/java/org/geomajas/geometry/service/BboxService.java#L133-L147 | train |
geomajas/geomajas-project-geometry | core/src/main/java/org/geomajas/geometry/service/BboxService.java | BboxService.intersects | public static boolean intersects(Bbox one, Bbox two) {
if (two.getX() > one.getMaxX()) {
return false;
}
if (two.getY() > one.getMaxY()) {
return false;
}
if (two.getMaxX() < one.getX()) {
return false;
}
if (two.getMaxY() < one.getY()) {
return false;
}
return true;
} | java | public static boolean intersects(Bbox one, Bbox two) {
if (two.getX() > one.getMaxX()) {
return false;
}
if (two.getY() > one.getMaxY()) {
return false;
}
if (two.getMaxX() < one.getX()) {
return false;
}
if (two.getMaxY() < one.getY()) {
return false;
}
return true;
} | [
"public",
"static",
"boolean",
"intersects",
"(",
"Bbox",
"one",
",",
"Bbox",
"two",
")",
"{",
"if",
"(",
"two",
".",
"getX",
"(",
")",
">",
"one",
".",
"getMaxX",
"(",
")",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"two",
".",
"getY",
... | Does one bounding box intersect another?
@param one
The first bounding box.
@param two
The second bounding box.
@return true if the both bounding boxes intersect, false otherwise. | [
"Does",
"one",
"bounding",
"box",
"intersect",
"another?"
] | 09a214fede69c9c01e41630828c4abbb551a557d | https://github.com/geomajas/geomajas-project-geometry/blob/09a214fede69c9c01e41630828c4abbb551a557d/core/src/main/java/org/geomajas/geometry/service/BboxService.java#L158-L172 | train |
geomajas/geomajas-project-geometry | core/src/main/java/org/geomajas/geometry/service/BboxService.java | BboxService.intersection | public static Bbox intersection(Bbox one, Bbox two) {
if (!intersects(one, two)) {
return null;
} else {
double minx = two.getX() > one.getX() ? two.getX() : one.getX();
double maxx = two.getMaxX() < one.getMaxX() ? two.getMaxX() : one.getMaxX();
double miny = two.getY() > one.getY() ? two.getY() : one.... | java | public static Bbox intersection(Bbox one, Bbox two) {
if (!intersects(one, two)) {
return null;
} else {
double minx = two.getX() > one.getX() ? two.getX() : one.getX();
double maxx = two.getMaxX() < one.getMaxX() ? two.getMaxX() : one.getMaxX();
double miny = two.getY() > one.getY() ? two.getY() : one.... | [
"public",
"static",
"Bbox",
"intersection",
"(",
"Bbox",
"one",
",",
"Bbox",
"two",
")",
"{",
"if",
"(",
"!",
"intersects",
"(",
"one",
",",
"two",
")",
")",
"{",
"return",
"null",
";",
"}",
"else",
"{",
"double",
"minx",
"=",
"two",
".",
"getX",
... | Calculates the intersection between 2 bounding boxes.
@param one
The first bounding box.
@param two
The second bounding box.
@return A new bounding box representing intersection or null if they do not intersect. | [
"Calculates",
"the",
"intersection",
"between",
"2",
"bounding",
"boxes",
"."
] | 09a214fede69c9c01e41630828c4abbb551a557d | https://github.com/geomajas/geomajas-project-geometry/blob/09a214fede69c9c01e41630828c4abbb551a557d/core/src/main/java/org/geomajas/geometry/service/BboxService.java#L183-L193 | train |
geomajas/geomajas-project-geometry | core/src/main/java/org/geomajas/geometry/service/BboxService.java | BboxService.buffer | public static Bbox buffer(Bbox bbox, double range) {
if (range >= 0) {
double r2 = range * 2;
return new Bbox(bbox.getX() - range, bbox.getY() - range, bbox.getWidth() + r2, bbox.getHeight() + r2);
}
throw new IllegalArgumentException("Buffer range must always be positive.");
} | java | public static Bbox buffer(Bbox bbox, double range) {
if (range >= 0) {
double r2 = range * 2;
return new Bbox(bbox.getX() - range, bbox.getY() - range, bbox.getWidth() + r2, bbox.getHeight() + r2);
}
throw new IllegalArgumentException("Buffer range must always be positive.");
} | [
"public",
"static",
"Bbox",
"buffer",
"(",
"Bbox",
"bbox",
",",
"double",
"range",
")",
"{",
"if",
"(",
"range",
">=",
"0",
")",
"{",
"double",
"r2",
"=",
"range",
"*",
"2",
";",
"return",
"new",
"Bbox",
"(",
"bbox",
".",
"getX",
"(",
")",
"-",
... | Return a new bounding box that has increased in size by adding a range to a given bounding box.
@param bbox
The original bounding box to calculate a buffer for. This one will remain untouched.
@param range
Must be a positive number, otherwise null will be returned.
@return The result as a new bounding box. | [
"Return",
"a",
"new",
"bounding",
"box",
"that",
"has",
"increased",
"in",
"size",
"by",
"adding",
"a",
"range",
"to",
"a",
"given",
"bounding",
"box",
"."
] | 09a214fede69c9c01e41630828c4abbb551a557d | https://github.com/geomajas/geomajas-project-geometry/blob/09a214fede69c9c01e41630828c4abbb551a557d/core/src/main/java/org/geomajas/geometry/service/BboxService.java#L228-L234 | train |
geomajas/geomajas-project-geometry | core/src/main/java/org/geomajas/geometry/service/BboxService.java | BboxService.translate | public static Bbox translate(Bbox bbox, double deltaX, double deltaY) {
return new Bbox(bbox.getX() + deltaX, bbox.getY() + deltaY, bbox.getWidth(), bbox.getHeight());
} | java | public static Bbox translate(Bbox bbox, double deltaX, double deltaY) {
return new Bbox(bbox.getX() + deltaX, bbox.getY() + deltaY, bbox.getWidth(), bbox.getHeight());
} | [
"public",
"static",
"Bbox",
"translate",
"(",
"Bbox",
"bbox",
",",
"double",
"deltaX",
",",
"double",
"deltaY",
")",
"{",
"return",
"new",
"Bbox",
"(",
"bbox",
".",
"getX",
"(",
")",
"+",
"deltaX",
",",
"bbox",
".",
"getY",
"(",
")",
"+",
"deltaY",
... | Translate the given bounding box.
@param bbox
The original bounding box to scale. This one will remain untouched.
@param deltaX
Translation factor along the X-axis.
@param deltaY
Translation factor along the Y-axis.
@return The result as a new bounding box. | [
"Translate",
"the",
"given",
"bounding",
"box",
"."
] | 09a214fede69c9c01e41630828c4abbb551a557d | https://github.com/geomajas/geomajas-project-geometry/blob/09a214fede69c9c01e41630828c4abbb551a557d/core/src/main/java/org/geomajas/geometry/service/BboxService.java#L267-L269 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.