_id stringlengths 2 7 | title stringlengths 3 140 | partition stringclasses 3
values | text stringlengths 73 34.1k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q15000 | MapCircle.getDistance | train | @Override
@Pure
public double getDistance(Point2D<?, ?> point) {
double dist = super.getDistance(point);
dist -= this.radius;
return dist;
} | java | {
"resource": ""
} |
q15001 | Point3dfx.convert | train | public static Point3dfx convert(Tuple3D<?> tuple) {
if (tuple instanceof Point3dfx) {
return (Point3dfx) tuple;
}
return new Point3dfx(tuple.getX(), tuple.getY(), tuple.getZ());
} | java | {
"resource": ""
} |
q15002 | ERELoading.fetch | train | @SuppressWarnings({"TypeParameterUnusedInFormals", "unchecked"})
private <T> T fetch(final String id) {
checkNotNull(id);
checkArgument(!id.isEmpty());
final T ret = (T) idMap.get(id);
if (ret == null) {
throw new EREException(String.format("Lookup failed for id %s.", id));
}
return ret;... | java | {
"resource": ""
} |
q15003 | StringEscaper.setSpecialChars | train | public void setSpecialChars(String[][] chars) {
assert chars != null : AssertMessages.notNullParameter();
this.specialChars.clear();
for (final String[] pair : chars) {
assert pair != null;
assert pair.length == 2;
assert pair[0].length() > 0;
assert pair[1].length() > 0;
this.specialChars.put(pair... | java | {
"resource": ""
} |
q15004 | StringEscaper.setValidCharRange | train | public void setValidCharRange(int minValidChar, int maxValidChar) {
if (minValidChar <= maxValidChar) {
this.minValidChar = minValidChar;
this.maxValidChar = maxValidChar;
} else {
this.maxValidChar = minValidChar;
this.minValidChar = maxValidChar;
}
} | java | {
"resource": ""
} |
q15005 | StringEscaper.escape | train | @SuppressWarnings("checkstyle:magicnumber")
public String escape(CharSequence text) {
final StringBuilder result = new StringBuilder();
for (int i = 0; i < text.length(); ++i) {
final char c = text.charAt(i);
final String cs = Character.toString(c);
if (this.escapeCharacters.contains(cs)) {
// Escape... | java | {
"resource": ""
} |
q15006 | IntUtils.shuffle | train | public static void shuffle(final int[] arr, final Random rng) {
// Fisher-Yates shuffle
for (int i = arr.length; i > 1; i--) {
// swap i-1 and a random spot
final int a = i - 1;
final int b = rng.nextInt(i);
final int tmp = arr[b];
arr[b] = arr[a];
arr[a] = tmp;
}
} | java | {
"resource": ""
} |
q15007 | RoadPolylineDrawer.setupRoadBorders | train | protected void setupRoadBorders(ZoomableGraphicsContext gc, RoadPolyline element) {
final Color color = gc.rgb(getDrawingColor(element));
gc.setStroke(color);
final double width;
if (element.isWidePolyline()) {
width = 2 + gc.doc2fxSize(element.getWidth());
} else {
width = 3;
}
gc.setLineWidthInPix... | java | {
"resource": ""
} |
q15008 | RoadPolylineDrawer.setupRoadInterior | train | protected void setupRoadInterior(ZoomableGraphicsContext gc, RoadPolyline element) {
final Color color;
if (isSelected(element)) {
color = gc.rgb(SELECTED_ROAD_COLOR);
} else {
color = gc.rgb(ROAD_COLOR);
}
gc.setStroke(color);
if (element.isWidePolyline()) {
gc.setLineWidthInMeters(element.getWidt... | java | {
"resource": ""
} |
q15009 | AssertMessages.lowerEqualParameter | train | @Pure
public static String lowerEqualParameter(int aindex, Object avalue, Object value) {
return msg("A11", aindex, avalue, value); //$NON-NLS-1$
} | java | {
"resource": ""
} |
q15010 | AssertMessages.lowerEqualParameters | train | @Pure
public static String lowerEqualParameters(int aindex, Object avalue, int bindex, Object bvalue) {
return msg("A3", aindex, avalue, bindex, bvalue); //$NON-NLS-1$
} | java | {
"resource": ""
} |
q15011 | AssertMessages.outsideRangeInclusiveParameter | train | @Pure
public static String outsideRangeInclusiveParameter(int parameterIndex, Object currentValue,
Object minValue, Object maxValue) {
return msg("A6", parameterIndex, currentValue, minValue, maxValue); //$NON-NLS-1$
} | java | {
"resource": ""
} |
q15012 | AssertMessages.outsideRangeInclusiveParameter | train | @Pure
@Inline(value = "AssertMessages.outsideRangeInclusiveParameter(0, $1, $2, $3)", imported = {AssertMessages.class})
public static String outsideRangeInclusiveParameter(Object currentValue,
Object minValue, Object maxValue) {
return outsideRangeInclusiveParameter(0, currentValue, minValue, maxValue);
} | java | {
"resource": ""
} |
q15013 | AssertMessages.tooSmallArrayParameter | train | @Pure
@Inline(value = "AssertMessages.tooSmallArrayParameter(0, $1, $2)", imported = {AssertMessages.class})
public static String tooSmallArrayParameter(int currentSize, int expectedSize) {
return tooSmallArrayParameter(0, currentSize, expectedSize);
} | java | {
"resource": ""
} |
q15014 | AssertMessages.tooSmallArrayParameter | train | @Pure
public static String tooSmallArrayParameter(int parameterIndex, int currentSize, int expectedSize) {
return msg("A5", parameterIndex, currentSize, expectedSize); //$NON-NLS-1$
} | java | {
"resource": ""
} |
q15015 | GISShapeFileWriter.toESRI | train | @Pure
public static ShapeElementType toESRI(Class<? extends MapElement> type) {
if (MapPolyline.class.isAssignableFrom(type)) {
return ShapeElementType.POLYLINE;
}
if (MapPolygon.class.isAssignableFrom(type)) {
return ShapeElementType.POLYGON;
}
if (MapMultiPoint.class.isAssignableFrom(type)) {
retu... | java | {
"resource": ""
} |
q15016 | Alignments.splitAlignmentByKeyFunction | train | @SuppressWarnings("unchecked")
public static <T, V> ImmutableMap<V, Alignment<T, T>> splitAlignmentByKeyFunction(
Alignment<? extends T, ? extends T> alignment,
Function<? super T, ? extends V> keyFunction) {
// we first determine all keys we could ever encounter to ensure we can construct our map
... | java | {
"resource": ""
} |
q15017 | DefaultProgression.fireStateChange | train | protected void fireStateChange() {
if (this.listeners != null) {
final ProgressionEvent event = new ProgressionEvent(this, isRootModel());
for (final ProgressionListener listener : this.listeners.getListeners(ProgressionListener.class)) {
listener.onProgressionStateChanged(event);
}
}
} | java | {
"resource": ""
} |
q15018 | DefaultProgression.fireValueChange | train | protected void fireValueChange() {
if (this.listeners != null) {
final ProgressionEvent event = new ProgressionEvent(this, isRootModel());
for (final ProgressionListener listener : this.listeners.getListeners(ProgressionListener.class)) {
listener.onProgressionValueChanged(event);
}
}
} | java | {
"resource": ""
} |
q15019 | DefaultProgression.setValue | train | void setValue(SubProgressionModel subTask, double newValue, String comment) {
setProperties(newValue, this.min, this.max, this.isAdjusting,
comment == null ? this.comment : comment, true, true, false,
subTask);
} | java | {
"resource": ""
} |
q15020 | DefaultProgression.disconnectSubTask | train | void disconnectSubTask(SubProgressionModel subTask, double value, boolean overwriteComment) {
if (this.child == subTask) {
if (overwriteComment) {
final String cmt = subTask.getComment();
if (cmt != null) {
this.comment = cmt;
}
}
this.child = null;
setProperties(value, this.min, this.max... | java | {
"resource": ""
} |
q15021 | BusLineLayer.onBusItineraryAdded | train | protected boolean onBusItineraryAdded(BusItinerary itinerary, int index) {
if (this.autoUpdate.get()) {
try {
addMapLayer(index, new BusItineraryLayer(itinerary, isLayerAutoUpdated()));
return true;
} catch (Throwable exception) {
//
}
}
return false;
} | java | {
"resource": ""
} |
q15022 | BusLineLayer.onBusItineraryRemoved | train | protected boolean onBusItineraryRemoved(BusItinerary itinerary, int index) {
if (this.autoUpdate.get()) {
try {
removeMapLayerAt(index);
return true;
} catch (Throwable exception) {
//
}
}
return false;
} | java | {
"resource": ""
} |
q15023 | GISShapeFileReader.fromESRI | train | @Pure
@SuppressWarnings("checkstyle:cyclomaticcomplexity")
public static Class<? extends MapElement> fromESRI(ShapeElementType type) {
switch (type) {
case MULTIPOINT:
case MULTIPOINT_M:
case MULTIPOINT_Z:
return MapMultiPoint.class;
case POINT:
case POINT_M:
case POINT_Z:
return MapPoint.class;
... | java | {
"resource": ""
} |
q15024 | GISShapeFileReader.getMapElementType | train | @Pure
public Class<? extends MapElement> getMapElementType() {
if (this.elementType != null) {
return this.elementType;
}
try {
return fromESRI(getShapeElementType());
} catch (IllegalArgumentException exception) {
//
}
return null;
} | java | {
"resource": ""
} |
q15025 | GISShapeFileReader.extractUUID | train | protected static UUID extractUUID(AttributeProvider provider) {
AttributeValue value;
value = provider.getAttribute(UUID_ATTR);
if (value != null) {
try {
return value.getUUID();
} catch (InvalidAttributeTypeException e) {
//
} catch (AttributeNotInitializedException e) {
//
}
}
valu... | java | {
"resource": ""
} |
q15026 | PopupListener.onShowPopup | train | protected void onShowPopup(final MouseEvent e)
{
if (e.isPopupTrigger())
{
System.out.println(e.getSource());
popupMenu.show(e.getComponent(), e.getX(), e.getY());
}
} | java | {
"resource": ""
} |
q15027 | HandlerSocketSessionImpl.takeExecutingCommand | train | private final Command takeExecutingCommand() {
try {
return this.commandAlreadySent.take();
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
}
return null;
} | java | {
"resource": ""
} |
q15028 | LibraryLoader.load | train | public static void load(URL filename) throws IOException {
// Silently ignore loading query
if (disable) {
return;
}
if (URISchemeType.FILE.isURL(filename)) {
try {
load(new File(filename.toURI()));
} catch (URISyntaxException e) {
throw new FileNotFoundException(filename.toExternalForm());
... | java | {
"resource": ""
} |
q15029 | AbstractShapeFileReader.readPoint | train | private E readPoint(int elementIndex, ShapeElementType type) throws IOException {
final boolean hasZ = type.hasZ();
final boolean hasM = type.hasM();
// Read coordinates
final double x = fromESRI_x(readLEDouble());
final double y = fromESRI_y(readLEDouble());
double z = 0;
double measure = Double.NaN;
... | java | {
"resource": ""
} |
q15030 | AbstractShapeFileReader.readPolyElement | train | @SuppressWarnings({"checkstyle:cyclomaticcomplexity", "checkstyle:npathcomplexity"})
private E readPolyElement(int elementIndex, ShapeElementType type) throws IOException {
final boolean hasZ = type.hasZ();
final boolean hasM = type.hasM();
// Ignore the bounds stored inside the file
skipBytes(8 * 4);
// C... | java | {
"resource": ""
} |
q15031 | AbstractShapeFileReader.readMultiPatch | train | private E readMultiPatch(int elementIndex, ShapeElementType type) throws IOException {
// Ignore the bounds stored inside the file
skipBytes(8 * 4);
// Read the part count
final int partCount = readLEInt();
// Read the point count
final int pointCount = readLEInt();
// Read the parts' indexes
final i... | java | {
"resource": ""
} |
q15032 | AbstractShapeFileReader.readAttributesFromDBaseFile | train | private void readAttributesFromDBaseFile(E created_element) throws IOException {
// Read the DBF entry
if (this.dbfReader != null) {
final List<DBaseFileField> dbfColumns = this.dbfReader.getDBFFields();
// Read the record even if the shape element was not inserted into
// the database. It is necessary t... | java | {
"resource": ""
} |
q15033 | StochasticGenerator.noiseValue | train | @Pure
public static double noiseValue(double value, MathFunction noiseLaw) throws MathException {
try {
double noise = Math.abs(noiseLaw.f(value));
initRandomNumberList();
noise *= uniformRandomVariableList.nextFloat();
if (uniformRandomVariableList.nextBoolea... | java | {
"resource": ""
} |
q15034 | Transform3D.setRotation | train | public void setRotation(Quaternion rotation) {
this.m00 = 1.0f - 2.0f * rotation.getY() * rotation.getY() - 2.0f * rotation.getZ() * rotation.getZ();
this.m10 = 2.0f * (rotation.getX() * rotation.getY() + rotation.getW() * rotation.getZ());
this.m20 = 2.0f * (rotation.getX() * rotation.getZ() - ... | java | {
"resource": ""
} |
q15035 | Transform3D.makeRotationMatrix | train | public final void makeRotationMatrix(Quaternion rotation) {
this.m00 = 1.0f - 2.0f * rotation.getY() * rotation.getY() - 2.0f * rotation.getZ() * rotation.getZ();
this.m10 = 2.0f * (rotation.getX() * rotation.getY() + rotation.getW() * rotation.getZ());
this.m20 = 2.0f * (rotation.getX() * rotat... | java | {
"resource": ""
} |
q15036 | StandardRoadConnection.setPosition | train | void setPosition(Point2D<?, ?> position) {
this.location = position == null ? null : new SoftReference<>(Point2d.convert(position));
} | java | {
"resource": ""
} |
q15037 | StandardRoadConnection.addConnectedSegment | train | void addConnectedSegment(RoadPolyline segment, boolean attachToStartPoint) {
if (segment == null) {
return;
}
if (this.connectedSegments.isEmpty()) {
this.connectedSegments.add(new Connection(segment, attachToStartPoint));
} else {
// Compute the angle to the unit vector for the new segment
final do... | java | {
"resource": ""
} |
q15038 | StandardRoadConnection.removeConnectedSegment | train | int removeConnectedSegment(RoadSegment segment, boolean attachToStartPoint) {
if (segment == null) {
return -1;
}
final int idx = indexOf(segment, attachToStartPoint);
if (idx != -1) {
this.connectedSegments.remove(idx);
fireIteratorUpdate();
}
return idx;
} | java | {
"resource": ""
} |
q15039 | StandardRoadConnection.addListeningIterator | train | protected void addListeningIterator(IClockwiseIterator iterator) {
if (this.listeningIterators == null) {
this.listeningIterators = new WeakArrayList<>();
}
this.listeningIterators.add(iterator);
} | java | {
"resource": ""
} |
q15040 | StandardRoadConnection.removeListeningIterator | train | protected void removeListeningIterator(IClockwiseIterator iterator) {
if (this.listeningIterators != null) {
this.listeningIterators.remove(iterator);
if (this.listeningIterators.isEmpty()) {
this.listeningIterators = null;
}
}
} | java | {
"resource": ""
} |
q15041 | StandardRoadConnection.fireIteratorUpdate | train | protected void fireIteratorUpdate() {
if (this.listeningIterators != null) {
for (final IClockwiseIterator iterator : this.listeningIterators) {
if (iterator != null) {
iterator.dataStructureUpdated();
}
}
}
} | java | {
"resource": ""
} |
q15042 | RoadNetworkLayerConstants.getPreferredRoadColor | train | @Pure
public static int getPreferredRoadColor(RoadType roadType, boolean useSystemValue) {
final RoadType rt = roadType == null ? RoadType.OTHER : roadType;
final Preferences prefs = Preferences.userNodeForPackage(RoadNetworkLayerConstants.class);
if (prefs != null) {
final String str = prefs.get("ROAD_COLOR... | java | {
"resource": ""
} |
q15043 | RoadNetworkLayerConstants.setPreferredRoadColor | train | public static void setPreferredRoadColor(RoadType roadType, Integer color) {
final RoadType rt = roadType == null ? RoadType.OTHER : roadType;
final Preferences prefs = Preferences.userNodeForPackage(RoadNetworkLayerConstants.class);
if (prefs != null) {
if (color == null || color.intValue() == DEFAULT_ROAD_CO... | java | {
"resource": ""
} |
q15044 | RoadNetworkLayerConstants.getPreferredRoadInternDrawing | train | @Pure
public static boolean getPreferredRoadInternDrawing() {
final Preferences prefs = Preferences.userNodeForPackage(RoadNetworkLayerConstants.class);
if (prefs != null) {
return prefs.getBoolean("ROAD_INTERN_DRAWING", DEFAULT_ROAD_INTERN_DRAWING); //$NON-NLS-1$
}
return DEFAULT_ROAD_INTERN_DRAWING;
} | java | {
"resource": ""
} |
q15045 | RoadNetworkLayerConstants.setPreferredRoadInternDrawing | train | public static void setPreferredRoadInternDrawing(Boolean draw) {
final Preferences prefs = Preferences.userNodeForPackage(RoadNetworkLayerConstants.class);
if (prefs != null) {
if (draw == null) {
prefs.remove("ROAD_INTERN_DRAWING"); //$NON-NLS-1$
} else {
prefs.putBoolean("ROAD_INTERN_DRAWING", draw)... | java | {
"resource": ""
} |
q15046 | RoadNetworkLayerConstants.getPreferredRoadInternColor | train | @Pure
public static int getPreferredRoadInternColor() {
final Preferences prefs = Preferences.userNodeForPackage(RoadNetworkLayerConstants.class);
if (prefs != null) {
final String color = prefs.get("ROAD_INTERN_COLOR", null); //$NON-NLS-1$
if (color != null) {
try {
return Integer.valueOf(color);
... | java | {
"resource": ""
} |
q15047 | RoadNetworkLayerConstants.setPreferredRoadInternColor | train | public static void setPreferredRoadInternColor(Integer color) {
final Preferences prefs = Preferences.userNodeForPackage(RoadNetworkLayerConstants.class);
if (prefs != null) {
if (color == null) {
prefs.remove("ROAD_INTERN_COLOR"); //$NON-NLS-1$
} else {
prefs.put("ROAD_INTERN_COLOR", Integer.toString... | java | {
"resource": ""
} |
q15048 | MathUtil.clamp | train | @Pure
public static double clamp(double v, double min, double max) {
assert min <= max : AssertMessages.lowerEqualParameters(1, min, 2, max);
if (v < min) {
return min;
}
if (v > max) {
return max;
}
return v;
} | java | {
"resource": ""
} |
q15049 | MathUtil.clampCyclic | train | @Pure
public static double clampCyclic(double value, double min, double max) {
assert min <= max : AssertMessages.lowerEqualParameters(1, min, 2, max);
if (Double.isNaN(max) || Double.isNaN(min) || Double.isNaN(max)) {
return Double.NaN;
}
if (value < min) {
final double perimeter = max - min;
final d... | java | {
"resource": ""
} |
q15050 | MathUtil.getMinMax | train | public static DoubleRange getMinMax(double value1, double value2, double value3) {
// Efficient implementation of the min/max determination
final double min;
final double max;
// ---------------------------------
// Table of cases
// ---------------------------------
// a-b a-c b-c sequence min max case
... | java | {
"resource": ""
} |
q15051 | MathUtil.csc | train | @Pure
@Inline(value = "1./Math.sin($1)", imported = {Math.class})
public static double csc(double angle) {
return 1. / Math.sin(angle);
} | java | {
"resource": ""
} |
q15052 | MathUtil.sec | train | @Pure
@Inline(value = "1./Math.cos($1)", imported = {Math.class})
public static double sec(double angle) {
return 1. / Math.cos(angle);
} | java | {
"resource": ""
} |
q15053 | MathUtil.cot | train | @Pure
@Inline(value = "1./Math.tan($1)", imported = {Math.class})
public static double cot(double angle) {
return 1. / Math.tan(angle);
} | java | {
"resource": ""
} |
q15054 | MathUtil.versin | train | @Pure
@Inline(value = "1.-Math.cos($1)", imported = {Math.class})
public static double versin(double angle) {
return 1. - Math.cos(angle);
} | java | {
"resource": ""
} |
q15055 | MathUtil.crd | train | @Pure
@Inline(value = "2.*Math.sin(($1)/2.)", imported = {Math.class})
public static double crd(double angle) {
return 2. * Math.sin(angle / 2.);
} | java | {
"resource": ""
} |
q15056 | Point2dfx.convert | train | public static Point2dfx convert(Tuple2D<?> tuple) {
if (tuple instanceof Point2dfx) {
return (Point2dfx) tuple;
}
return new Point2dfx(tuple.getX(), tuple.getY());
} | java | {
"resource": ""
} |
q15057 | AttributeValueImpl.parse | train | @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 {
bin... | java | {
"resource": ""
} |
q15058 | AttributeValueImpl.compareValues | train | @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 except... | java | {
"resource": ""
} |
q15059 | AttributeValueImpl.compareRawValues | train | @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;
... | java | {
"resource": ""
} |
q15060 | AttributeValueImpl.setInternalValue | train | protected void setInternalValue(Object value, AttributeType type) {
this.value = value;
this.assigned = this.value != null;
this.type = type;
} | java | {
"resource": ""
} |
q15061 | AttributeValueImpl.extractDate | train | 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 (P... | java | {
"resource": ""
} |
q15062 | DBaseFileFilter.isDbaseFile | train | @Pure
public static boolean isDbaseFile(File file) {
return FileType.isContentType(
file,
MimeName.MIME_DBASE_FILE.getMimeConstant());
} | java | {
"resource": ""
} |
q15063 | AbstractMapCircleDrawer.stroke | train | 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 | {
"resource": ""
} |
q15064 | AbstractMapCircleDrawer.fill | train | 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 | {
"resource": ""
} |
q15065 | BusItineraryHalt.getFirstFreeBushaltName | train | @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) !=... | java | {
"resource": ""
} |
q15066 | BusItineraryHalt.setBusStop | train | 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 != nu... | java | {
"resource": ""
} |
q15067 | BusItineraryHalt.getRoadSegment | train | @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 | {
"resource": ""
} |
q15068 | BusItineraryHalt.getRoadSegmentDirection | train | @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 | {
"resource": ""
} |
q15069 | BusItineraryHalt.setType | train | public void setType(BusItineraryHaltType type) {
if (type != null && type != this.type) {
this.type = type;
firePrimitiveChanged();
}
} | java | {
"resource": ""
} |
q15070 | BusItineraryHalt.insideBusHub | train | @Pure
public boolean insideBusHub() {
final BusStop busStop = getBusStop();
if (busStop != null) {
return busStop.insideBusHub();
}
return false;
} | java | {
"resource": ""
} |
q15071 | BusItineraryHalt.busHubs | train | @Pure
public Iterable<BusHub> busHubs() {
final BusStop busStop = getBusStop();
if (busStop != null) {
return busStop.busHubs();
}
return Collections.emptyList();
} | java | {
"resource": ""
} |
q15072 | BusItineraryHalt.busHubIterator | train | @Pure
public Iterator<BusHub> busHubIterator() {
final BusStop busStop = getBusStop();
if (busStop != null) {
return busStop.busHubIterator();
}
return Collections.emptyIterator();
} | java | {
"resource": ""
} |
q15073 | BusItineraryHalt.getGeoPosition | train | @Pure
public GeoLocationPoint getGeoPosition() {
final Point2d p = getPosition2D();
if (p != null) {
return new GeoLocationPoint(p.getX(), p.getY());
}
return null;
} | java | {
"resource": ""
} |
q15074 | BusItineraryHalt.distanceToBusStop | train | @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 | {
"resource": ""
} |
q15075 | BusItineraryHalt.distance | train | @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 | {
"resource": ""
} |
q15076 | BusItineraryHalt.distance | train | @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 | {
"resource": ""
} |
q15077 | BusItineraryHalt.distance | train | @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 | {
"resource": ""
} |
q15078 | EnglishAndChineseHeadRules.createChinesePTBFromResources | train | 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"),
Charset... | java | {
"resource": ""
} |
q15079 | DotDotWriter.write | train | 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<? e... | java | {
"resource": ""
} |
q15080 | AbstractCapsule3F.containsCapsulePoint | train | @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(
cap... | java | {
"resource": ""
} |
q15081 | AbstractCapsule3F.intersectsCapsuleAlignedBox | train | @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, ma... | java | {
"resource": ""
} |
q15082 | AbstractCapsule3F.intersectsCapsuleCapsule | train | @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 c... | java | {
"resource": ""
} |
q15083 | AbstractCapsule3F.ensureAIsLowerPoint | train | 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());
... | java | {
"resource": ""
} |
q15084 | Vector3ifx.convert | train | public static Vector3ifx convert(Tuple3D<?> tuple) {
if (tuple instanceof Vector3ifx) {
return (Vector3ifx) tuple;
}
return new Vector3ifx(tuple.getX(), tuple.getY(), tuple.getZ());
} | java | {
"resource": ""
} |
q15085 | DssatSoilInput.readFile | train | @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 | {
"resource": ""
} |
q15086 | Point3d.convert | train | public static Point3d convert(Tuple3D<?> tuple) {
if (tuple instanceof Point3d) {
return (Point3d) tuple;
}
return new Point3d(tuple.getX(), tuple.getY(), tuple.getZ());
} | java | {
"resource": ""
} |
q15087 | OctTreeNode.getChildAt | train | @Pure
public final N getChildAt(OctTreeZone zone) {
if (zone != null) {
return getChildAt(zone.ordinal());
}
return null;
} | java | {
"resource": ""
} |
q15088 | OctTreeNode.setChild6 | train | @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 != nul... | java | {
"resource": ""
} |
q15089 | OctTreeNode.setChild7 | train | @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 != nul... | java | {
"resource": ""
} |
q15090 | OctTreeNode.setChild8 | train | @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 != nul... | java | {
"resource": ""
} |
q15091 | GenerateSourceMojo.executeMojo | train | 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... | java | {
"resource": ""
} |
q15092 | Caller.getCaller | train | @Pure
public static org.arakhne.afc.vmutil.caller.Caller getCaller() {
synchronized (Caller.class) {
if (caller == null) {
caller = new StackTraceCaller();
}
return caller;
}
} | java | {
"resource": ""
} |
q15093 | GridCell.getElementAt | train | @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 Inde... | java | {
"resource": ""
} |
q15094 | GridCell.iterator | train | @Pure
public Iterator<P> iterator(Rectangle2afp<?, ?, ?, ?, ?, ?> bounds) {
return new BoundsIterator<>(this.elements.iterator(), bounds);
} | java | {
"resource": ""
} |
q15095 | GridCell.addElement | train | public boolean addElement(GridCellElement<P> element) {
if (element != null && this.elements.add(element)) {
if (element.addCellLink(this)) {
++this.referenceElementCount;
}
return true;
}
return false;
} | java | {
"resource": ""
} |
q15096 | GridCell.removeElement | train | public GridCellElement<P> removeElement(P element) {
final GridCellElement<P> elt = remove(element);
if (elt != null) {
if (elt.removeCellLink(this)) {
--this.referenceElementCount;
}
}
return elt;
} | java | {
"resource": ""
} |
q15097 | SimpleViewer.getElementUnderMouse | train | @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 getE... | java | {
"resource": ""
} |
q15098 | EnumRadioButtonGroupBean.getSelectedEnumFromRadioButtons | train | 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 | {
"resource": ""
} |
q15099 | EnumRadioButtonGroupBean.setSelectedRadioButton | train | 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 | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.