repo stringlengths 7 58 | path stringlengths 12 218 | func_name stringlengths 3 140 | original_string stringlengths 73 34.1k | language stringclasses 1 value | code stringlengths 73 34.1k | code_tokens list | docstring stringlengths 3 16k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 105 339 | partition stringclasses 1 value |
|---|---|---|---|---|---|---|---|---|---|---|---|
gallandarakhneorg/afc | advanced/attributes/src/main/java/org/arakhne/afc/attrs/attr/AttributeValueImpl.java | AttributeValueImpl.parse | @Pure
@SuppressWarnings("checkstyle:cyclomaticcomplexity")
public static AttributeValueImpl parse(String text) {
final AttributeValueImpl value = new AttributeValueImpl(text);
if (text != null && !text.isEmpty()) {
Object binValue;
for (final AttributeType type : AttributeType.values()) {
try {
binValue = null;
switch (type) {
case BOOLEAN:
binValue = value.getBoolean();
break;
case DATE:
binValue = value.getDate();
break;
case ENUMERATION:
binValue = value.getEnumeration();
break;
case INET_ADDRESS:
binValue = value.getInetAddress();
break;
case INTEGER:
binValue = value.getInteger();
break;
case OBJECT:
binValue = value.getJavaObject();
break;
case POINT:
binValue = parsePoint((String) value.value, true);
break;
case POINT3D:
binValue = parsePoint3D((String) value.value, true);
break;
case POLYLINE:
binValue = parsePolyline((String) value.value, true);
break;
case POLYLINE3D:
binValue = parsePolyline3D((String) value.value, true);
break;
case REAL:
binValue = value.getReal();
break;
case STRING:
binValue = value.getString();
break;
case TIMESTAMP:
binValue = value.getTimestamp();
break;
case TYPE:
binValue = value.getJavaClass();
break;
case URI:
binValue = parseURI((String) value.value);
break;
case URL:
binValue = value.getURL();
break;
case UUID:
binValue = parseUUID((String) value.value);
break;
default:
//
}
if (binValue != null) {
return new AttributeValueImpl(type, binValue);
}
} catch (Throwable exception) {
//
}
}
}
return value;
} | java | @Pure
@SuppressWarnings("checkstyle:cyclomaticcomplexity")
public static AttributeValueImpl parse(String text) {
final AttributeValueImpl value = new AttributeValueImpl(text);
if (text != null && !text.isEmpty()) {
Object binValue;
for (final AttributeType type : AttributeType.values()) {
try {
binValue = null;
switch (type) {
case BOOLEAN:
binValue = value.getBoolean();
break;
case DATE:
binValue = value.getDate();
break;
case ENUMERATION:
binValue = value.getEnumeration();
break;
case INET_ADDRESS:
binValue = value.getInetAddress();
break;
case INTEGER:
binValue = value.getInteger();
break;
case OBJECT:
binValue = value.getJavaObject();
break;
case POINT:
binValue = parsePoint((String) value.value, true);
break;
case POINT3D:
binValue = parsePoint3D((String) value.value, true);
break;
case POLYLINE:
binValue = parsePolyline((String) value.value, true);
break;
case POLYLINE3D:
binValue = parsePolyline3D((String) value.value, true);
break;
case REAL:
binValue = value.getReal();
break;
case STRING:
binValue = value.getString();
break;
case TIMESTAMP:
binValue = value.getTimestamp();
break;
case TYPE:
binValue = value.getJavaClass();
break;
case URI:
binValue = parseURI((String) value.value);
break;
case URL:
binValue = value.getURL();
break;
case UUID:
binValue = parseUUID((String) value.value);
break;
default:
//
}
if (binValue != null) {
return new AttributeValueImpl(type, binValue);
}
} catch (Throwable exception) {
//
}
}
}
return value;
} | [
"@",
"Pure",
"@",
"SuppressWarnings",
"(",
"\"checkstyle:cyclomaticcomplexity\"",
")",
"public",
"static",
"AttributeValueImpl",
"parse",
"(",
"String",
"text",
")",
"{",
"final",
"AttributeValueImpl",
"value",
"=",
"new",
"AttributeValueImpl",
"(",
"text",
")",
";"... | Replies the best attribute value that is representing
the given text.
@param text the text.
@return the attribute value, never <code>null</code>. | [
"Replies",
"the",
"best",
"attribute",
"value",
"that",
"is",
"representing",
"the",
"given",
"text",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/attributes/src/main/java/org/arakhne/afc/attrs/attr/AttributeValueImpl.java#L380-L453 | train |
gallandarakhneorg/afc | advanced/attributes/src/main/java/org/arakhne/afc/attrs/attr/AttributeValueImpl.java | AttributeValueImpl.compareValues | @Pure
public static int compareValues(AttributeValue arg0, AttributeValue arg1) {
if (arg0 == arg1) {
return 0;
}
if (arg0 == null) {
return Integer.MAX_VALUE;
}
if (arg1 == null) {
return Integer.MIN_VALUE;
}
Object v0;
Object v1;
try {
v0 = arg0.getValue();
} catch (Exception exception) {
v0 = null;
}
try {
v1 = arg1.getValue();
} catch (Exception exception) {
v1 = null;
}
return compareRawValues(v0, v1);
} | java | @Pure
public static int compareValues(AttributeValue arg0, AttributeValue arg1) {
if (arg0 == arg1) {
return 0;
}
if (arg0 == null) {
return Integer.MAX_VALUE;
}
if (arg1 == null) {
return Integer.MIN_VALUE;
}
Object v0;
Object v1;
try {
v0 = arg0.getValue();
} catch (Exception exception) {
v0 = null;
}
try {
v1 = arg1.getValue();
} catch (Exception exception) {
v1 = null;
}
return compareRawValues(v0, v1);
} | [
"@",
"Pure",
"public",
"static",
"int",
"compareValues",
"(",
"AttributeValue",
"arg0",
",",
"AttributeValue",
"arg1",
")",
"{",
"if",
"(",
"arg0",
"==",
"arg1",
")",
"{",
"return",
"0",
";",
"}",
"if",
"(",
"arg0",
"==",
"null",
")",
"{",
"return",
... | Compare the two specified values.
@param arg0 first value.
@param arg1 second value.
@return replies a negative value if {@code arg0} is lesser than
{@code arg1}, a positive value if {@code arg0} is greater than
{@code arg1}, or <code>0</code> if they are equal.
@see AttributeValueComparator | [
"Compare",
"the",
"two",
"specified",
"values",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/attributes/src/main/java/org/arakhne/afc/attrs/attr/AttributeValueImpl.java#L464-L492 | train |
gallandarakhneorg/afc | advanced/attributes/src/main/java/org/arakhne/afc/attrs/attr/AttributeValueImpl.java | AttributeValueImpl.compareRawValues | @Pure
@SuppressWarnings({"unchecked", "rawtypes", "checkstyle:returncount", "checkstyle:npathcomplexity"})
private static int compareRawValues(Object arg0, Object arg1) {
if (arg0 == arg1) {
return 0;
}
if (arg0 == null) {
return Integer.MAX_VALUE;
}
if (arg1 == null) {
return Integer.MIN_VALUE;
}
if ((arg0 instanceof Number) && (arg1 instanceof Number)) {
return Double.compare(((Number) arg0).doubleValue(), ((Number) arg1).doubleValue());
}
try {
if (arg0 instanceof Comparable<?>) {
return ((Comparable) arg0).compareTo(arg1);
}
} catch (RuntimeException exception) {
//
}
try {
if (arg1 instanceof Comparable<?>) {
return -((Comparable) arg1).compareTo(arg0);
}
} catch (RuntimeException exception) {
//
}
if (arg0.equals(arg1)) {
return 0;
}
final String sv0 = arg0.toString();
final String sv1 = arg1.toString();
if (sv0 == sv1) {
return 0;
}
if (sv0 == null) {
return Integer.MAX_VALUE;
}
if (sv1 == null) {
return Integer.MIN_VALUE;
}
return sv0.compareTo(sv1);
} | java | @Pure
@SuppressWarnings({"unchecked", "rawtypes", "checkstyle:returncount", "checkstyle:npathcomplexity"})
private static int compareRawValues(Object arg0, Object arg1) {
if (arg0 == arg1) {
return 0;
}
if (arg0 == null) {
return Integer.MAX_VALUE;
}
if (arg1 == null) {
return Integer.MIN_VALUE;
}
if ((arg0 instanceof Number) && (arg1 instanceof Number)) {
return Double.compare(((Number) arg0).doubleValue(), ((Number) arg1).doubleValue());
}
try {
if (arg0 instanceof Comparable<?>) {
return ((Comparable) arg0).compareTo(arg1);
}
} catch (RuntimeException exception) {
//
}
try {
if (arg1 instanceof Comparable<?>) {
return -((Comparable) arg1).compareTo(arg0);
}
} catch (RuntimeException exception) {
//
}
if (arg0.equals(arg1)) {
return 0;
}
final String sv0 = arg0.toString();
final String sv1 = arg1.toString();
if (sv0 == sv1) {
return 0;
}
if (sv0 == null) {
return Integer.MAX_VALUE;
}
if (sv1 == null) {
return Integer.MIN_VALUE;
}
return sv0.compareTo(sv1);
} | [
"@",
"Pure",
"@",
"SuppressWarnings",
"(",
"{",
"\"unchecked\"",
",",
"\"rawtypes\"",
",",
"\"checkstyle:returncount\"",
",",
"\"checkstyle:npathcomplexity\"",
"}",
")",
"private",
"static",
"int",
"compareRawValues",
"(",
"Object",
"arg0",
",",
"Object",
"arg1",
")... | Compare the internal objects of two specified values.
@param arg0 first value.
@param arg1 second value.
@return replies a negative value if {@code arg0} is lesser than
{@code arg1}, a positive value if {@code arg0} is greater than
{@code arg1}, or <code>0</code> if they are equal. | [
"Compare",
"the",
"internal",
"objects",
"of",
"two",
"specified",
"values",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/attributes/src/main/java/org/arakhne/afc/attrs/attr/AttributeValueImpl.java#L502-L553 | train |
gallandarakhneorg/afc | advanced/attributes/src/main/java/org/arakhne/afc/attrs/attr/AttributeValueImpl.java | AttributeValueImpl.setInternalValue | protected void setInternalValue(Object value, AttributeType type) {
this.value = value;
this.assigned = this.value != null;
this.type = type;
} | java | protected void setInternalValue(Object value, AttributeType type) {
this.value = value;
this.assigned = this.value != null;
this.type = type;
} | [
"protected",
"void",
"setInternalValue",
"(",
"Object",
"value",
",",
"AttributeType",
"type",
")",
"{",
"this",
".",
"value",
"=",
"value",
";",
"this",
".",
"assigned",
"=",
"this",
".",
"value",
"!=",
"null",
";",
"this",
".",
"type",
"=",
"type",
"... | Set this value with the content of the specified one.
<p>The type of the attribute will be NOT detected from the type
of the object. It means that it will be equal to the given type,
even if the given value is incompatible.
The given value must be compatible with internal representation
of the attribute implementation.
@param value is the raw value to put inside this attribute value.
@param type is the type of the value. | [
"Set",
"this",
"value",
"with",
"the",
"content",
"of",
"the",
"specified",
"one",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/attributes/src/main/java/org/arakhne/afc/attrs/attr/AttributeValueImpl.java#L849-L853 | train |
gallandarakhneorg/afc | advanced/attributes/src/main/java/org/arakhne/afc/attrs/attr/AttributeValueImpl.java | AttributeValueImpl.extractDate | private static Date extractDate(String text, Locale locale) {
DateFormat fmt;
for (int style = 0; style <= 3; ++style) {
// Date and time parsing
for (int style2 = 0; style2 <= 3; ++style2) {
fmt = DateFormat.getDateTimeInstance(style, style2, locale);
try {
return fmt.parse(text);
} catch (ParseException exception) {
//
}
}
// Date only parsing
fmt = DateFormat.getDateInstance(style, locale);
try {
return fmt.parse(text);
} catch (ParseException exception) {
//
}
// Time only parsing
fmt = DateFormat.getTimeInstance(style, locale);
try {
return fmt.parse(text);
} catch (ParseException exception) {
//
}
}
return null;
} | java | private static Date extractDate(String text, Locale locale) {
DateFormat fmt;
for (int style = 0; style <= 3; ++style) {
// Date and time parsing
for (int style2 = 0; style2 <= 3; ++style2) {
fmt = DateFormat.getDateTimeInstance(style, style2, locale);
try {
return fmt.parse(text);
} catch (ParseException exception) {
//
}
}
// Date only parsing
fmt = DateFormat.getDateInstance(style, locale);
try {
return fmt.parse(text);
} catch (ParseException exception) {
//
}
// Time only parsing
fmt = DateFormat.getTimeInstance(style, locale);
try {
return fmt.parse(text);
} catch (ParseException exception) {
//
}
}
return null;
} | [
"private",
"static",
"Date",
"extractDate",
"(",
"String",
"text",
",",
"Locale",
"locale",
")",
"{",
"DateFormat",
"fmt",
";",
"for",
"(",
"int",
"style",
"=",
"0",
";",
"style",
"<=",
"3",
";",
"++",
"style",
")",
"{",
"// Date and time parsing",
"for"... | Parse a date according to the specified locale. | [
"Parse",
"a",
"date",
"according",
"to",
"the",
"specified",
"locale",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/attributes/src/main/java/org/arakhne/afc/attrs/attr/AttributeValueImpl.java#L1111-L1139 | train |
gallandarakhneorg/afc | advanced/dbasefile/src/main/java/org/arakhne/afc/io/dbase/DBaseFileFilter.java | DBaseFileFilter.isDbaseFile | @Pure
public static boolean isDbaseFile(File file) {
return FileType.isContentType(
file,
MimeName.MIME_DBASE_FILE.getMimeConstant());
} | java | @Pure
public static boolean isDbaseFile(File file) {
return FileType.isContentType(
file,
MimeName.MIME_DBASE_FILE.getMimeConstant());
} | [
"@",
"Pure",
"public",
"static",
"boolean",
"isDbaseFile",
"(",
"File",
"file",
")",
"{",
"return",
"FileType",
".",
"isContentType",
"(",
"file",
",",
"MimeName",
".",
"MIME_DBASE_FILE",
".",
"getMimeConstant",
"(",
")",
")",
";",
"}"
] | Replies if the specified file content is a dBase file.
@param file is the file to test
@return <code>true</code> if the given file contains dBase data,
othersiwe <code>false</code>. | [
"Replies",
"if",
"the",
"specified",
"file",
"content",
"is",
"a",
"dBase",
"file",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/dbasefile/src/main/java/org/arakhne/afc/io/dbase/DBaseFileFilter.java#L83-L88 | train |
gallandarakhneorg/afc | advanced/gis/giscorefx/src/main/java/org/arakhne/afc/gis/ui/drawers/AbstractMapCircleDrawer.java | AbstractMapCircleDrawer.stroke | protected void stroke(ZoomableGraphicsContext gc, T element) {
final double radius = element.getRadius();
final double diameter = radius * radius;
final double minx = element.getX() - radius;
final double miny = element.getY() - radius;
gc.strokeOval(minx, miny, diameter, diameter);
} | java | protected void stroke(ZoomableGraphicsContext gc, T element) {
final double radius = element.getRadius();
final double diameter = radius * radius;
final double minx = element.getX() - radius;
final double miny = element.getY() - radius;
gc.strokeOval(minx, miny, diameter, diameter);
} | [
"protected",
"void",
"stroke",
"(",
"ZoomableGraphicsContext",
"gc",
",",
"T",
"element",
")",
"{",
"final",
"double",
"radius",
"=",
"element",
".",
"getRadius",
"(",
")",
";",
"final",
"double",
"diameter",
"=",
"radius",
"*",
"radius",
";",
"final",
"do... | Stroke the circle.
@param gc the graphics context that must be used for drawing.
@param element the map element. | [
"Stroke",
"the",
"circle",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/giscorefx/src/main/java/org/arakhne/afc/gis/ui/drawers/AbstractMapCircleDrawer.java#L42-L48 | train |
gallandarakhneorg/afc | advanced/gis/giscorefx/src/main/java/org/arakhne/afc/gis/ui/drawers/AbstractMapCircleDrawer.java | AbstractMapCircleDrawer.fill | protected void fill(ZoomableGraphicsContext gc, T element) {
final double radius = element.getRadius();
final double diameter = radius * radius;
final double minx = element.getX() - radius;
final double miny = element.getY() - radius;
gc.fillOval(minx, miny, diameter, diameter);
} | java | protected void fill(ZoomableGraphicsContext gc, T element) {
final double radius = element.getRadius();
final double diameter = radius * radius;
final double minx = element.getX() - radius;
final double miny = element.getY() - radius;
gc.fillOval(minx, miny, diameter, diameter);
} | [
"protected",
"void",
"fill",
"(",
"ZoomableGraphicsContext",
"gc",
",",
"T",
"element",
")",
"{",
"final",
"double",
"radius",
"=",
"element",
".",
"getRadius",
"(",
")",
";",
"final",
"double",
"diameter",
"=",
"radius",
"*",
"radius",
";",
"final",
"doub... | Fill the circle.
@param gc the graphics context that must be used for drawing.
@param element the map element. | [
"Fill",
"the",
"circle",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/giscorefx/src/main/java/org/arakhne/afc/gis/ui/drawers/AbstractMapCircleDrawer.java#L55-L61 | train |
gallandarakhneorg/afc | advanced/gis/gisbus/src/main/java/org/arakhne/afc/gis/bus/network/BusItineraryHalt.java | BusItineraryHalt.getFirstFreeBushaltName | @Pure
public static String getFirstFreeBushaltName(BusItinerary busItinerary) {
if (busItinerary == null) {
return null;
}
int nb = busItinerary.size();
String name;
do {
++nb;
name = Locale.getString("NAME_TEMPLATE", Integer.toString(nb)); //$NON-NLS-1$
}
while (busItinerary.getBusHalt(name) != null);
return name;
} | java | @Pure
public static String getFirstFreeBushaltName(BusItinerary busItinerary) {
if (busItinerary == null) {
return null;
}
int nb = busItinerary.size();
String name;
do {
++nb;
name = Locale.getString("NAME_TEMPLATE", Integer.toString(nb)); //$NON-NLS-1$
}
while (busItinerary.getBusHalt(name) != null);
return name;
} | [
"@",
"Pure",
"public",
"static",
"String",
"getFirstFreeBushaltName",
"(",
"BusItinerary",
"busItinerary",
")",
"{",
"if",
"(",
"busItinerary",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"int",
"nb",
"=",
"busItinerary",
".",
"size",
"(",
")",
";"... | Replies a bus halt name that was not exist in the specified
bus itinerary.
@param busItinerary is the bus itinerary for which a free bus halt name may be computed.
@return a name suitable for bus halt. | [
"Replies",
"a",
"bus",
"halt",
"name",
"that",
"was",
"not",
"exist",
"in",
"the",
"specified",
"bus",
"itinerary",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/gisbus/src/main/java/org/arakhne/afc/gis/bus/network/BusItineraryHalt.java#L184-L197 | train |
gallandarakhneorg/afc | advanced/gis/gisbus/src/main/java/org/arakhne/afc/gis/bus/network/BusItineraryHalt.java | BusItineraryHalt.setBusStop | public boolean setBusStop(BusStop busStop) {
final BusStop old = getBusStop();
if ((busStop == null && old != null)
|| (busStop != null && !busStop.equals(old))) {
if (old != null) {
old.removeBusHalt(this);
}
this.busStop = busStop == null ? null : new WeakReference<>(busStop);
if (busStop != null) {
busStop.addBusHalt(this);
}
clearPositionBuffers();
fireShapeChanged();
checkPrimitiveValidity();
return true;
}
return false;
} | java | public boolean setBusStop(BusStop busStop) {
final BusStop old = getBusStop();
if ((busStop == null && old != null)
|| (busStop != null && !busStop.equals(old))) {
if (old != null) {
old.removeBusHalt(this);
}
this.busStop = busStop == null ? null : new WeakReference<>(busStop);
if (busStop != null) {
busStop.addBusHalt(this);
}
clearPositionBuffers();
fireShapeChanged();
checkPrimitiveValidity();
return true;
}
return false;
} | [
"public",
"boolean",
"setBusStop",
"(",
"BusStop",
"busStop",
")",
"{",
"final",
"BusStop",
"old",
"=",
"getBusStop",
"(",
")",
";",
"if",
"(",
"(",
"busStop",
"==",
"null",
"&&",
"old",
"!=",
"null",
")",
"||",
"(",
"busStop",
"!=",
"null",
"&&",
"!... | Set the bus stop associated to this halt.
@param busStop is the bus stop associated to this halt,
or <code>null</code> if this halt is not associated to
a bus stop.
@return <code>true</code> if the bus stop was correctly set,
otherwise <code>false</code>. | [
"Set",
"the",
"bus",
"stop",
"associated",
"to",
"this",
"halt",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/gisbus/src/main/java/org/arakhne/afc/gis/bus/network/BusItineraryHalt.java#L315-L332 | train |
gallandarakhneorg/afc | advanced/gis/gisbus/src/main/java/org/arakhne/afc/gis/bus/network/BusItineraryHalt.java | BusItineraryHalt.getRoadSegment | @Pure
public RoadSegment getRoadSegment() {
final BusItinerary itinerary = getContainer();
if (itinerary != null && this.roadSegmentIndex >= 0 && this.roadSegmentIndex < itinerary.getRoadSegmentCount()) {
return itinerary.getRoadSegmentAt(this.roadSegmentIndex);
}
return null;
} | java | @Pure
public RoadSegment getRoadSegment() {
final BusItinerary itinerary = getContainer();
if (itinerary != null && this.roadSegmentIndex >= 0 && this.roadSegmentIndex < itinerary.getRoadSegmentCount()) {
return itinerary.getRoadSegmentAt(this.roadSegmentIndex);
}
return null;
} | [
"@",
"Pure",
"public",
"RoadSegment",
"getRoadSegment",
"(",
")",
"{",
"final",
"BusItinerary",
"itinerary",
"=",
"getContainer",
"(",
")",
";",
"if",
"(",
"itinerary",
"!=",
"null",
"&&",
"this",
".",
"roadSegmentIndex",
">=",
"0",
"&&",
"this",
".",
"roa... | Replies the road segment on which this bus halt was.
@return the road segment | [
"Replies",
"the",
"road",
"segment",
"on",
"which",
"this",
"bus",
"halt",
"was",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/gisbus/src/main/java/org/arakhne/afc/gis/bus/network/BusItineraryHalt.java#L418-L425 | train |
gallandarakhneorg/afc | advanced/gis/gisbus/src/main/java/org/arakhne/afc/gis/bus/network/BusItineraryHalt.java | BusItineraryHalt.getRoadSegmentDirection | @Pure
public Direction1D getRoadSegmentDirection() {
final BusItinerary itinerary = getContainer();
if (itinerary != null && this.roadSegmentIndex >= 0 && this.roadSegmentIndex < itinerary.getRoadSegmentCount()) {
return itinerary.getRoadSegmentDirection(this.roadSegmentIndex);
}
return null;
} | java | @Pure
public Direction1D getRoadSegmentDirection() {
final BusItinerary itinerary = getContainer();
if (itinerary != null && this.roadSegmentIndex >= 0 && this.roadSegmentIndex < itinerary.getRoadSegmentCount()) {
return itinerary.getRoadSegmentDirection(this.roadSegmentIndex);
}
return null;
} | [
"@",
"Pure",
"public",
"Direction1D",
"getRoadSegmentDirection",
"(",
")",
"{",
"final",
"BusItinerary",
"itinerary",
"=",
"getContainer",
"(",
")",
";",
"if",
"(",
"itinerary",
"!=",
"null",
"&&",
"this",
".",
"roadSegmentIndex",
">=",
"0",
"&&",
"this",
".... | Replies on which direction the bus halt is located on the road segment.
@return {@link Direction1D#SEGMENT_DIRECTION} or {@link Direction1D#REVERTED_DIRECTION}. | [
"Replies",
"on",
"which",
"direction",
"the",
"bus",
"halt",
"is",
"located",
"on",
"the",
"road",
"segment",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/gisbus/src/main/java/org/arakhne/afc/gis/bus/network/BusItineraryHalt.java#L480-L487 | train |
gallandarakhneorg/afc | advanced/gis/gisbus/src/main/java/org/arakhne/afc/gis/bus/network/BusItineraryHalt.java | BusItineraryHalt.setType | public void setType(BusItineraryHaltType type) {
if (type != null && type != this.type) {
this.type = type;
firePrimitiveChanged();
}
} | java | public void setType(BusItineraryHaltType type) {
if (type != null && type != this.type) {
this.type = type;
firePrimitiveChanged();
}
} | [
"public",
"void",
"setType",
"(",
"BusItineraryHaltType",
"type",
")",
"{",
"if",
"(",
"type",
"!=",
"null",
"&&",
"type",
"!=",
"this",
".",
"type",
")",
"{",
"this",
".",
"type",
"=",
"type",
";",
"firePrimitiveChanged",
"(",
")",
";",
"}",
"}"
] | Set the type of the bus halt.
@param type the type of the bus. | [
"Set",
"the",
"type",
"of",
"the",
"bus",
"halt",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/gisbus/src/main/java/org/arakhne/afc/gis/bus/network/BusItineraryHalt.java#L504-L509 | train |
gallandarakhneorg/afc | advanced/gis/gisbus/src/main/java/org/arakhne/afc/gis/bus/network/BusItineraryHalt.java | BusItineraryHalt.insideBusHub | @Pure
public boolean insideBusHub() {
final BusStop busStop = getBusStop();
if (busStop != null) {
return busStop.insideBusHub();
}
return false;
} | java | @Pure
public boolean insideBusHub() {
final BusStop busStop = getBusStop();
if (busStop != null) {
return busStop.insideBusHub();
}
return false;
} | [
"@",
"Pure",
"public",
"boolean",
"insideBusHub",
"(",
")",
"{",
"final",
"BusStop",
"busStop",
"=",
"getBusStop",
"(",
")",
";",
"if",
"(",
"busStop",
"!=",
"null",
")",
"{",
"return",
"busStop",
".",
"insideBusHub",
"(",
")",
";",
"}",
"return",
"fal... | Replies if this bus halt is inside a hub throught an associated bus stop.
@return <code>true</code> if this bus stop is inside a hub,
otherwise <code>false</code> | [
"Replies",
"if",
"this",
"bus",
"halt",
"is",
"inside",
"a",
"hub",
"throught",
"an",
"associated",
"bus",
"stop",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/gisbus/src/main/java/org/arakhne/afc/gis/bus/network/BusItineraryHalt.java#L585-L592 | train |
gallandarakhneorg/afc | advanced/gis/gisbus/src/main/java/org/arakhne/afc/gis/bus/network/BusItineraryHalt.java | BusItineraryHalt.busHubs | @Pure
public Iterable<BusHub> busHubs() {
final BusStop busStop = getBusStop();
if (busStop != null) {
return busStop.busHubs();
}
return Collections.emptyList();
} | java | @Pure
public Iterable<BusHub> busHubs() {
final BusStop busStop = getBusStop();
if (busStop != null) {
return busStop.busHubs();
}
return Collections.emptyList();
} | [
"@",
"Pure",
"public",
"Iterable",
"<",
"BusHub",
">",
"busHubs",
"(",
")",
"{",
"final",
"BusStop",
"busStop",
"=",
"getBusStop",
"(",
")",
";",
"if",
"(",
"busStop",
"!=",
"null",
")",
"{",
"return",
"busStop",
".",
"busHubs",
"(",
")",
";",
"}",
... | Replies the hubs in which this bus halt is located in
throught an associated bus stop.
@return the hubs | [
"Replies",
"the",
"hubs",
"in",
"which",
"this",
"bus",
"halt",
"is",
"located",
"in",
"throught",
"an",
"associated",
"bus",
"stop",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/gisbus/src/main/java/org/arakhne/afc/gis/bus/network/BusItineraryHalt.java#L599-L606 | train |
gallandarakhneorg/afc | advanced/gis/gisbus/src/main/java/org/arakhne/afc/gis/bus/network/BusItineraryHalt.java | BusItineraryHalt.busHubIterator | @Pure
public Iterator<BusHub> busHubIterator() {
final BusStop busStop = getBusStop();
if (busStop != null) {
return busStop.busHubIterator();
}
return Collections.emptyIterator();
} | java | @Pure
public Iterator<BusHub> busHubIterator() {
final BusStop busStop = getBusStop();
if (busStop != null) {
return busStop.busHubIterator();
}
return Collections.emptyIterator();
} | [
"@",
"Pure",
"public",
"Iterator",
"<",
"BusHub",
">",
"busHubIterator",
"(",
")",
"{",
"final",
"BusStop",
"busStop",
"=",
"getBusStop",
"(",
")",
";",
"if",
"(",
"busStop",
"!=",
"null",
")",
"{",
"return",
"busStop",
".",
"busHubIterator",
"(",
")",
... | Replies the hubs in which this bus stop is located in
throught an associated bus stop.
@return the hubs | [
"Replies",
"the",
"hubs",
"in",
"which",
"this",
"bus",
"stop",
"is",
"located",
"in",
"throught",
"an",
"associated",
"bus",
"stop",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/gisbus/src/main/java/org/arakhne/afc/gis/bus/network/BusItineraryHalt.java#L613-L620 | train |
gallandarakhneorg/afc | advanced/gis/gisbus/src/main/java/org/arakhne/afc/gis/bus/network/BusItineraryHalt.java | BusItineraryHalt.getGeoPosition | @Pure
public GeoLocationPoint getGeoPosition() {
final Point2d p = getPosition2D();
if (p != null) {
return new GeoLocationPoint(p.getX(), p.getY());
}
return null;
} | java | @Pure
public GeoLocationPoint getGeoPosition() {
final Point2d p = getPosition2D();
if (p != null) {
return new GeoLocationPoint(p.getX(), p.getY());
}
return null;
} | [
"@",
"Pure",
"public",
"GeoLocationPoint",
"getGeoPosition",
"(",
")",
"{",
"final",
"Point2d",
"p",
"=",
"getPosition2D",
"(",
")",
";",
"if",
"(",
"p",
"!=",
"null",
")",
"{",
"return",
"new",
"GeoLocationPoint",
"(",
"p",
".",
"getX",
"(",
")",
",",... | Replies the geo position.
@return the geo position. | [
"Replies",
"the",
"geo",
"position",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/gisbus/src/main/java/org/arakhne/afc/gis/bus/network/BusItineraryHalt.java#L655-L662 | train |
gallandarakhneorg/afc | advanced/gis/gisbus/src/main/java/org/arakhne/afc/gis/bus/network/BusItineraryHalt.java | BusItineraryHalt.distanceToBusStop | @Pure
public double distanceToBusStop() {
final Point2d p1 = getPosition2D();
if (p1 != null) {
final BusStop stop = getBusStop();
if (stop != null) {
final Point2d p2 = stop.getPosition2D();
if (p2 != null) {
return p1.getDistance(p2);
}
}
}
return Double.NaN;
} | java | @Pure
public double distanceToBusStop() {
final Point2d p1 = getPosition2D();
if (p1 != null) {
final BusStop stop = getBusStop();
if (stop != null) {
final Point2d p2 = stop.getPosition2D();
if (p2 != null) {
return p1.getDistance(p2);
}
}
}
return Double.NaN;
} | [
"@",
"Pure",
"public",
"double",
"distanceToBusStop",
"(",
")",
"{",
"final",
"Point2d",
"p1",
"=",
"getPosition2D",
"(",
")",
";",
"if",
"(",
"p1",
"!=",
"null",
")",
"{",
"final",
"BusStop",
"stop",
"=",
"getBusStop",
"(",
")",
";",
"if",
"(",
"sto... | Replies the distance between the position of this bus itinerary halt
and the position of the bus stop associated to this bus itinerary
halt.
@return the distance between the position of this bus itinerary halt
and the position of the bus stop associated to this bus itinerary
halt.
@since 2.0 | [
"Replies",
"the",
"distance",
"between",
"the",
"position",
"of",
"this",
"bus",
"itinerary",
"halt",
"and",
"the",
"position",
"of",
"the",
"bus",
"stop",
"associated",
"to",
"this",
"bus",
"itinerary",
"halt",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/gisbus/src/main/java/org/arakhne/afc/gis/bus/network/BusItineraryHalt.java#L673-L686 | train |
gallandarakhneorg/afc | advanced/gis/gisbus/src/main/java/org/arakhne/afc/gis/bus/network/BusItineraryHalt.java | BusItineraryHalt.distance | @Pure
public double distance(Point2D<?, ?> point) {
assert point != null;
final GeoLocationPoint p = getGeoPosition();
if (p != null) {
return Point2D.getDistancePointPoint(p.getX(), p.getY(), point.getX(), point.getY());
}
return Double.NaN;
} | java | @Pure
public double distance(Point2D<?, ?> point) {
assert point != null;
final GeoLocationPoint p = getGeoPosition();
if (p != null) {
return Point2D.getDistancePointPoint(p.getX(), p.getY(), point.getX(), point.getY());
}
return Double.NaN;
} | [
"@",
"Pure",
"public",
"double",
"distance",
"(",
"Point2D",
"<",
"?",
",",
"?",
">",
"point",
")",
"{",
"assert",
"point",
"!=",
"null",
";",
"final",
"GeoLocationPoint",
"p",
"=",
"getGeoPosition",
"(",
")",
";",
"if",
"(",
"p",
"!=",
"null",
")",
... | Replies the distance between the given point and this bus halt.
@param point the point
@return the distance to this bus halt | [
"Replies",
"the",
"distance",
"between",
"the",
"given",
"point",
"and",
"this",
"bus",
"halt",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/gisbus/src/main/java/org/arakhne/afc/gis/bus/network/BusItineraryHalt.java#L708-L716 | train |
gallandarakhneorg/afc | advanced/gis/gisbus/src/main/java/org/arakhne/afc/gis/bus/network/BusItineraryHalt.java | BusItineraryHalt.distance | @Pure
public double distance(BusItineraryHalt halt) {
assert halt != null;
final GeoLocationPoint p = getGeoPosition();
final GeoLocationPoint p2 = halt.getGeoPosition();
if (p != null && p2 != null) {
return Point2D.getDistancePointPoint(p.getX(), p.getY(), p2.getX(), p2.getY());
}
return Double.NaN;
} | java | @Pure
public double distance(BusItineraryHalt halt) {
assert halt != null;
final GeoLocationPoint p = getGeoPosition();
final GeoLocationPoint p2 = halt.getGeoPosition();
if (p != null && p2 != null) {
return Point2D.getDistancePointPoint(p.getX(), p.getY(), p2.getX(), p2.getY());
}
return Double.NaN;
} | [
"@",
"Pure",
"public",
"double",
"distance",
"(",
"BusItineraryHalt",
"halt",
")",
"{",
"assert",
"halt",
"!=",
"null",
";",
"final",
"GeoLocationPoint",
"p",
"=",
"getGeoPosition",
"(",
")",
";",
"final",
"GeoLocationPoint",
"p2",
"=",
"halt",
".",
"getGeoP... | Replies the distance between the given bus halt and this bus halt.
@param halt the halt.
@return the distance to this bus halt | [
"Replies",
"the",
"distance",
"between",
"the",
"given",
"bus",
"halt",
"and",
"this",
"bus",
"halt",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/gisbus/src/main/java/org/arakhne/afc/gis/bus/network/BusItineraryHalt.java#L723-L732 | train |
gallandarakhneorg/afc | advanced/gis/gisbus/src/main/java/org/arakhne/afc/gis/bus/network/BusItineraryHalt.java | BusItineraryHalt.distance | @Pure
public double distance(BusStop busStop) {
assert busStop != null;
final GeoLocationPoint p = getGeoPosition();
final GeoLocationPoint p2 = busStop.getGeoPosition();
if (p != null && p2 != null) {
return Point2D.getDistancePointPoint(p.getX(), p.getY(), p2.getX(), p2.getY());
}
return Double.NaN;
} | java | @Pure
public double distance(BusStop busStop) {
assert busStop != null;
final GeoLocationPoint p = getGeoPosition();
final GeoLocationPoint p2 = busStop.getGeoPosition();
if (p != null && p2 != null) {
return Point2D.getDistancePointPoint(p.getX(), p.getY(), p2.getX(), p2.getY());
}
return Double.NaN;
} | [
"@",
"Pure",
"public",
"double",
"distance",
"(",
"BusStop",
"busStop",
")",
"{",
"assert",
"busStop",
"!=",
"null",
";",
"final",
"GeoLocationPoint",
"p",
"=",
"getGeoPosition",
"(",
")",
";",
"final",
"GeoLocationPoint",
"p2",
"=",
"busStop",
".",
"getGeoP... | Replies the distance between the given bus stop and this bus halt.
@param busStop the stop.
@return the distance to this bus halt | [
"Replies",
"the",
"distance",
"between",
"the",
"given",
"bus",
"stop",
"and",
"this",
"bus",
"halt",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/gisbus/src/main/java/org/arakhne/afc/gis/bus/network/BusItineraryHalt.java#L739-L748 | train |
BBN-E/bue-common-open | nlp-core-open/src/main/java/com/bbn/nlp/parsing/EnglishAndChineseHeadRules.java | EnglishAndChineseHeadRules.createChinesePTBFromResources | public static <NodeT extends ConstituentNode<NodeT, ?>> HeadFinder<NodeT> createChinesePTBFromResources()
throws IOException {
final boolean headInitial = true;
final CharSource resource = Resources
.asCharSource(EnglishAndChineseHeadRules.class.getResource("ch_heads.sun.txt"),
Charsets.UTF_8);
final ImmutableMap<Symbol, HeadRule<NodeT>> headRules =
headRulesFromResources(headInitial, resource);
return MapHeadFinder.create(headRules);
} | java | public static <NodeT extends ConstituentNode<NodeT, ?>> HeadFinder<NodeT> createChinesePTBFromResources()
throws IOException {
final boolean headInitial = true;
final CharSource resource = Resources
.asCharSource(EnglishAndChineseHeadRules.class.getResource("ch_heads.sun.txt"),
Charsets.UTF_8);
final ImmutableMap<Symbol, HeadRule<NodeT>> headRules =
headRulesFromResources(headInitial, resource);
return MapHeadFinder.create(headRules);
} | [
"public",
"static",
"<",
"NodeT",
"extends",
"ConstituentNode",
"<",
"NodeT",
",",
"?",
">",
">",
"HeadFinder",
"<",
"NodeT",
">",
"createChinesePTBFromResources",
"(",
")",
"throws",
"IOException",
"{",
"final",
"boolean",
"headInitial",
"=",
"true",
";",
"fi... | Head finder using English NP rules and the Chinese head table as defined in
Honglin Sun and Daniel Jurafsky. 2004. Shallow Semantic Parsing of Chinese. In North American
Chapter of the ACL: Human Language Technologies (NAACL-HLT), pages 249256, Boston, MA. | [
"Head",
"finder",
"using",
"English",
"NP",
"rules",
"and",
"the",
"Chinese",
"head",
"table",
"as",
"defined",
"in"
] | d618652674d647867306e2e4b987a21b7c29c015 | https://github.com/BBN-E/bue-common-open/blob/d618652674d647867306e2e4b987a21b7c29c015/nlp-core-open/src/main/java/com/bbn/nlp/parsing/EnglishAndChineseHeadRules.java#L80-L89 | train |
gallandarakhneorg/afc | core/maths/mathtree/src/main/java/org/arakhne/afc/math/tree/io/DotDotWriter.java | DotDotWriter.write | public void write(Tree<?, ?> tree) throws IOException {
this.writer.append("digraph G"); //$NON-NLS-1$
this.writer.append(Integer.toString(this.graphIndex++));
this.writer.append(" {\n"); //$NON-NLS-1$
if (tree != null) {
// Write the node attributes
Iterator<? extends TreeNode<?, ?>> iterator = tree.broadFirstIterator();
TreeNode<?, ?> node;
int dataCount;
while (iterator.hasNext()) {
node = iterator.next();
dataCount = node.getUserDataCount();
final String name = "NODE" + Integer.toHexString(System.identityHashCode(node)); //$NON-NLS-1$
final String label = Integer.toString(dataCount);
this.writer.append("\t"); //$NON-NLS-1$
this.writer.append(name);
this.writer.append(" [label=\""); //$NON-NLS-1$
this.writer.append(label);
this.writer.append("\"]\n"); //$NON-NLS-1$
}
this.writer.append("\n"); //$NON-NLS-1$
// Write the node links
iterator = tree.broadFirstIterator();
Class<? extends Enum<?>> partitionType;
TreeNode<?, ?> child;
String childName;
while (iterator.hasNext()) {
node = iterator.next();
final String name = "NODE" + Integer.toHexString(System.identityHashCode(node)); //$NON-NLS-1$
if (!node.isLeaf()) {
partitionType = node.getPartitionEnumeration();
final int childCount = node.getChildCount();
for (int i = 0; i < childCount; ++i) {
child = node.getChildAt(i);
if (child != null) {
childName = "NODE" + Integer.toHexString(System.identityHashCode(child)); //$NON-NLS-1$
final String label;
if (partitionType != null) {
label = partitionType.getEnumConstants()[i].name();
} else {
label = Integer.toString(i);
}
this.writer.append("\t"); //$NON-NLS-1$
this.writer.append(name);
this.writer.append("->"); //$NON-NLS-1$
this.writer.append(childName);
this.writer.append(" [label=\""); //$NON-NLS-1$
this.writer.append(label);
this.writer.append("\"]\n"); //$NON-NLS-1$
}
}
}
}
}
this.writer.append("}\n\n"); //$NON-NLS-1$
} | java | public void write(Tree<?, ?> tree) throws IOException {
this.writer.append("digraph G"); //$NON-NLS-1$
this.writer.append(Integer.toString(this.graphIndex++));
this.writer.append(" {\n"); //$NON-NLS-1$
if (tree != null) {
// Write the node attributes
Iterator<? extends TreeNode<?, ?>> iterator = tree.broadFirstIterator();
TreeNode<?, ?> node;
int dataCount;
while (iterator.hasNext()) {
node = iterator.next();
dataCount = node.getUserDataCount();
final String name = "NODE" + Integer.toHexString(System.identityHashCode(node)); //$NON-NLS-1$
final String label = Integer.toString(dataCount);
this.writer.append("\t"); //$NON-NLS-1$
this.writer.append(name);
this.writer.append(" [label=\""); //$NON-NLS-1$
this.writer.append(label);
this.writer.append("\"]\n"); //$NON-NLS-1$
}
this.writer.append("\n"); //$NON-NLS-1$
// Write the node links
iterator = tree.broadFirstIterator();
Class<? extends Enum<?>> partitionType;
TreeNode<?, ?> child;
String childName;
while (iterator.hasNext()) {
node = iterator.next();
final String name = "NODE" + Integer.toHexString(System.identityHashCode(node)); //$NON-NLS-1$
if (!node.isLeaf()) {
partitionType = node.getPartitionEnumeration();
final int childCount = node.getChildCount();
for (int i = 0; i < childCount; ++i) {
child = node.getChildAt(i);
if (child != null) {
childName = "NODE" + Integer.toHexString(System.identityHashCode(child)); //$NON-NLS-1$
final String label;
if (partitionType != null) {
label = partitionType.getEnumConstants()[i].name();
} else {
label = Integer.toString(i);
}
this.writer.append("\t"); //$NON-NLS-1$
this.writer.append(name);
this.writer.append("->"); //$NON-NLS-1$
this.writer.append(childName);
this.writer.append(" [label=\""); //$NON-NLS-1$
this.writer.append(label);
this.writer.append("\"]\n"); //$NON-NLS-1$
}
}
}
}
}
this.writer.append("}\n\n"); //$NON-NLS-1$
} | [
"public",
"void",
"write",
"(",
"Tree",
"<",
"?",
",",
"?",
">",
"tree",
")",
"throws",
"IOException",
"{",
"this",
".",
"writer",
".",
"append",
"(",
"\"digraph G\"",
")",
";",
"//$NON-NLS-1$",
"this",
".",
"writer",
".",
"append",
"(",
"Integer",
"."... | Write the given tree inside the .dot output stream.
@param tree is the tree to write
@throws IOException in case of error | [
"Write",
"the",
"given",
"tree",
"inside",
"the",
".",
"dot",
"output",
"stream",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/maths/mathtree/src/main/java/org/arakhne/afc/math/tree/io/DotDotWriter.java#L76-L136 | train |
gallandarakhneorg/afc | core/maths/mathgeom/tobeincluded/src/d3/continuous/AbstractCapsule3F.java | AbstractCapsule3F.containsCapsulePoint | @Pure
public static boolean containsCapsulePoint(
double capsule1Ax, double capsule1Ay, double capsule1Az, double capsule1Bx, double capsule1By, double capsule1Bz, double capsule1Radius,
double px, double py, double pz) {
double distPointToCapsuleSegment = AbstractSegment3F.distanceSquaredSegmentPoint(
capsule1Ax, capsule1Ay, capsule1Az, capsule1Bx, capsule1By, capsule1Bz,
px,py,pz);
return (distPointToCapsuleSegment <= (capsule1Radius * capsule1Radius));
} | java | @Pure
public static boolean containsCapsulePoint(
double capsule1Ax, double capsule1Ay, double capsule1Az, double capsule1Bx, double capsule1By, double capsule1Bz, double capsule1Radius,
double px, double py, double pz) {
double distPointToCapsuleSegment = AbstractSegment3F.distanceSquaredSegmentPoint(
capsule1Ax, capsule1Ay, capsule1Az, capsule1Bx, capsule1By, capsule1Bz,
px,py,pz);
return (distPointToCapsuleSegment <= (capsule1Radius * capsule1Radius));
} | [
"@",
"Pure",
"public",
"static",
"boolean",
"containsCapsulePoint",
"(",
"double",
"capsule1Ax",
",",
"double",
"capsule1Ay",
",",
"double",
"capsule1Az",
",",
"double",
"capsule1Bx",
",",
"double",
"capsule1By",
",",
"double",
"capsule1Bz",
",",
"double",
"capsul... | Compute intersection between a point and a capsule.
@param capsule1Ax - capsule medial line segment start point
@param capsule1Ay - capsule medial line segment start point
@param capsule1Az - capsule medial line segment start point
@param capsule1Bx - capsule medial line segment end point
@param capsule1By - capsule medial line segment end point
@param capsule1Bz - capsule medial line segment end point
@param capsule1Radius - capsule radius
@param px - the point to test
@param py - the point to test
@param pz - the point to test
@return <code>true</code> if intersecting, otherwise <code>false</code> | [
"Compute",
"intersection",
"between",
"a",
"point",
"and",
"a",
"capsule",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/maths/mathgeom/tobeincluded/src/d3/continuous/AbstractCapsule3F.java#L66-L74 | train |
gallandarakhneorg/afc | core/maths/mathgeom/tobeincluded/src/d3/continuous/AbstractCapsule3F.java | AbstractCapsule3F.intersectsCapsuleAlignedBox | @Pure
public static boolean intersectsCapsuleAlignedBox(
double mx1, double my1, double mz1,
double mx2, double my2, double mz2,
double radius,
double minx, double miny, double minz,
double maxx, double maxy, double maxz) {
Point3f closest1 = AlignedBox3f.computeClosestPoint(
minx, miny, minz, maxx, maxy, maxz,
mx1, my1, mz1);
Point3f closest2 = AlignedBox3f.computeClosestPoint(
minx, miny, minz, maxx, maxy, maxz,
mx2, my2, mz2);
double sq = AbstractSegment3F.distanceSquaredSegmentSegment(
mx1, my1, mz1,
mx2, my2, mz2,
closest1.getX(), closest1.getY(), closest1.getZ(),
closest2.getX(), closest2.getY(), closest2.getZ());
return (sq <= (radius * radius));
} | java | @Pure
public static boolean intersectsCapsuleAlignedBox(
double mx1, double my1, double mz1,
double mx2, double my2, double mz2,
double radius,
double minx, double miny, double minz,
double maxx, double maxy, double maxz) {
Point3f closest1 = AlignedBox3f.computeClosestPoint(
minx, miny, minz, maxx, maxy, maxz,
mx1, my1, mz1);
Point3f closest2 = AlignedBox3f.computeClosestPoint(
minx, miny, minz, maxx, maxy, maxz,
mx2, my2, mz2);
double sq = AbstractSegment3F.distanceSquaredSegmentSegment(
mx1, my1, mz1,
mx2, my2, mz2,
closest1.getX(), closest1.getY(), closest1.getZ(),
closest2.getX(), closest2.getY(), closest2.getZ());
return (sq <= (radius * radius));
} | [
"@",
"Pure",
"public",
"static",
"boolean",
"intersectsCapsuleAlignedBox",
"(",
"double",
"mx1",
",",
"double",
"my1",
",",
"double",
"mz1",
",",
"double",
"mx2",
",",
"double",
"my2",
",",
"double",
"mz2",
",",
"double",
"radius",
",",
"double",
"minx",
"... | Replies if the capsule intersects the aligned box.
@param mx1 x coordinate of the first point of the capsule's segment.
@param my1 y coordinate of the first point of the capsule's segment.
@param mz1 z coordinate of the first point of the capsule's segment.
@param mx2 x coordinate of the second point of the capsule's segment.
@param my2 y coordinate of the second point of the capsule's segment.
@param mz2 z coordinate of the second point of the capsule's segment.
@param radius radius of the capsule.
@param minx x coordinate of the lower corner of the aligned box.
@param miny y coordinate of the lower corner of the aligned box.
@param minz z coordinate of the lower corner of the aligned box.
@param maxx x coordinate of the upper corner of the aligned box.
@param maxy y coordinate of the upper corner of the aligned box.
@param maxz z coordinate of the upper corner of the aligned box.
@return <code>true</code> if the capsule and aligned box are intersecting. | [
"Replies",
"if",
"the",
"capsule",
"intersects",
"the",
"aligned",
"box",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/maths/mathgeom/tobeincluded/src/d3/continuous/AbstractCapsule3F.java#L93-L112 | train |
gallandarakhneorg/afc | core/maths/mathgeom/tobeincluded/src/d3/continuous/AbstractCapsule3F.java | AbstractCapsule3F.intersectsCapsuleCapsule | @Pure
public static boolean intersectsCapsuleCapsule(
double capsule1Ax, double capsule1Ay, double capsule1Az, double capsule1Bx, double capsule1By, double capsule1Bz, double capsule1Radius,
double capsule2Ax, double capsule2Ay, double capsule2Az, double capsule2Bx, double capsule2By, double capsule2Bz, double capsule2Radius) {
double dist2 = AbstractSegment3F.distanceSquaredSegmentSegment(
capsule1Ax, capsule1Ay, capsule1Az, capsule1Bx, capsule1By, capsule1Bz,
capsule2Ax, capsule2Ay, capsule2Az, capsule2Bx, capsule2By, capsule2Bz);
// If (squared) distance smaller than (squared) sum of radii, they collide
double radius = capsule1Radius + capsule2Radius;
return dist2 <= (radius * radius);
} | java | @Pure
public static boolean intersectsCapsuleCapsule(
double capsule1Ax, double capsule1Ay, double capsule1Az, double capsule1Bx, double capsule1By, double capsule1Bz, double capsule1Radius,
double capsule2Ax, double capsule2Ay, double capsule2Az, double capsule2Bx, double capsule2By, double capsule2Bz, double capsule2Radius) {
double dist2 = AbstractSegment3F.distanceSquaredSegmentSegment(
capsule1Ax, capsule1Ay, capsule1Az, capsule1Bx, capsule1By, capsule1Bz,
capsule2Ax, capsule2Ay, capsule2Az, capsule2Bx, capsule2By, capsule2Bz);
// If (squared) distance smaller than (squared) sum of radii, they collide
double radius = capsule1Radius + capsule2Radius;
return dist2 <= (radius * radius);
} | [
"@",
"Pure",
"public",
"static",
"boolean",
"intersectsCapsuleCapsule",
"(",
"double",
"capsule1Ax",
",",
"double",
"capsule1Ay",
",",
"double",
"capsule1Az",
",",
"double",
"capsule1Bx",
",",
"double",
"capsule1By",
",",
"double",
"capsule1Bz",
",",
"double",
"ca... | Replies if the specified capsules intersect.
@param capsule1Ax - Medial line segment start point of the first capsule
@param capsule1Ay - Medial line segment start point of the first capsule
@param capsule1Az - Medial line segment start point of the first capsule
@param capsule1Bx - Medial line segment end point of the first capsule
@param capsule1By - Medial line segment end point of the first capsule
@param capsule1Bz - Medial line segment end point of the first capsule
@param capsule1Radius - radius of the first capsule
@param capsule2Ax - Medial line segment start point of the second capsule
@param capsule2Ay - Medial line segment start point of the second capsule
@param capsule2Az - Medial line segment start point of the second capsule
@param capsule2Bx - Medial line segment end point of the second capsule
@param capsule2By - Medial line segment end point of the second capsule
@param capsule2Bz - Medial line segment end point of the second capsule
@param capsule2Radius - radius of the second capsule
@return <code>true</code> if intersecting, otherwise <code>false</code> | [
"Replies",
"if",
"the",
"specified",
"capsules",
"intersect",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/maths/mathgeom/tobeincluded/src/d3/continuous/AbstractCapsule3F.java#L133-L145 | train |
gallandarakhneorg/afc | core/maths/mathgeom/tobeincluded/src/d3/continuous/AbstractCapsule3F.java | AbstractCapsule3F.ensureAIsLowerPoint | protected void ensureAIsLowerPoint() {
CoordinateSystem3D cs = CoordinateSystem3D.getDefaultCoordinateSystem();
boolean swap = false;
if (cs.isZOnUp()) {
swap = (this.getMedial1().getZ() > this.getMedial2().getZ());
} else if (cs.isYOnUp()){
swap = (this.getMedial1().getY() > this.getMedial2().getY());
}
if (swap) {
double x = this.getMedial1().getX();
double y = this.getMedial1().getY();
double z = this.getMedial1().getZ();
this.getMedial1().set(this.getMedial2());
this.getMedial2().set(x, y, z);
}
} | java | protected void ensureAIsLowerPoint() {
CoordinateSystem3D cs = CoordinateSystem3D.getDefaultCoordinateSystem();
boolean swap = false;
if (cs.isZOnUp()) {
swap = (this.getMedial1().getZ() > this.getMedial2().getZ());
} else if (cs.isYOnUp()){
swap = (this.getMedial1().getY() > this.getMedial2().getY());
}
if (swap) {
double x = this.getMedial1().getX();
double y = this.getMedial1().getY();
double z = this.getMedial1().getZ();
this.getMedial1().set(this.getMedial2());
this.getMedial2().set(x, y, z);
}
} | [
"protected",
"void",
"ensureAIsLowerPoint",
"(",
")",
"{",
"CoordinateSystem3D",
"cs",
"=",
"CoordinateSystem3D",
".",
"getDefaultCoordinateSystem",
"(",
")",
";",
"boolean",
"swap",
"=",
"false",
";",
"if",
"(",
"cs",
".",
"isZOnUp",
"(",
")",
")",
"{",
"sw... | Ensure that a has the lower coordinates than b. | [
"Ensure",
"that",
"a",
"has",
"the",
"lower",
"coordinates",
"than",
"b",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/maths/mathgeom/tobeincluded/src/d3/continuous/AbstractCapsule3F.java#L178-L193 | train |
gallandarakhneorg/afc | advanced/mathfx/src/main/java/org/arakhne/afc/math/geometry/d3/ifx/Vector3ifx.java | Vector3ifx.convert | public static Vector3ifx convert(Tuple3D<?> tuple) {
if (tuple instanceof Vector3ifx) {
return (Vector3ifx) tuple;
}
return new Vector3ifx(tuple.getX(), tuple.getY(), tuple.getZ());
} | java | public static Vector3ifx convert(Tuple3D<?> tuple) {
if (tuple instanceof Vector3ifx) {
return (Vector3ifx) tuple;
}
return new Vector3ifx(tuple.getX(), tuple.getY(), tuple.getZ());
} | [
"public",
"static",
"Vector3ifx",
"convert",
"(",
"Tuple3D",
"<",
"?",
">",
"tuple",
")",
"{",
"if",
"(",
"tuple",
"instanceof",
"Vector3ifx",
")",
"{",
"return",
"(",
"Vector3ifx",
")",
"tuple",
";",
"}",
"return",
"new",
"Vector3ifx",
"(",
"tuple",
"."... | Convert the given tuple to a real Vector3ifx.
<p>If the given tuple is already a Vector3ifx, it is replied.
@param tuple the tuple.
@return the Vector3ifx.
@since 14.0 | [
"Convert",
"the",
"given",
"tuple",
"to",
"a",
"real",
"Vector3ifx",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/mathfx/src/main/java/org/arakhne/afc/math/geometry/d3/ifx/Vector3ifx.java#L137-L142 | train |
agmip/translator-dssat | src/main/java/org/agmip/translators/dssat/DssatSoilInput.java | DssatSoilInput.readFile | @Override
protected HashMap readFile(HashMap brMap) throws IOException {
HashMap ret = new HashMap();
ArrayList<HashMap> sites = readSoilSites(brMap, new HashMap());
// compressData(sites);
ret.put("soils", sites);
return ret;
} | java | @Override
protected HashMap readFile(HashMap brMap) throws IOException {
HashMap ret = new HashMap();
ArrayList<HashMap> sites = readSoilSites(brMap, new HashMap());
// compressData(sites);
ret.put("soils", sites);
return ret;
} | [
"@",
"Override",
"protected",
"HashMap",
"readFile",
"(",
"HashMap",
"brMap",
")",
"throws",
"IOException",
"{",
"HashMap",
"ret",
"=",
"new",
"HashMap",
"(",
")",
";",
"ArrayList",
"<",
"HashMap",
">",
"sites",
"=",
"readSoilSites",
"(",
"brMap",
",",
"ne... | DSSAT Soil Data input method for only inputing soil file
@param brMap The holder for BufferReader objects for all files
@return result data holder object
@throws java.io.IOException | [
"DSSAT",
"Soil",
"Data",
"input",
"method",
"for",
"only",
"inputing",
"soil",
"file"
] | 4be61d998f106eb7234ea8701b63c3746ae688f4 | https://github.com/agmip/translator-dssat/blob/4be61d998f106eb7234ea8701b63c3746ae688f4/src/main/java/org/agmip/translators/dssat/DssatSoilInput.java#L37-L45 | train |
gallandarakhneorg/afc | core/maths/mathgeom/src/main/java/org/arakhne/afc/math/geometry/d3/d/Point3d.java | Point3d.convert | public static Point3d convert(Tuple3D<?> tuple) {
if (tuple instanceof Point3d) {
return (Point3d) tuple;
}
return new Point3d(tuple.getX(), tuple.getY(), tuple.getZ());
} | java | public static Point3d convert(Tuple3D<?> tuple) {
if (tuple instanceof Point3d) {
return (Point3d) tuple;
}
return new Point3d(tuple.getX(), tuple.getY(), tuple.getZ());
} | [
"public",
"static",
"Point3d",
"convert",
"(",
"Tuple3D",
"<",
"?",
">",
"tuple",
")",
"{",
"if",
"(",
"tuple",
"instanceof",
"Point3d",
")",
"{",
"return",
"(",
"Point3d",
")",
"tuple",
";",
"}",
"return",
"new",
"Point3d",
"(",
"tuple",
".",
"getX",
... | Convert the given tuple to a real Point3d.
<p>If the given tuple is already a Point3d, it is replied.
@param tuple the tuple.
@return the Point3d.
@since 14.0 | [
"Convert",
"the",
"given",
"tuple",
"to",
"a",
"real",
"Point3d",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/maths/mathgeom/src/main/java/org/arakhne/afc/math/geometry/d3/d/Point3d.java#L118-L123 | train |
gallandarakhneorg/afc | core/maths/mathtree/src/main/java/org/arakhne/afc/math/tree/node/OctTreeNode.java | OctTreeNode.getChildAt | @Pure
public final N getChildAt(OctTreeZone zone) {
if (zone != null) {
return getChildAt(zone.ordinal());
}
return null;
} | java | @Pure
public final N getChildAt(OctTreeZone zone) {
if (zone != null) {
return getChildAt(zone.ordinal());
}
return null;
} | [
"@",
"Pure",
"public",
"final",
"N",
"getChildAt",
"(",
"OctTreeZone",
"zone",
")",
"{",
"if",
"(",
"zone",
"!=",
"null",
")",
"{",
"return",
"getChildAt",
"(",
"zone",
".",
"ordinal",
"(",
")",
")",
";",
"}",
"return",
"null",
";",
"}"
] | Replies count of children in this node.
@param zone is the position of the node to reply
@return the node at the given index | [
"Replies",
"count",
"of",
"children",
"in",
"this",
"node",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/maths/mathtree/src/main/java/org/arakhne/afc/math/tree/node/OctTreeNode.java#L342-L348 | train |
gallandarakhneorg/afc | core/maths/mathtree/src/main/java/org/arakhne/afc/math/tree/node/OctTreeNode.java | OctTreeNode.setChild6 | @SuppressWarnings("checkstyle:magicnumber")
private boolean setChild6(N newChild) {
if (this.child6 == newChild) {
return false;
}
if (this.child6 != null) {
this.child6.setParentNodeReference(null, true);
--this.notNullChildCount;
firePropertyChildRemoved(5, this.child5);
}
if (newChild != null) {
final N oldParent = newChild.getParentNode();
if (oldParent != this) {
newChild.removeFromParent();
}
}
this.child6 = newChild;
if (newChild != null) {
newChild.setParentNodeReference(toN(), true);
++this.notNullChildCount;
firePropertyChildAdded(5, newChild);
}
return true;
} | java | @SuppressWarnings("checkstyle:magicnumber")
private boolean setChild6(N newChild) {
if (this.child6 == newChild) {
return false;
}
if (this.child6 != null) {
this.child6.setParentNodeReference(null, true);
--this.notNullChildCount;
firePropertyChildRemoved(5, this.child5);
}
if (newChild != null) {
final N oldParent = newChild.getParentNode();
if (oldParent != this) {
newChild.removeFromParent();
}
}
this.child6 = newChild;
if (newChild != null) {
newChild.setParentNodeReference(toN(), true);
++this.notNullChildCount;
firePropertyChildAdded(5, newChild);
}
return true;
} | [
"@",
"SuppressWarnings",
"(",
"\"checkstyle:magicnumber\"",
")",
"private",
"boolean",
"setChild6",
"(",
"N",
"newChild",
")",
"{",
"if",
"(",
"this",
".",
"child6",
"==",
"newChild",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"this",
".",
"child6",... | Set the child 6.
@param newChild is the new child
@return <code>true</code> on success, otherwise <code>false</code> | [
"Set",
"the",
"child",
"6",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/maths/mathtree/src/main/java/org/arakhne/afc/math/tree/node/OctTreeNode.java#L693-L722 | train |
gallandarakhneorg/afc | core/maths/mathtree/src/main/java/org/arakhne/afc/math/tree/node/OctTreeNode.java | OctTreeNode.setChild7 | @SuppressWarnings("checkstyle:magicnumber")
private boolean setChild7(N newChild) {
if (this.child7 == newChild) {
return false;
}
if (this.child7 != null) {
this.child7.setParentNodeReference(null, true);
--this.notNullChildCount;
firePropertyChildRemoved(6, this.child7);
}
if (newChild != null) {
final N oldParent = newChild.getParentNode();
if (oldParent != this) {
newChild.removeFromParent();
}
}
this.child7 = newChild;
if (newChild != null) {
newChild.setParentNodeReference(toN(), true);
++this.notNullChildCount;
firePropertyChildAdded(6, newChild);
}
return true;
} | java | @SuppressWarnings("checkstyle:magicnumber")
private boolean setChild7(N newChild) {
if (this.child7 == newChild) {
return false;
}
if (this.child7 != null) {
this.child7.setParentNodeReference(null, true);
--this.notNullChildCount;
firePropertyChildRemoved(6, this.child7);
}
if (newChild != null) {
final N oldParent = newChild.getParentNode();
if (oldParent != this) {
newChild.removeFromParent();
}
}
this.child7 = newChild;
if (newChild != null) {
newChild.setParentNodeReference(toN(), true);
++this.notNullChildCount;
firePropertyChildAdded(6, newChild);
}
return true;
} | [
"@",
"SuppressWarnings",
"(",
"\"checkstyle:magicnumber\"",
")",
"private",
"boolean",
"setChild7",
"(",
"N",
"newChild",
")",
"{",
"if",
"(",
"this",
".",
"child7",
"==",
"newChild",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"this",
".",
"child7",... | Set the child 7.
@param newChild is the new child
@return <code>true</code> on success, otherwise <code>false</code> | [
"Set",
"the",
"child",
"7",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/maths/mathtree/src/main/java/org/arakhne/afc/math/tree/node/OctTreeNode.java#L729-L758 | train |
gallandarakhneorg/afc | core/maths/mathtree/src/main/java/org/arakhne/afc/math/tree/node/OctTreeNode.java | OctTreeNode.setChild8 | @SuppressWarnings("checkstyle:magicnumber")
private boolean setChild8(N newChild) {
if (this.child8 == newChild) {
return false;
}
if (this.child8 != null) {
this.child8.setParentNodeReference(null, true);
--this.notNullChildCount;
firePropertyChildRemoved(7, this.child8);
}
if (newChild != null) {
final N oldParent = newChild.getParentNode();
if (oldParent != this) {
newChild.removeFromParent();
}
}
this.child8 = newChild;
if (newChild != null) {
newChild.setParentNodeReference(toN(), true);
++this.notNullChildCount;
firePropertyChildAdded(7, newChild);
}
return true;
} | java | @SuppressWarnings("checkstyle:magicnumber")
private boolean setChild8(N newChild) {
if (this.child8 == newChild) {
return false;
}
if (this.child8 != null) {
this.child8.setParentNodeReference(null, true);
--this.notNullChildCount;
firePropertyChildRemoved(7, this.child8);
}
if (newChild != null) {
final N oldParent = newChild.getParentNode();
if (oldParent != this) {
newChild.removeFromParent();
}
}
this.child8 = newChild;
if (newChild != null) {
newChild.setParentNodeReference(toN(), true);
++this.notNullChildCount;
firePropertyChildAdded(7, newChild);
}
return true;
} | [
"@",
"SuppressWarnings",
"(",
"\"checkstyle:magicnumber\"",
")",
"private",
"boolean",
"setChild8",
"(",
"N",
"newChild",
")",
"{",
"if",
"(",
"this",
".",
"child8",
"==",
"newChild",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"this",
".",
"child8",... | Set the child 8.
@param newChild is the new child
@return <code>true</code> on success, otherwise <code>false</code> | [
"Set",
"the",
"child",
"8",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/maths/mathtree/src/main/java/org/arakhne/afc/math/tree/node/OctTreeNode.java#L765-L794 | train |
gallandarakhneorg/afc | maven/tag-replacer/src/main/java/org/arakhne/maven/plugins/tagreplacer/GenerateSourceMojo.java | GenerateSourceMojo.executeMojo | protected synchronized void executeMojo(File targetDir) throws MojoExecutionException {
if (this.generateTargets.contains(targetDir)
&& targetDir.isDirectory()) {
getLog().debug("Skiping " + targetDir + " because is was already generated"); //$NON-NLS-1$ //$NON-NLS-2$
return;
}
this.generateTargets.add(targetDir);
final File[] sourceDirs;
final File mainDirectory = new File(getSourceDirectory(), "main"); //$NON-NLS-1$
if (this.sources == null || this.sources.length == 0) {
sourceDirs = new File[] {
new File(mainDirectory, "java"), //$NON-NLS-1$
};
} else {
sourceDirs = this.sources;
}
clearInternalBuffers();
for (final File sourceDir : sourceDirs) {
Map<File, File> htmlBasedFiles = this.bufferedFiles.get(sourceDir);
if (htmlBasedFiles == null) {
htmlBasedFiles = new TreeMap<>();
if (sourceDir.isDirectory()) {
// Search for .java files
findFiles(sourceDir, new JavaSourceFileFilter(), htmlBasedFiles);
}
this.bufferedFiles.put(sourceDir, htmlBasedFiles);
}
for (final Entry<File, File> entry : htmlBasedFiles.entrySet()) {
final String baseFile = removePathPrefix(entry.getValue(), entry.getKey());
replaceInFileBuffered(
entry.getKey(),
new File(targetDir, baseFile),
ReplacementType.HTML,
sourceDirs,
false);
}
}
} | java | protected synchronized void executeMojo(File targetDir) throws MojoExecutionException {
if (this.generateTargets.contains(targetDir)
&& targetDir.isDirectory()) {
getLog().debug("Skiping " + targetDir + " because is was already generated"); //$NON-NLS-1$ //$NON-NLS-2$
return;
}
this.generateTargets.add(targetDir);
final File[] sourceDirs;
final File mainDirectory = new File(getSourceDirectory(), "main"); //$NON-NLS-1$
if (this.sources == null || this.sources.length == 0) {
sourceDirs = new File[] {
new File(mainDirectory, "java"), //$NON-NLS-1$
};
} else {
sourceDirs = this.sources;
}
clearInternalBuffers();
for (final File sourceDir : sourceDirs) {
Map<File, File> htmlBasedFiles = this.bufferedFiles.get(sourceDir);
if (htmlBasedFiles == null) {
htmlBasedFiles = new TreeMap<>();
if (sourceDir.isDirectory()) {
// Search for .java files
findFiles(sourceDir, new JavaSourceFileFilter(), htmlBasedFiles);
}
this.bufferedFiles.put(sourceDir, htmlBasedFiles);
}
for (final Entry<File, File> entry : htmlBasedFiles.entrySet()) {
final String baseFile = removePathPrefix(entry.getValue(), entry.getKey());
replaceInFileBuffered(
entry.getKey(),
new File(targetDir, baseFile),
ReplacementType.HTML,
sourceDirs,
false);
}
}
} | [
"protected",
"synchronized",
"void",
"executeMojo",
"(",
"File",
"targetDir",
")",
"throws",
"MojoExecutionException",
"{",
"if",
"(",
"this",
".",
"generateTargets",
".",
"contains",
"(",
"targetDir",
")",
"&&",
"targetDir",
".",
"isDirectory",
"(",
")",
")",
... | Execute the replacement mojo inside the given target directory.
@param targetDir the target dir.
@throws MojoExecutionException on error. | [
"Execute",
"the",
"replacement",
"mojo",
"inside",
"the",
"given",
"target",
"directory",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/maven/tag-replacer/src/main/java/org/arakhne/maven/plugins/tagreplacer/GenerateSourceMojo.java#L90-L134 | train |
gallandarakhneorg/afc | core/vmutils/src/main/java/org/arakhne/afc/vmutil/Caller.java | Caller.getCaller | @Pure
public static org.arakhne.afc.vmutil.caller.Caller getCaller() {
synchronized (Caller.class) {
if (caller == null) {
caller = new StackTraceCaller();
}
return caller;
}
} | java | @Pure
public static org.arakhne.afc.vmutil.caller.Caller getCaller() {
synchronized (Caller.class) {
if (caller == null) {
caller = new StackTraceCaller();
}
return caller;
}
} | [
"@",
"Pure",
"public",
"static",
"org",
".",
"arakhne",
".",
"afc",
".",
"vmutil",
".",
"caller",
".",
"Caller",
"getCaller",
"(",
")",
"{",
"synchronized",
"(",
"Caller",
".",
"class",
")",
"{",
"if",
"(",
"caller",
"==",
"null",
")",
"{",
"caller",... | Replies the stack trace mamager used by this utility
class.
@return the stack trace mamager. | [
"Replies",
"the",
"stack",
"trace",
"mamager",
"used",
"by",
"this",
"utility",
"class",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/vmutils/src/main/java/org/arakhne/afc/vmutil/Caller.java#L53-L61 | train |
gallandarakhneorg/afc | advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/grid/GridCell.java | GridCell.getElementAt | @Pure
public P getElementAt(int index) {
if (index >= 0 && index < this.referenceElementCount) {
int idx = 0;
for (final GridCellElement<P> element : this.elements) {
if (element.isReferenceCell(this)) {
if (idx == index) {
return element.get();
}
++idx;
}
}
}
throw new IndexOutOfBoundsException();
} | java | @Pure
public P getElementAt(int index) {
if (index >= 0 && index < this.referenceElementCount) {
int idx = 0;
for (final GridCellElement<P> element : this.elements) {
if (element.isReferenceCell(this)) {
if (idx == index) {
return element.get();
}
++idx;
}
}
}
throw new IndexOutOfBoundsException();
} | [
"@",
"Pure",
"public",
"P",
"getElementAt",
"(",
"int",
"index",
")",
"{",
"if",
"(",
"index",
">=",
"0",
"&&",
"index",
"<",
"this",
".",
"referenceElementCount",
")",
"{",
"int",
"idx",
"=",
"0",
";",
"for",
"(",
"final",
"GridCellElement",
"<",
"P... | Replies the reference element at the specified index in this cell.
@param index the index.
@return the element. | [
"Replies",
"the",
"reference",
"element",
"at",
"the",
"specified",
"index",
"in",
"this",
"cell",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/grid/GridCell.java#L99-L113 | train |
gallandarakhneorg/afc | advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/grid/GridCell.java | GridCell.iterator | @Pure
public Iterator<P> iterator(Rectangle2afp<?, ?, ?, ?, ?, ?> bounds) {
return new BoundsIterator<>(this.elements.iterator(), bounds);
} | java | @Pure
public Iterator<P> iterator(Rectangle2afp<?, ?, ?, ?, ?, ?> bounds) {
return new BoundsIterator<>(this.elements.iterator(), bounds);
} | [
"@",
"Pure",
"public",
"Iterator",
"<",
"P",
">",
"iterator",
"(",
"Rectangle2afp",
"<",
"?",
",",
"?",
",",
"?",
",",
"?",
",",
"?",
",",
"?",
">",
"bounds",
")",
"{",
"return",
"new",
"BoundsIterator",
"<>",
"(",
"this",
".",
"elements",
".",
"... | Replies the iterator on the elements of the cell that
are intersecting the specified bounds.
@param bounds the bounds
@return the iterator. | [
"Replies",
"the",
"iterator",
"on",
"the",
"elements",
"of",
"the",
"cell",
"that",
"are",
"intersecting",
"the",
"specified",
"bounds",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/grid/GridCell.java#L175-L178 | train |
gallandarakhneorg/afc | advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/grid/GridCell.java | GridCell.addElement | public boolean addElement(GridCellElement<P> element) {
if (element != null && this.elements.add(element)) {
if (element.addCellLink(this)) {
++this.referenceElementCount;
}
return true;
}
return false;
} | java | public boolean addElement(GridCellElement<P> element) {
if (element != null && this.elements.add(element)) {
if (element.addCellLink(this)) {
++this.referenceElementCount;
}
return true;
}
return false;
} | [
"public",
"boolean",
"addElement",
"(",
"GridCellElement",
"<",
"P",
">",
"element",
")",
"{",
"if",
"(",
"element",
"!=",
"null",
"&&",
"this",
".",
"elements",
".",
"add",
"(",
"element",
")",
")",
"{",
"if",
"(",
"element",
".",
"addCellLink",
"(",
... | Add an element in the cell.
@param element the element.
@return <code>true</code> if the element is added;
otherwise <code>false</code>. | [
"Add",
"an",
"element",
"in",
"the",
"cell",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/grid/GridCell.java#L195-L203 | train |
gallandarakhneorg/afc | advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/grid/GridCell.java | GridCell.removeElement | public GridCellElement<P> removeElement(P element) {
final GridCellElement<P> elt = remove(element);
if (elt != null) {
if (elt.removeCellLink(this)) {
--this.referenceElementCount;
}
}
return elt;
} | java | public GridCellElement<P> removeElement(P element) {
final GridCellElement<P> elt = remove(element);
if (elt != null) {
if (elt.removeCellLink(this)) {
--this.referenceElementCount;
}
}
return elt;
} | [
"public",
"GridCellElement",
"<",
"P",
">",
"removeElement",
"(",
"P",
"element",
")",
"{",
"final",
"GridCellElement",
"<",
"P",
">",
"elt",
"=",
"remove",
"(",
"element",
")",
";",
"if",
"(",
"elt",
"!=",
"null",
")",
"{",
"if",
"(",
"elt",
".",
... | Remove the specified element from the cell.
@param element the element.
@return the removed grid-cell element. | [
"Remove",
"the",
"specified",
"element",
"from",
"the",
"cell",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/grid/GridCell.java#L225-L233 | train |
gallandarakhneorg/afc | advanced/gis/gisroadfx/src/main/java/org/arakhne/afc/gis/road/ui/SimpleViewer.java | SimpleViewer.getElementUnderMouse | @SuppressWarnings({ "rawtypes" })
public MapElement getElementUnderMouse(GisPane<?> pane, double x, double y) {
final GISContainer model = pane.getDocumentModel();
final Point2d mousePosition = pane.toDocumentPosition(x, y);
final Rectangle2d selectionArea = pane.toDocumentRect(x - 2, y - 2, 5, 5);
return getElementUnderMouse(model, mousePosition, selectionArea);
} | java | @SuppressWarnings({ "rawtypes" })
public MapElement getElementUnderMouse(GisPane<?> pane, double x, double y) {
final GISContainer model = pane.getDocumentModel();
final Point2d mousePosition = pane.toDocumentPosition(x, y);
final Rectangle2d selectionArea = pane.toDocumentRect(x - 2, y - 2, 5, 5);
return getElementUnderMouse(model, mousePosition, selectionArea);
} | [
"@",
"SuppressWarnings",
"(",
"{",
"\"rawtypes\"",
"}",
")",
"public",
"MapElement",
"getElementUnderMouse",
"(",
"GisPane",
"<",
"?",
">",
"pane",
",",
"double",
"x",
",",
"double",
"y",
")",
"{",
"final",
"GISContainer",
"model",
"=",
"pane",
".",
"getDo... | Replies the element at the given mouse position.
@param pane the element pane.
@param x the x position of the mouse.
@param y the y position of the mouse.
@return the element.
@since 15.0 | [
"Replies",
"the",
"element",
"at",
"the",
"given",
"mouse",
"position",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/gisroadfx/src/main/java/org/arakhne/afc/gis/road/ui/SimpleViewer.java#L261-L267 | train |
lightblueseas/swing-components | src/main/java/de/alpharogroup/swing/radio/model/EnumRadioButtonGroupBean.java | EnumRadioButtonGroupBean.getSelectedEnumFromRadioButtons | protected E getSelectedEnumFromRadioButtons()
{
for (final E enumValue : this.radioButtonMap.keySet())
{
final JRadioButton btn = this.radioButtonMap.get(enumValue);
if (btn.isSelected())
{
return enumValue;
}
}
return null;
} | java | protected E getSelectedEnumFromRadioButtons()
{
for (final E enumValue : this.radioButtonMap.keySet())
{
final JRadioButton btn = this.radioButtonMap.get(enumValue);
if (btn.isSelected())
{
return enumValue;
}
}
return null;
} | [
"protected",
"E",
"getSelectedEnumFromRadioButtons",
"(",
")",
"{",
"for",
"(",
"final",
"E",
"enumValue",
":",
"this",
".",
"radioButtonMap",
".",
"keySet",
"(",
")",
")",
"{",
"final",
"JRadioButton",
"btn",
"=",
"this",
".",
"radioButtonMap",
".",
"get",
... | Resolves the selected enum from the radio buttons.
@return the selected enum or null if none is selected. | [
"Resolves",
"the",
"selected",
"enum",
"from",
"the",
"radio",
"buttons",
"."
] | 4045e85cabd8f0ce985cbfff134c3c9873930c79 | https://github.com/lightblueseas/swing-components/blob/4045e85cabd8f0ce985cbfff134c3c9873930c79/src/main/java/de/alpharogroup/swing/radio/model/EnumRadioButtonGroupBean.java#L141-L152 | train |
lightblueseas/swing-components | src/main/java/de/alpharogroup/swing/radio/model/EnumRadioButtonGroupBean.java | EnumRadioButtonGroupBean.setSelectedRadioButton | private void setSelectedRadioButton(final E enumValue)
{
if (enumValue != null)
{
final JRadioButton radioButton = this.radioButtonMap.get(enumValue);
radioButton.setSelected(true);
}
else
{
for (final JRadioButton radioButton : this.radioButtonMap.values())
{
radioButton.setSelected(false);
}
}
} | java | private void setSelectedRadioButton(final E enumValue)
{
if (enumValue != null)
{
final JRadioButton radioButton = this.radioButtonMap.get(enumValue);
radioButton.setSelected(true);
}
else
{
for (final JRadioButton radioButton : this.radioButtonMap.values())
{
radioButton.setSelected(false);
}
}
} | [
"private",
"void",
"setSelectedRadioButton",
"(",
"final",
"E",
"enumValue",
")",
"{",
"if",
"(",
"enumValue",
"!=",
"null",
")",
"{",
"final",
"JRadioButton",
"radioButton",
"=",
"this",
".",
"radioButtonMap",
".",
"get",
"(",
"enumValue",
")",
";",
"radioB... | Sets the selected radio button.
@param enumValue
the new enum value to set | [
"Sets",
"the",
"selected",
"radio",
"button",
"."
] | 4045e85cabd8f0ce985cbfff134c3c9873930c79 | https://github.com/lightblueseas/swing-components/blob/4045e85cabd8f0ce985cbfff134c3c9873930c79/src/main/java/de/alpharogroup/swing/radio/model/EnumRadioButtonGroupBean.java#L171-L185 | train |
gallandarakhneorg/afc | advanced/bootique/bootique-variables/src/main/java/org/arakhne/afc/bootique/variables/VariableNames.java | VariableNames.toEnvironmentVariableName | public static String toEnvironmentVariableName(String bootiqueVariable) {
if (Strings.isNullOrEmpty(bootiqueVariable)) {
return null;
}
final StringBuilder name = new StringBuilder();
final Pattern pattern = Pattern.compile("((?:[a-z0_9_]+)|(?:[A-Z]+[^A-Z]*))"); //$NON-NLS-1$
for (final String component : bootiqueVariable.split("[^a-zA-Z0_9_]+")) { //$NON-NLS-1$
final Matcher matcher = pattern.matcher(component);
while (matcher.find()) {
final String word = matcher.group(1);
if (name.length() > 0) {
name.append("_"); //$NON-NLS-1$
}
name.append(word.toUpperCase());
}
}
return name.toString();
} | java | public static String toEnvironmentVariableName(String bootiqueVariable) {
if (Strings.isNullOrEmpty(bootiqueVariable)) {
return null;
}
final StringBuilder name = new StringBuilder();
final Pattern pattern = Pattern.compile("((?:[a-z0_9_]+)|(?:[A-Z]+[^A-Z]*))"); //$NON-NLS-1$
for (final String component : bootiqueVariable.split("[^a-zA-Z0_9_]+")) { //$NON-NLS-1$
final Matcher matcher = pattern.matcher(component);
while (matcher.find()) {
final String word = matcher.group(1);
if (name.length() > 0) {
name.append("_"); //$NON-NLS-1$
}
name.append(word.toUpperCase());
}
}
return name.toString();
} | [
"public",
"static",
"String",
"toEnvironmentVariableName",
"(",
"String",
"bootiqueVariable",
")",
"{",
"if",
"(",
"Strings",
".",
"isNullOrEmpty",
"(",
"bootiqueVariable",
")",
")",
"{",
"return",
"null",
";",
"}",
"final",
"StringBuilder",
"name",
"=",
"new",
... | Replies the name of an environment variable that corresponds to the name of a bootique variable.
@param bootiqueVariable the name of the bootique variable.
@return the name of the environment variable. | [
"Replies",
"the",
"name",
"of",
"an",
"environment",
"variable",
"that",
"corresponds",
"to",
"the",
"name",
"of",
"a",
"bootique",
"variable",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/bootique/bootique-variables/src/main/java/org/arakhne/afc/bootique/variables/VariableNames.java#L64-L81 | train |
digitalfondue/stampo | src/main/java/ch/digitalfondue/stampo/WatchDir.java | WatchDir.processEvent | void processEvent(DelayQueue<Delayed> delayQueue) {
// wait for key to be signaled
WatchKey key;
try {
key = watcher.poll(250, TimeUnit.MILLISECONDS);
} catch (InterruptedException | ClosedWatchServiceException x) {
return;
}
if(key == null) {
return;
}
Path dir = keys.get(key);
if (dir == null) {
return;
}
for (WatchEvent<?> event : key.pollEvents()) {
WatchEvent.Kind<?> kind = event.kind();
if (kind == OVERFLOW) {
continue;
}
// Context for directory entry event is the file name of entry
@SuppressWarnings("unchecked")
WatchEvent<Path> ev = (WatchEvent<Path>) event;
Path name = ev.context();
Path child = dir.resolve(name);
//
if (ignore.contains(child)) {
return;
}
if (!ignorePattern.stream().anyMatch(
m -> child.getFileSystem().getPathMatcher(m).matches(child.getFileName()))) {
delayQueue.add(new WatchDirDelay());
}
// if directory is created, and watching recursively, then
// register it and its sub-directories
if (kind == ENTRY_CREATE) {
try {
if (Files.isDirectory(child, NOFOLLOW_LINKS)) {
registerAll(child);
}
} catch (IOException x) {
}
}
}
// reset key and remove from set if directory no longer accessible
boolean valid = key.reset();
if (!valid) {
keys.remove(key);
// all directories are inaccessible
if (keys.isEmpty()) {
return;
}
}
} | java | void processEvent(DelayQueue<Delayed> delayQueue) {
// wait for key to be signaled
WatchKey key;
try {
key = watcher.poll(250, TimeUnit.MILLISECONDS);
} catch (InterruptedException | ClosedWatchServiceException x) {
return;
}
if(key == null) {
return;
}
Path dir = keys.get(key);
if (dir == null) {
return;
}
for (WatchEvent<?> event : key.pollEvents()) {
WatchEvent.Kind<?> kind = event.kind();
if (kind == OVERFLOW) {
continue;
}
// Context for directory entry event is the file name of entry
@SuppressWarnings("unchecked")
WatchEvent<Path> ev = (WatchEvent<Path>) event;
Path name = ev.context();
Path child = dir.resolve(name);
//
if (ignore.contains(child)) {
return;
}
if (!ignorePattern.stream().anyMatch(
m -> child.getFileSystem().getPathMatcher(m).matches(child.getFileName()))) {
delayQueue.add(new WatchDirDelay());
}
// if directory is created, and watching recursively, then
// register it and its sub-directories
if (kind == ENTRY_CREATE) {
try {
if (Files.isDirectory(child, NOFOLLOW_LINKS)) {
registerAll(child);
}
} catch (IOException x) {
}
}
}
// reset key and remove from set if directory no longer accessible
boolean valid = key.reset();
if (!valid) {
keys.remove(key);
// all directories are inaccessible
if (keys.isEmpty()) {
return;
}
}
} | [
"void",
"processEvent",
"(",
"DelayQueue",
"<",
"Delayed",
">",
"delayQueue",
")",
"{",
"// wait for key to be signaled",
"WatchKey",
"key",
";",
"try",
"{",
"key",
"=",
"watcher",
".",
"poll",
"(",
"250",
",",
"TimeUnit",
".",
"MILLISECONDS",
")",
";",
"}",... | Process a single key queued to the watcher
@param delayQueue | [
"Process",
"a",
"single",
"key",
"queued",
"to",
"the",
"watcher"
] | 5a41f20acd9211cf3951c30d0e0825994ae95573 | https://github.com/digitalfondue/stampo/blob/5a41f20acd9211cf3951c30d0e0825994ae95573/src/main/java/ch/digitalfondue/stampo/WatchDir.java#L124-L192 | train |
lightblueseas/swing-components | src/main/java/de/alpharogroup/swing/img/ImageExtensions.java | ImageExtensions.concatenateImages | public static BufferedImage concatenateImages(final List<BufferedImage> imgCollection,
final int width, final int height, final int imageType,
final Direction concatenationDirection)
{
final BufferedImage img = new BufferedImage(width, height, imageType);
int x = 0;
int y = 0;
for (final BufferedImage bi : imgCollection)
{
final boolean imageDrawn = img.createGraphics().drawImage(bi, x, y, null);
if (!imageDrawn)
{
throw new RuntimeException("BufferedImage could not be drawn:" + bi.toString());
}
if (concatenationDirection.equals(Direction.vertical))
{
y += bi.getHeight();
}
else
{
x += bi.getWidth();
}
}
return img;
} | java | public static BufferedImage concatenateImages(final List<BufferedImage> imgCollection,
final int width, final int height, final int imageType,
final Direction concatenationDirection)
{
final BufferedImage img = new BufferedImage(width, height, imageType);
int x = 0;
int y = 0;
for (final BufferedImage bi : imgCollection)
{
final boolean imageDrawn = img.createGraphics().drawImage(bi, x, y, null);
if (!imageDrawn)
{
throw new RuntimeException("BufferedImage could not be drawn:" + bi.toString());
}
if (concatenationDirection.equals(Direction.vertical))
{
y += bi.getHeight();
}
else
{
x += bi.getWidth();
}
}
return img;
} | [
"public",
"static",
"BufferedImage",
"concatenateImages",
"(",
"final",
"List",
"<",
"BufferedImage",
">",
"imgCollection",
",",
"final",
"int",
"width",
",",
"final",
"int",
"height",
",",
"final",
"int",
"imageType",
",",
"final",
"Direction",
"concatenationDire... | Concatenate the given list of BufferedImage objects to one image and returns the concatenated
BufferedImage object.
@param imgCollection
the BufferedImage collection
@param width
the width of the image that will be returned.
@param height
the height of the image that will be returned.
@param imageType
type of the created image
@param concatenationDirection
the direction of the concatenation.
@return the buffered image | [
"Concatenate",
"the",
"given",
"list",
"of",
"BufferedImage",
"objects",
"to",
"one",
"image",
"and",
"returns",
"the",
"concatenated",
"BufferedImage",
"object",
"."
] | 4045e85cabd8f0ce985cbfff134c3c9873930c79 | https://github.com/lightblueseas/swing-components/blob/4045e85cabd8f0ce985cbfff134c3c9873930c79/src/main/java/de/alpharogroup/swing/img/ImageExtensions.java#L90-L114 | train |
lightblueseas/swing-components | src/main/java/de/alpharogroup/swing/img/ImageExtensions.java | ImageExtensions.createPdf | public static void createPdf(final OutputStream result, final List<BufferedImage> images)
throws DocumentException, IOException
{
final Document document = new Document();
PdfWriter.getInstance(document, result);
for (final BufferedImage image : images)
{
final ByteArrayOutputStream baos = new ByteArrayOutputStream();
ImageIO.write(image, "png", baos);
final Image img = Image.getInstance(baos.toByteArray());
document.setPageSize(img);
document.newPage();
img.setAbsolutePosition(0, 0);
document.add(img);
}
document.close();
} | java | public static void createPdf(final OutputStream result, final List<BufferedImage> images)
throws DocumentException, IOException
{
final Document document = new Document();
PdfWriter.getInstance(document, result);
for (final BufferedImage image : images)
{
final ByteArrayOutputStream baos = new ByteArrayOutputStream();
ImageIO.write(image, "png", baos);
final Image img = Image.getInstance(baos.toByteArray());
document.setPageSize(img);
document.newPage();
img.setAbsolutePosition(0, 0);
document.add(img);
}
document.close();
} | [
"public",
"static",
"void",
"createPdf",
"(",
"final",
"OutputStream",
"result",
",",
"final",
"List",
"<",
"BufferedImage",
">",
"images",
")",
"throws",
"DocumentException",
",",
"IOException",
"{",
"final",
"Document",
"document",
"=",
"new",
"Document",
"(",... | Creates from the given Collection of images an pdf file.
@param result
the output stream from the pdf file where the images shell be written.
@param images
the BufferedImage collection to be written in the pdf file.
@throws DocumentException
is thrown if an error occurs when trying to get an instance of {@link PdfWriter}.
@throws IOException
Signals that an I/O exception has occurred. | [
"Creates",
"from",
"the",
"given",
"Collection",
"of",
"images",
"an",
"pdf",
"file",
"."
] | 4045e85cabd8f0ce985cbfff134c3c9873930c79 | https://github.com/lightblueseas/swing-components/blob/4045e85cabd8f0ce985cbfff134c3c9873930c79/src/main/java/de/alpharogroup/swing/img/ImageExtensions.java#L128-L144 | train |
lightblueseas/swing-components | src/main/java/de/alpharogroup/swing/img/ImageExtensions.java | ImageExtensions.resize | public static byte[] resize(final BufferedImage originalImage, final Method scalingMethod,
final Mode resizeMode, final String formatName, final int targetWidth,
final int targetHeight)
{
try
{
final BufferedImage resizedImage = Scalr.resize(originalImage, scalingMethod,
resizeMode, targetWidth, targetHeight);
return toByteArray(resizedImage, formatName);
}
catch (final Exception e)
{
return null;
}
} | java | public static byte[] resize(final BufferedImage originalImage, final Method scalingMethod,
final Mode resizeMode, final String formatName, final int targetWidth,
final int targetHeight)
{
try
{
final BufferedImage resizedImage = Scalr.resize(originalImage, scalingMethod,
resizeMode, targetWidth, targetHeight);
return toByteArray(resizedImage, formatName);
}
catch (final Exception e)
{
return null;
}
} | [
"public",
"static",
"byte",
"[",
"]",
"resize",
"(",
"final",
"BufferedImage",
"originalImage",
",",
"final",
"Method",
"scalingMethod",
",",
"final",
"Mode",
"resizeMode",
",",
"final",
"String",
"formatName",
",",
"final",
"int",
"targetWidth",
",",
"final",
... | Resize the given image.
@param originalImage
the original image
@param scalingMethod
the scaling method
@param resizeMode
the resize mode
@param formatName
the format name
@param targetWidth
the target width
@param targetHeight
the target height
@return the byte[] | [
"Resize",
"the",
"given",
"image",
"."
] | 4045e85cabd8f0ce985cbfff134c3c9873930c79 | https://github.com/lightblueseas/swing-components/blob/4045e85cabd8f0ce985cbfff134c3c9873930c79/src/main/java/de/alpharogroup/swing/img/ImageExtensions.java#L329-L343 | train |
lightblueseas/swing-components | src/main/java/de/alpharogroup/swing/img/ImageExtensions.java | ImageExtensions.resize | public static byte[] resize(final BufferedImage originalImage, final String formatName,
final int targetWidth, final int targetHeight)
{
return resize(originalImage, Scalr.Method.QUALITY, Scalr.Mode.FIT_EXACT, formatName,
targetWidth, targetHeight);
} | java | public static byte[] resize(final BufferedImage originalImage, final String formatName,
final int targetWidth, final int targetHeight)
{
return resize(originalImage, Scalr.Method.QUALITY, Scalr.Mode.FIT_EXACT, formatName,
targetWidth, targetHeight);
} | [
"public",
"static",
"byte",
"[",
"]",
"resize",
"(",
"final",
"BufferedImage",
"originalImage",
",",
"final",
"String",
"formatName",
",",
"final",
"int",
"targetWidth",
",",
"final",
"int",
"targetHeight",
")",
"{",
"return",
"resize",
"(",
"originalImage",
"... | Resize the given BufferedImage.
@param originalImage
the original image
@param formatName
the format name
@param targetWidth
the target width
@param targetHeight
the target height
@return the byte[] | [
"Resize",
"the",
"given",
"BufferedImage",
"."
] | 4045e85cabd8f0ce985cbfff134c3c9873930c79 | https://github.com/lightblueseas/swing-components/blob/4045e85cabd8f0ce985cbfff134c3c9873930c79/src/main/java/de/alpharogroup/swing/img/ImageExtensions.java#L358-L363 | train |
lightblueseas/swing-components | src/main/java/de/alpharogroup/swing/img/ImageExtensions.java | ImageExtensions.toByteArray | public static byte[] toByteArray(final BufferedImage bi, final String formatName)
throws IOException
{
try (ByteArrayOutputStream baos = new ByteArrayOutputStream())
{
ImageIO.write(bi, formatName, baos);
baos.flush();
final byte[] byteArray = baos.toByteArray();
return byteArray;
}
} | java | public static byte[] toByteArray(final BufferedImage bi, final String formatName)
throws IOException
{
try (ByteArrayOutputStream baos = new ByteArrayOutputStream())
{
ImageIO.write(bi, formatName, baos);
baos.flush();
final byte[] byteArray = baos.toByteArray();
return byteArray;
}
} | [
"public",
"static",
"byte",
"[",
"]",
"toByteArray",
"(",
"final",
"BufferedImage",
"bi",
",",
"final",
"String",
"formatName",
")",
"throws",
"IOException",
"{",
"try",
"(",
"ByteArrayOutputStream",
"baos",
"=",
"new",
"ByteArrayOutputStream",
"(",
")",
")",
... | Converts the given BufferedImage to a byte array.
@param bi
the bi
@param formatName
the format name
@return the byte[]
@throws IOException
Signals that an I/O exception has occurred. | [
"Converts",
"the",
"given",
"BufferedImage",
"to",
"a",
"byte",
"array",
"."
] | 4045e85cabd8f0ce985cbfff134c3c9873930c79 | https://github.com/lightblueseas/swing-components/blob/4045e85cabd8f0ce985cbfff134c3c9873930c79/src/main/java/de/alpharogroup/swing/img/ImageExtensions.java#L376-L386 | train |
gallandarakhneorg/afc | advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/tree/AbstractGISTreeSetNode.java | AbstractGISTreeSetNode.calcBounds | @Pure
protected Rectangle2d calcBounds() {
final Rectangle2d bb = new Rectangle2d();
boolean first = true;
Rectangle2afp<?, ?, ?, ?, ?, ?> b;
// Child bounds
N child;
for (int i = 0; i < getChildCount(); ++i) {
child = getChildAt(i);
if (child != null) {
b = child.getBounds();
if (b != null) {
if (first) {
first = false;
bb.setFromCorners(
b.getMinX(),
b.getMinY(),
b.getMaxX(),
b.getMaxY());
} else {
bb.setUnion(b);
}
}
}
}
// Data bounds
P primitive;
GeoLocation location;
for (int i = 0; i < getUserDataCount(); ++i) {
primitive = getUserDataAt(i);
if (primitive != null) {
location = primitive.getGeoLocation();
if (location != null) {
b = location.toBounds2D();
if (b != null) {
if (first) {
first = false;
bb.setFromCorners(
b.getMinX(),
b.getMinY(),
b.getMaxX(),
b.getMaxY());
} else {
bb.setUnion(b);
}
}
}
}
}
return first ? null : bb;
} | java | @Pure
protected Rectangle2d calcBounds() {
final Rectangle2d bb = new Rectangle2d();
boolean first = true;
Rectangle2afp<?, ?, ?, ?, ?, ?> b;
// Child bounds
N child;
for (int i = 0; i < getChildCount(); ++i) {
child = getChildAt(i);
if (child != null) {
b = child.getBounds();
if (b != null) {
if (first) {
first = false;
bb.setFromCorners(
b.getMinX(),
b.getMinY(),
b.getMaxX(),
b.getMaxY());
} else {
bb.setUnion(b);
}
}
}
}
// Data bounds
P primitive;
GeoLocation location;
for (int i = 0; i < getUserDataCount(); ++i) {
primitive = getUserDataAt(i);
if (primitive != null) {
location = primitive.getGeoLocation();
if (location != null) {
b = location.toBounds2D();
if (b != null) {
if (first) {
first = false;
bb.setFromCorners(
b.getMinX(),
b.getMinY(),
b.getMaxX(),
b.getMaxY());
} else {
bb.setUnion(b);
}
}
}
}
}
return first ? null : bb;
} | [
"@",
"Pure",
"protected",
"Rectangle2d",
"calcBounds",
"(",
")",
"{",
"final",
"Rectangle2d",
"bb",
"=",
"new",
"Rectangle2d",
"(",
")",
";",
"boolean",
"first",
"=",
"true",
";",
"Rectangle2afp",
"<",
"?",
",",
"?",
",",
"?",
",",
"?",
",",
"?",
","... | Compute and replies the bounds for this node.
@return bounds | [
"Compute",
"and",
"replies",
"the",
"bounds",
"for",
"this",
"node",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/tree/AbstractGISTreeSetNode.java#L251-L304 | train |
gallandarakhneorg/afc | advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/primitive/AbstractGISElement.java | AbstractGISElement.setContainer | public boolean setContainer(C container) {
this.mapContainer = container == null ? null : new WeakReference<>(container);
return true;
} | java | public boolean setContainer(C container) {
this.mapContainer = container == null ? null : new WeakReference<>(container);
return true;
} | [
"public",
"boolean",
"setContainer",
"(",
"C",
"container",
")",
"{",
"this",
".",
"mapContainer",
"=",
"container",
"==",
"null",
"?",
"null",
":",
"new",
"WeakReference",
"<>",
"(",
"container",
")",
";",
"return",
"true",
";",
"}"
] | Sets the container of this MapElement.
@param container the new container.
@return the success state of the operation. | [
"Sets",
"the",
"container",
"of",
"this",
"MapElement",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/primitive/AbstractGISElement.java#L139-L142 | train |
gallandarakhneorg/afc | advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/primitive/AbstractGISElement.java | AbstractGISElement.getTopContainer | @Pure
public Object getTopContainer() {
if (this.mapContainer == null) {
return null;
}
final C container = this.mapContainer.get();
if (container == null) {
return null;
}
if (container instanceof GISContentElement<?>) {
return ((GISContentElement<?>) container).getTopContainer();
}
return container;
} | java | @Pure
public Object getTopContainer() {
if (this.mapContainer == null) {
return null;
}
final C container = this.mapContainer.get();
if (container == null) {
return null;
}
if (container instanceof GISContentElement<?>) {
return ((GISContentElement<?>) container).getTopContainer();
}
return container;
} | [
"@",
"Pure",
"public",
"Object",
"getTopContainer",
"(",
")",
"{",
"if",
"(",
"this",
".",
"mapContainer",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"final",
"C",
"container",
"=",
"this",
".",
"mapContainer",
".",
"get",
"(",
")",
";",
"if... | Replies the top-most object which contains this MapElement.
@return the top container or <code>null</code> | [
"Replies",
"the",
"top",
"-",
"most",
"object",
"which",
"contains",
"this",
"MapElement",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/primitive/AbstractGISElement.java#L157-L170 | train |
gallandarakhneorg/afc | advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/primitive/AbstractGISElement.java | AbstractGISElement.getUUID | @Override
@Pure
public UUID getUUID() {
if (this.uid == null) {
this.uid = UUID.randomUUID();
}
return this.uid;
} | java | @Override
@Pure
public UUID getUUID() {
if (this.uid == null) {
this.uid = UUID.randomUUID();
}
return this.uid;
} | [
"@",
"Override",
"@",
"Pure",
"public",
"UUID",
"getUUID",
"(",
")",
"{",
"if",
"(",
"this",
".",
"uid",
"==",
"null",
")",
"{",
"this",
".",
"uid",
"=",
"UUID",
".",
"randomUUID",
"(",
")",
";",
"}",
"return",
"this",
".",
"uid",
";",
"}"
] | Replies an unique identifier for element.
<p>A Unique IDentifier (UID) must be unique for all the object instances.
<p>The following code is always true (where the arguments of the
constructors are the list of points of the polyline). It illustrates
that for two elements with the same geo-localized points, they
have the same geo-location identifier (Geo-Id) and they
have different unique ientifier (Uid):
<pre><code>
GISElement obj1 = new MapPolyline(100,10,200,30,300,4);
GISElement obj2 = new MapPolyline(100,10,200,30,300,4);
assert( obj1.getGeoId().equals(obj2.getGeoId()) );
assert( obj2.getGeoId().equals(obj1.getGeoId()) );
assert( ! obj1.getUid().equals(obj2.getUid()) );
assert( ! obj2.getUid().equals(obj1.getUid()) );
</code></pre>
@return an identifier
@since 4.0 | [
"Replies",
"an",
"unique",
"identifier",
"for",
"element",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/primitive/AbstractGISElement.java#L223-L230 | train |
gallandarakhneorg/afc | advanced/gis/gisbusinputoutput/src/main/java/org/arakhne/afc/gis/bus/io/xml/XMLBusNetworkUtil.java | XMLBusNetworkUtil.writeBusNetwork | @SuppressWarnings("checkstyle:npathcomplexity")
public static Node writeBusNetwork(BusNetwork busNetwork, XMLBuilder builder, XMLResources resources) throws IOException {
final Element element = builder.createElement(NODE_BUSNETWORK);
writeGISElementAttributes(element, busNetwork, builder, resources);
final Integer color = busNetwork.getRawColor();
if (color != null) {
element.setAttribute(ATTR_COLOR, toColor(color));
}
final Element stopsNode = builder.createElement(NODE_BUSSTOPS);
for (final BusStop stop : busNetwork.busStops()) {
final Node stopNode = writeBusStop(stop, builder, resources);
if (stopNode != null) {
stopsNode.appendChild(stopNode);
}
}
if (stopsNode.getChildNodes().getLength() > 0) {
element.appendChild(stopsNode);
}
final Element hubsNode = builder.createElement(NODE_BUSHUBS);
for (final BusHub hub : busNetwork.busHubs()) {
final Node hubNode = writeBusHub(hub, builder, resources);
if (hubNode != null) {
hubsNode.appendChild(hubNode);
}
}
if (hubsNode.getChildNodes().getLength() > 0) {
element.appendChild(hubsNode);
}
final Element linesNode = builder.createElement(NODE_BUSLINES);
for (final BusLine line : busNetwork.busLines()) {
final Node lineNode = writeBusLine(line, builder, resources);
if (lineNode != null) {
linesNode.appendChild(lineNode);
}
}
if (linesNode.getChildNodes().getLength() > 0) {
element.appendChild(linesNode);
}
return element;
} | java | @SuppressWarnings("checkstyle:npathcomplexity")
public static Node writeBusNetwork(BusNetwork busNetwork, XMLBuilder builder, XMLResources resources) throws IOException {
final Element element = builder.createElement(NODE_BUSNETWORK);
writeGISElementAttributes(element, busNetwork, builder, resources);
final Integer color = busNetwork.getRawColor();
if (color != null) {
element.setAttribute(ATTR_COLOR, toColor(color));
}
final Element stopsNode = builder.createElement(NODE_BUSSTOPS);
for (final BusStop stop : busNetwork.busStops()) {
final Node stopNode = writeBusStop(stop, builder, resources);
if (stopNode != null) {
stopsNode.appendChild(stopNode);
}
}
if (stopsNode.getChildNodes().getLength() > 0) {
element.appendChild(stopsNode);
}
final Element hubsNode = builder.createElement(NODE_BUSHUBS);
for (final BusHub hub : busNetwork.busHubs()) {
final Node hubNode = writeBusHub(hub, builder, resources);
if (hubNode != null) {
hubsNode.appendChild(hubNode);
}
}
if (hubsNode.getChildNodes().getLength() > 0) {
element.appendChild(hubsNode);
}
final Element linesNode = builder.createElement(NODE_BUSLINES);
for (final BusLine line : busNetwork.busLines()) {
final Node lineNode = writeBusLine(line, builder, resources);
if (lineNode != null) {
linesNode.appendChild(lineNode);
}
}
if (linesNode.getChildNodes().getLength() > 0) {
element.appendChild(linesNode);
}
return element;
} | [
"@",
"SuppressWarnings",
"(",
"\"checkstyle:npathcomplexity\"",
")",
"public",
"static",
"Node",
"writeBusNetwork",
"(",
"BusNetwork",
"busNetwork",
",",
"XMLBuilder",
"builder",
",",
"XMLResources",
"resources",
")",
"throws",
"IOException",
"{",
"final",
"Element",
... | Create and reply an XML representation of the given bus network.
@param busNetwork is the bus network to translate into XML.
@param builder is the tool that permits to create XML elements.
@param resources is the tool that permits to gather the resources.
@return the XML representation of the given bus network.
@throws IOException in case of error. | [
"Create",
"and",
"reply",
"an",
"XML",
"representation",
"of",
"the",
"given",
"bus",
"network",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/gisbusinputoutput/src/main/java/org/arakhne/afc/gis/bus/io/xml/XMLBusNetworkUtil.java#L137-L181 | train |
gallandarakhneorg/afc | advanced/gis/gisbusinputoutput/src/main/java/org/arakhne/afc/gis/bus/io/xml/XMLBusNetworkUtil.java | XMLBusNetworkUtil.readBusNetwork | public static BusNetwork readBusNetwork(Element xmlNode, RoadNetwork roadNetwork,
PathBuilder pathBuilder, XMLResources resources) throws IOException {
final UUID id = getAttributeUUID(xmlNode, NODE_BUSNETWORK, ATTR_ID);
final BusNetwork busNetwork = new BusNetwork(id, roadNetwork);
final Node stopsNode = getNodeFromPath(xmlNode, NODE_BUSNETWORK, NODE_BUSSTOPS);
if (stopsNode != null) {
for (final Element stopNode : getElementsFromPath(stopsNode, NODE_BUSSTOP)) {
final BusStop stop = readBusStop(stopNode, pathBuilder, resources);
if (stop != null) {
busNetwork.addBusStop(stop);
}
}
}
final Node hubsNode = getNodeFromPath(xmlNode, NODE_BUSNETWORK, NODE_BUSHUBS);
if (hubsNode != null) {
for (final Element hubNode : getElementsFromPath(hubsNode, NODE_BUSHUB)) {
readBusHub(hubNode, busNetwork, pathBuilder, resources);
}
}
final Node linesNode = getNodeFromPath(xmlNode, NODE_BUSNETWORK, NODE_BUSLINES);
if (linesNode != null) {
BusLine line;
for (final Element lineNode : getElementsFromPath(linesNode, NODE_BUSLINE)) {
line = readBusLine(lineNode, busNetwork, roadNetwork, pathBuilder, resources);
if (line != null) {
busNetwork.addBusLine(line);
}
}
}
readGISElementAttributes(xmlNode, busNetwork, pathBuilder, resources);
final Integer color = getAttributeColorWithDefault(xmlNode, null, ATTR_COLOR);
if (color != null) {
busNetwork.setColor(color);
}
// Force the validity checking to be sure
// that all the primitives are valid or not
busNetwork.revalidate();
return busNetwork;
} | java | public static BusNetwork readBusNetwork(Element xmlNode, RoadNetwork roadNetwork,
PathBuilder pathBuilder, XMLResources resources) throws IOException {
final UUID id = getAttributeUUID(xmlNode, NODE_BUSNETWORK, ATTR_ID);
final BusNetwork busNetwork = new BusNetwork(id, roadNetwork);
final Node stopsNode = getNodeFromPath(xmlNode, NODE_BUSNETWORK, NODE_BUSSTOPS);
if (stopsNode != null) {
for (final Element stopNode : getElementsFromPath(stopsNode, NODE_BUSSTOP)) {
final BusStop stop = readBusStop(stopNode, pathBuilder, resources);
if (stop != null) {
busNetwork.addBusStop(stop);
}
}
}
final Node hubsNode = getNodeFromPath(xmlNode, NODE_BUSNETWORK, NODE_BUSHUBS);
if (hubsNode != null) {
for (final Element hubNode : getElementsFromPath(hubsNode, NODE_BUSHUB)) {
readBusHub(hubNode, busNetwork, pathBuilder, resources);
}
}
final Node linesNode = getNodeFromPath(xmlNode, NODE_BUSNETWORK, NODE_BUSLINES);
if (linesNode != null) {
BusLine line;
for (final Element lineNode : getElementsFromPath(linesNode, NODE_BUSLINE)) {
line = readBusLine(lineNode, busNetwork, roadNetwork, pathBuilder, resources);
if (line != null) {
busNetwork.addBusLine(line);
}
}
}
readGISElementAttributes(xmlNode, busNetwork, pathBuilder, resources);
final Integer color = getAttributeColorWithDefault(xmlNode, null, ATTR_COLOR);
if (color != null) {
busNetwork.setColor(color);
}
// Force the validity checking to be sure
// that all the primitives are valid or not
busNetwork.revalidate();
return busNetwork;
} | [
"public",
"static",
"BusNetwork",
"readBusNetwork",
"(",
"Element",
"xmlNode",
",",
"RoadNetwork",
"roadNetwork",
",",
"PathBuilder",
"pathBuilder",
",",
"XMLResources",
"resources",
")",
"throws",
"IOException",
"{",
"final",
"UUID",
"id",
"=",
"getAttributeUUID",
... | Create and reply the bus network which is described by the given XML representation.
@param xmlNode is the node to explore.
@param roadNetwork is the road network on which the bus network is mapped.
@param pathBuilder is the tool that permits to make absolute paths.
@param resources is the tool that permits to gather the resources.
@return the bus network.
@throws IOException in case of error. | [
"Create",
"and",
"reply",
"the",
"bus",
"network",
"which",
"is",
"described",
"by",
"the",
"given",
"XML",
"representation",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/gisbusinputoutput/src/main/java/org/arakhne/afc/gis/bus/io/xml/XMLBusNetworkUtil.java#L312-L357 | train |
gallandarakhneorg/afc | core/inputoutput/src/main/java/org/arakhne/afc/inputoutput/stream/LittleEndianDataInputStream.java | LittleEndianDataInputStream.readBELong | public long readBELong() throws IOException {
return EndianNumbers.toBELong(read(), read(), read(), read(), read(), read(), read(), read());
} | java | public long readBELong() throws IOException {
return EndianNumbers.toBELong(read(), read(), read(), read(), read(), read(), read(), read());
} | [
"public",
"long",
"readBELong",
"(",
")",
"throws",
"IOException",
"{",
"return",
"EndianNumbers",
".",
"toBELong",
"(",
"read",
"(",
")",
",",
"read",
"(",
")",
",",
"read",
"(",
")",
",",
"read",
"(",
")",
",",
"read",
"(",
")",
",",
"read",
"(",... | Read a Big Endian long on 8 bytes.
<p>According to the contract of {@link DataInput#readLong()} this function is equivalent to.
@return the value red from the input stream
@throws IOException on error. | [
"Read",
"a",
"Big",
"Endian",
"long",
"on",
"8",
"bytes",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/inputoutput/src/main/java/org/arakhne/afc/inputoutput/stream/LittleEndianDataInputStream.java#L98-L100 | train |
gallandarakhneorg/afc | core/inputoutput/src/main/java/org/arakhne/afc/inputoutput/stream/LittleEndianDataInputStream.java | LittleEndianDataInputStream.readLELong | public long readLELong() throws IOException {
return EndianNumbers.toLELong(read(), read(), read(), read(), read(), read(), read(), read());
} | java | public long readLELong() throws IOException {
return EndianNumbers.toLELong(read(), read(), read(), read(), read(), read(), read(), read());
} | [
"public",
"long",
"readLELong",
"(",
")",
"throws",
"IOException",
"{",
"return",
"EndianNumbers",
".",
"toLELong",
"(",
"read",
"(",
")",
",",
"read",
"(",
")",
",",
"read",
"(",
")",
",",
"read",
"(",
")",
",",
"read",
"(",
")",
",",
"read",
"(",... | Read a Little Endian long on 8 bytes.
@return the value red from the input stream
@throws IOException on error. | [
"Read",
"a",
"Little",
"Endian",
"long",
"on",
"8",
"bytes",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/inputoutput/src/main/java/org/arakhne/afc/inputoutput/stream/LittleEndianDataInputStream.java#L150-L152 | train |
gallandarakhneorg/afc | advanced/nodefx/src/main/java/org/arakhne/afc/nodefx/Drawers.java | Drawers.getAllDrawers | @SuppressWarnings("unchecked")
@Pure
public static Iterator<Drawer<?>> getAllDrawers() {
if (services == null) {
services = ServiceLoader.load(Drawer.class);
}
return services.iterator();
} | java | @SuppressWarnings("unchecked")
@Pure
public static Iterator<Drawer<?>> getAllDrawers() {
if (services == null) {
services = ServiceLoader.load(Drawer.class);
}
return services.iterator();
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"@",
"Pure",
"public",
"static",
"Iterator",
"<",
"Drawer",
"<",
"?",
">",
">",
"getAllDrawers",
"(",
")",
"{",
"if",
"(",
"services",
"==",
"null",
")",
"{",
"services",
"=",
"ServiceLoader",
".",
"loa... | Replies all the registered document drawers.
@return the drawers. | [
"Replies",
"all",
"the",
"registered",
"document",
"drawers",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/nodefx/src/main/java/org/arakhne/afc/nodefx/Drawers.java#L62-L69 | train |
gallandarakhneorg/afc | advanced/nodefx/src/main/java/org/arakhne/afc/nodefx/Drawers.java | Drawers.getDrawerFor | @SuppressWarnings("unchecked")
@Pure
public static <T> Drawer<T> getDrawerFor(Class<? extends T> type) {
assert type != null : AssertMessages.notNullParameter();
final Drawer<?> bufferedType = buffer.get(type);
Drawer<T> defaultChoice = null;
if (bufferedType != null) {
defaultChoice = (Drawer<T>) bufferedType;
} else {
final Iterator<Drawer<?>> iterator = getAllDrawers();
while (iterator.hasNext()) {
final Drawer<?> drawer = iterator.next();
final Class<?> drawerType = drawer.getPrimitiveType();
if (drawerType.equals(type)) {
defaultChoice = (Drawer<T>) drawer;
break;
} else if (drawerType.isAssignableFrom(type)
&& (defaultChoice == null
|| drawerType.isAssignableFrom(defaultChoice.getPrimitiveType()))) {
defaultChoice = (Drawer<T>) drawer;
}
}
if (defaultChoice != null) {
buffer.put(type, defaultChoice);
}
}
return defaultChoice;
} | java | @SuppressWarnings("unchecked")
@Pure
public static <T> Drawer<T> getDrawerFor(Class<? extends T> type) {
assert type != null : AssertMessages.notNullParameter();
final Drawer<?> bufferedType = buffer.get(type);
Drawer<T> defaultChoice = null;
if (bufferedType != null) {
defaultChoice = (Drawer<T>) bufferedType;
} else {
final Iterator<Drawer<?>> iterator = getAllDrawers();
while (iterator.hasNext()) {
final Drawer<?> drawer = iterator.next();
final Class<?> drawerType = drawer.getPrimitiveType();
if (drawerType.equals(type)) {
defaultChoice = (Drawer<T>) drawer;
break;
} else if (drawerType.isAssignableFrom(type)
&& (defaultChoice == null
|| drawerType.isAssignableFrom(defaultChoice.getPrimitiveType()))) {
defaultChoice = (Drawer<T>) drawer;
}
}
if (defaultChoice != null) {
buffer.put(type, defaultChoice);
}
}
return defaultChoice;
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"@",
"Pure",
"public",
"static",
"<",
"T",
">",
"Drawer",
"<",
"T",
">",
"getDrawerFor",
"(",
"Class",
"<",
"?",
"extends",
"T",
">",
"type",
")",
"{",
"assert",
"type",
"!=",
"null",
":",
"AssertMess... | Replies the first registered document drawer that is supporting the given type.
<p>If multiple drawers handles the given type, the ones handling the top most type
within the type hierarchy are selected. If there is more than one drawer selected,
the first encountered is chosen. In this case, there is no warranty about the
order of the drawers; and the replied drawer may be any of the selected drawers.
The only assumption that could be done on the order of the drawers is:
if only one Jar library provides drawers' implementation, then the order of
the drawers is the same as the order of the types declared within the service's file.
@param <T> the type of the elements to drawer.
@param type the type of the elements to drawer.
@return the drawer, or {@code null} if none. | [
"Replies",
"the",
"first",
"registered",
"document",
"drawer",
"that",
"is",
"supporting",
"the",
"given",
"type",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/nodefx/src/main/java/org/arakhne/afc/nodefx/Drawers.java#L85-L112 | train |
gallandarakhneorg/afc | advanced/mathfx/src/main/java/org/arakhne/afc/math/geometry/d2/dfx/RoundRectangle2dfx.java | RoundRectangle2dfx.arcWidthProperty | public DoubleProperty arcWidthProperty() {
if (this.arcWidth == null) {
this.arcWidth = new DependentSimpleDoubleProperty<ReadOnlyDoubleProperty>(
this, MathFXAttributeNames.ARC_WIDTH, widthProperty()) {
@Override
protected void invalidated(ReadOnlyDoubleProperty dependency) {
final double value = get();
if (value < 0.) {
set(0.);
} else {
final double maxArcWidth = dependency.get() / 2.;
if (value > maxArcWidth) {
set(maxArcWidth);
}
}
}
};
}
return this.arcWidth;
} | java | public DoubleProperty arcWidthProperty() {
if (this.arcWidth == null) {
this.arcWidth = new DependentSimpleDoubleProperty<ReadOnlyDoubleProperty>(
this, MathFXAttributeNames.ARC_WIDTH, widthProperty()) {
@Override
protected void invalidated(ReadOnlyDoubleProperty dependency) {
final double value = get();
if (value < 0.) {
set(0.);
} else {
final double maxArcWidth = dependency.get() / 2.;
if (value > maxArcWidth) {
set(maxArcWidth);
}
}
}
};
}
return this.arcWidth;
} | [
"public",
"DoubleProperty",
"arcWidthProperty",
"(",
")",
"{",
"if",
"(",
"this",
".",
"arcWidth",
"==",
"null",
")",
"{",
"this",
".",
"arcWidth",
"=",
"new",
"DependentSimpleDoubleProperty",
"<",
"ReadOnlyDoubleProperty",
">",
"(",
"this",
",",
"MathFXAttribut... | Replies the property for the arc width.
@return the arcWidth property. | [
"Replies",
"the",
"property",
"for",
"the",
"arc",
"width",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/mathfx/src/main/java/org/arakhne/afc/math/geometry/d2/dfx/RoundRectangle2dfx.java#L126-L145 | train |
gallandarakhneorg/afc | advanced/mathfx/src/main/java/org/arakhne/afc/math/geometry/d2/dfx/RoundRectangle2dfx.java | RoundRectangle2dfx.arcHeightProperty | public DoubleProperty arcHeightProperty() {
if (this.arcHeight == null) {
this.arcHeight = new DependentSimpleDoubleProperty<ReadOnlyDoubleProperty>(
this, MathFXAttributeNames.ARC_HEIGHT, heightProperty()) {
@Override
protected void invalidated(ReadOnlyDoubleProperty dependency) {
final double value = get();
if (value < 0.) {
set(0.);
} else {
final double maxArcHeight = dependency.get() / 2.;
if (value > maxArcHeight) {
set(maxArcHeight);
}
}
}
};
}
return this.arcHeight;
} | java | public DoubleProperty arcHeightProperty() {
if (this.arcHeight == null) {
this.arcHeight = new DependentSimpleDoubleProperty<ReadOnlyDoubleProperty>(
this, MathFXAttributeNames.ARC_HEIGHT, heightProperty()) {
@Override
protected void invalidated(ReadOnlyDoubleProperty dependency) {
final double value = get();
if (value < 0.) {
set(0.);
} else {
final double maxArcHeight = dependency.get() / 2.;
if (value > maxArcHeight) {
set(maxArcHeight);
}
}
}
};
}
return this.arcHeight;
} | [
"public",
"DoubleProperty",
"arcHeightProperty",
"(",
")",
"{",
"if",
"(",
"this",
".",
"arcHeight",
"==",
"null",
")",
"{",
"this",
".",
"arcHeight",
"=",
"new",
"DependentSimpleDoubleProperty",
"<",
"ReadOnlyDoubleProperty",
">",
"(",
"this",
",",
"MathFXAttri... | Replies the property for the arc height.
@return the arcHeight property. | [
"Replies",
"the",
"property",
"for",
"the",
"arc",
"height",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/mathfx/src/main/java/org/arakhne/afc/math/geometry/d2/dfx/RoundRectangle2dfx.java#L157-L176 | train |
gallandarakhneorg/afc | advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/location/GeoId.java | GeoId.toBounds2D | @Pure
public Rectangle2d toBounds2D() {
int startIndex = this.id.indexOf('#');
if (startIndex <= 0) {
return null;
}
try {
int endIndex = this.id.indexOf(';', startIndex);
if (endIndex <= startIndex) {
return null;
}
final long minx = Long.parseLong(this.id.substring(startIndex + 1, endIndex));
startIndex = endIndex + 1;
endIndex = this.id.indexOf(';', startIndex);
if (endIndex <= startIndex) {
return null;
}
final long miny = Long.parseLong(this.id.substring(startIndex, endIndex));
startIndex = endIndex + 1;
endIndex = this.id.indexOf(';', startIndex);
if (endIndex <= startIndex) {
return null;
}
final long maxx = Long.parseLong(this.id.substring(startIndex, endIndex));
startIndex = endIndex + 1;
final long maxy = Long.parseLong(this.id.substring(startIndex));
final Rectangle2d r = new Rectangle2d();
r.setFromCorners(minx, miny, maxx, maxy);
return r;
} catch (Throwable exception) {
//
}
return null;
} | java | @Pure
public Rectangle2d toBounds2D() {
int startIndex = this.id.indexOf('#');
if (startIndex <= 0) {
return null;
}
try {
int endIndex = this.id.indexOf(';', startIndex);
if (endIndex <= startIndex) {
return null;
}
final long minx = Long.parseLong(this.id.substring(startIndex + 1, endIndex));
startIndex = endIndex + 1;
endIndex = this.id.indexOf(';', startIndex);
if (endIndex <= startIndex) {
return null;
}
final long miny = Long.parseLong(this.id.substring(startIndex, endIndex));
startIndex = endIndex + 1;
endIndex = this.id.indexOf(';', startIndex);
if (endIndex <= startIndex) {
return null;
}
final long maxx = Long.parseLong(this.id.substring(startIndex, endIndex));
startIndex = endIndex + 1;
final long maxy = Long.parseLong(this.id.substring(startIndex));
final Rectangle2d r = new Rectangle2d();
r.setFromCorners(minx, miny, maxx, maxy);
return r;
} catch (Throwable exception) {
//
}
return null;
} | [
"@",
"Pure",
"public",
"Rectangle2d",
"toBounds2D",
"(",
")",
"{",
"int",
"startIndex",
"=",
"this",
".",
"id",
".",
"indexOf",
"(",
"'",
"'",
")",
";",
"if",
"(",
"startIndex",
"<=",
"0",
")",
"{",
"return",
"null",
";",
"}",
"try",
"{",
"int",
... | Extract the primitive bounds from this geoId.
<p>A geoId is an identifier from which the localization could be extracted.
The location is here restricted to the bounds of the primitives.
@return a rectangle or <code>null</code> if invalid geoid. | [
"Extract",
"the",
"primitive",
"bounds",
"from",
"this",
"geoId",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/location/GeoId.java#L165-L204 | train |
gallandarakhneorg/afc | advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/location/GeoId.java | GeoId.getInternalId | @Pure
public String getInternalId() {
final int endIndex = this.id.indexOf('#');
if (endIndex <= 0) {
return null;
}
return this.id.substring(0, endIndex);
} | java | @Pure
public String getInternalId() {
final int endIndex = this.id.indexOf('#');
if (endIndex <= 0) {
return null;
}
return this.id.substring(0, endIndex);
} | [
"@",
"Pure",
"public",
"String",
"getInternalId",
"(",
")",
"{",
"final",
"int",
"endIndex",
"=",
"this",
".",
"id",
".",
"indexOf",
"(",
"'",
"'",
")",
";",
"if",
"(",
"endIndex",
"<=",
"0",
")",
"{",
"return",
"null",
";",
"}",
"return",
"this",
... | Extract the unique identifier stored in this geoId.
@return the internal identifier or <code>null</code> if this
geoid has invalid format. | [
"Extract",
"the",
"unique",
"identifier",
"stored",
"in",
"this",
"geoId",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/giscore/src/main/java/org/arakhne/afc/gis/location/GeoId.java#L211-L218 | train |
killme2008/hs4j | src/main/java/com/google/code/hs4j/network/nio/impl/Reactor.java | Reactor.checkSessionTimeout | private final long checkSessionTimeout() {
long nextTimeout = 0;
if (configuration.getCheckSessionTimeoutInterval() > 0) {
gate.lock();
try {
if (selectTries * 1000 >= configuration
.getCheckSessionTimeoutInterval()) {
nextTimeout = configuration
.getCheckSessionTimeoutInterval();
for (SelectionKey key : selector.keys()) {
if (key.attachment() != null) {
long n = checkExpiredIdle(key,
getSessionFromAttchment(key));
nextTimeout = n < nextTimeout ? n : nextTimeout;
}
}
selectTries = 0;
}
} finally {
gate.unlock();
}
}
return nextTimeout;
} | java | private final long checkSessionTimeout() {
long nextTimeout = 0;
if (configuration.getCheckSessionTimeoutInterval() > 0) {
gate.lock();
try {
if (selectTries * 1000 >= configuration
.getCheckSessionTimeoutInterval()) {
nextTimeout = configuration
.getCheckSessionTimeoutInterval();
for (SelectionKey key : selector.keys()) {
if (key.attachment() != null) {
long n = checkExpiredIdle(key,
getSessionFromAttchment(key));
nextTimeout = n < nextTimeout ? n : nextTimeout;
}
}
selectTries = 0;
}
} finally {
gate.unlock();
}
}
return nextTimeout;
} | [
"private",
"final",
"long",
"checkSessionTimeout",
"(",
")",
"{",
"long",
"nextTimeout",
"=",
"0",
";",
"if",
"(",
"configuration",
".",
"getCheckSessionTimeoutInterval",
"(",
")",
">",
"0",
")",
"{",
"gate",
".",
"lock",
"(",
")",
";",
"try",
"{",
"if",... | Check session timeout or idle
@return | [
"Check",
"session",
"timeout",
"or",
"idle"
] | 805fe14bfe270d95009514c224d93c5fe3575f11 | https://github.com/killme2008/hs4j/blob/805fe14bfe270d95009514c224d93c5fe3575f11/src/main/java/com/google/code/hs4j/network/nio/impl/Reactor.java#L352-L376 | train |
gallandarakhneorg/afc | core/maths/mathgeom/src/main/java/org/arakhne/afc/math/geometry/d1/d/Vector1d.java | Vector1d.convert | public static Vector1d convert(Tuple1d<?> tuple) {
if (tuple instanceof Vector1d) {
return (Vector1d) tuple;
}
return new Vector1d(tuple.getSegment(), tuple.getX(), tuple.getY());
} | java | public static Vector1d convert(Tuple1d<?> tuple) {
if (tuple instanceof Vector1d) {
return (Vector1d) tuple;
}
return new Vector1d(tuple.getSegment(), tuple.getX(), tuple.getY());
} | [
"public",
"static",
"Vector1d",
"convert",
"(",
"Tuple1d",
"<",
"?",
">",
"tuple",
")",
"{",
"if",
"(",
"tuple",
"instanceof",
"Vector1d",
")",
"{",
"return",
"(",
"Vector1d",
")",
"tuple",
";",
"}",
"return",
"new",
"Vector1d",
"(",
"tuple",
".",
"get... | Convert the given tuple to a real Vector1d.
<p>If the given tuple is already a Vector1d, it is replied.
@param tuple the tuple.
@return the Vector1d.
@since 14.0 | [
"Convert",
"the",
"given",
"tuple",
"to",
"a",
"real",
"Vector1d",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/maths/mathgeom/src/main/java/org/arakhne/afc/math/geometry/d1/d/Vector1d.java#L145-L150 | train |
gallandarakhneorg/afc | maven/maventools/src/main/java/org/arakhne/maven/AbstractArakhneMojo.java | AbstractArakhneMojo.getContributorURL | protected static URL getContributorURL(Contributor contributor, Log log) {
URL url = null;
if (contributor != null) {
String rawUrl = contributor.getUrl();
if (rawUrl != null && !EMPTY_STRING.equals(rawUrl)) {
try {
url = new URL(rawUrl);
} catch (Throwable exception) {
url = null;
}
}
if (url == null) {
rawUrl = contributor.getEmail();
if (rawUrl != null && !EMPTY_STRING.equals(rawUrl)) {
try {
url = new URL("mailto:" + rawUrl); //$NON-NLS-1$
} catch (Throwable exception) {
url = null;
}
}
}
}
return url;
} | java | protected static URL getContributorURL(Contributor contributor, Log log) {
URL url = null;
if (contributor != null) {
String rawUrl = contributor.getUrl();
if (rawUrl != null && !EMPTY_STRING.equals(rawUrl)) {
try {
url = new URL(rawUrl);
} catch (Throwable exception) {
url = null;
}
}
if (url == null) {
rawUrl = contributor.getEmail();
if (rawUrl != null && !EMPTY_STRING.equals(rawUrl)) {
try {
url = new URL("mailto:" + rawUrl); //$NON-NLS-1$
} catch (Throwable exception) {
url = null;
}
}
}
}
return url;
} | [
"protected",
"static",
"URL",
"getContributorURL",
"(",
"Contributor",
"contributor",
",",
"Log",
"log",
")",
"{",
"URL",
"url",
"=",
"null",
";",
"if",
"(",
"contributor",
"!=",
"null",
")",
"{",
"String",
"rawUrl",
"=",
"contributor",
".",
"getUrl",
"(",... | Replies the preferred URL for the given contributor.
@param contributor the contributor.
@param log the log.
@return the URL or <code>null</code> if no URL could be built. | [
"Replies",
"the",
"preferred",
"URL",
"for",
"the",
"given",
"contributor",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/maven/maventools/src/main/java/org/arakhne/maven/AbstractArakhneMojo.java#L206-L229 | train |
gallandarakhneorg/afc | maven/maventools/src/main/java/org/arakhne/maven/AbstractArakhneMojo.java | AbstractArakhneMojo.dirCopy | public final void dirCopy(File in, File out, boolean skipHiddenFiles) throws IOException {
assert in != null;
assert out != null;
getLog().debug(in.toString() + "->" + out.toString()); //$NON-NLS-1$
getLog().debug("Ignore hidden files: " + skipHiddenFiles); //$NON-NLS-1$
out.mkdirs();
final LinkedList<File> candidates = new LinkedList<>();
candidates.add(in);
File[] children;
while (!candidates.isEmpty()) {
final File f = candidates.removeFirst();
getLog().debug("Scanning: " + f); //$NON-NLS-1$
if (f.isDirectory()) {
children = f.listFiles();
if (children != null && children.length > 0) {
// Non empty directory
for (final File c : children) {
if (!skipHiddenFiles || !c.isHidden()) {
getLog().debug("Discovering: " + c); //$NON-NLS-1$
candidates.add(c);
}
}
}
} else {
// not a directory
final File targetFile = toOutput(in, f, out);
targetFile.getParentFile().mkdirs();
fileCopy(f, targetFile);
}
}
} | java | public final void dirCopy(File in, File out, boolean skipHiddenFiles) throws IOException {
assert in != null;
assert out != null;
getLog().debug(in.toString() + "->" + out.toString()); //$NON-NLS-1$
getLog().debug("Ignore hidden files: " + skipHiddenFiles); //$NON-NLS-1$
out.mkdirs();
final LinkedList<File> candidates = new LinkedList<>();
candidates.add(in);
File[] children;
while (!candidates.isEmpty()) {
final File f = candidates.removeFirst();
getLog().debug("Scanning: " + f); //$NON-NLS-1$
if (f.isDirectory()) {
children = f.listFiles();
if (children != null && children.length > 0) {
// Non empty directory
for (final File c : children) {
if (!skipHiddenFiles || !c.isHidden()) {
getLog().debug("Discovering: " + c); //$NON-NLS-1$
candidates.add(c);
}
}
}
} else {
// not a directory
final File targetFile = toOutput(in, f, out);
targetFile.getParentFile().mkdirs();
fileCopy(f, targetFile);
}
}
} | [
"public",
"final",
"void",
"dirCopy",
"(",
"File",
"in",
",",
"File",
"out",
",",
"boolean",
"skipHiddenFiles",
")",
"throws",
"IOException",
"{",
"assert",
"in",
"!=",
"null",
";",
"assert",
"out",
"!=",
"null",
";",
"getLog",
"(",
")",
".",
"debug",
... | Copy a directory.
@param in input directory.
@param out output directory.
@param skipHiddenFiles indicates if the hidden files should be ignored.
@throws IOException on error.
@since 3.3 | [
"Copy",
"a",
"directory",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/maven/maventools/src/main/java/org/arakhne/maven/AbstractArakhneMojo.java#L240-L270 | train |
gallandarakhneorg/afc | maven/maventools/src/main/java/org/arakhne/maven/AbstractArakhneMojo.java | AbstractArakhneMojo.dirRemove | public final void dirRemove(File dir) throws IOException {
if (dir != null) {
getLog().debug("Deleting tree: " + dir.toString()); //$NON-NLS-1$
final LinkedList<File> candidates = new LinkedList<>();
candidates.add(dir);
File[] children;
final BuildContext buildContext = getBuildContext();
while (!candidates.isEmpty()) {
final File f = candidates.getFirst();
getLog().debug("Scanning: " + f); //$NON-NLS-1$
if (f.isDirectory()) {
children = f.listFiles();
if (children != null && children.length > 0) {
// Non empty directory
for (final File c : children) {
getLog().debug("Discovering: " + c); //$NON-NLS-1$
candidates.push(c);
}
} else {
// empty directory
getLog().debug("Deleting: " + f); //$NON-NLS-1$
candidates.removeFirst();
f.delete();
buildContext.refresh(f.getParentFile());
}
} else {
// not a directory
candidates.removeFirst();
if (f.exists()) {
getLog().debug("Deleting: " + f); //$NON-NLS-1$
f.delete();
buildContext.refresh(f.getParentFile());
}
}
}
getLog().debug("Deletion done"); //$NON-NLS-1$
}
} | java | public final void dirRemove(File dir) throws IOException {
if (dir != null) {
getLog().debug("Deleting tree: " + dir.toString()); //$NON-NLS-1$
final LinkedList<File> candidates = new LinkedList<>();
candidates.add(dir);
File[] children;
final BuildContext buildContext = getBuildContext();
while (!candidates.isEmpty()) {
final File f = candidates.getFirst();
getLog().debug("Scanning: " + f); //$NON-NLS-1$
if (f.isDirectory()) {
children = f.listFiles();
if (children != null && children.length > 0) {
// Non empty directory
for (final File c : children) {
getLog().debug("Discovering: " + c); //$NON-NLS-1$
candidates.push(c);
}
} else {
// empty directory
getLog().debug("Deleting: " + f); //$NON-NLS-1$
candidates.removeFirst();
f.delete();
buildContext.refresh(f.getParentFile());
}
} else {
// not a directory
candidates.removeFirst();
if (f.exists()) {
getLog().debug("Deleting: " + f); //$NON-NLS-1$
f.delete();
buildContext.refresh(f.getParentFile());
}
}
}
getLog().debug("Deletion done"); //$NON-NLS-1$
}
} | [
"public",
"final",
"void",
"dirRemove",
"(",
"File",
"dir",
")",
"throws",
"IOException",
"{",
"if",
"(",
"dir",
"!=",
"null",
")",
"{",
"getLog",
"(",
")",
".",
"debug",
"(",
"\"Deleting tree: \"",
"+",
"dir",
".",
"toString",
"(",
")",
")",
";",
"/... | Delete a directory and its content.
@param dir the directory to remove.
@throws IOException on error.
@since 3.3 | [
"Delete",
"a",
"directory",
"and",
"its",
"content",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/maven/maventools/src/main/java/org/arakhne/maven/AbstractArakhneMojo.java#L286-L323 | train |
gallandarakhneorg/afc | maven/maventools/src/main/java/org/arakhne/maven/AbstractArakhneMojo.java | AbstractArakhneMojo.getLString | public static final String getLString(Class<?> source, String label, Object... params) {
final ResourceBundle rb = ResourceBundle.getBundle(source.getCanonicalName());
String text = rb.getString(label);
text = text.replaceAll("[\\n\\r]", "\n"); //$NON-NLS-1$ //$NON-NLS-2$
text = text.replaceAll("\\t", "\t"); //$NON-NLS-1$ //$NON-NLS-2$
text = MessageFormat.format(text, params);
return text;
} | java | public static final String getLString(Class<?> source, String label, Object... params) {
final ResourceBundle rb = ResourceBundle.getBundle(source.getCanonicalName());
String text = rb.getString(label);
text = text.replaceAll("[\\n\\r]", "\n"); //$NON-NLS-1$ //$NON-NLS-2$
text = text.replaceAll("\\t", "\t"); //$NON-NLS-1$ //$NON-NLS-2$
text = MessageFormat.format(text, params);
return text;
} | [
"public",
"static",
"final",
"String",
"getLString",
"(",
"Class",
"<",
"?",
">",
"source",
",",
"String",
"label",
",",
"Object",
"...",
"params",
")",
"{",
"final",
"ResourceBundle",
"rb",
"=",
"ResourceBundle",
".",
"getBundle",
"(",
"source",
".",
"get... | Read a resource property and replace the parametrized macros by the given parameters.
@param source
is the source of the properties.
@param label
is the name of the property.
@param params
are the parameters to replace.
@return the read text. | [
"Read",
"a",
"resource",
"property",
"and",
"replace",
"the",
"parametrized",
"macros",
"by",
"the",
"given",
"parameters",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/maven/maventools/src/main/java/org/arakhne/maven/AbstractArakhneMojo.java#L382-L389 | train |
gallandarakhneorg/afc | maven/maventools/src/main/java/org/arakhne/maven/AbstractArakhneMojo.java | AbstractArakhneMojo.removePathPrefix | public static final String removePathPrefix(File prefix, File file) {
final String r = file.getAbsolutePath().replaceFirst(
"^" //$NON-NLS-1$
+ Pattern.quote(prefix.getAbsolutePath()),
EMPTY_STRING);
if (r.startsWith(File.separator)) {
return r.substring(File.separator.length());
}
return r;
} | java | public static final String removePathPrefix(File prefix, File file) {
final String r = file.getAbsolutePath().replaceFirst(
"^" //$NON-NLS-1$
+ Pattern.quote(prefix.getAbsolutePath()),
EMPTY_STRING);
if (r.startsWith(File.separator)) {
return r.substring(File.separator.length());
}
return r;
} | [
"public",
"static",
"final",
"String",
"removePathPrefix",
"(",
"File",
"prefix",
",",
"File",
"file",
")",
"{",
"final",
"String",
"r",
"=",
"file",
".",
"getAbsolutePath",
"(",
")",
".",
"replaceFirst",
"(",
"\"^\"",
"//$NON-NLS-1$",
"+",
"Pattern",
".",
... | Remove the path prefix from a file.
@param prefix path prefix to remove.
@param file input filename.
@return the {@code file} without the prefix. | [
"Remove",
"the",
"path",
"prefix",
"from",
"a",
"file",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/maven/maventools/src/main/java/org/arakhne/maven/AbstractArakhneMojo.java#L398-L407 | train |
gallandarakhneorg/afc | maven/maventools/src/main/java/org/arakhne/maven/AbstractArakhneMojo.java | AbstractArakhneMojo.searchArtifact | public final synchronized ExtendedArtifact searchArtifact(File file) {
final String filename = removePathPrefix(getBaseDirectory(), file);
getLog().debug("Retreiving module for " + filename); //$NON-NLS-1$
File theFile = file;
File pomDirectory = null;
while (theFile != null && pomDirectory == null) {
if (theFile.isDirectory()) {
final File pomFile = new File(theFile, "pom.xml"); //$NON-NLS-1$
if (pomFile.exists()) {
pomDirectory = theFile;
}
}
theFile = theFile.getParentFile();
}
if (pomDirectory != null) {
ExtendedArtifact a = this.localArtifactDescriptions.get(pomDirectory);
if (a == null) {
a = readPom(pomDirectory);
this.localArtifactDescriptions.put(pomDirectory, a);
getLog().debug("Found local module description for " //$NON-NLS-1$
+ a.toString());
}
return a;
}
final BuildContext buildContext = getBuildContext();
buildContext.addMessage(file,
1, 1,
"The maven module for this file cannot be retreived.", //$NON-NLS-1$
BuildContext.SEVERITY_WARNING, null);
return null;
} | java | public final synchronized ExtendedArtifact searchArtifact(File file) {
final String filename = removePathPrefix(getBaseDirectory(), file);
getLog().debug("Retreiving module for " + filename); //$NON-NLS-1$
File theFile = file;
File pomDirectory = null;
while (theFile != null && pomDirectory == null) {
if (theFile.isDirectory()) {
final File pomFile = new File(theFile, "pom.xml"); //$NON-NLS-1$
if (pomFile.exists()) {
pomDirectory = theFile;
}
}
theFile = theFile.getParentFile();
}
if (pomDirectory != null) {
ExtendedArtifact a = this.localArtifactDescriptions.get(pomDirectory);
if (a == null) {
a = readPom(pomDirectory);
this.localArtifactDescriptions.put(pomDirectory, a);
getLog().debug("Found local module description for " //$NON-NLS-1$
+ a.toString());
}
return a;
}
final BuildContext buildContext = getBuildContext();
buildContext.addMessage(file,
1, 1,
"The maven module for this file cannot be retreived.", //$NON-NLS-1$
BuildContext.SEVERITY_WARNING, null);
return null;
} | [
"public",
"final",
"synchronized",
"ExtendedArtifact",
"searchArtifact",
"(",
"File",
"file",
")",
"{",
"final",
"String",
"filename",
"=",
"removePathPrefix",
"(",
"getBaseDirectory",
"(",
")",
",",
"file",
")",
";",
"getLog",
"(",
")",
".",
"debug",
"(",
"... | Search and reply the maven artifact which is corresponding to the given file.
@param file
is the file for which the maven artifact should be retreived.
@return the maven artifact or <code>null</code> if none. | [
"Search",
"and",
"reply",
"the",
"maven",
"artifact",
"which",
"is",
"corresponding",
"to",
"the",
"given",
"file",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/maven/maventools/src/main/java/org/arakhne/maven/AbstractArakhneMojo.java#L535-L569 | train |
gallandarakhneorg/afc | maven/maventools/src/main/java/org/arakhne/maven/AbstractArakhneMojo.java | AbstractArakhneMojo.resolveArtifact | public final Artifact resolveArtifact(Artifact mavenArtifact) throws MojoExecutionException {
final org.eclipse.aether.artifact.Artifact aetherArtifact = createArtifact(mavenArtifact);
final ArtifactRequest request = new ArtifactRequest();
request.setArtifact(aetherArtifact);
request.setRepositories(getRemoteRepositoryList());
final ArtifactResult result;
try {
result = getRepositorySystem().resolveArtifact(getRepositorySystemSession(), request);
} catch (ArtifactResolutionException e) {
throw new MojoExecutionException(e.getMessage(), e);
}
return createArtifact(result.getArtifact());
} | java | public final Artifact resolveArtifact(Artifact mavenArtifact) throws MojoExecutionException {
final org.eclipse.aether.artifact.Artifact aetherArtifact = createArtifact(mavenArtifact);
final ArtifactRequest request = new ArtifactRequest();
request.setArtifact(aetherArtifact);
request.setRepositories(getRemoteRepositoryList());
final ArtifactResult result;
try {
result = getRepositorySystem().resolveArtifact(getRepositorySystemSession(), request);
} catch (ArtifactResolutionException e) {
throw new MojoExecutionException(e.getMessage(), e);
}
return createArtifact(result.getArtifact());
} | [
"public",
"final",
"Artifact",
"resolveArtifact",
"(",
"Artifact",
"mavenArtifact",
")",
"throws",
"MojoExecutionException",
"{",
"final",
"org",
".",
"eclipse",
".",
"aether",
".",
"artifact",
".",
"Artifact",
"aetherArtifact",
"=",
"createArtifact",
"(",
"mavenArt... | Retreive the extended artifact definition of the given artifact.
@param mavenArtifact - the artifact to resolve
@return the artifact definition.
@throws MojoExecutionException on error. | [
"Retreive",
"the",
"extended",
"artifact",
"definition",
"of",
"the",
"given",
"artifact",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/maven/maventools/src/main/java/org/arakhne/maven/AbstractArakhneMojo.java#L617-L629 | train |
gallandarakhneorg/afc | maven/maventools/src/main/java/org/arakhne/maven/AbstractArakhneMojo.java | AbstractArakhneMojo.resolveArtifact | public final Artifact resolveArtifact(String groupId, String artifactId, String version) throws MojoExecutionException {
return resolveArtifact(createArtifact(groupId, artifactId, version));
} | java | public final Artifact resolveArtifact(String groupId, String artifactId, String version) throws MojoExecutionException {
return resolveArtifact(createArtifact(groupId, artifactId, version));
} | [
"public",
"final",
"Artifact",
"resolveArtifact",
"(",
"String",
"groupId",
",",
"String",
"artifactId",
",",
"String",
"version",
")",
"throws",
"MojoExecutionException",
"{",
"return",
"resolveArtifact",
"(",
"createArtifact",
"(",
"groupId",
",",
"artifactId",
",... | Retreive the extended artifact definition of the given artifact id.
@param groupId
is the identifier of the group.
@param artifactId
is the identifier of the artifact.
@param version
is the version of the artifact to retreive.
@return the artifact definition.
@throws MojoExecutionException on error. | [
"Retreive",
"the",
"extended",
"artifact",
"definition",
"of",
"the",
"given",
"artifact",
"id",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/maven/maventools/src/main/java/org/arakhne/maven/AbstractArakhneMojo.java#L643-L645 | train |
gallandarakhneorg/afc | maven/maventools/src/main/java/org/arakhne/maven/AbstractArakhneMojo.java | AbstractArakhneMojo.createArtifact | public final Artifact createArtifact(String groupId, String artifactId, String version) {
return createArtifact(groupId, artifactId, version, "runtime", "jar"); //$NON-NLS-1$ //$NON-NLS-2$
} | java | public final Artifact createArtifact(String groupId, String artifactId, String version) {
return createArtifact(groupId, artifactId, version, "runtime", "jar"); //$NON-NLS-1$ //$NON-NLS-2$
} | [
"public",
"final",
"Artifact",
"createArtifact",
"(",
"String",
"groupId",
",",
"String",
"artifactId",
",",
"String",
"version",
")",
"{",
"return",
"createArtifact",
"(",
"groupId",
",",
"artifactId",
",",
"version",
",",
"\"runtime\"",
",",
"\"jar\"",
")",
... | Create an Jar runtime artifact from the given values.
@param groupId group id.
@param artifactId artifact id.
@param version version number.
@return the artifact | [
"Create",
"an",
"Jar",
"runtime",
"artifact",
"from",
"the",
"given",
"values",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/maven/maventools/src/main/java/org/arakhne/maven/AbstractArakhneMojo.java#L950-L952 | train |
gallandarakhneorg/afc | maven/maventools/src/main/java/org/arakhne/maven/AbstractArakhneMojo.java | AbstractArakhneMojo.createArtifact | protected static final org.eclipse.aether.artifact.Artifact createArtifact(Artifact artifact) {
return new DefaultArtifact(
artifact.getGroupId(),
artifact.getArtifactId(),
artifact.getClassifier(),
artifact.getType(),
artifact.getVersion());
} | java | protected static final org.eclipse.aether.artifact.Artifact createArtifact(Artifact artifact) {
return new DefaultArtifact(
artifact.getGroupId(),
artifact.getArtifactId(),
artifact.getClassifier(),
artifact.getType(),
artifact.getVersion());
} | [
"protected",
"static",
"final",
"org",
".",
"eclipse",
".",
"aether",
".",
"artifact",
".",
"Artifact",
"createArtifact",
"(",
"Artifact",
"artifact",
")",
"{",
"return",
"new",
"DefaultArtifact",
"(",
"artifact",
".",
"getGroupId",
"(",
")",
",",
"artifact",
... | Convert the maven artifact to Aether artifact.
@param artifact - the maven artifact.
@return the Aether artifact. | [
"Convert",
"the",
"maven",
"artifact",
"to",
"Aether",
"artifact",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/maven/maventools/src/main/java/org/arakhne/maven/AbstractArakhneMojo.java#L959-L966 | train |
gallandarakhneorg/afc | maven/maventools/src/main/java/org/arakhne/maven/AbstractArakhneMojo.java | AbstractArakhneMojo.createArtifact | protected final Artifact createArtifact(org.eclipse.aether.artifact.Artifact artifact) {
return createArtifact(artifact.getGroupId(), artifact.getArtifactId(), artifact.getVersion());
} | java | protected final Artifact createArtifact(org.eclipse.aether.artifact.Artifact artifact) {
return createArtifact(artifact.getGroupId(), artifact.getArtifactId(), artifact.getVersion());
} | [
"protected",
"final",
"Artifact",
"createArtifact",
"(",
"org",
".",
"eclipse",
".",
"aether",
".",
"artifact",
".",
"Artifact",
"artifact",
")",
"{",
"return",
"createArtifact",
"(",
"artifact",
".",
"getGroupId",
"(",
")",
",",
"artifact",
".",
"getArtifactI... | Convert the Aether artifact to maven artifact.
@param artifact - the Aether artifact.
@return the maven artifact. | [
"Convert",
"the",
"Aether",
"artifact",
"to",
"maven",
"artifact",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/maven/maventools/src/main/java/org/arakhne/maven/AbstractArakhneMojo.java#L973-L975 | train |
gallandarakhneorg/afc | maven/maventools/src/main/java/org/arakhne/maven/AbstractArakhneMojo.java | AbstractArakhneMojo.createArtifact | public final Artifact createArtifact(String groupId, String artifactId, String version, String scope, String type) {
VersionRange versionRange = null;
if (version != null) {
versionRange = VersionRange.createFromVersion(version);
}
String desiredScope = scope;
if (Artifact.SCOPE_TEST.equals(desiredScope)) {
desiredScope = Artifact.SCOPE_TEST;
}
if (Artifact.SCOPE_PROVIDED.equals(desiredScope)) {
desiredScope = Artifact.SCOPE_PROVIDED;
}
if (Artifact.SCOPE_SYSTEM.equals(desiredScope)) {
// system scopes come through unchanged...
desiredScope = Artifact.SCOPE_SYSTEM;
}
final ArtifactHandler handler = getArtifactHandlerManager().getArtifactHandler(type);
return new org.apache.maven.artifact.DefaultArtifact(
groupId, artifactId, versionRange,
desiredScope, type, null,
handler, false);
} | java | public final Artifact createArtifact(String groupId, String artifactId, String version, String scope, String type) {
VersionRange versionRange = null;
if (version != null) {
versionRange = VersionRange.createFromVersion(version);
}
String desiredScope = scope;
if (Artifact.SCOPE_TEST.equals(desiredScope)) {
desiredScope = Artifact.SCOPE_TEST;
}
if (Artifact.SCOPE_PROVIDED.equals(desiredScope)) {
desiredScope = Artifact.SCOPE_PROVIDED;
}
if (Artifact.SCOPE_SYSTEM.equals(desiredScope)) {
// system scopes come through unchanged...
desiredScope = Artifact.SCOPE_SYSTEM;
}
final ArtifactHandler handler = getArtifactHandlerManager().getArtifactHandler(type);
return new org.apache.maven.artifact.DefaultArtifact(
groupId, artifactId, versionRange,
desiredScope, type, null,
handler, false);
} | [
"public",
"final",
"Artifact",
"createArtifact",
"(",
"String",
"groupId",
",",
"String",
"artifactId",
",",
"String",
"version",
",",
"String",
"scope",
",",
"String",
"type",
")",
"{",
"VersionRange",
"versionRange",
"=",
"null",
";",
"if",
"(",
"version",
... | Create an artifact from the given values.
@param groupId group id.
@param artifactId artifact id.
@param version version number.
@param scope artifact scope.
@param type artifact type.
@return the artifact | [
"Create",
"an",
"artifact",
"from",
"the",
"given",
"values",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/maven/maventools/src/main/java/org/arakhne/maven/AbstractArakhneMojo.java#L987-L1013 | train |
gallandarakhneorg/afc | maven/maventools/src/main/java/org/arakhne/maven/AbstractArakhneMojo.java | AbstractArakhneMojo.assertNotNull | protected final void assertNotNull(String message, Object obj) {
if (getLog().isDebugEnabled()) {
getLog().debug(
"\t(" //$NON-NLS-1$
+ getLogType(obj)
+ ") " //$NON-NLS-1$
+ message
+ " = " //$NON-NLS-1$
+ obj);
}
if (obj == null) {
throw new AssertionError("assertNotNull: " + message); //$NON-NLS-1$
}
} | java | protected final void assertNotNull(String message, Object obj) {
if (getLog().isDebugEnabled()) {
getLog().debug(
"\t(" //$NON-NLS-1$
+ getLogType(obj)
+ ") " //$NON-NLS-1$
+ message
+ " = " //$NON-NLS-1$
+ obj);
}
if (obj == null) {
throw new AssertionError("assertNotNull: " + message); //$NON-NLS-1$
}
} | [
"protected",
"final",
"void",
"assertNotNull",
"(",
"String",
"message",
",",
"Object",
"obj",
")",
"{",
"if",
"(",
"getLog",
"(",
")",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"getLog",
"(",
")",
".",
"debug",
"(",
"\"\\t(\"",
"//$NON-NLS-1$",
"+",
... | Throw an exception when the given object is null.
@param message
is the message to put in the exception.
@param obj the object to test. | [
"Throw",
"an",
"exception",
"when",
"the",
"given",
"object",
"is",
"null",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/maven/maventools/src/main/java/org/arakhne/maven/AbstractArakhneMojo.java#L1081-L1094 | train |
gallandarakhneorg/afc | maven/maventools/src/main/java/org/arakhne/maven/AbstractArakhneMojo.java | AbstractArakhneMojo.join | public static String join(String joint, String... values) {
final StringBuilder b = new StringBuilder();
for (final String value : values) {
if (value != null && !EMPTY_STRING.equals(value)) {
if (b.length() > 0) {
b.append(joint);
}
b.append(value);
}
}
return b.toString();
} | java | public static String join(String joint, String... values) {
final StringBuilder b = new StringBuilder();
for (final String value : values) {
if (value != null && !EMPTY_STRING.equals(value)) {
if (b.length() > 0) {
b.append(joint);
}
b.append(value);
}
}
return b.toString();
} | [
"public",
"static",
"String",
"join",
"(",
"String",
"joint",
",",
"String",
"...",
"values",
")",
"{",
"final",
"StringBuilder",
"b",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"for",
"(",
"final",
"String",
"value",
":",
"values",
")",
"{",
"if",
"(... | Join the values with the given joint.
@param joint the joint.
@param values the values.
@return the jointed values | [
"Join",
"the",
"values",
"with",
"the",
"given",
"joint",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/maven/maventools/src/main/java/org/arakhne/maven/AbstractArakhneMojo.java#L1127-L1138 | train |
gallandarakhneorg/afc | maven/maventools/src/main/java/org/arakhne/maven/AbstractArakhneMojo.java | AbstractArakhneMojo.getMavenProject | public MavenProject getMavenProject(Artifact artifact) {
try {
final MavenSession session = getMavenSession();
final MavenProject current = session.getCurrentProject();
final MavenProject prj = getMavenProjectBuilder().buildFromRepository(
artifact,
current.getRemoteArtifactRepositories(),
session.getLocalRepository());
return prj;
} catch (ProjectBuildingException e) {
getLog().warn(e);
}
return null;
} | java | public MavenProject getMavenProject(Artifact artifact) {
try {
final MavenSession session = getMavenSession();
final MavenProject current = session.getCurrentProject();
final MavenProject prj = getMavenProjectBuilder().buildFromRepository(
artifact,
current.getRemoteArtifactRepositories(),
session.getLocalRepository());
return prj;
} catch (ProjectBuildingException e) {
getLog().warn(e);
}
return null;
} | [
"public",
"MavenProject",
"getMavenProject",
"(",
"Artifact",
"artifact",
")",
"{",
"try",
"{",
"final",
"MavenSession",
"session",
"=",
"getMavenSession",
"(",
")",
";",
"final",
"MavenProject",
"current",
"=",
"session",
".",
"getCurrentProject",
"(",
")",
";"... | Load the Maven project for the given artifact.
@param artifact the artifact.
@return the maven project. | [
"Load",
"the",
"Maven",
"project",
"for",
"the",
"given",
"artifact",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/maven/maventools/src/main/java/org/arakhne/maven/AbstractArakhneMojo.java#L1268-L1281 | train |
gallandarakhneorg/afc | core/maths/mathgraph/src/main/java/org/arakhne/afc/math/graph/GraphIterator.java | GraphIterator.getNextSegments | @SuppressWarnings("checkstyle:nestedifdepth")
protected final List<GraphIterationElement<ST, PT>> getNextSegments(boolean avoid_visited_segments,
GraphIterationElement<ST, PT> element) {
assert this.allowManyReplies || this.visited != null;
if (element != null) {
final ST segment = element.getSegment();
final PT point = element.getPoint();
if ((segment != null) && (point != null)) {
final PT pts = segment.getOtherSidePoint(point);
if (pts != null) {
final double distanceToReach = element.getDistanceToReachSegment() + segment.getLength();
GraphIterationElement<ST, PT> candidate;
final double restToConsume = element.distanceToConsume - segment.getLength();
final List<GraphIterationElement<ST, PT>> list = new ArrayList<>();
for (final ST theSegment : pts.getConnectedSegmentsStartingFrom(segment)) {
if (!theSegment.equals(segment)) {
candidate = newIterationElement(
segment, theSegment,
pts,
distanceToReach,
restToConsume);
if ((this.allowManyReplies)
|| (!avoid_visited_segments)
|| (!this.visited.contains(candidate))) {
list.add(candidate);
}
}
}
return list;
}
}
}
throw new NoSuchElementException();
} | java | @SuppressWarnings("checkstyle:nestedifdepth")
protected final List<GraphIterationElement<ST, PT>> getNextSegments(boolean avoid_visited_segments,
GraphIterationElement<ST, PT> element) {
assert this.allowManyReplies || this.visited != null;
if (element != null) {
final ST segment = element.getSegment();
final PT point = element.getPoint();
if ((segment != null) && (point != null)) {
final PT pts = segment.getOtherSidePoint(point);
if (pts != null) {
final double distanceToReach = element.getDistanceToReachSegment() + segment.getLength();
GraphIterationElement<ST, PT> candidate;
final double restToConsume = element.distanceToConsume - segment.getLength();
final List<GraphIterationElement<ST, PT>> list = new ArrayList<>();
for (final ST theSegment : pts.getConnectedSegmentsStartingFrom(segment)) {
if (!theSegment.equals(segment)) {
candidate = newIterationElement(
segment, theSegment,
pts,
distanceToReach,
restToConsume);
if ((this.allowManyReplies)
|| (!avoid_visited_segments)
|| (!this.visited.contains(candidate))) {
list.add(candidate);
}
}
}
return list;
}
}
}
throw new NoSuchElementException();
} | [
"@",
"SuppressWarnings",
"(",
"\"checkstyle:nestedifdepth\"",
")",
"protected",
"final",
"List",
"<",
"GraphIterationElement",
"<",
"ST",
",",
"PT",
">",
">",
"getNextSegments",
"(",
"boolean",
"avoid_visited_segments",
",",
"GraphIterationElement",
"<",
"ST",
",",
... | Replies the next segments.
@param avoid_visited_segments is <code>true</code> to avoid to reply already visited segments, otherwise <code>false</code>
@param element is the element from which the next segments must be replied.
@return the list of the following segments
@see #next() | [
"Replies",
"the",
"next",
"segments",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/maths/mathgraph/src/main/java/org/arakhne/afc/math/graph/GraphIterator.java#L200-L234 | train |
gallandarakhneorg/afc | core/maths/mathgraph/src/main/java/org/arakhne/afc/math/graph/GraphIterator.java | GraphIterator.nextElement | public final GraphIterationElement<ST, PT> nextElement() {
if (!this.courseModel.isEmpty()) {
final GraphIterationElement<ST, PT> theElement = this.courseModel.removeNextIterationElement();
if (theElement != null) {
final List<GraphIterationElement<ST, PT>> list = getNextSegments(true, theElement);
final Iterator<GraphIterationElement<ST, PT>> iterator;
boolean hasFollowingSegments = false;
GraphIterationElement<ST, PT> elt;
if (this.courseModel.isReversedRestitution()) {
iterator = new ReverseIterator<>(list);
} else {
iterator = list.iterator();
}
while (iterator.hasNext()) {
elt = iterator.next();
if (canGotoIntoElement(elt)) {
hasFollowingSegments = true;
this.courseModel.addIterationElement(elt);
if (!this.allowManyReplies) {
this.visited.add(elt);
}
}
}
theElement.setTerminalSegment(!hasFollowingSegments);
theElement.replied = true;
this.current = theElement;
return this.current;
}
}
clear();
throw new NoSuchElementException();
} | java | public final GraphIterationElement<ST, PT> nextElement() {
if (!this.courseModel.isEmpty()) {
final GraphIterationElement<ST, PT> theElement = this.courseModel.removeNextIterationElement();
if (theElement != null) {
final List<GraphIterationElement<ST, PT>> list = getNextSegments(true, theElement);
final Iterator<GraphIterationElement<ST, PT>> iterator;
boolean hasFollowingSegments = false;
GraphIterationElement<ST, PT> elt;
if (this.courseModel.isReversedRestitution()) {
iterator = new ReverseIterator<>(list);
} else {
iterator = list.iterator();
}
while (iterator.hasNext()) {
elt = iterator.next();
if (canGotoIntoElement(elt)) {
hasFollowingSegments = true;
this.courseModel.addIterationElement(elt);
if (!this.allowManyReplies) {
this.visited.add(elt);
}
}
}
theElement.setTerminalSegment(!hasFollowingSegments);
theElement.replied = true;
this.current = theElement;
return this.current;
}
}
clear();
throw new NoSuchElementException();
} | [
"public",
"final",
"GraphIterationElement",
"<",
"ST",
",",
"PT",
">",
"nextElement",
"(",
")",
"{",
"if",
"(",
"!",
"this",
".",
"courseModel",
".",
"isEmpty",
"(",
")",
")",
"{",
"final",
"GraphIterationElement",
"<",
"ST",
",",
"PT",
">",
"theElement"... | Replies the next segment.
@return the next segment | [
"Replies",
"the",
"next",
"segment",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/maths/mathgraph/src/main/java/org/arakhne/afc/math/graph/GraphIterator.java#L269-L303 | train |
gallandarakhneorg/afc | core/maths/mathgraph/src/main/java/org/arakhne/afc/math/graph/GraphIterator.java | GraphIterator.newIterationElement | protected GraphIterationElement<ST, PT> newIterationElement(
ST previous_segment, ST segment,
PT point,
double distanceToReach,
double distanceToConsume) {
return new GraphIterationElement<>(
previous_segment, segment,
point,
distanceToReach,
distanceToConsume);
} | java | protected GraphIterationElement<ST, PT> newIterationElement(
ST previous_segment, ST segment,
PT point,
double distanceToReach,
double distanceToConsume) {
return new GraphIterationElement<>(
previous_segment, segment,
point,
distanceToReach,
distanceToConsume);
} | [
"protected",
"GraphIterationElement",
"<",
"ST",
",",
"PT",
">",
"newIterationElement",
"(",
"ST",
"previous_segment",
",",
"ST",
"segment",
",",
"PT",
"point",
",",
"double",
"distanceToReach",
",",
"double",
"distanceToConsume",
")",
"{",
"return",
"new",
"Gra... | Create an instance of GraphIterationElement.
@param previous_segment is the previous element that permits to reach this object during an iteration
@param segment is the current segment
@param point is the point on which the iteration arrived on the current segment.
@param distanceToReach is the distance that is already consumed to reach the segment.
@param distanceToConsume is the rest of distance to consume including the segment.
@return a graph iteration element. | [
"Create",
"an",
"instance",
"of",
"GraphIterationElement",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/maths/mathgraph/src/main/java/org/arakhne/afc/math/graph/GraphIterator.java#L314-L324 | train |
gallandarakhneorg/afc | core/maths/mathgraph/src/main/java/org/arakhne/afc/math/graph/GraphIterator.java | GraphIterator.ignoreElementsAfter | public void ignoreElementsAfter(GraphIterationElement<ST, PT> element) {
final List<GraphIterationElement<ST, PT>> nexts = getNextSegments(false, element);
this.courseModel.removeIterationElements(nexts);
} | java | public void ignoreElementsAfter(GraphIterationElement<ST, PT> element) {
final List<GraphIterationElement<ST, PT>> nexts = getNextSegments(false, element);
this.courseModel.removeIterationElements(nexts);
} | [
"public",
"void",
"ignoreElementsAfter",
"(",
"GraphIterationElement",
"<",
"ST",
",",
"PT",
">",
"element",
")",
"{",
"final",
"List",
"<",
"GraphIterationElement",
"<",
"ST",
",",
"PT",
">",
">",
"nexts",
"=",
"getNextSegments",
"(",
"false",
",",
"element... | Ignore the elements after the specified element.
@param element the reference element. | [
"Ignore",
"the",
"elements",
"after",
"the",
"specified",
"element",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/core/maths/mathgraph/src/main/java/org/arakhne/afc/math/graph/GraphIterator.java#L340-L343 | train |
lightblueseas/swing-components | src/main/java/de/alpharogroup/swing/tree/model/AbstractGenericTreeNode.java | AbstractGenericTreeNode.removeChild | @Override
public void removeChild(final ITreeNode<T> child)
{
if (children != null)
{
children.remove(child);
}
else
{
children = new ArrayList<>();
}
} | java | @Override
public void removeChild(final ITreeNode<T> child)
{
if (children != null)
{
children.remove(child);
}
else
{
children = new ArrayList<>();
}
} | [
"@",
"Override",
"public",
"void",
"removeChild",
"(",
"final",
"ITreeNode",
"<",
"T",
">",
"child",
")",
"{",
"if",
"(",
"children",
"!=",
"null",
")",
"{",
"children",
".",
"remove",
"(",
"child",
")",
";",
"}",
"else",
"{",
"children",
"=",
"new",... | Removes the child.
@param child
the child | [
"Removes",
"the",
"child",
"."
] | 4045e85cabd8f0ce985cbfff134c3c9873930c79 | https://github.com/lightblueseas/swing-components/blob/4045e85cabd8f0ce985cbfff134c3c9873930c79/src/main/java/de/alpharogroup/swing/tree/model/AbstractGenericTreeNode.java#L223-L235 | train |
gallandarakhneorg/afc | advanced/gis/gisinputoutput/src/main/java/org/arakhne/afc/gis/io/xml/XMLGISElementUtil.java | XMLGISElementUtil.getDefaultMapElementNodeName | public static String getDefaultMapElementNodeName(Class<? extends MapElement> type) {
if (MapPolyline.class.isAssignableFrom(type)) {
return NODE_POLYLINE;
}
if (MapPoint.class.isAssignableFrom(type)) {
return NODE_POINT;
}
if (MapPolygon.class.isAssignableFrom(type)) {
return NODE_POLYGON;
}
if (MapCircle.class.isAssignableFrom(type)) {
return NODE_CIRCLE;
}
if (MapMultiPoint.class.isAssignableFrom(type)) {
return NODE_MULTIPOINT;
}
return null;
} | java | public static String getDefaultMapElementNodeName(Class<? extends MapElement> type) {
if (MapPolyline.class.isAssignableFrom(type)) {
return NODE_POLYLINE;
}
if (MapPoint.class.isAssignableFrom(type)) {
return NODE_POINT;
}
if (MapPolygon.class.isAssignableFrom(type)) {
return NODE_POLYGON;
}
if (MapCircle.class.isAssignableFrom(type)) {
return NODE_CIRCLE;
}
if (MapMultiPoint.class.isAssignableFrom(type)) {
return NODE_MULTIPOINT;
}
return null;
} | [
"public",
"static",
"String",
"getDefaultMapElementNodeName",
"(",
"Class",
"<",
"?",
"extends",
"MapElement",
">",
"type",
")",
"{",
"if",
"(",
"MapPolyline",
".",
"class",
".",
"isAssignableFrom",
"(",
"type",
")",
")",
"{",
"return",
"NODE_POLYLINE",
";",
... | Replies the default name of the XML node for the given type of map element.
@param type the type of the map element.
@return the default XML node name; or {@code null} if the type if unknown. | [
"Replies",
"the",
"default",
"name",
"of",
"the",
"XML",
"node",
"for",
"the",
"given",
"type",
"of",
"map",
"element",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/gisinputoutput/src/main/java/org/arakhne/afc/gis/io/xml/XMLGISElementUtil.java#L444-L461 | train |
gallandarakhneorg/afc | advanced/gis/gisinputoutput/src/main/java/org/arakhne/afc/gis/io/xml/XMLGISElementUtil.java | XMLGISElementUtil.writeGISElementAttributes | public static void writeGISElementAttributes(Element element, GISElement primitive, XMLBuilder builder,
XMLResources resources) throws IOException {
XMLAttributeUtil.writeAttributeContainer(element, primitive, builder, resources, false);
element.setAttribute(XMLUtil.ATTR_NAME, primitive.getName());
element.setAttribute(XMLAttributeUtil.ATTR_GEOID, primitive.getGeoId().toString());
element.setAttribute(XMLUtil.ATTR_ID, primitive.getUUID().toString());
} | java | public static void writeGISElementAttributes(Element element, GISElement primitive, XMLBuilder builder,
XMLResources resources) throws IOException {
XMLAttributeUtil.writeAttributeContainer(element, primitive, builder, resources, false);
element.setAttribute(XMLUtil.ATTR_NAME, primitive.getName());
element.setAttribute(XMLAttributeUtil.ATTR_GEOID, primitive.getGeoId().toString());
element.setAttribute(XMLUtil.ATTR_ID, primitive.getUUID().toString());
} | [
"public",
"static",
"void",
"writeGISElementAttributes",
"(",
"Element",
"element",
",",
"GISElement",
"primitive",
",",
"XMLBuilder",
"builder",
",",
"XMLResources",
"resources",
")",
"throws",
"IOException",
"{",
"XMLAttributeUtil",
".",
"writeAttributeContainer",
"("... | Write the attributes of the given GISElement in the the XML description.
Only the name, geoId, id, and additional attributes are written. Icon and color are not written.
@param element is the XML node to fill with the attributes
@param primitive is the map element to output.
It may be {@code null} to use the default name.
@param builder is the tool to create XML nodes.
@param resources is the tool that permits to gather the resources.
@throws IOException in case of error. | [
"Write",
"the",
"attributes",
"of",
"the",
"given",
"GISElement",
"in",
"the",
"the",
"XML",
"description",
".",
"Only",
"the",
"name",
"geoId",
"id",
"and",
"additional",
"attributes",
"are",
"written",
".",
"Icon",
"and",
"color",
"are",
"not",
"written",
... | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/gisinputoutput/src/main/java/org/arakhne/afc/gis/io/xml/XMLGISElementUtil.java#L757-L763 | train |
gallandarakhneorg/afc | advanced/gis/gisinputoutput/src/main/java/org/arakhne/afc/gis/io/xml/XMLGISElementUtil.java | XMLGISElementUtil.readGISElementAttributes | public static void readGISElementAttributes(Element element, GISElement primitive, PathBuilder pathBuilder,
XMLResources resources) throws IOException {
XMLAttributeUtil.readAttributeContainer(element, primitive, pathBuilder, resources, false);
primitive.setName(XMLUtil.getAttributeValueWithDefault(element, null, XMLUtil.ATTR_NAME));
} | java | public static void readGISElementAttributes(Element element, GISElement primitive, PathBuilder pathBuilder,
XMLResources resources) throws IOException {
XMLAttributeUtil.readAttributeContainer(element, primitive, pathBuilder, resources, false);
primitive.setName(XMLUtil.getAttributeValueWithDefault(element, null, XMLUtil.ATTR_NAME));
} | [
"public",
"static",
"void",
"readGISElementAttributes",
"(",
"Element",
"element",
",",
"GISElement",
"primitive",
",",
"PathBuilder",
"pathBuilder",
",",
"XMLResources",
"resources",
")",
"throws",
"IOException",
"{",
"XMLAttributeUtil",
".",
"readAttributeContainer",
... | Read the attributes of a GISElement from the XML description.
Only the name and additional attributes are read. Id, geoId, icon and color are not read.
@param element is the XML node to read.
@param primitive is the GISElement to set up.
@param pathBuilder is the tool to make paths absolute.
@param resources is the tool that permits to gather the resources.
@throws IOException in case of error. | [
"Read",
"the",
"attributes",
"of",
"a",
"GISElement",
"from",
"the",
"XML",
"description",
".",
"Only",
"the",
"name",
"and",
"additional",
"attributes",
"are",
"read",
".",
"Id",
"geoId",
"icon",
"and",
"color",
"are",
"not",
"read",
"."
] | 0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb | https://github.com/gallandarakhneorg/afc/blob/0c7d2e1ddefd4167ef788416d970a6c1ef6f8bbb/advanced/gis/gisinputoutput/src/main/java/org/arakhne/afc/gis/io/xml/XMLGISElementUtil.java#L774-L778 | train |
BBN-E/bue-common-open | scoring-open/src/main/java/com/bbn/bue/common/evaluation/MultimapAlignment.java | MultimapAlignment.alignedToRightItem | @SuppressWarnings("unchecked")
@Override
public Set<LeftT> alignedToRightItem(final Object rightItem) {
if (rightToLeft.containsKey(rightItem)) {
return rightToLeft.get((RightT)rightItem);
} else {
return ImmutableSet.of();
}
} | java | @SuppressWarnings("unchecked")
@Override
public Set<LeftT> alignedToRightItem(final Object rightItem) {
if (rightToLeft.containsKey(rightItem)) {
return rightToLeft.get((RightT)rightItem);
} else {
return ImmutableSet.of();
}
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"@",
"Override",
"public",
"Set",
"<",
"LeftT",
">",
"alignedToRightItem",
"(",
"final",
"Object",
"rightItem",
")",
"{",
"if",
"(",
"rightToLeft",
".",
"containsKey",
"(",
"rightItem",
")",
")",
"{",
"retu... | if it's in the map, it must be RightT | [
"if",
"it",
"s",
"in",
"the",
"map",
"it",
"must",
"be",
"RightT"
] | d618652674d647867306e2e4b987a21b7c29c015 | https://github.com/BBN-E/bue-common-open/blob/d618652674d647867306e2e4b987a21b7c29c015/scoring-open/src/main/java/com/bbn/bue/common/evaluation/MultimapAlignment.java#L73-L81 | train |
BBN-E/bue-common-open | scoring-open/src/main/java/com/bbn/bue/common/evaluation/MultimapAlignment.java | MultimapAlignment.alignedToLeftItem | @SuppressWarnings("unchecked")
@Override
public Set<RightT> alignedToLeftItem(final Object leftItem) {
if (leftToRight.containsKey(leftItem)) {
return leftToRight.get((LeftT)leftItem);
} else {
return ImmutableSet.of();
}
} | java | @SuppressWarnings("unchecked")
@Override
public Set<RightT> alignedToLeftItem(final Object leftItem) {
if (leftToRight.containsKey(leftItem)) {
return leftToRight.get((LeftT)leftItem);
} else {
return ImmutableSet.of();
}
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"@",
"Override",
"public",
"Set",
"<",
"RightT",
">",
"alignedToLeftItem",
"(",
"final",
"Object",
"leftItem",
")",
"{",
"if",
"(",
"leftToRight",
".",
"containsKey",
"(",
"leftItem",
")",
")",
"{",
"return... | if it's in the map, it must be LeftT | [
"if",
"it",
"s",
"in",
"the",
"map",
"it",
"must",
"be",
"LeftT"
] | d618652674d647867306e2e4b987a21b7c29c015 | https://github.com/BBN-E/bue-common-open/blob/d618652674d647867306e2e4b987a21b7c29c015/scoring-open/src/main/java/com/bbn/bue/common/evaluation/MultimapAlignment.java#L84-L92 | train |
BBN-E/bue-common-open | common-core-open/src/main/java/com/bbn/bue/common/files/FileUtils.java | FileUtils.ensureParentDirectoryExists | public static void ensureParentDirectoryExists(File f) throws IOException {
final File parent = f.getParentFile();
if (parent != null) {
java.nio.file.Files.createDirectories(parent.toPath());
}
} | java | public static void ensureParentDirectoryExists(File f) throws IOException {
final File parent = f.getParentFile();
if (parent != null) {
java.nio.file.Files.createDirectories(parent.toPath());
}
} | [
"public",
"static",
"void",
"ensureParentDirectoryExists",
"(",
"File",
"f",
")",
"throws",
"IOException",
"{",
"final",
"File",
"parent",
"=",
"f",
".",
"getParentFile",
"(",
")",
";",
"if",
"(",
"parent",
"!=",
"null",
")",
"{",
"java",
".",
"nio",
"."... | Create the parent directories of the given file, if needed. | [
"Create",
"the",
"parent",
"directories",
"of",
"the",
"given",
"file",
"if",
"needed",
"."
] | d618652674d647867306e2e4b987a21b7c29c015 | https://github.com/BBN-E/bue-common-open/blob/d618652674d647867306e2e4b987a21b7c29c015/common-core-open/src/main/java/com/bbn/bue/common/files/FileUtils.java#L90-L95 | train |
BBN-E/bue-common-open | common-core-open/src/main/java/com/bbn/bue/common/files/FileUtils.java | FileUtils.loadFileList | public static ImmutableList<File> loadFileList(final Iterable<String> fileNames)
throws IOException {
final ImmutableList.Builder<File> ret = ImmutableList.builder();
for (String filename : fileNames) {
if (!filename.isEmpty()) {
ret.add(new File(filename.trim()));
}
}
return ret.build();
} | java | public static ImmutableList<File> loadFileList(final Iterable<String> fileNames)
throws IOException {
final ImmutableList.Builder<File> ret = ImmutableList.builder();
for (String filename : fileNames) {
if (!filename.isEmpty()) {
ret.add(new File(filename.trim()));
}
}
return ret.build();
} | [
"public",
"static",
"ImmutableList",
"<",
"File",
">",
"loadFileList",
"(",
"final",
"Iterable",
"<",
"String",
">",
"fileNames",
")",
"throws",
"IOException",
"{",
"final",
"ImmutableList",
".",
"Builder",
"<",
"File",
">",
"ret",
"=",
"ImmutableList",
".",
... | Takes a List of filenames and returns a list of files, ignoring any empty strings and any
trailing whitespace. | [
"Takes",
"a",
"List",
"of",
"filenames",
"and",
"returns",
"a",
"list",
"of",
"files",
"ignoring",
"any",
"empty",
"strings",
"and",
"any",
"trailing",
"whitespace",
"."
] | d618652674d647867306e2e4b987a21b7c29c015 | https://github.com/BBN-E/bue-common-open/blob/d618652674d647867306e2e4b987a21b7c29c015/common-core-open/src/main/java/com/bbn/bue/common/files/FileUtils.java#L126-L137 | train |
BBN-E/bue-common-open | common-core-open/src/main/java/com/bbn/bue/common/files/FileUtils.java | FileUtils.writeFileList | public static void writeFileList(Iterable<File> files, CharSink sink) throws IOException {
writeUnixLines(FluentIterable.from(files)
.transform(toAbsolutePathFunction()), sink);
} | java | public static void writeFileList(Iterable<File> files, CharSink sink) throws IOException {
writeUnixLines(FluentIterable.from(files)
.transform(toAbsolutePathFunction()), sink);
} | [
"public",
"static",
"void",
"writeFileList",
"(",
"Iterable",
"<",
"File",
">",
"files",
",",
"CharSink",
"sink",
")",
"throws",
"IOException",
"{",
"writeUnixLines",
"(",
"FluentIterable",
".",
"from",
"(",
"files",
")",
".",
"transform",
"(",
"toAbsolutePath... | Writes the absolutes paths of the given files in iteration order, one-per-line. Each line
will end with a Unix newline. | [
"Writes",
"the",
"absolutes",
"paths",
"of",
"the",
"given",
"files",
"in",
"iteration",
"order",
"one",
"-",
"per",
"-",
"line",
".",
"Each",
"line",
"will",
"end",
"with",
"a",
"Unix",
"newline",
"."
] | d618652674d647867306e2e4b987a21b7c29c015 | https://github.com/BBN-E/bue-common-open/blob/d618652674d647867306e2e4b987a21b7c29c015/common-core-open/src/main/java/com/bbn/bue/common/files/FileUtils.java#L143-L146 | train |
BBN-E/bue-common-open | common-core-open/src/main/java/com/bbn/bue/common/files/FileUtils.java | FileUtils.writeSymbolToFileMap | public static void writeSymbolToFileMap(Map<Symbol, File> symbolToFileMap, CharSink sink) throws IOException {
writeSymbolToFileEntries(symbolToFileMap.entrySet(), sink);
} | java | public static void writeSymbolToFileMap(Map<Symbol, File> symbolToFileMap, CharSink sink) throws IOException {
writeSymbolToFileEntries(symbolToFileMap.entrySet(), sink);
} | [
"public",
"static",
"void",
"writeSymbolToFileMap",
"(",
"Map",
"<",
"Symbol",
",",
"File",
">",
"symbolToFileMap",
",",
"CharSink",
"sink",
")",
"throws",
"IOException",
"{",
"writeSymbolToFileEntries",
"(",
"symbolToFileMap",
".",
"entrySet",
"(",
")",
",",
"s... | Writes a map from symbols to file absolute paths to a file. Each line has a mapping with the key and value
separated by a single tab. The file will have a trailing newline. | [
"Writes",
"a",
"map",
"from",
"symbols",
"to",
"file",
"absolute",
"paths",
"to",
"a",
"file",
".",
"Each",
"line",
"has",
"a",
"mapping",
"with",
"the",
"key",
"and",
"value",
"separated",
"by",
"a",
"single",
"tab",
".",
"The",
"file",
"will",
"have"... | d618652674d647867306e2e4b987a21b7c29c015 | https://github.com/BBN-E/bue-common-open/blob/d618652674d647867306e2e4b987a21b7c29c015/common-core-open/src/main/java/com/bbn/bue/common/files/FileUtils.java#L243-L245 | train |
BBN-E/bue-common-open | common-core-open/src/main/java/com/bbn/bue/common/files/FileUtils.java | FileUtils.writeSymbolToFileEntries | public static void writeSymbolToFileEntries(final Iterable<Map.Entry<Symbol, File>> entries,
final CharSink sink) throws IOException {
writeUnixLines(
transform(
MapUtils.transformValues(entries, toAbsolutePathFunction()),
TO_TAB_SEPARATED_ENTRY),
sink);
} | java | public static void writeSymbolToFileEntries(final Iterable<Map.Entry<Symbol, File>> entries,
final CharSink sink) throws IOException {
writeUnixLines(
transform(
MapUtils.transformValues(entries, toAbsolutePathFunction()),
TO_TAB_SEPARATED_ENTRY),
sink);
} | [
"public",
"static",
"void",
"writeSymbolToFileEntries",
"(",
"final",
"Iterable",
"<",
"Map",
".",
"Entry",
"<",
"Symbol",
",",
"File",
">",
">",
"entries",
",",
"final",
"CharSink",
"sink",
")",
"throws",
"IOException",
"{",
"writeUnixLines",
"(",
"transform"... | Writes map entries from symbols to file absolute paths to a file. Each line has a mapping with
the key and value separated by a single tab. The file will have a trailing newline. Note that
the same "key" may appear in the file with multiple mappings. | [
"Writes",
"map",
"entries",
"from",
"symbols",
"to",
"file",
"absolute",
"paths",
"to",
"a",
"file",
".",
"Each",
"line",
"has",
"a",
"mapping",
"with",
"the",
"key",
"and",
"value",
"separated",
"by",
"a",
"single",
"tab",
".",
"The",
"file",
"will",
... | d618652674d647867306e2e4b987a21b7c29c015 | https://github.com/BBN-E/bue-common-open/blob/d618652674d647867306e2e4b987a21b7c29c015/common-core-open/src/main/java/com/bbn/bue/common/files/FileUtils.java#L255-L263 | train |
BBN-E/bue-common-open | common-core-open/src/main/java/com/bbn/bue/common/files/FileUtils.java | FileUtils.writeIntegerToStart | public static void writeIntegerToStart(final File f, final int num) throws IOException {
final RandomAccessFile fixupFile = new RandomAccessFile(f, "rw");
fixupFile.writeInt(num);
fixupFile.close();
} | java | public static void writeIntegerToStart(final File f, final int num) throws IOException {
final RandomAccessFile fixupFile = new RandomAccessFile(f, "rw");
fixupFile.writeInt(num);
fixupFile.close();
} | [
"public",
"static",
"void",
"writeIntegerToStart",
"(",
"final",
"File",
"f",
",",
"final",
"int",
"num",
")",
"throws",
"IOException",
"{",
"final",
"RandomAccessFile",
"fixupFile",
"=",
"new",
"RandomAccessFile",
"(",
"f",
",",
"\"rw\"",
")",
";",
"fixupFile... | Writes a single integer to the beginning of a file, overwriting what was there originally but
leaving the rest of the file intact. This is useful when you are writing a long binary file
with a size header, but don't know how many elements are there until the end. | [
"Writes",
"a",
"single",
"integer",
"to",
"the",
"beginning",
"of",
"a",
"file",
"overwriting",
"what",
"was",
"there",
"originally",
"but",
"leaving",
"the",
"rest",
"of",
"the",
"file",
"intact",
".",
"This",
"is",
"useful",
"when",
"you",
"are",
"writin... | d618652674d647867306e2e4b987a21b7c29c015 | https://github.com/BBN-E/bue-common-open/blob/d618652674d647867306e2e4b987a21b7c29c015/common-core-open/src/main/java/com/bbn/bue/common/files/FileUtils.java#L389-L393 | train |
BBN-E/bue-common-open | common-core-open/src/main/java/com/bbn/bue/common/files/FileUtils.java | FileUtils.siblingDirectory | public static File siblingDirectory(final File f, final String siblingDirName) {
checkNotNull(f);
checkNotNull(siblingDirName);
checkArgument(!siblingDirName.isEmpty());
final File parent = f.getParentFile();
if (parent != null) {
return new File(parent, siblingDirName);
} else {
throw new RuntimeException(String
.format("Cannot create sibling directory %s of %s because the latter has no parent.",
siblingDirName, f));
}
} | java | public static File siblingDirectory(final File f, final String siblingDirName) {
checkNotNull(f);
checkNotNull(siblingDirName);
checkArgument(!siblingDirName.isEmpty());
final File parent = f.getParentFile();
if (parent != null) {
return new File(parent, siblingDirName);
} else {
throw new RuntimeException(String
.format("Cannot create sibling directory %s of %s because the latter has no parent.",
siblingDirName, f));
}
} | [
"public",
"static",
"File",
"siblingDirectory",
"(",
"final",
"File",
"f",
",",
"final",
"String",
"siblingDirName",
")",
"{",
"checkNotNull",
"(",
"f",
")",
";",
"checkNotNull",
"(",
"siblingDirName",
")",
";",
"checkArgument",
"(",
"!",
"siblingDirName",
"."... | Given a file, returns a File representing a sibling directory with the specified name.
@param f If f is the filesystem root, a runtime exeption will be thrown.
@param siblingDirName The non-empty name of the sibling directory. | [
"Given",
"a",
"file",
"returns",
"a",
"File",
"representing",
"a",
"sibling",
"directory",
"with",
"the",
"specified",
"name",
"."
] | d618652674d647867306e2e4b987a21b7c29c015 | https://github.com/BBN-E/bue-common-open/blob/d618652674d647867306e2e4b987a21b7c29c015/common-core-open/src/main/java/com/bbn/bue/common/files/FileUtils.java#L530-L543 | train |
BBN-E/bue-common-open | common-core-open/src/main/java/com/bbn/bue/common/files/FileUtils.java | FileUtils.endsWithPredicate | public static Predicate<File> endsWithPredicate(final String suffix) {
checkArgument(!suffix.isEmpty());
return new EndsWithPredicate(suffix);
} | java | public static Predicate<File> endsWithPredicate(final String suffix) {
checkArgument(!suffix.isEmpty());
return new EndsWithPredicate(suffix);
} | [
"public",
"static",
"Predicate",
"<",
"File",
">",
"endsWithPredicate",
"(",
"final",
"String",
"suffix",
")",
"{",
"checkArgument",
"(",
"!",
"suffix",
".",
"isEmpty",
"(",
")",
")",
";",
"return",
"new",
"EndsWithPredicate",
"(",
"suffix",
")",
";",
"}"
... | Make a predicate to test files for their name ending with the specified suffix.
@param suffix May not be null or empty. | [
"Make",
"a",
"predicate",
"to",
"test",
"files",
"for",
"their",
"name",
"ending",
"with",
"the",
"specified",
"suffix",
"."
] | d618652674d647867306e2e4b987a21b7c29c015 | https://github.com/BBN-E/bue-common-open/blob/d618652674d647867306e2e4b987a21b7c29c015/common-core-open/src/main/java/com/bbn/bue/common/files/FileUtils.java#L611-L615 | train |
BBN-E/bue-common-open | common-core-open/src/main/java/com/bbn/bue/common/files/FileUtils.java | FileUtils.isDirectoryPredicate | public static Predicate<File> isDirectoryPredicate() {
return new Predicate<File>() {
@Override
public boolean apply(final File input) {
return input.isDirectory();
}
};
} | java | public static Predicate<File> isDirectoryPredicate() {
return new Predicate<File>() {
@Override
public boolean apply(final File input) {
return input.isDirectory();
}
};
} | [
"public",
"static",
"Predicate",
"<",
"File",
">",
"isDirectoryPredicate",
"(",
")",
"{",
"return",
"new",
"Predicate",
"<",
"File",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"boolean",
"apply",
"(",
"final",
"File",
"input",
")",
"{",
"return",
"in... | Guava predicates and functions | [
"Guava",
"predicates",
"and",
"functions"
] | d618652674d647867306e2e4b987a21b7c29c015 | https://github.com/BBN-E/bue-common-open/blob/d618652674d647867306e2e4b987a21b7c29c015/common-core-open/src/main/java/com/bbn/bue/common/files/FileUtils.java#L829-L836 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.