repo stringlengths 7 58 | path stringlengths 12 218 | func_name stringlengths 3 140 | original_string stringlengths 73 34.1k | language stringclasses 1 value | code stringlengths 73 34.1k | code_tokens list | docstring stringlengths 3 16k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 105 339 | partition stringclasses 1 value |
|---|---|---|---|---|---|---|---|---|---|---|---|
BBN-E/bue-common-open | indri-utils/src/main/java/com/bbn/nlp/indri/bin/IndexBuilder.java | IndexBuilder.setupIndexer | private static IndexEnvironment setupIndexer(File outputDirectory, int memory,
boolean storeDocs) throws Exception {
final IndexEnvironment env = new IndexEnvironment();
env.setMemory(memory * ONE_MEGABYTE);
final Specification spec = env.getFileClassSpec("trectext");
env.addFileClass(spec);
env.setStoreDocs(storeDocs);
// if we don't build indices on DOCNO then getting the docIds at query time is
// extremely slow
env.setMetadataIndexedFields(new String[]{"docno"}, new String[]{"docno"});
env.create(outputDirectory.getAbsolutePath(), statusMonitor);
return env;
} | java | private static IndexEnvironment setupIndexer(File outputDirectory, int memory,
boolean storeDocs) throws Exception {
final IndexEnvironment env = new IndexEnvironment();
env.setMemory(memory * ONE_MEGABYTE);
final Specification spec = env.getFileClassSpec("trectext");
env.addFileClass(spec);
env.setStoreDocs(storeDocs);
// if we don't build indices on DOCNO then getting the docIds at query time is
// extremely slow
env.setMetadataIndexedFields(new String[]{"docno"}, new String[]{"docno"});
env.create(outputDirectory.getAbsolutePath(), statusMonitor);
return env;
} | [
"private",
"static",
"IndexEnvironment",
"setupIndexer",
"(",
"File",
"outputDirectory",
",",
"int",
"memory",
",",
"boolean",
"storeDocs",
")",
"throws",
"Exception",
"{",
"final",
"IndexEnvironment",
"env",
"=",
"new",
"IndexEnvironment",
"(",
")",
";",
"env",
".",
"setMemory",
"(",
"memory",
"*",
"ONE_MEGABYTE",
")",
";",
"final",
"Specification",
"spec",
"=",
"env",
".",
"getFileClassSpec",
"(",
"\"trectext\"",
")",
";",
"env",
".",
"addFileClass",
"(",
"spec",
")",
";",
"env",
".",
"setStoreDocs",
"(",
"storeDocs",
")",
";",
"// if we don't build indices on DOCNO then getting the docIds at query time is",
"// extremely slow",
"env",
".",
"setMetadataIndexedFields",
"(",
"new",
"String",
"[",
"]",
"{",
"\"docno\"",
"}",
",",
"new",
"String",
"[",
"]",
"{",
"\"docno\"",
"}",
")",
";",
"env",
".",
"create",
"(",
"outputDirectory",
".",
"getAbsolutePath",
"(",
")",
",",
"statusMonitor",
")",
";",
"return",
"env",
";",
"}"
] | because its only reference is in native code, then we will get a crash. | [
"because",
"its",
"only",
"reference",
"is",
"in",
"native",
"code",
"then",
"we",
"will",
"get",
"a",
"crash",
"."
] | d618652674d647867306e2e4b987a21b7c29c015 | https://github.com/BBN-E/bue-common-open/blob/d618652674d647867306e2e4b987a21b7c29c015/indri-utils/src/main/java/com/bbn/nlp/indri/bin/IndexBuilder.java#L138-L150 | train |
BBN-E/bue-common-open | scoring-open/src/main/java/com/bbn/bue/common/evaluation/InspectorTreeNode.java | InspectorTreeNode.registerConsumer | @SuppressWarnings("unchecked")
void registerConsumer(Inspector<? super OutT> subInspector) {
consumers.add((Inspector<OutT>) subInspector);
} | java | @SuppressWarnings("unchecked")
void registerConsumer(Inspector<? super OutT> subInspector) {
consumers.add((Inspector<OutT>) subInspector);
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"void",
"registerConsumer",
"(",
"Inspector",
"<",
"?",
"super",
"OutT",
">",
"subInspector",
")",
"{",
"consumers",
".",
"add",
"(",
"(",
"Inspector",
"<",
"OutT",
">",
")",
"subInspector",
")",
";",
"}"
] | Inspector is contravariant in its type | [
"Inspector",
"is",
"contravariant",
"in",
"its",
"type"
] | d618652674d647867306e2e4b987a21b7c29c015 | https://github.com/BBN-E/bue-common-open/blob/d618652674d647867306e2e4b987a21b7c29c015/scoring-open/src/main/java/com/bbn/bue/common/evaluation/InspectorTreeNode.java#L32-L35 | train |
gallandarakhneorg/afc | advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/tree/GISTreeSetUtil.java | GISTreeSetUtil.classifies | @Pure
public static int classifies(AbstractGISTreeSetNode<?, ?> node, GeoLocation location) {
if (node.getZone() == IcosepQuadTreeZone.ICOSEP) {
return classifiesIcocep(node.verticalSplit, node.horizontalSplit, location.toBounds2D());
}
return classifiesNonIcocep(node.verticalSplit, node.horizontalSplit, location.toBounds2D());
} | java | @Pure
public static int classifies(AbstractGISTreeSetNode<?, ?> node, GeoLocation location) {
if (node.getZone() == IcosepQuadTreeZone.ICOSEP) {
return classifiesIcocep(node.verticalSplit, node.horizontalSplit, location.toBounds2D());
}
return classifiesNonIcocep(node.verticalSplit, node.horizontalSplit, location.toBounds2D());
} | [
"@",
"Pure",
"public",
"static",
"int",
"classifies",
"(",
"AbstractGISTreeSetNode",
"<",
"?",
",",
"?",
">",
"node",
",",
"GeoLocation",
"location",
")",
"{",
"if",
"(",
"node",
".",
"getZone",
"(",
")",
"==",
"IcosepQuadTreeZone",
".",
"ICOSEP",
")",
"{",
"return",
"classifiesIcocep",
"(",
"node",
".",
"verticalSplit",
",",
"node",
".",
"horizontalSplit",
",",
"location",
".",
"toBounds2D",
"(",
")",
")",
";",
"}",
"return",
"classifiesNonIcocep",
"(",
"node",
".",
"verticalSplit",
",",
"node",
".",
"horizontalSplit",
",",
"location",
".",
"toBounds2D",
"(",
")",
")",
";",
"}"
] | Replies the classificiation of the specified location.
@param node the classification base.
@param location the point to classify.
@return the classificiation of the specified location inside to the node. | [
"Replies",
"the",
"classificiation",
"of",
"the",
"specified",
"location",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/tree/GISTreeSetUtil.java#L62-L68 | train |
gallandarakhneorg/afc | advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/tree/GISTreeSetUtil.java | GISTreeSetUtil.contains | @Pure
static boolean contains(int region, double cutX, double cutY, double pointX, double pointY) {
switch (IcosepQuadTreeZone.values()[region]) {
case SOUTH_WEST:
return pointX <= cutX && pointY <= cutY;
case SOUTH_EAST:
return pointX >= cutX && pointY <= cutY;
case NORTH_WEST:
return pointX <= cutX && pointY >= cutY;
case NORTH_EAST:
return pointX >= cutX && pointY >= cutY;
case ICOSEP:
return true;
default:
}
return false;
} | java | @Pure
static boolean contains(int region, double cutX, double cutY, double pointX, double pointY) {
switch (IcosepQuadTreeZone.values()[region]) {
case SOUTH_WEST:
return pointX <= cutX && pointY <= cutY;
case SOUTH_EAST:
return pointX >= cutX && pointY <= cutY;
case NORTH_WEST:
return pointX <= cutX && pointY >= cutY;
case NORTH_EAST:
return pointX >= cutX && pointY >= cutY;
case ICOSEP:
return true;
default:
}
return false;
} | [
"@",
"Pure",
"static",
"boolean",
"contains",
"(",
"int",
"region",
",",
"double",
"cutX",
",",
"double",
"cutY",
",",
"double",
"pointX",
",",
"double",
"pointY",
")",
"{",
"switch",
"(",
"IcosepQuadTreeZone",
".",
"values",
"(",
")",
"[",
"region",
"]",
")",
"{",
"case",
"SOUTH_WEST",
":",
"return",
"pointX",
"<=",
"cutX",
"&&",
"pointY",
"<=",
"cutY",
";",
"case",
"SOUTH_EAST",
":",
"return",
"pointX",
">=",
"cutX",
"&&",
"pointY",
"<=",
"cutY",
";",
"case",
"NORTH_WEST",
":",
"return",
"pointX",
"<=",
"cutX",
"&&",
"pointY",
">=",
"cutY",
";",
"case",
"NORTH_EAST",
":",
"return",
"pointX",
">=",
"cutX",
"&&",
"pointY",
">=",
"cutY",
";",
"case",
"ICOSEP",
":",
"return",
"true",
";",
"default",
":",
"}",
"return",
"false",
";",
"}"
] | Replies if the given region contains the given point.
@param region is the index of the region.
@param cutX is the cut line of the region parent.
@param cutY is the cut line of the region parent.
@param pointX is the coordinate of the point to classify.
@param pointY is the coordinate of the point to classify.
@return <code>true</code> if the point is inside the given region,
otherwise <code>false</code> | [
"Replies",
"if",
"the",
"given",
"region",
"contains",
"the",
"given",
"point",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/tree/GISTreeSetUtil.java#L128-L144 | train |
gallandarakhneorg/afc | advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/tree/GISTreeSetUtil.java | GISTreeSetUtil.isOutsideNodeBuildingBounds | @Pure
private static boolean isOutsideNodeBuildingBounds(AbstractGISTreeSetNode<?, ?> node,
Rectangle2afp<?, ?, ?, ?, ?, ?> location) {
final Rectangle2d b2 = getNormalizedNodeBuildingBounds(node, location);
if (b2 == null) {
return false;
}
return Rectangle2afp.classifiesRectangleRectangle(
b2.getMinX(), b2.getMinY(), b2.getMaxX(), b2.getMaxY(),
location.getMinX(), location.getMinY(), location.getMaxX(), location.getMaxY()) != IntersectionType.INSIDE;
} | java | @Pure
private static boolean isOutsideNodeBuildingBounds(AbstractGISTreeSetNode<?, ?> node,
Rectangle2afp<?, ?, ?, ?, ?, ?> location) {
final Rectangle2d b2 = getNormalizedNodeBuildingBounds(node, location);
if (b2 == null) {
return false;
}
return Rectangle2afp.classifiesRectangleRectangle(
b2.getMinX(), b2.getMinY(), b2.getMaxX(), b2.getMaxY(),
location.getMinX(), location.getMinY(), location.getMaxX(), location.getMaxY()) != IntersectionType.INSIDE;
} | [
"@",
"Pure",
"private",
"static",
"boolean",
"isOutsideNodeBuildingBounds",
"(",
"AbstractGISTreeSetNode",
"<",
"?",
",",
"?",
">",
"node",
",",
"Rectangle2afp",
"<",
"?",
",",
"?",
",",
"?",
",",
"?",
",",
"?",
",",
"?",
">",
"location",
")",
"{",
"final",
"Rectangle2d",
"b2",
"=",
"getNormalizedNodeBuildingBounds",
"(",
"node",
",",
"location",
")",
";",
"if",
"(",
"b2",
"==",
"null",
")",
"{",
"return",
"false",
";",
"}",
"return",
"Rectangle2afp",
".",
"classifiesRectangleRectangle",
"(",
"b2",
".",
"getMinX",
"(",
")",
",",
"b2",
".",
"getMinY",
"(",
")",
",",
"b2",
".",
"getMaxX",
"(",
")",
",",
"b2",
".",
"getMaxY",
"(",
")",
",",
"location",
".",
"getMinX",
"(",
")",
",",
"location",
".",
"getMinY",
"(",
")",
",",
"location",
".",
"getMaxX",
"(",
")",
",",
"location",
".",
"getMaxY",
"(",
")",
")",
"!=",
"IntersectionType",
".",
"INSIDE",
";",
"}"
] | Replies if the given geolocation is outside the building bounds of the given node. | [
"Replies",
"if",
"the",
"given",
"geolocation",
"is",
"outside",
"the",
"building",
"bounds",
"of",
"the",
"given",
"node",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/tree/GISTreeSetUtil.java#L311-L321 | train |
gallandarakhneorg/afc | advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/tree/GISTreeSetUtil.java | GISTreeSetUtil.union | private static Rectangle2d union(AbstractGISTreeSetNode<?, ?> node, Rectangle2afp<?, ?, ?, ?, ?, ?> shape) {
final Rectangle2d b = getNodeBuildingBounds(node);
b.setUnion(shape);
normalize(b, shape);
return b;
} | java | private static Rectangle2d union(AbstractGISTreeSetNode<?, ?> node, Rectangle2afp<?, ?, ?, ?, ?, ?> shape) {
final Rectangle2d b = getNodeBuildingBounds(node);
b.setUnion(shape);
normalize(b, shape);
return b;
} | [
"private",
"static",
"Rectangle2d",
"union",
"(",
"AbstractGISTreeSetNode",
"<",
"?",
",",
"?",
">",
"node",
",",
"Rectangle2afp",
"<",
"?",
",",
"?",
",",
"?",
",",
"?",
",",
"?",
",",
"?",
">",
"shape",
")",
"{",
"final",
"Rectangle2d",
"b",
"=",
"getNodeBuildingBounds",
"(",
"node",
")",
";",
"b",
".",
"setUnion",
"(",
"shape",
")",
";",
"normalize",
"(",
"b",
",",
"shape",
")",
";",
"return",
"b",
";",
"}"
] | Compute the union of the building bounds of the given node and the given geolocation. | [
"Compute",
"the",
"union",
"of",
"the",
"building",
"bounds",
"of",
"the",
"given",
"node",
"and",
"the",
"given",
"geolocation",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/tree/GISTreeSetUtil.java#L357-L362 | train |
gallandarakhneorg/afc | advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/tree/GISTreeSetUtil.java | GISTreeSetUtil.getNodeBuildingBounds | @Pure
public static Rectangle2d getNodeBuildingBounds(AbstractGISTreeSetNode<?, ?> node) {
assert node != null;
final double w = node.nodeWidth / 2.;
final double h = node.nodeHeight / 2.;
final IcosepQuadTreeZone zone = node.getZone();
final double lx;
final double ly;
if (zone == null) {
// Is root node
lx = node.verticalSplit - w;
ly = node.horizontalSplit - h;
} else {
switch (zone) {
case SOUTH_EAST:
lx = node.verticalSplit;
ly = node.horizontalSplit - h;
break;
case SOUTH_WEST:
lx = node.verticalSplit - w;
ly = node.horizontalSplit - h;
break;
case NORTH_EAST:
lx = node.verticalSplit;
ly = node.horizontalSplit;
break;
case NORTH_WEST:
lx = node.verticalSplit - w;
ly = node.horizontalSplit;
break;
case ICOSEP:
return getNodeBuildingBounds(node.getParentNode());
default:
throw new IllegalStateException();
}
}
return new Rectangle2d(lx, ly, node.nodeWidth, node.nodeHeight);
} | java | @Pure
public static Rectangle2d getNodeBuildingBounds(AbstractGISTreeSetNode<?, ?> node) {
assert node != null;
final double w = node.nodeWidth / 2.;
final double h = node.nodeHeight / 2.;
final IcosepQuadTreeZone zone = node.getZone();
final double lx;
final double ly;
if (zone == null) {
// Is root node
lx = node.verticalSplit - w;
ly = node.horizontalSplit - h;
} else {
switch (zone) {
case SOUTH_EAST:
lx = node.verticalSplit;
ly = node.horizontalSplit - h;
break;
case SOUTH_WEST:
lx = node.verticalSplit - w;
ly = node.horizontalSplit - h;
break;
case NORTH_EAST:
lx = node.verticalSplit;
ly = node.horizontalSplit;
break;
case NORTH_WEST:
lx = node.verticalSplit - w;
ly = node.horizontalSplit;
break;
case ICOSEP:
return getNodeBuildingBounds(node.getParentNode());
default:
throw new IllegalStateException();
}
}
return new Rectangle2d(lx, ly, node.nodeWidth, node.nodeHeight);
} | [
"@",
"Pure",
"public",
"static",
"Rectangle2d",
"getNodeBuildingBounds",
"(",
"AbstractGISTreeSetNode",
"<",
"?",
",",
"?",
">",
"node",
")",
"{",
"assert",
"node",
"!=",
"null",
";",
"final",
"double",
"w",
"=",
"node",
".",
"nodeWidth",
"/",
"2.",
";",
"final",
"double",
"h",
"=",
"node",
".",
"nodeHeight",
"/",
"2.",
";",
"final",
"IcosepQuadTreeZone",
"zone",
"=",
"node",
".",
"getZone",
"(",
")",
";",
"final",
"double",
"lx",
";",
"final",
"double",
"ly",
";",
"if",
"(",
"zone",
"==",
"null",
")",
"{",
"// Is root node",
"lx",
"=",
"node",
".",
"verticalSplit",
"-",
"w",
";",
"ly",
"=",
"node",
".",
"horizontalSplit",
"-",
"h",
";",
"}",
"else",
"{",
"switch",
"(",
"zone",
")",
"{",
"case",
"SOUTH_EAST",
":",
"lx",
"=",
"node",
".",
"verticalSplit",
";",
"ly",
"=",
"node",
".",
"horizontalSplit",
"-",
"h",
";",
"break",
";",
"case",
"SOUTH_WEST",
":",
"lx",
"=",
"node",
".",
"verticalSplit",
"-",
"w",
";",
"ly",
"=",
"node",
".",
"horizontalSplit",
"-",
"h",
";",
"break",
";",
"case",
"NORTH_EAST",
":",
"lx",
"=",
"node",
".",
"verticalSplit",
";",
"ly",
"=",
"node",
".",
"horizontalSplit",
";",
"break",
";",
"case",
"NORTH_WEST",
":",
"lx",
"=",
"node",
".",
"verticalSplit",
"-",
"w",
";",
"ly",
"=",
"node",
".",
"horizontalSplit",
";",
"break",
";",
"case",
"ICOSEP",
":",
"return",
"getNodeBuildingBounds",
"(",
"node",
".",
"getParentNode",
"(",
")",
")",
";",
"default",
":",
"throw",
"new",
"IllegalStateException",
"(",
")",
";",
"}",
"}",
"return",
"new",
"Rectangle2d",
"(",
"lx",
",",
"ly",
",",
"node",
".",
"nodeWidth",
",",
"node",
".",
"nodeHeight",
")",
";",
"}"
] | Replies the bounds of the area covered by the node.
The replied rectangle is not normalized.
@param node is the node for which the bounds must be extracted and reploed.
@return the not-normalized rectangle. | [
"Replies",
"the",
"bounds",
"of",
"the",
"area",
"covered",
"by",
"the",
"node",
".",
"The",
"replied",
"rectangle",
"is",
"not",
"normalized",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/tree/GISTreeSetUtil.java#L387-L424 | train |
gallandarakhneorg/afc | advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/tree/GISTreeSetUtil.java | GISTreeSetUtil.createNode | private static <P extends GISPrimitive, N extends AbstractGISTreeSetNode<P, N>>
N createNode(N parent, IcosepQuadTreeZone region, GISTreeSetNodeFactory<P, N> builder) {
Rectangle2d area = parent.getAreaBounds();
if (region == IcosepQuadTreeZone.ICOSEP) {
return builder.newNode(
IcosepQuadTreeZone.ICOSEP,
area.getMinX(),
area.getMinY(),
area.getWidth(),
area.getHeight());
}
if (parent.getZone() == IcosepQuadTreeZone.ICOSEP) {
area = computeIcosepSubarea(region, area);
return builder.newNode(
region,
area.getMinX(),
area.getMinY(),
area.getWidth(),
area.getHeight());
}
final Point2d childCutPlane = computeCutPoint(region, parent);
assert childCutPlane != null;
final double w = area.getWidth() / 4.;
final double h = area.getHeight() / 4.;
return builder.newNode(region,
childCutPlane.getX() - w, childCutPlane.getY() - h, 2. * w, 2. * h);
} | java | private static <P extends GISPrimitive, N extends AbstractGISTreeSetNode<P, N>>
N createNode(N parent, IcosepQuadTreeZone region, GISTreeSetNodeFactory<P, N> builder) {
Rectangle2d area = parent.getAreaBounds();
if (region == IcosepQuadTreeZone.ICOSEP) {
return builder.newNode(
IcosepQuadTreeZone.ICOSEP,
area.getMinX(),
area.getMinY(),
area.getWidth(),
area.getHeight());
}
if (parent.getZone() == IcosepQuadTreeZone.ICOSEP) {
area = computeIcosepSubarea(region, area);
return builder.newNode(
region,
area.getMinX(),
area.getMinY(),
area.getWidth(),
area.getHeight());
}
final Point2d childCutPlane = computeCutPoint(region, parent);
assert childCutPlane != null;
final double w = area.getWidth() / 4.;
final double h = area.getHeight() / 4.;
return builder.newNode(region,
childCutPlane.getX() - w, childCutPlane.getY() - h, 2. * w, 2. * h);
} | [
"private",
"static",
"<",
"P",
"extends",
"GISPrimitive",
",",
"N",
"extends",
"AbstractGISTreeSetNode",
"<",
"P",
",",
"N",
">",
">",
"N",
"createNode",
"(",
"N",
"parent",
",",
"IcosepQuadTreeZone",
"region",
",",
"GISTreeSetNodeFactory",
"<",
"P",
",",
"N",
">",
"builder",
")",
"{",
"Rectangle2d",
"area",
"=",
"parent",
".",
"getAreaBounds",
"(",
")",
";",
"if",
"(",
"region",
"==",
"IcosepQuadTreeZone",
".",
"ICOSEP",
")",
"{",
"return",
"builder",
".",
"newNode",
"(",
"IcosepQuadTreeZone",
".",
"ICOSEP",
",",
"area",
".",
"getMinX",
"(",
")",
",",
"area",
".",
"getMinY",
"(",
")",
",",
"area",
".",
"getWidth",
"(",
")",
",",
"area",
".",
"getHeight",
"(",
")",
")",
";",
"}",
"if",
"(",
"parent",
".",
"getZone",
"(",
")",
"==",
"IcosepQuadTreeZone",
".",
"ICOSEP",
")",
"{",
"area",
"=",
"computeIcosepSubarea",
"(",
"region",
",",
"area",
")",
";",
"return",
"builder",
".",
"newNode",
"(",
"region",
",",
"area",
".",
"getMinX",
"(",
")",
",",
"area",
".",
"getMinY",
"(",
")",
",",
"area",
".",
"getWidth",
"(",
")",
",",
"area",
".",
"getHeight",
"(",
")",
")",
";",
"}",
"final",
"Point2d",
"childCutPlane",
"=",
"computeCutPoint",
"(",
"region",
",",
"parent",
")",
";",
"assert",
"childCutPlane",
"!=",
"null",
";",
"final",
"double",
"w",
"=",
"area",
".",
"getWidth",
"(",
")",
"/",
"4.",
";",
"final",
"double",
"h",
"=",
"area",
".",
"getHeight",
"(",
")",
"/",
"4.",
";",
"return",
"builder",
".",
"newNode",
"(",
"region",
",",
"childCutPlane",
".",
"getX",
"(",
")",
"-",
"w",
",",
"childCutPlane",
".",
"getY",
"(",
")",
"-",
"h",
",",
"2.",
"*",
"w",
",",
"2.",
"*",
"h",
")",
";",
"}"
] | Create a child node that supports the specified region.
@param <P> is the type of the primitives.
@param parent is the node in which the new node will be inserted.
@param region is the region that must be covered by the new node.
@param element is the element to initially put inside the node.
@param builder permits to create nodes.
@return a new node that is covering the given region. | [
"Create",
"a",
"child",
"node",
"that",
"supports",
"the",
"specified",
"region",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/tree/GISTreeSetUtil.java#L435-L465 | train |
gallandarakhneorg/afc | advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/tree/GISTreeSetUtil.java | GISTreeSetUtil.computeIcosepSubarea | private static Rectangle2d
computeIcosepSubarea(IcosepQuadTreeZone region, Rectangle2d area) {
if (area == null || area.isEmpty()) {
return area;
}
final double demiWidth = area.getWidth() / 2.;
final double demiHeight = area.getHeight() / 2.;
switch (region) {
case ICOSEP:
return area;
case SOUTH_WEST:
return new Rectangle2d(
area.getMinX(), area.getMinY(),
demiWidth, demiHeight);
case NORTH_WEST:
return new Rectangle2d(
area.getMinX(), area.getCenterY(),
demiWidth, demiHeight);
case NORTH_EAST:
return new Rectangle2d(
area.getCenterX(), area.getMinY(),
demiWidth, demiHeight);
case SOUTH_EAST:
return new Rectangle2d(
area.getMinX(), area.getMinY(),
demiWidth, demiHeight);
default:
}
throw new IllegalStateException();
} | java | private static Rectangle2d
computeIcosepSubarea(IcosepQuadTreeZone region, Rectangle2d area) {
if (area == null || area.isEmpty()) {
return area;
}
final double demiWidth = area.getWidth() / 2.;
final double demiHeight = area.getHeight() / 2.;
switch (region) {
case ICOSEP:
return area;
case SOUTH_WEST:
return new Rectangle2d(
area.getMinX(), area.getMinY(),
demiWidth, demiHeight);
case NORTH_WEST:
return new Rectangle2d(
area.getMinX(), area.getCenterY(),
demiWidth, demiHeight);
case NORTH_EAST:
return new Rectangle2d(
area.getCenterX(), area.getMinY(),
demiWidth, demiHeight);
case SOUTH_EAST:
return new Rectangle2d(
area.getMinX(), area.getMinY(),
demiWidth, demiHeight);
default:
}
throw new IllegalStateException();
} | [
"private",
"static",
"Rectangle2d",
"computeIcosepSubarea",
"(",
"IcosepQuadTreeZone",
"region",
",",
"Rectangle2d",
"area",
")",
"{",
"if",
"(",
"area",
"==",
"null",
"||",
"area",
".",
"isEmpty",
"(",
")",
")",
"{",
"return",
"area",
";",
"}",
"final",
"double",
"demiWidth",
"=",
"area",
".",
"getWidth",
"(",
")",
"/",
"2.",
";",
"final",
"double",
"demiHeight",
"=",
"area",
".",
"getHeight",
"(",
")",
"/",
"2.",
";",
"switch",
"(",
"region",
")",
"{",
"case",
"ICOSEP",
":",
"return",
"area",
";",
"case",
"SOUTH_WEST",
":",
"return",
"new",
"Rectangle2d",
"(",
"area",
".",
"getMinX",
"(",
")",
",",
"area",
".",
"getMinY",
"(",
")",
",",
"demiWidth",
",",
"demiHeight",
")",
";",
"case",
"NORTH_WEST",
":",
"return",
"new",
"Rectangle2d",
"(",
"area",
".",
"getMinX",
"(",
")",
",",
"area",
".",
"getCenterY",
"(",
")",
",",
"demiWidth",
",",
"demiHeight",
")",
";",
"case",
"NORTH_EAST",
":",
"return",
"new",
"Rectangle2d",
"(",
"area",
".",
"getCenterX",
"(",
")",
",",
"area",
".",
"getMinY",
"(",
")",
",",
"demiWidth",
",",
"demiHeight",
")",
";",
"case",
"SOUTH_EAST",
":",
"return",
"new",
"Rectangle2d",
"(",
"area",
".",
"getMinX",
"(",
")",
",",
"area",
".",
"getMinY",
"(",
")",
",",
"demiWidth",
",",
"demiHeight",
")",
";",
"default",
":",
"}",
"throw",
"new",
"IllegalStateException",
"(",
")",
";",
"}"
] | Computes the area covered by a child node of an icosep-node.
@param region is the id of the region for which the area must be computed
@param area is the parent icosep area.
@return the area covered by the child node. | [
"Computes",
"the",
"area",
"covered",
"by",
"a",
"child",
"node",
"of",
"an",
"icosep",
"-",
"node",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/tree/GISTreeSetUtil.java#L473-L502 | train |
gallandarakhneorg/afc | advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/tree/GISTreeSetUtil.java | GISTreeSetUtil.computeCutPoint | private static <P extends GISPrimitive, N extends AbstractGISTreeSetNode<P, N>>
Point2d computeCutPoint(IcosepQuadTreeZone region, N parent) {
final double w = parent.nodeWidth / 4.;
final double h = parent.nodeHeight / 4.;
final double x;
final double y;
switch (region) {
case SOUTH_WEST:
x = parent.verticalSplit - w;
y = parent.horizontalSplit - h;
break;
case SOUTH_EAST:
x = parent.verticalSplit + w;
y = parent.horizontalSplit - h;
break;
case NORTH_WEST:
x = parent.verticalSplit - w;
y = parent.horizontalSplit + h;
break;
case NORTH_EAST:
x = parent.verticalSplit + w;
y = parent.horizontalSplit + h;
break;
case ICOSEP:
default:
return null;
}
return new Point2d(x, y);
} | java | private static <P extends GISPrimitive, N extends AbstractGISTreeSetNode<P, N>>
Point2d computeCutPoint(IcosepQuadTreeZone region, N parent) {
final double w = parent.nodeWidth / 4.;
final double h = parent.nodeHeight / 4.;
final double x;
final double y;
switch (region) {
case SOUTH_WEST:
x = parent.verticalSplit - w;
y = parent.horizontalSplit - h;
break;
case SOUTH_EAST:
x = parent.verticalSplit + w;
y = parent.horizontalSplit - h;
break;
case NORTH_WEST:
x = parent.verticalSplit - w;
y = parent.horizontalSplit + h;
break;
case NORTH_EAST:
x = parent.verticalSplit + w;
y = parent.horizontalSplit + h;
break;
case ICOSEP:
default:
return null;
}
return new Point2d(x, y);
} | [
"private",
"static",
"<",
"P",
"extends",
"GISPrimitive",
",",
"N",
"extends",
"AbstractGISTreeSetNode",
"<",
"P",
",",
"N",
">",
">",
"Point2d",
"computeCutPoint",
"(",
"IcosepQuadTreeZone",
"region",
",",
"N",
"parent",
")",
"{",
"final",
"double",
"w",
"=",
"parent",
".",
"nodeWidth",
"/",
"4.",
";",
"final",
"double",
"h",
"=",
"parent",
".",
"nodeHeight",
"/",
"4.",
";",
"final",
"double",
"x",
";",
"final",
"double",
"y",
";",
"switch",
"(",
"region",
")",
"{",
"case",
"SOUTH_WEST",
":",
"x",
"=",
"parent",
".",
"verticalSplit",
"-",
"w",
";",
"y",
"=",
"parent",
".",
"horizontalSplit",
"-",
"h",
";",
"break",
";",
"case",
"SOUTH_EAST",
":",
"x",
"=",
"parent",
".",
"verticalSplit",
"+",
"w",
";",
"y",
"=",
"parent",
".",
"horizontalSplit",
"-",
"h",
";",
"break",
";",
"case",
"NORTH_WEST",
":",
"x",
"=",
"parent",
".",
"verticalSplit",
"-",
"w",
";",
"y",
"=",
"parent",
".",
"horizontalSplit",
"+",
"h",
";",
"break",
";",
"case",
"NORTH_EAST",
":",
"x",
"=",
"parent",
".",
"verticalSplit",
"+",
"w",
";",
"y",
"=",
"parent",
".",
"horizontalSplit",
"+",
"h",
";",
"break",
";",
"case",
"ICOSEP",
":",
"default",
":",
"return",
"null",
";",
"}",
"return",
"new",
"Point2d",
"(",
"x",
",",
"y",
")",
";",
"}"
] | Computes the cut planes' position of the given region.
@param region is the id of the region for which the cut plane position must be computed
@param parent is the parent node.
@return the cut planes' position of the region, or <code>null</code> if
the cut planes' position could not be computed (because the region is the icosep region
for instance). | [
"Computes",
"the",
"cut",
"planes",
"position",
"of",
"the",
"given",
"region",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/tree/GISTreeSetUtil.java#L512-L540 | train |
gallandarakhneorg/afc | advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/tree/GISTreeSetUtil.java | GISTreeSetUtil.rearrangeTree | private static <P extends GISPrimitive, N extends AbstractGISTreeSetNode<P, N>>
N rearrangeTree(AbstractGISTreeSet<P, N> tree, N node, Rectangle2afp<?, ?, ?, ?, ?, ?> desiredBounds,
GISTreeSetNodeFactory<P, N> builder) {
// Search for the node that completely contains the desired area
N topNode = node.getParentNode();
while (topNode != null && isOutsideNodeBuildingBounds(topNode, desiredBounds)) {
topNode = topNode.getParentNode();
}
final Rectangle2afp<?, ?, ?, ?, ?, ?> dr;
if (topNode == null) {
// Node node found, the entire tree should be rebuilt
topNode = tree.getTree().getRoot();
if (topNode == null) {
throw new IllegalStateException();
}
dr = union(topNode, desiredBounds);
} else {
dr = getNormalizedNodeBuildingBounds(topNode, desiredBounds);
}
// Build a new subtree
final N parent = topNode.getParentNode();
final Iterator<P> dataIterator = new PrefixDataDepthFirstTreeIterator<>(topNode);
final N newTopNode = builder.newNode(
topNode.getZone(),
dr.getMinX(), dr.getMinY(), dr.getWidth(), dr.getHeight());
while (dataIterator.hasNext()) {
if (!addInside(tree, newTopNode, dataIterator.next(), builder, false)) {
throw new IllegalStateException();
}
}
// Replace rearranged subtree by the new one
if (parent != null) {
parent.setChildAt(topNode.getZone().ordinal(), newTopNode);
return parent;
}
tree.getTree().setRoot(newTopNode);
return newTopNode;
} | java | private static <P extends GISPrimitive, N extends AbstractGISTreeSetNode<P, N>>
N rearrangeTree(AbstractGISTreeSet<P, N> tree, N node, Rectangle2afp<?, ?, ?, ?, ?, ?> desiredBounds,
GISTreeSetNodeFactory<P, N> builder) {
// Search for the node that completely contains the desired area
N topNode = node.getParentNode();
while (topNode != null && isOutsideNodeBuildingBounds(topNode, desiredBounds)) {
topNode = topNode.getParentNode();
}
final Rectangle2afp<?, ?, ?, ?, ?, ?> dr;
if (topNode == null) {
// Node node found, the entire tree should be rebuilt
topNode = tree.getTree().getRoot();
if (topNode == null) {
throw new IllegalStateException();
}
dr = union(topNode, desiredBounds);
} else {
dr = getNormalizedNodeBuildingBounds(topNode, desiredBounds);
}
// Build a new subtree
final N parent = topNode.getParentNode();
final Iterator<P> dataIterator = new PrefixDataDepthFirstTreeIterator<>(topNode);
final N newTopNode = builder.newNode(
topNode.getZone(),
dr.getMinX(), dr.getMinY(), dr.getWidth(), dr.getHeight());
while (dataIterator.hasNext()) {
if (!addInside(tree, newTopNode, dataIterator.next(), builder, false)) {
throw new IllegalStateException();
}
}
// Replace rearranged subtree by the new one
if (parent != null) {
parent.setChildAt(topNode.getZone().ordinal(), newTopNode);
return parent;
}
tree.getTree().setRoot(newTopNode);
return newTopNode;
} | [
"private",
"static",
"<",
"P",
"extends",
"GISPrimitive",
",",
"N",
"extends",
"AbstractGISTreeSetNode",
"<",
"P",
",",
"N",
">",
">",
"N",
"rearrangeTree",
"(",
"AbstractGISTreeSet",
"<",
"P",
",",
"N",
">",
"tree",
",",
"N",
"node",
",",
"Rectangle2afp",
"<",
"?",
",",
"?",
",",
"?",
",",
"?",
",",
"?",
",",
"?",
">",
"desiredBounds",
",",
"GISTreeSetNodeFactory",
"<",
"P",
",",
"N",
">",
"builder",
")",
"{",
"// Search for the node that completely contains the desired area",
"N",
"topNode",
"=",
"node",
".",
"getParentNode",
"(",
")",
";",
"while",
"(",
"topNode",
"!=",
"null",
"&&",
"isOutsideNodeBuildingBounds",
"(",
"topNode",
",",
"desiredBounds",
")",
")",
"{",
"topNode",
"=",
"topNode",
".",
"getParentNode",
"(",
")",
";",
"}",
"final",
"Rectangle2afp",
"<",
"?",
",",
"?",
",",
"?",
",",
"?",
",",
"?",
",",
"?",
">",
"dr",
";",
"if",
"(",
"topNode",
"==",
"null",
")",
"{",
"// Node node found, the entire tree should be rebuilt",
"topNode",
"=",
"tree",
".",
"getTree",
"(",
")",
".",
"getRoot",
"(",
")",
";",
"if",
"(",
"topNode",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
")",
";",
"}",
"dr",
"=",
"union",
"(",
"topNode",
",",
"desiredBounds",
")",
";",
"}",
"else",
"{",
"dr",
"=",
"getNormalizedNodeBuildingBounds",
"(",
"topNode",
",",
"desiredBounds",
")",
";",
"}",
"// Build a new subtree",
"final",
"N",
"parent",
"=",
"topNode",
".",
"getParentNode",
"(",
")",
";",
"final",
"Iterator",
"<",
"P",
">",
"dataIterator",
"=",
"new",
"PrefixDataDepthFirstTreeIterator",
"<>",
"(",
"topNode",
")",
";",
"final",
"N",
"newTopNode",
"=",
"builder",
".",
"newNode",
"(",
"topNode",
".",
"getZone",
"(",
")",
",",
"dr",
".",
"getMinX",
"(",
")",
",",
"dr",
".",
"getMinY",
"(",
")",
",",
"dr",
".",
"getWidth",
"(",
")",
",",
"dr",
".",
"getHeight",
"(",
")",
")",
";",
"while",
"(",
"dataIterator",
".",
"hasNext",
"(",
")",
")",
"{",
"if",
"(",
"!",
"addInside",
"(",
"tree",
",",
"newTopNode",
",",
"dataIterator",
".",
"next",
"(",
")",
",",
"builder",
",",
"false",
")",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
")",
";",
"}",
"}",
"// Replace rearranged subtree by the new one",
"if",
"(",
"parent",
"!=",
"null",
")",
"{",
"parent",
".",
"setChildAt",
"(",
"topNode",
".",
"getZone",
"(",
")",
".",
"ordinal",
"(",
")",
",",
"newTopNode",
")",
";",
"return",
"parent",
";",
"}",
"tree",
".",
"getTree",
"(",
")",
".",
"setRoot",
"(",
"newTopNode",
")",
";",
"return",
"newTopNode",
";",
"}"
] | Try to rearrange the cut planes of the given node. | [
"Try",
"to",
"rearrange",
"the",
"cut",
"planes",
"of",
"the",
"given",
"node",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/tree/GISTreeSetUtil.java#L544-L584 | train |
gallandarakhneorg/afc | core/maths/mathgeom/src/main/java/org/arakhne/afc/math/geometry/d3/i/AbstractShape3i.java | AbstractShape3i.addShapeGeometryChangeListener | protected synchronized void addShapeGeometryChangeListener(ShapeGeometryChangeListener listener) {
assert listener != null : AssertMessages.notNullParameter();
if (this.geometryListeners == null) {
this.geometryListeners = new WeakArrayList<>();
}
this.geometryListeners.add(listener);
} | java | protected synchronized void addShapeGeometryChangeListener(ShapeGeometryChangeListener listener) {
assert listener != null : AssertMessages.notNullParameter();
if (this.geometryListeners == null) {
this.geometryListeners = new WeakArrayList<>();
}
this.geometryListeners.add(listener);
} | [
"protected",
"synchronized",
"void",
"addShapeGeometryChangeListener",
"(",
"ShapeGeometryChangeListener",
"listener",
")",
"{",
"assert",
"listener",
"!=",
"null",
":",
"AssertMessages",
".",
"notNullParameter",
"(",
")",
";",
"if",
"(",
"this",
".",
"geometryListeners",
"==",
"null",
")",
"{",
"this",
".",
"geometryListeners",
"=",
"new",
"WeakArrayList",
"<>",
"(",
")",
";",
"}",
"this",
".",
"geometryListeners",
".",
"add",
"(",
"listener",
")",
";",
"}"
] | Add listener on geometry changes.
@param listener the listener. | [
"Add",
"listener",
"on",
"geometry",
"changes",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/maths/mathgeom/src/main/java/org/arakhne/afc/math/geometry/d3/i/AbstractShape3i.java#L52-L58 | train |
gallandarakhneorg/afc | core/maths/mathgeom/src/main/java/org/arakhne/afc/math/geometry/d3/i/AbstractShape3i.java | AbstractShape3i.removeShapeGeometryChangeListener | protected synchronized void removeShapeGeometryChangeListener(ShapeGeometryChangeListener listener) {
assert listener != null : AssertMessages.notNullParameter();
if (this.geometryListeners != null) {
this.geometryListeners.remove(listener);
if (this.geometryListeners.isEmpty()) {
this.geometryListeners = null;
}
}
} | java | protected synchronized void removeShapeGeometryChangeListener(ShapeGeometryChangeListener listener) {
assert listener != null : AssertMessages.notNullParameter();
if (this.geometryListeners != null) {
this.geometryListeners.remove(listener);
if (this.geometryListeners.isEmpty()) {
this.geometryListeners = null;
}
}
} | [
"protected",
"synchronized",
"void",
"removeShapeGeometryChangeListener",
"(",
"ShapeGeometryChangeListener",
"listener",
")",
"{",
"assert",
"listener",
"!=",
"null",
":",
"AssertMessages",
".",
"notNullParameter",
"(",
")",
";",
"if",
"(",
"this",
".",
"geometryListeners",
"!=",
"null",
")",
"{",
"this",
".",
"geometryListeners",
".",
"remove",
"(",
"listener",
")",
";",
"if",
"(",
"this",
".",
"geometryListeners",
".",
"isEmpty",
"(",
")",
")",
"{",
"this",
".",
"geometryListeners",
"=",
"null",
";",
"}",
"}",
"}"
] | Remove listener on geometry changes.
@param listener the listener. | [
"Remove",
"listener",
"on",
"geometry",
"changes",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/maths/mathgeom/src/main/java/org/arakhne/afc/math/geometry/d3/i/AbstractShape3i.java#L64-L72 | train |
gallandarakhneorg/afc | core/maths/mathgeom/src/main/java/org/arakhne/afc/math/geometry/d3/i/AbstractShape3i.java | AbstractShape3i.fireGeometryChange | protected synchronized void fireGeometryChange() {
if (this.geometryListeners == null) {
return;
}
final ShapeGeometryChangeListener[] array = new ShapeGeometryChangeListener[this.geometryListeners.size()];
this.geometryListeners.toArray(array);
for (final ShapeGeometryChangeListener listener : array) {
listener.shapeGeometryChange(this);
}
} | java | protected synchronized void fireGeometryChange() {
if (this.geometryListeners == null) {
return;
}
final ShapeGeometryChangeListener[] array = new ShapeGeometryChangeListener[this.geometryListeners.size()];
this.geometryListeners.toArray(array);
for (final ShapeGeometryChangeListener listener : array) {
listener.shapeGeometryChange(this);
}
} | [
"protected",
"synchronized",
"void",
"fireGeometryChange",
"(",
")",
"{",
"if",
"(",
"this",
".",
"geometryListeners",
"==",
"null",
")",
"{",
"return",
";",
"}",
"final",
"ShapeGeometryChangeListener",
"[",
"]",
"array",
"=",
"new",
"ShapeGeometryChangeListener",
"[",
"this",
".",
"geometryListeners",
".",
"size",
"(",
")",
"]",
";",
"this",
".",
"geometryListeners",
".",
"toArray",
"(",
"array",
")",
";",
"for",
"(",
"final",
"ShapeGeometryChangeListener",
"listener",
":",
"array",
")",
"{",
"listener",
".",
"shapeGeometryChange",
"(",
"this",
")",
";",
"}",
"}"
] | Notify any listener of a geometry change. | [
"Notify",
"any",
"listener",
"of",
"a",
"geometry",
"change",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/maths/mathgeom/src/main/java/org/arakhne/afc/math/geometry/d3/i/AbstractShape3i.java#L76-L85 | train |
gallandarakhneorg/afc | advanced/nodefx/src/main/java/org/arakhne/afc/nodefx/ZoomablePane.java | ZoomablePane.setupListeners | protected void setupListeners() {
addDrawingListener(new DrawingListener() {
private long time;
@Override
public void onDrawingStart() {
this.time = System.currentTimeMillis();
getCorner().setColor(Color.ORANGERED);
}
@Override
public void onDrawingEnd() {
getCorner().setColor(null);
final long duration = System.currentTimeMillis() - this.time;
getLogger().fine("Rendering duration: " + Duration.millis(duration).toString()); //$NON-NLS-1$
}
});
} | java | protected void setupListeners() {
addDrawingListener(new DrawingListener() {
private long time;
@Override
public void onDrawingStart() {
this.time = System.currentTimeMillis();
getCorner().setColor(Color.ORANGERED);
}
@Override
public void onDrawingEnd() {
getCorner().setColor(null);
final long duration = System.currentTimeMillis() - this.time;
getLogger().fine("Rendering duration: " + Duration.millis(duration).toString()); //$NON-NLS-1$
}
});
} | [
"protected",
"void",
"setupListeners",
"(",
")",
"{",
"addDrawingListener",
"(",
"new",
"DrawingListener",
"(",
")",
"{",
"private",
"long",
"time",
";",
"@",
"Override",
"public",
"void",
"onDrawingStart",
"(",
")",
"{",
"this",
".",
"time",
"=",
"System",
".",
"currentTimeMillis",
"(",
")",
";",
"getCorner",
"(",
")",
".",
"setColor",
"(",
"Color",
".",
"ORANGERED",
")",
";",
"}",
"@",
"Override",
"public",
"void",
"onDrawingEnd",
"(",
")",
"{",
"getCorner",
"(",
")",
".",
"setColor",
"(",
"null",
")",
";",
"final",
"long",
"duration",
"=",
"System",
".",
"currentTimeMillis",
"(",
")",
"-",
"this",
".",
"time",
";",
"getLogger",
"(",
")",
".",
"fine",
"(",
"\"Rendering duration: \"",
"+",
"Duration",
".",
"millis",
"(",
"duration",
")",
".",
"toString",
"(",
")",
")",
";",
"//$NON-NLS-1$",
"}",
"}",
")",
";",
"}"
] | Setup the response based on listeners. | [
"Setup",
"the",
"response",
"based",
"on",
"listeners",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/nodefx/src/main/java/org/arakhne/afc/nodefx/ZoomablePane.java#L312-L329 | train |
gallandarakhneorg/afc | advanced/nodefx/src/main/java/org/arakhne/afc/nodefx/ZoomablePane.java | ZoomablePane.setupMousing | @SuppressWarnings({"checkstyle:cyclomaticcomplexity", "checkstyle:npathcomplexity", "checkstyle:nestedifdepth"})
protected void setupMousing() {
final ZoomableCanvas<T> canvas = getDocumentCanvas();
canvas.addEventHandler(MouseEvent.MOUSE_PRESSED, e -> {
this.pressX = e.getX();
this.pressY = e.getY();
this.hbarValue = this.hbar.getValue();
this.vbarValue = this.vbar.getValue();
});
setOnDragDetected(getDefaultOnDragDetectedEventHandler());
addEventFilter(MouseEvent.MOUSE_RELEASED, e -> {
if (this.dragDetected) {
this.dragDetected = false;
final Cursor scurs = this.savedCursor;
this.savedCursor = null;
if (scurs != null) {
getDocumentCanvas().setCursor(scurs);
requestLayout();
}
}
});
addEventHandler(DragEvent.DRAG_DONE, event -> {
if (this.dragDetected) {
this.dragDetected = false;
final Cursor scurs = this.savedCursor;
this.savedCursor = null;
if (scurs != null) {
getDocumentCanvas().setCursor(scurs);
requestLayout();
}
}
});
addEventHandler(MouseEvent.MOUSE_DRAGGED, getDefaultOnMouseDraggedEventHandler());
addEventHandler(ScrollEvent.SCROLL_STARTED, event -> {
this.scrollDetected = true;
});
addEventHandler(ScrollEvent.SCROLL_FINISHED, event -> {
this.scrollDetected = false;
});
addEventHandler(ScrollEvent.SCROLL, event -> {
if (!this.scrollDetected) {
event.consume();
final double delta;
if (event.getDeltaY() != 0.) {
delta = event.getDeltaY();
} else {
delta = event.getDeltaX();
}
if (delta < 0) {
zoomOut();
} else {
zoomIn();
}
}
});
} | java | @SuppressWarnings({"checkstyle:cyclomaticcomplexity", "checkstyle:npathcomplexity", "checkstyle:nestedifdepth"})
protected void setupMousing() {
final ZoomableCanvas<T> canvas = getDocumentCanvas();
canvas.addEventHandler(MouseEvent.MOUSE_PRESSED, e -> {
this.pressX = e.getX();
this.pressY = e.getY();
this.hbarValue = this.hbar.getValue();
this.vbarValue = this.vbar.getValue();
});
setOnDragDetected(getDefaultOnDragDetectedEventHandler());
addEventFilter(MouseEvent.MOUSE_RELEASED, e -> {
if (this.dragDetected) {
this.dragDetected = false;
final Cursor scurs = this.savedCursor;
this.savedCursor = null;
if (scurs != null) {
getDocumentCanvas().setCursor(scurs);
requestLayout();
}
}
});
addEventHandler(DragEvent.DRAG_DONE, event -> {
if (this.dragDetected) {
this.dragDetected = false;
final Cursor scurs = this.savedCursor;
this.savedCursor = null;
if (scurs != null) {
getDocumentCanvas().setCursor(scurs);
requestLayout();
}
}
});
addEventHandler(MouseEvent.MOUSE_DRAGGED, getDefaultOnMouseDraggedEventHandler());
addEventHandler(ScrollEvent.SCROLL_STARTED, event -> {
this.scrollDetected = true;
});
addEventHandler(ScrollEvent.SCROLL_FINISHED, event -> {
this.scrollDetected = false;
});
addEventHandler(ScrollEvent.SCROLL, event -> {
if (!this.scrollDetected) {
event.consume();
final double delta;
if (event.getDeltaY() != 0.) {
delta = event.getDeltaY();
} else {
delta = event.getDeltaX();
}
if (delta < 0) {
zoomOut();
} else {
zoomIn();
}
}
});
} | [
"@",
"SuppressWarnings",
"(",
"{",
"\"checkstyle:cyclomaticcomplexity\"",
",",
"\"checkstyle:npathcomplexity\"",
",",
"\"checkstyle:nestedifdepth\"",
"}",
")",
"protected",
"void",
"setupMousing",
"(",
")",
"{",
"final",
"ZoomableCanvas",
"<",
"T",
">",
"canvas",
"=",
"getDocumentCanvas",
"(",
")",
";",
"canvas",
".",
"addEventHandler",
"(",
"MouseEvent",
".",
"MOUSE_PRESSED",
",",
"e",
"->",
"{",
"this",
".",
"pressX",
"=",
"e",
".",
"getX",
"(",
")",
";",
"this",
".",
"pressY",
"=",
"e",
".",
"getY",
"(",
")",
";",
"this",
".",
"hbarValue",
"=",
"this",
".",
"hbar",
".",
"getValue",
"(",
")",
";",
"this",
".",
"vbarValue",
"=",
"this",
".",
"vbar",
".",
"getValue",
"(",
")",
";",
"}",
")",
";",
"setOnDragDetected",
"(",
"getDefaultOnDragDetectedEventHandler",
"(",
")",
")",
";",
"addEventFilter",
"(",
"MouseEvent",
".",
"MOUSE_RELEASED",
",",
"e",
"->",
"{",
"if",
"(",
"this",
".",
"dragDetected",
")",
"{",
"this",
".",
"dragDetected",
"=",
"false",
";",
"final",
"Cursor",
"scurs",
"=",
"this",
".",
"savedCursor",
";",
"this",
".",
"savedCursor",
"=",
"null",
";",
"if",
"(",
"scurs",
"!=",
"null",
")",
"{",
"getDocumentCanvas",
"(",
")",
".",
"setCursor",
"(",
"scurs",
")",
";",
"requestLayout",
"(",
")",
";",
"}",
"}",
"}",
")",
";",
"addEventHandler",
"(",
"DragEvent",
".",
"DRAG_DONE",
",",
"event",
"->",
"{",
"if",
"(",
"this",
".",
"dragDetected",
")",
"{",
"this",
".",
"dragDetected",
"=",
"false",
";",
"final",
"Cursor",
"scurs",
"=",
"this",
".",
"savedCursor",
";",
"this",
".",
"savedCursor",
"=",
"null",
";",
"if",
"(",
"scurs",
"!=",
"null",
")",
"{",
"getDocumentCanvas",
"(",
")",
".",
"setCursor",
"(",
"scurs",
")",
";",
"requestLayout",
"(",
")",
";",
"}",
"}",
"}",
")",
";",
"addEventHandler",
"(",
"MouseEvent",
".",
"MOUSE_DRAGGED",
",",
"getDefaultOnMouseDraggedEventHandler",
"(",
")",
")",
";",
"addEventHandler",
"(",
"ScrollEvent",
".",
"SCROLL_STARTED",
",",
"event",
"->",
"{",
"this",
".",
"scrollDetected",
"=",
"true",
";",
"}",
")",
";",
"addEventHandler",
"(",
"ScrollEvent",
".",
"SCROLL_FINISHED",
",",
"event",
"->",
"{",
"this",
".",
"scrollDetected",
"=",
"false",
";",
"}",
")",
";",
"addEventHandler",
"(",
"ScrollEvent",
".",
"SCROLL",
",",
"event",
"->",
"{",
"if",
"(",
"!",
"this",
".",
"scrollDetected",
")",
"{",
"event",
".",
"consume",
"(",
")",
";",
"final",
"double",
"delta",
";",
"if",
"(",
"event",
".",
"getDeltaY",
"(",
")",
"!=",
"0.",
")",
"{",
"delta",
"=",
"event",
".",
"getDeltaY",
"(",
")",
";",
"}",
"else",
"{",
"delta",
"=",
"event",
".",
"getDeltaX",
"(",
")",
";",
"}",
"if",
"(",
"delta",
"<",
"0",
")",
"{",
"zoomOut",
"(",
")",
";",
"}",
"else",
"{",
"zoomIn",
"(",
")",
";",
"}",
"}",
"}",
")",
";",
"}"
] | Setup the response of the pane to mouse events. | [
"Setup",
"the",
"response",
"of",
"the",
"pane",
"to",
"mouse",
"events",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/nodefx/src/main/java/org/arakhne/afc/nodefx/ZoomablePane.java#L409-L471 | train |
gallandarakhneorg/afc | advanced/nodefx/src/main/java/org/arakhne/afc/nodefx/ZoomablePane.java | ZoomablePane.setupKeying | protected void setupKeying() {
setOnKeyPressed(event -> {
switch (event.getCode()) {
case LEFT:
moveLeft(event.isShiftDown(), event.isControlDown(), false);
event.consume();
break;
case RIGHT:
moveRight(event.isShiftDown(), event.isControlDown(), false);
event.consume();
break;
case UP:
if (event.isAltDown()) {
zoomIn();
} else {
moveUp(event.isShiftDown(), event.isControlDown(), false);
}
event.consume();
break;
case DOWN:
if (event.isAltDown()) {
zoomOut();
} else {
moveDown(event.isShiftDown(), event.isControlDown(), false);
}
event.consume();
break;
case PAGE_UP:
if (event.isControlDown()) {
moveLeft(false, false, true);
} else {
moveUp(false, false, true);
}
event.consume();
break;
case PAGE_DOWN:
if (event.isControlDown()) {
moveRight(false, false, true);
} else {
moveDown(false, false, true);
}
event.consume();
break;
//$CASES-OMITTED$
default:
}
});
} | java | protected void setupKeying() {
setOnKeyPressed(event -> {
switch (event.getCode()) {
case LEFT:
moveLeft(event.isShiftDown(), event.isControlDown(), false);
event.consume();
break;
case RIGHT:
moveRight(event.isShiftDown(), event.isControlDown(), false);
event.consume();
break;
case UP:
if (event.isAltDown()) {
zoomIn();
} else {
moveUp(event.isShiftDown(), event.isControlDown(), false);
}
event.consume();
break;
case DOWN:
if (event.isAltDown()) {
zoomOut();
} else {
moveDown(event.isShiftDown(), event.isControlDown(), false);
}
event.consume();
break;
case PAGE_UP:
if (event.isControlDown()) {
moveLeft(false, false, true);
} else {
moveUp(false, false, true);
}
event.consume();
break;
case PAGE_DOWN:
if (event.isControlDown()) {
moveRight(false, false, true);
} else {
moveDown(false, false, true);
}
event.consume();
break;
//$CASES-OMITTED$
default:
}
});
} | [
"protected",
"void",
"setupKeying",
"(",
")",
"{",
"setOnKeyPressed",
"(",
"event",
"->",
"{",
"switch",
"(",
"event",
".",
"getCode",
"(",
")",
")",
"{",
"case",
"LEFT",
":",
"moveLeft",
"(",
"event",
".",
"isShiftDown",
"(",
")",
",",
"event",
".",
"isControlDown",
"(",
")",
",",
"false",
")",
";",
"event",
".",
"consume",
"(",
")",
";",
"break",
";",
"case",
"RIGHT",
":",
"moveRight",
"(",
"event",
".",
"isShiftDown",
"(",
")",
",",
"event",
".",
"isControlDown",
"(",
")",
",",
"false",
")",
";",
"event",
".",
"consume",
"(",
")",
";",
"break",
";",
"case",
"UP",
":",
"if",
"(",
"event",
".",
"isAltDown",
"(",
")",
")",
"{",
"zoomIn",
"(",
")",
";",
"}",
"else",
"{",
"moveUp",
"(",
"event",
".",
"isShiftDown",
"(",
")",
",",
"event",
".",
"isControlDown",
"(",
")",
",",
"false",
")",
";",
"}",
"event",
".",
"consume",
"(",
")",
";",
"break",
";",
"case",
"DOWN",
":",
"if",
"(",
"event",
".",
"isAltDown",
"(",
")",
")",
"{",
"zoomOut",
"(",
")",
";",
"}",
"else",
"{",
"moveDown",
"(",
"event",
".",
"isShiftDown",
"(",
")",
",",
"event",
".",
"isControlDown",
"(",
")",
",",
"false",
")",
";",
"}",
"event",
".",
"consume",
"(",
")",
";",
"break",
";",
"case",
"PAGE_UP",
":",
"if",
"(",
"event",
".",
"isControlDown",
"(",
")",
")",
"{",
"moveLeft",
"(",
"false",
",",
"false",
",",
"true",
")",
";",
"}",
"else",
"{",
"moveUp",
"(",
"false",
",",
"false",
",",
"true",
")",
";",
"}",
"event",
".",
"consume",
"(",
")",
";",
"break",
";",
"case",
"PAGE_DOWN",
":",
"if",
"(",
"event",
".",
"isControlDown",
"(",
")",
")",
"{",
"moveRight",
"(",
"false",
",",
"false",
",",
"true",
")",
";",
"}",
"else",
"{",
"moveDown",
"(",
"false",
",",
"false",
",",
"true",
")",
";",
"}",
"event",
".",
"consume",
"(",
")",
";",
"break",
";",
"//$CASES-OMITTED$",
"default",
":",
"}",
"}",
")",
";",
"}"
] | Setup the response of the pane to key events. | [
"Setup",
"the",
"response",
"of",
"the",
"pane",
"to",
"key",
"events",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/nodefx/src/main/java/org/arakhne/afc/nodefx/ZoomablePane.java#L475-L522 | train |
gallandarakhneorg/afc | advanced/nodefx/src/main/java/org/arakhne/afc/nodefx/ZoomablePane.java | ZoomablePane.moveLeft | public void moveLeft(boolean isUnit, boolean isLarge, boolean isVeryLarge) {
double inc = isUnit ? this.hbar.getUnitIncrement()
: (isLarge ? LARGE_MOVE_FACTOR
: (isVeryLarge ? VERY_LARGE_MOVE_FACTOR : STANDARD_MOVE_FACTOR)) * this.hbar.getBlockIncrement();
if (!isInvertedAxisX()) {
inc = -inc;
}
this.hbar.setValue(Utils.clamp(this.hbar.getMin(), this.hbar.getValue() + inc, this.hbar.getMax()));
} | java | public void moveLeft(boolean isUnit, boolean isLarge, boolean isVeryLarge) {
double inc = isUnit ? this.hbar.getUnitIncrement()
: (isLarge ? LARGE_MOVE_FACTOR
: (isVeryLarge ? VERY_LARGE_MOVE_FACTOR : STANDARD_MOVE_FACTOR)) * this.hbar.getBlockIncrement();
if (!isInvertedAxisX()) {
inc = -inc;
}
this.hbar.setValue(Utils.clamp(this.hbar.getMin(), this.hbar.getValue() + inc, this.hbar.getMax()));
} | [
"public",
"void",
"moveLeft",
"(",
"boolean",
"isUnit",
",",
"boolean",
"isLarge",
",",
"boolean",
"isVeryLarge",
")",
"{",
"double",
"inc",
"=",
"isUnit",
"?",
"this",
".",
"hbar",
".",
"getUnitIncrement",
"(",
")",
":",
"(",
"isLarge",
"?",
"LARGE_MOVE_FACTOR",
":",
"(",
"isVeryLarge",
"?",
"VERY_LARGE_MOVE_FACTOR",
":",
"STANDARD_MOVE_FACTOR",
")",
")",
"*",
"this",
".",
"hbar",
".",
"getBlockIncrement",
"(",
")",
";",
"if",
"(",
"!",
"isInvertedAxisX",
"(",
")",
")",
"{",
"inc",
"=",
"-",
"inc",
";",
"}",
"this",
".",
"hbar",
".",
"setValue",
"(",
"Utils",
".",
"clamp",
"(",
"this",
".",
"hbar",
".",
"getMin",
"(",
")",
",",
"this",
".",
"hbar",
".",
"getValue",
"(",
")",
"+",
"inc",
",",
"this",
".",
"hbar",
".",
"getMax",
"(",
")",
")",
")",
";",
"}"
] | Move the viewport left.
@param isUnit indicates if the move is a unit move. If {@code true}, this argument has precedence to the other arguments.
@param isLarge indicates if the move is a large move. If {@code true}, this argument has precedence
to the very large argument.
@param isVeryLarge indicates if the move is a very large move. | [
"Move",
"the",
"viewport",
"left",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/nodefx/src/main/java/org/arakhne/afc/nodefx/ZoomablePane.java#L531-L539 | train |
gallandarakhneorg/afc | advanced/nodefx/src/main/java/org/arakhne/afc/nodefx/ZoomablePane.java | ZoomablePane.moveUp | public void moveUp(boolean isUnit, boolean isLarge, boolean isVeryLarge) {
double inc = isUnit ? this.vbar.getUnitIncrement()
: (isLarge ? LARGE_MOVE_FACTOR
: (isVeryLarge ? VERY_LARGE_MOVE_FACTOR : STANDARD_MOVE_FACTOR)) * this.vbar.getBlockIncrement();
if (!isInvertedAxisY()) {
inc = -inc;
}
this.vbar.setValue(Utils.clamp(this.vbar.getMin(), this.vbar.getValue() + inc, this.vbar.getMax()));
} | java | public void moveUp(boolean isUnit, boolean isLarge, boolean isVeryLarge) {
double inc = isUnit ? this.vbar.getUnitIncrement()
: (isLarge ? LARGE_MOVE_FACTOR
: (isVeryLarge ? VERY_LARGE_MOVE_FACTOR : STANDARD_MOVE_FACTOR)) * this.vbar.getBlockIncrement();
if (!isInvertedAxisY()) {
inc = -inc;
}
this.vbar.setValue(Utils.clamp(this.vbar.getMin(), this.vbar.getValue() + inc, this.vbar.getMax()));
} | [
"public",
"void",
"moveUp",
"(",
"boolean",
"isUnit",
",",
"boolean",
"isLarge",
",",
"boolean",
"isVeryLarge",
")",
"{",
"double",
"inc",
"=",
"isUnit",
"?",
"this",
".",
"vbar",
".",
"getUnitIncrement",
"(",
")",
":",
"(",
"isLarge",
"?",
"LARGE_MOVE_FACTOR",
":",
"(",
"isVeryLarge",
"?",
"VERY_LARGE_MOVE_FACTOR",
":",
"STANDARD_MOVE_FACTOR",
")",
")",
"*",
"this",
".",
"vbar",
".",
"getBlockIncrement",
"(",
")",
";",
"if",
"(",
"!",
"isInvertedAxisY",
"(",
")",
")",
"{",
"inc",
"=",
"-",
"inc",
";",
"}",
"this",
".",
"vbar",
".",
"setValue",
"(",
"Utils",
".",
"clamp",
"(",
"this",
".",
"vbar",
".",
"getMin",
"(",
")",
",",
"this",
".",
"vbar",
".",
"getValue",
"(",
")",
"+",
"inc",
",",
"this",
".",
"vbar",
".",
"getMax",
"(",
")",
")",
")",
";",
"}"
] | Move the viewport up.
@param isUnit indicates if the move is a unit move. If {@code true}, this argument has precedence to the other arguments.
@param isLarge indicates if the move is a large move. If {@code true}, this argument has precedence
to the very large argument.
@param isVeryLarge indicates if the move is a very large move. | [
"Move",
"the",
"viewport",
"up",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/nodefx/src/main/java/org/arakhne/afc/nodefx/ZoomablePane.java#L565-L573 | train |
gallandarakhneorg/afc | advanced/nodefx/src/main/java/org/arakhne/afc/nodefx/ZoomablePane.java | ZoomablePane.loggerProperty | public ObjectProperty<Logger> loggerProperty() {
if (this.logger == null) {
this.logger = new SimpleObjectProperty<Logger>(this, LOGGER_PROPERTY, Logger.getLogger(getClass().getName())) {
@Override
protected void invalidated() {
final Logger log = get();
if (log == null) {
set(Logger.getLogger(getClass().getName()));
}
}
};
}
return this.logger;
} | java | public ObjectProperty<Logger> loggerProperty() {
if (this.logger == null) {
this.logger = new SimpleObjectProperty<Logger>(this, LOGGER_PROPERTY, Logger.getLogger(getClass().getName())) {
@Override
protected void invalidated() {
final Logger log = get();
if (log == null) {
set(Logger.getLogger(getClass().getName()));
}
}
};
}
return this.logger;
} | [
"public",
"ObjectProperty",
"<",
"Logger",
">",
"loggerProperty",
"(",
")",
"{",
"if",
"(",
"this",
".",
"logger",
"==",
"null",
")",
"{",
"this",
".",
"logger",
"=",
"new",
"SimpleObjectProperty",
"<",
"Logger",
">",
"(",
"this",
",",
"LOGGER_PROPERTY",
",",
"Logger",
".",
"getLogger",
"(",
"getClass",
"(",
")",
".",
"getName",
"(",
")",
")",
")",
"{",
"@",
"Override",
"protected",
"void",
"invalidated",
"(",
")",
"{",
"final",
"Logger",
"log",
"=",
"get",
"(",
")",
";",
"if",
"(",
"log",
"==",
"null",
")",
"{",
"set",
"(",
"Logger",
".",
"getLogger",
"(",
"getClass",
"(",
")",
".",
"getName",
"(",
")",
")",
")",
";",
"}",
"}",
"}",
";",
"}",
"return",
"this",
".",
"logger",
";",
"}"
] | Replies the property that contains the logger.
@return the logger. | [
"Replies",
"the",
"property",
"that",
"contains",
"the",
"logger",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/nodefx/src/main/java/org/arakhne/afc/nodefx/ZoomablePane.java#L596-L609 | train |
gallandarakhneorg/afc | advanced/nodefx/src/main/java/org/arakhne/afc/nodefx/ZoomablePane.java | ZoomablePane.panButtonProperty | public ObjectProperty<MouseButton> panButtonProperty() {
if (this.panButton == null) {
this.panButton = new StyleableObjectProperty<MouseButton>(DEFAULT_PAN_BUTTON) {
@SuppressWarnings("synthetic-access")
@Override
protected void invalidated() {
final MouseButton button = get();
if (button == null) {
set(DEFAULT_PAN_BUTTON);
}
}
@Override
public CssMetaData<ZoomablePane<?>, MouseButton> getCssMetaData() {
return StyleableProperties.PAN_BUTTON;
}
@Override
public Object getBean() {
return ZoomablePane.this;
}
@Override
public String getName() {
return PAN_BUTTON_PROPERTY;
}
};
}
return this.panButton;
} | java | public ObjectProperty<MouseButton> panButtonProperty() {
if (this.panButton == null) {
this.panButton = new StyleableObjectProperty<MouseButton>(DEFAULT_PAN_BUTTON) {
@SuppressWarnings("synthetic-access")
@Override
protected void invalidated() {
final MouseButton button = get();
if (button == null) {
set(DEFAULT_PAN_BUTTON);
}
}
@Override
public CssMetaData<ZoomablePane<?>, MouseButton> getCssMetaData() {
return StyleableProperties.PAN_BUTTON;
}
@Override
public Object getBean() {
return ZoomablePane.this;
}
@Override
public String getName() {
return PAN_BUTTON_PROPERTY;
}
};
}
return this.panButton;
} | [
"public",
"ObjectProperty",
"<",
"MouseButton",
">",
"panButtonProperty",
"(",
")",
"{",
"if",
"(",
"this",
".",
"panButton",
"==",
"null",
")",
"{",
"this",
".",
"panButton",
"=",
"new",
"StyleableObjectProperty",
"<",
"MouseButton",
">",
"(",
"DEFAULT_PAN_BUTTON",
")",
"{",
"@",
"SuppressWarnings",
"(",
"\"synthetic-access\"",
")",
"@",
"Override",
"protected",
"void",
"invalidated",
"(",
")",
"{",
"final",
"MouseButton",
"button",
"=",
"get",
"(",
")",
";",
"if",
"(",
"button",
"==",
"null",
")",
"{",
"set",
"(",
"DEFAULT_PAN_BUTTON",
")",
";",
"}",
"}",
"@",
"Override",
"public",
"CssMetaData",
"<",
"ZoomablePane",
"<",
"?",
">",
",",
"MouseButton",
">",
"getCssMetaData",
"(",
")",
"{",
"return",
"StyleableProperties",
".",
"PAN_BUTTON",
";",
"}",
"@",
"Override",
"public",
"Object",
"getBean",
"(",
")",
"{",
"return",
"ZoomablePane",
".",
"this",
";",
"}",
"@",
"Override",
"public",
"String",
"getName",
"(",
")",
"{",
"return",
"PAN_BUTTON_PROPERTY",
";",
"}",
"}",
";",
"}",
"return",
"this",
".",
"panButton",
";",
"}"
] | Replies the property for the button that serves for starting the mouse scrolling.
@return the property. | [
"Replies",
"the",
"property",
"for",
"the",
"button",
"that",
"serves",
"for",
"starting",
"the",
"mouse",
"scrolling",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/nodefx/src/main/java/org/arakhne/afc/nodefx/ZoomablePane.java#L690-L719 | train |
gallandarakhneorg/afc | advanced/nodefx/src/main/java/org/arakhne/afc/nodefx/ZoomablePane.java | ZoomablePane.panSensitivityProperty | public DoubleProperty panSensitivityProperty() {
if (this.panSensitivity == null) {
this.panSensitivity = new StyleableDoubleProperty(DEFAULT_PAN_SENSITIVITY) {
@Override
public void invalidated() {
if (get() <= MIN_PAN_SENSITIVITY) {
set(MIN_PAN_SENSITIVITY);
}
}
@Override
public CssMetaData<ZoomablePane<?>, Number> getCssMetaData() {
return StyleableProperties.PAN_SENSITIVITY;
}
@Override
public Object getBean() {
return ZoomablePane.this;
}
@Override
public String getName() {
return PAN_SENSITIVITY_PROPERTY;
}
};
}
return this.panSensitivity;
} | java | public DoubleProperty panSensitivityProperty() {
if (this.panSensitivity == null) {
this.panSensitivity = new StyleableDoubleProperty(DEFAULT_PAN_SENSITIVITY) {
@Override
public void invalidated() {
if (get() <= MIN_PAN_SENSITIVITY) {
set(MIN_PAN_SENSITIVITY);
}
}
@Override
public CssMetaData<ZoomablePane<?>, Number> getCssMetaData() {
return StyleableProperties.PAN_SENSITIVITY;
}
@Override
public Object getBean() {
return ZoomablePane.this;
}
@Override
public String getName() {
return PAN_SENSITIVITY_PROPERTY;
}
};
}
return this.panSensitivity;
} | [
"public",
"DoubleProperty",
"panSensitivityProperty",
"(",
")",
"{",
"if",
"(",
"this",
".",
"panSensitivity",
"==",
"null",
")",
"{",
"this",
".",
"panSensitivity",
"=",
"new",
"StyleableDoubleProperty",
"(",
"DEFAULT_PAN_SENSITIVITY",
")",
"{",
"@",
"Override",
"public",
"void",
"invalidated",
"(",
")",
"{",
"if",
"(",
"get",
"(",
")",
"<=",
"MIN_PAN_SENSITIVITY",
")",
"{",
"set",
"(",
"MIN_PAN_SENSITIVITY",
")",
";",
"}",
"}",
"@",
"Override",
"public",
"CssMetaData",
"<",
"ZoomablePane",
"<",
"?",
">",
",",
"Number",
">",
"getCssMetaData",
"(",
")",
"{",
"return",
"StyleableProperties",
".",
"PAN_SENSITIVITY",
";",
"}",
"@",
"Override",
"public",
"Object",
"getBean",
"(",
")",
"{",
"return",
"ZoomablePane",
".",
"this",
";",
"}",
"@",
"Override",
"public",
"String",
"getName",
"(",
")",
"{",
"return",
"PAN_SENSITIVITY_PROPERTY",
";",
"}",
"}",
";",
"}",
"return",
"this",
".",
"panSensitivity",
";",
"}"
] | Replies the property that indicates the sensibility of the panning moves.
The sensibility is a strictly positive number that is multiplied to the
distance covered by the mouse motion for obtaining the move to
apply to the document.
The default value is 1.
@return the property. | [
"Replies",
"the",
"property",
"that",
"indicates",
"the",
"sensibility",
"of",
"the",
"panning",
"moves",
".",
"The",
"sensibility",
"is",
"a",
"strictly",
"positive",
"number",
"that",
"is",
"multiplied",
"to",
"the",
"distance",
"covered",
"by",
"the",
"mouse",
"motion",
"for",
"obtaining",
"the",
"move",
"to",
"apply",
"to",
"the",
"document",
".",
"The",
"default",
"value",
"is",
"1",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/nodefx/src/main/java/org/arakhne/afc/nodefx/ZoomablePane.java#L745-L772 | train |
gallandarakhneorg/afc | advanced/nodefx/src/main/java/org/arakhne/afc/nodefx/ZoomablePane.java | ZoomablePane.getPanSensitivity | public double getPanSensitivity(boolean unitSensitivityModifier, boolean hugeSensivityModifier) {
if (unitSensitivityModifier) {
return DEFAULT_PAN_SENSITIVITY;
}
final double sens = getPanSensitivity();
if (hugeSensivityModifier) {
return sens * LARGE_MOVE_FACTOR;
}
return sens;
} | java | public double getPanSensitivity(boolean unitSensitivityModifier, boolean hugeSensivityModifier) {
if (unitSensitivityModifier) {
return DEFAULT_PAN_SENSITIVITY;
}
final double sens = getPanSensitivity();
if (hugeSensivityModifier) {
return sens * LARGE_MOVE_FACTOR;
}
return sens;
} | [
"public",
"double",
"getPanSensitivity",
"(",
"boolean",
"unitSensitivityModifier",
",",
"boolean",
"hugeSensivityModifier",
")",
"{",
"if",
"(",
"unitSensitivityModifier",
")",
"{",
"return",
"DEFAULT_PAN_SENSITIVITY",
";",
"}",
"final",
"double",
"sens",
"=",
"getPanSensitivity",
"(",
")",
";",
"if",
"(",
"hugeSensivityModifier",
")",
"{",
"return",
"sens",
"*",
"LARGE_MOVE_FACTOR",
";",
"}",
"return",
"sens",
";",
"}"
] | Replies the sensibility of the panning moves after applying dynamic user interaction modifiers.
The sensibility is a strictly positive number that is multiplied to the
distance covered by the mouse motion for obtaining the move to
apply to the document.
The default value is 1.
<p>This function is usually used for computing the sensibility within mouse handlers.
The Shift and Control key flags may be used as the modifiers.
<p>If {@code unitSensitivityModifier} is {@code true}, the sensibility is always {@code 1}.
If {@code hugeSensivityModifier} is {@code true}, the sensibility is multiplied by {@link #LARGE_MOVE_FACTOR}.
Otherwise, the value returned by {@link #getPanSensitivity()} is returned.
@param unitSensitivityModifier the user chooses the unit sensitivity dynamically. If {@code true}, this
parameter has precedence to the other parameters.
@param hugeSensivityModifier the user chooses a huge sensitivity dynamically.
@return the sensitivity. | [
"Replies",
"the",
"sensibility",
"of",
"the",
"panning",
"moves",
"after",
"applying",
"dynamic",
"user",
"interaction",
"modifiers",
".",
"The",
"sensibility",
"is",
"a",
"strictly",
"positive",
"number",
"that",
"is",
"multiplied",
"to",
"the",
"distance",
"covered",
"by",
"the",
"mouse",
"motion",
"for",
"obtaining",
"the",
"move",
"to",
"apply",
"to",
"the",
"document",
".",
"The",
"default",
"value",
"is",
"1",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/nodefx/src/main/java/org/arakhne/afc/nodefx/ZoomablePane.java#L816-L825 | train |
gallandarakhneorg/afc | core/maths/mathgeom/src/main/java/org/arakhne/afc/math/geometry/AbstractGeomFactoryBase.java | AbstractGeomFactoryBase.setGlobalSplineApproximationRatio | public static void setGlobalSplineApproximationRatio(Double distance) {
if (distance == null || Double.isNaN(distance.doubleValue())) {
globalSplineApproximation = GeomConstants.SPLINE_APPROXIMATION_RATIO;
} else {
globalSplineApproximation = Math.max(0, distance);
}
} | java | public static void setGlobalSplineApproximationRatio(Double distance) {
if (distance == null || Double.isNaN(distance.doubleValue())) {
globalSplineApproximation = GeomConstants.SPLINE_APPROXIMATION_RATIO;
} else {
globalSplineApproximation = Math.max(0, distance);
}
} | [
"public",
"static",
"void",
"setGlobalSplineApproximationRatio",
"(",
"Double",
"distance",
")",
"{",
"if",
"(",
"distance",
"==",
"null",
"||",
"Double",
".",
"isNaN",
"(",
"distance",
".",
"doubleValue",
"(",
")",
")",
")",
"{",
"globalSplineApproximation",
"=",
"GeomConstants",
".",
"SPLINE_APPROXIMATION_RATIO",
";",
"}",
"else",
"{",
"globalSplineApproximation",
"=",
"Math",
".",
"max",
"(",
"0",
",",
"distance",
")",
";",
"}",
"}"
] | Change the maximum distance that the line segments used to approximate the
curved segments are allowed to deviate from any point on the
original curve.
<p>The replied value is the one shared (and may be overridden) by the
geometry factories.
<p>The default value of the ratio is specified by
{@link GeomConstants#SPLINE_APPROXIMATION_RATIO}.
@param distance the maximal distance for approximating curves with segments.
If the argument value is {@code null} or NaN, the default value is assumed.
@since 14.0
@see GeomConstants#SPLINE_APPROXIMATION_RATIO | [
"Change",
"the",
"maximum",
"distance",
"that",
"the",
"line",
"segments",
"used",
"to",
"approximate",
"the",
"curved",
"segments",
"are",
"allowed",
"to",
"deviate",
"from",
"any",
"point",
"on",
"the",
"original",
"curve",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/maths/mathgeom/src/main/java/org/arakhne/afc/math/geometry/AbstractGeomFactoryBase.java#L73-L79 | train |
gallandarakhneorg/afc | advanced/shapefile/src/main/java/org/arakhne/afc/io/shape/ESRIBounds.java | ESRIBounds.createUnion | public ESRIBounds createUnion(ESRIBounds bounds) {
final ESRIBounds eb = new ESRIBounds();
eb.minx = (bounds.minx < this.minx) ? bounds.minx : this.minx;
eb.maxx = (bounds.maxx < this.maxx) ? this.maxx : bounds.maxx;
eb.miny = (bounds.miny < this.miny) ? bounds.miny : this.miny;
eb.maxy = (bounds.maxy < this.maxy) ? this.maxy : bounds.maxy;
eb.minz = (bounds.minz < this.minz) ? bounds.minz : this.minz;
eb.maxz = (bounds.maxz < this.maxz) ? this.maxz : bounds.maxz;
eb.minm = (bounds.minm < this.minm) ? bounds.minm : this.minm;
eb.maxm = (bounds.maxm < this.maxm) ? this.maxm : bounds.maxm;
return eb;
} | java | public ESRIBounds createUnion(ESRIBounds bounds) {
final ESRIBounds eb = new ESRIBounds();
eb.minx = (bounds.minx < this.minx) ? bounds.minx : this.minx;
eb.maxx = (bounds.maxx < this.maxx) ? this.maxx : bounds.maxx;
eb.miny = (bounds.miny < this.miny) ? bounds.miny : this.miny;
eb.maxy = (bounds.maxy < this.maxy) ? this.maxy : bounds.maxy;
eb.minz = (bounds.minz < this.minz) ? bounds.minz : this.minz;
eb.maxz = (bounds.maxz < this.maxz) ? this.maxz : bounds.maxz;
eb.minm = (bounds.minm < this.minm) ? bounds.minm : this.minm;
eb.maxm = (bounds.maxm < this.maxm) ? this.maxm : bounds.maxm;
return eb;
} | [
"public",
"ESRIBounds",
"createUnion",
"(",
"ESRIBounds",
"bounds",
")",
"{",
"final",
"ESRIBounds",
"eb",
"=",
"new",
"ESRIBounds",
"(",
")",
";",
"eb",
".",
"minx",
"=",
"(",
"bounds",
".",
"minx",
"<",
"this",
".",
"minx",
")",
"?",
"bounds",
".",
"minx",
":",
"this",
".",
"minx",
";",
"eb",
".",
"maxx",
"=",
"(",
"bounds",
".",
"maxx",
"<",
"this",
".",
"maxx",
")",
"?",
"this",
".",
"maxx",
":",
"bounds",
".",
"maxx",
";",
"eb",
".",
"miny",
"=",
"(",
"bounds",
".",
"miny",
"<",
"this",
".",
"miny",
")",
"?",
"bounds",
".",
"miny",
":",
"this",
".",
"miny",
";",
"eb",
".",
"maxy",
"=",
"(",
"bounds",
".",
"maxy",
"<",
"this",
".",
"maxy",
")",
"?",
"this",
".",
"maxy",
":",
"bounds",
".",
"maxy",
";",
"eb",
".",
"minz",
"=",
"(",
"bounds",
".",
"minz",
"<",
"this",
".",
"minz",
")",
"?",
"bounds",
".",
"minz",
":",
"this",
".",
"minz",
";",
"eb",
".",
"maxz",
"=",
"(",
"bounds",
".",
"maxz",
"<",
"this",
".",
"maxz",
")",
"?",
"this",
".",
"maxz",
":",
"bounds",
".",
"maxz",
";",
"eb",
".",
"minm",
"=",
"(",
"bounds",
".",
"minm",
"<",
"this",
".",
"minm",
")",
"?",
"bounds",
".",
"minm",
":",
"this",
".",
"minm",
";",
"eb",
".",
"maxm",
"=",
"(",
"bounds",
".",
"maxm",
"<",
"this",
".",
"maxm",
")",
"?",
"this",
".",
"maxm",
":",
"bounds",
".",
"maxm",
";",
"return",
"eb",
";",
"}"
] | Create and replies an union of this bounds and the given bounds.
@param bounds the bounds to make the union from.
@return the union of this bounds and the given one. | [
"Create",
"and",
"replies",
"an",
"union",
"of",
"this",
"bounds",
"and",
"the",
"given",
"bounds",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/shapefile/src/main/java/org/arakhne/afc/io/shape/ESRIBounds.java#L158-L169 | train |
gallandarakhneorg/afc | advanced/shapefile/src/main/java/org/arakhne/afc/io/shape/ESRIBounds.java | ESRIBounds.add | public void add(ESRIPoint point) {
if (point.getX() < this.minx) {
this.minx = point.getX();
}
if (point.getX() > this.maxx) {
this.maxx = point.getX();
}
if (point.getY() < this.miny) {
this.miny = point.getY();
}
if (point.getY() > this.maxy) {
this.maxy = point.getY();
}
if (point.getZ() < this.minz) {
this.minz = point.getZ();
}
if (point.getZ() > this.maxz) {
this.maxz = point.getZ();
}
if (point.getM() < this.minm) {
this.minm = point.getM();
}
if (point.getM() > this.maxm) {
this.maxm = point.getM();
}
} | java | public void add(ESRIPoint point) {
if (point.getX() < this.minx) {
this.minx = point.getX();
}
if (point.getX() > this.maxx) {
this.maxx = point.getX();
}
if (point.getY() < this.miny) {
this.miny = point.getY();
}
if (point.getY() > this.maxy) {
this.maxy = point.getY();
}
if (point.getZ() < this.minz) {
this.minz = point.getZ();
}
if (point.getZ() > this.maxz) {
this.maxz = point.getZ();
}
if (point.getM() < this.minm) {
this.minm = point.getM();
}
if (point.getM() > this.maxm) {
this.maxm = point.getM();
}
} | [
"public",
"void",
"add",
"(",
"ESRIPoint",
"point",
")",
"{",
"if",
"(",
"point",
".",
"getX",
"(",
")",
"<",
"this",
".",
"minx",
")",
"{",
"this",
".",
"minx",
"=",
"point",
".",
"getX",
"(",
")",
";",
"}",
"if",
"(",
"point",
".",
"getX",
"(",
")",
">",
"this",
".",
"maxx",
")",
"{",
"this",
".",
"maxx",
"=",
"point",
".",
"getX",
"(",
")",
";",
"}",
"if",
"(",
"point",
".",
"getY",
"(",
")",
"<",
"this",
".",
"miny",
")",
"{",
"this",
".",
"miny",
"=",
"point",
".",
"getY",
"(",
")",
";",
"}",
"if",
"(",
"point",
".",
"getY",
"(",
")",
">",
"this",
".",
"maxy",
")",
"{",
"this",
".",
"maxy",
"=",
"point",
".",
"getY",
"(",
")",
";",
"}",
"if",
"(",
"point",
".",
"getZ",
"(",
")",
"<",
"this",
".",
"minz",
")",
"{",
"this",
".",
"minz",
"=",
"point",
".",
"getZ",
"(",
")",
";",
"}",
"if",
"(",
"point",
".",
"getZ",
"(",
")",
">",
"this",
".",
"maxz",
")",
"{",
"this",
".",
"maxz",
"=",
"point",
".",
"getZ",
"(",
")",
";",
"}",
"if",
"(",
"point",
".",
"getM",
"(",
")",
"<",
"this",
".",
"minm",
")",
"{",
"this",
".",
"minm",
"=",
"point",
".",
"getM",
"(",
")",
";",
"}",
"if",
"(",
"point",
".",
"getM",
"(",
")",
">",
"this",
".",
"maxm",
")",
"{",
"this",
".",
"maxm",
"=",
"point",
".",
"getM",
"(",
")",
";",
"}",
"}"
] | Add a point to this bounds.
@param point the point to add. | [
"Add",
"a",
"point",
"to",
"this",
"bounds",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/shapefile/src/main/java/org/arakhne/afc/io/shape/ESRIBounds.java#L175-L200 | train |
gallandarakhneorg/afc | advanced/shapefile/src/main/java/org/arakhne/afc/io/shape/ESRIBounds.java | ESRIBounds.toRectangle2d | @Pure
public Rectangle2d toRectangle2d() {
final Rectangle2d bounds = new Rectangle2d();
bounds.setFromCorners(this.minx, this.miny, this.maxx, this.maxy);
return bounds;
} | java | @Pure
public Rectangle2d toRectangle2d() {
final Rectangle2d bounds = new Rectangle2d();
bounds.setFromCorners(this.minx, this.miny, this.maxx, this.maxy);
return bounds;
} | [
"@",
"Pure",
"public",
"Rectangle2d",
"toRectangle2d",
"(",
")",
"{",
"final",
"Rectangle2d",
"bounds",
"=",
"new",
"Rectangle2d",
"(",
")",
";",
"bounds",
".",
"setFromCorners",
"(",
"this",
".",
"minx",
",",
"this",
".",
"miny",
",",
"this",
".",
"maxx",
",",
"this",
".",
"maxy",
")",
";",
"return",
"bounds",
";",
"}"
] | Replies the 2D bounds.
@return the 2D bounds | [
"Replies",
"the",
"2D",
"bounds",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/shapefile/src/main/java/org/arakhne/afc/io/shape/ESRIBounds.java#L376-L381 | train |
gallandarakhneorg/afc | advanced/shapefile/src/main/java/org/arakhne/afc/io/shape/ESRIBounds.java | ESRIBounds.ensureMinMax | public void ensureMinMax() {
double t;
if (this.maxx < this.minx) {
t = this.minx;
this.minx = this.maxx;
this.maxx = t;
}
if (this.maxy < this.miny) {
t = this.miny;
this.miny = this.maxy;
this.maxy = t;
}
if (this.maxz < this.minz) {
t = this.minz;
this.minz = this.maxz;
this.maxz = t;
}
if (this.maxm < this.minm) {
t = this.minm;
this.minm = this.maxm;
this.maxm = t;
}
} | java | public void ensureMinMax() {
double t;
if (this.maxx < this.minx) {
t = this.minx;
this.minx = this.maxx;
this.maxx = t;
}
if (this.maxy < this.miny) {
t = this.miny;
this.miny = this.maxy;
this.maxy = t;
}
if (this.maxz < this.minz) {
t = this.minz;
this.minz = this.maxz;
this.maxz = t;
}
if (this.maxm < this.minm) {
t = this.minm;
this.minm = this.maxm;
this.maxm = t;
}
} | [
"public",
"void",
"ensureMinMax",
"(",
")",
"{",
"double",
"t",
";",
"if",
"(",
"this",
".",
"maxx",
"<",
"this",
".",
"minx",
")",
"{",
"t",
"=",
"this",
".",
"minx",
";",
"this",
".",
"minx",
"=",
"this",
".",
"maxx",
";",
"this",
".",
"maxx",
"=",
"t",
";",
"}",
"if",
"(",
"this",
".",
"maxy",
"<",
"this",
".",
"miny",
")",
"{",
"t",
"=",
"this",
".",
"miny",
";",
"this",
".",
"miny",
"=",
"this",
".",
"maxy",
";",
"this",
".",
"maxy",
"=",
"t",
";",
"}",
"if",
"(",
"this",
".",
"maxz",
"<",
"this",
".",
"minz",
")",
"{",
"t",
"=",
"this",
".",
"minz",
";",
"this",
".",
"minz",
"=",
"this",
".",
"maxz",
";",
"this",
".",
"maxz",
"=",
"t",
";",
"}",
"if",
"(",
"this",
".",
"maxm",
"<",
"this",
".",
"minm",
")",
"{",
"t",
"=",
"this",
".",
"minm",
";",
"this",
".",
"minm",
"=",
"this",
".",
"maxm",
";",
"this",
".",
"maxm",
"=",
"t",
";",
"}",
"}"
] | Ensure that min and max values are correctly ordered. | [
"Ensure",
"that",
"min",
"and",
"max",
"values",
"are",
"correctly",
"ordered",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/shapefile/src/main/java/org/arakhne/afc/io/shape/ESRIBounds.java#L397-L419 | train |
gallandarakhneorg/afc | advanced/shapefile/src/main/java/org/arakhne/afc/io/shape/AbstractCommonShapeFileReader.java | AbstractCommonShapeFileReader.getBoundsFromHeader | public ESRIBounds getBoundsFromHeader() {
try {
readHeader();
} catch (IOException exception) {
return null;
}
return new ESRIBounds(
this.minx, this.maxx,
this.miny, this.maxy,
this.minz, this.maxz,
this.minm, this.maxm);
} | java | public ESRIBounds getBoundsFromHeader() {
try {
readHeader();
} catch (IOException exception) {
return null;
}
return new ESRIBounds(
this.minx, this.maxx,
this.miny, this.maxy,
this.minz, this.maxz,
this.minm, this.maxm);
} | [
"public",
"ESRIBounds",
"getBoundsFromHeader",
"(",
")",
"{",
"try",
"{",
"readHeader",
"(",
")",
";",
"}",
"catch",
"(",
"IOException",
"exception",
")",
"{",
"return",
"null",
";",
"}",
"return",
"new",
"ESRIBounds",
"(",
"this",
".",
"minx",
",",
"this",
".",
"maxx",
",",
"this",
".",
"miny",
",",
"this",
".",
"maxy",
",",
"this",
".",
"minz",
",",
"this",
".",
"maxz",
",",
"this",
".",
"minm",
",",
"this",
".",
"maxm",
")",
";",
"}"
] | Replies the bounds read from the shape file header.
@return the bounds or <code>null</code> | [
"Replies",
"the",
"bounds",
"read",
"from",
"the",
"shape",
"file",
"header",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/shapefile/src/main/java/org/arakhne/afc/io/shape/AbstractCommonShapeFileReader.java#L246-L257 | train |
gallandarakhneorg/afc | advanced/shapefile/src/main/java/org/arakhne/afc/io/shape/AbstractCommonShapeFileReader.java | AbstractCommonShapeFileReader.read | public E read() throws IOException {
boolean status = false;
try {
// Read header if not already read
readHeader();
// Read the records
E element;
try {
do {
element = readRecord(this.nextExpectedRecordIndex);
if (!postRecordReadingStage(element)) {
element = null;
}
++this.nextExpectedRecordIndex;
}
while (element == null);
} catch (EOFException e) {
element = null;
close();
postReadingStage(true);
}
status = true;
return element;
} finally {
if (this.taskProgression != null) {
this.taskProgression.setValue(this.buffer.position() + HEADER_BYTES);
}
if (!status) {
close();
postReadingStage(status);
}
}
} | java | public E read() throws IOException {
boolean status = false;
try {
// Read header if not already read
readHeader();
// Read the records
E element;
try {
do {
element = readRecord(this.nextExpectedRecordIndex);
if (!postRecordReadingStage(element)) {
element = null;
}
++this.nextExpectedRecordIndex;
}
while (element == null);
} catch (EOFException e) {
element = null;
close();
postReadingStage(true);
}
status = true;
return element;
} finally {
if (this.taskProgression != null) {
this.taskProgression.setValue(this.buffer.position() + HEADER_BYTES);
}
if (!status) {
close();
postReadingStage(status);
}
}
} | [
"public",
"E",
"read",
"(",
")",
"throws",
"IOException",
"{",
"boolean",
"status",
"=",
"false",
";",
"try",
"{",
"// Read header if not already read",
"readHeader",
"(",
")",
";",
"// Read the records",
"E",
"element",
";",
"try",
"{",
"do",
"{",
"element",
"=",
"readRecord",
"(",
"this",
".",
"nextExpectedRecordIndex",
")",
";",
"if",
"(",
"!",
"postRecordReadingStage",
"(",
"element",
")",
")",
"{",
"element",
"=",
"null",
";",
"}",
"++",
"this",
".",
"nextExpectedRecordIndex",
";",
"}",
"while",
"(",
"element",
"==",
"null",
")",
";",
"}",
"catch",
"(",
"EOFException",
"e",
")",
"{",
"element",
"=",
"null",
";",
"close",
"(",
")",
";",
"postReadingStage",
"(",
"true",
")",
";",
"}",
"status",
"=",
"true",
";",
"return",
"element",
";",
"}",
"finally",
"{",
"if",
"(",
"this",
".",
"taskProgression",
"!=",
"null",
")",
"{",
"this",
".",
"taskProgression",
".",
"setValue",
"(",
"this",
".",
"buffer",
".",
"position",
"(",
")",
"+",
"HEADER_BYTES",
")",
";",
"}",
"if",
"(",
"!",
"status",
")",
"{",
"close",
"(",
")",
";",
"postReadingStage",
"(",
"status",
")",
";",
"}",
"}",
"}"
] | Read the elements for a shape file.
@return the list of the elements read from the Shape file or <code>null</code> on end-of-file.
@throws IOException in case of error. | [
"Read",
"the",
"elements",
"for",
"a",
"shape",
"file",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/shapefile/src/main/java/org/arakhne/afc/io/shape/AbstractCommonShapeFileReader.java#L420-L455 | train |
gallandarakhneorg/afc | advanced/shapefile/src/main/java/org/arakhne/afc/io/shape/AbstractCommonShapeFileReader.java | AbstractCommonShapeFileReader.setReadingPosition | protected void setReadingPosition(int recordIndex, int byteIndex) throws IOException {
if (this.seekEnabled) {
this.nextExpectedRecordIndex = recordIndex;
this.buffer.position(byteIndex);
} else {
throw new SeekOperationDisabledException();
}
} | java | protected void setReadingPosition(int recordIndex, int byteIndex) throws IOException {
if (this.seekEnabled) {
this.nextExpectedRecordIndex = recordIndex;
this.buffer.position(byteIndex);
} else {
throw new SeekOperationDisabledException();
}
} | [
"protected",
"void",
"setReadingPosition",
"(",
"int",
"recordIndex",
",",
"int",
"byteIndex",
")",
"throws",
"IOException",
"{",
"if",
"(",
"this",
".",
"seekEnabled",
")",
"{",
"this",
".",
"nextExpectedRecordIndex",
"=",
"recordIndex",
";",
"this",
".",
"buffer",
".",
"position",
"(",
"byteIndex",
")",
";",
"}",
"else",
"{",
"throw",
"new",
"SeekOperationDisabledException",
"(",
")",
";",
"}",
"}"
] | Set the reading position, excluding the header.
@param recordIndex is the index of the next record to read.
@param byteIndex is the index of the next byte to read (excluding the header).
@throws IOException in case of error. | [
"Set",
"the",
"reading",
"position",
"excluding",
"the",
"header",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/shapefile/src/main/java/org/arakhne/afc/io/shape/AbstractCommonShapeFileReader.java#L614-L621 | train |
gallandarakhneorg/afc | advanced/shapefile/src/main/java/org/arakhne/afc/io/shape/AbstractCommonShapeFileReader.java | AbstractCommonShapeFileReader.ensureAvailableBytes | protected void ensureAvailableBytes(int amount) throws IOException {
if (!this.seekEnabled && amount > this.buffer.remaining()) {
this.bufferPosition += this.buffer.position();
this.buffer.compact();
int limit = this.buffer.position();
final int read = this.stream.read(this.buffer);
if (read < 0) {
if (limit == 0) {
throw new EOFException();
}
} else {
limit += read;
}
this.buffer.rewind();
this.buffer.limit(limit);
}
if (amount > this.buffer.remaining()) {
throw new EOFException();
}
} | java | protected void ensureAvailableBytes(int amount) throws IOException {
if (!this.seekEnabled && amount > this.buffer.remaining()) {
this.bufferPosition += this.buffer.position();
this.buffer.compact();
int limit = this.buffer.position();
final int read = this.stream.read(this.buffer);
if (read < 0) {
if (limit == 0) {
throw new EOFException();
}
} else {
limit += read;
}
this.buffer.rewind();
this.buffer.limit(limit);
}
if (amount > this.buffer.remaining()) {
throw new EOFException();
}
} | [
"protected",
"void",
"ensureAvailableBytes",
"(",
"int",
"amount",
")",
"throws",
"IOException",
"{",
"if",
"(",
"!",
"this",
".",
"seekEnabled",
"&&",
"amount",
">",
"this",
".",
"buffer",
".",
"remaining",
"(",
")",
")",
"{",
"this",
".",
"bufferPosition",
"+=",
"this",
".",
"buffer",
".",
"position",
"(",
")",
";",
"this",
".",
"buffer",
".",
"compact",
"(",
")",
";",
"int",
"limit",
"=",
"this",
".",
"buffer",
".",
"position",
"(",
")",
";",
"final",
"int",
"read",
"=",
"this",
".",
"stream",
".",
"read",
"(",
"this",
".",
"buffer",
")",
";",
"if",
"(",
"read",
"<",
"0",
")",
"{",
"if",
"(",
"limit",
"==",
"0",
")",
"{",
"throw",
"new",
"EOFException",
"(",
")",
";",
"}",
"}",
"else",
"{",
"limit",
"+=",
"read",
";",
"}",
"this",
".",
"buffer",
".",
"rewind",
"(",
")",
";",
"this",
".",
"buffer",
".",
"limit",
"(",
"limit",
")",
";",
"}",
"if",
"(",
"amount",
">",
"this",
".",
"buffer",
".",
"remaining",
"(",
")",
")",
"{",
"throw",
"new",
"EOFException",
"(",
")",
";",
"}",
"}"
] | Ensure that the reading buffer is containing enoug bytes to read.
@param amount is the count of expected bytes
@throws IOException in case of error. | [
"Ensure",
"that",
"the",
"reading",
"buffer",
"is",
"containing",
"enoug",
"bytes",
"to",
"read",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/shapefile/src/main/java/org/arakhne/afc/io/shape/AbstractCommonShapeFileReader.java#L628-L648 | train |
gallandarakhneorg/afc | advanced/shapefile/src/main/java/org/arakhne/afc/io/shape/AbstractCommonShapeFileReader.java | AbstractCommonShapeFileReader.skipBytes | protected void skipBytes(int amount) throws IOException {
ensureAvailableBytes(amount);
this.buffer.position(this.buffer.position() + amount);
} | java | protected void skipBytes(int amount) throws IOException {
ensureAvailableBytes(amount);
this.buffer.position(this.buffer.position() + amount);
} | [
"protected",
"void",
"skipBytes",
"(",
"int",
"amount",
")",
"throws",
"IOException",
"{",
"ensureAvailableBytes",
"(",
"amount",
")",
";",
"this",
".",
"buffer",
".",
"position",
"(",
"this",
".",
"buffer",
".",
"position",
"(",
")",
"+",
"amount",
")",
";",
"}"
] | Skip an amount of bytes.
@param amount the amount to skip.
@throws IOException in case of error. | [
"Skip",
"an",
"amount",
"of",
"bytes",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/shapefile/src/main/java/org/arakhne/afc/io/shape/AbstractCommonShapeFileReader.java#L655-L658 | train |
gallandarakhneorg/afc | advanced/agentmotion/src/main/java/org/arakhne/afc/agentmotion/common/AbstractTargetPositionPredictionAlgorithm.java | AbstractTargetPositionPredictionAlgorithm.predictTargetPosition | @Pure
public Point2D<?, ?> predictTargetPosition(Point2D<?, ?> targetPosition, Vector2D<?, ?> targetLinearMotion) {
return new Point2d(
targetPosition.getX() + targetLinearMotion.getX() * this.predictionDuration,
targetPosition.getY() + targetLinearMotion.getY() * this.predictionDuration);
} | java | @Pure
public Point2D<?, ?> predictTargetPosition(Point2D<?, ?> targetPosition, Vector2D<?, ?> targetLinearMotion) {
return new Point2d(
targetPosition.getX() + targetLinearMotion.getX() * this.predictionDuration,
targetPosition.getY() + targetLinearMotion.getY() * this.predictionDuration);
} | [
"@",
"Pure",
"public",
"Point2D",
"<",
"?",
",",
"?",
">",
"predictTargetPosition",
"(",
"Point2D",
"<",
"?",
",",
"?",
">",
"targetPosition",
",",
"Vector2D",
"<",
"?",
",",
"?",
">",
"targetLinearMotion",
")",
"{",
"return",
"new",
"Point2d",
"(",
"targetPosition",
".",
"getX",
"(",
")",
"+",
"targetLinearMotion",
".",
"getX",
"(",
")",
"*",
"this",
".",
"predictionDuration",
",",
"targetPosition",
".",
"getY",
"(",
")",
"+",
"targetLinearMotion",
".",
"getY",
"(",
")",
"*",
"this",
".",
"predictionDuration",
")",
";",
"}"
] | Predict the next position of the target.
@param targetPosition is the position of the target.
@param targetLinearMotion is the linear motion of the target.
@return the predicted position. | [
"Predict",
"the",
"next",
"position",
"of",
"the",
"target",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/agentmotion/src/main/java/org/arakhne/afc/agentmotion/common/AbstractTargetPositionPredictionAlgorithm.java#L92-L97 | train |
killme2008/hs4j | src/main/java/com/google/code/hs4j/network/hs/HandlerSocketHandler.java | HandlerSocketHandler.reconnect | protected void reconnect(Session session) {
if (this.hsClient.isStarted()) {
if (log.isDebugEnabled()) {
log.debug("Add reconnectRequest to connector "
+ session.getRemoteSocketAddress());
}
HandlerSocketSession hSession = (HandlerSocketSession) session;
InetSocketAddress addr = hSession.getRemoteSocketAddress();
this.hsClient.getConnector().addToWatingQueue(
new ReconnectRequest(addr, 0, this.hsClient
.getHealConnectionInterval()));
}
} | java | protected void reconnect(Session session) {
if (this.hsClient.isStarted()) {
if (log.isDebugEnabled()) {
log.debug("Add reconnectRequest to connector "
+ session.getRemoteSocketAddress());
}
HandlerSocketSession hSession = (HandlerSocketSession) session;
InetSocketAddress addr = hSession.getRemoteSocketAddress();
this.hsClient.getConnector().addToWatingQueue(
new ReconnectRequest(addr, 0, this.hsClient
.getHealConnectionInterval()));
}
} | [
"protected",
"void",
"reconnect",
"(",
"Session",
"session",
")",
"{",
"if",
"(",
"this",
".",
"hsClient",
".",
"isStarted",
"(",
")",
")",
"{",
"if",
"(",
"log",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"log",
".",
"debug",
"(",
"\"Add reconnectRequest to connector \"",
"+",
"session",
".",
"getRemoteSocketAddress",
"(",
")",
")",
";",
"}",
"HandlerSocketSession",
"hSession",
"=",
"(",
"HandlerSocketSession",
")",
"session",
";",
"InetSocketAddress",
"addr",
"=",
"hSession",
".",
"getRemoteSocketAddress",
"(",
")",
";",
"this",
".",
"hsClient",
".",
"getConnector",
"(",
")",
".",
"addToWatingQueue",
"(",
"new",
"ReconnectRequest",
"(",
"addr",
",",
"0",
",",
"this",
".",
"hsClient",
".",
"getHealConnectionInterval",
"(",
")",
")",
")",
";",
"}",
"}"
] | Auto reconect request to hs4j server
@param session | [
"Auto",
"reconect",
"request",
"to",
"hs4j",
"server"
] | 805fe14bfe270d95009514c224d93c5fe3575f11 | https://github.com/killme2008/hs4j/blob/805fe14bfe270d95009514c224d93c5fe3575f11/src/main/java/com/google/code/hs4j/network/hs/HandlerSocketHandler.java#L83-L95 | train |
gallandarakhneorg/afc | core/maths/mathgraph/src/main/java/org/arakhne/afc/math/graph/astar/AStar.java | AStar.setSegmentReplacer | public AStarSegmentReplacer<ST> setSegmentReplacer(AStarSegmentReplacer<ST> replacer) {
final AStarSegmentReplacer<ST> old = this.segmentReplacer;
this.segmentReplacer = replacer;
return old;
} | java | public AStarSegmentReplacer<ST> setSegmentReplacer(AStarSegmentReplacer<ST> replacer) {
final AStarSegmentReplacer<ST> old = this.segmentReplacer;
this.segmentReplacer = replacer;
return old;
} | [
"public",
"AStarSegmentReplacer",
"<",
"ST",
">",
"setSegmentReplacer",
"(",
"AStarSegmentReplacer",
"<",
"ST",
">",
"replacer",
")",
"{",
"final",
"AStarSegmentReplacer",
"<",
"ST",
">",
"old",
"=",
"this",
".",
"segmentReplacer",
";",
"this",
".",
"segmentReplacer",
"=",
"replacer",
";",
"return",
"old",
";",
"}"
] | Set the object to use to replace the segments in the shortest path.
@param replacer is the new replacer.
@return the old replacer | [
"Set",
"the",
"object",
"to",
"use",
"to",
"replace",
"the",
"segments",
"in",
"the",
"shortest",
"path",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/maths/mathgraph/src/main/java/org/arakhne/afc/math/graph/astar/AStar.java#L237-L241 | train |
gallandarakhneorg/afc | core/maths/mathgraph/src/main/java/org/arakhne/afc/math/graph/astar/AStar.java | AStar.setSegmentOrientationTool | public AStarSegmentOrientation<ST, PT> setSegmentOrientationTool(AStarSegmentOrientation<ST, PT> tool) {
final AStarSegmentOrientation<ST, PT> old = this.segmentOrientation;
this.segmentOrientation = tool;
return old;
} | java | public AStarSegmentOrientation<ST, PT> setSegmentOrientationTool(AStarSegmentOrientation<ST, PT> tool) {
final AStarSegmentOrientation<ST, PT> old = this.segmentOrientation;
this.segmentOrientation = tool;
return old;
} | [
"public",
"AStarSegmentOrientation",
"<",
"ST",
",",
"PT",
">",
"setSegmentOrientationTool",
"(",
"AStarSegmentOrientation",
"<",
"ST",
",",
"PT",
">",
"tool",
")",
"{",
"final",
"AStarSegmentOrientation",
"<",
"ST",
",",
"PT",
">",
"old",
"=",
"this",
".",
"segmentOrientation",
";",
"this",
".",
"segmentOrientation",
"=",
"tool",
";",
"return",
"old",
";",
"}"
] | Set the tool that permits to retreive the orinetation of the segments.
@param tool the tool for retreiving the orientation of the segments.
@return the old tool. | [
"Set",
"the",
"tool",
"that",
"permits",
"to",
"retreive",
"the",
"orinetation",
"of",
"the",
"segments",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/maths/mathgraph/src/main/java/org/arakhne/afc/math/graph/astar/AStar.java#L257-L261 | train |
gallandarakhneorg/afc | core/maths/mathgraph/src/main/java/org/arakhne/afc/math/graph/astar/AStar.java | AStar.setCostComputer | public AStarCostComputer<? super ST, ? super PT> setCostComputer(AStarCostComputer<? super ST, ? super PT> costComputer) {
final AStarCostComputer<? super ST, ? super PT> old = this.costComputer;
this.costComputer = costComputer;
return old;
} | java | public AStarCostComputer<? super ST, ? super PT> setCostComputer(AStarCostComputer<? super ST, ? super PT> costComputer) {
final AStarCostComputer<? super ST, ? super PT> old = this.costComputer;
this.costComputer = costComputer;
return old;
} | [
"public",
"AStarCostComputer",
"<",
"?",
"super",
"ST",
",",
"?",
"super",
"PT",
">",
"setCostComputer",
"(",
"AStarCostComputer",
"<",
"?",
"super",
"ST",
",",
"?",
"super",
"PT",
">",
"costComputer",
")",
"{",
"final",
"AStarCostComputer",
"<",
"?",
"super",
"ST",
",",
"?",
"super",
"PT",
">",
"old",
"=",
"this",
".",
"costComputer",
";",
"this",
".",
"costComputer",
"=",
"costComputer",
";",
"return",
"old",
";",
"}"
] | Set the tool that permits to compute the costs of the nodes and the edges.
@param costComputer is the object that permits to compute the costs.
@return the old cost computer. | [
"Set",
"the",
"tool",
"that",
"permits",
"to",
"compute",
"the",
"costs",
"of",
"the",
"nodes",
"and",
"the",
"edges",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/maths/mathgraph/src/main/java/org/arakhne/afc/math/graph/astar/AStar.java#L277-L281 | train |
gallandarakhneorg/afc | core/maths/mathgraph/src/main/java/org/arakhne/afc/math/graph/astar/AStar.java | AStar.estimate | @Pure
protected double estimate(PT p1, PT p2) {
assert p1 != null && p2 != null;
if (this.heuristic == null) {
throw new IllegalStateException(Locale.getString("E1")); //$NON-NLS-1$
}
return this.heuristic.evaluate(p1, p2);
} | java | @Pure
protected double estimate(PT p1, PT p2) {
assert p1 != null && p2 != null;
if (this.heuristic == null) {
throw new IllegalStateException(Locale.getString("E1")); //$NON-NLS-1$
}
return this.heuristic.evaluate(p1, p2);
} | [
"@",
"Pure",
"protected",
"double",
"estimate",
"(",
"PT",
"p1",
",",
"PT",
"p2",
")",
"{",
"assert",
"p1",
"!=",
"null",
"&&",
"p2",
"!=",
"null",
";",
"if",
"(",
"this",
".",
"heuristic",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"Locale",
".",
"getString",
"(",
"\"E1\"",
")",
")",
";",
"//$NON-NLS-1$",
"}",
"return",
"this",
".",
"heuristic",
".",
"evaluate",
"(",
"p1",
",",
"p2",
")",
";",
"}"
] | Evaluate the distance between two points in the graph.
<p>By default, this function uses the heuristic passed as parameter
of the constructor.
@param p1 the first point.
@param p2 the second point.
@return the evaluated distance between {@code p1} and {@code p2}. | [
"Evaluate",
"the",
"distance",
"between",
"two",
"points",
"in",
"the",
"graph",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/maths/mathgraph/src/main/java/org/arakhne/afc/math/graph/astar/AStar.java#L301-L308 | train |
gallandarakhneorg/afc | core/maths/mathgraph/src/main/java/org/arakhne/afc/math/graph/astar/AStar.java | AStar.computeCostFor | @Pure
protected double computeCostFor(ST segment) {
if (this.costComputer != null) {
return this.costComputer.computeCostFor(segment);
}
return segment.getLength();
} | java | @Pure
protected double computeCostFor(ST segment) {
if (this.costComputer != null) {
return this.costComputer.computeCostFor(segment);
}
return segment.getLength();
} | [
"@",
"Pure",
"protected",
"double",
"computeCostFor",
"(",
"ST",
"segment",
")",
"{",
"if",
"(",
"this",
".",
"costComputer",
"!=",
"null",
")",
"{",
"return",
"this",
".",
"costComputer",
".",
"computeCostFor",
"(",
"segment",
")",
";",
"}",
"return",
"segment",
".",
"getLength",
"(",
")",
";",
"}"
] | Compute and replies the cost to traverse the given graph segment.
@param segment the segment.
@return the cost to traverse the segment. | [
"Compute",
"and",
"replies",
"the",
"cost",
"to",
"traverse",
"the",
"given",
"graph",
"segment",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/maths/mathgraph/src/main/java/org/arakhne/afc/math/graph/astar/AStar.java#L328-L334 | train |
gallandarakhneorg/afc | core/maths/mathgraph/src/main/java/org/arakhne/afc/math/graph/astar/AStar.java | AStar.newPath | @SuppressWarnings({ "unchecked", "rawtypes" })
@Pure
protected GP newPath(PT startPoint, ST segment) {
if (this.pathFactory != null) {
return this.pathFactory.newPath(startPoint, segment);
}
try {
return (GP) new GraphPath(segment, startPoint);
} catch (Throwable e) {
throw new IllegalStateException(Locale.getString("E2"), e); //$NON-NLS-1$
}
} | java | @SuppressWarnings({ "unchecked", "rawtypes" })
@Pure
protected GP newPath(PT startPoint, ST segment) {
if (this.pathFactory != null) {
return this.pathFactory.newPath(startPoint, segment);
}
try {
return (GP) new GraphPath(segment, startPoint);
} catch (Throwable e) {
throw new IllegalStateException(Locale.getString("E2"), e); //$NON-NLS-1$
}
} | [
"@",
"SuppressWarnings",
"(",
"{",
"\"unchecked\"",
",",
"\"rawtypes\"",
"}",
")",
"@",
"Pure",
"protected",
"GP",
"newPath",
"(",
"PT",
"startPoint",
",",
"ST",
"segment",
")",
"{",
"if",
"(",
"this",
".",
"pathFactory",
"!=",
"null",
")",
"{",
"return",
"this",
".",
"pathFactory",
".",
"newPath",
"(",
"startPoint",
",",
"segment",
")",
";",
"}",
"try",
"{",
"return",
"(",
"GP",
")",
"new",
"GraphPath",
"(",
"segment",
",",
"startPoint",
")",
";",
"}",
"catch",
"(",
"Throwable",
"e",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"Locale",
".",
"getString",
"(",
"\"E2\"",
")",
",",
"e",
")",
";",
"//$NON-NLS-1$",
"}",
"}"
] | Create an empty path.
<p>By default this function invokes the path factory
passed as parameter of the constructor.
@param startPoint is the first point in the path.
@param segment is the first connection to follow.
@return the path instance. | [
"Create",
"an",
"empty",
"path",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/maths/mathgraph/src/main/java/org/arakhne/afc/math/graph/astar/AStar.java#L368-L379 | train |
gallandarakhneorg/afc | core/maths/mathgraph/src/main/java/org/arakhne/afc/math/graph/astar/AStar.java | AStar.addToPath | protected boolean addToPath(GP path, ST segment) {
if (this.pathFactory != null) {
return this.pathFactory.addToPath(path, segment);
}
assert path != null;
assert segment != null;
try {
return path.add(segment);
} catch (Throwable e) {
throw new IllegalStateException(e);
}
} | java | protected boolean addToPath(GP path, ST segment) {
if (this.pathFactory != null) {
return this.pathFactory.addToPath(path, segment);
}
assert path != null;
assert segment != null;
try {
return path.add(segment);
} catch (Throwable e) {
throw new IllegalStateException(e);
}
} | [
"protected",
"boolean",
"addToPath",
"(",
"GP",
"path",
",",
"ST",
"segment",
")",
"{",
"if",
"(",
"this",
".",
"pathFactory",
"!=",
"null",
")",
"{",
"return",
"this",
".",
"pathFactory",
".",
"addToPath",
"(",
"path",
",",
"segment",
")",
";",
"}",
"assert",
"path",
"!=",
"null",
";",
"assert",
"segment",
"!=",
"null",
";",
"try",
"{",
"return",
"path",
".",
"add",
"(",
"segment",
")",
";",
"}",
"catch",
"(",
"Throwable",
"e",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"e",
")",
";",
"}",
"}"
] | Add the given segment into the given path.
<p>By default this function invokes the path factory
passed as parameter of the constructor.
@param path is the path to build.
@param segment is the segment to add.
@return <code>true</code> if the segment was added;
otherwise <code>false</code>. | [
"Add",
"the",
"given",
"segment",
"into",
"the",
"given",
"path",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/maths/mathgraph/src/main/java/org/arakhne/afc/math/graph/astar/AStar.java#L391-L402 | train |
gallandarakhneorg/afc | core/maths/mathgraph/src/main/java/org/arakhne/afc/math/graph/astar/AStar.java | AStar.replaceSegment | @Pure
protected ST replaceSegment(int index, ST segment) {
ST rep = null;
if (this.segmentReplacer != null) {
rep = this.segmentReplacer.replaceSegment(index, segment);
}
if (rep == null) {
rep = segment;
}
return rep;
} | java | @Pure
protected ST replaceSegment(int index, ST segment) {
ST rep = null;
if (this.segmentReplacer != null) {
rep = this.segmentReplacer.replaceSegment(index, segment);
}
if (rep == null) {
rep = segment;
}
return rep;
} | [
"@",
"Pure",
"protected",
"ST",
"replaceSegment",
"(",
"int",
"index",
",",
"ST",
"segment",
")",
"{",
"ST",
"rep",
"=",
"null",
";",
"if",
"(",
"this",
".",
"segmentReplacer",
"!=",
"null",
")",
"{",
"rep",
"=",
"this",
".",
"segmentReplacer",
".",
"replaceSegment",
"(",
"index",
",",
"segment",
")",
";",
"}",
"if",
"(",
"rep",
"==",
"null",
")",
"{",
"rep",
"=",
"segment",
";",
"}",
"return",
"rep",
";",
"}"
] | Invoked to replace a segment before adding it to the shortest path.
<p>* By default, this function invoked the {@link AStarSegmentReplacer}
associated to this AStar algorithm.
@param index is the position of the segment in the path.
@param segment is the segment to replace.
@return the replacement segment or the {@code segment} itself. | [
"Invoked",
"to",
"replace",
"a",
"segment",
"before",
"adding",
"it",
"to",
"the",
"shortest",
"path",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/maths/mathgraph/src/main/java/org/arakhne/afc/math/graph/astar/AStar.java#L676-L686 | train |
gallandarakhneorg/afc | core/maths/mathgeom/src/main/java/org/arakhne/afc/math/geometry/d2/d/Vector2d.java | Vector2d.convert | public static Vector2d convert(Tuple2D<?> tuple) {
if (tuple instanceof Vector2d) {
return (Vector2d) tuple;
}
return new Vector2d(tuple.getX(), tuple.getY());
} | java | public static Vector2d convert(Tuple2D<?> tuple) {
if (tuple instanceof Vector2d) {
return (Vector2d) tuple;
}
return new Vector2d(tuple.getX(), tuple.getY());
} | [
"public",
"static",
"Vector2d",
"convert",
"(",
"Tuple2D",
"<",
"?",
">",
"tuple",
")",
"{",
"if",
"(",
"tuple",
"instanceof",
"Vector2d",
")",
"{",
"return",
"(",
"Vector2d",
")",
"tuple",
";",
"}",
"return",
"new",
"Vector2d",
"(",
"tuple",
".",
"getX",
"(",
")",
",",
"tuple",
".",
"getY",
"(",
")",
")",
";",
"}"
] | Convert the given tuple to a real Vector2d.
<p>If the given tuple is already a Vector2d, it is replied.
@param tuple the tuple.
@return the Vector2d.
@since 14.0 | [
"Convert",
"the",
"given",
"tuple",
"to",
"a",
"real",
"Vector2d",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/maths/mathgeom/src/main/java/org/arakhne/afc/math/geometry/d2/d/Vector2d.java#L113-L118 | train |
gallandarakhneorg/afc | advanced/gis/gisbus/src/main/java/org/arakhne/afc/gis/bus/network/BusNetwork.java | BusNetwork.addBusLine | public boolean addBusLine(BusLine busLine) {
if (busLine == null) {
return false;
}
if (this.busLines.indexOf(busLine) != -1) {
return false;
}
if (!this.busLines.add(busLine)) {
return false;
}
final boolean isValidLine = busLine.isValidPrimitive();
busLine.setEventFirable(isEventFirable());
busLine.setContainer(this);
if (isEventFirable()) {
fireShapeChanged(new BusChangeEvent(this,
BusChangeEventType.LINE_ADDED,
busLine,
this.busLines.size() - 1,
"shape", //$NON-NLS-1$
null,
null));
if (!isValidLine) {
revalidate();
} else {
checkPrimitiveValidity();
}
}
return true;
} | java | public boolean addBusLine(BusLine busLine) {
if (busLine == null) {
return false;
}
if (this.busLines.indexOf(busLine) != -1) {
return false;
}
if (!this.busLines.add(busLine)) {
return false;
}
final boolean isValidLine = busLine.isValidPrimitive();
busLine.setEventFirable(isEventFirable());
busLine.setContainer(this);
if (isEventFirable()) {
fireShapeChanged(new BusChangeEvent(this,
BusChangeEventType.LINE_ADDED,
busLine,
this.busLines.size() - 1,
"shape", //$NON-NLS-1$
null,
null));
if (!isValidLine) {
revalidate();
} else {
checkPrimitiveValidity();
}
}
return true;
} | [
"public",
"boolean",
"addBusLine",
"(",
"BusLine",
"busLine",
")",
"{",
"if",
"(",
"busLine",
"==",
"null",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"this",
".",
"busLines",
".",
"indexOf",
"(",
"busLine",
")",
"!=",
"-",
"1",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"!",
"this",
".",
"busLines",
".",
"add",
"(",
"busLine",
")",
")",
"{",
"return",
"false",
";",
"}",
"final",
"boolean",
"isValidLine",
"=",
"busLine",
".",
"isValidPrimitive",
"(",
")",
";",
"busLine",
".",
"setEventFirable",
"(",
"isEventFirable",
"(",
")",
")",
";",
"busLine",
".",
"setContainer",
"(",
"this",
")",
";",
"if",
"(",
"isEventFirable",
"(",
")",
")",
"{",
"fireShapeChanged",
"(",
"new",
"BusChangeEvent",
"(",
"this",
",",
"BusChangeEventType",
".",
"LINE_ADDED",
",",
"busLine",
",",
"this",
".",
"busLines",
".",
"size",
"(",
")",
"-",
"1",
",",
"\"shape\"",
",",
"//$NON-NLS-1$",
"null",
",",
"null",
")",
")",
";",
"if",
"(",
"!",
"isValidLine",
")",
"{",
"revalidate",
"(",
")",
";",
"}",
"else",
"{",
"checkPrimitiveValidity",
"(",
")",
";",
"}",
"}",
"return",
"true",
";",
"}"
] | Add a bus line inside the bus network.
@param busLine is the bus line to insert.
@return <code>true</code> if the bus line was added, otherwise <code>false</code> | [
"Add",
"a",
"bus",
"line",
"inside",
"the",
"bus",
"network",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/gisbus/src/main/java/org/arakhne/afc/gis/bus/network/BusNetwork.java#L451-L479 | train |
gallandarakhneorg/afc | advanced/gis/gisbus/src/main/java/org/arakhne/afc/gis/bus/network/BusNetwork.java | BusNetwork.removeAllBusLines | public void removeAllBusLines() {
for (final BusLine busline : this.busLines) {
busline.setContainer(null);
busline.setEventFirable(true);
}
this.busLines.clear();
fireShapeChanged(new BusChangeEvent(this,
BusChangeEventType.ALL_LINES_REMOVED,
null,
-1,
"shape", //$NON-NLS-1$
null,
null));
checkPrimitiveValidity();
} | java | public void removeAllBusLines() {
for (final BusLine busline : this.busLines) {
busline.setContainer(null);
busline.setEventFirable(true);
}
this.busLines.clear();
fireShapeChanged(new BusChangeEvent(this,
BusChangeEventType.ALL_LINES_REMOVED,
null,
-1,
"shape", //$NON-NLS-1$
null,
null));
checkPrimitiveValidity();
} | [
"public",
"void",
"removeAllBusLines",
"(",
")",
"{",
"for",
"(",
"final",
"BusLine",
"busline",
":",
"this",
".",
"busLines",
")",
"{",
"busline",
".",
"setContainer",
"(",
"null",
")",
";",
"busline",
".",
"setEventFirable",
"(",
"true",
")",
";",
"}",
"this",
".",
"busLines",
".",
"clear",
"(",
")",
";",
"fireShapeChanged",
"(",
"new",
"BusChangeEvent",
"(",
"this",
",",
"BusChangeEventType",
".",
"ALL_LINES_REMOVED",
",",
"null",
",",
"-",
"1",
",",
"\"shape\"",
",",
"//$NON-NLS-1$",
"null",
",",
"null",
")",
")",
";",
"checkPrimitiveValidity",
"(",
")",
";",
"}"
] | Remove all the bus lines from the current network. | [
"Remove",
"all",
"the",
"bus",
"lines",
"from",
"the",
"current",
"network",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/gisbus/src/main/java/org/arakhne/afc/gis/bus/network/BusNetwork.java#L526-L540 | train |
gallandarakhneorg/afc | advanced/gis/gisbus/src/main/java/org/arakhne/afc/gis/bus/network/BusNetwork.java | BusNetwork.removeBusLine | public boolean removeBusLine(BusLine busLine) {
final int index = this.busLines.indexOf(busLine);
if (index >= 0) {
return removeBusLine(index);
}
return false;
} | java | public boolean removeBusLine(BusLine busLine) {
final int index = this.busLines.indexOf(busLine);
if (index >= 0) {
return removeBusLine(index);
}
return false;
} | [
"public",
"boolean",
"removeBusLine",
"(",
"BusLine",
"busLine",
")",
"{",
"final",
"int",
"index",
"=",
"this",
".",
"busLines",
".",
"indexOf",
"(",
"busLine",
")",
";",
"if",
"(",
"index",
">=",
"0",
")",
"{",
"return",
"removeBusLine",
"(",
"index",
")",
";",
"}",
"return",
"false",
";",
"}"
] | Remove a bus line from this network.
All the itineraries and the associated stops will be removed also.
If this bus line removal implies empty hubs, these hubs
will be also removed.
@param busLine is the bus line to remove.
@return <code>true</code> if the bus line was successfully removed, otherwise <code>false</code> | [
"Remove",
"a",
"bus",
"line",
"from",
"this",
"network",
".",
"All",
"the",
"itineraries",
"and",
"the",
"associated",
"stops",
"will",
"be",
"removed",
"also",
".",
"If",
"this",
"bus",
"line",
"removal",
"implies",
"empty",
"hubs",
"these",
"hubs",
"will",
"be",
"also",
"removed",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/gisbus/src/main/java/org/arakhne/afc/gis/bus/network/BusNetwork.java#L551-L557 | train |
gallandarakhneorg/afc | advanced/gis/gisbus/src/main/java/org/arakhne/afc/gis/bus/network/BusNetwork.java | BusNetwork.removeBusLine | public boolean removeBusLine(String name) {
final Iterator<BusLine> iterator = this.busLines.iterator();
BusLine busLine;
int i = 0;
while (iterator.hasNext()) {
busLine = iterator.next();
if (name.equals(busLine.getName())) {
iterator.remove();
busLine.setContainer(null);
busLine.setEventFirable(true);
fireShapeChanged(new BusChangeEvent(this,
BusChangeEventType.LINE_REMOVED,
busLine,
i,
"shape", //$NON-NLS-1$
null,
null));
checkPrimitiveValidity();
return true;
}
++i;
}
return false;
} | java | public boolean removeBusLine(String name) {
final Iterator<BusLine> iterator = this.busLines.iterator();
BusLine busLine;
int i = 0;
while (iterator.hasNext()) {
busLine = iterator.next();
if (name.equals(busLine.getName())) {
iterator.remove();
busLine.setContainer(null);
busLine.setEventFirable(true);
fireShapeChanged(new BusChangeEvent(this,
BusChangeEventType.LINE_REMOVED,
busLine,
i,
"shape", //$NON-NLS-1$
null,
null));
checkPrimitiveValidity();
return true;
}
++i;
}
return false;
} | [
"public",
"boolean",
"removeBusLine",
"(",
"String",
"name",
")",
"{",
"final",
"Iterator",
"<",
"BusLine",
">",
"iterator",
"=",
"this",
".",
"busLines",
".",
"iterator",
"(",
")",
";",
"BusLine",
"busLine",
";",
"int",
"i",
"=",
"0",
";",
"while",
"(",
"iterator",
".",
"hasNext",
"(",
")",
")",
"{",
"busLine",
"=",
"iterator",
".",
"next",
"(",
")",
";",
"if",
"(",
"name",
".",
"equals",
"(",
"busLine",
".",
"getName",
"(",
")",
")",
")",
"{",
"iterator",
".",
"remove",
"(",
")",
";",
"busLine",
".",
"setContainer",
"(",
"null",
")",
";",
"busLine",
".",
"setEventFirable",
"(",
"true",
")",
";",
"fireShapeChanged",
"(",
"new",
"BusChangeEvent",
"(",
"this",
",",
"BusChangeEventType",
".",
"LINE_REMOVED",
",",
"busLine",
",",
"i",
",",
"\"shape\"",
",",
"//$NON-NLS-1$",
"null",
",",
"null",
")",
")",
";",
"checkPrimitiveValidity",
"(",
")",
";",
"return",
"true",
";",
"}",
"++",
"i",
";",
"}",
"return",
"false",
";",
"}"
] | Remove the bus line with the given name.
All the itineraries and the associated stops will be removed also.
If this bus line removal implies empty hubs, these hubs
will be also removed.
@param name is the name of the bus line to remove.
@return <code>true</code> if the bus line was successfully removed, otherwise <code>false</code> | [
"Remove",
"the",
"bus",
"line",
"with",
"the",
"given",
"name",
".",
"All",
"the",
"itineraries",
"and",
"the",
"associated",
"stops",
"will",
"be",
"removed",
"also",
".",
"If",
"this",
"bus",
"line",
"removal",
"implies",
"empty",
"hubs",
"these",
"hubs",
"will",
"be",
"also",
"removed",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/gisbus/src/main/java/org/arakhne/afc/gis/bus/network/BusNetwork.java#L568-L591 | train |
gallandarakhneorg/afc | advanced/gis/gisbus/src/main/java/org/arakhne/afc/gis/bus/network/BusNetwork.java | BusNetwork.removeBusLine | public boolean removeBusLine(int index) {
try {
final BusLine busLine = this.busLines.remove(index);
busLine.setContainer(null);
busLine.setEventFirable(true);
fireShapeChanged(new BusChangeEvent(this,
BusChangeEventType.LINE_REMOVED,
busLine,
index,
"shape", //$NON-NLS-1$
null,
null));
checkPrimitiveValidity();
return true;
} catch (Throwable exception) {
//
}
return false;
} | java | public boolean removeBusLine(int index) {
try {
final BusLine busLine = this.busLines.remove(index);
busLine.setContainer(null);
busLine.setEventFirable(true);
fireShapeChanged(new BusChangeEvent(this,
BusChangeEventType.LINE_REMOVED,
busLine,
index,
"shape", //$NON-NLS-1$
null,
null));
checkPrimitiveValidity();
return true;
} catch (Throwable exception) {
//
}
return false;
} | [
"public",
"boolean",
"removeBusLine",
"(",
"int",
"index",
")",
"{",
"try",
"{",
"final",
"BusLine",
"busLine",
"=",
"this",
".",
"busLines",
".",
"remove",
"(",
"index",
")",
";",
"busLine",
".",
"setContainer",
"(",
"null",
")",
";",
"busLine",
".",
"setEventFirable",
"(",
"true",
")",
";",
"fireShapeChanged",
"(",
"new",
"BusChangeEvent",
"(",
"this",
",",
"BusChangeEventType",
".",
"LINE_REMOVED",
",",
"busLine",
",",
"index",
",",
"\"shape\"",
",",
"//$NON-NLS-1$",
"null",
",",
"null",
")",
")",
";",
"checkPrimitiveValidity",
"(",
")",
";",
"return",
"true",
";",
"}",
"catch",
"(",
"Throwable",
"exception",
")",
"{",
"//",
"}",
"return",
"false",
";",
"}"
] | Remove the bus line at the specified index.
All the itineraries and the associated stops will be removed also.
If this bus line removal implies empty hubs, these hubs
will be also removed.
@param index is the index of the bus line to remove.
@return <code>true</code> if the bus line was successfully removed, otherwise <code>false</code> | [
"Remove",
"the",
"bus",
"line",
"at",
"the",
"specified",
"index",
".",
"All",
"the",
"itineraries",
"and",
"the",
"associated",
"stops",
"will",
"be",
"removed",
"also",
".",
"If",
"this",
"bus",
"line",
"removal",
"implies",
"empty",
"hubs",
"these",
"hubs",
"will",
"be",
"also",
"removed",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/gisbus/src/main/java/org/arakhne/afc/gis/bus/network/BusNetwork.java#L602-L620 | train |
gallandarakhneorg/afc | advanced/gis/gisbus/src/main/java/org/arakhne/afc/gis/bus/network/BusNetwork.java | BusNetwork.getBusLine | @Pure
public BusLine getBusLine(UUID uuid) {
if (uuid == null) {
return null;
}
for (final BusLine busLine : this.busLines) {
if (uuid.equals(busLine.getUUID())) {
return busLine;
}
}
return null;
} | java | @Pure
public BusLine getBusLine(UUID uuid) {
if (uuid == null) {
return null;
}
for (final BusLine busLine : this.busLines) {
if (uuid.equals(busLine.getUUID())) {
return busLine;
}
}
return null;
} | [
"@",
"Pure",
"public",
"BusLine",
"getBusLine",
"(",
"UUID",
"uuid",
")",
"{",
"if",
"(",
"uuid",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"for",
"(",
"final",
"BusLine",
"busLine",
":",
"this",
".",
"busLines",
")",
"{",
"if",
"(",
"uuid",
".",
"equals",
"(",
"busLine",
".",
"getUUID",
"(",
")",
")",
")",
"{",
"return",
"busLine",
";",
"}",
"}",
"return",
"null",
";",
"}"
] | Replies the bus line with the specified uuid.
@param uuid the identifier.
@return BusLine or <code>null</code> | [
"Replies",
"the",
"bus",
"line",
"with",
"the",
"specified",
"uuid",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/gisbus/src/main/java/org/arakhne/afc/gis/bus/network/BusNetwork.java#L678-L689 | train |
gallandarakhneorg/afc | advanced/gis/gisbus/src/main/java/org/arakhne/afc/gis/bus/network/BusNetwork.java | BusNetwork.getBusLine | @Pure
public BusLine getBusLine(String name, Comparator<String> nameComparator) {
if (name == null) {
return null;
}
final Comparator<String> cmp = nameComparator == null ? BusNetworkUtilities.NAME_COMPARATOR : nameComparator;
for (final BusLine busLine : this.busLines) {
if (cmp.compare(name, busLine.getName()) == 0) {
return busLine;
}
}
return null;
} | java | @Pure
public BusLine getBusLine(String name, Comparator<String> nameComparator) {
if (name == null) {
return null;
}
final Comparator<String> cmp = nameComparator == null ? BusNetworkUtilities.NAME_COMPARATOR : nameComparator;
for (final BusLine busLine : this.busLines) {
if (cmp.compare(name, busLine.getName()) == 0) {
return busLine;
}
}
return null;
} | [
"@",
"Pure",
"public",
"BusLine",
"getBusLine",
"(",
"String",
"name",
",",
"Comparator",
"<",
"String",
">",
"nameComparator",
")",
"{",
"if",
"(",
"name",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"final",
"Comparator",
"<",
"String",
">",
"cmp",
"=",
"nameComparator",
"==",
"null",
"?",
"BusNetworkUtilities",
".",
"NAME_COMPARATOR",
":",
"nameComparator",
";",
"for",
"(",
"final",
"BusLine",
"busLine",
":",
"this",
".",
"busLines",
")",
"{",
"if",
"(",
"cmp",
".",
"compare",
"(",
"name",
",",
"busLine",
".",
"getName",
"(",
")",
")",
"==",
"0",
")",
"{",
"return",
"busLine",
";",
"}",
"}",
"return",
"null",
";",
"}"
] | Replies the bus line with the specified name.
@param name is the desired name
@param nameComparator is used to compare the names.
@return BusLine or <code>null</code> | [
"Replies",
"the",
"bus",
"line",
"with",
"the",
"specified",
"name",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/gisbus/src/main/java/org/arakhne/afc/gis/bus/network/BusNetwork.java#L698-L710 | train |
gallandarakhneorg/afc | advanced/gis/gisbus/src/main/java/org/arakhne/afc/gis/bus/network/BusNetwork.java | BusNetwork.addBusStop | public boolean addBusStop(BusStop busStop) {
if (busStop == null) {
return false;
}
if (this.validBusStops.contains(busStop)) {
return false;
}
if (ListUtil.contains(this.invalidBusStops, INVALID_STOP_COMPARATOR, busStop)) {
return false;
}
final boolean isValidPrimitive = busStop.isValidPrimitive();
if (isValidPrimitive) {
if (!this.validBusStops.add(busStop)) {
return false;
}
} else if (ListUtil.addIfAbsent(this.invalidBusStops, INVALID_STOP_COMPARATOR, busStop) < 0) {
return false;
}
busStop.setEventFirable(isEventFirable());
busStop.setContainer(this);
if (isEventFirable()) {
fireShapeChanged(new BusChangeEvent(this,
BusChangeEventType.STOP_ADDED,
busStop,
-1,
"shape", //$NON-NLS-1$
null,
null));
busStop.checkPrimitiveValidity();
checkPrimitiveValidity();
}
return true;
} | java | public boolean addBusStop(BusStop busStop) {
if (busStop == null) {
return false;
}
if (this.validBusStops.contains(busStop)) {
return false;
}
if (ListUtil.contains(this.invalidBusStops, INVALID_STOP_COMPARATOR, busStop)) {
return false;
}
final boolean isValidPrimitive = busStop.isValidPrimitive();
if (isValidPrimitive) {
if (!this.validBusStops.add(busStop)) {
return false;
}
} else if (ListUtil.addIfAbsent(this.invalidBusStops, INVALID_STOP_COMPARATOR, busStop) < 0) {
return false;
}
busStop.setEventFirable(isEventFirable());
busStop.setContainer(this);
if (isEventFirable()) {
fireShapeChanged(new BusChangeEvent(this,
BusChangeEventType.STOP_ADDED,
busStop,
-1,
"shape", //$NON-NLS-1$
null,
null));
busStop.checkPrimitiveValidity();
checkPrimitiveValidity();
}
return true;
} | [
"public",
"boolean",
"addBusStop",
"(",
"BusStop",
"busStop",
")",
"{",
"if",
"(",
"busStop",
"==",
"null",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"this",
".",
"validBusStops",
".",
"contains",
"(",
"busStop",
")",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"ListUtil",
".",
"contains",
"(",
"this",
".",
"invalidBusStops",
",",
"INVALID_STOP_COMPARATOR",
",",
"busStop",
")",
")",
"{",
"return",
"false",
";",
"}",
"final",
"boolean",
"isValidPrimitive",
"=",
"busStop",
".",
"isValidPrimitive",
"(",
")",
";",
"if",
"(",
"isValidPrimitive",
")",
"{",
"if",
"(",
"!",
"this",
".",
"validBusStops",
".",
"add",
"(",
"busStop",
")",
")",
"{",
"return",
"false",
";",
"}",
"}",
"else",
"if",
"(",
"ListUtil",
".",
"addIfAbsent",
"(",
"this",
".",
"invalidBusStops",
",",
"INVALID_STOP_COMPARATOR",
",",
"busStop",
")",
"<",
"0",
")",
"{",
"return",
"false",
";",
"}",
"busStop",
".",
"setEventFirable",
"(",
"isEventFirable",
"(",
")",
")",
";",
"busStop",
".",
"setContainer",
"(",
"this",
")",
";",
"if",
"(",
"isEventFirable",
"(",
")",
")",
"{",
"fireShapeChanged",
"(",
"new",
"BusChangeEvent",
"(",
"this",
",",
"BusChangeEventType",
".",
"STOP_ADDED",
",",
"busStop",
",",
"-",
"1",
",",
"\"shape\"",
",",
"//$NON-NLS-1$",
"null",
",",
"null",
")",
")",
";",
"busStop",
".",
"checkPrimitiveValidity",
"(",
")",
";",
"checkPrimitiveValidity",
"(",
")",
";",
"}",
"return",
"true",
";",
"}"
] | Add a bus stop inside the bus network.
@param busStop is the bus stop to insert.
@return <code>true</code> if the bus stop was added, otherwise <code>false</code> | [
"Add",
"a",
"bus",
"stop",
"inside",
"the",
"bus",
"network",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/gisbus/src/main/java/org/arakhne/afc/gis/bus/network/BusNetwork.java#L740-L775 | train |
gallandarakhneorg/afc | advanced/gis/gisbus/src/main/java/org/arakhne/afc/gis/bus/network/BusNetwork.java | BusNetwork.removeAllBusStops | public void removeAllBusStops() {
for (final BusStop busStop : this.validBusStops) {
busStop.setContainer(null);
busStop.setEventFirable(true);
}
for (final BusStop busStop : this.invalidBusStops) {
busStop.setContainer(null);
busStop.setEventFirable(true);
}
this.validBusStops.clear();
this.invalidBusStops.clear();
fireShapeChanged(new BusChangeEvent(this,
BusChangeEventType.ALL_STOPS_REMOVED,
null,
-1,
"shape", //$NON-NLS-1$
null,
null));
revalidate();
} | java | public void removeAllBusStops() {
for (final BusStop busStop : this.validBusStops) {
busStop.setContainer(null);
busStop.setEventFirable(true);
}
for (final BusStop busStop : this.invalidBusStops) {
busStop.setContainer(null);
busStop.setEventFirable(true);
}
this.validBusStops.clear();
this.invalidBusStops.clear();
fireShapeChanged(new BusChangeEvent(this,
BusChangeEventType.ALL_STOPS_REMOVED,
null,
-1,
"shape", //$NON-NLS-1$
null,
null));
revalidate();
} | [
"public",
"void",
"removeAllBusStops",
"(",
")",
"{",
"for",
"(",
"final",
"BusStop",
"busStop",
":",
"this",
".",
"validBusStops",
")",
"{",
"busStop",
".",
"setContainer",
"(",
"null",
")",
";",
"busStop",
".",
"setEventFirable",
"(",
"true",
")",
";",
"}",
"for",
"(",
"final",
"BusStop",
"busStop",
":",
"this",
".",
"invalidBusStops",
")",
"{",
"busStop",
".",
"setContainer",
"(",
"null",
")",
";",
"busStop",
".",
"setEventFirable",
"(",
"true",
")",
";",
"}",
"this",
".",
"validBusStops",
".",
"clear",
"(",
")",
";",
"this",
".",
"invalidBusStops",
".",
"clear",
"(",
")",
";",
"fireShapeChanged",
"(",
"new",
"BusChangeEvent",
"(",
"this",
",",
"BusChangeEventType",
".",
"ALL_STOPS_REMOVED",
",",
"null",
",",
"-",
"1",
",",
"\"shape\"",
",",
"//$NON-NLS-1$",
"null",
",",
"null",
")",
")",
";",
"revalidate",
"(",
")",
";",
"}"
] | Remove all the bus stops from the current network. | [
"Remove",
"all",
"the",
"bus",
"stops",
"from",
"the",
"current",
"network",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/gisbus/src/main/java/org/arakhne/afc/gis/bus/network/BusNetwork.java#L780-L799 | train |
gallandarakhneorg/afc | advanced/gis/gisbus/src/main/java/org/arakhne/afc/gis/bus/network/BusNetwork.java | BusNetwork.removeBusStop | public boolean removeBusStop(BusStop busStop) {
if (this.validBusStops.remove(busStop)) {
busStop.setContainer(null);
busStop.setEventFirable(true);
fireShapeChanged(new BusChangeEvent(this,
BusChangeEventType.STOP_REMOVED,
busStop,
-1,
"shape", //$NON-NLS-1$
null,
null));
checkPrimitiveValidity();
return true;
}
final int idx = ListUtil.remove(this.invalidBusStops, INVALID_STOP_COMPARATOR, busStop);
if (idx >= 0) {
busStop.setContainer(null);
fireShapeChanged(new BusChangeEvent(this,
BusChangeEventType.STOP_REMOVED,
busStop,
-1,
"shape", //$NON-NLS-1$
null,
null));
checkPrimitiveValidity();
return true;
}
return false;
} | java | public boolean removeBusStop(BusStop busStop) {
if (this.validBusStops.remove(busStop)) {
busStop.setContainer(null);
busStop.setEventFirable(true);
fireShapeChanged(new BusChangeEvent(this,
BusChangeEventType.STOP_REMOVED,
busStop,
-1,
"shape", //$NON-NLS-1$
null,
null));
checkPrimitiveValidity();
return true;
}
final int idx = ListUtil.remove(this.invalidBusStops, INVALID_STOP_COMPARATOR, busStop);
if (idx >= 0) {
busStop.setContainer(null);
fireShapeChanged(new BusChangeEvent(this,
BusChangeEventType.STOP_REMOVED,
busStop,
-1,
"shape", //$NON-NLS-1$
null,
null));
checkPrimitiveValidity();
return true;
}
return false;
} | [
"public",
"boolean",
"removeBusStop",
"(",
"BusStop",
"busStop",
")",
"{",
"if",
"(",
"this",
".",
"validBusStops",
".",
"remove",
"(",
"busStop",
")",
")",
"{",
"busStop",
".",
"setContainer",
"(",
"null",
")",
";",
"busStop",
".",
"setEventFirable",
"(",
"true",
")",
";",
"fireShapeChanged",
"(",
"new",
"BusChangeEvent",
"(",
"this",
",",
"BusChangeEventType",
".",
"STOP_REMOVED",
",",
"busStop",
",",
"-",
"1",
",",
"\"shape\"",
",",
"//$NON-NLS-1$",
"null",
",",
"null",
")",
")",
";",
"checkPrimitiveValidity",
"(",
")",
";",
"return",
"true",
";",
"}",
"final",
"int",
"idx",
"=",
"ListUtil",
".",
"remove",
"(",
"this",
".",
"invalidBusStops",
",",
"INVALID_STOP_COMPARATOR",
",",
"busStop",
")",
";",
"if",
"(",
"idx",
">=",
"0",
")",
"{",
"busStop",
".",
"setContainer",
"(",
"null",
")",
";",
"fireShapeChanged",
"(",
"new",
"BusChangeEvent",
"(",
"this",
",",
"BusChangeEventType",
".",
"STOP_REMOVED",
",",
"busStop",
",",
"-",
"1",
",",
"\"shape\"",
",",
"//$NON-NLS-1$",
"null",
",",
"null",
")",
")",
";",
"checkPrimitiveValidity",
"(",
")",
";",
"return",
"true",
";",
"}",
"return",
"false",
";",
"}"
] | Remove a bus stop from this network.
If this bus stop removal implies empty hubs, these hubs
will be also removed.
@param busStop is the bus stop to remove.
@return <code>true</code> if the bus stop was successfully removed, otherwise <code>false</code> | [
"Remove",
"a",
"bus",
"stop",
"from",
"this",
"network",
".",
"If",
"this",
"bus",
"stop",
"removal",
"implies",
"empty",
"hubs",
"these",
"hubs",
"will",
"be",
"also",
"removed",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/gisbus/src/main/java/org/arakhne/afc/gis/bus/network/BusNetwork.java#L809-L837 | train |
gallandarakhneorg/afc | advanced/gis/gisbus/src/main/java/org/arakhne/afc/gis/bus/network/BusNetwork.java | BusNetwork.removeBusStop | public boolean removeBusStop(String name) {
Iterator<BusStop> iterator;
BusStop busStop;
iterator = this.validBusStops.iterator();
while (iterator.hasNext()) {
busStop = iterator.next();
if (name.equals(busStop.getName())) {
iterator.remove();
busStop.setContainer(null);
busStop.setEventFirable(true);
fireShapeChanged(new BusChangeEvent(this,
BusChangeEventType.STOP_REMOVED,
busStop,
-1,
"shape", //$NON-NLS-1$
null,
null));
checkPrimitiveValidity();
return true;
}
}
iterator = this.invalidBusStops.iterator();
while (iterator.hasNext()) {
busStop = iterator.next();
if (name.equals(busStop.getName())) {
iterator.remove();
busStop.setContainer(null);
fireShapeChanged(new BusChangeEvent(this,
BusChangeEventType.STOP_REMOVED,
busStop,
-1,
"shape", //$NON-NLS-1$
null,
null));
checkPrimitiveValidity();
return true;
}
}
return false;
} | java | public boolean removeBusStop(String name) {
Iterator<BusStop> iterator;
BusStop busStop;
iterator = this.validBusStops.iterator();
while (iterator.hasNext()) {
busStop = iterator.next();
if (name.equals(busStop.getName())) {
iterator.remove();
busStop.setContainer(null);
busStop.setEventFirable(true);
fireShapeChanged(new BusChangeEvent(this,
BusChangeEventType.STOP_REMOVED,
busStop,
-1,
"shape", //$NON-NLS-1$
null,
null));
checkPrimitiveValidity();
return true;
}
}
iterator = this.invalidBusStops.iterator();
while (iterator.hasNext()) {
busStop = iterator.next();
if (name.equals(busStop.getName())) {
iterator.remove();
busStop.setContainer(null);
fireShapeChanged(new BusChangeEvent(this,
BusChangeEventType.STOP_REMOVED,
busStop,
-1,
"shape", //$NON-NLS-1$
null,
null));
checkPrimitiveValidity();
return true;
}
}
return false;
} | [
"public",
"boolean",
"removeBusStop",
"(",
"String",
"name",
")",
"{",
"Iterator",
"<",
"BusStop",
">",
"iterator",
";",
"BusStop",
"busStop",
";",
"iterator",
"=",
"this",
".",
"validBusStops",
".",
"iterator",
"(",
")",
";",
"while",
"(",
"iterator",
".",
"hasNext",
"(",
")",
")",
"{",
"busStop",
"=",
"iterator",
".",
"next",
"(",
")",
";",
"if",
"(",
"name",
".",
"equals",
"(",
"busStop",
".",
"getName",
"(",
")",
")",
")",
"{",
"iterator",
".",
"remove",
"(",
")",
";",
"busStop",
".",
"setContainer",
"(",
"null",
")",
";",
"busStop",
".",
"setEventFirable",
"(",
"true",
")",
";",
"fireShapeChanged",
"(",
"new",
"BusChangeEvent",
"(",
"this",
",",
"BusChangeEventType",
".",
"STOP_REMOVED",
",",
"busStop",
",",
"-",
"1",
",",
"\"shape\"",
",",
"//$NON-NLS-1$",
"null",
",",
"null",
")",
")",
";",
"checkPrimitiveValidity",
"(",
")",
";",
"return",
"true",
";",
"}",
"}",
"iterator",
"=",
"this",
".",
"invalidBusStops",
".",
"iterator",
"(",
")",
";",
"while",
"(",
"iterator",
".",
"hasNext",
"(",
")",
")",
"{",
"busStop",
"=",
"iterator",
".",
"next",
"(",
")",
";",
"if",
"(",
"name",
".",
"equals",
"(",
"busStop",
".",
"getName",
"(",
")",
")",
")",
"{",
"iterator",
".",
"remove",
"(",
")",
";",
"busStop",
".",
"setContainer",
"(",
"null",
")",
";",
"fireShapeChanged",
"(",
"new",
"BusChangeEvent",
"(",
"this",
",",
"BusChangeEventType",
".",
"STOP_REMOVED",
",",
"busStop",
",",
"-",
"1",
",",
"\"shape\"",
",",
"//$NON-NLS-1$",
"null",
",",
"null",
")",
")",
";",
"checkPrimitiveValidity",
"(",
")",
";",
"return",
"true",
";",
"}",
"}",
"return",
"false",
";",
"}"
] | Remove the bus stops with the given name.
If this bus stop removal implies empty hubs, these hubs
will be also removed.
@param name is the name of the bus stop to remove.
@return <code>true</code> if the bus stop was successfully removed, otherwise <code>false</code> | [
"Remove",
"the",
"bus",
"stops",
"with",
"the",
"given",
"name",
".",
"If",
"this",
"bus",
"stop",
"removal",
"implies",
"empty",
"hubs",
"these",
"hubs",
"will",
"be",
"also",
"removed",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/gisbus/src/main/java/org/arakhne/afc/gis/bus/network/BusNetwork.java#L847-L889 | train |
gallandarakhneorg/afc | advanced/gis/gisbus/src/main/java/org/arakhne/afc/gis/bus/network/BusNetwork.java | BusNetwork.getBusStop | @Pure
public BusStop getBusStop(UUID id) {
if (id == null) {
return null;
}
for (final BusStop busStop : this.validBusStops) {
final UUID busid = busStop.getUUID();
if (id.equals(busid)) {
return busStop;
}
}
for (final BusStop busStop : this.invalidBusStops) {
final UUID busid = busStop.getUUID();
if (id.equals(busid)) {
return busStop;
}
}
return null;
} | java | @Pure
public BusStop getBusStop(UUID id) {
if (id == null) {
return null;
}
for (final BusStop busStop : this.validBusStops) {
final UUID busid = busStop.getUUID();
if (id.equals(busid)) {
return busStop;
}
}
for (final BusStop busStop : this.invalidBusStops) {
final UUID busid = busStop.getUUID();
if (id.equals(busid)) {
return busStop;
}
}
return null;
} | [
"@",
"Pure",
"public",
"BusStop",
"getBusStop",
"(",
"UUID",
"id",
")",
"{",
"if",
"(",
"id",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"for",
"(",
"final",
"BusStop",
"busStop",
":",
"this",
".",
"validBusStops",
")",
"{",
"final",
"UUID",
"busid",
"=",
"busStop",
".",
"getUUID",
"(",
")",
";",
"if",
"(",
"id",
".",
"equals",
"(",
"busid",
")",
")",
"{",
"return",
"busStop",
";",
"}",
"}",
"for",
"(",
"final",
"BusStop",
"busStop",
":",
"this",
".",
"invalidBusStops",
")",
"{",
"final",
"UUID",
"busid",
"=",
"busStop",
".",
"getUUID",
"(",
")",
";",
"if",
"(",
"id",
".",
"equals",
"(",
"busid",
")",
")",
"{",
"return",
"busStop",
";",
"}",
"}",
"return",
"null",
";",
"}"
] | Replies the bus stop with the specified id.
@param id is the desired identifier
@return BusStop or <code>null</code> | [
"Replies",
"the",
"bus",
"stop",
"with",
"the",
"specified",
"id",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/gisbus/src/main/java/org/arakhne/afc/gis/bus/network/BusNetwork.java#L918-L936 | train |
gallandarakhneorg/afc | advanced/gis/gisbus/src/main/java/org/arakhne/afc/gis/bus/network/BusNetwork.java | BusNetwork.getBusStop | @Pure
public BusStop getBusStop(String name, Comparator<String> nameComparator) {
if (name == null) {
return null;
}
final Comparator<String> cmp = nameComparator == null ? BusNetworkUtilities.NAME_COMPARATOR : nameComparator;
for (final BusStop busStop : this.validBusStops) {
if (cmp.compare(name, busStop.getName()) == 0) {
return busStop;
}
}
for (final BusStop busStop : this.invalidBusStops) {
if (cmp.compare(name, busStop.getName()) == 0) {
return busStop;
}
}
return null;
} | java | @Pure
public BusStop getBusStop(String name, Comparator<String> nameComparator) {
if (name == null) {
return null;
}
final Comparator<String> cmp = nameComparator == null ? BusNetworkUtilities.NAME_COMPARATOR : nameComparator;
for (final BusStop busStop : this.validBusStops) {
if (cmp.compare(name, busStop.getName()) == 0) {
return busStop;
}
}
for (final BusStop busStop : this.invalidBusStops) {
if (cmp.compare(name, busStop.getName()) == 0) {
return busStop;
}
}
return null;
} | [
"@",
"Pure",
"public",
"BusStop",
"getBusStop",
"(",
"String",
"name",
",",
"Comparator",
"<",
"String",
">",
"nameComparator",
")",
"{",
"if",
"(",
"name",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"final",
"Comparator",
"<",
"String",
">",
"cmp",
"=",
"nameComparator",
"==",
"null",
"?",
"BusNetworkUtilities",
".",
"NAME_COMPARATOR",
":",
"nameComparator",
";",
"for",
"(",
"final",
"BusStop",
"busStop",
":",
"this",
".",
"validBusStops",
")",
"{",
"if",
"(",
"cmp",
".",
"compare",
"(",
"name",
",",
"busStop",
".",
"getName",
"(",
")",
")",
"==",
"0",
")",
"{",
"return",
"busStop",
";",
"}",
"}",
"for",
"(",
"final",
"BusStop",
"busStop",
":",
"this",
".",
"invalidBusStops",
")",
"{",
"if",
"(",
"cmp",
".",
"compare",
"(",
"name",
",",
"busStop",
".",
"getName",
"(",
")",
")",
"==",
"0",
")",
"{",
"return",
"busStop",
";",
"}",
"}",
"return",
"null",
";",
"}"
] | Replies the bus stop with the specified name.
@param name is the desired name
@param nameComparator is used to compare the names.
@return BusStop or <code>null</code> | [
"Replies",
"the",
"bus",
"stop",
"with",
"the",
"specified",
"name",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/gisbus/src/main/java/org/arakhne/afc/gis/bus/network/BusNetwork.java#L945-L962 | train |
gallandarakhneorg/afc | advanced/gis/gisbus/src/main/java/org/arakhne/afc/gis/bus/network/BusNetwork.java | BusNetwork.getBusStopsIn | @Pure
public Iterator<BusStop> getBusStopsIn(Rectangle2afp<?, ?, ?, ?, ?, ?> clipBounds) {
return Iterators.unmodifiableIterator(
this.validBusStops.iterator(clipBounds));
} | java | @Pure
public Iterator<BusStop> getBusStopsIn(Rectangle2afp<?, ?, ?, ?, ?, ?> clipBounds) {
return Iterators.unmodifiableIterator(
this.validBusStops.iterator(clipBounds));
} | [
"@",
"Pure",
"public",
"Iterator",
"<",
"BusStop",
">",
"getBusStopsIn",
"(",
"Rectangle2afp",
"<",
"?",
",",
"?",
",",
"?",
",",
"?",
",",
"?",
",",
"?",
">",
"clipBounds",
")",
"{",
"return",
"Iterators",
".",
"unmodifiableIterator",
"(",
"this",
".",
"validBusStops",
".",
"iterator",
"(",
"clipBounds",
")",
")",
";",
"}"
] | Replies the set of bus stops that have an intersection with the specified rectangle.
<p>This function replies the bus stops with a broad-first iteration on the elements' tree.
@param clipBounds is the bounds outside which the bus stops will not be replied
@return the bus stops inside the specified bounds. | [
"Replies",
"the",
"set",
"of",
"bus",
"stops",
"that",
"have",
"an",
"intersection",
"with",
"the",
"specified",
"rectangle",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/gisbus/src/main/java/org/arakhne/afc/gis/bus/network/BusNetwork.java#L993-L997 | train |
gallandarakhneorg/afc | advanced/gis/gisbus/src/main/java/org/arakhne/afc/gis/bus/network/BusNetwork.java | BusNetwork.getNearestBusStop | @Pure
public BusStop getNearestBusStop(double x, double y) {
double distance = Double.POSITIVE_INFINITY;
BusStop bestStop = null;
double dist;
for (final BusStop stop : this.validBusStops) {
dist = stop.distance(x, y);
if (dist < distance) {
distance = dist;
bestStop = stop;
}
}
return bestStop;
} | java | @Pure
public BusStop getNearestBusStop(double x, double y) {
double distance = Double.POSITIVE_INFINITY;
BusStop bestStop = null;
double dist;
for (final BusStop stop : this.validBusStops) {
dist = stop.distance(x, y);
if (dist < distance) {
distance = dist;
bestStop = stop;
}
}
return bestStop;
} | [
"@",
"Pure",
"public",
"BusStop",
"getNearestBusStop",
"(",
"double",
"x",
",",
"double",
"y",
")",
"{",
"double",
"distance",
"=",
"Double",
".",
"POSITIVE_INFINITY",
";",
"BusStop",
"bestStop",
"=",
"null",
";",
"double",
"dist",
";",
"for",
"(",
"final",
"BusStop",
"stop",
":",
"this",
".",
"validBusStops",
")",
"{",
"dist",
"=",
"stop",
".",
"distance",
"(",
"x",
",",
"y",
")",
";",
"if",
"(",
"dist",
"<",
"distance",
")",
"{",
"distance",
"=",
"dist",
";",
"bestStop",
"=",
"stop",
";",
"}",
"}",
"return",
"bestStop",
";",
"}"
] | Replies the nearest bus stops to the given point.
@param x x coordinate.
@param y y coordinate.
@return the nearest bus stop or <code>null</code> if none was found. | [
"Replies",
"the",
"nearest",
"bus",
"stops",
"to",
"the",
"given",
"point",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/gisbus/src/main/java/org/arakhne/afc/gis/bus/network/BusNetwork.java#L1028-L1043 | train |
gallandarakhneorg/afc | advanced/gis/gisbus/src/main/java/org/arakhne/afc/gis/bus/network/BusNetwork.java | BusNetwork.addBusHub | private boolean addBusHub(BusHub hub) {
if (hub == null) {
return false;
}
if (this.validBusHubs.contains(hub)) {
return false;
}
if (ListUtil.contains(this.invalidBusHubs, INVALID_HUB_COMPARATOR, hub)) {
return false;
}
final boolean isValidPrimitive = hub.isValidPrimitive();
if (isValidPrimitive) {
if (!this.validBusHubs.add(hub)) {
return false;
}
} else if (ListUtil.addIfAbsent(this.invalidBusHubs, INVALID_HUB_COMPARATOR, hub) < 0) {
return false;
}
hub.setEventFirable(isEventFirable());
hub.setContainer(this);
if (isEventFirable()) {
firePrimitiveChanged(new BusChangeEvent(this,
BusChangeEventType.HUB_ADDED,
hub,
-1,
null,
null,
null));
hub.checkPrimitiveValidity();
checkPrimitiveValidity();
}
return true;
} | java | private boolean addBusHub(BusHub hub) {
if (hub == null) {
return false;
}
if (this.validBusHubs.contains(hub)) {
return false;
}
if (ListUtil.contains(this.invalidBusHubs, INVALID_HUB_COMPARATOR, hub)) {
return false;
}
final boolean isValidPrimitive = hub.isValidPrimitive();
if (isValidPrimitive) {
if (!this.validBusHubs.add(hub)) {
return false;
}
} else if (ListUtil.addIfAbsent(this.invalidBusHubs, INVALID_HUB_COMPARATOR, hub) < 0) {
return false;
}
hub.setEventFirable(isEventFirable());
hub.setContainer(this);
if (isEventFirable()) {
firePrimitiveChanged(new BusChangeEvent(this,
BusChangeEventType.HUB_ADDED,
hub,
-1,
null,
null,
null));
hub.checkPrimitiveValidity();
checkPrimitiveValidity();
}
return true;
} | [
"private",
"boolean",
"addBusHub",
"(",
"BusHub",
"hub",
")",
"{",
"if",
"(",
"hub",
"==",
"null",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"this",
".",
"validBusHubs",
".",
"contains",
"(",
"hub",
")",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"ListUtil",
".",
"contains",
"(",
"this",
".",
"invalidBusHubs",
",",
"INVALID_HUB_COMPARATOR",
",",
"hub",
")",
")",
"{",
"return",
"false",
";",
"}",
"final",
"boolean",
"isValidPrimitive",
"=",
"hub",
".",
"isValidPrimitive",
"(",
")",
";",
"if",
"(",
"isValidPrimitive",
")",
"{",
"if",
"(",
"!",
"this",
".",
"validBusHubs",
".",
"add",
"(",
"hub",
")",
")",
"{",
"return",
"false",
";",
"}",
"}",
"else",
"if",
"(",
"ListUtil",
".",
"addIfAbsent",
"(",
"this",
".",
"invalidBusHubs",
",",
"INVALID_HUB_COMPARATOR",
",",
"hub",
")",
"<",
"0",
")",
"{",
"return",
"false",
";",
"}",
"hub",
".",
"setEventFirable",
"(",
"isEventFirable",
"(",
")",
")",
";",
"hub",
".",
"setContainer",
"(",
"this",
")",
";",
"if",
"(",
"isEventFirable",
"(",
")",
")",
"{",
"firePrimitiveChanged",
"(",
"new",
"BusChangeEvent",
"(",
"this",
",",
"BusChangeEventType",
".",
"HUB_ADDED",
",",
"hub",
",",
"-",
"1",
",",
"null",
",",
"null",
",",
"null",
")",
")",
";",
"hub",
".",
"checkPrimitiveValidity",
"(",
")",
";",
"checkPrimitiveValidity",
"(",
")",
";",
"}",
"return",
"true",
";",
"}"
] | Add the given bus hub in the network.
@param hub is the new bus hub.
@return <code>true</code> on success, otherwise <code>false</code>. | [
"Add",
"the",
"given",
"bus",
"hub",
"in",
"the",
"network",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/gisbus/src/main/java/org/arakhne/afc/gis/bus/network/BusNetwork.java#L1088-L1123 | train |
gallandarakhneorg/afc | advanced/gis/gisbus/src/main/java/org/arakhne/afc/gis/bus/network/BusNetwork.java | BusNetwork.removeAllBusHubs | public void removeAllBusHubs() {
for (final BusHub busHub : this.validBusHubs) {
busHub.setContainer(null);
busHub.setEventFirable(true);
}
for (final BusHub busHub : this.invalidBusHubs) {
busHub.setContainer(null);
busHub.setEventFirable(true);
}
this.validBusHubs.clear();
this.invalidBusHubs.clear();
firePrimitiveChanged(new BusChangeEvent(this,
BusChangeEventType.ALL_HUBS_REMOVED,
null,
-1,
null,
null,
null));
revalidate();
} | java | public void removeAllBusHubs() {
for (final BusHub busHub : this.validBusHubs) {
busHub.setContainer(null);
busHub.setEventFirable(true);
}
for (final BusHub busHub : this.invalidBusHubs) {
busHub.setContainer(null);
busHub.setEventFirable(true);
}
this.validBusHubs.clear();
this.invalidBusHubs.clear();
firePrimitiveChanged(new BusChangeEvent(this,
BusChangeEventType.ALL_HUBS_REMOVED,
null,
-1,
null,
null,
null));
revalidate();
} | [
"public",
"void",
"removeAllBusHubs",
"(",
")",
"{",
"for",
"(",
"final",
"BusHub",
"busHub",
":",
"this",
".",
"validBusHubs",
")",
"{",
"busHub",
".",
"setContainer",
"(",
"null",
")",
";",
"busHub",
".",
"setEventFirable",
"(",
"true",
")",
";",
"}",
"for",
"(",
"final",
"BusHub",
"busHub",
":",
"this",
".",
"invalidBusHubs",
")",
"{",
"busHub",
".",
"setContainer",
"(",
"null",
")",
";",
"busHub",
".",
"setEventFirable",
"(",
"true",
")",
";",
"}",
"this",
".",
"validBusHubs",
".",
"clear",
"(",
")",
";",
"this",
".",
"invalidBusHubs",
".",
"clear",
"(",
")",
";",
"firePrimitiveChanged",
"(",
"new",
"BusChangeEvent",
"(",
"this",
",",
"BusChangeEventType",
".",
"ALL_HUBS_REMOVED",
",",
"null",
",",
"-",
"1",
",",
"null",
",",
"null",
",",
"null",
")",
")",
";",
"revalidate",
"(",
")",
";",
"}"
] | Remove all the bus hubs from the current network. | [
"Remove",
"all",
"the",
"bus",
"hubs",
"from",
"the",
"current",
"network",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/gisbus/src/main/java/org/arakhne/afc/gis/bus/network/BusNetwork.java#L1128-L1147 | train |
gallandarakhneorg/afc | advanced/gis/gisbus/src/main/java/org/arakhne/afc/gis/bus/network/BusNetwork.java | BusNetwork.removeBusHub | public boolean removeBusHub(BusHub busHub) {
if (this.validBusHubs.remove(busHub)) {
busHub.setContainer(null);
busHub.setEventFirable(true);
firePrimitiveChanged(new BusChangeEvent(this,
BusChangeEventType.HUB_REMOVED,
busHub,
-1,
null,
null,
null));
checkPrimitiveValidity();
return true;
}
final int idx = ListUtil.remove(this.invalidBusHubs, INVALID_HUB_COMPARATOR, busHub);
if (idx >= 0) {
busHub.setContainer(null);
busHub.setEventFirable(true);
firePrimitiveChanged(new BusChangeEvent(this,
BusChangeEventType.HUB_REMOVED,
busHub,
-1,
null,
null,
null));
checkPrimitiveValidity();
return true;
}
return false;
} | java | public boolean removeBusHub(BusHub busHub) {
if (this.validBusHubs.remove(busHub)) {
busHub.setContainer(null);
busHub.setEventFirable(true);
firePrimitiveChanged(new BusChangeEvent(this,
BusChangeEventType.HUB_REMOVED,
busHub,
-1,
null,
null,
null));
checkPrimitiveValidity();
return true;
}
final int idx = ListUtil.remove(this.invalidBusHubs, INVALID_HUB_COMPARATOR, busHub);
if (idx >= 0) {
busHub.setContainer(null);
busHub.setEventFirable(true);
firePrimitiveChanged(new BusChangeEvent(this,
BusChangeEventType.HUB_REMOVED,
busHub,
-1,
null,
null,
null));
checkPrimitiveValidity();
return true;
}
return false;
} | [
"public",
"boolean",
"removeBusHub",
"(",
"BusHub",
"busHub",
")",
"{",
"if",
"(",
"this",
".",
"validBusHubs",
".",
"remove",
"(",
"busHub",
")",
")",
"{",
"busHub",
".",
"setContainer",
"(",
"null",
")",
";",
"busHub",
".",
"setEventFirable",
"(",
"true",
")",
";",
"firePrimitiveChanged",
"(",
"new",
"BusChangeEvent",
"(",
"this",
",",
"BusChangeEventType",
".",
"HUB_REMOVED",
",",
"busHub",
",",
"-",
"1",
",",
"null",
",",
"null",
",",
"null",
")",
")",
";",
"checkPrimitiveValidity",
"(",
")",
";",
"return",
"true",
";",
"}",
"final",
"int",
"idx",
"=",
"ListUtil",
".",
"remove",
"(",
"this",
".",
"invalidBusHubs",
",",
"INVALID_HUB_COMPARATOR",
",",
"busHub",
")",
";",
"if",
"(",
"idx",
">=",
"0",
")",
"{",
"busHub",
".",
"setContainer",
"(",
"null",
")",
";",
"busHub",
".",
"setEventFirable",
"(",
"true",
")",
";",
"firePrimitiveChanged",
"(",
"new",
"BusChangeEvent",
"(",
"this",
",",
"BusChangeEventType",
".",
"HUB_REMOVED",
",",
"busHub",
",",
"-",
"1",
",",
"null",
",",
"null",
",",
"null",
")",
")",
";",
"checkPrimitiveValidity",
"(",
")",
";",
"return",
"true",
";",
"}",
"return",
"false",
";",
"}"
] | Remove a bus hubs from this network.
@param busHub is the bus hub to remove.
@return <code>true</code> if the bus hub was successfully removed, otherwise <code>false</code> | [
"Remove",
"a",
"bus",
"hubs",
"from",
"this",
"network",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/gisbus/src/main/java/org/arakhne/afc/gis/bus/network/BusNetwork.java#L1155-L1184 | train |
gallandarakhneorg/afc | advanced/gis/gisbus/src/main/java/org/arakhne/afc/gis/bus/network/BusNetwork.java | BusNetwork.removeBusHub | public boolean removeBusHub(String name) {
Iterator<BusHub> iterator;
BusHub busHub;
iterator = this.validBusHubs.iterator();
while (iterator.hasNext()) {
busHub = iterator.next();
if (name.equals(busHub.getName())) {
iterator.remove();
busHub.setContainer(null);
busHub.setEventFirable(true);
firePrimitiveChanged(new BusChangeEvent(this,
BusChangeEventType.HUB_REMOVED,
busHub,
-1,
null,
null,
null));
checkPrimitiveValidity();
return true;
}
}
iterator = this.invalidBusHubs.iterator();
while (iterator.hasNext()) {
busHub = iterator.next();
if (name.equals(busHub.getName())) {
iterator.remove();
busHub.setContainer(null);
firePrimitiveChanged(new BusChangeEvent(this,
BusChangeEventType.HUB_REMOVED,
busHub,
-1,
null,
null,
null));
checkPrimitiveValidity();
return true;
}
}
return false;
} | java | public boolean removeBusHub(String name) {
Iterator<BusHub> iterator;
BusHub busHub;
iterator = this.validBusHubs.iterator();
while (iterator.hasNext()) {
busHub = iterator.next();
if (name.equals(busHub.getName())) {
iterator.remove();
busHub.setContainer(null);
busHub.setEventFirable(true);
firePrimitiveChanged(new BusChangeEvent(this,
BusChangeEventType.HUB_REMOVED,
busHub,
-1,
null,
null,
null));
checkPrimitiveValidity();
return true;
}
}
iterator = this.invalidBusHubs.iterator();
while (iterator.hasNext()) {
busHub = iterator.next();
if (name.equals(busHub.getName())) {
iterator.remove();
busHub.setContainer(null);
firePrimitiveChanged(new BusChangeEvent(this,
BusChangeEventType.HUB_REMOVED,
busHub,
-1,
null,
null,
null));
checkPrimitiveValidity();
return true;
}
}
return false;
} | [
"public",
"boolean",
"removeBusHub",
"(",
"String",
"name",
")",
"{",
"Iterator",
"<",
"BusHub",
">",
"iterator",
";",
"BusHub",
"busHub",
";",
"iterator",
"=",
"this",
".",
"validBusHubs",
".",
"iterator",
"(",
")",
";",
"while",
"(",
"iterator",
".",
"hasNext",
"(",
")",
")",
"{",
"busHub",
"=",
"iterator",
".",
"next",
"(",
")",
";",
"if",
"(",
"name",
".",
"equals",
"(",
"busHub",
".",
"getName",
"(",
")",
")",
")",
"{",
"iterator",
".",
"remove",
"(",
")",
";",
"busHub",
".",
"setContainer",
"(",
"null",
")",
";",
"busHub",
".",
"setEventFirable",
"(",
"true",
")",
";",
"firePrimitiveChanged",
"(",
"new",
"BusChangeEvent",
"(",
"this",
",",
"BusChangeEventType",
".",
"HUB_REMOVED",
",",
"busHub",
",",
"-",
"1",
",",
"null",
",",
"null",
",",
"null",
")",
")",
";",
"checkPrimitiveValidity",
"(",
")",
";",
"return",
"true",
";",
"}",
"}",
"iterator",
"=",
"this",
".",
"invalidBusHubs",
".",
"iterator",
"(",
")",
";",
"while",
"(",
"iterator",
".",
"hasNext",
"(",
")",
")",
"{",
"busHub",
"=",
"iterator",
".",
"next",
"(",
")",
";",
"if",
"(",
"name",
".",
"equals",
"(",
"busHub",
".",
"getName",
"(",
")",
")",
")",
"{",
"iterator",
".",
"remove",
"(",
")",
";",
"busHub",
".",
"setContainer",
"(",
"null",
")",
";",
"firePrimitiveChanged",
"(",
"new",
"BusChangeEvent",
"(",
"this",
",",
"BusChangeEventType",
".",
"HUB_REMOVED",
",",
"busHub",
",",
"-",
"1",
",",
"null",
",",
"null",
",",
"null",
")",
")",
";",
"checkPrimitiveValidity",
"(",
")",
";",
"return",
"true",
";",
"}",
"}",
"return",
"false",
";",
"}"
] | Remove the bus hub with the given name.
@param name is the name of the bus hub to remove.
@return <code>true</code> if the bus hub was successfully removed, otherwise <code>false</code> | [
"Remove",
"the",
"bus",
"hub",
"with",
"the",
"given",
"name",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/gisbus/src/main/java/org/arakhne/afc/gis/bus/network/BusNetwork.java#L1192-L1234 | train |
gallandarakhneorg/afc | advanced/gis/gisbus/src/main/java/org/arakhne/afc/gis/bus/network/BusNetwork.java | BusNetwork.getBusHub | @Pure
public BusHub getBusHub(UUID uuid) {
if (uuid == null) {
return null;
}
for (final BusHub busHub : this.validBusHubs) {
if (uuid.equals(busHub.getUUID())) {
return busHub;
}
}
for (final BusHub busHub : this.invalidBusHubs) {
if (uuid.equals(busHub.getUUID())) {
return busHub;
}
}
return null;
} | java | @Pure
public BusHub getBusHub(UUID uuid) {
if (uuid == null) {
return null;
}
for (final BusHub busHub : this.validBusHubs) {
if (uuid.equals(busHub.getUUID())) {
return busHub;
}
}
for (final BusHub busHub : this.invalidBusHubs) {
if (uuid.equals(busHub.getUUID())) {
return busHub;
}
}
return null;
} | [
"@",
"Pure",
"public",
"BusHub",
"getBusHub",
"(",
"UUID",
"uuid",
")",
"{",
"if",
"(",
"uuid",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"for",
"(",
"final",
"BusHub",
"busHub",
":",
"this",
".",
"validBusHubs",
")",
"{",
"if",
"(",
"uuid",
".",
"equals",
"(",
"busHub",
".",
"getUUID",
"(",
")",
")",
")",
"{",
"return",
"busHub",
";",
"}",
"}",
"for",
"(",
"final",
"BusHub",
"busHub",
":",
"this",
".",
"invalidBusHubs",
")",
"{",
"if",
"(",
"uuid",
".",
"equals",
"(",
"busHub",
".",
"getUUID",
"(",
")",
")",
")",
"{",
"return",
"busHub",
";",
"}",
"}",
"return",
"null",
";",
"}"
] | Replies the bus hub with the specified uuid.
@param uuid the identifier.
@return a bus hub or <code>null</code> | [
"Replies",
"the",
"bus",
"hub",
"with",
"the",
"specified",
"uuid",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/gisbus/src/main/java/org/arakhne/afc/gis/bus/network/BusNetwork.java#L1263-L1279 | train |
gallandarakhneorg/afc | advanced/gis/gisbus/src/main/java/org/arakhne/afc/gis/bus/network/BusNetwork.java | BusNetwork.getBusHub | @Pure
public BusHub getBusHub(String name, Comparator<String> nameComparator) {
if (name == null) {
return null;
}
final Comparator<String> cmp = nameComparator == null ? BusNetworkUtilities.NAME_COMPARATOR : nameComparator;
for (final BusHub busHub : this.validBusHubs) {
if (cmp.compare(name, busHub.getName()) == 0) {
return busHub;
}
}
for (final BusHub busHub : this.invalidBusHubs) {
if (cmp.compare(name, busHub.getName()) == 0) {
return busHub;
}
}
return null;
} | java | @Pure
public BusHub getBusHub(String name, Comparator<String> nameComparator) {
if (name == null) {
return null;
}
final Comparator<String> cmp = nameComparator == null ? BusNetworkUtilities.NAME_COMPARATOR : nameComparator;
for (final BusHub busHub : this.validBusHubs) {
if (cmp.compare(name, busHub.getName()) == 0) {
return busHub;
}
}
for (final BusHub busHub : this.invalidBusHubs) {
if (cmp.compare(name, busHub.getName()) == 0) {
return busHub;
}
}
return null;
} | [
"@",
"Pure",
"public",
"BusHub",
"getBusHub",
"(",
"String",
"name",
",",
"Comparator",
"<",
"String",
">",
"nameComparator",
")",
"{",
"if",
"(",
"name",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"final",
"Comparator",
"<",
"String",
">",
"cmp",
"=",
"nameComparator",
"==",
"null",
"?",
"BusNetworkUtilities",
".",
"NAME_COMPARATOR",
":",
"nameComparator",
";",
"for",
"(",
"final",
"BusHub",
"busHub",
":",
"this",
".",
"validBusHubs",
")",
"{",
"if",
"(",
"cmp",
".",
"compare",
"(",
"name",
",",
"busHub",
".",
"getName",
"(",
")",
")",
"==",
"0",
")",
"{",
"return",
"busHub",
";",
"}",
"}",
"for",
"(",
"final",
"BusHub",
"busHub",
":",
"this",
".",
"invalidBusHubs",
")",
"{",
"if",
"(",
"cmp",
".",
"compare",
"(",
"name",
",",
"busHub",
".",
"getName",
"(",
")",
")",
"==",
"0",
")",
"{",
"return",
"busHub",
";",
"}",
"}",
"return",
"null",
";",
"}"
] | Replies the bus hub with the specified name.
@param name is the desired name
@param nameComparator is used to compare the names.
@return a bus hub or <code>null</code> | [
"Replies",
"the",
"bus",
"hub",
"with",
"the",
"specified",
"name",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/gisbus/src/main/java/org/arakhne/afc/gis/bus/network/BusNetwork.java#L1288-L1305 | train |
gallandarakhneorg/afc | advanced/gis/gisbus/src/main/java/org/arakhne/afc/gis/bus/network/BusNetwork.java | BusNetwork.getBusHubsIn | @Pure
public Iterator<BusHub> getBusHubsIn(Rectangle2afp<?, ?, ?, ?, ?, ?> clipBounds) {
return Iterators.unmodifiableIterator(
this.validBusHubs.iterator(clipBounds));
} | java | @Pure
public Iterator<BusHub> getBusHubsIn(Rectangle2afp<?, ?, ?, ?, ?, ?> clipBounds) {
return Iterators.unmodifiableIterator(
this.validBusHubs.iterator(clipBounds));
} | [
"@",
"Pure",
"public",
"Iterator",
"<",
"BusHub",
">",
"getBusHubsIn",
"(",
"Rectangle2afp",
"<",
"?",
",",
"?",
",",
"?",
",",
"?",
",",
"?",
",",
"?",
">",
"clipBounds",
")",
"{",
"return",
"Iterators",
".",
"unmodifiableIterator",
"(",
"this",
".",
"validBusHubs",
".",
"iterator",
"(",
"clipBounds",
")",
")",
";",
"}"
] | Replies the set of bus hubs that have an intersection with the specified rectangle.
<p>This function replies the bus hubs with a broad-first iteration on the hubs' tree.
@param clipBounds is the bounds outside which the bus hubs will not be replied
@return the bus hubs inside the specified bounds. | [
"Replies",
"the",
"set",
"of",
"bus",
"hubs",
"that",
"have",
"an",
"intersection",
"with",
"the",
"specified",
"rectangle",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/gisbus/src/main/java/org/arakhne/afc/gis/bus/network/BusNetwork.java#L1336-L1340 | train |
aerogear/aerogear-android-core | library/src/main/java/org/jboss/aerogear/android/core/reflection/Property.java | Property.setValue | public void setValue(Object instance, Object value) {
try {
setMethod.invoke(instance, value);
} catch (Exception e) {
throw new PropertyNotFoundException(klass, getType(), fieldName);
}
} | java | public void setValue(Object instance, Object value) {
try {
setMethod.invoke(instance, value);
} catch (Exception e) {
throw new PropertyNotFoundException(klass, getType(), fieldName);
}
} | [
"public",
"void",
"setValue",
"(",
"Object",
"instance",
",",
"Object",
"value",
")",
"{",
"try",
"{",
"setMethod",
".",
"invoke",
"(",
"instance",
",",
"value",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"throw",
"new",
"PropertyNotFoundException",
"(",
"klass",
",",
"getType",
"(",
")",
",",
"fieldName",
")",
";",
"}",
"}"
] | Set new value
@param instance Instance to set new value
@param value new value | [
"Set",
"new",
"value"
] | 3be24a79dd3d2792804935572bb672ff8714e6aa | https://github.com/aerogear/aerogear-android-core/blob/3be24a79dd3d2792804935572bb672ff8714e6aa/library/src/main/java/org/jboss/aerogear/android/core/reflection/Property.java#L139-L146 | train |
gallandarakhneorg/afc | advanced/mathfx/src/main/java/org/arakhne/afc/math/geometry/d3/dfx/Vector3dfx.java | Vector3dfx.convert | public static Vector3dfx convert(Tuple3D<?> tuple) {
if (tuple instanceof Vector3dfx) {
return (Vector3dfx) tuple;
}
return new Vector3dfx(tuple.getX(), tuple.getY(), tuple.getZ());
} | java | public static Vector3dfx convert(Tuple3D<?> tuple) {
if (tuple instanceof Vector3dfx) {
return (Vector3dfx) tuple;
}
return new Vector3dfx(tuple.getX(), tuple.getY(), tuple.getZ());
} | [
"public",
"static",
"Vector3dfx",
"convert",
"(",
"Tuple3D",
"<",
"?",
">",
"tuple",
")",
"{",
"if",
"(",
"tuple",
"instanceof",
"Vector3dfx",
")",
"{",
"return",
"(",
"Vector3dfx",
")",
"tuple",
";",
"}",
"return",
"new",
"Vector3dfx",
"(",
"tuple",
".",
"getX",
"(",
")",
",",
"tuple",
".",
"getY",
"(",
")",
",",
"tuple",
".",
"getZ",
"(",
")",
")",
";",
"}"
] | Convert the given tuple to a real Vector3dfx.
<p>If the given tuple is already a Vector3dfx, it is replied.
@param tuple the tuple.
@return the Vector3dfx.
@since 14.0 | [
"Convert",
"the",
"given",
"tuple",
"to",
"a",
"real",
"Vector3dfx",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/mathfx/src/main/java/org/arakhne/afc/math/geometry/d3/dfx/Vector3dfx.java#L146-L151 | train |
lightblueseas/swing-components | src/main/java/de/alpharogroup/swing/table/model/suffle/GenericShuffleTableModel.java | GenericShuffleTableModel.shuffleSelectedRightRowToLeftTableModel | public void shuffleSelectedRightRowToLeftTableModel(final int selectedRow)
{
if (-1 < selectedRow)
{
final T row = rightTableModel.removeAt(selectedRow);
leftTableModel.add(row);
}
} | java | public void shuffleSelectedRightRowToLeftTableModel(final int selectedRow)
{
if (-1 < selectedRow)
{
final T row = rightTableModel.removeAt(selectedRow);
leftTableModel.add(row);
}
} | [
"public",
"void",
"shuffleSelectedRightRowToLeftTableModel",
"(",
"final",
"int",
"selectedRow",
")",
"{",
"if",
"(",
"-",
"1",
"<",
"selectedRow",
")",
"{",
"final",
"T",
"row",
"=",
"rightTableModel",
".",
"removeAt",
"(",
"selectedRow",
")",
";",
"leftTableModel",
".",
"add",
"(",
"row",
")",
";",
"}",
"}"
] | Shuffle selected right row to left table model.
@param selectedRow
the selected row | [
"Shuffle",
"selected",
"right",
"row",
"to",
"left",
"table",
"model",
"."
] | 4045e85cabd8f0ce985cbfff134c3c9873930c79 | https://github.com/lightblueseas/swing-components/blob/4045e85cabd8f0ce985cbfff134c3c9873930c79/src/main/java/de/alpharogroup/swing/table/model/suffle/GenericShuffleTableModel.java#L139-L146 | train |
BBN-E/bue-common-open | common-core-open/src/main/java/com/bbn/bue/common/strings/LocatedString.java | LocatedString.startReferenceOffsetsForContentOffset | public OffsetGroup startReferenceOffsetsForContentOffset(CharOffset contentOffset) {
return characterRegions().get(regionIndexContainingContentOffset(contentOffset))
.startOffsetGroupForPosition(contentOffset);
} | java | public OffsetGroup startReferenceOffsetsForContentOffset(CharOffset contentOffset) {
return characterRegions().get(regionIndexContainingContentOffset(contentOffset))
.startOffsetGroupForPosition(contentOffset);
} | [
"public",
"OffsetGroup",
"startReferenceOffsetsForContentOffset",
"(",
"CharOffset",
"contentOffset",
")",
"{",
"return",
"characterRegions",
"(",
")",
".",
"get",
"(",
"regionIndexContainingContentOffset",
"(",
"contentOffset",
")",
")",
".",
"startOffsetGroupForPosition",
"(",
"contentOffset",
")",
";",
"}"
] | Get the earliest reference string offsets corresponding to the given content string offset. | [
"Get",
"the",
"earliest",
"reference",
"string",
"offsets",
"corresponding",
"to",
"the",
"given",
"content",
"string",
"offset",
"."
] | d618652674d647867306e2e4b987a21b7c29c015 | https://github.com/BBN-E/bue-common-open/blob/d618652674d647867306e2e4b987a21b7c29c015/common-core-open/src/main/java/com/bbn/bue/common/strings/LocatedString.java#L261-L264 | train |
BBN-E/bue-common-open | common-core-open/src/main/java/com/bbn/bue/common/strings/LocatedString.java | LocatedString.endReferenceOffsetsForContentOffset | public OffsetGroup endReferenceOffsetsForContentOffset(CharOffset contentOffset) {
return characterRegions().get(regionIndexContainingContentOffset(contentOffset))
.endOffsetGroupForPosition(contentOffset);
} | java | public OffsetGroup endReferenceOffsetsForContentOffset(CharOffset contentOffset) {
return characterRegions().get(regionIndexContainingContentOffset(contentOffset))
.endOffsetGroupForPosition(contentOffset);
} | [
"public",
"OffsetGroup",
"endReferenceOffsetsForContentOffset",
"(",
"CharOffset",
"contentOffset",
")",
"{",
"return",
"characterRegions",
"(",
")",
".",
"get",
"(",
"regionIndexContainingContentOffset",
"(",
"contentOffset",
")",
")",
".",
"endOffsetGroupForPosition",
"(",
"contentOffset",
")",
";",
"}"
] | Get the latest reference string offsets corresponding to the given content string offset. | [
"Get",
"the",
"latest",
"reference",
"string",
"offsets",
"corresponding",
"to",
"the",
"given",
"content",
"string",
"offset",
"."
] | d618652674d647867306e2e4b987a21b7c29c015 | https://github.com/BBN-E/bue-common-open/blob/d618652674d647867306e2e4b987a21b7c29c015/common-core-open/src/main/java/com/bbn/bue/common/strings/LocatedString.java#L269-L272 | train |
BBN-E/bue-common-open | common-core-open/src/main/java/com/bbn/bue/common/strings/LocatedString.java | LocatedString.referenceSubstringByContentOffsets | public final Optional<UnicodeFriendlyString> referenceSubstringByContentOffsets(
final OffsetRange<CharOffset> contentOffsets) {
if (referenceString().isPresent()) {
return Optional.of(referenceString().get().substringByCodePoints(
OffsetGroupRange.from(
startReferenceOffsetsForContentOffset(contentOffsets.startInclusive()),
endReferenceOffsetsForContentOffset(contentOffsets.endInclusive()))
.asCharOffsetRange()));
} else {
return Optional.absent();
}
} | java | public final Optional<UnicodeFriendlyString> referenceSubstringByContentOffsets(
final OffsetRange<CharOffset> contentOffsets) {
if (referenceString().isPresent()) {
return Optional.of(referenceString().get().substringByCodePoints(
OffsetGroupRange.from(
startReferenceOffsetsForContentOffset(contentOffsets.startInclusive()),
endReferenceOffsetsForContentOffset(contentOffsets.endInclusive()))
.asCharOffsetRange()));
} else {
return Optional.absent();
}
} | [
"public",
"final",
"Optional",
"<",
"UnicodeFriendlyString",
">",
"referenceSubstringByContentOffsets",
"(",
"final",
"OffsetRange",
"<",
"CharOffset",
">",
"contentOffsets",
")",
"{",
"if",
"(",
"referenceString",
"(",
")",
".",
"isPresent",
"(",
")",
")",
"{",
"return",
"Optional",
".",
"of",
"(",
"referenceString",
"(",
")",
".",
"get",
"(",
")",
".",
"substringByCodePoints",
"(",
"OffsetGroupRange",
".",
"from",
"(",
"startReferenceOffsetsForContentOffset",
"(",
"contentOffsets",
".",
"startInclusive",
"(",
")",
")",
",",
"endReferenceOffsetsForContentOffset",
"(",
"contentOffsets",
".",
"endInclusive",
"(",
")",
")",
")",
".",
"asCharOffsetRange",
"(",
")",
")",
")",
";",
"}",
"else",
"{",
"return",
"Optional",
".",
"absent",
"(",
")",
";",
"}",
"}"
] | Gets the substring of the reference string corresponding to a range of content string
offsets. This will include intervening characters which may not themselves correspond to
any content string character.
Will return {@link Optional#absent()} if and only if {@link #referenceString()} returns
absent.
Please refer to the class Javadoc for coverage of available substring options. | [
"Gets",
"the",
"substring",
"of",
"the",
"reference",
"string",
"corresponding",
"to",
"a",
"range",
"of",
"content",
"string",
"offsets",
".",
"This",
"will",
"include",
"intervening",
"characters",
"which",
"may",
"not",
"themselves",
"correspond",
"to",
"any",
"content",
"string",
"character",
"."
] | d618652674d647867306e2e4b987a21b7c29c015 | https://github.com/BBN-E/bue-common-open/blob/d618652674d647867306e2e4b987a21b7c29c015/common-core-open/src/main/java/com/bbn/bue/common/strings/LocatedString.java#L332-L343 | train |
gallandarakhneorg/afc | advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/coordinate/GeodesicPosition.java | GeodesicPosition.getLatitudeMinute | @SuppressWarnings("checkstyle:localvariablename")
@Pure
public int getLatitudeMinute() {
double p = Math.abs(this.phi);
p = p - (int) p;
return (int) (p * 60.);
} | java | @SuppressWarnings("checkstyle:localvariablename")
@Pure
public int getLatitudeMinute() {
double p = Math.abs(this.phi);
p = p - (int) p;
return (int) (p * 60.);
} | [
"@",
"SuppressWarnings",
"(",
"\"checkstyle:localvariablename\"",
")",
"@",
"Pure",
"public",
"int",
"getLatitudeMinute",
"(",
")",
"{",
"double",
"p",
"=",
"Math",
".",
"abs",
"(",
"this",
".",
"phi",
")",
";",
"p",
"=",
"p",
"-",
"(",
"int",
")",
"p",
";",
"return",
"(",
"int",
")",
"(",
"p",
"*",
"60.",
")",
";",
"}"
] | Replies the minute of the sexagesimal representation of the latitude phi.
@return the latitude minute in [0;60). | [
"Replies",
"the",
"minute",
"of",
"the",
"sexagesimal",
"representation",
"of",
"the",
"latitude",
"phi",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/coordinate/GeodesicPosition.java#L170-L176 | train |
gallandarakhneorg/afc | advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/coordinate/GeodesicPosition.java | GeodesicPosition.getLatitudeSecond | @SuppressWarnings("checkstyle:localvariablename")
@Pure
public double getLatitudeSecond() {
double p = Math.abs(this.phi);
p = (p - (int) p) * 60.;
p = p - (int) p;
return p * 60.;
} | java | @SuppressWarnings("checkstyle:localvariablename")
@Pure
public double getLatitudeSecond() {
double p = Math.abs(this.phi);
p = (p - (int) p) * 60.;
p = p - (int) p;
return p * 60.;
} | [
"@",
"SuppressWarnings",
"(",
"\"checkstyle:localvariablename\"",
")",
"@",
"Pure",
"public",
"double",
"getLatitudeSecond",
"(",
")",
"{",
"double",
"p",
"=",
"Math",
".",
"abs",
"(",
"this",
".",
"phi",
")",
";",
"p",
"=",
"(",
"p",
"-",
"(",
"int",
")",
"p",
")",
"*",
"60.",
";",
"p",
"=",
"p",
"-",
"(",
"int",
")",
"p",
";",
"return",
"p",
"*",
"60.",
";",
"}"
] | Replies the second of the sexagesimal representation of the latitude phi.
@return the latitude second in [0;60). | [
"Replies",
"the",
"second",
"of",
"the",
"sexagesimal",
"representation",
"of",
"the",
"latitude",
"phi",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/coordinate/GeodesicPosition.java#L182-L189 | train |
gallandarakhneorg/afc | advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/coordinate/GeodesicPosition.java | GeodesicPosition.getLongitudeMinute | @SuppressWarnings("checkstyle:localvariablename")
@Pure
public int getLongitudeMinute() {
double l = Math.abs(this.lambda);
l = l - (int) l;
return (int) (l * 60.);
} | java | @SuppressWarnings("checkstyle:localvariablename")
@Pure
public int getLongitudeMinute() {
double l = Math.abs(this.lambda);
l = l - (int) l;
return (int) (l * 60.);
} | [
"@",
"SuppressWarnings",
"(",
"\"checkstyle:localvariablename\"",
")",
"@",
"Pure",
"public",
"int",
"getLongitudeMinute",
"(",
")",
"{",
"double",
"l",
"=",
"Math",
".",
"abs",
"(",
"this",
".",
"lambda",
")",
";",
"l",
"=",
"l",
"-",
"(",
"int",
")",
"l",
";",
"return",
"(",
"int",
")",
"(",
"l",
"*",
"60.",
")",
";",
"}"
] | Replies the minute of the sexagesimal representation of the longitude phi.
@return the longitude minute in [0;60). | [
"Replies",
"the",
"minute",
"of",
"the",
"sexagesimal",
"representation",
"of",
"the",
"longitude",
"phi",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/coordinate/GeodesicPosition.java#L222-L228 | train |
gallandarakhneorg/afc | advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/coordinate/GeodesicPosition.java | GeodesicPosition.getLongitudeSecond | @SuppressWarnings("checkstyle:localvariablename")
@Pure
public double getLongitudeSecond() {
double p = Math.abs(this.lambda);
p = (p - (int) p) * 60.;
p = p - (int) p;
return p * 60.;
} | java | @SuppressWarnings("checkstyle:localvariablename")
@Pure
public double getLongitudeSecond() {
double p = Math.abs(this.lambda);
p = (p - (int) p) * 60.;
p = p - (int) p;
return p * 60.;
} | [
"@",
"SuppressWarnings",
"(",
"\"checkstyle:localvariablename\"",
")",
"@",
"Pure",
"public",
"double",
"getLongitudeSecond",
"(",
")",
"{",
"double",
"p",
"=",
"Math",
".",
"abs",
"(",
"this",
".",
"lambda",
")",
";",
"p",
"=",
"(",
"p",
"-",
"(",
"int",
")",
"p",
")",
"*",
"60.",
";",
"p",
"=",
"p",
"-",
"(",
"int",
")",
"p",
";",
"return",
"p",
"*",
"60.",
";",
"}"
] | Replies the second of the sexagesimal representation of the longitude phi.
@return the longitude second in [0;60). | [
"Replies",
"the",
"second",
"of",
"the",
"sexagesimal",
"representation",
"of",
"the",
"longitude",
"phi",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/coordinate/GeodesicPosition.java#L234-L241 | train |
gallandarakhneorg/afc | advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/coordinate/GeodesicPosition.java | GeodesicPosition.setPreferredStringRepresentation | public static void setPreferredStringRepresentation(GeodesicPositionStringRepresentation representation,
boolean useSymbolicDirection) {
final Preferences prefs = Preferences.userNodeForPackage(GeodesicPosition.class);
if (prefs != null) {
if (representation == null) {
prefs.remove("STRING_REPRESENTATION"); //$NON-NLS-1$
prefs.remove("SYMBOL_IN_STRING_REPRESENTATION"); //$NON-NLS-1$
} else {
prefs.put("STRING_REPRESENTATION", representation.toString()); //$NON-NLS-1$
prefs.putBoolean("SYMBOL_IN_STRING_REPRESENTATION", useSymbolicDirection); //$NON-NLS-1$
}
}
} | java | public static void setPreferredStringRepresentation(GeodesicPositionStringRepresentation representation,
boolean useSymbolicDirection) {
final Preferences prefs = Preferences.userNodeForPackage(GeodesicPosition.class);
if (prefs != null) {
if (representation == null) {
prefs.remove("STRING_REPRESENTATION"); //$NON-NLS-1$
prefs.remove("SYMBOL_IN_STRING_REPRESENTATION"); //$NON-NLS-1$
} else {
prefs.put("STRING_REPRESENTATION", representation.toString()); //$NON-NLS-1$
prefs.putBoolean("SYMBOL_IN_STRING_REPRESENTATION", useSymbolicDirection); //$NON-NLS-1$
}
}
} | [
"public",
"static",
"void",
"setPreferredStringRepresentation",
"(",
"GeodesicPositionStringRepresentation",
"representation",
",",
"boolean",
"useSymbolicDirection",
")",
"{",
"final",
"Preferences",
"prefs",
"=",
"Preferences",
".",
"userNodeForPackage",
"(",
"GeodesicPosition",
".",
"class",
")",
";",
"if",
"(",
"prefs",
"!=",
"null",
")",
"{",
"if",
"(",
"representation",
"==",
"null",
")",
"{",
"prefs",
".",
"remove",
"(",
"\"STRING_REPRESENTATION\"",
")",
";",
"//$NON-NLS-1$",
"prefs",
".",
"remove",
"(",
"\"SYMBOL_IN_STRING_REPRESENTATION\"",
")",
";",
"//$NON-NLS-1$",
"}",
"else",
"{",
"prefs",
".",
"put",
"(",
"\"STRING_REPRESENTATION\"",
",",
"representation",
".",
"toString",
"(",
")",
")",
";",
"//$NON-NLS-1$",
"prefs",
".",
"putBoolean",
"(",
"\"SYMBOL_IN_STRING_REPRESENTATION\"",
",",
"useSymbolicDirection",
")",
";",
"//$NON-NLS-1$",
"}",
"}",
"}"
] | Set the preferred format of the string representation
of a geodesic position.
@param representation indicates the preferred string representation, or <code>null</code>
to use the default.
@param useSymbolicDirection indicates if the directions should be output with there
symbols or if there are represented by the signs of the coordinates.
@see #getPreferredStringRepresentation()
@see #toString() | [
"Set",
"the",
"preferred",
"format",
"of",
"the",
"string",
"representation",
"of",
"a",
"geodesic",
"position",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/coordinate/GeodesicPosition.java#L429-L441 | train |
gallandarakhneorg/afc | advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/coordinate/GeodesicPosition.java | GeodesicPosition.getPreferredStringRepresentation | @Pure
public static GeodesicPositionStringRepresentation getPreferredStringRepresentation(boolean allowNullValue) {
final Preferences prefs = Preferences.userNodeForPackage(GeodesicPosition.class);
if (prefs != null) {
final String v = prefs.get("STRING_REPRESENTATION", null); //$NON-NLS-1$
if (v != null && !"".equals(v)) { //$NON-NLS-1$
try {
GeodesicPositionStringRepresentation rep;
try {
rep = GeodesicPositionStringRepresentation.valueOf(v.toUpperCase());
} catch (Throwable exception) {
rep = null;
}
if (rep != null) {
return rep;
}
} catch (AssertionError e) {
throw e;
} catch (Throwable exception) {
//
}
}
}
if (allowNullValue) {
return null;
}
return DEFAULT_STRING_REPRESENTATION;
} | java | @Pure
public static GeodesicPositionStringRepresentation getPreferredStringRepresentation(boolean allowNullValue) {
final Preferences prefs = Preferences.userNodeForPackage(GeodesicPosition.class);
if (prefs != null) {
final String v = prefs.get("STRING_REPRESENTATION", null); //$NON-NLS-1$
if (v != null && !"".equals(v)) { //$NON-NLS-1$
try {
GeodesicPositionStringRepresentation rep;
try {
rep = GeodesicPositionStringRepresentation.valueOf(v.toUpperCase());
} catch (Throwable exception) {
rep = null;
}
if (rep != null) {
return rep;
}
} catch (AssertionError e) {
throw e;
} catch (Throwable exception) {
//
}
}
}
if (allowNullValue) {
return null;
}
return DEFAULT_STRING_REPRESENTATION;
} | [
"@",
"Pure",
"public",
"static",
"GeodesicPositionStringRepresentation",
"getPreferredStringRepresentation",
"(",
"boolean",
"allowNullValue",
")",
"{",
"final",
"Preferences",
"prefs",
"=",
"Preferences",
".",
"userNodeForPackage",
"(",
"GeodesicPosition",
".",
"class",
")",
";",
"if",
"(",
"prefs",
"!=",
"null",
")",
"{",
"final",
"String",
"v",
"=",
"prefs",
".",
"get",
"(",
"\"STRING_REPRESENTATION\"",
",",
"null",
")",
";",
"//$NON-NLS-1$",
"if",
"(",
"v",
"!=",
"null",
"&&",
"!",
"\"\"",
".",
"equals",
"(",
"v",
")",
")",
"{",
"//$NON-NLS-1$",
"try",
"{",
"GeodesicPositionStringRepresentation",
"rep",
";",
"try",
"{",
"rep",
"=",
"GeodesicPositionStringRepresentation",
".",
"valueOf",
"(",
"v",
".",
"toUpperCase",
"(",
")",
")",
";",
"}",
"catch",
"(",
"Throwable",
"exception",
")",
"{",
"rep",
"=",
"null",
";",
"}",
"if",
"(",
"rep",
"!=",
"null",
")",
"{",
"return",
"rep",
";",
"}",
"}",
"catch",
"(",
"AssertionError",
"e",
")",
"{",
"throw",
"e",
";",
"}",
"catch",
"(",
"Throwable",
"exception",
")",
"{",
"//",
"}",
"}",
"}",
"if",
"(",
"allowNullValue",
")",
"{",
"return",
"null",
";",
"}",
"return",
"DEFAULT_STRING_REPRESENTATION",
";",
"}"
] | Replies the preferred format of the string representation
of a geodesic position.
@param allowNullValue indicates if the <code>null</code> value is enable
for output in the replied value.
@return the preferred string representation, or <code>null</code>
to use the default. The <code>null</code> value is replied iff
<var>allowNullValue</var> is <code>true</code> and if the
default configuration is currently used.
@see #setPreferredStringRepresentation(GeodesicPositionStringRepresentation, boolean)
@see #getDirectionSymbolInPreferredStringRepresentation()
@see #toString() | [
"Replies",
"the",
"preferred",
"format",
"of",
"the",
"string",
"representation",
"of",
"a",
"geodesic",
"position",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/coordinate/GeodesicPosition.java#L470-L497 | train |
gallandarakhneorg/afc | advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/coordinate/GeodesicPosition.java | GeodesicPosition.getDirectionSymbolInPreferredStringRepresentation | @Pure
public static boolean getDirectionSymbolInPreferredStringRepresentation() {
final Preferences prefs = Preferences.userNodeForPackage(GeodesicPosition.class);
if (prefs != null) {
return prefs.getBoolean("SYMBOL_IN_STRING_REPRESENTATION", DEFAULT_SYMBOL_IN_STRING_REPRESENTATION); //$NON-NLS-1$
}
return DEFAULT_SYMBOL_IN_STRING_REPRESENTATION;
} | java | @Pure
public static boolean getDirectionSymbolInPreferredStringRepresentation() {
final Preferences prefs = Preferences.userNodeForPackage(GeodesicPosition.class);
if (prefs != null) {
return prefs.getBoolean("SYMBOL_IN_STRING_REPRESENTATION", DEFAULT_SYMBOL_IN_STRING_REPRESENTATION); //$NON-NLS-1$
}
return DEFAULT_SYMBOL_IN_STRING_REPRESENTATION;
} | [
"@",
"Pure",
"public",
"static",
"boolean",
"getDirectionSymbolInPreferredStringRepresentation",
"(",
")",
"{",
"final",
"Preferences",
"prefs",
"=",
"Preferences",
".",
"userNodeForPackage",
"(",
"GeodesicPosition",
".",
"class",
")",
";",
"if",
"(",
"prefs",
"!=",
"null",
")",
"{",
"return",
"prefs",
".",
"getBoolean",
"(",
"\"SYMBOL_IN_STRING_REPRESENTATION\"",
",",
"DEFAULT_SYMBOL_IN_STRING_REPRESENTATION",
")",
";",
"//$NON-NLS-1$",
"}",
"return",
"DEFAULT_SYMBOL_IN_STRING_REPRESENTATION",
";",
"}"
] | Replies if the direction symbol should be
output in the preferred string representation
of a geodesic position.
@return <code>true</code> if the direction symbol should be output,
<code>false</code> if the signs of the coordinates indicate the directions.
@see #setPreferredStringRepresentation(GeodesicPositionStringRepresentation, boolean)
@see #getPreferredStringRepresentation()
@see #toString() | [
"Replies",
"if",
"the",
"direction",
"symbol",
"should",
"be",
"output",
"in",
"the",
"preferred",
"string",
"representation",
"of",
"a",
"geodesic",
"position",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/coordinate/GeodesicPosition.java#L509-L516 | train |
gallandarakhneorg/afc | core/maths/mathtree/src/main/java/org/arakhne/afc/math/tree/AbstractForest.java | AbstractForest.addForestListener | public synchronized void addForestListener(ForestListener listener) {
if (this.listeners == null) {
this.listeners = new ArrayList<>();
}
this.listeners.add(listener);
} | java | public synchronized void addForestListener(ForestListener listener) {
if (this.listeners == null) {
this.listeners = new ArrayList<>();
}
this.listeners.add(listener);
} | [
"public",
"synchronized",
"void",
"addForestListener",
"(",
"ForestListener",
"listener",
")",
"{",
"if",
"(",
"this",
".",
"listeners",
"==",
"null",
")",
"{",
"this",
".",
"listeners",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"}",
"this",
".",
"listeners",
".",
"add",
"(",
"listener",
")",
";",
"}"
] | Add forest listener.
@param listener the listener. | [
"Add",
"forest",
"listener",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/maths/mathtree/src/main/java/org/arakhne/afc/math/tree/AbstractForest.java#L327-L332 | train |
gallandarakhneorg/afc | core/maths/mathtree/src/main/java/org/arakhne/afc/math/tree/AbstractForest.java | AbstractForest.removeForestListener | public synchronized void removeForestListener(ForestListener listener) {
if (this.listeners != null) {
this.listeners.remove(listener);
if (this.listeners.isEmpty()) {
this.listeners = null;
}
}
} | java | public synchronized void removeForestListener(ForestListener listener) {
if (this.listeners != null) {
this.listeners.remove(listener);
if (this.listeners.isEmpty()) {
this.listeners = null;
}
}
} | [
"public",
"synchronized",
"void",
"removeForestListener",
"(",
"ForestListener",
"listener",
")",
"{",
"if",
"(",
"this",
".",
"listeners",
"!=",
"null",
")",
"{",
"this",
".",
"listeners",
".",
"remove",
"(",
"listener",
")",
";",
"if",
"(",
"this",
".",
"listeners",
".",
"isEmpty",
"(",
")",
")",
"{",
"this",
".",
"listeners",
"=",
"null",
";",
"}",
"}",
"}"
] | Remove forest listener.
@param listener the listener. | [
"Remove",
"forest",
"listener",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/maths/mathtree/src/main/java/org/arakhne/afc/math/tree/AbstractForest.java#L338-L345 | train |
gallandarakhneorg/afc | advanced/bootique/bootique-log4j/src/main/java/org/arakhne/afc/bootique/log4j/modules/Log4jIntegrationModule.java | Log4jIntegrationModule.getLog4jIntegrationConfig | @SuppressWarnings("static-method")
@Provides
@Singleton
public Log4jIntegrationConfig getLog4jIntegrationConfig(ConfigurationFactory configFactory, Injector injector) {
final Log4jIntegrationConfig config = Log4jIntegrationConfig.getConfiguration(configFactory);
injector.injectMembers(config);
return config;
} | java | @SuppressWarnings("static-method")
@Provides
@Singleton
public Log4jIntegrationConfig getLog4jIntegrationConfig(ConfigurationFactory configFactory, Injector injector) {
final Log4jIntegrationConfig config = Log4jIntegrationConfig.getConfiguration(configFactory);
injector.injectMembers(config);
return config;
} | [
"@",
"SuppressWarnings",
"(",
"\"static-method\"",
")",
"@",
"Provides",
"@",
"Singleton",
"public",
"Log4jIntegrationConfig",
"getLog4jIntegrationConfig",
"(",
"ConfigurationFactory",
"configFactory",
",",
"Injector",
"injector",
")",
"{",
"final",
"Log4jIntegrationConfig",
"config",
"=",
"Log4jIntegrationConfig",
".",
"getConfiguration",
"(",
"configFactory",
")",
";",
"injector",
".",
"injectMembers",
"(",
"config",
")",
";",
"return",
"config",
";",
"}"
] | Replies the instance of the log4j integration configuration..
@param configFactory accessor to the bootique factory.
@param injector the current injector.
@return the configuration accessor. | [
"Replies",
"the",
"instance",
"of",
"the",
"log4j",
"integration",
"configuration",
".."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/bootique/bootique-log4j/src/main/java/org/arakhne/afc/bootique/log4j/modules/Log4jIntegrationModule.java#L74-L81 | train |
gallandarakhneorg/afc | advanced/bootique/bootique-log4j/src/main/java/org/arakhne/afc/bootique/log4j/modules/Log4jIntegrationModule.java | Log4jIntegrationModule.provideRootLogger | @SuppressWarnings("static-method")
@Singleton
@Provides
public Logger provideRootLogger(ConfigurationFactory configFactory, Provider<Log4jIntegrationConfig> config) {
final Logger root = Logger.getRootLogger();
// Reroute JUL
SLF4JBridgeHandler.removeHandlersForRootLogger();
SLF4JBridgeHandler.install();
final Log4jIntegrationConfig cfg = config.get();
if (!cfg.getUseLog4jConfig()) {
cfg.configureLogger(root);
}
return root;
} | java | @SuppressWarnings("static-method")
@Singleton
@Provides
public Logger provideRootLogger(ConfigurationFactory configFactory, Provider<Log4jIntegrationConfig> config) {
final Logger root = Logger.getRootLogger();
// Reroute JUL
SLF4JBridgeHandler.removeHandlersForRootLogger();
SLF4JBridgeHandler.install();
final Log4jIntegrationConfig cfg = config.get();
if (!cfg.getUseLog4jConfig()) {
cfg.configureLogger(root);
}
return root;
} | [
"@",
"SuppressWarnings",
"(",
"\"static-method\"",
")",
"@",
"Singleton",
"@",
"Provides",
"public",
"Logger",
"provideRootLogger",
"(",
"ConfigurationFactory",
"configFactory",
",",
"Provider",
"<",
"Log4jIntegrationConfig",
">",
"config",
")",
"{",
"final",
"Logger",
"root",
"=",
"Logger",
".",
"getRootLogger",
"(",
")",
";",
"// Reroute JUL",
"SLF4JBridgeHandler",
".",
"removeHandlersForRootLogger",
"(",
")",
";",
"SLF4JBridgeHandler",
".",
"install",
"(",
")",
";",
"final",
"Log4jIntegrationConfig",
"cfg",
"=",
"config",
".",
"get",
"(",
")",
";",
"if",
"(",
"!",
"cfg",
".",
"getUseLog4jConfig",
"(",
")",
")",
"{",
"cfg",
".",
"configureLogger",
"(",
"root",
")",
";",
"}",
"return",
"root",
";",
"}"
] | Provide the root logger.
@param configFactory the factory of configurations.
@param config the logger configuration.
@return the root logger. | [
"Provide",
"the",
"root",
"logger",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/bootique/bootique-log4j/src/main/java/org/arakhne/afc/bootique/log4j/modules/Log4jIntegrationModule.java#L89-L102 | train |
lightblueseas/swing-components | src/main/java/de/alpharogroup/swing/panels/network/NetworkSettingsPanel.java | NetworkSettingsPanel.onInitializeComponents | @Override
protected void onInitializeComponents()
{
lpNoProxy = new JLayeredPane();
lpNoProxy.setBorder(new EtchedBorder(EtchedBorder.RAISED, null, null));
lpHostOrIpaddress = new JLayeredPane();
lpHostOrIpaddress.setBorder(new EtchedBorder(EtchedBorder.RAISED, null, null));
rdbtnManualProxyConfiguration = new JRadioButton("Manual proxy configuration");
rdbtnManualProxyConfiguration.setBounds(6, 7, 313, 23);
lpHostOrIpaddress.add(rdbtnManualProxyConfiguration);
lblHostOrIpaddress = new JLabel("Host or IP-address:");
lblHostOrIpaddress.setBounds(26, 37, 109, 14);
lpHostOrIpaddress.add(lblHostOrIpaddress);
txtHostOrIpaddress = new JTextField();
txtHostOrIpaddress.setBounds(145, 37, 213, 20);
lpHostOrIpaddress.add(txtHostOrIpaddress);
txtHostOrIpaddress.setColumns(10);
lblPort = new JLabel("Port:");
lblPort.setBounds(368, 40, 46, 14);
lpHostOrIpaddress.add(lblPort);
txtPort = new JTextField();
txtPort.setBounds(408, 37, 67, 20);
lpHostOrIpaddress.add(txtPort);
txtPort.setColumns(10);
rdbtnNoProxy = new JRadioButton("Direct connection to internet (no proxy)");
rdbtnNoProxy.setBounds(6, 7, 305, 23);
lpNoProxy.add(rdbtnNoProxy);
lpUseSystemSettings = new JLayeredPane();
lpUseSystemSettings.setBorder(new EtchedBorder(EtchedBorder.RAISED, null, null));
rdbtnUseSystemSettings = new JRadioButton("Use proxy settings from system");
rdbtnUseSystemSettings.setBounds(6, 7, 305, 23);
lpUseSystemSettings.add(rdbtnUseSystemSettings);
// Group the radio buttons.
btngrpProxySettings = new ButtonGroup();
btngrpProxySettings.add(rdbtnNoProxy);
btngrpProxySettings.add(rdbtnManualProxyConfiguration);
chckbxSocksProxy = new JCheckBox("SOCKS-Proxy?");
chckbxSocksProxy.setToolTipText("Is it a SOCKS-Proxy?");
chckbxSocksProxy.setBounds(26, 63, 97, 23);
lpHostOrIpaddress.add(chckbxSocksProxy);
btngrpProxySettings.add(rdbtnUseSystemSettings);
} | java | @Override
protected void onInitializeComponents()
{
lpNoProxy = new JLayeredPane();
lpNoProxy.setBorder(new EtchedBorder(EtchedBorder.RAISED, null, null));
lpHostOrIpaddress = new JLayeredPane();
lpHostOrIpaddress.setBorder(new EtchedBorder(EtchedBorder.RAISED, null, null));
rdbtnManualProxyConfiguration = new JRadioButton("Manual proxy configuration");
rdbtnManualProxyConfiguration.setBounds(6, 7, 313, 23);
lpHostOrIpaddress.add(rdbtnManualProxyConfiguration);
lblHostOrIpaddress = new JLabel("Host or IP-address:");
lblHostOrIpaddress.setBounds(26, 37, 109, 14);
lpHostOrIpaddress.add(lblHostOrIpaddress);
txtHostOrIpaddress = new JTextField();
txtHostOrIpaddress.setBounds(145, 37, 213, 20);
lpHostOrIpaddress.add(txtHostOrIpaddress);
txtHostOrIpaddress.setColumns(10);
lblPort = new JLabel("Port:");
lblPort.setBounds(368, 40, 46, 14);
lpHostOrIpaddress.add(lblPort);
txtPort = new JTextField();
txtPort.setBounds(408, 37, 67, 20);
lpHostOrIpaddress.add(txtPort);
txtPort.setColumns(10);
rdbtnNoProxy = new JRadioButton("Direct connection to internet (no proxy)");
rdbtnNoProxy.setBounds(6, 7, 305, 23);
lpNoProxy.add(rdbtnNoProxy);
lpUseSystemSettings = new JLayeredPane();
lpUseSystemSettings.setBorder(new EtchedBorder(EtchedBorder.RAISED, null, null));
rdbtnUseSystemSettings = new JRadioButton("Use proxy settings from system");
rdbtnUseSystemSettings.setBounds(6, 7, 305, 23);
lpUseSystemSettings.add(rdbtnUseSystemSettings);
// Group the radio buttons.
btngrpProxySettings = new ButtonGroup();
btngrpProxySettings.add(rdbtnNoProxy);
btngrpProxySettings.add(rdbtnManualProxyConfiguration);
chckbxSocksProxy = new JCheckBox("SOCKS-Proxy?");
chckbxSocksProxy.setToolTipText("Is it a SOCKS-Proxy?");
chckbxSocksProxy.setBounds(26, 63, 97, 23);
lpHostOrIpaddress.add(chckbxSocksProxy);
btngrpProxySettings.add(rdbtnUseSystemSettings);
} | [
"@",
"Override",
"protected",
"void",
"onInitializeComponents",
"(",
")",
"{",
"lpNoProxy",
"=",
"new",
"JLayeredPane",
"(",
")",
";",
"lpNoProxy",
".",
"setBorder",
"(",
"new",
"EtchedBorder",
"(",
"EtchedBorder",
".",
"RAISED",
",",
"null",
",",
"null",
")",
")",
";",
"lpHostOrIpaddress",
"=",
"new",
"JLayeredPane",
"(",
")",
";",
"lpHostOrIpaddress",
".",
"setBorder",
"(",
"new",
"EtchedBorder",
"(",
"EtchedBorder",
".",
"RAISED",
",",
"null",
",",
"null",
")",
")",
";",
"rdbtnManualProxyConfiguration",
"=",
"new",
"JRadioButton",
"(",
"\"Manual proxy configuration\"",
")",
";",
"rdbtnManualProxyConfiguration",
".",
"setBounds",
"(",
"6",
",",
"7",
",",
"313",
",",
"23",
")",
";",
"lpHostOrIpaddress",
".",
"add",
"(",
"rdbtnManualProxyConfiguration",
")",
";",
"lblHostOrIpaddress",
"=",
"new",
"JLabel",
"(",
"\"Host or IP-address:\"",
")",
";",
"lblHostOrIpaddress",
".",
"setBounds",
"(",
"26",
",",
"37",
",",
"109",
",",
"14",
")",
";",
"lpHostOrIpaddress",
".",
"add",
"(",
"lblHostOrIpaddress",
")",
";",
"txtHostOrIpaddress",
"=",
"new",
"JTextField",
"(",
")",
";",
"txtHostOrIpaddress",
".",
"setBounds",
"(",
"145",
",",
"37",
",",
"213",
",",
"20",
")",
";",
"lpHostOrIpaddress",
".",
"add",
"(",
"txtHostOrIpaddress",
")",
";",
"txtHostOrIpaddress",
".",
"setColumns",
"(",
"10",
")",
";",
"lblPort",
"=",
"new",
"JLabel",
"(",
"\"Port:\"",
")",
";",
"lblPort",
".",
"setBounds",
"(",
"368",
",",
"40",
",",
"46",
",",
"14",
")",
";",
"lpHostOrIpaddress",
".",
"add",
"(",
"lblPort",
")",
";",
"txtPort",
"=",
"new",
"JTextField",
"(",
")",
";",
"txtPort",
".",
"setBounds",
"(",
"408",
",",
"37",
",",
"67",
",",
"20",
")",
";",
"lpHostOrIpaddress",
".",
"add",
"(",
"txtPort",
")",
";",
"txtPort",
".",
"setColumns",
"(",
"10",
")",
";",
"rdbtnNoProxy",
"=",
"new",
"JRadioButton",
"(",
"\"Direct connection to internet (no proxy)\"",
")",
";",
"rdbtnNoProxy",
".",
"setBounds",
"(",
"6",
",",
"7",
",",
"305",
",",
"23",
")",
";",
"lpNoProxy",
".",
"add",
"(",
"rdbtnNoProxy",
")",
";",
"lpUseSystemSettings",
"=",
"new",
"JLayeredPane",
"(",
")",
";",
"lpUseSystemSettings",
".",
"setBorder",
"(",
"new",
"EtchedBorder",
"(",
"EtchedBorder",
".",
"RAISED",
",",
"null",
",",
"null",
")",
")",
";",
"rdbtnUseSystemSettings",
"=",
"new",
"JRadioButton",
"(",
"\"Use proxy settings from system\"",
")",
";",
"rdbtnUseSystemSettings",
".",
"setBounds",
"(",
"6",
",",
"7",
",",
"305",
",",
"23",
")",
";",
"lpUseSystemSettings",
".",
"add",
"(",
"rdbtnUseSystemSettings",
")",
";",
"// Group the radio buttons.",
"btngrpProxySettings",
"=",
"new",
"ButtonGroup",
"(",
")",
";",
"btngrpProxySettings",
".",
"add",
"(",
"rdbtnNoProxy",
")",
";",
"btngrpProxySettings",
".",
"add",
"(",
"rdbtnManualProxyConfiguration",
")",
";",
"chckbxSocksProxy",
"=",
"new",
"JCheckBox",
"(",
"\"SOCKS-Proxy?\"",
")",
";",
"chckbxSocksProxy",
".",
"setToolTipText",
"(",
"\"Is it a SOCKS-Proxy?\"",
")",
";",
"chckbxSocksProxy",
".",
"setBounds",
"(",
"26",
",",
"63",
",",
"97",
",",
"23",
")",
";",
"lpHostOrIpaddress",
".",
"add",
"(",
"chckbxSocksProxy",
")",
";",
"btngrpProxySettings",
".",
"add",
"(",
"rdbtnUseSystemSettings",
")",
";",
"}"
] | Initialize components. | [
"Initialize",
"components",
"."
] | 4045e85cabd8f0ce985cbfff134c3c9873930c79 | https://github.com/lightblueseas/swing-components/blob/4045e85cabd8f0ce985cbfff134c3c9873930c79/src/main/java/de/alpharogroup/swing/panels/network/NetworkSettingsPanel.java#L115-L168 | train |
gallandarakhneorg/afc | advanced/gis/gisbus/src/main/java/org/arakhne/afc/gis/bus/network/BusNetworkUtilities.java | BusNetworkUtilities.getBusHalts | @Pure
public static Iterator<BusItineraryHalt> getBusHalts(BusLine busLine) {
assert busLine != null;
return new LineHaltIterator(busLine);
} | java | @Pure
public static Iterator<BusItineraryHalt> getBusHalts(BusLine busLine) {
assert busLine != null;
return new LineHaltIterator(busLine);
} | [
"@",
"Pure",
"public",
"static",
"Iterator",
"<",
"BusItineraryHalt",
">",
"getBusHalts",
"(",
"BusLine",
"busLine",
")",
"{",
"assert",
"busLine",
"!=",
"null",
";",
"return",
"new",
"LineHaltIterator",
"(",
"busLine",
")",
";",
"}"
] | Replies all the bus itinerary halts in the given bus line.
@param busLine the bus line.
@return the iterator on bus itinerary halts. | [
"Replies",
"all",
"the",
"bus",
"itinerary",
"halts",
"in",
"the",
"given",
"bus",
"line",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/gisbus/src/main/java/org/arakhne/afc/gis/bus/network/BusNetworkUtilities.java#L71-L75 | train |
gallandarakhneorg/afc | advanced/gis/gisbus/src/main/java/org/arakhne/afc/gis/bus/network/BusNetworkUtilities.java | BusNetworkUtilities.getBusHalts | @Pure
public static Iterator<BusItineraryHalt> getBusHalts(BusNetwork busNetwork) {
assert busNetwork != null;
return new NetworkHaltIterator(busNetwork);
} | java | @Pure
public static Iterator<BusItineraryHalt> getBusHalts(BusNetwork busNetwork) {
assert busNetwork != null;
return new NetworkHaltIterator(busNetwork);
} | [
"@",
"Pure",
"public",
"static",
"Iterator",
"<",
"BusItineraryHalt",
">",
"getBusHalts",
"(",
"BusNetwork",
"busNetwork",
")",
"{",
"assert",
"busNetwork",
"!=",
"null",
";",
"return",
"new",
"NetworkHaltIterator",
"(",
"busNetwork",
")",
";",
"}"
] | Replies all the bus itinerary halts in the given bus network.
@param busNetwork the bus network.
@return the iterator on bus itinerary halts. | [
"Replies",
"all",
"the",
"bus",
"itinerary",
"halts",
"in",
"the",
"given",
"bus",
"network",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/gisbus/src/main/java/org/arakhne/afc/gis/bus/network/BusNetworkUtilities.java#L82-L86 | train |
umeshawasthi/jsr303-validator-plugin | src/main/java/com/github/umeshawasthi/struts2/jsr303/validation/interceptor/JSR303ValidationInterceptor.java | JSR303ValidationInterceptor.getActionMethod | protected Method getActionMethod(Class actionClass, String methodName)
throws NoSuchMethodException {
Method method;
try {
method = actionClass.getMethod(methodName, new Class[0]);
} catch (NoSuchMethodException e) {
// hmm -- OK, try doXxx instead
try {
String altMethodName = "do" + methodName.substring(0, 1).toUpperCase() +
methodName.substring(1);
method = actionClass.getMethod(altMethodName, new Class[0]);
} catch (NoSuchMethodException e1) {
// throw the original one
throw e;
}
}
return method;
} | java | protected Method getActionMethod(Class actionClass, String methodName)
throws NoSuchMethodException {
Method method;
try {
method = actionClass.getMethod(methodName, new Class[0]);
} catch (NoSuchMethodException e) {
// hmm -- OK, try doXxx instead
try {
String altMethodName = "do" + methodName.substring(0, 1).toUpperCase() +
methodName.substring(1);
method = actionClass.getMethod(altMethodName, new Class[0]);
} catch (NoSuchMethodException e1) {
// throw the original one
throw e;
}
}
return method;
} | [
"protected",
"Method",
"getActionMethod",
"(",
"Class",
"actionClass",
",",
"String",
"methodName",
")",
"throws",
"NoSuchMethodException",
"{",
"Method",
"method",
";",
"try",
"{",
"method",
"=",
"actionClass",
".",
"getMethod",
"(",
"methodName",
",",
"new",
"Class",
"[",
"0",
"]",
")",
";",
"}",
"catch",
"(",
"NoSuchMethodException",
"e",
")",
"{",
"// hmm -- OK, try doXxx instead",
"try",
"{",
"String",
"altMethodName",
"=",
"\"do\"",
"+",
"methodName",
".",
"substring",
"(",
"0",
",",
"1",
")",
".",
"toUpperCase",
"(",
")",
"+",
"methodName",
".",
"substring",
"(",
"1",
")",
";",
"method",
"=",
"actionClass",
".",
"getMethod",
"(",
"altMethodName",
",",
"new",
"Class",
"[",
"0",
"]",
")",
";",
"}",
"catch",
"(",
"NoSuchMethodException",
"e1",
")",
"{",
"// throw the original one",
"throw",
"e",
";",
"}",
"}",
"return",
"method",
";",
"}"
] | This is copied from DefaultActionInvocation | [
"This",
"is",
"copied",
"from",
"DefaultActionInvocation"
] | a3dfeafa1c81f96ea559bde65304c3fdbd8b5378 | https://github.com/umeshawasthi/jsr303-validator-plugin/blob/a3dfeafa1c81f96ea559bde65304c3fdbd8b5378/src/main/java/com/github/umeshawasthi/struts2/jsr303/validation/interceptor/JSR303ValidationInterceptor.java#L201-L220 | train |
agmip/translator-dssat | src/main/java/org/agmip/translators/dssat/DssatAFileOutput.java | DssatAFileOutput.cutYear | private String cutYear(String str) {
if (str.length() > 3) {
return str.substring(str.length() - 3, str.length());
} else {
return str;
}
} | java | private String cutYear(String str) {
if (str.length() > 3) {
return str.substring(str.length() - 3, str.length());
} else {
return str;
}
} | [
"private",
"String",
"cutYear",
"(",
"String",
"str",
")",
"{",
"if",
"(",
"str",
".",
"length",
"(",
")",
">",
"3",
")",
"{",
"return",
"str",
".",
"substring",
"(",
"str",
".",
"length",
"(",
")",
"-",
"3",
",",
"str",
".",
"length",
"(",
")",
")",
";",
"}",
"else",
"{",
"return",
"str",
";",
"}",
"}"
] | Remove the 2-bit year number from input date string
@param str input date string
@return the days of year | [
"Remove",
"the",
"2",
"-",
"bit",
"year",
"number",
"from",
"input",
"date",
"string"
] | 4be61d998f106eb7234ea8701b63c3746ae688f4 | https://github.com/agmip/translator-dssat/blob/4be61d998f106eb7234ea8701b63c3746ae688f4/src/main/java/org/agmip/translators/dssat/DssatAFileOutput.java#L170-L176 | train |
gallandarakhneorg/afc | core/maths/mathgeom/tobeincluded/src/d3/continuous/Plane4d.java | Plane4d.getPivot | @Override
public Point3d getPivot() {
Point3d pivot = this.cachedPivot == null ? null : this.cachedPivot.get();
if (pivot==null) {
pivot = getProjection(0., 0., 0.);
this.cachedPivot = new WeakReference<>(pivot);
}
return pivot;
} | java | @Override
public Point3d getPivot() {
Point3d pivot = this.cachedPivot == null ? null : this.cachedPivot.get();
if (pivot==null) {
pivot = getProjection(0., 0., 0.);
this.cachedPivot = new WeakReference<>(pivot);
}
return pivot;
} | [
"@",
"Override",
"public",
"Point3d",
"getPivot",
"(",
")",
"{",
"Point3d",
"pivot",
"=",
"this",
".",
"cachedPivot",
"==",
"null",
"?",
"null",
":",
"this",
".",
"cachedPivot",
".",
"get",
"(",
")",
";",
"if",
"(",
"pivot",
"==",
"null",
")",
"{",
"pivot",
"=",
"getProjection",
"(",
"0.",
",",
"0.",
",",
"0.",
")",
";",
"this",
".",
"cachedPivot",
"=",
"new",
"WeakReference",
"<>",
"(",
"pivot",
")",
";",
"}",
"return",
"pivot",
";",
"}"
] | Replies the pivot point around which the rotation must be done.
@return a reference on the buffered pivot point. | [
"Replies",
"the",
"pivot",
"point",
"around",
"which",
"the",
"rotation",
"must",
"be",
"done",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/maths/mathgeom/tobeincluded/src/d3/continuous/Plane4d.java#L340-L348 | train |
gallandarakhneorg/afc | core/vmutils/src/main/java/org/arakhne/afc/vmutil/FileSystem.java | FileSystem.decodeHTMLEntities | private static String decodeHTMLEntities(String string) {
if (string == null) {
return null;
}
try {
return URLDecoder.decode(string, Charset.defaultCharset().displayName());
} catch (UnsupportedEncodingException exception) {
return string;
}
} | java | private static String decodeHTMLEntities(String string) {
if (string == null) {
return null;
}
try {
return URLDecoder.decode(string, Charset.defaultCharset().displayName());
} catch (UnsupportedEncodingException exception) {
return string;
}
} | [
"private",
"static",
"String",
"decodeHTMLEntities",
"(",
"String",
"string",
")",
"{",
"if",
"(",
"string",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"try",
"{",
"return",
"URLDecoder",
".",
"decode",
"(",
"string",
",",
"Charset",
".",
"defaultCharset",
"(",
")",
".",
"displayName",
"(",
")",
")",
";",
"}",
"catch",
"(",
"UnsupportedEncodingException",
"exception",
")",
"{",
"return",
"string",
";",
"}",
"}"
] | Replace the HTML entities by the current charset characters.
@param string the string to decode.
@return decoded string or {@code s}. | [
"Replace",
"the",
"HTML",
"entities",
"by",
"the",
"current",
"charset",
"characters",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/vmutils/src/main/java/org/arakhne/afc/vmutil/FileSystem.java#L157-L166 | train |
gallandarakhneorg/afc | core/vmutils/src/main/java/org/arakhne/afc/vmutil/FileSystem.java | FileSystem.encodeHTMLEntities | private static String encodeHTMLEntities(String string) {
if (string == null) {
return null;
}
try {
return URLEncoder.encode(string, Charset.defaultCharset().displayName());
} catch (UnsupportedEncodingException exception) {
return string;
}
} | java | private static String encodeHTMLEntities(String string) {
if (string == null) {
return null;
}
try {
return URLEncoder.encode(string, Charset.defaultCharset().displayName());
} catch (UnsupportedEncodingException exception) {
return string;
}
} | [
"private",
"static",
"String",
"encodeHTMLEntities",
"(",
"String",
"string",
")",
"{",
"if",
"(",
"string",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"try",
"{",
"return",
"URLEncoder",
".",
"encode",
"(",
"string",
",",
"Charset",
".",
"defaultCharset",
"(",
")",
".",
"displayName",
"(",
")",
")",
";",
"}",
"catch",
"(",
"UnsupportedEncodingException",
"exception",
")",
"{",
"return",
"string",
";",
"}",
"}"
] | Replace the special characters by HTML entities.
@param string the string to decode.
@return decoded string or {@code s}. | [
"Replace",
"the",
"special",
"characters",
"by",
"HTML",
"entities",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/vmutils/src/main/java/org/arakhne/afc/vmutil/FileSystem.java#L173-L182 | train |
gallandarakhneorg/afc | core/vmutils/src/main/java/org/arakhne/afc/vmutil/FileSystem.java | FileSystem.isJarURL | @Pure
@Inline(value = "URISchemeType.JAR.isURL($1)", imported = {URISchemeType.class})
public static boolean isJarURL(URL url) {
return URISchemeType.JAR.isURL(url);
} | java | @Pure
@Inline(value = "URISchemeType.JAR.isURL($1)", imported = {URISchemeType.class})
public static boolean isJarURL(URL url) {
return URISchemeType.JAR.isURL(url);
} | [
"@",
"Pure",
"@",
"Inline",
"(",
"value",
"=",
"\"URISchemeType.JAR.isURL($1)\"",
",",
"imported",
"=",
"{",
"URISchemeType",
".",
"class",
"}",
")",
"public",
"static",
"boolean",
"isJarURL",
"(",
"URL",
"url",
")",
"{",
"return",
"URISchemeType",
".",
"JAR",
".",
"isURL",
"(",
"url",
")",
";",
"}"
] | Replies if the given URL has a jar scheme.
@param url the URL to test.
@return <code>true</code> if the given URL uses a jar scheme. | [
"Replies",
"if",
"the",
"given",
"URL",
"has",
"a",
"jar",
"scheme",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/vmutils/src/main/java/org/arakhne/afc/vmutil/FileSystem.java#L235-L239 | train |
gallandarakhneorg/afc | core/vmutils/src/main/java/org/arakhne/afc/vmutil/FileSystem.java | FileSystem.getJarURL | @Pure
public static URL getJarURL(URL url) {
if (!isJarURL(url)) {
return null;
}
String path = url.getPath();
final int idx = path.lastIndexOf(JAR_URL_FILE_ROOT);
if (idx >= 0) {
path = path.substring(0, idx);
}
try {
return new URL(path);
} catch (MalformedURLException exception) {
return null;
}
} | java | @Pure
public static URL getJarURL(URL url) {
if (!isJarURL(url)) {
return null;
}
String path = url.getPath();
final int idx = path.lastIndexOf(JAR_URL_FILE_ROOT);
if (idx >= 0) {
path = path.substring(0, idx);
}
try {
return new URL(path);
} catch (MalformedURLException exception) {
return null;
}
} | [
"@",
"Pure",
"public",
"static",
"URL",
"getJarURL",
"(",
"URL",
"url",
")",
"{",
"if",
"(",
"!",
"isJarURL",
"(",
"url",
")",
")",
"{",
"return",
"null",
";",
"}",
"String",
"path",
"=",
"url",
".",
"getPath",
"(",
")",
";",
"final",
"int",
"idx",
"=",
"path",
".",
"lastIndexOf",
"(",
"JAR_URL_FILE_ROOT",
")",
";",
"if",
"(",
"idx",
">=",
"0",
")",
"{",
"path",
"=",
"path",
".",
"substring",
"(",
"0",
",",
"idx",
")",
";",
"}",
"try",
"{",
"return",
"new",
"URL",
"(",
"path",
")",
";",
"}",
"catch",
"(",
"MalformedURLException",
"exception",
")",
"{",
"return",
"null",
";",
"}",
"}"
] | Replies the jar part of the jar-scheme URL.
<p>If the input URL is {@code jar:file:/path1/archive.jar!/path2/file},
the output of this function is {@code file:/path1/archive.jar}.
@param url the URL to test.
@return the URL of the jar file in the given URL, or <code>null</code>
if the given URL does not use jar scheme. | [
"Replies",
"the",
"jar",
"part",
"of",
"the",
"jar",
"-",
"scheme",
"URL",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/vmutils/src/main/java/org/arakhne/afc/vmutil/FileSystem.java#L250-L265 | train |
gallandarakhneorg/afc | core/vmutils/src/main/java/org/arakhne/afc/vmutil/FileSystem.java | FileSystem.getJarFile | @Pure
public static File getJarFile(URL url) {
if (isJarURL(url)) {
final String path = url.getPath();
final int idx = path.lastIndexOf(JAR_URL_FILE_ROOT);
if (idx >= 0) {
return new File(decodeHTMLEntities(path.substring(idx + 1)));
}
}
return null;
} | java | @Pure
public static File getJarFile(URL url) {
if (isJarURL(url)) {
final String path = url.getPath();
final int idx = path.lastIndexOf(JAR_URL_FILE_ROOT);
if (idx >= 0) {
return new File(decodeHTMLEntities(path.substring(idx + 1)));
}
}
return null;
} | [
"@",
"Pure",
"public",
"static",
"File",
"getJarFile",
"(",
"URL",
"url",
")",
"{",
"if",
"(",
"isJarURL",
"(",
"url",
")",
")",
"{",
"final",
"String",
"path",
"=",
"url",
".",
"getPath",
"(",
")",
";",
"final",
"int",
"idx",
"=",
"path",
".",
"lastIndexOf",
"(",
"JAR_URL_FILE_ROOT",
")",
";",
"if",
"(",
"idx",
">=",
"0",
")",
"{",
"return",
"new",
"File",
"(",
"decodeHTMLEntities",
"(",
"path",
".",
"substring",
"(",
"idx",
"+",
"1",
")",
")",
")",
";",
"}",
"}",
"return",
"null",
";",
"}"
] | Replies the file part of the jar-scheme URL.
<p>If the input URL is {@code jar:file:/path1/archive.jar!/path2/file},
the output of this function is {@code /path2/file}.
@param url the URL to test.
@return the file in the given URL, or <code>null</code>
if the given URL does not use jar scheme. | [
"Replies",
"the",
"file",
"part",
"of",
"the",
"jar",
"-",
"scheme",
"URL",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/vmutils/src/main/java/org/arakhne/afc/vmutil/FileSystem.java#L276-L286 | train |
gallandarakhneorg/afc | core/vmutils/src/main/java/org/arakhne/afc/vmutil/FileSystem.java | FileSystem.isCaseSensitiveFilenameSystem | @Pure
public static boolean isCaseSensitiveFilenameSystem() {
switch (OperatingSystem.getCurrentOS()) {
case AIX:
case ANDROID:
case BSD:
case FREEBSD:
case NETBSD:
case OPENBSD:
case LINUX:
case SOLARIS:
case HPUX:
return true;
//$CASES-OMITTED$
default:
return false;
}
} | java | @Pure
public static boolean isCaseSensitiveFilenameSystem() {
switch (OperatingSystem.getCurrentOS()) {
case AIX:
case ANDROID:
case BSD:
case FREEBSD:
case NETBSD:
case OPENBSD:
case LINUX:
case SOLARIS:
case HPUX:
return true;
//$CASES-OMITTED$
default:
return false;
}
} | [
"@",
"Pure",
"public",
"static",
"boolean",
"isCaseSensitiveFilenameSystem",
"(",
")",
"{",
"switch",
"(",
"OperatingSystem",
".",
"getCurrentOS",
"(",
")",
")",
"{",
"case",
"AIX",
":",
"case",
"ANDROID",
":",
"case",
"BSD",
":",
"case",
"FREEBSD",
":",
"case",
"NETBSD",
":",
"case",
"OPENBSD",
":",
"case",
"LINUX",
":",
"case",
"SOLARIS",
":",
"case",
"HPUX",
":",
"return",
"true",
";",
"//$CASES-OMITTED$",
"default",
":",
"return",
"false",
";",
"}",
"}"
] | Replies if the current operating system uses case-sensitive filename.
@return <code>true</code> if the filenames on the current file system are case sensitive,
otherwise <code>false</code> | [
"Replies",
"if",
"the",
"current",
"operating",
"system",
"uses",
"case",
"-",
"sensitive",
"filename",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/vmutils/src/main/java/org/arakhne/afc/vmutil/FileSystem.java#L373-L390 | train |
gallandarakhneorg/afc | core/vmutils/src/main/java/org/arakhne/afc/vmutil/FileSystem.java | FileSystem.extension | @Pure
public static String extension(File filename) {
if (filename == null) {
return null;
}
final String largeBasename = largeBasename(filename);
final int idx = largeBasename.lastIndexOf(getFileExtensionCharacter());
if (idx <= 0) {
return ""; //$NON-NLS-1$
}
return largeBasename.substring(idx);
} | java | @Pure
public static String extension(File filename) {
if (filename == null) {
return null;
}
final String largeBasename = largeBasename(filename);
final int idx = largeBasename.lastIndexOf(getFileExtensionCharacter());
if (idx <= 0) {
return ""; //$NON-NLS-1$
}
return largeBasename.substring(idx);
} | [
"@",
"Pure",
"public",
"static",
"String",
"extension",
"(",
"File",
"filename",
")",
"{",
"if",
"(",
"filename",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"final",
"String",
"largeBasename",
"=",
"largeBasename",
"(",
"filename",
")",
";",
"final",
"int",
"idx",
"=",
"largeBasename",
".",
"lastIndexOf",
"(",
"getFileExtensionCharacter",
"(",
")",
")",
";",
"if",
"(",
"idx",
"<=",
"0",
")",
"{",
"return",
"\"\"",
";",
"//$NON-NLS-1$",
"}",
"return",
"largeBasename",
".",
"substring",
"(",
"idx",
")",
";",
"}"
] | Reply the extension of the specified file.
@param filename is the name to parse.
@return the extension of the specified file
@see #shortBasename(File)
@see #largeBasename(File)
@see #basename(File)
@see #dirname(File)
@see #extensions(File) | [
"Reply",
"the",
"extension",
"of",
"the",
"specified",
"file",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/vmutils/src/main/java/org/arakhne/afc/vmutil/FileSystem.java#L807-L818 | train |
gallandarakhneorg/afc | core/vmutils/src/main/java/org/arakhne/afc/vmutil/FileSystem.java | FileSystem.hasExtension | @Pure
public static boolean hasExtension(File filename, String extension) {
if (filename == null) {
return false;
}
assert extension != null;
String extent = extension;
if (!"".equals(extent) && !extent.startsWith(EXTENSION_SEPARATOR)) { //$NON-NLS-1$
extent = EXTENSION_SEPARATOR + extent;
}
final String ext = extension(filename);
if (ext == null) {
return false;
}
if (isCaseSensitiveFilenameSystem()) {
return ext.equals(extent);
}
return ext.equalsIgnoreCase(extent);
} | java | @Pure
public static boolean hasExtension(File filename, String extension) {
if (filename == null) {
return false;
}
assert extension != null;
String extent = extension;
if (!"".equals(extent) && !extent.startsWith(EXTENSION_SEPARATOR)) { //$NON-NLS-1$
extent = EXTENSION_SEPARATOR + extent;
}
final String ext = extension(filename);
if (ext == null) {
return false;
}
if (isCaseSensitiveFilenameSystem()) {
return ext.equals(extent);
}
return ext.equalsIgnoreCase(extent);
} | [
"@",
"Pure",
"public",
"static",
"boolean",
"hasExtension",
"(",
"File",
"filename",
",",
"String",
"extension",
")",
"{",
"if",
"(",
"filename",
"==",
"null",
")",
"{",
"return",
"false",
";",
"}",
"assert",
"extension",
"!=",
"null",
";",
"String",
"extent",
"=",
"extension",
";",
"if",
"(",
"!",
"\"\"",
".",
"equals",
"(",
"extent",
")",
"&&",
"!",
"extent",
".",
"startsWith",
"(",
"EXTENSION_SEPARATOR",
")",
")",
"{",
"//$NON-NLS-1$",
"extent",
"=",
"EXTENSION_SEPARATOR",
"+",
"extent",
";",
"}",
"final",
"String",
"ext",
"=",
"extension",
"(",
"filename",
")",
";",
"if",
"(",
"ext",
"==",
"null",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"isCaseSensitiveFilenameSystem",
"(",
")",
")",
"{",
"return",
"ext",
".",
"equals",
"(",
"extent",
")",
";",
"}",
"return",
"ext",
".",
"equalsIgnoreCase",
"(",
"extent",
")",
";",
"}"
] | Replies if the specified file has the specified extension.
<p>The test is dependent of the case-sensitive attribute of operating system.
@param filename is the filename to parse
@param extension is the extension to test.
@return <code>true</code> if the given filename has the given extension,
otherwise <code>false</code> | [
"Replies",
"if",
"the",
"specified",
"file",
"has",
"the",
"specified",
"extension",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/vmutils/src/main/java/org/arakhne/afc/vmutil/FileSystem.java#L1137-L1155 | train |
gallandarakhneorg/afc | core/vmutils/src/main/java/org/arakhne/afc/vmutil/FileSystem.java | FileSystem.getSystemConfigurationDirectoryFor | @Pure
public static File getSystemConfigurationDirectoryFor(String software) {
if (software == null || "".equals(software)) { //$NON-NLS-1$
throw new IllegalArgumentException();
}
final OperatingSystem os = OperatingSystem.getCurrentOS();
if (os == OperatingSystem.ANDROID) {
return join(File.listRoots()[0], Android.CONFIGURATION_DIRECTORY,
Android.makeAndroidApplicationName(software));
} else if (os.isUnixCompliant()) {
final File[] roots = File.listRoots();
return join(roots[0], "etc", software); //$NON-NLS-1$
} else if (os == OperatingSystem.WIN) {
File pfDirectory;
for (final File root : File.listRoots()) {
pfDirectory = new File(root, "Program Files"); //$NON-NLS-1$
if (pfDirectory.isDirectory()) {
return new File(root, software);
}
}
}
return null;
} | java | @Pure
public static File getSystemConfigurationDirectoryFor(String software) {
if (software == null || "".equals(software)) { //$NON-NLS-1$
throw new IllegalArgumentException();
}
final OperatingSystem os = OperatingSystem.getCurrentOS();
if (os == OperatingSystem.ANDROID) {
return join(File.listRoots()[0], Android.CONFIGURATION_DIRECTORY,
Android.makeAndroidApplicationName(software));
} else if (os.isUnixCompliant()) {
final File[] roots = File.listRoots();
return join(roots[0], "etc", software); //$NON-NLS-1$
} else if (os == OperatingSystem.WIN) {
File pfDirectory;
for (final File root : File.listRoots()) {
pfDirectory = new File(root, "Program Files"); //$NON-NLS-1$
if (pfDirectory.isDirectory()) {
return new File(root, software);
}
}
}
return null;
} | [
"@",
"Pure",
"public",
"static",
"File",
"getSystemConfigurationDirectoryFor",
"(",
"String",
"software",
")",
"{",
"if",
"(",
"software",
"==",
"null",
"||",
"\"\"",
".",
"equals",
"(",
"software",
")",
")",
"{",
"//$NON-NLS-1$",
"throw",
"new",
"IllegalArgumentException",
"(",
")",
";",
"}",
"final",
"OperatingSystem",
"os",
"=",
"OperatingSystem",
".",
"getCurrentOS",
"(",
")",
";",
"if",
"(",
"os",
"==",
"OperatingSystem",
".",
"ANDROID",
")",
"{",
"return",
"join",
"(",
"File",
".",
"listRoots",
"(",
")",
"[",
"0",
"]",
",",
"Android",
".",
"CONFIGURATION_DIRECTORY",
",",
"Android",
".",
"makeAndroidApplicationName",
"(",
"software",
")",
")",
";",
"}",
"else",
"if",
"(",
"os",
".",
"isUnixCompliant",
"(",
")",
")",
"{",
"final",
"File",
"[",
"]",
"roots",
"=",
"File",
".",
"listRoots",
"(",
")",
";",
"return",
"join",
"(",
"roots",
"[",
"0",
"]",
",",
"\"etc\"",
",",
"software",
")",
";",
"//$NON-NLS-1$",
"}",
"else",
"if",
"(",
"os",
"==",
"OperatingSystem",
".",
"WIN",
")",
"{",
"File",
"pfDirectory",
";",
"for",
"(",
"final",
"File",
"root",
":",
"File",
".",
"listRoots",
"(",
")",
")",
"{",
"pfDirectory",
"=",
"new",
"File",
"(",
"root",
",",
"\"Program Files\"",
")",
";",
"//$NON-NLS-1$",
"if",
"(",
"pfDirectory",
".",
"isDirectory",
"(",
")",
")",
"{",
"return",
"new",
"File",
"(",
"root",
",",
"software",
")",
";",
"}",
"}",
"}",
"return",
"null",
";",
"}"
] | Replies the system configuration directory for the specified software.
<p>On Unix operating systems, the system directory for a
software is by default {@code /etc/software} where {@code software}
is the given parameter (case-sensitive). On Windows® operating systems, the user
directory for a software is by default
{@code C:<span>\</span>Program Files<span>\</span>software}
where {@code software} is the given parameter (case-insensitive).
@param software is the name of the concerned software.
@return the configuration directory of the software for the current user. | [
"Replies",
"the",
"system",
"configuration",
"directory",
"for",
"the",
"specified",
"software",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/vmutils/src/main/java/org/arakhne/afc/vmutil/FileSystem.java#L1752-L1774 | train |
gallandarakhneorg/afc | core/vmutils/src/main/java/org/arakhne/afc/vmutil/FileSystem.java | FileSystem.getSystemSharedLibraryDirectoryNameFor | @Pure
public static String getSystemSharedLibraryDirectoryNameFor(String software) {
final File f = getSystemSharedLibraryDirectoryFor(software);
if (f == null) {
return null;
}
return f.getAbsolutePath();
} | java | @Pure
public static String getSystemSharedLibraryDirectoryNameFor(String software) {
final File f = getSystemSharedLibraryDirectoryFor(software);
if (f == null) {
return null;
}
return f.getAbsolutePath();
} | [
"@",
"Pure",
"public",
"static",
"String",
"getSystemSharedLibraryDirectoryNameFor",
"(",
"String",
"software",
")",
"{",
"final",
"File",
"f",
"=",
"getSystemSharedLibraryDirectoryFor",
"(",
"software",
")",
";",
"if",
"(",
"f",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"return",
"f",
".",
"getAbsolutePath",
"(",
")",
";",
"}"
] | Replies the system shared library directory for the specified software.
<p>On Unix operating systems, the system directory for a
software is by default {@code /usr/lib/software} where {@code software}
is the given parameter (case-sensitive). On Windows® operating systems, the user
directory for a software is by default
{@code C:<span>\</span>Program Files<span>\</span>software}
where {@code software} is the given parameter (case-insensitive).
@param software is the name of the concerned software.
@return the configuration directory of the software for the current user. | [
"Replies",
"the",
"system",
"shared",
"library",
"directory",
"for",
"the",
"specified",
"software",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/vmutils/src/main/java/org/arakhne/afc/vmutil/FileSystem.java#L1845-L1852 | train |
gallandarakhneorg/afc | core/vmutils/src/main/java/org/arakhne/afc/vmutil/FileSystem.java | FileSystem.convertStringToFile | @Pure
public static File convertStringToFile(String filename) {
if (filename == null || "".equals(filename)) { //$NON-NLS-1$
return null;
}
if (isWindowsNativeFilename(filename)) {
return normalizeWindowsNativeFilename(filename);
}
// Test for malformed filenames.
return new File(extractLocalPath(filename).replaceAll(
Pattern.quote(UNIX_SEPARATOR_STRING),
Matcher.quoteReplacement(File.separator)));
} | java | @Pure
public static File convertStringToFile(String filename) {
if (filename == null || "".equals(filename)) { //$NON-NLS-1$
return null;
}
if (isWindowsNativeFilename(filename)) {
return normalizeWindowsNativeFilename(filename);
}
// Test for malformed filenames.
return new File(extractLocalPath(filename).replaceAll(
Pattern.quote(UNIX_SEPARATOR_STRING),
Matcher.quoteReplacement(File.separator)));
} | [
"@",
"Pure",
"public",
"static",
"File",
"convertStringToFile",
"(",
"String",
"filename",
")",
"{",
"if",
"(",
"filename",
"==",
"null",
"||",
"\"\"",
".",
"equals",
"(",
"filename",
")",
")",
"{",
"//$NON-NLS-1$",
"return",
"null",
";",
"}",
"if",
"(",
"isWindowsNativeFilename",
"(",
"filename",
")",
")",
"{",
"return",
"normalizeWindowsNativeFilename",
"(",
"filename",
")",
";",
"}",
"// Test for malformed filenames.",
"return",
"new",
"File",
"(",
"extractLocalPath",
"(",
"filename",
")",
".",
"replaceAll",
"(",
"Pattern",
".",
"quote",
"(",
"UNIX_SEPARATOR_STRING",
")",
",",
"Matcher",
".",
"quoteReplacement",
"(",
"File",
".",
"separator",
")",
")",
")",
";",
"}"
] | Convert a string which represents a local file into a File.
<p>This function supports the naming standards coming for the different
operating systems.
@param filename the filename.
@return the file, or <code>null</code> if the given filename is <code>null</code> or empty.
@since 13.0 | [
"Convert",
"a",
"string",
"which",
"represents",
"a",
"local",
"file",
"into",
"a",
"File",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/vmutils/src/main/java/org/arakhne/afc/vmutil/FileSystem.java#L1863-L1875 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.