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 | common-core-open/src/main/java/com/bbn/bue/common/files/FileUtils.java | FileUtils.toLinesFunction | public static Function<File, Iterable<String>> toLinesFunction(final Charset charset) {
return new Function<File, Iterable<String>>() {
@Override
public Iterable<String> apply(final File input) {
try {
return Files.readLines(input, charset);
} catch (IOException e) {
e.printStackTrace();
throw new RuntimeException(e);
}
}
};
} | java | public static Function<File, Iterable<String>> toLinesFunction(final Charset charset) {
return new Function<File, Iterable<String>>() {
@Override
public Iterable<String> apply(final File input) {
try {
return Files.readLines(input, charset);
} catch (IOException e) {
e.printStackTrace();
throw new RuntimeException(e);
}
}
};
} | [
"public",
"static",
"Function",
"<",
"File",
",",
"Iterable",
"<",
"String",
">",
">",
"toLinesFunction",
"(",
"final",
"Charset",
"charset",
")",
"{",
"return",
"new",
"Function",
"<",
"File",
",",
"Iterable",
"<",
"String",
">",
">",
"(",
")",
"{",
"... | wraps any IOException and throws a RuntimeException | [
"wraps",
"any",
"IOException",
"and",
"throws",
"a",
"RuntimeException"
] | d618652674d647867306e2e4b987a21b7c29c015 | https://github.com/BBN-E/bue-common-open/blob/d618652674d647867306e2e4b987a21b7c29c015/common-core-open/src/main/java/com/bbn/bue/common/files/FileUtils.java#L841-L853 | train |
BBN-E/bue-common-open | common-core-open/src/main/java/com/bbn/bue/common/files/FileUtils.java | FileUtils.recursivelyDeleteDirectory | public static void recursivelyDeleteDirectory(File directory) throws IOException {
if (!directory.exists()) {
return;
}
checkArgument(directory.isDirectory(), "Cannot recursively delete a non-directory");
walkFileTree(directory.toPath(), new DeletionFileVisitor());
} | java | public static void recursivelyDeleteDirectory(File directory) throws IOException {
if (!directory.exists()) {
return;
}
checkArgument(directory.isDirectory(), "Cannot recursively delete a non-directory");
walkFileTree(directory.toPath(), new DeletionFileVisitor());
} | [
"public",
"static",
"void",
"recursivelyDeleteDirectory",
"(",
"File",
"directory",
")",
"throws",
"IOException",
"{",
"if",
"(",
"!",
"directory",
".",
"exists",
"(",
")",
")",
"{",
"return",
";",
"}",
"checkArgument",
"(",
"directory",
".",
"isDirectory",
... | Recursively delete this directory and all its contents. | [
"Recursively",
"delete",
"this",
"directory",
"and",
"all",
"its",
"contents",
"."
] | d618652674d647867306e2e4b987a21b7c29c015 | https://github.com/BBN-E/bue-common-open/blob/d618652674d647867306e2e4b987a21b7c29c015/common-core-open/src/main/java/com/bbn/bue/common/files/FileUtils.java#L884-L890 | train |
BBN-E/bue-common-open | common-core-open/src/main/java/com/bbn/bue/common/files/FileUtils.java | FileUtils.recursivelyCopyDirectory | public static void recursivelyCopyDirectory(final File sourceDir, final File destDir,
final StandardCopyOption copyOption)
throws IOException {
checkNotNull(sourceDir);
checkNotNull(destDir);
checkArgument(sourceDir.isDirectory(), "Source directory does not exist");
java.nio.file.Files.createDirectories(destDir.toPath());
walkFileTree(sourceDir.toPath(), new CopyFileVisitor(sourceDir.toPath(), destDir.toPath(),
copyOption));
} | java | public static void recursivelyCopyDirectory(final File sourceDir, final File destDir,
final StandardCopyOption copyOption)
throws IOException {
checkNotNull(sourceDir);
checkNotNull(destDir);
checkArgument(sourceDir.isDirectory(), "Source directory does not exist");
java.nio.file.Files.createDirectories(destDir.toPath());
walkFileTree(sourceDir.toPath(), new CopyFileVisitor(sourceDir.toPath(), destDir.toPath(),
copyOption));
} | [
"public",
"static",
"void",
"recursivelyCopyDirectory",
"(",
"final",
"File",
"sourceDir",
",",
"final",
"File",
"destDir",
",",
"final",
"StandardCopyOption",
"copyOption",
")",
"throws",
"IOException",
"{",
"checkNotNull",
"(",
"sourceDir",
")",
";",
"checkNotNull... | Recursively copies a directory.
@param sourceDir the source directory
@param destDir the destination directory, which does not need to already exist
@param copyOption options to be used for copying files | [
"Recursively",
"copies",
"a",
"directory",
"."
] | d618652674d647867306e2e4b987a21b7c29c015 | https://github.com/BBN-E/bue-common-open/blob/d618652674d647867306e2e4b987a21b7c29c015/common-core-open/src/main/java/com/bbn/bue/common/files/FileUtils.java#L944-L953 | train |
BBN-E/bue-common-open | common-core-open/src/main/java/com/bbn/bue/common/files/FileUtils.java | FileUtils.loadSymbolMultimap | @Deprecated
public static ImmutableMultimap<Symbol, Symbol> loadSymbolMultimap(File multimapFile)
throws IOException {
return loadSymbolMultimap(Files.asCharSource(multimapFile, Charsets.UTF_8));
} | java | @Deprecated
public static ImmutableMultimap<Symbol, Symbol> loadSymbolMultimap(File multimapFile)
throws IOException {
return loadSymbolMultimap(Files.asCharSource(multimapFile, Charsets.UTF_8));
} | [
"@",
"Deprecated",
"public",
"static",
"ImmutableMultimap",
"<",
"Symbol",
",",
"Symbol",
">",
"loadSymbolMultimap",
"(",
"File",
"multimapFile",
")",
"throws",
"IOException",
"{",
"return",
"loadSymbolMultimap",
"(",
"Files",
".",
"asCharSource",
"(",
"multimapFile... | Deprecated in favor of the CharSource version to force the user to define their encoding. If
you call this, it will use UTF_8 encoding.
@deprecated | [
"Deprecated",
"in",
"favor",
"of",
"the",
"CharSource",
"version",
"to",
"force",
"the",
"user",
"to",
"define",
"their",
"encoding",
".",
"If",
"you",
"call",
"this",
"it",
"will",
"use",
"UTF_8",
"encoding",
"."
] | d618652674d647867306e2e4b987a21b7c29c015 | https://github.com/BBN-E/bue-common-open/blob/d618652674d647867306e2e4b987a21b7c29c015/common-core-open/src/main/java/com/bbn/bue/common/files/FileUtils.java#L1169-L1173 | train |
gallandarakhneorg/afc | advanced/shapefile/src/main/java/org/arakhne/afc/io/shape/ESRIFileUtil.java | ESRIFileUtil.toESRI_x | @Pure
public static double toESRI_x(double x) throws IOException {
if (Double.isInfinite(x) || Double.isNaN(x)) {
throw new InvalidNumericValueException(x);
}
return x;
} | java | @Pure
public static double toESRI_x(double x) throws IOException {
if (Double.isInfinite(x) || Double.isNaN(x)) {
throw new InvalidNumericValueException(x);
}
return x;
} | [
"@",
"Pure",
"public",
"static",
"double",
"toESRI_x",
"(",
"double",
"x",
")",
"throws",
"IOException",
"{",
"if",
"(",
"Double",
".",
"isInfinite",
"(",
"x",
")",
"||",
"Double",
".",
"isNaN",
"(",
"x",
")",
")",
"{",
"throw",
"new",
"InvalidNumericV... | Translate a x-coordinate from Java standard
to ESRI standard.
@param x is the Java x-coordinate
@return the ESRI x-coordinate
@throws IOException when invalid conversion. | [
"Translate",
"a",
"x",
"-",
"coordinate",
"from",
"Java",
"standard",
"to",
"ESRI",
"standard",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/shapefile/src/main/java/org/arakhne/afc/io/shape/ESRIFileUtil.java#L95-L101 | train |
gallandarakhneorg/afc | advanced/shapefile/src/main/java/org/arakhne/afc/io/shape/ESRIFileUtil.java | ESRIFileUtil.fromESRI_x | @Pure
public static double fromESRI_x(double x) throws IOException {
if (Double.isInfinite(x) || Double.isNaN(x)) {
throw new InvalidNumericValueException(x);
}
return x;
} | java | @Pure
public static double fromESRI_x(double x) throws IOException {
if (Double.isInfinite(x) || Double.isNaN(x)) {
throw new InvalidNumericValueException(x);
}
return x;
} | [
"@",
"Pure",
"public",
"static",
"double",
"fromESRI_x",
"(",
"double",
"x",
")",
"throws",
"IOException",
"{",
"if",
"(",
"Double",
".",
"isInfinite",
"(",
"x",
")",
"||",
"Double",
".",
"isNaN",
"(",
"x",
")",
")",
"{",
"throw",
"new",
"InvalidNumeri... | Translate a x-coordinate from ESRI standard
to Java standard.
@param x is the Java x-coordinate
@return the ESRI x-coordinate
@throws IOException when invalid conversion. | [
"Translate",
"a",
"x",
"-",
"coordinate",
"from",
"ESRI",
"standard",
"to",
"Java",
"standard",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/shapefile/src/main/java/org/arakhne/afc/io/shape/ESRIFileUtil.java#L110-L116 | train |
gallandarakhneorg/afc | advanced/shapefile/src/main/java/org/arakhne/afc/io/shape/ESRIFileUtil.java | ESRIFileUtil.toESRI_y | @Pure
public static double toESRI_y(double y) throws IOException {
if (Double.isInfinite(y) || Double.isNaN(y)) {
throw new InvalidNumericValueException(y);
}
return y;
} | java | @Pure
public static double toESRI_y(double y) throws IOException {
if (Double.isInfinite(y) || Double.isNaN(y)) {
throw new InvalidNumericValueException(y);
}
return y;
} | [
"@",
"Pure",
"public",
"static",
"double",
"toESRI_y",
"(",
"double",
"y",
")",
"throws",
"IOException",
"{",
"if",
"(",
"Double",
".",
"isInfinite",
"(",
"y",
")",
"||",
"Double",
".",
"isNaN",
"(",
"y",
")",
")",
"{",
"throw",
"new",
"InvalidNumericV... | Translate a y-coordinate from Java standard
to ESRI standard.
@param y is the Java y-coordinate
@return the ESRI y-coordinate
@throws IOException when invalid conversion. | [
"Translate",
"a",
"y",
"-",
"coordinate",
"from",
"Java",
"standard",
"to",
"ESRI",
"standard",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/shapefile/src/main/java/org/arakhne/afc/io/shape/ESRIFileUtil.java#L125-L131 | train |
gallandarakhneorg/afc | advanced/shapefile/src/main/java/org/arakhne/afc/io/shape/ESRIFileUtil.java | ESRIFileUtil.fromESRI_y | @Pure
public static double fromESRI_y(double y) throws IOException {
if (Double.isInfinite(y) || Double.isNaN(y)) {
throw new InvalidNumericValueException(y);
}
return y;
} | java | @Pure
public static double fromESRI_y(double y) throws IOException {
if (Double.isInfinite(y) || Double.isNaN(y)) {
throw new InvalidNumericValueException(y);
}
return y;
} | [
"@",
"Pure",
"public",
"static",
"double",
"fromESRI_y",
"(",
"double",
"y",
")",
"throws",
"IOException",
"{",
"if",
"(",
"Double",
".",
"isInfinite",
"(",
"y",
")",
"||",
"Double",
".",
"isNaN",
"(",
"y",
")",
")",
"{",
"throw",
"new",
"InvalidNumeri... | Translate a y-coordinate from ESRI standard
to Java standard.
@param y is the Java y-coordinate
@return the ESRI y-coordinate
@throws IOException when invalid conversion. | [
"Translate",
"a",
"y",
"-",
"coordinate",
"from",
"ESRI",
"standard",
"to",
"Java",
"standard",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/shapefile/src/main/java/org/arakhne/afc/io/shape/ESRIFileUtil.java#L140-L146 | train |
gallandarakhneorg/afc | advanced/shapefile/src/main/java/org/arakhne/afc/io/shape/ESRIFileUtil.java | ESRIFileUtil.toESRI_z | @Pure
public static double toESRI_z(double z) {
if (Double.isInfinite(z) || Double.isNaN(z)) {
return ESRI_NAN;
}
return z;
} | java | @Pure
public static double toESRI_z(double z) {
if (Double.isInfinite(z) || Double.isNaN(z)) {
return ESRI_NAN;
}
return z;
} | [
"@",
"Pure",
"public",
"static",
"double",
"toESRI_z",
"(",
"double",
"z",
")",
"{",
"if",
"(",
"Double",
".",
"isInfinite",
"(",
"z",
")",
"||",
"Double",
".",
"isNaN",
"(",
"z",
")",
")",
"{",
"return",
"ESRI_NAN",
";",
"}",
"return",
"z",
";",
... | Translate a z-coordinate from Java standard
to ESRI standard.
@param z is the Java z-coordinate
@return the ESRI z-coordinate | [
"Translate",
"a",
"z",
"-",
"coordinate",
"from",
"Java",
"standard",
"to",
"ESRI",
"standard",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/shapefile/src/main/java/org/arakhne/afc/io/shape/ESRIFileUtil.java#L154-L160 | train |
gallandarakhneorg/afc | advanced/shapefile/src/main/java/org/arakhne/afc/io/shape/ESRIFileUtil.java | ESRIFileUtil.toESRI_m | @Pure
public static double toESRI_m(double measure) {
if (Double.isInfinite(measure) || Double.isNaN(measure)) {
return ESRI_NAN;
}
return measure;
} | java | @Pure
public static double toESRI_m(double measure) {
if (Double.isInfinite(measure) || Double.isNaN(measure)) {
return ESRI_NAN;
}
return measure;
} | [
"@",
"Pure",
"public",
"static",
"double",
"toESRI_m",
"(",
"double",
"measure",
")",
"{",
"if",
"(",
"Double",
".",
"isInfinite",
"(",
"measure",
")",
"||",
"Double",
".",
"isNaN",
"(",
"measure",
")",
")",
"{",
"return",
"ESRI_NAN",
";",
"}",
"return... | Translate a M-coordinate from Java standard
to ESRI standard.
@param measure is the Java z-coordinate
@return the ESRI m-coordinate | [
"Translate",
"a",
"M",
"-",
"coordinate",
"from",
"Java",
"standard",
"to",
"ESRI",
"standard",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/shapefile/src/main/java/org/arakhne/afc/io/shape/ESRIFileUtil.java#L182-L188 | train |
lightblueseas/swing-components | src/main/java/de/alpharogroup/swing/menu/MenuExtensions.java | MenuExtensions.setAccelerator | public static void setAccelerator(final JMenuItem jmi, final Character keyChar,
final int modifiers)
{
jmi.setAccelerator(KeyStroke.getKeyStroke(keyChar, modifiers));
} | java | public static void setAccelerator(final JMenuItem jmi, final Character keyChar,
final int modifiers)
{
jmi.setAccelerator(KeyStroke.getKeyStroke(keyChar, modifiers));
} | [
"public",
"static",
"void",
"setAccelerator",
"(",
"final",
"JMenuItem",
"jmi",
",",
"final",
"Character",
"keyChar",
",",
"final",
"int",
"modifiers",
")",
"{",
"jmi",
".",
"setAccelerator",
"(",
"KeyStroke",
".",
"getKeyStroke",
"(",
"keyChar",
",",
"modifie... | Sets the accelerator for the given menuitem and the given key char and the given modifiers.
@param jmi
The JMenuItem.
@param keyChar
the key char
@param modifiers
the modifiers | [
"Sets",
"the",
"accelerator",
"for",
"the",
"given",
"menuitem",
"and",
"the",
"given",
"key",
"char",
"and",
"the",
"given",
"modifiers",
"."
] | 4045e85cabd8f0ce985cbfff134c3c9873930c79 | https://github.com/lightblueseas/swing-components/blob/4045e85cabd8f0ce985cbfff134c3c9873930c79/src/main/java/de/alpharogroup/swing/menu/MenuExtensions.java#L61-L65 | train |
lightblueseas/swing-components | src/main/java/de/alpharogroup/swing/menu/MenuExtensions.java | MenuExtensions.setAccelerator | public static void setAccelerator(final JMenuItem jmi, final int keyCode, final int modifiers)
{
jmi.setAccelerator(KeyStroke.getKeyStroke(keyCode, modifiers));
} | java | public static void setAccelerator(final JMenuItem jmi, final int keyCode, final int modifiers)
{
jmi.setAccelerator(KeyStroke.getKeyStroke(keyCode, modifiers));
} | [
"public",
"static",
"void",
"setAccelerator",
"(",
"final",
"JMenuItem",
"jmi",
",",
"final",
"int",
"keyCode",
",",
"final",
"int",
"modifiers",
")",
"{",
"jmi",
".",
"setAccelerator",
"(",
"KeyStroke",
".",
"getKeyStroke",
"(",
"keyCode",
",",
"modifiers",
... | Sets the accelerator for the given menuitem and the given key code and the given modifiers.
@param jmi
The JMenuItem.
@param keyCode
the key code
@param modifiers
the modifiers | [
"Sets",
"the",
"accelerator",
"for",
"the",
"given",
"menuitem",
"and",
"the",
"given",
"key",
"code",
"and",
"the",
"given",
"modifiers",
"."
] | 4045e85cabd8f0ce985cbfff134c3c9873930c79 | https://github.com/lightblueseas/swing-components/blob/4045e85cabd8f0ce985cbfff134c3c9873930c79/src/main/java/de/alpharogroup/swing/menu/MenuExtensions.java#L77-L80 | train |
lightblueseas/swing-components | src/main/java/de/alpharogroup/swing/menu/MenuExtensions.java | MenuExtensions.setAccelerator | public static void setAccelerator(final JMenuItem jmi, final String parsableKeystrokeString)
{
jmi.setAccelerator(KeyStroke.getKeyStroke(parsableKeystrokeString));
} | java | public static void setAccelerator(final JMenuItem jmi, final String parsableKeystrokeString)
{
jmi.setAccelerator(KeyStroke.getKeyStroke(parsableKeystrokeString));
} | [
"public",
"static",
"void",
"setAccelerator",
"(",
"final",
"JMenuItem",
"jmi",
",",
"final",
"String",
"parsableKeystrokeString",
")",
"{",
"jmi",
".",
"setAccelerator",
"(",
"KeyStroke",
".",
"getKeyStroke",
"(",
"parsableKeystrokeString",
")",
")",
";",
"}"
] | Sets the accelerator for the given menuitem and the given parsable keystroke string.
@param jmi
The JMenuItem.
@param parsableKeystrokeString
the parsable keystroke string | [
"Sets",
"the",
"accelerator",
"for",
"the",
"given",
"menuitem",
"and",
"the",
"given",
"parsable",
"keystroke",
"string",
"."
] | 4045e85cabd8f0ce985cbfff134c3c9873930c79 | https://github.com/lightblueseas/swing-components/blob/4045e85cabd8f0ce985cbfff134c3c9873930c79/src/main/java/de/alpharogroup/swing/menu/MenuExtensions.java#L108-L111 | train |
gallandarakhneorg/afc | core/text/src/main/java/org/arakhne/afc/text/Base64Coder.java | Base64Coder.decode | @Pure
@Inline(value = "Base64Coder.decode(($1).toCharArray())", imported = {Base64Coder.class})
public static byte[] decode(String string) {
return decode(string.toCharArray());
} | java | @Pure
@Inline(value = "Base64Coder.decode(($1).toCharArray())", imported = {Base64Coder.class})
public static byte[] decode(String string) {
return decode(string.toCharArray());
} | [
"@",
"Pure",
"@",
"Inline",
"(",
"value",
"=",
"\"Base64Coder.decode(($1).toCharArray())\"",
",",
"imported",
"=",
"{",
"Base64Coder",
".",
"class",
"}",
")",
"public",
"static",
"byte",
"[",
"]",
"decode",
"(",
"String",
"string",
")",
"{",
"return",
"decod... | Decodes a byte array from Base64 format.
@param string a Base64 String to be decoded.
@return An array containing the decoded data bytes.
@throws IllegalArgumentException if the input is not valid Base64 encoded data. | [
"Decodes",
"a",
"byte",
"array",
"from",
"Base64",
"format",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/text/src/main/java/org/arakhne/afc/text/Base64Coder.java#L156-L160 | train |
gallandarakhneorg/afc | core/vmutils/src/main/java/org/arakhne/afc/vmutil/ClassLoaderFinder.java | ClassLoaderFinder.setPreferredClassLoader | public static void setPreferredClassLoader(ClassLoader classLoader) {
if (classLoader != dynamicLoader) {
dynamicLoader = classLoader;
final Thread[] threads = new Thread[Thread.activeCount()];
Thread.enumerate(threads);
for (final Thread t : threads) {
if (t != null) {
t.setContextClassLoader(classLoader);
}
}
}
} | java | public static void setPreferredClassLoader(ClassLoader classLoader) {
if (classLoader != dynamicLoader) {
dynamicLoader = classLoader;
final Thread[] threads = new Thread[Thread.activeCount()];
Thread.enumerate(threads);
for (final Thread t : threads) {
if (t != null) {
t.setContextClassLoader(classLoader);
}
}
}
} | [
"public",
"static",
"void",
"setPreferredClassLoader",
"(",
"ClassLoader",
"classLoader",
")",
"{",
"if",
"(",
"classLoader",
"!=",
"dynamicLoader",
")",
"{",
"dynamicLoader",
"=",
"classLoader",
";",
"final",
"Thread",
"[",
"]",
"threads",
"=",
"new",
"Thread",... | Set the preferred class loader.
@param classLoader is the preferred class loader | [
"Set",
"the",
"preferred",
"class",
"loader",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/vmutils/src/main/java/org/arakhne/afc/vmutil/ClassLoaderFinder.java#L66-L77 | train |
gallandarakhneorg/afc | core/vmutils/src/main/java/org/arakhne/afc/vmutil/ClassLoaderFinder.java | ClassLoaderFinder.popPreferredClassLoader | public static void popPreferredClassLoader() {
final ClassLoader sysLoader = ClassLoaderFinder.class.getClassLoader();
if ((dynamicLoader == null) || (dynamicLoader == sysLoader)) {
dynamicLoader = null;
final Thread[] threads = new Thread[Thread.activeCount()];
Thread.enumerate(threads);
for (final Thread t : threads) {
if (t != null) {
t.setContextClassLoader(sysLoader);
}
}
return;
}
final ClassLoader parent = dynamicLoader.getParent();
dynamicLoader = (parent == sysLoader) ? null : parent;
final Thread[] threads = new Thread[Thread.activeCount()];
Thread.enumerate(threads);
for (final Thread t : threads) {
if (t != null) {
t.setContextClassLoader(parent);
}
}
} | java | public static void popPreferredClassLoader() {
final ClassLoader sysLoader = ClassLoaderFinder.class.getClassLoader();
if ((dynamicLoader == null) || (dynamicLoader == sysLoader)) {
dynamicLoader = null;
final Thread[] threads = new Thread[Thread.activeCount()];
Thread.enumerate(threads);
for (final Thread t : threads) {
if (t != null) {
t.setContextClassLoader(sysLoader);
}
}
return;
}
final ClassLoader parent = dynamicLoader.getParent();
dynamicLoader = (parent == sysLoader) ? null : parent;
final Thread[] threads = new Thread[Thread.activeCount()];
Thread.enumerate(threads);
for (final Thread t : threads) {
if (t != null) {
t.setContextClassLoader(parent);
}
}
} | [
"public",
"static",
"void",
"popPreferredClassLoader",
"(",
")",
"{",
"final",
"ClassLoader",
"sysLoader",
"=",
"ClassLoaderFinder",
".",
"class",
".",
"getClassLoader",
"(",
")",
";",
"if",
"(",
"(",
"dynamicLoader",
"==",
"null",
")",
"||",
"(",
"dynamicLoad... | Pop the preferred class loader. | [
"Pop",
"the",
"preferred",
"class",
"loader",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/vmutils/src/main/java/org/arakhne/afc/vmutil/ClassLoaderFinder.java#L81-L107 | train |
gallandarakhneorg/afc | core/util/src/main/java/org/arakhne/afc/progress/ProgressionUtil.java | ProgressionUtil.isMinValue | public static boolean isMinValue(Progression model) {
if (model != null) {
return model.getValue() <= model.getMinimum();
}
return true;
} | java | public static boolean isMinValue(Progression model) {
if (model != null) {
return model.getValue() <= model.getMinimum();
}
return true;
} | [
"public",
"static",
"boolean",
"isMinValue",
"(",
"Progression",
"model",
")",
"{",
"if",
"(",
"model",
"!=",
"null",
")",
"{",
"return",
"model",
".",
"getValue",
"(",
")",
"<=",
"model",
".",
"getMinimum",
"(",
")",
";",
"}",
"return",
"true",
";",
... | Replies if the given progression indicators has its value
equal to its min value.
@param model is the task progression to initialize.
@return <code>true</code> if the indicator is at its min value or
if {@code model} is <code>null</code>. | [
"Replies",
"if",
"the",
"given",
"progression",
"indicators",
"has",
"its",
"value",
"equal",
"to",
"its",
"min",
"value",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/util/src/main/java/org/arakhne/afc/progress/ProgressionUtil.java#L366-L371 | train |
gallandarakhneorg/afc | advanced/gis/giscorefx/src/main/java/org/arakhne/afc/gis/ui/drawers/AbstractMapMultiPointDrawer.java | AbstractMapMultiPointDrawer.defineSmallRectangles | protected void defineSmallRectangles(ZoomableGraphicsContext gc, T element) {
final double ptsSize = element.getPointSize() / 2.;
final Rectangle2afp<?, ?, ?, ?, ?, ?> visibleArea = gc.getVisibleArea();
for (final Point2d point : element.points()) {
if (visibleArea.contains(point)) {
final double x = point.getX() - ptsSize;
final double y = point.getY() - ptsSize;
final double mx = point.getX() + ptsSize;
final double my = point.getY() + ptsSize;
gc.moveTo(x, y);
gc.lineTo(mx, y);
gc.lineTo(mx, my);
gc.lineTo(x, my);
gc.closePath();
}
}
} | java | protected void defineSmallRectangles(ZoomableGraphicsContext gc, T element) {
final double ptsSize = element.getPointSize() / 2.;
final Rectangle2afp<?, ?, ?, ?, ?, ?> visibleArea = gc.getVisibleArea();
for (final Point2d point : element.points()) {
if (visibleArea.contains(point)) {
final double x = point.getX() - ptsSize;
final double y = point.getY() - ptsSize;
final double mx = point.getX() + ptsSize;
final double my = point.getY() + ptsSize;
gc.moveTo(x, y);
gc.lineTo(mx, y);
gc.lineTo(mx, my);
gc.lineTo(x, my);
gc.closePath();
}
}
} | [
"protected",
"void",
"defineSmallRectangles",
"(",
"ZoomableGraphicsContext",
"gc",
",",
"T",
"element",
")",
"{",
"final",
"double",
"ptsSize",
"=",
"element",
".",
"getPointSize",
"(",
")",
"/",
"2.",
";",
"final",
"Rectangle2afp",
"<",
"?",
",",
"?",
",",... | Define a path that corresponds to the small rectangles around the points.
@param gc the graphics context that must be used for drawing.
@param element the map element. | [
"Define",
"a",
"path",
"that",
"corresponds",
"to",
"the",
"small",
"rectangles",
"around",
"the",
"points",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/giscorefx/src/main/java/org/arakhne/afc/gis/ui/drawers/AbstractMapMultiPointDrawer.java#L44-L60 | train |
gallandarakhneorg/afc | advanced/mathfx/src/main/java/org/arakhne/afc/math/geometry/d1/dfx/Point1dfx.java | Point1dfx.convert | public static Point1dfx convert(Tuple1dfx<?> tuple) {
if (tuple instanceof Point1dfx) {
return (Point1dfx) tuple;
}
return new Point1dfx(tuple.getSegment(), tuple.getX(), tuple.getY());
} | java | public static Point1dfx convert(Tuple1dfx<?> tuple) {
if (tuple instanceof Point1dfx) {
return (Point1dfx) tuple;
}
return new Point1dfx(tuple.getSegment(), tuple.getX(), tuple.getY());
} | [
"public",
"static",
"Point1dfx",
"convert",
"(",
"Tuple1dfx",
"<",
"?",
">",
"tuple",
")",
"{",
"if",
"(",
"tuple",
"instanceof",
"Point1dfx",
")",
"{",
"return",
"(",
"Point1dfx",
")",
"tuple",
";",
"}",
"return",
"new",
"Point1dfx",
"(",
"tuple",
".",
... | Convert the given tuple to a real Point1dfx.
<p>If the given tuple is already a Point1dfx, it is replied.
@param tuple the tuple.
@return the Point1dfx.
@since 14.0 | [
"Convert",
"the",
"given",
"tuple",
"to",
"a",
"real",
"Point1dfx",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/mathfx/src/main/java/org/arakhne/afc/math/geometry/d1/dfx/Point1dfx.java#L157-L162 | train |
BBN-E/bue-common-open | nlp-core-open/src/main/java/com/bbn/nlp/corenlp/CoreNLPSentence.java | CoreNLPSentence.offsets | public OffsetRange<CharOffset> offsets() {
final CharOffset start = tokens.get(0).offsets().startInclusive();
final CharOffset end = tokens.reverse().get(0).offsets().endInclusive();
return OffsetRange.charOffsetRange(start.asInt(), end.asInt());
} | java | public OffsetRange<CharOffset> offsets() {
final CharOffset start = tokens.get(0).offsets().startInclusive();
final CharOffset end = tokens.reverse().get(0).offsets().endInclusive();
return OffsetRange.charOffsetRange(start.asInt(), end.asInt());
} | [
"public",
"OffsetRange",
"<",
"CharOffset",
">",
"offsets",
"(",
")",
"{",
"final",
"CharOffset",
"start",
"=",
"tokens",
".",
"get",
"(",
"0",
")",
".",
"offsets",
"(",
")",
".",
"startInclusive",
"(",
")",
";",
"final",
"CharOffset",
"end",
"=",
"tok... | Span from the start of the first token to the end of the last. | [
"Span",
"from",
"the",
"start",
"of",
"the",
"first",
"token",
"to",
"the",
"end",
"of",
"the",
"last",
"."
] | d618652674d647867306e2e4b987a21b7c29c015 | https://github.com/BBN-E/bue-common-open/blob/d618652674d647867306e2e4b987a21b7c29c015/nlp-core-open/src/main/java/com/bbn/nlp/corenlp/CoreNLPSentence.java#L35-L39 | train |
agmip/translator-dssat | src/main/java/org/agmip/translators/dssat/DssatControllerInput.java | DssatControllerInput.readFile | @Override
public HashMap readFile(String arg0) {
HashMap brMap;
try {
brMap = getBufferReader(arg0);
} catch (FileNotFoundException fe) {
LOG.warn("File not found under following path : [" + arg0 + "]!");
return new HashMap();
} catch (IOException e) {
LOG.error(Functions.getStackTrace(e));
return new HashMap();
}
return read(brMap);
} | java | @Override
public HashMap readFile(String arg0) {
HashMap brMap;
try {
brMap = getBufferReader(arg0);
} catch (FileNotFoundException fe) {
LOG.warn("File not found under following path : [" + arg0 + "]!");
return new HashMap();
} catch (IOException e) {
LOG.error(Functions.getStackTrace(e));
return new HashMap();
}
return read(brMap);
} | [
"@",
"Override",
"public",
"HashMap",
"readFile",
"(",
"String",
"arg0",
")",
"{",
"HashMap",
"brMap",
";",
"try",
"{",
"brMap",
"=",
"getBufferReader",
"(",
"arg0",
")",
";",
"}",
"catch",
"(",
"FileNotFoundException",
"fe",
")",
"{",
"LOG",
".",
"warn"... | All DSSAT Data input method, used for single file or zip package
@param arg0 The path of input experiment file
@return result data holder object | [
"All",
"DSSAT",
"Data",
"input",
"method",
"used",
"for",
"single",
"file",
"or",
"zip",
"package"
] | 4be61d998f106eb7234ea8701b63c3746ae688f4 | https://github.com/agmip/translator-dssat/blob/4be61d998f106eb7234ea8701b63c3746ae688f4/src/main/java/org/agmip/translators/dssat/DssatControllerInput.java#L36-L49 | train |
agmip/translator-dssat | src/main/java/org/agmip/translators/dssat/DssatControllerInput.java | DssatControllerInput.readFile | public HashMap readFile(List<File> files) {
HashMap brMap;
try {
brMap = getBufferReader(files);
} catch (IOException e) {
LOG.error(Functions.getStackTrace(e));
return new HashMap();
}
return read(brMap);
} | java | public HashMap readFile(List<File> files) {
HashMap brMap;
try {
brMap = getBufferReader(files);
} catch (IOException e) {
LOG.error(Functions.getStackTrace(e));
return new HashMap();
}
return read(brMap);
} | [
"public",
"HashMap",
"readFile",
"(",
"List",
"<",
"File",
">",
"files",
")",
"{",
"HashMap",
"brMap",
";",
"try",
"{",
"brMap",
"=",
"getBufferReader",
"(",
"files",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"LOG",
".",
"error",
"("... | All DSSAT Data input method, used for uncompressed multiple files
@param files The list of model input files for translation
@return result data holder object | [
"All",
"DSSAT",
"Data",
"input",
"method",
"used",
"for",
"uncompressed",
"multiple",
"files"
] | 4be61d998f106eb7234ea8701b63c3746ae688f4 | https://github.com/agmip/translator-dssat/blob/4be61d998f106eb7234ea8701b63c3746ae688f4/src/main/java/org/agmip/translators/dssat/DssatControllerInput.java#L57-L66 | train |
agmip/translator-dssat | src/main/java/org/agmip/translators/dssat/DssatControllerInput.java | DssatControllerInput.readFileFromCRAFT | public HashMap readFileFromCRAFT(String arg0) {
HashMap brMap;
try {
File dir = new File(arg0);
// Data frin CRAFT with DSSAT format
if (dir.isDirectory()) {
List<File> files = new ArrayList();
for (File f : dir.listFiles()) {
String name = f.getName().toUpperCase();
// XFile folder
if (name.equals("FILEX")) {
for (File exp : f.listFiles()) {
if (exp.isFile()) {
String expName = exp.getName().toUpperCase();
if (expName.matches(".+\\.\\w{2}X")) {
files.add(exp);
}
}
}
} // Weather folder
else if (name.equals("WEATHER")) {
for (File wth : f.listFiles()) {
if (wth.isFile()) {
String wthName = wth.getName().toUpperCase();
if (wthName.endsWith(".WTH")) {
files.add(wth);
}
}
}
} // Soil file
else if (f.isFile() && name.endsWith(".SOL")) {
files.add(f);
}
}
brMap = getBufferReader(files);
} else {
LOG.error("You need to provide the CRAFT working folder used for generating DSSAT files.");
return new HashMap();
}
} catch (IOException e) {
LOG.error(Functions.getStackTrace(e));
return new HashMap();
}
return read(brMap);
} | java | public HashMap readFileFromCRAFT(String arg0) {
HashMap brMap;
try {
File dir = new File(arg0);
// Data frin CRAFT with DSSAT format
if (dir.isDirectory()) {
List<File> files = new ArrayList();
for (File f : dir.listFiles()) {
String name = f.getName().toUpperCase();
// XFile folder
if (name.equals("FILEX")) {
for (File exp : f.listFiles()) {
if (exp.isFile()) {
String expName = exp.getName().toUpperCase();
if (expName.matches(".+\\.\\w{2}X")) {
files.add(exp);
}
}
}
} // Weather folder
else if (name.equals("WEATHER")) {
for (File wth : f.listFiles()) {
if (wth.isFile()) {
String wthName = wth.getName().toUpperCase();
if (wthName.endsWith(".WTH")) {
files.add(wth);
}
}
}
} // Soil file
else if (f.isFile() && name.endsWith(".SOL")) {
files.add(f);
}
}
brMap = getBufferReader(files);
} else {
LOG.error("You need to provide the CRAFT working folder used for generating DSSAT files.");
return new HashMap();
}
} catch (IOException e) {
LOG.error(Functions.getStackTrace(e));
return new HashMap();
}
return read(brMap);
} | [
"public",
"HashMap",
"readFileFromCRAFT",
"(",
"String",
"arg0",
")",
"{",
"HashMap",
"brMap",
";",
"try",
"{",
"File",
"dir",
"=",
"new",
"File",
"(",
"arg0",
")",
";",
"// Data frin CRAFT with DSSAT format",
"if",
"(",
"dir",
".",
"isDirectory",
"(",
")",
... | All DSSAT Data input method, specially used for DSSAT files generated by CRAFT
@param arg0 The path of CRAFT working folder
@return result data holder object | [
"All",
"DSSAT",
"Data",
"input",
"method",
"specially",
"used",
"for",
"DSSAT",
"files",
"generated",
"by",
"CRAFT"
] | 4be61d998f106eb7234ea8701b63c3746ae688f4 | https://github.com/agmip/translator-dssat/blob/4be61d998f106eb7234ea8701b63c3746ae688f4/src/main/java/org/agmip/translators/dssat/DssatControllerInput.java#L74-L120 | train |
gallandarakhneorg/afc | core/inputoutput/src/main/java/org/arakhne/afc/inputoutput/filetype/BufferedMagicNumberStream.java | BufferedMagicNumberStream.ensureBuffer | private int ensureBuffer(int offset, int length) throws IOException {
final int lastPos = offset + length - 1;
final int desiredSize = ((lastPos / BUFFER_SIZE) + 1) * BUFFER_SIZE;
final int currentSize = this.buffer.length;
if (desiredSize > currentSize) {
final byte[] readBuffer = new byte[desiredSize - currentSize];
final int count = this.in.read(readBuffer);
if (count > 0) {
final byte[] newBuffer = new byte[currentSize + count];
System.arraycopy(this.buffer, 0, newBuffer, 0, currentSize);
System.arraycopy(readBuffer, 0, newBuffer, currentSize, count);
this.buffer = newBuffer;
}
return (lastPos < this.buffer.length) ? length : length - (lastPos - this.buffer.length + 1);
}
return length;
} | java | private int ensureBuffer(int offset, int length) throws IOException {
final int lastPos = offset + length - 1;
final int desiredSize = ((lastPos / BUFFER_SIZE) + 1) * BUFFER_SIZE;
final int currentSize = this.buffer.length;
if (desiredSize > currentSize) {
final byte[] readBuffer = new byte[desiredSize - currentSize];
final int count = this.in.read(readBuffer);
if (count > 0) {
final byte[] newBuffer = new byte[currentSize + count];
System.arraycopy(this.buffer, 0, newBuffer, 0, currentSize);
System.arraycopy(readBuffer, 0, newBuffer, currentSize, count);
this.buffer = newBuffer;
}
return (lastPos < this.buffer.length) ? length : length - (lastPos - this.buffer.length + 1);
}
return length;
} | [
"private",
"int",
"ensureBuffer",
"(",
"int",
"offset",
",",
"int",
"length",
")",
"throws",
"IOException",
"{",
"final",
"int",
"lastPos",
"=",
"offset",
"+",
"length",
"-",
"1",
";",
"final",
"int",
"desiredSize",
"=",
"(",
"(",
"lastPos",
"/",
"BUFFER... | Replies the count of characters available for reading. | [
"Replies",
"the",
"count",
"of",
"characters",
"available",
"for",
"reading",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/inputoutput/src/main/java/org/arakhne/afc/inputoutput/filetype/BufferedMagicNumberStream.java#L68-L86 | train |
gallandarakhneorg/afc | core/inputoutput/src/main/java/org/arakhne/afc/inputoutput/filetype/BufferedMagicNumberStream.java | BufferedMagicNumberStream.read | public byte[] read(int offset, int length) throws IOException {
if (ensureBuffer(offset, length) >= length) {
final byte[] array = new byte[length];
System.arraycopy(this.buffer, offset, array, 0, length);
this.pos = offset + length;
return array;
}
throw new EOFException();
} | java | public byte[] read(int offset, int length) throws IOException {
if (ensureBuffer(offset, length) >= length) {
final byte[] array = new byte[length];
System.arraycopy(this.buffer, offset, array, 0, length);
this.pos = offset + length;
return array;
}
throw new EOFException();
} | [
"public",
"byte",
"[",
"]",
"read",
"(",
"int",
"offset",
",",
"int",
"length",
")",
"throws",
"IOException",
"{",
"if",
"(",
"ensureBuffer",
"(",
"offset",
",",
"length",
")",
">=",
"length",
")",
"{",
"final",
"byte",
"[",
"]",
"array",
"=",
"new",... | Replies the bytes at the specified offset.
@param offset is the position of the first byte to read.
@param length is the count of bytes to read.
@return the array of red bytes.
@throws IOException in case of problems | [
"Replies",
"the",
"bytes",
"at",
"the",
"specified",
"offset",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/inputoutput/src/main/java/org/arakhne/afc/inputoutput/filetype/BufferedMagicNumberStream.java#L95-L103 | train |
gallandarakhneorg/afc | core/inputoutput/src/main/java/org/arakhne/afc/inputoutput/filetype/BufferedMagicNumberStream.java | BufferedMagicNumberStream.read | public byte read(int offset) throws IOException {
if (ensureBuffer(offset, 1) > 0) {
this.pos = offset + 1;
return this.buffer[offset];
}
throw new EOFException();
} | java | public byte read(int offset) throws IOException {
if (ensureBuffer(offset, 1) > 0) {
this.pos = offset + 1;
return this.buffer[offset];
}
throw new EOFException();
} | [
"public",
"byte",
"read",
"(",
"int",
"offset",
")",
"throws",
"IOException",
"{",
"if",
"(",
"ensureBuffer",
"(",
"offset",
",",
"1",
")",
">",
"0",
")",
"{",
"this",
".",
"pos",
"=",
"offset",
"+",
"1",
";",
"return",
"this",
".",
"buffer",
"[",
... | Replies a byte at the specified offset.
@param offset is the position of the byte to read.
@return the byte.
@throws IOException in case of problems | [
"Replies",
"a",
"byte",
"at",
"the",
"specified",
"offset",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/inputoutput/src/main/java/org/arakhne/afc/inputoutput/filetype/BufferedMagicNumberStream.java#L111-L117 | train |
BBN-E/bue-common-open | common-core-open/src/main/java/com/bbn/bue/common/parameters/Parameters.java | Parameters.getString | public String getString(final String param) {
checkNotNull(param);
checkArgument(!param.isEmpty());
final String ret = params.get(param);
observeWithListeners(param);
if (ret != null) {
return ret;
} else {
throw new MissingRequiredParameter(fullString(param));
}
} | java | public String getString(final String param) {
checkNotNull(param);
checkArgument(!param.isEmpty());
final String ret = params.get(param);
observeWithListeners(param);
if (ret != null) {
return ret;
} else {
throw new MissingRequiredParameter(fullString(param));
}
} | [
"public",
"String",
"getString",
"(",
"final",
"String",
"param",
")",
"{",
"checkNotNull",
"(",
"param",
")",
";",
"checkArgument",
"(",
"!",
"param",
".",
"isEmpty",
"(",
")",
")",
";",
"final",
"String",
"ret",
"=",
"params",
".",
"get",
"(",
"param... | Gets the value for a parameter as a raw string. | [
"Gets",
"the",
"value",
"for",
"a",
"parameter",
"as",
"a",
"raw",
"string",
"."
] | d618652674d647867306e2e4b987a21b7c29c015 | https://github.com/BBN-E/bue-common-open/blob/d618652674d647867306e2e4b987a21b7c29c015/common-core-open/src/main/java/com/bbn/bue/common/parameters/Parameters.java#L272-L284 | train |
BBN-E/bue-common-open | common-core-open/src/main/java/com/bbn/bue/common/parameters/Parameters.java | Parameters.getMapped | public <T> T getMapped(final String param, final Map<String, T> possibleValues) {
checkNotNull(possibleValues);
checkArgument(!possibleValues.isEmpty());
final String value = getString(param);
final T ret = possibleValues.get(value);
if (ret == null) {
throw new InvalidEnumeratedPropertyException(fullString(param), value,
possibleValues.keySet());
}
return ret;
} | java | public <T> T getMapped(final String param, final Map<String, T> possibleValues) {
checkNotNull(possibleValues);
checkArgument(!possibleValues.isEmpty());
final String value = getString(param);
final T ret = possibleValues.get(value);
if (ret == null) {
throw new InvalidEnumeratedPropertyException(fullString(param), value,
possibleValues.keySet());
}
return ret;
} | [
"public",
"<",
"T",
">",
"T",
"getMapped",
"(",
"final",
"String",
"param",
",",
"final",
"Map",
"<",
"String",
",",
"T",
">",
"possibleValues",
")",
"{",
"checkNotNull",
"(",
"possibleValues",
")",
";",
"checkArgument",
"(",
"!",
"possibleValues",
".",
... | Looks up a parameter, then uses the value as a key in a map lookup. If the value is not a key
in the map, throws an exception.
@param possibleValues May not be null. May not be empty.
@throws InvalidEnumeratedPropertyException if the parameter value is not on the list. | [
"Looks",
"up",
"a",
"parameter",
"then",
"uses",
"the",
"value",
"as",
"a",
"key",
"in",
"a",
"map",
"lookup",
".",
"If",
"the",
"value",
"is",
"not",
"a",
"key",
"in",
"the",
"map",
"throws",
"an",
"exception",
"."
] | d618652674d647867306e2e4b987a21b7c29c015 | https://github.com/BBN-E/bue-common-open/blob/d618652674d647867306e2e4b987a21b7c29c015/common-core-open/src/main/java/com/bbn/bue/common/parameters/Parameters.java#L436-L448 | train |
BBN-E/bue-common-open | common-core-open/src/main/java/com/bbn/bue/common/parameters/Parameters.java | Parameters.getExistingFile | public File getExistingFile(final String param) {
return get(param, getFileConverter(),
new And<>(new FileExists(), new IsFile()),
"existing file");
} | java | public File getExistingFile(final String param) {
return get(param, getFileConverter(),
new And<>(new FileExists(), new IsFile()),
"existing file");
} | [
"public",
"File",
"getExistingFile",
"(",
"final",
"String",
"param",
")",
"{",
"return",
"get",
"(",
"param",
",",
"getFileConverter",
"(",
")",
",",
"new",
"And",
"<>",
"(",
"new",
"FileExists",
"(",
")",
",",
"new",
"IsFile",
"(",
")",
")",
",",
"... | Gets a file, which is required to exist. | [
"Gets",
"a",
"file",
"which",
"is",
"required",
"to",
"exist",
"."
] | d618652674d647867306e2e4b987a21b7c29c015 | https://github.com/BBN-E/bue-common-open/blob/d618652674d647867306e2e4b987a21b7c29c015/common-core-open/src/main/java/com/bbn/bue/common/parameters/Parameters.java#L759-L763 | train |
BBN-E/bue-common-open | common-core-open/src/main/java/com/bbn/bue/common/parameters/Parameters.java | Parameters.getAndMakeDirectory | public File getAndMakeDirectory(final String param) {
final File f = get(param, new StringToFile(),
new AlwaysValid<File>(), "existing or creatable directory");
if (f.exists()) {
if (f.isDirectory()) {
return f.getAbsoluteFile();
} else {
throw new ParameterValidationException(fullString(param), f
.getAbsolutePath().toString(),
new ValidationException("Not an existing or creatable directory"));
}
} else {
f.getAbsoluteFile().mkdirs();
return f.getAbsoluteFile();
}
} | java | public File getAndMakeDirectory(final String param) {
final File f = get(param, new StringToFile(),
new AlwaysValid<File>(), "existing or creatable directory");
if (f.exists()) {
if (f.isDirectory()) {
return f.getAbsoluteFile();
} else {
throw new ParameterValidationException(fullString(param), f
.getAbsolutePath().toString(),
new ValidationException("Not an existing or creatable directory"));
}
} else {
f.getAbsoluteFile().mkdirs();
return f.getAbsoluteFile();
}
} | [
"public",
"File",
"getAndMakeDirectory",
"(",
"final",
"String",
"param",
")",
"{",
"final",
"File",
"f",
"=",
"get",
"(",
"param",
",",
"new",
"StringToFile",
"(",
")",
",",
"new",
"AlwaysValid",
"<",
"File",
">",
"(",
")",
",",
"\"existing or creatable d... | Gets a directory which is guaranteed to exist after the execution of this method. If the
directory does not already exist, it and its parents are created. If this is not possible, an
exception is throws. | [
"Gets",
"a",
"directory",
"which",
"is",
"guaranteed",
"to",
"exist",
"after",
"the",
"execution",
"of",
"this",
"method",
".",
"If",
"the",
"directory",
"does",
"not",
"already",
"exist",
"it",
"and",
"its",
"parents",
"are",
"created",
".",
"If",
"this",... | d618652674d647867306e2e4b987a21b7c29c015 | https://github.com/BBN-E/bue-common-open/blob/d618652674d647867306e2e4b987a21b7c29c015/common-core-open/src/main/java/com/bbn/bue/common/parameters/Parameters.java#L791-L807 | train |
BBN-E/bue-common-open | common-core-open/src/main/java/com/bbn/bue/common/parameters/Parameters.java | Parameters.getExistingDirectory | public File getExistingDirectory(final String param) {
return get(param, new StringToFile(),
new And<>(new FileExists(), new IsDirectory()),
"existing directory");
} | java | public File getExistingDirectory(final String param) {
return get(param, new StringToFile(),
new And<>(new FileExists(), new IsDirectory()),
"existing directory");
} | [
"public",
"File",
"getExistingDirectory",
"(",
"final",
"String",
"param",
")",
"{",
"return",
"get",
"(",
"param",
",",
"new",
"StringToFile",
"(",
")",
",",
"new",
"And",
"<>",
"(",
"new",
"FileExists",
"(",
")",
",",
"new",
"IsDirectory",
"(",
")",
... | Gets a directory which already exists. | [
"Gets",
"a",
"directory",
"which",
"already",
"exists",
"."
] | d618652674d647867306e2e4b987a21b7c29c015 | https://github.com/BBN-E/bue-common-open/blob/d618652674d647867306e2e4b987a21b7c29c015/common-core-open/src/main/java/com/bbn/bue/common/parameters/Parameters.java#L812-L816 | train |
BBN-E/bue-common-open | common-core-open/src/main/java/com/bbn/bue/common/parameters/Parameters.java | Parameters.getStringSet | public Set<String> getStringSet(final String param) {
return get(param, new StringToStringSet(","),
new AlwaysValid<Set<String>>(),
"comma-separated list of strings");
} | java | public Set<String> getStringSet(final String param) {
return get(param, new StringToStringSet(","),
new AlwaysValid<Set<String>>(),
"comma-separated list of strings");
} | [
"public",
"Set",
"<",
"String",
">",
"getStringSet",
"(",
"final",
"String",
"param",
")",
"{",
"return",
"get",
"(",
"param",
",",
"new",
"StringToStringSet",
"(",
"\",\"",
")",
",",
"new",
"AlwaysValid",
"<",
"Set",
"<",
"String",
">",
">",
"(",
")",... | Gets a ,-separated set of Strings. | [
"Gets",
"a",
"-",
"separated",
"set",
"of",
"Strings",
"."
] | d618652674d647867306e2e4b987a21b7c29c015 | https://github.com/BBN-E/bue-common-open/blob/d618652674d647867306e2e4b987a21b7c29c015/common-core-open/src/main/java/com/bbn/bue/common/parameters/Parameters.java#L875-L879 | train |
BBN-E/bue-common-open | common-core-open/src/main/java/com/bbn/bue/common/parameters/Parameters.java | Parameters.getSymbolSet | public Set<Symbol> getSymbolSet(final String param) {
return get(param, new StringToSymbolSet(","),
new AlwaysValid<Set<Symbol>>(),
"comma-separated list of strings");
} | java | public Set<Symbol> getSymbolSet(final String param) {
return get(param, new StringToSymbolSet(","),
new AlwaysValid<Set<Symbol>>(),
"comma-separated list of strings");
} | [
"public",
"Set",
"<",
"Symbol",
">",
"getSymbolSet",
"(",
"final",
"String",
"param",
")",
"{",
"return",
"get",
"(",
"param",
",",
"new",
"StringToSymbolSet",
"(",
"\",\"",
")",
",",
"new",
"AlwaysValid",
"<",
"Set",
"<",
"Symbol",
">",
">",
"(",
")",... | Gets a ,-separated set of Symbols | [
"Gets",
"a",
"-",
"separated",
"set",
"of",
"Symbols"
] | d618652674d647867306e2e4b987a21b7c29c015 | https://github.com/BBN-E/bue-common-open/blob/d618652674d647867306e2e4b987a21b7c29c015/common-core-open/src/main/java/com/bbn/bue/common/parameters/Parameters.java#L912-L916 | train |
BBN-E/bue-common-open | common-core-open/src/main/java/com/bbn/bue/common/parameters/Parameters.java | Parameters.assertAtLeastOneDefined | public void assertAtLeastOneDefined(final String param1, final String param2) {
if (!isPresent(param1) && !isPresent(param2)) {
throw new ParameterException(
String.format("At least one of %s and %s must be defined.", param1, param2));
}
} | java | public void assertAtLeastOneDefined(final String param1, final String param2) {
if (!isPresent(param1) && !isPresent(param2)) {
throw new ParameterException(
String.format("At least one of %s and %s must be defined.", param1, param2));
}
} | [
"public",
"void",
"assertAtLeastOneDefined",
"(",
"final",
"String",
"param1",
",",
"final",
"String",
"param2",
")",
"{",
"if",
"(",
"!",
"isPresent",
"(",
"param1",
")",
"&&",
"!",
"isPresent",
"(",
"param2",
")",
")",
"{",
"throw",
"new",
"ParameterExce... | Throws a ParameterException if neither parameter is defined. | [
"Throws",
"a",
"ParameterException",
"if",
"neither",
"parameter",
"is",
"defined",
"."
] | d618652674d647867306e2e4b987a21b7c29c015 | https://github.com/BBN-E/bue-common-open/blob/d618652674d647867306e2e4b987a21b7c29c015/common-core-open/src/main/java/com/bbn/bue/common/parameters/Parameters.java#L1088-L1093 | train |
BBN-E/bue-common-open | common-core-open/src/main/java/com/bbn/bue/common/parameters/Parameters.java | Parameters.assertAtLeastOneDefined | public void assertAtLeastOneDefined(final String param1, final String... moreParams) {
if (!isPresent(param1)) {
for (final String moreParam : moreParams) {
if (isPresent(moreParam)) {
return;
}
}
final List<String> paramsForError = Lists.newArrayList();
paramsForError.add(param1);
paramsForError.addAll(Arrays.asList(moreParams));
throw new ParameterException(
String.format("At least one of %s must be defined.",
StringUtils.CommaSpaceJoiner.join(paramsForError)));
}
} | java | public void assertAtLeastOneDefined(final String param1, final String... moreParams) {
if (!isPresent(param1)) {
for (final String moreParam : moreParams) {
if (isPresent(moreParam)) {
return;
}
}
final List<String> paramsForError = Lists.newArrayList();
paramsForError.add(param1);
paramsForError.addAll(Arrays.asList(moreParams));
throw new ParameterException(
String.format("At least one of %s must be defined.",
StringUtils.CommaSpaceJoiner.join(paramsForError)));
}
} | [
"public",
"void",
"assertAtLeastOneDefined",
"(",
"final",
"String",
"param1",
",",
"final",
"String",
"...",
"moreParams",
")",
"{",
"if",
"(",
"!",
"isPresent",
"(",
"param1",
")",
")",
"{",
"for",
"(",
"final",
"String",
"moreParam",
":",
"moreParams",
... | Throws a ParameterException if none of the supplied parameters are defined. | [
"Throws",
"a",
"ParameterException",
"if",
"none",
"of",
"the",
"supplied",
"parameters",
"are",
"defined",
"."
] | d618652674d647867306e2e4b987a21b7c29c015 | https://github.com/BBN-E/bue-common-open/blob/d618652674d647867306e2e4b987a21b7c29c015/common-core-open/src/main/java/com/bbn/bue/common/parameters/Parameters.java#L1098-L1112 | train |
BBN-E/bue-common-open | common-core-open/src/main/java/com/bbn/bue/common/collections/ShufflingIterable.java | ShufflingIterable.iterator | @Override
public Iterator<T> iterator() {
final List<T> shuffledList = Lists.newArrayList(data);
Collections.shuffle(shuffledList, rng);
return Collections.unmodifiableList(shuffledList).iterator();
} | java | @Override
public Iterator<T> iterator() {
final List<T> shuffledList = Lists.newArrayList(data);
Collections.shuffle(shuffledList, rng);
return Collections.unmodifiableList(shuffledList).iterator();
} | [
"@",
"Override",
"public",
"Iterator",
"<",
"T",
">",
"iterator",
"(",
")",
"{",
"final",
"List",
"<",
"T",
">",
"shuffledList",
"=",
"Lists",
".",
"newArrayList",
"(",
"data",
")",
";",
"Collections",
".",
"shuffle",
"(",
"shuffledList",
",",
"rng",
"... | Returns a new iterator that iterates over a new random ordering of the data. | [
"Returns",
"a",
"new",
"iterator",
"that",
"iterates",
"over",
"a",
"new",
"random",
"ordering",
"of",
"the",
"data",
"."
] | d618652674d647867306e2e4b987a21b7c29c015 | https://github.com/BBN-E/bue-common-open/blob/d618652674d647867306e2e4b987a21b7c29c015/common-core-open/src/main/java/com/bbn/bue/common/collections/ShufflingIterable.java#L43-L48 | train |
agmip/translator-dssat | src/main/java/org/agmip/translators/dssat/DssatBatchFileOutput.java | DssatBatchFileOutput.writeFile | @Override
public void writeFile(String arg0, Map result) {
// Initial variables
BufferedWriter bwB; // output object
StringBuilder sbData = new StringBuilder(); // construct the data info in the output
try {
// Set default value for missing data
setDefVal();
// Get version number
if (dssatVerStr == null) {
dssatVerStr = getObjectOr(result, "crop_model_version", "").replaceAll("\\D", "");
if (!dssatVerStr.matches("\\d+")) {
dssatVerStr = DssatVersion.DSSAT45.toString();
}
}
// Initial BufferedWriter
arg0 = revisePath(arg0);
outputFile = new File(arg0 + "DSSBatch.v" + dssatVerStr);
bwB = new BufferedWriter(new FileWriter(outputFile));
// Output Batch File
// Titel Section
String crop = getCropName(result);
String dssatPath = "C:\\DSSAT" + dssatVerStr + "\\";
String exFileName = getFileName(result, "X");
int expNo = 1;
// Write title section
sbData.append("$BATCH(").append(crop).append(")\r\n!\r\n");
sbData.append(String.format("! Command Line : %1$sDSCSM0%2$s.EXE B DSSBatch.v%2$s\r\n", dssatPath, dssatVerStr));
sbData.append("! Crop : ").append(crop).append("\r\n");
sbData.append("! Experiment : ").append(exFileName).append("\r\n");
sbData.append("! ExpNo : ").append(expNo).append("\r\n");
sbData.append(String.format("! Debug : %1$sDSCSM0%2$s.EXE \" B DSSBatch.v%2$s\"\r\n!\r\n", dssatPath, dssatVerStr));
// Body Section
sbData.append("@FILEX TRTNO RP SQ OP CO\r\n");
// Get DSSAT Sequence info
HashMap dssatSeqData = getObjectOr(result, "dssat_sequence", new HashMap());
ArrayList<HashMap> dssatSeqArr = getObjectOr(dssatSeqData, "data", new ArrayList<HashMap>());
// If missing, set default value
if (dssatSeqArr.isEmpty()) {
HashMap tmp = new HashMap();
tmp.put("sq", "1");
tmp.put("op", "1");
tmp.put("co", "0");
dssatSeqArr.add(tmp);
}
// Output all info
for (HashMap dssatSeqSubData : dssatSeqArr) {
sbData.append(String.format("%1$-92s %2$6s %3$6s %4$6s %5$6s %6$6s", exFileName, "1", "1", getObjectOr(dssatSeqSubData, "sq", "1"), getObjectOr(dssatSeqSubData, "op", "1"), getObjectOr(dssatSeqSubData, "co", "0")));
}
// Output finish
bwB.write(sbError.toString());
bwB.write(sbData.toString());
bwB.close();
} catch (IOException e) {
LOG.error(DssatCommonOutput.getStackTrace(e));
}
} | java | @Override
public void writeFile(String arg0, Map result) {
// Initial variables
BufferedWriter bwB; // output object
StringBuilder sbData = new StringBuilder(); // construct the data info in the output
try {
// Set default value for missing data
setDefVal();
// Get version number
if (dssatVerStr == null) {
dssatVerStr = getObjectOr(result, "crop_model_version", "").replaceAll("\\D", "");
if (!dssatVerStr.matches("\\d+")) {
dssatVerStr = DssatVersion.DSSAT45.toString();
}
}
// Initial BufferedWriter
arg0 = revisePath(arg0);
outputFile = new File(arg0 + "DSSBatch.v" + dssatVerStr);
bwB = new BufferedWriter(new FileWriter(outputFile));
// Output Batch File
// Titel Section
String crop = getCropName(result);
String dssatPath = "C:\\DSSAT" + dssatVerStr + "\\";
String exFileName = getFileName(result, "X");
int expNo = 1;
// Write title section
sbData.append("$BATCH(").append(crop).append(")\r\n!\r\n");
sbData.append(String.format("! Command Line : %1$sDSCSM0%2$s.EXE B DSSBatch.v%2$s\r\n", dssatPath, dssatVerStr));
sbData.append("! Crop : ").append(crop).append("\r\n");
sbData.append("! Experiment : ").append(exFileName).append("\r\n");
sbData.append("! ExpNo : ").append(expNo).append("\r\n");
sbData.append(String.format("! Debug : %1$sDSCSM0%2$s.EXE \" B DSSBatch.v%2$s\"\r\n!\r\n", dssatPath, dssatVerStr));
// Body Section
sbData.append("@FILEX TRTNO RP SQ OP CO\r\n");
// Get DSSAT Sequence info
HashMap dssatSeqData = getObjectOr(result, "dssat_sequence", new HashMap());
ArrayList<HashMap> dssatSeqArr = getObjectOr(dssatSeqData, "data", new ArrayList<HashMap>());
// If missing, set default value
if (dssatSeqArr.isEmpty()) {
HashMap tmp = new HashMap();
tmp.put("sq", "1");
tmp.put("op", "1");
tmp.put("co", "0");
dssatSeqArr.add(tmp);
}
// Output all info
for (HashMap dssatSeqSubData : dssatSeqArr) {
sbData.append(String.format("%1$-92s %2$6s %3$6s %4$6s %5$6s %6$6s", exFileName, "1", "1", getObjectOr(dssatSeqSubData, "sq", "1"), getObjectOr(dssatSeqSubData, "op", "1"), getObjectOr(dssatSeqSubData, "co", "0")));
}
// Output finish
bwB.write(sbError.toString());
bwB.write(sbData.toString());
bwB.close();
} catch (IOException e) {
LOG.error(DssatCommonOutput.getStackTrace(e));
}
} | [
"@",
"Override",
"public",
"void",
"writeFile",
"(",
"String",
"arg0",
",",
"Map",
"result",
")",
"{",
"// Initial variables",
"BufferedWriter",
"bwB",
";",
"// output object",
"StringBuilder",
"sbData",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"// construct th... | DSSAT Batch File Output method
@param arg0 file output path
@param result data holder object | [
"DSSAT",
"Batch",
"File",
"Output",
"method"
] | 4be61d998f106eb7234ea8701b63c3746ae688f4 | https://github.com/agmip/translator-dssat/blob/4be61d998f106eb7234ea8701b63c3746ae688f4/src/main/java/org/agmip/translators/dssat/DssatBatchFileOutput.java#L145-L210 | train |
agmip/translator-dssat | src/main/java/org/agmip/translators/dssat/DssatBatchFileOutput.java | DssatBatchFileOutput.getCropName | private String getCropName(Map result) {
String ret;
String crid;
// Get crop id
crid = getCrid(result);
// Get crop name string
ret = LookupCodes.lookupCode("CRID", crid, "common", "DSSAT");
if (ret.equals(crid)) {
ret = "Unkown";
sbError.append("! Warning: Undefined crop id: [").append(crid).append("]\r\n");
}
// // Get crop name string
// if ("BH".equals(crid)) {
// ret = "Bahia";
// } else if ("BA".equals(crid)) {
// ret = "Barley";
// } else if ("BR".equals(crid)) {
// ret = "Brachiaria";
// } else if ("CB".equals(crid)) {
// ret = "Cabbage";
// } else if ("CS".equals(crid)) {
// ret = "Cassava";
// } else if ("CH".equals(crid)) {
// ret = "Chickpea";
// } else if ("CO".equals(crid)) {
// ret = "Cotton";
// } else if ("CP".equals(crid)) {
// ret = "Cowpea";
// } else if ("BN".equals(crid)) {
// ret = "Drybean";
// } else if ("FB".equals(crid)) {
// ret = "FabaBean";
// } else if ("FA".equals(crid)) {
// ret = "Fallow";
// } else if ("GB".equals(crid)) {
// ret = "GreenBean";
// } else if ("MZ".equals(crid)) {
// ret = "Maize";
// } else if ("ML".equals(crid)) {
// ret = "Millet";
// } else if ("PN".equals(crid)) {
// ret = "Peanut";
// } else if ("PR".equals(crid)) {
// ret = "Pepper";
// } else if ("PI".equals(crid)) {
// ret = "PineApple";
// } else if ("PT".equals(crid)) {
// ret = "Potato";
// } else if ("RI".equals(crid)) {
// ret = "Rice";
// } else if ("SG".equals(crid)) {
// ret = "Sorghum";
// } else if ("SB".equals(crid)) {
// ret = "Soybean";
// } else if ("SC".equals(crid)) {
// ret = "Sugarcane";
// } else if ("SU".equals(crid)) {
// ret = "Sunflower";
// } else if ("SW".equals(crid)) {
// ret = "SweetCorn";
// } else if ("TN".equals(crid)) {
// ret = "Tanier";
// } else if ("TR".equals(crid)) {
// ret = "Taro";
// } else if ("TM".equals(crid)) {
// ret = "Tomato";
// } else if ("VB".equals(crid)) {
// ret = "Velvetbean";
// } else if ("WH".equals(crid)) {
// ret = "Wheat";
// } else if ("SQ".equals(crid)) {
// ret = "Sequence";
// } else {
// ret = "Unkown";
// sbError.append("! Warning: Undefined crop id: [").append(crid).append("]\r\n");
// }
return ret;
} | java | private String getCropName(Map result) {
String ret;
String crid;
// Get crop id
crid = getCrid(result);
// Get crop name string
ret = LookupCodes.lookupCode("CRID", crid, "common", "DSSAT");
if (ret.equals(crid)) {
ret = "Unkown";
sbError.append("! Warning: Undefined crop id: [").append(crid).append("]\r\n");
}
// // Get crop name string
// if ("BH".equals(crid)) {
// ret = "Bahia";
// } else if ("BA".equals(crid)) {
// ret = "Barley";
// } else if ("BR".equals(crid)) {
// ret = "Brachiaria";
// } else if ("CB".equals(crid)) {
// ret = "Cabbage";
// } else if ("CS".equals(crid)) {
// ret = "Cassava";
// } else if ("CH".equals(crid)) {
// ret = "Chickpea";
// } else if ("CO".equals(crid)) {
// ret = "Cotton";
// } else if ("CP".equals(crid)) {
// ret = "Cowpea";
// } else if ("BN".equals(crid)) {
// ret = "Drybean";
// } else if ("FB".equals(crid)) {
// ret = "FabaBean";
// } else if ("FA".equals(crid)) {
// ret = "Fallow";
// } else if ("GB".equals(crid)) {
// ret = "GreenBean";
// } else if ("MZ".equals(crid)) {
// ret = "Maize";
// } else if ("ML".equals(crid)) {
// ret = "Millet";
// } else if ("PN".equals(crid)) {
// ret = "Peanut";
// } else if ("PR".equals(crid)) {
// ret = "Pepper";
// } else if ("PI".equals(crid)) {
// ret = "PineApple";
// } else if ("PT".equals(crid)) {
// ret = "Potato";
// } else if ("RI".equals(crid)) {
// ret = "Rice";
// } else if ("SG".equals(crid)) {
// ret = "Sorghum";
// } else if ("SB".equals(crid)) {
// ret = "Soybean";
// } else if ("SC".equals(crid)) {
// ret = "Sugarcane";
// } else if ("SU".equals(crid)) {
// ret = "Sunflower";
// } else if ("SW".equals(crid)) {
// ret = "SweetCorn";
// } else if ("TN".equals(crid)) {
// ret = "Tanier";
// } else if ("TR".equals(crid)) {
// ret = "Taro";
// } else if ("TM".equals(crid)) {
// ret = "Tomato";
// } else if ("VB".equals(crid)) {
// ret = "Velvetbean";
// } else if ("WH".equals(crid)) {
// ret = "Wheat";
// } else if ("SQ".equals(crid)) {
// ret = "Sequence";
// } else {
// ret = "Unkown";
// sbError.append("! Warning: Undefined crop id: [").append(crid).append("]\r\n");
// }
return ret;
} | [
"private",
"String",
"getCropName",
"(",
"Map",
"result",
")",
"{",
"String",
"ret",
";",
"String",
"crid",
";",
"// Get crop id",
"crid",
"=",
"getCrid",
"(",
"result",
")",
";",
"// Get crop name string",
"ret",
"=",
"LookupCodes",
".",
"lookupCode",
"(",
... | Get crop name string
@param result experiment data holder
@return the crop name | [
"Get",
"crop",
"name",
"string"
] | 4be61d998f106eb7234ea8701b63c3746ae688f4 | https://github.com/agmip/translator-dssat/blob/4be61d998f106eb7234ea8701b63c3746ae688f4/src/main/java/org/agmip/translators/dssat/DssatBatchFileOutput.java#L218-L298 | train |
BBN-E/bue-common-open | nlp-core-open/src/main/java/com/bbn/nlp/corenlp/CoreNLPConstituencyParse.java | CoreNLPConstituencyParse.smallestContainerForRange | private static <T extends Comparable<T>> Optional<Range<T>> smallestContainerForRange(
Collection<Range<T>> ranges, Range<T> target) {
Range<T> best = Range.all();
for (final Range<T> r : ranges) {
if (r.equals(target)) {
continue;
}
// prefer a smaller range, always;
if (r.encloses(target) && best.encloses(r)) {
best = r;
}
}
if (best.equals(Range.<T>all())) {
return Optional.absent();
}
return Optional.of(best);
} | java | private static <T extends Comparable<T>> Optional<Range<T>> smallestContainerForRange(
Collection<Range<T>> ranges, Range<T> target) {
Range<T> best = Range.all();
for (final Range<T> r : ranges) {
if (r.equals(target)) {
continue;
}
// prefer a smaller range, always;
if (r.encloses(target) && best.encloses(r)) {
best = r;
}
}
if (best.equals(Range.<T>all())) {
return Optional.absent();
}
return Optional.of(best);
} | [
"private",
"static",
"<",
"T",
"extends",
"Comparable",
"<",
"T",
">",
">",
"Optional",
"<",
"Range",
"<",
"T",
">",
">",
"smallestContainerForRange",
"(",
"Collection",
"<",
"Range",
"<",
"T",
">",
">",
"ranges",
",",
"Range",
"<",
"T",
">",
"target",... | Assuming our ranges look tree-structured, finds the "smallest" range for the particular target
one. | [
"Assuming",
"our",
"ranges",
"look",
"tree",
"-",
"structured",
"finds",
"the",
"smallest",
"range",
"for",
"the",
"particular",
"target",
"one",
"."
] | d618652674d647867306e2e4b987a21b7c29c015 | https://github.com/BBN-E/bue-common-open/blob/d618652674d647867306e2e4b987a21b7c29c015/nlp-core-open/src/main/java/com/bbn/nlp/corenlp/CoreNLPConstituencyParse.java#L213-L229 | train |
BBN-E/bue-common-open | common-core-open/src/main/java/com/bbn/bue/common/validators/And.java | And.validate | @Override
public void validate(T arg) throws ValidationException {
for (final Validator<T> validator : validators) {
validator.validate(arg);
}
} | java | @Override
public void validate(T arg) throws ValidationException {
for (final Validator<T> validator : validators) {
validator.validate(arg);
}
} | [
"@",
"Override",
"public",
"void",
"validate",
"(",
"T",
"arg",
")",
"throws",
"ValidationException",
"{",
"for",
"(",
"final",
"Validator",
"<",
"T",
">",
"validator",
":",
"validators",
")",
"{",
"validator",
".",
"validate",
"(",
"arg",
")",
";",
"}",... | Calls each of its child validators on the input, short-circuiting and propagating if one throws
an exception. | [
"Calls",
"each",
"of",
"its",
"child",
"validators",
"on",
"the",
"input",
"short",
"-",
"circuiting",
"and",
"propagating",
"if",
"one",
"throws",
"an",
"exception",
"."
] | d618652674d647867306e2e4b987a21b7c29c015 | https://github.com/BBN-E/bue-common-open/blob/d618652674d647867306e2e4b987a21b7c29c015/common-core-open/src/main/java/com/bbn/bue/common/validators/And.java#L22-L27 | train |
killme2008/hs4j | src/main/java/com/google/code/hs4j/impl/HSClientImpl.java | HSClientImpl.setSocketOption | public <T> void setSocketOption(SocketOption<T> socketOption, T value) {
this.socketOptions.put(socketOption, value);
} | java | public <T> void setSocketOption(SocketOption<T> socketOption, T value) {
this.socketOptions.put(socketOption, value);
} | [
"public",
"<",
"T",
">",
"void",
"setSocketOption",
"(",
"SocketOption",
"<",
"T",
">",
"socketOption",
",",
"T",
"value",
")",
"{",
"this",
".",
"socketOptions",
".",
"put",
"(",
"socketOption",
",",
"value",
")",
";",
"}"
] | Set tcp socket option
@param socketOption
@param value | [
"Set",
"tcp",
"socket",
"option"
] | 805fe14bfe270d95009514c224d93c5fe3575f11 | https://github.com/killme2008/hs4j/blob/805fe14bfe270d95009514c224d93c5fe3575f11/src/main/java/com/google/code/hs4j/impl/HSClientImpl.java#L531-L533 | train |
gallandarakhneorg/afc | core/maths/mathgeom/tobeincluded/src/d3/continuous/OrientedBox3d.java | OrientedBox3d.setCenterProperties | public void setCenterProperties(Point3d center1) {
this.center.setProperties(center1.xProperty, center1.yProperty, center1.zProperty);
} | java | public void setCenterProperties(Point3d center1) {
this.center.setProperties(center1.xProperty, center1.yProperty, center1.zProperty);
} | [
"public",
"void",
"setCenterProperties",
"(",
"Point3d",
"center1",
")",
"{",
"this",
".",
"center",
".",
"setProperties",
"(",
"center1",
".",
"xProperty",
",",
"center1",
".",
"yProperty",
",",
"center1",
".",
"zProperty",
")",
";",
"}"
] | Set the center property.
@param center1 | [
"Set",
"the",
"center",
"property",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/maths/mathgeom/tobeincluded/src/d3/continuous/OrientedBox3d.java#L282-L284 | train |
lightblueseas/swing-components | src/main/java/de/alpharogroup/behaviors/EnableButtonBehavior.java | EnableButtonBehavior.onChange | protected void onChange()
{
enabled = false;
if (getDocument().getLength() > 0)
{
enabled = true;
}
buttonModel.setEnabled(enabled);
} | java | protected void onChange()
{
enabled = false;
if (getDocument().getLength() > 0)
{
enabled = true;
}
buttonModel.setEnabled(enabled);
} | [
"protected",
"void",
"onChange",
"(",
")",
"{",
"enabled",
"=",
"false",
";",
"if",
"(",
"getDocument",
"(",
")",
".",
"getLength",
"(",
")",
">",
"0",
")",
"{",
"enabled",
"=",
"true",
";",
"}",
"buttonModel",
".",
"setEnabled",
"(",
"enabled",
")",... | Callback method that can be overwritten to provide specific action on change of document. | [
"Callback",
"method",
"that",
"can",
"be",
"overwritten",
"to",
"provide",
"specific",
"action",
"on",
"change",
"of",
"document",
"."
] | 4045e85cabd8f0ce985cbfff134c3c9873930c79 | https://github.com/lightblueseas/swing-components/blob/4045e85cabd8f0ce985cbfff134c3c9873930c79/src/main/java/de/alpharogroup/behaviors/EnableButtonBehavior.java#L102-L110 | train |
dbflute-session/tomcat-boot | src/main/java/org/dbflute/tomcat/core/RhythmicalTomcat.java | RhythmicalTomcat.addWebapp | @Override
public Context addWebapp(Host host, String contextPath, String docBase) {
final ContextConfig contextConfig = createContextConfig(); // *extension point
return addWebapp(host, contextPath, docBase, contextConfig);
} | java | @Override
public Context addWebapp(Host host, String contextPath, String docBase) {
final ContextConfig contextConfig = createContextConfig(); // *extension point
return addWebapp(host, contextPath, docBase, contextConfig);
} | [
"@",
"Override",
"public",
"Context",
"addWebapp",
"(",
"Host",
"host",
",",
"String",
"contextPath",
",",
"String",
"docBase",
")",
"{",
"final",
"ContextConfig",
"contextConfig",
"=",
"createContextConfig",
"(",
")",
";",
"// *extension point",
"return",
"addWeb... | copied from super Tomcat because of private methods | [
"copied",
"from",
"super",
"Tomcat",
"because",
"of",
"private",
"methods"
] | fe941f88b6be083781873126f5b12d4c16bb9073 | https://github.com/dbflute-session/tomcat-boot/blob/fe941f88b6be083781873126f5b12d4c16bb9073/src/main/java/org/dbflute/tomcat/core/RhythmicalTomcat.java#L86-L90 | train |
gallandarakhneorg/afc | advanced/attributes/src/main/java/org/arakhne/afc/attrs/collection/MultiAttributeCollection.java | MultiAttributeCollection.fireAttributeChange | protected void fireAttributeChange(AttributeChangeEvent event) {
if (this.listeners != null && isEventFirable()) {
final AttributeChangeListener[] list = new AttributeChangeListener[this.listeners.size()];
this.listeners.toArray(list);
for (final AttributeChangeListener listener : list) {
listener.onAttributeChangeEvent(event);
}
}
} | java | protected void fireAttributeChange(AttributeChangeEvent event) {
if (this.listeners != null && isEventFirable()) {
final AttributeChangeListener[] list = new AttributeChangeListener[this.listeners.size()];
this.listeners.toArray(list);
for (final AttributeChangeListener listener : list) {
listener.onAttributeChangeEvent(event);
}
}
} | [
"protected",
"void",
"fireAttributeChange",
"(",
"AttributeChangeEvent",
"event",
")",
"{",
"if",
"(",
"this",
".",
"listeners",
"!=",
"null",
"&&",
"isEventFirable",
"(",
")",
")",
"{",
"final",
"AttributeChangeListener",
"[",
"]",
"list",
"=",
"new",
"Attrib... | Notifies the listeners about the change of an attribute.
@param event the event. | [
"Notifies",
"the",
"listeners",
"about",
"the",
"change",
"of",
"an",
"attribute",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/attributes/src/main/java/org/arakhne/afc/attrs/collection/MultiAttributeCollection.java#L159-L167 | train |
gallandarakhneorg/afc | core/references/src/main/java/org/arakhne/afc/references/WeakArrayList.java | WeakArrayList.maskNull | @SuppressWarnings("unchecked")
private static <T> T maskNull(T value) {
return (value == null) ? (T) NULL_VALUE : value;
} | java | @SuppressWarnings("unchecked")
private static <T> T maskNull(T value) {
return (value == null) ? (T) NULL_VALUE : value;
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"private",
"static",
"<",
"T",
">",
"T",
"maskNull",
"(",
"T",
"value",
")",
"{",
"return",
"(",
"value",
"==",
"null",
")",
"?",
"(",
"T",
")",
"NULL_VALUE",
":",
"value",
";",
"}"
] | Replies the null value given by the user by the corresponding null object. | [
"Replies",
"the",
"null",
"value",
"given",
"by",
"the",
"user",
"by",
"the",
"corresponding",
"null",
"object",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/references/src/main/java/org/arakhne/afc/references/WeakArrayList.java#L134-L137 | train |
gallandarakhneorg/afc | core/references/src/main/java/org/arakhne/afc/references/WeakArrayList.java | WeakArrayList.assertRange | protected void assertRange(int index, boolean allowLast) {
final int csize = expurge();
if (index < 0) {
throw new IndexOutOfBoundsException(Locale.getString("E1", index)); //$NON-NLS-1$
}
if (allowLast && (index > csize)) {
throw new IndexOutOfBoundsException(Locale.getString("E2", csize, index)); //$NON-NLS-1$
}
if (!allowLast && (index >= csize)) {
throw new IndexOutOfBoundsException(Locale.getString("E3", csize, index)); //$NON-NLS-1$
}
} | java | protected void assertRange(int index, boolean allowLast) {
final int csize = expurge();
if (index < 0) {
throw new IndexOutOfBoundsException(Locale.getString("E1", index)); //$NON-NLS-1$
}
if (allowLast && (index > csize)) {
throw new IndexOutOfBoundsException(Locale.getString("E2", csize, index)); //$NON-NLS-1$
}
if (!allowLast && (index >= csize)) {
throw new IndexOutOfBoundsException(Locale.getString("E3", csize, index)); //$NON-NLS-1$
}
} | [
"protected",
"void",
"assertRange",
"(",
"int",
"index",
",",
"boolean",
"allowLast",
")",
"{",
"final",
"int",
"csize",
"=",
"expurge",
"(",
")",
";",
"if",
"(",
"index",
"<",
"0",
")",
"{",
"throw",
"new",
"IndexOutOfBoundsException",
"(",
"Locale",
".... | Verify if the specified index is inside the array.
@param index is the index totest
@param allowLast indicates if the last elements is assumed to be valid or not. | [
"Verify",
"if",
"the",
"specified",
"index",
"is",
"inside",
"the",
"array",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/references/src/main/java/org/arakhne/afc/references/WeakArrayList.java#L271-L282 | train |
gallandarakhneorg/afc | core/references/src/main/java/org/arakhne/afc/references/WeakArrayList.java | WeakArrayList.addReferenceListener | public void addReferenceListener(ReferenceListener listener) {
if (this.listeners == null) {
this.listeners = new LinkedList<>();
}
final List<ReferenceListener> list = this.listeners;
synchronized (list) {
list.add(listener);
}
} | java | public void addReferenceListener(ReferenceListener listener) {
if (this.listeners == null) {
this.listeners = new LinkedList<>();
}
final List<ReferenceListener> list = this.listeners;
synchronized (list) {
list.add(listener);
}
} | [
"public",
"void",
"addReferenceListener",
"(",
"ReferenceListener",
"listener",
")",
"{",
"if",
"(",
"this",
".",
"listeners",
"==",
"null",
")",
"{",
"this",
".",
"listeners",
"=",
"new",
"LinkedList",
"<>",
"(",
")",
";",
"}",
"final",
"List",
"<",
"Re... | Add listener on reference's release.
@param listener the listener. | [
"Add",
"listener",
"on",
"reference",
"s",
"release",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/references/src/main/java/org/arakhne/afc/references/WeakArrayList.java#L353-L361 | train |
gallandarakhneorg/afc | core/references/src/main/java/org/arakhne/afc/references/WeakArrayList.java | WeakArrayList.removeReferenceListener | public void removeReferenceListener(ReferenceListener listener) {
final List<ReferenceListener> list = this.listeners;
if (list != null) {
synchronized (list) {
list.remove(listener);
if (list.isEmpty()) {
this.listeners = null;
}
}
}
} | java | public void removeReferenceListener(ReferenceListener listener) {
final List<ReferenceListener> list = this.listeners;
if (list != null) {
synchronized (list) {
list.remove(listener);
if (list.isEmpty()) {
this.listeners = null;
}
}
}
} | [
"public",
"void",
"removeReferenceListener",
"(",
"ReferenceListener",
"listener",
")",
"{",
"final",
"List",
"<",
"ReferenceListener",
">",
"list",
"=",
"this",
".",
"listeners",
";",
"if",
"(",
"list",
"!=",
"null",
")",
"{",
"synchronized",
"(",
"list",
"... | Remove listener on reference's release.
@param listener the listener. | [
"Remove",
"listener",
"on",
"reference",
"s",
"release",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/references/src/main/java/org/arakhne/afc/references/WeakArrayList.java#L367-L377 | train |
gallandarakhneorg/afc | core/references/src/main/java/org/arakhne/afc/references/WeakArrayList.java | WeakArrayList.fireReferenceRelease | protected void fireReferenceRelease(int released) {
final List<ReferenceListener> list = this.listeners;
if (list != null && !list.isEmpty()) {
for (final ReferenceListener listener : list) {
listener.referenceReleased(released);
}
}
} | java | protected void fireReferenceRelease(int released) {
final List<ReferenceListener> list = this.listeners;
if (list != null && !list.isEmpty()) {
for (final ReferenceListener listener : list) {
listener.referenceReleased(released);
}
}
} | [
"protected",
"void",
"fireReferenceRelease",
"(",
"int",
"released",
")",
"{",
"final",
"List",
"<",
"ReferenceListener",
">",
"list",
"=",
"this",
".",
"listeners",
";",
"if",
"(",
"list",
"!=",
"null",
"&&",
"!",
"list",
".",
"isEmpty",
"(",
")",
")",
... | Fire the reference release event.
@param released is the count of released objects. | [
"Fire",
"the",
"reference",
"release",
"event",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/references/src/main/java/org/arakhne/afc/references/WeakArrayList.java#L384-L391 | train |
gallandarakhneorg/afc | core/maths/mathgraph/src/main/java/org/arakhne/afc/math/graph/GraphPath.java | GraphPath.getStartingPointFor | @Pure
@SuppressWarnings("checkstyle:cyclomaticcomplexity")
public PT getStartingPointFor(int index) {
if ((index < 1) || (this.segmentList.size() <= 1)) {
if (this.startingPoint != null) {
return this.startingPoint;
}
} else {
int idx = index;
ST currentSegment = this.segmentList.get(idx);
ST previousSegment = this.segmentList.get(--idx);
// Because the two segments are the same
// we must go deeper in the path elements
// to detect the right segment
int count = 0;
while ((previousSegment != null) && (previousSegment.equals(currentSegment))) {
currentSegment = previousSegment;
idx--;
previousSegment = (idx >= 0) ? this.segmentList.get(idx) : null;
count++;
}
if (count > 0) {
PT sp = null;
if (previousSegment != null) {
final PT p1 = currentSegment.getBeginPoint();
final PT p2 = currentSegment.getEndPoint();
final PT p3 = previousSegment.getBeginPoint();
final PT p4 = previousSegment.getEndPoint();
assert p1 != null && p2 != null && p3 != null && p4 != null;
if (p1.equals(p3) || p1.equals(p4)) {
sp = p1;
} else if (p2.equals(p3) || p2.equals(p4)) {
sp = p2;
}
} else {
sp = this.startingPoint;
}
if (sp != null) {
return ((count % 2) == 0) ? sp : currentSegment.getOtherSidePoint(sp);
}
} else if ((currentSegment != null) && (previousSegment != null)) {
// if the two segments are different
// it is simple to detect the
// common point
final PT p1 = currentSegment.getBeginPoint();
final PT p2 = currentSegment.getEndPoint();
final PT p3 = previousSegment.getBeginPoint();
final PT p4 = previousSegment.getEndPoint();
assert p1 != null && p2 != null && p3 != null && p4 != null;
if (p1.equals(p3) || p1.equals(p4)) {
return p1;
}
if (p2.equals(p3) || p2.equals(p4)) {
return p2;
}
}
}
return null;
} | java | @Pure
@SuppressWarnings("checkstyle:cyclomaticcomplexity")
public PT getStartingPointFor(int index) {
if ((index < 1) || (this.segmentList.size() <= 1)) {
if (this.startingPoint != null) {
return this.startingPoint;
}
} else {
int idx = index;
ST currentSegment = this.segmentList.get(idx);
ST previousSegment = this.segmentList.get(--idx);
// Because the two segments are the same
// we must go deeper in the path elements
// to detect the right segment
int count = 0;
while ((previousSegment != null) && (previousSegment.equals(currentSegment))) {
currentSegment = previousSegment;
idx--;
previousSegment = (idx >= 0) ? this.segmentList.get(idx) : null;
count++;
}
if (count > 0) {
PT sp = null;
if (previousSegment != null) {
final PT p1 = currentSegment.getBeginPoint();
final PT p2 = currentSegment.getEndPoint();
final PT p3 = previousSegment.getBeginPoint();
final PT p4 = previousSegment.getEndPoint();
assert p1 != null && p2 != null && p3 != null && p4 != null;
if (p1.equals(p3) || p1.equals(p4)) {
sp = p1;
} else if (p2.equals(p3) || p2.equals(p4)) {
sp = p2;
}
} else {
sp = this.startingPoint;
}
if (sp != null) {
return ((count % 2) == 0) ? sp : currentSegment.getOtherSidePoint(sp);
}
} else if ((currentSegment != null) && (previousSegment != null)) {
// if the two segments are different
// it is simple to detect the
// common point
final PT p1 = currentSegment.getBeginPoint();
final PT p2 = currentSegment.getEndPoint();
final PT p3 = previousSegment.getBeginPoint();
final PT p4 = previousSegment.getEndPoint();
assert p1 != null && p2 != null && p3 != null && p4 != null;
if (p1.equals(p3) || p1.equals(p4)) {
return p1;
}
if (p2.equals(p3) || p2.equals(p4)) {
return p2;
}
}
}
return null;
} | [
"@",
"Pure",
"@",
"SuppressWarnings",
"(",
"\"checkstyle:cyclomaticcomplexity\"",
")",
"public",
"PT",
"getStartingPointFor",
"(",
"int",
"index",
")",
"{",
"if",
"(",
"(",
"index",
"<",
"1",
")",
"||",
"(",
"this",
".",
"segmentList",
".",
"size",
"(",
")... | Replies the starting point for the segment at the given index.
@param index is the index of the segment.
@return the starting point for the segment at the given index. | [
"Replies",
"the",
"starting",
"point",
"for",
"the",
"segment",
"at",
"the",
"given",
"index",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/maths/mathgraph/src/main/java/org/arakhne/afc/math/graph/GraphPath.java#L362-L427 | train |
gallandarakhneorg/afc | core/maths/mathgraph/src/main/java/org/arakhne/afc/math/graph/GraphPath.java | GraphPath.removeUntil | boolean removeUntil(int index, boolean inclusive) {
if (index >= 0) {
boolean changed = false;
PT startPoint = this.startingPoint;
ST segment;
int limit = index;
if (inclusive) {
++limit;
}
for (int i = 0; i < limit; ++i) {
segment = this.segmentList.remove(0);
this.length -= segment.getLength();
if (this.length < 0) {
this.length = 0;
}
startPoint = segment.getOtherSidePoint(startPoint);
changed = true;
}
if (changed) {
if (this.segmentList.isEmpty()) {
this.startingPoint = null;
this.endingPoint = null;
this.isReversable = true;
} else {
this.startingPoint = startPoint;
}
return true;
}
}
return false;
} | java | boolean removeUntil(int index, boolean inclusive) {
if (index >= 0) {
boolean changed = false;
PT startPoint = this.startingPoint;
ST segment;
int limit = index;
if (inclusive) {
++limit;
}
for (int i = 0; i < limit; ++i) {
segment = this.segmentList.remove(0);
this.length -= segment.getLength();
if (this.length < 0) {
this.length = 0;
}
startPoint = segment.getOtherSidePoint(startPoint);
changed = true;
}
if (changed) {
if (this.segmentList.isEmpty()) {
this.startingPoint = null;
this.endingPoint = null;
this.isReversable = true;
} else {
this.startingPoint = startPoint;
}
return true;
}
}
return false;
} | [
"boolean",
"removeUntil",
"(",
"int",
"index",
",",
"boolean",
"inclusive",
")",
"{",
"if",
"(",
"index",
">=",
"0",
")",
"{",
"boolean",
"changed",
"=",
"false",
";",
"PT",
"startPoint",
"=",
"this",
".",
"startingPoint",
";",
"ST",
"segment",
";",
"i... | Package access to avoid compilation error.
You must not call this function directly.
@param index the reference index.
@param inclusive indicates if the element at the reference index is included in the removed elements.
@return <code>true</code> or <code>false</code> | [
"Package",
"access",
"to",
"avoid",
"compilation",
"error",
".",
"You",
"must",
"not",
"call",
"this",
"function",
"directly",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/maths/mathgraph/src/main/java/org/arakhne/afc/math/graph/GraphPath.java#L566-L596 | train |
gallandarakhneorg/afc | core/maths/mathgraph/src/main/java/org/arakhne/afc/math/graph/GraphPath.java | GraphPath.invert | public void invert() {
final PT p = this.startingPoint;
this.startingPoint = this.endingPoint;
this.endingPoint = p;
final int middle = this.segmentList.size() / 2;
ST segment;
for (int i = 0, j = this.segmentList.size() - 1; i < middle; ++i, --j) {
segment = this.segmentList.get(i);
this.segmentList.set(i, this.segmentList.get(j));
this.segmentList.set(j, segment);
}
} | java | public void invert() {
final PT p = this.startingPoint;
this.startingPoint = this.endingPoint;
this.endingPoint = p;
final int middle = this.segmentList.size() / 2;
ST segment;
for (int i = 0, j = this.segmentList.size() - 1; i < middle; ++i, --j) {
segment = this.segmentList.get(i);
this.segmentList.set(i, this.segmentList.get(j));
this.segmentList.set(j, segment);
}
} | [
"public",
"void",
"invert",
"(",
")",
"{",
"final",
"PT",
"p",
"=",
"this",
".",
"startingPoint",
";",
"this",
".",
"startingPoint",
"=",
"this",
".",
"endingPoint",
";",
"this",
".",
"endingPoint",
"=",
"p",
";",
"final",
"int",
"middle",
"=",
"this",... | Revert the order of the graph segment in this path. | [
"Revert",
"the",
"order",
"of",
"the",
"graph",
"segment",
"in",
"this",
"path",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/maths/mathgraph/src/main/java/org/arakhne/afc/math/graph/GraphPath.java#L1065-L1076 | train |
gallandarakhneorg/afc | core/maths/mathgraph/src/main/java/org/arakhne/afc/math/graph/GraphPath.java | GraphPath.splitAt | public GP splitAt(ST obj, PT startPoint) {
return splitAt(indexOf(obj, startPoint), true);
} | java | public GP splitAt(ST obj, PT startPoint) {
return splitAt(indexOf(obj, startPoint), true);
} | [
"public",
"GP",
"splitAt",
"(",
"ST",
"obj",
",",
"PT",
"startPoint",
")",
"{",
"return",
"splitAt",
"(",
"indexOf",
"(",
"obj",
",",
"startPoint",
")",
",",
"true",
")",
";",
"}"
] | Split this path and retains the first part of the
part in this object and reply the second part.
The first occurrence of this specified element
will be in the second part.
<p>This function removes until the <i>last occurence</i>
of the given object.
@param obj the reference segment.
@param startPoint is the starting point of the searched segment.
@return the rest of the path after the first occurence of the given element. | [
"Split",
"this",
"path",
"and",
"retains",
"the",
"first",
"part",
"of",
"the",
"part",
"in",
"this",
"object",
"and",
"reply",
"the",
"second",
"part",
".",
"The",
"first",
"occurrence",
"of",
"this",
"specified",
"element",
"will",
"be",
"in",
"the",
"... | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/maths/mathgraph/src/main/java/org/arakhne/afc/math/graph/GraphPath.java#L1130-L1132 | train |
gallandarakhneorg/afc | core/maths/mathgraph/src/main/java/org/arakhne/afc/math/graph/GraphPath.java | GraphPath.splitAfterLast | public GP splitAfterLast(ST obj, PT startPoint) {
return splitAt(lastIndexOf(obj, startPoint), false);
} | java | public GP splitAfterLast(ST obj, PT startPoint) {
return splitAt(lastIndexOf(obj, startPoint), false);
} | [
"public",
"GP",
"splitAfterLast",
"(",
"ST",
"obj",
",",
"PT",
"startPoint",
")",
"{",
"return",
"splitAt",
"(",
"lastIndexOf",
"(",
"obj",
",",
"startPoint",
")",
",",
"false",
")",
";",
"}"
] | Split this path and retains the first part of the
part in this object and reply the second part.
The last occurence of the specified element
will be in the first part.
<p>This function removes until the <i>last occurence</i>
of the given object.
@param obj is the segment to search for.
@param startPoint is the starting point of the searched segment.
@return the rest of the path after the last occurence of the given element. | [
"Split",
"this",
"path",
"and",
"retains",
"the",
"first",
"part",
"of",
"the",
"part",
"in",
"this",
"object",
"and",
"reply",
"the",
"second",
"part",
".",
"The",
"last",
"occurence",
"of",
"the",
"specified",
"element",
"will",
"be",
"in",
"the",
"fir... | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/maths/mathgraph/src/main/java/org/arakhne/afc/math/graph/GraphPath.java#L1172-L1174 | train |
gallandarakhneorg/afc | core/maths/mathgraph/src/main/java/org/arakhne/afc/math/graph/GraphPath.java | GraphPath.splitAtLast | public GP splitAtLast(ST obj, PT startPoint) {
return splitAt(lastIndexOf(obj, startPoint), true);
} | java | public GP splitAtLast(ST obj, PT startPoint) {
return splitAt(lastIndexOf(obj, startPoint), true);
} | [
"public",
"GP",
"splitAtLast",
"(",
"ST",
"obj",
",",
"PT",
"startPoint",
")",
"{",
"return",
"splitAt",
"(",
"lastIndexOf",
"(",
"obj",
",",
"startPoint",
")",
",",
"true",
")",
";",
"}"
] | Split this path and retains the first part of the
part in this object and reply the second part.
The last occurence of the specified element
will be in the second part.
<p>This function removes until the <i>last occurence</i>
of the given object.
@param obj the reference segment.
@param startPoint is the starting point of the searched segment.
@return the rest of the path after the last occurence of the given element. | [
"Split",
"this",
"path",
"and",
"retains",
"the",
"first",
"part",
"of",
"the",
"part",
"in",
"this",
"object",
"and",
"reply",
"the",
"second",
"part",
".",
"The",
"last",
"occurence",
"of",
"the",
"specified",
"element",
"will",
"be",
"in",
"the",
"sec... | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/maths/mathgraph/src/main/java/org/arakhne/afc/math/graph/GraphPath.java#L1188-L1190 | train |
gallandarakhneorg/afc | core/maths/mathgraph/src/main/java/org/arakhne/afc/math/graph/GraphPath.java | GraphPath.splitAfter | public GP splitAfter(ST obj, PT startPoint) {
return splitAt(indexOf(obj, startPoint), false);
} | java | public GP splitAfter(ST obj, PT startPoint) {
return splitAt(indexOf(obj, startPoint), false);
} | [
"public",
"GP",
"splitAfter",
"(",
"ST",
"obj",
",",
"PT",
"startPoint",
")",
"{",
"return",
"splitAt",
"(",
"indexOf",
"(",
"obj",
",",
"startPoint",
")",
",",
"false",
")",
";",
"}"
] | Split this path and retains the first part of the
part in this object and reply the second part.
The first occurrence of specified element will be
in the first part.
<p>This function removes until the <i>last occurence</i>
of the given object.
@param obj the reference segment.
@param startPoint is the starting point of the searched segment.
@return the rest of the path after the first occurence of the given element. | [
"Split",
"this",
"path",
"and",
"retains",
"the",
"first",
"part",
"of",
"the",
"part",
"in",
"this",
"object",
"and",
"reply",
"the",
"second",
"part",
".",
"The",
"first",
"occurrence",
"of",
"specified",
"element",
"will",
"be",
"in",
"the",
"first",
... | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/maths/mathgraph/src/main/java/org/arakhne/afc/math/graph/GraphPath.java#L1234-L1236 | train |
gallandarakhneorg/afc | core/maths/mathgeom/tobeincluded/src/d3/continuous/AbstractPlane4F.java | AbstractPlane4F.transform | public void transform(Transform3D transform, Point3D pivot) {
Point3D refPoint = (pivot == null) ? getPivot() : pivot;
Vector3f v = new Vector3f(this.getEquationComponentA(),this.getEquationComponentB(),this.getEquationComponentC());
transform.transform(v);
// Update the plane equation according
// to the desired normal (computed from
// the identity vector and the rotations).
// a.x + b.y + c.z + d = 0
// where (x,y,z) is the translation point
this.set(v.getX(),v.getY(),v.getZ(),- (this.getEquationComponentA()*(refPoint.getX()+transform.m03) +
this.getEquationComponentB()*(refPoint.getY()+transform.m13) +
this.getEquationComponentC()*(refPoint.getZ()+transform.m23)));
clearBufferedValues();
} | java | public void transform(Transform3D transform, Point3D pivot) {
Point3D refPoint = (pivot == null) ? getPivot() : pivot;
Vector3f v = new Vector3f(this.getEquationComponentA(),this.getEquationComponentB(),this.getEquationComponentC());
transform.transform(v);
// Update the plane equation according
// to the desired normal (computed from
// the identity vector and the rotations).
// a.x + b.y + c.z + d = 0
// where (x,y,z) is the translation point
this.set(v.getX(),v.getY(),v.getZ(),- (this.getEquationComponentA()*(refPoint.getX()+transform.m03) +
this.getEquationComponentB()*(refPoint.getY()+transform.m13) +
this.getEquationComponentC()*(refPoint.getZ()+transform.m23)));
clearBufferedValues();
} | [
"public",
"void",
"transform",
"(",
"Transform3D",
"transform",
",",
"Point3D",
"pivot",
")",
"{",
"Point3D",
"refPoint",
"=",
"(",
"pivot",
"==",
"null",
")",
"?",
"getPivot",
"(",
")",
":",
"pivot",
";",
"Vector3f",
"v",
"=",
"new",
"Vector3f",
"(",
... | Apply the given transformation matrix on the plane.
@param transform the transformation matrix.
@param pivot the pivot point. | [
"Apply",
"the",
"given",
"transformation",
"matrix",
"on",
"the",
"plane",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/maths/mathgeom/tobeincluded/src/d3/continuous/AbstractPlane4F.java#L515-L533 | train |
gallandarakhneorg/afc | core/maths/mathgeom/tobeincluded/src/d3/continuous/AbstractPlane4F.java | AbstractPlane4F.translate | public void translate(double dx, double dy, double dz) {
// Compute the reference point for the plane
// (usefull for translation)
Point3f refPoint = (Point3f) getPivot();
// a.x + b.y + c.z + d = 0
// where (x,y,z) is the translation point
setPivot(refPoint.getX()+dx,refPoint.getY()+dy,refPoint.getZ()+dz);
} | java | public void translate(double dx, double dy, double dz) {
// Compute the reference point for the plane
// (usefull for translation)
Point3f refPoint = (Point3f) getPivot();
// a.x + b.y + c.z + d = 0
// where (x,y,z) is the translation point
setPivot(refPoint.getX()+dx,refPoint.getY()+dy,refPoint.getZ()+dz);
} | [
"public",
"void",
"translate",
"(",
"double",
"dx",
",",
"double",
"dy",
",",
"double",
"dz",
")",
"{",
"// Compute the reference point for the plane",
"// (usefull for translation)",
"Point3f",
"refPoint",
"=",
"(",
"Point3f",
")",
"getPivot",
"(",
")",
";",
"// ... | Translate the pivot point of the plane.
@param dx the translation to apply.
@param dy the translation to apply.
@param dz the translation to apply. | [
"Translate",
"the",
"pivot",
"point",
"of",
"the",
"plane",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/maths/mathgeom/tobeincluded/src/d3/continuous/AbstractPlane4F.java#L549-L557 | train |
gallandarakhneorg/afc | core/maths/mathgeom/tobeincluded/src/d3/continuous/AbstractPlane4F.java | AbstractPlane4F.rotate | public void rotate(Quaternion rotation, Point3D pivot) {
Point3D currentPivot = getPivot();
// Update the plane equation according
// to the desired normal (computed from
// the identity vector and the rotations).
Transform3D m = new Transform3D();
m.setRotation(rotation);
Vector3f v = new Vector3f(this.getEquationComponentA(),this.getEquationComponentB(),this.getEquationComponentC());
m.transform(v);
this.setEquationComponentA(v.getX());
this.setEquationComponentB(v.getY());
this.setEquationComponentC(v.getZ());
if (pivot==null) {
// a.x + b.y + c.z + d = 0
// where (x,y,z) is the translation point
this.setEquationComponentD( - (this.getEquationComponentA()*currentPivot.getX() +
this.getEquationComponentB()*currentPivot.getY() +
this.getEquationComponentC()*currentPivot.getZ()));
}
else {
// Compute the new point
Point3f nP = new Point3f(
currentPivot.getX() - pivot.getX(),
currentPivot.getY() - pivot.getY(),
currentPivot.getZ() - pivot.getZ());
m.transform(nP);
nP.setX(nP.getX() + pivot.getX());
nP.setY(nP.getY() + pivot.getY());
nP.setZ(nP.getZ() + pivot.getZ());
// a.x + b.y + c.z + d = 0
// where (x,y,z) is the translation point
this.setEquationComponentD( - (this.getEquationComponentA()*nP.getX() +
this.getEquationComponentB()*nP.getY() +
this.getEquationComponentC()*nP.getZ()));
}
clearBufferedValues();
} | java | public void rotate(Quaternion rotation, Point3D pivot) {
Point3D currentPivot = getPivot();
// Update the plane equation according
// to the desired normal (computed from
// the identity vector and the rotations).
Transform3D m = new Transform3D();
m.setRotation(rotation);
Vector3f v = new Vector3f(this.getEquationComponentA(),this.getEquationComponentB(),this.getEquationComponentC());
m.transform(v);
this.setEquationComponentA(v.getX());
this.setEquationComponentB(v.getY());
this.setEquationComponentC(v.getZ());
if (pivot==null) {
// a.x + b.y + c.z + d = 0
// where (x,y,z) is the translation point
this.setEquationComponentD( - (this.getEquationComponentA()*currentPivot.getX() +
this.getEquationComponentB()*currentPivot.getY() +
this.getEquationComponentC()*currentPivot.getZ()));
}
else {
// Compute the new point
Point3f nP = new Point3f(
currentPivot.getX() - pivot.getX(),
currentPivot.getY() - pivot.getY(),
currentPivot.getZ() - pivot.getZ());
m.transform(nP);
nP.setX(nP.getX() + pivot.getX());
nP.setY(nP.getY() + pivot.getY());
nP.setZ(nP.getZ() + pivot.getZ());
// a.x + b.y + c.z + d = 0
// where (x,y,z) is the translation point
this.setEquationComponentD( - (this.getEquationComponentA()*nP.getX() +
this.getEquationComponentB()*nP.getY() +
this.getEquationComponentC()*nP.getZ()));
}
clearBufferedValues();
} | [
"public",
"void",
"rotate",
"(",
"Quaternion",
"rotation",
",",
"Point3D",
"pivot",
")",
"{",
"Point3D",
"currentPivot",
"=",
"getPivot",
"(",
")",
";",
"// Update the plane equation according",
"// to the desired normal (computed from",
"// the identity vector and the rotati... | Rotate the plane around the given pivot point.
@param rotation the rotation to apply.
@param pivot the pivot point. | [
"Rotate",
"the",
"plane",
"around",
"the",
"given",
"pivot",
"point",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/maths/mathgeom/tobeincluded/src/d3/continuous/AbstractPlane4F.java#L572-L611 | train |
BBN-E/bue-common-open | common-core-open/src/main/java/com/bbn/bue/common/math/ProbabilityUtils.java | ProbabilityUtils.cleanProbability | public static double cleanProbability(double prob, double epsilon, boolean allowOne) {
if (prob < -epsilon || prob > (1.0 + epsilon)) {
throw new InvalidProbabilityException(prob);
}
if (prob < epsilon) {
prob = epsilon;
} else {
final double limit = allowOne ? 1.0 : (1.0 - epsilon);
if (prob > limit) {
prob = limit;
}
}
return prob;
} | java | public static double cleanProbability(double prob, double epsilon, boolean allowOne) {
if (prob < -epsilon || prob > (1.0 + epsilon)) {
throw new InvalidProbabilityException(prob);
}
if (prob < epsilon) {
prob = epsilon;
} else {
final double limit = allowOne ? 1.0 : (1.0 - epsilon);
if (prob > limit) {
prob = limit;
}
}
return prob;
} | [
"public",
"static",
"double",
"cleanProbability",
"(",
"double",
"prob",
",",
"double",
"epsilon",
",",
"boolean",
"allowOne",
")",
"{",
"if",
"(",
"prob",
"<",
"-",
"epsilon",
"||",
"prob",
">",
"(",
"1.0",
"+",
"epsilon",
")",
")",
"{",
"throw",
"new... | Cleans up input which should be probabilities. Occasionally due to numerical stability issues
you get input which should be a probability but could actually be very slightly less than 0 or
more than 1.0. This function will take values within epsilon of being good probabilities and
fix them. If the prob is within epsilon of zero, it is changed to +epsilon. One the upper end,
if allowOne is true, anything between 1.0 and 1.0 + epsilon is mapped to 1.0. If allowOne is
false, anything between 1.0-epsilon and 1.0 + epsilon is mapped to 1.0-epsilon. All other
probability values throw an unchecked InvalidProbabilityException. | [
"Cleans",
"up",
"input",
"which",
"should",
"be",
"probabilities",
".",
"Occasionally",
"due",
"to",
"numerical",
"stability",
"issues",
"you",
"get",
"input",
"which",
"should",
"be",
"a",
"probability",
"but",
"could",
"actually",
"be",
"very",
"slightly",
"... | d618652674d647867306e2e4b987a21b7c29c015 | https://github.com/BBN-E/bue-common-open/blob/d618652674d647867306e2e4b987a21b7c29c015/common-core-open/src/main/java/com/bbn/bue/common/math/ProbabilityUtils.java#L35-L50 | train |
gallandarakhneorg/afc | core/maths/mathgeom/tobeincluded/src/d3/continuous/Path3d.java | Path3d.propertyArraysEquals | @Pure
public static boolean propertyArraysEquals (Property<?>[] array, Property<?> [] array2) {
if(array.length==array2.length) {
for(int i=0; i<array.length; i++) {
if(array[i]==null) {
if(array2[i]!=null)
return false;
} else if(array2[i]==null) {
return false;
} else if(!array[i].getValue().equals(array2[i].getValue())) {
return false;
}
}
return true;
}
return false;
} | java | @Pure
public static boolean propertyArraysEquals (Property<?>[] array, Property<?> [] array2) {
if(array.length==array2.length) {
for(int i=0; i<array.length; i++) {
if(array[i]==null) {
if(array2[i]!=null)
return false;
} else if(array2[i]==null) {
return false;
} else if(!array[i].getValue().equals(array2[i].getValue())) {
return false;
}
}
return true;
}
return false;
} | [
"@",
"Pure",
"public",
"static",
"boolean",
"propertyArraysEquals",
"(",
"Property",
"<",
"?",
">",
"[",
"]",
"array",
",",
"Property",
"<",
"?",
">",
"[",
"]",
"array2",
")",
"{",
"if",
"(",
"array",
".",
"length",
"==",
"array2",
".",
"length",
")"... | Indicates if the two property arrays are strictly equals
@param array
@param array2
@return <code>true</code> if every Property in the first array is equals to the Property
in same index in the second array, <code>false</code> otherwise | [
"Indicates",
"if",
"the",
"two",
"property",
"arrays",
"are",
"strictly",
"equals"
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/maths/mathgeom/tobeincluded/src/d3/continuous/Path3d.java#L70-L86 | train |
gallandarakhneorg/afc | core/maths/mathgeom/tobeincluded/src/d3/continuous/Path3d.java | Path3d.moveTo | public void moveTo(Point3d point) {
if (this.numTypesProperty.get()>0 && this.types[this.numTypesProperty.get()-1]==PathElementType.MOVE_TO) {
this.coordsProperty[this.numCoordsProperty.get()-3] = point.xProperty;
this.coordsProperty[this.numCoordsProperty.get()-2] = point.yProperty;
this.coordsProperty[this.numCoordsProperty.get()-1] = point.zProperty;
}
else {
ensureSlots(false, 3);
this.types[this.numTypesProperty.get()] = PathElementType.MOVE_TO;
this.numTypesProperty.set(this.numTypesProperty.get()+1);
this.coordsProperty[this.numCoordsProperty.get()] = point.xProperty;
this.numCoordsProperty.set(this.numCoordsProperty.get()+1);
this.coordsProperty[this.numCoordsProperty.get()] = point.yProperty;
this.numCoordsProperty.set(this.numCoordsProperty.get()+1);
this.coordsProperty[this.numCoordsProperty.get()] = point.zProperty;
this.numCoordsProperty.set(this.numCoordsProperty.get()+1);
}
this.graphicalBounds = null;
this.logicalBounds = null;
} | java | public void moveTo(Point3d point) {
if (this.numTypesProperty.get()>0 && this.types[this.numTypesProperty.get()-1]==PathElementType.MOVE_TO) {
this.coordsProperty[this.numCoordsProperty.get()-3] = point.xProperty;
this.coordsProperty[this.numCoordsProperty.get()-2] = point.yProperty;
this.coordsProperty[this.numCoordsProperty.get()-1] = point.zProperty;
}
else {
ensureSlots(false, 3);
this.types[this.numTypesProperty.get()] = PathElementType.MOVE_TO;
this.numTypesProperty.set(this.numTypesProperty.get()+1);
this.coordsProperty[this.numCoordsProperty.get()] = point.xProperty;
this.numCoordsProperty.set(this.numCoordsProperty.get()+1);
this.coordsProperty[this.numCoordsProperty.get()] = point.yProperty;
this.numCoordsProperty.set(this.numCoordsProperty.get()+1);
this.coordsProperty[this.numCoordsProperty.get()] = point.zProperty;
this.numCoordsProperty.set(this.numCoordsProperty.get()+1);
}
this.graphicalBounds = null;
this.logicalBounds = null;
} | [
"public",
"void",
"moveTo",
"(",
"Point3d",
"point",
")",
"{",
"if",
"(",
"this",
".",
"numTypesProperty",
".",
"get",
"(",
")",
">",
"0",
"&&",
"this",
".",
"types",
"[",
"this",
".",
"numTypesProperty",
".",
"get",
"(",
")",
"-",
"1",
"]",
"==",
... | Adds a point to the path by moving to the specified
coordinates specified in point in paramater.
We store the property here, and not the values. So when the point changes,
the path will be automatically updated.
@param point the specified point | [
"Adds",
"a",
"point",
"to",
"the",
"path",
"by",
"moving",
"to",
"the",
"specified",
"coordinates",
"specified",
"in",
"point",
"in",
"paramater",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/maths/mathgeom/tobeincluded/src/d3/continuous/Path3d.java#L2044-L2066 | train |
gallandarakhneorg/afc | core/maths/mathgeom/tobeincluded/src/d3/continuous/Path3d.java | Path3d.lineTo | public void lineTo(Point3d point) {
ensureSlots(true, 3);
this.types[this.numTypesProperty.get()] = PathElementType.LINE_TO;
this.numTypesProperty.set(this.numTypesProperty.get()+1);
this.coordsProperty[this.numCoordsProperty.get()] = point.xProperty;
this.numCoordsProperty.set(this.numCoordsProperty.get()+1);
this.coordsProperty[this.numCoordsProperty.get()] = point.yProperty;
this.numCoordsProperty.set(this.numCoordsProperty.get()+1);
this.coordsProperty[this.numCoordsProperty.get()] = point.zProperty;
this.numCoordsProperty.set(this.numCoordsProperty.get()+1);
this.isEmptyProperty = null;
this.graphicalBounds = null;
this.logicalBounds = null;
} | java | public void lineTo(Point3d point) {
ensureSlots(true, 3);
this.types[this.numTypesProperty.get()] = PathElementType.LINE_TO;
this.numTypesProperty.set(this.numTypesProperty.get()+1);
this.coordsProperty[this.numCoordsProperty.get()] = point.xProperty;
this.numCoordsProperty.set(this.numCoordsProperty.get()+1);
this.coordsProperty[this.numCoordsProperty.get()] = point.yProperty;
this.numCoordsProperty.set(this.numCoordsProperty.get()+1);
this.coordsProperty[this.numCoordsProperty.get()] = point.zProperty;
this.numCoordsProperty.set(this.numCoordsProperty.get()+1);
this.isEmptyProperty = null;
this.graphicalBounds = null;
this.logicalBounds = null;
} | [
"public",
"void",
"lineTo",
"(",
"Point3d",
"point",
")",
"{",
"ensureSlots",
"(",
"true",
",",
"3",
")",
";",
"this",
".",
"types",
"[",
"this",
".",
"numTypesProperty",
".",
"get",
"(",
")",
"]",
"=",
"PathElementType",
".",
"LINE_TO",
";",
"this",
... | Adds a point to the path by drawing a straight line from the
current coordinates to the new specified coordinates
specified in the point in paramater.
We store the property here, and not the value. So when the point changes,
the path will be automatically updated.
@param point the specified point | [
"Adds",
"a",
"point",
"to",
"the",
"path",
"by",
"drawing",
"a",
"straight",
"line",
"from",
"the",
"current",
"coordinates",
"to",
"the",
"new",
"specified",
"coordinates",
"specified",
"in",
"the",
"point",
"in",
"paramater",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/maths/mathgeom/tobeincluded/src/d3/continuous/Path3d.java#L2078-L2095 | train |
gallandarakhneorg/afc | core/maths/mathgeom/tobeincluded/src/d3/continuous/Path3d.java | Path3d.quadTo | public void quadTo(Point3d controlPoint, Point3d endPoint) {
ensureSlots(true, 6);
this.types[this.numTypesProperty.get()] = PathElementType.QUAD_TO;
this.numTypesProperty.set(this.numTypesProperty.get()+1);
this.coordsProperty[this.numCoordsProperty.get()] = controlPoint.xProperty;
this.numCoordsProperty.set(this.numCoordsProperty.get()+1);
this.coordsProperty[this.numCoordsProperty.get()] = controlPoint.yProperty;
this.numCoordsProperty.set(this.numCoordsProperty.get()+1);
this.coordsProperty[this.numCoordsProperty.get()] = controlPoint.zProperty;
this.numCoordsProperty.set(this.numCoordsProperty.get()+1);
this.coordsProperty[this.numCoordsProperty.get()] = endPoint.xProperty;
this.numCoordsProperty.set(this.numCoordsProperty.get()+1);
this.coordsProperty[this.numCoordsProperty.get()] = endPoint.yProperty;
this.numCoordsProperty.set(this.numCoordsProperty.get()+1);
this.coordsProperty[this.numCoordsProperty.get()] = endPoint.zProperty;
this.numCoordsProperty.set(this.numCoordsProperty.get()+1);
this.isEmptyProperty = null;
this.isPolylineProperty.set(false);
this.graphicalBounds = null;
this.logicalBounds = null;
} | java | public void quadTo(Point3d controlPoint, Point3d endPoint) {
ensureSlots(true, 6);
this.types[this.numTypesProperty.get()] = PathElementType.QUAD_TO;
this.numTypesProperty.set(this.numTypesProperty.get()+1);
this.coordsProperty[this.numCoordsProperty.get()] = controlPoint.xProperty;
this.numCoordsProperty.set(this.numCoordsProperty.get()+1);
this.coordsProperty[this.numCoordsProperty.get()] = controlPoint.yProperty;
this.numCoordsProperty.set(this.numCoordsProperty.get()+1);
this.coordsProperty[this.numCoordsProperty.get()] = controlPoint.zProperty;
this.numCoordsProperty.set(this.numCoordsProperty.get()+1);
this.coordsProperty[this.numCoordsProperty.get()] = endPoint.xProperty;
this.numCoordsProperty.set(this.numCoordsProperty.get()+1);
this.coordsProperty[this.numCoordsProperty.get()] = endPoint.yProperty;
this.numCoordsProperty.set(this.numCoordsProperty.get()+1);
this.coordsProperty[this.numCoordsProperty.get()] = endPoint.zProperty;
this.numCoordsProperty.set(this.numCoordsProperty.get()+1);
this.isEmptyProperty = null;
this.isPolylineProperty.set(false);
this.graphicalBounds = null;
this.logicalBounds = null;
} | [
"public",
"void",
"quadTo",
"(",
"Point3d",
"controlPoint",
",",
"Point3d",
"endPoint",
")",
"{",
"ensureSlots",
"(",
"true",
",",
"6",
")",
";",
"this",
".",
"types",
"[",
"this",
".",
"numTypesProperty",
".",
"get",
"(",
")",
"]",
"=",
"PathElementType... | Adds a curved segment, defined by two new points, to the path by
drawing a Quadratic curve that intersects both the current
coordinates and the specified endPoint,
using the specified controlPoint as a quadratic
parametric control point.
All coordinates are specified in Point3d.
We store the property here, and not the value. So when the points changes,
the path will be automatically updated.
@param controlPoint the quadratic control point
@param endPoint the final end point | [
"Adds",
"a",
"curved",
"segment",
"defined",
"by",
"two",
"new",
"points",
"to",
"the",
"path",
"by",
"drawing",
"a",
"Quadratic",
"curve",
"that",
"intersects",
"both",
"the",
"current",
"coordinates",
"and",
"the",
"specified",
"endPoint",
"using",
"the",
... | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/maths/mathgeom/tobeincluded/src/d3/continuous/Path3d.java#L2185-L2214 | train |
gallandarakhneorg/afc | core/maths/mathgeom/tobeincluded/src/d3/continuous/Path3d.java | Path3d.curveTo | public void curveTo(Point3d controlPoint1,
Point3d controlPoint2,
Point3d endPoint) {
ensureSlots(true, 9);
this.types[this.numTypesProperty.get()] = PathElementType.CURVE_TO;
this.numTypesProperty.set(this.numTypesProperty.get()+1);
this.coordsProperty[this.numCoordsProperty.get()] = controlPoint1.xProperty;
this.numCoordsProperty.set(this.numCoordsProperty.get()+1);
this.coordsProperty[this.numCoordsProperty.get()] = controlPoint1.yProperty;
this.numCoordsProperty.set(this.numCoordsProperty.get()+1);
this.coordsProperty[this.numCoordsProperty.get()] = controlPoint1.zProperty;
this.numCoordsProperty.set(this.numCoordsProperty.get()+1);
this.coordsProperty[this.numCoordsProperty.get()] = controlPoint2.xProperty;
this.numCoordsProperty.set(this.numCoordsProperty.get()+1);
this.coordsProperty[this.numCoordsProperty.get()] = controlPoint2.yProperty;
this.numCoordsProperty.set(this.numCoordsProperty.get()+1);
this.coordsProperty[this.numCoordsProperty.get()] = controlPoint2.zProperty;
this.numCoordsProperty.set(this.numCoordsProperty.get()+1);
this.coordsProperty[this.numCoordsProperty.get()] = endPoint.xProperty;
this.numCoordsProperty.set(this.numCoordsProperty.get()+1);
this.coordsProperty[this.numCoordsProperty.get()] = endPoint.yProperty;
this.numCoordsProperty.set(this.numCoordsProperty.get()+1);
this.coordsProperty[this.numCoordsProperty.get()] = endPoint.zProperty;
this.numCoordsProperty.set(this.numCoordsProperty.get()+1);
this.isEmptyProperty = null;
this.isPolylineProperty.set(false);
this.graphicalBounds = null;
this.logicalBounds = null;
} | java | public void curveTo(Point3d controlPoint1,
Point3d controlPoint2,
Point3d endPoint) {
ensureSlots(true, 9);
this.types[this.numTypesProperty.get()] = PathElementType.CURVE_TO;
this.numTypesProperty.set(this.numTypesProperty.get()+1);
this.coordsProperty[this.numCoordsProperty.get()] = controlPoint1.xProperty;
this.numCoordsProperty.set(this.numCoordsProperty.get()+1);
this.coordsProperty[this.numCoordsProperty.get()] = controlPoint1.yProperty;
this.numCoordsProperty.set(this.numCoordsProperty.get()+1);
this.coordsProperty[this.numCoordsProperty.get()] = controlPoint1.zProperty;
this.numCoordsProperty.set(this.numCoordsProperty.get()+1);
this.coordsProperty[this.numCoordsProperty.get()] = controlPoint2.xProperty;
this.numCoordsProperty.set(this.numCoordsProperty.get()+1);
this.coordsProperty[this.numCoordsProperty.get()] = controlPoint2.yProperty;
this.numCoordsProperty.set(this.numCoordsProperty.get()+1);
this.coordsProperty[this.numCoordsProperty.get()] = controlPoint2.zProperty;
this.numCoordsProperty.set(this.numCoordsProperty.get()+1);
this.coordsProperty[this.numCoordsProperty.get()] = endPoint.xProperty;
this.numCoordsProperty.set(this.numCoordsProperty.get()+1);
this.coordsProperty[this.numCoordsProperty.get()] = endPoint.yProperty;
this.numCoordsProperty.set(this.numCoordsProperty.get()+1);
this.coordsProperty[this.numCoordsProperty.get()] = endPoint.zProperty;
this.numCoordsProperty.set(this.numCoordsProperty.get()+1);
this.isEmptyProperty = null;
this.isPolylineProperty.set(false);
this.graphicalBounds = null;
this.logicalBounds = null;
} | [
"public",
"void",
"curveTo",
"(",
"Point3d",
"controlPoint1",
",",
"Point3d",
"controlPoint2",
",",
"Point3d",
"endPoint",
")",
"{",
"ensureSlots",
"(",
"true",
",",
"9",
")",
";",
"this",
".",
"types",
"[",
"this",
".",
"numTypesProperty",
".",
"get",
"("... | Adds a curved segment, defined by three new points, to the path by
drawing a Bézier curve that intersects both the current
coordinates and the specified endPoint,
using the specified points controlPoint1 and controlPoint2 as
Bézier control points.
All coordinates are specified in Point3d.
We store the property here, and not the value. So when the points changes,
the path will be automatically updated.
@param controlPoint1 the first Bézier control point
@param controlPoint2 the second Bézier control point
@param endPoint the final end point | [
"Adds",
"a",
"curved",
"segment",
"defined",
"by",
"three",
"new",
"points",
"to",
"the",
"path",
"by",
"drawing",
"a",
"Bé",
";",
"zier",
"curve",
"that",
"intersects",
"both",
"the",
"current",
"coordinates",
"and",
"the",
"specified",
"endPoint",
"u... | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/maths/mathgeom/tobeincluded/src/d3/continuous/Path3d.java#L2294-L2336 | train |
gallandarakhneorg/afc | advanced/shapefile/src/main/java/org/arakhne/afc/io/shape/AbstractCommonShapeFileWriter.java | AbstractCommonShapeFileWriter.flush | protected void flush() throws IOException {
if (this.tempStream != null && this.buffer.position() > 0) {
final int pos = this.buffer.position();
this.buffer.rewind();
this.buffer.limit(pos);
this.tempStream.write(this.buffer);
this.buffer.rewind();
this.buffer.limit(this.buffer.capacity());
this.bufferPosition += pos;
}
} | java | protected void flush() throws IOException {
if (this.tempStream != null && this.buffer.position() > 0) {
final int pos = this.buffer.position();
this.buffer.rewind();
this.buffer.limit(pos);
this.tempStream.write(this.buffer);
this.buffer.rewind();
this.buffer.limit(this.buffer.capacity());
this.bufferPosition += pos;
}
} | [
"protected",
"void",
"flush",
"(",
")",
"throws",
"IOException",
"{",
"if",
"(",
"this",
".",
"tempStream",
"!=",
"null",
"&&",
"this",
".",
"buffer",
".",
"position",
"(",
")",
">",
"0",
")",
"{",
"final",
"int",
"pos",
"=",
"this",
".",
"buffer",
... | Force this writer to write the memory buffer inside the temporary file.
@throws IOException in case of error. | [
"Force",
"this",
"writer",
"to",
"write",
"the",
"memory",
"buffer",
"inside",
"the",
"temporary",
"file",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/shapefile/src/main/java/org/arakhne/afc/io/shape/AbstractCommonShapeFileWriter.java#L178-L191 | train |
gallandarakhneorg/afc | advanced/shapefile/src/main/java/org/arakhne/afc/io/shape/AbstractCommonShapeFileWriter.java | AbstractCommonShapeFileWriter.writeBEInt | protected final void writeBEInt(int v) throws IOException {
ensureAvailableBytes(4);
this.buffer.order(ByteOrder.BIG_ENDIAN);
this.buffer.putInt(v);
} | java | protected final void writeBEInt(int v) throws IOException {
ensureAvailableBytes(4);
this.buffer.order(ByteOrder.BIG_ENDIAN);
this.buffer.putInt(v);
} | [
"protected",
"final",
"void",
"writeBEInt",
"(",
"int",
"v",
")",
"throws",
"IOException",
"{",
"ensureAvailableBytes",
"(",
"4",
")",
";",
"this",
".",
"buffer",
".",
"order",
"(",
"ByteOrder",
".",
"BIG_ENDIAN",
")",
";",
"this",
".",
"buffer",
".",
"p... | Write a big endian 4-byte integer.
@param v is a big endian 4-byte integer.
@throws IOException in case of error. | [
"Write",
"a",
"big",
"endian",
"4",
"-",
"byte",
"integer",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/shapefile/src/main/java/org/arakhne/afc/io/shape/AbstractCommonShapeFileWriter.java#L209-L213 | train |
gallandarakhneorg/afc | advanced/shapefile/src/main/java/org/arakhne/afc/io/shape/AbstractCommonShapeFileWriter.java | AbstractCommonShapeFileWriter.writeBEDouble | protected final void writeBEDouble(double v) throws IOException {
ensureAvailableBytes(8);
this.buffer.order(ByteOrder.BIG_ENDIAN);
this.buffer.putDouble(v);
} | java | protected final void writeBEDouble(double v) throws IOException {
ensureAvailableBytes(8);
this.buffer.order(ByteOrder.BIG_ENDIAN);
this.buffer.putDouble(v);
} | [
"protected",
"final",
"void",
"writeBEDouble",
"(",
"double",
"v",
")",
"throws",
"IOException",
"{",
"ensureAvailableBytes",
"(",
"8",
")",
";",
"this",
".",
"buffer",
".",
"order",
"(",
"ByteOrder",
".",
"BIG_ENDIAN",
")",
";",
"this",
".",
"buffer",
"."... | Write a big endian 8-byte floating point number.
@param v is a big endian 8-byte floating point number.
@throws IOException in case of error. | [
"Write",
"a",
"big",
"endian",
"8",
"-",
"byte",
"floating",
"point",
"number",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/shapefile/src/main/java/org/arakhne/afc/io/shape/AbstractCommonShapeFileWriter.java#L220-L224 | train |
gallandarakhneorg/afc | advanced/shapefile/src/main/java/org/arakhne/afc/io/shape/AbstractCommonShapeFileWriter.java | AbstractCommonShapeFileWriter.writeLEInt | protected final void writeLEInt(int v) throws IOException {
ensureAvailableBytes(4);
this.buffer.order(ByteOrder.LITTLE_ENDIAN);
this.buffer.putInt(v);
} | java | protected final void writeLEInt(int v) throws IOException {
ensureAvailableBytes(4);
this.buffer.order(ByteOrder.LITTLE_ENDIAN);
this.buffer.putInt(v);
} | [
"protected",
"final",
"void",
"writeLEInt",
"(",
"int",
"v",
")",
"throws",
"IOException",
"{",
"ensureAvailableBytes",
"(",
"4",
")",
";",
"this",
".",
"buffer",
".",
"order",
"(",
"ByteOrder",
".",
"LITTLE_ENDIAN",
")",
";",
"this",
".",
"buffer",
".",
... | Write a little endian 4-byte integer.
@param v is a little endian 4-byte integer.
@throws IOException in case of error. | [
"Write",
"a",
"little",
"endian",
"4",
"-",
"byte",
"integer",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/shapefile/src/main/java/org/arakhne/afc/io/shape/AbstractCommonShapeFileWriter.java#L231-L235 | train |
gallandarakhneorg/afc | advanced/shapefile/src/main/java/org/arakhne/afc/io/shape/AbstractCommonShapeFileWriter.java | AbstractCommonShapeFileWriter.writeLEDouble | protected final void writeLEDouble(double v) throws IOException {
ensureAvailableBytes(8);
this.buffer.order(ByteOrder.LITTLE_ENDIAN);
this.buffer.putDouble(v);
} | java | protected final void writeLEDouble(double v) throws IOException {
ensureAvailableBytes(8);
this.buffer.order(ByteOrder.LITTLE_ENDIAN);
this.buffer.putDouble(v);
} | [
"protected",
"final",
"void",
"writeLEDouble",
"(",
"double",
"v",
")",
"throws",
"IOException",
"{",
"ensureAvailableBytes",
"(",
"8",
")",
";",
"this",
".",
"buffer",
".",
"order",
"(",
"ByteOrder",
".",
"LITTLE_ENDIAN",
")",
";",
"this",
".",
"buffer",
... | Write a little endian 8-byte floating point number.
@param v is a little endian 8-byte floating point number.
@throws IOException in case of error. | [
"Write",
"a",
"little",
"endian",
"8",
"-",
"byte",
"floating",
"point",
"number",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/shapefile/src/main/java/org/arakhne/afc/io/shape/AbstractCommonShapeFileWriter.java#L242-L246 | train |
gallandarakhneorg/afc | advanced/shapefile/src/main/java/org/arakhne/afc/io/shape/AbstractCommonShapeFileWriter.java | AbstractCommonShapeFileWriter.writeHeader | private void writeHeader(ESRIBounds box, ShapeElementType type, Collection<? extends E> elements) throws IOException {
if (!this.headerWasWritten) {
initializeContentBuffer();
box.ensureMinMax();
//Byte 0 : File Code (9994)
writeBEInt(SHAPE_FILE_CODE);
//Byte 4 : Unused (0)
writeBEInt(0);
//Byte 8 : Unused (0)
writeBEInt(0);
//Byte 12 : Unused (0)
writeBEInt(0);
//Byte 16 : Unused (0)
writeBEInt(0);
//Byte 20 : Unused (0)
writeBEInt(0);
//Byte 24 : File Length, fill later
writeBEInt(0);
//Byte 28 : Version(1000)
writeLEInt(SHAPE_FILE_VERSION);
//Byte 32 : ShapeType
writeLEInt(type.shapeType);
//Byte 36 : Xmin
writeLEDouble(toESRI_x(box.getMinX()));
//Byte 44 : Ymin
writeLEDouble(toESRI_y(box.getMinY()));
//Byte 52 : Xmax
writeLEDouble(toESRI_x(box.getMaxX()));
//Byte 60 : Ymax
writeLEDouble(toESRI_y(box.getMaxY()));
//Byte 68 : Zmin
writeLEDouble(toESRI_z(box.getMinZ()));
//Byte 76 : Zmax
writeLEDouble(toESRI_z(box.getMaxZ()));
//Byte 84 : Mmin
writeLEDouble(toESRI_m(box.getMinM()));
//Byte 92 : Mmax
writeLEDouble(toESRI_m(box.getMaxM()));
this.headerWasWritten = true;
this.recordIndex = 0;
onHeaderWritten(box, type, elements);
}
} | java | private void writeHeader(ESRIBounds box, ShapeElementType type, Collection<? extends E> elements) throws IOException {
if (!this.headerWasWritten) {
initializeContentBuffer();
box.ensureMinMax();
//Byte 0 : File Code (9994)
writeBEInt(SHAPE_FILE_CODE);
//Byte 4 : Unused (0)
writeBEInt(0);
//Byte 8 : Unused (0)
writeBEInt(0);
//Byte 12 : Unused (0)
writeBEInt(0);
//Byte 16 : Unused (0)
writeBEInt(0);
//Byte 20 : Unused (0)
writeBEInt(0);
//Byte 24 : File Length, fill later
writeBEInt(0);
//Byte 28 : Version(1000)
writeLEInt(SHAPE_FILE_VERSION);
//Byte 32 : ShapeType
writeLEInt(type.shapeType);
//Byte 36 : Xmin
writeLEDouble(toESRI_x(box.getMinX()));
//Byte 44 : Ymin
writeLEDouble(toESRI_y(box.getMinY()));
//Byte 52 : Xmax
writeLEDouble(toESRI_x(box.getMaxX()));
//Byte 60 : Ymax
writeLEDouble(toESRI_y(box.getMaxY()));
//Byte 68 : Zmin
writeLEDouble(toESRI_z(box.getMinZ()));
//Byte 76 : Zmax
writeLEDouble(toESRI_z(box.getMaxZ()));
//Byte 84 : Mmin
writeLEDouble(toESRI_m(box.getMinM()));
//Byte 92 : Mmax
writeLEDouble(toESRI_m(box.getMaxM()));
this.headerWasWritten = true;
this.recordIndex = 0;
onHeaderWritten(box, type, elements);
}
} | [
"private",
"void",
"writeHeader",
"(",
"ESRIBounds",
"box",
",",
"ShapeElementType",
"type",
",",
"Collection",
"<",
"?",
"extends",
"E",
">",
"elements",
")",
"throws",
"IOException",
"{",
"if",
"(",
"!",
"this",
".",
"headerWasWritten",
")",
"{",
"initiali... | Write the header of a Shape file.
@param box is the bounds of the data in the shape file.
@param stream is the output stream
@param type is the type of the elements.
@param elements are the elements which are caused the header to be written.
@throws IOException in case of error. | [
"Write",
"the",
"header",
"of",
"a",
"Shape",
"file",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/shapefile/src/main/java/org/arakhne/afc/io/shape/AbstractCommonShapeFileWriter.java#L269-L315 | train |
gallandarakhneorg/afc | advanced/shapefile/src/main/java/org/arakhne/afc/io/shape/AbstractCommonShapeFileWriter.java | AbstractCommonShapeFileWriter.write | public void write(Collection<? extends E> elements) throws IOException {
final Progression progressBar = getTaskProgression();
Progression subTask = null;
if (progressBar != null) {
progressBar.setProperties(0, 0, (elements.size() + 1) * 100, false);
}
if (this.fileBounds == null) {
this.fileBounds = getFileBounds();
}
if (this.fileBounds != null) {
writeHeader(this.fileBounds, this.elementType, elements);
if (progressBar != null) {
progressBar.setValue(100);
subTask = progressBar.subTask(elements.size() * 100);
subTask.setProperties(0, 0, elements.size(), false);
}
for (final E element : elements) {
writeElement(this.recordIndex, element, this.elementType);
if (subTask != null) {
subTask.setValue(this.recordIndex + 1);
}
++this.recordIndex;
}
} else {
throw new BoundsNotFoundException();
}
if (progressBar != null) {
progressBar.end();
}
} | java | public void write(Collection<? extends E> elements) throws IOException {
final Progression progressBar = getTaskProgression();
Progression subTask = null;
if (progressBar != null) {
progressBar.setProperties(0, 0, (elements.size() + 1) * 100, false);
}
if (this.fileBounds == null) {
this.fileBounds = getFileBounds();
}
if (this.fileBounds != null) {
writeHeader(this.fileBounds, this.elementType, elements);
if (progressBar != null) {
progressBar.setValue(100);
subTask = progressBar.subTask(elements.size() * 100);
subTask.setProperties(0, 0, elements.size(), false);
}
for (final E element : elements) {
writeElement(this.recordIndex, element, this.elementType);
if (subTask != null) {
subTask.setValue(this.recordIndex + 1);
}
++this.recordIndex;
}
} else {
throw new BoundsNotFoundException();
}
if (progressBar != null) {
progressBar.end();
}
} | [
"public",
"void",
"write",
"(",
"Collection",
"<",
"?",
"extends",
"E",
">",
"elements",
")",
"throws",
"IOException",
"{",
"final",
"Progression",
"progressBar",
"=",
"getTaskProgression",
"(",
")",
";",
"Progression",
"subTask",
"=",
"null",
";",
"if",
"("... | Write the Shape file and its associated files.
@param elements are the elements to write down
@throws IOException in case of error. | [
"Write",
"the",
"Shape",
"file",
"and",
"its",
"associated",
"files",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/shapefile/src/main/java/org/arakhne/afc/io/shape/AbstractCommonShapeFileWriter.java#L395-L434 | train |
gallandarakhneorg/afc | core/maths/mathphysics/src/main/java/org/arakhne/afc/math/physics/MeasureUnitUtil.java | MeasureUnitUtil.toSeconds | @Pure
public static double toSeconds(double value, TimeUnit inputUnit) {
switch (inputUnit) {
case DAYS:
return value * 86400.;
case HOURS:
return value * 3600.;
case MINUTES:
return value * 60.;
case SECONDS:
break;
case MILLISECONDS:
return milli2unit(value);
case MICROSECONDS:
return micro2unit(value);
case NANOSECONDS:
return nano2unit(value);
default:
throw new IllegalArgumentException();
}
return value;
} | java | @Pure
public static double toSeconds(double value, TimeUnit inputUnit) {
switch (inputUnit) {
case DAYS:
return value * 86400.;
case HOURS:
return value * 3600.;
case MINUTES:
return value * 60.;
case SECONDS:
break;
case MILLISECONDS:
return milli2unit(value);
case MICROSECONDS:
return micro2unit(value);
case NANOSECONDS:
return nano2unit(value);
default:
throw new IllegalArgumentException();
}
return value;
} | [
"@",
"Pure",
"public",
"static",
"double",
"toSeconds",
"(",
"double",
"value",
",",
"TimeUnit",
"inputUnit",
")",
"{",
"switch",
"(",
"inputUnit",
")",
"{",
"case",
"DAYS",
":",
"return",
"value",
"*",
"86400.",
";",
"case",
"HOURS",
":",
"return",
"val... | Convert the given value expressed in the given unit to seconds.
@param value is the value to convert
@param inputUnit is the unit of the {@code value}
@return the result of the convertion. | [
"Convert",
"the",
"given",
"value",
"expressed",
"in",
"the",
"given",
"unit",
"to",
"seconds",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/maths/mathphysics/src/main/java/org/arakhne/afc/math/physics/MeasureUnitUtil.java#L393-L414 | train |
gallandarakhneorg/afc | core/maths/mathphysics/src/main/java/org/arakhne/afc/math/physics/MeasureUnitUtil.java | MeasureUnitUtil.toMeters | @Pure
@SuppressWarnings("checkstyle:returncount")
public static double toMeters(double value, SpaceUnit inputUnit) {
switch (inputUnit) {
case TERAMETER:
return value * 1e12;
case GIGAMETER:
return value * 1e9;
case MEGAMETER:
return value * 1e6;
case KILOMETER:
return value * 1e3;
case HECTOMETER:
return value * 1e2;
case DECAMETER:
return value * 1e1;
case METER:
break;
case DECIMETER:
return value * 1e-1;
case CENTIMETER:
return value * 1e-2;
case MILLIMETER:
return value * 1e-3;
case MICROMETER:
return value * 1e-6;
case NANOMETER:
return value * 1e-9;
case PICOMETER:
return value * 1e-12;
case FEMTOMETER:
return value * 1e-15;
default:
throw new IllegalArgumentException();
}
return value;
} | java | @Pure
@SuppressWarnings("checkstyle:returncount")
public static double toMeters(double value, SpaceUnit inputUnit) {
switch (inputUnit) {
case TERAMETER:
return value * 1e12;
case GIGAMETER:
return value * 1e9;
case MEGAMETER:
return value * 1e6;
case KILOMETER:
return value * 1e3;
case HECTOMETER:
return value * 1e2;
case DECAMETER:
return value * 1e1;
case METER:
break;
case DECIMETER:
return value * 1e-1;
case CENTIMETER:
return value * 1e-2;
case MILLIMETER:
return value * 1e-3;
case MICROMETER:
return value * 1e-6;
case NANOMETER:
return value * 1e-9;
case PICOMETER:
return value * 1e-12;
case FEMTOMETER:
return value * 1e-15;
default:
throw new IllegalArgumentException();
}
return value;
} | [
"@",
"Pure",
"@",
"SuppressWarnings",
"(",
"\"checkstyle:returncount\"",
")",
"public",
"static",
"double",
"toMeters",
"(",
"double",
"value",
",",
"SpaceUnit",
"inputUnit",
")",
"{",
"switch",
"(",
"inputUnit",
")",
"{",
"case",
"TERAMETER",
":",
"return",
"... | Convert the given value expressed in the given unit to meters.
@param value is the value to convert
@param inputUnit is the unit of the {@code value}
@return the result of the convertion. | [
"Convert",
"the",
"given",
"value",
"expressed",
"in",
"the",
"given",
"unit",
"to",
"meters",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/maths/mathphysics/src/main/java/org/arakhne/afc/math/physics/MeasureUnitUtil.java#L422-L458 | train |
gallandarakhneorg/afc | core/maths/mathphysics/src/main/java/org/arakhne/afc/math/physics/MeasureUnitUtil.java | MeasureUnitUtil.fromSeconds | @Pure
public static double fromSeconds(double value, TimeUnit outputUnit) {
switch (outputUnit) {
case DAYS:
return value / 86400.;
case HOURS:
return value / 3600.;
case MINUTES:
return value / 60.;
case SECONDS:
break;
case MILLISECONDS:
return unit2milli(value);
case MICROSECONDS:
return unit2micro(value);
case NANOSECONDS:
return unit2nano(value);
default:
throw new IllegalArgumentException();
}
return value;
} | java | @Pure
public static double fromSeconds(double value, TimeUnit outputUnit) {
switch (outputUnit) {
case DAYS:
return value / 86400.;
case HOURS:
return value / 3600.;
case MINUTES:
return value / 60.;
case SECONDS:
break;
case MILLISECONDS:
return unit2milli(value);
case MICROSECONDS:
return unit2micro(value);
case NANOSECONDS:
return unit2nano(value);
default:
throw new IllegalArgumentException();
}
return value;
} | [
"@",
"Pure",
"public",
"static",
"double",
"fromSeconds",
"(",
"double",
"value",
",",
"TimeUnit",
"outputUnit",
")",
"{",
"switch",
"(",
"outputUnit",
")",
"{",
"case",
"DAYS",
":",
"return",
"value",
"/",
"86400.",
";",
"case",
"HOURS",
":",
"return",
... | Convert the given value expressed in seconds to the given unit.
@param value is the value to convert
@param outputUnit is the unit of result.
@return the result of the convertion. | [
"Convert",
"the",
"given",
"value",
"expressed",
"in",
"seconds",
"to",
"the",
"given",
"unit",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/maths/mathphysics/src/main/java/org/arakhne/afc/math/physics/MeasureUnitUtil.java#L510-L531 | train |
gallandarakhneorg/afc | core/maths/mathphysics/src/main/java/org/arakhne/afc/math/physics/MeasureUnitUtil.java | MeasureUnitUtil.toMetersPerSecond | @Pure
public static double toMetersPerSecond(double value, SpeedUnit inputUnit) {
switch (inputUnit) {
case KILOMETERS_PER_HOUR:
return 3.6 * value;
case MILLIMETERS_PER_SECOND:
return value / 1000.;
case METERS_PER_SECOND:
default:
}
return value;
} | java | @Pure
public static double toMetersPerSecond(double value, SpeedUnit inputUnit) {
switch (inputUnit) {
case KILOMETERS_PER_HOUR:
return 3.6 * value;
case MILLIMETERS_PER_SECOND:
return value / 1000.;
case METERS_PER_SECOND:
default:
}
return value;
} | [
"@",
"Pure",
"public",
"static",
"double",
"toMetersPerSecond",
"(",
"double",
"value",
",",
"SpeedUnit",
"inputUnit",
")",
"{",
"switch",
"(",
"inputUnit",
")",
"{",
"case",
"KILOMETERS_PER_HOUR",
":",
"return",
"3.6",
"*",
"value",
";",
"case",
"MILLIMETERS_... | Convert the given value expressed in the given unit to meters per second.
@param value is the value to convert
@param inputUnit is the unit of the {@code value}
@return the result of the convertion. | [
"Convert",
"the",
"given",
"value",
"expressed",
"in",
"the",
"given",
"unit",
"to",
"meters",
"per",
"second",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/maths/mathphysics/src/main/java/org/arakhne/afc/math/physics/MeasureUnitUtil.java#L620-L631 | train |
gallandarakhneorg/afc | core/maths/mathphysics/src/main/java/org/arakhne/afc/math/physics/MeasureUnitUtil.java | MeasureUnitUtil.toRadiansPerSecond | @Pure
public static double toRadiansPerSecond(double value, AngularUnit inputUnit) {
switch (inputUnit) {
case TURNS_PER_SECOND:
return value * (2. * MathConstants.PI);
case DEGREES_PER_SECOND:
return Math.toRadians(value);
case RADIANS_PER_SECOND:
default:
}
return value;
} | java | @Pure
public static double toRadiansPerSecond(double value, AngularUnit inputUnit) {
switch (inputUnit) {
case TURNS_PER_SECOND:
return value * (2. * MathConstants.PI);
case DEGREES_PER_SECOND:
return Math.toRadians(value);
case RADIANS_PER_SECOND:
default:
}
return value;
} | [
"@",
"Pure",
"public",
"static",
"double",
"toRadiansPerSecond",
"(",
"double",
"value",
",",
"AngularUnit",
"inputUnit",
")",
"{",
"switch",
"(",
"inputUnit",
")",
"{",
"case",
"TURNS_PER_SECOND",
":",
"return",
"value",
"*",
"(",
"2.",
"*",
"MathConstants",
... | Convert the given value expressed in the given unit to radians per second.
@param value is the value to convert
@param inputUnit is the unit of the {@code value}
@return the result of the convertion. | [
"Convert",
"the",
"given",
"value",
"expressed",
"in",
"the",
"given",
"unit",
"to",
"radians",
"per",
"second",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/maths/mathphysics/src/main/java/org/arakhne/afc/math/physics/MeasureUnitUtil.java#L639-L650 | train |
gallandarakhneorg/afc | core/maths/mathphysics/src/main/java/org/arakhne/afc/math/physics/MeasureUnitUtil.java | MeasureUnitUtil.fromMetersPerSecond | @Pure
public static double fromMetersPerSecond(double value, SpeedUnit outputUnit) {
switch (outputUnit) {
case KILOMETERS_PER_HOUR:
return value / 3.6;
case MILLIMETERS_PER_SECOND:
return value * 1000.;
case METERS_PER_SECOND:
default:
}
return value;
} | java | @Pure
public static double fromMetersPerSecond(double value, SpeedUnit outputUnit) {
switch (outputUnit) {
case KILOMETERS_PER_HOUR:
return value / 3.6;
case MILLIMETERS_PER_SECOND:
return value * 1000.;
case METERS_PER_SECOND:
default:
}
return value;
} | [
"@",
"Pure",
"public",
"static",
"double",
"fromMetersPerSecond",
"(",
"double",
"value",
",",
"SpeedUnit",
"outputUnit",
")",
"{",
"switch",
"(",
"outputUnit",
")",
"{",
"case",
"KILOMETERS_PER_HOUR",
":",
"return",
"value",
"/",
"3.6",
";",
"case",
"MILLIMET... | Convert the given value expressed in meters per second to the given unit.
@param value is the value to convert
@param outputUnit is the unit of result.
@return the result of the convertion. | [
"Convert",
"the",
"given",
"value",
"expressed",
"in",
"meters",
"per",
"second",
"to",
"the",
"given",
"unit",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/maths/mathphysics/src/main/java/org/arakhne/afc/math/physics/MeasureUnitUtil.java#L658-L669 | train |
gallandarakhneorg/afc | core/maths/mathphysics/src/main/java/org/arakhne/afc/math/physics/MeasureUnitUtil.java | MeasureUnitUtil.fromRadiansPerSecond | @Pure
public static double fromRadiansPerSecond(double value, AngularUnit outputUnit) {
switch (outputUnit) {
case TURNS_PER_SECOND:
return value / (2. * MathConstants.PI);
case DEGREES_PER_SECOND:
return Math.toDegrees(value);
case RADIANS_PER_SECOND:
default:
}
return value;
} | java | @Pure
public static double fromRadiansPerSecond(double value, AngularUnit outputUnit) {
switch (outputUnit) {
case TURNS_PER_SECOND:
return value / (2. * MathConstants.PI);
case DEGREES_PER_SECOND:
return Math.toDegrees(value);
case RADIANS_PER_SECOND:
default:
}
return value;
} | [
"@",
"Pure",
"public",
"static",
"double",
"fromRadiansPerSecond",
"(",
"double",
"value",
",",
"AngularUnit",
"outputUnit",
")",
"{",
"switch",
"(",
"outputUnit",
")",
"{",
"case",
"TURNS_PER_SECOND",
":",
"return",
"value",
"/",
"(",
"2.",
"*",
"MathConstant... | Convert the given value expressed in radians per second to the given unit.
@param value is the value to convert
@param outputUnit is the unit of result.
@return the result of the convertion. | [
"Convert",
"the",
"given",
"value",
"expressed",
"in",
"radians",
"per",
"second",
"to",
"the",
"given",
"unit",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/maths/mathphysics/src/main/java/org/arakhne/afc/math/physics/MeasureUnitUtil.java#L677-L688 | train |
gallandarakhneorg/afc | core/maths/mathphysics/src/main/java/org/arakhne/afc/math/physics/MeasureUnitUtil.java | MeasureUnitUtil.getSmallestUnit | @Pure
public static SpaceUnit getSmallestUnit(double amount, SpaceUnit unit) {
final double meters = toMeters(amount, unit);
double v;
final SpaceUnit[] units = SpaceUnit.values();
SpaceUnit u;
for (int i = units.length - 1; i >= 0; --i) {
u = units[i];
v = Math.floor(fromMeters(meters, u));
if (v > 0.) {
return u;
}
}
return unit;
} | java | @Pure
public static SpaceUnit getSmallestUnit(double amount, SpaceUnit unit) {
final double meters = toMeters(amount, unit);
double v;
final SpaceUnit[] units = SpaceUnit.values();
SpaceUnit u;
for (int i = units.length - 1; i >= 0; --i) {
u = units[i];
v = Math.floor(fromMeters(meters, u));
if (v > 0.) {
return u;
}
}
return unit;
} | [
"@",
"Pure",
"public",
"static",
"SpaceUnit",
"getSmallestUnit",
"(",
"double",
"amount",
",",
"SpaceUnit",
"unit",
")",
"{",
"final",
"double",
"meters",
"=",
"toMeters",
"(",
"amount",
",",
"unit",
")",
";",
"double",
"v",
";",
"final",
"SpaceUnit",
"[",... | Compute the smallest unit that permits to have
a metric value with its integer part positive.
@param amount is the amount expressed in the given unit.
@param unit is the unit of the given amount.
@return the smallest unit that permits to obtain the smallest
positive mathematical integer that corresponds to the integer
part of the given amount after its convertion to the selected
unit. | [
"Compute",
"the",
"smallest",
"unit",
"that",
"permits",
"to",
"have",
"a",
"metric",
"value",
"with",
"its",
"integer",
"part",
"positive",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/maths/mathphysics/src/main/java/org/arakhne/afc/math/physics/MeasureUnitUtil.java#L700-L714 | train |
gallandarakhneorg/afc | core/maths/mathgeom/src/main/java/org/arakhne/afc/math/geometry/d3/d/Vector3d.java | Vector3d.convert | public static Vector3d convert(Tuple3D<?> tuple) {
if (tuple instanceof Vector3d) {
return (Vector3d) tuple;
}
return new Vector3d(tuple.getX(), tuple.getY(), tuple.getZ());
} | java | public static Vector3d convert(Tuple3D<?> tuple) {
if (tuple instanceof Vector3d) {
return (Vector3d) tuple;
}
return new Vector3d(tuple.getX(), tuple.getY(), tuple.getZ());
} | [
"public",
"static",
"Vector3d",
"convert",
"(",
"Tuple3D",
"<",
"?",
">",
"tuple",
")",
"{",
"if",
"(",
"tuple",
"instanceof",
"Vector3d",
")",
"{",
"return",
"(",
"Vector3d",
")",
"tuple",
";",
"}",
"return",
"new",
"Vector3d",
"(",
"tuple",
".",
"get... | Convert the given tuple to a real Vector3d.
<p>If the given tuple is already a Vector3d, it is replied.
@param tuple the tuple.
@return the Vector3d.
@since 14.0 | [
"Convert",
"the",
"given",
"tuple",
"to",
"a",
"real",
"Vector3d",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/maths/mathgeom/src/main/java/org/arakhne/afc/math/geometry/d3/d/Vector3d.java#L117-L122 | train |
hltcoe/annotated-nyt | src/main/java/com/nytlabs/corpus/NYTCorpusDocument.java | NYTCorpusDocument.ljust | private String ljust(String s, Integer length) {
if (s.length() >= length) {
return s;
}
length -= s.length();
StringBuffer sb = new StringBuffer();
for (Integer i = 0; i < length; i++) {
sb.append(" ");
}
return s + sb.toString();
} | java | private String ljust(String s, Integer length) {
if (s.length() >= length) {
return s;
}
length -= s.length();
StringBuffer sb = new StringBuffer();
for (Integer i = 0; i < length; i++) {
sb.append(" ");
}
return s + sb.toString();
} | [
"private",
"String",
"ljust",
"(",
"String",
"s",
",",
"Integer",
"length",
")",
"{",
"if",
"(",
"s",
".",
"length",
"(",
")",
">=",
"length",
")",
"{",
"return",
"s",
";",
"}",
"length",
"-=",
"s",
".",
"length",
"(",
")",
";",
"StringBuffer",
"... | Left justify a string by forcing it to be the specified length. This is
done by concatonating space characters to the end of the string until the
string is of the specified length. If, however, the string is initially
longer than the specified length then the original string is returned.
@param s
A string.
@param length
The target length for the string.
@return A left-justified string. | [
"Left",
"justify",
"a",
"string",
"by",
"forcing",
"it",
"to",
"be",
"the",
"specified",
"length",
".",
"This",
"is",
"done",
"by",
"concatonating",
"space",
"characters",
"to",
"the",
"end",
"of",
"the",
"string",
"until",
"the",
"string",
"is",
"of",
"... | 0a4daa97705591cefea9de61614770ae2665a48e | https://github.com/hltcoe/annotated-nyt/blob/0a4daa97705591cefea9de61614770ae2665a48e/src/main/java/com/nytlabs/corpus/NYTCorpusDocument.java#L990-L1000 | train |
hltcoe/annotated-nyt | src/main/java/com/nytlabs/corpus/NYTCorpusDocument.java | NYTCorpusDocument.appendProperty | private void appendProperty(StringBuffer sb, String propertyName,
Object propertyValue) {
if (propertyValue != null) {
propertyValue = propertyValue.toString().replaceAll("\\s+", " ")
.trim();
}
sb.append(ljust(propertyName + ":", 45) + propertyValue + "\n");
} | java | private void appendProperty(StringBuffer sb, String propertyName,
Object propertyValue) {
if (propertyValue != null) {
propertyValue = propertyValue.toString().replaceAll("\\s+", " ")
.trim();
}
sb.append(ljust(propertyName + ":", 45) + propertyValue + "\n");
} | [
"private",
"void",
"appendProperty",
"(",
"StringBuffer",
"sb",
",",
"String",
"propertyName",
",",
"Object",
"propertyValue",
")",
"{",
"if",
"(",
"propertyValue",
"!=",
"null",
")",
"{",
"propertyValue",
"=",
"propertyValue",
".",
"toString",
"(",
")",
".",
... | Append a property to the specified string.
@param sb
@param propertyName
@param propertyValue | [
"Append",
"a",
"property",
"to",
"the",
"specified",
"string",
"."
] | 0a4daa97705591cefea9de61614770ae2665a48e | https://github.com/hltcoe/annotated-nyt/blob/0a4daa97705591cefea9de61614770ae2665a48e/src/main/java/com/nytlabs/corpus/NYTCorpusDocument.java#L1560-L1568 | train |
gallandarakhneorg/afc | core/maths/mathgeom/tobeincluded/src/d3/continuous/AbstractBoxedShape3F.java | AbstractBoxedShape3F.inflate | public void inflate(double minx, double miny, double minz, double maxx, double maxy, double maxz) {
this.setFromCorners(this.getMinX()+ minx,this.getMinY()+ miny,this.getMinZ()+ minz,this.getMaxX()+ maxx,this.getMaxY()+ maxy,this.getMaxZ()+ maxz);
} | java | public void inflate(double minx, double miny, double minz, double maxx, double maxy, double maxz) {
this.setFromCorners(this.getMinX()+ minx,this.getMinY()+ miny,this.getMinZ()+ minz,this.getMaxX()+ maxx,this.getMaxY()+ maxy,this.getMaxZ()+ maxz);
} | [
"public",
"void",
"inflate",
"(",
"double",
"minx",
",",
"double",
"miny",
",",
"double",
"minz",
",",
"double",
"maxx",
",",
"double",
"maxy",
",",
"double",
"maxz",
")",
"{",
"this",
".",
"setFromCorners",
"(",
"this",
".",
"getMinX",
"(",
")",
"+",
... | Inflate this box with the given amounts.
@param minx
@param miny
@param minz
@param maxx
@param maxy
@param maxz | [
"Inflate",
"this",
"box",
"with",
"the",
"given",
"amounts",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/maths/mathgeom/tobeincluded/src/d3/continuous/AbstractBoxedShape3F.java#L319-L321 | train |
gallandarakhneorg/afc | core/maths/mathgeom/tobeincluded/src/d3/continuous/AlignedBox3d.java | AlignedBox3d.computeClosestPoint | @Pure
public static Point3d computeClosestPoint(
double minx, double miny, double minz,
double maxx, double maxy, double maxz,
double x, double y, double z) {
Point3d closest = new Point3d();
if (x < minx) {
closest.setX(minx);
}
else if (x > maxx) {
closest.setX(maxx);
}
else {
closest.setX(x);
}
if (y < miny) {
closest.setY(miny);
}
else if (y > maxy) {
closest.setY(maxy);
}
else {
closest.setY(y);
}
if (z < minz) {
closest.setZ(minz);
}
else if (z > maxz) {
closest.setZ(maxz);
}
else {
closest.setZ(z);
}
return closest;
} | java | @Pure
public static Point3d computeClosestPoint(
double minx, double miny, double minz,
double maxx, double maxy, double maxz,
double x, double y, double z) {
Point3d closest = new Point3d();
if (x < minx) {
closest.setX(minx);
}
else if (x > maxx) {
closest.setX(maxx);
}
else {
closest.setX(x);
}
if (y < miny) {
closest.setY(miny);
}
else if (y > maxy) {
closest.setY(maxy);
}
else {
closest.setY(y);
}
if (z < minz) {
closest.setZ(minz);
}
else if (z > maxz) {
closest.setZ(maxz);
}
else {
closest.setZ(z);
}
return closest;
} | [
"@",
"Pure",
"public",
"static",
"Point3d",
"computeClosestPoint",
"(",
"double",
"minx",
",",
"double",
"miny",
",",
"double",
"minz",
",",
"double",
"maxx",
",",
"double",
"maxy",
",",
"double",
"maxz",
",",
"double",
"x",
",",
"double",
"y",
",",
"dou... | Replies the point on the shape that is closest to the given point.
@param minx x coordinate of the lower point of the box.
@param miny y coordinate of the lower point of the box.
@param minz z coordinate of the lower point of the box.
@param maxx x coordinate of the upper point of the box.
@param maxy y coordinate of the upper point of the box.
@param maxz z coordinate of the upper point of the box.
@param x x coordinate of the point.
@param y y coordinate of the point.
@param z z coordinate of the point.
@return the closest point on the shape; or the point itself
if it is inside the shape. | [
"Replies",
"the",
"point",
"on",
"the",
"shape",
"that",
"is",
"closest",
"to",
"the",
"given",
"point",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/maths/mathgeom/tobeincluded/src/d3/continuous/AlignedBox3d.java#L60-L94 | train |
gallandarakhneorg/afc | core/maths/mathgeom/tobeincluded/src/d3/continuous/AlignedBox3d.java | AlignedBox3d.setMinX | @Override
public void setMinX(double x) {
double o = this.maxxProperty.doubleValue();
if (o<x) {
this.minxProperty.set(o);
this.maxxProperty.set(x);
}
else {
this.minxProperty.set(x);
}
} | java | @Override
public void setMinX(double x) {
double o = this.maxxProperty.doubleValue();
if (o<x) {
this.minxProperty.set(o);
this.maxxProperty.set(x);
}
else {
this.minxProperty.set(x);
}
} | [
"@",
"Override",
"public",
"void",
"setMinX",
"(",
"double",
"x",
")",
"{",
"double",
"o",
"=",
"this",
".",
"maxxProperty",
".",
"doubleValue",
"(",
")",
";",
"if",
"(",
"o",
"<",
"x",
")",
"{",
"this",
".",
"minxProperty",
".",
"set",
"(",
"o",
... | Set the min X.
@param x the min x. | [
"Set",
"the",
"min",
"X",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/maths/mathgeom/tobeincluded/src/d3/continuous/AlignedBox3d.java#L464-L474 | train |
gallandarakhneorg/afc | core/maths/mathgeom/tobeincluded/src/d3/continuous/AlignedBox3d.java | AlignedBox3d.setMaxX | @Override
public void setMaxX(double x) {
double o = this.minxProperty.doubleValue();
if (o>x) {
this.maxxProperty.set(o);
this.minxProperty.set(x);
}
else {
this.maxxProperty.set(x);
}
} | java | @Override
public void setMaxX(double x) {
double o = this.minxProperty.doubleValue();
if (o>x) {
this.maxxProperty.set(o);
this.minxProperty.set(x);
}
else {
this.maxxProperty.set(x);
}
} | [
"@",
"Override",
"public",
"void",
"setMaxX",
"(",
"double",
"x",
")",
"{",
"double",
"o",
"=",
"this",
".",
"minxProperty",
".",
"doubleValue",
"(",
")",
";",
"if",
"(",
"o",
">",
"x",
")",
"{",
"this",
".",
"maxxProperty",
".",
"set",
"(",
"o",
... | Set the max X.
@param x the max x. | [
"Set",
"the",
"max",
"X",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/maths/mathgeom/tobeincluded/src/d3/continuous/AlignedBox3d.java#L500-L510 | train |
gallandarakhneorg/afc | core/maths/mathgeom/tobeincluded/src/d3/continuous/AlignedBox3d.java | AlignedBox3d.setMaxY | @Override
public void setMaxY(double y) {
double o = this.minyProperty.doubleValue() ;
if (o>y) {
this.maxyProperty.set( o);
this.minyProperty.set(y);
}
else {
this.maxyProperty.set(y);
}
} | java | @Override
public void setMaxY(double y) {
double o = this.minyProperty.doubleValue() ;
if (o>y) {
this.maxyProperty.set( o);
this.minyProperty.set(y);
}
else {
this.maxyProperty.set(y);
}
} | [
"@",
"Override",
"public",
"void",
"setMaxY",
"(",
"double",
"y",
")",
"{",
"double",
"o",
"=",
"this",
".",
"minyProperty",
".",
"doubleValue",
"(",
")",
";",
"if",
"(",
"o",
">",
"y",
")",
"{",
"this",
".",
"maxyProperty",
".",
"set",
"(",
"o",
... | Set the max Y.
@param y the max y. | [
"Set",
"the",
"max",
"Y",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/maths/mathgeom/tobeincluded/src/d3/continuous/AlignedBox3d.java#L562-L572 | train |
gallandarakhneorg/afc | advanced/gis/gisinputoutput/src/main/java/org/arakhne/afc/gis/io/shape/MapElementGroup.java | MapElementGroup.classifiesElement | @Pure
public static ShapeElementType classifiesElement(MapElement element) {
final Class<? extends MapElement> type = element.getClass();
if (MapMultiPoint.class.isAssignableFrom(type)) {
return ShapeElementType.MULTIPOINT;
}
if (MapPolygon.class.isAssignableFrom(type)) {
return ShapeElementType.POLYGON;
}
if (MapPolyline.class.isAssignableFrom(type)) {
return ShapeElementType.POLYLINE;
}
if (MapPoint.class.isAssignableFrom(type)) {
return ShapeElementType.POINT;
}
return ShapeElementType.UNSUPPORTED;
} | java | @Pure
public static ShapeElementType classifiesElement(MapElement element) {
final Class<? extends MapElement> type = element.getClass();
if (MapMultiPoint.class.isAssignableFrom(type)) {
return ShapeElementType.MULTIPOINT;
}
if (MapPolygon.class.isAssignableFrom(type)) {
return ShapeElementType.POLYGON;
}
if (MapPolyline.class.isAssignableFrom(type)) {
return ShapeElementType.POLYLINE;
}
if (MapPoint.class.isAssignableFrom(type)) {
return ShapeElementType.POINT;
}
return ShapeElementType.UNSUPPORTED;
} | [
"@",
"Pure",
"public",
"static",
"ShapeElementType",
"classifiesElement",
"(",
"MapElement",
"element",
")",
"{",
"final",
"Class",
"<",
"?",
"extends",
"MapElement",
">",
"type",
"=",
"element",
".",
"getClass",
"(",
")",
";",
"if",
"(",
"MapMultiPoint",
".... | Replies the shape type that is corresponding to the given element.
@param element the element to classify.
@return the type of the element | [
"Replies",
"the",
"shape",
"type",
"that",
"is",
"corresponding",
"to",
"the",
"given",
"element",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/gisinputoutput/src/main/java/org/arakhne/afc/gis/io/shape/MapElementGroup.java#L79-L95 | train |
gallandarakhneorg/afc | advanced/gis/gisinputoutput/src/main/java/org/arakhne/afc/gis/io/shape/MapElementGroup.java | MapElementGroup.add | void add(MapElement element) {
final Rectangle2d r = element.getBoundingBox();
if (r != null) {
if (Double.isNaN(this.minx) || this.minx > r.getMinX()) {
this.minx = r.getMinX();
}
if (Double.isNaN(this.maxx) || this.maxx < r.getMaxX()) {
this.maxx = r.getMaxX();
}
if (Double.isNaN(this.miny) || this.miny > r.getMinY()) {
this.miny = r.getMinY();
}
if (Double.isNaN(this.maxy) || this.maxy < r.getMaxY()) {
this.maxy = r.getMaxY();
}
}
this.elements.add(element);
} | java | void add(MapElement element) {
final Rectangle2d r = element.getBoundingBox();
if (r != null) {
if (Double.isNaN(this.minx) || this.minx > r.getMinX()) {
this.minx = r.getMinX();
}
if (Double.isNaN(this.maxx) || this.maxx < r.getMaxX()) {
this.maxx = r.getMaxX();
}
if (Double.isNaN(this.miny) || this.miny > r.getMinY()) {
this.miny = r.getMinY();
}
if (Double.isNaN(this.maxy) || this.maxy < r.getMaxY()) {
this.maxy = r.getMaxY();
}
}
this.elements.add(element);
} | [
"void",
"add",
"(",
"MapElement",
"element",
")",
"{",
"final",
"Rectangle2d",
"r",
"=",
"element",
".",
"getBoundingBox",
"(",
")",
";",
"if",
"(",
"r",
"!=",
"null",
")",
"{",
"if",
"(",
"Double",
".",
"isNaN",
"(",
"this",
".",
"minx",
")",
"||"... | Add the given element into the group.
@param element the element to add. | [
"Add",
"the",
"given",
"element",
"into",
"the",
"group",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/gisinputoutput/src/main/java/org/arakhne/afc/gis/io/shape/MapElementGroup.java#L158-L175 | train |
gallandarakhneorg/afc | core/util/src/main/java/org/arakhne/afc/util/MultiCollection.java | MultiCollection.addCollection | public void addCollection(Collection<? extends E> collection) {
if (collection != null && !collection.isEmpty()) {
this.collections.add(collection);
}
} | java | public void addCollection(Collection<? extends E> collection) {
if (collection != null && !collection.isEmpty()) {
this.collections.add(collection);
}
} | [
"public",
"void",
"addCollection",
"(",
"Collection",
"<",
"?",
"extends",
"E",
">",
"collection",
")",
"{",
"if",
"(",
"collection",
"!=",
"null",
"&&",
"!",
"collection",
".",
"isEmpty",
"(",
")",
")",
"{",
"this",
".",
"collections",
".",
"add",
"("... | Add a collection inside this multicollection.
@param collection the collection to add. | [
"Add",
"a",
"collection",
"inside",
"this",
"multicollection",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/util/src/main/java/org/arakhne/afc/util/MultiCollection.java#L58-L62 | train |
gallandarakhneorg/afc | advanced/mathfx/src/main/java/org/arakhne/afc/math/geometry/d2/ifx/Point2ifx.java | Point2ifx.convert | public static Point2ifx convert(Tuple2D<?> tuple) {
if (tuple instanceof Point2ifx) {
return (Point2ifx) tuple;
}
return new Point2ifx(tuple.getX(), tuple.getY());
} | java | public static Point2ifx convert(Tuple2D<?> tuple) {
if (tuple instanceof Point2ifx) {
return (Point2ifx) tuple;
}
return new Point2ifx(tuple.getX(), tuple.getY());
} | [
"public",
"static",
"Point2ifx",
"convert",
"(",
"Tuple2D",
"<",
"?",
">",
"tuple",
")",
"{",
"if",
"(",
"tuple",
"instanceof",
"Point2ifx",
")",
"{",
"return",
"(",
"Point2ifx",
")",
"tuple",
";",
"}",
"return",
"new",
"Point2ifx",
"(",
"tuple",
".",
... | Convert the given tuple to a real Point2ifx.
<p>If the given tuple is already a Point2ifx, it is replied.
@param tuple the tuple.
@return the Point2ifx.
@since 14.0 | [
"Convert",
"the",
"given",
"tuple",
"to",
"a",
"real",
"Point2ifx",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/mathfx/src/main/java/org/arakhne/afc/math/geometry/d2/ifx/Point2ifx.java#L119-L124 | train |
lightblueseas/swing-components | src/main/java/de/alpharogroup/swing/table/model/GenericTableModel.java | GenericTableModel.remove | public T remove(final T row)
{
final int index = data.indexOf(row);
if (index != -1)
{
try
{
return data.remove(index);
}
finally
{
fireTableDataChanged();
}
}
return null;
} | java | public T remove(final T row)
{
final int index = data.indexOf(row);
if (index != -1)
{
try
{
return data.remove(index);
}
finally
{
fireTableDataChanged();
}
}
return null;
} | [
"public",
"T",
"remove",
"(",
"final",
"T",
"row",
")",
"{",
"final",
"int",
"index",
"=",
"data",
".",
"indexOf",
"(",
"row",
")",
";",
"if",
"(",
"index",
"!=",
"-",
"1",
")",
"{",
"try",
"{",
"return",
"data",
".",
"remove",
"(",
"index",
")... | Removes the given Object.
@param row
the row
@return the removed Object or null if the object is not in the tablemodel. | [
"Removes",
"the",
"given",
"Object",
"."
] | 4045e85cabd8f0ce985cbfff134c3c9873930c79 | https://github.com/lightblueseas/swing-components/blob/4045e85cabd8f0ce985cbfff134c3c9873930c79/src/main/java/de/alpharogroup/swing/table/model/GenericTableModel.java#L145-L161 | train |
lightblueseas/swing-components | src/main/java/de/alpharogroup/swing/table/model/GenericTableModel.java | GenericTableModel.removeAll | public List<T> removeAll(final List<T> toRemove)
{
final List<T> removedList = new ArrayList<>();
for (final T t : toRemove)
{
final int index = data.indexOf(t);
if (index != -1)
{
removedList.add(data.remove(index));
}
}
fireTableDataChanged();
return removedList;
} | java | public List<T> removeAll(final List<T> toRemove)
{
final List<T> removedList = new ArrayList<>();
for (final T t : toRemove)
{
final int index = data.indexOf(t);
if (index != -1)
{
removedList.add(data.remove(index));
}
}
fireTableDataChanged();
return removedList;
} | [
"public",
"List",
"<",
"T",
">",
"removeAll",
"(",
"final",
"List",
"<",
"T",
">",
"toRemove",
")",
"{",
"final",
"List",
"<",
"T",
">",
"removedList",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"for",
"(",
"final",
"T",
"t",
":",
"toRemove",
... | Removes the all the given Object.
@param toRemove
the to remove
@return the list the removed Objects. | [
"Removes",
"the",
"all",
"the",
"given",
"Object",
"."
] | 4045e85cabd8f0ce985cbfff134c3c9873930c79 | https://github.com/lightblueseas/swing-components/blob/4045e85cabd8f0ce985cbfff134c3c9873930c79/src/main/java/de/alpharogroup/swing/table/model/GenericTableModel.java#L191-L204 | train |
lightblueseas/swing-components | src/main/java/de/alpharogroup/swing/table/model/GenericTableModel.java | GenericTableModel.update | public void update(final T row)
{
final int index = data.indexOf(row);
if (index != -1)
{
data.set(index, row);
fireTableDataChanged();
}
} | java | public void update(final T row)
{
final int index = data.indexOf(row);
if (index != -1)
{
data.set(index, row);
fireTableDataChanged();
}
} | [
"public",
"void",
"update",
"(",
"final",
"T",
"row",
")",
"{",
"final",
"int",
"index",
"=",
"data",
".",
"indexOf",
"(",
"row",
")",
";",
"if",
"(",
"index",
"!=",
"-",
"1",
")",
"{",
"data",
".",
"set",
"(",
"index",
",",
"row",
")",
";",
... | Update the row.
@param row
the row | [
"Update",
"the",
"row",
"."
] | 4045e85cabd8f0ce985cbfff134c3c9873930c79 | https://github.com/lightblueseas/swing-components/blob/4045e85cabd8f0ce985cbfff134c3c9873930c79/src/main/java/de/alpharogroup/swing/table/model/GenericTableModel.java#L243-L251 | train |
gallandarakhneorg/afc | advanced/mathfx/src/main/java/org/arakhne/afc/math/geometry/d3/ifx/Point3ifx.java | Point3ifx.convert | public static Point3ifx convert(Tuple3D<?> tuple) {
if (tuple instanceof Point3ifx) {
return (Point3ifx) tuple;
}
return new Point3ifx(tuple.getX(), tuple.getY(), tuple.getZ());
} | java | public static Point3ifx convert(Tuple3D<?> tuple) {
if (tuple instanceof Point3ifx) {
return (Point3ifx) tuple;
}
return new Point3ifx(tuple.getX(), tuple.getY(), tuple.getZ());
} | [
"public",
"static",
"Point3ifx",
"convert",
"(",
"Tuple3D",
"<",
"?",
">",
"tuple",
")",
"{",
"if",
"(",
"tuple",
"instanceof",
"Point3ifx",
")",
"{",
"return",
"(",
"Point3ifx",
")",
"tuple",
";",
"}",
"return",
"new",
"Point3ifx",
"(",
"tuple",
".",
... | Convert the given tuple to a real Point3ifx.
<p>If the given tuple is already a Point3ifx, it is replied.
@param tuple the tuple.
@return the Point3ifx.
@since 14.0 | [
"Convert",
"the",
"given",
"tuple",
"to",
"a",
"real",
"Point3ifx",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/mathfx/src/main/java/org/arakhne/afc/math/geometry/d3/ifx/Point3ifx.java#L124-L129 | train |
gallandarakhneorg/afc | advanced/mathfx/src/main/java/org/arakhne/afc/math/geometry/d2/dfx/Triangle2dfx.java | Triangle2dfx.ccwProperty | @Pure
public ReadOnlyBooleanProperty ccwProperty() {
if (this.ccw == null) {
this.ccw = new ReadOnlyBooleanWrapper(this, MathFXAttributeNames.CCW);
this.ccw.bind(Bindings.createBooleanBinding(() ->
Triangle2afp.isCCW(
getX1(), getY1(), getX2(), getY2(),
getX3(), getY3()),
x1Property(), y1Property(),
x2Property(), y2Property(),
x3Property(), y3Property()));
}
return this.ccw.getReadOnlyProperty();
} | java | @Pure
public ReadOnlyBooleanProperty ccwProperty() {
if (this.ccw == null) {
this.ccw = new ReadOnlyBooleanWrapper(this, MathFXAttributeNames.CCW);
this.ccw.bind(Bindings.createBooleanBinding(() ->
Triangle2afp.isCCW(
getX1(), getY1(), getX2(), getY2(),
getX3(), getY3()),
x1Property(), y1Property(),
x2Property(), y2Property(),
x3Property(), y3Property()));
}
return this.ccw.getReadOnlyProperty();
} | [
"@",
"Pure",
"public",
"ReadOnlyBooleanProperty",
"ccwProperty",
"(",
")",
"{",
"if",
"(",
"this",
".",
"ccw",
"==",
"null",
")",
"{",
"this",
".",
"ccw",
"=",
"new",
"ReadOnlyBooleanWrapper",
"(",
"this",
",",
"MathFXAttributeNames",
".",
"CCW",
")",
";",... | Replies the property that indictes if the triangle's points are defined in a counter-clockwise order.
@return the ccw property. | [
"Replies",
"the",
"property",
"that",
"indictes",
"if",
"the",
"triangle",
"s",
"points",
"are",
"defined",
"in",
"a",
"counter",
"-",
"clockwise",
"order",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/mathfx/src/main/java/org/arakhne/afc/math/geometry/d2/dfx/Triangle2dfx.java#L305-L318 | train |
BBN-E/bue-common-open | common-core-open/src/main/java/com/bbn/bue/common/evaluation/SummaryConfusionMatrices.java | SummaryConfusionMatrices.chooseMostCommonRightHandClassAccuracy | public static final double chooseMostCommonRightHandClassAccuracy(SummaryConfusionMatrix m) {
final double total = m.sumOfallCells();
double max = 0.0;
for (final Symbol right : m.rightLabels()) {
max = Math.max(max, m.columnSum(right));
}
return DoubleUtils.XOverYOrZero(max, total);
} | java | public static final double chooseMostCommonRightHandClassAccuracy(SummaryConfusionMatrix m) {
final double total = m.sumOfallCells();
double max = 0.0;
for (final Symbol right : m.rightLabels()) {
max = Math.max(max, m.columnSum(right));
}
return DoubleUtils.XOverYOrZero(max, total);
} | [
"public",
"static",
"final",
"double",
"chooseMostCommonRightHandClassAccuracy",
"(",
"SummaryConfusionMatrix",
"m",
")",
"{",
"final",
"double",
"total",
"=",
"m",
".",
"sumOfallCells",
"(",
")",
";",
"double",
"max",
"=",
"0.0",
";",
"for",
"(",
"final",
"Sy... | Returns the maximum accuracy that would be achieved if a single classification were
selected for all instances. | [
"Returns",
"the",
"maximum",
"accuracy",
"that",
"would",
"be",
"achieved",
"if",
"a",
"single",
"classification",
"were",
"selected",
"for",
"all",
"instances",
"."
] | d618652674d647867306e2e4b987a21b7c29c015 | https://github.com/BBN-E/bue-common-open/blob/d618652674d647867306e2e4b987a21b7c29c015/common-core-open/src/main/java/com/bbn/bue/common/evaluation/SummaryConfusionMatrices.java#L138-L145 | train |
gallandarakhneorg/afc | advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/grid/GridCellElement.java | GridCellElement.consumeCells | public List<GridCell<P>> consumeCells() {
final List<GridCell<P>> list = new ArrayList<>(this.cells);
this.cells.clear();
return list;
} | java | public List<GridCell<P>> consumeCells() {
final List<GridCell<P>> list = new ArrayList<>(this.cells);
this.cells.clear();
return list;
} | [
"public",
"List",
"<",
"GridCell",
"<",
"P",
">",
">",
"consumeCells",
"(",
")",
"{",
"final",
"List",
"<",
"GridCell",
"<",
"P",
">",
">",
"list",
"=",
"new",
"ArrayList",
"<>",
"(",
"this",
".",
"cells",
")",
";",
"this",
".",
"cells",
".",
"cl... | Replies the cell on which the given element is located.
The cell links were removed from the element.
@return a copy of the cells. | [
"Replies",
"the",
"cell",
"on",
"which",
"the",
"given",
"element",
"is",
"located",
".",
"The",
"cell",
"links",
"were",
"removed",
"from",
"the",
"element",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/grid/GridCellElement.java#L88-L92 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.