repo stringlengths 7 58 | path stringlengths 12 218 | func_name stringlengths 3 140 | original_string stringlengths 73 34.1k | language stringclasses 1 value | code stringlengths 73 34.1k | code_tokens list | docstring stringlengths 3 16k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 105 339 | partition stringclasses 1 value |
|---|---|---|---|---|---|---|---|---|---|---|---|
gallandarakhneorg/afc | advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/grid/GridCellElement.java | GridCellElement.isReferenceCell | @Pure
public boolean isReferenceCell(GridCell<P> cell) {
return !this.cells.isEmpty() && this.cells.get(0) == cell;
} | java | @Pure
public boolean isReferenceCell(GridCell<P> cell) {
return !this.cells.isEmpty() && this.cells.get(0) == cell;
} | [
"@",
"Pure",
"public",
"boolean",
"isReferenceCell",
"(",
"GridCell",
"<",
"P",
">",
"cell",
")",
"{",
"return",
"!",
"this",
".",
"cells",
".",
"isEmpty",
"(",
")",
"&&",
"this",
".",
"cells",
".",
"get",
"(",
"0",
")",
"==",
"cell",
";",
"}"
] | Replies if the specified cell is the reference cell for the element.
The reference cell is the cell where the element is supported to
be attached when it is supposed by be inside only one cell.
@param cell is the cell to test
@return <code>true</code> if the specified cell is the reference cell;
<code>false</code> otherwise. | [
"Replies",
"if",
"the",
"specified",
"cell",
"is",
"the",
"reference",
"cell",
"for",
"the",
"element",
".",
"The",
"reference",
"cell",
"is",
"the",
"cell",
"where",
"the",
"element",
"is",
"supported",
"to",
"be",
"attached",
"when",
"it",
"is",
"suppose... | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/grid/GridCellElement.java#L102-L105 | train |
BBN-E/bue-common-open | common-core-open/src/main/java/com/bbn/bue/common/collections/ListUtils.java | ListUtils.shuffledCopy | public static <E> ImmutableList<E> shuffledCopy(List<? extends E> list, Random rng) {
final ArrayList<E> shuffled = Lists.newArrayList(list);
Collections.shuffle(shuffled, rng);
return ImmutableList.copyOf(shuffled);
} | java | public static <E> ImmutableList<E> shuffledCopy(List<? extends E> list, Random rng) {
final ArrayList<E> shuffled = Lists.newArrayList(list);
Collections.shuffle(shuffled, rng);
return ImmutableList.copyOf(shuffled);
} | [
"public",
"static",
"<",
"E",
">",
"ImmutableList",
"<",
"E",
">",
"shuffledCopy",
"(",
"List",
"<",
"?",
"extends",
"E",
">",
"list",
",",
"Random",
"rng",
")",
"{",
"final",
"ArrayList",
"<",
"E",
">",
"shuffled",
"=",
"Lists",
".",
"newArrayList",
... | Returns a shuffled copy of the provided list.
@param list the list to shuffle
@param rng random number generator to use
@return a shuffled copy of the list | [
"Returns",
"a",
"shuffled",
"copy",
"of",
"the",
"provided",
"list",
"."
] | d618652674d647867306e2e4b987a21b7c29c015 | https://github.com/BBN-E/bue-common-open/blob/d618652674d647867306e2e4b987a21b7c29c015/common-core-open/src/main/java/com/bbn/bue/common/collections/ListUtils.java#L46-L50 | train |
gallandarakhneorg/afc | maven/tag-replacer/src/main/java/org/arakhne/maven/plugins/tagreplacer/AbstractReplaceMojo.java | AbstractReplaceMojo.replaceInFileBuffered | protected synchronized void replaceInFileBuffered(File sourceFile, File targetFile, ReplacementType replacementType,
File[] classpath, boolean detectEncoding) throws MojoExecutionException {
if (this.replacementTreatedFiles.contains(targetFile)
&& targetFile.exists()) {
getLog().debug("Skiping " + targetFile //$NON-NLS-1$
+ " because is was already treated for replacements"); //$NON-NLS-1$
return;
}
replaceInFile(sourceFile, targetFile, replacementType, classpath, detectEncoding);
} | java | protected synchronized void replaceInFileBuffered(File sourceFile, File targetFile, ReplacementType replacementType,
File[] classpath, boolean detectEncoding) throws MojoExecutionException {
if (this.replacementTreatedFiles.contains(targetFile)
&& targetFile.exists()) {
getLog().debug("Skiping " + targetFile //$NON-NLS-1$
+ " because is was already treated for replacements"); //$NON-NLS-1$
return;
}
replaceInFile(sourceFile, targetFile, replacementType, classpath, detectEncoding);
} | [
"protected",
"synchronized",
"void",
"replaceInFileBuffered",
"(",
"File",
"sourceFile",
",",
"File",
"targetFile",
",",
"ReplacementType",
"replacementType",
",",
"File",
"[",
"]",
"classpath",
",",
"boolean",
"detectEncoding",
")",
"throws",
"MojoExecutionException",
... | Replace the Javadoc tags in the given file only if the file was never
treated before.
@param sourceFile
is the name of the file to read out. It may be <code>null</code>
@param targetFile
is the name of the file to write in. It cannot be <code>null</code>
@param replacementType
is the type of replacement to be done.
@param classpath
are the directories from which the file is extracted.
@param detectEncoding
when <code>true</code> the encoding of the file will be detected and preserved.
When <code>false</code> the encoding may be loose.
@throws MojoExecutionException on error.
@see #replaceInFile(File, File, ReplacementType, File[], boolean) | [
"Replace",
"the",
"Javadoc",
"tags",
"in",
"the",
"given",
"file",
"only",
"if",
"the",
"file",
"was",
"never",
"treated",
"before",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/maven/tag-replacer/src/main/java/org/arakhne/maven/plugins/tagreplacer/AbstractReplaceMojo.java#L311-L320 | train |
gallandarakhneorg/afc | maven/tag-replacer/src/main/java/org/arakhne/maven/plugins/tagreplacer/AbstractReplaceMojo.java | AbstractReplaceMojo.replaceAuthor | @SuppressWarnings("checkstyle:nestedifdepth")
protected synchronized String replaceAuthor(File sourceFile, int sourceLine, String text,
ExtendedArtifact artifact, ReplacementType replacementType) throws MojoExecutionException {
String result = text;
final Pattern p = buildMacroPatternWithGroup(Macros.MACRO_AUTHOR);
final Matcher m = p.matcher(text);
boolean hasResult = m.find();
if (hasResult) {
final StringBuffer sb = new StringBuffer();
final StringBuilder replacement = new StringBuilder();
String login;
URL url;
Contributor contributor;
do {
login = m.group(1);
if (login != null) {
login = login.trim();
if (login.length() > 0) {
replacement.setLength(0);
if (artifact != null) {
contributor = artifact.getPeople(login, getLog());
if (contributor != null) {
url = getContributorURL(contributor, getLog());
if (url == null) {
replacement.append(contributor.getName());
} else if (replacementType == ReplacementType.HTML) {
replacement.append("<a target=\"_blank\" href=\""); //$NON-NLS-1$
replacement.append(url.toExternalForm());
replacement.append("\">"); //$NON-NLS-1$
replacement.append(contributor.getName());
replacement.append("</a>"); //$NON-NLS-1$
} else {
replacement.append(contributor.getName());
replacement.append(" ["); //$NON-NLS-1$
replacement.append(url.toExternalForm());
replacement.append("]"); //$NON-NLS-1$
}
} else {
getBuildContext().addMessage(
sourceFile,
sourceLine, 1,
"unable to find a developer or a contributor " //$NON-NLS-1$
+ "with an id, a name or an email equal to: " //$NON-NLS-1$
+ login,
BuildContext.SEVERITY_WARNING, null);
}
}
if (replacement.length() != 0) {
m.appendReplacement(sb, Matcher.quoteReplacement(replacement.toString()));
}
} else {
getBuildContext().addMessage(
sourceFile,
sourceLine, 1,
"no login for Author tag: " + m.group(0), //$NON-NLS-1$
BuildContext.SEVERITY_WARNING, null);
}
} else {
getBuildContext().addMessage(
sourceFile,
sourceLine, 1,
"no login for Author tag: " + m.group(0), //$NON-NLS-1$
BuildContext.SEVERITY_WARNING, null);
}
hasResult = m.find();
} while (hasResult);
m.appendTail(sb);
result = sb.toString();
}
return result;
} | java | @SuppressWarnings("checkstyle:nestedifdepth")
protected synchronized String replaceAuthor(File sourceFile, int sourceLine, String text,
ExtendedArtifact artifact, ReplacementType replacementType) throws MojoExecutionException {
String result = text;
final Pattern p = buildMacroPatternWithGroup(Macros.MACRO_AUTHOR);
final Matcher m = p.matcher(text);
boolean hasResult = m.find();
if (hasResult) {
final StringBuffer sb = new StringBuffer();
final StringBuilder replacement = new StringBuilder();
String login;
URL url;
Contributor contributor;
do {
login = m.group(1);
if (login != null) {
login = login.trim();
if (login.length() > 0) {
replacement.setLength(0);
if (artifact != null) {
contributor = artifact.getPeople(login, getLog());
if (contributor != null) {
url = getContributorURL(contributor, getLog());
if (url == null) {
replacement.append(contributor.getName());
} else if (replacementType == ReplacementType.HTML) {
replacement.append("<a target=\"_blank\" href=\""); //$NON-NLS-1$
replacement.append(url.toExternalForm());
replacement.append("\">"); //$NON-NLS-1$
replacement.append(contributor.getName());
replacement.append("</a>"); //$NON-NLS-1$
} else {
replacement.append(contributor.getName());
replacement.append(" ["); //$NON-NLS-1$
replacement.append(url.toExternalForm());
replacement.append("]"); //$NON-NLS-1$
}
} else {
getBuildContext().addMessage(
sourceFile,
sourceLine, 1,
"unable to find a developer or a contributor " //$NON-NLS-1$
+ "with an id, a name or an email equal to: " //$NON-NLS-1$
+ login,
BuildContext.SEVERITY_WARNING, null);
}
}
if (replacement.length() != 0) {
m.appendReplacement(sb, Matcher.quoteReplacement(replacement.toString()));
}
} else {
getBuildContext().addMessage(
sourceFile,
sourceLine, 1,
"no login for Author tag: " + m.group(0), //$NON-NLS-1$
BuildContext.SEVERITY_WARNING, null);
}
} else {
getBuildContext().addMessage(
sourceFile,
sourceLine, 1,
"no login for Author tag: " + m.group(0), //$NON-NLS-1$
BuildContext.SEVERITY_WARNING, null);
}
hasResult = m.find();
} while (hasResult);
m.appendTail(sb);
result = sb.toString();
}
return result;
} | [
"@",
"SuppressWarnings",
"(",
"\"checkstyle:nestedifdepth\"",
")",
"protected",
"synchronized",
"String",
"replaceAuthor",
"(",
"File",
"sourceFile",
",",
"int",
"sourceLine",
",",
"String",
"text",
",",
"ExtendedArtifact",
"artifact",
",",
"ReplacementType",
"replaceme... | Replace the author information tags in the given text.
@param sourceFile
is the filename in which the replacement is done.
@param sourceLine
is the line at which the replacement is done.
@param text
is the text in which the author tags should be replaced
@param artifact the artifact.
@param replacementType
is the type of replacement.
@return the result of the replacement.
@throws MojoExecutionException on error. | [
"Replace",
"the",
"author",
"information",
"tags",
"in",
"the",
"given",
"text",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/maven/tag-replacer/src/main/java/org/arakhne/maven/plugins/tagreplacer/AbstractReplaceMojo.java#L532-L605 | train |
gallandarakhneorg/afc | maven/tag-replacer/src/main/java/org/arakhne/maven/plugins/tagreplacer/AbstractReplaceMojo.java | AbstractReplaceMojo.replaceProp | @SuppressWarnings("checkstyle:nestedifdepth")
protected synchronized String replaceProp(File sourceFile, int sourceLine, String text,
MavenProject project, ReplacementType replacementType) throws MojoExecutionException {
String result = text;
final Pattern p = buildMacroPatternWithGroup(Macros.MACRO_PROP);
final Matcher m = p.matcher(text);
boolean hasResult = m.find();
Properties props = null;
if (project != null) {
props = project.getProperties();
}
if (hasResult) {
final StringBuffer sb = new StringBuffer();
final StringBuilder replacement = new StringBuilder();
String propName;
do {
propName = m.group(1);
if (propName != null) {
propName = propName.trim();
if (propName.length() > 0) {
replacement.setLength(0);
if (props != null) {
final String value = props.getProperty(propName);
if (value != null && !value.isEmpty()) {
replacement.append(value);
}
}
if (replacement.length() != 0) {
m.appendReplacement(sb, Matcher.quoteReplacement(replacement.toString()));
}
} else {
getBuildContext().addMessage(
sourceFile,
sourceLine, 1,
"no property name for Prop tag: " + m.group(0), //$NON-NLS-1$
BuildContext.SEVERITY_WARNING, null);
}
} else {
getBuildContext().addMessage(
sourceFile,
sourceLine, 1,
"no property name for Prop tag: " + m.group(0), //$NON-NLS-1$
BuildContext.SEVERITY_WARNING, null);
}
hasResult = m.find();
}
while (hasResult);
m.appendTail(sb);
result = sb.toString();
}
return result;
} | java | @SuppressWarnings("checkstyle:nestedifdepth")
protected synchronized String replaceProp(File sourceFile, int sourceLine, String text,
MavenProject project, ReplacementType replacementType) throws MojoExecutionException {
String result = text;
final Pattern p = buildMacroPatternWithGroup(Macros.MACRO_PROP);
final Matcher m = p.matcher(text);
boolean hasResult = m.find();
Properties props = null;
if (project != null) {
props = project.getProperties();
}
if (hasResult) {
final StringBuffer sb = new StringBuffer();
final StringBuilder replacement = new StringBuilder();
String propName;
do {
propName = m.group(1);
if (propName != null) {
propName = propName.trim();
if (propName.length() > 0) {
replacement.setLength(0);
if (props != null) {
final String value = props.getProperty(propName);
if (value != null && !value.isEmpty()) {
replacement.append(value);
}
}
if (replacement.length() != 0) {
m.appendReplacement(sb, Matcher.quoteReplacement(replacement.toString()));
}
} else {
getBuildContext().addMessage(
sourceFile,
sourceLine, 1,
"no property name for Prop tag: " + m.group(0), //$NON-NLS-1$
BuildContext.SEVERITY_WARNING, null);
}
} else {
getBuildContext().addMessage(
sourceFile,
sourceLine, 1,
"no property name for Prop tag: " + m.group(0), //$NON-NLS-1$
BuildContext.SEVERITY_WARNING, null);
}
hasResult = m.find();
}
while (hasResult);
m.appendTail(sb);
result = sb.toString();
}
return result;
} | [
"@",
"SuppressWarnings",
"(",
"\"checkstyle:nestedifdepth\"",
")",
"protected",
"synchronized",
"String",
"replaceProp",
"(",
"File",
"sourceFile",
",",
"int",
"sourceLine",
",",
"String",
"text",
",",
"MavenProject",
"project",
",",
"ReplacementType",
"replacementType"... | Replace the property information tags in the given text.
@param sourceFile
is the filename in which the replacement is done.
@param sourceLine
is the line at which the replacement is done.
@param text
is the text in which the author tags should be replaced
@param project the project.
@param replacementType
is the type of replacement.
@return the result of the replacement.
@throws MojoExecutionException on error. | [
"Replace",
"the",
"property",
"information",
"tags",
"in",
"the",
"given",
"text",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/maven/tag-replacer/src/main/java/org/arakhne/maven/plugins/tagreplacer/AbstractReplaceMojo.java#L622-L677 | train |
gallandarakhneorg/afc | maven/tag-replacer/src/main/java/org/arakhne/maven/plugins/tagreplacer/AbstractReplaceMojo.java | AbstractReplaceMojo.setSourceDirectoryForAllMojo | protected void setSourceDirectoryForAllMojo(File newSourceDirectory) {
final List<String> sourceRoots = this.mavenProject.getCompileSourceRoots();
getLog().debug("Old source roots: " + sourceRoots.toString()); //$NON-NLS-1$
final Iterator<String> iterator = sourceRoots.iterator();
final String removableSourcePath = this.javaSourceRoot.getAbsolutePath();
getLog().debug("Removable source root: " + removableSourcePath); //$NON-NLS-1$
String path;
while (iterator.hasNext()) {
path = iterator.next();
if (path != null && path.equals(removableSourcePath)) {
getLog().debug("Removing source root: " + path); //$NON-NLS-1$
iterator.remove();
}
}
getLog().debug("Adding source root: " + newSourceDirectory.getAbsolutePath()); //$NON-NLS-1$
this.mavenProject.addCompileSourceRoot(newSourceDirectory.toString());
this.sourceDirectory = newSourceDirectory;
} | java | protected void setSourceDirectoryForAllMojo(File newSourceDirectory) {
final List<String> sourceRoots = this.mavenProject.getCompileSourceRoots();
getLog().debug("Old source roots: " + sourceRoots.toString()); //$NON-NLS-1$
final Iterator<String> iterator = sourceRoots.iterator();
final String removableSourcePath = this.javaSourceRoot.getAbsolutePath();
getLog().debug("Removable source root: " + removableSourcePath); //$NON-NLS-1$
String path;
while (iterator.hasNext()) {
path = iterator.next();
if (path != null && path.equals(removableSourcePath)) {
getLog().debug("Removing source root: " + path); //$NON-NLS-1$
iterator.remove();
}
}
getLog().debug("Adding source root: " + newSourceDirectory.getAbsolutePath()); //$NON-NLS-1$
this.mavenProject.addCompileSourceRoot(newSourceDirectory.toString());
this.sourceDirectory = newSourceDirectory;
} | [
"protected",
"void",
"setSourceDirectoryForAllMojo",
"(",
"File",
"newSourceDirectory",
")",
"{",
"final",
"List",
"<",
"String",
">",
"sourceRoots",
"=",
"this",
".",
"mavenProject",
".",
"getCompileSourceRoots",
"(",
")",
";",
"getLog",
"(",
")",
".",
"debug",... | Replace the current source directory by the given directory.
<p>CAUTION: this function override the source directory for all
the Maven plugins. Invoking this function may cause failures
in other maven plugins.
@param newSourceDirectory the directory. | [
"Replace",
"the",
"current",
"source",
"directory",
"by",
"the",
"given",
"directory",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/maven/tag-replacer/src/main/java/org/arakhne/maven/plugins/tagreplacer/AbstractReplaceMojo.java#L844-L861 | train |
BBN-E/bue-common-open | common-core-open/src/main/java/com/bbn/bue/common/strings/offsets/OffsetRange.java | OffsetRange.charOffsetsOfWholeString | public static Optional<OffsetRange<CharOffset>> charOffsetsOfWholeString(String s) {
if (s.isEmpty()) {
return Optional.absent();
}
return Optional.of(charOffsetRange(0, s.length() - 1));
} | java | public static Optional<OffsetRange<CharOffset>> charOffsetsOfWholeString(String s) {
if (s.isEmpty()) {
return Optional.absent();
}
return Optional.of(charOffsetRange(0, s.length() - 1));
} | [
"public",
"static",
"Optional",
"<",
"OffsetRange",
"<",
"CharOffset",
">",
">",
"charOffsetsOfWholeString",
"(",
"String",
"s",
")",
"{",
"if",
"(",
"s",
".",
"isEmpty",
"(",
")",
")",
"{",
"return",
"Optional",
".",
"absent",
"(",
")",
";",
"}",
"ret... | This returns optional because it is not possible to represent an empty offset span | [
"This",
"returns",
"optional",
"because",
"it",
"is",
"not",
"possible",
"to",
"represent",
"an",
"empty",
"offset",
"span"
] | d618652674d647867306e2e4b987a21b7c29c015 | https://github.com/BBN-E/bue-common-open/blob/d618652674d647867306e2e4b987a21b7c29c015/common-core-open/src/main/java/com/bbn/bue/common/strings/offsets/OffsetRange.java#L169-L174 | train |
BBN-E/bue-common-open | common-core-open/src/main/java/com/bbn/bue/common/strings/offsets/OffsetRange.java | OffsetRange.contains | public boolean contains(final OffsetType x) {
return x.asInt() >= startInclusive().asInt() && x.asInt() <= endInclusive().asInt();
} | java | public boolean contains(final OffsetType x) {
return x.asInt() >= startInclusive().asInt() && x.asInt() <= endInclusive().asInt();
} | [
"public",
"boolean",
"contains",
"(",
"final",
"OffsetType",
"x",
")",
"{",
"return",
"x",
".",
"asInt",
"(",
")",
">=",
"startInclusive",
"(",
")",
".",
"asInt",
"(",
")",
"&&",
"x",
".",
"asInt",
"(",
")",
"<=",
"endInclusive",
"(",
")",
".",
"as... | Returns if the given offset is within the inclusive bounds of this range. | [
"Returns",
"if",
"the",
"given",
"offset",
"is",
"within",
"the",
"inclusive",
"bounds",
"of",
"this",
"range",
"."
] | d618652674d647867306e2e4b987a21b7c29c015 | https://github.com/BBN-E/bue-common-open/blob/d618652674d647867306e2e4b987a21b7c29c015/common-core-open/src/main/java/com/bbn/bue/common/strings/offsets/OffsetRange.java#L204-L206 | train |
gallandarakhneorg/afc | core/vmutils/src/main/java/org/arakhne/afc/vmutil/ColorNames.java | ColorNames.getColorFromName | @Pure
public static int getColorFromName(String colorName, int defaultValue) {
final Integer value = COLOR_MATCHES.get(Strings.nullToEmpty(colorName).toLowerCase());
if (value != null) {
return value.intValue();
}
return defaultValue;
} | java | @Pure
public static int getColorFromName(String colorName, int defaultValue) {
final Integer value = COLOR_MATCHES.get(Strings.nullToEmpty(colorName).toLowerCase());
if (value != null) {
return value.intValue();
}
return defaultValue;
} | [
"@",
"Pure",
"public",
"static",
"int",
"getColorFromName",
"(",
"String",
"colorName",
",",
"int",
"defaultValue",
")",
"{",
"final",
"Integer",
"value",
"=",
"COLOR_MATCHES",
".",
"get",
"(",
"Strings",
".",
"nullToEmpty",
"(",
"colorName",
")",
".",
"toLo... | Replies the color value for the given color name.
<p>See the documentation of the {@link #ColorNames} type for obtaining a list of the colors.
@param colorName the color name.
@param defaultValue if the given name does not corresponds to a known color, this value is replied.
@return the color value. | [
"Replies",
"the",
"color",
"value",
"for",
"the",
"given",
"color",
"name",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/vmutils/src/main/java/org/arakhne/afc/vmutil/ColorNames.java#L541-L548 | train |
gallandarakhneorg/afc | core/vmutils/src/main/java/org/arakhne/afc/vmutil/ColorNames.java | ColorNames.getColorNameFromValue | @Pure
public static String getColorNameFromValue(int colorValue) {
for (final Entry<String, Integer> entry : COLOR_MATCHES.entrySet()) {
final int knownValue = entry.getValue().intValue();
if (colorValue == knownValue) {
return entry.getKey();
}
}
return null;
} | java | @Pure
public static String getColorNameFromValue(int colorValue) {
for (final Entry<String, Integer> entry : COLOR_MATCHES.entrySet()) {
final int knownValue = entry.getValue().intValue();
if (colorValue == knownValue) {
return entry.getKey();
}
}
return null;
} | [
"@",
"Pure",
"public",
"static",
"String",
"getColorNameFromValue",
"(",
"int",
"colorValue",
")",
"{",
"for",
"(",
"final",
"Entry",
"<",
"String",
",",
"Integer",
">",
"entry",
":",
"COLOR_MATCHES",
".",
"entrySet",
"(",
")",
")",
"{",
"final",
"int",
... | Replies the color name for the given color value.
<p>See the documentation of the {@link #ColorNames} type for obtaining a list of the colors.
@param colorValue the color value.
@return the color name, or {@code null} if the value does not correspond to an known color. | [
"Replies",
"the",
"color",
"name",
"for",
"the",
"given",
"color",
"value",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/vmutils/src/main/java/org/arakhne/afc/vmutil/ColorNames.java#L569-L578 | train |
gallandarakhneorg/afc | advanced/gis/gisroad/src/main/java/org/arakhne/afc/gis/road/path/ClusteredRoadPath.java | ClusteredRoadPath.getLength | @Pure
public double getLength() {
double length = 0;
for (final RoadPath p : this.paths) {
length += p.getLength();
}
return length;
} | java | @Pure
public double getLength() {
double length = 0;
for (final RoadPath p : this.paths) {
length += p.getLength();
}
return length;
} | [
"@",
"Pure",
"public",
"double",
"getLength",
"(",
")",
"{",
"double",
"length",
"=",
"0",
";",
"for",
"(",
"final",
"RoadPath",
"p",
":",
"this",
".",
"paths",
")",
"{",
"length",
"+=",
"p",
".",
"getLength",
"(",
")",
";",
"}",
"return",
"length"... | Replies the length of the path.
@return the length of the path. | [
"Replies",
"the",
"length",
"of",
"the",
"path",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/gisroad/src/main/java/org/arakhne/afc/gis/road/path/ClusteredRoadPath.java#L88-L95 | train |
gallandarakhneorg/afc | advanced/gis/gisroad/src/main/java/org/arakhne/afc/gis/road/path/ClusteredRoadPath.java | ClusteredRoadPath.indexOf | @Pure
public int indexOf(RoadSegment segment) {
int count = 0;
int index;
for (final RoadPath p : this.paths) {
index = p.indexOf(segment);
if (index >= 0) {
return count + index;
}
count += p.size();
}
return -1;
} | java | @Pure
public int indexOf(RoadSegment segment) {
int count = 0;
int index;
for (final RoadPath p : this.paths) {
index = p.indexOf(segment);
if (index >= 0) {
return count + index;
}
count += p.size();
}
return -1;
} | [
"@",
"Pure",
"public",
"int",
"indexOf",
"(",
"RoadSegment",
"segment",
")",
"{",
"int",
"count",
"=",
"0",
";",
"int",
"index",
";",
"for",
"(",
"final",
"RoadPath",
"p",
":",
"this",
".",
"paths",
")",
"{",
"index",
"=",
"p",
".",
"indexOf",
"(",... | Replies the index of the first occurrence. of the given road segment.
@param segment a segment.
@return the index of the first occurrence. of the given road segment or
<code>-1</code> if the road segment was not found. | [
"Replies",
"the",
"index",
"of",
"the",
"first",
"occurrence",
".",
"of",
"the",
"given",
"road",
"segment",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/gisroad/src/main/java/org/arakhne/afc/gis/road/path/ClusteredRoadPath.java#L150-L162 | train |
gallandarakhneorg/afc | advanced/gis/gisroad/src/main/java/org/arakhne/afc/gis/road/path/ClusteredRoadPath.java | ClusteredRoadPath.lastIndexOf | @Pure
public int lastIndexOf(RoadSegment segment) {
int count = 0;
int index;
int lastIndex = -1;
for (final RoadPath p : this.paths) {
index = p.lastIndexOf(segment);
if (index >= 0) {
lastIndex = count + index;
}
count += p.size();
}
return lastIndex;
} | java | @Pure
public int lastIndexOf(RoadSegment segment) {
int count = 0;
int index;
int lastIndex = -1;
for (final RoadPath p : this.paths) {
index = p.lastIndexOf(segment);
if (index >= 0) {
lastIndex = count + index;
}
count += p.size();
}
return lastIndex;
} | [
"@",
"Pure",
"public",
"int",
"lastIndexOf",
"(",
"RoadSegment",
"segment",
")",
"{",
"int",
"count",
"=",
"0",
";",
"int",
"index",
";",
"int",
"lastIndex",
"=",
"-",
"1",
";",
"for",
"(",
"final",
"RoadPath",
"p",
":",
"this",
".",
"paths",
")",
... | Replies the index of the last occurrence. of the given road segment.
@param segment a segment.
@return the index of the last occurrence. of the given road segment or
<code>-1</code> if the road segment was not found. | [
"Replies",
"the",
"index",
"of",
"the",
"last",
"occurrence",
".",
"of",
"the",
"given",
"road",
"segment",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/gisroad/src/main/java/org/arakhne/afc/gis/road/path/ClusteredRoadPath.java#L170-L183 | train |
gallandarakhneorg/afc | advanced/gis/gisroad/src/main/java/org/arakhne/afc/gis/road/path/ClusteredRoadPath.java | ClusteredRoadPath.getRoadSegmentAt | @Pure
public RoadSegment getRoadSegmentAt(int index) {
if (index >= 0) {
int b = 0;
for (final RoadPath p : this.paths) {
final int e = b + p.size();
if (index < e) {
return p.get(index - b);
}
b = e;
}
}
throw new IndexOutOfBoundsException();
} | java | @Pure
public RoadSegment getRoadSegmentAt(int index) {
if (index >= 0) {
int b = 0;
for (final RoadPath p : this.paths) {
final int e = b + p.size();
if (index < e) {
return p.get(index - b);
}
b = e;
}
}
throw new IndexOutOfBoundsException();
} | [
"@",
"Pure",
"public",
"RoadSegment",
"getRoadSegmentAt",
"(",
"int",
"index",
")",
"{",
"if",
"(",
"index",
">=",
"0",
")",
"{",
"int",
"b",
"=",
"0",
";",
"for",
"(",
"final",
"RoadPath",
"p",
":",
"this",
".",
"paths",
")",
"{",
"final",
"int",
... | Replies the road segment at the given index.
@param index an index.
@return the road segment. | [
"Replies",
"the",
"road",
"segment",
"at",
"the",
"given",
"index",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/gisroad/src/main/java/org/arakhne/afc/gis/road/path/ClusteredRoadPath.java#L190-L203 | train |
gallandarakhneorg/afc | advanced/gis/gisroad/src/main/java/org/arakhne/afc/gis/road/path/ClusteredRoadPath.java | ClusteredRoadPath.getPathForRoadSegmentAt | @Pure
public RoadPath getPathForRoadSegmentAt(int index) {
if (index >= 0) {
int b = 0;
for (final RoadPath p : this.paths) {
final int e = b + p.size();
if (index < e) {
return p;
}
b = e;
}
}
throw new IndexOutOfBoundsException();
} | java | @Pure
public RoadPath getPathForRoadSegmentAt(int index) {
if (index >= 0) {
int b = 0;
for (final RoadPath p : this.paths) {
final int e = b + p.size();
if (index < e) {
return p;
}
b = e;
}
}
throw new IndexOutOfBoundsException();
} | [
"@",
"Pure",
"public",
"RoadPath",
"getPathForRoadSegmentAt",
"(",
"int",
"index",
")",
"{",
"if",
"(",
"index",
">=",
"0",
")",
"{",
"int",
"b",
"=",
"0",
";",
"for",
"(",
"final",
"RoadPath",
"p",
":",
"this",
".",
"paths",
")",
"{",
"final",
"in... | Replies the road path which is containing the road segment
at the given index.
@param index is the index of the road segment.
@return the road path, never <code>null</code>. | [
"Replies",
"the",
"road",
"path",
"which",
"is",
"containing",
"the",
"road",
"segment",
"at",
"the",
"given",
"index",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/gisroad/src/main/java/org/arakhne/afc/gis/road/path/ClusteredRoadPath.java#L211-L224 | train |
gallandarakhneorg/afc | advanced/gis/gisroad/src/main/java/org/arakhne/afc/gis/road/path/ClusteredRoadPath.java | ClusteredRoadPath.removeRoadSegmentAt | public RoadSegment removeRoadSegmentAt(int index) {
if (index >= 0) {
int b = 0;
for (final RoadPath p : this.paths) {
int end = b + p.size();
if (index < end) {
end = index - b;
return removeRoadSegmentAt(p, end, null);
}
b = end;
}
}
throw new IndexOutOfBoundsException();
} | java | public RoadSegment removeRoadSegmentAt(int index) {
if (index >= 0) {
int b = 0;
for (final RoadPath p : this.paths) {
int end = b + p.size();
if (index < end) {
end = index - b;
return removeRoadSegmentAt(p, end, null);
}
b = end;
}
}
throw new IndexOutOfBoundsException();
} | [
"public",
"RoadSegment",
"removeRoadSegmentAt",
"(",
"int",
"index",
")",
"{",
"if",
"(",
"index",
">=",
"0",
")",
"{",
"int",
"b",
"=",
"0",
";",
"for",
"(",
"final",
"RoadPath",
"p",
":",
"this",
".",
"paths",
")",
"{",
"int",
"end",
"=",
"b",
... | Remove the road segment at the given index.
@param index an index.
@return the removed road segment. | [
"Remove",
"the",
"road",
"segment",
"at",
"the",
"given",
"index",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/gisroad/src/main/java/org/arakhne/afc/gis/road/path/ClusteredRoadPath.java#L255-L268 | train |
gallandarakhneorg/afc | advanced/gis/gisroad/src/main/java/org/arakhne/afc/gis/road/path/ClusteredRoadPath.java | ClusteredRoadPath.removeRoadSegmentAt | private RoadSegment removeRoadSegmentAt(RoadPath path, int index, PathIterator iterator) {
final int pathIndex = this.paths.indexOf(path);
assert pathIndex >= 0 && pathIndex < this.paths.size();
assert index >= 0 && index < path.size();
final RoadPath syncPath;
final RoadSegment sgmt;
if (index == 0 || index == path.size() - 1) {
// Remove one of the bounds of the path. if cause
// minimal insertion changes in the clustered road-path
sgmt = path.remove(index);
} else {
// Split the path somewhere between the first and last positions
sgmt = path.get(index);
assert sgmt != null;
final RoadPath rest = path.splitAfter(sgmt);
path.remove(sgmt);
if (rest != null && !rest.isEmpty()) {
// put back the rest of the segments
this.paths.add(pathIndex + 1, rest);
}
}
--this.segmentCount;
if (path.isEmpty()) {
this.paths.remove(path);
if (pathIndex > 0) {
syncPath = this.paths.get(pathIndex - 1);
} else {
syncPath = null;
}
} else {
syncPath = path;
}
if (iterator != null) {
iterator.reset(syncPath);
}
return sgmt;
} | java | private RoadSegment removeRoadSegmentAt(RoadPath path, int index, PathIterator iterator) {
final int pathIndex = this.paths.indexOf(path);
assert pathIndex >= 0 && pathIndex < this.paths.size();
assert index >= 0 && index < path.size();
final RoadPath syncPath;
final RoadSegment sgmt;
if (index == 0 || index == path.size() - 1) {
// Remove one of the bounds of the path. if cause
// minimal insertion changes in the clustered road-path
sgmt = path.remove(index);
} else {
// Split the path somewhere between the first and last positions
sgmt = path.get(index);
assert sgmt != null;
final RoadPath rest = path.splitAfter(sgmt);
path.remove(sgmt);
if (rest != null && !rest.isEmpty()) {
// put back the rest of the segments
this.paths.add(pathIndex + 1, rest);
}
}
--this.segmentCount;
if (path.isEmpty()) {
this.paths.remove(path);
if (pathIndex > 0) {
syncPath = this.paths.get(pathIndex - 1);
} else {
syncPath = null;
}
} else {
syncPath = path;
}
if (iterator != null) {
iterator.reset(syncPath);
}
return sgmt;
} | [
"private",
"RoadSegment",
"removeRoadSegmentAt",
"(",
"RoadPath",
"path",
",",
"int",
"index",
",",
"PathIterator",
"iterator",
")",
"{",
"final",
"int",
"pathIndex",
"=",
"this",
".",
"paths",
".",
"indexOf",
"(",
"path",
")",
";",
"assert",
"pathIndex",
">... | Remove the road segment at the given index in the given path.
<p>The given path must be inside the clustered road-path.
The given index is inside the path's segments.
@param path a path.
@param index an index.
@param iterator an iterator.
@return the removed segment, never <code>null</code>. | [
"Remove",
"the",
"road",
"segment",
"at",
"the",
"given",
"index",
"in",
"the",
"given",
"path",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/gisroad/src/main/java/org/arakhne/afc/gis/road/path/ClusteredRoadPath.java#L280-L316 | train |
gallandarakhneorg/afc | advanced/gis/gisroad/src/main/java/org/arakhne/afc/gis/road/path/ClusteredRoadPath.java | ClusteredRoadPath.addAndGetPath | @SuppressWarnings({"checkstyle:cyclomaticcomplexity", "checkstyle:npathcomplexity",
"checkstyle:nestedifdepth"})
public RoadPath addAndGetPath(RoadPath end) {
RoadPath selectedPath = null;
if (end != null && !end.isEmpty()) {
RoadConnection first = end.getFirstPoint();
RoadConnection last = end.getLastPoint();
assert first != null;
assert last != null;
first = first.getWrappedRoadConnection();
last = last.getWrappedRoadConnection();
assert first != null;
assert last != null;
if (this.paths.isEmpty()) {
this.paths.add(end);
selectedPath = end;
} else {
RoadPath connectToFirst = null;
RoadPath connectToLast = null;
final Iterator<RoadPath> pathIterator = this.paths.iterator();
RoadPath path;
while ((connectToFirst == null || connectToLast == null) && pathIterator.hasNext()) {
path = pathIterator.next();
if (connectToFirst == null) {
if (first.equals(path.getFirstPoint())) {
connectToFirst = path;
} else if (first.equals(path.getLastPoint())) {
connectToFirst = path;
}
}
if (connectToLast == null) {
if (last.equals(path.getFirstPoint())) {
connectToLast = path;
} else if (last.equals(path.getLastPoint())) {
connectToLast = path;
}
}
}
if (connectToFirst != null && connectToLast != null && !connectToLast.equals(connectToFirst)) {
// a) Select the biggest path as reference
// b) Remove the nonreference path that is connected to the new path
// c) Add the components of the new path into the reference path
// d) Reinject the components of the nonreference path.
// --
// a)
final RoadPath reference;
final RoadPath nonreference;
if (connectToFirst.size() > connectToLast.size()) {
reference = connectToFirst;
nonreference = connectToLast;
} else {
reference = connectToLast;
nonreference = connectToFirst;
}
// b)
if (this.paths.remove(nonreference)) {
// c)
if (!RoadPath.addPathToPath(reference, end)) {
// Reinject the remove elements.
this.paths.add(nonreference);
} else {
// d)
if (!RoadPath.addPathToPath(reference, nonreference)) {
// Reinject the remove elements.
this.paths.add(nonreference);
} else {
selectedPath = reference;
}
}
}
} else if (connectToFirst != null) {
if (RoadPath.addPathToPath(connectToFirst, end)) {
selectedPath = connectToFirst;
}
} else if (connectToLast != null) {
if (RoadPath.addPathToPath(connectToLast, end)) {
selectedPath = connectToLast;
}
} else if (this.paths.add(end)) {
selectedPath = end;
}
}
if (selectedPath != null) {
this.segmentCount += end.size();
}
}
return selectedPath;
} | java | @SuppressWarnings({"checkstyle:cyclomaticcomplexity", "checkstyle:npathcomplexity",
"checkstyle:nestedifdepth"})
public RoadPath addAndGetPath(RoadPath end) {
RoadPath selectedPath = null;
if (end != null && !end.isEmpty()) {
RoadConnection first = end.getFirstPoint();
RoadConnection last = end.getLastPoint();
assert first != null;
assert last != null;
first = first.getWrappedRoadConnection();
last = last.getWrappedRoadConnection();
assert first != null;
assert last != null;
if (this.paths.isEmpty()) {
this.paths.add(end);
selectedPath = end;
} else {
RoadPath connectToFirst = null;
RoadPath connectToLast = null;
final Iterator<RoadPath> pathIterator = this.paths.iterator();
RoadPath path;
while ((connectToFirst == null || connectToLast == null) && pathIterator.hasNext()) {
path = pathIterator.next();
if (connectToFirst == null) {
if (first.equals(path.getFirstPoint())) {
connectToFirst = path;
} else if (first.equals(path.getLastPoint())) {
connectToFirst = path;
}
}
if (connectToLast == null) {
if (last.equals(path.getFirstPoint())) {
connectToLast = path;
} else if (last.equals(path.getLastPoint())) {
connectToLast = path;
}
}
}
if (connectToFirst != null && connectToLast != null && !connectToLast.equals(connectToFirst)) {
// a) Select the biggest path as reference
// b) Remove the nonreference path that is connected to the new path
// c) Add the components of the new path into the reference path
// d) Reinject the components of the nonreference path.
// --
// a)
final RoadPath reference;
final RoadPath nonreference;
if (connectToFirst.size() > connectToLast.size()) {
reference = connectToFirst;
nonreference = connectToLast;
} else {
reference = connectToLast;
nonreference = connectToFirst;
}
// b)
if (this.paths.remove(nonreference)) {
// c)
if (!RoadPath.addPathToPath(reference, end)) {
// Reinject the remove elements.
this.paths.add(nonreference);
} else {
// d)
if (!RoadPath.addPathToPath(reference, nonreference)) {
// Reinject the remove elements.
this.paths.add(nonreference);
} else {
selectedPath = reference;
}
}
}
} else if (connectToFirst != null) {
if (RoadPath.addPathToPath(connectToFirst, end)) {
selectedPath = connectToFirst;
}
} else if (connectToLast != null) {
if (RoadPath.addPathToPath(connectToLast, end)) {
selectedPath = connectToLast;
}
} else if (this.paths.add(end)) {
selectedPath = end;
}
}
if (selectedPath != null) {
this.segmentCount += end.size();
}
}
return selectedPath;
} | [
"@",
"SuppressWarnings",
"(",
"{",
"\"checkstyle:cyclomaticcomplexity\"",
",",
"\"checkstyle:npathcomplexity\"",
",",
"\"checkstyle:nestedifdepth\"",
"}",
")",
"public",
"RoadPath",
"addAndGetPath",
"(",
"RoadPath",
"end",
")",
"{",
"RoadPath",
"selectedPath",
"=",
"null"... | Add the given road path into this cluster of road paths.
@param end is the road path to add
@return the road path inside which the road segments are added; it could
be <var>e</var> itself; return <code>null</code> if the elements cannot be
added. | [
"Add",
"the",
"given",
"road",
"path",
"into",
"this",
"cluster",
"of",
"road",
"paths",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/gisroad/src/main/java/org/arakhne/afc/gis/road/path/ClusteredRoadPath.java#L330-L422 | train |
gallandarakhneorg/afc | core/maths/mathtree/src/main/java/org/arakhne/afc/math/tree/node/AbstractTreeNode.java | AbstractTreeNode.setParentNodeReference | boolean setParentNodeReference(N newParent, boolean fireEvent) {
final N oldParent = getParentNode();
if (newParent == oldParent) {
return false;
}
this.parent = (newParent == null) ? null : new WeakReference<>(newParent);
if (!fireEvent) {
return true;
}
firePropertyParentChanged(oldParent, newParent);
if (oldParent != null) {
oldParent.firePropertyParentChanged(toN(), oldParent, newParent);
}
return false;
} | java | boolean setParentNodeReference(N newParent, boolean fireEvent) {
final N oldParent = getParentNode();
if (newParent == oldParent) {
return false;
}
this.parent = (newParent == null) ? null : new WeakReference<>(newParent);
if (!fireEvent) {
return true;
}
firePropertyParentChanged(oldParent, newParent);
if (oldParent != null) {
oldParent.firePropertyParentChanged(toN(), oldParent, newParent);
}
return false;
} | [
"boolean",
"setParentNodeReference",
"(",
"N",
"newParent",
",",
"boolean",
"fireEvent",
")",
"{",
"final",
"N",
"oldParent",
"=",
"getParentNode",
"(",
")",
";",
"if",
"(",
"newParent",
"==",
"oldParent",
")",
"{",
"return",
"false",
";",
"}",
"this",
"."... | Set the reference to the parent node.
@param newParent is the new parent.
@param fireEvent indicates if the event must be fired or not.
@return <code>true</code> if an event must be fired due to
the action of this function, otherwise <code>false</code>.
@since 4.0 | [
"Set",
"the",
"reference",
"to",
"the",
"parent",
"node",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/maths/mathtree/src/main/java/org/arakhne/afc/math/tree/node/AbstractTreeNode.java#L127-L141 | train |
gallandarakhneorg/afc | core/maths/mathtree/src/main/java/org/arakhne/afc/math/tree/node/AbstractTreeNode.java | AbstractTreeNode.firePropertyChildAdded | void firePropertyChildAdded(TreeNodeAddedEvent event) {
if (this.nodeListeners != null) {
for (final TreeNodeListener listener : this.nodeListeners) {
if (listener != null) {
listener.treeNodeChildAdded(event);
}
}
}
final N parentNode = getParentNode();
assert parentNode != this;
if (parentNode != null) {
parentNode.firePropertyChildAdded(event);
}
} | java | void firePropertyChildAdded(TreeNodeAddedEvent event) {
if (this.nodeListeners != null) {
for (final TreeNodeListener listener : this.nodeListeners) {
if (listener != null) {
listener.treeNodeChildAdded(event);
}
}
}
final N parentNode = getParentNode();
assert parentNode != this;
if (parentNode != null) {
parentNode.firePropertyChildAdded(event);
}
} | [
"void",
"firePropertyChildAdded",
"(",
"TreeNodeAddedEvent",
"event",
")",
"{",
"if",
"(",
"this",
".",
"nodeListeners",
"!=",
"null",
")",
"{",
"for",
"(",
"final",
"TreeNodeListener",
"listener",
":",
"this",
".",
"nodeListeners",
")",
"{",
"if",
"(",
"lis... | Fire the event for the node child sets.
@param event the event. | [
"Fire",
"the",
"event",
"for",
"the",
"node",
"child",
"sets",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/maths/mathtree/src/main/java/org/arakhne/afc/math/tree/node/AbstractTreeNode.java#L186-L199 | train |
gallandarakhneorg/afc | core/maths/mathtree/src/main/java/org/arakhne/afc/math/tree/node/AbstractTreeNode.java | AbstractTreeNode.firePropertyChildRemoved | void firePropertyChildRemoved(TreeNodeRemovedEvent event) {
if (this.nodeListeners != null) {
for (final TreeNodeListener listener : this.nodeListeners) {
if (listener != null) {
listener.treeNodeChildRemoved(event);
}
}
}
final N parentNode = getParentNode();
if (parentNode != null) {
parentNode.firePropertyChildRemoved(event);
}
} | java | void firePropertyChildRemoved(TreeNodeRemovedEvent event) {
if (this.nodeListeners != null) {
for (final TreeNodeListener listener : this.nodeListeners) {
if (listener != null) {
listener.treeNodeChildRemoved(event);
}
}
}
final N parentNode = getParentNode();
if (parentNode != null) {
parentNode.firePropertyChildRemoved(event);
}
} | [
"void",
"firePropertyChildRemoved",
"(",
"TreeNodeRemovedEvent",
"event",
")",
"{",
"if",
"(",
"this",
".",
"nodeListeners",
"!=",
"null",
")",
"{",
"for",
"(",
"final",
"TreeNodeListener",
"listener",
":",
"this",
".",
"nodeListeners",
")",
"{",
"if",
"(",
... | Fire the event for the removed node child.
@param event the event. | [
"Fire",
"the",
"event",
"for",
"the",
"removed",
"node",
"child",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/maths/mathtree/src/main/java/org/arakhne/afc/math/tree/node/AbstractTreeNode.java#L214-L226 | train |
BBN-E/bue-common-open | common-core-open/src/main/java/com/bbn/bue/common/StringUtils.java | StringUtils.joinFunction | public static Function<Iterable<?>, String> joinFunction(final Joiner joiner) {
return new Function<Iterable<?>, String>() {
@Override
public String apply(final Iterable<?> list) {
return joiner.join(list);
}
};
} | java | public static Function<Iterable<?>, String> joinFunction(final Joiner joiner) {
return new Function<Iterable<?>, String>() {
@Override
public String apply(final Iterable<?> list) {
return joiner.join(list);
}
};
} | [
"public",
"static",
"Function",
"<",
"Iterable",
"<",
"?",
">",
",",
"String",
">",
"joinFunction",
"(",
"final",
"Joiner",
"joiner",
")",
"{",
"return",
"new",
"Function",
"<",
"Iterable",
"<",
"?",
">",
",",
"String",
">",
"(",
")",
"{",
"@",
"Over... | Returns a Function which will join the string with the specified separator | [
"Returns",
"a",
"Function",
"which",
"will",
"join",
"the",
"string",
"with",
"the",
"specified",
"separator"
] | d618652674d647867306e2e4b987a21b7c29c015 | https://github.com/BBN-E/bue-common-open/blob/d618652674d647867306e2e4b987a21b7c29c015/common-core-open/src/main/java/com/bbn/bue/common/StringUtils.java#L182-L189 | train |
BBN-E/bue-common-open | common-core-open/src/main/java/com/bbn/bue/common/StringUtils.java | StringUtils.toLowerCaseFunction | public static Function<String, String> toLowerCaseFunction(final Locale locale) {
return new Function<String, String>() {
@Override
public String apply(final String s) {
return s.toLowerCase(locale);
}
@Override
public String toString() {
return "toLowercase(" + locale + ")";
}
};
} | java | public static Function<String, String> toLowerCaseFunction(final Locale locale) {
return new Function<String, String>() {
@Override
public String apply(final String s) {
return s.toLowerCase(locale);
}
@Override
public String toString() {
return "toLowercase(" + locale + ")";
}
};
} | [
"public",
"static",
"Function",
"<",
"String",
",",
"String",
">",
"toLowerCaseFunction",
"(",
"final",
"Locale",
"locale",
")",
"{",
"return",
"new",
"Function",
"<",
"String",
",",
"String",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"String",
"apply... | A Guava function for converting strings to lowercase.
@param locale
@return | [
"A",
"Guava",
"function",
"for",
"converting",
"strings",
"to",
"lowercase",
"."
] | d618652674d647867306e2e4b987a21b7c29c015 | https://github.com/BBN-E/bue-common-open/blob/d618652674d647867306e2e4b987a21b7c29c015/common-core-open/src/main/java/com/bbn/bue/common/StringUtils.java#L342-L354 | train |
BBN-E/bue-common-open | common-core-open/src/main/java/com/bbn/bue/common/StringUtils.java | StringUtils.stripAccents | public static UnicodeFriendlyString stripAccents(final UnicodeFriendlyString input) {
// this nifty normalization courtesy of http://stackoverflow.com/questions/3322152/is-there-a-way-to-get-rid-of-accents-and-convert-a-whole-string-to-regular-lette
return StringUtils.unicodeFriendly(ACCENT_STRIPPER.matcher(
Normalizer.normalize(input.utf16CodeUnits(), Normalizer.Form.NFD))
// note this replaceAll is really deleteAll
.replaceAll(""));
} | java | public static UnicodeFriendlyString stripAccents(final UnicodeFriendlyString input) {
// this nifty normalization courtesy of http://stackoverflow.com/questions/3322152/is-there-a-way-to-get-rid-of-accents-and-convert-a-whole-string-to-regular-lette
return StringUtils.unicodeFriendly(ACCENT_STRIPPER.matcher(
Normalizer.normalize(input.utf16CodeUnits(), Normalizer.Form.NFD))
// note this replaceAll is really deleteAll
.replaceAll(""));
} | [
"public",
"static",
"UnicodeFriendlyString",
"stripAccents",
"(",
"final",
"UnicodeFriendlyString",
"input",
")",
"{",
"// this nifty normalization courtesy of http://stackoverflow.com/questions/3322152/is-there-a-way-to-get-rid-of-accents-and-convert-a-whole-string-to-regular-lette",
"return"... | Removes all Unicode marks from a string. As a side effect, applies NFD normalization. | [
"Removes",
"all",
"Unicode",
"marks",
"from",
"a",
"string",
".",
"As",
"a",
"side",
"effect",
"applies",
"NFD",
"normalization",
"."
] | d618652674d647867306e2e4b987a21b7c29c015 | https://github.com/BBN-E/bue-common-open/blob/d618652674d647867306e2e4b987a21b7c29c015/common-core-open/src/main/java/com/bbn/bue/common/StringUtils.java#L659-L665 | train |
lightblueseas/swing-components | src/main/java/de/alpharogroup/swing/robot/RobotExtensions.java | RobotExtensions.getKeyCode | public static int getKeyCode(final char character)
throws IllegalAccessException, NoSuchFieldException
{
final String c = String.valueOf(character).toUpperCase();
final String variableName = "VK_" + c;
final Class<KeyEvent> clazz = KeyEvent.class;
final Field field = clazz.getField(variableName);
final int keyCode = field.getInt(null);
return keyCode;
} | java | public static int getKeyCode(final char character)
throws IllegalAccessException, NoSuchFieldException
{
final String c = String.valueOf(character).toUpperCase();
final String variableName = "VK_" + c;
final Class<KeyEvent> clazz = KeyEvent.class;
final Field field = clazz.getField(variableName);
final int keyCode = field.getInt(null);
return keyCode;
} | [
"public",
"static",
"int",
"getKeyCode",
"(",
"final",
"char",
"character",
")",
"throws",
"IllegalAccessException",
",",
"NoSuchFieldException",
"{",
"final",
"String",
"c",
"=",
"String",
".",
"valueOf",
"(",
"character",
")",
".",
"toUpperCase",
"(",
")",
"... | Gets the key code from the given char.
@param character
the character
@return the key code
@throws IllegalAccessException
the illegal access exception
@throws NoSuchFieldException
the no such field exception | [
"Gets",
"the",
"key",
"code",
"from",
"the",
"given",
"char",
"."
] | 4045e85cabd8f0ce985cbfff134c3c9873930c79 | https://github.com/lightblueseas/swing-components/blob/4045e85cabd8f0ce985cbfff134c3c9873930c79/src/main/java/de/alpharogroup/swing/robot/RobotExtensions.java#L48-L57 | train |
lightblueseas/swing-components | src/main/java/de/alpharogroup/swing/robot/RobotExtensions.java | RobotExtensions.typeCharacter | public static void typeCharacter(final Robot robot, final char character)
throws IllegalAccessException, NoSuchFieldException
{
final boolean upperCase = Character.isUpperCase(character);
final int keyCode = getKeyCode(character);
if (upperCase)
{
robot.keyPress(KeyEvent.VK_SHIFT);
}
robot.keyPress(keyCode);
robot.keyRelease(keyCode);
if (upperCase)
{
robot.keyRelease(KeyEvent.VK_SHIFT);
}
} | java | public static void typeCharacter(final Robot robot, final char character)
throws IllegalAccessException, NoSuchFieldException
{
final boolean upperCase = Character.isUpperCase(character);
final int keyCode = getKeyCode(character);
if (upperCase)
{
robot.keyPress(KeyEvent.VK_SHIFT);
}
robot.keyPress(keyCode);
robot.keyRelease(keyCode);
if (upperCase)
{
robot.keyRelease(KeyEvent.VK_SHIFT);
}
} | [
"public",
"static",
"void",
"typeCharacter",
"(",
"final",
"Robot",
"robot",
",",
"final",
"char",
"character",
")",
"throws",
"IllegalAccessException",
",",
"NoSuchFieldException",
"{",
"final",
"boolean",
"upperCase",
"=",
"Character",
".",
"isUpperCase",
"(",
"... | Types the given char with the given robot.
@param robot
the robot
@param character
the character
@throws IllegalAccessException
the illegal access exception
@throws NoSuchFieldException
the no such field exception | [
"Types",
"the",
"given",
"char",
"with",
"the",
"given",
"robot",
"."
] | 4045e85cabd8f0ce985cbfff134c3c9873930c79 | https://github.com/lightblueseas/swing-components/blob/4045e85cabd8f0ce985cbfff134c3c9873930c79/src/main/java/de/alpharogroup/swing/robot/RobotExtensions.java#L71-L86 | train |
lightblueseas/swing-components | src/main/java/de/alpharogroup/swing/robot/RobotExtensions.java | RobotExtensions.typeString | public static void typeString(final Robot robot, final String input)
throws NoSuchFieldException, IllegalAccessException
{
if (input != null && !input.isEmpty())
{
for (final char character : input.toCharArray())
{
typeCharacter(robot, character);
}
}
} | java | public static void typeString(final Robot robot, final String input)
throws NoSuchFieldException, IllegalAccessException
{
if (input != null && !input.isEmpty())
{
for (final char character : input.toCharArray())
{
typeCharacter(robot, character);
}
}
} | [
"public",
"static",
"void",
"typeString",
"(",
"final",
"Robot",
"robot",
",",
"final",
"String",
"input",
")",
"throws",
"NoSuchFieldException",
",",
"IllegalAccessException",
"{",
"if",
"(",
"input",
"!=",
"null",
"&&",
"!",
"input",
".",
"isEmpty",
"(",
"... | Type the given string with the given robot.
@param robot
the robot
@param input
the input
@throws NoSuchFieldException
the no such field exception
@throws IllegalAccessException
the illegal access exception | [
"Type",
"the",
"given",
"string",
"with",
"the",
"given",
"robot",
"."
] | 4045e85cabd8f0ce985cbfff134c3c9873930c79 | https://github.com/lightblueseas/swing-components/blob/4045e85cabd8f0ce985cbfff134c3c9873930c79/src/main/java/de/alpharogroup/swing/robot/RobotExtensions.java#L100-L110 | train |
gallandarakhneorg/afc | advanced/gis/gisinputoutput/src/main/java/org/arakhne/afc/gis/io/binary/GISLayerReader.java | GISLayerReader.iterator | public <T extends MapLayer> Iterator<T> iterator(Class<T> type) {
return new LayerReaderIterator<>(type);
} | java | public <T extends MapLayer> Iterator<T> iterator(Class<T> type) {
return new LayerReaderIterator<>(type);
} | [
"public",
"<",
"T",
"extends",
"MapLayer",
">",
"Iterator",
"<",
"T",
">",
"iterator",
"(",
"Class",
"<",
"T",
">",
"type",
")",
"{",
"return",
"new",
"LayerReaderIterator",
"<>",
"(",
"type",
")",
";",
"}"
] | Replies an iterator on the layers of the given type and read from the input stream.
@param <T> the type of the layers to reply.
@param type is the type of the layers to reply.
@return the iterator. | [
"Replies",
"an",
"iterator",
"on",
"the",
"layers",
"of",
"the",
"given",
"type",
"and",
"read",
"from",
"the",
"input",
"stream",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/gisinputoutput/src/main/java/org/arakhne/afc/gis/io/binary/GISLayerReader.java#L139-L141 | train |
gallandarakhneorg/afc | advanced/gis/gisinputoutput/src/main/java/org/arakhne/afc/gis/io/binary/GISLayerReader.java | GISLayerReader.read | public final <T extends MapLayer> T read(Class<T> type) throws IOException {
// Read the header
if (!this.isHeaderRead) {
this.isHeaderRead = true;
readHeader();
if (this.progression != null) {
this.progression.setProperties(0, 0, this.restToRead, false);
}
}
T selectedObject = null;
if (this.restToRead > 0) {
final ObjectInputStream oos = new ObjectInputStream(this.input);
do {
try {
final Object readObject = oos.readObject();
--this.restToRead;
if (type.isInstance(readObject)) {
selectedObject = type.cast(readObject);
}
} catch (ClassNotFoundException e) {
//
}
}
while (this.restToRead > 0 && selectedObject == null);
}
if (this.progression != null) {
if (this.restToRead <= 0) {
this.progression.end();
} else {
this.progression.increment();
}
}
return selectedObject;
} | java | public final <T extends MapLayer> T read(Class<T> type) throws IOException {
// Read the header
if (!this.isHeaderRead) {
this.isHeaderRead = true;
readHeader();
if (this.progression != null) {
this.progression.setProperties(0, 0, this.restToRead, false);
}
}
T selectedObject = null;
if (this.restToRead > 0) {
final ObjectInputStream oos = new ObjectInputStream(this.input);
do {
try {
final Object readObject = oos.readObject();
--this.restToRead;
if (type.isInstance(readObject)) {
selectedObject = type.cast(readObject);
}
} catch (ClassNotFoundException e) {
//
}
}
while (this.restToRead > 0 && selectedObject == null);
}
if (this.progression != null) {
if (this.restToRead <= 0) {
this.progression.end();
} else {
this.progression.increment();
}
}
return selectedObject;
} | [
"public",
"final",
"<",
"T",
"extends",
"MapLayer",
">",
"T",
"read",
"(",
"Class",
"<",
"T",
">",
"type",
")",
"throws",
"IOException",
"{",
"// Read the header",
"if",
"(",
"!",
"this",
".",
"isHeaderRead",
")",
"{",
"this",
".",
"isHeaderRead",
"=",
... | Read the next layer of the given type from the input.
@param <T> is the type of the expected layer.
@param type is the type of the expected layer.
@return the next layer in the input stream, or <code>null</code>
if there is no more object of the given type.
@throws IOException in case of error.
@throws IndexOutOfBoundsException in case of error. | [
"Read",
"the",
"next",
"layer",
"of",
"the",
"given",
"type",
"from",
"the",
"input",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/gisinputoutput/src/main/java/org/arakhne/afc/gis/io/binary/GISLayerReader.java#L162-L199 | train |
gallandarakhneorg/afc | advanced/gis/gisinputoutput/src/main/java/org/arakhne/afc/gis/io/binary/GISLayerReader.java | GISLayerReader.readHeader | @SuppressWarnings({"resource", "checkstyle:magicnumber"})
protected void readHeader() throws IOException {
final ReadableByteChannel in = Channels.newChannel(this.input);
final int limit = HEADER_KEY.getBytes().length + 2;
final ByteBuffer hBuffer = ByteBuffer.allocate(limit);
hBuffer.limit(limit);
// Check the header
final byte[] key = GISLayerIOConstants.HEADER_KEY.getBytes();
final int n = in.read(hBuffer);
if (n != limit) {
throw new IOException("Invalid file header"); //$NON-NLS-1$
}
for (int i = 0; i < key.length; ++i) {
if (hBuffer.get(i) != key[i]) {
throw new IOException("Invalid file header"); //$NON-NLS-1$
}
}
// Check the format version
final byte major = hBuffer.get(key.length);
final byte minor = hBuffer.get(key.length + 1);
if (major != GISLayerIOConstants.MAJOR_SPEC_NUMBER || minor != GISLayerIOConstants.MINOR_SPEC_NUMBER) {
throw new IOException("Invalid file format version."); //$NON-NLS-1$
}
// Read the number of objects inside the input stream
final ByteBuffer sBuffer = ByteBuffer.allocate(4);
sBuffer.limit(4);
in.read(sBuffer);
sBuffer.rewind();
this.restToRead = sBuffer.getInt();
} | java | @SuppressWarnings({"resource", "checkstyle:magicnumber"})
protected void readHeader() throws IOException {
final ReadableByteChannel in = Channels.newChannel(this.input);
final int limit = HEADER_KEY.getBytes().length + 2;
final ByteBuffer hBuffer = ByteBuffer.allocate(limit);
hBuffer.limit(limit);
// Check the header
final byte[] key = GISLayerIOConstants.HEADER_KEY.getBytes();
final int n = in.read(hBuffer);
if (n != limit) {
throw new IOException("Invalid file header"); //$NON-NLS-1$
}
for (int i = 0; i < key.length; ++i) {
if (hBuffer.get(i) != key[i]) {
throw new IOException("Invalid file header"); //$NON-NLS-1$
}
}
// Check the format version
final byte major = hBuffer.get(key.length);
final byte minor = hBuffer.get(key.length + 1);
if (major != GISLayerIOConstants.MAJOR_SPEC_NUMBER || minor != GISLayerIOConstants.MINOR_SPEC_NUMBER) {
throw new IOException("Invalid file format version."); //$NON-NLS-1$
}
// Read the number of objects inside the input stream
final ByteBuffer sBuffer = ByteBuffer.allocate(4);
sBuffer.limit(4);
in.read(sBuffer);
sBuffer.rewind();
this.restToRead = sBuffer.getInt();
} | [
"@",
"SuppressWarnings",
"(",
"{",
"\"resource\"",
",",
"\"checkstyle:magicnumber\"",
"}",
")",
"protected",
"void",
"readHeader",
"(",
")",
"throws",
"IOException",
"{",
"final",
"ReadableByteChannel",
"in",
"=",
"Channels",
".",
"newChannel",
"(",
"this",
".",
... | Read the header of the file.
@throws IOException in case of error. | [
"Read",
"the",
"header",
"of",
"the",
"file",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/gisinputoutput/src/main/java/org/arakhne/afc/gis/io/binary/GISLayerReader.java#L205-L235 | train |
gallandarakhneorg/afc | advanced/nodefx/src/main/java/org/arakhne/afc/nodefx/ZoomableGraphicsContext.java | ZoomableGraphicsContext.getLevelOfDetails | public LevelOfDetails getLevelOfDetails() {
if (this.lod == null) {
final double meterSize = doc2fxSize(1);
if (meterSize <= LOW_DETAILLED_METER_SIZE) {
this.lod = LevelOfDetails.LOW;
} else if (meterSize >= HIGH_DETAILLED_METER_SIZE) {
this.lod = LevelOfDetails.HIGH;
} else {
this.lod = LevelOfDetails.NORMAL;
}
}
return this.lod;
} | java | public LevelOfDetails getLevelOfDetails() {
if (this.lod == null) {
final double meterSize = doc2fxSize(1);
if (meterSize <= LOW_DETAILLED_METER_SIZE) {
this.lod = LevelOfDetails.LOW;
} else if (meterSize >= HIGH_DETAILLED_METER_SIZE) {
this.lod = LevelOfDetails.HIGH;
} else {
this.lod = LevelOfDetails.NORMAL;
}
}
return this.lod;
} | [
"public",
"LevelOfDetails",
"getLevelOfDetails",
"(",
")",
"{",
"if",
"(",
"this",
".",
"lod",
"==",
"null",
")",
"{",
"final",
"double",
"meterSize",
"=",
"doc2fxSize",
"(",
"1",
")",
";",
"if",
"(",
"meterSize",
"<=",
"LOW_DETAILLED_METER_SIZE",
")",
"{"... | Replies the current level of details.
@return the level of details. | [
"Replies",
"the",
"current",
"level",
"of",
"details",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/nodefx/src/main/java/org/arakhne/afc/nodefx/ZoomableGraphicsContext.java#L195-L207 | train |
gallandarakhneorg/afc | advanced/nodefx/src/main/java/org/arakhne/afc/nodefx/ZoomableGraphicsContext.java | ZoomableGraphicsContext.rgb | @SuppressWarnings({ "checkstyle:magicnumber", "static-method" })
@Pure
public Color rgb(int color) {
final int red = (color & 0x00FF0000) >> 16;
final int green = (color & 0x0000FF00) >> 8;
final int blue = color & 0x000000FF;
return Color.rgb(red, green, blue);
} | java | @SuppressWarnings({ "checkstyle:magicnumber", "static-method" })
@Pure
public Color rgb(int color) {
final int red = (color & 0x00FF0000) >> 16;
final int green = (color & 0x0000FF00) >> 8;
final int blue = color & 0x000000FF;
return Color.rgb(red, green, blue);
} | [
"@",
"SuppressWarnings",
"(",
"{",
"\"checkstyle:magicnumber\"",
",",
"\"static-method\"",
"}",
")",
"@",
"Pure",
"public",
"Color",
"rgb",
"(",
"int",
"color",
")",
"{",
"final",
"int",
"red",
"=",
"(",
"color",
"&",
"0x00FF0000",
")",
">>",
"16",
";",
... | Parse the given RGB color.
<p>Opacity is always {@code 1}.
@param color the RGB color.
@return the JavaFX color. | [
"Parse",
"the",
"given",
"RGB",
"color",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/nodefx/src/main/java/org/arakhne/afc/nodefx/ZoomableGraphicsContext.java#L257-L264 | train |
gallandarakhneorg/afc | advanced/nodefx/src/main/java/org/arakhne/afc/nodefx/ZoomableGraphicsContext.java | ZoomableGraphicsContext.doc2fxX | @Pure
public double doc2fxX(double x) {
return this.centeringTransform.toCenterX(x) * this.scale.get() + this.canvasWidth.get() / 2.;
} | java | @Pure
public double doc2fxX(double x) {
return this.centeringTransform.toCenterX(x) * this.scale.get() + this.canvasWidth.get() / 2.;
} | [
"@",
"Pure",
"public",
"double",
"doc2fxX",
"(",
"double",
"x",
")",
"{",
"return",
"this",
".",
"centeringTransform",
".",
"toCenterX",
"(",
"x",
")",
"*",
"this",
".",
"scale",
".",
"get",
"(",
")",
"+",
"this",
".",
"canvasWidth",
".",
"get",
"(",... | Transform a document x coordinate to its JavaFX equivalent.
@param x the document x coordinate.
@return the JavaFX x coordinate. | [
"Transform",
"a",
"document",
"x",
"coordinate",
"to",
"its",
"JavaFX",
"equivalent",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/nodefx/src/main/java/org/arakhne/afc/nodefx/ZoomableGraphicsContext.java#L312-L315 | train |
gallandarakhneorg/afc | advanced/nodefx/src/main/java/org/arakhne/afc/nodefx/ZoomableGraphicsContext.java | ZoomableGraphicsContext.fx2docX | @Pure
public double fx2docX(double x) {
return this.centeringTransform.toGlobalX((x - this.canvasWidth.get() / 2.) / this.scale.get());
} | java | @Pure
public double fx2docX(double x) {
return this.centeringTransform.toGlobalX((x - this.canvasWidth.get() / 2.) / this.scale.get());
} | [
"@",
"Pure",
"public",
"double",
"fx2docX",
"(",
"double",
"x",
")",
"{",
"return",
"this",
".",
"centeringTransform",
".",
"toGlobalX",
"(",
"(",
"x",
"-",
"this",
".",
"canvasWidth",
".",
"get",
"(",
")",
"/",
"2.",
")",
"/",
"this",
".",
"scale",
... | Transform a JavaFX x coordinate to its document equivalent.
@param x the document x coordinate.
@return the JavaFX x coordinate. | [
"Transform",
"a",
"JavaFX",
"x",
"coordinate",
"to",
"its",
"document",
"equivalent",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/nodefx/src/main/java/org/arakhne/afc/nodefx/ZoomableGraphicsContext.java#L322-L325 | train |
gallandarakhneorg/afc | advanced/nodefx/src/main/java/org/arakhne/afc/nodefx/ZoomableGraphicsContext.java | ZoomableGraphicsContext.doc2fxY | @Pure
public double doc2fxY(double y) {
return this.centeringTransform.toCenterY(y) * this.scale.get() + this.canvasHeight.get() / 2.;
} | java | @Pure
public double doc2fxY(double y) {
return this.centeringTransform.toCenterY(y) * this.scale.get() + this.canvasHeight.get() / 2.;
} | [
"@",
"Pure",
"public",
"double",
"doc2fxY",
"(",
"double",
"y",
")",
"{",
"return",
"this",
".",
"centeringTransform",
".",
"toCenterY",
"(",
"y",
")",
"*",
"this",
".",
"scale",
".",
"get",
"(",
")",
"+",
"this",
".",
"canvasHeight",
".",
"get",
"("... | Transform a document y coordinate to its JavaFX equivalent.
@param y the document y coordinate.
@return the JavaFX y coordinate. | [
"Transform",
"a",
"document",
"y",
"coordinate",
"to",
"its",
"JavaFX",
"equivalent",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/nodefx/src/main/java/org/arakhne/afc/nodefx/ZoomableGraphicsContext.java#L332-L335 | train |
gallandarakhneorg/afc | advanced/nodefx/src/main/java/org/arakhne/afc/nodefx/ZoomableGraphicsContext.java | ZoomableGraphicsContext.fx2docY | @Pure
public double fx2docY(double y) {
return this.centeringTransform.toGlobalY((y - this.canvasHeight.get() / 2.) / this.scale.get());
} | java | @Pure
public double fx2docY(double y) {
return this.centeringTransform.toGlobalY((y - this.canvasHeight.get() / 2.) / this.scale.get());
} | [
"@",
"Pure",
"public",
"double",
"fx2docY",
"(",
"double",
"y",
")",
"{",
"return",
"this",
".",
"centeringTransform",
".",
"toGlobalY",
"(",
"(",
"y",
"-",
"this",
".",
"canvasHeight",
".",
"get",
"(",
")",
"/",
"2.",
")",
"/",
"this",
".",
"scale",... | Transform a JavaFX y coordinate to its document equivalent.
@param y the JavaFX y coordinate.
@return the document y coordinate. | [
"Transform",
"a",
"JavaFX",
"y",
"coordinate",
"to",
"its",
"document",
"equivalent",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/nodefx/src/main/java/org/arakhne/afc/nodefx/ZoomableGraphicsContext.java#L342-L345 | train |
gallandarakhneorg/afc | advanced/nodefx/src/main/java/org/arakhne/afc/nodefx/ZoomableGraphicsContext.java | ZoomableGraphicsContext.doc2fxAngle | @Pure
public double doc2fxAngle(double angle) {
final ZoomableCanvas<?> canvas = getCanvas();
if (canvas.isInvertedAxisX() != canvas.isInvertedAxisY()) {
return -angle;
}
return angle;
} | java | @Pure
public double doc2fxAngle(double angle) {
final ZoomableCanvas<?> canvas = getCanvas();
if (canvas.isInvertedAxisX() != canvas.isInvertedAxisY()) {
return -angle;
}
return angle;
} | [
"@",
"Pure",
"public",
"double",
"doc2fxAngle",
"(",
"double",
"angle",
")",
"{",
"final",
"ZoomableCanvas",
"<",
"?",
">",
"canvas",
"=",
"getCanvas",
"(",
")",
";",
"if",
"(",
"canvas",
".",
"isInvertedAxisX",
"(",
")",
"!=",
"canvas",
".",
"isInverted... | Transform a document angle to its JavaFX equivalent.
@param angle the document angle.
@return the JavaFX angle. | [
"Transform",
"a",
"document",
"angle",
"to",
"its",
"JavaFX",
"equivalent",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/nodefx/src/main/java/org/arakhne/afc/nodefx/ZoomableGraphicsContext.java#L378-L385 | train |
gallandarakhneorg/afc | advanced/nodefx/src/main/java/org/arakhne/afc/nodefx/ZoomableGraphicsContext.java | ZoomableGraphicsContext.fx2docAngle | @Pure
public double fx2docAngle(double angle) {
final ZoomableCanvas<?> canvas = getCanvas();
if (canvas.isInvertedAxisX() != canvas.isInvertedAxisY()) {
return -angle;
}
return angle;
} | java | @Pure
public double fx2docAngle(double angle) {
final ZoomableCanvas<?> canvas = getCanvas();
if (canvas.isInvertedAxisX() != canvas.isInvertedAxisY()) {
return -angle;
}
return angle;
} | [
"@",
"Pure",
"public",
"double",
"fx2docAngle",
"(",
"double",
"angle",
")",
"{",
"final",
"ZoomableCanvas",
"<",
"?",
">",
"canvas",
"=",
"getCanvas",
"(",
")",
";",
"if",
"(",
"canvas",
".",
"isInvertedAxisX",
"(",
")",
"!=",
"canvas",
".",
"isInverted... | Transform a JavaFX angle to its document equivalent.
@param angle the JavaFX angle.
@return the document angle. | [
"Transform",
"a",
"JavaFX",
"angle",
"to",
"its",
"document",
"equivalent",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/nodefx/src/main/java/org/arakhne/afc/nodefx/ZoomableGraphicsContext.java#L392-L399 | train |
gallandarakhneorg/afc | advanced/nodefx/src/main/java/org/arakhne/afc/nodefx/ZoomableGraphicsContext.java | ZoomableGraphicsContext.restore | public void restore() {
this.gc.restore();
if (this.stateStack != null) {
if (!this.stateStack.isEmpty()) {
final int[] data = this.stateStack.pop();
if (this.stateStack.isEmpty()) {
this.stateStack = null;
}
this.bugdet = data[0];
this.state = data[1];
} else {
this.stateStack = null;
}
}
} | java | public void restore() {
this.gc.restore();
if (this.stateStack != null) {
if (!this.stateStack.isEmpty()) {
final int[] data = this.stateStack.pop();
if (this.stateStack.isEmpty()) {
this.stateStack = null;
}
this.bugdet = data[0];
this.state = data[1];
} else {
this.stateStack = null;
}
}
} | [
"public",
"void",
"restore",
"(",
")",
"{",
"this",
".",
"gc",
".",
"restore",
"(",
")",
";",
"if",
"(",
"this",
".",
"stateStack",
"!=",
"null",
")",
"{",
"if",
"(",
"!",
"this",
".",
"stateStack",
".",
"isEmpty",
"(",
")",
")",
"{",
"final",
... | Pops the state off of the stack, setting the following attributes to their
value at the time when that state was pushed onto the stack. If the stack
is empty then nothing is changed.
<ul>
<li>Global Alpha</li>
<li>Global Blend Operation</li>
<li>Transform</li>
<li>Fill Paint</li>
<li>Stroke Paint</li>
<li>Line Width</li>
<li>Line Cap</li>
<li>Line Join</li>
<li>Miter Limit</li>
<li>Clip</li>
<li>Font</li>
<li>Text Align</li>
<li>Text Baseline</li>
<li>Effect</li>
<li>Fill Rule</li>
</ul>
Note that the current path is not restored. | [
"Pops",
"the",
"state",
"off",
"of",
"the",
"stack",
"setting",
"the",
"following",
"attributes",
"to",
"their",
"value",
"at",
"the",
"time",
"when",
"that",
"state",
"was",
"pushed",
"onto",
"the",
"stack",
".",
"If",
"the",
"stack",
"is",
"empty",
"th... | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/nodefx/src/main/java/org/arakhne/afc/nodefx/ZoomableGraphicsContext.java#L455-L469 | train |
gallandarakhneorg/afc | advanced/nodefx/src/main/java/org/arakhne/afc/nodefx/ZoomableGraphicsContext.java | ZoomableGraphicsContext.fillRoundRect | public void fillRoundRect(double x, double y, double width, double height, double arcWidth, double arcHeight) {
this.gc.fillRoundRect(
doc2fxX(x), doc2fxY(y),
doc2fxSize(width), doc2fxSize(height),
doc2fxSize(arcWidth), doc2fxSize(arcHeight));
} | java | public void fillRoundRect(double x, double y, double width, double height, double arcWidth, double arcHeight) {
this.gc.fillRoundRect(
doc2fxX(x), doc2fxY(y),
doc2fxSize(width), doc2fxSize(height),
doc2fxSize(arcWidth), doc2fxSize(arcHeight));
} | [
"public",
"void",
"fillRoundRect",
"(",
"double",
"x",
",",
"double",
"y",
",",
"double",
"width",
",",
"double",
"height",
",",
"double",
"arcWidth",
",",
"double",
"arcHeight",
")",
"{",
"this",
".",
"gc",
".",
"fillRoundRect",
"(",
"doc2fxX",
"(",
"x"... | Fills a rounded rectangle using the current fill paint.
<p>This method will be affected by any of the
global common or fill attributes as specified in the
Rendering Attributes Table of {@link GraphicsContext}.
@param x the X coordinate of the upper left bound of the oval.
@param y the Y coordinate of the upper left bound of the oval.
@param width the width at the center of the oval.
@param height the height at the center of the oval.
@param arcWidth the arc width of the rectangle corners.
@param arcHeight the arc height of the rectangle corners. | [
"Fills",
"a",
"rounded",
"rectangle",
"using",
"the",
"current",
"fill",
"paint",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/nodefx/src/main/java/org/arakhne/afc/nodefx/ZoomableGraphicsContext.java#L1600-L1605 | train |
gallandarakhneorg/afc | advanced/nodefx/src/main/java/org/arakhne/afc/nodefx/ZoomableGraphicsContext.java | ZoomableGraphicsContext.strokeLine | public void strokeLine(double x1, double y1, double x2, double y2) {
this.gc.strokeLine(
doc2fxX(x1), doc2fxY(y1),
doc2fxX(x2), doc2fxY(y2));
} | java | public void strokeLine(double x1, double y1, double x2, double y2) {
this.gc.strokeLine(
doc2fxX(x1), doc2fxY(y1),
doc2fxX(x2), doc2fxY(y2));
} | [
"public",
"void",
"strokeLine",
"(",
"double",
"x1",
",",
"double",
"y1",
",",
"double",
"x2",
",",
"double",
"y2",
")",
"{",
"this",
".",
"gc",
".",
"strokeLine",
"(",
"doc2fxX",
"(",
"x1",
")",
",",
"doc2fxY",
"(",
"y1",
")",
",",
"doc2fxX",
"(",... | Strokes a line using the current stroke paint.
<p>This method will be affected by any of the
global common or stroke attributes as specified in the
Rendering Attributes Table of {@link GraphicsContext}.
@param x1 the X coordinate of the starting point of the line.
@param y1 the Y coordinate of the starting point of the line.
@param x2 the X coordinate of the ending point of the line.
@param y2 the Y coordinate of the ending point of the line. | [
"Strokes",
"a",
"line",
"using",
"the",
"current",
"stroke",
"paint",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/nodefx/src/main/java/org/arakhne/afc/nodefx/ZoomableGraphicsContext.java#L1641-L1645 | train |
gallandarakhneorg/afc | advanced/gis/gisroad/src/main/java/org/arakhne/afc/gis/road/StandardRoadNetwork.java | StandardRoadNetwork.createInternalDataStructure | @SuppressWarnings({"static-method", "checkstyle:magicnumber"})
protected GISPolylineSet<RoadPolyline> createInternalDataStructure(Rectangle2afp<?, ?, ?, ?, ?, ?> originalBounds) {
/*return new MapPolylineGridSet<>(100, 100,
originalBounds.getMinX(),
originalBounds.getMinY(),
originalBounds.getWidth(),
originalBounds.getHeight());*/
return new MapPolylineTreeSet<>(
originalBounds.getMinX(),
originalBounds.getMinY(),
originalBounds.getWidth(),
originalBounds.getHeight());
} | java | @SuppressWarnings({"static-method", "checkstyle:magicnumber"})
protected GISPolylineSet<RoadPolyline> createInternalDataStructure(Rectangle2afp<?, ?, ?, ?, ?, ?> originalBounds) {
/*return new MapPolylineGridSet<>(100, 100,
originalBounds.getMinX(),
originalBounds.getMinY(),
originalBounds.getWidth(),
originalBounds.getHeight());*/
return new MapPolylineTreeSet<>(
originalBounds.getMinX(),
originalBounds.getMinY(),
originalBounds.getWidth(),
originalBounds.getHeight());
} | [
"@",
"SuppressWarnings",
"(",
"{",
"\"static-method\"",
",",
"\"checkstyle:magicnumber\"",
"}",
")",
"protected",
"GISPolylineSet",
"<",
"RoadPolyline",
">",
"createInternalDataStructure",
"(",
"Rectangle2afp",
"<",
"?",
",",
"?",
",",
"?",
",",
"?",
",",
"?",
"... | Create the internal data structure.
@param originalBounds are the bounds of the road network.
@return the internal data structure. | [
"Create",
"the",
"internal",
"data",
"structure",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/gisroad/src/main/java/org/arakhne/afc/gis/road/StandardRoadNetwork.java#L147-L159 | train |
gallandarakhneorg/afc | advanced/gis/gisroad/src/main/java/org/arakhne/afc/gis/road/StandardRoadNetwork.java | StandardRoadNetwork.getInternalTree | @SuppressWarnings("unchecked")
@Pure
public Tree<RoadPolyline, ?> getInternalTree() {
if (this.roadSegments instanceof GISTreeSet<?, ?>) {
return ((GISTreeSet<RoadPolyline, ?>) this.roadSegments).getTree();
}
return null;
} | java | @SuppressWarnings("unchecked")
@Pure
public Tree<RoadPolyline, ?> getInternalTree() {
if (this.roadSegments instanceof GISTreeSet<?, ?>) {
return ((GISTreeSet<RoadPolyline, ?>) this.roadSegments).getTree();
}
return null;
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"@",
"Pure",
"public",
"Tree",
"<",
"RoadPolyline",
",",
"?",
">",
"getInternalTree",
"(",
")",
"{",
"if",
"(",
"this",
".",
"roadSegments",
"instanceof",
"GISTreeSet",
"<",
"?",
",",
"?",
">",
")",
"{"... | Replies the internal data-structure as tree.
@return the internal data-structure as tree. | [
"Replies",
"the",
"internal",
"data",
"-",
"structure",
"as",
"tree",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/gisroad/src/main/java/org/arakhne/afc/gis/road/StandardRoadNetwork.java#L206-L213 | train |
gallandarakhneorg/afc | advanced/gis/gisroad/src/main/java/org/arakhne/afc/gis/road/StandardRoadNetwork.java | StandardRoadNetwork.getLegalTrafficSide | @Pure
public LegalTrafficSide getLegalTrafficSide() {
final String side;
try {
side = getAttributeAsString("LEGAL_TRAFFIC_SIDE"); //$NON-NLS-1$
LegalTrafficSide sd;
try {
sd = LegalTrafficSide.valueOf(side);
} catch (Throwable exception) {
sd = null;
}
if (sd != null) {
return sd;
}
} catch (Throwable exception) {
//
}
return RoadNetworkConstants.getPreferredLegalTrafficSide();
} | java | @Pure
public LegalTrafficSide getLegalTrafficSide() {
final String side;
try {
side = getAttributeAsString("LEGAL_TRAFFIC_SIDE"); //$NON-NLS-1$
LegalTrafficSide sd;
try {
sd = LegalTrafficSide.valueOf(side);
} catch (Throwable exception) {
sd = null;
}
if (sd != null) {
return sd;
}
} catch (Throwable exception) {
//
}
return RoadNetworkConstants.getPreferredLegalTrafficSide();
} | [
"@",
"Pure",
"public",
"LegalTrafficSide",
"getLegalTrafficSide",
"(",
")",
"{",
"final",
"String",
"side",
";",
"try",
"{",
"side",
"=",
"getAttributeAsString",
"(",
"\"LEGAL_TRAFFIC_SIDE\"",
")",
";",
"//$NON-NLS-1$",
"LegalTrafficSide",
"sd",
";",
"try",
"{",
... | Replies the legal traffic side.
<p>When left-side circulation direction rule is used, it is supposed that all
vehicles are going on the left side of the roads. For example,
this rule is used in UK.
@return the legal traffic side | [
"Replies",
"the",
"legal",
"traffic",
"side",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/gisroad/src/main/java/org/arakhne/afc/gis/road/StandardRoadNetwork.java#L239-L257 | train |
gallandarakhneorg/afc | advanced/gis/gisroad/src/main/java/org/arakhne/afc/gis/road/StandardRoadNetwork.java | StandardRoadNetwork.fireSegmentChanged | protected void fireSegmentChanged(RoadSegment segment) {
if (this.listeners != null && isEventFirable()) {
for (final RoadNetworkListener listener : this.listeners) {
listener.onRoadSegmentChanged(this, segment);
}
}
} | java | protected void fireSegmentChanged(RoadSegment segment) {
if (this.listeners != null && isEventFirable()) {
for (final RoadNetworkListener listener : this.listeners) {
listener.onRoadSegmentChanged(this, segment);
}
}
} | [
"protected",
"void",
"fireSegmentChanged",
"(",
"RoadSegment",
"segment",
")",
"{",
"if",
"(",
"this",
".",
"listeners",
"!=",
"null",
"&&",
"isEventFirable",
"(",
")",
")",
"{",
"for",
"(",
"final",
"RoadNetworkListener",
"listener",
":",
"this",
".",
"list... | Fire the change event.
@param segment is the changed segment | [
"Fire",
"the",
"change",
"event",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/gisroad/src/main/java/org/arakhne/afc/gis/road/StandardRoadNetwork.java#L767-L773 | train |
gallandarakhneorg/afc | core/util/src/main/java/org/arakhne/afc/util/IntegerList.java | IntegerList.toSegmentIterable | @Pure
public Iterable<IntegerSegment> toSegmentIterable() {
return new Iterable<IntegerSegment>() {
@Override
public Iterator<IntegerSegment> iterator() {
return new SegmentIterator();
}
};
} | java | @Pure
public Iterable<IntegerSegment> toSegmentIterable() {
return new Iterable<IntegerSegment>() {
@Override
public Iterator<IntegerSegment> iterator() {
return new SegmentIterator();
}
};
} | [
"@",
"Pure",
"public",
"Iterable",
"<",
"IntegerSegment",
">",
"toSegmentIterable",
"(",
")",
"{",
"return",
"new",
"Iterable",
"<",
"IntegerSegment",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"Iterator",
"<",
"IntegerSegment",
">",
"iterator",
"(",
")"... | Returns an iterable object over the segments in this list in proper sequence.
@return an iterable object over the segments in this list in proper sequence | [
"Returns",
"an",
"iterable",
"object",
"over",
"the",
"segments",
"in",
"this",
"list",
"in",
"proper",
"sequence",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/util/src/main/java/org/arakhne/afc/util/IntegerList.java#L400-L408 | train |
gallandarakhneorg/afc | core/util/src/main/java/org/arakhne/afc/util/IntegerList.java | IntegerList.set | public void set(SortedSet<? extends Number> collection) {
this.values = null;
this.size = 0;
for (final Number number : collection) {
final int e = number.intValue();
if ((this.values != null) && (e == this.values[this.values.length - 1] + 1)) {
// Same group
++this.values[this.values.length - 1];
++this.size;
}
if ((this.values != null) && (e > this.values[this.values.length - 1] + 1)) {
// Create a new group
final int[] newTab = new int[this.values.length + 2];
System.arraycopy(this.values, 0, newTab, 0, this.values.length);
newTab[newTab.length - 2] = e;
newTab[newTab.length - 1] = newTab[newTab.length - 2];
this.values = newTab;
++this.size;
} else if (this.values == null) {
// Add the first group
this.values = new int[] {e, e};
this.size = 1;
}
}
} | java | public void set(SortedSet<? extends Number> collection) {
this.values = null;
this.size = 0;
for (final Number number : collection) {
final int e = number.intValue();
if ((this.values != null) && (e == this.values[this.values.length - 1] + 1)) {
// Same group
++this.values[this.values.length - 1];
++this.size;
}
if ((this.values != null) && (e > this.values[this.values.length - 1] + 1)) {
// Create a new group
final int[] newTab = new int[this.values.length + 2];
System.arraycopy(this.values, 0, newTab, 0, this.values.length);
newTab[newTab.length - 2] = e;
newTab[newTab.length - 1] = newTab[newTab.length - 2];
this.values = newTab;
++this.size;
} else if (this.values == null) {
// Add the first group
this.values = new int[] {e, e};
this.size = 1;
}
}
} | [
"public",
"void",
"set",
"(",
"SortedSet",
"<",
"?",
"extends",
"Number",
">",
"collection",
")",
"{",
"this",
".",
"values",
"=",
"null",
";",
"this",
".",
"size",
"=",
"0",
";",
"for",
"(",
"final",
"Number",
"number",
":",
"collection",
")",
"{",
... | Set the content of this list from the specified collection.
@param collection is the values to pout inside this list. | [
"Set",
"the",
"content",
"of",
"this",
"list",
"from",
"the",
"specified",
"collection",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/util/src/main/java/org/arakhne/afc/util/IntegerList.java#L552-L579 | train |
gallandarakhneorg/afc | core/util/src/main/java/org/arakhne/afc/util/IntegerList.java | IntegerList.toSortedSet | @Pure
public SortedSet<Integer> toSortedSet() {
final SortedSet<Integer> theset = new TreeSet<>();
if (this.values != null) {
for (int idxStart = 0; idxStart < this.values.length - 1; idxStart += 2) {
for (int n = this.values[idxStart]; n <= this.values[idxStart + 1]; ++n) {
theset.add(n);
}
}
}
return theset;
} | java | @Pure
public SortedSet<Integer> toSortedSet() {
final SortedSet<Integer> theset = new TreeSet<>();
if (this.values != null) {
for (int idxStart = 0; idxStart < this.values.length - 1; idxStart += 2) {
for (int n = this.values[idxStart]; n <= this.values[idxStart + 1]; ++n) {
theset.add(n);
}
}
}
return theset;
} | [
"@",
"Pure",
"public",
"SortedSet",
"<",
"Integer",
">",
"toSortedSet",
"(",
")",
"{",
"final",
"SortedSet",
"<",
"Integer",
">",
"theset",
"=",
"new",
"TreeSet",
"<>",
"(",
")",
";",
"if",
"(",
"this",
".",
"values",
"!=",
"null",
")",
"{",
"for",
... | Replies the complete list of stored integers.
@return the set of values. | [
"Replies",
"the",
"complete",
"list",
"of",
"stored",
"integers",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/util/src/main/java/org/arakhne/afc/util/IntegerList.java#L779-L790 | train |
agmip/translator-dssat | src/main/java/org/agmip/translators/dssat/DssatCommonOutput.java | DssatCommonOutput.formatDateStr2 | protected String formatDateStr2(String str) {
// Initial Calendar object
Calendar cal = Calendar.getInstance();
str = str.replaceAll("/", "");
try {
// Set date with input value
cal.set(Integer.parseInt(str.substring(0, 4)), Integer.parseInt(str.substring(4, 6)) - 1, Integer.parseInt(str.substring(6)));
// translatet to yyddd format
return String.format("%1$02d%2$03d", cal.get(Calendar.YEAR) % 100, cal.get(Calendar.DAY_OF_YEAR));
} catch (Exception e) {
// if tranlate failed, then use default value for date
//sbError.append("! Waring: There is a invalid date [").append(str).append("]\r\n");
return formatDateStr2(defValD);
}
} | java | protected String formatDateStr2(String str) {
// Initial Calendar object
Calendar cal = Calendar.getInstance();
str = str.replaceAll("/", "");
try {
// Set date with input value
cal.set(Integer.parseInt(str.substring(0, 4)), Integer.parseInt(str.substring(4, 6)) - 1, Integer.parseInt(str.substring(6)));
// translatet to yyddd format
return String.format("%1$02d%2$03d", cal.get(Calendar.YEAR) % 100, cal.get(Calendar.DAY_OF_YEAR));
} catch (Exception e) {
// if tranlate failed, then use default value for date
//sbError.append("! Waring: There is a invalid date [").append(str).append("]\r\n");
return formatDateStr2(defValD);
}
} | [
"protected",
"String",
"formatDateStr2",
"(",
"String",
"str",
")",
"{",
"// Initial Calendar object",
"Calendar",
"cal",
"=",
"Calendar",
".",
"getInstance",
"(",
")",
";",
"str",
"=",
"str",
".",
"replaceAll",
"(",
"\"/\"",
",",
"\"\"",
")",
";",
"try",
... | Translate data str from "yyyymmdd" to "yyddd"
2012/3/19 change input format from "yy/mm/dd" to "yyyymmdd"
@param str date string with format of "yyyymmdd"
@return result date string with format of "yyddd" | [
"Translate",
"data",
"str",
"from",
"yyyymmdd",
"to",
"yyddd"
] | 4be61d998f106eb7234ea8701b63c3746ae688f4 | https://github.com/agmip/translator-dssat/blob/4be61d998f106eb7234ea8701b63c3746ae688f4/src/main/java/org/agmip/translators/dssat/DssatCommonOutput.java#L49-L64 | train |
agmip/translator-dssat | src/main/java/org/agmip/translators/dssat/DssatCommonOutput.java | DssatCommonOutput.formatDateStr | protected static String formatDateStr(String startDate, String strDays) {
// Initial Calendar object
Calendar cal = Calendar.getInstance();
int days;
startDate = startDate.replaceAll("/", "");
try {
days = Double.valueOf(strDays).intValue();
// Set date with input value
cal.set(Integer.parseInt(startDate.substring(0, 4)), Integer.parseInt(startDate.substring(4, 6)) - 1, Integer.parseInt(startDate.substring(6)));
cal.add(Calendar.DATE, days);
// translatet to yyddd format
return String.format("%1$02d%2$03d", cal.get(Calendar.YEAR) % 100, cal.get(Calendar.DAY_OF_YEAR));
} catch (Exception e) {
// if tranlate failed, then use default value for date
// sbError.append("! Waring: There is a invalid date [").append(startDate).append("]\r\n");
return "-99"; //formatDateStr(defValD);
}
} | java | protected static String formatDateStr(String startDate, String strDays) {
// Initial Calendar object
Calendar cal = Calendar.getInstance();
int days;
startDate = startDate.replaceAll("/", "");
try {
days = Double.valueOf(strDays).intValue();
// Set date with input value
cal.set(Integer.parseInt(startDate.substring(0, 4)), Integer.parseInt(startDate.substring(4, 6)) - 1, Integer.parseInt(startDate.substring(6)));
cal.add(Calendar.DATE, days);
// translatet to yyddd format
return String.format("%1$02d%2$03d", cal.get(Calendar.YEAR) % 100, cal.get(Calendar.DAY_OF_YEAR));
} catch (Exception e) {
// if tranlate failed, then use default value for date
// sbError.append("! Waring: There is a invalid date [").append(startDate).append("]\r\n");
return "-99"; //formatDateStr(defValD);
}
} | [
"protected",
"static",
"String",
"formatDateStr",
"(",
"String",
"startDate",
",",
"String",
"strDays",
")",
"{",
"// Initial Calendar object",
"Calendar",
"cal",
"=",
"Calendar",
".",
"getInstance",
"(",
")",
";",
"int",
"days",
";",
"startDate",
"=",
"startDat... | Translate data str from "yyyymmdd" to "yyddd" plus days you want
@param startDate date string with format of "yyyymmdd"
@param strDays the number of days need to be added on
@return result date string with format of "yyddd" | [
"Translate",
"data",
"str",
"from",
"yyyymmdd",
"to",
"yyddd",
"plus",
"days",
"you",
"want"
] | 4be61d998f106eb7234ea8701b63c3746ae688f4 | https://github.com/agmip/translator-dssat/blob/4be61d998f106eb7234ea8701b63c3746ae688f4/src/main/java/org/agmip/translators/dssat/DssatCommonOutput.java#L152-L171 | train |
agmip/translator-dssat | src/main/java/org/agmip/translators/dssat/DssatCommonOutput.java | DssatCommonOutput.getExName | protected String getExName(Map result) {
String ret = getValueOr(result, "exname", "");
if (ret.matches("\\w+\\.\\w{2}[Xx]")) {
ret = ret.substring(0, ret.length() - 1).replace(".", "");
}
// TODO need to be updated with a translate rule for other models' exname
if (ret.matches(".+(_+\\d+)+$")) {
ret = ret.replaceAll("(_+\\d+)+$", "");
}
return ret;
} | java | protected String getExName(Map result) {
String ret = getValueOr(result, "exname", "");
if (ret.matches("\\w+\\.\\w{2}[Xx]")) {
ret = ret.substring(0, ret.length() - 1).replace(".", "");
}
// TODO need to be updated with a translate rule for other models' exname
if (ret.matches(".+(_+\\d+)+$")) {
ret = ret.replaceAll("(_+\\d+)+$", "");
}
return ret;
} | [
"protected",
"String",
"getExName",
"(",
"Map",
"result",
")",
"{",
"String",
"ret",
"=",
"getValueOr",
"(",
"result",
",",
"\"exname\"",
",",
"\"\"",
")",
";",
"if",
"(",
"ret",
".",
"matches",
"(",
"\"\\\\w+\\\\.\\\\w{2}[Xx]\"",
")",
")",
"{",
"ret",
"... | Get experiment name without any extention content after first underscore
@param result date holder for experiment data
@return experiment name | [
"Get",
"experiment",
"name",
"without",
"any",
"extention",
"content",
"after",
"first",
"underscore"
] | 4be61d998f106eb7234ea8701b63c3746ae688f4 | https://github.com/agmip/translator-dssat/blob/4be61d998f106eb7234ea8701b63c3746ae688f4/src/main/java/org/agmip/translators/dssat/DssatCommonOutput.java#L179-L191 | train |
agmip/translator-dssat | src/main/java/org/agmip/translators/dssat/DssatCommonOutput.java | DssatCommonOutput.getCrid | protected String getCrid(Map result) {
HashMap mgnData = getObjectOr(result, "management", new HashMap());
ArrayList<HashMap> events = getObjectOr(mgnData, "events", new ArrayList());
String crid = null;
boolean isPlEventExist = false;
for (HashMap event : events) {
if ("planting".equals(event.get("event"))) {
isPlEventExist = true;
if (crid == null) {
crid = (String) event.get("crid");
} else if (!crid.equals(event.get("crid"))) {
return "SQ";
}
}
}
if (crid == null) {
crid = getValueOr(result, "crid", "XX");
}
if (!isPlEventExist && "XX".equals(crid)) {
return "FA";
} else {
// DssatCRIDHelper crids = new DssatCRIDHelper();
return DssatCRIDHelper.get2BitCrid(crid);
}
} | java | protected String getCrid(Map result) {
HashMap mgnData = getObjectOr(result, "management", new HashMap());
ArrayList<HashMap> events = getObjectOr(mgnData, "events", new ArrayList());
String crid = null;
boolean isPlEventExist = false;
for (HashMap event : events) {
if ("planting".equals(event.get("event"))) {
isPlEventExist = true;
if (crid == null) {
crid = (String) event.get("crid");
} else if (!crid.equals(event.get("crid"))) {
return "SQ";
}
}
}
if (crid == null) {
crid = getValueOr(result, "crid", "XX");
}
if (!isPlEventExist && "XX".equals(crid)) {
return "FA";
} else {
// DssatCRIDHelper crids = new DssatCRIDHelper();
return DssatCRIDHelper.get2BitCrid(crid);
}
} | [
"protected",
"String",
"getCrid",
"(",
"Map",
"result",
")",
"{",
"HashMap",
"mgnData",
"=",
"getObjectOr",
"(",
"result",
",",
"\"management\"",
",",
"new",
"HashMap",
"(",
")",
")",
";",
"ArrayList",
"<",
"HashMap",
">",
"events",
"=",
"getObjectOr",
"("... | Get crop id with 2-bit format
@param result date holder for experiment data
@return crop id | [
"Get",
"crop",
"id",
"with",
"2",
"-",
"bit",
"format"
] | 4be61d998f106eb7234ea8701b63c3746ae688f4 | https://github.com/agmip/translator-dssat/blob/4be61d998f106eb7234ea8701b63c3746ae688f4/src/main/java/org/agmip/translators/dssat/DssatCommonOutput.java#L199-L224 | train |
agmip/translator-dssat | src/main/java/org/agmip/translators/dssat/DssatCommonOutput.java | DssatCommonOutput.getFileName | protected synchronized String getFileName(Map result, String fileType) {
String exname = getExName(result);
String crid;
if (getValueOr(result, "seasonal_dome_applied", "N").equals("Y")) {
crid = "SN";
} else {
crid = getCrid(result);
}
if (exname.length() == 10) {
if (crid.equals("XX") || crid.equals("FA")) {
crid = exname.substring(exname.length() - 2, exname.length());
}
}
String ret;
if (exToFileMap.containsKey(exname + "_" + crid)) {
return exToFileMap.get(exname + "_" + crid) + fileType;
} else {
ret = exname;
if (ret.equals("")) {
ret = "TEMP0001";
} else {
try {
if (ret.endsWith(crid)) {
ret = ret.substring(0, ret.length() - crid.length());
}
// If the exname is too long
if (ret.length() > 8) {
ret = ret.substring(0, 8);
}
// If the exname do not follow the Dssat rule
if (!ret.matches("[\\w ]{1,6}\\d{2}$")) {
if (ret.length() > 6) {
ret = ret.substring(0, 6);
}
ret += "01";
}
} catch (Exception e) {
ret = "TEMP0001";
}
}
// Special handling for batch
if (exname.matches(".+_\\d+_b\\S+(__\\d+)?$")) {
int idx = exname.lastIndexOf("_b") + 2;
ret += "B" + exname.substring(idx).replaceAll("__\\d+$", "");
}
// Find a non-repeated file name
int count;
while (fileNameSet.contains(ret + "." + crid)) {
try {
count = Integer.parseInt(ret.substring(ret.length() - 2, ret.length()));
count++;
} catch (Exception e) {
count = 1;
}
ret = ret.replaceAll("\\w{2}$", String.format("%02d", count));
}
}
exToFileMap.put(exname + "_" + crid, ret + "." + crid);
fileNameSet.add(ret + "." + crid);
return ret + "." + crid + fileType;
} | java | protected synchronized String getFileName(Map result, String fileType) {
String exname = getExName(result);
String crid;
if (getValueOr(result, "seasonal_dome_applied", "N").equals("Y")) {
crid = "SN";
} else {
crid = getCrid(result);
}
if (exname.length() == 10) {
if (crid.equals("XX") || crid.equals("FA")) {
crid = exname.substring(exname.length() - 2, exname.length());
}
}
String ret;
if (exToFileMap.containsKey(exname + "_" + crid)) {
return exToFileMap.get(exname + "_" + crid) + fileType;
} else {
ret = exname;
if (ret.equals("")) {
ret = "TEMP0001";
} else {
try {
if (ret.endsWith(crid)) {
ret = ret.substring(0, ret.length() - crid.length());
}
// If the exname is too long
if (ret.length() > 8) {
ret = ret.substring(0, 8);
}
// If the exname do not follow the Dssat rule
if (!ret.matches("[\\w ]{1,6}\\d{2}$")) {
if (ret.length() > 6) {
ret = ret.substring(0, 6);
}
ret += "01";
}
} catch (Exception e) {
ret = "TEMP0001";
}
}
// Special handling for batch
if (exname.matches(".+_\\d+_b\\S+(__\\d+)?$")) {
int idx = exname.lastIndexOf("_b") + 2;
ret += "B" + exname.substring(idx).replaceAll("__\\d+$", "");
}
// Find a non-repeated file name
int count;
while (fileNameSet.contains(ret + "." + crid)) {
try {
count = Integer.parseInt(ret.substring(ret.length() - 2, ret.length()));
count++;
} catch (Exception e) {
count = 1;
}
ret = ret.replaceAll("\\w{2}$", String.format("%02d", count));
}
}
exToFileMap.put(exname + "_" + crid, ret + "." + crid);
fileNameSet.add(ret + "." + crid);
return ret + "." + crid + fileType;
} | [
"protected",
"synchronized",
"String",
"getFileName",
"(",
"Map",
"result",
",",
"String",
"fileType",
")",
"{",
"String",
"exname",
"=",
"getExName",
"(",
"result",
")",
";",
"String",
"crid",
";",
"if",
"(",
"getValueOr",
"(",
"result",
",",
"\"seasonal_do... | Generate output file name
@param result date holder for experiment data
@param fileType the last letter from file extend name
@return file name | [
"Generate",
"output",
"file",
"name"
] | 4be61d998f106eb7234ea8701b63c3746ae688f4 | https://github.com/agmip/translator-dssat/blob/4be61d998f106eb7234ea8701b63c3746ae688f4/src/main/java/org/agmip/translators/dssat/DssatCommonOutput.java#L233-L298 | train |
agmip/translator-dssat | src/main/java/org/agmip/translators/dssat/DssatCommonOutput.java | DssatCommonOutput.decompressData | protected void decompressData(HashMap m) {
for (Object key : m.keySet()) {
if (m.get(key) instanceof ArrayList) {
// iterate sub array nodes
decompressData((ArrayList) m.get(key));
} else if (m.get(key) instanceof HashMap) {
// iterate sub data nodes
decompressData((HashMap) m.get(key));
} else {
// ignore other type nodes
}
}
} | java | protected void decompressData(HashMap m) {
for (Object key : m.keySet()) {
if (m.get(key) instanceof ArrayList) {
// iterate sub array nodes
decompressData((ArrayList) m.get(key));
} else if (m.get(key) instanceof HashMap) {
// iterate sub data nodes
decompressData((HashMap) m.get(key));
} else {
// ignore other type nodes
}
}
} | [
"protected",
"void",
"decompressData",
"(",
"HashMap",
"m",
")",
"{",
"for",
"(",
"Object",
"key",
":",
"m",
".",
"keySet",
"(",
")",
")",
"{",
"if",
"(",
"m",
".",
"get",
"(",
"key",
")",
"instanceof",
"ArrayList",
")",
"{",
"// iterate sub array node... | decompress the data in a map object
@param m input map | [
"decompress",
"the",
"data",
"in",
"a",
"map",
"object"
] | 4be61d998f106eb7234ea8701b63c3746ae688f4 | https://github.com/agmip/translator-dssat/blob/4be61d998f106eb7234ea8701b63c3746ae688f4/src/main/java/org/agmip/translators/dssat/DssatCommonOutput.java#L338-L352 | train |
agmip/translator-dssat | src/main/java/org/agmip/translators/dssat/DssatCommonOutput.java | DssatCommonOutput.decompressData | protected void decompressData(ArrayList arr) {
HashMap fstData = null; // The first data record (Map type)
HashMap cprData; // The following data record which will be compressed
for (Object sub : arr) {
if (sub instanceof ArrayList) {
// iterate sub array nodes
decompressData((ArrayList) sub);
} else if (sub instanceof HashMap) {
// iterate sub data nodes
decompressData((HashMap) sub);
// Compress data for current array
if (fstData == null) {
// Get first data node
fstData = (HashMap) sub;
} else {
cprData = (HashMap) sub;
// The omitted data will be recovered to the following map; Only data item (String type) will be processed
for (Object key : fstData.keySet()) {
if (!cprData.containsKey(key)) {
cprData.put(key, fstData.get(key));
}
}
}
} else {
}
}
} | java | protected void decompressData(ArrayList arr) {
HashMap fstData = null; // The first data record (Map type)
HashMap cprData; // The following data record which will be compressed
for (Object sub : arr) {
if (sub instanceof ArrayList) {
// iterate sub array nodes
decompressData((ArrayList) sub);
} else if (sub instanceof HashMap) {
// iterate sub data nodes
decompressData((HashMap) sub);
// Compress data for current array
if (fstData == null) {
// Get first data node
fstData = (HashMap) sub;
} else {
cprData = (HashMap) sub;
// The omitted data will be recovered to the following map; Only data item (String type) will be processed
for (Object key : fstData.keySet()) {
if (!cprData.containsKey(key)) {
cprData.put(key, fstData.get(key));
}
}
}
} else {
}
}
} | [
"protected",
"void",
"decompressData",
"(",
"ArrayList",
"arr",
")",
"{",
"HashMap",
"fstData",
"=",
"null",
";",
"// The first data record (Map type)",
"HashMap",
"cprData",
";",
"// The following data record which will be compressed",
"for",
"(",
"Object",
"sub",
":",
... | decompress the data in an ArrayList object
@param arr input ArrayList | [
"decompress",
"the",
"data",
"in",
"an",
"ArrayList",
"object"
] | 4be61d998f106eb7234ea8701b63c3746ae688f4 | https://github.com/agmip/translator-dssat/blob/4be61d998f106eb7234ea8701b63c3746ae688f4/src/main/java/org/agmip/translators/dssat/DssatCommonOutput.java#L360-L387 | train |
agmip/translator-dssat | src/main/java/org/agmip/translators/dssat/DssatCommonOutput.java | DssatCommonOutput.getPdate | protected String getPdate(Map result) {
HashMap management = getObjectOr(result, "management", new HashMap());
ArrayList<HashMap> events = getObjectOr(management, "events", new ArrayList<HashMap>());
for (HashMap event : events) {
if (getValueOr(event, "event", "").equals("planting")) {
return getValueOr(event, "date", "");
}
}
return "";
} | java | protected String getPdate(Map result) {
HashMap management = getObjectOr(result, "management", new HashMap());
ArrayList<HashMap> events = getObjectOr(management, "events", new ArrayList<HashMap>());
for (HashMap event : events) {
if (getValueOr(event, "event", "").equals("planting")) {
return getValueOr(event, "date", "");
}
}
return "";
} | [
"protected",
"String",
"getPdate",
"(",
"Map",
"result",
")",
"{",
"HashMap",
"management",
"=",
"getObjectOr",
"(",
"result",
",",
"\"management\"",
",",
"new",
"HashMap",
"(",
")",
")",
";",
"ArrayList",
"<",
"HashMap",
">",
"events",
"=",
"getObjectOr",
... | Get plating date from experiment management event
@param result the experiment data object
@return plating date | [
"Get",
"plating",
"date",
"from",
"experiment",
"management",
"event"
] | 4be61d998f106eb7234ea8701b63c3746ae688f4 | https://github.com/agmip/translator-dssat/blob/4be61d998f106eb7234ea8701b63c3746ae688f4/src/main/java/org/agmip/translators/dssat/DssatCommonOutput.java#L395-L406 | train |
gallandarakhneorg/afc | core/inputoutput/src/main/java/org/arakhne/afc/inputoutput/filetype/ZipArchiveMagicNumber.java | ZipArchiveMagicNumber.isContentTypeIn | private boolean isContentTypeIn(ZipInputStream stream) throws IOException {
boolean isContentType = false;
if (this.innerFile != null) {
final String strInner = this.innerFile.toString();
InputStream dataStream = null;
ZipEntry zipEntry = stream.getNextEntry();
while (zipEntry != null && dataStream == null) {
if (strInner.equals(zipEntry.getName())) {
dataStream = stream;
} else {
zipEntry = stream.getNextEntry();
}
}
if (dataStream != null) {
isContentType = isContentType(stream, zipEntry, dataStream);
}
} else {
isContentType = isContentType(stream, null, null);
}
return isContentType;
} | java | private boolean isContentTypeIn(ZipInputStream stream) throws IOException {
boolean isContentType = false;
if (this.innerFile != null) {
final String strInner = this.innerFile.toString();
InputStream dataStream = null;
ZipEntry zipEntry = stream.getNextEntry();
while (zipEntry != null && dataStream == null) {
if (strInner.equals(zipEntry.getName())) {
dataStream = stream;
} else {
zipEntry = stream.getNextEntry();
}
}
if (dataStream != null) {
isContentType = isContentType(stream, zipEntry, dataStream);
}
} else {
isContentType = isContentType(stream, null, null);
}
return isContentType;
} | [
"private",
"boolean",
"isContentTypeIn",
"(",
"ZipInputStream",
"stream",
")",
"throws",
"IOException",
"{",
"boolean",
"isContentType",
"=",
"false",
";",
"if",
"(",
"this",
".",
"innerFile",
"!=",
"null",
")",
"{",
"final",
"String",
"strInner",
"=",
"this",... | Replies if the given ZIP stream contains data of the expected type.
@throws IOException if the stream cannot be read. | [
"Replies",
"if",
"the",
"given",
"ZIP",
"stream",
"contains",
"data",
"of",
"the",
"expected",
"type",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/inputoutput/src/main/java/org/arakhne/afc/inputoutput/filetype/ZipArchiveMagicNumber.java#L109-L129 | train |
gallandarakhneorg/afc | advanced/dbasefile/src/main/java/org/arakhne/afc/io/dbase/attr/DBaseFileAttributePool.java | DBaseFileAttributePool.close | public void close() throws IOException {
this.accessors.clear();
if (this.reader != null) {
this.reader.close();
this.reader = null;
}
} | java | public void close() throws IOException {
this.accessors.clear();
if (this.reader != null) {
this.reader.close();
this.reader = null;
}
} | [
"public",
"void",
"close",
"(",
")",
"throws",
"IOException",
"{",
"this",
".",
"accessors",
".",
"clear",
"(",
")",
";",
"if",
"(",
"this",
".",
"reader",
"!=",
"null",
")",
"{",
"this",
".",
"reader",
".",
"close",
"(",
")",
";",
"this",
".",
"... | Close all opened accessors.
@throws IOException in case of error. | [
"Close",
"all",
"opened",
"accessors",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/dbasefile/src/main/java/org/arakhne/afc/io/dbase/attr/DBaseFileAttributePool.java#L315-L321 | train |
gallandarakhneorg/afc | advanced/dbasefile/src/main/java/org/arakhne/afc/io/dbase/attr/DBaseFileAttributePool.java | DBaseFileAttributePool.getReader | @Pure
protected DBaseFileReader getReader() throws IOException {
if (this.reader == null) {
this.reader = new DBaseFileReader(this.url.openStream());
this.reader.readDBFHeader();
this.reader.readDBFFields();
}
return this.reader;
} | java | @Pure
protected DBaseFileReader getReader() throws IOException {
if (this.reader == null) {
this.reader = new DBaseFileReader(this.url.openStream());
this.reader.readDBFHeader();
this.reader.readDBFFields();
}
return this.reader;
} | [
"@",
"Pure",
"protected",
"DBaseFileReader",
"getReader",
"(",
")",
"throws",
"IOException",
"{",
"if",
"(",
"this",
".",
"reader",
"==",
"null",
")",
"{",
"this",
".",
"reader",
"=",
"new",
"DBaseFileReader",
"(",
"this",
".",
"url",
".",
"openStream",
... | Replies the reader.
@return the reader.
@throws IOException in case of error. | [
"Replies",
"the",
"reader",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/dbasefile/src/main/java/org/arakhne/afc/io/dbase/attr/DBaseFileAttributePool.java#L348-L356 | train |
gallandarakhneorg/afc | advanced/dbasefile/src/main/java/org/arakhne/afc/io/dbase/attr/DBaseFileAttributePool.java | DBaseFileAttributePool.getAllAttributeNames | @SuppressWarnings("resource")
@Pure
public Collection<String> getAllAttributeNames(int recordNumber) {
try {
final DBaseFileReader dbReader = getReader();
synchronized (dbReader) {
final List<DBaseFileField> fields = dbReader.getDBFFields();
if (fields == null) {
return Collections.emptyList();
}
final ArrayList<String> titles = new ArrayList<>(fields.size());
for (int i = 0; i < fields.size(); ++i) {
titles.add(fields.get(i).getName());
}
return titles;
}
} catch (IOException exception) {
return Collections.emptyList();
}
} | java | @SuppressWarnings("resource")
@Pure
public Collection<String> getAllAttributeNames(int recordNumber) {
try {
final DBaseFileReader dbReader = getReader();
synchronized (dbReader) {
final List<DBaseFileField> fields = dbReader.getDBFFields();
if (fields == null) {
return Collections.emptyList();
}
final ArrayList<String> titles = new ArrayList<>(fields.size());
for (int i = 0; i < fields.size(); ++i) {
titles.add(fields.get(i).getName());
}
return titles;
}
} catch (IOException exception) {
return Collections.emptyList();
}
} | [
"@",
"SuppressWarnings",
"(",
"\"resource\"",
")",
"@",
"Pure",
"public",
"Collection",
"<",
"String",
">",
"getAllAttributeNames",
"(",
"int",
"recordNumber",
")",
"{",
"try",
"{",
"final",
"DBaseFileReader",
"dbReader",
"=",
"getReader",
"(",
")",
";",
"sync... | Replies the names of all the attributes that corresponds to the specified
record number.
<p>The parameter is not used because, in a dBase file, all the record
have the same attribute names.
@param recordNumber the number of the record.
@return the collection of attribute names | [
"Replies",
"the",
"names",
"of",
"all",
"the",
"attributes",
"that",
"corresponds",
"to",
"the",
"specified",
"record",
"number",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/dbasefile/src/main/java/org/arakhne/afc/io/dbase/attr/DBaseFileAttributePool.java#L368-L387 | train |
gallandarakhneorg/afc | advanced/dbasefile/src/main/java/org/arakhne/afc/io/dbase/attr/DBaseFileAttributePool.java | DBaseFileAttributePool.getAttributeCount | @SuppressWarnings("resource")
@Pure
public int getAttributeCount() {
try {
final DBaseFileReader dbReader = getReader();
synchronized (dbReader) {
return dbReader.getDBFFieldCount();
}
} catch (IOException exception) {
return 0;
}
} | java | @SuppressWarnings("resource")
@Pure
public int getAttributeCount() {
try {
final DBaseFileReader dbReader = getReader();
synchronized (dbReader) {
return dbReader.getDBFFieldCount();
}
} catch (IOException exception) {
return 0;
}
} | [
"@",
"SuppressWarnings",
"(",
"\"resource\"",
")",
"@",
"Pure",
"public",
"int",
"getAttributeCount",
"(",
")",
"{",
"try",
"{",
"final",
"DBaseFileReader",
"dbReader",
"=",
"getReader",
"(",
")",
";",
"synchronized",
"(",
"dbReader",
")",
"{",
"return",
"db... | Replies the count of attributes.
@return the count of attributes | [
"Replies",
"the",
"count",
"of",
"attributes",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/dbasefile/src/main/java/org/arakhne/afc/io/dbase/attr/DBaseFileAttributePool.java#L393-L404 | train |
gallandarakhneorg/afc | advanced/dbasefile/src/main/java/org/arakhne/afc/io/dbase/attr/DBaseFileAttributePool.java | DBaseFileAttributePool.getRawValue | @SuppressWarnings("resource")
@Pure
public Object getRawValue(int recordNumber, String name, OutputParameter<AttributeType> type) throws AttributeException {
try {
final DBaseFileReader dbReader = getReader();
synchronized (dbReader) {
dbReader.seek(recordNumber);
final DBaseFileRecord record = dbReader.readNextDBFRecord();
if (record != null) {
final int column = dbReader.getDBFFieldIndex(name);
if (column >= 0) {
final Object value = record.getFieldValue(column);
final DBaseFieldType dbfType = dbReader.getDBFFieldType(column);
type.set(dbfType.toAttributeType());
return value;
}
}
throw new NoAttributeFoundException(name);
}
} catch (IOException e) {
throw new AttributeException(e);
}
} | java | @SuppressWarnings("resource")
@Pure
public Object getRawValue(int recordNumber, String name, OutputParameter<AttributeType> type) throws AttributeException {
try {
final DBaseFileReader dbReader = getReader();
synchronized (dbReader) {
dbReader.seek(recordNumber);
final DBaseFileRecord record = dbReader.readNextDBFRecord();
if (record != null) {
final int column = dbReader.getDBFFieldIndex(name);
if (column >= 0) {
final Object value = record.getFieldValue(column);
final DBaseFieldType dbfType = dbReader.getDBFFieldType(column);
type.set(dbfType.toAttributeType());
return value;
}
}
throw new NoAttributeFoundException(name);
}
} catch (IOException e) {
throw new AttributeException(e);
}
} | [
"@",
"SuppressWarnings",
"(",
"\"resource\"",
")",
"@",
"Pure",
"public",
"Object",
"getRawValue",
"(",
"int",
"recordNumber",
",",
"String",
"name",
",",
"OutputParameter",
"<",
"AttributeType",
">",
"type",
")",
"throws",
"AttributeException",
"{",
"try",
"{",... | Replies the raw value that corresponds to the specified
attribute name for the given record.
@param recordNumber is the index of the record to read ({@code 0..recordCount-1}).
@param name is the name of the attribute value to replies.
@param type is the type of the replied value. Tis attribute will be set by this function.
@return the value extracted from the pool.
@throws AttributeException if an attribute cannot be read. | [
"Replies",
"the",
"raw",
"value",
"that",
"corresponds",
"to",
"the",
"specified",
"attribute",
"name",
"for",
"the",
"given",
"record",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/dbasefile/src/main/java/org/arakhne/afc/io/dbase/attr/DBaseFileAttributePool.java#L416-L438 | train |
gallandarakhneorg/afc | core/inputoutput/src/main/java/org/arakhne/afc/inputoutput/endian/EndianNumbers.java | EndianNumbers.toLEInt | @Pure
public static int toLEInt(int b1, int b2, int b3, int b4) {
return ((b4 & 0xFF) << 24) + ((b3 & 0xFF) << 16) + ((b2 & 0xFF) << 8) + (b1 & 0xFF);
} | java | @Pure
public static int toLEInt(int b1, int b2, int b3, int b4) {
return ((b4 & 0xFF) << 24) + ((b3 & 0xFF) << 16) + ((b2 & 0xFF) << 8) + (b1 & 0xFF);
} | [
"@",
"Pure",
"public",
"static",
"int",
"toLEInt",
"(",
"int",
"b1",
",",
"int",
"b2",
",",
"int",
"b3",
",",
"int",
"b4",
")",
"{",
"return",
"(",
"(",
"b4",
"&",
"0xFF",
")",
"<<",
"24",
")",
"+",
"(",
"(",
"b3",
"&",
"0xFF",
")",
"<<",
"... | Converting four bytes to a Little Endian integer.
@param b1 the first byte.
@param b2 the second byte.
@param b3 the third byte.
@param b4 the fourth byte.
@return the conversion result | [
"Converting",
"four",
"bytes",
"to",
"a",
"Little",
"Endian",
"integer",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/inputoutput/src/main/java/org/arakhne/afc/inputoutput/endian/EndianNumbers.java#L75-L78 | train |
gallandarakhneorg/afc | core/inputoutput/src/main/java/org/arakhne/afc/inputoutput/endian/EndianNumbers.java | EndianNumbers.toBEInt | @Pure
public static int toBEInt(int b1, int b2, int b3, int b4) {
return ((b1 & 0xFF) << 24) + ((b2 & 0xFF) << 16) + ((b3 & 0xFF) << 8) + (b4 & 0xFF);
} | java | @Pure
public static int toBEInt(int b1, int b2, int b3, int b4) {
return ((b1 & 0xFF) << 24) + ((b2 & 0xFF) << 16) + ((b3 & 0xFF) << 8) + (b4 & 0xFF);
} | [
"@",
"Pure",
"public",
"static",
"int",
"toBEInt",
"(",
"int",
"b1",
",",
"int",
"b2",
",",
"int",
"b3",
",",
"int",
"b4",
")",
"{",
"return",
"(",
"(",
"b1",
"&",
"0xFF",
")",
"<<",
"24",
")",
"+",
"(",
"(",
"b2",
"&",
"0xFF",
")",
"<<",
"... | Converting four bytes to a Big Endian integer.
@param b1 the first byte.
@param b2 the second byte.
@param b3 the third byte.
@param b4 the fourth byte.
@return the conversion result | [
"Converting",
"four",
"bytes",
"to",
"a",
"Big",
"Endian",
"integer",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/inputoutput/src/main/java/org/arakhne/afc/inputoutput/endian/EndianNumbers.java#L89-L92 | train |
gallandarakhneorg/afc | core/inputoutput/src/main/java/org/arakhne/afc/inputoutput/endian/EndianNumbers.java | EndianNumbers.toLELong | @Pure
public static long toLELong(int b1, int b2, int b3, int b4, int b5, int b6, int b7, int b8) {
return ((b8 & 0xFF) << 56) + ((b7 & 0xFF) << 48) + ((b6 & 0xFF) << 40) + ((b5 & 0xFF) << 32)
+ ((b4 & 0xFF) << 24) + ((b3 & 0xFF) << 16) + ((b2 & 0xFF) << 8) + (b1 & 0xFF);
} | java | @Pure
public static long toLELong(int b1, int b2, int b3, int b4, int b5, int b6, int b7, int b8) {
return ((b8 & 0xFF) << 56) + ((b7 & 0xFF) << 48) + ((b6 & 0xFF) << 40) + ((b5 & 0xFF) << 32)
+ ((b4 & 0xFF) << 24) + ((b3 & 0xFF) << 16) + ((b2 & 0xFF) << 8) + (b1 & 0xFF);
} | [
"@",
"Pure",
"public",
"static",
"long",
"toLELong",
"(",
"int",
"b1",
",",
"int",
"b2",
",",
"int",
"b3",
",",
"int",
"b4",
",",
"int",
"b5",
",",
"int",
"b6",
",",
"int",
"b7",
",",
"int",
"b8",
")",
"{",
"return",
"(",
"(",
"b8",
"&",
"0xF... | Converting eight bytes to a Little Endian integer.
@param b1 the first byte.
@param b2 the second byte.
@param b3 the third byte.
@param b4 the fourth byte.
@param b5 the fifth byte.
@param b6 the sixth byte.
@param b7 the seventh byte.
@param b8 the eighth byte.
@return the conversion result | [
"Converting",
"eight",
"bytes",
"to",
"a",
"Little",
"Endian",
"integer",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/inputoutput/src/main/java/org/arakhne/afc/inputoutput/endian/EndianNumbers.java#L107-L111 | train |
gallandarakhneorg/afc | core/inputoutput/src/main/java/org/arakhne/afc/inputoutput/endian/EndianNumbers.java | EndianNumbers.toLEDouble | @Pure
@Inline(value = "Double.longBitsToDouble(EndianNumbers.toLELong($1, $2, $3, $4, $5, $6, $7, $8))",
imported = {EndianNumbers.class})
public static double toLEDouble(int b1, int b2, int b3, int b4, int b5, int b6, int b7, int b8) {
return Double.longBitsToDouble(toLELong(b1, b2, b3, b4, b5, b6, b7, b8));
} | java | @Pure
@Inline(value = "Double.longBitsToDouble(EndianNumbers.toLELong($1, $2, $3, $4, $5, $6, $7, $8))",
imported = {EndianNumbers.class})
public static double toLEDouble(int b1, int b2, int b3, int b4, int b5, int b6, int b7, int b8) {
return Double.longBitsToDouble(toLELong(b1, b2, b3, b4, b5, b6, b7, b8));
} | [
"@",
"Pure",
"@",
"Inline",
"(",
"value",
"=",
"\"Double.longBitsToDouble(EndianNumbers.toLELong($1, $2, $3, $4, $5, $6, $7, $8))\"",
",",
"imported",
"=",
"{",
"EndianNumbers",
".",
"class",
"}",
")",
"public",
"static",
"double",
"toLEDouble",
"(",
"int",
"b1",
",",... | Converting eight bytes to a Little Endian double.
@param b1 the first byte.
@param b2 the second byte.
@param b3 the third byte.
@param b4 the fourth byte.
@param b5 the fifth byte.
@param b6 the sixth byte.
@param b7 the seventh byte.
@param b8 the eighth byte.
@return the conversion result | [
"Converting",
"eight",
"bytes",
"to",
"a",
"Little",
"Endian",
"double",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/inputoutput/src/main/java/org/arakhne/afc/inputoutput/endian/EndianNumbers.java#L145-L150 | train |
gallandarakhneorg/afc | core/inputoutput/src/main/java/org/arakhne/afc/inputoutput/endian/EndianNumbers.java | EndianNumbers.toBEDouble | @Pure
@Inline(value = "Double.longBitsToDouble(EndianNumbers.toBELong($1, $2, $3, $4, $5, $6, $7, $8))",
imported = {EndianNumbers.class})
public static double toBEDouble(int b1, int b2, int b3, int b4, int b5, int b6, int b7, int b8) {
return Double.longBitsToDouble(toBELong(b1, b2, b3, b4, b5, b6, b7, b8));
} | java | @Pure
@Inline(value = "Double.longBitsToDouble(EndianNumbers.toBELong($1, $2, $3, $4, $5, $6, $7, $8))",
imported = {EndianNumbers.class})
public static double toBEDouble(int b1, int b2, int b3, int b4, int b5, int b6, int b7, int b8) {
return Double.longBitsToDouble(toBELong(b1, b2, b3, b4, b5, b6, b7, b8));
} | [
"@",
"Pure",
"@",
"Inline",
"(",
"value",
"=",
"\"Double.longBitsToDouble(EndianNumbers.toBELong($1, $2, $3, $4, $5, $6, $7, $8))\"",
",",
"imported",
"=",
"{",
"EndianNumbers",
".",
"class",
"}",
")",
"public",
"static",
"double",
"toBEDouble",
"(",
"int",
"b1",
",",... | Converting eight bytes to a Big Endian double.
@param b1 the first byte.
@param b2 the second byte.
@param b3 the third byte.
@param b4 the fourth byte.
@param b5 the fifth byte.
@param b6 the sixth byte.
@param b7 the seventh byte.
@param b8 the eighth byte.
@return the conversion result | [
"Converting",
"eight",
"bytes",
"to",
"a",
"Big",
"Endian",
"double",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/inputoutput/src/main/java/org/arakhne/afc/inputoutput/endian/EndianNumbers.java#L165-L170 | train |
gallandarakhneorg/afc | core/inputoutput/src/main/java/org/arakhne/afc/inputoutput/endian/EndianNumbers.java | EndianNumbers.toLEFloat | @Pure
@Inline(value = "Float.intBitsToFloat(EndianNumbers.toLEInt($1, $2, $3, $4))",
imported = {EndianNumbers.class})
public static float toLEFloat(int b1, int b2, int b3, int b4) {
return Float.intBitsToFloat(toLEInt(b1, b2, b3, b4));
} | java | @Pure
@Inline(value = "Float.intBitsToFloat(EndianNumbers.toLEInt($1, $2, $3, $4))",
imported = {EndianNumbers.class})
public static float toLEFloat(int b1, int b2, int b3, int b4) {
return Float.intBitsToFloat(toLEInt(b1, b2, b3, b4));
} | [
"@",
"Pure",
"@",
"Inline",
"(",
"value",
"=",
"\"Float.intBitsToFloat(EndianNumbers.toLEInt($1, $2, $3, $4))\"",
",",
"imported",
"=",
"{",
"EndianNumbers",
".",
"class",
"}",
")",
"public",
"static",
"float",
"toLEFloat",
"(",
"int",
"b1",
",",
"int",
"b2",
",... | Converting four bytes to a Little Endian float.
@param b1 the first byte.
@param b2 the second byte.
@param b3 the third byte.
@param b4 the fourth byte.
@return the conversion result | [
"Converting",
"four",
"bytes",
"to",
"a",
"Little",
"Endian",
"float",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/inputoutput/src/main/java/org/arakhne/afc/inputoutput/endian/EndianNumbers.java#L181-L186 | train |
gallandarakhneorg/afc | core/inputoutput/src/main/java/org/arakhne/afc/inputoutput/endian/EndianNumbers.java | EndianNumbers.toBEFloat | @Pure
@Inline(value = "Float.intBitsToFloat(EndianNumbers.toBEInt($1, $2, $3, $4))",
imported = {EndianNumbers.class})
public static float toBEFloat(int b1, int b2, int b3, int b4) {
return Float.intBitsToFloat(toBEInt(b1, b2, b3, b4));
} | java | @Pure
@Inline(value = "Float.intBitsToFloat(EndianNumbers.toBEInt($1, $2, $3, $4))",
imported = {EndianNumbers.class})
public static float toBEFloat(int b1, int b2, int b3, int b4) {
return Float.intBitsToFloat(toBEInt(b1, b2, b3, b4));
} | [
"@",
"Pure",
"@",
"Inline",
"(",
"value",
"=",
"\"Float.intBitsToFloat(EndianNumbers.toBEInt($1, $2, $3, $4))\"",
",",
"imported",
"=",
"{",
"EndianNumbers",
".",
"class",
"}",
")",
"public",
"static",
"float",
"toBEFloat",
"(",
"int",
"b1",
",",
"int",
"b2",
",... | Converting four bytes to a Big Endian float.
@param b1 the first byte.
@param b2 the second byte.
@param b3 the third byte.
@param b4 the fourth byte.
@return the conversion result | [
"Converting",
"four",
"bytes",
"to",
"a",
"Big",
"Endian",
"float",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/inputoutput/src/main/java/org/arakhne/afc/inputoutput/endian/EndianNumbers.java#L197-L202 | train |
gallandarakhneorg/afc | core/inputoutput/src/main/java/org/arakhne/afc/inputoutput/endian/EndianNumbers.java | EndianNumbers.parseLEFloat | @Pure
@Inline(value = "EndianNumbers.parseLEInt(Float.floatToIntBits($1))",
imported = {EndianNumbers.class})
public static byte[] parseLEFloat(float value) {
return parseLEInt(Float.floatToIntBits(value));
} | java | @Pure
@Inline(value = "EndianNumbers.parseLEInt(Float.floatToIntBits($1))",
imported = {EndianNumbers.class})
public static byte[] parseLEFloat(float value) {
return parseLEInt(Float.floatToIntBits(value));
} | [
"@",
"Pure",
"@",
"Inline",
"(",
"value",
"=",
"\"EndianNumbers.parseLEInt(Float.floatToIntBits($1))\"",
",",
"imported",
"=",
"{",
"EndianNumbers",
".",
"class",
"}",
")",
"public",
"static",
"byte",
"[",
"]",
"parseLEFloat",
"(",
"float",
"value",
")",
"{",
... | Converts a Java float to a Little Endian int on 4 bytes.
@param value is the value to parse.
@return the parsing result | [
"Converts",
"a",
"Java",
"float",
"to",
"a",
"Little",
"Endian",
"int",
"on",
"4",
"bytes",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/inputoutput/src/main/java/org/arakhne/afc/inputoutput/endian/EndianNumbers.java#L241-L246 | train |
gallandarakhneorg/afc | core/inputoutput/src/main/java/org/arakhne/afc/inputoutput/endian/EndianNumbers.java | EndianNumbers.parseLELong | @Pure
public static byte[] parseLELong(long value) {
return new byte[] {
(byte) (value & 0xFF),
(byte) ((value >> 8) & 0xFF),
(byte) ((value >> 16) & 0xFF),
(byte) ((value >> 24) & 0xFF),
(byte) ((value >> 32) & 0xFF),
(byte) ((value >> 40) & 0xFF),
(byte) ((value >> 48) & 0xFF),
(byte) ((value >> 56) & 0xFF),
};
} | java | @Pure
public static byte[] parseLELong(long value) {
return new byte[] {
(byte) (value & 0xFF),
(byte) ((value >> 8) & 0xFF),
(byte) ((value >> 16) & 0xFF),
(byte) ((value >> 24) & 0xFF),
(byte) ((value >> 32) & 0xFF),
(byte) ((value >> 40) & 0xFF),
(byte) ((value >> 48) & 0xFF),
(byte) ((value >> 56) & 0xFF),
};
} | [
"@",
"Pure",
"public",
"static",
"byte",
"[",
"]",
"parseLELong",
"(",
"long",
"value",
")",
"{",
"return",
"new",
"byte",
"[",
"]",
"{",
"(",
"byte",
")",
"(",
"value",
"&",
"0xFF",
")",
",",
"(",
"byte",
")",
"(",
"(",
"value",
">>",
"8",
")"... | Converts a Java long to a Little Endian int on 8 bytes.
@param value is the value to parse.
@return the parsing result | [
"Converts",
"a",
"Java",
"long",
"to",
"a",
"Little",
"Endian",
"int",
"on",
"8",
"bytes",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/inputoutput/src/main/java/org/arakhne/afc/inputoutput/endian/EndianNumbers.java#L255-L267 | train |
gallandarakhneorg/afc | core/inputoutput/src/main/java/org/arakhne/afc/inputoutput/endian/EndianNumbers.java | EndianNumbers.parseLEDouble | @Pure
@Inline(value = "EndianNumbers.parseLELong(Double.doubleToLongBits($1))",
imported = {EndianNumbers.class})
public static byte[] parseLEDouble(double value) {
return parseLELong(Double.doubleToLongBits(value));
} | java | @Pure
@Inline(value = "EndianNumbers.parseLELong(Double.doubleToLongBits($1))",
imported = {EndianNumbers.class})
public static byte[] parseLEDouble(double value) {
return parseLELong(Double.doubleToLongBits(value));
} | [
"@",
"Pure",
"@",
"Inline",
"(",
"value",
"=",
"\"EndianNumbers.parseLELong(Double.doubleToLongBits($1))\"",
",",
"imported",
"=",
"{",
"EndianNumbers",
".",
"class",
"}",
")",
"public",
"static",
"byte",
"[",
"]",
"parseLEDouble",
"(",
"double",
"value",
")",
"... | Converts a Java double to a Little Endian int on 8 bytes.
@param value is the value to parse.
@return the parsing result | [
"Converts",
"a",
"Java",
"double",
"to",
"a",
"Little",
"Endian",
"int",
"on",
"8",
"bytes",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/inputoutput/src/main/java/org/arakhne/afc/inputoutput/endian/EndianNumbers.java#L275-L280 | train |
gallandarakhneorg/afc | core/inputoutput/src/main/java/org/arakhne/afc/inputoutput/endian/EndianNumbers.java | EndianNumbers.parseBEFloat | @Pure
@Inline(value = "EndianNumbers.parseBEInt(Float.floatToIntBits($1))",
imported = {EndianNumbers.class})
public static byte[] parseBEFloat(float value) {
return parseBEInt(Float.floatToIntBits(value));
} | java | @Pure
@Inline(value = "EndianNumbers.parseBEInt(Float.floatToIntBits($1))",
imported = {EndianNumbers.class})
public static byte[] parseBEFloat(float value) {
return parseBEInt(Float.floatToIntBits(value));
} | [
"@",
"Pure",
"@",
"Inline",
"(",
"value",
"=",
"\"EndianNumbers.parseBEInt(Float.floatToIntBits($1))\"",
",",
"imported",
"=",
"{",
"EndianNumbers",
".",
"class",
"}",
")",
"public",
"static",
"byte",
"[",
"]",
"parseBEFloat",
"(",
"float",
"value",
")",
"{",
... | Converts a Java float to a Big Endian int on 4 bytes.
@param value is the value to parse.
@return the parsing result | [
"Converts",
"a",
"Java",
"float",
"to",
"a",
"Big",
"Endian",
"int",
"on",
"4",
"bytes",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/inputoutput/src/main/java/org/arakhne/afc/inputoutput/endian/EndianNumbers.java#L318-L323 | train |
gallandarakhneorg/afc | core/inputoutput/src/main/java/org/arakhne/afc/inputoutput/endian/EndianNumbers.java | EndianNumbers.parseBELong | @Pure
public static byte[] parseBELong(long value) {
return new byte[] {
(byte) ((value >> 56) & 0xFF),
(byte) ((value >> 48) & 0xFF),
(byte) ((value >> 40) & 0xFF),
(byte) ((value >> 32) & 0xFF),
(byte) ((value >> 24) & 0xFF),
(byte) ((value >> 16) & 0xFF),
(byte) ((value >> 8) & 0xFF),
(byte) (value & 0xFF),
};
} | java | @Pure
public static byte[] parseBELong(long value) {
return new byte[] {
(byte) ((value >> 56) & 0xFF),
(byte) ((value >> 48) & 0xFF),
(byte) ((value >> 40) & 0xFF),
(byte) ((value >> 32) & 0xFF),
(byte) ((value >> 24) & 0xFF),
(byte) ((value >> 16) & 0xFF),
(byte) ((value >> 8) & 0xFF),
(byte) (value & 0xFF),
};
} | [
"@",
"Pure",
"public",
"static",
"byte",
"[",
"]",
"parseBELong",
"(",
"long",
"value",
")",
"{",
"return",
"new",
"byte",
"[",
"]",
"{",
"(",
"byte",
")",
"(",
"(",
"value",
">>",
"56",
")",
"&",
"0xFF",
")",
",",
"(",
"byte",
")",
"(",
"(",
... | Converts a Java long to a Big Endian int on 8 bytes.
@param value is the value to parse.
@return the parsing result | [
"Converts",
"a",
"Java",
"long",
"to",
"a",
"Big",
"Endian",
"int",
"on",
"8",
"bytes",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/inputoutput/src/main/java/org/arakhne/afc/inputoutput/endian/EndianNumbers.java#L332-L344 | train |
gallandarakhneorg/afc | core/inputoutput/src/main/java/org/arakhne/afc/inputoutput/endian/EndianNumbers.java | EndianNumbers.parseBEDouble | @Pure
@Inline(value = "EndianNumbers.parseBELong(Double.doubleToLongBits($1))",
imported = {EndianNumbers.class})
public static byte[] parseBEDouble(double value) {
return parseBELong(Double.doubleToLongBits(value));
} | java | @Pure
@Inline(value = "EndianNumbers.parseBELong(Double.doubleToLongBits($1))",
imported = {EndianNumbers.class})
public static byte[] parseBEDouble(double value) {
return parseBELong(Double.doubleToLongBits(value));
} | [
"@",
"Pure",
"@",
"Inline",
"(",
"value",
"=",
"\"EndianNumbers.parseBELong(Double.doubleToLongBits($1))\"",
",",
"imported",
"=",
"{",
"EndianNumbers",
".",
"class",
"}",
")",
"public",
"static",
"byte",
"[",
"]",
"parseBEDouble",
"(",
"double",
"value",
")",
"... | Converts a Java double to a Big Endian int on 8 bytes.
@param value is the value to parse.
@return the parsing result | [
"Converts",
"a",
"Java",
"double",
"to",
"a",
"Big",
"Endian",
"int",
"on",
"8",
"bytes",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/inputoutput/src/main/java/org/arakhne/afc/inputoutput/endian/EndianNumbers.java#L352-L357 | train |
gallandarakhneorg/afc | advanced/gis/gisroad/src/main/java/org/arakhne/afc/gis/road/SubRoadNetwork.java | SubRoadNetwork.unwrap | @SuppressWarnings({ "unchecked", "static-method" })
@Pure
final <O> O unwrap(O obj) {
O unwrapped = obj;
if (obj instanceof TerminalConnection) {
unwrapped = (O) ((TerminalConnection) obj).getWrappedRoadConnection();
} else if (obj instanceof WrapSegment) {
unwrapped = (O) ((WrapSegment) obj).getWrappedSegment();
}
assert unwrapped != null;
return unwrapped;
} | java | @SuppressWarnings({ "unchecked", "static-method" })
@Pure
final <O> O unwrap(O obj) {
O unwrapped = obj;
if (obj instanceof TerminalConnection) {
unwrapped = (O) ((TerminalConnection) obj).getWrappedRoadConnection();
} else if (obj instanceof WrapSegment) {
unwrapped = (O) ((WrapSegment) obj).getWrappedSegment();
}
assert unwrapped != null;
return unwrapped;
} | [
"@",
"SuppressWarnings",
"(",
"{",
"\"unchecked\"",
",",
"\"static-method\"",
"}",
")",
"@",
"Pure",
"final",
"<",
"O",
">",
"O",
"unwrap",
"(",
"O",
"obj",
")",
"{",
"O",
"unwrapped",
"=",
"obj",
";",
"if",
"(",
"obj",
"instanceof",
"TerminalConnection"... | Unwrap a connection.
@param <O> the type of the object to unwrap.
@param obj the object to unwrap.
@return the unwrapped segment | [
"Unwrap",
"a",
"connection",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/gisroad/src/main/java/org/arakhne/afc/gis/road/SubRoadNetwork.java#L165-L176 | train |
gallandarakhneorg/afc | advanced/mathfx/src/main/java/org/arakhne/afc/math/geometry/d2/dfx/OrientedRectangle2dfx.java | OrientedRectangle2dfx.firstAxisProperty | @Pure
public UnitVectorProperty firstAxisProperty() {
if (this.raxis == null) {
this.raxis = new UnitVectorProperty(this, MathFXAttributeNames.FIRST_AXIS, getGeomFactory());
}
return this.raxis;
} | java | @Pure
public UnitVectorProperty firstAxisProperty() {
if (this.raxis == null) {
this.raxis = new UnitVectorProperty(this, MathFXAttributeNames.FIRST_AXIS, getGeomFactory());
}
return this.raxis;
} | [
"@",
"Pure",
"public",
"UnitVectorProperty",
"firstAxisProperty",
"(",
")",
"{",
"if",
"(",
"this",
".",
"raxis",
"==",
"null",
")",
"{",
"this",
".",
"raxis",
"=",
"new",
"UnitVectorProperty",
"(",
"this",
",",
"MathFXAttributeNames",
".",
"FIRST_AXIS",
","... | Replies the property for the first rectangle axis.
@return the firstAxis property. | [
"Replies",
"the",
"property",
"for",
"the",
"first",
"rectangle",
"axis",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/mathfx/src/main/java/org/arakhne/afc/math/geometry/d2/dfx/OrientedRectangle2dfx.java#L271-L277 | train |
gallandarakhneorg/afc | advanced/mathfx/src/main/java/org/arakhne/afc/math/geometry/d2/dfx/OrientedRectangle2dfx.java | OrientedRectangle2dfx.secondAxisProperty | @Pure
public ReadOnlyUnitVectorProperty secondAxisProperty() {
if (this.saxis == null) {
this.saxis = new ReadOnlyUnitVectorWrapper(this, MathFXAttributeNames.SECOND_AXIS, getGeomFactory());
this.saxis.bind(Bindings.createObjectBinding(() -> {
final Vector2dfx firstAxis = firstAxisProperty().get();
return firstAxis.toOrthogonalVector();
},
firstAxisProperty()));
}
return this.saxis.getReadOnlyProperty();
} | java | @Pure
public ReadOnlyUnitVectorProperty secondAxisProperty() {
if (this.saxis == null) {
this.saxis = new ReadOnlyUnitVectorWrapper(this, MathFXAttributeNames.SECOND_AXIS, getGeomFactory());
this.saxis.bind(Bindings.createObjectBinding(() -> {
final Vector2dfx firstAxis = firstAxisProperty().get();
return firstAxis.toOrthogonalVector();
},
firstAxisProperty()));
}
return this.saxis.getReadOnlyProperty();
} | [
"@",
"Pure",
"public",
"ReadOnlyUnitVectorProperty",
"secondAxisProperty",
"(",
")",
"{",
"if",
"(",
"this",
".",
"saxis",
"==",
"null",
")",
"{",
"this",
".",
"saxis",
"=",
"new",
"ReadOnlyUnitVectorWrapper",
"(",
"this",
",",
"MathFXAttributeNames",
".",
"SE... | Replies the property for the second rectangle axis.
@return the secondAxis property. | [
"Replies",
"the",
"property",
"for",
"the",
"second",
"rectangle",
"axis",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/mathfx/src/main/java/org/arakhne/afc/math/geometry/d2/dfx/OrientedRectangle2dfx.java#L283-L294 | train |
lightblueseas/swing-components | src/main/java/de/alpharogroup/layout/InfomationDialog.java | InfomationDialog.showInfoDialog | public static String showInfoDialog(final Frame owner, final String message)
{
InfomationDialog mdialog;
String ok = "OK";
mdialog = new InfomationDialog(owner, "Information message", message, ok);
@SuppressWarnings("unlikely-arg-type")
final int index = mdialog.getVButtons().indexOf(ok);
final Button button = mdialog.getVButtons().get(index);
button.addActionListener(mdialog);
mdialog.setVisible(true);
return mdialog.getResult();
} | java | public static String showInfoDialog(final Frame owner, final String message)
{
InfomationDialog mdialog;
String ok = "OK";
mdialog = new InfomationDialog(owner, "Information message", message, ok);
@SuppressWarnings("unlikely-arg-type")
final int index = mdialog.getVButtons().indexOf(ok);
final Button button = mdialog.getVButtons().get(index);
button.addActionListener(mdialog);
mdialog.setVisible(true);
return mdialog.getResult();
} | [
"public",
"static",
"String",
"showInfoDialog",
"(",
"final",
"Frame",
"owner",
",",
"final",
"String",
"message",
")",
"{",
"InfomationDialog",
"mdialog",
";",
"String",
"ok",
"=",
"\"OK\"",
";",
"mdialog",
"=",
"new",
"InfomationDialog",
"(",
"owner",
",",
... | Statische Methode um ein Dialogfenster mit der angegebener Nachricht zu erzeugen.
@param owner
the owner
@param message
the message
@return das ergebnis | [
"Statische",
"Methode",
"um",
"ein",
"Dialogfenster",
"mit",
"der",
"angegebener",
"Nachricht",
"zu",
"erzeugen",
"."
] | 4045e85cabd8f0ce985cbfff134c3c9873930c79 | https://github.com/lightblueseas/swing-components/blob/4045e85cabd8f0ce985cbfff134c3c9873930c79/src/main/java/de/alpharogroup/layout/InfomationDialog.java#L63-L74 | train |
agmip/translator-dssat | src/main/java/org/agmip/translators/dssat/DssatCulFileInput.java | DssatCulFileInput.readFile | @Override
protected HashMap readFile(HashMap brMap) throws IOException {
HashMap ret = new HashMap();
HashMap metaData = new HashMap();
ArrayList<HashMap> culArr = readCultivarData(brMap, metaData);
// compressData(sites);
ArrayList<HashMap> expArr = new ArrayList();
HashMap tmp = new HashMap();
HashMap tmp2 = new HashMap();
tmp.put(jsonKey, tmp2);
tmp2.put(dataKey, culArr);
expArr.add(tmp);
ret.put("experiments", expArr);
return ret;
} | java | @Override
protected HashMap readFile(HashMap brMap) throws IOException {
HashMap ret = new HashMap();
HashMap metaData = new HashMap();
ArrayList<HashMap> culArr = readCultivarData(brMap, metaData);
// compressData(sites);
ArrayList<HashMap> expArr = new ArrayList();
HashMap tmp = new HashMap();
HashMap tmp2 = new HashMap();
tmp.put(jsonKey, tmp2);
tmp2.put(dataKey, culArr);
expArr.add(tmp);
ret.put("experiments", expArr);
return ret;
} | [
"@",
"Override",
"protected",
"HashMap",
"readFile",
"(",
"HashMap",
"brMap",
")",
"throws",
"IOException",
"{",
"HashMap",
"ret",
"=",
"new",
"HashMap",
"(",
")",
";",
"HashMap",
"metaData",
"=",
"new",
"HashMap",
"(",
")",
";",
"ArrayList",
"<",
"HashMap... | DSSAT Cultivar Data input method for only inputing Cultivar file
@param brMap The holder for BufferReader objects for all files
@return result data holder object
@throws java.io.IOException | [
"DSSAT",
"Cultivar",
"Data",
"input",
"method",
"for",
"only",
"inputing",
"Cultivar",
"file"
] | 4be61d998f106eb7234ea8701b63c3746ae688f4 | https://github.com/agmip/translator-dssat/blob/4be61d998f106eb7234ea8701b63c3746ae688f4/src/main/java/org/agmip/translators/dssat/DssatCulFileInput.java#L36-L51 | train |
BBN-E/bue-common-open | scoring-open/src/main/java/com/bbn/bue/common/evaluation/TypeConfusionInspector.java | TypeConfusionInspector.createOutputtingTo | public static <LeftRightT> TypeConfusionInspector<LeftRightT> createOutputtingTo(
final String name,
final Function<? super LeftRightT, String> confusionLabeler,
final Equivalence<LeftRightT> confusionEquivalence,
final File outputDir) {
return new TypeConfusionInspector<LeftRightT>(name, confusionLabeler, confusionEquivalence, outputDir);
} | java | public static <LeftRightT> TypeConfusionInspector<LeftRightT> createOutputtingTo(
final String name,
final Function<? super LeftRightT, String> confusionLabeler,
final Equivalence<LeftRightT> confusionEquivalence,
final File outputDir) {
return new TypeConfusionInspector<LeftRightT>(name, confusionLabeler, confusionEquivalence, outputDir);
} | [
"public",
"static",
"<",
"LeftRightT",
">",
"TypeConfusionInspector",
"<",
"LeftRightT",
">",
"createOutputtingTo",
"(",
"final",
"String",
"name",
",",
"final",
"Function",
"<",
"?",
"super",
"LeftRightT",
",",
"String",
">",
"confusionLabeler",
",",
"final",
"... | Creates a new inspector. See class documentation for an explanation of the confusion labeler
and confusion equivalence.
@param name a name to be used as a prefix for file output
@param confusionLabeler a function for mapping an observation to its label in the confusion matrix
@param confusionEquivalence an equivalence between observations that are considered confusable
@param outputDir directory for writing output
@param <LeftRightT> the type of both left and right items in the alignment
@return a new inspector | [
"Creates",
"a",
"new",
"inspector",
".",
"See",
"class",
"documentation",
"for",
"an",
"explanation",
"of",
"the",
"confusion",
"labeler",
"and",
"confusion",
"equivalence",
"."
] | d618652674d647867306e2e4b987a21b7c29c015 | https://github.com/BBN-E/bue-common-open/blob/d618652674d647867306e2e4b987a21b7c29c015/scoring-open/src/main/java/com/bbn/bue/common/evaluation/TypeConfusionInspector.java#L83-L89 | train |
gallandarakhneorg/afc | advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/mapelement/MapPolyline.java | MapPolyline.distanceToEnd | @Pure
public double distanceToEnd(Point2D<?, ?> point, double width) {
final Point2d firstPoint = getPointAt(0);
final Point2d lastPoint = getPointAt(-1);
double d1 = firstPoint.getDistance(point);
double d2 = lastPoint.getDistance(point);
d1 -= width;
if (d1 < 0) {
d1 = 0;
}
d2 -= width;
if (d2 < 0) {
d2 = 0;
}
return d1 < d2 ? d1 : d2;
} | java | @Pure
public double distanceToEnd(Point2D<?, ?> point, double width) {
final Point2d firstPoint = getPointAt(0);
final Point2d lastPoint = getPointAt(-1);
double d1 = firstPoint.getDistance(point);
double d2 = lastPoint.getDistance(point);
d1 -= width;
if (d1 < 0) {
d1 = 0;
}
d2 -= width;
if (d2 < 0) {
d2 = 0;
}
return d1 < d2 ? d1 : d2;
} | [
"@",
"Pure",
"public",
"double",
"distanceToEnd",
"(",
"Point2D",
"<",
"?",
",",
"?",
">",
"point",
",",
"double",
"width",
")",
"{",
"final",
"Point2d",
"firstPoint",
"=",
"getPointAt",
"(",
"0",
")",
";",
"final",
"Point2d",
"lastPoint",
"=",
"getPoint... | Replies the distance between the nearest end of this MapElement and
the point.
@param point is the x-coordinate of the point.
@param width is the width of the polyline.
@return the computed distance | [
"Replies",
"the",
"distance",
"between",
"the",
"nearest",
"end",
"of",
"this",
"MapElement",
"and",
"the",
"point",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/mapelement/MapPolyline.java#L211-L226 | train |
gallandarakhneorg/afc | advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/mapelement/MapPolyline.java | MapPolyline.getNearestEndIndex | @Pure
public final int getNearestEndIndex(double x, double y, OutputParameter<Double> distance) {
final int count = getPointCount();
final Point2d firstPoint = getPointAt(0);
final Point2d lastPoint = getPointAt(count - 1);
final double d1 = Point2D.getDistancePointPoint(firstPoint.getX(), firstPoint.getY(), x, y);
final double d2 = Point2D.getDistancePointPoint(lastPoint.getX(), lastPoint.getY(), x, y);
if (d1 <= d2) {
if (distance != null) {
distance.set(d1);
}
return 0;
}
if (distance != null) {
distance.set(d2);
}
return count - 1;
} | java | @Pure
public final int getNearestEndIndex(double x, double y, OutputParameter<Double> distance) {
final int count = getPointCount();
final Point2d firstPoint = getPointAt(0);
final Point2d lastPoint = getPointAt(count - 1);
final double d1 = Point2D.getDistancePointPoint(firstPoint.getX(), firstPoint.getY(), x, y);
final double d2 = Point2D.getDistancePointPoint(lastPoint.getX(), lastPoint.getY(), x, y);
if (d1 <= d2) {
if (distance != null) {
distance.set(d1);
}
return 0;
}
if (distance != null) {
distance.set(d2);
}
return count - 1;
} | [
"@",
"Pure",
"public",
"final",
"int",
"getNearestEndIndex",
"(",
"double",
"x",
",",
"double",
"y",
",",
"OutputParameter",
"<",
"Double",
">",
"distance",
")",
"{",
"final",
"int",
"count",
"=",
"getPointCount",
"(",
")",
";",
"final",
"Point2d",
"firstP... | Replies the index of the nearest end of line according to the specified point.
@param x is the point coordinate from which the distance must be computed
@param y is the point coordinate from which the distance must be computed
@param distance is the distance value that will be set by this function (if the parameter is not <code>null</code>).
@return index of the nearest end point. | [
"Replies",
"the",
"index",
"of",
"the",
"nearest",
"end",
"of",
"line",
"according",
"to",
"the",
"specified",
"point",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/mapelement/MapPolyline.java#L248-L265 | train |
gallandarakhneorg/afc | advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/mapelement/MapPolyline.java | MapPolyline.getNearestPosition | @Pure
public Point1d getNearestPosition(Point2D<?, ?> pos) {
Point2d pp = null;
final Vector2d v = new Vector2d();
double currentPosition = 0.;
double bestPosition = Double.NaN;
double bestDistance = Double.POSITIVE_INFINITY;
for (final Point2d p : points()) {
if (pp != null) {
double position = Segment2afp.findsProjectedPointPointLine(
pos.getX(), pos.getY(),
pp.getX(), pp.getY(),
p.getX(), p.getY());
if (position < 0.) {
position = 0.;
}
if (position > 1.) {
position = 1.;
}
v.sub(p, pp);
final double t = v.getLength();
v.scale(position);
final double dist = Point2D.getDistanceSquaredPointPoint(
pos.getX(),
pos.getY(),
pp.getX() + v.getX(),
pp.getY() + v.getY());
if (dist < bestDistance) {
bestDistance = dist;
bestPosition = currentPosition + v.getLength();
}
currentPosition += t;
}
pp = p;
}
if (Double.isNaN(bestPosition)) {
return null;
}
return new Point1d(toSegment1D(), bestPosition, 0.);
} | java | @Pure
public Point1d getNearestPosition(Point2D<?, ?> pos) {
Point2d pp = null;
final Vector2d v = new Vector2d();
double currentPosition = 0.;
double bestPosition = Double.NaN;
double bestDistance = Double.POSITIVE_INFINITY;
for (final Point2d p : points()) {
if (pp != null) {
double position = Segment2afp.findsProjectedPointPointLine(
pos.getX(), pos.getY(),
pp.getX(), pp.getY(),
p.getX(), p.getY());
if (position < 0.) {
position = 0.;
}
if (position > 1.) {
position = 1.;
}
v.sub(p, pp);
final double t = v.getLength();
v.scale(position);
final double dist = Point2D.getDistanceSquaredPointPoint(
pos.getX(),
pos.getY(),
pp.getX() + v.getX(),
pp.getY() + v.getY());
if (dist < bestDistance) {
bestDistance = dist;
bestPosition = currentPosition + v.getLength();
}
currentPosition += t;
}
pp = p;
}
if (Double.isNaN(bestPosition)) {
return null;
}
return new Point1d(toSegment1D(), bestPosition, 0.);
} | [
"@",
"Pure",
"public",
"Point1d",
"getNearestPosition",
"(",
"Point2D",
"<",
"?",
",",
"?",
">",
"pos",
")",
"{",
"Point2d",
"pp",
"=",
"null",
";",
"final",
"Vector2d",
"v",
"=",
"new",
"Vector2d",
"(",
")",
";",
"double",
"currentPosition",
"=",
"0."... | Return the nearest point 1.5D from a 2D position.
@param pos is the testing position.
@return the nearest 1.5D position on the road network. | [
"Return",
"the",
"nearest",
"point",
"1",
".",
"5D",
"from",
"a",
"2D",
"position",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/mapelement/MapPolyline.java#L273-L312 | train |
gallandarakhneorg/afc | advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/mapelement/MapPolyline.java | MapPolyline.getLength | @Pure
public double getLength() {
if (this.length < 0) {
double segmentLength = 0;
for (final PointGroup group : groups()) {
Point2d previousPts = null;
for (final Point2d pts : group.points()) {
if (previousPts != null) {
segmentLength += previousPts.getDistance(pts);
}
previousPts = pts;
}
}
this.length = segmentLength;
}
return this.length;
} | java | @Pure
public double getLength() {
if (this.length < 0) {
double segmentLength = 0;
for (final PointGroup group : groups()) {
Point2d previousPts = null;
for (final Point2d pts : group.points()) {
if (previousPts != null) {
segmentLength += previousPts.getDistance(pts);
}
previousPts = pts;
}
}
this.length = segmentLength;
}
return this.length;
} | [
"@",
"Pure",
"public",
"double",
"getLength",
"(",
")",
"{",
"if",
"(",
"this",
".",
"length",
"<",
"0",
")",
"{",
"double",
"segmentLength",
"=",
"0",
";",
"for",
"(",
"final",
"PointGroup",
"group",
":",
"groups",
"(",
")",
")",
"{",
"Point2d",
"... | Replies the length of this polyline.
The length is the distance between first point and the
last point of the polyline.
<p>The returned value is the sum of the lengths of the polyline' groups that
compose this polyline.
@return the length of the segment in meters. | [
"Replies",
"the",
"length",
"of",
"this",
"polyline",
".",
"The",
"length",
"is",
"the",
"distance",
"between",
"first",
"point",
"and",
"the",
"last",
"point",
"of",
"the",
"polyline",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/mapelement/MapPolyline.java#L334-L350 | train |
gallandarakhneorg/afc | advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/mapelement/MapPolyline.java | MapPolyline.getSubSegmentForDistance | @Pure
public Segment1D<?, ?> getSubSegmentForDistance(double distance) {
final double rd = distance < 0. ? 0. : distance;
double onGoingDistance = 0.;
for (final PointGroup group : groups()) {
Point2d previousPts = null;
for (final Point2d pts : group.points()) {
if (previousPts != null) {
onGoingDistance += previousPts.getDistance(pts);
if (rd <= onGoingDistance) {
// The desired distance is on the current point pair
return new DefaultSegment1d(previousPts, pts);
}
}
previousPts = pts;
}
}
throw new IllegalArgumentException("distance must be lower or equal than getLength(); distance=" //$NON-NLS-1$
+ Double.toString(distance)
+ "; length=" //$NON-NLS-1$
+ Double.toString(getLength()));
} | java | @Pure
public Segment1D<?, ?> getSubSegmentForDistance(double distance) {
final double rd = distance < 0. ? 0. : distance;
double onGoingDistance = 0.;
for (final PointGroup group : groups()) {
Point2d previousPts = null;
for (final Point2d pts : group.points()) {
if (previousPts != null) {
onGoingDistance += previousPts.getDistance(pts);
if (rd <= onGoingDistance) {
// The desired distance is on the current point pair
return new DefaultSegment1d(previousPts, pts);
}
}
previousPts = pts;
}
}
throw new IllegalArgumentException("distance must be lower or equal than getLength(); distance=" //$NON-NLS-1$
+ Double.toString(distance)
+ "; length=" //$NON-NLS-1$
+ Double.toString(getLength()));
} | [
"@",
"Pure",
"public",
"Segment1D",
"<",
"?",
",",
"?",
">",
"getSubSegmentForDistance",
"(",
"double",
"distance",
")",
"{",
"final",
"double",
"rd",
"=",
"distance",
"<",
"0.",
"?",
"0.",
":",
"distance",
";",
"double",
"onGoingDistance",
"=",
"0.",
";... | Replies the subsegment which is corresponding to the given position.
<p>A subsegment is a pair if connected points in the polyline.
@param distance is position on the polyline (in {@code 0} to {@code getLength()}).
@return the point pair, never <code>null</code>. | [
"Replies",
"the",
"subsegment",
"which",
"is",
"corresponding",
"to",
"the",
"given",
"position",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/mapelement/MapPolyline.java#L360-L381 | train |
gallandarakhneorg/afc | advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/mapelement/MapPolyline.java | MapPolyline.toPath2D | @Pure
public final void toPath2D(Path2d path) {
// loop on parts and build the path to draw
boolean firstPoint;
for (final PointGroup grp : groups()) {
firstPoint = true;
for (final Point2d pts : grp) {
final double x = pts.getX();
final double y = pts.getY();
if (firstPoint) {
path.moveTo(x, y);
firstPoint = false;
} else {
path.lineTo(x, y);
}
}
}
} | java | @Pure
public final void toPath2D(Path2d path) {
// loop on parts and build the path to draw
boolean firstPoint;
for (final PointGroup grp : groups()) {
firstPoint = true;
for (final Point2d pts : grp) {
final double x = pts.getX();
final double y = pts.getY();
if (firstPoint) {
path.moveTo(x, y);
firstPoint = false;
} else {
path.lineTo(x, y);
}
}
}
} | [
"@",
"Pure",
"public",
"final",
"void",
"toPath2D",
"(",
"Path2d",
"path",
")",
"{",
"// loop on parts and build the path to draw",
"boolean",
"firstPoint",
";",
"for",
"(",
"final",
"PointGroup",
"grp",
":",
"groups",
"(",
")",
")",
"{",
"firstPoint",
"=",
"t... | Replies the Path2D that corresponds to this polyline.
@param path the 2D path to update. | [
"Replies",
"the",
"Path2D",
"that",
"corresponds",
"to",
"this",
"polyline",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/mapelement/MapPolyline.java#L485-L502 | train |
gallandarakhneorg/afc | advanced/gis/gisroad/src/main/java/org/arakhne/afc/gis/road/path/RoadPath.java | RoadPath.addPathToPath | public static boolean addPathToPath(RoadPath inside, RoadPath elements) {
RoadConnection first = elements.getFirstPoint();
RoadConnection last = elements.getLastPoint();
assert first != null;
assert last != null;
first = first.getWrappedRoadConnection();
last = last.getWrappedRoadConnection();
assert first != null;
assert last != null;
if (last.equals(inside.getLastPoint()) || last.equals(inside.getFirstPoint())) {
for (int i = elements.size() - 1; i >= 0; --i) {
if (!inside.add(elements.get(i))) {
return false;
}
}
} else {
for (final RoadSegment segment : elements) {
if (!inside.add(segment)) {
return false;
}
}
}
return true;
} | java | public static boolean addPathToPath(RoadPath inside, RoadPath elements) {
RoadConnection first = elements.getFirstPoint();
RoadConnection last = elements.getLastPoint();
assert first != null;
assert last != null;
first = first.getWrappedRoadConnection();
last = last.getWrappedRoadConnection();
assert first != null;
assert last != null;
if (last.equals(inside.getLastPoint()) || last.equals(inside.getFirstPoint())) {
for (int i = elements.size() - 1; i >= 0; --i) {
if (!inside.add(elements.get(i))) {
return false;
}
}
} else {
for (final RoadSegment segment : elements) {
if (!inside.add(segment)) {
return false;
}
}
}
return true;
} | [
"public",
"static",
"boolean",
"addPathToPath",
"(",
"RoadPath",
"inside",
",",
"RoadPath",
"elements",
")",
"{",
"RoadConnection",
"first",
"=",
"elements",
".",
"getFirstPoint",
"(",
")",
";",
"RoadConnection",
"last",
"=",
"elements",
".",
"getLastPoint",
"("... | Add the elements stored inside a road path into a road path.
This function takes care about the two ends to the path to insert into.
@param inside is the path to change.
@param elements are the elements to insert.
@return <code>true</code> if all the elements were added;
otherwise <code>false</code>.
@since 4.0 | [
"Add",
"the",
"elements",
"stored",
"inside",
"a",
"road",
"path",
"into",
"a",
"road",
"path",
".",
"This",
"function",
"takes",
"care",
"about",
"the",
"two",
"ends",
"to",
"the",
"path",
"to",
"insert",
"into",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/gisroad/src/main/java/org/arakhne/afc/gis/road/path/RoadPath.java#L92-L116 | train |
gallandarakhneorg/afc | advanced/gis/gisroad/src/main/java/org/arakhne/afc/gis/road/path/RoadPath.java | RoadPath.isConnectableTo | @Pure
public boolean isConnectableTo(RoadPath path) {
assert path != null;
if (path.isEmpty()) {
return false;
}
RoadConnection first1 = getFirstPoint();
RoadConnection last1 = getLastPoint();
first1 = first1.getWrappedRoadConnection();
last1 = last1.getWrappedRoadConnection();
RoadConnection first2 = path.getFirstPoint();
RoadConnection last2 = path.getLastPoint();
first2 = first2.getWrappedRoadConnection();
last2 = last2.getWrappedRoadConnection();
return first1.equals(first2) || first1.equals(last2)
|| last1.equals(first2) || last1.equals(last2);
} | java | @Pure
public boolean isConnectableTo(RoadPath path) {
assert path != null;
if (path.isEmpty()) {
return false;
}
RoadConnection first1 = getFirstPoint();
RoadConnection last1 = getLastPoint();
first1 = first1.getWrappedRoadConnection();
last1 = last1.getWrappedRoadConnection();
RoadConnection first2 = path.getFirstPoint();
RoadConnection last2 = path.getLastPoint();
first2 = first2.getWrappedRoadConnection();
last2 = last2.getWrappedRoadConnection();
return first1.equals(first2) || first1.equals(last2)
|| last1.equals(first2) || last1.equals(last2);
} | [
"@",
"Pure",
"public",
"boolean",
"isConnectableTo",
"(",
"RoadPath",
"path",
")",
"{",
"assert",
"path",
"!=",
"null",
";",
"if",
"(",
"path",
".",
"isEmpty",
"(",
")",
")",
"{",
"return",
"false",
";",
"}",
"RoadConnection",
"first1",
"=",
"getFirstPoi... | Replies if the given road path is connectable to this road path.
@param path a path.
@return <code>true</code> if the given road path is connectable;
otherwise <code>false</code>.
@since 4.0
@see #isFirstPointConnectableTo(RoadPath)
@see #isLastPointConnectableTo(RoadPath) | [
"Replies",
"if",
"the",
"given",
"road",
"path",
"is",
"connectable",
"to",
"this",
"road",
"path",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/gisroad/src/main/java/org/arakhne/afc/gis/road/path/RoadPath.java#L157-L173 | train |
gallandarakhneorg/afc | advanced/gis/gisroad/src/main/java/org/arakhne/afc/gis/road/path/RoadPath.java | RoadPath.getFirstCrossRoad | @Pure
public RoadConnection getFirstCrossRoad() {
for (final RoadConnection pt : points()) {
if (pt.getConnectedSegmentCount() > 2) {
return pt;
}
}
return null;
} | java | @Pure
public RoadConnection getFirstCrossRoad() {
for (final RoadConnection pt : points()) {
if (pt.getConnectedSegmentCount() > 2) {
return pt;
}
}
return null;
} | [
"@",
"Pure",
"public",
"RoadConnection",
"getFirstCrossRoad",
"(",
")",
"{",
"for",
"(",
"final",
"RoadConnection",
"pt",
":",
"points",
"(",
")",
")",
"{",
"if",
"(",
"pt",
".",
"getConnectedSegmentCount",
"(",
")",
">",
"2",
")",
"{",
"return",
"pt",
... | Replies the first cross-road point in the path.
@return the cross-road point or <code>null</code> if none. | [
"Replies",
"the",
"first",
"cross",
"-",
"road",
"point",
"in",
"the",
"path",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/gisroad/src/main/java/org/arakhne/afc/gis/road/path/RoadPath.java#L300-L308 | train |
gallandarakhneorg/afc | advanced/gis/gisroad/src/main/java/org/arakhne/afc/gis/road/path/RoadPath.java | RoadPath.getFirstJunctionPoint | @Pure
public CrossRoad getFirstJunctionPoint() {
RoadConnection point = getFirstPoint();
double distance = 0;
RoadSegment beforeSegment = null;
RoadSegment afterSegment = null;
int beforeSegmentIndex = -1;
int afterSegmentIndex = -1;
boolean found = false;
if (point != null) {
int index = 0;
for (final RoadSegment sgmt : this) {
if (found) {
afterSegment = sgmt;
afterSegmentIndex = index;
//stop now
break;
}
point = sgmt.getOtherSidePoint(point);
beforeSegment = sgmt;
beforeSegmentIndex = index;
distance += sgmt.getLength();
final int count = point.getConnectedSegmentCount();
if (count != 2) {
found = true;
}
++index;
}
}
if (found) {
return new CrossRoad(point, beforeSegment, beforeSegmentIndex,
afterSegment, afterSegmentIndex, distance, distance);
}
return null;
} | java | @Pure
public CrossRoad getFirstJunctionPoint() {
RoadConnection point = getFirstPoint();
double distance = 0;
RoadSegment beforeSegment = null;
RoadSegment afterSegment = null;
int beforeSegmentIndex = -1;
int afterSegmentIndex = -1;
boolean found = false;
if (point != null) {
int index = 0;
for (final RoadSegment sgmt : this) {
if (found) {
afterSegment = sgmt;
afterSegmentIndex = index;
//stop now
break;
}
point = sgmt.getOtherSidePoint(point);
beforeSegment = sgmt;
beforeSegmentIndex = index;
distance += sgmt.getLength();
final int count = point.getConnectedSegmentCount();
if (count != 2) {
found = true;
}
++index;
}
}
if (found) {
return new CrossRoad(point, beforeSegment, beforeSegmentIndex,
afterSegment, afterSegmentIndex, distance, distance);
}
return null;
} | [
"@",
"Pure",
"public",
"CrossRoad",
"getFirstJunctionPoint",
"(",
")",
"{",
"RoadConnection",
"point",
"=",
"getFirstPoint",
"(",
")",
";",
"double",
"distance",
"=",
"0",
";",
"RoadSegment",
"beforeSegment",
"=",
"null",
";",
"RoadSegment",
"afterSegment",
"=",... | Replies the first cul-de-sac or cross-road point in the path.
@return the cul-de-sac/cross-road point or <code>null</code> if none. | [
"Replies",
"the",
"first",
"cul",
"-",
"de",
"-",
"sac",
"or",
"cross",
"-",
"road",
"point",
"in",
"the",
"path",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/gisroad/src/main/java/org/arakhne/afc/gis/road/path/RoadPath.java#L314-L351 | train |
gallandarakhneorg/afc | advanced/gis/gisbus/src/main/java/org/arakhne/afc/gis/bus/network/BusLine.java | BusLine.getFirstFreeBusLineName | public static String getFirstFreeBusLineName(BusNetwork network) {
if (network == null) {
return null;
}
int nb = network.getBusLineCount();
String name;
do {
++nb;
name = Locale.getString("NAME_TEMPLATE", Integer.toString(nb)); //$NON-NLS-1$
}
while (network.getBusLine(name) != null);
return name;
} | java | public static String getFirstFreeBusLineName(BusNetwork network) {
if (network == null) {
return null;
}
int nb = network.getBusLineCount();
String name;
do {
++nb;
name = Locale.getString("NAME_TEMPLATE", Integer.toString(nb)); //$NON-NLS-1$
}
while (network.getBusLine(name) != null);
return name;
} | [
"public",
"static",
"String",
"getFirstFreeBusLineName",
"(",
"BusNetwork",
"network",
")",
"{",
"if",
"(",
"network",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"int",
"nb",
"=",
"network",
".",
"getBusLineCount",
"(",
")",
";",
"String",
"name",... | Replies a bus line name that was not exist in the specified
network.
@param network is the bus network from which a free bus line name may be computed.
@return the name suitable for a bus line. | [
"Replies",
"a",
"bus",
"line",
"name",
"that",
"was",
"not",
"exist",
"in",
"the",
"specified",
"network",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/gisbus/src/main/java/org/arakhne/afc/gis/bus/network/BusLine.java#L237-L249 | train |
gallandarakhneorg/afc | advanced/gis/gisbus/src/main/java/org/arakhne/afc/gis/bus/network/BusLine.java | BusLine.addBusItinerary | public boolean addBusItinerary(BusItinerary busItinerary) {
if (busItinerary == null) {
return false;
}
if (this.itineraries.indexOf(busItinerary) != -1) {
return false;
}
if (!this.itineraries.add(busItinerary)) {
return false;
}
final boolean isValidItinerary = busItinerary.isValidPrimitive();
busItinerary.setEventFirable(isEventFirable());
busItinerary.setContainer(this);
if (isEventFirable()) {
fireShapeChanged(new BusChangeEvent(this,
BusChangeEventType.ITINERARY_ADDED,
busItinerary,
this.itineraries.size() - 1,
"shape", //$NON-NLS-1$
null,
null));
if (!isValidItinerary) {
revalidate();
} else {
checkPrimitiveValidity();
}
}
return true;
} | java | public boolean addBusItinerary(BusItinerary busItinerary) {
if (busItinerary == null) {
return false;
}
if (this.itineraries.indexOf(busItinerary) != -1) {
return false;
}
if (!this.itineraries.add(busItinerary)) {
return false;
}
final boolean isValidItinerary = busItinerary.isValidPrimitive();
busItinerary.setEventFirable(isEventFirable());
busItinerary.setContainer(this);
if (isEventFirable()) {
fireShapeChanged(new BusChangeEvent(this,
BusChangeEventType.ITINERARY_ADDED,
busItinerary,
this.itineraries.size() - 1,
"shape", //$NON-NLS-1$
null,
null));
if (!isValidItinerary) {
revalidate();
} else {
checkPrimitiveValidity();
}
}
return true;
} | [
"public",
"boolean",
"addBusItinerary",
"(",
"BusItinerary",
"busItinerary",
")",
"{",
"if",
"(",
"busItinerary",
"==",
"null",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"this",
".",
"itineraries",
".",
"indexOf",
"(",
"busItinerary",
")",
"!=",
"-... | Add a bus itinerary inside the bus line.
@param busItinerary is the bus itinerary to insert.
@return <code>true</code> if the bus itinerary was added, otherwise <code>false</code> | [
"Add",
"a",
"bus",
"itinerary",
"inside",
"the",
"bus",
"line",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/gisbus/src/main/java/org/arakhne/afc/gis/bus/network/BusLine.java#L400-L428 | train |
gallandarakhneorg/afc | advanced/gis/gisbus/src/main/java/org/arakhne/afc/gis/bus/network/BusLine.java | BusLine.removeAllBusItineraries | public void removeAllBusItineraries() {
for (final BusItinerary itinerary : this.itineraries) {
itinerary.setContainer(null);
itinerary.setEventFirable(true);
}
this.itineraries.clear();
fireShapeChanged(new BusChangeEvent(this,
BusChangeEventType.ALL_ITINERARIES_REMOVED,
null,
-1,
"shape", //$NON-NLS-1$
null,
null));
checkPrimitiveValidity();
} | java | public void removeAllBusItineraries() {
for (final BusItinerary itinerary : this.itineraries) {
itinerary.setContainer(null);
itinerary.setEventFirable(true);
}
this.itineraries.clear();
fireShapeChanged(new BusChangeEvent(this,
BusChangeEventType.ALL_ITINERARIES_REMOVED,
null,
-1,
"shape", //$NON-NLS-1$
null,
null));
checkPrimitiveValidity();
} | [
"public",
"void",
"removeAllBusItineraries",
"(",
")",
"{",
"for",
"(",
"final",
"BusItinerary",
"itinerary",
":",
"this",
".",
"itineraries",
")",
"{",
"itinerary",
".",
"setContainer",
"(",
"null",
")",
";",
"itinerary",
".",
"setEventFirable",
"(",
"true",
... | Remove all the bus itineraries from the current line. | [
"Remove",
"all",
"the",
"bus",
"itineraries",
"from",
"the",
"current",
"line",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/gisbus/src/main/java/org/arakhne/afc/gis/bus/network/BusLine.java#L475-L489 | train |
gallandarakhneorg/afc | advanced/gis/gisbus/src/main/java/org/arakhne/afc/gis/bus/network/BusLine.java | BusLine.removeBusItinerary | public boolean removeBusItinerary(BusItinerary itinerary) {
final int index = this.itineraries.indexOf(itinerary);
if (index >= 0) {
return removeBusItinerary(index);
}
return false;
} | java | public boolean removeBusItinerary(BusItinerary itinerary) {
final int index = this.itineraries.indexOf(itinerary);
if (index >= 0) {
return removeBusItinerary(index);
}
return false;
} | [
"public",
"boolean",
"removeBusItinerary",
"(",
"BusItinerary",
"itinerary",
")",
"{",
"final",
"int",
"index",
"=",
"this",
".",
"itineraries",
".",
"indexOf",
"(",
"itinerary",
")",
";",
"if",
"(",
"index",
">=",
"0",
")",
"{",
"return",
"removeBusItinerar... | Remove a bus itinerary from this line.
All the associated stops will be removed also.
@param itinerary is the bus itinerary to remove.
@return <code>true</code> if the bus itinerary was successfully removed, otherwise <code>false</code> | [
"Remove",
"a",
"bus",
"itinerary",
"from",
"this",
"line",
".",
"All",
"the",
"associated",
"stops",
"will",
"be",
"removed",
"also",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/gisbus/src/main/java/org/arakhne/afc/gis/bus/network/BusLine.java#L498-L504 | train |
gallandarakhneorg/afc | advanced/gis/gisbus/src/main/java/org/arakhne/afc/gis/bus/network/BusLine.java | BusLine.removeBusItinerary | public boolean removeBusItinerary(int index) {
try {
final BusItinerary busItinerary = this.itineraries.remove(index);
busItinerary.setContainer(null);
busItinerary.setEventFirable(true);
fireShapeChanged(new BusChangeEvent(this,
BusChangeEventType.ITINERARY_REMOVED,
busItinerary,
index,
"shape", //$NON-NLS-1$
null,
null));
checkPrimitiveValidity();
return true;
} catch (Throwable exception) {
//
}
return false;
} | java | public boolean removeBusItinerary(int index) {
try {
final BusItinerary busItinerary = this.itineraries.remove(index);
busItinerary.setContainer(null);
busItinerary.setEventFirable(true);
fireShapeChanged(new BusChangeEvent(this,
BusChangeEventType.ITINERARY_REMOVED,
busItinerary,
index,
"shape", //$NON-NLS-1$
null,
null));
checkPrimitiveValidity();
return true;
} catch (Throwable exception) {
//
}
return false;
} | [
"public",
"boolean",
"removeBusItinerary",
"(",
"int",
"index",
")",
"{",
"try",
"{",
"final",
"BusItinerary",
"busItinerary",
"=",
"this",
".",
"itineraries",
".",
"remove",
"(",
"index",
")",
";",
"busItinerary",
".",
"setContainer",
"(",
"null",
")",
";",... | Remove the bus itinerary at the specified index.
All the associated stops will be removed also.
@param index is the index of the bus itinerary to remove.
@return <code>true</code> if the bus itinerary was successfully removed, otherwise <code>false</code> | [
"Remove",
"the",
"bus",
"itinerary",
"at",
"the",
"specified",
"index",
".",
"All",
"the",
"associated",
"stops",
"will",
"be",
"removed",
"also",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/gisbus/src/main/java/org/arakhne/afc/gis/bus/network/BusLine.java#L513-L531 | train |
gallandarakhneorg/afc | advanced/gis/gisbus/src/main/java/org/arakhne/afc/gis/bus/network/BusLine.java | BusLine.getBusItinerary | public BusItinerary getBusItinerary(UUID uuid) {
if (uuid == null) {
return null;
}
for (final BusItinerary busItinerary : this.itineraries) {
if (uuid.equals(busItinerary.getUUID())) {
return busItinerary;
}
}
return null;
} | java | public BusItinerary getBusItinerary(UUID uuid) {
if (uuid == null) {
return null;
}
for (final BusItinerary busItinerary : this.itineraries) {
if (uuid.equals(busItinerary.getUUID())) {
return busItinerary;
}
}
return null;
} | [
"public",
"BusItinerary",
"getBusItinerary",
"(",
"UUID",
"uuid",
")",
"{",
"if",
"(",
"uuid",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"for",
"(",
"final",
"BusItinerary",
"busItinerary",
":",
"this",
".",
"itineraries",
")",
"{",
"if",
"(",
... | Replies the bus itinerary with the specified uuid.
@param uuid the identifier.
@return BusItinerary or <code>null</code> | [
"Replies",
"the",
"bus",
"itinerary",
"with",
"the",
"specified",
"uuid",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/gisbus/src/main/java/org/arakhne/afc/gis/bus/network/BusLine.java#L587-L597 | train |
gallandarakhneorg/afc | advanced/gis/gisbus/src/main/java/org/arakhne/afc/gis/bus/network/BusLine.java | BusLine.getBusItinerary | public BusItinerary getBusItinerary(String name, Comparator<String> nameComparator) {
if (name == null) {
return null;
}
final Comparator<String> cmp = nameComparator == null ? BusNetworkUtilities.NAME_COMPARATOR : nameComparator;
for (final BusItinerary itinerary : this.itineraries) {
if (cmp.compare(name, itinerary.getName()) == 0) {
return itinerary;
}
}
return null;
} | java | public BusItinerary getBusItinerary(String name, Comparator<String> nameComparator) {
if (name == null) {
return null;
}
final Comparator<String> cmp = nameComparator == null ? BusNetworkUtilities.NAME_COMPARATOR : nameComparator;
for (final BusItinerary itinerary : this.itineraries) {
if (cmp.compare(name, itinerary.getName()) == 0) {
return itinerary;
}
}
return null;
} | [
"public",
"BusItinerary",
"getBusItinerary",
"(",
"String",
"name",
",",
"Comparator",
"<",
"String",
">",
"nameComparator",
")",
"{",
"if",
"(",
"name",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"final",
"Comparator",
"<",
"String",
">",
"cmp",
... | Replies the bus itinerary with the specified name.
@param name is the desired name
@param nameComparator is used to compare the names.
@return a bus itinerary or <code>null</code> | [
"Replies",
"the",
"bus",
"itinerary",
"with",
"the",
"specified",
"name",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/gisbus/src/main/java/org/arakhne/afc/gis/bus/network/BusLine.java#L606-L617 | train |
BBN-E/bue-common-open | common-core-open/src/main/java/com/bbn/bue/common/parameters/serifstyle/SerifStyleParameterFileLoader.java | SerifStyleParameterFileLoader.load | @Override
public final Parameters load(final File configFile) throws IOException {
final Loading loading = new Loading();
loading.topLoad(configFile);
return Parameters.fromMap(loading.ret);
} | java | @Override
public final Parameters load(final File configFile) throws IOException {
final Loading loading = new Loading();
loading.topLoad(configFile);
return Parameters.fromMap(loading.ret);
} | [
"@",
"Override",
"public",
"final",
"Parameters",
"load",
"(",
"final",
"File",
"configFile",
")",
"throws",
"IOException",
"{",
"final",
"Loading",
"loading",
"=",
"new",
"Loading",
"(",
")",
";",
"loading",
".",
"topLoad",
"(",
"configFile",
")",
";",
"r... | Parses a BBN-style parameter file to a Map. | [
"Parses",
"a",
"BBN",
"-",
"style",
"parameter",
"file",
"to",
"a",
"Map",
"."
] | d618652674d647867306e2e4b987a21b7c29c015 | https://github.com/BBN-E/bue-common-open/blob/d618652674d647867306e2e4b987a21b7c29c015/common-core-open/src/main/java/com/bbn/bue/common/parameters/serifstyle/SerifStyleParameterFileLoader.java#L79-L84 | train |
gallandarakhneorg/afc | core/vmutils/src/main/java/org/arakhne/afc/vmutil/DynamicURLClassLoader.java | DynamicURLClassLoader.findClass | @Override
@Pure
protected Class<?> findClass(final String name) throws ClassNotFoundException {
try {
return AccessController.doPrivileged(new PrivilegedExceptionAction<Class<?>>() {
@Override
public Class<?> run() throws ClassNotFoundException {
final String path = name.replace('.', '/').concat(".class"); //$NON-NLS-1$
final sun.misc.Resource res = DynamicURLClassLoader.this.ucp.getResource(path, false);
if (res != null) {
try {
return defineClass(name, res);
} catch (IOException e) {
throw new ClassNotFoundException(name, e);
}
}
throw new ClassNotFoundException(name);
}
}, this.acc);
} catch (java.security.PrivilegedActionException pae) {
throw (ClassNotFoundException) pae.getException();
}
} | java | @Override
@Pure
protected Class<?> findClass(final String name) throws ClassNotFoundException {
try {
return AccessController.doPrivileged(new PrivilegedExceptionAction<Class<?>>() {
@Override
public Class<?> run() throws ClassNotFoundException {
final String path = name.replace('.', '/').concat(".class"); //$NON-NLS-1$
final sun.misc.Resource res = DynamicURLClassLoader.this.ucp.getResource(path, false);
if (res != null) {
try {
return defineClass(name, res);
} catch (IOException e) {
throw new ClassNotFoundException(name, e);
}
}
throw new ClassNotFoundException(name);
}
}, this.acc);
} catch (java.security.PrivilegedActionException pae) {
throw (ClassNotFoundException) pae.getException();
}
} | [
"@",
"Override",
"@",
"Pure",
"protected",
"Class",
"<",
"?",
">",
"findClass",
"(",
"final",
"String",
"name",
")",
"throws",
"ClassNotFoundException",
"{",
"try",
"{",
"return",
"AccessController",
".",
"doPrivileged",
"(",
"new",
"PrivilegedExceptionAction",
... | Finds and loads the class with the specified name from the URL search
path. Any URLs referring to JAR files are loaded and opened as needed
until the class is found.
@param name the name of the class
@return the resulting class
@exception ClassNotFoundException if the class could not be found | [
"Finds",
"and",
"loads",
"the",
"class",
"with",
"the",
"specified",
"name",
"from",
"the",
"URL",
"search",
"path",
".",
"Any",
"URLs",
"referring",
"to",
"JAR",
"files",
"are",
"loaded",
"and",
"opened",
"as",
"needed",
"until",
"the",
"class",
"is",
"... | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/vmutils/src/main/java/org/arakhne/afc/vmutil/DynamicURLClassLoader.java#L177-L199 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.