_id
stringlengths
2
7
title
stringlengths
3
140
partition
stringclasses
3 values
text
stringlengths
73
34.1k
language
stringclasses
1 value
meta_information
dict
q15200
RhythmicalTomcat.addWebapp
train
@Override public Context addWebapp(Host host, String contextPath, String docBase) { final ContextConfig contextConfig = createContextConfig(); // *extension point return addWebapp(host, contextPath, docBase, contextConfig); }
java
{ "resource": "" }
q15201
MultiAttributeCollection.fireAttributeChange
train
protected void fireAttributeChange(AttributeChangeEvent event) { if (this.listeners != null && isEventFirable()) { final AttributeChangeListener[] list = new AttributeChangeListener[this.listeners.size()]; this.listeners.toArray(list); for (final AttributeChangeListener listener : list) { listener.onAttr...
java
{ "resource": "" }
q15202
WeakArrayList.maskNull
train
@SuppressWarnings("unchecked") private static <T> T maskNull(T value) { return (value == null) ? (T) NULL_VALUE : value; }
java
{ "resource": "" }
q15203
WeakArrayList.assertRange
train
protected void assertRange(int index, boolean allowLast) { final int csize = expurge(); if (index < 0) { throw new IndexOutOfBoundsException(Locale.getString("E1", index)); //$NON-NLS-1$ } if (allowLast && (index > csize)) { throw new IndexOutOfBoundsException(Locale.getString("E2", csize, index)); //$NON...
java
{ "resource": "" }
q15204
WeakArrayList.addReferenceListener
train
public void addReferenceListener(ReferenceListener listener) { if (this.listeners == null) { this.listeners = new LinkedList<>(); } final List<ReferenceListener> list = this.listeners; synchronized (list) { list.add(listener); } }
java
{ "resource": "" }
q15205
WeakArrayList.removeReferenceListener
train
public void removeReferenceListener(ReferenceListener listener) { final List<ReferenceListener> list = this.listeners; if (list != null) { synchronized (list) { list.remove(listener); if (list.isEmpty()) { this.listeners = null; } } } }
java
{ "resource": "" }
q15206
WeakArrayList.fireReferenceRelease
train
protected void fireReferenceRelease(int released) { final List<ReferenceListener> list = this.listeners; if (list != null && !list.isEmpty()) { for (final ReferenceListener listener : list) { listener.referenceReleased(released); } } }
java
{ "resource": "" }
q15207
GraphPath.getStartingPointFor
train
@Pure @SuppressWarnings("checkstyle:cyclomaticcomplexity") public PT getStartingPointFor(int index) { if ((index < 1) || (this.segmentList.size() <= 1)) { if (this.startingPoint != null) { return this.startingPoint; } } else { int idx = index; ST currentSegment = this.segmentList.get(idx); ST p...
java
{ "resource": "" }
q15208
GraphPath.removeUntil
train
boolean removeUntil(int index, boolean inclusive) { if (index >= 0) { boolean changed = false; PT startPoint = this.startingPoint; ST segment; int limit = index; if (inclusive) { ++limit; } for (int i = 0; i < limit; ++i) { segment = this.segmentList.remove(0); this.length -= segment....
java
{ "resource": "" }
q15209
GraphPath.invert
train
public void invert() { final PT p = this.startingPoint; this.startingPoint = this.endingPoint; this.endingPoint = p; final int middle = this.segmentList.size() / 2; ST segment; for (int i = 0, j = this.segmentList.size() - 1; i < middle; ++i, --j) { segment = this.segmentList.get(i); this.segmentList....
java
{ "resource": "" }
q15210
GraphPath.splitAt
train
public GP splitAt(ST obj, PT startPoint) { return splitAt(indexOf(obj, startPoint), true); }
java
{ "resource": "" }
q15211
GraphPath.splitAfterLast
train
public GP splitAfterLast(ST obj, PT startPoint) { return splitAt(lastIndexOf(obj, startPoint), false); }
java
{ "resource": "" }
q15212
GraphPath.splitAtLast
train
public GP splitAtLast(ST obj, PT startPoint) { return splitAt(lastIndexOf(obj, startPoint), true); }
java
{ "resource": "" }
q15213
GraphPath.splitAfter
train
public GP splitAfter(ST obj, PT startPoint) { return splitAt(indexOf(obj, startPoint), false); }
java
{ "resource": "" }
q15214
AbstractPlane4F.transform
train
public void transform(Transform3D transform, Point3D pivot) { Point3D refPoint = (pivot == null) ? getPivot() : pivot; Vector3f v = new Vector3f(this.getEquationComponentA(),this.getEquationComponentB(),this.getEquationComponentC()); transform.transform(v); // Update the plane equation according // ...
java
{ "resource": "" }
q15215
AbstractPlane4F.translate
train
public void translate(double dx, double dy, double dz) { // Compute the reference point for the plane // (usefull for translation) Point3f refPoint = (Point3f) getPivot(); // a.x + b.y + c.z + d = 0 // where (x,y,z) is the translation point setPivot(refPoint.getX()+dx,refPoint.getY()+dy...
java
{ "resource": "" }
q15216
AbstractPlane4F.rotate
train
public void rotate(Quaternion rotation, Point3D pivot) { Point3D currentPivot = getPivot(); // Update the plane equation according // to the desired normal (computed from // the identity vector and the rotations). Transform3D m = new Transform3D(); m.setRotation(rotation); Vector3f v = n...
java
{ "resource": "" }
q15217
ProbabilityUtils.cleanProbability
train
public static double cleanProbability(double prob, double epsilon, boolean allowOne) { if (prob < -epsilon || prob > (1.0 + epsilon)) { throw new InvalidProbabilityException(prob); } if (prob < epsilon) { prob = epsilon; } else { final double limit = allowOne ? 1.0 : (1.0 - epsilon); ...
java
{ "resource": "" }
q15218
Path3d.propertyArraysEquals
train
@Pure public static boolean propertyArraysEquals (Property<?>[] array, Property<?> [] array2) { if(array.length==array2.length) { for(int i=0; i<array.length; i++) { if(array[i]==null) { if(array2[i]!=null) return false; } else if(array2[i]==null) { return false; } else if(!array[i].ge...
java
{ "resource": "" }
q15219
Path3d.moveTo
train
public void moveTo(Point3d point) { if (this.numTypesProperty.get()>0 && this.types[this.numTypesProperty.get()-1]==PathElementType.MOVE_TO) { this.coordsProperty[this.numCoordsProperty.get()-3] = point.xProperty; this.coordsProperty[this.numCoordsProperty.get()-2] = point.yProperty; this.coordsProperty[this...
java
{ "resource": "" }
q15220
Path3d.lineTo
train
public void lineTo(Point3d point) { ensureSlots(true, 3); this.types[this.numTypesProperty.get()] = PathElementType.LINE_TO; this.numTypesProperty.set(this.numTypesProperty.get()+1); this.coordsProperty[this.numCoordsProperty.get()] = point.xProperty; this.numCoordsProperty.set(this.numCoordsProperty.get()+1...
java
{ "resource": "" }
q15221
Path3d.quadTo
train
public void quadTo(Point3d controlPoint, Point3d endPoint) { ensureSlots(true, 6); this.types[this.numTypesProperty.get()] = PathElementType.QUAD_TO; this.numTypesProperty.set(this.numTypesProperty.get()+1); this.coordsProperty[this.numCoordsProperty.get()] = controlPoint.xProperty; this.numCoordsProperty.se...
java
{ "resource": "" }
q15222
Path3d.curveTo
train
public void curveTo(Point3d controlPoint1, Point3d controlPoint2, Point3d endPoint) { ensureSlots(true, 9); this.types[this.numTypesProperty.get()] = PathElementType.CURVE_TO; this.numTypesProperty.set(this.numTypesProperty.get()+1); this.coordsProperty[this.numCoordsProperty.get()] = controlPoint1.xPr...
java
{ "resource": "" }
q15223
AbstractCommonShapeFileWriter.flush
train
protected void flush() throws IOException { if (this.tempStream != null && this.buffer.position() > 0) { final int pos = this.buffer.position(); this.buffer.rewind(); this.buffer.limit(pos); this.tempStream.write(this.buffer); this.buffer.rewind(); this.buffer.limit(this.buffer.capacity()); th...
java
{ "resource": "" }
q15224
AbstractCommonShapeFileWriter.writeBEInt
train
protected final void writeBEInt(int v) throws IOException { ensureAvailableBytes(4); this.buffer.order(ByteOrder.BIG_ENDIAN); this.buffer.putInt(v); }
java
{ "resource": "" }
q15225
AbstractCommonShapeFileWriter.writeBEDouble
train
protected final void writeBEDouble(double v) throws IOException { ensureAvailableBytes(8); this.buffer.order(ByteOrder.BIG_ENDIAN); this.buffer.putDouble(v); }
java
{ "resource": "" }
q15226
AbstractCommonShapeFileWriter.writeLEInt
train
protected final void writeLEInt(int v) throws IOException { ensureAvailableBytes(4); this.buffer.order(ByteOrder.LITTLE_ENDIAN); this.buffer.putInt(v); }
java
{ "resource": "" }
q15227
AbstractCommonShapeFileWriter.writeLEDouble
train
protected final void writeLEDouble(double v) throws IOException { ensureAvailableBytes(8); this.buffer.order(ByteOrder.LITTLE_ENDIAN); this.buffer.putDouble(v); }
java
{ "resource": "" }
q15228
AbstractCommonShapeFileWriter.writeHeader
train
private void writeHeader(ESRIBounds box, ShapeElementType type, Collection<? extends E> elements) throws IOException { if (!this.headerWasWritten) { initializeContentBuffer(); box.ensureMinMax(); //Byte 0 : File Code (9994) writeBEInt(SHAPE_FILE_CODE); //Byte 4 : Unused (0) writeBEInt(0); //Byt...
java
{ "resource": "" }
q15229
AbstractCommonShapeFileWriter.write
train
public void write(Collection<? extends E> elements) throws IOException { final Progression progressBar = getTaskProgression(); Progression subTask = null; if (progressBar != null) { progressBar.setProperties(0, 0, (elements.size() + 1) * 100, false); } if (this.fileBounds == null) { this.fileBounds = ...
java
{ "resource": "" }
q15230
MeasureUnitUtil.toSeconds
train
@Pure public static double toSeconds(double value, TimeUnit inputUnit) { switch (inputUnit) { case DAYS: return value * 86400.; case HOURS: return value * 3600.; case MINUTES: return value * 60.; case SECONDS: break; case MILLISECONDS: return milli2unit(value); case MICROSECONDS: return...
java
{ "resource": "" }
q15231
MeasureUnitUtil.toMeters
train
@Pure @SuppressWarnings("checkstyle:returncount") public static double toMeters(double value, SpaceUnit inputUnit) { switch (inputUnit) { case TERAMETER: return value * 1e12; case GIGAMETER: return value * 1e9; case MEGAMETER: return value * 1e6; case KILOMETER: return value * 1e3; case HECTOM...
java
{ "resource": "" }
q15232
MeasureUnitUtil.fromSeconds
train
@Pure public static double fromSeconds(double value, TimeUnit outputUnit) { switch (outputUnit) { case DAYS: return value / 86400.; case HOURS: return value / 3600.; case MINUTES: return value / 60.; case SECONDS: break; case MILLISECONDS: return unit2milli(value); case MICROSECONDS: re...
java
{ "resource": "" }
q15233
MeasureUnitUtil.toMetersPerSecond
train
@Pure public static double toMetersPerSecond(double value, SpeedUnit inputUnit) { switch (inputUnit) { case KILOMETERS_PER_HOUR: return 3.6 * value; case MILLIMETERS_PER_SECOND: return value / 1000.; case METERS_PER_SECOND: default: } return value; }
java
{ "resource": "" }
q15234
MeasureUnitUtil.toRadiansPerSecond
train
@Pure public static double toRadiansPerSecond(double value, AngularUnit inputUnit) { switch (inputUnit) { case TURNS_PER_SECOND: return value * (2. * MathConstants.PI); case DEGREES_PER_SECOND: return Math.toRadians(value); case RADIANS_PER_SECOND: default: } return value; }
java
{ "resource": "" }
q15235
MeasureUnitUtil.fromMetersPerSecond
train
@Pure public static double fromMetersPerSecond(double value, SpeedUnit outputUnit) { switch (outputUnit) { case KILOMETERS_PER_HOUR: return value / 3.6; case MILLIMETERS_PER_SECOND: return value * 1000.; case METERS_PER_SECOND: default: } return value; }
java
{ "resource": "" }
q15236
MeasureUnitUtil.fromRadiansPerSecond
train
@Pure public static double fromRadiansPerSecond(double value, AngularUnit outputUnit) { switch (outputUnit) { case TURNS_PER_SECOND: return value / (2. * MathConstants.PI); case DEGREES_PER_SECOND: return Math.toDegrees(value); case RADIANS_PER_SECOND: default: } return value; }
java
{ "resource": "" }
q15237
MeasureUnitUtil.getSmallestUnit
train
@Pure public static SpaceUnit getSmallestUnit(double amount, SpaceUnit unit) { final double meters = toMeters(amount, unit); double v; final SpaceUnit[] units = SpaceUnit.values(); SpaceUnit u; for (int i = units.length - 1; i >= 0; --i) { u = units[i]; v = Math.floor(fromMeters(meters, u)); if (v >...
java
{ "resource": "" }
q15238
Vector3d.convert
train
public static Vector3d convert(Tuple3D<?> tuple) { if (tuple instanceof Vector3d) { return (Vector3d) tuple; } return new Vector3d(tuple.getX(), tuple.getY(), tuple.getZ()); }
java
{ "resource": "" }
q15239
NYTCorpusDocument.ljust
train
private String ljust(String s, Integer length) { if (s.length() >= length) { return s; } length -= s.length(); StringBuffer sb = new StringBuffer(); for (Integer i = 0; i < length; i++) { sb.append(" "); } return s + sb.toString(); }
java
{ "resource": "" }
q15240
NYTCorpusDocument.appendProperty
train
private void appendProperty(StringBuffer sb, String propertyName, Object propertyValue) { if (propertyValue != null) { propertyValue = propertyValue.toString().replaceAll("\\s+", " ") .trim(); } sb.append(ljust(propertyName + ":", 45) + propertyValue + "\n"); }
java
{ "resource": "" }
q15241
AbstractBoxedShape3F.inflate
train
public void inflate(double minx, double miny, double minz, double maxx, double maxy, double maxz) { this.setFromCorners(this.getMinX()+ minx,this.getMinY()+ miny,this.getMinZ()+ minz,this.getMaxX()+ maxx,this.getMaxY()+ maxy,this.getMaxZ()+ maxz); }
java
{ "resource": "" }
q15242
AlignedBox3d.computeClosestPoint
train
@Pure public static Point3d computeClosestPoint( double minx, double miny, double minz, double maxx, double maxy, double maxz, double x, double y, double z) { Point3d closest = new Point3d(); if (x < minx) { closest.setX(minx); } else if (x > maxx) { closest.setX(maxx); } else { closest.s...
java
{ "resource": "" }
q15243
AlignedBox3d.setMinX
train
@Override public void setMinX(double x) { double o = this.maxxProperty.doubleValue(); if (o<x) { this.minxProperty.set(o); this.maxxProperty.set(x); } else { this.minxProperty.set(x); } }
java
{ "resource": "" }
q15244
AlignedBox3d.setMaxX
train
@Override public void setMaxX(double x) { double o = this.minxProperty.doubleValue(); if (o>x) { this.maxxProperty.set(o); this.minxProperty.set(x); } else { this.maxxProperty.set(x); } }
java
{ "resource": "" }
q15245
AlignedBox3d.setMaxY
train
@Override public void setMaxY(double y) { double o = this.minyProperty.doubleValue() ; if (o>y) { this.maxyProperty.set( o); this.minyProperty.set(y); } else { this.maxyProperty.set(y); } }
java
{ "resource": "" }
q15246
MapElementGroup.classifiesElement
train
@Pure public static ShapeElementType classifiesElement(MapElement element) { final Class<? extends MapElement> type = element.getClass(); if (MapMultiPoint.class.isAssignableFrom(type)) { return ShapeElementType.MULTIPOINT; } if (MapPolygon.class.isAssignableFrom(type)) { return ShapeElementType.POLYGON;...
java
{ "resource": "" }
q15247
MapElementGroup.add
train
void add(MapElement element) { final Rectangle2d r = element.getBoundingBox(); if (r != null) { if (Double.isNaN(this.minx) || this.minx > r.getMinX()) { this.minx = r.getMinX(); } if (Double.isNaN(this.maxx) || this.maxx < r.getMaxX()) { this.maxx = r.getMaxX(); } if (Double.isNaN(this.miny)...
java
{ "resource": "" }
q15248
MultiCollection.addCollection
train
public void addCollection(Collection<? extends E> collection) { if (collection != null && !collection.isEmpty()) { this.collections.add(collection); } }
java
{ "resource": "" }
q15249
Point2ifx.convert
train
public static Point2ifx convert(Tuple2D<?> tuple) { if (tuple instanceof Point2ifx) { return (Point2ifx) tuple; } return new Point2ifx(tuple.getX(), tuple.getY()); }
java
{ "resource": "" }
q15250
GenericTableModel.remove
train
public T remove(final T row) { final int index = data.indexOf(row); if (index != -1) { try { return data.remove(index); } finally { fireTableDataChanged(); } } return null; }
java
{ "resource": "" }
q15251
GenericTableModel.removeAll
train
public List<T> removeAll(final List<T> toRemove) { final List<T> removedList = new ArrayList<>(); for (final T t : toRemove) { final int index = data.indexOf(t); if (index != -1) { removedList.add(data.remove(index)); } } fireTableDataChanged(); return removedList; }
java
{ "resource": "" }
q15252
GenericTableModel.update
train
public void update(final T row) { final int index = data.indexOf(row); if (index != -1) { data.set(index, row); fireTableDataChanged(); } }
java
{ "resource": "" }
q15253
Point3ifx.convert
train
public static Point3ifx convert(Tuple3D<?> tuple) { if (tuple instanceof Point3ifx) { return (Point3ifx) tuple; } return new Point3ifx(tuple.getX(), tuple.getY(), tuple.getZ()); }
java
{ "resource": "" }
q15254
Triangle2dfx.ccwProperty
train
@Pure public ReadOnlyBooleanProperty ccwProperty() { if (this.ccw == null) { this.ccw = new ReadOnlyBooleanWrapper(this, MathFXAttributeNames.CCW); this.ccw.bind(Bindings.createBooleanBinding(() -> Triangle2afp.isCCW( getX1(), getY1(), getX2(), getY2(), getX3(), getY3()), x1Property(), y1P...
java
{ "resource": "" }
q15255
SummaryConfusionMatrices.chooseMostCommonRightHandClassAccuracy
train
public static final double chooseMostCommonRightHandClassAccuracy(SummaryConfusionMatrix m) { final double total = m.sumOfallCells(); double max = 0.0; for (final Symbol right : m.rightLabels()) { max = Math.max(max, m.columnSum(right)); } return DoubleUtils.XOverYOrZero(max, total); }
java
{ "resource": "" }
q15256
GridCellElement.consumeCells
train
public List<GridCell<P>> consumeCells() { final List<GridCell<P>> list = new ArrayList<>(this.cells); this.cells.clear(); return list; }
java
{ "resource": "" }
q15257
GridCellElement.isReferenceCell
train
@Pure public boolean isReferenceCell(GridCell<P> cell) { return !this.cells.isEmpty() && this.cells.get(0) == cell; }
java
{ "resource": "" }
q15258
ListUtils.shuffledCopy
train
public static <E> ImmutableList<E> shuffledCopy(List<? extends E> list, Random rng) { final ArrayList<E> shuffled = Lists.newArrayList(list); Collections.shuffle(shuffled, rng); return ImmutableList.copyOf(shuffled); }
java
{ "resource": "" }
q15259
AbstractReplaceMojo.replaceInFileBuffered
train
protected synchronized void replaceInFileBuffered(File sourceFile, File targetFile, ReplacementType replacementType, File[] classpath, boolean detectEncoding) throws MojoExecutionException { if (this.replacementTreatedFiles.contains(targetFile) && targetFile.exists()) { getLog().debug("Skiping " + targetFil...
java
{ "resource": "" }
q15260
AbstractReplaceMojo.replaceAuthor
train
@SuppressWarnings("checkstyle:nestedifdepth") protected synchronized String replaceAuthor(File sourceFile, int sourceLine, String text, ExtendedArtifact artifact, ReplacementType replacementType) throws MojoExecutionException { String result = text; final Pattern p = buildMacroPatternWithGroup(Macros.MACRO_AUTH...
java
{ "resource": "" }
q15261
AbstractReplaceMojo.replaceProp
train
@SuppressWarnings("checkstyle:nestedifdepth") protected synchronized String replaceProp(File sourceFile, int sourceLine, String text, MavenProject project, ReplacementType replacementType) throws MojoExecutionException { String result = text; final Pattern p = buildMacroPatternWithGroup(Macros.MACRO_PROP); fi...
java
{ "resource": "" }
q15262
AbstractReplaceMojo.setSourceDirectoryForAllMojo
train
protected void setSourceDirectoryForAllMojo(File newSourceDirectory) { final List<String> sourceRoots = this.mavenProject.getCompileSourceRoots(); getLog().debug("Old source roots: " + sourceRoots.toString()); //$NON-NLS-1$ final Iterator<String> iterator = sourceRoots.iterator(); final String removableSourcePa...
java
{ "resource": "" }
q15263
OffsetRange.charOffsetsOfWholeString
train
public static Optional<OffsetRange<CharOffset>> charOffsetsOfWholeString(String s) { if (s.isEmpty()) { return Optional.absent(); } return Optional.of(charOffsetRange(0, s.length() - 1)); }
java
{ "resource": "" }
q15264
OffsetRange.contains
train
public boolean contains(final OffsetType x) { return x.asInt() >= startInclusive().asInt() && x.asInt() <= endInclusive().asInt(); }
java
{ "resource": "" }
q15265
ColorNames.getColorFromName
train
@Pure public static int getColorFromName(String colorName, int defaultValue) { final Integer value = COLOR_MATCHES.get(Strings.nullToEmpty(colorName).toLowerCase()); if (value != null) { return value.intValue(); } return defaultValue; }
java
{ "resource": "" }
q15266
ColorNames.getColorNameFromValue
train
@Pure public static String getColorNameFromValue(int colorValue) { for (final Entry<String, Integer> entry : COLOR_MATCHES.entrySet()) { final int knownValue = entry.getValue().intValue(); if (colorValue == knownValue) { return entry.getKey(); } } return null; }
java
{ "resource": "" }
q15267
ClusteredRoadPath.getLength
train
@Pure public double getLength() { double length = 0; for (final RoadPath p : this.paths) { length += p.getLength(); } return length; }
java
{ "resource": "" }
q15268
ClusteredRoadPath.indexOf
train
@Pure public int indexOf(RoadSegment segment) { int count = 0; int index; for (final RoadPath p : this.paths) { index = p.indexOf(segment); if (index >= 0) { return count + index; } count += p.size(); } return -1; }
java
{ "resource": "" }
q15269
ClusteredRoadPath.lastIndexOf
train
@Pure public int lastIndexOf(RoadSegment segment) { int count = 0; int index; int lastIndex = -1; for (final RoadPath p : this.paths) { index = p.lastIndexOf(segment); if (index >= 0) { lastIndex = count + index; } count += p.size(); } return lastIndex; }
java
{ "resource": "" }
q15270
ClusteredRoadPath.getRoadSegmentAt
train
@Pure public RoadSegment getRoadSegmentAt(int index) { if (index >= 0) { int b = 0; for (final RoadPath p : this.paths) { final int e = b + p.size(); if (index < e) { return p.get(index - b); } b = e; } } throw new IndexOutOfBoundsException(); }
java
{ "resource": "" }
q15271
ClusteredRoadPath.getPathForRoadSegmentAt
train
@Pure public RoadPath getPathForRoadSegmentAt(int index) { if (index >= 0) { int b = 0; for (final RoadPath p : this.paths) { final int e = b + p.size(); if (index < e) { return p; } b = e; } } throw new IndexOutOfBoundsException(); }
java
{ "resource": "" }
q15272
ClusteredRoadPath.removeRoadSegmentAt
train
public RoadSegment removeRoadSegmentAt(int index) { if (index >= 0) { int b = 0; for (final RoadPath p : this.paths) { int end = b + p.size(); if (index < end) { end = index - b; return removeRoadSegmentAt(p, end, null); } b = end; } } throw new IndexOutOfBoundsException(); }
java
{ "resource": "" }
q15273
ClusteredRoadPath.removeRoadSegmentAt
train
private RoadSegment removeRoadSegmentAt(RoadPath path, int index, PathIterator iterator) { final int pathIndex = this.paths.indexOf(path); assert pathIndex >= 0 && pathIndex < this.paths.size(); assert index >= 0 && index < path.size(); final RoadPath syncPath; final RoadSegment sgmt; if (index == 0 || inde...
java
{ "resource": "" }
q15274
ClusteredRoadPath.addAndGetPath
train
@SuppressWarnings({"checkstyle:cyclomaticcomplexity", "checkstyle:npathcomplexity", "checkstyle:nestedifdepth"}) public RoadPath addAndGetPath(RoadPath end) { RoadPath selectedPath = null; if (end != null && !end.isEmpty()) { RoadConnection first = end.getFirstPoint(); RoadConnection last = end.getLastPoin...
java
{ "resource": "" }
q15275
AbstractTreeNode.setParentNodeReference
train
boolean setParentNodeReference(N newParent, boolean fireEvent) { final N oldParent = getParentNode(); if (newParent == oldParent) { return false; } this.parent = (newParent == null) ? null : new WeakReference<>(newParent); if (!fireEvent) { return true; } firePropertyParentChanged(oldParent, newPare...
java
{ "resource": "" }
q15276
AbstractTreeNode.firePropertyChildAdded
train
void firePropertyChildAdded(TreeNodeAddedEvent event) { if (this.nodeListeners != null) { for (final TreeNodeListener listener : this.nodeListeners) { if (listener != null) { listener.treeNodeChildAdded(event); } } } final N parentNode = getParentNode(); assert parentNode != this; if (paren...
java
{ "resource": "" }
q15277
AbstractTreeNode.firePropertyChildRemoved
train
void firePropertyChildRemoved(TreeNodeRemovedEvent event) { if (this.nodeListeners != null) { for (final TreeNodeListener listener : this.nodeListeners) { if (listener != null) { listener.treeNodeChildRemoved(event); } } } final N parentNode = getParentNode(); if (parentNode != null) { par...
java
{ "resource": "" }
q15278
StringUtils.joinFunction
train
public static Function<Iterable<?>, String> joinFunction(final Joiner joiner) { return new Function<Iterable<?>, String>() { @Override public String apply(final Iterable<?> list) { return joiner.join(list); } }; }
java
{ "resource": "" }
q15279
StringUtils.toLowerCaseFunction
train
public static Function<String, String> toLowerCaseFunction(final Locale locale) { return new Function<String, String>() { @Override public String apply(final String s) { return s.toLowerCase(locale); } @Override public String toString() { return "toLowercase(" + locale...
java
{ "resource": "" }
q15280
StringUtils.stripAccents
train
public static UnicodeFriendlyString stripAccents(final UnicodeFriendlyString input) { // this nifty normalization courtesy of http://stackoverflow.com/questions/3322152/is-there-a-way-to-get-rid-of-accents-and-convert-a-whole-string-to-regular-lette return StringUtils.unicodeFriendly(ACCENT_STRIPPER.matcher( ...
java
{ "resource": "" }
q15281
RobotExtensions.getKeyCode
train
public static int getKeyCode(final char character) throws IllegalAccessException, NoSuchFieldException { final String c = String.valueOf(character).toUpperCase(); final String variableName = "VK_" + c; final Class<KeyEvent> clazz = KeyEvent.class; final Field field = clazz.getField(variableName); final int...
java
{ "resource": "" }
q15282
RobotExtensions.typeCharacter
train
public static void typeCharacter(final Robot robot, final char character) throws IllegalAccessException, NoSuchFieldException { final boolean upperCase = Character.isUpperCase(character); final int keyCode = getKeyCode(character); if (upperCase) { robot.keyPress(KeyEvent.VK_SHIFT); } robot.keyPress(ke...
java
{ "resource": "" }
q15283
RobotExtensions.typeString
train
public static void typeString(final Robot robot, final String input) throws NoSuchFieldException, IllegalAccessException { if (input != null && !input.isEmpty()) { for (final char character : input.toCharArray()) { typeCharacter(robot, character); } } }
java
{ "resource": "" }
q15284
GISLayerReader.iterator
train
public <T extends MapLayer> Iterator<T> iterator(Class<T> type) { return new LayerReaderIterator<>(type); }
java
{ "resource": "" }
q15285
GISLayerReader.read
train
public final <T extends MapLayer> T read(Class<T> type) throws IOException { // Read the header if (!this.isHeaderRead) { this.isHeaderRead = true; readHeader(); if (this.progression != null) { this.progression.setProperties(0, 0, this.restToRead, false); } } T selectedObject = null; if (thi...
java
{ "resource": "" }
q15286
GISLayerReader.readHeader
train
@SuppressWarnings({"resource", "checkstyle:magicnumber"}) protected void readHeader() throws IOException { final ReadableByteChannel in = Channels.newChannel(this.input); final int limit = HEADER_KEY.getBytes().length + 2; final ByteBuffer hBuffer = ByteBuffer.allocate(limit); hBuffer.limit(limit); // Check...
java
{ "resource": "" }
q15287
ZoomableGraphicsContext.getLevelOfDetails
train
public LevelOfDetails getLevelOfDetails() { if (this.lod == null) { final double meterSize = doc2fxSize(1); if (meterSize <= LOW_DETAILLED_METER_SIZE) { this.lod = LevelOfDetails.LOW; } else if (meterSize >= HIGH_DETAILLED_METER_SIZE) { this.lod = LevelOfDetails.HIGH; } else { this.lod = Level...
java
{ "resource": "" }
q15288
ZoomableGraphicsContext.rgb
train
@SuppressWarnings({ "checkstyle:magicnumber", "static-method" }) @Pure public Color rgb(int color) { final int red = (color & 0x00FF0000) >> 16; final int green = (color & 0x0000FF00) >> 8; final int blue = color & 0x000000FF; return Color.rgb(red, green, blue); }
java
{ "resource": "" }
q15289
ZoomableGraphicsContext.doc2fxX
train
@Pure public double doc2fxX(double x) { return this.centeringTransform.toCenterX(x) * this.scale.get() + this.canvasWidth.get() / 2.; }
java
{ "resource": "" }
q15290
ZoomableGraphicsContext.fx2docX
train
@Pure public double fx2docX(double x) { return this.centeringTransform.toGlobalX((x - this.canvasWidth.get() / 2.) / this.scale.get()); }
java
{ "resource": "" }
q15291
ZoomableGraphicsContext.doc2fxY
train
@Pure public double doc2fxY(double y) { return this.centeringTransform.toCenterY(y) * this.scale.get() + this.canvasHeight.get() / 2.; }
java
{ "resource": "" }
q15292
ZoomableGraphicsContext.fx2docY
train
@Pure public double fx2docY(double y) { return this.centeringTransform.toGlobalY((y - this.canvasHeight.get() / 2.) / this.scale.get()); }
java
{ "resource": "" }
q15293
ZoomableGraphicsContext.doc2fxAngle
train
@Pure public double doc2fxAngle(double angle) { final ZoomableCanvas<?> canvas = getCanvas(); if (canvas.isInvertedAxisX() != canvas.isInvertedAxisY()) { return -angle; } return angle; }
java
{ "resource": "" }
q15294
ZoomableGraphicsContext.fx2docAngle
train
@Pure public double fx2docAngle(double angle) { final ZoomableCanvas<?> canvas = getCanvas(); if (canvas.isInvertedAxisX() != canvas.isInvertedAxisY()) { return -angle; } return angle; }
java
{ "resource": "" }
q15295
ZoomableGraphicsContext.restore
train
public void restore() { this.gc.restore(); if (this.stateStack != null) { if (!this.stateStack.isEmpty()) { final int[] data = this.stateStack.pop(); if (this.stateStack.isEmpty()) { this.stateStack = null; } this.bugdet = data[0]; this.state = data[1]; } else { this.stateStack = ...
java
{ "resource": "" }
q15296
ZoomableGraphicsContext.fillRoundRect
train
public void fillRoundRect(double x, double y, double width, double height, double arcWidth, double arcHeight) { this.gc.fillRoundRect( doc2fxX(x), doc2fxY(y), doc2fxSize(width), doc2fxSize(height), doc2fxSize(arcWidth), doc2fxSize(arcHeight)); }
java
{ "resource": "" }
q15297
ZoomableGraphicsContext.strokeLine
train
public void strokeLine(double x1, double y1, double x2, double y2) { this.gc.strokeLine( doc2fxX(x1), doc2fxY(y1), doc2fxX(x2), doc2fxY(y2)); }
java
{ "resource": "" }
q15298
StandardRoadNetwork.createInternalDataStructure
train
@SuppressWarnings({"static-method", "checkstyle:magicnumber"}) protected GISPolylineSet<RoadPolyline> createInternalDataStructure(Rectangle2afp<?, ?, ?, ?, ?, ?> originalBounds) { /*return new MapPolylineGridSet<>(100, 100, originalBounds.getMinX(), originalBounds.getMinY(), originalBounds.getWidth(), ...
java
{ "resource": "" }
q15299
StandardRoadNetwork.getInternalTree
train
@SuppressWarnings("unchecked") @Pure public Tree<RoadPolyline, ?> getInternalTree() { if (this.roadSegments instanceof GISTreeSet<?, ?>) { return ((GISTreeSet<RoadPolyline, ?>) this.roadSegments).getTree(); } return null; }
java
{ "resource": "" }