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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
gallandarakhneorg/afc | advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/coordinate/GISCoordinates.java | GISCoordinates.WSG84_L1 | @Pure
public static Point2d WSG84_L1(double lambda, double phi) {
final Point2d ntfLambdaPhi = WSG84_NTFLamdaPhi(lambda, phi);
return NTFLambdaPhi_NTFLambert(
ntfLambdaPhi.getX(), ntfLambdaPhi.getY(),
LAMBERT_1_N,
LAMBERT_1_C,
LAMBERT_1_XS,
LAMBERT_1_YS);
} | java | @Pure
public static Point2d WSG84_L1(double lambda, double phi) {
final Point2d ntfLambdaPhi = WSG84_NTFLamdaPhi(lambda, phi);
return NTFLambdaPhi_NTFLambert(
ntfLambdaPhi.getX(), ntfLambdaPhi.getY(),
LAMBERT_1_N,
LAMBERT_1_C,
LAMBERT_1_XS,
LAMBERT_1_YS);
} | [
"@",
"Pure",
"public",
"static",
"Point2d",
"WSG84_L1",
"(",
"double",
"lambda",
",",
"double",
"phi",
")",
"{",
"final",
"Point2d",
"ntfLambdaPhi",
"=",
"WSG84_NTFLamdaPhi",
"(",
"lambda",
",",
"phi",
")",
";",
"return",
"NTFLambdaPhi_NTFLambert",
"(",
"ntfLa... | This function convert WSG84 GPS coordinate to France Lambert I coordinate.
@param lambda in degrees.
@param phi in degrees.
@return the France Lambert I coordinates. | [
"This",
"function",
"convert",
"WSG84",
"GPS",
"coordinate",
"to",
"France",
"Lambert",
"I",
"coordinate",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/coordinate/GISCoordinates.java#L1061-L1070 | train |
gallandarakhneorg/afc | advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/coordinate/GISCoordinates.java | GISCoordinates.WSG84_L2 | @Pure
public static Point2d WSG84_L2(double lambda, double phi) {
final Point2d ntfLambdaPhi = WSG84_NTFLamdaPhi(lambda, phi);
return NTFLambdaPhi_NTFLambert(
ntfLambdaPhi.getX(), ntfLambdaPhi.getY(),
LAMBERT_2_N,
LAMBERT_2_C,
LAMBERT_2_XS,
LAMBERT_2_YS);
} | java | @Pure
public static Point2d WSG84_L2(double lambda, double phi) {
final Point2d ntfLambdaPhi = WSG84_NTFLamdaPhi(lambda, phi);
return NTFLambdaPhi_NTFLambert(
ntfLambdaPhi.getX(), ntfLambdaPhi.getY(),
LAMBERT_2_N,
LAMBERT_2_C,
LAMBERT_2_XS,
LAMBERT_2_YS);
} | [
"@",
"Pure",
"public",
"static",
"Point2d",
"WSG84_L2",
"(",
"double",
"lambda",
",",
"double",
"phi",
")",
"{",
"final",
"Point2d",
"ntfLambdaPhi",
"=",
"WSG84_NTFLamdaPhi",
"(",
"lambda",
",",
"phi",
")",
";",
"return",
"NTFLambdaPhi_NTFLambert",
"(",
"ntfLa... | This function convert WSG84 GPS coordinate to France Lambert II coordinate.
@param lambda in degrees.
@param phi in degrees.
@return the France Lambert II coordinates. | [
"This",
"function",
"convert",
"WSG84",
"GPS",
"coordinate",
"to",
"France",
"Lambert",
"II",
"coordinate",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/coordinate/GISCoordinates.java#L1079-L1088 | train |
gallandarakhneorg/afc | advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/coordinate/GISCoordinates.java | GISCoordinates.WSG84_L3 | @Pure
public static Point2d WSG84_L3(double lambda, double phi) {
final Point2d ntfLambdaPhi = WSG84_NTFLamdaPhi(lambda, phi);
return NTFLambdaPhi_NTFLambert(
ntfLambdaPhi.getX(), ntfLambdaPhi.getY(),
LAMBERT_3_N,
LAMBERT_3_C,
LAMBERT_3_XS,
LAMBERT_3_YS);
} | java | @Pure
public static Point2d WSG84_L3(double lambda, double phi) {
final Point2d ntfLambdaPhi = WSG84_NTFLamdaPhi(lambda, phi);
return NTFLambdaPhi_NTFLambert(
ntfLambdaPhi.getX(), ntfLambdaPhi.getY(),
LAMBERT_3_N,
LAMBERT_3_C,
LAMBERT_3_XS,
LAMBERT_3_YS);
} | [
"@",
"Pure",
"public",
"static",
"Point2d",
"WSG84_L3",
"(",
"double",
"lambda",
",",
"double",
"phi",
")",
"{",
"final",
"Point2d",
"ntfLambdaPhi",
"=",
"WSG84_NTFLamdaPhi",
"(",
"lambda",
",",
"phi",
")",
";",
"return",
"NTFLambdaPhi_NTFLambert",
"(",
"ntfLa... | This function convert WSG84 GPS coordinate to France Lambert III coordinate.
@param lambda in degrees.
@param phi in degrees.
@return the France Lambert III coordinates. | [
"This",
"function",
"convert",
"WSG84",
"GPS",
"coordinate",
"to",
"France",
"Lambert",
"III",
"coordinate",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/coordinate/GISCoordinates.java#L1097-L1106 | train |
gallandarakhneorg/afc | advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/coordinate/GISCoordinates.java | GISCoordinates.WSG84_L4 | public static Point2d WSG84_L4(double lambda, double phi) {
final Point2d ntfLambdaPhi = WSG84_NTFLamdaPhi(lambda, phi);
return NTFLambdaPhi_NTFLambert(
ntfLambdaPhi.getX(), ntfLambdaPhi.getY(),
LAMBERT_4_N,
LAMBERT_4_C,
LAMBERT_4_XS,
LAMBERT_4_YS);
} | java | public static Point2d WSG84_L4(double lambda, double phi) {
final Point2d ntfLambdaPhi = WSG84_NTFLamdaPhi(lambda, phi);
return NTFLambdaPhi_NTFLambert(
ntfLambdaPhi.getX(), ntfLambdaPhi.getY(),
LAMBERT_4_N,
LAMBERT_4_C,
LAMBERT_4_XS,
LAMBERT_4_YS);
} | [
"public",
"static",
"Point2d",
"WSG84_L4",
"(",
"double",
"lambda",
",",
"double",
"phi",
")",
"{",
"final",
"Point2d",
"ntfLambdaPhi",
"=",
"WSG84_NTFLamdaPhi",
"(",
"lambda",
",",
"phi",
")",
";",
"return",
"NTFLambdaPhi_NTFLambert",
"(",
"ntfLambdaPhi",
".",
... | This function convert WSG84 GPS coordinate to France Lambert IV coordinate.
@param lambda in degrees.
@param phi in degrees.
@return the France Lambert IV coordinates. | [
"This",
"function",
"convert",
"WSG84",
"GPS",
"coordinate",
"to",
"France",
"Lambert",
"IV",
"coordinate",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/coordinate/GISCoordinates.java#L1115-L1123 | train |
gallandarakhneorg/afc | advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/coordinate/GISCoordinates.java | GISCoordinates.WSG84_L93 | @Pure
public static Point2d WSG84_L93(double lambda, double phi) {
final Point2d ntfLambdaPhi = WSG84_NTFLamdaPhi(lambda, phi);
return NTFLambdaPhi_NTFLambert(
ntfLambdaPhi.getX(), ntfLambdaPhi.getY(),
LAMBERT_93_N,
LAMBERT_93_C,
LAMBERT_93_XS,
LAMBERT_93_YS);
} | java | @Pure
public static Point2d WSG84_L93(double lambda, double phi) {
final Point2d ntfLambdaPhi = WSG84_NTFLamdaPhi(lambda, phi);
return NTFLambdaPhi_NTFLambert(
ntfLambdaPhi.getX(), ntfLambdaPhi.getY(),
LAMBERT_93_N,
LAMBERT_93_C,
LAMBERT_93_XS,
LAMBERT_93_YS);
} | [
"@",
"Pure",
"public",
"static",
"Point2d",
"WSG84_L93",
"(",
"double",
"lambda",
",",
"double",
"phi",
")",
"{",
"final",
"Point2d",
"ntfLambdaPhi",
"=",
"WSG84_NTFLamdaPhi",
"(",
"lambda",
",",
"phi",
")",
";",
"return",
"NTFLambdaPhi_NTFLambert",
"(",
"ntfL... | This function convert WSG84 GPS coordinate to France Lambert 93 coordinate.
@param lambda in degrees.
@param phi in degrees.
@return the France Lambert 93 coordinates. | [
"This",
"function",
"convert",
"WSG84",
"GPS",
"coordinate",
"to",
"France",
"Lambert",
"93",
"coordinate",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/coordinate/GISCoordinates.java#L1132-L1141 | train |
gallandarakhneorg/afc | advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/coordinate/GISCoordinates.java | GISCoordinates.NTFLambdaPhi_NTFLambert | @SuppressWarnings({"checkstyle:parametername", "checkstyle:magicnumber",
"checkstyle:localfinalvariablename", "checkstyle:localvariablename"})
private static Point2d NTFLambdaPhi_NTFLambert(double lambda, double phi, double n, double c, double Xs, double Ys) {
//---------------------------------------------------------
// 3) cartesian coordinate NTF (X_n,Y_n,Z_n)
// -> geographical coordinate NTF (phi_n,lambda_n)
// One formula is given by the IGN, and two constants about
// the ellipsoide are from the NTF system specification of Clarke 1880.
// Ref:
// http://www.ign.fr/telechargement/MPro/geodesie/CIRCE/NTG_80.pdf
// http://support.esrifrance.fr/Documents/Generalites/Projections/Generalites/Generalites.htm#2
final double a_n = 6378249.2;
final double b_n = 6356515.0;
// then
final double e2_n = (a_n * a_n - b_n * b_n) / (a_n * a_n);
//---------------------------------------------------------
// 4) Geographical coordinate NTF (phi_n,lambda_n)
// -> Extended Lambert II coordinate (X_l2e, Y_l2e)
// Formula are given by the IGN from another specification
// Ref:
// http://www.ign.fr/telechargement/MPro/geodesie/CIRCE/NTG_71.pdf
final double e_n = Math.sqrt(e2_n);
// Let the longitude in radians of Paris (2°20'14.025" E) from the Greenwich meridian
final double lambda0 = 0.04079234433198;
// Compute the isometric latitude
final double L = Math.log(Math.tan(Math.PI / 4. + phi / 2.)
* Math.pow((1. - e_n * Math.sin(phi)) / (1. + e_n * Math.sin(phi)),
e_n / 2.));
// Then do the projection according to extended Lambert II
final double X_l2e = Xs + c * Math.exp(-n * L) * Math.sin(n * (lambda - lambda0));
final double Y_l2e = Ys - c * Math.exp(-n * L) * Math.cos(n * (lambda - lambda0));
return new Point2d(X_l2e, Y_l2e);
} | java | @SuppressWarnings({"checkstyle:parametername", "checkstyle:magicnumber",
"checkstyle:localfinalvariablename", "checkstyle:localvariablename"})
private static Point2d NTFLambdaPhi_NTFLambert(double lambda, double phi, double n, double c, double Xs, double Ys) {
//---------------------------------------------------------
// 3) cartesian coordinate NTF (X_n,Y_n,Z_n)
// -> geographical coordinate NTF (phi_n,lambda_n)
// One formula is given by the IGN, and two constants about
// the ellipsoide are from the NTF system specification of Clarke 1880.
// Ref:
// http://www.ign.fr/telechargement/MPro/geodesie/CIRCE/NTG_80.pdf
// http://support.esrifrance.fr/Documents/Generalites/Projections/Generalites/Generalites.htm#2
final double a_n = 6378249.2;
final double b_n = 6356515.0;
// then
final double e2_n = (a_n * a_n - b_n * b_n) / (a_n * a_n);
//---------------------------------------------------------
// 4) Geographical coordinate NTF (phi_n,lambda_n)
// -> Extended Lambert II coordinate (X_l2e, Y_l2e)
// Formula are given by the IGN from another specification
// Ref:
// http://www.ign.fr/telechargement/MPro/geodesie/CIRCE/NTG_71.pdf
final double e_n = Math.sqrt(e2_n);
// Let the longitude in radians of Paris (2°20'14.025" E) from the Greenwich meridian
final double lambda0 = 0.04079234433198;
// Compute the isometric latitude
final double L = Math.log(Math.tan(Math.PI / 4. + phi / 2.)
* Math.pow((1. - e_n * Math.sin(phi)) / (1. + e_n * Math.sin(phi)),
e_n / 2.));
// Then do the projection according to extended Lambert II
final double X_l2e = Xs + c * Math.exp(-n * L) * Math.sin(n * (lambda - lambda0));
final double Y_l2e = Ys - c * Math.exp(-n * L) * Math.cos(n * (lambda - lambda0));
return new Point2d(X_l2e, Y_l2e);
} | [
"@",
"SuppressWarnings",
"(",
"{",
"\"checkstyle:parametername\"",
",",
"\"checkstyle:magicnumber\"",
",",
"\"checkstyle:localfinalvariablename\"",
",",
"\"checkstyle:localvariablename\"",
"}",
")",
"private",
"static",
"Point2d",
"NTFLambdaPhi_NTFLambert",
"(",
"double",
"lamb... | This function convert the geographical NTF Lambda-Phi
coordinate to one of the France NTF standard coordinate.
@param lambda is the NTF coordinate.
@param phi is the NTF coordinate.
@param n is the exponential of the Lambert projection.
@param c is the constant of projection.
@param Xs is the x coordinate of the origine of the Lambert projection.
@param Ys is the y coordinate of the origine of the Lambert projection.
@return the extended France Lambert II coordinates. | [
"This",
"function",
"convert",
"the",
"geographical",
"NTF",
"Lambda",
"-",
"Phi",
"coordinate",
"to",
"one",
"of",
"the",
"France",
"NTF",
"standard",
"coordinate",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/coordinate/GISCoordinates.java#L1155-L1194 | train |
gallandarakhneorg/afc | advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/coordinate/GISCoordinates.java | GISCoordinates.WSG84_NTFLamdaPhi | @SuppressWarnings({"checkstyle:parametername", "checkstyle:magicnumber",
"checkstyle:localfinalvariablename", "checkstyle:localvariablename"})
private static Point2d WSG84_NTFLamdaPhi(double lambda, double phi) {
//---------------------------------------------------------
// 0) degree -> radian
final double lambda_w = Math.toRadians(lambda);
final double phi_w = Math.toRadians(phi);
//---------------------------------------------------------
// 1) geographical coordinates WGS84 (phi_w,lambda_w)
// -> cartesian coordinate WGS84 (x_w,y_w,z_w)
// Formula from IGN are used from the official downloadable document, and
// the two constants, one for each demi-axis, are given by the WGS84 specification
// of the ellipsoide.
// Ref:
// http://www.ign.fr/telechargement/MPro/geodesie/CIRCE/NTG_80.pdf
// http://de.wikipedia.org/wiki/WGS84
final double a_w = 6378137.0;
final double b_w = 6356752.314;
// then
final double e2_w = (a_w * a_w - b_w * b_w) / (a_w * a_w);
// then let the big normal of the WGS84 ellipsoide
final double N = a_w / Math.sqrt(1. - e2_w * Math.pow(Math.sin(phi_w), 2.));
// let the WGS84 cartesian coordinates:
final double X_w = N * Math.cos(phi_w) * Math.cos(lambda_w);
final double Y_w = N * Math.cos(phi_w) * Math.sin(lambda_w);
final double Z_w = N * (1 - e2_w) * Math.sin(phi_w);
//---------------------------------------------------------
// 2) cartesian coordinate WGS84 (X_w,Y_w,Z_w)
// -> cartesian coordinate NTF (X_n,Y_n,Z_n)
// Ref: http://support.esrifrance.fr/Documents/Generalites/Projections/Generalites/Generalites.htm#2
// No convertion to be done.
final double dX = 168.0;
final double dY = 60.0;
final double dZ = -320.0;
final double X_n = X_w + dX;
final double Y_n = Y_w + dY;
final double Z_n = Z_w + dZ;
//---------------------------------------------------------
// 3) cartesian coordinate NTF (X_n,Y_n,Z_n)
// -> geographical coordinate NTF (phi_n,lambda_n)
// One formula is given by the IGN, and two constants about
// the ellipsoide are from the NTF system specification of Clarke 1880.
// Ref:
// http://www.ign.fr/telechargement/MPro/geodesie/CIRCE/NTG_80.pdf
// http://support.esrifrance.fr/Documents/Generalites/Projections/Generalites/Generalites.htm#2
final double a_n = 6378249.2;
final double b_n = 6356515.0;
// then
final double e2_n = (a_n * a_n - b_n * b_n) / (a_n * a_n);
// let the convergence epsilon
final double epsilon = 1e-10;
// Then try to converge
double p0 = Math.atan(Z_n / Math.sqrt(X_n * X_n + Y_n * Y_n) * (1 - (a_n * e2_n) / (Math.sqrt(X_n * X_n + Y_n
* Y_n + Z_n * Z_n))));
double p1 = Math.atan((Z_n / Math.sqrt(X_n * X_n + Y_n * Y_n)) / (1 - (a_n * e2_n
* Math.cos(p0)) / (Math.sqrt((X_n * X_n + Y_n * Y_n) * (1 - e2_n * Math.pow(Math.sin(p0), 2))))));
while (Math.abs(p1 - p0) >= epsilon) {
p0 = p1;
p1 = Math.atan((Z_n / Math.sqrt(X_n * X_n + Y_n * Y_n)) / (1 - (a_n * e2_n * Math.cos(p0))
/ (Math.sqrt((X_n * X_n + Y_n * Y_n) * (1 - e2_n * Math.pow(Math.sin(p0), 2))))));
}
final double phi_n = p1;
final double lambda_n = Math.atan(Y_n / X_n);
return new Point2d(lambda_n, phi_n);
} | java | @SuppressWarnings({"checkstyle:parametername", "checkstyle:magicnumber",
"checkstyle:localfinalvariablename", "checkstyle:localvariablename"})
private static Point2d WSG84_NTFLamdaPhi(double lambda, double phi) {
//---------------------------------------------------------
// 0) degree -> radian
final double lambda_w = Math.toRadians(lambda);
final double phi_w = Math.toRadians(phi);
//---------------------------------------------------------
// 1) geographical coordinates WGS84 (phi_w,lambda_w)
// -> cartesian coordinate WGS84 (x_w,y_w,z_w)
// Formula from IGN are used from the official downloadable document, and
// the two constants, one for each demi-axis, are given by the WGS84 specification
// of the ellipsoide.
// Ref:
// http://www.ign.fr/telechargement/MPro/geodesie/CIRCE/NTG_80.pdf
// http://de.wikipedia.org/wiki/WGS84
final double a_w = 6378137.0;
final double b_w = 6356752.314;
// then
final double e2_w = (a_w * a_w - b_w * b_w) / (a_w * a_w);
// then let the big normal of the WGS84 ellipsoide
final double N = a_w / Math.sqrt(1. - e2_w * Math.pow(Math.sin(phi_w), 2.));
// let the WGS84 cartesian coordinates:
final double X_w = N * Math.cos(phi_w) * Math.cos(lambda_w);
final double Y_w = N * Math.cos(phi_w) * Math.sin(lambda_w);
final double Z_w = N * (1 - e2_w) * Math.sin(phi_w);
//---------------------------------------------------------
// 2) cartesian coordinate WGS84 (X_w,Y_w,Z_w)
// -> cartesian coordinate NTF (X_n,Y_n,Z_n)
// Ref: http://support.esrifrance.fr/Documents/Generalites/Projections/Generalites/Generalites.htm#2
// No convertion to be done.
final double dX = 168.0;
final double dY = 60.0;
final double dZ = -320.0;
final double X_n = X_w + dX;
final double Y_n = Y_w + dY;
final double Z_n = Z_w + dZ;
//---------------------------------------------------------
// 3) cartesian coordinate NTF (X_n,Y_n,Z_n)
// -> geographical coordinate NTF (phi_n,lambda_n)
// One formula is given by the IGN, and two constants about
// the ellipsoide are from the NTF system specification of Clarke 1880.
// Ref:
// http://www.ign.fr/telechargement/MPro/geodesie/CIRCE/NTG_80.pdf
// http://support.esrifrance.fr/Documents/Generalites/Projections/Generalites/Generalites.htm#2
final double a_n = 6378249.2;
final double b_n = 6356515.0;
// then
final double e2_n = (a_n * a_n - b_n * b_n) / (a_n * a_n);
// let the convergence epsilon
final double epsilon = 1e-10;
// Then try to converge
double p0 = Math.atan(Z_n / Math.sqrt(X_n * X_n + Y_n * Y_n) * (1 - (a_n * e2_n) / (Math.sqrt(X_n * X_n + Y_n
* Y_n + Z_n * Z_n))));
double p1 = Math.atan((Z_n / Math.sqrt(X_n * X_n + Y_n * Y_n)) / (1 - (a_n * e2_n
* Math.cos(p0)) / (Math.sqrt((X_n * X_n + Y_n * Y_n) * (1 - e2_n * Math.pow(Math.sin(p0), 2))))));
while (Math.abs(p1 - p0) >= epsilon) {
p0 = p1;
p1 = Math.atan((Z_n / Math.sqrt(X_n * X_n + Y_n * Y_n)) / (1 - (a_n * e2_n * Math.cos(p0))
/ (Math.sqrt((X_n * X_n + Y_n * Y_n) * (1 - e2_n * Math.pow(Math.sin(p0), 2))))));
}
final double phi_n = p1;
final double lambda_n = Math.atan(Y_n / X_n);
return new Point2d(lambda_n, phi_n);
} | [
"@",
"SuppressWarnings",
"(",
"{",
"\"checkstyle:parametername\"",
",",
"\"checkstyle:magicnumber\"",
",",
"\"checkstyle:localfinalvariablename\"",
",",
"\"checkstyle:localvariablename\"",
"}",
")",
"private",
"static",
"Point2d",
"WSG84_NTFLamdaPhi",
"(",
"double",
"lambda",
... | This function convert WSG84 GPS coordinate to one of the NTF Lambda-Phi coordinate.
@param lambda is the WSG94 coordinate in decimal degrees.
@param phi is the WSG84 coordinate is decimal in degrees.
@param n is the exponential of the Lambert projection.
@param c is the constant of projection.
@param Xs is the x coordinate of the origine of the Lambert projection.
@param Ys is the y coordinate of the origine of the Lambert projection.
@return the NTF Lambda-Phi | [
"This",
"function",
"convert",
"WSG84",
"GPS",
"coordinate",
"to",
"one",
"of",
"the",
"NTF",
"Lambda",
"-",
"Phi",
"coordinate",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/coordinate/GISCoordinates.java#L1207-L1279 | train |
gallandarakhneorg/afc | advanced/mathfx/src/main/java/org/arakhne/afc/math/geometry/d1/dfx/Tuple1dfx.java | Tuple1dfx.segmentProperty | @Pure
public ObjectProperty<WeakReference<Segment1D<?, ?>>> segmentProperty() {
if (this.segment == null) {
this.segment = new SimpleObjectProperty<>(this, MathFXAttributeNames.SEGMENT);
}
return this.segment;
} | java | @Pure
public ObjectProperty<WeakReference<Segment1D<?, ?>>> segmentProperty() {
if (this.segment == null) {
this.segment = new SimpleObjectProperty<>(this, MathFXAttributeNames.SEGMENT);
}
return this.segment;
} | [
"@",
"Pure",
"public",
"ObjectProperty",
"<",
"WeakReference",
"<",
"Segment1D",
"<",
"?",
",",
"?",
">",
">",
">",
"segmentProperty",
"(",
")",
"{",
"if",
"(",
"this",
".",
"segment",
"==",
"null",
")",
"{",
"this",
".",
"segment",
"=",
"new",
"Simp... | Replies the segment property.
@return the segment property. | [
"Replies",
"the",
"segment",
"property",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/mathfx/src/main/java/org/arakhne/afc/math/geometry/d1/dfx/Tuple1dfx.java#L159-L165 | train |
gallandarakhneorg/afc | advanced/mathfx/src/main/java/org/arakhne/afc/math/geometry/d1/dfx/Tuple1dfx.java | Tuple1dfx.set | void set(ObjectProperty<WeakReference<Segment1D<?, ?>>> segment, DoubleProperty x, DoubleProperty y) {
this.segment = segment;
this.x = x;
this.y = y;
} | java | void set(ObjectProperty<WeakReference<Segment1D<?, ?>>> segment, DoubleProperty x, DoubleProperty y) {
this.segment = segment;
this.x = x;
this.y = y;
} | [
"void",
"set",
"(",
"ObjectProperty",
"<",
"WeakReference",
"<",
"Segment1D",
"<",
"?",
",",
"?",
">",
">",
">",
"segment",
",",
"DoubleProperty",
"x",
",",
"DoubleProperty",
"y",
")",
"{",
"this",
".",
"segment",
"=",
"segment",
";",
"this",
".",
"x",... | Change the x and y properties.
@param segment the new segment property.
@param x the new x property.
@param y the new y property. | [
"Change",
"the",
"x",
"and",
"y",
"properties",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/mathfx/src/main/java/org/arakhne/afc/math/geometry/d1/dfx/Tuple1dfx.java#L256-L260 | train |
gallandarakhneorg/afc | core/maths/mathgeom/tobeincluded/src/d3/continuous/AbstractSegment3F.java | AbstractSegment3F.intersectsSegmentCapsule | @Pure
public static boolean intersectsSegmentCapsule(
double sx1, double sy1, double sz1, double sx2, double sy2, double sz2,
double mx1, double my1, double mz1, double mx2, double my2, double mz2, double radius) {
double d = distanceSquaredSegmentSegment(
sx1, sy1, sz1, sx2, sy2, sz2,
mx1, my1, mz1, mx2, my2, mz2);
return d < (radius * radius);
} | java | @Pure
public static boolean intersectsSegmentCapsule(
double sx1, double sy1, double sz1, double sx2, double sy2, double sz2,
double mx1, double my1, double mz1, double mx2, double my2, double mz2, double radius) {
double d = distanceSquaredSegmentSegment(
sx1, sy1, sz1, sx2, sy2, sz2,
mx1, my1, mz1, mx2, my2, mz2);
return d < (radius * radius);
} | [
"@",
"Pure",
"public",
"static",
"boolean",
"intersectsSegmentCapsule",
"(",
"double",
"sx1",
",",
"double",
"sy1",
",",
"double",
"sz1",
",",
"double",
"sx2",
",",
"double",
"sy2",
",",
"double",
"sz2",
",",
"double",
"mx1",
",",
"double",
"my1",
",",
"... | Tests if the capsule is intersecting a segment.
@param sx1 x coordinate of the first point of the segment.
@param sy1 y coordinate of the first point of the segment.
@param sz1 z coordinate of the first point of the segment.
@param sx2 x coordinate of the second point of the segment.
@param sy2 y coordinate of the second point of the segment.
@param sz2 z coordinate of the second point of the segment.
@param mx1 x coordinate of the first point of the capsule's segment.
@param my1 y coordinate of the first point of the capsule's segment.
@param mz1 z coordinate of the first point of the capsule's segment.
@param mx2 x coordinate of the second point of the capsule's segment.
@param my2 y coordinate of the second point of the capsule's segment.
@param mz2 z coordinate of the second point of the capsule's segment.
@param radius radius of the capsule.
@return <code>true</code> if the two shapes intersect each
other; <code>false</code> otherwise.
@see "http://books.google.ca/books?id=fvA7zLEFWZgC" | [
"Tests",
"if",
"the",
"capsule",
"is",
"intersecting",
"a",
"segment",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/maths/mathgeom/tobeincluded/src/d3/continuous/AbstractSegment3F.java#L204-L212 | train |
gallandarakhneorg/afc | core/maths/mathgeom/tobeincluded/src/d3/continuous/AbstractSegment3F.java | AbstractSegment3F.intersectsLineLine | @Pure
public static boolean intersectsLineLine(
double x1, double y1, double z1,
double x2, double y2, double z2,
double x3, double y3, double z3,
double x4, double y4, double z4) {
double s = computeLineLineIntersectionFactor(x1, y1, z1, x2, y2, z2, x3, y3, z3, x4, y4, z4);
return !Double.isNaN(s);
} | java | @Pure
public static boolean intersectsLineLine(
double x1, double y1, double z1,
double x2, double y2, double z2,
double x3, double y3, double z3,
double x4, double y4, double z4) {
double s = computeLineLineIntersectionFactor(x1, y1, z1, x2, y2, z2, x3, y3, z3, x4, y4, z4);
return !Double.isNaN(s);
} | [
"@",
"Pure",
"public",
"static",
"boolean",
"intersectsLineLine",
"(",
"double",
"x1",
",",
"double",
"y1",
",",
"double",
"z1",
",",
"double",
"x2",
",",
"double",
"y2",
",",
"double",
"z2",
",",
"double",
"x3",
",",
"double",
"y3",
",",
"double",
"z3... | Replies if two lines are intersecting.
@param x1 is the first point of the first line.
@param y1 is the first point of the first line.
@param z1 is the first point of the first line.
@param x2 is the second point of the first line.
@param y2 is the second point of the first line.
@param z2 is the second point of the first line.
@param x3 is the first point of the second line.
@param y3 is the first point of the second line.
@param z3 is the first point of the second line.
@param x4 is the second point of the second line.
@param y4 is the second point of the second line.
@param z4 is the second point of the second line.
@return <code>true</code> if the two shapes are intersecting; otherwise
<code>false</code>
@see "http://mathworld.wolfram.com/Line-LineIntersection.html" | [
"Replies",
"if",
"two",
"lines",
"are",
"intersecting",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/maths/mathgeom/tobeincluded/src/d3/continuous/AbstractSegment3F.java#L517-L525 | train |
gallandarakhneorg/afc | core/maths/mathgeom/tobeincluded/src/d3/continuous/AbstractSegment3F.java | AbstractSegment3F.distanceSquaredSegmentPoint | @Pure
public static double distanceSquaredSegmentPoint(
double sx1, double sy1, double sz1, double sx2, double sy2, double sz2,
double px, double py, double pz) {
double ratio = getPointProjectionFactorOnSegmentLine(px, py, pz, sx1, sy1, sz1, sx2, sy2, sz2);
if (ratio <= 0.)
return FunctionalPoint3D.distanceSquaredPointPoint(px, py, pz, sx1, sy1, sz1);
if (ratio >= 1.)
return FunctionalPoint3D.distanceSquaredPointPoint(px, py, pz, sx2, sy2, sz2);
return FunctionalPoint3D.distanceSquaredPointPoint(
px, py, pz,
(1. - ratio) * sx1 + ratio * sx2,
(1. - ratio) * sy1 + ratio * sy2,
(1. - ratio) * sz1 + ratio * sz2);
} | java | @Pure
public static double distanceSquaredSegmentPoint(
double sx1, double sy1, double sz1, double sx2, double sy2, double sz2,
double px, double py, double pz) {
double ratio = getPointProjectionFactorOnSegmentLine(px, py, pz, sx1, sy1, sz1, sx2, sy2, sz2);
if (ratio <= 0.)
return FunctionalPoint3D.distanceSquaredPointPoint(px, py, pz, sx1, sy1, sz1);
if (ratio >= 1.)
return FunctionalPoint3D.distanceSquaredPointPoint(px, py, pz, sx2, sy2, sz2);
return FunctionalPoint3D.distanceSquaredPointPoint(
px, py, pz,
(1. - ratio) * sx1 + ratio * sx2,
(1. - ratio) * sy1 + ratio * sy2,
(1. - ratio) * sz1 + ratio * sz2);
} | [
"@",
"Pure",
"public",
"static",
"double",
"distanceSquaredSegmentPoint",
"(",
"double",
"sx1",
",",
"double",
"sy1",
",",
"double",
"sz1",
",",
"double",
"sx2",
",",
"double",
"sy2",
",",
"double",
"sz2",
",",
"double",
"px",
",",
"double",
"py",
",",
"... | Compute and replies the perpendicular squared distance from a point to a segment.
@param sx1
is the X coord of the first point of the segment
@param sy1
is the Y coord of the first point of the segment
@param sz1
is the Z coord of the first point of the segment
@param sx2
is the X coord of the second point of the segment
@param sy2
is the Y coord of the second point of the segment
@param sz2
is the Z coord of the second point of the segment
@param px
is the X coord of the point
@param py
is the Y coord of the point
@param pz
is the Z coord of the point
@return the distance | [
"Compute",
"and",
"replies",
"the",
"perpendicular",
"squared",
"distance",
"from",
"a",
"point",
"to",
"a",
"segment",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/maths/mathgeom/tobeincluded/src/d3/continuous/AbstractSegment3F.java#L800-L817 | train |
gallandarakhneorg/afc | core/maths/mathgeom/tobeincluded/src/d3/continuous/AbstractSegment3F.java | AbstractSegment3F.distanceSegmentPoint | @Pure
public static double distanceSegmentPoint(
double sx1, double sy1, double sz1, double sx2, double sy2, double sz2,
double px, double py, double pz) {
double ratio = getPointProjectionFactorOnSegmentLine(px, py, pz, sx1, sy1, sz1, sx2, sy2, sz2);
if (ratio <= 0.)
return FunctionalPoint3D.distancePointPoint(px, py, pz, sx1, sy1, sz1);
if (ratio >= 1.)
return FunctionalPoint3D.distancePointPoint(px, py, pz, sx2, sy2, sz2);
return FunctionalPoint3D.distancePointPoint(
px, py, pz,
(1. - ratio) * sx1 + ratio * sx2,
(1. - ratio) * sy1 + ratio * sy2,
(1. - ratio) * sz1 + ratio * sz2);
} | java | @Pure
public static double distanceSegmentPoint(
double sx1, double sy1, double sz1, double sx2, double sy2, double sz2,
double px, double py, double pz) {
double ratio = getPointProjectionFactorOnSegmentLine(px, py, pz, sx1, sy1, sz1, sx2, sy2, sz2);
if (ratio <= 0.)
return FunctionalPoint3D.distancePointPoint(px, py, pz, sx1, sy1, sz1);
if (ratio >= 1.)
return FunctionalPoint3D.distancePointPoint(px, py, pz, sx2, sy2, sz2);
return FunctionalPoint3D.distancePointPoint(
px, py, pz,
(1. - ratio) * sx1 + ratio * sx2,
(1. - ratio) * sy1 + ratio * sy2,
(1. - ratio) * sz1 + ratio * sz2);
} | [
"@",
"Pure",
"public",
"static",
"double",
"distanceSegmentPoint",
"(",
"double",
"sx1",
",",
"double",
"sy1",
",",
"double",
"sz1",
",",
"double",
"sx2",
",",
"double",
"sy2",
",",
"double",
"sz2",
",",
"double",
"px",
",",
"double",
"py",
",",
"double"... | Compute and replies the perpendicular distance from a point to a segment.
@param sx1
is the X coord of the first point of the segment
@param sy1
is the Y coord of the first point of the segment
@param sz1
is the Z coord of the first point of the segment
@param sx2
is the X coord of the second point of the segment
@param sy2
is the Y coord of the second point of the segment
@param sz2
is the Z coord of the second point of the segment
@param px
is the X coord of the point
@param py
is the Y coord of the point
@param pz
is the Z coord of the point
@return the distance | [
"Compute",
"and",
"replies",
"the",
"perpendicular",
"distance",
"from",
"a",
"point",
"to",
"a",
"segment",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/maths/mathgeom/tobeincluded/src/d3/continuous/AbstractSegment3F.java#L929-L946 | train |
gallandarakhneorg/afc | core/maths/mathgeom/tobeincluded/src/d3/continuous/AbstractSegment3F.java | AbstractSegment3F.getPointProjectionFactorOnSegmentLine | @Pure
public static double getPointProjectionFactorOnSegmentLine(
double px, double py, double pz,
double s1x, double s1y, double s1z,
double s2x, double s2y, double s2z) {
double dx = s2x - s1x;
double dy = s2y - s1y;
double dz = s2z - s1z;
if (dx == 0. && dy == 0. && dz == 0.)
return 0.;
return ((px - s1x) * dx + (py - s1y) * dy + (pz - s1z) * dz) / (dx * dx + dy * dy + dz * dz);
} | java | @Pure
public static double getPointProjectionFactorOnSegmentLine(
double px, double py, double pz,
double s1x, double s1y, double s1z,
double s2x, double s2y, double s2z) {
double dx = s2x - s1x;
double dy = s2y - s1y;
double dz = s2z - s1z;
if (dx == 0. && dy == 0. && dz == 0.)
return 0.;
return ((px - s1x) * dx + (py - s1y) * dy + (pz - s1z) * dz) / (dx * dx + dy * dy + dz * dz);
} | [
"@",
"Pure",
"public",
"static",
"double",
"getPointProjectionFactorOnSegmentLine",
"(",
"double",
"px",
",",
"double",
"py",
",",
"double",
"pz",
",",
"double",
"s1x",
",",
"double",
"s1y",
",",
"double",
"s1z",
",",
"double",
"s2x",
",",
"double",
"s2y",
... | Replies the projection a point on a segment.
@param px
is the coordiante of the point to project
@param py
is the coordiante of the point to project
@param pz
is the coordiante of the point to project
@param s1x
is the x-coordinate of the first line point.
@param s1y
is the y-coordinate of the first line point.
@param s1z
is the z-coordinate of the first line point.
@param s2x
is the x-coordinate of the second line point.
@param s2y
is the y-coordinate of the second line point.
@param s2z
is the z-coordinate of the second line point.
@return the projection of the specified point on the line.
If equal to {@code 0}, the projection is equal to the first segment point.
If equal to {@code 1}, the projection is equal to the second segment point.
If inside {@code ]0;1[}, the projection is between the two segment points.
If inside {@code ]-inf;0[}, the projection is outside on the side of the first segment point.
If inside {@code ]1;+inf[}, the projection is outside on the side of the second segment point. | [
"Replies",
"the",
"projection",
"a",
"point",
"on",
"a",
"segment",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/maths/mathgeom/tobeincluded/src/d3/continuous/AbstractSegment3F.java#L1015-L1028 | train |
gallandarakhneorg/afc | core/maths/mathgeom/tobeincluded/src/d3/continuous/AbstractSegment3F.java | AbstractSegment3F.distanceSegmentSegment | @Pure
public static double distanceSegmentSegment(
double ax1, double ay1, double az1, double ax2, double ay2, double az2,
double bx1, double by1, double bz1, double bx2, double by2, double bz2) {
return Math.sqrt(distanceSquaredSegmentSegment(
ax1, ay1, az1, ax2, ay2, az2,
bx1, by1, bz1, bx2, by2, bz2));
} | java | @Pure
public static double distanceSegmentSegment(
double ax1, double ay1, double az1, double ax2, double ay2, double az2,
double bx1, double by1, double bz1, double bx2, double by2, double bz2) {
return Math.sqrt(distanceSquaredSegmentSegment(
ax1, ay1, az1, ax2, ay2, az2,
bx1, by1, bz1, bx2, by2, bz2));
} | [
"@",
"Pure",
"public",
"static",
"double",
"distanceSegmentSegment",
"(",
"double",
"ax1",
",",
"double",
"ay1",
",",
"double",
"az1",
",",
"double",
"ax2",
",",
"double",
"ay2",
",",
"double",
"az2",
",",
"double",
"bx1",
",",
"double",
"by1",
",",
"dou... | Compute and replies the distance between two segments.
@param ax1
is the X coord of the first point of the first segment
@param ay1
is the Y coord of the first point of the first segment
@param az1
is the Z coord of the first point of the first segment
@param ax2
is the X coord of the second point of the first segment
@param ay2
is the Y coord of the second point of the first segment
@param az2
is the Z coord of the second point of the first segment
@param bx1
is the X coord of the first point of the second segment
@param by1
is the Y coord of the first point of the second segment
@param bz1
is the Z coord of the first point of the second segment
@param bx2
is the X coord of the second point of the second segment
@param by2
is the Y coord of the second point of the second segment
@param bz2
is the Z coord of the second point of the second segment
@return the distance | [
"Compute",
"and",
"replies",
"the",
"distance",
"between",
"two",
"segments",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/maths/mathgeom/tobeincluded/src/d3/continuous/AbstractSegment3F.java#L1060-L1067 | train |
gallandarakhneorg/afc | core/maths/mathgeom/tobeincluded/src/d3/continuous/AbstractSegment3F.java | AbstractSegment3F.distanceSquaredSegmentSegment | @Pure
public static double distanceSquaredSegmentSegment(
double ax1, double ay1, double az1, double ax2, double ay2, double az2,
double bx1, double by1, double bz1, double bx2, double by2, double bz2) {
Vector3f u = new Vector3f(ax2 - ax1, ay2 - ay1, az2 - az1);
Vector3f v = new Vector3f(bx2 - bx1, by2 - by1, bz2 - bz1);
Vector3f w = new Vector3f(ax1 - bx1, ay1 - by1, az1 - bz1);
double a = u.dot(u);
double b = u.dot(v);
double c = v.dot(v);
double d = u.dot(w);
double e = v.dot(w);
double D = a * c - b * b;
double sc, sN, tc, tN;
double sD = D;
double tD = D;
// compute the line parameters of the two closest points
if (MathUtil.isEpsilonZero(D)) {
// the lines are almost parallel
// force using point P0 on segment S1
// to prevent possible division by 0.0 later
sN = 0.;
sD = 1.;
tN = e;
tD = c;
}
else {
// get the closest points on the infinite lines
sN = b*e - c*d;
tN = a*e - b*d;
if (sN < 0.) {
// sc < 0 => the s=0 edge is visible
sN = 0.;
tN = e;
tD = c;
} else if (sN > sD) {
// sc > 1 => the s=1 edge is visible
sN = sD;
tN = e + b;
tD = c;
}
}
if (tN < 0.) {
// tc < 0 => the t=0 edge is visible
tN = 0.;
// recompute sc for this edge
if (-d < 0.)
sN = 0.;
else if (-d > a)
sN = sD;
else {
sN = -d;
sD = a;
}
}
else if (tN > tD) {
// tc > 1 => the t=1 edge is visible
tN = tD;
// recompute sc for this edge
if ((-d + b) < 0.)
sN = 0;
else if ((-d + b) > a)
sN = sD;
else {
sN = (-d + b);
sD = a;
}
}
// finally do the division to get sc and tc
sc = (MathUtil.isEpsilonZero(sN) ? 0. : sN / sD);
tc = (MathUtil.isEpsilonZero(tN) ? 0. : tN / tD);
// get the difference of the two closest points
// = S1(sc) - S2(tc)
// reuse u, v, w
u.scale(sc);
w.add(u);
v.scale(tc);
w.sub(v);
return w.lengthSquared();
} | java | @Pure
public static double distanceSquaredSegmentSegment(
double ax1, double ay1, double az1, double ax2, double ay2, double az2,
double bx1, double by1, double bz1, double bx2, double by2, double bz2) {
Vector3f u = new Vector3f(ax2 - ax1, ay2 - ay1, az2 - az1);
Vector3f v = new Vector3f(bx2 - bx1, by2 - by1, bz2 - bz1);
Vector3f w = new Vector3f(ax1 - bx1, ay1 - by1, az1 - bz1);
double a = u.dot(u);
double b = u.dot(v);
double c = v.dot(v);
double d = u.dot(w);
double e = v.dot(w);
double D = a * c - b * b;
double sc, sN, tc, tN;
double sD = D;
double tD = D;
// compute the line parameters of the two closest points
if (MathUtil.isEpsilonZero(D)) {
// the lines are almost parallel
// force using point P0 on segment S1
// to prevent possible division by 0.0 later
sN = 0.;
sD = 1.;
tN = e;
tD = c;
}
else {
// get the closest points on the infinite lines
sN = b*e - c*d;
tN = a*e - b*d;
if (sN < 0.) {
// sc < 0 => the s=0 edge is visible
sN = 0.;
tN = e;
tD = c;
} else if (sN > sD) {
// sc > 1 => the s=1 edge is visible
sN = sD;
tN = e + b;
tD = c;
}
}
if (tN < 0.) {
// tc < 0 => the t=0 edge is visible
tN = 0.;
// recompute sc for this edge
if (-d < 0.)
sN = 0.;
else if (-d > a)
sN = sD;
else {
sN = -d;
sD = a;
}
}
else if (tN > tD) {
// tc > 1 => the t=1 edge is visible
tN = tD;
// recompute sc for this edge
if ((-d + b) < 0.)
sN = 0;
else if ((-d + b) > a)
sN = sD;
else {
sN = (-d + b);
sD = a;
}
}
// finally do the division to get sc and tc
sc = (MathUtil.isEpsilonZero(sN) ? 0. : sN / sD);
tc = (MathUtil.isEpsilonZero(tN) ? 0. : tN / tD);
// get the difference of the two closest points
// = S1(sc) - S2(tc)
// reuse u, v, w
u.scale(sc);
w.add(u);
v.scale(tc);
w.sub(v);
return w.lengthSquared();
} | [
"@",
"Pure",
"public",
"static",
"double",
"distanceSquaredSegmentSegment",
"(",
"double",
"ax1",
",",
"double",
"ay1",
",",
"double",
"az1",
",",
"double",
"ax2",
",",
"double",
"ay2",
",",
"double",
"az2",
",",
"double",
"bx1",
",",
"double",
"by1",
",",... | Compute and replies the squared distance between two segments.
@param ax1
is the X coord of the first point of the first segment
@param ay1
is the Y coord of the first point of the first segment
@param az1
is the Z coord of the first point of the first segment
@param ax2
is the X coord of the second point of the first segment
@param ay2
is the Y coord of the second point of the first segment
@param az2
is the Z coord of the second point of the first segment
@param bx1
is the X coord of the first point of the second segment
@param by1
is the Y coord of the first point of the second segment
@param bz1
is the Z coord of the first point of the second segment
@param bx2
is the X coord of the second point of the second segment
@param by2
is the Y coord of the second point of the second segment
@param bz2
is the Z coord of the second point of the second segment
@return the squared distance | [
"Compute",
"and",
"replies",
"the",
"squared",
"distance",
"between",
"two",
"segments",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/maths/mathgeom/tobeincluded/src/d3/continuous/AbstractSegment3F.java#L1098-L1183 | train |
gallandarakhneorg/afc | core/maths/mathgeom/tobeincluded/src/d3/continuous/AbstractSegment3F.java | AbstractSegment3F.distanceSegment | @Pure
public double distanceSegment(Point3D point) {
return distanceSegmentPoint(
getX1(), getY1(), getZ1(),
getX2(), getY2(), getZ2(),
point.getX(), point.getY(), point.getZ());
} | java | @Pure
public double distanceSegment(Point3D point) {
return distanceSegmentPoint(
getX1(), getY1(), getZ1(),
getX2(), getY2(), getZ2(),
point.getX(), point.getY(), point.getZ());
} | [
"@",
"Pure",
"public",
"double",
"distanceSegment",
"(",
"Point3D",
"point",
")",
"{",
"return",
"distanceSegmentPoint",
"(",
"getX1",
"(",
")",
",",
"getY1",
"(",
")",
",",
"getZ1",
"(",
")",
",",
"getX2",
"(",
")",
",",
"getY2",
"(",
")",
",",
"get... | Replies the distance between this segment and the given point.
@param point
@return the distance. | [
"Replies",
"the",
"distance",
"between",
"this",
"segment",
"and",
"the",
"given",
"point",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/maths/mathgeom/tobeincluded/src/d3/continuous/AbstractSegment3F.java#L1409-L1415 | train |
gallandarakhneorg/afc | core/maths/mathgeom/tobeincluded/src/d3/continuous/AbstractSegment3F.java | AbstractSegment3F.distanceLine | @Pure
public double distanceLine(Point3D point) {
return distanceLinePoint(
getX1(), getY1(), getZ1(),
getX2(), getY2(), getZ2(),
point.getX(), point.getY(), point.getZ());
} | java | @Pure
public double distanceLine(Point3D point) {
return distanceLinePoint(
getX1(), getY1(), getZ1(),
getX2(), getY2(), getZ2(),
point.getX(), point.getY(), point.getZ());
} | [
"@",
"Pure",
"public",
"double",
"distanceLine",
"(",
"Point3D",
"point",
")",
"{",
"return",
"distanceLinePoint",
"(",
"getX1",
"(",
")",
",",
"getY1",
"(",
")",
",",
"getZ1",
"(",
")",
",",
"getX2",
"(",
")",
",",
"getY2",
"(",
")",
",",
"getZ2",
... | Replies the distance between the line of this segment and the given point.
@param point
@return the distance. | [
"Replies",
"the",
"distance",
"between",
"the",
"line",
"of",
"this",
"segment",
"and",
"the",
"given",
"point",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/maths/mathgeom/tobeincluded/src/d3/continuous/AbstractSegment3F.java#L1422-L1428 | train |
gallandarakhneorg/afc | core/maths/mathgeom/tobeincluded/src/d3/continuous/AbstractSegment3F.java | AbstractSegment3F.distanceSquaredSegment | @Pure
public double distanceSquaredSegment(Point3D point) {
return distanceSquaredSegmentPoint(
getX1(), getY1(), getZ1(),
getX2(), getY2(), getZ2(),
point.getX(), point.getY(), point.getZ());
} | java | @Pure
public double distanceSquaredSegment(Point3D point) {
return distanceSquaredSegmentPoint(
getX1(), getY1(), getZ1(),
getX2(), getY2(), getZ2(),
point.getX(), point.getY(), point.getZ());
} | [
"@",
"Pure",
"public",
"double",
"distanceSquaredSegment",
"(",
"Point3D",
"point",
")",
"{",
"return",
"distanceSquaredSegmentPoint",
"(",
"getX1",
"(",
")",
",",
"getY1",
"(",
")",
",",
"getZ1",
"(",
")",
",",
"getX2",
"(",
")",
",",
"getY2",
"(",
")",... | Replies the squared distance between this segment and the given point.
@param point
@return the squared distance. | [
"Replies",
"the",
"squared",
"distance",
"between",
"this",
"segment",
"and",
"the",
"given",
"point",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/maths/mathgeom/tobeincluded/src/d3/continuous/AbstractSegment3F.java#L1435-L1441 | train |
gallandarakhneorg/afc | core/maths/mathgeom/tobeincluded/src/d3/continuous/AbstractSegment3F.java | AbstractSegment3F.distanceSquaredLine | @Pure
public double distanceSquaredLine(Point3D point) {
return distanceSquaredLinePoint(
getX1(), getY1(), getZ1(),
getX2(), getY2(), getZ2(),
point.getX(), point.getY(), point.getZ());
} | java | @Pure
public double distanceSquaredLine(Point3D point) {
return distanceSquaredLinePoint(
getX1(), getY1(), getZ1(),
getX2(), getY2(), getZ2(),
point.getX(), point.getY(), point.getZ());
} | [
"@",
"Pure",
"public",
"double",
"distanceSquaredLine",
"(",
"Point3D",
"point",
")",
"{",
"return",
"distanceSquaredLinePoint",
"(",
"getX1",
"(",
")",
",",
"getY1",
"(",
")",
",",
"getZ1",
"(",
")",
",",
"getX2",
"(",
")",
",",
"getY2",
"(",
")",
","... | Replies the squared distance between the line of this segment and the given point.
@param point
@return the squared distance. | [
"Replies",
"the",
"squared",
"distance",
"between",
"the",
"line",
"of",
"this",
"segment",
"and",
"the",
"given",
"point",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/maths/mathgeom/tobeincluded/src/d3/continuous/AbstractSegment3F.java#L1448-L1454 | train |
gallandarakhneorg/afc | advanced/gis/gisbus/src/main/java/org/arakhne/afc/gis/bus/layer/BusNetworkLayer.java | BusNetworkLayer.onBusLineAdded | protected boolean onBusLineAdded(BusLine line, int index) {
if (this.autoUpdate.get()) {
try {
addMapLayer(index, new BusLineLayer(line, isLayerAutoUpdated()));
return true;
} catch (Throwable exception) {
//
}
}
return false;
} | java | protected boolean onBusLineAdded(BusLine line, int index) {
if (this.autoUpdate.get()) {
try {
addMapLayer(index, new BusLineLayer(line, isLayerAutoUpdated()));
return true;
} catch (Throwable exception) {
//
}
}
return false;
} | [
"protected",
"boolean",
"onBusLineAdded",
"(",
"BusLine",
"line",
",",
"int",
"index",
")",
"{",
"if",
"(",
"this",
".",
"autoUpdate",
".",
"get",
"(",
")",
")",
"{",
"try",
"{",
"addMapLayer",
"(",
"index",
",",
"new",
"BusLineLayer",
"(",
"line",
","... | Invoked when a bus line was added in the attached network.
<p>This function exists to allow be override to provide a specific behaviour
when a bus line has been added.
@param line is the new line.
@param index is the index of the bus line.
@return <code>true</code> if the events was fired, otherwise <code>false</code>. | [
"Invoked",
"when",
"a",
"bus",
"line",
"was",
"added",
"in",
"the",
"attached",
"network",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/gisbus/src/main/java/org/arakhne/afc/gis/bus/layer/BusNetworkLayer.java#L264-L274 | train |
gallandarakhneorg/afc | advanced/gis/gisbus/src/main/java/org/arakhne/afc/gis/bus/layer/BusNetworkLayer.java | BusNetworkLayer.onBusLineRemoved | protected boolean onBusLineRemoved(BusLine line, int index) {
if (this.autoUpdate.get()) {
try {
removeMapLayerAt(index);
return true;
} catch (Throwable exception) {
//
}
}
return false;
} | java | protected boolean onBusLineRemoved(BusLine line, int index) {
if (this.autoUpdate.get()) {
try {
removeMapLayerAt(index);
return true;
} catch (Throwable exception) {
//
}
}
return false;
} | [
"protected",
"boolean",
"onBusLineRemoved",
"(",
"BusLine",
"line",
",",
"int",
"index",
")",
"{",
"if",
"(",
"this",
".",
"autoUpdate",
".",
"get",
"(",
")",
")",
"{",
"try",
"{",
"removeMapLayerAt",
"(",
"index",
")",
";",
"return",
"true",
";",
"}",... | Invoked when a bus line was removed from the attached network.
<p>This function exists to allow be override to provide a specific behaviour
when a bus line has been removed.
@param line is the removed line.
@param index is the index of the bus line.
@return <code>true</code> if the events was fired, otherwise <code>false</code>. | [
"Invoked",
"when",
"a",
"bus",
"line",
"was",
"removed",
"from",
"the",
"attached",
"network",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/gisbus/src/main/java/org/arakhne/afc/gis/bus/layer/BusNetworkLayer.java#L285-L295 | train |
BBN-E/bue-common-open | common-core-open/src/main/java/com/bbn/bue/common/files/KeyValueSources.java | KeyValueSources.fromFileMap | @Nonnull
public static ImmutableKeyValueSource<Symbol, ByteSource> fromFileMap(
final Map<Symbol, File> fileMap) {
return new FileMapKeyToByteSource(fileMap);
} | java | @Nonnull
public static ImmutableKeyValueSource<Symbol, ByteSource> fromFileMap(
final Map<Symbol, File> fileMap) {
return new FileMapKeyToByteSource(fileMap);
} | [
"@",
"Nonnull",
"public",
"static",
"ImmutableKeyValueSource",
"<",
"Symbol",
",",
"ByteSource",
">",
"fromFileMap",
"(",
"final",
"Map",
"<",
"Symbol",
",",
"File",
">",
"fileMap",
")",
"{",
"return",
"new",
"FileMapKeyToByteSource",
"(",
"fileMap",
")",
";",... | Creates a new key-value source based on the contents of the specified symbol to file map. | [
"Creates",
"a",
"new",
"key",
"-",
"value",
"source",
"based",
"on",
"the",
"contents",
"of",
"the",
"specified",
"symbol",
"to",
"file",
"map",
"."
] | d618652674d647867306e2e4b987a21b7c29c015 | https://github.com/BBN-E/bue-common-open/blob/d618652674d647867306e2e4b987a21b7c29c015/common-core-open/src/main/java/com/bbn/bue/common/files/KeyValueSources.java#L35-L39 | train |
BBN-E/bue-common-open | common-core-open/src/main/java/com/bbn/bue/common/files/KeyValueSources.java | KeyValueSources.fromPalDB | @Nonnull
public static ImmutableKeyValueSource<Symbol, ByteSource> fromPalDB(final File dbFile)
throws IOException {
return PalDBKeyValueSource.fromFile(dbFile);
} | java | @Nonnull
public static ImmutableKeyValueSource<Symbol, ByteSource> fromPalDB(final File dbFile)
throws IOException {
return PalDBKeyValueSource.fromFile(dbFile);
} | [
"@",
"Nonnull",
"public",
"static",
"ImmutableKeyValueSource",
"<",
"Symbol",
",",
"ByteSource",
">",
"fromPalDB",
"(",
"final",
"File",
"dbFile",
")",
"throws",
"IOException",
"{",
"return",
"PalDBKeyValueSource",
".",
"fromFile",
"(",
"dbFile",
")",
";",
"}"
] | Creates a new key-value source based on the contents of the specified embedded database.
@param dbFile a database file created using {@link KeyValueSinks#forPalDB(File, boolean)}
@return a key-value source
@throws IOException if the database could not be opened for reading | [
"Creates",
"a",
"new",
"key",
"-",
"value",
"source",
"based",
"on",
"the",
"contents",
"of",
"the",
"specified",
"embedded",
"database",
"."
] | d618652674d647867306e2e4b987a21b7c29c015 | https://github.com/BBN-E/bue-common-open/blob/d618652674d647867306e2e4b987a21b7c29c015/common-core-open/src/main/java/com/bbn/bue/common/files/KeyValueSources.java#L48-L52 | train |
lightblueseas/swing-components | src/main/java/de/alpharogroup/swing/panels/tree/JTreePanel.java | JTreePanel.newTree | protected JTree newTree()
{
JTree tree = new JTree();
tree.setModel(newTreeModel(getModel()));
tree.setEditable(true);
tree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
tree.addMouseListener(new MouseAdapter()
{
@Override
public void mousePressed(MouseEvent e)
{
int selRow = tree.getRowForLocation(e.getX(), e.getY());
if (selRow != -1)
{
if (e.getClickCount() == 1)
{
onSingleClick(e);
}
else if (e.getClickCount() == 2)
{
onDoubleClick(e);
}
}
}
});
return tree;
} | java | protected JTree newTree()
{
JTree tree = new JTree();
tree.setModel(newTreeModel(getModel()));
tree.setEditable(true);
tree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
tree.addMouseListener(new MouseAdapter()
{
@Override
public void mousePressed(MouseEvent e)
{
int selRow = tree.getRowForLocation(e.getX(), e.getY());
if (selRow != -1)
{
if (e.getClickCount() == 1)
{
onSingleClick(e);
}
else if (e.getClickCount() == 2)
{
onDoubleClick(e);
}
}
}
});
return tree;
} | [
"protected",
"JTree",
"newTree",
"(",
")",
"{",
"JTree",
"tree",
"=",
"new",
"JTree",
"(",
")",
";",
"tree",
".",
"setModel",
"(",
"newTreeModel",
"(",
"getModel",
"(",
")",
")",
")",
";",
"tree",
".",
"setEditable",
"(",
"true",
")",
";",
"tree",
... | New tree.
@return the j tree | [
"New",
"tree",
"."
] | 4045e85cabd8f0ce985cbfff134c3c9873930c79 | https://github.com/lightblueseas/swing-components/blob/4045e85cabd8f0ce985cbfff134c3c9873930c79/src/main/java/de/alpharogroup/swing/panels/tree/JTreePanel.java#L104-L133 | train |
gallandarakhneorg/afc | core/maths/mathgeom/tobeincluded/src/d3/continuous/Path3f.java | Path3f.add | public void add(Iterator<AbstractPathElement3F> iterator) {
AbstractPathElement3F element;
while (iterator.hasNext()) {
element = iterator.next();
switch(element.type) {
case MOVE_TO:
moveTo(element.getToX(), element.getToY(), element.getToZ());
break;
case LINE_TO:
lineTo(element.getToX(), element.getToY(), element.getToZ());
break;
case QUAD_TO:
quadTo(element.getCtrlX1(), element.getCtrlY1(), element.getCtrlZ1(), element.getToX(), element.getToY(), element.getToZ());
break;
case CURVE_TO:
curveTo(element.getCtrlX1(), element.getCtrlY1(), element.getCtrlZ1(), element.getCtrlX2(), element.getCtrlY2(), element.getCtrlZ2(), element.getToX(), element.getToY(), element.getToZ());
break;
case CLOSE:
closePath();
break;
default:
}
}
} | java | public void add(Iterator<AbstractPathElement3F> iterator) {
AbstractPathElement3F element;
while (iterator.hasNext()) {
element = iterator.next();
switch(element.type) {
case MOVE_TO:
moveTo(element.getToX(), element.getToY(), element.getToZ());
break;
case LINE_TO:
lineTo(element.getToX(), element.getToY(), element.getToZ());
break;
case QUAD_TO:
quadTo(element.getCtrlX1(), element.getCtrlY1(), element.getCtrlZ1(), element.getToX(), element.getToY(), element.getToZ());
break;
case CURVE_TO:
curveTo(element.getCtrlX1(), element.getCtrlY1(), element.getCtrlZ1(), element.getCtrlX2(), element.getCtrlY2(), element.getCtrlZ2(), element.getToX(), element.getToY(), element.getToZ());
break;
case CLOSE:
closePath();
break;
default:
}
}
} | [
"public",
"void",
"add",
"(",
"Iterator",
"<",
"AbstractPathElement3F",
">",
"iterator",
")",
"{",
"AbstractPathElement3F",
"element",
";",
"while",
"(",
"iterator",
".",
"hasNext",
"(",
")",
")",
"{",
"element",
"=",
"iterator",
".",
"next",
"(",
")",
";"... | Add the elements replied by the iterator into this path.
@param iterator | [
"Add",
"the",
"elements",
"replied",
"by",
"the",
"iterator",
"into",
"this",
"path",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/maths/mathgeom/tobeincluded/src/d3/continuous/Path3f.java#L1756-L1779 | train |
gallandarakhneorg/afc | core/maths/mathgeom/tobeincluded/src/d3/continuous/Path3f.java | Path3f.length | public double length() {
if (this.isEmpty()) return 0;
double length = 0;
PathIterator3f pi = getPathIterator(MathConstants.SPLINE_APPROXIMATION_RATIO);
AbstractPathElement3F pathElement = pi.next();
if (pathElement.type != PathElementType.MOVE_TO) {
throw new IllegalArgumentException("missing initial moveto in path definition");
}
Path3f subPath;
double curx, cury, curz, movx, movy, movz, endx, endy, endz;
curx = movx = pathElement.getToX();
cury = movy = pathElement.getToY();
curz = movz = pathElement.getToZ();
while (pi.hasNext()) {
pathElement = pi.next();
switch (pathElement.type) {
case MOVE_TO:
movx = curx = pathElement.getToX();
movy = cury = pathElement.getToY();
movz = curz = pathElement.getToZ();
break;
case LINE_TO:
endx = pathElement.getToX();
endy = pathElement.getToY();
endz = pathElement.getToZ();
length += FunctionalPoint3D.distancePointPoint(
curx, cury, curz,
endx, endy, endz);
curx = endx;
cury = endy;
curz = endz;
break;
case QUAD_TO:
endx = pathElement.getToX();
endy = pathElement.getToY();
endz = pathElement.getToZ();
subPath = new Path3f();
subPath.moveTo(curx, cury, curz);
subPath.quadTo(
pathElement.getCtrlX1(), pathElement.getCtrlY1(), pathElement.getCtrlZ1(),
endx, endy, endz);
length += subPath.length();
curx = endx;
cury = endy;
curz = endz;
break;
case CURVE_TO:
endx = pathElement.getToX();
endy = pathElement.getToY();
endz = pathElement.getToZ();
subPath = new Path3f();
subPath.moveTo(curx, cury, curz);
subPath.curveTo(
pathElement.getCtrlX1(), pathElement.getCtrlY1(), pathElement.getCtrlZ1(),
pathElement.getCtrlX2(), pathElement.getCtrlY2(), pathElement.getCtrlZ2(),
endx, endy, endz);
length += subPath.length();
curx = endx;
cury = endy;
curz = endz;
break;
case CLOSE:
if (curx != movx || cury != movy || curz != movz) {
length += FunctionalPoint3D.distancePointPoint(
curx, cury, curz,
movx, movy, movz);
}
curx = movx;
cury = movy;
cury = movz;
break;
default:
}
}
return length;
} | java | public double length() {
if (this.isEmpty()) return 0;
double length = 0;
PathIterator3f pi = getPathIterator(MathConstants.SPLINE_APPROXIMATION_RATIO);
AbstractPathElement3F pathElement = pi.next();
if (pathElement.type != PathElementType.MOVE_TO) {
throw new IllegalArgumentException("missing initial moveto in path definition");
}
Path3f subPath;
double curx, cury, curz, movx, movy, movz, endx, endy, endz;
curx = movx = pathElement.getToX();
cury = movy = pathElement.getToY();
curz = movz = pathElement.getToZ();
while (pi.hasNext()) {
pathElement = pi.next();
switch (pathElement.type) {
case MOVE_TO:
movx = curx = pathElement.getToX();
movy = cury = pathElement.getToY();
movz = curz = pathElement.getToZ();
break;
case LINE_TO:
endx = pathElement.getToX();
endy = pathElement.getToY();
endz = pathElement.getToZ();
length += FunctionalPoint3D.distancePointPoint(
curx, cury, curz,
endx, endy, endz);
curx = endx;
cury = endy;
curz = endz;
break;
case QUAD_TO:
endx = pathElement.getToX();
endy = pathElement.getToY();
endz = pathElement.getToZ();
subPath = new Path3f();
subPath.moveTo(curx, cury, curz);
subPath.quadTo(
pathElement.getCtrlX1(), pathElement.getCtrlY1(), pathElement.getCtrlZ1(),
endx, endy, endz);
length += subPath.length();
curx = endx;
cury = endy;
curz = endz;
break;
case CURVE_TO:
endx = pathElement.getToX();
endy = pathElement.getToY();
endz = pathElement.getToZ();
subPath = new Path3f();
subPath.moveTo(curx, cury, curz);
subPath.curveTo(
pathElement.getCtrlX1(), pathElement.getCtrlY1(), pathElement.getCtrlZ1(),
pathElement.getCtrlX2(), pathElement.getCtrlY2(), pathElement.getCtrlZ2(),
endx, endy, endz);
length += subPath.length();
curx = endx;
cury = endy;
curz = endz;
break;
case CLOSE:
if (curx != movx || cury != movy || curz != movz) {
length += FunctionalPoint3D.distancePointPoint(
curx, cury, curz,
movx, movy, movz);
}
curx = movx;
cury = movy;
cury = movz;
break;
default:
}
}
return length;
} | [
"public",
"double",
"length",
"(",
")",
"{",
"if",
"(",
"this",
".",
"isEmpty",
"(",
")",
")",
"return",
"0",
";",
"double",
"length",
"=",
"0",
";",
"PathIterator3f",
"pi",
"=",
"getPathIterator",
"(",
"MathConstants",
".",
"SPLINE_APPROXIMATION_RATIO",
"... | FIXME TO BE IMPLEMENTED IN POLYLINE | [
"FIXME",
"TO",
"BE",
"IMPLEMENTED",
"IN",
"POLYLINE"
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/maths/mathgeom/tobeincluded/src/d3/continuous/Path3f.java#L1983-L2075 | train |
BBN-E/bue-common-open | nlp-core-open/src/main/java/com/bbn/nlp/corpora/lightERE/EREtoEDT.java | EREtoEDT.lightEREOffsetToEDTOffset | private ImmutableMap<Integer, Integer> lightEREOffsetToEDTOffset(String document) {
final ImmutableMap.Builder<Integer, Integer> offsetMap = ImmutableMap.builder();
int EDT = 0;
// lightERE treats these as one, not two (as an XML parser would)
document = document.replaceAll("\\r\\n", "\n");
for (int i = 0; i < document.length(); i++) {
final String c = document.substring(i, i + 1);
// skip <tags>
if (c.equals("<")) {
i = document.indexOf('>', i);
continue;
}
offsetMap.put(i, EDT);
EDT++;
}
return offsetMap.build();
} | java | private ImmutableMap<Integer, Integer> lightEREOffsetToEDTOffset(String document) {
final ImmutableMap.Builder<Integer, Integer> offsetMap = ImmutableMap.builder();
int EDT = 0;
// lightERE treats these as one, not two (as an XML parser would)
document = document.replaceAll("\\r\\n", "\n");
for (int i = 0; i < document.length(); i++) {
final String c = document.substring(i, i + 1);
// skip <tags>
if (c.equals("<")) {
i = document.indexOf('>', i);
continue;
}
offsetMap.put(i, EDT);
EDT++;
}
return offsetMap.build();
} | [
"private",
"ImmutableMap",
"<",
"Integer",
",",
"Integer",
">",
"lightEREOffsetToEDTOffset",
"(",
"String",
"document",
")",
"{",
"final",
"ImmutableMap",
".",
"Builder",
"<",
"Integer",
",",
"Integer",
">",
"offsetMap",
"=",
"ImmutableMap",
".",
"builder",
"(",... | lightERE offsets are indexed into the document, including text inside tags EDT offsets are
TODO use the mapping in bue-common-open | [
"lightERE",
"offsets",
"are",
"indexed",
"into",
"the",
"document",
"including",
"text",
"inside",
"tags",
"EDT",
"offsets",
"are"
] | d618652674d647867306e2e4b987a21b7c29c015 | https://github.com/BBN-E/bue-common-open/blob/d618652674d647867306e2e4b987a21b7c29c015/nlp-core-open/src/main/java/com/bbn/nlp/corpora/lightERE/EREtoEDT.java#L242-L258 | train |
lightblueseas/swing-components | src/main/java/de/alpharogroup/swing/docfilter/IntegerArrayFilter.java | IntegerArrayFilter.validate | protected boolean validate(String text)
{
try
{
String[] strings = text.split(",");
for (int i = 0; i < strings.length; i++)
{
Integer.parseInt(strings[i].trim());
}
return true;
}
catch (NumberFormatException e)
{
return false;
}
} | java | protected boolean validate(String text)
{
try
{
String[] strings = text.split(",");
for (int i = 0; i < strings.length; i++)
{
Integer.parseInt(strings[i].trim());
}
return true;
}
catch (NumberFormatException e)
{
return false;
}
} | [
"protected",
"boolean",
"validate",
"(",
"String",
"text",
")",
"{",
"try",
"{",
"String",
"[",
"]",
"strings",
"=",
"text",
".",
"split",
"(",
"\",\"",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"strings",
".",
"length",
";",
"i"... | Validate the given string that it is a int array
@param text
the text
@return true, if successful | [
"Validate",
"the",
"given",
"string",
"that",
"it",
"is",
"a",
"int",
"array"
] | 4045e85cabd8f0ce985cbfff134c3c9873930c79 | https://github.com/lightblueseas/swing-components/blob/4045e85cabd8f0ce985cbfff134c3c9873930c79/src/main/java/de/alpharogroup/swing/docfilter/IntegerArrayFilter.java#L124-L139 | train |
BBN-E/bue-common-open | scoring-open/src/main/java/com/bbn/bue/common/evaluation/EquivalenceBasedProvenancedAlignment.java | EquivalenceBasedProvenancedAlignment.getAlignedTo | private Collection<EqClassT> getAlignedTo(final Object item) {
if (rightEquivalenceClassesToProvenances.containsKey(item)
&& leftEquivalenceClassesToProvenances.containsKey(item)) {
return ImmutableList.of((EqClassT) item);
} else {
return ImmutableList.of();
}
} | java | private Collection<EqClassT> getAlignedTo(final Object item) {
if (rightEquivalenceClassesToProvenances.containsKey(item)
&& leftEquivalenceClassesToProvenances.containsKey(item)) {
return ImmutableList.of((EqClassT) item);
} else {
return ImmutableList.of();
}
} | [
"private",
"Collection",
"<",
"EqClassT",
">",
"getAlignedTo",
"(",
"final",
"Object",
"item",
")",
"{",
"if",
"(",
"rightEquivalenceClassesToProvenances",
".",
"containsKey",
"(",
"item",
")",
"&&",
"leftEquivalenceClassesToProvenances",
".",
"containsKey",
"(",
"i... | Any equivalence class is by definition aligned to itself if it is present on both the left
and the right. Otherwise, it has no alignment. | [
"Any",
"equivalence",
"class",
"is",
"by",
"definition",
"aligned",
"to",
"itself",
"if",
"it",
"is",
"present",
"on",
"both",
"the",
"left",
"and",
"the",
"right",
".",
"Otherwise",
"it",
"has",
"no",
"alignment",
"."
] | d618652674d647867306e2e4b987a21b7c29c015 | https://github.com/BBN-E/bue-common-open/blob/d618652674d647867306e2e4b987a21b7c29c015/scoring-open/src/main/java/com/bbn/bue/common/evaluation/EquivalenceBasedProvenancedAlignment.java#L104-L111 | train |
gallandarakhneorg/afc | core/util/src/main/java/org/arakhne/afc/util/ListenerCollection.java | ListenerCollection.add | public synchronized <T extends EventListener> void add(Class<T> type, T listener) {
assert listener != null;
if (this.listeners == NULL) {
// if this is the first listener added,
// initialize the lists
this.listeners = new Object[] {type, listener};
} else {
// Otherwise copy the array and add the new listener
final int i = this.listeners.length;
final Object[] tmp = new Object[i + 2];
System.arraycopy(this.listeners, 0, tmp, 0, i);
tmp[i] = type;
tmp[i + 1] = listener;
this.listeners = tmp;
}
} | java | public synchronized <T extends EventListener> void add(Class<T> type, T listener) {
assert listener != null;
if (this.listeners == NULL) {
// if this is the first listener added,
// initialize the lists
this.listeners = new Object[] {type, listener};
} else {
// Otherwise copy the array and add the new listener
final int i = this.listeners.length;
final Object[] tmp = new Object[i + 2];
System.arraycopy(this.listeners, 0, tmp, 0, i);
tmp[i] = type;
tmp[i + 1] = listener;
this.listeners = tmp;
}
} | [
"public",
"synchronized",
"<",
"T",
"extends",
"EventListener",
">",
"void",
"add",
"(",
"Class",
"<",
"T",
">",
"type",
",",
"T",
"listener",
")",
"{",
"assert",
"listener",
"!=",
"null",
";",
"if",
"(",
"this",
".",
"listeners",
"==",
"NULL",
")",
... | Adds the listener as a listener of the specified type.
@param <T> the type of the listener to be added
@param type the type of the listener to be added
@param listener the listener to be added | [
"Adds",
"the",
"listener",
"as",
"a",
"listener",
"of",
"the",
"specified",
"type",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/util/src/main/java/org/arakhne/afc/util/ListenerCollection.java#L164-L181 | train |
gallandarakhneorg/afc | core/util/src/main/java/org/arakhne/afc/util/ListenerCollection.java | ListenerCollection.remove | public synchronized <T extends EventListener> void remove(Class<T> type, T listener) {
assert listener != null;
// Is l on the list?
int index = -1;
for (int i = this.listeners.length - 2; i >= 0; i -= 2) {
if ((this.listeners[i] == type) && (this.listeners[i + 1].equals(listener))) {
index = i;
break;
}
}
// If so, remove it
if (index != -1) {
final Object[] tmp = new Object[this.listeners.length - 2];
// Copy the list up to index
System.arraycopy(this.listeners, 0, tmp, 0, index);
// Copy from two past the index, up to
// the end of tmp (which is two elements
// shorter than the old list)
if (index < tmp.length) {
System.arraycopy(this.listeners, index + 2, tmp, index,
tmp.length - index);
}
// set the listener array to the new array or null
this.listeners = (tmp.length == 0) ? NULL : tmp;
}
} | java | public synchronized <T extends EventListener> void remove(Class<T> type, T listener) {
assert listener != null;
// Is l on the list?
int index = -1;
for (int i = this.listeners.length - 2; i >= 0; i -= 2) {
if ((this.listeners[i] == type) && (this.listeners[i + 1].equals(listener))) {
index = i;
break;
}
}
// If so, remove it
if (index != -1) {
final Object[] tmp = new Object[this.listeners.length - 2];
// Copy the list up to index
System.arraycopy(this.listeners, 0, tmp, 0, index);
// Copy from two past the index, up to
// the end of tmp (which is two elements
// shorter than the old list)
if (index < tmp.length) {
System.arraycopy(this.listeners, index + 2, tmp, index,
tmp.length - index);
}
// set the listener array to the new array or null
this.listeners = (tmp.length == 0) ? NULL : tmp;
}
} | [
"public",
"synchronized",
"<",
"T",
"extends",
"EventListener",
">",
"void",
"remove",
"(",
"Class",
"<",
"T",
">",
"type",
",",
"T",
"listener",
")",
"{",
"assert",
"listener",
"!=",
"null",
";",
"// Is l on the list?",
"int",
"index",
"=",
"-",
"1",
";... | Removes the listener as a listener of the specified type.
@param <T> the type of the listener to be removed
@param type the type of the listener to be removed
@param listener the listener to be removed | [
"Removes",
"the",
"listener",
"as",
"a",
"listener",
"of",
"the",
"specified",
"type",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/util/src/main/java/org/arakhne/afc/util/ListenerCollection.java#L190-L216 | train |
gallandarakhneorg/afc | core/util/src/main/java/org/arakhne/afc/util/ListenerCollection.java | ListenerCollection.writeObject | private void writeObject(ObjectOutputStream stream) throws IOException {
final Object[] lList = this.listeners;
stream.defaultWriteObject();
// Save the non-null event listeners:
for (int i = 0; i < lList.length; i += 2) {
final Class<?> t = (Class<?>) lList[i];
final EventListener l = (EventListener) lList[i + 1];
if ((l != null) && (l instanceof Serializable)) {
stream.writeObject(t.getName());
stream.writeObject(l);
}
}
stream.writeObject(null);
} | java | private void writeObject(ObjectOutputStream stream) throws IOException {
final Object[] lList = this.listeners;
stream.defaultWriteObject();
// Save the non-null event listeners:
for (int i = 0; i < lList.length; i += 2) {
final Class<?> t = (Class<?>) lList[i];
final EventListener l = (EventListener) lList[i + 1];
if ((l != null) && (l instanceof Serializable)) {
stream.writeObject(t.getName());
stream.writeObject(l);
}
}
stream.writeObject(null);
} | [
"private",
"void",
"writeObject",
"(",
"ObjectOutputStream",
"stream",
")",
"throws",
"IOException",
"{",
"final",
"Object",
"[",
"]",
"lList",
"=",
"this",
".",
"listeners",
";",
"stream",
".",
"defaultWriteObject",
"(",
")",
";",
"// Save the non-null event list... | Serialization support.
@param stream the stream.
@throws IOException when something wrong occurs. | [
"Serialization",
"support",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/util/src/main/java/org/arakhne/afc/util/ListenerCollection.java#L223-L238 | train |
gallandarakhneorg/afc | core/maths/mathstochastic/src/main/java/org/arakhne/afc/math/stochastic/MathFunctionRange.java | MathFunctionRange.createDiscreteSet | @Pure
public static MathFunctionRange[] createDiscreteSet(double... values) {
final MathFunctionRange[] bounds = new MathFunctionRange[values.length];
for (int i = 0; i < values.length; ++i) {
bounds[i] = new MathFunctionRange(values[i]);
}
return bounds;
} | java | @Pure
public static MathFunctionRange[] createDiscreteSet(double... values) {
final MathFunctionRange[] bounds = new MathFunctionRange[values.length];
for (int i = 0; i < values.length; ++i) {
bounds[i] = new MathFunctionRange(values[i]);
}
return bounds;
} | [
"@",
"Pure",
"public",
"static",
"MathFunctionRange",
"[",
"]",
"createDiscreteSet",
"(",
"double",
"...",
"values",
")",
"{",
"final",
"MathFunctionRange",
"[",
"]",
"bounds",
"=",
"new",
"MathFunctionRange",
"[",
"values",
".",
"length",
"]",
";",
"for",
"... | Create a set of bounds that correspond to the specified discrete values.
@param values are put in there own bounds object
@return the set of bounds | [
"Create",
"a",
"set",
"of",
"bounds",
"that",
"correspond",
"to",
"the",
"specified",
"discrete",
"values",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/maths/mathstochastic/src/main/java/org/arakhne/afc/math/stochastic/MathFunctionRange.java#L85-L92 | train |
gallandarakhneorg/afc | core/maths/mathstochastic/src/main/java/org/arakhne/afc/math/stochastic/MathFunctionRange.java | MathFunctionRange.createSet | @Pure
public static MathFunctionRange[] createSet(double... values) {
final MathFunctionRange[] bounds = new MathFunctionRange[values.length / 2];
for (int i = 0, j = 0; i < values.length; i += 2, ++j) {
bounds[j] = new MathFunctionRange(values[i], values[i + 1]);
}
return bounds;
} | java | @Pure
public static MathFunctionRange[] createSet(double... values) {
final MathFunctionRange[] bounds = new MathFunctionRange[values.length / 2];
for (int i = 0, j = 0; i < values.length; i += 2, ++j) {
bounds[j] = new MathFunctionRange(values[i], values[i + 1]);
}
return bounds;
} | [
"@",
"Pure",
"public",
"static",
"MathFunctionRange",
"[",
"]",
"createSet",
"(",
"double",
"...",
"values",
")",
"{",
"final",
"MathFunctionRange",
"[",
"]",
"bounds",
"=",
"new",
"MathFunctionRange",
"[",
"values",
".",
"length",
"/",
"2",
"]",
";",
"for... | Create a set of bounds that correspond to the specified values.
<p>The first value is the minimal value of the first bounds,
the second value is the maximal value of the first bounds,
the third value is the minimal value of the second bounds,
the forth value is the maximal value of the second bounds, and so on.
@param values are put in there own bounds object
@return the set of bounds | [
"Create",
"a",
"set",
"of",
"bounds",
"that",
"correspond",
"to",
"the",
"specified",
"values",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/maths/mathstochastic/src/main/java/org/arakhne/afc/math/stochastic/MathFunctionRange.java#L104-L111 | train |
qiujuer/OkHttpPacker | okhttp/src/main/java/net/qiujuer/common/okhttp/core/HttpCore.java | HttpCore.interceptToProgressResponse | public Interceptor interceptToProgressResponse() {
return new Interceptor() {
@Override
public Response intercept(Chain chain) throws IOException {
Response response = chain.proceed(chain.request());
ResponseBody body = new ForwardResponseBody(response.body());
return response.newBuilder()
.body(body)
.build();
}
};
} | java | public Interceptor interceptToProgressResponse() {
return new Interceptor() {
@Override
public Response intercept(Chain chain) throws IOException {
Response response = chain.proceed(chain.request());
ResponseBody body = new ForwardResponseBody(response.body());
return response.newBuilder()
.body(body)
.build();
}
};
} | [
"public",
"Interceptor",
"interceptToProgressResponse",
"(",
")",
"{",
"return",
"new",
"Interceptor",
"(",
")",
"{",
"@",
"Override",
"public",
"Response",
"intercept",
"(",
"Chain",
"chain",
")",
"throws",
"IOException",
"{",
"Response",
"response",
"=",
"chai... | intercept the Response body stream progress | [
"intercept",
"the",
"Response",
"body",
"stream",
"progress"
] | d2d484facb66b7e11e6cbbfeb78025f76ce25ebd | https://github.com/qiujuer/OkHttpPacker/blob/d2d484facb66b7e11e6cbbfeb78025f76ce25ebd/okhttp/src/main/java/net/qiujuer/common/okhttp/core/HttpCore.java#L86-L97 | train |
gallandarakhneorg/afc | advanced/gis/gisroad/src/main/java/org/arakhne/afc/gis/road/RoadPolyline.java | RoadPolyline.setStartPoint | void setStartPoint(StandardRoadConnection desiredConnection) {
final StandardRoadConnection oldPoint = getBeginPoint(StandardRoadConnection.class);
if (oldPoint != null) {
oldPoint.removeConnectedSegment(this, true);
}
this.firstConnection = desiredConnection;
if (desiredConnection != null) {
final Point2d pts = desiredConnection.getPoint();
if (pts != null) {
setPointAt(0, pts, true);
}
desiredConnection.addConnectedSegment(this, true);
}
} | java | void setStartPoint(StandardRoadConnection desiredConnection) {
final StandardRoadConnection oldPoint = getBeginPoint(StandardRoadConnection.class);
if (oldPoint != null) {
oldPoint.removeConnectedSegment(this, true);
}
this.firstConnection = desiredConnection;
if (desiredConnection != null) {
final Point2d pts = desiredConnection.getPoint();
if (pts != null) {
setPointAt(0, pts, true);
}
desiredConnection.addConnectedSegment(this, true);
}
} | [
"void",
"setStartPoint",
"(",
"StandardRoadConnection",
"desiredConnection",
")",
"{",
"final",
"StandardRoadConnection",
"oldPoint",
"=",
"getBeginPoint",
"(",
"StandardRoadConnection",
".",
"class",
")",
";",
"if",
"(",
"oldPoint",
"!=",
"null",
")",
"{",
"oldPoin... | Move the start point of a road segment.
<p>This function forces the start point of the given
segment to correspond to the specified connection point
even if the original start point was not near the connection
point.
@param desiredConnection the connection. | [
"Move",
"the",
"start",
"point",
"of",
"a",
"road",
"segment",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/gisroad/src/main/java/org/arakhne/afc/gis/road/RoadPolyline.java#L680-L693 | train |
gallandarakhneorg/afc | advanced/gis/gisroad/src/main/java/org/arakhne/afc/gis/road/RoadPolyline.java | RoadPolyline.setEndPoint | void setEndPoint(StandardRoadConnection desiredConnection) {
final StandardRoadConnection oldPoint = getEndPoint(StandardRoadConnection.class);
if (oldPoint != null) {
oldPoint.removeConnectedSegment(this, false);
}
this.lastConnection = desiredConnection;
if (desiredConnection != null) {
final Point2d pts = desiredConnection.getPoint();
if (pts != null) {
setPointAt(-1, pts, true);
}
desiredConnection.addConnectedSegment(this, false);
}
} | java | void setEndPoint(StandardRoadConnection desiredConnection) {
final StandardRoadConnection oldPoint = getEndPoint(StandardRoadConnection.class);
if (oldPoint != null) {
oldPoint.removeConnectedSegment(this, false);
}
this.lastConnection = desiredConnection;
if (desiredConnection != null) {
final Point2d pts = desiredConnection.getPoint();
if (pts != null) {
setPointAt(-1, pts, true);
}
desiredConnection.addConnectedSegment(this, false);
}
} | [
"void",
"setEndPoint",
"(",
"StandardRoadConnection",
"desiredConnection",
")",
"{",
"final",
"StandardRoadConnection",
"oldPoint",
"=",
"getEndPoint",
"(",
"StandardRoadConnection",
".",
"class",
")",
";",
"if",
"(",
"oldPoint",
"!=",
"null",
")",
"{",
"oldPoint",
... | Move the end point of a road segment.
<p>This function forces the end point of the given
segment to correspond to the specified connection point
even if the original end point was not near the connection
point.
@param desiredConnection the connection. | [
"Move",
"the",
"end",
"point",
"of",
"a",
"road",
"segment",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/gisroad/src/main/java/org/arakhne/afc/gis/road/RoadPolyline.java#L705-L718 | train |
BBN-E/bue-common-open | common-core-open/src/main/java/com/bbn/bue/common/PartitionData.java | PartitionData.filterMapToKeysPreservingOrder | private static <K, V> ImmutableMap<K, V> filterMapToKeysPreservingOrder(
final ImmutableMap<? extends K, ? extends V> map, Iterable<? extends K> keys) {
final ImmutableMap.Builder<K, V> ret = ImmutableMap.builder();
for (final K key : keys) {
final V value = map.get(key);
checkArgument(value != null, "Key " + key + " not in map");
ret.put(key, value);
}
return ret.build();
} | java | private static <K, V> ImmutableMap<K, V> filterMapToKeysPreservingOrder(
final ImmutableMap<? extends K, ? extends V> map, Iterable<? extends K> keys) {
final ImmutableMap.Builder<K, V> ret = ImmutableMap.builder();
for (final K key : keys) {
final V value = map.get(key);
checkArgument(value != null, "Key " + key + " not in map");
ret.put(key, value);
}
return ret.build();
} | [
"private",
"static",
"<",
"K",
",",
"V",
">",
"ImmutableMap",
"<",
"K",
",",
"V",
">",
"filterMapToKeysPreservingOrder",
"(",
"final",
"ImmutableMap",
"<",
"?",
"extends",
"K",
",",
"?",
"extends",
"V",
">",
"map",
",",
"Iterable",
"<",
"?",
"extends",
... | Filters a map down to the specified keys such that the new map has the same iteration order as
the specified keys. | [
"Filters",
"a",
"map",
"down",
"to",
"the",
"specified",
"keys",
"such",
"that",
"the",
"new",
"map",
"has",
"the",
"same",
"iteration",
"order",
"as",
"the",
"specified",
"keys",
"."
] | d618652674d647867306e2e4b987a21b7c29c015 | https://github.com/BBN-E/bue-common-open/blob/d618652674d647867306e2e4b987a21b7c29c015/common-core-open/src/main/java/com/bbn/bue/common/PartitionData.java#L252-L261 | train |
lightblueseas/swing-components | src/main/java/de/alpharogroup/swing/utils/AwtExtensions.java | AwtExtensions.getRootJDialog | public static Component getRootJDialog(Component component)
{
while (null != component.getParent())
{
component = component.getParent();
if (component instanceof JDialog)
{
break;
}
}
return component;
} | java | public static Component getRootJDialog(Component component)
{
while (null != component.getParent())
{
component = component.getParent();
if (component instanceof JDialog)
{
break;
}
}
return component;
} | [
"public",
"static",
"Component",
"getRootJDialog",
"(",
"Component",
"component",
")",
"{",
"while",
"(",
"null",
"!=",
"component",
".",
"getParent",
"(",
")",
")",
"{",
"component",
"=",
"component",
".",
"getParent",
"(",
")",
";",
"if",
"(",
"component... | Gets the root JDialog from the given Component Object.
@param component
The Component to find the root JDialog.
@return 's the root JDialog. | [
"Gets",
"the",
"root",
"JDialog",
"from",
"the",
"given",
"Component",
"Object",
"."
] | 4045e85cabd8f0ce985cbfff134c3c9873930c79 | https://github.com/lightblueseas/swing-components/blob/4045e85cabd8f0ce985cbfff134c3c9873930c79/src/main/java/de/alpharogroup/swing/utils/AwtExtensions.java#L58-L69 | train |
lightblueseas/swing-components | src/main/java/de/alpharogroup/swing/utils/AwtExtensions.java | AwtExtensions.getRootJFrame | public static Component getRootJFrame(Component component)
{
while (null != component.getParent())
{
component = component.getParent();
if (component instanceof JFrame)
{
break;
}
}
return component;
} | java | public static Component getRootJFrame(Component component)
{
while (null != component.getParent())
{
component = component.getParent();
if (component instanceof JFrame)
{
break;
}
}
return component;
} | [
"public",
"static",
"Component",
"getRootJFrame",
"(",
"Component",
"component",
")",
"{",
"while",
"(",
"null",
"!=",
"component",
".",
"getParent",
"(",
")",
")",
"{",
"component",
"=",
"component",
".",
"getParent",
"(",
")",
";",
"if",
"(",
"component"... | Gets the root JFrame from the given Component Object.
@param component
The Component to find the root JFrame.
@return 's the root JFrame. | [
"Gets",
"the",
"root",
"JFrame",
"from",
"the",
"given",
"Component",
"Object",
"."
] | 4045e85cabd8f0ce985cbfff134c3c9873930c79 | https://github.com/lightblueseas/swing-components/blob/4045e85cabd8f0ce985cbfff134c3c9873930c79/src/main/java/de/alpharogroup/swing/utils/AwtExtensions.java#L78-L89 | train |
lightblueseas/swing-components | src/main/java/de/alpharogroup/swing/utils/AwtExtensions.java | AwtExtensions.getRootParent | public static Component getRootParent(Component component)
{
while (null != component.getParent())
{
component = component.getParent();
}
return component;
} | java | public static Component getRootParent(Component component)
{
while (null != component.getParent())
{
component = component.getParent();
}
return component;
} | [
"public",
"static",
"Component",
"getRootParent",
"(",
"Component",
"component",
")",
"{",
"while",
"(",
"null",
"!=",
"component",
".",
"getParent",
"(",
")",
")",
"{",
"component",
"=",
"component",
".",
"getParent",
"(",
")",
";",
"}",
"return",
"compon... | Gets the root parent from the given Component Object.
@param component
The Component to find the root parent.
@return 's the root parent. | [
"Gets",
"the",
"root",
"parent",
"from",
"the",
"given",
"Component",
"Object",
"."
] | 4045e85cabd8f0ce985cbfff134c3c9873930c79 | https://github.com/lightblueseas/swing-components/blob/4045e85cabd8f0ce985cbfff134c3c9873930c79/src/main/java/de/alpharogroup/swing/utils/AwtExtensions.java#L98-L105 | train |
lightblueseas/swing-components | src/main/java/de/alpharogroup/swing/utils/AwtExtensions.java | AwtExtensions.setIconImage | public static void setIconImage(final String resourceName, final Window window)
throws IOException
{
final InputStream isLogo = ClassExtensions.getResourceAsStream(resourceName);
final BufferedImage biLogo = ImageIO.read(isLogo);
window.setIconImage(biLogo);
} | java | public static void setIconImage(final String resourceName, final Window window)
throws IOException
{
final InputStream isLogo = ClassExtensions.getResourceAsStream(resourceName);
final BufferedImage biLogo = ImageIO.read(isLogo);
window.setIconImage(biLogo);
} | [
"public",
"static",
"void",
"setIconImage",
"(",
"final",
"String",
"resourceName",
",",
"final",
"Window",
"window",
")",
"throws",
"IOException",
"{",
"final",
"InputStream",
"isLogo",
"=",
"ClassExtensions",
".",
"getResourceAsStream",
"(",
"resourceName",
")",
... | Sets the icon image from the given resource name and add it to the given window object.
@param resourceName
The name from the resource. This includes the absolute path to the image icon from
the classpath.
@param window
the window in which to set the icon image.
@throws IOException
Signals that an I/O exception has occurred. | [
"Sets",
"the",
"icon",
"image",
"from",
"the",
"given",
"resource",
"name",
"and",
"add",
"it",
"to",
"the",
"given",
"window",
"object",
"."
] | 4045e85cabd8f0ce985cbfff134c3c9873930c79 | https://github.com/lightblueseas/swing-components/blob/4045e85cabd8f0ce985cbfff134c3c9873930c79/src/main/java/de/alpharogroup/swing/utils/AwtExtensions.java#L153-L159 | train |
gallandarakhneorg/afc | advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/mapelement/MapCircle.java | MapCircle.getDistance | @Override
@Pure
public double getDistance(Point2D<?, ?> point) {
double dist = super.getDistance(point);
dist -= this.radius;
return dist;
} | java | @Override
@Pure
public double getDistance(Point2D<?, ?> point) {
double dist = super.getDistance(point);
dist -= this.radius;
return dist;
} | [
"@",
"Override",
"@",
"Pure",
"public",
"double",
"getDistance",
"(",
"Point2D",
"<",
"?",
",",
"?",
">",
"point",
")",
"{",
"double",
"dist",
"=",
"super",
".",
"getDistance",
"(",
"point",
")",
";",
"dist",
"-=",
"this",
".",
"radius",
";",
"return... | Replies the distance between this MapCircle and
point.
@param point the point to compute the distance to.
@return the distance. Should be negative if the point is inside the circle. | [
"Replies",
"the",
"distance",
"between",
"this",
"MapCircle",
"and",
"point",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/mapelement/MapCircle.java#L309-L315 | train |
gallandarakhneorg/afc | advanced/mathfx/src/main/java/org/arakhne/afc/math/geometry/d3/dfx/Point3dfx.java | Point3dfx.convert | public static Point3dfx convert(Tuple3D<?> tuple) {
if (tuple instanceof Point3dfx) {
return (Point3dfx) tuple;
}
return new Point3dfx(tuple.getX(), tuple.getY(), tuple.getZ());
} | java | public static Point3dfx convert(Tuple3D<?> tuple) {
if (tuple instanceof Point3dfx) {
return (Point3dfx) tuple;
}
return new Point3dfx(tuple.getX(), tuple.getY(), tuple.getZ());
} | [
"public",
"static",
"Point3dfx",
"convert",
"(",
"Tuple3D",
"<",
"?",
">",
"tuple",
")",
"{",
"if",
"(",
"tuple",
"instanceof",
"Point3dfx",
")",
"{",
"return",
"(",
"Point3dfx",
")",
"tuple",
";",
"}",
"return",
"new",
"Point3dfx",
"(",
"tuple",
".",
... | Convert the given tuple to a real Point3dfx.
<p>If the given tuple is already a Point3dfx, it is replied.
@param tuple the tuple.
@return the Point3dfx.
@since 14.0 | [
"Convert",
"the",
"given",
"tuple",
"to",
"a",
"real",
"Point3dfx",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/mathfx/src/main/java/org/arakhne/afc/math/geometry/d3/dfx/Point3dfx.java#L126-L131 | train |
BBN-E/bue-common-open | nlp-core-open/src/main/java/com/bbn/nlp/corpora/ere/ERELoader.java | ERELoading.fetch | @SuppressWarnings({"TypeParameterUnusedInFormals", "unchecked"})
private <T> T fetch(final String id) {
checkNotNull(id);
checkArgument(!id.isEmpty());
final T ret = (T) idMap.get(id);
if (ret == null) {
throw new EREException(String.format("Lookup failed for id %s.", id));
}
return ret;
} | java | @SuppressWarnings({"TypeParameterUnusedInFormals", "unchecked"})
private <T> T fetch(final String id) {
checkNotNull(id);
checkArgument(!id.isEmpty());
final T ret = (T) idMap.get(id);
if (ret == null) {
throw new EREException(String.format("Lookup failed for id %s.", id));
}
return ret;
} | [
"@",
"SuppressWarnings",
"(",
"{",
"\"TypeParameterUnusedInFormals\"",
",",
"\"unchecked\"",
"}",
")",
"private",
"<",
"T",
">",
"T",
"fetch",
"(",
"final",
"String",
"id",
")",
"{",
"checkNotNull",
"(",
"id",
")",
";",
"checkArgument",
"(",
"!",
"id",
"."... | no way around unchecked cast for heterogeneous container | [
"no",
"way",
"around",
"unchecked",
"cast",
"for",
"heterogeneous",
"container"
] | d618652674d647867306e2e4b987a21b7c29c015 | https://github.com/BBN-E/bue-common-open/blob/d618652674d647867306e2e4b987a21b7c29c015/nlp-core-open/src/main/java/com/bbn/nlp/corpora/ere/ERELoader.java#L429-L438 | train |
gallandarakhneorg/afc | core/vmutils/src/main/java/org/arakhne/afc/vmutil/StringEscaper.java | StringEscaper.setSpecialChars | public void setSpecialChars(String[][] chars) {
assert chars != null : AssertMessages.notNullParameter();
this.specialChars.clear();
for (final String[] pair : chars) {
assert pair != null;
assert pair.length == 2;
assert pair[0].length() > 0;
assert pair[1].length() > 0;
this.specialChars.put(pair[0], pair[1]);
}
} | java | public void setSpecialChars(String[][] chars) {
assert chars != null : AssertMessages.notNullParameter();
this.specialChars.clear();
for (final String[] pair : chars) {
assert pair != null;
assert pair.length == 2;
assert pair[0].length() > 0;
assert pair[1].length() > 0;
this.specialChars.put(pair[0], pair[1]);
}
} | [
"public",
"void",
"setSpecialChars",
"(",
"String",
"[",
"]",
"[",
"]",
"chars",
")",
"{",
"assert",
"chars",
"!=",
"null",
":",
"AssertMessages",
".",
"notNullParameter",
"(",
")",
";",
"this",
".",
"specialChars",
".",
"clear",
"(",
")",
";",
"for",
... | Change the special characters.
<p>The given table is an array of string pairs. The first element of each pair is
the string of characters to replace. The second element of each pair is the replacement
string of characters.
@param chars the translation table. | [
"Change",
"the",
"special",
"characters",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/vmutils/src/main/java/org/arakhne/afc/vmutil/StringEscaper.java#L114-L124 | train |
gallandarakhneorg/afc | core/vmutils/src/main/java/org/arakhne/afc/vmutil/StringEscaper.java | StringEscaper.setValidCharRange | public void setValidCharRange(int minValidChar, int maxValidChar) {
if (minValidChar <= maxValidChar) {
this.minValidChar = minValidChar;
this.maxValidChar = maxValidChar;
} else {
this.maxValidChar = minValidChar;
this.minValidChar = maxValidChar;
}
} | java | public void setValidCharRange(int minValidChar, int maxValidChar) {
if (minValidChar <= maxValidChar) {
this.minValidChar = minValidChar;
this.maxValidChar = maxValidChar;
} else {
this.maxValidChar = minValidChar;
this.minValidChar = maxValidChar;
}
} | [
"public",
"void",
"setValidCharRange",
"(",
"int",
"minValidChar",
",",
"int",
"maxValidChar",
")",
"{",
"if",
"(",
"minValidChar",
"<=",
"maxValidChar",
")",
"{",
"this",
".",
"minValidChar",
"=",
"minValidChar",
";",
"this",
".",
"maxValidChar",
"=",
"maxVal... | Change the range of the valid characters that should not be escaped.
Any character outside the given range is automatically escaped.
<p>If {@code maxValidChar} is lower or equal to zero, the invalid characters
are not put within the result of the escaping.
@param minValidChar the code of the minimal valid character.
@param maxValidChar the code of the maximal valid character. | [
"Change",
"the",
"range",
"of",
"the",
"valid",
"characters",
"that",
"should",
"not",
"be",
"escaped",
".",
"Any",
"character",
"outside",
"the",
"given",
"range",
"is",
"automatically",
"escaped",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/vmutils/src/main/java/org/arakhne/afc/vmutil/StringEscaper.java#L135-L143 | train |
gallandarakhneorg/afc | core/vmutils/src/main/java/org/arakhne/afc/vmutil/StringEscaper.java | StringEscaper.escape | @SuppressWarnings("checkstyle:magicnumber")
public String escape(CharSequence text) {
final StringBuilder result = new StringBuilder();
for (int i = 0; i < text.length(); ++i) {
final char c = text.charAt(i);
final String cs = Character.toString(c);
if (this.escapeCharacters.contains(cs)) {
// Escape protected elements
result.append(this.toEscapeCharacter);
result.append(cs);
} else {
// Escape special characters
final String special = this.specialChars.get(cs);
if (special != null) {
result.append(special);
} else if (c < this.minValidChar || c > this.maxValidChar) {
if (this.maxValidChar > 0) {
// Escape invalid characters.
result.append("\\u"); //$NON-NLS-1$
result.append(formatHex(c, 4));
}
} else {
result.append(cs);
}
}
}
return result.toString();
} | java | @SuppressWarnings("checkstyle:magicnumber")
public String escape(CharSequence text) {
final StringBuilder result = new StringBuilder();
for (int i = 0; i < text.length(); ++i) {
final char c = text.charAt(i);
final String cs = Character.toString(c);
if (this.escapeCharacters.contains(cs)) {
// Escape protected elements
result.append(this.toEscapeCharacter);
result.append(cs);
} else {
// Escape special characters
final String special = this.specialChars.get(cs);
if (special != null) {
result.append(special);
} else if (c < this.minValidChar || c > this.maxValidChar) {
if (this.maxValidChar > 0) {
// Escape invalid characters.
result.append("\\u"); //$NON-NLS-1$
result.append(formatHex(c, 4));
}
} else {
result.append(cs);
}
}
}
return result.toString();
} | [
"@",
"SuppressWarnings",
"(",
"\"checkstyle:magicnumber\"",
")",
"public",
"String",
"escape",
"(",
"CharSequence",
"text",
")",
"{",
"final",
"StringBuilder",
"result",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
... | Escape the given text.
@param text is the text to convert.
@return the Java string for the text. | [
"Escape",
"the",
"given",
"text",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/vmutils/src/main/java/org/arakhne/afc/vmutil/StringEscaper.java#L150-L178 | train |
BBN-E/bue-common-open | common-core-open/src/main/java/com/bbn/bue/common/primitives/IntUtils.java | IntUtils.shuffle | public static void shuffle(final int[] arr, final Random rng) {
// Fisher-Yates shuffle
for (int i = arr.length; i > 1; i--) {
// swap i-1 and a random spot
final int a = i - 1;
final int b = rng.nextInt(i);
final int tmp = arr[b];
arr[b] = arr[a];
arr[a] = tmp;
}
} | java | public static void shuffle(final int[] arr, final Random rng) {
// Fisher-Yates shuffle
for (int i = arr.length; i > 1; i--) {
// swap i-1 and a random spot
final int a = i - 1;
final int b = rng.nextInt(i);
final int tmp = arr[b];
arr[b] = arr[a];
arr[a] = tmp;
}
} | [
"public",
"static",
"void",
"shuffle",
"(",
"final",
"int",
"[",
"]",
"arr",
",",
"final",
"Random",
"rng",
")",
"{",
"// Fisher-Yates shuffle",
"for",
"(",
"int",
"i",
"=",
"arr",
".",
"length",
";",
"i",
">",
"1",
";",
"i",
"--",
")",
"{",
"// sw... | Fisher-Yates suffer a primitive int array | [
"Fisher",
"-",
"Yates",
"suffer",
"a",
"primitive",
"int",
"array"
] | d618652674d647867306e2e4b987a21b7c29c015 | https://github.com/BBN-E/bue-common-open/blob/d618652674d647867306e2e4b987a21b7c29c015/common-core-open/src/main/java/com/bbn/bue/common/primitives/IntUtils.java#L28-L39 | train |
gallandarakhneorg/afc | advanced/gis/gisroadfx/src/main/java/org/arakhne/afc/gis/road/ui/drawers/RoadPolylineDrawer.java | RoadPolylineDrawer.setupRoadBorders | protected void setupRoadBorders(ZoomableGraphicsContext gc, RoadPolyline element) {
final Color color = gc.rgb(getDrawingColor(element));
gc.setStroke(color);
final double width;
if (element.isWidePolyline()) {
width = 2 + gc.doc2fxSize(element.getWidth());
} else {
width = 3;
}
gc.setLineWidthInPixels(width);
} | java | protected void setupRoadBorders(ZoomableGraphicsContext gc, RoadPolyline element) {
final Color color = gc.rgb(getDrawingColor(element));
gc.setStroke(color);
final double width;
if (element.isWidePolyline()) {
width = 2 + gc.doc2fxSize(element.getWidth());
} else {
width = 3;
}
gc.setLineWidthInPixels(width);
} | [
"protected",
"void",
"setupRoadBorders",
"(",
"ZoomableGraphicsContext",
"gc",
",",
"RoadPolyline",
"element",
")",
"{",
"final",
"Color",
"color",
"=",
"gc",
".",
"rgb",
"(",
"getDrawingColor",
"(",
"element",
")",
")",
";",
"gc",
".",
"setStroke",
"(",
"co... | Setup for drawing the road borders.
@param gc the graphics context.
@param element the element to draw. | [
"Setup",
"for",
"drawing",
"the",
"road",
"borders",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/gisroadfx/src/main/java/org/arakhne/afc/gis/road/ui/drawers/RoadPolylineDrawer.java#L86-L96 | train |
gallandarakhneorg/afc | advanced/gis/gisroadfx/src/main/java/org/arakhne/afc/gis/road/ui/drawers/RoadPolylineDrawer.java | RoadPolylineDrawer.setupRoadInterior | protected void setupRoadInterior(ZoomableGraphicsContext gc, RoadPolyline element) {
final Color color;
if (isSelected(element)) {
color = gc.rgb(SELECTED_ROAD_COLOR);
} else {
color = gc.rgb(ROAD_COLOR);
}
gc.setStroke(color);
if (element.isWidePolyline()) {
gc.setLineWidthInMeters(element.getWidth());
} else {
gc.setLineWidthInPixels(1);
}
} | java | protected void setupRoadInterior(ZoomableGraphicsContext gc, RoadPolyline element) {
final Color color;
if (isSelected(element)) {
color = gc.rgb(SELECTED_ROAD_COLOR);
} else {
color = gc.rgb(ROAD_COLOR);
}
gc.setStroke(color);
if (element.isWidePolyline()) {
gc.setLineWidthInMeters(element.getWidth());
} else {
gc.setLineWidthInPixels(1);
}
} | [
"protected",
"void",
"setupRoadInterior",
"(",
"ZoomableGraphicsContext",
"gc",
",",
"RoadPolyline",
"element",
")",
"{",
"final",
"Color",
"color",
";",
"if",
"(",
"isSelected",
"(",
"element",
")",
")",
"{",
"color",
"=",
"gc",
".",
"rgb",
"(",
"SELECTED_R... | Setup for drawing the road interior.
@param gc the graphics context.
@param element the element to draw. | [
"Setup",
"for",
"drawing",
"the",
"road",
"interior",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/gisroadfx/src/main/java/org/arakhne/afc/gis/road/ui/drawers/RoadPolylineDrawer.java#L103-L116 | train |
gallandarakhneorg/afc | core/vmutils/src/main/java/org/arakhne/afc/vmutil/asserts/AssertMessages.java | AssertMessages.lowerEqualParameter | @Pure
public static String lowerEqualParameter(int aindex, Object avalue, Object value) {
return msg("A11", aindex, avalue, value); //$NON-NLS-1$
} | java | @Pure
public static String lowerEqualParameter(int aindex, Object avalue, Object value) {
return msg("A11", aindex, avalue, value); //$NON-NLS-1$
} | [
"@",
"Pure",
"public",
"static",
"String",
"lowerEqualParameter",
"(",
"int",
"aindex",
",",
"Object",
"avalue",
",",
"Object",
"value",
")",
"{",
"return",
"msg",
"(",
"\"A11\"",
",",
"aindex",
",",
"avalue",
",",
"value",
")",
";",
"//$NON-NLS-1$",
"}"
] | Parameter A must be lower than or equal to the given value.
@param aindex the index of the parameter A.
@param avalue the value of the parameter A.
@param value the value.
@return the error message. | [
"Parameter",
"A",
"must",
"be",
"lower",
"than",
"or",
"equal",
"to",
"the",
"given",
"value",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/vmutils/src/main/java/org/arakhne/afc/vmutil/asserts/AssertMessages.java#L126-L129 | train |
gallandarakhneorg/afc | core/vmutils/src/main/java/org/arakhne/afc/vmutil/asserts/AssertMessages.java | AssertMessages.lowerEqualParameters | @Pure
public static String lowerEqualParameters(int aindex, Object avalue, int bindex, Object bvalue) {
return msg("A3", aindex, avalue, bindex, bvalue); //$NON-NLS-1$
} | java | @Pure
public static String lowerEqualParameters(int aindex, Object avalue, int bindex, Object bvalue) {
return msg("A3", aindex, avalue, bindex, bvalue); //$NON-NLS-1$
} | [
"@",
"Pure",
"public",
"static",
"String",
"lowerEqualParameters",
"(",
"int",
"aindex",
",",
"Object",
"avalue",
",",
"int",
"bindex",
",",
"Object",
"bvalue",
")",
"{",
"return",
"msg",
"(",
"\"A3\"",
",",
"aindex",
",",
"avalue",
",",
"bindex",
",",
"... | Parameter A must be lower than or equal to Parameter B.
@param aindex the index of the parameter A.
@param avalue the value of the parameter A.
@param bindex the index of the parameter B.
@param bvalue the value of the parameter B.
@return the error message. | [
"Parameter",
"A",
"must",
"be",
"lower",
"than",
"or",
"equal",
"to",
"Parameter",
"B",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/vmutils/src/main/java/org/arakhne/afc/vmutil/asserts/AssertMessages.java#L139-L142 | train |
gallandarakhneorg/afc | core/vmutils/src/main/java/org/arakhne/afc/vmutil/asserts/AssertMessages.java | AssertMessages.outsideRangeInclusiveParameter | @Pure
public static String outsideRangeInclusiveParameter(int parameterIndex, Object currentValue,
Object minValue, Object maxValue) {
return msg("A6", parameterIndex, currentValue, minValue, maxValue); //$NON-NLS-1$
} | java | @Pure
public static String outsideRangeInclusiveParameter(int parameterIndex, Object currentValue,
Object minValue, Object maxValue) {
return msg("A6", parameterIndex, currentValue, minValue, maxValue); //$NON-NLS-1$
} | [
"@",
"Pure",
"public",
"static",
"String",
"outsideRangeInclusiveParameter",
"(",
"int",
"parameterIndex",
",",
"Object",
"currentValue",
",",
"Object",
"minValue",
",",
"Object",
"maxValue",
")",
"{",
"return",
"msg",
"(",
"\"A6\"",
",",
"parameterIndex",
",",
... | Value is outside range.
@param parameterIndex the index of the formal parameter.
@param currentValue current value.
@param minValue minimum value in range.
@param maxValue maximum value in range.
@return the error message. | [
"Value",
"is",
"outside",
"range",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/vmutils/src/main/java/org/arakhne/afc/vmutil/asserts/AssertMessages.java#L237-L241 | train |
gallandarakhneorg/afc | core/vmutils/src/main/java/org/arakhne/afc/vmutil/asserts/AssertMessages.java | AssertMessages.outsideRangeInclusiveParameter | @Pure
@Inline(value = "AssertMessages.outsideRangeInclusiveParameter(0, $1, $2, $3)", imported = {AssertMessages.class})
public static String outsideRangeInclusiveParameter(Object currentValue,
Object minValue, Object maxValue) {
return outsideRangeInclusiveParameter(0, currentValue, minValue, maxValue);
} | java | @Pure
@Inline(value = "AssertMessages.outsideRangeInclusiveParameter(0, $1, $2, $3)", imported = {AssertMessages.class})
public static String outsideRangeInclusiveParameter(Object currentValue,
Object minValue, Object maxValue) {
return outsideRangeInclusiveParameter(0, currentValue, minValue, maxValue);
} | [
"@",
"Pure",
"@",
"Inline",
"(",
"value",
"=",
"\"AssertMessages.outsideRangeInclusiveParameter(0, $1, $2, $3)\"",
",",
"imported",
"=",
"{",
"AssertMessages",
".",
"class",
"}",
")",
"public",
"static",
"String",
"outsideRangeInclusiveParameter",
"(",
"Object",
"curren... | First parameter value is outside range.
@param currentValue current value.
@param minValue minimum value in range.
@param maxValue maximum value in range.
@return the error message. | [
"First",
"parameter",
"value",
"is",
"outside",
"range",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/vmutils/src/main/java/org/arakhne/afc/vmutil/asserts/AssertMessages.java#L250-L255 | train |
gallandarakhneorg/afc | core/vmutils/src/main/java/org/arakhne/afc/vmutil/asserts/AssertMessages.java | AssertMessages.tooSmallArrayParameter | @Pure
@Inline(value = "AssertMessages.tooSmallArrayParameter(0, $1, $2)", imported = {AssertMessages.class})
public static String tooSmallArrayParameter(int currentSize, int expectedSize) {
return tooSmallArrayParameter(0, currentSize, expectedSize);
} | java | @Pure
@Inline(value = "AssertMessages.tooSmallArrayParameter(0, $1, $2)", imported = {AssertMessages.class})
public static String tooSmallArrayParameter(int currentSize, int expectedSize) {
return tooSmallArrayParameter(0, currentSize, expectedSize);
} | [
"@",
"Pure",
"@",
"Inline",
"(",
"value",
"=",
"\"AssertMessages.tooSmallArrayParameter(0, $1, $2)\"",
",",
"imported",
"=",
"{",
"AssertMessages",
".",
"class",
"}",
")",
"public",
"static",
"String",
"tooSmallArrayParameter",
"(",
"int",
"currentSize",
",",
"int",... | Size of the first array parameter is too small.
@param currentSize current size of the array.
@param expectedSize expected size.
@return the error message. | [
"Size",
"of",
"the",
"first",
"array",
"parameter",
"is",
"too",
"small",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/vmutils/src/main/java/org/arakhne/afc/vmutil/asserts/AssertMessages.java#L303-L307 | train |
gallandarakhneorg/afc | core/vmutils/src/main/java/org/arakhne/afc/vmutil/asserts/AssertMessages.java | AssertMessages.tooSmallArrayParameter | @Pure
public static String tooSmallArrayParameter(int parameterIndex, int currentSize, int expectedSize) {
return msg("A5", parameterIndex, currentSize, expectedSize); //$NON-NLS-1$
} | java | @Pure
public static String tooSmallArrayParameter(int parameterIndex, int currentSize, int expectedSize) {
return msg("A5", parameterIndex, currentSize, expectedSize); //$NON-NLS-1$
} | [
"@",
"Pure",
"public",
"static",
"String",
"tooSmallArrayParameter",
"(",
"int",
"parameterIndex",
",",
"int",
"currentSize",
",",
"int",
"expectedSize",
")",
"{",
"return",
"msg",
"(",
"\"A5\"",
",",
"parameterIndex",
",",
"currentSize",
",",
"expectedSize",
")... | Size of the array parameter is too small.
@param parameterIndex the index of the formal parameter.
@param currentSize current size of the array.
@param expectedSize expected size.
@return the error message. | [
"Size",
"of",
"the",
"array",
"parameter",
"is",
"too",
"small",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/vmutils/src/main/java/org/arakhne/afc/vmutil/asserts/AssertMessages.java#L316-L319 | train |
gallandarakhneorg/afc | advanced/gis/gisinputoutput/src/main/java/org/arakhne/afc/gis/io/shape/GISShapeFileWriter.java | GISShapeFileWriter.toESRI | @Pure
public static ShapeElementType toESRI(Class<? extends MapElement> type) {
if (MapPolyline.class.isAssignableFrom(type)) {
return ShapeElementType.POLYLINE;
}
if (MapPolygon.class.isAssignableFrom(type)) {
return ShapeElementType.POLYGON;
}
if (MapMultiPoint.class.isAssignableFrom(type)) {
return ShapeElementType.MULTIPOINT;
}
if (MapPoint.class.isAssignableFrom(type)) {
return ShapeElementType.POINT;
}
throw new IllegalArgumentException();
} | java | @Pure
public static ShapeElementType toESRI(Class<? extends MapElement> type) {
if (MapPolyline.class.isAssignableFrom(type)) {
return ShapeElementType.POLYLINE;
}
if (MapPolygon.class.isAssignableFrom(type)) {
return ShapeElementType.POLYGON;
}
if (MapMultiPoint.class.isAssignableFrom(type)) {
return ShapeElementType.MULTIPOINT;
}
if (MapPoint.class.isAssignableFrom(type)) {
return ShapeElementType.POINT;
}
throw new IllegalArgumentException();
} | [
"@",
"Pure",
"public",
"static",
"ShapeElementType",
"toESRI",
"(",
"Class",
"<",
"?",
"extends",
"MapElement",
">",
"type",
")",
"{",
"if",
"(",
"MapPolyline",
".",
"class",
".",
"isAssignableFrom",
"(",
"type",
")",
")",
"{",
"return",
"ShapeElementType",
... | Replies the type of map element which is corresponding to the given GIS class.
@param type the type of element.
@return the type of map element.
@throws IllegalArgumentException if the given type is not supported by the I/O API.
@since 4.0 | [
"Replies",
"the",
"type",
"of",
"map",
"element",
"which",
"is",
"corresponding",
"to",
"the",
"given",
"GIS",
"class",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/gisinputoutput/src/main/java/org/arakhne/afc/gis/io/shape/GISShapeFileWriter.java#L342-L357 | train |
BBN-E/bue-common-open | scoring-open/src/main/java/com/bbn/bue/common/evaluation/Alignments.java | Alignments.splitAlignmentByKeyFunction | @SuppressWarnings("unchecked")
public static <T, V> ImmutableMap<V, Alignment<T, T>> splitAlignmentByKeyFunction(
Alignment<? extends T, ? extends T> alignment,
Function<? super T, ? extends V> keyFunction) {
// we first determine all keys we could ever encounter to ensure we can construct our map
// deterministically
// Java will complain about this cast but it is safe because ImmutableSet if covariant in its
// type parameter
final ImmutableSet<? extends V> allKeys =
FluentIterable.from((ImmutableSet<T>) alignment.allLeftItems())
.append(alignment.allRightItems())
.transform(keyFunction).toSet();
final ImmutableMap.Builder<V, MultimapAlignment.Builder<T, T>> keysToAlignmentsB =
ImmutableMap.builder();
for (final V key : allKeys) {
keysToAlignmentsB.put(key, MultimapAlignment.<T, T>builder());
}
final ImmutableMap<V, MultimapAlignment.Builder<T, T>> keysToAlignments =
keysToAlignmentsB.build();
for (final T leftItem : alignment.allLeftItems()) {
final V keyVal = keyFunction.apply(leftItem);
final MultimapAlignment.Builder<T, T> alignmentForKey = keysToAlignments.get(keyVal);
alignmentForKey.addLeftItem(leftItem);
for (T rightItem : alignment.alignedToLeftItem(leftItem)) {
if (keyFunction.apply(rightItem).equals(keyVal)) {
alignmentForKey.align(leftItem, rightItem);
}
}
}
for (final T rightItem : alignment.allRightItems()) {
final V keyVal = keyFunction.apply(rightItem);
final MultimapAlignment.Builder<T, T> alignmentForKey = keysToAlignments.get(keyVal);
alignmentForKey.addRightItem(rightItem);
for (final T leftItem : alignment.alignedToRightItem(rightItem)) {
if (keyVal.equals(keyFunction.apply(leftItem))) {
alignmentForKey.align(leftItem, rightItem);
}
}
}
final ImmutableMap.Builder<V, Alignment<T, T>> ret = ImmutableMap.builder();
for (final Map.Entry<V, MultimapAlignment.Builder<T, T>> entry : keysToAlignments.entrySet()) {
ret.put(entry.getKey(), entry.getValue().build());
}
return ret.build();
} | java | @SuppressWarnings("unchecked")
public static <T, V> ImmutableMap<V, Alignment<T, T>> splitAlignmentByKeyFunction(
Alignment<? extends T, ? extends T> alignment,
Function<? super T, ? extends V> keyFunction) {
// we first determine all keys we could ever encounter to ensure we can construct our map
// deterministically
// Java will complain about this cast but it is safe because ImmutableSet if covariant in its
// type parameter
final ImmutableSet<? extends V> allKeys =
FluentIterable.from((ImmutableSet<T>) alignment.allLeftItems())
.append(alignment.allRightItems())
.transform(keyFunction).toSet();
final ImmutableMap.Builder<V, MultimapAlignment.Builder<T, T>> keysToAlignmentsB =
ImmutableMap.builder();
for (final V key : allKeys) {
keysToAlignmentsB.put(key, MultimapAlignment.<T, T>builder());
}
final ImmutableMap<V, MultimapAlignment.Builder<T, T>> keysToAlignments =
keysToAlignmentsB.build();
for (final T leftItem : alignment.allLeftItems()) {
final V keyVal = keyFunction.apply(leftItem);
final MultimapAlignment.Builder<T, T> alignmentForKey = keysToAlignments.get(keyVal);
alignmentForKey.addLeftItem(leftItem);
for (T rightItem : alignment.alignedToLeftItem(leftItem)) {
if (keyFunction.apply(rightItem).equals(keyVal)) {
alignmentForKey.align(leftItem, rightItem);
}
}
}
for (final T rightItem : alignment.allRightItems()) {
final V keyVal = keyFunction.apply(rightItem);
final MultimapAlignment.Builder<T, T> alignmentForKey = keysToAlignments.get(keyVal);
alignmentForKey.addRightItem(rightItem);
for (final T leftItem : alignment.alignedToRightItem(rightItem)) {
if (keyVal.equals(keyFunction.apply(leftItem))) {
alignmentForKey.align(leftItem, rightItem);
}
}
}
final ImmutableMap.Builder<V, Alignment<T, T>> ret = ImmutableMap.builder();
for (final Map.Entry<V, MultimapAlignment.Builder<T, T>> entry : keysToAlignments.entrySet()) {
ret.put(entry.getKey(), entry.getValue().build());
}
return ret.build();
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"<",
"T",
",",
"V",
">",
"ImmutableMap",
"<",
"V",
",",
"Alignment",
"<",
"T",
",",
"T",
">",
">",
"splitAlignmentByKeyFunction",
"(",
"Alignment",
"<",
"?",
"extends",
"T",
",",
"?"... | Splits an alignment into many alignments based on a function mapping aligned items to some set
of keys. Returns a map where the keys are all observed outputs of the key function on items in
the alignment and the values are new alignments containing only elements which yield that
output when the key function is applied. For example, if you had an alignment of
EventMentions, you could use an "event type" key function to produce one alignment per event
type. | [
"Splits",
"an",
"alignment",
"into",
"many",
"alignments",
"based",
"on",
"a",
"function",
"mapping",
"aligned",
"items",
"to",
"some",
"set",
"of",
"keys",
".",
"Returns",
"a",
"map",
"where",
"the",
"keys",
"are",
"all",
"observed",
"outputs",
"of",
"the... | d618652674d647867306e2e4b987a21b7c29c015 | https://github.com/BBN-E/bue-common-open/blob/d618652674d647867306e2e4b987a21b7c29c015/scoring-open/src/main/java/com/bbn/bue/common/evaluation/Alignments.java#L29-L78 | train |
gallandarakhneorg/afc | core/util/src/main/java/org/arakhne/afc/progress/DefaultProgression.java | DefaultProgression.fireStateChange | protected void fireStateChange() {
if (this.listeners != null) {
final ProgressionEvent event = new ProgressionEvent(this, isRootModel());
for (final ProgressionListener listener : this.listeners.getListeners(ProgressionListener.class)) {
listener.onProgressionStateChanged(event);
}
}
} | java | protected void fireStateChange() {
if (this.listeners != null) {
final ProgressionEvent event = new ProgressionEvent(this, isRootModel());
for (final ProgressionListener listener : this.listeners.getListeners(ProgressionListener.class)) {
listener.onProgressionStateChanged(event);
}
}
} | [
"protected",
"void",
"fireStateChange",
"(",
")",
"{",
"if",
"(",
"this",
".",
"listeners",
"!=",
"null",
")",
"{",
"final",
"ProgressionEvent",
"event",
"=",
"new",
"ProgressionEvent",
"(",
"this",
",",
"isRootModel",
"(",
")",
")",
";",
"for",
"(",
"fi... | Notify listeners about state change. | [
"Notify",
"listeners",
"about",
"state",
"change",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/util/src/main/java/org/arakhne/afc/progress/DefaultProgression.java#L170-L177 | train |
gallandarakhneorg/afc | core/util/src/main/java/org/arakhne/afc/progress/DefaultProgression.java | DefaultProgression.fireValueChange | protected void fireValueChange() {
if (this.listeners != null) {
final ProgressionEvent event = new ProgressionEvent(this, isRootModel());
for (final ProgressionListener listener : this.listeners.getListeners(ProgressionListener.class)) {
listener.onProgressionValueChanged(event);
}
}
} | java | protected void fireValueChange() {
if (this.listeners != null) {
final ProgressionEvent event = new ProgressionEvent(this, isRootModel());
for (final ProgressionListener listener : this.listeners.getListeners(ProgressionListener.class)) {
listener.onProgressionValueChanged(event);
}
}
} | [
"protected",
"void",
"fireValueChange",
"(",
")",
"{",
"if",
"(",
"this",
".",
"listeners",
"!=",
"null",
")",
"{",
"final",
"ProgressionEvent",
"event",
"=",
"new",
"ProgressionEvent",
"(",
"this",
",",
"isRootModel",
"(",
")",
")",
";",
"for",
"(",
"fi... | Notify listeners about value change. | [
"Notify",
"listeners",
"about",
"value",
"change",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/util/src/main/java/org/arakhne/afc/progress/DefaultProgression.java#L181-L188 | train |
gallandarakhneorg/afc | core/util/src/main/java/org/arakhne/afc/progress/DefaultProgression.java | DefaultProgression.setValue | void setValue(SubProgressionModel subTask, double newValue, String comment) {
setProperties(newValue, this.min, this.max, this.isAdjusting,
comment == null ? this.comment : comment, true, true, false,
subTask);
} | java | void setValue(SubProgressionModel subTask, double newValue, String comment) {
setProperties(newValue, this.min, this.max, this.isAdjusting,
comment == null ? this.comment : comment, true, true, false,
subTask);
} | [
"void",
"setValue",
"(",
"SubProgressionModel",
"subTask",
",",
"double",
"newValue",
",",
"String",
"comment",
")",
"{",
"setProperties",
"(",
"newValue",
",",
"this",
".",
"min",
",",
"this",
".",
"max",
",",
"this",
".",
"isAdjusting",
",",
"comment",
"... | Set the value with a float-point precision.
This method is invoked from a subtask.
@param subTask the subtask.
@param newValue the new value.
@param comment the new comment. | [
"Set",
"the",
"value",
"with",
"a",
"float",
"-",
"point",
"precision",
".",
"This",
"method",
"is",
"invoked",
"from",
"a",
"subtask",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/util/src/main/java/org/arakhne/afc/progress/DefaultProgression.java#L342-L346 | train |
gallandarakhneorg/afc | core/util/src/main/java/org/arakhne/afc/progress/DefaultProgression.java | DefaultProgression.disconnectSubTask | void disconnectSubTask(SubProgressionModel subTask, double value, boolean overwriteComment) {
if (this.child == subTask) {
if (overwriteComment) {
final String cmt = subTask.getComment();
if (cmt != null) {
this.comment = cmt;
}
}
this.child = null;
setProperties(value, this.min, this.max, this.isAdjusting, this.comment, overwriteComment, true, false, null);
}
} | java | void disconnectSubTask(SubProgressionModel subTask, double value, boolean overwriteComment) {
if (this.child == subTask) {
if (overwriteComment) {
final String cmt = subTask.getComment();
if (cmt != null) {
this.comment = cmt;
}
}
this.child = null;
setProperties(value, this.min, this.max, this.isAdjusting, this.comment, overwriteComment, true, false, null);
}
} | [
"void",
"disconnectSubTask",
"(",
"SubProgressionModel",
"subTask",
",",
"double",
"value",
",",
"boolean",
"overwriteComment",
")",
"{",
"if",
"(",
"this",
".",
"child",
"==",
"subTask",
")",
"{",
"if",
"(",
"overwriteComment",
")",
"{",
"final",
"String",
... | Set the parent value and disconnect this subtask from its parent.
This method is invoked from a subtask.
@param subTask the subtask to disconnect.
@param value the value of the task.
@param overwriteComment indicates if the comment of this parent model may
be overwritten by the child's comment. | [
"Set",
"the",
"parent",
"value",
"and",
"disconnect",
"this",
"subtask",
"from",
"its",
"parent",
".",
"This",
"method",
"is",
"invoked",
"from",
"a",
"subtask",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/util/src/main/java/org/arakhne/afc/progress/DefaultProgression.java#L398-L409 | train |
gallandarakhneorg/afc | advanced/gis/gisbus/src/main/java/org/arakhne/afc/gis/bus/layer/BusLineLayer.java | BusLineLayer.onBusItineraryAdded | protected boolean onBusItineraryAdded(BusItinerary itinerary, int index) {
if (this.autoUpdate.get()) {
try {
addMapLayer(index, new BusItineraryLayer(itinerary, isLayerAutoUpdated()));
return true;
} catch (Throwable exception) {
//
}
}
return false;
} | java | protected boolean onBusItineraryAdded(BusItinerary itinerary, int index) {
if (this.autoUpdate.get()) {
try {
addMapLayer(index, new BusItineraryLayer(itinerary, isLayerAutoUpdated()));
return true;
} catch (Throwable exception) {
//
}
}
return false;
} | [
"protected",
"boolean",
"onBusItineraryAdded",
"(",
"BusItinerary",
"itinerary",
",",
"int",
"index",
")",
"{",
"if",
"(",
"this",
".",
"autoUpdate",
".",
"get",
"(",
")",
")",
"{",
"try",
"{",
"addMapLayer",
"(",
"index",
",",
"new",
"BusItineraryLayer",
... | Invoked when a bus itinerary was added in the attached line.
<p>This function exists to allow be override to provide a specific behaviour
when a bus itinerary has been added.
@param itinerary is the new itinerary.
@param index is the index of the bus itinerary.
@return <code>true</code> if the events was fired, otherwise <code>false</code>. | [
"Invoked",
"when",
"a",
"bus",
"itinerary",
"was",
"added",
"in",
"the",
"attached",
"line",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/gisbus/src/main/java/org/arakhne/afc/gis/bus/layer/BusLineLayer.java#L253-L263 | train |
gallandarakhneorg/afc | advanced/gis/gisbus/src/main/java/org/arakhne/afc/gis/bus/layer/BusLineLayer.java | BusLineLayer.onBusItineraryRemoved | protected boolean onBusItineraryRemoved(BusItinerary itinerary, int index) {
if (this.autoUpdate.get()) {
try {
removeMapLayerAt(index);
return true;
} catch (Throwable exception) {
//
}
}
return false;
} | java | protected boolean onBusItineraryRemoved(BusItinerary itinerary, int index) {
if (this.autoUpdate.get()) {
try {
removeMapLayerAt(index);
return true;
} catch (Throwable exception) {
//
}
}
return false;
} | [
"protected",
"boolean",
"onBusItineraryRemoved",
"(",
"BusItinerary",
"itinerary",
",",
"int",
"index",
")",
"{",
"if",
"(",
"this",
".",
"autoUpdate",
".",
"get",
"(",
")",
")",
"{",
"try",
"{",
"removeMapLayerAt",
"(",
"index",
")",
";",
"return",
"true"... | Invoked when a bus itinerary was removed from the attached line.
<p>This function exists to allow be override to provide a specific behaviour
when a bus itinerary has been removed.
@param itinerary is the removed itinerary.
@param index is the index of the bus itinerary.
@return <code>true</code> if the events was fired, otherwise <code>false</code>. | [
"Invoked",
"when",
"a",
"bus",
"itinerary",
"was",
"removed",
"from",
"the",
"attached",
"line",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/gisbus/src/main/java/org/arakhne/afc/gis/bus/layer/BusLineLayer.java#L274-L284 | train |
gallandarakhneorg/afc | advanced/gis/gisinputoutput/src/main/java/org/arakhne/afc/gis/io/shape/GISShapeFileReader.java | GISShapeFileReader.fromESRI | @Pure
@SuppressWarnings("checkstyle:cyclomaticcomplexity")
public static Class<? extends MapElement> fromESRI(ShapeElementType type) {
switch (type) {
case MULTIPOINT:
case MULTIPOINT_M:
case MULTIPOINT_Z:
return MapMultiPoint.class;
case POINT:
case POINT_M:
case POINT_Z:
return MapPoint.class;
case POLYGON:
case POLYGON_M:
case POLYGON_Z:
return MapPolygon.class;
case POLYLINE:
case POLYLINE_M:
case POLYLINE_Z:
return MapPolyline.class;
//$CASES-OMITTED$
default:
}
throw new IllegalArgumentException();
} | java | @Pure
@SuppressWarnings("checkstyle:cyclomaticcomplexity")
public static Class<? extends MapElement> fromESRI(ShapeElementType type) {
switch (type) {
case MULTIPOINT:
case MULTIPOINT_M:
case MULTIPOINT_Z:
return MapMultiPoint.class;
case POINT:
case POINT_M:
case POINT_Z:
return MapPoint.class;
case POLYGON:
case POLYGON_M:
case POLYGON_Z:
return MapPolygon.class;
case POLYLINE:
case POLYLINE_M:
case POLYLINE_Z:
return MapPolyline.class;
//$CASES-OMITTED$
default:
}
throw new IllegalArgumentException();
} | [
"@",
"Pure",
"@",
"SuppressWarnings",
"(",
"\"checkstyle:cyclomaticcomplexity\"",
")",
"public",
"static",
"Class",
"<",
"?",
"extends",
"MapElement",
">",
"fromESRI",
"(",
"ShapeElementType",
"type",
")",
"{",
"switch",
"(",
"type",
")",
"{",
"case",
"MULTIPOIN... | Replies the type of map element which is corresponding to the given ESRI type.
@param type the type of element.
@return the type of map element.
@throws IllegalArgumentException if the given type is not supported by the I/O API.
@since 4.0 | [
"Replies",
"the",
"type",
"of",
"map",
"element",
"which",
"is",
"corresponding",
"to",
"the",
"given",
"ESRI",
"type",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/gisinputoutput/src/main/java/org/arakhne/afc/gis/io/shape/GISShapeFileReader.java#L646-L670 | train |
gallandarakhneorg/afc | advanced/gis/gisinputoutput/src/main/java/org/arakhne/afc/gis/io/shape/GISShapeFileReader.java | GISShapeFileReader.getMapElementType | @Pure
public Class<? extends MapElement> getMapElementType() {
if (this.elementType != null) {
return this.elementType;
}
try {
return fromESRI(getShapeElementType());
} catch (IllegalArgumentException exception) {
//
}
return null;
} | java | @Pure
public Class<? extends MapElement> getMapElementType() {
if (this.elementType != null) {
return this.elementType;
}
try {
return fromESRI(getShapeElementType());
} catch (IllegalArgumentException exception) {
//
}
return null;
} | [
"@",
"Pure",
"public",
"Class",
"<",
"?",
"extends",
"MapElement",
">",
"getMapElementType",
"(",
")",
"{",
"if",
"(",
"this",
".",
"elementType",
"!=",
"null",
")",
"{",
"return",
"this",
".",
"elementType",
";",
"}",
"try",
"{",
"return",
"fromESRI",
... | Replies the type of map element replied by this reader.
<p>This function retrieve the element type from the header with
{@link #getShapeElementType()} and matches it to the GIS API
with {@link #fromESRI(ShapeElementType)}.
@return the type of map element; or <code>null</code> if unsupported.
@since 4.0 | [
"Replies",
"the",
"type",
"of",
"map",
"element",
"replied",
"by",
"this",
"reader",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/gisinputoutput/src/main/java/org/arakhne/afc/gis/io/shape/GISShapeFileReader.java#L682-L693 | train |
gallandarakhneorg/afc | advanced/gis/gisinputoutput/src/main/java/org/arakhne/afc/gis/io/shape/GISShapeFileReader.java | GISShapeFileReader.extractUUID | protected static UUID extractUUID(AttributeProvider provider) {
AttributeValue value;
value = provider.getAttribute(UUID_ATTR);
if (value != null) {
try {
return value.getUUID();
} catch (InvalidAttributeTypeException e) {
//
} catch (AttributeNotInitializedException e) {
//
}
}
value = provider.getAttribute(ID_ATTR);
if (value != null) {
try {
return value.getUUID();
} catch (InvalidAttributeTypeException e) {
//
} catch (AttributeNotInitializedException e) {
//
}
}
return null;
} | java | protected static UUID extractUUID(AttributeProvider provider) {
AttributeValue value;
value = provider.getAttribute(UUID_ATTR);
if (value != null) {
try {
return value.getUUID();
} catch (InvalidAttributeTypeException e) {
//
} catch (AttributeNotInitializedException e) {
//
}
}
value = provider.getAttribute(ID_ATTR);
if (value != null) {
try {
return value.getUUID();
} catch (InvalidAttributeTypeException e) {
//
} catch (AttributeNotInitializedException e) {
//
}
}
return null;
} | [
"protected",
"static",
"UUID",
"extractUUID",
"(",
"AttributeProvider",
"provider",
")",
"{",
"AttributeValue",
"value",
";",
"value",
"=",
"provider",
".",
"getAttribute",
"(",
"UUID_ATTR",
")",
";",
"if",
"(",
"value",
"!=",
"null",
")",
"{",
"try",
"{",
... | Extract the UUID from the attributes.
@param provider is a provider of attributes
@return the uuid if found or <code>null</code> if none. | [
"Extract",
"the",
"UUID",
"from",
"the",
"attributes",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/gisinputoutput/src/main/java/org/arakhne/afc/gis/io/shape/GISShapeFileReader.java#L714-L740 | train |
lightblueseas/swing-components | src/main/java/de/alpharogroup/swing/menu/popup/listeners/PopupListener.java | PopupListener.onShowPopup | protected void onShowPopup(final MouseEvent e)
{
if (e.isPopupTrigger())
{
System.out.println(e.getSource());
popupMenu.show(e.getComponent(), e.getX(), e.getY());
}
} | java | protected void onShowPopup(final MouseEvent e)
{
if (e.isPopupTrigger())
{
System.out.println(e.getSource());
popupMenu.show(e.getComponent(), e.getX(), e.getY());
}
} | [
"protected",
"void",
"onShowPopup",
"(",
"final",
"MouseEvent",
"e",
")",
"{",
"if",
"(",
"e",
".",
"isPopupTrigger",
"(",
")",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"e",
".",
"getSource",
"(",
")",
")",
";",
"popupMenu",
".",
"show",
... | Callback method that is called on show popup.
@param e
the mouse event | [
"Callback",
"method",
"that",
"is",
"called",
"on",
"show",
"popup",
"."
] | 4045e85cabd8f0ce985cbfff134c3c9873930c79 | https://github.com/lightblueseas/swing-components/blob/4045e85cabd8f0ce985cbfff134c3c9873930c79/src/main/java/de/alpharogroup/swing/menu/popup/listeners/PopupListener.java#L80-L87 | train |
killme2008/hs4j | src/main/java/com/google/code/hs4j/network/hs/HandlerSocketSessionImpl.java | HandlerSocketSessionImpl.takeExecutingCommand | private final Command takeExecutingCommand() {
try {
return this.commandAlreadySent.take();
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
}
return null;
} | java | private final Command takeExecutingCommand() {
try {
return this.commandAlreadySent.take();
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
}
return null;
} | [
"private",
"final",
"Command",
"takeExecutingCommand",
"(",
")",
"{",
"try",
"{",
"return",
"this",
".",
"commandAlreadySent",
".",
"take",
"(",
")",
";",
"}",
"catch",
"(",
"InterruptedException",
"e",
")",
"{",
"Thread",
".",
"currentThread",
"(",
")",
"... | get current command from queue
@return | [
"get",
"current",
"command",
"from",
"queue"
] | 805fe14bfe270d95009514c224d93c5fe3575f11 | https://github.com/killme2008/hs4j/blob/805fe14bfe270d95009514c224d93c5fe3575f11/src/main/java/com/google/code/hs4j/network/hs/HandlerSocketSessionImpl.java#L103-L110 | train |
gallandarakhneorg/afc | core/vmutils/src/main/java/org/arakhne/afc/vmutil/LibraryLoader.java | LibraryLoader.load | public static void load(URL filename) throws IOException {
// Silently ignore loading query
if (disable) {
return;
}
if (URISchemeType.FILE.isURL(filename)) {
try {
load(new File(filename.toURI()));
} catch (URISyntaxException e) {
throw new FileNotFoundException(filename.toExternalForm());
}
} else {
// Create a tmp file to receive the library code.
final String libName = System.mapLibraryName("javaDynLib"); //$NON-NLS-1$
String suffix = ".dll"; //$NON-NLS-1$
String prefix = "javaDynLib"; //$NON-NLS-1$
final int pos = libName.lastIndexOf('.');
if (pos >= 0) {
suffix = libName.substring(pos);
prefix = libName.substring(0, pos);
}
final File file = File.createTempFile(prefix, suffix);
// Copy the library code into the local file
try (FileOutputStream outs = new FileOutputStream(file)) {
try (InputStream ins = filename.openStream()) {
final byte[] buffer = new byte[BUFFER_SIZE];
int lu;
while ((lu = ins.read(buffer)) > 0) {
outs.write(buffer, 0, lu);
}
}
}
// Load the library from the local file
load(file);
// Delete local file
file.deleteOnExit();
}
} | java | public static void load(URL filename) throws IOException {
// Silently ignore loading query
if (disable) {
return;
}
if (URISchemeType.FILE.isURL(filename)) {
try {
load(new File(filename.toURI()));
} catch (URISyntaxException e) {
throw new FileNotFoundException(filename.toExternalForm());
}
} else {
// Create a tmp file to receive the library code.
final String libName = System.mapLibraryName("javaDynLib"); //$NON-NLS-1$
String suffix = ".dll"; //$NON-NLS-1$
String prefix = "javaDynLib"; //$NON-NLS-1$
final int pos = libName.lastIndexOf('.');
if (pos >= 0) {
suffix = libName.substring(pos);
prefix = libName.substring(0, pos);
}
final File file = File.createTempFile(prefix, suffix);
// Copy the library code into the local file
try (FileOutputStream outs = new FileOutputStream(file)) {
try (InputStream ins = filename.openStream()) {
final byte[] buffer = new byte[BUFFER_SIZE];
int lu;
while ((lu = ins.read(buffer)) > 0) {
outs.write(buffer, 0, lu);
}
}
}
// Load the library from the local file
load(file);
// Delete local file
file.deleteOnExit();
}
} | [
"public",
"static",
"void",
"load",
"(",
"URL",
"filename",
")",
"throws",
"IOException",
"{",
"// Silently ignore loading query",
"if",
"(",
"disable",
")",
"{",
"return",
";",
"}",
"if",
"(",
"URISchemeType",
".",
"FILE",
".",
"isURL",
"(",
"filename",
")"... | Loads a code file with the specified filename from the local file
system as a dynamic library. The filename
argument must be a complete path name.
@param filename is the file to load.
@throws IOException when reading error occurs.
@throws SecurityException if a security manager exists and its
<code>checkLink</code> method doesn't allow
loading of the specified dynamic library
@throws UnsatisfiedLinkError if the file does not exist.
@throws NullPointerException if <code>filename</code> is
<code>null</code>
@see java.lang.System#load(java.lang.String) | [
"Loads",
"a",
"code",
"file",
"with",
"the",
"specified",
"filename",
"from",
"the",
"local",
"file",
"system",
"as",
"a",
"dynamic",
"library",
".",
"The",
"filename",
"argument",
"must",
"be",
"a",
"complete",
"path",
"name",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/vmutils/src/main/java/org/arakhne/afc/vmutil/LibraryLoader.java#L130-L171 | train |
gallandarakhneorg/afc | advanced/shapefile/src/main/java/org/arakhne/afc/io/shape/AbstractShapeFileReader.java | AbstractShapeFileReader.readPoint | private E readPoint(int elementIndex, ShapeElementType type) throws IOException {
final boolean hasZ = type.hasZ();
final boolean hasM = type.hasM();
// Read coordinates
final double x = fromESRI_x(readLEDouble());
final double y = fromESRI_y(readLEDouble());
double z = 0;
double measure = Double.NaN;
if (hasZ) {
z = fromESRI_z(readLEDouble());
}
if (hasM) {
measure = fromESRI_m(readLEDouble());
}
// Create the point
if (!Double.isNaN(x) && !Double.isNaN(y)) {
return createPoint(createAttributeCollection(elementIndex), elementIndex, new ESRIPoint(x, y, z, measure));
}
return null;
} | java | private E readPoint(int elementIndex, ShapeElementType type) throws IOException {
final boolean hasZ = type.hasZ();
final boolean hasM = type.hasM();
// Read coordinates
final double x = fromESRI_x(readLEDouble());
final double y = fromESRI_y(readLEDouble());
double z = 0;
double measure = Double.NaN;
if (hasZ) {
z = fromESRI_z(readLEDouble());
}
if (hasM) {
measure = fromESRI_m(readLEDouble());
}
// Create the point
if (!Double.isNaN(x) && !Double.isNaN(y)) {
return createPoint(createAttributeCollection(elementIndex), elementIndex, new ESRIPoint(x, y, z, measure));
}
return null;
} | [
"private",
"E",
"readPoint",
"(",
"int",
"elementIndex",
",",
"ShapeElementType",
"type",
")",
"throws",
"IOException",
"{",
"final",
"boolean",
"hasZ",
"=",
"type",
".",
"hasZ",
"(",
")",
";",
"final",
"boolean",
"hasM",
"=",
"type",
".",
"hasM",
"(",
"... | Read a point.
@param elementIndex is the index of the element inside the shape file
@param type is the type of the element to read.
@return an object representing the creating point, depending of your implementation.
This value will be passed to {@link #postRecordReadingStage(E)}. | [
"Read",
"a",
"point",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/shapefile/src/main/java/org/arakhne/afc/io/shape/AbstractShapeFileReader.java#L278-L301 | train |
gallandarakhneorg/afc | advanced/shapefile/src/main/java/org/arakhne/afc/io/shape/AbstractShapeFileReader.java | AbstractShapeFileReader.readPolyElement | @SuppressWarnings({"checkstyle:cyclomaticcomplexity", "checkstyle:npathcomplexity"})
private E readPolyElement(int elementIndex, ShapeElementType type) throws IOException {
final boolean hasZ = type.hasZ();
final boolean hasM = type.hasM();
// Ignore the bounds stored inside the file
skipBytes(8 * 4);
// Count of parts
final int numParts;
if (type == ShapeElementType.MULTIPOINT || type == ShapeElementType.MULTIPOINT_Z
|| type == ShapeElementType.MULTIPOINT_M) {
numParts = 0;
} else {
numParts = readLEInt();
}
// Count of points
final int numPoints = readLEInt();
// Read the parts' indexes
final int[] parts = new int[numParts];
for (int idxParts = 0; idxParts < numParts; ++idxParts) {
parts[idxParts] = readLEInt();
}
// Read the points
final ESRIPoint[] points = new ESRIPoint[numPoints];
for (int idxPoints = 0; idxPoints < numPoints; ++idxPoints) {
// Read coordinates
final double x = fromESRI_x(readLEDouble());
final double y = fromESRI_y(readLEDouble());
// Create point
if (!Double.isNaN(x) && !Double.isNaN(y)) {
points[idxPoints] = new ESRIPoint(x, y);
} else {
throw new ShapeFileException("invalid (x,y) coordinates"); //$NON-NLS-1$
}
} // for i= 0 to numPoints
if (hasZ) {
// Zmin and Zmax: 2*Double - ignored
skipBytes(2 * 8);
// Z array: numpoints*Double
double z;
for (int i = 0; i < numPoints; ++i) {
z = fromESRI_z(readLEDouble());
if (!Double.isNaN(z)) {
points[i].setZ(z);
}
}
}
if (hasM) {
// Mmin and Mmax: 2*Double - ignored
skipBytes(2 * 8);
// M array: numpoints*Double
double measure;
for (int i = 0; i < numPoints; ++i) {
measure = fromESRI_m(readLEDouble());
if (!Double.isNaN(measure)) {
points[i].setM(measure);
}
}
}
// Create the instance of the element
E newElement = null;
switch (type) {
case POLYGON_Z:
case POLYGON_M:
case POLYGON:
newElement = createPolygon(createAttributeCollection(elementIndex), elementIndex, parts, points, hasZ);
break;
case POLYLINE_Z:
case POLYLINE_M:
case POLYLINE:
newElement = createPolyline(createAttributeCollection(elementIndex), elementIndex, parts, points, hasZ);
break;
case MULTIPOINT:
case MULTIPOINT_M:
case MULTIPOINT_Z:
newElement = createMultiPoint(createAttributeCollection(elementIndex), elementIndex, points, hasZ);
break;
//$CASES-OMITTED$
default:
}
return newElement;
} | java | @SuppressWarnings({"checkstyle:cyclomaticcomplexity", "checkstyle:npathcomplexity"})
private E readPolyElement(int elementIndex, ShapeElementType type) throws IOException {
final boolean hasZ = type.hasZ();
final boolean hasM = type.hasM();
// Ignore the bounds stored inside the file
skipBytes(8 * 4);
// Count of parts
final int numParts;
if (type == ShapeElementType.MULTIPOINT || type == ShapeElementType.MULTIPOINT_Z
|| type == ShapeElementType.MULTIPOINT_M) {
numParts = 0;
} else {
numParts = readLEInt();
}
// Count of points
final int numPoints = readLEInt();
// Read the parts' indexes
final int[] parts = new int[numParts];
for (int idxParts = 0; idxParts < numParts; ++idxParts) {
parts[idxParts] = readLEInt();
}
// Read the points
final ESRIPoint[] points = new ESRIPoint[numPoints];
for (int idxPoints = 0; idxPoints < numPoints; ++idxPoints) {
// Read coordinates
final double x = fromESRI_x(readLEDouble());
final double y = fromESRI_y(readLEDouble());
// Create point
if (!Double.isNaN(x) && !Double.isNaN(y)) {
points[idxPoints] = new ESRIPoint(x, y);
} else {
throw new ShapeFileException("invalid (x,y) coordinates"); //$NON-NLS-1$
}
} // for i= 0 to numPoints
if (hasZ) {
// Zmin and Zmax: 2*Double - ignored
skipBytes(2 * 8);
// Z array: numpoints*Double
double z;
for (int i = 0; i < numPoints; ++i) {
z = fromESRI_z(readLEDouble());
if (!Double.isNaN(z)) {
points[i].setZ(z);
}
}
}
if (hasM) {
// Mmin and Mmax: 2*Double - ignored
skipBytes(2 * 8);
// M array: numpoints*Double
double measure;
for (int i = 0; i < numPoints; ++i) {
measure = fromESRI_m(readLEDouble());
if (!Double.isNaN(measure)) {
points[i].setM(measure);
}
}
}
// Create the instance of the element
E newElement = null;
switch (type) {
case POLYGON_Z:
case POLYGON_M:
case POLYGON:
newElement = createPolygon(createAttributeCollection(elementIndex), elementIndex, parts, points, hasZ);
break;
case POLYLINE_Z:
case POLYLINE_M:
case POLYLINE:
newElement = createPolyline(createAttributeCollection(elementIndex), elementIndex, parts, points, hasZ);
break;
case MULTIPOINT:
case MULTIPOINT_M:
case MULTIPOINT_Z:
newElement = createMultiPoint(createAttributeCollection(elementIndex), elementIndex, points, hasZ);
break;
//$CASES-OMITTED$
default:
}
return newElement;
} | [
"@",
"SuppressWarnings",
"(",
"{",
"\"checkstyle:cyclomaticcomplexity\"",
",",
"\"checkstyle:npathcomplexity\"",
"}",
")",
"private",
"E",
"readPolyElement",
"(",
"int",
"elementIndex",
",",
"ShapeElementType",
"type",
")",
"throws",
"IOException",
"{",
"final",
"boolea... | Read a polyelement.
@param elementIndex is the index of the element inside the shape file
@return an object representing the creating point, depending of your implementation.
This value will be passed to {@link #postRecordReadingStage(E)}. | [
"Read",
"a",
"polyelement",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/shapefile/src/main/java/org/arakhne/afc/io/shape/AbstractShapeFileReader.java#L320-L411 | train |
gallandarakhneorg/afc | advanced/shapefile/src/main/java/org/arakhne/afc/io/shape/AbstractShapeFileReader.java | AbstractShapeFileReader.readMultiPatch | private E readMultiPatch(int elementIndex, ShapeElementType type) throws IOException {
// Ignore the bounds stored inside the file
skipBytes(8 * 4);
// Read the part count
final int partCount = readLEInt();
// Read the point count
final int pointCount = readLEInt();
// Read the parts' indexes
final int[] parts = new int[partCount];
for (int idxParts = 0; idxParts < partCount; ++idxParts) {
parts[idxParts] = readLEInt();
}
// Read the parts' types
final ShapeMultiPatchType[] partTypes = new ShapeMultiPatchType[partCount];
for (int idxParts = 0; idxParts < partCount; ++idxParts) {
partTypes[idxParts] = ShapeMultiPatchType.fromESRIInteger(readLEInt());
}
// Read the points
final ESRIPoint[] points = new ESRIPoint[pointCount];
for (int idxPoints = 0; idxPoints < pointCount; ++idxPoints) {
// Read coordinates
final double x = fromESRI_x(readLEDouble());
final double y = fromESRI_y(readLEDouble());
// Create point
if (!Double.isNaN(x) && !Double.isNaN(y)) {
points[idxPoints] = new ESRIPoint(x, y);
} else {
throw new InvalidNumericValueException(
Double.isNaN(x) ? x : y);
}
} // for i= 0 to numPoints
// Zmin and Zmax: 2*Double - ignored
skipBytes(2 * 8);
// Z array: numpoints*Double
double z;
for (int i = 0; i < pointCount; ++i) {
z = fromESRI_z(readLEDouble());
if (!Double.isNaN(z)) {
points[i].setZ(z);
}
}
// Mmin and Mmax: 2*Double - ignored
skipBytes(2 * 8);
// M array: numpoints*Double
double measure;
for (int i = 0; i < pointCount; ++i) {
measure = fromESRI_m(readLEDouble());
if (!Double.isNaN(measure)) {
points[i].setM(measure);
}
}
// Create the instance of the element
return createMultiPatch(
createAttributeCollection(elementIndex),
elementIndex,
parts,
partTypes,
points);
} | java | private E readMultiPatch(int elementIndex, ShapeElementType type) throws IOException {
// Ignore the bounds stored inside the file
skipBytes(8 * 4);
// Read the part count
final int partCount = readLEInt();
// Read the point count
final int pointCount = readLEInt();
// Read the parts' indexes
final int[] parts = new int[partCount];
for (int idxParts = 0; idxParts < partCount; ++idxParts) {
parts[idxParts] = readLEInt();
}
// Read the parts' types
final ShapeMultiPatchType[] partTypes = new ShapeMultiPatchType[partCount];
for (int idxParts = 0; idxParts < partCount; ++idxParts) {
partTypes[idxParts] = ShapeMultiPatchType.fromESRIInteger(readLEInt());
}
// Read the points
final ESRIPoint[] points = new ESRIPoint[pointCount];
for (int idxPoints = 0; idxPoints < pointCount; ++idxPoints) {
// Read coordinates
final double x = fromESRI_x(readLEDouble());
final double y = fromESRI_y(readLEDouble());
// Create point
if (!Double.isNaN(x) && !Double.isNaN(y)) {
points[idxPoints] = new ESRIPoint(x, y);
} else {
throw new InvalidNumericValueException(
Double.isNaN(x) ? x : y);
}
} // for i= 0 to numPoints
// Zmin and Zmax: 2*Double - ignored
skipBytes(2 * 8);
// Z array: numpoints*Double
double z;
for (int i = 0; i < pointCount; ++i) {
z = fromESRI_z(readLEDouble());
if (!Double.isNaN(z)) {
points[i].setZ(z);
}
}
// Mmin and Mmax: 2*Double - ignored
skipBytes(2 * 8);
// M array: numpoints*Double
double measure;
for (int i = 0; i < pointCount; ++i) {
measure = fromESRI_m(readLEDouble());
if (!Double.isNaN(measure)) {
points[i].setM(measure);
}
}
// Create the instance of the element
return createMultiPatch(
createAttributeCollection(elementIndex),
elementIndex,
parts,
partTypes,
points);
} | [
"private",
"E",
"readMultiPatch",
"(",
"int",
"elementIndex",
",",
"ShapeElementType",
"type",
")",
"throws",
"IOException",
"{",
"// Ignore the bounds stored inside the file",
"skipBytes",
"(",
"8",
"*",
"4",
")",
";",
"// Read the part count",
"final",
"int",
"partC... | Read a multipatch.
<p>A MultiPatch consists of a number of surface patches. Each surface patch describes a
surface. The surface patches of a MultiPatch are referred to as its parts, and the type of
part controls how the order of vertices of an MultiPatch part is interpreted.
<p>A single Triangle Strip, or Triangle Fan, represents a single surface patch.
<p>A sequence of parts that are rings can describe a polygonal surface patch with holes. The
sequence typically consists of an Outer Ring, representing the outer boundary of the
patch, followed by a number of Inner Rings representing holes. When the individual
types of rings in a collection of rings representing a polygonal patch with holes are
unknown, the sequence must start with First Ring, followed by a number of Rings. A
sequence of Rings not preceded by an First Ring is treated as a sequence of Outer Rings
without holes.
@param elementIndex is the index of the element inside the shape file
@param type is the type of the shape element to extract.
@return an object representing the creating multipatch, depending of your implementation.
This value will be passed to {@link #postRecordReadingStage(E)}. | [
"Read",
"a",
"multipatch",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/shapefile/src/main/java/org/arakhne/afc/io/shape/AbstractShapeFileReader.java#L435-L505 | train |
gallandarakhneorg/afc | advanced/shapefile/src/main/java/org/arakhne/afc/io/shape/AbstractShapeFileReader.java | AbstractShapeFileReader.readAttributesFromDBaseFile | private void readAttributesFromDBaseFile(E created_element) throws IOException {
// Read the DBF entry
if (this.dbfReader != null) {
final List<DBaseFileField> dbfColumns = this.dbfReader.getDBFFields();
// Read the record even if the shape element was not inserted into
// the database. It is necessary to not have inconsistancy between
// the shape entries and the dbase entries.
final DBaseFileRecord record = this.dbfReader.readNextDBFRecord();
if (record != null) {
// Add the dBase values
for (final DBaseFileField dbfColumn : dbfColumns) {
// Test if the column was marked as selected.
// A column was selected if the user want to import the column
// values into the database.
if (this.dbfReader.isColumnSelectable(dbfColumn)) {
final Object fieldValue = record.getFieldValue(dbfColumn.getColumnIndex());
final AttributeValueImpl attr = new AttributeValueImpl();
attr.castAndSet(dbfColumn.getAttributeType(), fieldValue);
putAttributeIn(created_element, dbfColumn.getName(), attr);
}
}
}
}
} | java | private void readAttributesFromDBaseFile(E created_element) throws IOException {
// Read the DBF entry
if (this.dbfReader != null) {
final List<DBaseFileField> dbfColumns = this.dbfReader.getDBFFields();
// Read the record even if the shape element was not inserted into
// the database. It is necessary to not have inconsistancy between
// the shape entries and the dbase entries.
final DBaseFileRecord record = this.dbfReader.readNextDBFRecord();
if (record != null) {
// Add the dBase values
for (final DBaseFileField dbfColumn : dbfColumns) {
// Test if the column was marked as selected.
// A column was selected if the user want to import the column
// values into the database.
if (this.dbfReader.isColumnSelectable(dbfColumn)) {
final Object fieldValue = record.getFieldValue(dbfColumn.getColumnIndex());
final AttributeValueImpl attr = new AttributeValueImpl();
attr.castAndSet(dbfColumn.getAttributeType(), fieldValue);
putAttributeIn(created_element, dbfColumn.getName(), attr);
}
}
}
}
} | [
"private",
"void",
"readAttributesFromDBaseFile",
"(",
"E",
"created_element",
")",
"throws",
"IOException",
"{",
"// Read the DBF entry",
"if",
"(",
"this",
".",
"dbfReader",
"!=",
"null",
")",
"{",
"final",
"List",
"<",
"DBaseFileField",
">",
"dbfColumns",
"=",
... | Create the attribute values that correspond to the dBase content.
@param created_element is an object representing the creating point, depending of your implementation.
This value will be passed to {@link #postRecordReadingStage(Object)}.
@throws IOException in case of error. | [
"Create",
"the",
"attribute",
"values",
"that",
"correspond",
"to",
"the",
"dBase",
"content",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/shapefile/src/main/java/org/arakhne/afc/io/shape/AbstractShapeFileReader.java#L579-L607 | train |
gallandarakhneorg/afc | core/maths/mathstochastic/src/main/java/org/arakhne/afc/math/stochastic/StochasticGenerator.java | StochasticGenerator.noiseValue | @Pure
public static double noiseValue(double value, MathFunction noiseLaw) throws MathException {
try {
double noise = Math.abs(noiseLaw.f(value));
initRandomNumberList();
noise *= uniformRandomVariableList.nextFloat();
if (uniformRandomVariableList.nextBoolean()) {
noise = -noise;
}
return value + noise;
} catch (MathException e) {
return value;
}
} | java | @Pure
public static double noiseValue(double value, MathFunction noiseLaw) throws MathException {
try {
double noise = Math.abs(noiseLaw.f(value));
initRandomNumberList();
noise *= uniformRandomVariableList.nextFloat();
if (uniformRandomVariableList.nextBoolean()) {
noise = -noise;
}
return value + noise;
} catch (MathException e) {
return value;
}
} | [
"@",
"Pure",
"public",
"static",
"double",
"noiseValue",
"(",
"double",
"value",
",",
"MathFunction",
"noiseLaw",
")",
"throws",
"MathException",
"{",
"try",
"{",
"double",
"noise",
"=",
"Math",
".",
"abs",
"(",
"noiseLaw",
".",
"f",
"(",
"value",
")",
"... | Add a noise to the specified value.
<p>The returned value is given by:
{@code (value-noise) < value < (value+noise)}
where {@code 0 <= noise <= max(abs(value), noiseLaw(value))}.
The {@code noise} is randomly selected according to the
given random number list.
<p>This method uses a {@link UniformStochasticLaw uniform distribution random number generation}.
@param value is the value to noise
@param noiseLaw is the law used to selected tyhe noise amount.
@return the value
@throws MathException is case the value is not valid | [
"Add",
"a",
"noise",
"to",
"the",
"specified",
"value",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/maths/mathstochastic/src/main/java/org/arakhne/afc/math/stochastic/StochasticGenerator.java#L86-L99 | train |
gallandarakhneorg/afc | core/maths/mathgeom/src/main/java/org/arakhne/afc/math/geometry/d3/Transform3D.java | Transform3D.setRotation | public void setRotation(Quaternion rotation) {
this.m00 = 1.0f - 2.0f * rotation.getY() * rotation.getY() - 2.0f * rotation.getZ() * rotation.getZ();
this.m10 = 2.0f * (rotation.getX() * rotation.getY() + rotation.getW() * rotation.getZ());
this.m20 = 2.0f * (rotation.getX() * rotation.getZ() - rotation.getW() * rotation.getY());
this.m01 = 2.0f * (rotation.getX() * rotation.getY() - rotation.getW() * rotation.getZ());
this.m11 = 1.0f - 2.0f * rotation.getX() * rotation.getX() - 2.0f * rotation.getZ() * rotation.getZ();
this.m21 = 2.0f * (rotation.getY() * rotation.getZ() + rotation.getW() * rotation.getX());
this.m02 = 2.0f * (rotation.getX() * rotation.getZ() + rotation.getW() * rotation.getY());
this.m12 = 2.0f * (rotation.getY() * rotation.getZ() - rotation.getW() * rotation.getX());
this.m22 = 1.0f - 2.0f * rotation.getX() * rotation.getX() - 2.0f * rotation.getY() * rotation.getY();
} | java | public void setRotation(Quaternion rotation) {
this.m00 = 1.0f - 2.0f * rotation.getY() * rotation.getY() - 2.0f * rotation.getZ() * rotation.getZ();
this.m10 = 2.0f * (rotation.getX() * rotation.getY() + rotation.getW() * rotation.getZ());
this.m20 = 2.0f * (rotation.getX() * rotation.getZ() - rotation.getW() * rotation.getY());
this.m01 = 2.0f * (rotation.getX() * rotation.getY() - rotation.getW() * rotation.getZ());
this.m11 = 1.0f - 2.0f * rotation.getX() * rotation.getX() - 2.0f * rotation.getZ() * rotation.getZ();
this.m21 = 2.0f * (rotation.getY() * rotation.getZ() + rotation.getW() * rotation.getX());
this.m02 = 2.0f * (rotation.getX() * rotation.getZ() + rotation.getW() * rotation.getY());
this.m12 = 2.0f * (rotation.getY() * rotation.getZ() - rotation.getW() * rotation.getX());
this.m22 = 1.0f - 2.0f * rotation.getX() * rotation.getX() - 2.0f * rotation.getY() * rotation.getY();
} | [
"public",
"void",
"setRotation",
"(",
"Quaternion",
"rotation",
")",
"{",
"this",
".",
"m00",
"=",
"1.0f",
"-",
"2.0f",
"*",
"rotation",
".",
"getY",
"(",
")",
"*",
"rotation",
".",
"getY",
"(",
")",
"-",
"2.0f",
"*",
"rotation",
".",
"getZ",
"(",
... | Set the rotation for the object but do not change the translation.
<p>This function changes only the elements of
the matrix related to the rotation.
The translation is not changed.
<p>After a call to this function, the matrix will
contains (? means any value, and r is the translation
of the quaternion as a 3x3 matrix):
<pre>
[ r r r ? ]
[ r r r ? ]
[ r r r ? ]
[ ? ? ? ? ]
</pre>
@param rotation the rotation
@see #makeRotationMatrix(Quaternion) | [
"Set",
"the",
"rotation",
"for",
"the",
"object",
"but",
"do",
"not",
"change",
"the",
"translation",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/maths/mathgeom/src/main/java/org/arakhne/afc/math/geometry/d3/Transform3D.java#L255-L267 | train |
gallandarakhneorg/afc | core/maths/mathgeom/src/main/java/org/arakhne/afc/math/geometry/d3/Transform3D.java | Transform3D.makeRotationMatrix | public final void makeRotationMatrix(Quaternion rotation) {
this.m00 = 1.0f - 2.0f * rotation.getY() * rotation.getY() - 2.0f * rotation.getZ() * rotation.getZ();
this.m10 = 2.0f * (rotation.getX() * rotation.getY() + rotation.getW() * rotation.getZ());
this.m20 = 2.0f * (rotation.getX() * rotation.getZ() - rotation.getW() * rotation.getY());
this.m01 = 2.0f * (rotation.getX() * rotation.getY() - rotation.getW() * rotation.getZ());
this.m11 = 1.0f - 2.0f * rotation.getX() * rotation.getX() - 2.0f * rotation.getZ() * rotation.getZ();
this.m21 = 2.0f * (rotation.getY() * rotation.getZ() + rotation.getW() * rotation.getX());
this.m02 = 2.0f * (rotation.getX() * rotation.getZ() + rotation.getW() * rotation.getY());
this.m12 = 2.0f * (rotation.getY() * rotation.getZ() - rotation.getW() * rotation.getX());
this.m22 = 1.0f - 2.0f * rotation.getX() * rotation.getX() - 2.0f * rotation.getY() * rotation.getY();
this.m03 = 0.0;
this.m13 = 0.0;
this.m23 = 0.0;
this.m30 = 0.0;
this.m31 = 0.0;
this.m32 = 0.0;
this.m33 = 1.0;
} | java | public final void makeRotationMatrix(Quaternion rotation) {
this.m00 = 1.0f - 2.0f * rotation.getY() * rotation.getY() - 2.0f * rotation.getZ() * rotation.getZ();
this.m10 = 2.0f * (rotation.getX() * rotation.getY() + rotation.getW() * rotation.getZ());
this.m20 = 2.0f * (rotation.getX() * rotation.getZ() - rotation.getW() * rotation.getY());
this.m01 = 2.0f * (rotation.getX() * rotation.getY() - rotation.getW() * rotation.getZ());
this.m11 = 1.0f - 2.0f * rotation.getX() * rotation.getX() - 2.0f * rotation.getZ() * rotation.getZ();
this.m21 = 2.0f * (rotation.getY() * rotation.getZ() + rotation.getW() * rotation.getX());
this.m02 = 2.0f * (rotation.getX() * rotation.getZ() + rotation.getW() * rotation.getY());
this.m12 = 2.0f * (rotation.getY() * rotation.getZ() - rotation.getW() * rotation.getX());
this.m22 = 1.0f - 2.0f * rotation.getX() * rotation.getX() - 2.0f * rotation.getY() * rotation.getY();
this.m03 = 0.0;
this.m13 = 0.0;
this.m23 = 0.0;
this.m30 = 0.0;
this.m31 = 0.0;
this.m32 = 0.0;
this.m33 = 1.0;
} | [
"public",
"final",
"void",
"makeRotationMatrix",
"(",
"Quaternion",
"rotation",
")",
"{",
"this",
".",
"m00",
"=",
"1.0f",
"-",
"2.0f",
"*",
"rotation",
".",
"getY",
"(",
")",
"*",
"rotation",
".",
"getY",
"(",
")",
"-",
"2.0f",
"*",
"rotation",
".",
... | Sets the value of this matrix to a rotation matrix, and no translation.
<p>This function changes all the elements of
the matrix, including the translation.
<p>After a call to this function, the matrix will
contains (? means any value, and r a value from
the quaternion):
<pre>
[ r r r 0 ]
[ r r r 0 ]
[ r r r 0 ]
[ 0 0 0 1 ]
</pre>
@param rotation the rotation
@see #setRotation(Quaternion) | [
"Sets",
"the",
"value",
"of",
"this",
"matrix",
"to",
"a",
"rotation",
"matrix",
"and",
"no",
"translation",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/maths/mathgeom/src/main/java/org/arakhne/afc/math/geometry/d3/Transform3D.java#L315-L336 | train |
gallandarakhneorg/afc | advanced/gis/gisroad/src/main/java/org/arakhne/afc/gis/road/StandardRoadConnection.java | StandardRoadConnection.setPosition | void setPosition(Point2D<?, ?> position) {
this.location = position == null ? null : new SoftReference<>(Point2d.convert(position));
} | java | void setPosition(Point2D<?, ?> position) {
this.location = position == null ? null : new SoftReference<>(Point2d.convert(position));
} | [
"void",
"setPosition",
"(",
"Point2D",
"<",
"?",
",",
"?",
">",
"position",
")",
"{",
"this",
".",
"location",
"=",
"position",
"==",
"null",
"?",
"null",
":",
"new",
"SoftReference",
"<>",
"(",
"Point2d",
".",
"convert",
"(",
"position",
")",
")",
"... | Set the temporary buffer of the position of the road connection.
@param position a position.
@since 4.0 | [
"Set",
"the",
"temporary",
"buffer",
"of",
"the",
"position",
"of",
"the",
"road",
"connection",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/gisroad/src/main/java/org/arakhne/afc/gis/road/StandardRoadConnection.java#L226-L228 | train |
gallandarakhneorg/afc | advanced/gis/gisroad/src/main/java/org/arakhne/afc/gis/road/StandardRoadConnection.java | StandardRoadConnection.addConnectedSegment | void addConnectedSegment(RoadPolyline segment, boolean attachToStartPoint) {
if (segment == null) {
return;
}
if (this.connectedSegments.isEmpty()) {
this.connectedSegments.add(new Connection(segment, attachToStartPoint));
} else {
// Compute the angle to the unit vector for the new segment
final double newSegmentAngle = computeAngle(segment, attachToStartPoint);
// Search for the insertion index
final int insertionIndex = searchInsertionIndex(newSegmentAngle, 0, this.connectedSegments.size() - 1);
// Insert
this.connectedSegments.add(insertionIndex, new Connection(segment, attachToStartPoint));
}
fireIteratorUpdate();
} | java | void addConnectedSegment(RoadPolyline segment, boolean attachToStartPoint) {
if (segment == null) {
return;
}
if (this.connectedSegments.isEmpty()) {
this.connectedSegments.add(new Connection(segment, attachToStartPoint));
} else {
// Compute the angle to the unit vector for the new segment
final double newSegmentAngle = computeAngle(segment, attachToStartPoint);
// Search for the insertion index
final int insertionIndex = searchInsertionIndex(newSegmentAngle, 0, this.connectedSegments.size() - 1);
// Insert
this.connectedSegments.add(insertionIndex, new Connection(segment, attachToStartPoint));
}
fireIteratorUpdate();
} | [
"void",
"addConnectedSegment",
"(",
"RoadPolyline",
"segment",
",",
"boolean",
"attachToStartPoint",
")",
"{",
"if",
"(",
"segment",
"==",
"null",
")",
"{",
"return",
";",
"}",
"if",
"(",
"this",
".",
"connectedSegments",
".",
"isEmpty",
"(",
")",
")",
"{"... | Add a segment to this connection point.
<p>The segments are ordered according to there
geo-localization along a trigonometric cicle.
The first segment has the nearest angle to the
vector (1,0), and the following segments are
ordered according to the positive value of there
angles to this unity vector (counterclockwise order).
@param segment is the segment to add.
@param attachToStartPoint indicates if the segment must be attached by
its start point (if value is <code>true</code>) or by its end point
(if value is <code>false</code>). | [
"Add",
"a",
"segment",
"to",
"this",
"connection",
"point",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/gisroad/src/main/java/org/arakhne/afc/gis/road/StandardRoadConnection.java#L310-L326 | train |
gallandarakhneorg/afc | advanced/gis/gisroad/src/main/java/org/arakhne/afc/gis/road/StandardRoadConnection.java | StandardRoadConnection.removeConnectedSegment | int removeConnectedSegment(RoadSegment segment, boolean attachToStartPoint) {
if (segment == null) {
return -1;
}
final int idx = indexOf(segment, attachToStartPoint);
if (idx != -1) {
this.connectedSegments.remove(idx);
fireIteratorUpdate();
}
return idx;
} | java | int removeConnectedSegment(RoadSegment segment, boolean attachToStartPoint) {
if (segment == null) {
return -1;
}
final int idx = indexOf(segment, attachToStartPoint);
if (idx != -1) {
this.connectedSegments.remove(idx);
fireIteratorUpdate();
}
return idx;
} | [
"int",
"removeConnectedSegment",
"(",
"RoadSegment",
"segment",
",",
"boolean",
"attachToStartPoint",
")",
"{",
"if",
"(",
"segment",
"==",
"null",
")",
"{",
"return",
"-",
"1",
";",
"}",
"final",
"int",
"idx",
"=",
"indexOf",
"(",
"segment",
",",
"attachT... | Remove a connection with a segment.
@param segment is the segment to remove.
@param attachToStartPoint indicates if the segment is attached by
its start point (if value is <code>true</code>) or by its end point
@return the index of the removed segment, or {@code -1} if none was found | [
"Remove",
"a",
"connection",
"with",
"a",
"segment",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/gisroad/src/main/java/org/arakhne/afc/gis/road/StandardRoadConnection.java#L414-L424 | train |
gallandarakhneorg/afc | advanced/gis/gisroad/src/main/java/org/arakhne/afc/gis/road/StandardRoadConnection.java | StandardRoadConnection.addListeningIterator | protected void addListeningIterator(IClockwiseIterator iterator) {
if (this.listeningIterators == null) {
this.listeningIterators = new WeakArrayList<>();
}
this.listeningIterators.add(iterator);
} | java | protected void addListeningIterator(IClockwiseIterator iterator) {
if (this.listeningIterators == null) {
this.listeningIterators = new WeakArrayList<>();
}
this.listeningIterators.add(iterator);
} | [
"protected",
"void",
"addListeningIterator",
"(",
"IClockwiseIterator",
"iterator",
")",
"{",
"if",
"(",
"this",
".",
"listeningIterators",
"==",
"null",
")",
"{",
"this",
".",
"listeningIterators",
"=",
"new",
"WeakArrayList",
"<>",
"(",
")",
";",
"}",
"this"... | Add a listening iterator.
@param iterator the iterator. | [
"Add",
"a",
"listening",
"iterator",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/gisroad/src/main/java/org/arakhne/afc/gis/road/StandardRoadConnection.java#L828-L833 | train |
gallandarakhneorg/afc | advanced/gis/gisroad/src/main/java/org/arakhne/afc/gis/road/StandardRoadConnection.java | StandardRoadConnection.removeListeningIterator | protected void removeListeningIterator(IClockwiseIterator iterator) {
if (this.listeningIterators != null) {
this.listeningIterators.remove(iterator);
if (this.listeningIterators.isEmpty()) {
this.listeningIterators = null;
}
}
} | java | protected void removeListeningIterator(IClockwiseIterator iterator) {
if (this.listeningIterators != null) {
this.listeningIterators.remove(iterator);
if (this.listeningIterators.isEmpty()) {
this.listeningIterators = null;
}
}
} | [
"protected",
"void",
"removeListeningIterator",
"(",
"IClockwiseIterator",
"iterator",
")",
"{",
"if",
"(",
"this",
".",
"listeningIterators",
"!=",
"null",
")",
"{",
"this",
".",
"listeningIterators",
".",
"remove",
"(",
"iterator",
")",
";",
"if",
"(",
"this... | Remove a listening iterator.
@param iterator the iterator. | [
"Remove",
"a",
"listening",
"iterator",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/gisroad/src/main/java/org/arakhne/afc/gis/road/StandardRoadConnection.java#L839-L846 | train |
gallandarakhneorg/afc | advanced/gis/gisroad/src/main/java/org/arakhne/afc/gis/road/StandardRoadConnection.java | StandardRoadConnection.fireIteratorUpdate | protected void fireIteratorUpdate() {
if (this.listeningIterators != null) {
for (final IClockwiseIterator iterator : this.listeningIterators) {
if (iterator != null) {
iterator.dataStructureUpdated();
}
}
}
} | java | protected void fireIteratorUpdate() {
if (this.listeningIterators != null) {
for (final IClockwiseIterator iterator : this.listeningIterators) {
if (iterator != null) {
iterator.dataStructureUpdated();
}
}
}
} | [
"protected",
"void",
"fireIteratorUpdate",
"(",
")",
"{",
"if",
"(",
"this",
".",
"listeningIterators",
"!=",
"null",
")",
"{",
"for",
"(",
"final",
"IClockwiseIterator",
"iterator",
":",
"this",
".",
"listeningIterators",
")",
"{",
"if",
"(",
"iterator",
"!... | Notify the iterators about changes. | [
"Notify",
"the",
"iterators",
"about",
"changes",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/gisroad/src/main/java/org/arakhne/afc/gis/road/StandardRoadConnection.java#L850-L858 | train |
gallandarakhneorg/afc | advanced/gis/gisroad/src/main/java/org/arakhne/afc/gis/road/layer/RoadNetworkLayerConstants.java | RoadNetworkLayerConstants.getPreferredRoadColor | @Pure
public static int getPreferredRoadColor(RoadType roadType, boolean useSystemValue) {
final RoadType rt = roadType == null ? RoadType.OTHER : roadType;
final Preferences prefs = Preferences.userNodeForPackage(RoadNetworkLayerConstants.class);
if (prefs != null) {
final String str = prefs.get("ROAD_COLOR_" + rt.name().toUpperCase(), null); //$NON-NLS-1$
if (str != null) {
try {
return Integer.valueOf(str);
} catch (Throwable exception) {
//
}
}
}
if (useSystemValue) {
return DEFAULT_ROAD_COLORS[rt.ordinal() * 2];
}
return 0;
} | java | @Pure
public static int getPreferredRoadColor(RoadType roadType, boolean useSystemValue) {
final RoadType rt = roadType == null ? RoadType.OTHER : roadType;
final Preferences prefs = Preferences.userNodeForPackage(RoadNetworkLayerConstants.class);
if (prefs != null) {
final String str = prefs.get("ROAD_COLOR_" + rt.name().toUpperCase(), null); //$NON-NLS-1$
if (str != null) {
try {
return Integer.valueOf(str);
} catch (Throwable exception) {
//
}
}
}
if (useSystemValue) {
return DEFAULT_ROAD_COLORS[rt.ordinal() * 2];
}
return 0;
} | [
"@",
"Pure",
"public",
"static",
"int",
"getPreferredRoadColor",
"(",
"RoadType",
"roadType",
",",
"boolean",
"useSystemValue",
")",
"{",
"final",
"RoadType",
"rt",
"=",
"roadType",
"==",
"null",
"?",
"RoadType",
".",
"OTHER",
":",
"roadType",
";",
"final",
... | Replies the preferred color to draw the content of the roads of the given type.
@param roadType is the type of road for which the color should be replied.
@param useSystemValue indicates if the <code>null</code> value
must be replaced by the default system value in
{@link #DEFAULT_ROAD_COLORS} (if <code>true</code>).
@return the color of the inner parts of the roads. | [
"Replies",
"the",
"preferred",
"color",
"to",
"draw",
"the",
"content",
"of",
"the",
"roads",
"of",
"the",
"given",
"type",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/gisroad/src/main/java/org/arakhne/afc/gis/road/layer/RoadNetworkLayerConstants.java#L170-L188 | train |
gallandarakhneorg/afc | advanced/gis/gisroad/src/main/java/org/arakhne/afc/gis/road/layer/RoadNetworkLayerConstants.java | RoadNetworkLayerConstants.setPreferredRoadColor | public static void setPreferredRoadColor(RoadType roadType, Integer color) {
final RoadType rt = roadType == null ? RoadType.OTHER : roadType;
final Preferences prefs = Preferences.userNodeForPackage(RoadNetworkLayerConstants.class);
if (prefs != null) {
if (color == null || color.intValue() == DEFAULT_ROAD_COLORS[rt.ordinal() * 2]) {
prefs.remove("ROAD_COLOR_" + rt.name().toUpperCase()); //$NON-NLS-1$
} else {
prefs.put("ROAD_COLOR_" + rt.name().toUpperCase(), Integer.toString(color.intValue())); //$NON-NLS-1$
}
try {
prefs.flush();
} catch (BackingStoreException exception) {
//
}
}
} | java | public static void setPreferredRoadColor(RoadType roadType, Integer color) {
final RoadType rt = roadType == null ? RoadType.OTHER : roadType;
final Preferences prefs = Preferences.userNodeForPackage(RoadNetworkLayerConstants.class);
if (prefs != null) {
if (color == null || color.intValue() == DEFAULT_ROAD_COLORS[rt.ordinal() * 2]) {
prefs.remove("ROAD_COLOR_" + rt.name().toUpperCase()); //$NON-NLS-1$
} else {
prefs.put("ROAD_COLOR_" + rt.name().toUpperCase(), Integer.toString(color.intValue())); //$NON-NLS-1$
}
try {
prefs.flush();
} catch (BackingStoreException exception) {
//
}
}
} | [
"public",
"static",
"void",
"setPreferredRoadColor",
"(",
"RoadType",
"roadType",
",",
"Integer",
"color",
")",
"{",
"final",
"RoadType",
"rt",
"=",
"roadType",
"==",
"null",
"?",
"RoadType",
".",
"OTHER",
":",
"roadType",
";",
"final",
"Preferences",
"prefs",... | Set the preferred color to draw the content of the roads of the given type.
@param roadType is the type of road for which the color should be replied.
@param color is the color or <code>null</code> to restore the default value. | [
"Set",
"the",
"preferred",
"color",
"to",
"draw",
"the",
"content",
"of",
"the",
"roads",
"of",
"the",
"given",
"type",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/gisroad/src/main/java/org/arakhne/afc/gis/road/layer/RoadNetworkLayerConstants.java#L195-L210 | train |
gallandarakhneorg/afc | advanced/gis/gisroad/src/main/java/org/arakhne/afc/gis/road/layer/RoadNetworkLayerConstants.java | RoadNetworkLayerConstants.getPreferredRoadInternDrawing | @Pure
public static boolean getPreferredRoadInternDrawing() {
final Preferences prefs = Preferences.userNodeForPackage(RoadNetworkLayerConstants.class);
if (prefs != null) {
return prefs.getBoolean("ROAD_INTERN_DRAWING", DEFAULT_ROAD_INTERN_DRAWING); //$NON-NLS-1$
}
return DEFAULT_ROAD_INTERN_DRAWING;
} | java | @Pure
public static boolean getPreferredRoadInternDrawing() {
final Preferences prefs = Preferences.userNodeForPackage(RoadNetworkLayerConstants.class);
if (prefs != null) {
return prefs.getBoolean("ROAD_INTERN_DRAWING", DEFAULT_ROAD_INTERN_DRAWING); //$NON-NLS-1$
}
return DEFAULT_ROAD_INTERN_DRAWING;
} | [
"@",
"Pure",
"public",
"static",
"boolean",
"getPreferredRoadInternDrawing",
"(",
")",
"{",
"final",
"Preferences",
"prefs",
"=",
"Preferences",
".",
"userNodeForPackage",
"(",
"RoadNetworkLayerConstants",
".",
"class",
")",
";",
"if",
"(",
"prefs",
"!=",
"null",
... | Replies if the internal data structure used to store the road network
may be drawn on the displayers.
@return <code>true</code> if the internal data structures may be
drawn on the displayers, otherwise <code>false</code>. | [
"Replies",
"if",
"the",
"internal",
"data",
"structure",
"used",
"to",
"store",
"the",
"road",
"network",
"may",
"be",
"drawn",
"on",
"the",
"displayers",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/gisroad/src/main/java/org/arakhne/afc/gis/road/layer/RoadNetworkLayerConstants.java#L278-L285 | train |
gallandarakhneorg/afc | advanced/gis/gisroad/src/main/java/org/arakhne/afc/gis/road/layer/RoadNetworkLayerConstants.java | RoadNetworkLayerConstants.setPreferredRoadInternDrawing | public static void setPreferredRoadInternDrawing(Boolean draw) {
final Preferences prefs = Preferences.userNodeForPackage(RoadNetworkLayerConstants.class);
if (prefs != null) {
if (draw == null) {
prefs.remove("ROAD_INTERN_DRAWING"); //$NON-NLS-1$
} else {
prefs.putBoolean("ROAD_INTERN_DRAWING", draw); //$NON-NLS-1$
}
try {
prefs.flush();
} catch (BackingStoreException exception) {
//
}
}
} | java | public static void setPreferredRoadInternDrawing(Boolean draw) {
final Preferences prefs = Preferences.userNodeForPackage(RoadNetworkLayerConstants.class);
if (prefs != null) {
if (draw == null) {
prefs.remove("ROAD_INTERN_DRAWING"); //$NON-NLS-1$
} else {
prefs.putBoolean("ROAD_INTERN_DRAWING", draw); //$NON-NLS-1$
}
try {
prefs.flush();
} catch (BackingStoreException exception) {
//
}
}
} | [
"public",
"static",
"void",
"setPreferredRoadInternDrawing",
"(",
"Boolean",
"draw",
")",
"{",
"final",
"Preferences",
"prefs",
"=",
"Preferences",
".",
"userNodeForPackage",
"(",
"RoadNetworkLayerConstants",
".",
"class",
")",
";",
"if",
"(",
"prefs",
"!=",
"null... | Set if the internal data structure used to store the road network
may be drawn on the displayers.
@param draw is <code>true</code> if the internal data structures may be
drawn on the displayers, <code>false</code> if the internal data structures
may not be drawn on the displayers, <code>null</code> to restore
the default value given by {@link #DEFAULT_ROAD_INTERN_DRAWING}. | [
"Set",
"if",
"the",
"internal",
"data",
"structure",
"used",
"to",
"store",
"the",
"road",
"network",
"may",
"be",
"drawn",
"on",
"the",
"displayers",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/gisroad/src/main/java/org/arakhne/afc/gis/road/layer/RoadNetworkLayerConstants.java#L295-L309 | train |
gallandarakhneorg/afc | advanced/gis/gisroad/src/main/java/org/arakhne/afc/gis/road/layer/RoadNetworkLayerConstants.java | RoadNetworkLayerConstants.getPreferredRoadInternColor | @Pure
public static int getPreferredRoadInternColor() {
final Preferences prefs = Preferences.userNodeForPackage(RoadNetworkLayerConstants.class);
if (prefs != null) {
final String color = prefs.get("ROAD_INTERN_COLOR", null); //$NON-NLS-1$
if (color != null) {
try {
return Integer.valueOf(color);
} catch (Throwable exception) {
//
}
}
}
return DEFAULT_ROAD_INTERN_COLOR;
} | java | @Pure
public static int getPreferredRoadInternColor() {
final Preferences prefs = Preferences.userNodeForPackage(RoadNetworkLayerConstants.class);
if (prefs != null) {
final String color = prefs.get("ROAD_INTERN_COLOR", null); //$NON-NLS-1$
if (color != null) {
try {
return Integer.valueOf(color);
} catch (Throwable exception) {
//
}
}
}
return DEFAULT_ROAD_INTERN_COLOR;
} | [
"@",
"Pure",
"public",
"static",
"int",
"getPreferredRoadInternColor",
"(",
")",
"{",
"final",
"Preferences",
"prefs",
"=",
"Preferences",
".",
"userNodeForPackage",
"(",
"RoadNetworkLayerConstants",
".",
"class",
")",
";",
"if",
"(",
"prefs",
"!=",
"null",
")",... | Replies the color of the internal data structures used when they
are drawn on the displayers.
@return the color of the internal data structures, never <code>null</code>. | [
"Replies",
"the",
"color",
"of",
"the",
"internal",
"data",
"structures",
"used",
"when",
"they",
"are",
"drawn",
"on",
"the",
"displayers",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/gisroad/src/main/java/org/arakhne/afc/gis/road/layer/RoadNetworkLayerConstants.java#L316-L330 | train |
gallandarakhneorg/afc | advanced/gis/gisroad/src/main/java/org/arakhne/afc/gis/road/layer/RoadNetworkLayerConstants.java | RoadNetworkLayerConstants.setPreferredRoadInternColor | public static void setPreferredRoadInternColor(Integer color) {
final Preferences prefs = Preferences.userNodeForPackage(RoadNetworkLayerConstants.class);
if (prefs != null) {
if (color == null) {
prefs.remove("ROAD_INTERN_COLOR"); //$NON-NLS-1$
} else {
prefs.put("ROAD_INTERN_COLOR", Integer.toString(color.intValue())); //$NON-NLS-1$
}
try {
prefs.flush();
} catch (BackingStoreException exception) {
//
}
}
} | java | public static void setPreferredRoadInternColor(Integer color) {
final Preferences prefs = Preferences.userNodeForPackage(RoadNetworkLayerConstants.class);
if (prefs != null) {
if (color == null) {
prefs.remove("ROAD_INTERN_COLOR"); //$NON-NLS-1$
} else {
prefs.put("ROAD_INTERN_COLOR", Integer.toString(color.intValue())); //$NON-NLS-1$
}
try {
prefs.flush();
} catch (BackingStoreException exception) {
//
}
}
} | [
"public",
"static",
"void",
"setPreferredRoadInternColor",
"(",
"Integer",
"color",
")",
"{",
"final",
"Preferences",
"prefs",
"=",
"Preferences",
".",
"userNodeForPackage",
"(",
"RoadNetworkLayerConstants",
".",
"class",
")",
";",
"if",
"(",
"prefs",
"!=",
"null"... | Set the color of the internal data structures used when they
are drawn on the displayers.
@param color is the color of the internal data structures, never <code>null</code>. | [
"Set",
"the",
"color",
"of",
"the",
"internal",
"data",
"structures",
"used",
"when",
"they",
"are",
"drawn",
"on",
"the",
"displayers",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/gisroad/src/main/java/org/arakhne/afc/gis/road/layer/RoadNetworkLayerConstants.java#L337-L351 | train |
gallandarakhneorg/afc | core/maths/mathgen/src/main/java/org/arakhne/afc/math/MathUtil.java | MathUtil.clamp | @Pure
public static double clamp(double v, double min, double max) {
assert min <= max : AssertMessages.lowerEqualParameters(1, min, 2, max);
if (v < min) {
return min;
}
if (v > max) {
return max;
}
return v;
} | java | @Pure
public static double clamp(double v, double min, double max) {
assert min <= max : AssertMessages.lowerEqualParameters(1, min, 2, max);
if (v < min) {
return min;
}
if (v > max) {
return max;
}
return v;
} | [
"@",
"Pure",
"public",
"static",
"double",
"clamp",
"(",
"double",
"v",
",",
"double",
"min",
",",
"double",
"max",
")",
"{",
"assert",
"min",
"<=",
"max",
":",
"AssertMessages",
".",
"lowerEqualParameters",
"(",
"1",
",",
"min",
",",
"2",
",",
"max",
... | Clamp the given value to the given range.
<p>If the value is outside the {@code [min;max]}
range, it is clamp to the nearest bounding value
{@code min} or {@code max}.
@param v is the value to clamp.
@param min is the min value of the range.
@param max is the max value of the range.
@return the value in {@code [min;max]} range. | [
"Clamp",
"the",
"given",
"value",
"to",
"the",
"given",
"range",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/maths/mathgen/src/main/java/org/arakhne/afc/math/MathUtil.java#L80-L90 | train |
gallandarakhneorg/afc | core/maths/mathgen/src/main/java/org/arakhne/afc/math/MathUtil.java | MathUtil.clampCyclic | @Pure
public static double clampCyclic(double value, double min, double max) {
assert min <= max : AssertMessages.lowerEqualParameters(1, min, 2, max);
if (Double.isNaN(max) || Double.isNaN(min) || Double.isNaN(max)) {
return Double.NaN;
}
if (value < min) {
final double perimeter = max - min;
final double nvalue = min - value;
double rest = perimeter - (nvalue % perimeter);
if (rest >= perimeter) {
rest -= perimeter;
}
return min + rest;
} else if (value >= max) {
final double perimeter = max - min;
final double nvalue = value - max;
final double rest = nvalue % perimeter;
return min + rest;
}
return value;
} | java | @Pure
public static double clampCyclic(double value, double min, double max) {
assert min <= max : AssertMessages.lowerEqualParameters(1, min, 2, max);
if (Double.isNaN(max) || Double.isNaN(min) || Double.isNaN(max)) {
return Double.NaN;
}
if (value < min) {
final double perimeter = max - min;
final double nvalue = min - value;
double rest = perimeter - (nvalue % perimeter);
if (rest >= perimeter) {
rest -= perimeter;
}
return min + rest;
} else if (value >= max) {
final double perimeter = max - min;
final double nvalue = value - max;
final double rest = nvalue % perimeter;
return min + rest;
}
return value;
} | [
"@",
"Pure",
"public",
"static",
"double",
"clampCyclic",
"(",
"double",
"value",
",",
"double",
"min",
",",
"double",
"max",
")",
"{",
"assert",
"min",
"<=",
"max",
":",
"AssertMessages",
".",
"lowerEqualParameters",
"(",
"1",
",",
"min",
",",
"2",
",",... | Clamp the given value to fit between the min and max values
according to a cyclic heuristic.
If the given value is not between the minimum and maximum
values, the replied value
is modulo the min-max range.
@param value the value to clamp.
@param min the minimum value inclusive.
@param max the maximum value exclusive.
@return the clamped value | [
"Clamp",
"the",
"given",
"value",
"to",
"fit",
"between",
"the",
"min",
"and",
"max",
"values",
"according",
"to",
"a",
"cyclic",
"heuristic",
".",
"If",
"the",
"given",
"value",
"is",
"not",
"between",
"the",
"minimum",
"and",
"maximum",
"values",
"the",
... | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/maths/mathgen/src/main/java/org/arakhne/afc/math/MathUtil.java#L428-L449 | train |
gallandarakhneorg/afc | core/maths/mathgen/src/main/java/org/arakhne/afc/math/MathUtil.java | MathUtil.getMinMax | public static DoubleRange getMinMax(double value1, double value2, double value3) {
// Efficient implementation of the min/max determination
final double min;
final double max;
// ---------------------------------
// Table of cases
// ---------------------------------
// a-b a-c b-c sequence min max case
// < < < a b c a c 1
// < < > a c b a b 2
// < > < - -
// < > > c a b c b 3
// > < < b a c b c 4
// > < > - -
// > > < b c a b a 5
// > > > c b a c a 6
// ---------------------------------
if (value1 <= value2) {
// A and B are not NaN
// case candidates: 123
if (value1 <= value3) {
// case candidates: 12
min = value1;
if (value2 <= value3) {
// case: 1
max = value3;
} else {
// case: 2
max = value2;
}
} else {
// 3
max = value2;
if (Double.isNaN(value3)) {
min = value1;
} else {
min = value3;
}
}
} else {
// case candidates: 456
if (value1 <= value3) {
max = value3;
if (Double.isNaN(value2)) {
min = value1;
} else {
// case: 4
min = value2;
}
} else if (Double.isNaN(value1)) {
if (value2 <= value3) {
min = value2;
max = value3;
} else if (Double.isNaN(value2)) {
if (Double.isNaN(value3)) {
return null;
}
min = value3;
max = min;
} else if (Double.isNaN(value3)) {
min = value2;
max = min;
} else {
min = value3;
max = value2;
}
} else if (Double.isNaN(value3)) {
if (Double.isNaN(value2)) {
min = value1;
max = min;
} else {
min = value2;
max = value1;
}
} else {
// B may NaN
// case candidates: 56
max = value1;
if (value2 <= value3) {
// case: 5
min = value2;
} else {
// case: 6
min = value3;
}
}
}
return new DoubleRange(min, max);
} | java | public static DoubleRange getMinMax(double value1, double value2, double value3) {
// Efficient implementation of the min/max determination
final double min;
final double max;
// ---------------------------------
// Table of cases
// ---------------------------------
// a-b a-c b-c sequence min max case
// < < < a b c a c 1
// < < > a c b a b 2
// < > < - -
// < > > c a b c b 3
// > < < b a c b c 4
// > < > - -
// > > < b c a b a 5
// > > > c b a c a 6
// ---------------------------------
if (value1 <= value2) {
// A and B are not NaN
// case candidates: 123
if (value1 <= value3) {
// case candidates: 12
min = value1;
if (value2 <= value3) {
// case: 1
max = value3;
} else {
// case: 2
max = value2;
}
} else {
// 3
max = value2;
if (Double.isNaN(value3)) {
min = value1;
} else {
min = value3;
}
}
} else {
// case candidates: 456
if (value1 <= value3) {
max = value3;
if (Double.isNaN(value2)) {
min = value1;
} else {
// case: 4
min = value2;
}
} else if (Double.isNaN(value1)) {
if (value2 <= value3) {
min = value2;
max = value3;
} else if (Double.isNaN(value2)) {
if (Double.isNaN(value3)) {
return null;
}
min = value3;
max = min;
} else if (Double.isNaN(value3)) {
min = value2;
max = min;
} else {
min = value3;
max = value2;
}
} else if (Double.isNaN(value3)) {
if (Double.isNaN(value2)) {
min = value1;
max = min;
} else {
min = value2;
max = value1;
}
} else {
// B may NaN
// case candidates: 56
max = value1;
if (value2 <= value3) {
// case: 5
min = value2;
} else {
// case: 6
min = value3;
}
}
}
return new DoubleRange(min, max);
} | [
"public",
"static",
"DoubleRange",
"getMinMax",
"(",
"double",
"value1",
",",
"double",
"value2",
",",
"double",
"value3",
")",
"{",
"// Efficient implementation of the min/max determination",
"final",
"double",
"min",
";",
"final",
"double",
"max",
";",
"// ---------... | Determine the min and max values from a set of three values.
<p>This function has an algorithm that is efficient for 3 values.
<p>If one of the value is {@link Double#NaN}, it is ignored.
If all the values are {@link Double#NaN}, the function replies
<code>null</code>.
@param value1 the first value.
@param value2 the second value.
@param value3 the third value.
@return the min max range; or <code>null</code>.
@since 13.0 | [
"Determine",
"the",
"min",
"and",
"max",
"values",
"from",
"a",
"set",
"of",
"three",
"values",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/maths/mathgen/src/main/java/org/arakhne/afc/math/MathUtil.java#L675-L765 | train |
gallandarakhneorg/afc | core/maths/mathgen/src/main/java/org/arakhne/afc/math/MathUtil.java | MathUtil.csc | @Pure
@Inline(value = "1./Math.sin($1)", imported = {Math.class})
public static double csc(double angle) {
return 1. / Math.sin(angle);
} | java | @Pure
@Inline(value = "1./Math.sin($1)", imported = {Math.class})
public static double csc(double angle) {
return 1. / Math.sin(angle);
} | [
"@",
"Pure",
"@",
"Inline",
"(",
"value",
"=",
"\"1./Math.sin($1)\"",
",",
"imported",
"=",
"{",
"Math",
".",
"class",
"}",
")",
"public",
"static",
"double",
"csc",
"(",
"double",
"angle",
")",
"{",
"return",
"1.",
"/",
"Math",
".",
"sin",
"(",
"ang... | Replies the cosecant of the specified angle.
<p><code>csc(a) = 1/sin(a)</code>
<p><img src="./doc-files/trigo1.png" alt="[Cosecant function]">
<img src="./doc-files/trigo3.png" alt="[Cosecant function]">
@param angle the angle.
@return the cosecant of the angle. | [
"Replies",
"the",
"cosecant",
"of",
"the",
"specified",
"angle",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/maths/mathgen/src/main/java/org/arakhne/afc/math/MathUtil.java#L777-L781 | train |
gallandarakhneorg/afc | core/maths/mathgen/src/main/java/org/arakhne/afc/math/MathUtil.java | MathUtil.sec | @Pure
@Inline(value = "1./Math.cos($1)", imported = {Math.class})
public static double sec(double angle) {
return 1. / Math.cos(angle);
} | java | @Pure
@Inline(value = "1./Math.cos($1)", imported = {Math.class})
public static double sec(double angle) {
return 1. / Math.cos(angle);
} | [
"@",
"Pure",
"@",
"Inline",
"(",
"value",
"=",
"\"1./Math.cos($1)\"",
",",
"imported",
"=",
"{",
"Math",
".",
"class",
"}",
")",
"public",
"static",
"double",
"sec",
"(",
"double",
"angle",
")",
"{",
"return",
"1.",
"/",
"Math",
".",
"cos",
"(",
"ang... | Replies the secant of the specified angle.
<p><code>csc(a) = 1/cos(a)</code>
<p><img src="./doc-files/trigo1.png" alt="[Secant function]">
<img src="./doc-files/trigo2.png" alt="[Secant function]">
@param angle the angle.
@return the secant of the angle. | [
"Replies",
"the",
"secant",
"of",
"the",
"specified",
"angle",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/maths/mathgen/src/main/java/org/arakhne/afc/math/MathUtil.java#L793-L797 | train |
gallandarakhneorg/afc | core/maths/mathgen/src/main/java/org/arakhne/afc/math/MathUtil.java | MathUtil.cot | @Pure
@Inline(value = "1./Math.tan($1)", imported = {Math.class})
public static double cot(double angle) {
return 1. / Math.tan(angle);
} | java | @Pure
@Inline(value = "1./Math.tan($1)", imported = {Math.class})
public static double cot(double angle) {
return 1. / Math.tan(angle);
} | [
"@",
"Pure",
"@",
"Inline",
"(",
"value",
"=",
"\"1./Math.tan($1)\"",
",",
"imported",
"=",
"{",
"Math",
".",
"class",
"}",
")",
"public",
"static",
"double",
"cot",
"(",
"double",
"angle",
")",
"{",
"return",
"1.",
"/",
"Math",
".",
"tan",
"(",
"ang... | Replies the cotangent of the specified angle.
<p><code>csc(a) = 1/tan(a)</code>
<p><img src="./doc-files/trigo1.png" alt="[Cotangent function]">
<img src="./doc-files/trigo3.png" alt="[Cotangent function]">
@param angle the angle.
@return the cotangent of the angle. | [
"Replies",
"the",
"cotangent",
"of",
"the",
"specified",
"angle",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/maths/mathgen/src/main/java/org/arakhne/afc/math/MathUtil.java#L809-L813 | train |
gallandarakhneorg/afc | core/maths/mathgen/src/main/java/org/arakhne/afc/math/MathUtil.java | MathUtil.versin | @Pure
@Inline(value = "1.-Math.cos($1)", imported = {Math.class})
public static double versin(double angle) {
return 1. - Math.cos(angle);
} | java | @Pure
@Inline(value = "1.-Math.cos($1)", imported = {Math.class})
public static double versin(double angle) {
return 1. - Math.cos(angle);
} | [
"@",
"Pure",
"@",
"Inline",
"(",
"value",
"=",
"\"1.-Math.cos($1)\"",
",",
"imported",
"=",
"{",
"Math",
".",
"class",
"}",
")",
"public",
"static",
"double",
"versin",
"(",
"double",
"angle",
")",
"{",
"return",
"1.",
"-",
"Math",
".",
"cos",
"(",
"... | Replies the versine of the specified angle.
<p><code>versin(a) = 1 - cos(a)</code>
<p><img src="./doc-files/trigo1.png" alt="[Versine function]">
@param angle the angle.
@return the versine of the angle. | [
"Replies",
"the",
"versine",
"of",
"the",
"specified",
"angle",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/maths/mathgen/src/main/java/org/arakhne/afc/math/MathUtil.java#L824-L828 | train |
gallandarakhneorg/afc | core/maths/mathgen/src/main/java/org/arakhne/afc/math/MathUtil.java | MathUtil.crd | @Pure
@Inline(value = "2.*Math.sin(($1)/2.)", imported = {Math.class})
public static double crd(double angle) {
return 2. * Math.sin(angle / 2.);
} | java | @Pure
@Inline(value = "2.*Math.sin(($1)/2.)", imported = {Math.class})
public static double crd(double angle) {
return 2. * Math.sin(angle / 2.);
} | [
"@",
"Pure",
"@",
"Inline",
"(",
"value",
"=",
"\"2.*Math.sin(($1)/2.)\"",
",",
"imported",
"=",
"{",
"Math",
".",
"class",
"}",
")",
"public",
"static",
"double",
"crd",
"(",
"double",
"angle",
")",
"{",
"return",
"2.",
"*",
"Math",
".",
"sin",
"(",
... | Replies the chord of the specified angle.
<p><code>crd(a) = 2 sin(a/2)</code>
<p><img src="./doc-files/chord.png" alt="[Chord function]">
@param angle the angle.
@return the chord of the angle. | [
"Replies",
"the",
"chord",
"of",
"the",
"specified",
"angle",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/maths/mathgen/src/main/java/org/arakhne/afc/math/MathUtil.java#L854-L858 | train |
gallandarakhneorg/afc | advanced/mathfx/src/main/java/org/arakhne/afc/math/geometry/d2/dfx/Point2dfx.java | Point2dfx.convert | public static Point2dfx convert(Tuple2D<?> tuple) {
if (tuple instanceof Point2dfx) {
return (Point2dfx) tuple;
}
return new Point2dfx(tuple.getX(), tuple.getY());
} | java | public static Point2dfx convert(Tuple2D<?> tuple) {
if (tuple instanceof Point2dfx) {
return (Point2dfx) tuple;
}
return new Point2dfx(tuple.getX(), tuple.getY());
} | [
"public",
"static",
"Point2dfx",
"convert",
"(",
"Tuple2D",
"<",
"?",
">",
"tuple",
")",
"{",
"if",
"(",
"tuple",
"instanceof",
"Point2dfx",
")",
"{",
"return",
"(",
"Point2dfx",
")",
"tuple",
";",
"}",
"return",
"new",
"Point2dfx",
"(",
"tuple",
".",
... | Convert the given tuple to a real Point2dfx.
<p>If the given tuple is already a Point2dfx, it is replied.
@param tuple the tuple.
@return the Point2dfx.
@since 14.0 | [
"Convert",
"the",
"given",
"tuple",
"to",
"a",
"real",
"Point2dfx",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/mathfx/src/main/java/org/arakhne/afc/math/geometry/d2/dfx/Point2dfx.java#L120-L125 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.