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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
BBN-E/bue-common-open | nlp-core-open/src/main/java/com/bbn/nlp/corpora/lightERE/EREEventMention.java | EREEventMention.typeFunction | public static Function<EREEventMention, TYPE> typeFunction() {
return new Function<EREEventMention, TYPE>() {
@Override
public TYPE apply(final EREEventMention input) {
return input.getType();
}
};
} | java | public static Function<EREEventMention, TYPE> typeFunction() {
return new Function<EREEventMention, TYPE>() {
@Override
public TYPE apply(final EREEventMention input) {
return input.getType();
}
};
} | [
"public",
"static",
"Function",
"<",
"EREEventMention",
",",
"TYPE",
">",
"typeFunction",
"(",
")",
"{",
"return",
"new",
"Function",
"<",
"EREEventMention",
",",
"TYPE",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"TYPE",
"apply",
"(",
"final",
"EREEve... | guava style functions | [
"guava",
"style",
"functions"
] | d618652674d647867306e2e4b987a21b7c29c015 | https://github.com/BBN-E/bue-common-open/blob/d618652674d647867306e2e4b987a21b7c29c015/nlp-core-open/src/main/java/com/bbn/nlp/corpora/lightERE/EREEventMention.java#L201-L208 | train |
lightblueseas/swing-components | src/main/java/de/alpharogroup/swing/browser/BrowserControlExtensions.java | BrowserControlExtensions.displayURLonStandardBrowser | public static Object displayURLonStandardBrowser(final Component parentComponent,
final String url)
{
Object obj = null;
try
{
if (System.getProperty(SYSTEM_PROPERTY_OS_NAME).startsWith(OS.MAC.getOs()))
{
obj = openURLinMacOS(url);
}
else if (System.getProperty(SYSTEM_PROPERTY_OS_NAME).startsWith(OS.WINDOWS.getOs()))
{
obj = openURLinWindowsOS(url);
}
else
{ // if operate syste is Unix or Linux
obj = openURLinUnixOS(url);
}
}
catch (final Exception e)
{
JOptionPane.showMessageDialog(parentComponent,
"An exception occured attempting to run the default web browser\n" + e.toString());
}
return obj;
} | java | public static Object displayURLonStandardBrowser(final Component parentComponent,
final String url)
{
Object obj = null;
try
{
if (System.getProperty(SYSTEM_PROPERTY_OS_NAME).startsWith(OS.MAC.getOs()))
{
obj = openURLinMacOS(url);
}
else if (System.getProperty(SYSTEM_PROPERTY_OS_NAME).startsWith(OS.WINDOWS.getOs()))
{
obj = openURLinWindowsOS(url);
}
else
{ // if operate syste is Unix or Linux
obj = openURLinUnixOS(url);
}
}
catch (final Exception e)
{
JOptionPane.showMessageDialog(parentComponent,
"An exception occured attempting to run the default web browser\n" + e.toString());
}
return obj;
} | [
"public",
"static",
"Object",
"displayURLonStandardBrowser",
"(",
"final",
"Component",
"parentComponent",
",",
"final",
"String",
"url",
")",
"{",
"Object",
"obj",
"=",
"null",
";",
"try",
"{",
"if",
"(",
"System",
".",
"getProperty",
"(",
"SYSTEM_PROPERTY_OS_N... | This method opens the specified url in the standard web-browser.
@param parentComponent
The parent component. Can be null.
@param url
An url like "http://www.yahoo.com/"
@return the object | [
"This",
"method",
"opens",
"the",
"specified",
"url",
"in",
"the",
"standard",
"web",
"-",
"browser",
"."
] | 4045e85cabd8f0ce985cbfff134c3c9873930c79 | https://github.com/lightblueseas/swing-components/blob/4045e85cabd8f0ce985cbfff134c3c9873930c79/src/main/java/de/alpharogroup/swing/browser/BrowserControlExtensions.java#L65-L90 | train |
lightblueseas/swing-components | src/main/java/de/alpharogroup/swing/browser/BrowserControlExtensions.java | BrowserControlExtensions.openURLinMacOS | private static Object openURLinMacOS(final String url) throws ClassNotFoundException,
NoSuchMethodException, IllegalAccessException, InvocationTargetException
{
final Class<?> fileManagerClass = Class.forName(MAC_FILE_MANAGER);
final Method openURL = fileManagerClass.getDeclaredMethod("openURL",
new Class[] { String.class });
return openURL.invoke(null, new Object[] { url });
} | java | private static Object openURLinMacOS(final String url) throws ClassNotFoundException,
NoSuchMethodException, IllegalAccessException, InvocationTargetException
{
final Class<?> fileManagerClass = Class.forName(MAC_FILE_MANAGER);
final Method openURL = fileManagerClass.getDeclaredMethod("openURL",
new Class[] { String.class });
return openURL.invoke(null, new Object[] { url });
} | [
"private",
"static",
"Object",
"openURLinMacOS",
"(",
"final",
"String",
"url",
")",
"throws",
"ClassNotFoundException",
",",
"NoSuchMethodException",
",",
"IllegalAccessException",
",",
"InvocationTargetException",
"{",
"final",
"Class",
"<",
"?",
">",
"fileManagerClas... | Opens the given URL in mac os.
@param url
the url
@return the object
@throws ClassNotFoundException
occurs if a given class cannot be located by the specified class loader
@throws NoSuchMethodException
is thrown if a matching method is not found
@throws IllegalAccessException
is thrown if this {@code Method} object is enforcing Java language access control
and the underlying method is inaccessible
@throws InvocationTargetException
is thrown if the underlying method throws an exception. | [
"Opens",
"the",
"given",
"URL",
"in",
"mac",
"os",
"."
] | 4045e85cabd8f0ce985cbfff134c3c9873930c79 | https://github.com/lightblueseas/swing-components/blob/4045e85cabd8f0ce985cbfff134c3c9873930c79/src/main/java/de/alpharogroup/swing/browser/BrowserControlExtensions.java#L110-L117 | train |
lightblueseas/swing-components | src/main/java/de/alpharogroup/swing/browser/BrowserControlExtensions.java | BrowserControlExtensions.openURLinUnixOS | private static Boolean openURLinUnixOS(final String url)
throws InterruptedException, IOException, Exception
{
Boolean executed = false;
for (final Browsers browser : Browsers.values())
{
if (!executed)
{
executed = Runtime.getRuntime()
.exec(new String[] { UNIX_COMMAND_WHICH, browser.getBrowserName() })
.waitFor() == 0;
if (executed)
{
Runtime.getRuntime().exec(new String[] { browser.getBrowserName(), url });
}
}
}
if (!executed)
{
throw new Exception(Arrays.toString(Browsers.values()));
}
return executed;
} | java | private static Boolean openURLinUnixOS(final String url)
throws InterruptedException, IOException, Exception
{
Boolean executed = false;
for (final Browsers browser : Browsers.values())
{
if (!executed)
{
executed = Runtime.getRuntime()
.exec(new String[] { UNIX_COMMAND_WHICH, browser.getBrowserName() })
.waitFor() == 0;
if (executed)
{
Runtime.getRuntime().exec(new String[] { browser.getBrowserName(), url });
}
}
}
if (!executed)
{
throw new Exception(Arrays.toString(Browsers.values()));
}
return executed;
} | [
"private",
"static",
"Boolean",
"openURLinUnixOS",
"(",
"final",
"String",
"url",
")",
"throws",
"InterruptedException",
",",
"IOException",
",",
"Exception",
"{",
"Boolean",
"executed",
"=",
"false",
";",
"for",
"(",
"final",
"Browsers",
"browser",
":",
"Browse... | Opens the given URL in unix os.
@param url
the url
@return the boolean
@throws InterruptedException
the interrupted exception
@throws IOException
Signals that an I/O exception has occurred.
@throws Exception
the exception | [
"Opens",
"the",
"given",
"URL",
"in",
"unix",
"os",
"."
] | 4045e85cabd8f0ce985cbfff134c3c9873930c79 | https://github.com/lightblueseas/swing-components/blob/4045e85cabd8f0ce985cbfff134c3c9873930c79/src/main/java/de/alpharogroup/swing/browser/BrowserControlExtensions.java#L134-L156 | train |
lightblueseas/swing-components | src/main/java/de/alpharogroup/swing/browser/BrowserControlExtensions.java | BrowserControlExtensions.openURLinWindowsOS | private static Process openURLinWindowsOS(final String url) throws IOException
{
String cmd = null;
cmd = WINDOWS_PATH + " " + WINDOWS_FLAG + " ";
return Runtime.getRuntime().exec(cmd + url);
} | java | private static Process openURLinWindowsOS(final String url) throws IOException
{
String cmd = null;
cmd = WINDOWS_PATH + " " + WINDOWS_FLAG + " ";
return Runtime.getRuntime().exec(cmd + url);
} | [
"private",
"static",
"Process",
"openURLinWindowsOS",
"(",
"final",
"String",
"url",
")",
"throws",
"IOException",
"{",
"String",
"cmd",
"=",
"null",
";",
"cmd",
"=",
"WINDOWS_PATH",
"+",
"\" \"",
"+",
"WINDOWS_FLAG",
"+",
"\" \"",
";",
"return",
"Runtime",
... | Opens the given URL in windows os.
@param url
the url
@return the process
@throws IOException
Signals that an I/O exception has occurred. | [
"Opens",
"the",
"given",
"URL",
"in",
"windows",
"os",
"."
] | 4045e85cabd8f0ce985cbfff134c3c9873930c79 | https://github.com/lightblueseas/swing-components/blob/4045e85cabd8f0ce985cbfff134c3c9873930c79/src/main/java/de/alpharogroup/swing/browser/BrowserControlExtensions.java#L169-L174 | train |
lightblueseas/swing-components | src/main/java/de/alpharogroup/swing/panels/tree/TreeElementPanel.java | TreeElementPanel.onInitializeGroupLayout | protected void onInitializeGroupLayout()
{
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup().addContainerGap()
.addComponent(scrTree, javax.swing.GroupLayout.PREFERRED_SIZE, 384,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));
layout.setVerticalGroup(layout
.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup().addContainerGap()
.addComponent(scrTree, javax.swing.GroupLayout.DEFAULT_SIZE, 536, Short.MAX_VALUE)
.addContainerGap()));
} | java | protected void onInitializeGroupLayout()
{
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup().addContainerGap()
.addComponent(scrTree, javax.swing.GroupLayout.PREFERRED_SIZE, 384,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));
layout.setVerticalGroup(layout
.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup().addContainerGap()
.addComponent(scrTree, javax.swing.GroupLayout.DEFAULT_SIZE, 536, Short.MAX_VALUE)
.addContainerGap()));
} | [
"protected",
"void",
"onInitializeGroupLayout",
"(",
")",
"{",
"javax",
".",
"swing",
".",
"GroupLayout",
"layout",
"=",
"new",
"javax",
".",
"swing",
".",
"GroupLayout",
"(",
"this",
")",
";",
"this",
".",
"setLayout",
"(",
"layout",
")",
";",
"layout",
... | On initialize group layout. | [
"On",
"initialize",
"group",
"layout",
"."
] | 4045e85cabd8f0ce985cbfff134c3c9873930c79 | https://github.com/lightblueseas/swing-components/blob/4045e85cabd8f0ce985cbfff134c3c9873930c79/src/main/java/de/alpharogroup/swing/panels/tree/TreeElementPanel.java#L81-L96 | train |
italiangrid/voms-clients | src/main/java/org/italiangrid/voms/clients/util/VersionProvider.java | VersionProvider.displayVersionInfo | public static void displayVersionInfo(String command) {
String version = ProxyInitStrategy.class.getPackage()
.getImplementationVersion();
if (version == null) {
version = "N/A";
}
System.out.format("%s v. %s (%s)\n", command, version,
getAPIVersionString());
} | java | public static void displayVersionInfo(String command) {
String version = ProxyInitStrategy.class.getPackage()
.getImplementationVersion();
if (version == null) {
version = "N/A";
}
System.out.format("%s v. %s (%s)\n", command, version,
getAPIVersionString());
} | [
"public",
"static",
"void",
"displayVersionInfo",
"(",
"String",
"command",
")",
"{",
"String",
"version",
"=",
"ProxyInitStrategy",
".",
"class",
".",
"getPackage",
"(",
")",
".",
"getImplementationVersion",
"(",
")",
";",
"if",
"(",
"version",
"==",
"null",
... | Display version information.
@param command
a command string | [
"Display",
"version",
"information",
"."
] | 069cbe324c85286fa454bd78c3f76c23e97e5768 | https://github.com/italiangrid/voms-clients/blob/069cbe324c85286fa454bd78c3f76c23e97e5768/src/main/java/org/italiangrid/voms/clients/util/VersionProvider.java#L42-L53 | train |
gallandarakhneorg/afc | core/maths/mathgeom/tobeincluded/src/d3/continuous/AbstractOrientedBox3F.java | AbstractOrientedBox3F.intersectsOrientedBoxCapsule | @Pure
public static boolean intersectsOrientedBoxCapsule(
double centerx,double centery,double centerz,
double axis1x, double axis1y, double axis1z,
double axis2x, double axis2y, double axis2z,
double axis3x, double axis3y, double axis3z,
double extentAxis1, double extentAxis2, double extentAxis3,
double capsule1Ax, double capsule1Ay, double capsule1Az, double capsule1Bx, double capsule1By, double capsule1Bz, double capsule1Radius) {
Point3f closestFromA = new Point3f();
Point3f closestFromB = new Point3f();
computeClosestFarestOBBPoints(
capsule1Ax, capsule1Ay, capsule1Az,
centerx, centery, centerz,
axis1x, axis1y, axis1z,
axis2x, axis2y, axis2z,
axis3x, axis3y, axis3z,
extentAxis1, extentAxis2, extentAxis3,
closestFromA, null);
computeClosestFarestOBBPoints(
capsule1Bx, capsule1By, capsule1Bz,
centerx, centery, centerz,
axis1x, axis1y, axis1z,
axis2x, axis2y, axis2z,
axis3x, axis3y, axis3z,
extentAxis1, extentAxis2, extentAxis3,
closestFromB,null);
double distance = AbstractSegment3F.distanceSquaredSegmentSegment(
capsule1Ax, capsule1Ay, capsule1Az,
capsule1Bx, capsule1By, capsule1Bz,
closestFromA.getX(), closestFromA.getY(), closestFromA.getZ(),
closestFromB.getX(), closestFromB.getY(), closestFromB.getZ());
return (distance <= (capsule1Radius * capsule1Radius));
} | java | @Pure
public static boolean intersectsOrientedBoxCapsule(
double centerx,double centery,double centerz,
double axis1x, double axis1y, double axis1z,
double axis2x, double axis2y, double axis2z,
double axis3x, double axis3y, double axis3z,
double extentAxis1, double extentAxis2, double extentAxis3,
double capsule1Ax, double capsule1Ay, double capsule1Az, double capsule1Bx, double capsule1By, double capsule1Bz, double capsule1Radius) {
Point3f closestFromA = new Point3f();
Point3f closestFromB = new Point3f();
computeClosestFarestOBBPoints(
capsule1Ax, capsule1Ay, capsule1Az,
centerx, centery, centerz,
axis1x, axis1y, axis1z,
axis2x, axis2y, axis2z,
axis3x, axis3y, axis3z,
extentAxis1, extentAxis2, extentAxis3,
closestFromA, null);
computeClosestFarestOBBPoints(
capsule1Bx, capsule1By, capsule1Bz,
centerx, centery, centerz,
axis1x, axis1y, axis1z,
axis2x, axis2y, axis2z,
axis3x, axis3y, axis3z,
extentAxis1, extentAxis2, extentAxis3,
closestFromB,null);
double distance = AbstractSegment3F.distanceSquaredSegmentSegment(
capsule1Ax, capsule1Ay, capsule1Az,
capsule1Bx, capsule1By, capsule1Bz,
closestFromA.getX(), closestFromA.getY(), closestFromA.getZ(),
closestFromB.getX(), closestFromB.getY(), closestFromB.getZ());
return (distance <= (capsule1Radius * capsule1Radius));
} | [
"@",
"Pure",
"public",
"static",
"boolean",
"intersectsOrientedBoxCapsule",
"(",
"double",
"centerx",
",",
"double",
"centery",
",",
"double",
"centerz",
",",
"double",
"axis1x",
",",
"double",
"axis1y",
",",
"double",
"axis1z",
",",
"double",
"axis2x",
",",
"... | Compute intersection between an OBB and a capsule.
@param centerx is the center point of the oriented box.
@param centery is the center point of the oriented box.
@param centerz is the center point of the oriented box.
@param axis1x are the unit vectors of the oriented box axis.
@param axis1y are the unit vectors of the oriented box axis.
@param axis1z are the unit vectors of the oriented box axis.
@param axis2x are the unit vectors of the oriented box axis.
@param axis2y are the unit vectors of the oriented box axis.
@param axis2z are the unit vectors of the oriented box axis.
@param axis3x are the unit vectors of the oriented box axis.
@param axis3y are the unit vectors of the oriented box axis.
@param axis3z are the unit vectors of the oriented box axis.
@param extentAxis1 are the sizes of the oriented box.
@param extentAxis2 are the sizes of the oriented box.
@param extentAxis3 are the sizes of the oriented box.
@param capsule1Ax x coordinate of the first point of the capsule medial line.
@param capsule1Ay y coordinate of the first point of the capsule medial line.
@param capsule1Az z coordinate of the first point of the capsule medial line.
@param capsule1Bx x coordinate of the second point of the capsule medial line.
@param capsule1By y coordinate of the second point of the capsule medial line.
@param capsule1Bz z coordinate of the second point of the capsule medial line.
@param capsule1Radius - capsule radius
@return <code>true</code> if intersecting, otherwise <code>false</code> | [
"Compute",
"intersection",
"between",
"an",
"OBB",
"and",
"a",
"capsule",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/maths/mathgeom/tobeincluded/src/d3/continuous/AbstractOrientedBox3F.java#L81-L117 | train |
gallandarakhneorg/afc | core/maths/mathgeom/tobeincluded/src/d3/continuous/AbstractOrientedBox3F.java | AbstractOrientedBox3F.setFromPointCloud | public void setFromPointCloud(Iterable<? extends Point3D> pointCloud) {
Vector3f r = new Vector3f();
Vector3f s = new Vector3f();
Vector3f t = new Vector3f();
Point3f c = new Point3f();
double[] extents = new double[3];
computeOBBCenterAxisExtents(
pointCloud,
r, s, t,
c,
extents);
set(c.getX(), c.getY(), c.getZ(),
r.getX(), r.getY(), r.getZ(),
s.getX(), s.getY(), s.getZ(),
extents[0], extents[1], extents[2]);
} | java | public void setFromPointCloud(Iterable<? extends Point3D> pointCloud) {
Vector3f r = new Vector3f();
Vector3f s = new Vector3f();
Vector3f t = new Vector3f();
Point3f c = new Point3f();
double[] extents = new double[3];
computeOBBCenterAxisExtents(
pointCloud,
r, s, t,
c,
extents);
set(c.getX(), c.getY(), c.getZ(),
r.getX(), r.getY(), r.getZ(),
s.getX(), s.getY(), s.getZ(),
extents[0], extents[1], extents[2]);
} | [
"public",
"void",
"setFromPointCloud",
"(",
"Iterable",
"<",
"?",
"extends",
"Point3D",
">",
"pointCloud",
")",
"{",
"Vector3f",
"r",
"=",
"new",
"Vector3f",
"(",
")",
";",
"Vector3f",
"s",
"=",
"new",
"Vector3f",
"(",
")",
";",
"Vector3f",
"t",
"=",
"... | Set the oriented box from a could of points.
@param pointCloud - the cloud of points. | [
"Set",
"the",
"oriented",
"box",
"from",
"a",
"could",
"of",
"points",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/maths/mathgeom/tobeincluded/src/d3/continuous/AbstractOrientedBox3F.java#L1048-L1063 | train |
gallandarakhneorg/afc | core/maths/mathgeom/tobeincluded/src/d3/continuous/AbstractOrientedBox3F.java | AbstractOrientedBox3F.rotate | public void rotate(Quaternion rotation) {
Transform3D m = new Transform3D();
m.transform(this.getFirstAxis());
m.transform(this.getSecondAxis());
m.transform(this.getThirdAxis());
this.setFirstAxisExtent(this.getFirstAxis().length());
this.setSecondAxisExtent(this.getSecondAxis().length());
this.setThirdAxisExtent(this.getThirdAxis().length());
this.getFirstAxis().normalize();
this.getSecondAxis().normalize();
this.getThirdAxis().normalize();
} | java | public void rotate(Quaternion rotation) {
Transform3D m = new Transform3D();
m.transform(this.getFirstAxis());
m.transform(this.getSecondAxis());
m.transform(this.getThirdAxis());
this.setFirstAxisExtent(this.getFirstAxis().length());
this.setSecondAxisExtent(this.getSecondAxis().length());
this.setThirdAxisExtent(this.getThirdAxis().length());
this.getFirstAxis().normalize();
this.getSecondAxis().normalize();
this.getThirdAxis().normalize();
} | [
"public",
"void",
"rotate",
"(",
"Quaternion",
"rotation",
")",
"{",
"Transform3D",
"m",
"=",
"new",
"Transform3D",
"(",
")",
";",
"m",
".",
"transform",
"(",
"this",
".",
"getFirstAxis",
"(",
")",
")",
";",
"m",
".",
"transform",
"(",
"this",
".",
"... | Rotate the box around its pivot point.
The pivot point is the center of the box.
@param rotation the rotation. | [
"Rotate",
"the",
"box",
"around",
"its",
"pivot",
"point",
".",
"The",
"pivot",
"point",
"is",
"the",
"center",
"of",
"the",
"box",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/maths/mathgeom/tobeincluded/src/d3/continuous/AbstractOrientedBox3F.java#L1367-L1378 | train |
gallandarakhneorg/afc | core/maths/mathgeom/tobeincluded/src/d3/continuous/AbstractOrientedBox3F.java | AbstractOrientedBox3F.rotate | public void rotate(Quaternion rotation, Point3D pivot) {
if (pivot!=null) {
// Change the center
Transform3D m1 = new Transform3D();
m1.setTranslation(-pivot.getX(), -pivot.getY(), -pivot.getZ());
Transform3D m2 = new Transform3D();
m2.setRotation(rotation);
Transform3D m3 = new Transform3D();
m3.setTranslation(pivot.getX(), pivot.getY(), pivot.getZ());
Transform3D r = new Transform3D();
r.mul(m1, m2);
r.mul(m3);
r.transform(this.getCenter());
}
rotate(rotation);
} | java | public void rotate(Quaternion rotation, Point3D pivot) {
if (pivot!=null) {
// Change the center
Transform3D m1 = new Transform3D();
m1.setTranslation(-pivot.getX(), -pivot.getY(), -pivot.getZ());
Transform3D m2 = new Transform3D();
m2.setRotation(rotation);
Transform3D m3 = new Transform3D();
m3.setTranslation(pivot.getX(), pivot.getY(), pivot.getZ());
Transform3D r = new Transform3D();
r.mul(m1, m2);
r.mul(m3);
r.transform(this.getCenter());
}
rotate(rotation);
} | [
"public",
"void",
"rotate",
"(",
"Quaternion",
"rotation",
",",
"Point3D",
"pivot",
")",
"{",
"if",
"(",
"pivot",
"!=",
"null",
")",
"{",
"// Change the center",
"Transform3D",
"m1",
"=",
"new",
"Transform3D",
"(",
")",
";",
"m1",
".",
"setTranslation",
"(... | Rotate the box around a given pivot point.
The default pivot point of the center of the box.
@param rotation the rotation.
@param pivot the pivot point. If <code>null</code> the default pivot point is used. | [
"Rotate",
"the",
"box",
"around",
"a",
"given",
"pivot",
"point",
".",
"The",
"default",
"pivot",
"point",
"of",
"the",
"center",
"of",
"the",
"box",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/maths/mathgeom/tobeincluded/src/d3/continuous/AbstractOrientedBox3F.java#L1386-L1402 | train |
gallandarakhneorg/afc | advanced/gis/giscorefx/src/main/java/org/arakhne/afc/gis/ui/drawers/AbstractMapPolylineDrawer.java | AbstractMapPolylineDrawer.definePath | protected void definePath(ZoomableGraphicsContext gc, T element) {
gc.beginPath();
final PathIterator2afp<PathElement2d> pathIterator = element.toPath2D().getPathIterator();
switch (pathIterator.getWindingRule()) {
case EVEN_ODD:
gc.setFillRule(FillRule.EVEN_ODD);
break;
case NON_ZERO:
gc.setFillRule(FillRule.NON_ZERO);
break;
default:
throw new IllegalStateException();
}
while (pathIterator.hasNext()) {
final PathElement2d pelement = pathIterator.next();
switch (pelement.getType()) {
case LINE_TO:
gc.lineTo(pelement.getToX(), pelement.getToY());
break;
case MOVE_TO:
gc.moveTo(pelement.getToX(), pelement.getToY());
break;
case CLOSE:
gc.closePath();
break;
case CURVE_TO:
gc.bezierCurveTo(
pelement.getCtrlX1(), pelement.getCtrlY1(),
pelement.getCtrlX2(), pelement.getCtrlY2(),
pelement.getToX(), pelement.getToY());
break;
case QUAD_TO:
gc.quadraticCurveTo(
pelement.getCtrlX1(), pelement.getCtrlY1(),
pelement.getToX(), pelement.getToY());
break;
case ARC_TO:
//TODO: implements arcTo
gc.lineTo(pelement.getToX(), pelement.getToY());
break;
default:
break;
}
}
} | java | protected void definePath(ZoomableGraphicsContext gc, T element) {
gc.beginPath();
final PathIterator2afp<PathElement2d> pathIterator = element.toPath2D().getPathIterator();
switch (pathIterator.getWindingRule()) {
case EVEN_ODD:
gc.setFillRule(FillRule.EVEN_ODD);
break;
case NON_ZERO:
gc.setFillRule(FillRule.NON_ZERO);
break;
default:
throw new IllegalStateException();
}
while (pathIterator.hasNext()) {
final PathElement2d pelement = pathIterator.next();
switch (pelement.getType()) {
case LINE_TO:
gc.lineTo(pelement.getToX(), pelement.getToY());
break;
case MOVE_TO:
gc.moveTo(pelement.getToX(), pelement.getToY());
break;
case CLOSE:
gc.closePath();
break;
case CURVE_TO:
gc.bezierCurveTo(
pelement.getCtrlX1(), pelement.getCtrlY1(),
pelement.getCtrlX2(), pelement.getCtrlY2(),
pelement.getToX(), pelement.getToY());
break;
case QUAD_TO:
gc.quadraticCurveTo(
pelement.getCtrlX1(), pelement.getCtrlY1(),
pelement.getToX(), pelement.getToY());
break;
case ARC_TO:
//TODO: implements arcTo
gc.lineTo(pelement.getToX(), pelement.getToY());
break;
default:
break;
}
}
} | [
"protected",
"void",
"definePath",
"(",
"ZoomableGraphicsContext",
"gc",
",",
"T",
"element",
")",
"{",
"gc",
".",
"beginPath",
"(",
")",
";",
"final",
"PathIterator2afp",
"<",
"PathElement2d",
">",
"pathIterator",
"=",
"element",
".",
"toPath2D",
"(",
")",
... | Draw the polyline path.
@param gc the graphics context that must be used for drawing.
@param element the map element. | [
"Draw",
"the",
"polyline",
"path",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/giscorefx/src/main/java/org/arakhne/afc/gis/ui/drawers/AbstractMapPolylineDrawer.java#L46-L90 | train |
gallandarakhneorg/afc | advanced/gis/gisbus/src/main/java/org/arakhne/afc/gis/bus/network/BusStop.java | BusStop.getFirstFreeBusStopName | @Pure
public static String getFirstFreeBusStopName(BusNetwork busNetwork) {
if (busNetwork == null) {
return null;
}
int nb = busNetwork.getBusStopCount();
String name;
do {
++nb;
name = Locale.getString("NAME_TEMPLATE", Integer.toString(nb)); //$NON-NLS-1$
}
while (busNetwork.getBusStop(name) != null);
return name;
} | java | @Pure
public static String getFirstFreeBusStopName(BusNetwork busNetwork) {
if (busNetwork == null) {
return null;
}
int nb = busNetwork.getBusStopCount();
String name;
do {
++nb;
name = Locale.getString("NAME_TEMPLATE", Integer.toString(nb)); //$NON-NLS-1$
}
while (busNetwork.getBusStop(name) != null);
return name;
} | [
"@",
"Pure",
"public",
"static",
"String",
"getFirstFreeBusStopName",
"(",
"BusNetwork",
"busNetwork",
")",
"{",
"if",
"(",
"busNetwork",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"int",
"nb",
"=",
"busNetwork",
".",
"getBusStopCount",
"(",
")",
... | Replies a bus stop name that was not exist in the specified
bus network.
@param busNetwork is the bus network for which a free bus stop name may be computed.
@return a name suitable for bus stop. | [
"Replies",
"a",
"bus",
"stop",
"name",
"that",
"was",
"not",
"exist",
"in",
"the",
"specified",
"bus",
"network",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/gisbus/src/main/java/org/arakhne/afc/gis/bus/network/BusStop.java#L182-L195 | train |
gallandarakhneorg/afc | advanced/gis/gisbus/src/main/java/org/arakhne/afc/gis/bus/network/BusStop.java | BusStop.notifyDependencies | private void notifyDependencies() {
if (getContainer() != null) {
for (final BusHub hub : busHubs()) {
hub.checkPrimitiveValidity();
}
for (final BusItineraryHalt halt : getBindedBusHalts()) {
halt.checkPrimitiveValidity();
}
}
} | java | private void notifyDependencies() {
if (getContainer() != null) {
for (final BusHub hub : busHubs()) {
hub.checkPrimitiveValidity();
}
for (final BusItineraryHalt halt : getBindedBusHalts()) {
halt.checkPrimitiveValidity();
}
}
} | [
"private",
"void",
"notifyDependencies",
"(",
")",
"{",
"if",
"(",
"getContainer",
"(",
")",
"!=",
"null",
")",
"{",
"for",
"(",
"final",
"BusHub",
"hub",
":",
"busHubs",
"(",
")",
")",
"{",
"hub",
".",
"checkPrimitiveValidity",
"(",
")",
";",
"}",
"... | Notifies any dependent object about a validation change from
this bus stop. | [
"Notifies",
"any",
"dependent",
"object",
"about",
"a",
"validation",
"change",
"from",
"this",
"bus",
"stop",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/gisbus/src/main/java/org/arakhne/afc/gis/bus/network/BusStop.java#L237-L246 | train |
gallandarakhneorg/afc | advanced/gis/gisbus/src/main/java/org/arakhne/afc/gis/bus/network/BusStop.java | BusStop.setPosition | public void setPosition(GeoLocationPoint position) {
if ((this.position == null && position != null)
|| (this.position != null && !this.position.equals(position))) {
this.position = position;
fireShapeChanged();
checkPrimitiveValidity();
}
} | java | public void setPosition(GeoLocationPoint position) {
if ((this.position == null && position != null)
|| (this.position != null && !this.position.equals(position))) {
this.position = position;
fireShapeChanged();
checkPrimitiveValidity();
}
} | [
"public",
"void",
"setPosition",
"(",
"GeoLocationPoint",
"position",
")",
"{",
"if",
"(",
"(",
"this",
".",
"position",
"==",
"null",
"&&",
"position",
"!=",
"null",
")",
"||",
"(",
"this",
".",
"position",
"!=",
"null",
"&&",
"!",
"this",
".",
"posit... | Set the position of the element.
@param position the position. | [
"Set",
"the",
"position",
"of",
"the",
"element",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/gisbus/src/main/java/org/arakhne/afc/gis/bus/network/BusStop.java#L291-L298 | train |
gallandarakhneorg/afc | advanced/gis/gisbus/src/main/java/org/arakhne/afc/gis/bus/network/BusStop.java | BusStop.distance | @Pure
public double distance(double x, double y) {
if (isValidPrimitive()) {
final GeoLocationPoint p = getGeoPosition();
return Point2D.getDistancePointPoint(p.getX(), p.getY(), x, y);
}
return Double.NaN;
} | java | @Pure
public double distance(double x, double y) {
if (isValidPrimitive()) {
final GeoLocationPoint p = getGeoPosition();
return Point2D.getDistancePointPoint(p.getX(), p.getY(), x, y);
}
return Double.NaN;
} | [
"@",
"Pure",
"public",
"double",
"distance",
"(",
"double",
"x",
",",
"double",
"y",
")",
"{",
"if",
"(",
"isValidPrimitive",
"(",
")",
")",
"{",
"final",
"GeoLocationPoint",
"p",
"=",
"getGeoPosition",
"(",
")",
";",
"return",
"Point2D",
".",
"getDistan... | Replies the distance between the given point and this bus stop.
@param x x coordinate.
@param y y coordinate.
@return the distance to this bus stop | [
"Replies",
"the",
"distance",
"between",
"the",
"given",
"point",
"and",
"this",
"bus",
"stop",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/gisbus/src/main/java/org/arakhne/afc/gis/bus/network/BusStop.java#L370-L377 | train |
gallandarakhneorg/afc | advanced/gis/gisbus/src/main/java/org/arakhne/afc/gis/bus/network/BusStop.java | BusStop.distance | @Pure
public double distance(BusStop stop) {
if (isValidPrimitive() && stop.isValidPrimitive()) {
final GeoLocationPoint p = getGeoPosition();
final GeoLocationPoint p2 = stop.getGeoPosition();
return Point2D.getDistancePointPoint(p.getX(), p.getY(), p2.getX(), p2.getY());
}
return Double.NaN;
} | java | @Pure
public double distance(BusStop stop) {
if (isValidPrimitive() && stop.isValidPrimitive()) {
final GeoLocationPoint p = getGeoPosition();
final GeoLocationPoint p2 = stop.getGeoPosition();
return Point2D.getDistancePointPoint(p.getX(), p.getY(), p2.getX(), p2.getY());
}
return Double.NaN;
} | [
"@",
"Pure",
"public",
"double",
"distance",
"(",
"BusStop",
"stop",
")",
"{",
"if",
"(",
"isValidPrimitive",
"(",
")",
"&&",
"stop",
".",
"isValidPrimitive",
"(",
")",
")",
"{",
"final",
"GeoLocationPoint",
"p",
"=",
"getGeoPosition",
"(",
")",
";",
"fi... | Replies the distance between the given bus stop and this bus stop.
@param stop the stop.
@return the distance to this bus stop | [
"Replies",
"the",
"distance",
"between",
"the",
"given",
"bus",
"stop",
"and",
"this",
"bus",
"stop",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/gisbus/src/main/java/org/arakhne/afc/gis/bus/network/BusStop.java#L384-L392 | train |
gallandarakhneorg/afc | advanced/gis/gisbus/src/main/java/org/arakhne/afc/gis/bus/network/BusStop.java | BusStop.addBusHub | void addBusHub(BusHub hub) {
if (this.hubs == null) {
this.hubs = new WeakArrayList<>();
}
this.hubs.add(hub);
} | java | void addBusHub(BusHub hub) {
if (this.hubs == null) {
this.hubs = new WeakArrayList<>();
}
this.hubs.add(hub);
} | [
"void",
"addBusHub",
"(",
"BusHub",
"hub",
")",
"{",
"if",
"(",
"this",
".",
"hubs",
"==",
"null",
")",
"{",
"this",
".",
"hubs",
"=",
"new",
"WeakArrayList",
"<>",
"(",
")",
";",
"}",
"this",
".",
"hubs",
".",
"add",
"(",
"hub",
")",
";",
"}"
... | Add a hub reference.
@param hub the hub. | [
"Add",
"a",
"hub",
"reference",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/gisbus/src/main/java/org/arakhne/afc/gis/bus/network/BusStop.java#L445-L450 | train |
gallandarakhneorg/afc | advanced/gis/gisbus/src/main/java/org/arakhne/afc/gis/bus/network/BusStop.java | BusStop.removeBusHub | void removeBusHub(BusHub hub) {
if (this.hubs != null) {
this.hubs.remove(hub);
if (this.hubs.isEmpty()) {
this.hubs = null;
}
}
} | java | void removeBusHub(BusHub hub) {
if (this.hubs != null) {
this.hubs.remove(hub);
if (this.hubs.isEmpty()) {
this.hubs = null;
}
}
} | [
"void",
"removeBusHub",
"(",
"BusHub",
"hub",
")",
"{",
"if",
"(",
"this",
".",
"hubs",
"!=",
"null",
")",
"{",
"this",
".",
"hubs",
".",
"remove",
"(",
"hub",
")",
";",
"if",
"(",
"this",
".",
"hubs",
".",
"isEmpty",
"(",
")",
")",
"{",
"this"... | Remove a hub reference.
@param hub the hub. | [
"Remove",
"a",
"hub",
"reference",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/gisbus/src/main/java/org/arakhne/afc/gis/bus/network/BusStop.java#L456-L463 | train |
gallandarakhneorg/afc | advanced/gis/gisbus/src/main/java/org/arakhne/afc/gis/bus/network/BusStop.java | BusStop.addBusHalt | void addBusHalt(BusItineraryHalt halt) {
if (this.halts == null) {
this.halts = new WeakArrayList<>();
}
this.halts.add(halt);
} | java | void addBusHalt(BusItineraryHalt halt) {
if (this.halts == null) {
this.halts = new WeakArrayList<>();
}
this.halts.add(halt);
} | [
"void",
"addBusHalt",
"(",
"BusItineraryHalt",
"halt",
")",
"{",
"if",
"(",
"this",
".",
"halts",
"==",
"null",
")",
"{",
"this",
".",
"halts",
"=",
"new",
"WeakArrayList",
"<>",
"(",
")",
";",
"}",
"this",
".",
"halts",
".",
"add",
"(",
"halt",
")... | Add a bus halt reference.
@param halt the halt. | [
"Add",
"a",
"bus",
"halt",
"reference",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/gisbus/src/main/java/org/arakhne/afc/gis/bus/network/BusStop.java#L507-L512 | train |
gallandarakhneorg/afc | advanced/gis/gisbus/src/main/java/org/arakhne/afc/gis/bus/network/BusStop.java | BusStop.removeBusHalt | void removeBusHalt(BusItineraryHalt halt) {
if (this.halts != null) {
this.halts.remove(halt);
if (this.halts.isEmpty()) {
this.halts = null;
}
}
} | java | void removeBusHalt(BusItineraryHalt halt) {
if (this.halts != null) {
this.halts.remove(halt);
if (this.halts.isEmpty()) {
this.halts = null;
}
}
} | [
"void",
"removeBusHalt",
"(",
"BusItineraryHalt",
"halt",
")",
"{",
"if",
"(",
"this",
".",
"halts",
"!=",
"null",
")",
"{",
"this",
".",
"halts",
".",
"remove",
"(",
"halt",
")",
";",
"if",
"(",
"this",
".",
"halts",
".",
"isEmpty",
"(",
")",
")",... | Remove a bus halt reference.
@param halt the halt. | [
"Remove",
"a",
"bus",
"halt",
"reference",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/gisbus/src/main/java/org/arakhne/afc/gis/bus/network/BusStop.java#L518-L525 | train |
gallandarakhneorg/afc | advanced/gis/gisbus/src/main/java/org/arakhne/afc/gis/bus/network/BusStop.java | BusStop.getBindedBusHalts | @Pure
public Iterable<BusItineraryHalt> getBindedBusHalts() {
if (this.halts == null) {
return Collections.emptyList();
}
return Collections.unmodifiableCollection(this.halts);
} | java | @Pure
public Iterable<BusItineraryHalt> getBindedBusHalts() {
if (this.halts == null) {
return Collections.emptyList();
}
return Collections.unmodifiableCollection(this.halts);
} | [
"@",
"Pure",
"public",
"Iterable",
"<",
"BusItineraryHalt",
">",
"getBindedBusHalts",
"(",
")",
"{",
"if",
"(",
"this",
".",
"halts",
"==",
"null",
")",
"{",
"return",
"Collections",
".",
"emptyList",
"(",
")",
";",
"}",
"return",
"Collections",
".",
"un... | Replies the bus itinerary halts associated to this bus stop.
@return the bus itinerary halts. | [
"Replies",
"the",
"bus",
"itinerary",
"halts",
"associated",
"to",
"this",
"bus",
"stop",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/gisbus/src/main/java/org/arakhne/afc/gis/bus/network/BusStop.java#L547-L553 | train |
gallandarakhneorg/afc | advanced/mathfx/src/main/java/org/arakhne/afc/math/geometry/d2/ifx/Vector2ifx.java | Vector2ifx.convert | public static Vector2ifx convert(Tuple2D<?> tuple) {
if (tuple instanceof Vector2ifx) {
return (Vector2ifx) tuple;
}
return new Vector2ifx(tuple.getX(), tuple.getY());
} | java | public static Vector2ifx convert(Tuple2D<?> tuple) {
if (tuple instanceof Vector2ifx) {
return (Vector2ifx) tuple;
}
return new Vector2ifx(tuple.getX(), tuple.getY());
} | [
"public",
"static",
"Vector2ifx",
"convert",
"(",
"Tuple2D",
"<",
"?",
">",
"tuple",
")",
"{",
"if",
"(",
"tuple",
"instanceof",
"Vector2ifx",
")",
"{",
"return",
"(",
"Vector2ifx",
")",
"tuple",
";",
"}",
"return",
"new",
"Vector2ifx",
"(",
"tuple",
"."... | Convert the given tuple to a real Vector2ifx.
<p>If the given tuple is already a Vector2ifx, it is replied.
@param tuple the tuple.
@return the Vector2ifx.
@since 14.0 | [
"Convert",
"the",
"given",
"tuple",
"to",
"a",
"real",
"Vector2ifx",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/mathfx/src/main/java/org/arakhne/afc/math/geometry/d2/ifx/Vector2ifx.java#L132-L137 | train |
gallandarakhneorg/afc | advanced/attributes/src/main/java/org/arakhne/afc/attrs/attr/AttributeImpl.java | AttributeImpl.compareAttrs | @Pure
public static int compareAttrs(Attribute arg0, Attribute arg1) {
if (arg0 == arg1) {
return 0;
}
if (arg0 == null) {
return 1;
}
if (arg1 == null) {
return -1;
}
final String n0 = arg0.getName();
final String n1 = arg1.getName();
final int cmp = compareAttrNames(n0, n1);
if (cmp == 0) {
return compareValues(arg0, arg1);
}
return cmp;
} | java | @Pure
public static int compareAttrs(Attribute arg0, Attribute arg1) {
if (arg0 == arg1) {
return 0;
}
if (arg0 == null) {
return 1;
}
if (arg1 == null) {
return -1;
}
final String n0 = arg0.getName();
final String n1 = arg1.getName();
final int cmp = compareAttrNames(n0, n1);
if (cmp == 0) {
return compareValues(arg0, arg1);
}
return cmp;
} | [
"@",
"Pure",
"public",
"static",
"int",
"compareAttrs",
"(",
"Attribute",
"arg0",
",",
"Attribute",
"arg1",
")",
"{",
"if",
"(",
"arg0",
"==",
"arg1",
")",
"{",
"return",
"0",
";",
"}",
"if",
"(",
"arg0",
"==",
"null",
")",
"{",
"return",
"1",
";",... | Compare the two specified attributes.
@param arg0 first attribute
@param arg1 second attribute.
@return replies a negative value if {@code arg0} is lesser than
{@code arg1}, a positive value if {@code arg0} is greater than
{@code arg1}, or <code>0</code> if they are equal.
@see AttributeComparator | [
"Compare",
"the",
"two",
"specified",
"attributes",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/attributes/src/main/java/org/arakhne/afc/attrs/attr/AttributeImpl.java#L344-L365 | train |
gallandarakhneorg/afc | advanced/attributes/src/main/java/org/arakhne/afc/attrs/attr/AttributeImpl.java | AttributeImpl.compareAttrNames | @Pure
public static int compareAttrNames(String arg0, String arg1) {
if (arg0 == arg1) {
return 0;
}
if (arg0 == null) {
return Integer.MAX_VALUE;
}
if (arg1 == null) {
return Integer.MIN_VALUE;
}
return arg0.compareToIgnoreCase(arg1);
} | java | @Pure
public static int compareAttrNames(String arg0, String arg1) {
if (arg0 == arg1) {
return 0;
}
if (arg0 == null) {
return Integer.MAX_VALUE;
}
if (arg1 == null) {
return Integer.MIN_VALUE;
}
return arg0.compareToIgnoreCase(arg1);
} | [
"@",
"Pure",
"public",
"static",
"int",
"compareAttrNames",
"(",
"String",
"arg0",
",",
"String",
"arg1",
")",
"{",
"if",
"(",
"arg0",
"==",
"arg1",
")",
"{",
"return",
"0",
";",
"}",
"if",
"(",
"arg0",
"==",
"null",
")",
"{",
"return",
"Integer",
... | Compare the two specified attribute names.
@param arg0 first attribute.
@param arg1 second attribute.
@return replies a negative value if {@code arg0} is lesser than
{@code arg1}, a positive value if {@code arg0} is greater than
{@code arg1}, or <code>0</code> if they are equal.
@see AttributeNameComparator | [
"Compare",
"the",
"two",
"specified",
"attribute",
"names",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/attributes/src/main/java/org/arakhne/afc/attrs/attr/AttributeImpl.java#L376-L388 | train |
gallandarakhneorg/afc | advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/maplayer/MapLayerAttributeChangeEvent.java | MapLayerAttributeChangeEvent.isTemporaryChange | @Pure
public boolean isTemporaryChange() {
final Object src = getSource();
if (src instanceof MapLayer) {
return ((MapLayer) src).isTemporaryLayer();
}
return false;
} | java | @Pure
public boolean isTemporaryChange() {
final Object src = getSource();
if (src instanceof MapLayer) {
return ((MapLayer) src).isTemporaryLayer();
}
return false;
} | [
"@",
"Pure",
"public",
"boolean",
"isTemporaryChange",
"(",
")",
"{",
"final",
"Object",
"src",
"=",
"getSource",
"(",
")",
";",
"if",
"(",
"src",
"instanceof",
"MapLayer",
")",
"{",
"return",
"(",
"(",
"MapLayer",
")",
"src",
")",
".",
"isTemporaryLayer... | Replies if the change in the layer was marked as temporary.
The usage of this information depends on the listener's behaviour.
@return <code>true</code> if the change is temporary,
otherwise <code>false</code> | [
"Replies",
"if",
"the",
"change",
"in",
"the",
"layer",
"was",
"marked",
"as",
"temporary",
".",
"The",
"usage",
"of",
"this",
"information",
"depends",
"on",
"the",
"listener",
"s",
"behaviour",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/maplayer/MapLayerAttributeChangeEvent.java#L132-L139 | train |
gallandarakhneorg/afc | core/maths/mathgraph/src/main/java/org/arakhne/afc/math/graph/SubGraph.java | SubGraph.getParentGraph | @Pure
protected final Graph<ST, PT> getParentGraph() {
return this.parentGraph == null ? null : this.parentGraph.get();
} | java | @Pure
protected final Graph<ST, PT> getParentGraph() {
return this.parentGraph == null ? null : this.parentGraph.get();
} | [
"@",
"Pure",
"protected",
"final",
"Graph",
"<",
"ST",
",",
"PT",
">",
"getParentGraph",
"(",
")",
"{",
"return",
"this",
".",
"parentGraph",
"==",
"null",
"?",
"null",
":",
"this",
".",
"parentGraph",
".",
"get",
"(",
")",
";",
"}"
] | Replies the parent graph is this subgraph was built.
@return the parent graph or <code>null</code> | [
"Replies",
"the",
"parent",
"graph",
"is",
"this",
"subgraph",
"was",
"built",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/maths/mathgraph/src/main/java/org/arakhne/afc/math/graph/SubGraph.java#L112-L115 | train |
gallandarakhneorg/afc | core/maths/mathgraph/src/main/java/org/arakhne/afc/math/graph/SubGraph.java | SubGraph.build | public final void build(GraphIterator<ST, PT> iterator, SubGraphBuildListener<ST, PT> listener) {
assert iterator != null;
final Set<ComparableWeakReference<PT>> reachedPoints = new TreeSet<>();
GraphIterationElement<ST, PT> element;
ST segment;
PT point;
PT firstPoint = null;
this.parentGraph = new WeakReference<>(iterator.getGraph());
this.segments.clear();
this.pointNumber = 0;
this.terminalPoints.clear();
while (iterator.hasNext()) {
element = iterator.nextElement();
point = element.getPoint();
segment = element.getSegment();
// First reached segment
if (this.segments.isEmpty()) {
firstPoint = point;
}
this.segments.add(segment);
if (listener != null) {
listener.segmentAdded(this, element);
}
// Register terminal points
point = segment.getOtherSidePoint(point);
final ComparableWeakReference<PT> ref = new ComparableWeakReference<>(point);
if (element.isTerminalSegment()) {
if (!reachedPoints.contains(ref)) {
this.terminalPoints.add(ref);
if (listener != null) {
listener.terminalPointReached(this, point, segment);
}
}
} else {
this.terminalPoints.remove(ref);
reachedPoints.add(ref);
if (listener != null) {
listener.nonTerminalPointReached(this, point, segment);
}
}
}
if (firstPoint != null) {
final ComparableWeakReference<PT> ref = new ComparableWeakReference<>(firstPoint);
if (!reachedPoints.contains(ref)) {
this.terminalPoints.add(ref);
}
}
this.pointNumber = this.terminalPoints.size() + reachedPoints.size();
reachedPoints.clear();
} | java | public final void build(GraphIterator<ST, PT> iterator, SubGraphBuildListener<ST, PT> listener) {
assert iterator != null;
final Set<ComparableWeakReference<PT>> reachedPoints = new TreeSet<>();
GraphIterationElement<ST, PT> element;
ST segment;
PT point;
PT firstPoint = null;
this.parentGraph = new WeakReference<>(iterator.getGraph());
this.segments.clear();
this.pointNumber = 0;
this.terminalPoints.clear();
while (iterator.hasNext()) {
element = iterator.nextElement();
point = element.getPoint();
segment = element.getSegment();
// First reached segment
if (this.segments.isEmpty()) {
firstPoint = point;
}
this.segments.add(segment);
if (listener != null) {
listener.segmentAdded(this, element);
}
// Register terminal points
point = segment.getOtherSidePoint(point);
final ComparableWeakReference<PT> ref = new ComparableWeakReference<>(point);
if (element.isTerminalSegment()) {
if (!reachedPoints.contains(ref)) {
this.terminalPoints.add(ref);
if (listener != null) {
listener.terminalPointReached(this, point, segment);
}
}
} else {
this.terminalPoints.remove(ref);
reachedPoints.add(ref);
if (listener != null) {
listener.nonTerminalPointReached(this, point, segment);
}
}
}
if (firstPoint != null) {
final ComparableWeakReference<PT> ref = new ComparableWeakReference<>(firstPoint);
if (!reachedPoints.contains(ref)) {
this.terminalPoints.add(ref);
}
}
this.pointNumber = this.terminalPoints.size() + reachedPoints.size();
reachedPoints.clear();
} | [
"public",
"final",
"void",
"build",
"(",
"GraphIterator",
"<",
"ST",
",",
"PT",
">",
"iterator",
",",
"SubGraphBuildListener",
"<",
"ST",
",",
"PT",
">",
"listener",
")",
"{",
"assert",
"iterator",
"!=",
"null",
";",
"final",
"Set",
"<",
"ComparableWeakRef... | Build a subgraph from the specified graph.
@param iterator is the iterator on the graph.
@param listener is the listener invoked each time a segment was added to the subgraph. | [
"Build",
"a",
"subgraph",
"from",
"the",
"specified",
"graph",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/maths/mathgraph/src/main/java/org/arakhne/afc/math/graph/SubGraph.java#L145-L202 | train |
gallandarakhneorg/afc | core/maths/mathtree/src/main/java/org/arakhne/afc/math/tree/TreeDataEvent.java | TreeDataEvent.getAddedValues | @Pure
public List<Object> getAddedValues() {
if (this.newValues == null) {
return Collections.emptyList();
}
return Collections.unmodifiableList(this.newValues);
} | java | @Pure
public List<Object> getAddedValues() {
if (this.newValues == null) {
return Collections.emptyList();
}
return Collections.unmodifiableList(this.newValues);
} | [
"@",
"Pure",
"public",
"List",
"<",
"Object",
">",
"getAddedValues",
"(",
")",
"{",
"if",
"(",
"this",
".",
"newValues",
"==",
"null",
")",
"{",
"return",
"Collections",
".",
"emptyList",
"(",
")",
";",
"}",
"return",
"Collections",
".",
"unmodifiableLis... | Replies the list of added data.
@return the list of added data. | [
"Replies",
"the",
"list",
"of",
"added",
"data",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/maths/mathtree/src/main/java/org/arakhne/afc/math/tree/TreeDataEvent.java#L200-L206 | train |
gallandarakhneorg/afc | core/maths/mathtree/src/main/java/org/arakhne/afc/math/tree/TreeDataEvent.java | TreeDataEvent.getRemovedValues | @Pure
public List<Object> getRemovedValues() {
if (this.oldValues == null) {
return Collections.emptyList();
}
return Collections.unmodifiableList(this.oldValues);
} | java | @Pure
public List<Object> getRemovedValues() {
if (this.oldValues == null) {
return Collections.emptyList();
}
return Collections.unmodifiableList(this.oldValues);
} | [
"@",
"Pure",
"public",
"List",
"<",
"Object",
">",
"getRemovedValues",
"(",
")",
"{",
"if",
"(",
"this",
".",
"oldValues",
"==",
"null",
")",
"{",
"return",
"Collections",
".",
"emptyList",
"(",
")",
";",
"}",
"return",
"Collections",
".",
"unmodifiableL... | Replies the list of removed data.
@return the list of removed data. | [
"Replies",
"the",
"list",
"of",
"removed",
"data",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/maths/mathtree/src/main/java/org/arakhne/afc/math/tree/TreeDataEvent.java#L212-L218 | train |
gallandarakhneorg/afc | core/maths/mathtree/src/main/java/org/arakhne/afc/math/tree/TreeDataEvent.java | TreeDataEvent.getCurrentValues | @Pure
public List<Object> getCurrentValues() {
if (this.allValues == null) {
return Collections.emptyList();
}
return Collections.unmodifiableList(this.allValues);
} | java | @Pure
public List<Object> getCurrentValues() {
if (this.allValues == null) {
return Collections.emptyList();
}
return Collections.unmodifiableList(this.allValues);
} | [
"@",
"Pure",
"public",
"List",
"<",
"Object",
">",
"getCurrentValues",
"(",
")",
"{",
"if",
"(",
"this",
".",
"allValues",
"==",
"null",
")",
"{",
"return",
"Collections",
".",
"emptyList",
"(",
")",
";",
"}",
"return",
"Collections",
".",
"unmodifiableL... | Replies the list of current data.
@return the list of current data. | [
"Replies",
"the",
"list",
"of",
"current",
"data",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/maths/mathtree/src/main/java/org/arakhne/afc/math/tree/TreeDataEvent.java#L224-L230 | train |
BBN-E/bue-common-open | common-core-open/src/main/java/com/bbn/bue/common/collections/CollectionUtils.java | CollectionUtils.transformedCopy | public static <A, B> ImmutableMultiset<B> transformedCopy(Multiset<A> ms,
Function<A, B> func) {
final ImmutableMultiset.Builder<B> ret = ImmutableMultiset.builder();
for (final Multiset.Entry<A> entry : ms.entrySet()) {
final B transformedElement = func.apply(entry.getElement());
ret.addCopies(transformedElement, entry.getCount());
}
return ret.build();
} | java | public static <A, B> ImmutableMultiset<B> transformedCopy(Multiset<A> ms,
Function<A, B> func) {
final ImmutableMultiset.Builder<B> ret = ImmutableMultiset.builder();
for (final Multiset.Entry<A> entry : ms.entrySet()) {
final B transformedElement = func.apply(entry.getElement());
ret.addCopies(transformedElement, entry.getCount());
}
return ret.build();
} | [
"public",
"static",
"<",
"A",
",",
"B",
">",
"ImmutableMultiset",
"<",
"B",
">",
"transformedCopy",
"(",
"Multiset",
"<",
"A",
">",
"ms",
",",
"Function",
"<",
"A",
",",
"B",
">",
"func",
")",
"{",
"final",
"ImmutableMultiset",
".",
"Builder",
"<",
"... | Returns a new Multiset resulting from transforming each element of the input Multiset by a
function. If two or more elements are mapped to the same value by the function, their counts
will be summed in the new Multiset. | [
"Returns",
"a",
"new",
"Multiset",
"resulting",
"from",
"transforming",
"each",
"element",
"of",
"the",
"input",
"Multiset",
"by",
"a",
"function",
".",
"If",
"two",
"or",
"more",
"elements",
"are",
"mapped",
"to",
"the",
"same",
"value",
"by",
"the",
"fun... | d618652674d647867306e2e4b987a21b7c29c015 | https://github.com/BBN-E/bue-common-open/blob/d618652674d647867306e2e4b987a21b7c29c015/common-core-open/src/main/java/com/bbn/bue/common/collections/CollectionUtils.java#L91-L101 | train |
BBN-E/bue-common-open | common-core-open/src/main/java/com/bbn/bue/common/collections/CollectionUtils.java | CollectionUtils.mutableTransformedCopy | public static <A, B> Multiset<B> mutableTransformedCopy(Multiset<A> ms,
Function<A, B> func) {
final Multiset<B> ret = HashMultiset.create();
for (final Multiset.Entry<A> entry : ms.entrySet()) {
final B transformedElement = func.apply(entry.getElement());
ret.add(transformedElement, entry.getCount());
}
return ret;
} | java | public static <A, B> Multiset<B> mutableTransformedCopy(Multiset<A> ms,
Function<A, B> func) {
final Multiset<B> ret = HashMultiset.create();
for (final Multiset.Entry<A> entry : ms.entrySet()) {
final B transformedElement = func.apply(entry.getElement());
ret.add(transformedElement, entry.getCount());
}
return ret;
} | [
"public",
"static",
"<",
"A",
",",
"B",
">",
"Multiset",
"<",
"B",
">",
"mutableTransformedCopy",
"(",
"Multiset",
"<",
"A",
">",
"ms",
",",
"Function",
"<",
"A",
",",
"B",
">",
"func",
")",
"{",
"final",
"Multiset",
"<",
"B",
">",
"ret",
"=",
"H... | Same as transformedCopy, except the returned Multiset is mutable. | [
"Same",
"as",
"transformedCopy",
"except",
"the",
"returned",
"Multiset",
"is",
"mutable",
"."
] | d618652674d647867306e2e4b987a21b7c29c015 | https://github.com/BBN-E/bue-common-open/blob/d618652674d647867306e2e4b987a21b7c29c015/common-core-open/src/main/java/com/bbn/bue/common/collections/CollectionUtils.java#L106-L116 | train |
BBN-E/bue-common-open | common-core-open/src/main/java/com/bbn/bue/common/collections/CollectionUtils.java | CollectionUtils.allSameSize | public static boolean allSameSize(List<Collection<?>> collections) {
if (collections.isEmpty()) {
return true;
}
final int referenceSize = collections.get(0).size();
for (final Collection<?> col : collections) {
if (col.size() != referenceSize) {
return false;
}
}
return true;
} | java | public static boolean allSameSize(List<Collection<?>> collections) {
if (collections.isEmpty()) {
return true;
}
final int referenceSize = collections.get(0).size();
for (final Collection<?> col : collections) {
if (col.size() != referenceSize) {
return false;
}
}
return true;
} | [
"public",
"static",
"boolean",
"allSameSize",
"(",
"List",
"<",
"Collection",
"<",
"?",
">",
">",
"collections",
")",
"{",
"if",
"(",
"collections",
".",
"isEmpty",
"(",
")",
")",
"{",
"return",
"true",
";",
"}",
"final",
"int",
"referenceSize",
"=",
"... | Returns true if and only if all the collections in the provided list have the same size.
Returns true if the provided list is empty. | [
"Returns",
"true",
"if",
"and",
"only",
"if",
"all",
"the",
"collections",
"in",
"the",
"provided",
"list",
"have",
"the",
"same",
"size",
".",
"Returns",
"true",
"if",
"the",
"provided",
"list",
"is",
"empty",
"."
] | d618652674d647867306e2e4b987a21b7c29c015 | https://github.com/BBN-E/bue-common-open/blob/d618652674d647867306e2e4b987a21b7c29c015/common-core-open/src/main/java/com/bbn/bue/common/collections/CollectionUtils.java#L136-L147 | train |
BBN-E/bue-common-open | common-core-open/src/main/java/com/bbn/bue/common/collections/CollectionUtils.java | CollectionUtils.coerceNullToEmpty | public static <T> List<T> coerceNullToEmpty(List<T> list) {
return MoreObjects.firstNonNull(list, ImmutableList.<T>of());
} | java | public static <T> List<T> coerceNullToEmpty(List<T> list) {
return MoreObjects.firstNonNull(list, ImmutableList.<T>of());
} | [
"public",
"static",
"<",
"T",
">",
"List",
"<",
"T",
">",
"coerceNullToEmpty",
"(",
"List",
"<",
"T",
">",
"list",
")",
"{",
"return",
"MoreObjects",
".",
"firstNonNull",
"(",
"list",
",",
"ImmutableList",
".",
"<",
"T",
">",
"of",
"(",
")",
")",
"... | Turns null into an empty list and leaves other inputs untouched. | [
"Turns",
"null",
"into",
"an",
"empty",
"list",
"and",
"leaves",
"other",
"inputs",
"untouched",
"."
] | d618652674d647867306e2e4b987a21b7c29c015 | https://github.com/BBN-E/bue-common-open/blob/d618652674d647867306e2e4b987a21b7c29c015/common-core-open/src/main/java/com/bbn/bue/common/collections/CollectionUtils.java#L230-L232 | train |
lightblueseas/swing-components | src/main/java/de/alpharogroup/swing/bind/StringBindingListener.java | StringBindingListener.update | protected void update(DocumentEvent event)
{
String text;
try
{
text = event.getDocument().getText(event.getDocument().getStartPosition().getOffset(),
event.getDocument().getEndPosition().getOffset() - 1);
model.setObject(text);
}
catch (BadLocationException e1)
{
log.log(Level.SEVERE,
"some portion of the given range was not a valid part of the document. "
+ "The location in the exception is the first bad position encountered.",
e1);
}
} | java | protected void update(DocumentEvent event)
{
String text;
try
{
text = event.getDocument().getText(event.getDocument().getStartPosition().getOffset(),
event.getDocument().getEndPosition().getOffset() - 1);
model.setObject(text);
}
catch (BadLocationException e1)
{
log.log(Level.SEVERE,
"some portion of the given range was not a valid part of the document. "
+ "The location in the exception is the first bad position encountered.",
e1);
}
} | [
"protected",
"void",
"update",
"(",
"DocumentEvent",
"event",
")",
"{",
"String",
"text",
";",
"try",
"{",
"text",
"=",
"event",
".",
"getDocument",
"(",
")",
".",
"getText",
"(",
"event",
".",
"getDocument",
"(",
")",
".",
"getStartPosition",
"(",
")",
... | Update the underlying model object.
@param event
the event | [
"Update",
"the",
"underlying",
"model",
"object",
"."
] | 4045e85cabd8f0ce985cbfff134c3c9873930c79 | https://github.com/lightblueseas/swing-components/blob/4045e85cabd8f0ce985cbfff134c3c9873930c79/src/main/java/de/alpharogroup/swing/bind/StringBindingListener.java#L95-L111 | train |
gallandarakhneorg/afc | core/vmutils/src/main/java/org/arakhne/afc/vmutil/Android.java | Android.makeAndroidApplicationName | @Pure
public static String makeAndroidApplicationName(String applicationName) {
final String fullName;
if (applicationName.indexOf('.') >= 0) {
fullName = applicationName;
} else {
fullName = "org.arakhne.partnership." + applicationName; //$NON-NLS-1$
}
return fullName;
} | java | @Pure
public static String makeAndroidApplicationName(String applicationName) {
final String fullName;
if (applicationName.indexOf('.') >= 0) {
fullName = applicationName;
} else {
fullName = "org.arakhne.partnership." + applicationName; //$NON-NLS-1$
}
return fullName;
} | [
"@",
"Pure",
"public",
"static",
"String",
"makeAndroidApplicationName",
"(",
"String",
"applicationName",
")",
"{",
"final",
"String",
"fullName",
";",
"if",
"(",
"applicationName",
".",
"indexOf",
"(",
"'",
"'",
")",
">=",
"0",
")",
"{",
"fullName",
"=",
... | Make a valid android application name from the given application name.
A valid android application name is a package name followed by the name
of the application.
@param applicationName is the simple application name.
@return the android application name. | [
"Make",
"a",
"valid",
"android",
"application",
"name",
"from",
"the",
"given",
"application",
"name",
".",
"A",
"valid",
"android",
"application",
"name",
"is",
"a",
"package",
"name",
"followed",
"by",
"the",
"name",
"of",
"the",
"application",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/vmutils/src/main/java/org/arakhne/afc/vmutil/Android.java#L74-L83 | train |
gallandarakhneorg/afc | core/vmutils/src/main/java/org/arakhne/afc/vmutil/Android.java | Android.getContextClassLoader | @Pure
public static ClassLoader getContextClassLoader() throws AndroidException {
synchronized (Android.class) {
final ClassLoader cl = (contextClassLoader == null) ? null : contextClassLoader.get();
if (cl != null) {
return cl;
}
}
final Object context = getContext();
try {
final Method method = context.getClass().getMethod("getClassLoader"); //$NON-NLS-1$
final Object classLoader = method.invoke(context);
final ClassLoader cl = (ClassLoader) classLoader;
synchronized (Android.class) {
contextClassLoader = new WeakReference<>(cl);
}
return cl;
} catch (Exception e) {
throw new AndroidException(e);
}
} | java | @Pure
public static ClassLoader getContextClassLoader() throws AndroidException {
synchronized (Android.class) {
final ClassLoader cl = (contextClassLoader == null) ? null : contextClassLoader.get();
if (cl != null) {
return cl;
}
}
final Object context = getContext();
try {
final Method method = context.getClass().getMethod("getClassLoader"); //$NON-NLS-1$
final Object classLoader = method.invoke(context);
final ClassLoader cl = (ClassLoader) classLoader;
synchronized (Android.class) {
contextClassLoader = new WeakReference<>(cl);
}
return cl;
} catch (Exception e) {
throw new AndroidException(e);
}
} | [
"@",
"Pure",
"public",
"static",
"ClassLoader",
"getContextClassLoader",
"(",
")",
"throws",
"AndroidException",
"{",
"synchronized",
"(",
"Android",
".",
"class",
")",
"{",
"final",
"ClassLoader",
"cl",
"=",
"(",
"contextClassLoader",
"==",
"null",
")",
"?",
... | Replies the class loader of the current Android context.
@return class loader used by the current Android context.
@throws AndroidException when the context is <code>null</code>.
@see #initialize(Object) | [
"Replies",
"the",
"class",
"loader",
"of",
"the",
"current",
"Android",
"context",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/vmutils/src/main/java/org/arakhne/afc/vmutil/Android.java#L214-L234 | train |
lightblueseas/swing-components | src/main/java/de/alpharogroup/swing/dialog/DialogExtensions.java | DialogExtensions.showExceptionDialog | public static void showExceptionDialog(Exception exception, Component parentComponent,
String... additionalMessages)
{
String title = exception.getLocalizedMessage();
StringBuilder sb = new StringBuilder();
sb.append("<html><body width='650'>");
sb.append("<h2>");
sb.append(exception.getLocalizedMessage());
sb.append("</h2>");
sb.append("<p>");
sb.append(exception.getMessage());
Stream.of(additionalMessages).forEach(am -> sb.append("<p>" + am));
String htmlMessage = sb.toString();
JOptionPane.showMessageDialog(parentComponent, htmlMessage, title,
JOptionPane.ERROR_MESSAGE);
} | java | public static void showExceptionDialog(Exception exception, Component parentComponent,
String... additionalMessages)
{
String title = exception.getLocalizedMessage();
StringBuilder sb = new StringBuilder();
sb.append("<html><body width='650'>");
sb.append("<h2>");
sb.append(exception.getLocalizedMessage());
sb.append("</h2>");
sb.append("<p>");
sb.append(exception.getMessage());
Stream.of(additionalMessages).forEach(am -> sb.append("<p>" + am));
String htmlMessage = sb.toString();
JOptionPane.showMessageDialog(parentComponent, htmlMessage, title,
JOptionPane.ERROR_MESSAGE);
} | [
"public",
"static",
"void",
"showExceptionDialog",
"(",
"Exception",
"exception",
",",
"Component",
"parentComponent",
",",
"String",
"...",
"additionalMessages",
")",
"{",
"String",
"title",
"=",
"exception",
".",
"getLocalizedMessage",
"(",
")",
";",
"StringBuilde... | Show exception dialog.
@param exception
the exception
@param parentComponent
determines the <code>Frame</code> in which the dialog is displayed; if
<code>null</code>, or if the <code>parentComponent</code> has no
<code>Frame</code>, a default <code>Frame</code> is used
@param additionalMessages
the additional messages | [
"Show",
"exception",
"dialog",
"."
] | 4045e85cabd8f0ce985cbfff134c3c9873930c79 | https://github.com/lightblueseas/swing-components/blob/4045e85cabd8f0ce985cbfff134c3c9873930c79/src/main/java/de/alpharogroup/swing/dialog/DialogExtensions.java#L53-L68 | train |
BBN-E/bue-common-open | scoring-open/src/main/java/com/bbn/bue/common/evaluation/BootstrapInspector.java | BootstrapInspector.forSummarizer | @SuppressWarnings("unchecked")
public static <ObsT, SummaryT> Builder<ObsT, SummaryT> forSummarizer(
final ObservationSummarizer<? super ObsT, ? extends SummaryT> observationSummarizer,
int numSamples,
final Random rng) {
return new Builder<ObsT, SummaryT>(
(ObservationSummarizer<ObsT, SummaryT>) observationSummarizer, numSamples, rng);
} | java | @SuppressWarnings("unchecked")
public static <ObsT, SummaryT> Builder<ObsT, SummaryT> forSummarizer(
final ObservationSummarizer<? super ObsT, ? extends SummaryT> observationSummarizer,
int numSamples,
final Random rng) {
return new Builder<ObsT, SummaryT>(
(ObservationSummarizer<ObsT, SummaryT>) observationSummarizer, numSamples, rng);
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"<",
"ObsT",
",",
"SummaryT",
">",
"Builder",
"<",
"ObsT",
",",
"SummaryT",
">",
"forSummarizer",
"(",
"final",
"ObservationSummarizer",
"<",
"?",
"super",
"ObsT",
",",
"?",
"extends",
"... | cast is safe - see covariance and contravariance notes on ObservationSummarizer | [
"cast",
"is",
"safe",
"-",
"see",
"covariance",
"and",
"contravariance",
"notes",
"on",
"ObservationSummarizer"
] | d618652674d647867306e2e4b987a21b7c29c015 | https://github.com/BBN-E/bue-common-open/blob/d618652674d647867306e2e4b987a21b7c29c015/scoring-open/src/main/java/com/bbn/bue/common/evaluation/BootstrapInspector.java#L115-L122 | train |
gallandarakhneorg/afc | advanced/bootique/bootique-printconfig/src/main/java/org/arakhne/afc/bootique/printconfig/modules/PrintConfigCommandModule.java | PrintConfigCommandModule.providePrintConfigCommand | @SuppressWarnings("static-method")
@Provides
@Singleton
public PrintConfigCommand providePrintConfigCommand(
Provider<BootLogger> bootLogger,
Provider<ModulesMetadata> modulesMetadata,
Injector injector) {
return new PrintConfigCommand(bootLogger, modulesMetadata, injector);
} | java | @SuppressWarnings("static-method")
@Provides
@Singleton
public PrintConfigCommand providePrintConfigCommand(
Provider<BootLogger> bootLogger,
Provider<ModulesMetadata> modulesMetadata,
Injector injector) {
return new PrintConfigCommand(bootLogger, modulesMetadata, injector);
} | [
"@",
"SuppressWarnings",
"(",
"\"static-method\"",
")",
"@",
"Provides",
"@",
"Singleton",
"public",
"PrintConfigCommand",
"providePrintConfigCommand",
"(",
"Provider",
"<",
"BootLogger",
">",
"bootLogger",
",",
"Provider",
"<",
"ModulesMetadata",
">",
"modulesMetadata"... | Provide the command for running the command for printing out the configuration values.
@param bootLogger the boot logger.
@param modulesMetadata the modules' metadata.
@param injector the current injector.
@return the command. | [
"Provide",
"the",
"command",
"for",
"running",
"the",
"command",
"for",
"printing",
"out",
"the",
"configuration",
"values",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/bootique/bootique-printconfig/src/main/java/org/arakhne/afc/bootique/printconfig/modules/PrintConfigCommandModule.java#L57-L65 | train |
gallandarakhneorg/afc | advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/mapelement/MapElement.java | MapElement.fireShapeChanged | protected final void fireShapeChanged() {
resetBoundingBox();
if (isEventFirable()) {
final GISElementContainer<?> container = getContainer();
if (container != null) {
container.onMapElementGraphicalAttributeChanged();
}
}
} | java | protected final void fireShapeChanged() {
resetBoundingBox();
if (isEventFirable()) {
final GISElementContainer<?> container = getContainer();
if (container != null) {
container.onMapElementGraphicalAttributeChanged();
}
}
} | [
"protected",
"final",
"void",
"fireShapeChanged",
"(",
")",
"{",
"resetBoundingBox",
"(",
")",
";",
"if",
"(",
"isEventFirable",
"(",
")",
")",
"{",
"final",
"GISElementContainer",
"<",
"?",
">",
"container",
"=",
"getContainer",
"(",
")",
";",
"if",
"(",
... | Invoked when the shape of this element changed.
<p>This method also reset the bounding box to allow
its re-computation (with a call to {@link #resetBoundingBox()}.
<p>In the implementation of a MapElement, prefers to call
{@link #fireGraphicalAttributeChanged()} or
{@code fireShapeChanged()} instead of {@link #resetBoundingBox()}.
<p>If the attributes that change does not concern the shape (bounding box)
of the element, prefers an invocation of {@link #fireGraphicalAttributeChanged()}
instead of {@code fireShapeChanged()} | [
"Invoked",
"when",
"the",
"shape",
"of",
"this",
"element",
"changed",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/mapelement/MapElement.java#L323-L331 | train |
gallandarakhneorg/afc | advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/mapelement/MapElement.java | MapElement.boundsIntersects | @Pure
protected final boolean boundsIntersects(Shape2D<?, ?, ?, ?, ?, ? extends Rectangle2afp<?, ?, ?, ?, ?, ?>> rectangle) {
final Rectangle2d bounds = getBoundingBox();
assert bounds != null;
return bounds.intersects(rectangle);
} | java | @Pure
protected final boolean boundsIntersects(Shape2D<?, ?, ?, ?, ?, ? extends Rectangle2afp<?, ?, ?, ?, ?, ?>> rectangle) {
final Rectangle2d bounds = getBoundingBox();
assert bounds != null;
return bounds.intersects(rectangle);
} | [
"@",
"Pure",
"protected",
"final",
"boolean",
"boundsIntersects",
"(",
"Shape2D",
"<",
"?",
",",
"?",
",",
"?",
",",
"?",
",",
"?",
",",
"?",
"extends",
"Rectangle2afp",
"<",
"?",
",",
"?",
",",
"?",
",",
"?",
",",
"?",
",",
"?",
">",
">",
"rec... | Replies if the bounds of this element has an intersection
with the specified rectangle.
@param rectangle the rectangle.
@return <code>true</code> if this bounds is intersecting the specified area,
otherwise <code>false</code> | [
"Replies",
"if",
"the",
"bounds",
"of",
"this",
"element",
"has",
"an",
"intersection",
"with",
"the",
"specified",
"rectangle",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/mapelement/MapElement.java#L455-L460 | train |
gallandarakhneorg/afc | advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/mapelement/MapElement.java | MapElement.isContainerColorUsed | @Pure
public boolean isContainerColorUsed() {
final AttributeValue val = getAttributeCollection().getAttribute(ATTR_USE_CONTAINER_COLOR);
if (val != null) {
try {
return val.getBoolean();
} catch (AttributeException e) {
//
}
}
return false;
} | java | @Pure
public boolean isContainerColorUsed() {
final AttributeValue val = getAttributeCollection().getAttribute(ATTR_USE_CONTAINER_COLOR);
if (val != null) {
try {
return val.getBoolean();
} catch (AttributeException e) {
//
}
}
return false;
} | [
"@",
"Pure",
"public",
"boolean",
"isContainerColorUsed",
"(",
")",
"{",
"final",
"AttributeValue",
"val",
"=",
"getAttributeCollection",
"(",
")",
".",
"getAttribute",
"(",
"ATTR_USE_CONTAINER_COLOR",
")",
";",
"if",
"(",
"val",
"!=",
"null",
")",
"{",
"try",... | Replies the flag that indicates if this element use its color or
the container's color.
@return <code>true</code> if this element must
use the container's color, and <code>false</code> to use the
element's color. | [
"Replies",
"the",
"flag",
"that",
"indicates",
"if",
"this",
"element",
"use",
"its",
"color",
"or",
"the",
"container",
"s",
"color",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/mapelement/MapElement.java#L482-L493 | train |
gallandarakhneorg/afc | advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/mapelement/MapElement.java | MapElement.getVisualizationType | @Pure
public VisualizationType getVisualizationType() {
if (this.vizualizationType == null) {
final AttributeValue val = getAttributeCollection().getAttribute(ATTR_VISUALIZATION_TYPE);
if (val != null) {
try {
this.vizualizationType = val.getJavaObject();
} catch (Exception e) {
//
}
}
if (this.vizualizationType == null) {
this.vizualizationType = VisualizationType.SHAPE_ONLY;
}
}
return this.vizualizationType;
} | java | @Pure
public VisualizationType getVisualizationType() {
if (this.vizualizationType == null) {
final AttributeValue val = getAttributeCollection().getAttribute(ATTR_VISUALIZATION_TYPE);
if (val != null) {
try {
this.vizualizationType = val.getJavaObject();
} catch (Exception e) {
//
}
}
if (this.vizualizationType == null) {
this.vizualizationType = VisualizationType.SHAPE_ONLY;
}
}
return this.vizualizationType;
} | [
"@",
"Pure",
"public",
"VisualizationType",
"getVisualizationType",
"(",
")",
"{",
"if",
"(",
"this",
".",
"vizualizationType",
"==",
"null",
")",
"{",
"final",
"AttributeValue",
"val",
"=",
"getAttributeCollection",
"(",
")",
".",
"getAttribute",
"(",
"ATTR_VIS... | Replies the type of visualization that must be used by
this element.
@return the type of visualization | [
"Replies",
"the",
"type",
"of",
"visualization",
"that",
"must",
"be",
"used",
"by",
"this",
"element",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/mapelement/MapElement.java#L546-L562 | train |
gallandarakhneorg/afc | advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/mapelement/MapElement.java | MapElement.setVisualizationType | public void setVisualizationType(VisualizationType type) {
try {
if (getVisualizationType() != type) {
this.vizualizationType = type;
getAttributeCollection().setAttribute(ATTR_VISUALIZATION_TYPE, new AttributeValueImpl(type));
}
} catch (AttributeException e) {
//
}
} | java | public void setVisualizationType(VisualizationType type) {
try {
if (getVisualizationType() != type) {
this.vizualizationType = type;
getAttributeCollection().setAttribute(ATTR_VISUALIZATION_TYPE, new AttributeValueImpl(type));
}
} catch (AttributeException e) {
//
}
} | [
"public",
"void",
"setVisualizationType",
"(",
"VisualizationType",
"type",
")",
"{",
"try",
"{",
"if",
"(",
"getVisualizationType",
"(",
")",
"!=",
"type",
")",
"{",
"this",
".",
"vizualizationType",
"=",
"type",
";",
"getAttributeCollection",
"(",
")",
".",
... | Set the type of visualization that must be used by
this element.
@param type the visualization type. | [
"Set",
"the",
"type",
"of",
"visualization",
"that",
"must",
"be",
"used",
"by",
"this",
"element",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/mapelement/MapElement.java#L570-L579 | train |
gallandarakhneorg/afc | advanced/mathfx/src/main/java/org/arakhne/afc/math/geometry/d1/dfx/GeomFactory1dfx.java | GeomFactory1dfx.newVector | @SuppressWarnings("static-method")
public Vector1dfx newVector(ObjectProperty<WeakReference<Segment1D<?, ?>>> segment, DoubleProperty x, DoubleProperty y) {
return new Vector1dfx(segment, x, y);
} | java | @SuppressWarnings("static-method")
public Vector1dfx newVector(ObjectProperty<WeakReference<Segment1D<?, ?>>> segment, DoubleProperty x, DoubleProperty y) {
return new Vector1dfx(segment, x, y);
} | [
"@",
"SuppressWarnings",
"(",
"\"static-method\"",
")",
"public",
"Vector1dfx",
"newVector",
"(",
"ObjectProperty",
"<",
"WeakReference",
"<",
"Segment1D",
"<",
"?",
",",
"?",
">",
">",
">",
"segment",
",",
"DoubleProperty",
"x",
",",
"DoubleProperty",
"y",
")... | Create a vector with properties.
@param segment the segment property.
@param x the x property.
@param y the y property.
@return the vector. | [
"Create",
"a",
"vector",
"with",
"properties",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/mathfx/src/main/java/org/arakhne/afc/math/geometry/d1/dfx/GeomFactory1dfx.java#L131-L134 | train |
killme2008/hs4j | src/main/java/com/google/code/hs4j/utils/HSUtils.java | HSUtils.isBlank | public static final boolean isBlank(String s) {
if (s == null || s.trim().length() == 0) {
return true;
}
return false;
} | java | public static final boolean isBlank(String s) {
if (s == null || s.trim().length() == 0) {
return true;
}
return false;
} | [
"public",
"static",
"final",
"boolean",
"isBlank",
"(",
"String",
"s",
")",
"{",
"if",
"(",
"s",
"==",
"null",
"||",
"s",
".",
"trim",
"(",
")",
".",
"length",
"(",
")",
"==",
"0",
")",
"{",
"return",
"true",
";",
"}",
"return",
"false",
";",
"... | Whether string is a space or null
@param s
@return | [
"Whether",
"string",
"is",
"a",
"space",
"or",
"null"
] | 805fe14bfe270d95009514c224d93c5fe3575f11 | https://github.com/killme2008/hs4j/blob/805fe14bfe270d95009514c224d93c5fe3575f11/src/main/java/com/google/code/hs4j/utils/HSUtils.java#L16-L21 | train |
gallandarakhneorg/afc | core/util/src/main/java/org/arakhne/afc/util/OutputParameter.java | OutputParameter.set | public T set(T newValue) {
final T obj = this.object;
this.object = newValue;
return obj;
} | java | public T set(T newValue) {
final T obj = this.object;
this.object = newValue;
return obj;
} | [
"public",
"T",
"set",
"(",
"T",
"newValue",
")",
"{",
"final",
"T",
"obj",
"=",
"this",
".",
"object",
";",
"this",
".",
"object",
"=",
"newValue",
";",
"return",
"obj",
";",
"}"
] | Set the parameter.
@param newValue is the value of the parameter.
@return the old value of the parameter. | [
"Set",
"the",
"parameter",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/util/src/main/java/org/arakhne/afc/util/OutputParameter.java#L105-L109 | train |
gallandarakhneorg/afc | advanced/gis/gisroad/src/main/java/org/arakhne/afc/gis/road/primitive/RoadNetworkConstants.java | RoadNetworkConstants.getPreferredAttributeNameForRoadWidth | @Pure
public static String getPreferredAttributeNameForRoadWidth() {
final Preferences prefs = Preferences.userNodeForPackage(RoadNetworkConstants.class);
if (prefs != null) {
return prefs.get("ROAD_WIDTH_ATTR_NAME", DEFAULT_ATTR_ROAD_WIDTH); //$NON-NLS-1$
}
return DEFAULT_ATTR_ROAD_WIDTH;
} | java | @Pure
public static String getPreferredAttributeNameForRoadWidth() {
final Preferences prefs = Preferences.userNodeForPackage(RoadNetworkConstants.class);
if (prefs != null) {
return prefs.get("ROAD_WIDTH_ATTR_NAME", DEFAULT_ATTR_ROAD_WIDTH); //$NON-NLS-1$
}
return DEFAULT_ATTR_ROAD_WIDTH;
} | [
"@",
"Pure",
"public",
"static",
"String",
"getPreferredAttributeNameForRoadWidth",
"(",
")",
"{",
"final",
"Preferences",
"prefs",
"=",
"Preferences",
".",
"userNodeForPackage",
"(",
"RoadNetworkConstants",
".",
"class",
")",
";",
"if",
"(",
"prefs",
"!=",
"null"... | Replies the preferred name for the width of the roads.
@return the preferred name for the width of the roads.
@see #DEFAULT_ATTR_ROAD_WIDTH | [
"Replies",
"the",
"preferred",
"name",
"for",
"the",
"width",
"of",
"the",
"roads",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/gisroad/src/main/java/org/arakhne/afc/gis/road/primitive/RoadNetworkConstants.java#L198-L205 | train |
gallandarakhneorg/afc | advanced/gis/gisroad/src/main/java/org/arakhne/afc/gis/road/primitive/RoadNetworkConstants.java | RoadNetworkConstants.setPreferredAttributeNameForRoadWidth | public static void setPreferredAttributeNameForRoadWidth(String name) {
final Preferences prefs = Preferences.userNodeForPackage(RoadNetworkConstants.class);
if (prefs != null) {
if (name == null || "".equals(name) || DEFAULT_ATTR_ROAD_WIDTH.equalsIgnoreCase(name)) { //$NON-NLS-1$
prefs.remove("ROAD_WIDTH_ATTR_NAME"); //$NON-NLS-1$
} else {
prefs.put("ROAD_WIDTH_ATTR_NAME", name); //$NON-NLS-1$
}
}
} | java | public static void setPreferredAttributeNameForRoadWidth(String name) {
final Preferences prefs = Preferences.userNodeForPackage(RoadNetworkConstants.class);
if (prefs != null) {
if (name == null || "".equals(name) || DEFAULT_ATTR_ROAD_WIDTH.equalsIgnoreCase(name)) { //$NON-NLS-1$
prefs.remove("ROAD_WIDTH_ATTR_NAME"); //$NON-NLS-1$
} else {
prefs.put("ROAD_WIDTH_ATTR_NAME", name); //$NON-NLS-1$
}
}
} | [
"public",
"static",
"void",
"setPreferredAttributeNameForRoadWidth",
"(",
"String",
"name",
")",
"{",
"final",
"Preferences",
"prefs",
"=",
"Preferences",
".",
"userNodeForPackage",
"(",
"RoadNetworkConstants",
".",
"class",
")",
";",
"if",
"(",
"prefs",
"!=",
"nu... | Set the preferred name for the width of the roads.
@param name is the preferred name for the width of the roads.
@see #DEFAULT_ATTR_ROAD_WIDTH | [
"Set",
"the",
"preferred",
"name",
"for",
"the",
"width",
"of",
"the",
"roads",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/gisroad/src/main/java/org/arakhne/afc/gis/road/primitive/RoadNetworkConstants.java#L212-L221 | train |
gallandarakhneorg/afc | advanced/gis/gisroad/src/main/java/org/arakhne/afc/gis/road/primitive/RoadNetworkConstants.java | RoadNetworkConstants.getPreferredAttributeNameForLaneCount | @Pure
public static String getPreferredAttributeNameForLaneCount() {
final Preferences prefs = Preferences.userNodeForPackage(RoadNetworkConstants.class);
if (prefs != null) {
return prefs.get("LANE_COUNT_ATTR_NAME", DEFAULT_ATTR_LANE_COUNT); //$NON-NLS-1$
}
return DEFAULT_ATTR_LANE_COUNT;
} | java | @Pure
public static String getPreferredAttributeNameForLaneCount() {
final Preferences prefs = Preferences.userNodeForPackage(RoadNetworkConstants.class);
if (prefs != null) {
return prefs.get("LANE_COUNT_ATTR_NAME", DEFAULT_ATTR_LANE_COUNT); //$NON-NLS-1$
}
return DEFAULT_ATTR_LANE_COUNT;
} | [
"@",
"Pure",
"public",
"static",
"String",
"getPreferredAttributeNameForLaneCount",
"(",
")",
"{",
"final",
"Preferences",
"prefs",
"=",
"Preferences",
".",
"userNodeForPackage",
"(",
"RoadNetworkConstants",
".",
"class",
")",
";",
"if",
"(",
"prefs",
"!=",
"null"... | Replies the preferred name for the number of lanes of the roads.
@return the preferred name for the number of lanes of the roads.
@see #DEFAULT_ATTR_LANE_COUNT | [
"Replies",
"the",
"preferred",
"name",
"for",
"the",
"number",
"of",
"lanes",
"of",
"the",
"roads",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/gisroad/src/main/java/org/arakhne/afc/gis/road/primitive/RoadNetworkConstants.java#L228-L235 | train |
gallandarakhneorg/afc | advanced/gis/gisroad/src/main/java/org/arakhne/afc/gis/road/primitive/RoadNetworkConstants.java | RoadNetworkConstants.setPreferredAttributeNameForLaneCount | public static void setPreferredAttributeNameForLaneCount(String name) {
final Preferences prefs = Preferences.userNodeForPackage(RoadNetworkConstants.class);
if (prefs != null) {
if (name == null || "".equals(name) || DEFAULT_ATTR_LANE_COUNT.equalsIgnoreCase(name)) { //$NON-NLS-1$
prefs.remove("LANE_COUNT_ATTR_NAME"); //$NON-NLS-1$
} else {
prefs.put("LANE_COUNT_ATTR_NAME", name); //$NON-NLS-1$
}
}
} | java | public static void setPreferredAttributeNameForLaneCount(String name) {
final Preferences prefs = Preferences.userNodeForPackage(RoadNetworkConstants.class);
if (prefs != null) {
if (name == null || "".equals(name) || DEFAULT_ATTR_LANE_COUNT.equalsIgnoreCase(name)) { //$NON-NLS-1$
prefs.remove("LANE_COUNT_ATTR_NAME"); //$NON-NLS-1$
} else {
prefs.put("LANE_COUNT_ATTR_NAME", name); //$NON-NLS-1$
}
}
} | [
"public",
"static",
"void",
"setPreferredAttributeNameForLaneCount",
"(",
"String",
"name",
")",
"{",
"final",
"Preferences",
"prefs",
"=",
"Preferences",
".",
"userNodeForPackage",
"(",
"RoadNetworkConstants",
".",
"class",
")",
";",
"if",
"(",
"prefs",
"!=",
"nu... | Set the preferred name for the number of lanes of the roads.
@param name is the preferred name for the number of lanes of the roads.
@see #DEFAULT_ATTR_LANE_COUNT | [
"Set",
"the",
"preferred",
"name",
"for",
"the",
"number",
"of",
"lanes",
"of",
"the",
"roads",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/gisroad/src/main/java/org/arakhne/afc/gis/road/primitive/RoadNetworkConstants.java#L242-L251 | train |
gallandarakhneorg/afc | advanced/gis/gisroad/src/main/java/org/arakhne/afc/gis/road/primitive/RoadNetworkConstants.java | RoadNetworkConstants.getPreferredLaneCount | @Pure
public static int getPreferredLaneCount() {
final Preferences prefs = Preferences.userNodeForPackage(RoadNetworkConstants.class);
if (prefs != null) {
return prefs.getInt("LANE_COUNT", DEFAULT_LANE_COUNT); //$NON-NLS-1$
}
return DEFAULT_LANE_COUNT;
} | java | @Pure
public static int getPreferredLaneCount() {
final Preferences prefs = Preferences.userNodeForPackage(RoadNetworkConstants.class);
if (prefs != null) {
return prefs.getInt("LANE_COUNT", DEFAULT_LANE_COUNT); //$NON-NLS-1$
}
return DEFAULT_LANE_COUNT;
} | [
"@",
"Pure",
"public",
"static",
"int",
"getPreferredLaneCount",
"(",
")",
"{",
"final",
"Preferences",
"prefs",
"=",
"Preferences",
".",
"userNodeForPackage",
"(",
"RoadNetworkConstants",
".",
"class",
")",
";",
"if",
"(",
"prefs",
"!=",
"null",
")",
"{",
"... | Replies the preferred number of lanes for a road segment.
@return the preferred number of lanes for a road segment.
@see #DEFAULT_LANE_COUNT | [
"Replies",
"the",
"preferred",
"number",
"of",
"lanes",
"for",
"a",
"road",
"segment",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/gisroad/src/main/java/org/arakhne/afc/gis/road/primitive/RoadNetworkConstants.java#L258-L265 | train |
gallandarakhneorg/afc | advanced/gis/gisroad/src/main/java/org/arakhne/afc/gis/road/primitive/RoadNetworkConstants.java | RoadNetworkConstants.setPreferredLaneCount | public static void setPreferredLaneCount(int count) {
final Preferences prefs = Preferences.userNodeForPackage(RoadNetworkConstants.class);
if (prefs != null) {
if (count < 0) {
prefs.remove("LANE_COUNT"); //$NON-NLS-1$
} else {
prefs.putInt("LANE_COUNT", count); //$NON-NLS-1$
}
}
} | java | public static void setPreferredLaneCount(int count) {
final Preferences prefs = Preferences.userNodeForPackage(RoadNetworkConstants.class);
if (prefs != null) {
if (count < 0) {
prefs.remove("LANE_COUNT"); //$NON-NLS-1$
} else {
prefs.putInt("LANE_COUNT", count); //$NON-NLS-1$
}
}
} | [
"public",
"static",
"void",
"setPreferredLaneCount",
"(",
"int",
"count",
")",
"{",
"final",
"Preferences",
"prefs",
"=",
"Preferences",
".",
"userNodeForPackage",
"(",
"RoadNetworkConstants",
".",
"class",
")",
";",
"if",
"(",
"prefs",
"!=",
"null",
")",
"{",... | Set the preferred number of lanes for a road segment.
@param count is the preferred number of lanes for a road segment.
@see #DEFAULT_LANE_COUNT | [
"Set",
"the",
"preferred",
"number",
"of",
"lanes",
"for",
"a",
"road",
"segment",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/gisroad/src/main/java/org/arakhne/afc/gis/road/primitive/RoadNetworkConstants.java#L272-L281 | train |
gallandarakhneorg/afc | advanced/gis/gisroad/src/main/java/org/arakhne/afc/gis/road/primitive/RoadNetworkConstants.java | RoadNetworkConstants.getPreferredLaneWidth | @Pure
public static double getPreferredLaneWidth() {
final Preferences prefs = Preferences.userNodeForPackage(RoadNetworkConstants.class);
if (prefs != null) {
return prefs.getDouble("LANE_WIDTH", DEFAULT_LANE_WIDTH); //$NON-NLS-1$
}
return DEFAULT_LANE_WIDTH;
} | java | @Pure
public static double getPreferredLaneWidth() {
final Preferences prefs = Preferences.userNodeForPackage(RoadNetworkConstants.class);
if (prefs != null) {
return prefs.getDouble("LANE_WIDTH", DEFAULT_LANE_WIDTH); //$NON-NLS-1$
}
return DEFAULT_LANE_WIDTH;
} | [
"@",
"Pure",
"public",
"static",
"double",
"getPreferredLaneWidth",
"(",
")",
"{",
"final",
"Preferences",
"prefs",
"=",
"Preferences",
".",
"userNodeForPackage",
"(",
"RoadNetworkConstants",
".",
"class",
")",
";",
"if",
"(",
"prefs",
"!=",
"null",
")",
"{",
... | Replies the preferred width of a lane for a road segment.
@return the preferred width of a lane for a road segment, in meters.
@see #DEFAULT_LANE_WIDTH | [
"Replies",
"the",
"preferred",
"width",
"of",
"a",
"lane",
"for",
"a",
"road",
"segment",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/gisroad/src/main/java/org/arakhne/afc/gis/road/primitive/RoadNetworkConstants.java#L288-L295 | train |
gallandarakhneorg/afc | advanced/gis/gisroad/src/main/java/org/arakhne/afc/gis/road/primitive/RoadNetworkConstants.java | RoadNetworkConstants.setPreferredLaneWidth | public static void setPreferredLaneWidth(double width) {
final Preferences prefs = Preferences.userNodeForPackage(RoadNetworkConstants.class);
if (prefs != null) {
if (width <= 0) {
prefs.remove("LANE_WIDTH"); //$NON-NLS-1$
} else {
prefs.putDouble("LANE_WIDTH", width); //$NON-NLS-1$
}
}
} | java | public static void setPreferredLaneWidth(double width) {
final Preferences prefs = Preferences.userNodeForPackage(RoadNetworkConstants.class);
if (prefs != null) {
if (width <= 0) {
prefs.remove("LANE_WIDTH"); //$NON-NLS-1$
} else {
prefs.putDouble("LANE_WIDTH", width); //$NON-NLS-1$
}
}
} | [
"public",
"static",
"void",
"setPreferredLaneWidth",
"(",
"double",
"width",
")",
"{",
"final",
"Preferences",
"prefs",
"=",
"Preferences",
".",
"userNodeForPackage",
"(",
"RoadNetworkConstants",
".",
"class",
")",
";",
"if",
"(",
"prefs",
"!=",
"null",
")",
"... | Set the preferred width of a lane for a road segment.
@param width is the preferred width of a lane for a road segment, in meters.
@see #DEFAULT_LANE_WIDTH | [
"Set",
"the",
"preferred",
"width",
"of",
"a",
"lane",
"for",
"a",
"road",
"segment",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/gisroad/src/main/java/org/arakhne/afc/gis/road/primitive/RoadNetworkConstants.java#L302-L311 | train |
gallandarakhneorg/afc | advanced/gis/gisroad/src/main/java/org/arakhne/afc/gis/road/primitive/RoadNetworkConstants.java | RoadNetworkConstants.getPreferredLegalTrafficSide | @Pure
public static LegalTrafficSide getPreferredLegalTrafficSide() {
final Preferences prefs = Preferences.userNodeForPackage(RoadNetworkConstants.class);
String name = null;
if (prefs != null) {
name = prefs.get("LEGAL_TRAFFIC_SIDE", null); //$NON-NLS-1$
}
if (name != null) {
LegalTrafficSide side;
try {
side = LegalTrafficSide.valueOf(name);
} catch (Throwable exception) {
side = null;
}
if (side != null) {
return side;
}
}
return LegalTrafficSide.getCurrent();
} | java | @Pure
public static LegalTrafficSide getPreferredLegalTrafficSide() {
final Preferences prefs = Preferences.userNodeForPackage(RoadNetworkConstants.class);
String name = null;
if (prefs != null) {
name = prefs.get("LEGAL_TRAFFIC_SIDE", null); //$NON-NLS-1$
}
if (name != null) {
LegalTrafficSide side;
try {
side = LegalTrafficSide.valueOf(name);
} catch (Throwable exception) {
side = null;
}
if (side != null) {
return side;
}
}
return LegalTrafficSide.getCurrent();
} | [
"@",
"Pure",
"public",
"static",
"LegalTrafficSide",
"getPreferredLegalTrafficSide",
"(",
")",
"{",
"final",
"Preferences",
"prefs",
"=",
"Preferences",
".",
"userNodeForPackage",
"(",
"RoadNetworkConstants",
".",
"class",
")",
";",
"String",
"name",
"=",
"null",
... | Replies the preferred side of traffic for vehicles on road segments.
@return the preferred side of traffic for vehicles on road segments. | [
"Replies",
"the",
"preferred",
"side",
"of",
"traffic",
"for",
"vehicles",
"on",
"road",
"segments",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/gisroad/src/main/java/org/arakhne/afc/gis/road/primitive/RoadNetworkConstants.java#L317-L336 | train |
gallandarakhneorg/afc | advanced/gis/gisroad/src/main/java/org/arakhne/afc/gis/road/primitive/RoadNetworkConstants.java | RoadNetworkConstants.setPreferredLegalTrafficSide | public static void setPreferredLegalTrafficSide(LegalTrafficSide side) {
final Preferences prefs = Preferences.userNodeForPackage(RoadNetworkConstants.class);
if (prefs != null) {
if (side == null) {
prefs.remove("LEGAL_TRAFFIC_SIDE"); //$NON-NLS-1$
} else {
prefs.put("LEGAL_TRAFFIC_SIDE", side.name()); //$NON-NLS-1$
}
}
} | java | public static void setPreferredLegalTrafficSide(LegalTrafficSide side) {
final Preferences prefs = Preferences.userNodeForPackage(RoadNetworkConstants.class);
if (prefs != null) {
if (side == null) {
prefs.remove("LEGAL_TRAFFIC_SIDE"); //$NON-NLS-1$
} else {
prefs.put("LEGAL_TRAFFIC_SIDE", side.name()); //$NON-NLS-1$
}
}
} | [
"public",
"static",
"void",
"setPreferredLegalTrafficSide",
"(",
"LegalTrafficSide",
"side",
")",
"{",
"final",
"Preferences",
"prefs",
"=",
"Preferences",
".",
"userNodeForPackage",
"(",
"RoadNetworkConstants",
".",
"class",
")",
";",
"if",
"(",
"prefs",
"!=",
"n... | Set the preferred side of traffic for vehicles on road segments.
@param side is the preferred side of traffic for vehicles on road segments. | [
"Set",
"the",
"preferred",
"side",
"of",
"traffic",
"for",
"vehicles",
"on",
"road",
"segments",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/gisroad/src/main/java/org/arakhne/afc/gis/road/primitive/RoadNetworkConstants.java#L342-L351 | train |
gallandarakhneorg/afc | advanced/gis/gisroad/src/main/java/org/arakhne/afc/gis/road/primitive/RoadNetworkConstants.java | RoadNetworkConstants.getPreferredAttributeNameForTrafficDirection | @Pure
public static String getPreferredAttributeNameForTrafficDirection() {
final Preferences prefs = Preferences.userNodeForPackage(RoadNetworkConstants.class);
if (prefs != null) {
return prefs.get("TRAFFIC_DIRECTION_ATTR_NAME", DEFAULT_ATTR_TRAFFIC_DIRECTION); //$NON-NLS-1$
}
return DEFAULT_ATTR_TRAFFIC_DIRECTION;
} | java | @Pure
public static String getPreferredAttributeNameForTrafficDirection() {
final Preferences prefs = Preferences.userNodeForPackage(RoadNetworkConstants.class);
if (prefs != null) {
return prefs.get("TRAFFIC_DIRECTION_ATTR_NAME", DEFAULT_ATTR_TRAFFIC_DIRECTION); //$NON-NLS-1$
}
return DEFAULT_ATTR_TRAFFIC_DIRECTION;
} | [
"@",
"Pure",
"public",
"static",
"String",
"getPreferredAttributeNameForTrafficDirection",
"(",
")",
"{",
"final",
"Preferences",
"prefs",
"=",
"Preferences",
".",
"userNodeForPackage",
"(",
"RoadNetworkConstants",
".",
"class",
")",
";",
"if",
"(",
"prefs",
"!=",
... | Replies the preferred name for the traffic direction on the roads.
@return the preferred name for the traffic direction on the roads.
@see #DEFAULT_ATTR_TRAFFIC_DIRECTION | [
"Replies",
"the",
"preferred",
"name",
"for",
"the",
"traffic",
"direction",
"on",
"the",
"roads",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/gisroad/src/main/java/org/arakhne/afc/gis/road/primitive/RoadNetworkConstants.java#L358-L365 | train |
gallandarakhneorg/afc | advanced/gis/gisroad/src/main/java/org/arakhne/afc/gis/road/primitive/RoadNetworkConstants.java | RoadNetworkConstants.setPreferredAttributeNameForTrafficDirection | public static void setPreferredAttributeNameForTrafficDirection(String name) {
final Preferences prefs = Preferences.userNodeForPackage(RoadNetworkConstants.class);
if (prefs != null) {
if (name == null || "".equals(name) || DEFAULT_ATTR_TRAFFIC_DIRECTION.equalsIgnoreCase(name)) { //$NON-NLS-1$
prefs.remove("TRAFFIC_DIRECTION_ATTR_NAME"); //$NON-NLS-1$
} else {
prefs.put("TRAFFIC_DIRECTION_ATTR_NAME", name); //$NON-NLS-1$
}
}
} | java | public static void setPreferredAttributeNameForTrafficDirection(String name) {
final Preferences prefs = Preferences.userNodeForPackage(RoadNetworkConstants.class);
if (prefs != null) {
if (name == null || "".equals(name) || DEFAULT_ATTR_TRAFFIC_DIRECTION.equalsIgnoreCase(name)) { //$NON-NLS-1$
prefs.remove("TRAFFIC_DIRECTION_ATTR_NAME"); //$NON-NLS-1$
} else {
prefs.put("TRAFFIC_DIRECTION_ATTR_NAME", name); //$NON-NLS-1$
}
}
} | [
"public",
"static",
"void",
"setPreferredAttributeNameForTrafficDirection",
"(",
"String",
"name",
")",
"{",
"final",
"Preferences",
"prefs",
"=",
"Preferences",
".",
"userNodeForPackage",
"(",
"RoadNetworkConstants",
".",
"class",
")",
";",
"if",
"(",
"prefs",
"!="... | Set the preferred name for the traffic direction on the roads.
@param name is the preferred name for the traffic direction on the roads.
@see #DEFAULT_ATTR_TRAFFIC_DIRECTION | [
"Set",
"the",
"preferred",
"name",
"for",
"the",
"traffic",
"direction",
"on",
"the",
"roads",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/gisroad/src/main/java/org/arakhne/afc/gis/road/primitive/RoadNetworkConstants.java#L372-L381 | train |
gallandarakhneorg/afc | advanced/gis/gisroad/src/main/java/org/arakhne/afc/gis/road/primitive/RoadNetworkConstants.java | RoadNetworkConstants.getPreferredAttributeValueForTrafficDirection | @Pure
public static String getPreferredAttributeValueForTrafficDirection(TrafficDirection direction, int index) {
final Preferences prefs = Preferences.userNodeForPackage(RoadNetworkConstants.class);
if (prefs != null) {
final StringBuilder b = new StringBuilder();
b.append("TRAFFIC_DIRECTION_VALUE_"); //$NON-NLS-1$
b.append(direction.name());
b.append("_"); //$NON-NLS-1$
b.append(index);
final String v = prefs.get(b.toString(), null);
if (v != null && !"".equals(v)) { //$NON-NLS-1$
return v;
}
}
try {
return getSystemDefault(direction, index);
} catch (AssertionError e) {
throw e;
} catch (Throwable exception) {
return null;
}
} | java | @Pure
public static String getPreferredAttributeValueForTrafficDirection(TrafficDirection direction, int index) {
final Preferences prefs = Preferences.userNodeForPackage(RoadNetworkConstants.class);
if (prefs != null) {
final StringBuilder b = new StringBuilder();
b.append("TRAFFIC_DIRECTION_VALUE_"); //$NON-NLS-1$
b.append(direction.name());
b.append("_"); //$NON-NLS-1$
b.append(index);
final String v = prefs.get(b.toString(), null);
if (v != null && !"".equals(v)) { //$NON-NLS-1$
return v;
}
}
try {
return getSystemDefault(direction, index);
} catch (AssertionError e) {
throw e;
} catch (Throwable exception) {
return null;
}
} | [
"@",
"Pure",
"public",
"static",
"String",
"getPreferredAttributeValueForTrafficDirection",
"(",
"TrafficDirection",
"direction",
",",
"int",
"index",
")",
"{",
"final",
"Preferences",
"prefs",
"=",
"Preferences",
".",
"userNodeForPackage",
"(",
"RoadNetworkConstants",
... | Replies the preferred value of traffic direction
used in the attributes for the traffic direction on the roads.
@param direction a direction.
@param index is the index of the supported string to reply
@return the preferred name for the traffic direction on the roads,
or <code>null</code> if there is no string value for the given index. | [
"Replies",
"the",
"preferred",
"value",
"of",
"traffic",
"direction",
"used",
"in",
"the",
"attributes",
"for",
"the",
"traffic",
"direction",
"on",
"the",
"roads",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/gisroad/src/main/java/org/arakhne/afc/gis/road/primitive/RoadNetworkConstants.java#L391-L412 | train |
gallandarakhneorg/afc | advanced/gis/gisroad/src/main/java/org/arakhne/afc/gis/road/primitive/RoadNetworkConstants.java | RoadNetworkConstants.getPreferredAttributeValuesForTrafficDirection | @Pure
public static List<String> getPreferredAttributeValuesForTrafficDirection(TrafficDirection direction) {
final List<String> array = new ArrayList<>();
int i = 0;
String value = getPreferredAttributeValueForTrafficDirection(direction, i);
while (value != null) {
array.add(value);
value = getPreferredAttributeValueForTrafficDirection(direction, ++i);
}
return array;
} | java | @Pure
public static List<String> getPreferredAttributeValuesForTrafficDirection(TrafficDirection direction) {
final List<String> array = new ArrayList<>();
int i = 0;
String value = getPreferredAttributeValueForTrafficDirection(direction, i);
while (value != null) {
array.add(value);
value = getPreferredAttributeValueForTrafficDirection(direction, ++i);
}
return array;
} | [
"@",
"Pure",
"public",
"static",
"List",
"<",
"String",
">",
"getPreferredAttributeValuesForTrafficDirection",
"(",
"TrafficDirection",
"direction",
")",
"{",
"final",
"List",
"<",
"String",
">",
"array",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"int",
"i... | Replies the preferred values of traffic direction
used in the attributes for the traffic direction on the roads.
@param direction aa direction
@return the preferred names for the traffic direction on the roads, never <code>null</code>. | [
"Replies",
"the",
"preferred",
"values",
"of",
"traffic",
"direction",
"used",
"in",
"the",
"attributes",
"for",
"the",
"traffic",
"direction",
"on",
"the",
"roads",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/gisroad/src/main/java/org/arakhne/afc/gis/road/primitive/RoadNetworkConstants.java#L420-L430 | train |
gallandarakhneorg/afc | advanced/gis/gisroad/src/main/java/org/arakhne/afc/gis/road/primitive/RoadNetworkConstants.java | RoadNetworkConstants.getSystemDefault | @Pure
public static String getSystemDefault(TrafficDirection direction, int valueIndex) {
// Values from the IGN-BDCarto standard
switch (direction) {
case DOUBLE_WAY:
switch (valueIndex) {
case 0:
return DEFAULT_DOUBLE_WAY_TRAFFIC_DIRECTION_0;
case 1:
return DEFAULT_DOUBLE_WAY_TRAFFIC_DIRECTION_1;
default:
throw new IndexOutOfBoundsException();
}
case NO_ENTRY:
switch (valueIndex) {
case 0:
return DEFAULT_NO_ENTRY_TRAFFIC_DIRECTION_0;
case 1:
return DEFAULT_NO_ENTRY_TRAFFIC_DIRECTION_1;
default:
throw new IndexOutOfBoundsException();
}
case NO_WAY:
switch (valueIndex) {
case 0:
return DEFAULT_NO_WAY_TRAFFIC_DIRECTION_0;
case 1:
return DEFAULT_NO_WAY_TRAFFIC_DIRECTION_1;
default:
throw new IndexOutOfBoundsException();
}
case ONE_WAY:
switch (valueIndex) {
case 0:
return DEFAULT_ONE_WAY_TRAFFIC_DIRECTION_0;
case 1:
return DEFAULT_ONE_WAY_TRAFFIC_DIRECTION_1;
default:
throw new IndexOutOfBoundsException();
}
default:
}
throw new IllegalArgumentException();
} | java | @Pure
public static String getSystemDefault(TrafficDirection direction, int valueIndex) {
// Values from the IGN-BDCarto standard
switch (direction) {
case DOUBLE_WAY:
switch (valueIndex) {
case 0:
return DEFAULT_DOUBLE_WAY_TRAFFIC_DIRECTION_0;
case 1:
return DEFAULT_DOUBLE_WAY_TRAFFIC_DIRECTION_1;
default:
throw new IndexOutOfBoundsException();
}
case NO_ENTRY:
switch (valueIndex) {
case 0:
return DEFAULT_NO_ENTRY_TRAFFIC_DIRECTION_0;
case 1:
return DEFAULT_NO_ENTRY_TRAFFIC_DIRECTION_1;
default:
throw new IndexOutOfBoundsException();
}
case NO_WAY:
switch (valueIndex) {
case 0:
return DEFAULT_NO_WAY_TRAFFIC_DIRECTION_0;
case 1:
return DEFAULT_NO_WAY_TRAFFIC_DIRECTION_1;
default:
throw new IndexOutOfBoundsException();
}
case ONE_WAY:
switch (valueIndex) {
case 0:
return DEFAULT_ONE_WAY_TRAFFIC_DIRECTION_0;
case 1:
return DEFAULT_ONE_WAY_TRAFFIC_DIRECTION_1;
default:
throw new IndexOutOfBoundsException();
}
default:
}
throw new IllegalArgumentException();
} | [
"@",
"Pure",
"public",
"static",
"String",
"getSystemDefault",
"(",
"TrafficDirection",
"direction",
",",
"int",
"valueIndex",
")",
"{",
"// Values from the IGN-BDCarto standard",
"switch",
"(",
"direction",
")",
"{",
"case",
"DOUBLE_WAY",
":",
"switch",
"(",
"value... | Replies the system default string-value for the traffic direction, at the
given index in the list of system default values.
@param direction is the direction for which the string value should be replied
@param valueIndex is the position of the string-value.
@return the string-value at the given position, never <code>null</code>
@throws IndexOutOfBoundsException is the given index is wrong.
@throws IllegalArgumentException is the given direction is wrong. | [
"Replies",
"the",
"system",
"default",
"string",
"-",
"value",
"for",
"the",
"traffic",
"direction",
"at",
"the",
"given",
"index",
"in",
"the",
"list",
"of",
"system",
"default",
"values",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/gisroad/src/main/java/org/arakhne/afc/gis/road/primitive/RoadNetworkConstants.java#L441-L484 | train |
gallandarakhneorg/afc | advanced/gis/gisroad/src/main/java/org/arakhne/afc/gis/road/primitive/RoadNetworkConstants.java | RoadNetworkConstants.getSystemDefault | @Pure
public static String getSystemDefault(RoadType type) {
switch (type) {
case OTHER:
return DEFAULT_OTHER_ROAD_TYPE;
case PRIVACY_PATH:
return DEFAULT_PRIVACY_ROAD_TYPE;
case TRACK:
return DEFAULT_TRACK_ROAD_TYPE;
case BIKEWAY:
return DEFAULT_BIKEWAY_ROAD_TYPE;
case LOCAL_ROAD:
return DEFAULT_LOCAL_ROAD_ROAD_TYPE;
case INTERCHANGE_RAMP:
return DEFAULT_INTERCHANGE_RAMP_ROAD_TYPE;
case MAJOR_URBAN_AXIS:
return DEFAULT_MAJOR_URBAN_ROAD_TYPE;
case SECONDARY_ROAD:
return DEFAULT_SECONDARY_ROAD_TYPE;
case MAJOR_ROAD:
return DEFAULT_MAJOR_ROAD_TYPE;
case FREEWAY:
return DEFAULT_FREEWAY_ROAD_TYPE;
default:
}
throw new IllegalArgumentException();
} | java | @Pure
public static String getSystemDefault(RoadType type) {
switch (type) {
case OTHER:
return DEFAULT_OTHER_ROAD_TYPE;
case PRIVACY_PATH:
return DEFAULT_PRIVACY_ROAD_TYPE;
case TRACK:
return DEFAULT_TRACK_ROAD_TYPE;
case BIKEWAY:
return DEFAULT_BIKEWAY_ROAD_TYPE;
case LOCAL_ROAD:
return DEFAULT_LOCAL_ROAD_ROAD_TYPE;
case INTERCHANGE_RAMP:
return DEFAULT_INTERCHANGE_RAMP_ROAD_TYPE;
case MAJOR_URBAN_AXIS:
return DEFAULT_MAJOR_URBAN_ROAD_TYPE;
case SECONDARY_ROAD:
return DEFAULT_SECONDARY_ROAD_TYPE;
case MAJOR_ROAD:
return DEFAULT_MAJOR_ROAD_TYPE;
case FREEWAY:
return DEFAULT_FREEWAY_ROAD_TYPE;
default:
}
throw new IllegalArgumentException();
} | [
"@",
"Pure",
"public",
"static",
"String",
"getSystemDefault",
"(",
"RoadType",
"type",
")",
"{",
"switch",
"(",
"type",
")",
"{",
"case",
"OTHER",
":",
"return",
"DEFAULT_OTHER_ROAD_TYPE",
";",
"case",
"PRIVACY_PATH",
":",
"return",
"DEFAULT_PRIVACY_ROAD_TYPE",
... | Replies the system-default value for the type of
road.
@param type a type
@return the system-default value.
@throws IllegalArgumentException if bad type. | [
"Replies",
"the",
"system",
"-",
"default",
"value",
"for",
"the",
"type",
"of",
"road",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/gisroad/src/main/java/org/arakhne/afc/gis/road/primitive/RoadNetworkConstants.java#L493-L519 | train |
gallandarakhneorg/afc | advanced/gis/gisroad/src/main/java/org/arakhne/afc/gis/road/primitive/RoadNetworkConstants.java | RoadNetworkConstants.getSystemDefaults | @Pure
public static List<String> getSystemDefaults(TrafficDirection direction) {
final List<String> array = new ArrayList<>();
try {
int i = 0;
while (true) {
array.add(getSystemDefault(direction, i));
++i;
}
} catch (AssertionError e) {
throw e;
} catch (Throwable exception) {
//
}
return array;
} | java | @Pure
public static List<String> getSystemDefaults(TrafficDirection direction) {
final List<String> array = new ArrayList<>();
try {
int i = 0;
while (true) {
array.add(getSystemDefault(direction, i));
++i;
}
} catch (AssertionError e) {
throw e;
} catch (Throwable exception) {
//
}
return array;
} | [
"@",
"Pure",
"public",
"static",
"List",
"<",
"String",
">",
"getSystemDefaults",
"(",
"TrafficDirection",
"direction",
")",
"{",
"final",
"List",
"<",
"String",
">",
"array",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"try",
"{",
"int",
"i",
"=",
"... | Replies the system default string-values for the traffic direction.
@param direction is the direction for which the string values should be replied
@return the string-values, never <code>null</code> | [
"Replies",
"the",
"system",
"default",
"string",
"-",
"values",
"for",
"the",
"traffic",
"direction",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/gisroad/src/main/java/org/arakhne/afc/gis/road/primitive/RoadNetworkConstants.java#L526-L541 | train |
gallandarakhneorg/afc | advanced/gis/gisroad/src/main/java/org/arakhne/afc/gis/road/primitive/RoadNetworkConstants.java | RoadNetworkConstants.setPreferredAttributeValueForTrafficDirection | public static void setPreferredAttributeValueForTrafficDirection(TrafficDirection direction, int index, String value) {
final Preferences prefs = Preferences.userNodeForPackage(RoadNetworkConstants.class);
if (prefs != null) {
final StringBuilder keyName = new StringBuilder();
keyName.append("TRAFFIC_DIRECTION_VALUE_"); //$NON-NLS-1$
keyName.append(direction.name());
keyName.append("_"); //$NON-NLS-1$
keyName.append(index);
String sysDef;
try {
sysDef = getSystemDefault(direction, index);
} catch (IndexOutOfBoundsException exception) {
sysDef = null;
}
if (value == null || "".equals(value) //$NON-NLS-1$
|| (sysDef != null && sysDef.equalsIgnoreCase(value))) {
prefs.remove(keyName.toString());
return;
}
prefs.put(keyName.toString(), value);
}
} | java | public static void setPreferredAttributeValueForTrafficDirection(TrafficDirection direction, int index, String value) {
final Preferences prefs = Preferences.userNodeForPackage(RoadNetworkConstants.class);
if (prefs != null) {
final StringBuilder keyName = new StringBuilder();
keyName.append("TRAFFIC_DIRECTION_VALUE_"); //$NON-NLS-1$
keyName.append(direction.name());
keyName.append("_"); //$NON-NLS-1$
keyName.append(index);
String sysDef;
try {
sysDef = getSystemDefault(direction, index);
} catch (IndexOutOfBoundsException exception) {
sysDef = null;
}
if (value == null || "".equals(value) //$NON-NLS-1$
|| (sysDef != null && sysDef.equalsIgnoreCase(value))) {
prefs.remove(keyName.toString());
return;
}
prefs.put(keyName.toString(), value);
}
} | [
"public",
"static",
"void",
"setPreferredAttributeValueForTrafficDirection",
"(",
"TrafficDirection",
"direction",
",",
"int",
"index",
",",
"String",
"value",
")",
"{",
"final",
"Preferences",
"prefs",
"=",
"Preferences",
".",
"userNodeForPackage",
"(",
"RoadNetworkCon... | Set the preferred value of traffic direction
used in the attributes for the traffic direction on the roads.
@param direction a direction.
@param index is the index of the supported string to reply
@param value is the preferred name for the traffic direction on the roads. | [
"Set",
"the",
"preferred",
"value",
"of",
"traffic",
"direction",
"used",
"in",
"the",
"attributes",
"for",
"the",
"traffic",
"direction",
"on",
"the",
"roads",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/gisroad/src/main/java/org/arakhne/afc/gis/road/primitive/RoadNetworkConstants.java#L550-L571 | train |
gallandarakhneorg/afc | advanced/gis/gisroad/src/main/java/org/arakhne/afc/gis/road/primitive/RoadNetworkConstants.java | RoadNetworkConstants.getPreferredRoadConnectionDistance | @Pure
public static double getPreferredRoadConnectionDistance() {
final Preferences prefs = Preferences.userNodeForPackage(RoadNetworkConstants.class);
if (prefs != null) {
return prefs.getDouble("ROAD_CONNECTION_DISTANCE", DEFAULT_ROAD_CONNECTION_DISTANCE); //$NON-NLS-1$
}
return DEFAULT_ROAD_CONNECTION_DISTANCE;
} | java | @Pure
public static double getPreferredRoadConnectionDistance() {
final Preferences prefs = Preferences.userNodeForPackage(RoadNetworkConstants.class);
if (prefs != null) {
return prefs.getDouble("ROAD_CONNECTION_DISTANCE", DEFAULT_ROAD_CONNECTION_DISTANCE); //$NON-NLS-1$
}
return DEFAULT_ROAD_CONNECTION_DISTANCE;
} | [
"@",
"Pure",
"public",
"static",
"double",
"getPreferredRoadConnectionDistance",
"(",
")",
"{",
"final",
"Preferences",
"prefs",
"=",
"Preferences",
".",
"userNodeForPackage",
"(",
"RoadNetworkConstants",
".",
"class",
")",
";",
"if",
"(",
"prefs",
"!=",
"null",
... | Replies the preferred distance below which roads may be connected.
@return the preferred distance (in meters) below which roads may be connected. | [
"Replies",
"the",
"preferred",
"distance",
"below",
"which",
"roads",
"may",
"be",
"connected",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/gisroad/src/main/java/org/arakhne/afc/gis/road/primitive/RoadNetworkConstants.java#L602-L609 | train |
gallandarakhneorg/afc | advanced/gis/gisroad/src/main/java/org/arakhne/afc/gis/road/primitive/RoadNetworkConstants.java | RoadNetworkConstants.setPreferredRoadConnectionDistance | public static void setPreferredRoadConnectionDistance(double distance) {
final Preferences prefs = Preferences.userNodeForPackage(RoadNetworkConstants.class);
if (prefs != null) {
if (distance <= 0.) {
prefs.remove("ROAD_CONNECTION_DISTANCE"); //$NON-NLS-1$
} else {
prefs.putDouble("ROAD_CONNECTION_DISTANCE", distance); //$NON-NLS-1$
}
}
} | java | public static void setPreferredRoadConnectionDistance(double distance) {
final Preferences prefs = Preferences.userNodeForPackage(RoadNetworkConstants.class);
if (prefs != null) {
if (distance <= 0.) {
prefs.remove("ROAD_CONNECTION_DISTANCE"); //$NON-NLS-1$
} else {
prefs.putDouble("ROAD_CONNECTION_DISTANCE", distance); //$NON-NLS-1$
}
}
} | [
"public",
"static",
"void",
"setPreferredRoadConnectionDistance",
"(",
"double",
"distance",
")",
"{",
"final",
"Preferences",
"prefs",
"=",
"Preferences",
".",
"userNodeForPackage",
"(",
"RoadNetworkConstants",
".",
"class",
")",
";",
"if",
"(",
"prefs",
"!=",
"n... | Set the preferred distance below which roads may be connected.
@param distance is the preferred distance (in meters) below which roads may be connected. | [
"Set",
"the",
"preferred",
"distance",
"below",
"which",
"roads",
"may",
"be",
"connected",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/gisroad/src/main/java/org/arakhne/afc/gis/road/primitive/RoadNetworkConstants.java#L615-L624 | train |
gallandarakhneorg/afc | advanced/gis/gisroad/src/main/java/org/arakhne/afc/gis/road/primitive/RoadNetworkConstants.java | RoadNetworkConstants.getPreferredRoadType | @Pure
public static RoadType getPreferredRoadType() {
final Preferences prefs = Preferences.userNodeForPackage(RoadNetworkConstants.class);
String name = null;
if (prefs != null) {
name = prefs.get("ROAD_TYPE", null); //$NON-NLS-1$
}
if (name != null) {
RoadType type;
try {
type = RoadType.valueOf(name);
} catch (Throwable exception) {
type = null;
}
if (type != null) {
return type;
}
}
return RoadType.OTHER;
} | java | @Pure
public static RoadType getPreferredRoadType() {
final Preferences prefs = Preferences.userNodeForPackage(RoadNetworkConstants.class);
String name = null;
if (prefs != null) {
name = prefs.get("ROAD_TYPE", null); //$NON-NLS-1$
}
if (name != null) {
RoadType type;
try {
type = RoadType.valueOf(name);
} catch (Throwable exception) {
type = null;
}
if (type != null) {
return type;
}
}
return RoadType.OTHER;
} | [
"@",
"Pure",
"public",
"static",
"RoadType",
"getPreferredRoadType",
"(",
")",
"{",
"final",
"Preferences",
"prefs",
"=",
"Preferences",
".",
"userNodeForPackage",
"(",
"RoadNetworkConstants",
".",
"class",
")",
";",
"String",
"name",
"=",
"null",
";",
"if",
"... | Replies the preferred type of road segment.
@return the preferred type of road segment. | [
"Replies",
"the",
"preferred",
"type",
"of",
"road",
"segment",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/gisroad/src/main/java/org/arakhne/afc/gis/road/primitive/RoadNetworkConstants.java#L630-L649 | train |
gallandarakhneorg/afc | advanced/gis/gisroad/src/main/java/org/arakhne/afc/gis/road/primitive/RoadNetworkConstants.java | RoadNetworkConstants.setPreferredRoadType | public static void setPreferredRoadType(RoadType type) {
final Preferences prefs = Preferences.userNodeForPackage(RoadNetworkConstants.class);
if (prefs != null) {
if (type == null) {
prefs.remove("ROAD_TYPE"); //$NON-NLS-1$
} else {
prefs.put("ROAD_TYPE", type.name()); //$NON-NLS-1$
}
}
} | java | public static void setPreferredRoadType(RoadType type) {
final Preferences prefs = Preferences.userNodeForPackage(RoadNetworkConstants.class);
if (prefs != null) {
if (type == null) {
prefs.remove("ROAD_TYPE"); //$NON-NLS-1$
} else {
prefs.put("ROAD_TYPE", type.name()); //$NON-NLS-1$
}
}
} | [
"public",
"static",
"void",
"setPreferredRoadType",
"(",
"RoadType",
"type",
")",
"{",
"final",
"Preferences",
"prefs",
"=",
"Preferences",
".",
"userNodeForPackage",
"(",
"RoadNetworkConstants",
".",
"class",
")",
";",
"if",
"(",
"prefs",
"!=",
"null",
")",
"... | Set the preferred type of road segment.
@param type is the preferred type of road segment. | [
"Set",
"the",
"preferred",
"type",
"of",
"road",
"segment",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/gisroad/src/main/java/org/arakhne/afc/gis/road/primitive/RoadNetworkConstants.java#L655-L664 | train |
gallandarakhneorg/afc | advanced/gis/gisroad/src/main/java/org/arakhne/afc/gis/road/primitive/RoadNetworkConstants.java | RoadNetworkConstants.getPreferredAttributeNameForRoadType | @Pure
public static String getPreferredAttributeNameForRoadType() {
final Preferences prefs = Preferences.userNodeForPackage(RoadNetworkConstants.class);
if (prefs != null) {
return prefs.get("ROAD_TYPE_ATTR_NAME", DEFAULT_ATTR_ROAD_TYPE); //$NON-NLS-1$
}
return DEFAULT_ATTR_ROAD_TYPE;
} | java | @Pure
public static String getPreferredAttributeNameForRoadType() {
final Preferences prefs = Preferences.userNodeForPackage(RoadNetworkConstants.class);
if (prefs != null) {
return prefs.get("ROAD_TYPE_ATTR_NAME", DEFAULT_ATTR_ROAD_TYPE); //$NON-NLS-1$
}
return DEFAULT_ATTR_ROAD_TYPE;
} | [
"@",
"Pure",
"public",
"static",
"String",
"getPreferredAttributeNameForRoadType",
"(",
")",
"{",
"final",
"Preferences",
"prefs",
"=",
"Preferences",
".",
"userNodeForPackage",
"(",
"RoadNetworkConstants",
".",
"class",
")",
";",
"if",
"(",
"prefs",
"!=",
"null",... | Replies the preferred name for the types of the roads.
@return the preferred name for the types of the roads.
@see #DEFAULT_ATTR_ROAD_TYPE | [
"Replies",
"the",
"preferred",
"name",
"for",
"the",
"types",
"of",
"the",
"roads",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/gisroad/src/main/java/org/arakhne/afc/gis/road/primitive/RoadNetworkConstants.java#L671-L678 | train |
gallandarakhneorg/afc | advanced/gis/gisroad/src/main/java/org/arakhne/afc/gis/road/primitive/RoadNetworkConstants.java | RoadNetworkConstants.setPreferredAttributeNameForRoadType | public static void setPreferredAttributeNameForRoadType(String name) {
final Preferences prefs = Preferences.userNodeForPackage(RoadNetworkConstants.class);
if (prefs != null) {
if (name == null || "".equals(name) || DEFAULT_ATTR_ROAD_TYPE.equalsIgnoreCase(name)) { //$NON-NLS-1$
prefs.remove("ROAD_TYPE_ATTR_NAME"); //$NON-NLS-1$
} else {
prefs.put("ROAD_TYPE_ATTR_NAME", name); //$NON-NLS-1$
}
}
} | java | public static void setPreferredAttributeNameForRoadType(String name) {
final Preferences prefs = Preferences.userNodeForPackage(RoadNetworkConstants.class);
if (prefs != null) {
if (name == null || "".equals(name) || DEFAULT_ATTR_ROAD_TYPE.equalsIgnoreCase(name)) { //$NON-NLS-1$
prefs.remove("ROAD_TYPE_ATTR_NAME"); //$NON-NLS-1$
} else {
prefs.put("ROAD_TYPE_ATTR_NAME", name); //$NON-NLS-1$
}
}
} | [
"public",
"static",
"void",
"setPreferredAttributeNameForRoadType",
"(",
"String",
"name",
")",
"{",
"final",
"Preferences",
"prefs",
"=",
"Preferences",
".",
"userNodeForPackage",
"(",
"RoadNetworkConstants",
".",
"class",
")",
";",
"if",
"(",
"prefs",
"!=",
"nul... | Set the preferred name for the types of the roads.
@param name is the preferred name for the types of the roads.
@see #DEFAULT_ATTR_ROAD_TYPE | [
"Set",
"the",
"preferred",
"name",
"for",
"the",
"types",
"of",
"the",
"roads",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/gisroad/src/main/java/org/arakhne/afc/gis/road/primitive/RoadNetworkConstants.java#L685-L694 | train |
gallandarakhneorg/afc | advanced/gis/gisroad/src/main/java/org/arakhne/afc/gis/road/primitive/RoadNetworkConstants.java | RoadNetworkConstants.getPreferredAttributeValueForRoadType | @Pure
public static String getPreferredAttributeValueForRoadType(RoadType type) {
final Preferences prefs = Preferences.userNodeForPackage(RoadNetworkConstants.class);
if (prefs != null) {
final String v = prefs.get("ROAD_TYPE_VALUE_" + type.name(), null); //$NON-NLS-1$
if (v != null && !"".equals(v)) { //$NON-NLS-1$
return v;
}
}
return getSystemDefault(type);
} | java | @Pure
public static String getPreferredAttributeValueForRoadType(RoadType type) {
final Preferences prefs = Preferences.userNodeForPackage(RoadNetworkConstants.class);
if (prefs != null) {
final String v = prefs.get("ROAD_TYPE_VALUE_" + type.name(), null); //$NON-NLS-1$
if (v != null && !"".equals(v)) { //$NON-NLS-1$
return v;
}
}
return getSystemDefault(type);
} | [
"@",
"Pure",
"public",
"static",
"String",
"getPreferredAttributeValueForRoadType",
"(",
"RoadType",
"type",
")",
"{",
"final",
"Preferences",
"prefs",
"=",
"Preferences",
".",
"userNodeForPackage",
"(",
"RoadNetworkConstants",
".",
"class",
")",
";",
"if",
"(",
"... | Replies the preferred value of road type
used in the attributes for the types of the roads.
@param type a type
@return the preferred name for the given type of the roads. | [
"Replies",
"the",
"preferred",
"value",
"of",
"road",
"type",
"used",
"in",
"the",
"attributes",
"for",
"the",
"types",
"of",
"the",
"roads",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/gisroad/src/main/java/org/arakhne/afc/gis/road/primitive/RoadNetworkConstants.java#L702-L712 | train |
gallandarakhneorg/afc | advanced/gis/gisroad/src/main/java/org/arakhne/afc/gis/road/primitive/RoadNetworkConstants.java | RoadNetworkConstants.setPreferredAttributeValueForRoadType | public static void setPreferredAttributeValueForRoadType(RoadType type, String value) {
final Preferences prefs = Preferences.userNodeForPackage(RoadNetworkConstants.class);
if (prefs != null) {
final String sysDef = getSystemDefault(type);
if (value == null || "".equals(value) || sysDef.equalsIgnoreCase(value)) { //$NON-NLS-1$
prefs.remove("ROAD_TYPE_VALUE_" + type.name()); //$NON-NLS-1$
} else {
prefs.put("ROAD_TYPE_VALUE_" + type.name(), value); //$NON-NLS-1$
}
}
} | java | public static void setPreferredAttributeValueForRoadType(RoadType type, String value) {
final Preferences prefs = Preferences.userNodeForPackage(RoadNetworkConstants.class);
if (prefs != null) {
final String sysDef = getSystemDefault(type);
if (value == null || "".equals(value) || sysDef.equalsIgnoreCase(value)) { //$NON-NLS-1$
prefs.remove("ROAD_TYPE_VALUE_" + type.name()); //$NON-NLS-1$
} else {
prefs.put("ROAD_TYPE_VALUE_" + type.name(), value); //$NON-NLS-1$
}
}
} | [
"public",
"static",
"void",
"setPreferredAttributeValueForRoadType",
"(",
"RoadType",
"type",
",",
"String",
"value",
")",
"{",
"final",
"Preferences",
"prefs",
"=",
"Preferences",
".",
"userNodeForPackage",
"(",
"RoadNetworkConstants",
".",
"class",
")",
";",
"if",... | Set the preferred value of road type
used in the attributes for the types of the roads.
@param type a type
@param value is the preferred name for the types of the roads. | [
"Set",
"the",
"preferred",
"value",
"of",
"road",
"type",
"used",
"in",
"the",
"attributes",
"for",
"the",
"types",
"of",
"the",
"roads",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/gisroad/src/main/java/org/arakhne/afc/gis/road/primitive/RoadNetworkConstants.java#L720-L730 | train |
gallandarakhneorg/afc | advanced/gis/gisroad/src/main/java/org/arakhne/afc/gis/road/primitive/RoadNetworkConstants.java | RoadNetworkConstants.getPreferredAttributeNameForRoadName | @Pure
public static String getPreferredAttributeNameForRoadName() {
final Preferences prefs = Preferences.userNodeForPackage(RoadNetworkConstants.class);
if (prefs != null) {
return prefs.get("ROAD_NAME_ATTR_NAME", DEFAULT_ATTR_ROAD_NAME); //$NON-NLS-1$
}
return DEFAULT_ATTR_ROAD_NAME;
} | java | @Pure
public static String getPreferredAttributeNameForRoadName() {
final Preferences prefs = Preferences.userNodeForPackage(RoadNetworkConstants.class);
if (prefs != null) {
return prefs.get("ROAD_NAME_ATTR_NAME", DEFAULT_ATTR_ROAD_NAME); //$NON-NLS-1$
}
return DEFAULT_ATTR_ROAD_NAME;
} | [
"@",
"Pure",
"public",
"static",
"String",
"getPreferredAttributeNameForRoadName",
"(",
")",
"{",
"final",
"Preferences",
"prefs",
"=",
"Preferences",
".",
"userNodeForPackage",
"(",
"RoadNetworkConstants",
".",
"class",
")",
";",
"if",
"(",
"prefs",
"!=",
"null",... | Replies the preferred name for the name of the roads.
@return the preferred name for the name of the roads.
@see #DEFAULT_ATTR_ROAD_NAME | [
"Replies",
"the",
"preferred",
"name",
"for",
"the",
"name",
"of",
"the",
"roads",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/gisroad/src/main/java/org/arakhne/afc/gis/road/primitive/RoadNetworkConstants.java#L737-L744 | train |
gallandarakhneorg/afc | advanced/gis/gisroad/src/main/java/org/arakhne/afc/gis/road/primitive/RoadNetworkConstants.java | RoadNetworkConstants.setPreferredAttributeNameForRoadName | public static void setPreferredAttributeNameForRoadName(String name) {
final Preferences prefs = Preferences.userNodeForPackage(RoadNetworkConstants.class);
if (prefs != null) {
if (name == null || "".equals(name) || DEFAULT_ATTR_ROAD_NAME.equalsIgnoreCase(name)) { //$NON-NLS-1$
prefs.remove("ROAD_NAME_ATTR_NAME"); //$NON-NLS-1$
} else {
prefs.put("ROAD_NAME_ATTR_NAME", name); //$NON-NLS-1$
}
}
} | java | public static void setPreferredAttributeNameForRoadName(String name) {
final Preferences prefs = Preferences.userNodeForPackage(RoadNetworkConstants.class);
if (prefs != null) {
if (name == null || "".equals(name) || DEFAULT_ATTR_ROAD_NAME.equalsIgnoreCase(name)) { //$NON-NLS-1$
prefs.remove("ROAD_NAME_ATTR_NAME"); //$NON-NLS-1$
} else {
prefs.put("ROAD_NAME_ATTR_NAME", name); //$NON-NLS-1$
}
}
} | [
"public",
"static",
"void",
"setPreferredAttributeNameForRoadName",
"(",
"String",
"name",
")",
"{",
"final",
"Preferences",
"prefs",
"=",
"Preferences",
".",
"userNodeForPackage",
"(",
"RoadNetworkConstants",
".",
"class",
")",
";",
"if",
"(",
"prefs",
"!=",
"nul... | Set the preferred name for the name of the roads.
@param name is the preferred name for the name of the roads.
@see #DEFAULT_ATTR_ROAD_NAME | [
"Set",
"the",
"preferred",
"name",
"for",
"the",
"name",
"of",
"the",
"roads",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/gisroad/src/main/java/org/arakhne/afc/gis/road/primitive/RoadNetworkConstants.java#L751-L760 | train |
gallandarakhneorg/afc | advanced/gis/gisroad/src/main/java/org/arakhne/afc/gis/road/primitive/RoadNetworkConstants.java | RoadNetworkConstants.getPreferredAttributeNameForRoadNumber | @Pure
public static String getPreferredAttributeNameForRoadNumber() {
final Preferences prefs = Preferences.userNodeForPackage(RoadNetworkConstants.class);
if (prefs != null) {
return prefs.get("ROAD_NUMBER_ATTR_NAME", DEFAULT_ATTR_ROAD_NUMBER); //$NON-NLS-1$
}
return DEFAULT_ATTR_ROAD_NUMBER;
} | java | @Pure
public static String getPreferredAttributeNameForRoadNumber() {
final Preferences prefs = Preferences.userNodeForPackage(RoadNetworkConstants.class);
if (prefs != null) {
return prefs.get("ROAD_NUMBER_ATTR_NAME", DEFAULT_ATTR_ROAD_NUMBER); //$NON-NLS-1$
}
return DEFAULT_ATTR_ROAD_NUMBER;
} | [
"@",
"Pure",
"public",
"static",
"String",
"getPreferredAttributeNameForRoadNumber",
"(",
")",
"{",
"final",
"Preferences",
"prefs",
"=",
"Preferences",
".",
"userNodeForPackage",
"(",
"RoadNetworkConstants",
".",
"class",
")",
";",
"if",
"(",
"prefs",
"!=",
"null... | Replies the preferred name for the numbers of the roads.
@return the preferred name for the numbers of the roads.
@see #DEFAULT_ATTR_ROAD_NUMBER | [
"Replies",
"the",
"preferred",
"name",
"for",
"the",
"numbers",
"of",
"the",
"roads",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/gisroad/src/main/java/org/arakhne/afc/gis/road/primitive/RoadNetworkConstants.java#L767-L774 | train |
gallandarakhneorg/afc | advanced/gis/gisroad/src/main/java/org/arakhne/afc/gis/road/primitive/RoadNetworkConstants.java | RoadNetworkConstants.setPreferredAttributeNameForRoadNumber | public static void setPreferredAttributeNameForRoadNumber(String name) {
final Preferences prefs = Preferences.userNodeForPackage(RoadNetworkConstants.class);
if (prefs != null) {
if (name == null || "".equals(name) || DEFAULT_ATTR_ROAD_NUMBER.equalsIgnoreCase(name)) { //$NON-NLS-1$
prefs.remove("ROAD_NUMBER_ATTR_NAME"); //$NON-NLS-1$
} else {
prefs.put("ROAD_NUMBER_ATTR_NAME", name); //$NON-NLS-1$
}
}
} | java | public static void setPreferredAttributeNameForRoadNumber(String name) {
final Preferences prefs = Preferences.userNodeForPackage(RoadNetworkConstants.class);
if (prefs != null) {
if (name == null || "".equals(name) || DEFAULT_ATTR_ROAD_NUMBER.equalsIgnoreCase(name)) { //$NON-NLS-1$
prefs.remove("ROAD_NUMBER_ATTR_NAME"); //$NON-NLS-1$
} else {
prefs.put("ROAD_NUMBER_ATTR_NAME", name); //$NON-NLS-1$
}
}
} | [
"public",
"static",
"void",
"setPreferredAttributeNameForRoadNumber",
"(",
"String",
"name",
")",
"{",
"final",
"Preferences",
"prefs",
"=",
"Preferences",
".",
"userNodeForPackage",
"(",
"RoadNetworkConstants",
".",
"class",
")",
";",
"if",
"(",
"prefs",
"!=",
"n... | Set the preferred name for the numbers of the roads.
@param name is the preferred name for the numbers of the roads.
@see #DEFAULT_ATTR_ROAD_NUMBER | [
"Set",
"the",
"preferred",
"name",
"for",
"the",
"numbers",
"of",
"the",
"roads",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/gisroad/src/main/java/org/arakhne/afc/gis/road/primitive/RoadNetworkConstants.java#L781-L790 | train |
gallandarakhneorg/afc | advanced/dbasefile/src/main/java/org/arakhne/afc/io/dbase/DBaseFileReader.java | DBaseFileReader.readDBFHeader | @SuppressWarnings("checkstyle:magicnumber")
public void readDBFHeader() throws IOException {
if (this.finished) {
throw new EOFDBaseFileException();
}
if (this.fieldCount != -1) {
// The header was already red
return;
}
//-----------------------------------------------------------
// Bytes Size Content
//-----------------------------------------------------------
// 0 1 byte DBF Format id
// 0x03: FoxBase+, FoxPro, dBASEIII+
// dBASEIV, no memo
// 0x83: FoxBase+, dBASEIII+ with memo
// 0xF5: FoxPro with memo
// 0x8B: dBASEIV with memo
// 0x8E: dBASEIV with SQL table
this.fileVersion = this.stream.readByte();
//-----------------------------------------------------------
// Bytes Size Content
//-----------------------------------------------------------
// 1-3 3 bytes Date of last update: YMD
final Calendar cal = new GregorianCalendar();
cal.set(Calendar.YEAR, this.stream.readByte() + 1900);
cal.set(Calendar.MONTH, this.stream.readByte() - 1);
cal.set(Calendar.DAY_OF_MONTH, this.stream.readByte());
this.lastUpdateDate = cal.getTime();
// Get the count of records
//
//-----------------------------------------------------------
// Bytes Size Content
//-----------------------------------------------------------
// 4-7 4 bytes Number of records in the table
this.recordCount = this.stream.readLEInt();
// Get the count of fields (nbBytes / size of a Field - ending byte ODh)
//
//-----------------------------------------------------------
// Bytes Size Content
//-----------------------------------------------------------
// 8-9 2 bytes Number of bytes in the header
// #bytes = 32 + 32 * #fields + 1;
this.fieldCount = (this.stream.readLEShort() - 1) / 32 - 1;
// Skip the ending chars of the header
//
//-----------------------------------------------------------
// Bytes Size Content
//-----------------------------------------------------------
// 10-11 2 bytes Number of bytes in the record
this.recordSize = this.stream.readLEShort();
//-----------------------------------------------------------
// Bytes Size Content
//-----------------------------------------------------------
// 12-13 2 bytes Reserved
// 14 1 byte Incomplete transaction
// 0x00: Ignored / Transaction End
// 0x01: Transaction started
// 15 1 byte Encryption flag
// 0x00: Not encrypted
// 0x01: Encrypted
// 16-19 4 bytes Free record thread (reserved for LAN only)
// 20-27 8 bytes Reserved for multi-user dBASE (dBASE III+)
// 28 1 byte MDX flag (dBASE IV)
// 0x00: index upon demand
// 0x01: production index exists
this.stream.skipBytes(17);
// use skipBytes because it force to skip the specified amount, instead of skip()
//-----------------------------------------------------------
// Bytes Size Content
//-----------------------------------------------------------
// 29 1 byte Language driver ID
// See {@link DBaseCodePage} for details.
final byte b = this.stream.readByte();
this.codePage = DBaseCodePage.fromLanguageCode(b);
//-----------------------------------------------------------
// Bytes Size Content
//-----------------------------------------------------------
// 30-31 2 bytes Reserved
this.stream.skipBytes(2);
// use skipBytes because it force to skip the specified amount, instead of skip()
// Update the offset of the first record with the size of the header
this.firstRecordOffset = 32;
} | java | @SuppressWarnings("checkstyle:magicnumber")
public void readDBFHeader() throws IOException {
if (this.finished) {
throw new EOFDBaseFileException();
}
if (this.fieldCount != -1) {
// The header was already red
return;
}
//-----------------------------------------------------------
// Bytes Size Content
//-----------------------------------------------------------
// 0 1 byte DBF Format id
// 0x03: FoxBase+, FoxPro, dBASEIII+
// dBASEIV, no memo
// 0x83: FoxBase+, dBASEIII+ with memo
// 0xF5: FoxPro with memo
// 0x8B: dBASEIV with memo
// 0x8E: dBASEIV with SQL table
this.fileVersion = this.stream.readByte();
//-----------------------------------------------------------
// Bytes Size Content
//-----------------------------------------------------------
// 1-3 3 bytes Date of last update: YMD
final Calendar cal = new GregorianCalendar();
cal.set(Calendar.YEAR, this.stream.readByte() + 1900);
cal.set(Calendar.MONTH, this.stream.readByte() - 1);
cal.set(Calendar.DAY_OF_MONTH, this.stream.readByte());
this.lastUpdateDate = cal.getTime();
// Get the count of records
//
//-----------------------------------------------------------
// Bytes Size Content
//-----------------------------------------------------------
// 4-7 4 bytes Number of records in the table
this.recordCount = this.stream.readLEInt();
// Get the count of fields (nbBytes / size of a Field - ending byte ODh)
//
//-----------------------------------------------------------
// Bytes Size Content
//-----------------------------------------------------------
// 8-9 2 bytes Number of bytes in the header
// #bytes = 32 + 32 * #fields + 1;
this.fieldCount = (this.stream.readLEShort() - 1) / 32 - 1;
// Skip the ending chars of the header
//
//-----------------------------------------------------------
// Bytes Size Content
//-----------------------------------------------------------
// 10-11 2 bytes Number of bytes in the record
this.recordSize = this.stream.readLEShort();
//-----------------------------------------------------------
// Bytes Size Content
//-----------------------------------------------------------
// 12-13 2 bytes Reserved
// 14 1 byte Incomplete transaction
// 0x00: Ignored / Transaction End
// 0x01: Transaction started
// 15 1 byte Encryption flag
// 0x00: Not encrypted
// 0x01: Encrypted
// 16-19 4 bytes Free record thread (reserved for LAN only)
// 20-27 8 bytes Reserved for multi-user dBASE (dBASE III+)
// 28 1 byte MDX flag (dBASE IV)
// 0x00: index upon demand
// 0x01: production index exists
this.stream.skipBytes(17);
// use skipBytes because it force to skip the specified amount, instead of skip()
//-----------------------------------------------------------
// Bytes Size Content
//-----------------------------------------------------------
// 29 1 byte Language driver ID
// See {@link DBaseCodePage} for details.
final byte b = this.stream.readByte();
this.codePage = DBaseCodePage.fromLanguageCode(b);
//-----------------------------------------------------------
// Bytes Size Content
//-----------------------------------------------------------
// 30-31 2 bytes Reserved
this.stream.skipBytes(2);
// use skipBytes because it force to skip the specified amount, instead of skip()
// Update the offset of the first record with the size of the header
this.firstRecordOffset = 32;
} | [
"@",
"SuppressWarnings",
"(",
"\"checkstyle:magicnumber\"",
")",
"public",
"void",
"readDBFHeader",
"(",
")",
"throws",
"IOException",
"{",
"if",
"(",
"this",
".",
"finished",
")",
"{",
"throw",
"new",
"EOFDBaseFileException",
"(",
")",
";",
"}",
"if",
"(",
... | Read the header of the DBF file.
@throws IOException in case of error. | [
"Read",
"the",
"header",
"of",
"the",
"DBF",
"file",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/dbasefile/src/main/java/org/arakhne/afc/io/dbase/DBaseFileReader.java#L466-L559 | train |
gallandarakhneorg/afc | advanced/dbasefile/src/main/java/org/arakhne/afc/io/dbase/DBaseFileReader.java | DBaseFileReader.getDBFFieldName | @Pure
public String getDBFFieldName(int index) {
if (this.fieldCount != -1) {
try {
final DBaseFileField field = this.fields.get(index);
if (field != null) {
return field.getName();
}
} catch (Exception exception) {
//
}
}
return null;
} | java | @Pure
public String getDBFFieldName(int index) {
if (this.fieldCount != -1) {
try {
final DBaseFileField field = this.fields.get(index);
if (field != null) {
return field.getName();
}
} catch (Exception exception) {
//
}
}
return null;
} | [
"@",
"Pure",
"public",
"String",
"getDBFFieldName",
"(",
"int",
"index",
")",
"{",
"if",
"(",
"this",
".",
"fieldCount",
"!=",
"-",
"1",
")",
"{",
"try",
"{",
"final",
"DBaseFileField",
"field",
"=",
"this",
".",
"fields",
".",
"get",
"(",
"index",
"... | Replies the name of the i-th field.
@param index the index.
@return the name or <code>null</code> if the function {@link #readDBFFields()}
was never called. | [
"Replies",
"the",
"name",
"of",
"the",
"i",
"-",
"th",
"field",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/dbasefile/src/main/java/org/arakhne/afc/io/dbase/DBaseFileReader.java#L592-L605 | train |
gallandarakhneorg/afc | advanced/dbasefile/src/main/java/org/arakhne/afc/io/dbase/DBaseFileReader.java | DBaseFileReader.getDBFFieldIndex | @Pure
public int getDBFFieldIndex(String name) {
assert name != null;
if (this.fieldCount != -1) {
try {
int i = 0;
for (final DBaseFileField field : this.fields) {
if (field != null && name.equals(field.getName())) {
return i;
}
++i;
}
} catch (Exception exception) {
//
}
}
return -1;
} | java | @Pure
public int getDBFFieldIndex(String name) {
assert name != null;
if (this.fieldCount != -1) {
try {
int i = 0;
for (final DBaseFileField field : this.fields) {
if (field != null && name.equals(field.getName())) {
return i;
}
++i;
}
} catch (Exception exception) {
//
}
}
return -1;
} | [
"@",
"Pure",
"public",
"int",
"getDBFFieldIndex",
"(",
"String",
"name",
")",
"{",
"assert",
"name",
"!=",
"null",
";",
"if",
"(",
"this",
".",
"fieldCount",
"!=",
"-",
"1",
")",
"{",
"try",
"{",
"int",
"i",
"=",
"0",
";",
"for",
"(",
"final",
"D... | Replies the column index of the specified column name.
@param name the field name.
@return the index or <code>-1</code> if the columns was not found
or the function {@link #readDBFFields()} was never called | [
"Replies",
"the",
"column",
"index",
"of",
"the",
"specified",
"column",
"name",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/dbasefile/src/main/java/org/arakhne/afc/io/dbase/DBaseFileReader.java#L614-L631 | train |
gallandarakhneorg/afc | advanced/dbasefile/src/main/java/org/arakhne/afc/io/dbase/DBaseFileReader.java | DBaseFileReader.getDBFFieldType | @Pure
public DBaseFieldType getDBFFieldType(int index) {
if (this.fieldCount != -1) {
try {
final DBaseFileField field = this.fields.get(index);
if (field != null) {
return field.getType();
}
} catch (Exception exception) {
//
}
}
return null;
} | java | @Pure
public DBaseFieldType getDBFFieldType(int index) {
if (this.fieldCount != -1) {
try {
final DBaseFileField field = this.fields.get(index);
if (field != null) {
return field.getType();
}
} catch (Exception exception) {
//
}
}
return null;
} | [
"@",
"Pure",
"public",
"DBaseFieldType",
"getDBFFieldType",
"(",
"int",
"index",
")",
"{",
"if",
"(",
"this",
".",
"fieldCount",
"!=",
"-",
"1",
")",
"{",
"try",
"{",
"final",
"DBaseFileField",
"field",
"=",
"this",
".",
"fields",
".",
"get",
"(",
"ind... | Replies the type of the i-th field.
@param index the index.
@return the type or <code>null</code> if the function {@link #readDBFFields()}
was never called. | [
"Replies",
"the",
"type",
"of",
"the",
"i",
"-",
"th",
"field",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/dbasefile/src/main/java/org/arakhne/afc/io/dbase/DBaseFileReader.java#L640-L653 | train |
gallandarakhneorg/afc | advanced/dbasefile/src/main/java/org/arakhne/afc/io/dbase/DBaseFileReader.java | DBaseFileReader.readDBFFields | @SuppressWarnings({"checkstyle:npathcomplexity", "checkstyle:magicnumber"})
public List<DBaseFileField> readDBFFields() throws IOException, EOFException {
if (this.fields != null) {
return this.fields;
}
if (this.finished) {
throw new EOFDBaseFileException();
}
if (this.fieldCount == -1) {
throw new MustCallReadHeaderFunctionException();
}
//
//-----------------------------------------------------------
// Bytes Size Content
//-----------------------------------------------------------
// 32-m n*32 bytes Field descriptors (see bellow)
// m+1 1 byte terminator character 0x0D
// A field contains at least the "removal flag" byte
int byteSize = 1;
final ArrayList<DBaseFileField> array = new ArrayList<>();
final Charset charSet = (this.codePage == null) ? null : this.codePage.getChatset();
String columnName;
for (int idxFields = 0; idxFields < this.fieldCount; ++idxFields) {
// Read the field header
//
//-----------------------------------------------------------
// Bytes Size Content
//-----------------------------------------------------------
// 0-10 11 bytes Field name, filled with 0x00
// 11 1 byte Field type (see bellow)
// 12-15 4 bytes Field data address, not useful for disk
// 16 1 byte Field length
// 17 1 byte Field decimal count
// 18-19 2 bytes Reserved for dBASE III+ on a Lan
// 20 1 byte Work area ID
// 21-22 2 bytes Reserved for dBASE III+ on a Lan
// 23 1 byte SET FIELDS flag
// 24-31 7 bytes Reserved
final byte[] header = new byte[32];
this.stream.readFully(header);
// Update the offset of the first record with the end-of-header character
this.firstRecordOffset += header.length;
// Read the name of the field until 0x00
int nbChars = 0;
for (int i = 0; i <= 10; ++i) {
if (header[i] == 0) {
break;
}
++nbChars;
}
final byte[] bName = new byte[nbChars];
System.arraycopy(header, 0, bName, 0, nbChars);
if (charSet != null) {
columnName = new String(bName, charSet);
} else {
columnName = new String(bName);
}
// Read the type
final DBaseFieldType dbftype = DBaseFieldType.fromByte(header[11]);
final DBaseFileField field = new DBaseFileField(
columnName,
dbftype,
// convert unsigned byte into int
header[16] & 0xFF,
// convert unsigned byte into int
header[17] & 0xFF,
idxFields);
array.add(field);
byteSize += field.getLength();
}
// Check if the byte size of the field list corresponds to size specified record size inside the header
if (byteSize != this.recordSize) {
throw new InvalidRecordSizeException(this.recordSize, byteSize);
}
// Read the terminator character 0x0D
final byte bt = this.stream.readByte();
if (bt != 0x0D) {
throw new InvalidDBaseFieldTerminationException(bt);
}
// Update the offset of the first record with the end-of-header character
++this.firstRecordOffset;
this.fields = array;
// Save the position inside the input stream for seeking function
if (this.stream.markSupported()) {
this.stream.mark(this.recordSize * this.recordCount + this.firstRecordOffset + 1);
}
return array;
} | java | @SuppressWarnings({"checkstyle:npathcomplexity", "checkstyle:magicnumber"})
public List<DBaseFileField> readDBFFields() throws IOException, EOFException {
if (this.fields != null) {
return this.fields;
}
if (this.finished) {
throw new EOFDBaseFileException();
}
if (this.fieldCount == -1) {
throw new MustCallReadHeaderFunctionException();
}
//
//-----------------------------------------------------------
// Bytes Size Content
//-----------------------------------------------------------
// 32-m n*32 bytes Field descriptors (see bellow)
// m+1 1 byte terminator character 0x0D
// A field contains at least the "removal flag" byte
int byteSize = 1;
final ArrayList<DBaseFileField> array = new ArrayList<>();
final Charset charSet = (this.codePage == null) ? null : this.codePage.getChatset();
String columnName;
for (int idxFields = 0; idxFields < this.fieldCount; ++idxFields) {
// Read the field header
//
//-----------------------------------------------------------
// Bytes Size Content
//-----------------------------------------------------------
// 0-10 11 bytes Field name, filled with 0x00
// 11 1 byte Field type (see bellow)
// 12-15 4 bytes Field data address, not useful for disk
// 16 1 byte Field length
// 17 1 byte Field decimal count
// 18-19 2 bytes Reserved for dBASE III+ on a Lan
// 20 1 byte Work area ID
// 21-22 2 bytes Reserved for dBASE III+ on a Lan
// 23 1 byte SET FIELDS flag
// 24-31 7 bytes Reserved
final byte[] header = new byte[32];
this.stream.readFully(header);
// Update the offset of the first record with the end-of-header character
this.firstRecordOffset += header.length;
// Read the name of the field until 0x00
int nbChars = 0;
for (int i = 0; i <= 10; ++i) {
if (header[i] == 0) {
break;
}
++nbChars;
}
final byte[] bName = new byte[nbChars];
System.arraycopy(header, 0, bName, 0, nbChars);
if (charSet != null) {
columnName = new String(bName, charSet);
} else {
columnName = new String(bName);
}
// Read the type
final DBaseFieldType dbftype = DBaseFieldType.fromByte(header[11]);
final DBaseFileField field = new DBaseFileField(
columnName,
dbftype,
// convert unsigned byte into int
header[16] & 0xFF,
// convert unsigned byte into int
header[17] & 0xFF,
idxFields);
array.add(field);
byteSize += field.getLength();
}
// Check if the byte size of the field list corresponds to size specified record size inside the header
if (byteSize != this.recordSize) {
throw new InvalidRecordSizeException(this.recordSize, byteSize);
}
// Read the terminator character 0x0D
final byte bt = this.stream.readByte();
if (bt != 0x0D) {
throw new InvalidDBaseFieldTerminationException(bt);
}
// Update the offset of the first record with the end-of-header character
++this.firstRecordOffset;
this.fields = array;
// Save the position inside the input stream for seeking function
if (this.stream.markSupported()) {
this.stream.mark(this.recordSize * this.recordCount + this.firstRecordOffset + 1);
}
return array;
} | [
"@",
"SuppressWarnings",
"(",
"{",
"\"checkstyle:npathcomplexity\"",
",",
"\"checkstyle:magicnumber\"",
"}",
")",
"public",
"List",
"<",
"DBaseFileField",
">",
"readDBFFields",
"(",
")",
"throws",
"IOException",
",",
"EOFException",
"{",
"if",
"(",
"this",
".",
"f... | Read the field definitions.
Multiple calls to this method will return always the
same data structure. The column list is red only
at the first call to this function.
So you could use this method to obtain the list
of the dBASE file's columns.
<p>Instead of {@link #getDBFFields()}, this method
does not returns the value <code>null</code>. It
prefers to throw an exception.
@return all the columns
@throws IOException if the stream cannot be read.
@throws EOFException if unexpected end-of-file.
@see #getDBFFields() | [
"Read",
"the",
"field",
"definitions",
".",
"Multiple",
"calls",
"to",
"this",
"method",
"will",
"return",
"always",
"the",
"same",
"data",
"structure",
".",
"The",
"column",
"list",
"is",
"red",
"only",
"at",
"the",
"first",
"call",
"to",
"this",
"functio... | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/dbasefile/src/main/java/org/arakhne/afc/io/dbase/DBaseFileReader.java#L672-L773 | train |
gallandarakhneorg/afc | advanced/dbasefile/src/main/java/org/arakhne/afc/io/dbase/DBaseFileReader.java | DBaseFileReader.skip | public void skip(int skipAmount) throws IOException {
if (this.recordCount == -1) {
throw new MustCallReadHeaderFunctionException();
}
if ((this.readingPosition + skipAmount) >= this.recordCount) {
throw new EOFException();
}
if (skipAmount > 0) {
this.readingPosition += skipAmount;
//this.stream.reset();
//this.stream.skipBytes(this.recordSize * this.readingPosition);
final long skippedAmount = this.stream.skipBytes(this.recordSize * skipAmount);
// use skipBytes because it force to skip the specified amount, instead of skip()
assert skippedAmount == this.recordSize * skipAmount;
}
} | java | public void skip(int skipAmount) throws IOException {
if (this.recordCount == -1) {
throw new MustCallReadHeaderFunctionException();
}
if ((this.readingPosition + skipAmount) >= this.recordCount) {
throw new EOFException();
}
if (skipAmount > 0) {
this.readingPosition += skipAmount;
//this.stream.reset();
//this.stream.skipBytes(this.recordSize * this.readingPosition);
final long skippedAmount = this.stream.skipBytes(this.recordSize * skipAmount);
// use skipBytes because it force to skip the specified amount, instead of skip()
assert skippedAmount == this.recordSize * skipAmount;
}
} | [
"public",
"void",
"skip",
"(",
"int",
"skipAmount",
")",
"throws",
"IOException",
"{",
"if",
"(",
"this",
".",
"recordCount",
"==",
"-",
"1",
")",
"{",
"throw",
"new",
"MustCallReadHeaderFunctionException",
"(",
")",
";",
"}",
"if",
"(",
"(",
"this",
"."... | Move the reading head by the specified record count amount.
<p>If the count of records to skip puts the reading head after
the last record, the exception {@link EOFException} is thrown.
@param skipAmount is the count of records to skip.
@throws IOException in case of error. | [
"Move",
"the",
"reading",
"head",
"by",
"the",
"specified",
"record",
"count",
"amount",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/dbasefile/src/main/java/org/arakhne/afc/io/dbase/DBaseFileReader.java#L810-L825 | train |
gallandarakhneorg/afc | advanced/dbasefile/src/main/java/org/arakhne/afc/io/dbase/DBaseFileReader.java | DBaseFileReader.readRestOfDBFRecords | public List<DBaseFileRecord> readRestOfDBFRecords() throws IOException {
if (this.finished) {
throw new EOFDBaseFileException();
}
if (this.recordCount == -1) {
throw new MustCallReadHeaderFunctionException();
}
final Vector<DBaseFileRecord> records = new Vector<>();
try {
while (this.readingPosition < this.recordCount) {
final DBaseFileRecord record = readNextDBFRecord();
if (record != null) {
records.add(record);
}
}
} catch (EOFException e) {
//
}
this.finished = true;
this.stream.close();
return records;
} | java | public List<DBaseFileRecord> readRestOfDBFRecords() throws IOException {
if (this.finished) {
throw new EOFDBaseFileException();
}
if (this.recordCount == -1) {
throw new MustCallReadHeaderFunctionException();
}
final Vector<DBaseFileRecord> records = new Vector<>();
try {
while (this.readingPosition < this.recordCount) {
final DBaseFileRecord record = readNextDBFRecord();
if (record != null) {
records.add(record);
}
}
} catch (EOFException e) {
//
}
this.finished = true;
this.stream.close();
return records;
} | [
"public",
"List",
"<",
"DBaseFileRecord",
">",
"readRestOfDBFRecords",
"(",
")",
"throws",
"IOException",
"{",
"if",
"(",
"this",
".",
"finished",
")",
"{",
"throw",
"new",
"EOFDBaseFileException",
"(",
")",
";",
"}",
"if",
"(",
"this",
".",
"recordCount",
... | Read all the records.
<p><strong>This method close the input stream !!!</strong>
<p>The returned value could take a lot
of memory. In this case, the virtual machine
could freeze when you try to access to the
collection content.
@return all the records
@throws IOException in case of error. | [
"Read",
"all",
"the",
"records",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/dbasefile/src/main/java/org/arakhne/afc/io/dbase/DBaseFileReader.java#L892-L914 | train |
gallandarakhneorg/afc | advanced/dbasefile/src/main/java/org/arakhne/afc/io/dbase/DBaseFileReader.java | DBaseFileReader.readStringRecordValue | private int readStringRecordValue(DBaseFileField field, int nrecord, int nfield, byte[] rawData,
int rawOffset, OutputParameter<String> value) throws IOException {
final byte[] recordData = new byte[field.getLength()];
System.arraycopy(rawData, rawOffset, recordData, 0, recordData.length);
String data;
if (hasOption(OPTION_DECODE_STRING)) {
data = Locale.decodeString(recordData).trim();
} else {
data = new String(recordData).trim();
}
// ignore the data that does not contain anything
if (data == null || data.length() == 0 || DBaseFileField.isUnsetValue(data)) {
data = null;
}
value.set(data);
return recordData.length;
} | java | private int readStringRecordValue(DBaseFileField field, int nrecord, int nfield, byte[] rawData,
int rawOffset, OutputParameter<String> value) throws IOException {
final byte[] recordData = new byte[field.getLength()];
System.arraycopy(rawData, rawOffset, recordData, 0, recordData.length);
String data;
if (hasOption(OPTION_DECODE_STRING)) {
data = Locale.decodeString(recordData).trim();
} else {
data = new String(recordData).trim();
}
// ignore the data that does not contain anything
if (data == null || data.length() == 0 || DBaseFileField.isUnsetValue(data)) {
data = null;
}
value.set(data);
return recordData.length;
} | [
"private",
"int",
"readStringRecordValue",
"(",
"DBaseFileField",
"field",
",",
"int",
"nrecord",
",",
"int",
"nfield",
",",
"byte",
"[",
"]",
"rawData",
",",
"int",
"rawOffset",
",",
"OutputParameter",
"<",
"String",
">",
"value",
")",
"throws",
"IOException"... | Read a STRING record value.
@param field is the current parsed field.
@param nrecord is the number of the record
@param nfield is the number of the field
@param rawData raw data
@param rawOffset is the index at which the data could be obtained
@param value will be set with the value extracted from the dBASE file
@return the count of consumed bytes
@throws IOException in case of error. | [
"Read",
"a",
"STRING",
"record",
"value",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/dbasefile/src/main/java/org/arakhne/afc/io/dbase/DBaseFileReader.java#L1055-L1073 | train |
gallandarakhneorg/afc | advanced/dbasefile/src/main/java/org/arakhne/afc/io/dbase/DBaseFileReader.java | DBaseFileReader.readDateRecordValue | @SuppressWarnings("checkstyle:magicnumber")
private static int readDateRecordValue(DBaseFileField field, int nrecord, int nfield, byte[] rawData,
int rawOffset, OutputParameter<Date> value) throws IOException {
final GregorianCalendar cal = new GregorianCalendar();
final int year = ((rawData[rawOffset] & 0xFF) - '0') * 1000
+ ((rawData[rawOffset + 1] & 0xFF) - '0') * 100
+ ((rawData[rawOffset + 2] & 0xFF) - '0') * 10
+ ((rawData[rawOffset + 3] & 0xFF) - '0');
final int month = ((rawData[rawOffset + 4] & 0xFF) - '0') * 10
+ ((rawData[rawOffset + 5] & 0xFF) - '0');
final int day = ((rawData[rawOffset + 6] & 0xFF) - '0') * 10
+ ((rawData[rawOffset + 7] & 0xFF) - '0');
cal.set(Calendar.YEAR, year);
cal.set(Calendar.MONTH, month);
cal.set(Calendar.DAY_OF_MONTH, day);
if (year == cal.get(Calendar.YEAR) && month == cal.get(Calendar.MONTH)
&& day == cal.get(Calendar.DAY_OF_MONTH)) {
value.set(cal.getTime());
return 8;
}
throw new InvalidRawDataFormatException(nrecord, nfield, new String(rawData, rawOffset, field.getLength()));
} | java | @SuppressWarnings("checkstyle:magicnumber")
private static int readDateRecordValue(DBaseFileField field, int nrecord, int nfield, byte[] rawData,
int rawOffset, OutputParameter<Date> value) throws IOException {
final GregorianCalendar cal = new GregorianCalendar();
final int year = ((rawData[rawOffset] & 0xFF) - '0') * 1000
+ ((rawData[rawOffset + 1] & 0xFF) - '0') * 100
+ ((rawData[rawOffset + 2] & 0xFF) - '0') * 10
+ ((rawData[rawOffset + 3] & 0xFF) - '0');
final int month = ((rawData[rawOffset + 4] & 0xFF) - '0') * 10
+ ((rawData[rawOffset + 5] & 0xFF) - '0');
final int day = ((rawData[rawOffset + 6] & 0xFF) - '0') * 10
+ ((rawData[rawOffset + 7] & 0xFF) - '0');
cal.set(Calendar.YEAR, year);
cal.set(Calendar.MONTH, month);
cal.set(Calendar.DAY_OF_MONTH, day);
if (year == cal.get(Calendar.YEAR) && month == cal.get(Calendar.MONTH)
&& day == cal.get(Calendar.DAY_OF_MONTH)) {
value.set(cal.getTime());
return 8;
}
throw new InvalidRawDataFormatException(nrecord, nfield, new String(rawData, rawOffset, field.getLength()));
} | [
"@",
"SuppressWarnings",
"(",
"\"checkstyle:magicnumber\"",
")",
"private",
"static",
"int",
"readDateRecordValue",
"(",
"DBaseFileField",
"field",
",",
"int",
"nrecord",
",",
"int",
"nfield",
",",
"byte",
"[",
"]",
"rawData",
",",
"int",
"rawOffset",
",",
"Outp... | Read a DATE record value.
@param field is the current parsed field.
@param nrecord is the number of the record
@param nfield is the number of the field
@param rawData raw data
@param rawOffset is the index at which the data could be obtained
@param value will be set with the value extracted from the dBASE file
@return the count of consumed bytes
@throws IOException in case of error. | [
"Read",
"a",
"DATE",
"record",
"value",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/dbasefile/src/main/java/org/arakhne/afc/io/dbase/DBaseFileReader.java#L1086-L1109 | train |
gallandarakhneorg/afc | advanced/dbasefile/src/main/java/org/arakhne/afc/io/dbase/DBaseFileReader.java | DBaseFileReader.readNumberRecordValue | private static int readNumberRecordValue(DBaseFileField field, int nrecord, int nfield, byte[] rawData,
int rawOffset, OutputParameter<Double> value) throws IOException {
final String buffer = new String(rawData, rawOffset, field.getLength());
try {
final String b = buffer.trim();
if (b != null && b.length() > 0) {
value.set(new Double(b));
return field.getLength();
}
} catch (NumberFormatException e) {
//
}
throw new InvalidRawDataFormatException(nrecord, nfield, buffer);
} | java | private static int readNumberRecordValue(DBaseFileField field, int nrecord, int nfield, byte[] rawData,
int rawOffset, OutputParameter<Double> value) throws IOException {
final String buffer = new String(rawData, rawOffset, field.getLength());
try {
final String b = buffer.trim();
if (b != null && b.length() > 0) {
value.set(new Double(b));
return field.getLength();
}
} catch (NumberFormatException e) {
//
}
throw new InvalidRawDataFormatException(nrecord, nfield, buffer);
} | [
"private",
"static",
"int",
"readNumberRecordValue",
"(",
"DBaseFileField",
"field",
",",
"int",
"nrecord",
",",
"int",
"nfield",
",",
"byte",
"[",
"]",
"rawData",
",",
"int",
"rawOffset",
",",
"OutputParameter",
"<",
"Double",
">",
"value",
")",
"throws",
"... | Read a NUMBER record value.
@param field is the current parsed field.
@param nrecord is the number of the record
@param nfield is the number of the field
@param rawData raw data
@param rawOffset is the index at which the data could be obtained
@param value will be set with the value extracted from the dBASE file
@return the count of consumed bytes
@throws IOException in case of error. | [
"Read",
"a",
"NUMBER",
"record",
"value",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/dbasefile/src/main/java/org/arakhne/afc/io/dbase/DBaseFileReader.java#L1122-L1135 | train |
gallandarakhneorg/afc | advanced/dbasefile/src/main/java/org/arakhne/afc/io/dbase/DBaseFileReader.java | DBaseFileReader.readBooleanRecordValue | @SuppressWarnings("checkstyle:magicnumber")
private static int readBooleanRecordValue(DBaseFileField field, int nrecord, int nfield, byte[] rawData,
int rawOffset, OutputParameter<Boolean> value) throws IOException {
final int byteCode = rawData[rawOffset] & 0xFF;
if (TRUE_CHARS.indexOf(byteCode) != -1) {
value.set(true);
return 1;
}
if (FALSE_CHARS.indexOf(byteCode) != -1) {
value.set(false);
return 1;
}
throw new InvalidRawDataFormatException(nrecord, nfield, Integer.toString(byteCode));
} | java | @SuppressWarnings("checkstyle:magicnumber")
private static int readBooleanRecordValue(DBaseFileField field, int nrecord, int nfield, byte[] rawData,
int rawOffset, OutputParameter<Boolean> value) throws IOException {
final int byteCode = rawData[rawOffset] & 0xFF;
if (TRUE_CHARS.indexOf(byteCode) != -1) {
value.set(true);
return 1;
}
if (FALSE_CHARS.indexOf(byteCode) != -1) {
value.set(false);
return 1;
}
throw new InvalidRawDataFormatException(nrecord, nfield, Integer.toString(byteCode));
} | [
"@",
"SuppressWarnings",
"(",
"\"checkstyle:magicnumber\"",
")",
"private",
"static",
"int",
"readBooleanRecordValue",
"(",
"DBaseFileField",
"field",
",",
"int",
"nrecord",
",",
"int",
"nfield",
",",
"byte",
"[",
"]",
"rawData",
",",
"int",
"rawOffset",
",",
"O... | Read a BOOLEAN record value.
@param field is the current parsed field.
@param nrecord is the number of the record
@param nfield is the number of the field
@param rawData raw data
@param rawOffset is the index at which the data could be obtained
@param value will be set with the value extracted from the dBASE file
@return the count of consumed bytes
@throws IOException in case of error. | [
"Read",
"a",
"BOOLEAN",
"record",
"value",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/dbasefile/src/main/java/org/arakhne/afc/io/dbase/DBaseFileReader.java#L1148-L1164 | train |
gallandarakhneorg/afc | advanced/dbasefile/src/main/java/org/arakhne/afc/io/dbase/DBaseFileReader.java | DBaseFileReader.read2ByteIntegerRecordValue | private static int read2ByteIntegerRecordValue(DBaseFileField field, int nrecord, int nfield,
byte[] rawData, int rawOffset, OutputParameter<Integer> value) throws IOException {
final short rawNumber = EndianNumbers.toLEShort(rawData[rawOffset], rawData[rawOffset + 1]);
try {
value.set(new Integer(rawNumber));
return 2;
} catch (NumberFormatException exception) {
throw new InvalidRawDataFormatException(nrecord, nfield, Short.toString(rawNumber));
}
} | java | private static int read2ByteIntegerRecordValue(DBaseFileField field, int nrecord, int nfield,
byte[] rawData, int rawOffset, OutputParameter<Integer> value) throws IOException {
final short rawNumber = EndianNumbers.toLEShort(rawData[rawOffset], rawData[rawOffset + 1]);
try {
value.set(new Integer(rawNumber));
return 2;
} catch (NumberFormatException exception) {
throw new InvalidRawDataFormatException(nrecord, nfield, Short.toString(rawNumber));
}
} | [
"private",
"static",
"int",
"read2ByteIntegerRecordValue",
"(",
"DBaseFileField",
"field",
",",
"int",
"nrecord",
",",
"int",
"nfield",
",",
"byte",
"[",
"]",
"rawData",
",",
"int",
"rawOffset",
",",
"OutputParameter",
"<",
"Integer",
">",
"value",
")",
"throw... | Read a 2 BYTE INTEGER record value.
@param field is the current parsed field.
@param nrecord is the number of the record
@param nfield is the number of the field
@param rawData raw data
@param rawOffset is the index at which the data could be obtained
@param value will be set with the value extracted from the dBASE file
@return the count of consumed bytes
@throws IOException in case of error. | [
"Read",
"a",
"2",
"BYTE",
"INTEGER",
"record",
"value",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/dbasefile/src/main/java/org/arakhne/afc/io/dbase/DBaseFileReader.java#L1177-L1186 | train |
gallandarakhneorg/afc | advanced/dbasefile/src/main/java/org/arakhne/afc/io/dbase/DBaseFileReader.java | DBaseFileReader.read4ByteIntegerRecordValue | @SuppressWarnings("checkstyle:magicnumber")
private static int read4ByteIntegerRecordValue(DBaseFileField field, int nrecord, int nfield,
byte[] rawData, int rawOffset, OutputParameter<Long> value) throws IOException {
final int rawNumber = EndianNumbers.toLEInt(
rawData[rawOffset], rawData[rawOffset + 1],
rawData[rawOffset + 2], rawData[rawOffset + 3]);
try {
value.set(new Long(rawNumber));
return 4;
} catch (NumberFormatException exception) {
throw new InvalidRawDataFormatException(nrecord, nfield, Long.toString(rawNumber));
}
} | java | @SuppressWarnings("checkstyle:magicnumber")
private static int read4ByteIntegerRecordValue(DBaseFileField field, int nrecord, int nfield,
byte[] rawData, int rawOffset, OutputParameter<Long> value) throws IOException {
final int rawNumber = EndianNumbers.toLEInt(
rawData[rawOffset], rawData[rawOffset + 1],
rawData[rawOffset + 2], rawData[rawOffset + 3]);
try {
value.set(new Long(rawNumber));
return 4;
} catch (NumberFormatException exception) {
throw new InvalidRawDataFormatException(nrecord, nfield, Long.toString(rawNumber));
}
} | [
"@",
"SuppressWarnings",
"(",
"\"checkstyle:magicnumber\"",
")",
"private",
"static",
"int",
"read4ByteIntegerRecordValue",
"(",
"DBaseFileField",
"field",
",",
"int",
"nrecord",
",",
"int",
"nfield",
",",
"byte",
"[",
"]",
"rawData",
",",
"int",
"rawOffset",
",",... | Read a 4 BYTE INTEGER record value.
@param field is the current parsed field.
@param nrecord is the number of the record
@param nfield is the number of the field
@param rawData raw data
@param rawOffset is the index at which the data could be obtained
@param value will be set with the value extracted from the dBASE file
@return the count of consumed bytes
@throws IOException in case of error. | [
"Read",
"a",
"4",
"BYTE",
"INTEGER",
"record",
"value",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/dbasefile/src/main/java/org/arakhne/afc/io/dbase/DBaseFileReader.java#L1199-L1211 | train |
gallandarakhneorg/afc | advanced/dbasefile/src/main/java/org/arakhne/afc/io/dbase/DBaseFileReader.java | DBaseFileReader.read8ByteDoubleRecordValue | @SuppressWarnings("checkstyle:magicnumber")
private static int read8ByteDoubleRecordValue(DBaseFileField field, int nrecord, int nfield,
byte[] rawData, int rawOffset, OutputParameter<Double> value) throws IOException {
final double rawNumber = EndianNumbers.toLEDouble(
rawData[rawOffset], rawData[rawOffset + 1],
rawData[rawOffset + 2], rawData[rawOffset + 3],
rawData[rawOffset + 4], rawData[rawOffset + 5],
rawData[rawOffset + 6], rawData[rawOffset + 7]);
try {
value.set(new Double(rawNumber));
return 8;
} catch (NumberFormatException exception) {
throw new InvalidRawDataFormatException(nrecord, nfield, Double.toString(rawNumber));
}
} | java | @SuppressWarnings("checkstyle:magicnumber")
private static int read8ByteDoubleRecordValue(DBaseFileField field, int nrecord, int nfield,
byte[] rawData, int rawOffset, OutputParameter<Double> value) throws IOException {
final double rawNumber = EndianNumbers.toLEDouble(
rawData[rawOffset], rawData[rawOffset + 1],
rawData[rawOffset + 2], rawData[rawOffset + 3],
rawData[rawOffset + 4], rawData[rawOffset + 5],
rawData[rawOffset + 6], rawData[rawOffset + 7]);
try {
value.set(new Double(rawNumber));
return 8;
} catch (NumberFormatException exception) {
throw new InvalidRawDataFormatException(nrecord, nfield, Double.toString(rawNumber));
}
} | [
"@",
"SuppressWarnings",
"(",
"\"checkstyle:magicnumber\"",
")",
"private",
"static",
"int",
"read8ByteDoubleRecordValue",
"(",
"DBaseFileField",
"field",
",",
"int",
"nrecord",
",",
"int",
"nfield",
",",
"byte",
"[",
"]",
"rawData",
",",
"int",
"rawOffset",
",",
... | Read a 8 BYTE DOUBLE record value.
@param field is the current parsed field.
@param nrecord is the number of the record
@param nfield is the number of the field
@param rawData raw data
@param rawOffset is the index at which the data could be obtained
@param value will be set with the value extracted from the dBASE file
@return the count of consumed bytes
@throws IOException in case of error. | [
"Read",
"a",
"8",
"BYTE",
"DOUBLE",
"record",
"value",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/dbasefile/src/main/java/org/arakhne/afc/io/dbase/DBaseFileReader.java#L1224-L1238 | train |
gallandarakhneorg/afc | advanced/dbasefile/src/main/java/org/arakhne/afc/io/dbase/DBaseFileReader.java | DBaseFileReader.isColumnSelectable | @Pure
public boolean isColumnSelectable(DBaseFileField column) {
return column != null && (this.selectedColumns.isEmpty()
|| this.selectedColumns.contains(column));
} | java | @Pure
public boolean isColumnSelectable(DBaseFileField column) {
return column != null && (this.selectedColumns.isEmpty()
|| this.selectedColumns.contains(column));
} | [
"@",
"Pure",
"public",
"boolean",
"isColumnSelectable",
"(",
"DBaseFileField",
"column",
")",
"{",
"return",
"column",
"!=",
"null",
"&&",
"(",
"this",
".",
"selectedColumns",
".",
"isEmpty",
"(",
")",
"||",
"this",
".",
"selectedColumns",
".",
"contains",
"... | Replies if the specified column could be replied or ignored.
@param column the column.
@return <code>true</code> if the given column is selectable, otherwise <code>false</code> | [
"Replies",
"if",
"the",
"specified",
"column",
"could",
"be",
"replied",
"or",
"ignored",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/dbasefile/src/main/java/org/arakhne/afc/io/dbase/DBaseFileReader.java#L1260-L1264 | train |
gallandarakhneorg/afc | core/text/src/main/java/org/arakhne/afc/text/Encryption.java | Encryption.loadDefaultEncryptionModule | public static void loadDefaultEncryptionModule() {
// Be sure that the cryptographical algorithms are loaded
final Provider[] providers = Security.getProviders();
boolean found = false;
for (final Provider provider : providers) {
if (provider instanceof SunJCE) {
found = true;
break;
}
}
if (!found) {
Security.addProvider(new SunJCE());
}
} | java | public static void loadDefaultEncryptionModule() {
// Be sure that the cryptographical algorithms are loaded
final Provider[] providers = Security.getProviders();
boolean found = false;
for (final Provider provider : providers) {
if (provider instanceof SunJCE) {
found = true;
break;
}
}
if (!found) {
Security.addProvider(new SunJCE());
}
} | [
"public",
"static",
"void",
"loadDefaultEncryptionModule",
"(",
")",
"{",
"// Be sure that the cryptographical algorithms are loaded",
"final",
"Provider",
"[",
"]",
"providers",
"=",
"Security",
".",
"getProviders",
"(",
")",
";",
"boolean",
"found",
"=",
"false",
";... | Load the default encryption module.
<p>By default this is the SunJCE module. | [
"Load",
"the",
"default",
"encryption",
"module",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/text/src/main/java/org/arakhne/afc/text/Encryption.java#L106-L119 | train |
gallandarakhneorg/afc | core/text/src/main/java/org/arakhne/afc/text/Encryption.java | Encryption.md5 | public static String md5(String str) {
if (str == null) {
return ""; //$NON-NLS-1$
}
final byte[] uniqueKey = str.getBytes();
byte[] hash = null;
try {
hash = MessageDigest.getInstance("MD5").digest(uniqueKey); //$NON-NLS-1$
} catch (NoSuchAlgorithmException e) {
throw new Error(Locale.getString("NO_MD5")); //$NON-NLS-1$
}
final StringBuilder hashString = new StringBuilder();
for (int i = 0; i < hash.length; ++i) {
final String hex = Integer.toHexString(hash[i]);
if (hex.length() == 1) {
hashString.append('0');
hashString.append(hex.charAt(hex.length() - 1));
} else {
hashString.append(hex.substring(hex.length() - 2));
}
}
return hashString.toString();
} | java | public static String md5(String str) {
if (str == null) {
return ""; //$NON-NLS-1$
}
final byte[] uniqueKey = str.getBytes();
byte[] hash = null;
try {
hash = MessageDigest.getInstance("MD5").digest(uniqueKey); //$NON-NLS-1$
} catch (NoSuchAlgorithmException e) {
throw new Error(Locale.getString("NO_MD5")); //$NON-NLS-1$
}
final StringBuilder hashString = new StringBuilder();
for (int i = 0; i < hash.length; ++i) {
final String hex = Integer.toHexString(hash[i]);
if (hex.length() == 1) {
hashString.append('0');
hashString.append(hex.charAt(hex.length() - 1));
} else {
hashString.append(hex.substring(hex.length() - 2));
}
}
return hashString.toString();
} | [
"public",
"static",
"String",
"md5",
"(",
"String",
"str",
")",
"{",
"if",
"(",
"str",
"==",
"null",
")",
"{",
"return",
"\"\"",
";",
"//$NON-NLS-1$",
"}",
"final",
"byte",
"[",
"]",
"uniqueKey",
"=",
"str",
".",
"getBytes",
"(",
")",
";",
"byte",
... | Replies a MD5 key.
<p>MD5 was developed by Professor Ronald L. Rivest in 1994.
Its 128 bit (16 byte) message digest makes it a
faster implementation than SHA-1.
<p>The fingerprint (message digest) is
non-reversable.... your data cannot be retrieved from
the message digest, yet as stated earlier,
the digest uniquely identifies the data.
@param str is the string to encrypt.
@return the MD5 encryption of the string <var>str</var> | [
"Replies",
"a",
"MD5",
"key",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/text/src/main/java/org/arakhne/afc/text/Encryption.java#L136-L161 | train |
gallandarakhneorg/afc | advanced/mathfx/src/main/java/org/arakhne/afc/math/geometry/d3/ifx/Path3ifx.java | Path3ifx.isMultiPartsProperty | public BooleanProperty isMultiPartsProperty() {
if (this.isMultipart == null) {
this.isMultipart = new ReadOnlyBooleanWrapper(this, MathFXAttributeNames.IS_MULTIPARTS, false);
this.isMultipart.bind(Bindings.createBooleanBinding(() -> {
boolean foundOne = false;
for (final PathElementType type : innerTypesProperty()) {
if (type == PathElementType.MOVE_TO) {
if (foundOne) {
return true;
}
foundOne = true;
}
}
return false;
},
innerTypesProperty()));
}
return this.isMultipart;
} | java | public BooleanProperty isMultiPartsProperty() {
if (this.isMultipart == null) {
this.isMultipart = new ReadOnlyBooleanWrapper(this, MathFXAttributeNames.IS_MULTIPARTS, false);
this.isMultipart.bind(Bindings.createBooleanBinding(() -> {
boolean foundOne = false;
for (final PathElementType type : innerTypesProperty()) {
if (type == PathElementType.MOVE_TO) {
if (foundOne) {
return true;
}
foundOne = true;
}
}
return false;
},
innerTypesProperty()));
}
return this.isMultipart;
} | [
"public",
"BooleanProperty",
"isMultiPartsProperty",
"(",
")",
"{",
"if",
"(",
"this",
".",
"isMultipart",
"==",
"null",
")",
"{",
"this",
".",
"isMultipart",
"=",
"new",
"ReadOnlyBooleanWrapper",
"(",
"this",
",",
"MathFXAttributeNames",
".",
"IS_MULTIPARTS",
"... | Replies the isMultiParts property.
@return the isMultiParts property. | [
"Replies",
"the",
"isMultiParts",
"property",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/mathfx/src/main/java/org/arakhne/afc/math/geometry/d3/ifx/Path3ifx.java#L388-L406 | train |
agmip/translator-dssat | src/main/java/org/agmip/translators/dssat/DssatWthFileHelper.java | DssatWthFileHelper.getWthInsiCodeOr | private String getWthInsiCodeOr(Map wthData) {
String insiName = getWthInsiCode(wthData);
if (insiName.equals("")) {
return getNextDefName();
} else {
return insiName;
}
} | java | private String getWthInsiCodeOr(Map wthData) {
String insiName = getWthInsiCode(wthData);
if (insiName.equals("")) {
return getNextDefName();
} else {
return insiName;
}
} | [
"private",
"String",
"getWthInsiCodeOr",
"(",
"Map",
"wthData",
")",
"{",
"String",
"insiName",
"=",
"getWthInsiCode",
"(",
"wthData",
")",
";",
"if",
"(",
"insiName",
".",
"equals",
"(",
"\"\"",
")",
")",
"{",
"return",
"getNextDefName",
"(",
")",
";",
... | Get the 4-bit institute code for weather file name, if not available from
data holder, then use default code
@param wthData Weather data holder
@return 4-bit institute code | [
"Get",
"the",
"4",
"-",
"bit",
"institute",
"code",
"for",
"weather",
"file",
"name",
"if",
"not",
"available",
"from",
"data",
"holder",
"then",
"use",
"default",
"code"
] | 4be61d998f106eb7234ea8701b63c3746ae688f4 | https://github.com/agmip/translator-dssat/blob/4be61d998f106eb7234ea8701b63c3746ae688f4/src/main/java/org/agmip/translators/dssat/DssatWthFileHelper.java#L64-L71 | train |
agmip/translator-dssat | src/main/java/org/agmip/translators/dssat/DssatWthFileHelper.java | DssatWthFileHelper.getWthInsiCode | public static String getWthInsiCode(Map wthData) {
String wst_name = getValueOr(wthData, "wst_name", "");
if (wst_name.matches("(\\w{4})|(\\w{8})")) {
return wst_name;
}
String wst_id = getValueOr(wthData, "wst_id", "");
if (wst_id.matches("(\\w{4})|(\\w{8})")) {
return wst_id;
}
wst_id = getValueOr(wthData, "dssat_insi", "");
if (wst_id.matches("(\\w{4})|(\\w{8})")) {
return wst_id;
}
return "";
} | java | public static String getWthInsiCode(Map wthData) {
String wst_name = getValueOr(wthData, "wst_name", "");
if (wst_name.matches("(\\w{4})|(\\w{8})")) {
return wst_name;
}
String wst_id = getValueOr(wthData, "wst_id", "");
if (wst_id.matches("(\\w{4})|(\\w{8})")) {
return wst_id;
}
wst_id = getValueOr(wthData, "dssat_insi", "");
if (wst_id.matches("(\\w{4})|(\\w{8})")) {
return wst_id;
}
return "";
} | [
"public",
"static",
"String",
"getWthInsiCode",
"(",
"Map",
"wthData",
")",
"{",
"String",
"wst_name",
"=",
"getValueOr",
"(",
"wthData",
",",
"\"wst_name\"",
",",
"\"\"",
")",
";",
"if",
"(",
"wst_name",
".",
"matches",
"(",
"\"(\\\\w{4})|(\\\\w{8})\"",
")",
... | Get the 4-bit institute code for weather file nam
@param wthData weather data holder
@return the 4-bit institute code | [
"Get",
"the",
"4",
"-",
"bit",
"institute",
"code",
"for",
"weather",
"file",
"nam"
] | 4be61d998f106eb7234ea8701b63c3746ae688f4 | https://github.com/agmip/translator-dssat/blob/4be61d998f106eb7234ea8701b63c3746ae688f4/src/main/java/org/agmip/translators/dssat/DssatWthFileHelper.java#L88-L105 | train |
agmip/translator-dssat | src/main/java/org/agmip/translators/dssat/DssatWthFileHelper.java | DssatWthFileHelper.getWthYearDuration | public static String getWthYearDuration(Map wthData) {
String yearDur = "";
ArrayList<Map> wthRecords = (ArrayList) getObjectOr(wthData, "dailyWeather", new ArrayList());
if (!wthRecords.isEmpty()) {
// Get the year of starting date and end date
String startYear = getValueOr((wthRecords.get(0)), "w_date", " ").substring(2, 4).trim();
String endYear = getValueOr((wthRecords.get(wthRecords.size() - 1)), "w_date", " ").substring(2, 4).trim();
// If not available, do not show year and duration in the file name
if (!startYear.equals("") && !endYear.equals("")) {
yearDur += startYear;
try {
int iStartYear = Integer.parseInt(startYear);
int iEndYear = Integer.parseInt(endYear);
iStartYear += iStartYear <= 15 ? 2000 : 1900; // P.S. 2015 is the cross year for the current version
iEndYear += iEndYear <= 15 ? 2000 : 1900; // P.S. 2015 is the cross year for the current version
int duration = iEndYear - iStartYear + 1;
// P.S. Currently the system only support the maximum of 99 years for duration
duration = duration > 99 ? 99 : duration;
yearDur += String.format("%02d", duration);
} catch (Exception e) {
yearDur += "01"; // Default duration uses 01 (minimum value)
}
}
}
return yearDur;
} | java | public static String getWthYearDuration(Map wthData) {
String yearDur = "";
ArrayList<Map> wthRecords = (ArrayList) getObjectOr(wthData, "dailyWeather", new ArrayList());
if (!wthRecords.isEmpty()) {
// Get the year of starting date and end date
String startYear = getValueOr((wthRecords.get(0)), "w_date", " ").substring(2, 4).trim();
String endYear = getValueOr((wthRecords.get(wthRecords.size() - 1)), "w_date", " ").substring(2, 4).trim();
// If not available, do not show year and duration in the file name
if (!startYear.equals("") && !endYear.equals("")) {
yearDur += startYear;
try {
int iStartYear = Integer.parseInt(startYear);
int iEndYear = Integer.parseInt(endYear);
iStartYear += iStartYear <= 15 ? 2000 : 1900; // P.S. 2015 is the cross year for the current version
iEndYear += iEndYear <= 15 ? 2000 : 1900; // P.S. 2015 is the cross year for the current version
int duration = iEndYear - iStartYear + 1;
// P.S. Currently the system only support the maximum of 99 years for duration
duration = duration > 99 ? 99 : duration;
yearDur += String.format("%02d", duration);
} catch (Exception e) {
yearDur += "01"; // Default duration uses 01 (minimum value)
}
}
}
return yearDur;
} | [
"public",
"static",
"String",
"getWthYearDuration",
"(",
"Map",
"wthData",
")",
"{",
"String",
"yearDur",
"=",
"\"\"",
";",
"ArrayList",
"<",
"Map",
">",
"wthRecords",
"=",
"(",
"ArrayList",
")",
"getObjectOr",
"(",
"wthData",
",",
"\"dailyWeather\"",
",",
"... | Get the last 2-bit year number and 2-bit of the duration for weather file
name
@param wthData weather data holder
@return the 4-bit number for year and duration | [
"Get",
"the",
"last",
"2",
"-",
"bit",
"year",
"number",
"and",
"2",
"-",
"bit",
"of",
"the",
"duration",
"for",
"weather",
"file",
"name"
] | 4be61d998f106eb7234ea8701b63c3746ae688f4 | https://github.com/agmip/translator-dssat/blob/4be61d998f106eb7234ea8701b63c3746ae688f4/src/main/java/org/agmip/translators/dssat/DssatWthFileHelper.java#L114-L140 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.