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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
TheHortonMachine/hortonmachine | gears/src/main/java/org/hortonmachine/gears/utils/geometry/GeometryUtilities.java | GeometryUtilities.createDummyPolygon | public static Polygon createDummyPolygon() {
Coordinate[] c = new Coordinate[]{new Coordinate(0.0, 0.0), new Coordinate(1.0, 1.0), new Coordinate(1.0, 0.0),
new Coordinate(0.0, 0.0)};
LinearRing linearRing = gf().createLinearRing(c);
return gf().createPolygon(linearRing, null);
... | java | public static Polygon createDummyPolygon() {
Coordinate[] c = new Coordinate[]{new Coordinate(0.0, 0.0), new Coordinate(1.0, 1.0), new Coordinate(1.0, 0.0),
new Coordinate(0.0, 0.0)};
LinearRing linearRing = gf().createLinearRing(c);
return gf().createPolygon(linearRing, null);
... | [
"public",
"static",
"Polygon",
"createDummyPolygon",
"(",
")",
"{",
"Coordinate",
"[",
"]",
"c",
"=",
"new",
"Coordinate",
"[",
"]",
"{",
"new",
"Coordinate",
"(",
"0.0",
",",
"0.0",
")",
",",
"new",
"Coordinate",
"(",
"1.0",
",",
"1.0",
")",
",",
"n... | Creates a polygon that may help out as placeholder.
@return a dummy {@link Polygon}. | [
"Creates",
"a",
"polygon",
"that",
"may",
"help",
"out",
"as",
"placeholder",
"."
] | d2b436bbdf951dc1fda56096a42dbc0eae4d35a5 | https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/utils/geometry/GeometryUtilities.java#L124-L129 | train |
TheHortonMachine/hortonmachine | gears/src/main/java/org/hortonmachine/gears/utils/geometry/GeometryUtilities.java | GeometryUtilities.createDummyLine | public static LineString createDummyLine() {
Coordinate[] c = new Coordinate[]{new Coordinate(0.0, 0.0), new Coordinate(1.0, 1.0), new Coordinate(1.0, 0.0)};
LineString lineString = gf().createLineString(c);
return lineString;
} | java | public static LineString createDummyLine() {
Coordinate[] c = new Coordinate[]{new Coordinate(0.0, 0.0), new Coordinate(1.0, 1.0), new Coordinate(1.0, 0.0)};
LineString lineString = gf().createLineString(c);
return lineString;
} | [
"public",
"static",
"LineString",
"createDummyLine",
"(",
")",
"{",
"Coordinate",
"[",
"]",
"c",
"=",
"new",
"Coordinate",
"[",
"]",
"{",
"new",
"Coordinate",
"(",
"0.0",
",",
"0.0",
")",
",",
"new",
"Coordinate",
"(",
"1.0",
",",
"1.0",
")",
",",
"n... | Creates a line that may help out as placeholder.
@return a dummy {@link LineString}. | [
"Creates",
"a",
"line",
"that",
"may",
"help",
"out",
"as",
"placeholder",
"."
] | d2b436bbdf951dc1fda56096a42dbc0eae4d35a5 | https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/utils/geometry/GeometryUtilities.java#L136-L140 | train |
TheHortonMachine/hortonmachine | gears/src/main/java/org/hortonmachine/gears/utils/geometry/GeometryUtilities.java | GeometryUtilities.getPolygonArea | public static double getPolygonArea( int[] x, int[] y, int N ) {
int i, j;
double area = 0;
for( i = 0; i < N; i++ ) {
j = (i + 1) % N;
area += x[i] * y[j];
area -= y[i] * x[j];
}
area /= 2;
return (area < 0 ? -area : area);
} | java | public static double getPolygonArea( int[] x, int[] y, int N ) {
int i, j;
double area = 0;
for( i = 0; i < N; i++ ) {
j = (i + 1) % N;
area += x[i] * y[j];
area -= y[i] * x[j];
}
area /= 2;
return (area < 0 ? -area : area);
} | [
"public",
"static",
"double",
"getPolygonArea",
"(",
"int",
"[",
"]",
"x",
",",
"int",
"[",
"]",
"y",
",",
"int",
"N",
")",
"{",
"int",
"i",
",",
"j",
";",
"double",
"area",
"=",
"0",
";",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"N",
";",... | Calculates the area of a polygon from its vertices.
@param x the array of x coordinates.
@param y the array of y coordinates.
@param N the number of sides of the polygon.
@return the area of the polygon. | [
"Calculates",
"the",
"area",
"of",
"a",
"polygon",
"from",
"its",
"vertices",
"."
] | d2b436bbdf951dc1fda56096a42dbc0eae4d35a5 | https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/utils/geometry/GeometryUtilities.java#L284-L296 | train |
TheHortonMachine/hortonmachine | gears/src/main/java/org/hortonmachine/gears/utils/geometry/GeometryUtilities.java | GeometryUtilities.distance3d | public static double distance3d( Coordinate c1, Coordinate c2, GeodeticCalculator geodeticCalculator ) {
if (Double.isNaN(c1.z) || Double.isNaN(c2.z)) {
throw new IllegalArgumentException("Missing elevation information in the supplied coordinates.");
}
double deltaElev = Math.abs(c1.... | java | public static double distance3d( Coordinate c1, Coordinate c2, GeodeticCalculator geodeticCalculator ) {
if (Double.isNaN(c1.z) || Double.isNaN(c2.z)) {
throw new IllegalArgumentException("Missing elevation information in the supplied coordinates.");
}
double deltaElev = Math.abs(c1.... | [
"public",
"static",
"double",
"distance3d",
"(",
"Coordinate",
"c1",
",",
"Coordinate",
"c2",
",",
"GeodeticCalculator",
"geodeticCalculator",
")",
"{",
"if",
"(",
"Double",
".",
"isNaN",
"(",
"c1",
".",
"z",
")",
"||",
"Double",
".",
"isNaN",
"(",
"c2",
... | Calculates the 3d distance between two coordinates that have an elevation information.
<p>Note that the {@link Coordinate#distance(Coordinate)} method does only 2d.
@param c1 coordinate 1.
@param c2 coordinate 2.
@param geodeticCalculator If supplied it will be used for planar distance calculation.
@return the distan... | [
"Calculates",
"the",
"3d",
"distance",
"between",
"two",
"coordinates",
"that",
"have",
"an",
"elevation",
"information",
"."
] | d2b436bbdf951dc1fda56096a42dbc0eae4d35a5 | https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/utils/geometry/GeometryUtilities.java#L308-L324 | train |
TheHortonMachine/hortonmachine | gears/src/main/java/org/hortonmachine/gears/utils/geometry/GeometryUtilities.java | GeometryUtilities.lines2Polygon | public static Polygon lines2Polygon( boolean checkValid, LineString... lines ) {
List<Coordinate> coordinatesList = new ArrayList<Coordinate>();
List<LineString> linesList = new ArrayList<LineString>();
for( LineString tmpLine : lines ) {
linesList.add(tmpLine);
}
L... | java | public static Polygon lines2Polygon( boolean checkValid, LineString... lines ) {
List<Coordinate> coordinatesList = new ArrayList<Coordinate>();
List<LineString> linesList = new ArrayList<LineString>();
for( LineString tmpLine : lines ) {
linesList.add(tmpLine);
}
L... | [
"public",
"static",
"Polygon",
"lines2Polygon",
"(",
"boolean",
"checkValid",
",",
"LineString",
"...",
"lines",
")",
"{",
"List",
"<",
"Coordinate",
">",
"coordinatesList",
"=",
"new",
"ArrayList",
"<",
"Coordinate",
">",
"(",
")",
";",
"List",
"<",
"LineSt... | Joins two lines to a polygon.
@param checkValid checks if the resulting polygon is valid.
@param lines the lines to use.
@return the joined polygon or <code>null</code> if something ugly happened. | [
"Joins",
"two",
"lines",
"to",
"a",
"polygon",
"."
] | d2b436bbdf951dc1fda56096a42dbc0eae4d35a5 | https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/utils/geometry/GeometryUtilities.java#L351-L413 | train |
TheHortonMachine/hortonmachine | gears/src/main/java/org/hortonmachine/gears/utils/geometry/GeometryUtilities.java | GeometryUtilities.getCoordinatesAtInterval | public static List<Coordinate> getCoordinatesAtInterval( LineString line, double interval, boolean keepExisting,
double startFrom, double endAt ) {
if (interval <= 0) {
throw new IllegalArgumentException("Interval needs to be > 0.");
}
double length = line.getLength();
... | java | public static List<Coordinate> getCoordinatesAtInterval( LineString line, double interval, boolean keepExisting,
double startFrom, double endAt ) {
if (interval <= 0) {
throw new IllegalArgumentException("Interval needs to be > 0.");
}
double length = line.getLength();
... | [
"public",
"static",
"List",
"<",
"Coordinate",
">",
"getCoordinatesAtInterval",
"(",
"LineString",
"line",
",",
"double",
"interval",
",",
"boolean",
"keepExisting",
",",
"double",
"startFrom",
",",
"double",
"endAt",
")",
"{",
"if",
"(",
"interval",
"<=",
"0"... | Returns the coordinates at a given interval along the line.
<p>
Note that first and last coordinate are also added, making it
likely that the interval between the last two coordinates is less
than the supplied interval.
</p>
@param line the line to use.
@param interval the interval to use as distance between coordin... | [
"Returns",
"the",
"coordinates",
"at",
"a",
"given",
"interval",
"along",
"the",
"line",
"."
] | d2b436bbdf951dc1fda56096a42dbc0eae4d35a5 | https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/utils/geometry/GeometryUtilities.java#L433-L481 | train |
TheHortonMachine/hortonmachine | gears/src/main/java/org/hortonmachine/gears/utils/geometry/GeometryUtilities.java | GeometryUtilities.getSectionsAtInterval | public static List<LineString> getSectionsAtInterval( LineString line, double interval, double width, double startFrom,
double endAt ) {
if (interval <= 0) {
throw new IllegalArgumentException("Interval needs to be > 0.");
}
double length = line.getLength();
if (s... | java | public static List<LineString> getSectionsAtInterval( LineString line, double interval, double width, double startFrom,
double endAt ) {
if (interval <= 0) {
throw new IllegalArgumentException("Interval needs to be > 0.");
}
double length = line.getLength();
if (s... | [
"public",
"static",
"List",
"<",
"LineString",
">",
"getSectionsAtInterval",
"(",
"LineString",
"line",
",",
"double",
"interval",
",",
"double",
"width",
",",
"double",
"startFrom",
",",
"double",
"endAt",
")",
"{",
"if",
"(",
"interval",
"<=",
"0",
")",
... | Returns the section line at a given interval along the line.
<p>
The returned lines are digitized from left to right and contain also the
center point.
</p>
<p>
Note that first and last coordinate's section are also added, making it
likely that the interval between the last two coordinates is less
than the supplied in... | [
"Returns",
"the",
"section",
"line",
"at",
"a",
"given",
"interval",
"along",
"the",
"line",
"."
] | d2b436bbdf951dc1fda56096a42dbc0eae4d35a5 | https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/utils/geometry/GeometryUtilities.java#L560-L594 | train |
TheHortonMachine/hortonmachine | gears/src/main/java/org/hortonmachine/gears/utils/geometry/GeometryUtilities.java | GeometryUtilities.scaleToRatio | public static void scaleToRatio( Rectangle2D fixed, Rectangle2D toScale, boolean doShrink ) {
double origWidth = fixed.getWidth();
double origHeight = fixed.getHeight();
double toAdaptWidth = toScale.getWidth();
double toAdaptHeight = toScale.getHeight();
double scaleWidth = 0;
... | java | public static void scaleToRatio( Rectangle2D fixed, Rectangle2D toScale, boolean doShrink ) {
double origWidth = fixed.getWidth();
double origHeight = fixed.getHeight();
double toAdaptWidth = toScale.getWidth();
double toAdaptHeight = toScale.getHeight();
double scaleWidth = 0;
... | [
"public",
"static",
"void",
"scaleToRatio",
"(",
"Rectangle2D",
"fixed",
",",
"Rectangle2D",
"toScale",
",",
"boolean",
"doShrink",
")",
"{",
"double",
"origWidth",
"=",
"fixed",
".",
"getWidth",
"(",
")",
";",
"double",
"origHeight",
"=",
"fixed",
".",
"get... | Extends or shrinks a rectangle following the ration of a fixed one.
<p>This keeps the center point of the rectangle fixed.</p>
@param fixed the fixed {@link Rectangle2D} to use for the ratio.
@param toScale the {@link Rectangle2D} to adapt to the ratio of the fixed one.
@param doShrink if <code>true</code>, the adapt... | [
"Extends",
"or",
"shrinks",
"a",
"rectangle",
"following",
"the",
"ration",
"of",
"a",
"fixed",
"one",
"."
] | d2b436bbdf951dc1fda56096a42dbc0eae4d35a5 | https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/utils/geometry/GeometryUtilities.java#L679-L708 | train |
TheHortonMachine/hortonmachine | gears/src/main/java/org/hortonmachine/gears/utils/geometry/GeometryUtilities.java | GeometryUtilities.scaleDownToFit | public static void scaleDownToFit( Rectangle2D rectToFitIn, Rectangle2D toScale ) {
double fitWidth = rectToFitIn.getWidth();
double fitHeight = rectToFitIn.getHeight();
double toScaleWidth = toScale.getWidth();
double toScaleHeight = toScale.getHeight();
if (toScaleWidth > fit... | java | public static void scaleDownToFit( Rectangle2D rectToFitIn, Rectangle2D toScale ) {
double fitWidth = rectToFitIn.getWidth();
double fitHeight = rectToFitIn.getHeight();
double toScaleWidth = toScale.getWidth();
double toScaleHeight = toScale.getHeight();
if (toScaleWidth > fit... | [
"public",
"static",
"void",
"scaleDownToFit",
"(",
"Rectangle2D",
"rectToFitIn",
",",
"Rectangle2D",
"toScale",
")",
"{",
"double",
"fitWidth",
"=",
"rectToFitIn",
".",
"getWidth",
"(",
")",
";",
"double",
"fitHeight",
"=",
"rectToFitIn",
".",
"getHeight",
"(",
... | Scales a rectangle down to fit inside the given one, keeping the ratio.
@param rectToFitIn the fixed rectangle to fit in.
@param toScale the rectangle to scale. | [
"Scales",
"a",
"rectangle",
"down",
"to",
"fit",
"inside",
"the",
"given",
"one",
"keeping",
"the",
"ratio",
"."
] | d2b436bbdf951dc1fda56096a42dbc0eae4d35a5 | https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/utils/geometry/GeometryUtilities.java#L716-L734 | train |
TheHortonMachine/hortonmachine | gears/src/main/java/org/hortonmachine/gears/utils/geometry/GeometryUtilities.java | GeometryUtilities.getLineWithPlaneIntersection | public static Coordinate getLineWithPlaneIntersection( Coordinate lC1, Coordinate lC2, Coordinate pC1, Coordinate pC2,
Coordinate pC3 ) {
double[] p = getPlaneCoefficientsFrom3Points(pC1, pC2, pC3);
double denominator = p[0] * (lC1.x - lC2.x) + p[1] * (lC1.y - lC2.y) + p[2] * (lC1.z - lC2.z... | java | public static Coordinate getLineWithPlaneIntersection( Coordinate lC1, Coordinate lC2, Coordinate pC1, Coordinate pC2,
Coordinate pC3 ) {
double[] p = getPlaneCoefficientsFrom3Points(pC1, pC2, pC3);
double denominator = p[0] * (lC1.x - lC2.x) + p[1] * (lC1.y - lC2.y) + p[2] * (lC1.z - lC2.z... | [
"public",
"static",
"Coordinate",
"getLineWithPlaneIntersection",
"(",
"Coordinate",
"lC1",
",",
"Coordinate",
"lC2",
",",
"Coordinate",
"pC1",
",",
"Coordinate",
"pC2",
",",
"Coordinate",
"pC3",
")",
"{",
"double",
"[",
"]",
"p",
"=",
"getPlaneCoefficientsFrom3Po... | Get the intersection coordinate between a line and plane.
<p>The line is defined by 2 3d coordinates and the plane by 3 3d coordinates.</p>
<p>from http://paulbourke.net/geometry/pointlineplane/</p>
@param lC1 line coordinate 1.
@param lC2 line coordinate 2.
@param pC1 plane coordinate 1.
@param pC2 plane coordinate... | [
"Get",
"the",
"intersection",
"coordinate",
"between",
"a",
"line",
"and",
"plane",
"."
] | d2b436bbdf951dc1fda56096a42dbc0eae4d35a5 | https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/utils/geometry/GeometryUtilities.java#L766-L780 | train |
TheHortonMachine/hortonmachine | gears/src/main/java/org/hortonmachine/gears/utils/geometry/GeometryUtilities.java | GeometryUtilities.getAngleBetweenLinePlane | public static double getAngleBetweenLinePlane( Coordinate a, Coordinate d, Coordinate b, Coordinate c ) {
double[] rAD = {d.x - a.x, d.y - a.y, d.z - a.z};
double[] rDB = {b.x - d.x, b.y - d.y, b.z - d.z};
double[] rDC = {c.x - d.x, c.y - d.y, c.z - d.z};
double[] n = {//
... | java | public static double getAngleBetweenLinePlane( Coordinate a, Coordinate d, Coordinate b, Coordinate c ) {
double[] rAD = {d.x - a.x, d.y - a.y, d.z - a.z};
double[] rDB = {b.x - d.x, b.y - d.y, b.z - d.z};
double[] rDC = {c.x - d.x, c.y - d.y, c.z - d.z};
double[] n = {//
... | [
"public",
"static",
"double",
"getAngleBetweenLinePlane",
"(",
"Coordinate",
"a",
",",
"Coordinate",
"d",
",",
"Coordinate",
"b",
",",
"Coordinate",
"c",
")",
"{",
"double",
"[",
"]",
"rAD",
"=",
"{",
"d",
".",
"x",
"-",
"a",
".",
"x",
",",
"d",
".",... | Calculates the angle between line and plane.
http://geogebrawiki.wikispaces.com/3D+Geometry
@param a the 3d point.
@param d the point of intersection between line and plane.
@param b the second plane coordinate.
@param c the third plane coordinate.
@return the angle in degrees between line and plane. | [
"Calculates",
"the",
"angle",
"between",
"line",
"and",
"plane",
"."
] | d2b436bbdf951dc1fda56096a42dbc0eae4d35a5 | https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/utils/geometry/GeometryUtilities.java#L793-L810 | train |
TheHortonMachine/hortonmachine | gears/src/main/java/org/hortonmachine/gears/utils/geometry/GeometryUtilities.java | GeometryUtilities.getAngleInTriangle | public static double getAngleInTriangle( double a, double b, double c ) {
double angle = Math.acos((a * a + b * b - c * c) / (2.0 * a * b));
return angle;
} | java | public static double getAngleInTriangle( double a, double b, double c ) {
double angle = Math.acos((a * a + b * b - c * c) / (2.0 * a * b));
return angle;
} | [
"public",
"static",
"double",
"getAngleInTriangle",
"(",
"double",
"a",
",",
"double",
"b",
",",
"double",
"c",
")",
"{",
"double",
"angle",
"=",
"Math",
".",
"acos",
"(",
"(",
"a",
"*",
"a",
"+",
"b",
"*",
"b",
"-",
"c",
"*",
"c",
")",
"/",
"(... | Uses the cosine rule to find an angle in radiants of a triangle defined by the length of its sides.
<p>The calculated angle is the one between the two adjacent sides a and b.</p>
@param a adjacent side 1 length.
@param b adjacent side 2 length.
@param c opposite side length.
@return the angle in radiants. | [
"Uses",
"the",
"cosine",
"rule",
"to",
"find",
"an",
"angle",
"in",
"radiants",
"of",
"a",
"triangle",
"defined",
"by",
"the",
"length",
"of",
"its",
"sides",
"."
] | d2b436bbdf951dc1fda56096a42dbc0eae4d35a5 | https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/utils/geometry/GeometryUtilities.java#L837-L840 | train |
TheHortonMachine/hortonmachine | gears/src/main/java/org/hortonmachine/gears/utils/geometry/GeometryUtilities.java | GeometryUtilities.angleBetween3D | public static double angleBetween3D( Coordinate c1, Coordinate c2, Coordinate c3 ) {
double a = distance3d(c2, c1, null);
double b = distance3d(c2, c3, null);
double c = distance3d(c1, c3, null);
double angleInTriangle = getAngleInTriangle(a, b, c);
double degrees = toDegrees(an... | java | public static double angleBetween3D( Coordinate c1, Coordinate c2, Coordinate c3 ) {
double a = distance3d(c2, c1, null);
double b = distance3d(c2, c3, null);
double c = distance3d(c1, c3, null);
double angleInTriangle = getAngleInTriangle(a, b, c);
double degrees = toDegrees(an... | [
"public",
"static",
"double",
"angleBetween3D",
"(",
"Coordinate",
"c1",
",",
"Coordinate",
"c2",
",",
"Coordinate",
"c3",
")",
"{",
"double",
"a",
"=",
"distance3d",
"(",
"c2",
",",
"c1",
",",
"null",
")",
";",
"double",
"b",
"=",
"distance3d",
"(",
"... | Calculates the angle in degrees between 3 3D coordinates.
<p>The calculated angle is the one placed in vertex c2.</p>
@param c1 first 3D point.
@param c2 central 3D point.
@param c3 last 3D point.
@return the angle between the coordinates in degrees. | [
"Calculates",
"the",
"angle",
"in",
"degrees",
"between",
"3",
"3D",
"coordinates",
"."
] | d2b436bbdf951dc1fda56096a42dbc0eae4d35a5 | https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/utils/geometry/GeometryUtilities.java#L852-L860 | train |
TheHortonMachine/hortonmachine | gears/src/main/java/org/hortonmachine/gears/utils/geometry/GeometryUtilities.java | GeometryUtilities.mergeLinestrings | @SuppressWarnings("unchecked")
public static List<LineString> mergeLinestrings( List<LineString> multiLines ) {
LineMerger lineMerger = new LineMerger();
for( int i = 0; i < multiLines.size(); i++ ) {
Geometry line = multiLines.get(i);
lineMerger.add(line);
}
... | java | @SuppressWarnings("unchecked")
public static List<LineString> mergeLinestrings( List<LineString> multiLines ) {
LineMerger lineMerger = new LineMerger();
for( int i = 0; i < multiLines.size(); i++ ) {
Geometry line = multiLines.get(i);
lineMerger.add(line);
}
... | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"List",
"<",
"LineString",
">",
"mergeLinestrings",
"(",
"List",
"<",
"LineString",
">",
"multiLines",
")",
"{",
"LineMerger",
"lineMerger",
"=",
"new",
"LineMerger",
"(",
")",
";",
"for",... | Tries to merge multilines when they are snapped properly.
@param multiLines the lines to merge.
@return the list of lines, ideally containing a single line,merged. | [
"Tries",
"to",
"merge",
"multilines",
"when",
"they",
"are",
"snapped",
"properly",
"."
] | d2b436bbdf951dc1fda56096a42dbc0eae4d35a5 | https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/utils/geometry/GeometryUtilities.java#L921-L934 | train |
TheHortonMachine/hortonmachine | gears/src/main/java/org/hortonmachine/gears/utils/geometry/GeometryUtilities.java | GeometryUtilities.createSimpleDirectionArrow | public static List<Polygon> createSimpleDirectionArrow( Geometry... geometries ) {
List<Polygon> polygons = new ArrayList<>();
for( Geometry geometry : geometries ) {
for( int i = 0; i < geometry.getNumGeometries(); i++ ) {
Geometry geometryN = geometry.getGeometryN(i);
... | java | public static List<Polygon> createSimpleDirectionArrow( Geometry... geometries ) {
List<Polygon> polygons = new ArrayList<>();
for( Geometry geometry : geometries ) {
for( int i = 0; i < geometry.getNumGeometries(); i++ ) {
Geometry geometryN = geometry.getGeometryN(i);
... | [
"public",
"static",
"List",
"<",
"Polygon",
">",
"createSimpleDirectionArrow",
"(",
"Geometry",
"...",
"geometries",
")",
"{",
"List",
"<",
"Polygon",
">",
"polygons",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"for",
"(",
"Geometry",
"geometry",
":",
"... | Creates simple arrow polygons in the direction of the coordinates.
@param geometries the geometries (lines and polygons) for which to create the arrows.
@return the list of polygon arrows. | [
"Creates",
"simple",
"arrow",
"polygons",
"in",
"the",
"direction",
"of",
"the",
"coordinates",
"."
] | d2b436bbdf951dc1fda56096a42dbc0eae4d35a5 | https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/utils/geometry/GeometryUtilities.java#L961-L982 | train |
enasequence/sequencetools | src/main/java/uk/ac/ebi/embl/api/entry/location/Location.java | Location.overlaps | public boolean overlaps(Location location) {
if (location.getBeginPosition()>=getBeginPosition() && location.getBeginPosition() <= getEndPosition())
return true;
if(location.getBeginPosition() <= getBeginPosition() && location.getEndPosition()>=getBeginPosition())
return tr... | java | public boolean overlaps(Location location) {
if (location.getBeginPosition()>=getBeginPosition() && location.getBeginPosition() <= getEndPosition())
return true;
if(location.getBeginPosition() <= getBeginPosition() && location.getEndPosition()>=getBeginPosition())
return tr... | [
"public",
"boolean",
"overlaps",
"(",
"Location",
"location",
")",
"{",
"if",
"(",
"location",
".",
"getBeginPosition",
"(",
")",
">=",
"getBeginPosition",
"(",
")",
"&&",
"location",
".",
"getBeginPosition",
"(",
")",
"<=",
"getEndPosition",
"(",
")",
")",
... | 6361..6539,6363..6649 | [
"6361",
"..",
"6539",
"6363",
"..",
"6649"
] | 4127f5e1a17540239f5810136153fbd6737fa262 | https://github.com/enasequence/sequencetools/blob/4127f5e1a17540239f5810136153fbd6737fa262/src/main/java/uk/ac/ebi/embl/api/entry/location/Location.java#L95-L103 | train |
TheHortonMachine/hortonmachine | gears/src/main/java/org/hortonmachine/gears/libs/modules/JGTProcessingRegion.java | JGTProcessingRegion.fixRowsAndCols | private void fixRowsAndCols() {
rows = (int) Math.round((north - south) / ns_res);
if (rows < 1)
rows = 1;
cols = (int) Math.round((east - west) / we_res);
if (cols < 1)
cols = 1;
} | java | private void fixRowsAndCols() {
rows = (int) Math.round((north - south) / ns_res);
if (rows < 1)
rows = 1;
cols = (int) Math.round((east - west) / we_res);
if (cols < 1)
cols = 1;
} | [
"private",
"void",
"fixRowsAndCols",
"(",
")",
"{",
"rows",
"=",
"(",
"int",
")",
"Math",
".",
"round",
"(",
"(",
"north",
"-",
"south",
")",
"/",
"ns_res",
")",
";",
"if",
"(",
"rows",
"<",
"1",
")",
"rows",
"=",
"1",
";",
"cols",
"=",
"(",
... | calculates rows and cols from the region and its resolution.
<p>
Rows and cols have to be integers, rounding is applied if required.
</p> | [
"calculates",
"rows",
"and",
"cols",
"from",
"the",
"region",
"and",
"its",
"resolution",
"."
] | d2b436bbdf951dc1fda56096a42dbc0eae4d35a5 | https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/libs/modules/JGTProcessingRegion.java#L361-L368 | train |
TheHortonMachine/hortonmachine | gears/src/main/java/org/hortonmachine/gears/libs/modules/JGTProcessingRegion.java | JGTProcessingRegion.degreeToNumber | private double degreeToNumber( String value ) {
double number = -1;
String[] valueSplit = value.trim().split(":"); //$NON-NLS-1$
if (valueSplit.length == 3) {
// deg:min:sec.ss
double deg = Double.parseDouble(valueSplit[0]);
double min = Double.parseDouble(va... | java | private double degreeToNumber( String value ) {
double number = -1;
String[] valueSplit = value.trim().split(":"); //$NON-NLS-1$
if (valueSplit.length == 3) {
// deg:min:sec.ss
double deg = Double.parseDouble(valueSplit[0]);
double min = Double.parseDouble(va... | [
"private",
"double",
"degreeToNumber",
"(",
"String",
"value",
")",
"{",
"double",
"number",
"=",
"-",
"1",
";",
"String",
"[",
"]",
"valueSplit",
"=",
"value",
".",
"trim",
"(",
")",
".",
"split",
"(",
"\":\"",
")",
";",
"//$NON-NLS-1$",
"if",
"(",
... | Transforms degree string into the decimal value.
@param value the string in degrees.
@return the translated value. | [
"Transforms",
"degree",
"string",
"into",
"the",
"decimal",
"value",
"."
] | d2b436bbdf951dc1fda56096a42dbc0eae4d35a5 | https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/libs/modules/JGTProcessingRegion.java#L459-L479 | train |
TheHortonMachine/hortonmachine | gears/src/main/java/org/hortonmachine/gears/libs/modules/JGTProcessingRegion.java | JGTProcessingRegion.xyResStringToNumbers | private double[] xyResStringToNumbers( String ewres, String nsres ) {
double xres = -1.0;
double yres = -1.0;
if (ewres.indexOf(':') != -1) {
xres = degreeToNumber(ewres);
} else {
xres = Double.parseDouble(ewres);
}
if (nsres.indexOf(':') != -1) {... | java | private double[] xyResStringToNumbers( String ewres, String nsres ) {
double xres = -1.0;
double yres = -1.0;
if (ewres.indexOf(':') != -1) {
xres = degreeToNumber(ewres);
} else {
xres = Double.parseDouble(ewres);
}
if (nsres.indexOf(':') != -1) {... | [
"private",
"double",
"[",
"]",
"xyResStringToNumbers",
"(",
"String",
"ewres",
",",
"String",
"nsres",
")",
"{",
"double",
"xres",
"=",
"-",
"1.0",
";",
"double",
"yres",
"=",
"-",
"1.0",
";",
"if",
"(",
"ewres",
".",
"indexOf",
"(",
"'",
"'",
")",
... | Transforms a GRASS resolution string in metric or degree to decimal.
@param ewres the x resolution string.
@param nsres the y resolution string.
@return the array of x and y resolution doubles. | [
"Transforms",
"a",
"GRASS",
"resolution",
"string",
"in",
"metric",
"or",
"degree",
"to",
"decimal",
"."
] | d2b436bbdf951dc1fda56096a42dbc0eae4d35a5 | https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/libs/modules/JGTProcessingRegion.java#L488-L503 | train |
TheHortonMachine/hortonmachine | gears/src/main/java/org/hortonmachine/gears/libs/modules/JGTProcessingRegion.java | JGTProcessingRegion.nsewStringsToNumbers | @SuppressWarnings("nls")
private double[] nsewStringsToNumbers( String north, String south, String east, String west ) {
double no = -1.0;
double so = -1.0;
double ea = -1.0;
double we = -1.0;
if (north.indexOf("N") != -1 || north.indexOf("n") != -1) {
north = n... | java | @SuppressWarnings("nls")
private double[] nsewStringsToNumbers( String north, String south, String east, String west ) {
double no = -1.0;
double so = -1.0;
double ea = -1.0;
double we = -1.0;
if (north.indexOf("N") != -1 || north.indexOf("n") != -1) {
north = n... | [
"@",
"SuppressWarnings",
"(",
"\"nls\"",
")",
"private",
"double",
"[",
"]",
"nsewStringsToNumbers",
"(",
"String",
"north",
",",
"String",
"south",
",",
"String",
"east",
",",
"String",
"west",
")",
"{",
"double",
"no",
"=",
"-",
"1.0",
";",
"double",
"... | Transforms the GRASS bounds strings in metric or degree to decimal.
@param north the north string.
@param south the south string.
@param east the east string.
@param west the west string.
@return the array of the bounds in doubles. | [
"Transforms",
"the",
"GRASS",
"bounds",
"strings",
"in",
"metric",
"or",
"degree",
"to",
"decimal",
"."
] | d2b436bbdf951dc1fda56096a42dbc0eae4d35a5 | https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/libs/modules/JGTProcessingRegion.java#L514-L560 | train |
TheHortonMachine/hortonmachine | gears/src/main/java/oms3/io/ExtendedBufferedReader.java | ExtendedBufferedReader.read | @Override
public int read() throws IOException {
// initalize the lookahead
if (lookaheadChar == UNDEFINED) {
lookaheadChar = super.read();
}
lastChar = lookaheadChar;
if (super.ready()) {
lookaheadChar = super.read();
} else {
look... | java | @Override
public int read() throws IOException {
// initalize the lookahead
if (lookaheadChar == UNDEFINED) {
lookaheadChar = super.read();
}
lastChar = lookaheadChar;
if (super.ready()) {
lookaheadChar = super.read();
} else {
look... | [
"@",
"Override",
"public",
"int",
"read",
"(",
")",
"throws",
"IOException",
"{",
"// initalize the lookahead",
"if",
"(",
"lookaheadChar",
"==",
"UNDEFINED",
")",
"{",
"lookaheadChar",
"=",
"super",
".",
"read",
"(",
")",
";",
"}",
"lastChar",
"=",
"lookahe... | Reads the next char from the input stream.
@return the next char or END_OF_STREAM if end of stream has been reached. | [
"Reads",
"the",
"next",
"char",
"from",
"the",
"input",
"stream",
"."
] | d2b436bbdf951dc1fda56096a42dbc0eae4d35a5 | https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/oms3/io/ExtendedBufferedReader.java#L82-L98 | train |
TheHortonMachine/hortonmachine | gears/src/main/java/oms3/io/ExtendedBufferedReader.java | ExtendedBufferedReader.read | public int read(char[] buf, int off, int len) throws IOException {
// do not claim if len == 0
if (len == 0) {
return 0;
}
// init lookahead, but do not block !!
if (lookaheadChar == UNDEFINED) {
if (ready()) {
lookaheadChar = super.read()... | java | public int read(char[] buf, int off, int len) throws IOException {
// do not claim if len == 0
if (len == 0) {
return 0;
}
// init lookahead, but do not block !!
if (lookaheadChar == UNDEFINED) {
if (ready()) {
lookaheadChar = super.read()... | [
"public",
"int",
"read",
"(",
"char",
"[",
"]",
"buf",
",",
"int",
"off",
",",
"int",
"len",
")",
"throws",
"IOException",
"{",
"// do not claim if len == 0",
"if",
"(",
"len",
"==",
"0",
")",
"{",
"return",
"0",
";",
"}",
"// init lookahead, but do not bl... | Non-blocking reading of len chars into buffer buf starting
at bufferposition off.
performs an iteratative read on the underlying stream
as long as the following conditions hold:
- less than len chars have been read
- end of stream has not been reached
- next read is not blocking
@return nof chars actually read or END... | [
"Non",
"-",
"blocking",
"reading",
"of",
"len",
"chars",
"into",
"buffer",
"buf",
"starting",
"at",
"bufferposition",
"off",
"."
] | d2b436bbdf951dc1fda56096a42dbc0eae4d35a5 | https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/oms3/io/ExtendedBufferedReader.java#L121-L156 | train |
TheHortonMachine/hortonmachine | gears/src/main/java/oms3/io/ExtendedBufferedReader.java | ExtendedBufferedReader.skip | public long skip(long n) throws IllegalArgumentException, IOException {
if (lookaheadChar == UNDEFINED) {
lookaheadChar = super.read();
}
// illegal argument
if (n < 0) {
throw new IllegalArgumentException("negative argument not supported");
}
/... | java | public long skip(long n) throws IllegalArgumentException, IOException {
if (lookaheadChar == UNDEFINED) {
lookaheadChar = super.read();
}
// illegal argument
if (n < 0) {
throw new IllegalArgumentException("negative argument not supported");
}
/... | [
"public",
"long",
"skip",
"(",
"long",
"n",
")",
"throws",
"IllegalArgumentException",
",",
"IOException",
"{",
"if",
"(",
"lookaheadChar",
"==",
"UNDEFINED",
")",
"{",
"lookaheadChar",
"=",
"super",
".",
"read",
"(",
")",
";",
"}",
"// illegal argument",
"i... | Skips char in the stream
ATTENTION: invalidates the line-counter !!!!!
@return nof skiped chars | [
"Skips",
"char",
"in",
"the",
"stream"
] | d2b436bbdf951dc1fda56096a42dbc0eae4d35a5 | https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/oms3/io/ExtendedBufferedReader.java#L231-L256 | train |
TheHortonMachine/hortonmachine | gears/src/main/java/org/hortonmachine/gears/utils/sorting/QuickSortAlgorithmObjects.java | QuickSortAlgorithmObjects.sort | public void sort( double[] values, Object[] valuesToFollow ) {
this.valuesToSort = values;
this.valuesToFollow = valuesToFollow;
number = values.length;
monitor.beginTask("Sorting...", -1);
monitor.worked(1);
quicksort(0, number - 1);
monitor.done();
} | java | public void sort( double[] values, Object[] valuesToFollow ) {
this.valuesToSort = values;
this.valuesToFollow = valuesToFollow;
number = values.length;
monitor.beginTask("Sorting...", -1);
monitor.worked(1);
quicksort(0, number - 1);
monitor.done();
} | [
"public",
"void",
"sort",
"(",
"double",
"[",
"]",
"values",
",",
"Object",
"[",
"]",
"valuesToFollow",
")",
"{",
"this",
".",
"valuesToSort",
"=",
"values",
";",
"this",
".",
"valuesToFollow",
"=",
"valuesToFollow",
";",
"number",
"=",
"values",
".",
"l... | Sorts an array of values and moves with the sort a second array.
@param values the array to sort.
@param valuesToFollow the array that should be sorted following the
indexes of the first array. Can be null. | [
"Sorts",
"an",
"array",
"of",
"values",
"and",
"moves",
"with",
"the",
"sort",
"a",
"second",
"array",
"."
] | d2b436bbdf951dc1fda56096a42dbc0eae4d35a5 | https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/utils/sorting/QuickSortAlgorithmObjects.java#L49-L61 | train |
TheHortonMachine/hortonmachine | hmachine/src/main/java/org/hortonmachine/hmachine/modules/statistics/jami/OmsJami.java | OmsJami.createStationBasinsMatrix | private int[][] createStationBasinsMatrix( double[] statValues, int[] activeStationsPerBasin ) {
int[][] stationsBasins = new int[stationCoordinates.size()][basinBaricenterCoordinates.size()];
Set<Integer> bandsIdSet = bin2StationsListMap.keySet();
Integer[] bandsIdArray = (Integer[]) bandsIdSet... | java | private int[][] createStationBasinsMatrix( double[] statValues, int[] activeStationsPerBasin ) {
int[][] stationsBasins = new int[stationCoordinates.size()][basinBaricenterCoordinates.size()];
Set<Integer> bandsIdSet = bin2StationsListMap.keySet();
Integer[] bandsIdArray = (Integer[]) bandsIdSet... | [
"private",
"int",
"[",
"]",
"[",
"]",
"createStationBasinsMatrix",
"(",
"double",
"[",
"]",
"statValues",
",",
"int",
"[",
"]",
"activeStationsPerBasin",
")",
"{",
"int",
"[",
"]",
"[",
"]",
"stationsBasins",
"=",
"new",
"int",
"[",
"stationCoordinates",
"... | Creates the stations per basins matrix.
<p>
The matrix is a bitmap of the stations that will be used for every basin,
following the schema:
</p>
<table>
<tr>
<td></td>
<td>basin1</td>
<td>basin2</td>
<td>basin3</td>
<td>basin...</td>
<tr>
<td>station1</td>
<td>1</td>
<td>0</td>
<td>1</td>
<td>0...</td>
<tr>
<td>statio... | [
"Creates",
"the",
"stations",
"per",
"basins",
"matrix",
"."
] | d2b436bbdf951dc1fda56096a42dbc0eae4d35a5 | https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/hmachine/src/main/java/org/hortonmachine/hmachine/modules/statistics/jami/OmsJami.java#L931-L976 | train |
TheHortonMachine/hortonmachine | hmachine/src/main/java/org/hortonmachine/hmachine/modules/statistics/jami/OmsJami.java | OmsJami.extractFromStationFeatures | private void extractFromStationFeatures() throws Exception {
int stationIdIndex = -1;
int stationElevIndex = -1;
pm.beginTask("Filling the elevation and id arrays for the stations, ordering them in ascending elevation order.",
stationCoordinates.size());
for( int i = 0; i... | java | private void extractFromStationFeatures() throws Exception {
int stationIdIndex = -1;
int stationElevIndex = -1;
pm.beginTask("Filling the elevation and id arrays for the stations, ordering them in ascending elevation order.",
stationCoordinates.size());
for( int i = 0; i... | [
"private",
"void",
"extractFromStationFeatures",
"(",
")",
"throws",
"Exception",
"{",
"int",
"stationIdIndex",
"=",
"-",
"1",
";",
"int",
"stationElevIndex",
"=",
"-",
"1",
";",
"pm",
".",
"beginTask",
"(",
"\"Filling the elevation and id arrays for the stations, ord... | Fills the elevation and id arrays for the stations, ordering in ascending
elevation order.
@throws Exception
in the case the sorting gives problems. | [
"Fills",
"the",
"elevation",
"and",
"id",
"arrays",
"for",
"the",
"stations",
"ordering",
"in",
"ascending",
"elevation",
"order",
"."
] | d2b436bbdf951dc1fda56096a42dbc0eae4d35a5 | https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/hmachine/src/main/java/org/hortonmachine/hmachine/modules/statistics/jami/OmsJami.java#L1050-L1080 | train |
TheHortonMachine/hortonmachine | gears/src/main/java/org/hortonmachine/gears/modules/r/tmsgenerator/GlobalMercator.java | GlobalMercator.PixelsToTile | public int[] PixelsToTile( int px, int py ) {
int tx = (int) Math.ceil(px / ((double) tileSize) - 1);
int ty = (int) Math.ceil(py / ((double) tileSize) - 1);
return new int[]{tx, ty};
} | java | public int[] PixelsToTile( int px, int py ) {
int tx = (int) Math.ceil(px / ((double) tileSize) - 1);
int ty = (int) Math.ceil(py / ((double) tileSize) - 1);
return new int[]{tx, ty};
} | [
"public",
"int",
"[",
"]",
"PixelsToTile",
"(",
"int",
"px",
",",
"int",
"py",
")",
"{",
"int",
"tx",
"=",
"(",
"int",
")",
"Math",
".",
"ceil",
"(",
"px",
"/",
"(",
"(",
"double",
")",
"tileSize",
")",
"-",
"1",
")",
";",
"int",
"ty",
"=",
... | Returns a tile covering region in given pixel coordinates
@param px
@param py
@return | [
"Returns",
"a",
"tile",
"covering",
"region",
"in",
"given",
"pixel",
"coordinates"
] | d2b436bbdf951dc1fda56096a42dbc0eae4d35a5 | https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/modules/r/tmsgenerator/GlobalMercator.java#L191-L195 | train |
TheHortonMachine/hortonmachine | gears/src/main/java/org/hortonmachine/gears/modules/r/tmsgenerator/GlobalMercator.java | GlobalMercator.PixelsToRaster | public int[] PixelsToRaster( int px, int py, int zoom ) {
int mapSize = tileSize << zoom;
return new int[]{px, mapSize - py};
} | java | public int[] PixelsToRaster( int px, int py, int zoom ) {
int mapSize = tileSize << zoom;
return new int[]{px, mapSize - py};
} | [
"public",
"int",
"[",
"]",
"PixelsToRaster",
"(",
"int",
"px",
",",
"int",
"py",
",",
"int",
"zoom",
")",
"{",
"int",
"mapSize",
"=",
"tileSize",
"<<",
"zoom",
";",
"return",
"new",
"int",
"[",
"]",
"{",
"px",
",",
"mapSize",
"-",
"py",
"}",
";",... | Move the origin of pixel coordinates to top-left corner
@param px
@param py
@param zoom
@return | [
"Move",
"the",
"origin",
"of",
"pixel",
"coordinates",
"to",
"top",
"-",
"left",
"corner"
] | d2b436bbdf951dc1fda56096a42dbc0eae4d35a5 | https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/modules/r/tmsgenerator/GlobalMercator.java#L205-L208 | train |
TheHortonMachine/hortonmachine | gears/src/main/java/org/hortonmachine/gears/modules/r/tmsgenerator/GlobalMercator.java | GlobalMercator.ZoomForPixelSize | public int ZoomForPixelSize( int pixelSize ) {
for( int i = 0; i < 30; i++ ) {
if (pixelSize > Resolution(i)) {
if (i != 0) {
return i - 1;
} else {
return 0; // We don't want to scale up
}
}
... | java | public int ZoomForPixelSize( int pixelSize ) {
for( int i = 0; i < 30; i++ ) {
if (pixelSize > Resolution(i)) {
if (i != 0) {
return i - 1;
} else {
return 0; // We don't want to scale up
}
}
... | [
"public",
"int",
"ZoomForPixelSize",
"(",
"int",
"pixelSize",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"30",
";",
"i",
"++",
")",
"{",
"if",
"(",
"pixelSize",
">",
"Resolution",
"(",
"i",
")",
")",
"{",
"if",
"(",
"i",
"!=",
... | Maximal scaledown zoom of the pyramid closest to the pixelSize
@param pixelSize
@return | [
"Maximal",
"scaledown",
"zoom",
"of",
"the",
"pyramid",
"closest",
"to",
"the",
"pixelSize"
] | d2b436bbdf951dc1fda56096a42dbc0eae4d35a5 | https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/modules/r/tmsgenerator/GlobalMercator.java#L300-L311 | train |
TheHortonMachine/hortonmachine | gears/src/main/java/org/hortonmachine/gears/modules/r/tmsgenerator/GlobalMercator.java | GlobalMercator.GoogleTile | public int[] GoogleTile( double lat, double lon, int zoom ) {
double[] meters = LatLonToMeters(lat, lon);
int[] tile = MetersToTile(meters[0], meters[1], zoom);
return this.GoogleTile(tile[0], tile[1], zoom);
} | java | public int[] GoogleTile( double lat, double lon, int zoom ) {
double[] meters = LatLonToMeters(lat, lon);
int[] tile = MetersToTile(meters[0], meters[1], zoom);
return this.GoogleTile(tile[0], tile[1], zoom);
} | [
"public",
"int",
"[",
"]",
"GoogleTile",
"(",
"double",
"lat",
",",
"double",
"lon",
",",
"int",
"zoom",
")",
"{",
"double",
"[",
"]",
"meters",
"=",
"LatLonToMeters",
"(",
"lat",
",",
"lon",
")",
";",
"int",
"[",
"]",
"tile",
"=",
"MetersToTile",
... | Converts a lat long coordinates to Google Tile Coordinates
@param lat
@param lon
@param zoom
@return | [
"Converts",
"a",
"lat",
"long",
"coordinates",
"to",
"Google",
"Tile",
"Coordinates"
] | d2b436bbdf951dc1fda56096a42dbc0eae4d35a5 | https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/modules/r/tmsgenerator/GlobalMercator.java#L341-L345 | train |
TheHortonMachine/hortonmachine | gears/src/main/java/org/hortonmachine/gears/modules/r/tmsgenerator/GlobalMercator.java | GlobalMercator.QuadTree | public String QuadTree( int tx, int ty, int zoom ) {
String quadKey = "";
ty = (int) ((Math.pow(2, zoom) - 1) - ty);
for( int i = zoom; i < 0; i-- ) {
int digit = 0;
int mask = 1 << (i - 1);
if ((tx & mask) != 0) {
digit += 1;
}
... | java | public String QuadTree( int tx, int ty, int zoom ) {
String quadKey = "";
ty = (int) ((Math.pow(2, zoom) - 1) - ty);
for( int i = zoom; i < 0; i-- ) {
int digit = 0;
int mask = 1 << (i - 1);
if ((tx & mask) != 0) {
digit += 1;
}
... | [
"public",
"String",
"QuadTree",
"(",
"int",
"tx",
",",
"int",
"ty",
",",
"int",
"zoom",
")",
"{",
"String",
"quadKey",
"=",
"\"\"",
";",
"ty",
"=",
"(",
"int",
")",
"(",
"(",
"Math",
".",
"pow",
"(",
"2",
",",
"zoom",
")",
"-",
"1",
")",
"-",... | Converts TMS tile coordinates to Microsoft QuadTree
@return | [
"Converts",
"TMS",
"tile",
"coordinates",
"to",
"Microsoft",
"QuadTree"
] | d2b436bbdf951dc1fda56096a42dbc0eae4d35a5 | https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/modules/r/tmsgenerator/GlobalMercator.java#L352-L367 | train |
TheHortonMachine/hortonmachine | hmachine/src/main/java/org/hortonmachine/hmachine/modules/demmanipulation/splitsubbasin/OmsSplitSubbasins.java | OmsSplitSubbasins.net | private void net( WritableRandomIter hacksIter, WritableRandomIter netIter ) {
// calculates the max order of basin (max hackstream value)
pm.beginTask("Extraction of rivers of chosen order...", nRows);
for( int r = 0; r < nRows; r++ ) {
for( int c = 0; c < nCols; c++ ) {
... | java | private void net( WritableRandomIter hacksIter, WritableRandomIter netIter ) {
// calculates the max order of basin (max hackstream value)
pm.beginTask("Extraction of rivers of chosen order...", nRows);
for( int r = 0; r < nRows; r++ ) {
for( int c = 0; c < nCols; c++ ) {
... | [
"private",
"void",
"net",
"(",
"WritableRandomIter",
"hacksIter",
",",
"WritableRandomIter",
"netIter",
")",
"{",
"// calculates the max order of basin (max hackstream value)",
"pm",
".",
"beginTask",
"(",
"\"Extraction of rivers of chosen order...\"",
",",
"nRows",
")",
";",... | Return the map of the network with only the river of the choosen order.
@param hacksIter the hack stream map.
@param netIter the network map to build on the required hack orders.
@return the map of the network with the choosen order. | [
"Return",
"the",
"map",
"of",
"the",
"network",
"with",
"only",
"the",
"river",
"of",
"the",
"choosen",
"order",
"."
] | d2b436bbdf951dc1fda56096a42dbc0eae4d35a5 | https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/hmachine/src/main/java/org/hortonmachine/hmachine/modules/demmanipulation/splitsubbasin/OmsSplitSubbasins.java#L138-L159 | train |
enasequence/sequencetools | src/main/java/uk/ac/ebi/embl/api/validation/helper/ByteBufferUtils.java | ByteBufferUtils.bytes | public static ByteBuffer bytes(String s, Charset charset)
{
return ByteBuffer.wrap(s.getBytes(charset));
} | java | public static ByteBuffer bytes(String s, Charset charset)
{
return ByteBuffer.wrap(s.getBytes(charset));
} | [
"public",
"static",
"ByteBuffer",
"bytes",
"(",
"String",
"s",
",",
"Charset",
"charset",
")",
"{",
"return",
"ByteBuffer",
".",
"wrap",
"(",
"s",
".",
"getBytes",
"(",
"charset",
")",
")",
";",
"}"
] | Encode a String in a ByteBuffer using the provided charset.
@param s the string to encode
@param charset the String encoding charset to use
@return the encoded string | [
"Encode",
"a",
"String",
"in",
"a",
"ByteBuffer",
"using",
"the",
"provided",
"charset",
"."
] | 4127f5e1a17540239f5810136153fbd6737fa262 | https://github.com/enasequence/sequencetools/blob/4127f5e1a17540239f5810136153fbd6737fa262/src/main/java/uk/ac/ebi/embl/api/validation/helper/ByteBufferUtils.java#L145-L148 | train |
enasequence/sequencetools | src/main/java/uk/ac/ebi/embl/gff3/writer/GFF3EntryWriter.java | GFF3EntryWriter.write | public void write(Writer writer) throws IOException {
GFF3Writer.writeVersionPragma(writer);
GFF3Writer.writeRegionPragma(writer, entry.getPrimaryAccession(),
windowBeginPosition, windowEndPosition);
int ID = 0;
if (show.contains(SHOW_GENE)) {
locusTagGeneMap = new HashMap<String, GFF3Gene>();
... | java | public void write(Writer writer) throws IOException {
GFF3Writer.writeVersionPragma(writer);
GFF3Writer.writeRegionPragma(writer, entry.getPrimaryAccession(),
windowBeginPosition, windowEndPosition);
int ID = 0;
if (show.contains(SHOW_GENE)) {
locusTagGeneMap = new HashMap<String, GFF3Gene>();
... | [
"public",
"void",
"write",
"(",
"Writer",
"writer",
")",
"throws",
"IOException",
"{",
"GFF3Writer",
".",
"writeVersionPragma",
"(",
"writer",
")",
";",
"GFF3Writer",
".",
"writeRegionPragma",
"(",
"writer",
",",
"entry",
".",
"getPrimaryAccession",
"(",
")",
... | Writes the GFF3 file.
@param writer the output stream.
@throws IOException is there was an error in writing
to the output stream. | [
"Writes",
"the",
"GFF3",
"file",
"."
] | 4127f5e1a17540239f5810136153fbd6737fa262 | https://github.com/enasequence/sequencetools/blob/4127f5e1a17540239f5810136153fbd6737fa262/src/main/java/uk/ac/ebi/embl/gff3/writer/GFF3EntryWriter.java#L71-L123 | train |
enasequence/sequencetools | src/main/java/uk/ac/ebi/embl/flatfile/FlatFileUtils.java | FlatFileUtils.trim | public static String
trim( String string, int pos )
{
int len = string.length();
int leftPos = pos;
int rightPos = len;
for( ; rightPos > 0; --rightPos )
{
char ch = string.charAt( rightPos - 1 );
if( ch != ' '
&& ch != '\t'
&& ch != '... | java | public static String
trim( String string, int pos )
{
int len = string.length();
int leftPos = pos;
int rightPos = len;
for( ; rightPos > 0; --rightPos )
{
char ch = string.charAt( rightPos - 1 );
if( ch != ' '
&& ch != '\t'
&& ch != '... | [
"public",
"static",
"String",
"trim",
"(",
"String",
"string",
",",
"int",
"pos",
")",
"{",
"int",
"len",
"=",
"string",
".",
"length",
"(",
")",
";",
"int",
"leftPos",
"=",
"pos",
";",
"int",
"rightPos",
"=",
"len",
";",
"for",
"(",
";",
"rightPos... | Removes all whitespace characters from the beginning and
end of the string starting from the given position. | [
"Removes",
"all",
"whitespace",
"characters",
"from",
"the",
"beginning",
"and",
"end",
"of",
"the",
"string",
"starting",
"from",
"the",
"given",
"position",
"."
] | 4127f5e1a17540239f5810136153fbd6737fa262 | https://github.com/enasequence/sequencetools/blob/4127f5e1a17540239f5810136153fbd6737fa262/src/main/java/uk/ac/ebi/embl/flatfile/FlatFileUtils.java#L32-L71 | train |
enasequence/sequencetools | src/main/java/uk/ac/ebi/embl/flatfile/FlatFileUtils.java | FlatFileUtils.trimRight | public static String
trimRight( String string )
{
for( int i = string.length(); i > 0; --i )
{
if( string.charAt(i-1) != ' '
&& string.charAt(i-1) != '\t'
&& string.charAt(i-1) != '\n'
&& string.charAt(i-1) != '\r' )
{
return i == string.length() ? string... | java | public static String
trimRight( String string )
{
for( int i = string.length(); i > 0; --i )
{
if( string.charAt(i-1) != ' '
&& string.charAt(i-1) != '\t'
&& string.charAt(i-1) != '\n'
&& string.charAt(i-1) != '\r' )
{
return i == string.length() ? string... | [
"public",
"static",
"String",
"trimRight",
"(",
"String",
"string",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"string",
".",
"length",
"(",
")",
";",
"i",
">",
"0",
";",
"--",
"i",
")",
"{",
"if",
"(",
"string",
".",
"charAt",
"(",
"i",
"-",
"1",
... | Removes all whitespace characters from the end of the string. | [
"Removes",
"all",
"whitespace",
"characters",
"from",
"the",
"end",
"of",
"the",
"string",
"."
] | 4127f5e1a17540239f5810136153fbd6737fa262 | https://github.com/enasequence/sequencetools/blob/4127f5e1a17540239f5810136153fbd6737fa262/src/main/java/uk/ac/ebi/embl/flatfile/FlatFileUtils.java#L75-L90 | train |
enasequence/sequencetools | src/main/java/uk/ac/ebi/embl/flatfile/FlatFileUtils.java | FlatFileUtils.trimRight | public static String
trimRight( String string, int pos )
{
int i = string.length();
for( ; i > pos; --i )
{
char charAt = string.charAt( i - 1 );
if( charAt != ' '
&& charAt != '\t'
&& charAt != '\n'
&& charAt != '\r' )
{
break;
}
... | java | public static String
trimRight( String string, int pos )
{
int i = string.length();
for( ; i > pos; --i )
{
char charAt = string.charAt( i - 1 );
if( charAt != ' '
&& charAt != '\t'
&& charAt != '\n'
&& charAt != '\r' )
{
break;
}
... | [
"public",
"static",
"String",
"trimRight",
"(",
"String",
"string",
",",
"int",
"pos",
")",
"{",
"int",
"i",
"=",
"string",
".",
"length",
"(",
")",
";",
"for",
"(",
";",
"i",
">",
"pos",
";",
"--",
"i",
")",
"{",
"char",
"charAt",
"=",
"string",... | Removes all whitespace characters from the end of the string
starting from the given position. | [
"Removes",
"all",
"whitespace",
"characters",
"from",
"the",
"end",
"of",
"the",
"string",
"starting",
"from",
"the",
"given",
"position",
"."
] | 4127f5e1a17540239f5810136153fbd6737fa262 | https://github.com/enasequence/sequencetools/blob/4127f5e1a17540239f5810136153fbd6737fa262/src/main/java/uk/ac/ebi/embl/flatfile/FlatFileUtils.java#L95-L118 | train |
enasequence/sequencetools | src/main/java/uk/ac/ebi/embl/flatfile/FlatFileUtils.java | FlatFileUtils.trimRight | public static String
trimRight( String string, char c )
{
for( int i = string.length(); i > 0; --i )
{
char charAt = string.charAt( i - 1 );
if( charAt != c
&& charAt != ' '
&& charAt != '\t'
&& charAt != '\n'
&& charAt != '\r' )
{
... | java | public static String
trimRight( String string, char c )
{
for( int i = string.length(); i > 0; --i )
{
char charAt = string.charAt( i - 1 );
if( charAt != c
&& charAt != ' '
&& charAt != '\t'
&& charAt != '\n'
&& charAt != '\r' )
{
... | [
"public",
"static",
"String",
"trimRight",
"(",
"String",
"string",
",",
"char",
"c",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"string",
".",
"length",
"(",
")",
";",
"i",
">",
"0",
";",
"--",
"i",
")",
"{",
"char",
"charAt",
"=",
"string",
".",
... | Removes all whitespace characters and instances of the given
character from the end of the string. | [
"Removes",
"all",
"whitespace",
"characters",
"and",
"instances",
"of",
"the",
"given",
"character",
"from",
"the",
"end",
"of",
"the",
"string",
"."
] | 4127f5e1a17540239f5810136153fbd6737fa262 | https://github.com/enasequence/sequencetools/blob/4127f5e1a17540239f5810136153fbd6737fa262/src/main/java/uk/ac/ebi/embl/flatfile/FlatFileUtils.java#L123-L140 | train |
enasequence/sequencetools | src/main/java/uk/ac/ebi/embl/flatfile/FlatFileUtils.java | FlatFileUtils.trimLeft | public static String
trimLeft( String string )
{
for( int i = 0; i < string.length(); ++i )
{
char charAt = string.charAt( i );
if( charAt != ' '
&& charAt != '\t'
&& charAt != '\n'
&& charAt != '\r' )
{
return i == 0 ? string :
... | java | public static String
trimLeft( String string )
{
for( int i = 0; i < string.length(); ++i )
{
char charAt = string.charAt( i );
if( charAt != ' '
&& charAt != '\t'
&& charAt != '\n'
&& charAt != '\r' )
{
return i == 0 ? string :
... | [
"public",
"static",
"String",
"trimLeft",
"(",
"String",
"string",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"string",
".",
"length",
"(",
")",
";",
"++",
"i",
")",
"{",
"char",
"charAt",
"=",
"string",
".",
"charAt",
"(",
"i",
... | Removes all whitespace characters from the beginning
of the string. | [
"Removes",
"all",
"whitespace",
"characters",
"from",
"the",
"beginning",
"of",
"the",
"string",
"."
] | 4127f5e1a17540239f5810136153fbd6737fa262 | https://github.com/enasequence/sequencetools/blob/4127f5e1a17540239f5810136153fbd6737fa262/src/main/java/uk/ac/ebi/embl/flatfile/FlatFileUtils.java#L145-L161 | train |
enasequence/sequencetools | src/main/java/uk/ac/ebi/embl/flatfile/FlatFileUtils.java | FlatFileUtils.split | public static Vector<String> split(String string, String regex) {
Vector<String> strings = new Vector<String>();
for (String value : string.split(new String(regex))) {
value = value.trim();
if (!value.equals("")) {
strings.add(shrink(value));
}
}
return strings;
} | java | public static Vector<String> split(String string, String regex) {
Vector<String> strings = new Vector<String>();
for (String value : string.split(new String(regex))) {
value = value.trim();
if (!value.equals("")) {
strings.add(shrink(value));
}
}
return strings;
} | [
"public",
"static",
"Vector",
"<",
"String",
">",
"split",
"(",
"String",
"string",
",",
"String",
"regex",
")",
"{",
"Vector",
"<",
"String",
">",
"strings",
"=",
"new",
"Vector",
"<",
"String",
">",
"(",
")",
";",
"for",
"(",
"String",
"value",
":"... | Split the string into values using the regular expression,
removes whitespace from the beginning and end of the
resultant strings and replaces runs of whitespace with a single
space. | [
"Split",
"the",
"string",
"into",
"values",
"using",
"the",
"regular",
"expression",
"removes",
"whitespace",
"from",
"the",
"beginning",
"and",
"end",
"of",
"the",
"resultant",
"strings",
"and",
"replaces",
"runs",
"of",
"whitespace",
"with",
"a",
"single",
"... | 4127f5e1a17540239f5810136153fbd6737fa262 | https://github.com/enasequence/sequencetools/blob/4127f5e1a17540239f5810136153fbd6737fa262/src/main/java/uk/ac/ebi/embl/flatfile/FlatFileUtils.java#L190-L199 | train |
enasequence/sequencetools | src/main/java/uk/ac/ebi/embl/flatfile/FlatFileUtils.java | FlatFileUtils.shrink | public static String shrink(String string) {
if (string == null) {
return null;
}
string = string.trim();
return SHRINK.matcher(string).replaceAll(" ");
} | java | public static String shrink(String string) {
if (string == null) {
return null;
}
string = string.trim();
return SHRINK.matcher(string).replaceAll(" ");
} | [
"public",
"static",
"String",
"shrink",
"(",
"String",
"string",
")",
"{",
"if",
"(",
"string",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"string",
"=",
"string",
".",
"trim",
"(",
")",
";",
"return",
"SHRINK",
".",
"matcher",
"(",
"string"... | Trims the string and replaces runs of whitespace with a single space. | [
"Trims",
"the",
"string",
"and",
"replaces",
"runs",
"of",
"whitespace",
"with",
"a",
"single",
"space",
"."
] | 4127f5e1a17540239f5810136153fbd6737fa262 | https://github.com/enasequence/sequencetools/blob/4127f5e1a17540239f5810136153fbd6737fa262/src/main/java/uk/ac/ebi/embl/flatfile/FlatFileUtils.java#L205-L211 | train |
enasequence/sequencetools | src/main/java/uk/ac/ebi/embl/flatfile/FlatFileUtils.java | FlatFileUtils.shrink | public static String shrink(String string, char c) {
if (string == null) {
return null;
}
string = string.trim();
Pattern pattern = Pattern.compile("\\" + String.valueOf(c) + "{2,}");
return pattern.matcher(string).replaceAll(String.valueOf(c));
} | java | public static String shrink(String string, char c) {
if (string == null) {
return null;
}
string = string.trim();
Pattern pattern = Pattern.compile("\\" + String.valueOf(c) + "{2,}");
return pattern.matcher(string).replaceAll(String.valueOf(c));
} | [
"public",
"static",
"String",
"shrink",
"(",
"String",
"string",
",",
"char",
"c",
")",
"{",
"if",
"(",
"string",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"string",
"=",
"string",
".",
"trim",
"(",
")",
";",
"Pattern",
"pattern",
"=",
"P... | Trims the string and replaces runs of whitespace with a single character. | [
"Trims",
"the",
"string",
"and",
"replaces",
"runs",
"of",
"whitespace",
"with",
"a",
"single",
"character",
"."
] | 4127f5e1a17540239f5810136153fbd6737fa262 | https://github.com/enasequence/sequencetools/blob/4127f5e1a17540239f5810136153fbd6737fa262/src/main/java/uk/ac/ebi/embl/flatfile/FlatFileUtils.java#L215-L222 | train |
enasequence/sequencetools | src/main/java/uk/ac/ebi/embl/flatfile/FlatFileUtils.java | FlatFileUtils.remove | public static String remove(String string, char c) {
return string.replaceAll(String.valueOf(c), "");
} | java | public static String remove(String string, char c) {
return string.replaceAll(String.valueOf(c), "");
} | [
"public",
"static",
"String",
"remove",
"(",
"String",
"string",
",",
"char",
"c",
")",
"{",
"return",
"string",
".",
"replaceAll",
"(",
"String",
".",
"valueOf",
"(",
"c",
")",
",",
"\"\"",
")",
";",
"}"
] | Removes the characters from the string. | [
"Removes",
"the",
"characters",
"from",
"the",
"string",
"."
] | 4127f5e1a17540239f5810136153fbd6737fa262 | https://github.com/enasequence/sequencetools/blob/4127f5e1a17540239f5810136153fbd6737fa262/src/main/java/uk/ac/ebi/embl/flatfile/FlatFileUtils.java#L226-L228 | train |
enasequence/sequencetools | src/main/java/uk/ac/ebi/embl/flatfile/FlatFileUtils.java | FlatFileUtils.getYear | public static Date getYear(String string) {
if (string == null) {
return null;
}
Date date = null;
try {
date = ((SimpleDateFormat)year.clone()) .parse(string);
}
catch (ParseException ex) {
return null;
}
return date;
} | java | public static Date getYear(String string) {
if (string == null) {
return null;
}
Date date = null;
try {
date = ((SimpleDateFormat)year.clone()) .parse(string);
}
catch (ParseException ex) {
return null;
}
return date;
} | [
"public",
"static",
"Date",
"getYear",
"(",
"String",
"string",
")",
"{",
"if",
"(",
"string",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"Date",
"date",
"=",
"null",
";",
"try",
"{",
"date",
"=",
"(",
"(",
"SimpleDateFormat",
")",
"year",
... | Returns the year given a string in format yyyy. | [
"Returns",
"the",
"year",
"given",
"a",
"string",
"in",
"format",
"yyyy",
"."
] | 4127f5e1a17540239f5810136153fbd6737fa262 | https://github.com/enasequence/sequencetools/blob/4127f5e1a17540239f5810136153fbd6737fa262/src/main/java/uk/ac/ebi/embl/flatfile/FlatFileUtils.java#L249-L261 | train |
TheHortonMachine/hortonmachine | gears/src/main/java/org/hortonmachine/gears/modules/r/labeler/OmsLabeler.java | OmsLabeler.getNeighbours | private int getNeighbours( int[] src1d, int i, int ox, int oy, int d_w, int d_h ) {
int x, y, result;
x = (i % d_w) + ox; // d_w and d_h are assumed to be set to the
y = (i / d_w) + oy; // width and height of scr1d
if ((x < 0) || (x >= d_w) || (y < 0) || (y >= d_h)) {
resul... | java | private int getNeighbours( int[] src1d, int i, int ox, int oy, int d_w, int d_h ) {
int x, y, result;
x = (i % d_w) + ox; // d_w and d_h are assumed to be set to the
y = (i / d_w) + oy; // width and height of scr1d
if ((x < 0) || (x >= d_w) || (y < 0) || (y >= d_h)) {
resul... | [
"private",
"int",
"getNeighbours",
"(",
"int",
"[",
"]",
"src1d",
",",
"int",
"i",
",",
"int",
"ox",
",",
"int",
"oy",
",",
"int",
"d_w",
",",
"int",
"d_h",
")",
"{",
"int",
"x",
",",
"y",
",",
"result",
";",
"x",
"=",
"(",
"i",
"%",
"d_w",
... | getNeighbours will get the pixel value of i's neighbour that's ox and oy
away from i, if the point is outside the image, then 0 is returned.
This version gets from source image.
@param d_w
@param d_h | [
"getNeighbours",
"will",
"get",
"the",
"pixel",
"value",
"of",
"i",
"s",
"neighbour",
"that",
"s",
"ox",
"and",
"oy",
"away",
"from",
"i",
"if",
"the",
"point",
"is",
"outside",
"the",
"image",
"then",
"0",
"is",
"returned",
".",
"This",
"version",
"ge... | d2b436bbdf951dc1fda56096a42dbc0eae4d35a5 | https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/modules/r/labeler/OmsLabeler.java#L248-L260 | train |
TheHortonMachine/hortonmachine | gears/src/main/java/org/hortonmachine/gears/modules/r/labeler/OmsLabeler.java | OmsLabeler.reduce | private int reduce( int a, int[] labels ) {
if (labels[a] == a) {
return a;
} else {
return reduce(labels[a], labels);
}
} | java | private int reduce( int a, int[] labels ) {
if (labels[a] == a) {
return a;
} else {
return reduce(labels[a], labels);
}
} | [
"private",
"int",
"reduce",
"(",
"int",
"a",
",",
"int",
"[",
"]",
"labels",
")",
"{",
"if",
"(",
"labels",
"[",
"a",
"]",
"==",
"a",
")",
"{",
"return",
"a",
";",
"}",
"else",
"{",
"return",
"reduce",
"(",
"labels",
"[",
"a",
"]",
",",
"labe... | Reduces the number of labels.
@param labels | [
"Reduces",
"the",
"number",
"of",
"labels",
"."
] | d2b436bbdf951dc1fda56096a42dbc0eae4d35a5 | https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/modules/r/labeler/OmsLabeler.java#L312-L318 | train |
TheHortonMachine/hortonmachine | gears/src/main/java/oms3/util/Annotations.java | Annotations.playsAll | public static boolean playsAll(Role role, String... r) {
if (role == null) {
return false;
}
for (String s : r) {
if (!role.value().contains(s)) {
return false;
}
}
return true;
} | java | public static boolean playsAll(Role role, String... r) {
if (role == null) {
return false;
}
for (String s : r) {
if (!role.value().contains(s)) {
return false;
}
}
return true;
} | [
"public",
"static",
"boolean",
"playsAll",
"(",
"Role",
"role",
",",
"String",
"...",
"r",
")",
"{",
"if",
"(",
"role",
"==",
"null",
")",
"{",
"return",
"false",
";",
"}",
"for",
"(",
"String",
"s",
":",
"r",
")",
"{",
"if",
"(",
"!",
"role",
... | Checks if all roles are played.
@param role the role to check.
@param r the roles that all have to be played
@return true or false. | [
"Checks",
"if",
"all",
"roles",
"are",
"played",
"."
] | d2b436bbdf951dc1fda56096a42dbc0eae4d35a5 | https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/oms3/util/Annotations.java#L25-L35 | train |
TheHortonMachine/hortonmachine | gears/src/main/java/oms3/util/Annotations.java | Annotations.plays | public static boolean plays(Role role, String r) {
if (r == null) {
throw new IllegalArgumentException("null role");
}
if (role == null) {
return false;
}
return role.value().contains(r);
} | java | public static boolean plays(Role role, String r) {
if (r == null) {
throw new IllegalArgumentException("null role");
}
if (role == null) {
return false;
}
return role.value().contains(r);
} | [
"public",
"static",
"boolean",
"plays",
"(",
"Role",
"role",
",",
"String",
"r",
")",
"{",
"if",
"(",
"r",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"null role\"",
")",
";",
"}",
"if",
"(",
"role",
"==",
"null",
")",
... | Checks if one role is played.
@param role the role to check
@param r the expected role
@return true or false. | [
"Checks",
"if",
"one",
"role",
"is",
"played",
"."
] | d2b436bbdf951dc1fda56096a42dbc0eae4d35a5 | https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/oms3/util/Annotations.java#L43-L51 | train |
TheHortonMachine/hortonmachine | gears/src/main/java/oms3/util/Annotations.java | Annotations.inRange | public static boolean inRange(Range range, double val) {
return val >= range.min() && val <= range.max();
} | java | public static boolean inRange(Range range, double val) {
return val >= range.min() && val <= range.max();
} | [
"public",
"static",
"boolean",
"inRange",
"(",
"Range",
"range",
",",
"double",
"val",
")",
"{",
"return",
"val",
">=",
"range",
".",
"min",
"(",
")",
"&&",
"val",
"<=",
"range",
".",
"max",
"(",
")",
";",
"}"
] | Check if a certain value is in range
@param range range info
@param val the value to check;
@return true if it is in range, false otherwise. | [
"Check",
"if",
"a",
"certain",
"value",
"is",
"in",
"range"
] | d2b436bbdf951dc1fda56096a42dbc0eae4d35a5 | https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/oms3/util/Annotations.java#L87-L89 | train |
enasequence/sequencetools | src/main/java/uk/ac/ebi/embl/flatfile/reader/EntryReader.java | EntryReader.close | public void close() {
entry.close();
getBlockCounter().clear();
getSkipTagCounter().clear();
getCache().resetOrganismCache();
getCache().resetReferenceCache();
} | java | public void close() {
entry.close();
getBlockCounter().clear();
getSkipTagCounter().clear();
getCache().resetOrganismCache();
getCache().resetReferenceCache();
} | [
"public",
"void",
"close",
"(",
")",
"{",
"entry",
".",
"close",
"(",
")",
";",
"getBlockCounter",
"(",
")",
".",
"clear",
"(",
")",
";",
"getSkipTagCounter",
"(",
")",
".",
"clear",
"(",
")",
";",
"getCache",
"(",
")",
".",
"resetOrganismCache",
"("... | Release resources used by the reader. Help the GC to cleanup the heap | [
"Release",
"resources",
"used",
"by",
"the",
"reader",
".",
"Help",
"the",
"GC",
"to",
"cleanup",
"the",
"heap"
] | 4127f5e1a17540239f5810136153fbd6737fa262 | https://github.com/enasequence/sequencetools/blob/4127f5e1a17540239f5810136153fbd6737fa262/src/main/java/uk/ac/ebi/embl/flatfile/reader/EntryReader.java#L302-L308 | train |
TheHortonMachine/hortonmachine | gears/src/main/java/org/hortonmachine/gears/io/grasslegacy/utils/GrassLegacyUtilities.java | GrassLegacyUtilities.ByteBufferImage | public static BufferedImage ByteBufferImage( byte[] data, int width, int height ) {
int[] bandoffsets = {0, 1, 2, 3};
DataBufferByte dbb = new DataBufferByte(data, data.length);
WritableRaster wr = Raster.createInterleavedRaster(dbb, width, height, width * 4, 4, bandoffsets, null);
int[]... | java | public static BufferedImage ByteBufferImage( byte[] data, int width, int height ) {
int[] bandoffsets = {0, 1, 2, 3};
DataBufferByte dbb = new DataBufferByte(data, data.length);
WritableRaster wr = Raster.createInterleavedRaster(dbb, width, height, width * 4, 4, bandoffsets, null);
int[]... | [
"public",
"static",
"BufferedImage",
"ByteBufferImage",
"(",
"byte",
"[",
"]",
"data",
",",
"int",
"width",
",",
"int",
"height",
")",
"{",
"int",
"[",
"]",
"bandoffsets",
"=",
"{",
"0",
",",
"1",
",",
"2",
",",
"3",
"}",
";",
"DataBufferByte",
"dbb"... | create a buffered image from a set of color triplets
@param data
@param width
@param height
@return | [
"create",
"a",
"buffered",
"image",
"from",
"a",
"set",
"of",
"color",
"triplets"
] | d2b436bbdf951dc1fda56096a42dbc0eae4d35a5 | https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/io/grasslegacy/utils/GrassLegacyUtilities.java#L322-L332 | train |
TheHortonMachine/hortonmachine | gears/src/main/java/org/hortonmachine/gears/io/grasslegacy/utils/GrassLegacyUtilities.java | GrassLegacyUtilities.getRectangleAroundPoint | public static Window getRectangleAroundPoint( Window activeRegion, double x, double y ) {
double minx = activeRegion.getRectangle().getBounds2D().getMinX();
double ewres = activeRegion.getWEResolution();
double snapx = minx + (Math.round((x - minx) / ewres) * ewres);
double miny = activ... | java | public static Window getRectangleAroundPoint( Window activeRegion, double x, double y ) {
double minx = activeRegion.getRectangle().getBounds2D().getMinX();
double ewres = activeRegion.getWEResolution();
double snapx = minx + (Math.round((x - minx) / ewres) * ewres);
double miny = activ... | [
"public",
"static",
"Window",
"getRectangleAroundPoint",
"(",
"Window",
"activeRegion",
",",
"double",
"x",
",",
"double",
"y",
")",
"{",
"double",
"minx",
"=",
"activeRegion",
".",
"getRectangle",
"(",
")",
".",
"getBounds2D",
"(",
")",
".",
"getMinX",
"(",... | return the rectangle of the cell of the active region, that surrounds the given coordinates
@param activeRegion
@param x the given easting coordinate
@param y given northing coordinate
@return the rectangle localizing the cell inside which the x and y stay | [
"return",
"the",
"rectangle",
"of",
"the",
"cell",
"of",
"the",
"active",
"region",
"that",
"surrounds",
"the",
"given",
"coordinates"
] | d2b436bbdf951dc1fda56096a42dbc0eae4d35a5 | https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/io/grasslegacy/utils/GrassLegacyUtilities.java#L357-L392 | train |
TheHortonMachine/hortonmachine | gears/src/main/java/org/hortonmachine/gears/io/grasslegacy/utils/GrassLegacyUtilities.java | GrassLegacyUtilities.rasterizePolygonGeometry | public static void rasterizePolygonGeometry( Window active, Geometry polygon, RasterData raster, RasterData rasterToMap,
double value, IHMProgressMonitor monitor ) {
GeometryFactory gFactory = new GeometryFactory();
int rows = active.getRows();
int cols = active.getCols();
do... | java | public static void rasterizePolygonGeometry( Window active, Geometry polygon, RasterData raster, RasterData rasterToMap,
double value, IHMProgressMonitor monitor ) {
GeometryFactory gFactory = new GeometryFactory();
int rows = active.getRows();
int cols = active.getCols();
do... | [
"public",
"static",
"void",
"rasterizePolygonGeometry",
"(",
"Window",
"active",
",",
"Geometry",
"polygon",
",",
"RasterData",
"raster",
",",
"RasterData",
"rasterToMap",
",",
"double",
"value",
",",
"IHMProgressMonitor",
"monitor",
")",
"{",
"GeometryFactory",
"gF... | Fill polygon areas mapping on a raster
@param active the active region
@param polygon the jts polygon geometry
@param raster the empty raster data to be filled
@param rasterToMap the map from which the values to fill raster are taken (if null, the value
parameter is used)
@param value the value to set if a second map ... | [
"Fill",
"polygon",
"areas",
"mapping",
"on",
"a",
"raster"
] | d2b436bbdf951dc1fda56096a42dbc0eae4d35a5 | https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/io/grasslegacy/utils/GrassLegacyUtilities.java#L577-L618 | train |
TheHortonMachine/hortonmachine | gears/src/main/java/org/hortonmachine/gears/io/grasslegacy/utils/GrassLegacyUtilities.java | GrassLegacyUtilities.removeGrassRasterMap | public static boolean removeGrassRasterMap( String mapsetPath, String mapName ) throws IOException {
// list of files to remove
String mappaths[] = filesOfRasterMap(mapsetPath, mapName);
// first delete the list above, which are just files
for( int j = 0; j < mappaths.length; j++ ) {
... | java | public static boolean removeGrassRasterMap( String mapsetPath, String mapName ) throws IOException {
// list of files to remove
String mappaths[] = filesOfRasterMap(mapsetPath, mapName);
// first delete the list above, which are just files
for( int j = 0; j < mappaths.length; j++ ) {
... | [
"public",
"static",
"boolean",
"removeGrassRasterMap",
"(",
"String",
"mapsetPath",
",",
"String",
"mapName",
")",
"throws",
"IOException",
"{",
"// list of files to remove",
"String",
"mappaths",
"[",
"]",
"=",
"filesOfRasterMap",
"(",
"mapsetPath",
",",
"mapName",
... | Given the mapsetpath and the mapname, the map is removed with all its accessor files
@param mapsetPath
@param mapName
@throws IOException | [
"Given",
"the",
"mapsetpath",
"and",
"the",
"mapname",
"the",
"map",
"is",
"removed",
"with",
"all",
"its",
"accessor",
"files"
] | d2b436bbdf951dc1fda56096a42dbc0eae4d35a5 | https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/io/grasslegacy/utils/GrassLegacyUtilities.java#L658-L673 | train |
TheHortonMachine/hortonmachine | gears/src/main/java/org/hortonmachine/gears/io/grasslegacy/utils/GrassLegacyUtilities.java | GrassLegacyUtilities.rowColToNodeboundCoordinates | public static double[] rowColToNodeboundCoordinates( Window active, int row, int col ) {
double anorth = active.getNorth();
double awest = active.getWest();
double nsres = active.getNSResolution();
double ewres = active.getWEResolution();
double[] nsew = new double[4];
... | java | public static double[] rowColToNodeboundCoordinates( Window active, int row, int col ) {
double anorth = active.getNorth();
double awest = active.getWest();
double nsres = active.getNSResolution();
double ewres = active.getWEResolution();
double[] nsew = new double[4];
... | [
"public",
"static",
"double",
"[",
"]",
"rowColToNodeboundCoordinates",
"(",
"Window",
"active",
",",
"int",
"row",
",",
"int",
"col",
")",
"{",
"double",
"anorth",
"=",
"active",
".",
"getNorth",
"(",
")",
";",
"double",
"awest",
"=",
"active",
".",
"ge... | Transforms row and column index of the active region into an array of the coordinates of the
edgaes, i.e. n, s, e, w
@param active - the active region (can be null)
@param row - row number of the point to transform
@param col - column number of the point to transform
@return the array of north, south, east, west | [
"Transforms",
"row",
"and",
"column",
"index",
"of",
"the",
"active",
"region",
"into",
"an",
"array",
"of",
"the",
"coordinates",
"of",
"the",
"edgaes",
"i",
".",
"e",
".",
"n",
"s",
"e",
"w"
] | d2b436bbdf951dc1fda56096a42dbc0eae4d35a5 | https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/io/grasslegacy/utils/GrassLegacyUtilities.java#L713-L727 | train |
TheHortonMachine/hortonmachine | gears/src/main/java/org/hortonmachine/gears/io/dxfdwg/libs/dwg/utils/AcadExtrusionCalculator.java | AcadExtrusionCalculator.CalculateAcadExtrusion | public static double[] CalculateAcadExtrusion(double[] coord_in, double[] xtru) {
double[] coord_out;
double dxt0 = 0D, dyt0 = 0D, dzt0 = 0D;
double dvx1, dvx2, dvx3;
double dvy1, dvy2, dvy3;
double dmod, dxt, dyt, dzt;
double aux = 1D/64D;
double aux1 = Mat... | java | public static double[] CalculateAcadExtrusion(double[] coord_in, double[] xtru) {
double[] coord_out;
double dxt0 = 0D, dyt0 = 0D, dzt0 = 0D;
double dvx1, dvx2, dvx3;
double dvy1, dvy2, dvy3;
double dmod, dxt, dyt, dzt;
double aux = 1D/64D;
double aux1 = Mat... | [
"public",
"static",
"double",
"[",
"]",
"CalculateAcadExtrusion",
"(",
"double",
"[",
"]",
"coord_in",
",",
"double",
"[",
"]",
"xtru",
")",
"{",
"double",
"[",
"]",
"coord_out",
";",
"double",
"dxt0",
"=",
"0D",
",",
"dyt0",
"=",
"0D",
",",
"dzt0",
... | Method that allows to apply the extrusion transformation of Autocad
@param coord_in Array of doubles that represents the input coordinates
@param xtru array of doubles that contanins the extrusion parameters
@return double[] Is the result of the application of the extrusion transformation
to the input point | [
"Method",
"that",
"allows",
"to",
"apply",
"the",
"extrusion",
"transformation",
"of",
"Autocad"
] | d2b436bbdf951dc1fda56096a42dbc0eae4d35a5 | https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/io/dxfdwg/libs/dwg/utils/AcadExtrusionCalculator.java#L40-L94 | train |
TheHortonMachine/hortonmachine | dbs/src/main/java/org/hortonmachine/dbs/spatialite/hm/SpatialiteDb.java | SpatialiteDb.deleteGeoTable | public void deleteGeoTable( String tableName ) throws Exception {
String sql = "SELECT DropGeoTable('" + tableName + "');";
try (IHMStatement stmt = mConn.createStatement()) {
stmt.execute(sql);
}
} | java | public void deleteGeoTable( String tableName ) throws Exception {
String sql = "SELECT DropGeoTable('" + tableName + "');";
try (IHMStatement stmt = mConn.createStatement()) {
stmt.execute(sql);
}
} | [
"public",
"void",
"deleteGeoTable",
"(",
"String",
"tableName",
")",
"throws",
"Exception",
"{",
"String",
"sql",
"=",
"\"SELECT DropGeoTable('\"",
"+",
"tableName",
"+",
"\"');\"",
";",
"try",
"(",
"IHMStatement",
"stmt",
"=",
"mConn",
".",
"createStatement",
"... | Delete a geo-table with all attached indexes and stuff.
@param tableName
@throws Exception | [
"Delete",
"a",
"geo",
"-",
"table",
"with",
"all",
"attached",
"indexes",
"and",
"stuff",
"."
] | d2b436bbdf951dc1fda56096a42dbc0eae4d35a5 | https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/dbs/src/main/java/org/hortonmachine/dbs/spatialite/hm/SpatialiteDb.java#L294-L300 | train |
TheHortonMachine/hortonmachine | dbs/src/main/java/org/hortonmachine/dbs/spatialite/hm/SpatialiteDb.java | SpatialiteDb.runRawSqlToCsv | public void runRawSqlToCsv( String sql, File csvFile, boolean doHeader, String separator ) throws Exception {
try (BufferedWriter bw = new BufferedWriter(new FileWriter(csvFile))) {
SpatialiteWKBReader wkbReader = new SpatialiteWKBReader();
try (IHMStatement stmt = mConn.createStatement(... | java | public void runRawSqlToCsv( String sql, File csvFile, boolean doHeader, String separator ) throws Exception {
try (BufferedWriter bw = new BufferedWriter(new FileWriter(csvFile))) {
SpatialiteWKBReader wkbReader = new SpatialiteWKBReader();
try (IHMStatement stmt = mConn.createStatement(... | [
"public",
"void",
"runRawSqlToCsv",
"(",
"String",
"sql",
",",
"File",
"csvFile",
",",
"boolean",
"doHeader",
",",
"String",
"separator",
")",
"throws",
"Exception",
"{",
"try",
"(",
"BufferedWriter",
"bw",
"=",
"new",
"BufferedWriter",
"(",
"new",
"FileWriter... | Execute a query from raw sql and put the result in a csv file.
@param sql
the sql to run.
@param csvFile
the output file.
@param doHeader
if <code>true</code>, the header is written.
@param separator
the separator (if null, ";" is used).
@throws Exception | [
"Execute",
"a",
"query",
"from",
"raw",
"sql",
"and",
"put",
"the",
"result",
"in",
"a",
"csv",
"file",
"."
] | d2b436bbdf951dc1fda56096a42dbc0eae4d35a5 | https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/dbs/src/main/java/org/hortonmachine/dbs/spatialite/hm/SpatialiteDb.java#L372-L432 | train |
TheHortonMachine/hortonmachine | gears/src/main/java/org/hortonmachine/gears/io/dxfdwg/libs/dwg/DwgFile.java | DwgFile.read | public void read() throws IOException {
System.out.println("DwgFile.read() executed ...");
setDwgVersion();
if (dwgVersion.equals("R13")) {
dwgReader = new DwgFileV14Reader();
dwgReader.read(this);
} else if (dwgVersion.equals("R14")) {
dwgReader = new... | java | public void read() throws IOException {
System.out.println("DwgFile.read() executed ...");
setDwgVersion();
if (dwgVersion.equals("R13")) {
dwgReader = new DwgFileV14Reader();
dwgReader.read(this);
} else if (dwgVersion.equals("R14")) {
dwgReader = new... | [
"public",
"void",
"read",
"(",
")",
"throws",
"IOException",
"{",
"System",
".",
"out",
".",
"println",
"(",
"\"DwgFile.read() executed ...\"",
")",
";",
"setDwgVersion",
"(",
")",
";",
"if",
"(",
"dwgVersion",
".",
"equals",
"(",
"\"R13\"",
")",
")",
"{",... | Reads a DWG file and put its objects in the dwgObjects Vector
This method is version independent
@throws IOException If the file location is wrong | [
"Reads",
"a",
"DWG",
"file",
"and",
"put",
"its",
"objects",
"in",
"the",
"dwgObjects",
"Vector",
"This",
"method",
"is",
"version",
"independent"
] | d2b436bbdf951dc1fda56096a42dbc0eae4d35a5 | https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/io/dxfdwg/libs/dwg/DwgFile.java#L99-L114 | train |
TheHortonMachine/hortonmachine | gears/src/main/java/org/hortonmachine/gears/io/dxfdwg/libs/dwg/DwgFile.java | DwgFile.calculateCadModelDwgPolylines | public void calculateCadModelDwgPolylines() {
for( int i = 0; i < dwgObjects.size(); i++ ) {
DwgObject pol = (DwgObject) dwgObjects.get(i);
if (pol instanceof DwgPolyline2D) {
int flags = ((DwgPolyline2D) pol).getFlags();
int firstHandle = ((DwgPolyline2D)... | java | public void calculateCadModelDwgPolylines() {
for( int i = 0; i < dwgObjects.size(); i++ ) {
DwgObject pol = (DwgObject) dwgObjects.get(i);
if (pol instanceof DwgPolyline2D) {
int flags = ((DwgPolyline2D) pol).getFlags();
int firstHandle = ((DwgPolyline2D)... | [
"public",
"void",
"calculateCadModelDwgPolylines",
"(",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"dwgObjects",
".",
"size",
"(",
")",
";",
"i",
"++",
")",
"{",
"DwgObject",
"pol",
"=",
"(",
"DwgObject",
")",
"dwgObjects",
".",
"get"... | Configure the geometry of the polylines in a DWG file from the vertex list in
this DWG file. This geometry is given by an array of Points
Besides, manage closed polylines and polylines with bulges in a GIS Data model.
It means that the arcs of the polylines will be done through a curvature
parameter called bulge associ... | [
"Configure",
"the",
"geometry",
"of",
"the",
"polylines",
"in",
"a",
"DWG",
"file",
"from",
"the",
"vertex",
"list",
"in",
"this",
"DWG",
"file",
".",
"This",
"geometry",
"is",
"given",
"by",
"an",
"array",
"of",
"Points",
"Besides",
"manage",
"closed",
... | d2b436bbdf951dc1fda56096a42dbc0eae4d35a5 | https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/io/dxfdwg/libs/dwg/DwgFile.java#L434-L504 | train |
TheHortonMachine/hortonmachine | gears/src/main/java/org/hortonmachine/gears/io/dxfdwg/libs/dwg/DwgFile.java | DwgFile.blockManagement | public void blockManagement() {
Vector dwgObjectsWithoutBlocks = new Vector();
boolean addingToBlock = false;
for( int i = 0; i < dwgObjects.size(); i++ ) {
try {
DwgObject entity = (DwgObject) dwgObjects.get(i);
if (entity instanceof DwgArc && !adding... | java | public void blockManagement() {
Vector dwgObjectsWithoutBlocks = new Vector();
boolean addingToBlock = false;
for( int i = 0; i < dwgObjects.size(); i++ ) {
try {
DwgObject entity = (DwgObject) dwgObjects.get(i);
if (entity instanceof DwgArc && !adding... | [
"public",
"void",
"blockManagement",
"(",
")",
"{",
"Vector",
"dwgObjectsWithoutBlocks",
"=",
"new",
"Vector",
"(",
")",
";",
"boolean",
"addingToBlock",
"=",
"false",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"dwgObjects",
".",
"size",
"(",
... | Modify the geometry of the objects contained in the blocks of a DWG file and
add these objects to the DWG object list. | [
"Modify",
"the",
"geometry",
"of",
"the",
"objects",
"contained",
"in",
"the",
"blocks",
"of",
"a",
"DWG",
"file",
"and",
"add",
"these",
"objects",
"to",
"the",
"DWG",
"object",
"list",
"."
] | d2b436bbdf951dc1fda56096a42dbc0eae4d35a5 | https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/io/dxfdwg/libs/dwg/DwgFile.java#L510-L565 | train |
TheHortonMachine/hortonmachine | gears/src/main/java/org/hortonmachine/gears/io/dxfdwg/libs/dwg/DwgFile.java | DwgFile.initializeLayerTable | public void initializeLayerTable() {
layerTable = new Vector();
layerNames = new Vector();
for( int i = 0; i < dwgObjects.size(); i++ ) {
DwgObject obj = (DwgObject) dwgObjects.get(i);
if (obj instanceof DwgLayer) {
Vector layerTableRecord = new Vector();
... | java | public void initializeLayerTable() {
layerTable = new Vector();
layerNames = new Vector();
for( int i = 0; i < dwgObjects.size(); i++ ) {
DwgObject obj = (DwgObject) dwgObjects.get(i);
if (obj instanceof DwgLayer) {
Vector layerTableRecord = new Vector();
... | [
"public",
"void",
"initializeLayerTable",
"(",
")",
"{",
"layerTable",
"=",
"new",
"Vector",
"(",
")",
";",
"layerNames",
"=",
"new",
"Vector",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"dwgObjects",
".",
"size",
"(",
")",
";"... | Initialize a new Vector that contains the DWG file layers. Each layer have three
parameters. These parameters are handle, name and color | [
"Initialize",
"a",
"new",
"Vector",
"that",
"contains",
"the",
"DWG",
"file",
"layers",
".",
"Each",
"layer",
"have",
"three",
"parameters",
".",
"These",
"parameters",
"are",
"handle",
"name",
"and",
"color"
] | d2b436bbdf951dc1fda56096a42dbc0eae4d35a5 | https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/io/dxfdwg/libs/dwg/DwgFile.java#L928-L943 | train |
TheHortonMachine/hortonmachine | gears/src/main/java/org/hortonmachine/gears/io/dxfdwg/libs/dwg/DwgFile.java | DwgFile.getColorByLayer | public int getColorByLayer( DwgObject entity ) {
int colorByLayer = 0;
int layer = entity.getLayerHandle();
for( int j = 0; j < layerTable.size(); j++ ) {
Vector layerTableRecord = (Vector) layerTable.get(j);
int lHandle = ((Integer) layerTableRecord.get(0)).intValue();
... | java | public int getColorByLayer( DwgObject entity ) {
int colorByLayer = 0;
int layer = entity.getLayerHandle();
for( int j = 0; j < layerTable.size(); j++ ) {
Vector layerTableRecord = (Vector) layerTable.get(j);
int lHandle = ((Integer) layerTableRecord.get(0)).intValue();
... | [
"public",
"int",
"getColorByLayer",
"(",
"DwgObject",
"entity",
")",
"{",
"int",
"colorByLayer",
"=",
"0",
";",
"int",
"layer",
"=",
"entity",
".",
"getLayerHandle",
"(",
")",
";",
"for",
"(",
"int",
"j",
"=",
"0",
";",
"j",
"<",
"layerTable",
".",
"... | Returns the color of the layer of a DWG object
@param entity DWG object which we want to know its layer color
@return int Layer color of the DWG object in the Autocad color code | [
"Returns",
"the",
"color",
"of",
"the",
"layer",
"of",
"a",
"DWG",
"object"
] | d2b436bbdf951dc1fda56096a42dbc0eae4d35a5 | https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/io/dxfdwg/libs/dwg/DwgFile.java#L978-L989 | train |
TheHortonMachine/hortonmachine | gears/src/main/java/org/hortonmachine/gears/io/dxfdwg/libs/dwg/DwgFile.java | DwgFile.addDwgSectionOffset | public void addDwgSectionOffset( String key, int seek, int size ) {
DwgSectionOffset dso = new DwgSectionOffset(key, seek, size);
dwgSectionOffsets.add(dso);
} | java | public void addDwgSectionOffset( String key, int seek, int size ) {
DwgSectionOffset dso = new DwgSectionOffset(key, seek, size);
dwgSectionOffsets.add(dso);
} | [
"public",
"void",
"addDwgSectionOffset",
"(",
"String",
"key",
",",
"int",
"seek",
",",
"int",
"size",
")",
"{",
"DwgSectionOffset",
"dso",
"=",
"new",
"DwgSectionOffset",
"(",
"key",
",",
"seek",
",",
"size",
")",
";",
"dwgSectionOffsets",
".",
"add",
"("... | Add a DWG section offset to the dwgSectionOffsets vector
@param key Define the DWG section
@param seek Offset of the section
@param size Size of the section | [
"Add",
"a",
"DWG",
"section",
"offset",
"to",
"the",
"dwgSectionOffsets",
"vector"
] | d2b436bbdf951dc1fda56096a42dbc0eae4d35a5 | https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/io/dxfdwg/libs/dwg/DwgFile.java#L1122-L1125 | train |
TheHortonMachine/hortonmachine | gears/src/main/java/org/hortonmachine/gears/io/dxfdwg/libs/dwg/DwgFile.java | DwgFile.getDwgSectionOffset | public int getDwgSectionOffset( String key ) {
int offset = 0;
for( int i = 0; i < dwgSectionOffsets.size(); i++ ) {
DwgSectionOffset dso = (DwgSectionOffset) dwgSectionOffsets.get(i);
String ikey = dso.getKey();
if (key.equals(ikey)) {
offset = dso.ge... | java | public int getDwgSectionOffset( String key ) {
int offset = 0;
for( int i = 0; i < dwgSectionOffsets.size(); i++ ) {
DwgSectionOffset dso = (DwgSectionOffset) dwgSectionOffsets.get(i);
String ikey = dso.getKey();
if (key.equals(ikey)) {
offset = dso.ge... | [
"public",
"int",
"getDwgSectionOffset",
"(",
"String",
"key",
")",
"{",
"int",
"offset",
"=",
"0",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"dwgSectionOffsets",
".",
"size",
"(",
")",
";",
"i",
"++",
")",
"{",
"DwgSectionOffset",
"dso",
... | Returns the offset of DWG section given by its key
@param key Define the DWG section
@return int Offset of the section in the DWG file | [
"Returns",
"the",
"offset",
"of",
"DWG",
"section",
"given",
"by",
"its",
"key"
] | d2b436bbdf951dc1fda56096a42dbc0eae4d35a5 | https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/io/dxfdwg/libs/dwg/DwgFile.java#L1133-L1144 | train |
TheHortonMachine/hortonmachine | gears/src/main/java/org/hortonmachine/gears/io/dxfdwg/libs/dwg/DwgFile.java | DwgFile.addDwgObjectOffset | public void addDwgObjectOffset( int handle, int offset ) {
DwgObjectOffset doo = new DwgObjectOffset(handle, offset);
dwgObjectOffsets.add(doo);
} | java | public void addDwgObjectOffset( int handle, int offset ) {
DwgObjectOffset doo = new DwgObjectOffset(handle, offset);
dwgObjectOffsets.add(doo);
} | [
"public",
"void",
"addDwgObjectOffset",
"(",
"int",
"handle",
",",
"int",
"offset",
")",
"{",
"DwgObjectOffset",
"doo",
"=",
"new",
"DwgObjectOffset",
"(",
"handle",
",",
"offset",
")",
";",
"dwgObjectOffsets",
".",
"add",
"(",
"doo",
")",
";",
"}"
] | Add a DWG object offset to the dwgObjectOffsets vector
@param handle Object handle
@param offset Offset of the object data in the DWG file | [
"Add",
"a",
"DWG",
"object",
"offset",
"to",
"the",
"dwgObjectOffsets",
"vector"
] | d2b436bbdf951dc1fda56096a42dbc0eae4d35a5 | https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/io/dxfdwg/libs/dwg/DwgFile.java#L1152-L1155 | train |
enasequence/sequencetools | src/main/java/uk/ac/ebi/embl/api/validation/EnaValidator.java | EnaValidator.initValidator | protected void initValidator() throws SQLException, IOException
{
EmblEntryValidationPlanProperty emblEntryValidationPlanProperty = new EmblEntryValidationPlanProperty();
emblEntryValidationPlanProperty.validationScope.set(ValidationScope.getScope(fileType));
emblEntryValidationPlanProperty.isDevMode.set(testMo... | java | protected void initValidator() throws SQLException, IOException
{
EmblEntryValidationPlanProperty emblEntryValidationPlanProperty = new EmblEntryValidationPlanProperty();
emblEntryValidationPlanProperty.validationScope.set(ValidationScope.getScope(fileType));
emblEntryValidationPlanProperty.isDevMode.set(testMo... | [
"protected",
"void",
"initValidator",
"(",
")",
"throws",
"SQLException",
",",
"IOException",
"{",
"EmblEntryValidationPlanProperty",
"emblEntryValidationPlanProperty",
"=",
"new",
"EmblEntryValidationPlanProperty",
"(",
")",
";",
"emblEntryValidationPlanProperty",
".",
"vali... | Inits the validator.
@throws SQLException
@throws IOException
Signals that an I/O exception has occurred. | [
"Inits",
"the",
"validator",
"."
] | 4127f5e1a17540239f5810136153fbd6737fa262 | https://github.com/enasequence/sequencetools/blob/4127f5e1a17540239f5810136153fbd6737fa262/src/main/java/uk/ac/ebi/embl/api/validation/EnaValidator.java#L191-L212 | train |
enasequence/sequencetools | src/main/java/uk/ac/ebi/embl/api/validation/EnaValidator.java | EnaValidator.initWriters | protected void initWriters() throws IOException
{
String summarywriter = prefix == null ? "VAL_SUMMARY.txt" : prefix + "_" + "VAL_SUMMARY.txt";
String infowriter = prefix == null ? "VAL_INFO.txt" : prefix + "_" + "VAL_INFO.txt";
String errorwriter = prefix == null ? "VAL_ERROR.txt" : prefix + "_" + "VAL_ERROR.tx... | java | protected void initWriters() throws IOException
{
String summarywriter = prefix == null ? "VAL_SUMMARY.txt" : prefix + "_" + "VAL_SUMMARY.txt";
String infowriter = prefix == null ? "VAL_INFO.txt" : prefix + "_" + "VAL_INFO.txt";
String errorwriter = prefix == null ? "VAL_ERROR.txt" : prefix + "_" + "VAL_ERROR.tx... | [
"protected",
"void",
"initWriters",
"(",
")",
"throws",
"IOException",
"{",
"String",
"summarywriter",
"=",
"prefix",
"==",
"null",
"?",
"\"VAL_SUMMARY.txt\"",
":",
"prefix",
"+",
"\"_\"",
"+",
"\"VAL_SUMMARY.txt\"",
";",
"String",
"infowriter",
"=",
"prefix",
"... | separate method to instantiate so unit tests can call this
@throws IOException | [
"separate",
"method",
"to",
"instantiate",
"so",
"unit",
"tests",
"can",
"call",
"this"
] | 4127f5e1a17540239f5810136153fbd6737fa262 | https://github.com/enasequence/sequencetools/blob/4127f5e1a17540239f5810136153fbd6737fa262/src/main/java/uk/ac/ebi/embl/api/validation/EnaValidator.java#L472-L484 | train |
enasequence/sequencetools | src/main/java/uk/ac/ebi/embl/api/validation/EnaValidator.java | EnaValidator.validateFile | private List<ValidationPlanResult> validateFile(File file, Writer writer) throws IOException
{
List<ValidationPlanResult> messages = new ArrayList<ValidationPlanResult>();
ArrayList<Object> entryList = new ArrayList<Object>();
BufferedReader fileReader = null;
try
{
fileReader= new BufferedReader(new F... | java | private List<ValidationPlanResult> validateFile(File file, Writer writer) throws IOException
{
List<ValidationPlanResult> messages = new ArrayList<ValidationPlanResult>();
ArrayList<Object> entryList = new ArrayList<Object>();
BufferedReader fileReader = null;
try
{
fileReader= new BufferedReader(new F... | [
"private",
"List",
"<",
"ValidationPlanResult",
">",
"validateFile",
"(",
"File",
"file",
",",
"Writer",
"writer",
")",
"throws",
"IOException",
"{",
"List",
"<",
"ValidationPlanResult",
">",
"messages",
"=",
"new",
"ArrayList",
"<",
"ValidationPlanResult",
">",
... | Validate file.
@param file
the file
@param writer
the writer
@return the list of ValidationPlanResult
@throws IOException
@throws ValidationEngineException | [
"Validate",
"file",
"."
] | 4127f5e1a17540239f5810136153fbd6737fa262 | https://github.com/enasequence/sequencetools/blob/4127f5e1a17540239f5810136153fbd6737fa262/src/main/java/uk/ac/ebi/embl/api/validation/EnaValidator.java#L497-L535 | train |
enasequence/sequencetools | src/main/java/uk/ac/ebi/embl/api/validation/EnaValidator.java | EnaValidator.prepareReader | private void prepareReader(BufferedReader fileReader, String fileId)
{
switch (fileType)
{
case EMBL:
EmblEntryReader emblReader = new EmblEntryReader( fileReader, EmblEntryReader.Format.EMBL_FORMAT,fileId);
emblReader.setCheckBlockCounts(lineCount);
reader = emblReader;
break;
case GENBANK:
re... | java | private void prepareReader(BufferedReader fileReader, String fileId)
{
switch (fileType)
{
case EMBL:
EmblEntryReader emblReader = new EmblEntryReader( fileReader, EmblEntryReader.Format.EMBL_FORMAT,fileId);
emblReader.setCheckBlockCounts(lineCount);
reader = emblReader;
break;
case GENBANK:
re... | [
"private",
"void",
"prepareReader",
"(",
"BufferedReader",
"fileReader",
",",
"String",
"fileId",
")",
"{",
"switch",
"(",
"fileType",
")",
"{",
"case",
"EMBL",
":",
"EmblEntryReader",
"emblReader",
"=",
"new",
"EmblEntryReader",
"(",
"fileReader",
",",
"EmblEnt... | Prepare reader.
@param fileReader
the file reader
@param fileId
the file name | [
"Prepare",
"reader",
"."
] | 4127f5e1a17540239f5810136153fbd6737fa262 | https://github.com/enasequence/sequencetools/blob/4127f5e1a17540239f5810136153fbd6737fa262/src/main/java/uk/ac/ebi/embl/api/validation/EnaValidator.java#L545-L571 | train |
enasequence/sequencetools | src/main/java/uk/ac/ebi/embl/api/validation/EnaValidator.java | EnaValidator.writeResultsToFile | private void writeResultsToFile(ValidationPlanResult planResult) throws IOException
{
/**
* first set any report messages (probably exceptional that the
* translation report needs to get set outside the embl-api-core package
* due to the need for embl-ff writers
**/
for (ValidationResult result : plan... | java | private void writeResultsToFile(ValidationPlanResult planResult) throws IOException
{
/**
* first set any report messages (probably exceptional that the
* translation report needs to get set outside the embl-api-core package
* due to the need for embl-ff writers
**/
for (ValidationResult result : plan... | [
"private",
"void",
"writeResultsToFile",
"(",
"ValidationPlanResult",
"planResult",
")",
"throws",
"IOException",
"{",
"/**\n\t\t * first set any report messages (probably exceptional that the\n\t\t * translation report needs to get set outside the embl-api-core package\n\t\t * due to the need f... | Write results to file.
@param planResult the plan result
@throws IOException Signals that an I/O exception has occurred. | [
"Write",
"results",
"to",
"file",
"."
] | 4127f5e1a17540239f5810136153fbd6737fa262 | https://github.com/enasequence/sequencetools/blob/4127f5e1a17540239f5810136153fbd6737fa262/src/main/java/uk/ac/ebi/embl/api/validation/EnaValidator.java#L913-L955 | train |
enasequence/sequencetools | src/main/java/uk/ac/ebi/embl/api/validation/EnaValidator.java | EnaValidator.getNextEntryFromReader | protected Object getNextEntryFromReader(Writer writer)
{
try
{
parseError = false;
ValidationResult parseResult = reader.read();
if (parseResult.getMessages("FT.10").size() >= 1 && (fixMode || fixDiagnoseMode))
{
parseResult.removeMessage("FT.10"); // writer fixes automatically if quotes are not gi... | java | protected Object getNextEntryFromReader(Writer writer)
{
try
{
parseError = false;
ValidationResult parseResult = reader.read();
if (parseResult.getMessages("FT.10").size() >= 1 && (fixMode || fixDiagnoseMode))
{
parseResult.removeMessage("FT.10"); // writer fixes automatically if quotes are not gi... | [
"protected",
"Object",
"getNextEntryFromReader",
"(",
"Writer",
"writer",
")",
"{",
"try",
"{",
"parseError",
"=",
"false",
";",
"ValidationResult",
"parseResult",
"=",
"reader",
".",
"read",
"(",
")",
";",
"if",
"(",
"parseResult",
".",
"getMessages",
"(",
... | Gets the next entry from reader.
@param writer
the writer
@return the next entry from reader | [
"Gets",
"the",
"next",
"entry",
"from",
"reader",
"."
] | 4127f5e1a17540239f5810136153fbd6737fa262 | https://github.com/enasequence/sequencetools/blob/4127f5e1a17540239f5810136153fbd6737fa262/src/main/java/uk/ac/ebi/embl/api/validation/EnaValidator.java#L1013-L1046 | train |
TheHortonMachine/hortonmachine | hmachine/src/main/java/org/hortonmachine/hmachine/modules/networktools/trento_p/OmsTrentoP.java | OmsTrentoP.setNetworkPipes | private void setNetworkPipes( boolean isAreaNotAllDry ) throws Exception {
int length = inPipes.size();
networkPipes = new Pipe[length];
SimpleFeatureIterator stationsIter = inPipes.features();
boolean existOut = false;
int tmpOutIndex = 0;
try {
int t = 0;
... | java | private void setNetworkPipes( boolean isAreaNotAllDry ) throws Exception {
int length = inPipes.size();
networkPipes = new Pipe[length];
SimpleFeatureIterator stationsIter = inPipes.features();
boolean existOut = false;
int tmpOutIndex = 0;
try {
int t = 0;
... | [
"private",
"void",
"setNetworkPipes",
"(",
"boolean",
"isAreaNotAllDry",
")",
"throws",
"Exception",
"{",
"int",
"length",
"=",
"inPipes",
".",
"size",
"(",
")",
";",
"networkPipes",
"=",
"new",
"Pipe",
"[",
"length",
"]",
";",
"SimpleFeatureIterator",
"statio... | Initializating the array.
<p>
The array is the net. If there is a FeatureCollection extract values from
it. The Array is order following the ID.
</p>
oss: if the FeatureCillection is null a IllegalArgumentException is throw
in {@link OmsTrentoP#verifyParameter()}.
@param isAreaNotAllDry it is true if there is only a ... | [
"Initializating",
"the",
"array",
"."
] | d2b436bbdf951dc1fda56096a42dbc0eae4d35a5 | https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/hmachine/src/main/java/org/hortonmachine/hmachine/modules/networktools/trento_p/OmsTrentoP.java#L693-L759 | train |
TheHortonMachine/hortonmachine | hmachine/src/main/java/org/hortonmachine/hmachine/modules/networktools/trento_p/OmsTrentoP.java | OmsTrentoP.verifyNet | public void verifyNet( Pipe[] networkPipes, IHMProgressMonitor pm ) {
/*
* serve per verificare che ci sia almeno un'uscita. True= esiste
* un'uscita
*/
boolean isOut = false;
if (networkPipes != null) {
/* VERIFICA DATI GEOMETRICI DELLA RETE */
... | java | public void verifyNet( Pipe[] networkPipes, IHMProgressMonitor pm ) {
/*
* serve per verificare che ci sia almeno un'uscita. True= esiste
* un'uscita
*/
boolean isOut = false;
if (networkPipes != null) {
/* VERIFICA DATI GEOMETRICI DELLA RETE */
... | [
"public",
"void",
"verifyNet",
"(",
"Pipe",
"[",
"]",
"networkPipes",
",",
"IHMProgressMonitor",
"pm",
")",
"{",
"/*\n * serve per verificare che ci sia almeno un'uscita. True= esiste\n * un'uscita\n */",
"boolean",
"isOut",
"=",
"false",
";",
"if",
"(... | Verify if the network is consistent.
<p>
<ol>
<li>Verify that the <i>ID</i> of a pipe is a value less than the number
of pipe.
<li>Verify that the pipe where, the current pipe drain, have an <i>ID</i>
less than the number of pipes.
<li>Verify that there is an <b>outlet<b> in the net.
</ol>
</p>
@param networkPipes
th... | [
"Verify",
"if",
"the",
"network",
"is",
"consistent",
"."
] | d2b436bbdf951dc1fda56096a42dbc0eae4d35a5 | https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/hmachine/src/main/java/org/hortonmachine/hmachine/modules/networktools/trento_p/OmsTrentoP.java#L825-L922 | train |
enasequence/sequencetools | src/main/java/uk/ac/ebi/embl/flatfile/reader/LineReader.java | LineReader.joinLine | public boolean joinLine() {
if (!isCurrentLine()) {
return false;
}
if (!isNextLine()) {
return false;
}
if (!isNextTag()) {
return true; // no next tag -> continue block
}
if (!isCurrentTag()) {
return false; // no current tag -> new block
}
// compare current and next tag
return getCur... | java | public boolean joinLine() {
if (!isCurrentLine()) {
return false;
}
if (!isNextLine()) {
return false;
}
if (!isNextTag()) {
return true; // no next tag -> continue block
}
if (!isCurrentTag()) {
return false; // no current tag -> new block
}
// compare current and next tag
return getCur... | [
"public",
"boolean",
"joinLine",
"(",
")",
"{",
"if",
"(",
"!",
"isCurrentLine",
"(",
")",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"!",
"isNextLine",
"(",
")",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"!",
"isNextTag",
"(",
")"... | Returns true if the next and current lines can be joined together either
because they have the same tag or because the next line does not have a
tag. | [
"Returns",
"true",
"if",
"the",
"next",
"and",
"current",
"lines",
"can",
"be",
"joined",
"together",
"either",
"because",
"they",
"have",
"the",
"same",
"tag",
"or",
"because",
"the",
"next",
"line",
"does",
"not",
"have",
"a",
"tag",
"."
] | 4127f5e1a17540239f5810136153fbd6737fa262 | https://github.com/enasequence/sequencetools/blob/4127f5e1a17540239f5810136153fbd6737fa262/src/main/java/uk/ac/ebi/embl/flatfile/reader/LineReader.java#L197-L212 | train |
enasequence/sequencetools | src/main/java/uk/ac/ebi/embl/flatfile/reader/LineReader.java | LineReader.getCurrentLine | public String getCurrentLine() {
if (!isCurrentLine()) {
return null;
}
if (isTag(currentLine))
return FlatFileUtils.trimRight(currentLine,
getTagWidth(currentLine));
else
return currentLine.trim();
} | java | public String getCurrentLine() {
if (!isCurrentLine()) {
return null;
}
if (isTag(currentLine))
return FlatFileUtils.trimRight(currentLine,
getTagWidth(currentLine));
else
return currentLine.trim();
} | [
"public",
"String",
"getCurrentLine",
"(",
")",
"{",
"if",
"(",
"!",
"isCurrentLine",
"(",
")",
")",
"{",
"return",
"null",
";",
"}",
"if",
"(",
"isTag",
"(",
"currentLine",
")",
")",
"return",
"FlatFileUtils",
".",
"trimRight",
"(",
"currentLine",
",",
... | Return current line without tag. | [
"Return",
"current",
"line",
"without",
"tag",
"."
] | 4127f5e1a17540239f5810136153fbd6737fa262 | https://github.com/enasequence/sequencetools/blob/4127f5e1a17540239f5810136153fbd6737fa262/src/main/java/uk/ac/ebi/embl/flatfile/reader/LineReader.java#L217-L226 | train |
enasequence/sequencetools | src/main/java/uk/ac/ebi/embl/flatfile/reader/LineReader.java | LineReader.getNextLine | public String getNextLine() {
if (!isNextLine()) {
return null;
}
if (isTag(nextLine))
return FlatFileUtils.trimRight(nextLine,
getTagWidth(nextLine));
else
return nextLine.trim();
} | java | public String getNextLine() {
if (!isNextLine()) {
return null;
}
if (isTag(nextLine))
return FlatFileUtils.trimRight(nextLine,
getTagWidth(nextLine));
else
return nextLine.trim();
} | [
"public",
"String",
"getNextLine",
"(",
")",
"{",
"if",
"(",
"!",
"isNextLine",
"(",
")",
")",
"{",
"return",
"null",
";",
"}",
"if",
"(",
"isTag",
"(",
"nextLine",
")",
")",
"return",
"FlatFileUtils",
".",
"trimRight",
"(",
"nextLine",
",",
"getTagWid... | Return next line without tag. | [
"Return",
"next",
"line",
"without",
"tag",
"."
] | 4127f5e1a17540239f5810136153fbd6737fa262 | https://github.com/enasequence/sequencetools/blob/4127f5e1a17540239f5810136153fbd6737fa262/src/main/java/uk/ac/ebi/embl/flatfile/reader/LineReader.java#L231-L240 | train |
enasequence/sequencetools | src/main/java/uk/ac/ebi/embl/flatfile/reader/LineReader.java | LineReader.getCurrentMaskedLine | public String getCurrentMaskedLine() {
if (!isCurrentLine()) {
return null;
}
StringBuilder str = new StringBuilder();
int tagWidth = getTagWidth(currentLine);
for (int i = 0; i < tagWidth; ++i) {
str.append(" ");
}
if (currentLine.length() > tagWidth) {
str.append(currentLine.substring(tagWidth)... | java | public String getCurrentMaskedLine() {
if (!isCurrentLine()) {
return null;
}
StringBuilder str = new StringBuilder();
int tagWidth = getTagWidth(currentLine);
for (int i = 0; i < tagWidth; ++i) {
str.append(" ");
}
if (currentLine.length() > tagWidth) {
str.append(currentLine.substring(tagWidth)... | [
"public",
"String",
"getCurrentMaskedLine",
"(",
")",
"{",
"if",
"(",
"!",
"isCurrentLine",
"(",
")",
")",
"{",
"return",
"null",
";",
"}",
"StringBuilder",
"str",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"int",
"tagWidth",
"=",
"getTagWidth",
"(",
"c... | Return current line with tag masked with whitespace. | [
"Return",
"current",
"line",
"with",
"tag",
"masked",
"with",
"whitespace",
"."
] | 4127f5e1a17540239f5810136153fbd6737fa262 | https://github.com/enasequence/sequencetools/blob/4127f5e1a17540239f5810136153fbd6737fa262/src/main/java/uk/ac/ebi/embl/flatfile/reader/LineReader.java#L245-L258 | train |
enasequence/sequencetools | src/main/java/uk/ac/ebi/embl/flatfile/reader/LineReader.java | LineReader.getNextMaskedLine | public String getNextMaskedLine() {
if (!isNextLine()) {
return null;
}
StringBuilder str = new StringBuilder();
int tagWidth = getTagWidth(nextLine);
for (int i = 0; i < tagWidth; ++i) {
str.append(" ");
}
if (nextLine.length() > tagWidth) {
str.append(nextLine.substring(tagWidth));
}
return... | java | public String getNextMaskedLine() {
if (!isNextLine()) {
return null;
}
StringBuilder str = new StringBuilder();
int tagWidth = getTagWidth(nextLine);
for (int i = 0; i < tagWidth; ++i) {
str.append(" ");
}
if (nextLine.length() > tagWidth) {
str.append(nextLine.substring(tagWidth));
}
return... | [
"public",
"String",
"getNextMaskedLine",
"(",
")",
"{",
"if",
"(",
"!",
"isNextLine",
"(",
")",
")",
"{",
"return",
"null",
";",
"}",
"StringBuilder",
"str",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"int",
"tagWidth",
"=",
"getTagWidth",
"(",
"nextLin... | Return next line with tag masked with whitespace. | [
"Return",
"next",
"line",
"with",
"tag",
"masked",
"with",
"whitespace",
"."
] | 4127f5e1a17540239f5810136153fbd6737fa262 | https://github.com/enasequence/sequencetools/blob/4127f5e1a17540239f5810136153fbd6737fa262/src/main/java/uk/ac/ebi/embl/flatfile/reader/LineReader.java#L263-L276 | train |
enasequence/sequencetools | src/main/java/uk/ac/ebi/embl/flatfile/reader/LineReader.java | LineReader.getCurrentShrinkedLine | public String getCurrentShrinkedLine() {
if (!isCurrentLine()) {
return null;
}
String string = FlatFileUtils.trim(currentLine,
getTagWidth(currentLine));
if (string.equals("")) {
return null;
}
return FlatFileUtils.shrink(string);
} | java | public String getCurrentShrinkedLine() {
if (!isCurrentLine()) {
return null;
}
String string = FlatFileUtils.trim(currentLine,
getTagWidth(currentLine));
if (string.equals("")) {
return null;
}
return FlatFileUtils.shrink(string);
} | [
"public",
"String",
"getCurrentShrinkedLine",
"(",
")",
"{",
"if",
"(",
"!",
"isCurrentLine",
"(",
")",
")",
"{",
"return",
"null",
";",
"}",
"String",
"string",
"=",
"FlatFileUtils",
".",
"trim",
"(",
"currentLine",
",",
"getTagWidth",
"(",
"currentLine",
... | Shrink and return the current line without tag. | [
"Shrink",
"and",
"return",
"the",
"current",
"line",
"without",
"tag",
"."
] | 4127f5e1a17540239f5810136153fbd6737fa262 | https://github.com/enasequence/sequencetools/blob/4127f5e1a17540239f5810136153fbd6737fa262/src/main/java/uk/ac/ebi/embl/flatfile/reader/LineReader.java#L291-L301 | train |
TheHortonMachine/hortonmachine | gui/src/main/java/org/hortonmachine/gui/utils/monitor/HMProgressMonitorDialog.java | HMProgressMonitorDialog.propertyChange | public void propertyChange( PropertyChangeEvent evt ) {
if ("progress" == evt.getPropertyName()) {
int progress = (Integer) evt.getNewValue();
progressMonitor.setProgress(progress);
// String message = String.format("Completed %d%%.\n", progress);
// progressMonit... | java | public void propertyChange( PropertyChangeEvent evt ) {
if ("progress" == evt.getPropertyName()) {
int progress = (Integer) evt.getNewValue();
progressMonitor.setProgress(progress);
// String message = String.format("Completed %d%%.\n", progress);
// progressMonit... | [
"public",
"void",
"propertyChange",
"(",
"PropertyChangeEvent",
"evt",
")",
"{",
"if",
"(",
"\"progress\"",
"==",
"evt",
".",
"getPropertyName",
"(",
")",
")",
"{",
"int",
"progress",
"=",
"(",
"Integer",
")",
"evt",
".",
"getNewValue",
"(",
")",
";",
"p... | Invoked when task's progress property changes. | [
"Invoked",
"when",
"task",
"s",
"progress",
"property",
"changes",
"."
] | d2b436bbdf951dc1fda56096a42dbc0eae4d35a5 | https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gui/src/main/java/org/hortonmachine/gui/utils/monitor/HMProgressMonitorDialog.java#L125-L147 | train |
TheHortonMachine/hortonmachine | modules/src/main/java/org/hortonmachine/modules/Raster.java | Raster.positionAt | public double[] positionAt( int col, int row ) {
if (isInRaster(col, row)) {
GridGeometry2D gridGeometry = getGridGeometry();
Coordinate coordinate = CoverageUtilities.coordinateFromColRow(col, row, gridGeometry);
return new double[]{coordinate.x, coordinate.y};
}
... | java | public double[] positionAt( int col, int row ) {
if (isInRaster(col, row)) {
GridGeometry2D gridGeometry = getGridGeometry();
Coordinate coordinate = CoverageUtilities.coordinateFromColRow(col, row, gridGeometry);
return new double[]{coordinate.x, coordinate.y};
}
... | [
"public",
"double",
"[",
"]",
"positionAt",
"(",
"int",
"col",
",",
"int",
"row",
")",
"{",
"if",
"(",
"isInRaster",
"(",
"col",
",",
"row",
")",
")",
"{",
"GridGeometry2D",
"gridGeometry",
"=",
"getGridGeometry",
"(",
")",
";",
"Coordinate",
"coordinate... | Get world position from col, row.
@param col
@param row
@return the [x, y] position or <code>null</code> if outside the bounds. | [
"Get",
"world",
"position",
"from",
"col",
"row",
"."
] | d2b436bbdf951dc1fda56096a42dbc0eae4d35a5 | https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/modules/src/main/java/org/hortonmachine/modules/Raster.java#L250-L257 | train |
TheHortonMachine/hortonmachine | modules/src/main/java/org/hortonmachine/modules/Raster.java | Raster.gridAt | public int[] gridAt( double x, double y ) {
if (isInRaster(x, y)) {
GridGeometry2D gridGeometry = getGridGeometry();
int[] colRowFromCoordinate = CoverageUtilities.colRowFromCoordinate(new Coordinate(x, y), gridGeometry, null);
return colRowFromCoordinate;
}
r... | java | public int[] gridAt( double x, double y ) {
if (isInRaster(x, y)) {
GridGeometry2D gridGeometry = getGridGeometry();
int[] colRowFromCoordinate = CoverageUtilities.colRowFromCoordinate(new Coordinate(x, y), gridGeometry, null);
return colRowFromCoordinate;
}
r... | [
"public",
"int",
"[",
"]",
"gridAt",
"(",
"double",
"x",
",",
"double",
"y",
")",
"{",
"if",
"(",
"isInRaster",
"(",
"x",
",",
"y",
")",
")",
"{",
"GridGeometry2D",
"gridGeometry",
"=",
"getGridGeometry",
"(",
")",
";",
"int",
"[",
"]",
"colRowFromCo... | Get grid col and row from a world coordinate.
@param x
@param y
@return the [col, row] or <code>null</code> if the position is outside the bounds. | [
"Get",
"grid",
"col",
"and",
"row",
"from",
"a",
"world",
"coordinate",
"."
] | d2b436bbdf951dc1fda56096a42dbc0eae4d35a5 | https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/modules/src/main/java/org/hortonmachine/modules/Raster.java#L266-L273 | train |
TheHortonMachine/hortonmachine | modules/src/main/java/org/hortonmachine/modules/Raster.java | Raster.setValueAt | public void setValueAt( int col, int row, double value ) {
if (makeNew) {
if (isInRaster(col, row)) {
((WritableRandomIter) iter).setSample(col, row, 0, value);
} else {
throw new RuntimeException("Setting value outside of raster.");
}
... | java | public void setValueAt( int col, int row, double value ) {
if (makeNew) {
if (isInRaster(col, row)) {
((WritableRandomIter) iter).setSample(col, row, 0, value);
} else {
throw new RuntimeException("Setting value outside of raster.");
}
... | [
"public",
"void",
"setValueAt",
"(",
"int",
"col",
",",
"int",
"row",
",",
"double",
"value",
")",
"{",
"if",
"(",
"makeNew",
")",
"{",
"if",
"(",
"isInRaster",
"(",
"col",
",",
"row",
")",
")",
"{",
"(",
"(",
"WritableRandomIter",
")",
"iter",
")"... | Sets a raster value if the raster is writable.
@param col
@param row
@param value | [
"Sets",
"a",
"raster",
"value",
"if",
"the",
"raster",
"is",
"writable",
"."
] | d2b436bbdf951dc1fda56096a42dbc0eae4d35a5 | https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/modules/src/main/java/org/hortonmachine/modules/Raster.java#L282-L292 | train |
TheHortonMachine/hortonmachine | modules/src/main/java/org/hortonmachine/modules/Raster.java | Raster.surrounding | public double[] surrounding( int col, int row ) {
GridNode node = new GridNode(iter, cols, rows, xRes, yRes, col, row);
List<GridNode> surroundingNodes = node.getSurroundingNodes();
double[] surr = new double[8];
for( int i = 0; i < surroundingNodes.size(); i++ ) {
GridNode g... | java | public double[] surrounding( int col, int row ) {
GridNode node = new GridNode(iter, cols, rows, xRes, yRes, col, row);
List<GridNode> surroundingNodes = node.getSurroundingNodes();
double[] surr = new double[8];
for( int i = 0; i < surroundingNodes.size(); i++ ) {
GridNode g... | [
"public",
"double",
"[",
"]",
"surrounding",
"(",
"int",
"col",
",",
"int",
"row",
")",
"{",
"GridNode",
"node",
"=",
"new",
"GridNode",
"(",
"iter",
",",
"cols",
",",
"rows",
",",
"xRes",
",",
"yRes",
",",
"col",
",",
"row",
")",
";",
"List",
"<... | Get the values of the surrounding cells.
<b>The order of the values is [E, EN, N, NW, W, WS, S, SE].</b>
@param col the col of the center cell.
@param row the row of the center cell.
@return the array of cell values around them as [E, EN, N, NW, W, WS, S, SE]. | [
"Get",
"the",
"values",
"of",
"the",
"surrounding",
"cells",
"."
] | d2b436bbdf951dc1fda56096a42dbc0eae4d35a5 | https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/modules/src/main/java/org/hortonmachine/modules/Raster.java#L303-L316 | train |
TheHortonMachine/hortonmachine | modules/src/main/java/org/hortonmachine/modules/Raster.java | Raster.write | public void write( String path ) throws Exception {
if (makeNew) {
RasterWriter.writeRaster(path, buildRaster());
} else {
throw new RuntimeException("Only new rasters can be dumped.");
}
} | java | public void write( String path ) throws Exception {
if (makeNew) {
RasterWriter.writeRaster(path, buildRaster());
} else {
throw new RuntimeException("Only new rasters can be dumped.");
}
} | [
"public",
"void",
"write",
"(",
"String",
"path",
")",
"throws",
"Exception",
"{",
"if",
"(",
"makeNew",
")",
"{",
"RasterWriter",
".",
"writeRaster",
"(",
"path",
",",
"buildRaster",
"(",
")",
")",
";",
"}",
"else",
"{",
"throw",
"new",
"RuntimeExceptio... | Write the raster to file.
@param path th epath to write to.
@throws Exception | [
"Write",
"the",
"raster",
"to",
"file",
"."
] | d2b436bbdf951dc1fda56096a42dbc0eae4d35a5 | https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/modules/src/main/java/org/hortonmachine/modules/Raster.java#L359-L365 | train |
TheHortonMachine/hortonmachine | modules/src/main/java/org/hortonmachine/modules/Raster.java | Raster.read | public static Raster read( String path ) throws Exception {
GridCoverage2D coverage2d = RasterReader.readRaster(path);
Raster raster = new Raster(coverage2d);
return raster;
} | java | public static Raster read( String path ) throws Exception {
GridCoverage2D coverage2d = RasterReader.readRaster(path);
Raster raster = new Raster(coverage2d);
return raster;
} | [
"public",
"static",
"Raster",
"read",
"(",
"String",
"path",
")",
"throws",
"Exception",
"{",
"GridCoverage2D",
"coverage2d",
"=",
"RasterReader",
".",
"readRaster",
"(",
"path",
")",
";",
"Raster",
"raster",
"=",
"new",
"Raster",
"(",
"coverage2d",
")",
";"... | Read a raster from file.
@param path the path to the raster to read.
@return the read raster in readonly mode.
@throws Exception | [
"Read",
"a",
"raster",
"from",
"file",
"."
] | d2b436bbdf951dc1fda56096a42dbc0eae4d35a5 | https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/modules/src/main/java/org/hortonmachine/modules/Raster.java#L374-L378 | train |
enasequence/sequencetools | src/main/java/uk/ac/ebi/embl/template/TemplateLoader.java | TemplateLoader.checkDuplicateTokens | private void checkDuplicateTokens(MutableTemplateInfo templateInfo) throws TemplateException {
List<String> allTokenNames = new ArrayList<String>();
for (TemplateTokenInfo tokenInfo : templateInfo.tokenInfos) {
if (allTokenNames.contains(tokenInfo.getName())) {
throw new Temp... | java | private void checkDuplicateTokens(MutableTemplateInfo templateInfo) throws TemplateException {
List<String> allTokenNames = new ArrayList<String>();
for (TemplateTokenInfo tokenInfo : templateInfo.tokenInfos) {
if (allTokenNames.contains(tokenInfo.getName())) {
throw new Temp... | [
"private",
"void",
"checkDuplicateTokens",
"(",
"MutableTemplateInfo",
"templateInfo",
")",
"throws",
"TemplateException",
"{",
"List",
"<",
"String",
">",
"allTokenNames",
"=",
"new",
"ArrayList",
"<",
"String",
">",
"(",
")",
";",
"for",
"(",
"TemplateTokenInfo"... | throws error if a token name appears twice - will bail as soon as one duplicate is hit
@param templateInfo
@throws TemplateException | [
"throws",
"error",
"if",
"a",
"token",
"name",
"appears",
"twice",
"-",
"will",
"bail",
"as",
"soon",
"as",
"one",
"duplicate",
"is",
"hit"
] | 4127f5e1a17540239f5810136153fbd6737fa262 | https://github.com/enasequence/sequencetools/blob/4127f5e1a17540239f5810136153fbd6737fa262/src/main/java/uk/ac/ebi/embl/template/TemplateLoader.java#L235-L246 | train |
enasequence/sequencetools | src/main/java/uk/ac/ebi/embl/template/TemplateLoader.java | TemplateLoader.processGroups | private void processGroups(MutableTemplateInfo template) throws TemplateException {
List<TemplateTokenGroupInfo> groupInfos = template.groupInfo;
List<String> allGroupTokens = new ArrayList<String>();
for (TemplateTokenGroupInfo groupInfo : groupInfos) {
for (String newToken : grou... | java | private void processGroups(MutableTemplateInfo template) throws TemplateException {
List<TemplateTokenGroupInfo> groupInfos = template.groupInfo;
List<String> allGroupTokens = new ArrayList<String>();
for (TemplateTokenGroupInfo groupInfo : groupInfos) {
for (String newToken : grou... | [
"private",
"void",
"processGroups",
"(",
"MutableTemplateInfo",
"template",
")",
"throws",
"TemplateException",
"{",
"List",
"<",
"TemplateTokenGroupInfo",
">",
"groupInfos",
"=",
"template",
".",
"groupInfo",
";",
"List",
"<",
"String",
">",
"allGroupTokens",
"=",
... | creates a group containing all tokens not contained in any other sections - an "all others" group
@param template - | [
"creates",
"a",
"group",
"containing",
"all",
"tokens",
"not",
"contained",
"in",
"any",
"other",
"sections",
"-",
"an",
"all",
"others",
"group"
] | 4127f5e1a17540239f5810136153fbd6737fa262 | https://github.com/enasequence/sequencetools/blob/4127f5e1a17540239f5810136153fbd6737fa262/src/main/java/uk/ac/ebi/embl/template/TemplateLoader.java#L253-L284 | train |
TheHortonMachine/hortonmachine | gears/src/main/java/oms3/io/CharBuffer.java | CharBuffer.shrink | public void shrink() {
if (c.length == length) {
return;
}
char[] newc = new char[length];
System.arraycopy(c, 0, newc, 0, length);
c = newc;
} | java | public void shrink() {
if (c.length == length) {
return;
}
char[] newc = new char[length];
System.arraycopy(c, 0, newc, 0, length);
c = newc;
} | [
"public",
"void",
"shrink",
"(",
")",
"{",
"if",
"(",
"c",
".",
"length",
"==",
"length",
")",
"{",
"return",
";",
"}",
"char",
"[",
"]",
"newc",
"=",
"new",
"char",
"[",
"length",
"]",
";",
"System",
".",
"arraycopy",
"(",
"c",
",",
"0",
",",
... | Shrinks the capacity of the buffer to the current length if necessary.
This method involves copying the data once! | [
"Shrinks",
"the",
"capacity",
"of",
"the",
"buffer",
"to",
"the",
"current",
"length",
"if",
"necessary",
".",
"This",
"method",
"involves",
"copying",
"the",
"data",
"once!"
] | d2b436bbdf951dc1fda56096a42dbc0eae4d35a5 | https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/oms3/io/CharBuffer.java#L153-L160 | train |
TheHortonMachine/hortonmachine | gears/src/main/java/oms3/io/CharBuffer.java | CharBuffer.toStringBuffer | public StringBuffer toStringBuffer() {
StringBuffer sb = new StringBuffer(length);
sb.append(c, 0, length);
return sb;
} | java | public StringBuffer toStringBuffer() {
StringBuffer sb = new StringBuffer(length);
sb.append(c, 0, length);
return sb;
} | [
"public",
"StringBuffer",
"toStringBuffer",
"(",
")",
"{",
"StringBuffer",
"sb",
"=",
"new",
"StringBuffer",
"(",
"length",
")",
";",
"sb",
".",
"append",
"(",
"c",
",",
"0",
",",
"length",
")",
";",
"return",
"sb",
";",
"}"
] | Converts the contents of the buffer into a StringBuffer.
This method involves copying the new data once!
@return | [
"Converts",
"the",
"contents",
"of",
"the",
"buffer",
"into",
"a",
"StringBuffer",
".",
"This",
"method",
"involves",
"copying",
"the",
"new",
"data",
"once!"
] | d2b436bbdf951dc1fda56096a42dbc0eae4d35a5 | https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/oms3/io/CharBuffer.java#L200-L204 | train |
TheHortonMachine/hortonmachine | gears/src/main/java/org/hortonmachine/gears/utils/coverage/CoverageUtilities.java | CoverageUtilities.createSubCoverageFromTemplate | public static GridCoverage2D createSubCoverageFromTemplate( GridCoverage2D template, Envelope2D subregion, Double value,
WritableRaster[] writableRasterHolder ) {
RegionMap regionMap = getRegionParamsFromGridCoverage(template);
double xRes = regionMap.getXres();
double yRes = regionM... | java | public static GridCoverage2D createSubCoverageFromTemplate( GridCoverage2D template, Envelope2D subregion, Double value,
WritableRaster[] writableRasterHolder ) {
RegionMap regionMap = getRegionParamsFromGridCoverage(template);
double xRes = regionMap.getXres();
double yRes = regionM... | [
"public",
"static",
"GridCoverage2D",
"createSubCoverageFromTemplate",
"(",
"GridCoverage2D",
"template",
",",
"Envelope2D",
"subregion",
",",
"Double",
"value",
",",
"WritableRaster",
"[",
"]",
"writableRasterHolder",
")",
"{",
"RegionMap",
"regionMap",
"=",
"getRegion... | Create a subcoverage given a template coverage and an envelope.
@param template the template coverage used for the resolution.
@param subregion the envelope to extract to the new coverage. This should
be snapped on the resolution of the coverage, in order to avoid
shifts.
@param value the value to set the new raster t... | [
"Create",
"a",
"subcoverage",
"given",
"a",
"template",
"coverage",
"and",
"an",
"envelope",
"."
] | d2b436bbdf951dc1fda56096a42dbc0eae4d35a5 | https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/utils/coverage/CoverageUtilities.java#L344-L376 | train |
TheHortonMachine/hortonmachine | gears/src/main/java/org/hortonmachine/gears/utils/coverage/CoverageUtilities.java | CoverageUtilities.getRegionColsRows | public static int[] getRegionColsRows( GridCoverage2D gridCoverage ) {
GridGeometry2D gridGeometry = gridCoverage.getGridGeometry();
GridEnvelope2D gridRange = gridGeometry.getGridRange2D();
int height = gridRange.height;
int width = gridRange.width;
int[] params = new int[]{widt... | java | public static int[] getRegionColsRows( GridCoverage2D gridCoverage ) {
GridGeometry2D gridGeometry = gridCoverage.getGridGeometry();
GridEnvelope2D gridRange = gridGeometry.getGridRange2D();
int height = gridRange.height;
int width = gridRange.width;
int[] params = new int[]{widt... | [
"public",
"static",
"int",
"[",
"]",
"getRegionColsRows",
"(",
"GridCoverage2D",
"gridCoverage",
")",
"{",
"GridGeometry2D",
"gridGeometry",
"=",
"gridCoverage",
".",
"getGridGeometry",
"(",
")",
";",
"GridEnvelope2D",
"gridRange",
"=",
"gridGeometry",
".",
"getGrid... | Get the array of rows and cols.
@param gridCoverage the coverage.
@return the array as [cols, rows] | [
"Get",
"the",
"array",
"of",
"rows",
"and",
"cols",
"."
] | d2b436bbdf951dc1fda56096a42dbc0eae4d35a5 | https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/utils/coverage/CoverageUtilities.java#L485-L492 | train |
TheHortonMachine/hortonmachine | gears/src/main/java/org/hortonmachine/gears/utils/coverage/CoverageUtilities.java | CoverageUtilities.getLoopColsRowsForSubregion | public static int[] getLoopColsRowsForSubregion( GridCoverage2D gridCoverage, Envelope2D subregion ) throws Exception {
GridGeometry2D gridGeometry = gridCoverage.getGridGeometry();
GridEnvelope2D subRegionGrid = gridGeometry.worldToGrid(subregion);
int minCol = subRegionGrid.x;
int maxC... | java | public static int[] getLoopColsRowsForSubregion( GridCoverage2D gridCoverage, Envelope2D subregion ) throws Exception {
GridGeometry2D gridGeometry = gridCoverage.getGridGeometry();
GridEnvelope2D subRegionGrid = gridGeometry.worldToGrid(subregion);
int minCol = subRegionGrid.x;
int maxC... | [
"public",
"static",
"int",
"[",
"]",
"getLoopColsRowsForSubregion",
"(",
"GridCoverage2D",
"gridCoverage",
",",
"Envelope2D",
"subregion",
")",
"throws",
"Exception",
"{",
"GridGeometry2D",
"gridGeometry",
"=",
"gridCoverage",
".",
"getGridGeometry",
"(",
")",
";",
... | Get the cols and rows ranges to use to loop the original gridcoverage.
@param gridCoverage the coverage.
@param subregion the sub region of the coverage to get the cols and rows to loop on.
@return the array of looping values in the form [minCol, maxCol, minRow, maxRow].
@throws Exception | [
"Get",
"the",
"cols",
"and",
"rows",
"ranges",
"to",
"use",
"to",
"loop",
"the",
"original",
"gridcoverage",
"."
] | d2b436bbdf951dc1fda56096a42dbc0eae4d35a5 | https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/utils/coverage/CoverageUtilities.java#L519-L527 | train |
TheHortonMachine/hortonmachine | gears/src/main/java/org/hortonmachine/gears/utils/coverage/CoverageUtilities.java | CoverageUtilities.renderedImage2IntegerArray | public static int[] renderedImage2IntegerArray( RenderedImage renderedImage, double multiply ) {
int width = renderedImage.getWidth();
int height = renderedImage.getHeight();
int[] values = new int[width * height];
RandomIter imageIter = RandomIterFactory.create(renderedImage, null);
... | java | public static int[] renderedImage2IntegerArray( RenderedImage renderedImage, double multiply ) {
int width = renderedImage.getWidth();
int height = renderedImage.getHeight();
int[] values = new int[width * height];
RandomIter imageIter = RandomIterFactory.create(renderedImage, null);
... | [
"public",
"static",
"int",
"[",
"]",
"renderedImage2IntegerArray",
"(",
"RenderedImage",
"renderedImage",
",",
"double",
"multiply",
")",
"{",
"int",
"width",
"=",
"renderedImage",
".",
"getWidth",
"(",
")",
";",
"int",
"height",
"=",
"renderedImage",
".",
"ge... | Transform a double values rendered image in its integer array representation by scaling the values.
@param renderedImage the rendered image to transform.
@param multiply value by which to multiply the values before casting to integer.
@return the array holding the data. | [
"Transform",
"a",
"double",
"values",
"rendered",
"image",
"in",
"its",
"integer",
"array",
"representation",
"by",
"scaling",
"the",
"values",
"."
] | d2b436bbdf951dc1fda56096a42dbc0eae4d35a5 | https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/utils/coverage/CoverageUtilities.java#L1050-L1066 | train |
TheHortonMachine/hortonmachine | gears/src/main/java/org/hortonmachine/gears/utils/coverage/CoverageUtilities.java | CoverageUtilities.renderedImage2ByteArray | public static byte[] renderedImage2ByteArray( RenderedImage renderedImage, boolean doRowsThenCols ) {
int width = renderedImage.getWidth();
int height = renderedImage.getHeight();
byte[] values = new byte[width * height];
RandomIter imageIter = RandomIterFactory.create(renderedImage, nu... | java | public static byte[] renderedImage2ByteArray( RenderedImage renderedImage, boolean doRowsThenCols ) {
int width = renderedImage.getWidth();
int height = renderedImage.getHeight();
byte[] values = new byte[width * height];
RandomIter imageIter = RandomIterFactory.create(renderedImage, nu... | [
"public",
"static",
"byte",
"[",
"]",
"renderedImage2ByteArray",
"(",
"RenderedImage",
"renderedImage",
",",
"boolean",
"doRowsThenCols",
")",
"{",
"int",
"width",
"=",
"renderedImage",
".",
"getWidth",
"(",
")",
";",
"int",
"height",
"=",
"renderedImage",
".",
... | Transform a double values rendered image in its byte array.
<p>No check is done if the double value fits in a byte.</p>
@param renderedImage the rendered image to transform.
@param doRowsThenCols if <code>true</code>, rows are processed in the outer loop.
@return the array holding the data. | [
"Transform",
"a",
"double",
"values",
"rendered",
"image",
"in",
"its",
"byte",
"array",
"."
] | d2b436bbdf951dc1fda56096a42dbc0eae4d35a5 | https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/utils/coverage/CoverageUtilities.java#L1077-L1101 | train |
TheHortonMachine/hortonmachine | gears/src/main/java/org/hortonmachine/gears/utils/coverage/CoverageUtilities.java | CoverageUtilities.setNovalueBorder | public static void setNovalueBorder( WritableRaster raster ) {
int width = raster.getWidth();
int height = raster.getHeight();
for( int c = 0; c < width; c++ ) {
raster.setSample(c, 0, 0, doubleNovalue);
raster.setSample(c, height - 1, 0, doubleNovalue);
}
... | java | public static void setNovalueBorder( WritableRaster raster ) {
int width = raster.getWidth();
int height = raster.getHeight();
for( int c = 0; c < width; c++ ) {
raster.setSample(c, 0, 0, doubleNovalue);
raster.setSample(c, height - 1, 0, doubleNovalue);
}
... | [
"public",
"static",
"void",
"setNovalueBorder",
"(",
"WritableRaster",
"raster",
")",
"{",
"int",
"width",
"=",
"raster",
".",
"getWidth",
"(",
")",
";",
"int",
"height",
"=",
"raster",
".",
"getHeight",
"(",
")",
";",
"for",
"(",
"int",
"c",
"=",
"0",... | Creates a border of novalues.
@param raster the raster to process. | [
"Creates",
"a",
"border",
"of",
"novalues",
"."
] | d2b436bbdf951dc1fda56096a42dbc0eae4d35a5 | https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/utils/coverage/CoverageUtilities.java#L1149-L1161 | train |
TheHortonMachine/hortonmachine | gears/src/main/java/org/hortonmachine/gears/utils/coverage/CoverageUtilities.java | CoverageUtilities.replaceNovalue | public static WritableRaster replaceNovalue( RenderedImage renderedImage, double newValue ) {
WritableRaster tmpWR = (WritableRaster) renderedImage.getData();
RandomIter pitTmpIterator = RandomIterFactory.create(renderedImage, null);
int height = renderedImage.getHeight();
int width = r... | java | public static WritableRaster replaceNovalue( RenderedImage renderedImage, double newValue ) {
WritableRaster tmpWR = (WritableRaster) renderedImage.getData();
RandomIter pitTmpIterator = RandomIterFactory.create(renderedImage, null);
int height = renderedImage.getHeight();
int width = r... | [
"public",
"static",
"WritableRaster",
"replaceNovalue",
"(",
"RenderedImage",
"renderedImage",
",",
"double",
"newValue",
")",
"{",
"WritableRaster",
"tmpWR",
"=",
"(",
"WritableRaster",
")",
"renderedImage",
".",
"getData",
"(",
")",
";",
"RandomIter",
"pitTmpItera... | Replace the current internal novalue with a given value.
@param renderedImage a {@link RenderedImage}.
@param newValue the value to put in instead of the novalue.
@return the rendered image with the substituted novalue. | [
"Replace",
"the",
"current",
"internal",
"novalue",
"with",
"a",
"given",
"value",
"."
] | d2b436bbdf951dc1fda56096a42dbc0eae4d35a5 | https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/utils/coverage/CoverageUtilities.java#L1256-L1271 | train |
TheHortonMachine/hortonmachine | gears/src/main/java/org/hortonmachine/gears/utils/coverage/CoverageUtilities.java | CoverageUtilities.prepareROI | public static ROI prepareROI( Geometry roi, AffineTransform mt2d ) throws Exception {
// transform the geometry to raster space so that we can use it as a ROI source
Geometry rasterSpaceGeometry = JTS.transform(roi, new AffineTransform2D(mt2d.createInverse()));
// simplify the geometry so that ... | java | public static ROI prepareROI( Geometry roi, AffineTransform mt2d ) throws Exception {
// transform the geometry to raster space so that we can use it as a ROI source
Geometry rasterSpaceGeometry = JTS.transform(roi, new AffineTransform2D(mt2d.createInverse()));
// simplify the geometry so that ... | [
"public",
"static",
"ROI",
"prepareROI",
"(",
"Geometry",
"roi",
",",
"AffineTransform",
"mt2d",
")",
"throws",
"Exception",
"{",
"// transform the geometry to raster space so that we can use it as a ROI source",
"Geometry",
"rasterSpaceGeometry",
"=",
"JTS",
".",
"transform"... | Utility method for transforming a geometry ROI into the raster space, using the provided affine transformation.
@param roi a {@link Geometry} in model space.
@param mt2d an {@link AffineTransform} that maps from raster to model space. This is already referred to the pixel corner.
@return a {@link ROI} suitable for usi... | [
"Utility",
"method",
"for",
"transforming",
"a",
"geometry",
"ROI",
"into",
"the",
"raster",
"space",
"using",
"the",
"provided",
"affine",
"transformation",
"."
] | d2b436bbdf951dc1fda56096a42dbc0eae4d35a5 | https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/utils/coverage/CoverageUtilities.java#L1281-L1291 | train |
TheHortonMachine/hortonmachine | gears/src/main/java/org/hortonmachine/gears/utils/coverage/CoverageUtilities.java | CoverageUtilities.isGrass | public static boolean isGrass( String path ) {
File file = new File(path);
File cellFolderFile = file.getParentFile();
File mapsetFile = cellFolderFile.getParentFile();
File windFile = new File(mapsetFile, "WIND");
return cellFolderFile.getName().toLowerCase().equals("cell") && w... | java | public static boolean isGrass( String path ) {
File file = new File(path);
File cellFolderFile = file.getParentFile();
File mapsetFile = cellFolderFile.getParentFile();
File windFile = new File(mapsetFile, "WIND");
return cellFolderFile.getName().toLowerCase().equals("cell") && w... | [
"public",
"static",
"boolean",
"isGrass",
"(",
"String",
"path",
")",
"{",
"File",
"file",
"=",
"new",
"File",
"(",
"path",
")",
";",
"File",
"cellFolderFile",
"=",
"file",
".",
"getParentFile",
"(",
")",
";",
"File",
"mapsetFile",
"=",
"cellFolderFile",
... | Checks if the given path is a GRASS raster file.
<p>Note that there is no check on the existence of the file.
@param path the path to check.
@return true if the file is a grass raster. | [
"Checks",
"if",
"the",
"given",
"path",
"is",
"a",
"GRASS",
"raster",
"file",
"."
] | d2b436bbdf951dc1fda56096a42dbc0eae4d35a5 | https://github.com/TheHortonMachine/hortonmachine/blob/d2b436bbdf951dc1fda56096a42dbc0eae4d35a5/gears/src/main/java/org/hortonmachine/gears/utils/coverage/CoverageUtilities.java#L1301-L1307 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.