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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
osmdroid/osmdroid | osmdroid-android/src/main/java/org/osmdroid/views/overlay/IconOverlay.java | IconOverlay.draw | @Override
public void draw(Canvas canvas, Projection pj) {
if (mIcon == null)
return;
if (mPosition == null)
return;
pj.toPixels(mPosition, mPositionPixels);
int width = mIcon.getIntrinsicWidth();
int height = mIcon.getIntrinsicHeight();
Rect ... | java | @Override
public void draw(Canvas canvas, Projection pj) {
if (mIcon == null)
return;
if (mPosition == null)
return;
pj.toPixels(mPosition, mPositionPixels);
int width = mIcon.getIntrinsicWidth();
int height = mIcon.getIntrinsicHeight();
Rect ... | [
"@",
"Override",
"public",
"void",
"draw",
"(",
"Canvas",
"canvas",
",",
"Projection",
"pj",
")",
"{",
"if",
"(",
"mIcon",
"==",
"null",
")",
"return",
";",
"if",
"(",
"mPosition",
"==",
"null",
")",
"return",
";",
"pj",
".",
"toPixels",
"(",
"mPosit... | Draw the icon. | [
"Draw",
"the",
"icon",
"."
] | 3b178b2f078497dd88c137110e87aafe45ad2b16 | https://github.com/osmdroid/osmdroid/blob/3b178b2f078497dd88c137110e87aafe45ad2b16/osmdroid-android/src/main/java/org/osmdroid/views/overlay/IconOverlay.java#L49-L67 | train |
osmdroid/osmdroid | osmdroid-android/src/main/java/org/osmdroid/util/TileSystem.java | TileSystem.getX01FromLongitude | public double getX01FromLongitude(double longitude, boolean wrapEnabled) {
longitude = wrapEnabled ? Clip(longitude, getMinLongitude(), getMaxLongitude()) : longitude;
final double result = getX01FromLongitude(longitude);
return wrapEnabled ? Clip(result, 0, 1) : result;
} | java | public double getX01FromLongitude(double longitude, boolean wrapEnabled) {
longitude = wrapEnabled ? Clip(longitude, getMinLongitude(), getMaxLongitude()) : longitude;
final double result = getX01FromLongitude(longitude);
return wrapEnabled ? Clip(result, 0, 1) : result;
} | [
"public",
"double",
"getX01FromLongitude",
"(",
"double",
"longitude",
",",
"boolean",
"wrapEnabled",
")",
"{",
"longitude",
"=",
"wrapEnabled",
"?",
"Clip",
"(",
"longitude",
",",
"getMinLongitude",
"(",
")",
",",
"getMaxLongitude",
"(",
")",
")",
":",
"longi... | Converts a longitude to its "X01" value,
id est a double between 0 and 1 for the whole longitude range
@since 6.0.0 | [
"Converts",
"a",
"longitude",
"to",
"its",
"X01",
"value",
"id",
"est",
"a",
"double",
"between",
"0",
"and",
"1",
"for",
"the",
"whole",
"longitude",
"range"
] | 3b178b2f078497dd88c137110e87aafe45ad2b16 | https://github.com/osmdroid/osmdroid/blob/3b178b2f078497dd88c137110e87aafe45ad2b16/osmdroid-android/src/main/java/org/osmdroid/util/TileSystem.java#L219-L223 | train |
osmdroid/osmdroid | osmdroid-android/src/main/java/org/osmdroid/util/TileSystem.java | TileSystem.getY01FromLatitude | public double getY01FromLatitude(double latitude, boolean wrapEnabled) {
latitude = wrapEnabled ? Clip(latitude, getMinLatitude(), getMaxLatitude()) : latitude;
final double result = getY01FromLatitude(latitude);
return wrapEnabled ? Clip(result, 0, 1) : result;
} | java | public double getY01FromLatitude(double latitude, boolean wrapEnabled) {
latitude = wrapEnabled ? Clip(latitude, getMinLatitude(), getMaxLatitude()) : latitude;
final double result = getY01FromLatitude(latitude);
return wrapEnabled ? Clip(result, 0, 1) : result;
} | [
"public",
"double",
"getY01FromLatitude",
"(",
"double",
"latitude",
",",
"boolean",
"wrapEnabled",
")",
"{",
"latitude",
"=",
"wrapEnabled",
"?",
"Clip",
"(",
"latitude",
",",
"getMinLatitude",
"(",
")",
",",
"getMaxLatitude",
"(",
")",
")",
":",
"latitude",
... | Converts a latitude to its "Y01" value,
id est a double between 0 and 1 for the whole latitude range
@since 6.0.0 | [
"Converts",
"a",
"latitude",
"to",
"its",
"Y01",
"value",
"id",
"est",
"a",
"double",
"between",
"0",
"and",
"1",
"for",
"the",
"whole",
"latitude",
"range"
] | 3b178b2f078497dd88c137110e87aafe45ad2b16 | https://github.com/osmdroid/osmdroid/blob/3b178b2f078497dd88c137110e87aafe45ad2b16/osmdroid-android/src/main/java/org/osmdroid/util/TileSystem.java#L230-L234 | train |
osmdroid/osmdroid | osmdroid-android/src/main/java/org/osmdroid/views/overlay/infowindow/InfoWindow.java | InfoWindow.open | public void open(Object object, GeoPoint position, int offsetX, int offsetY) {
close(); //if it was already opened
mRelatedObject = object;
mPosition = position;
mOffsetX = offsetX;
mOffsetY = offsetY;
onOpen(object);
MapView.LayoutParams lp = new MapView.LayoutPa... | java | public void open(Object object, GeoPoint position, int offsetX, int offsetY) {
close(); //if it was already opened
mRelatedObject = object;
mPosition = position;
mOffsetX = offsetX;
mOffsetY = offsetY;
onOpen(object);
MapView.LayoutParams lp = new MapView.LayoutPa... | [
"public",
"void",
"open",
"(",
"Object",
"object",
",",
"GeoPoint",
"position",
",",
"int",
"offsetX",
",",
"int",
"offsetY",
")",
"{",
"close",
"(",
")",
";",
"//if it was already opened",
"mRelatedObject",
"=",
"object",
";",
"mPosition",
"=",
"position",
... | open the InfoWindow at the specified GeoPosition + offset.
If it was already opened, close it before reopening.
@param object the graphical object on which is hooked the view
@param position to place the window on the map
@param offsetX (&offsetY) the offset of the view to the position, in pixels.
This allows to of... | [
"open",
"the",
"InfoWindow",
"at",
"the",
"specified",
"GeoPosition",
"+",
"offset",
".",
"If",
"it",
"was",
"already",
"opened",
"close",
"it",
"before",
"reopening",
"."
] | 3b178b2f078497dd88c137110e87aafe45ad2b16 | https://github.com/osmdroid/osmdroid/blob/3b178b2f078497dd88c137110e87aafe45ad2b16/osmdroid-android/src/main/java/org/osmdroid/views/overlay/infowindow/InfoWindow.java#L105-L124 | train |
osmdroid/osmdroid | osmdroid-android/src/main/java/org/osmdroid/views/overlay/infowindow/InfoWindow.java | InfoWindow.close | public void close() {
if (mIsVisible) {
mIsVisible = false;
((ViewGroup) mView.getParent()).removeView(mView);
onClose();
}
} | java | public void close() {
if (mIsVisible) {
mIsVisible = false;
((ViewGroup) mView.getParent()).removeView(mView);
onClose();
}
} | [
"public",
"void",
"close",
"(",
")",
"{",
"if",
"(",
"mIsVisible",
")",
"{",
"mIsVisible",
"=",
"false",
";",
"(",
"(",
"ViewGroup",
")",
"mView",
".",
"getParent",
"(",
")",
")",
".",
"removeView",
"(",
"mView",
")",
";",
"onClose",
"(",
")",
";",... | hides the info window, which triggers another render of the map | [
"hides",
"the",
"info",
"window",
"which",
"triggers",
"another",
"render",
"of",
"the",
"map"
] | 3b178b2f078497dd88c137110e87aafe45ad2b16 | https://github.com/osmdroid/osmdroid/blob/3b178b2f078497dd88c137110e87aafe45ad2b16/osmdroid-android/src/main/java/org/osmdroid/views/overlay/infowindow/InfoWindow.java#L151-L157 | train |
osmdroid/osmdroid | osmdroid-android/src/main/java/org/osmdroid/views/overlay/infowindow/InfoWindow.java | InfoWindow.onDetach | public void onDetach() {
close();
if (mView != null)
mView.setTag(null);
mView = null;
mMapView = null;
if (Configuration.getInstance().isDebugMode())
Log.d(IMapView.LOGTAG, "Marked detached");
} | java | public void onDetach() {
close();
if (mView != null)
mView.setTag(null);
mView = null;
mMapView = null;
if (Configuration.getInstance().isDebugMode())
Log.d(IMapView.LOGTAG, "Marked detached");
} | [
"public",
"void",
"onDetach",
"(",
")",
"{",
"close",
"(",
")",
";",
"if",
"(",
"mView",
"!=",
"null",
")",
"mView",
".",
"setTag",
"(",
"null",
")",
";",
"mView",
"=",
"null",
";",
"mMapView",
"=",
"null",
";",
"if",
"(",
"Configuration",
".",
"... | this destroys the window and all references to views | [
"this",
"destroys",
"the",
"window",
"and",
"all",
"references",
"to",
"views"
] | 3b178b2f078497dd88c137110e87aafe45ad2b16 | https://github.com/osmdroid/osmdroid/blob/3b178b2f078497dd88c137110e87aafe45ad2b16/osmdroid-android/src/main/java/org/osmdroid/views/overlay/infowindow/InfoWindow.java#L162-L170 | train |
osmdroid/osmdroid | osmdroid-android/src/main/java/org/osmdroid/views/overlay/infowindow/InfoWindow.java | InfoWindow.closeAllInfoWindowsOn | public static void closeAllInfoWindowsOn(MapView mapView) {
ArrayList<InfoWindow> opened = getOpenedInfoWindowsOn(mapView);
for (InfoWindow infoWindow : opened) {
infoWindow.close();
}
} | java | public static void closeAllInfoWindowsOn(MapView mapView) {
ArrayList<InfoWindow> opened = getOpenedInfoWindowsOn(mapView);
for (InfoWindow infoWindow : opened) {
infoWindow.close();
}
} | [
"public",
"static",
"void",
"closeAllInfoWindowsOn",
"(",
"MapView",
"mapView",
")",
"{",
"ArrayList",
"<",
"InfoWindow",
">",
"opened",
"=",
"getOpenedInfoWindowsOn",
"(",
"mapView",
")",
";",
"for",
"(",
"InfoWindow",
"infoWindow",
":",
"opened",
")",
"{",
"... | close all InfoWindows currently opened on this MapView
@param mapView | [
"close",
"all",
"InfoWindows",
"currently",
"opened",
"on",
"this",
"MapView"
] | 3b178b2f078497dd88c137110e87aafe45ad2b16 | https://github.com/osmdroid/osmdroid/blob/3b178b2f078497dd88c137110e87aafe45ad2b16/osmdroid-android/src/main/java/org/osmdroid/views/overlay/infowindow/InfoWindow.java#L181-L186 | train |
osmdroid/osmdroid | osmdroid-android/src/main/java/org/osmdroid/views/overlay/infowindow/InfoWindow.java | InfoWindow.getOpenedInfoWindowsOn | public static ArrayList<InfoWindow> getOpenedInfoWindowsOn(MapView mapView) {
int count = mapView.getChildCount();
ArrayList<InfoWindow> opened = new ArrayList<InfoWindow>(count);
for (int i = 0; i < count; i++) {
final View child = mapView.getChildAt(i);
Object tag = chi... | java | public static ArrayList<InfoWindow> getOpenedInfoWindowsOn(MapView mapView) {
int count = mapView.getChildCount();
ArrayList<InfoWindow> opened = new ArrayList<InfoWindow>(count);
for (int i = 0; i < count; i++) {
final View child = mapView.getChildAt(i);
Object tag = chi... | [
"public",
"static",
"ArrayList",
"<",
"InfoWindow",
">",
"getOpenedInfoWindowsOn",
"(",
"MapView",
"mapView",
")",
"{",
"int",
"count",
"=",
"mapView",
".",
"getChildCount",
"(",
")",
";",
"ArrayList",
"<",
"InfoWindow",
">",
"opened",
"=",
"new",
"ArrayList",... | return all InfoWindows currently opened on this MapView
@param mapView
@return | [
"return",
"all",
"InfoWindows",
"currently",
"opened",
"on",
"this",
"MapView"
] | 3b178b2f078497dd88c137110e87aafe45ad2b16 | https://github.com/osmdroid/osmdroid/blob/3b178b2f078497dd88c137110e87aafe45ad2b16/osmdroid-android/src/main/java/org/osmdroid/views/overlay/infowindow/InfoWindow.java#L194-L206 | train |
osmdroid/osmdroid | OpenStreetMapViewer/src/main/java/org/osmdroid/samplefragments/data/SampleRace.java | SampleRace.getHalfKilometerManager | private MilestoneManager getHalfKilometerManager() {
final Path arrowPath = new Path(); // a simple arrow towards the right
arrowPath.moveTo(-5, -5);
arrowPath.lineTo(5, 0);
arrowPath.lineTo(-5, 5);
arrowPath.close();
final Paint backgroundPaint = getFillPaint(COLOR_BACKG... | java | private MilestoneManager getHalfKilometerManager() {
final Path arrowPath = new Path(); // a simple arrow towards the right
arrowPath.moveTo(-5, -5);
arrowPath.lineTo(5, 0);
arrowPath.lineTo(-5, 5);
arrowPath.close();
final Paint backgroundPaint = getFillPaint(COLOR_BACKG... | [
"private",
"MilestoneManager",
"getHalfKilometerManager",
"(",
")",
"{",
"final",
"Path",
"arrowPath",
"=",
"new",
"Path",
"(",
")",
";",
"// a simple arrow towards the right",
"arrowPath",
".",
"moveTo",
"(",
"-",
"5",
",",
"-",
"5",
")",
";",
"arrowPath",
".... | Half-kilometer milestones
@since 6.0.2 | [
"Half",
"-",
"kilometer",
"milestones"
] | 3b178b2f078497dd88c137110e87aafe45ad2b16 | https://github.com/osmdroid/osmdroid/blob/3b178b2f078497dd88c137110e87aafe45ad2b16/OpenStreetMapViewer/src/main/java/org/osmdroid/samplefragments/data/SampleRace.java#L184-L204 | train |
osmdroid/osmdroid | osmdroid-geopackage/src/main/java/org/osmdroid/gpkg/overlay/OsmMapShapeConverter.java | OsmMapShapeConverter.toWgs84 | public Point toWgs84(Point point) {
if (projection != null) {
point = toWgs84.transform(point);
}
return point;
} | java | public Point toWgs84(Point point) {
if (projection != null) {
point = toWgs84.transform(point);
}
return point;
} | [
"public",
"Point",
"toWgs84",
"(",
"Point",
"point",
")",
"{",
"if",
"(",
"projection",
"!=",
"null",
")",
"{",
"point",
"=",
"toWgs84",
".",
"transform",
"(",
"point",
")",
";",
"}",
"return",
"point",
";",
"}"
] | Transform a projection point to WGS84
@param point
@return | [
"Transform",
"a",
"projection",
"point",
"to",
"WGS84"
] | 3b178b2f078497dd88c137110e87aafe45ad2b16 | https://github.com/osmdroid/osmdroid/blob/3b178b2f078497dd88c137110e87aafe45ad2b16/osmdroid-geopackage/src/main/java/org/osmdroid/gpkg/overlay/OsmMapShapeConverter.java#L161-L166 | train |
osmdroid/osmdroid | osmdroid-geopackage/src/main/java/org/osmdroid/gpkg/overlay/OsmMapShapeConverter.java | OsmMapShapeConverter.toProjection | public Point toProjection(Point point) {
if (projection != null) {
point = fromWgs84.transform(point);
}
return point;
} | java | public Point toProjection(Point point) {
if (projection != null) {
point = fromWgs84.transform(point);
}
return point;
} | [
"public",
"Point",
"toProjection",
"(",
"Point",
"point",
")",
"{",
"if",
"(",
"projection",
"!=",
"null",
")",
"{",
"point",
"=",
"fromWgs84",
".",
"transform",
"(",
"point",
")",
";",
"}",
"return",
"point",
";",
"}"
] | Transform a WGS84 point to the projection
@param point
@return | [
"Transform",
"a",
"WGS84",
"point",
"to",
"the",
"projection"
] | 3b178b2f078497dd88c137110e87aafe45ad2b16 | https://github.com/osmdroid/osmdroid/blob/3b178b2f078497dd88c137110e87aafe45ad2b16/osmdroid-geopackage/src/main/java/org/osmdroid/gpkg/overlay/OsmMapShapeConverter.java#L174-L179 | train |
osmdroid/osmdroid | osmdroid-geopackage/src/main/java/org/osmdroid/gpkg/overlay/OsmMapShapeConverter.java | OsmMapShapeConverter.addPolylineToMap | public static Polyline addPolylineToMap(MapView map,
Polyline polyline) {
if (polyline.getInfoWindow()==null)
polyline.setInfoWindow(new BasicInfoWindow(R.layout.bonuspack_bubble, map));
map.getOverlayManager().add(polyline);
return polylin... | java | public static Polyline addPolylineToMap(MapView map,
Polyline polyline) {
if (polyline.getInfoWindow()==null)
polyline.setInfoWindow(new BasicInfoWindow(R.layout.bonuspack_bubble, map));
map.getOverlayManager().add(polyline);
return polylin... | [
"public",
"static",
"Polyline",
"addPolylineToMap",
"(",
"MapView",
"map",
",",
"Polyline",
"polyline",
")",
"{",
"if",
"(",
"polyline",
".",
"getInfoWindow",
"(",
")",
"==",
"null",
")",
"polyline",
".",
"setInfoWindow",
"(",
"new",
"BasicInfoWindow",
"(",
... | Add a Polyline to the map
@param map
@param polyline
@return | [
"Add",
"a",
"Polyline",
"to",
"the",
"map"
] | 3b178b2f078497dd88c137110e87aafe45ad2b16 | https://github.com/osmdroid/osmdroid/blob/3b178b2f078497dd88c137110e87aafe45ad2b16/osmdroid-geopackage/src/main/java/org/osmdroid/gpkg/overlay/OsmMapShapeConverter.java#L706-L712 | train |
JakeWharton/DiskLruCache | src/main/java/com/jakewharton/disklrucache/DiskLruCache.java | DiskLruCache.close | public synchronized void close() throws IOException {
if (journalWriter == null) {
return; // Already closed.
}
for (Entry entry : new ArrayList<Entry>(lruEntries.values())) {
if (entry.currentEditor != null) {
entry.currentEditor.abort();
}
}
trimToSize();
journalWrite... | java | public synchronized void close() throws IOException {
if (journalWriter == null) {
return; // Already closed.
}
for (Entry entry : new ArrayList<Entry>(lruEntries.values())) {
if (entry.currentEditor != null) {
entry.currentEditor.abort();
}
}
trimToSize();
journalWrite... | [
"public",
"synchronized",
"void",
"close",
"(",
")",
"throws",
"IOException",
"{",
"if",
"(",
"journalWriter",
"==",
"null",
")",
"{",
"return",
";",
"// Already closed.",
"}",
"for",
"(",
"Entry",
"entry",
":",
"new",
"ArrayList",
"<",
"Entry",
">",
"(",
... | Closes this cache. Stored values will remain on the filesystem. | [
"Closes",
"this",
"cache",
".",
"Stored",
"values",
"will",
"remain",
"on",
"the",
"filesystem",
"."
] | 3e016356cfc7e5f9644a7a732fe0223e9742e024 | https://github.com/JakeWharton/DiskLruCache/blob/3e016356cfc7e5f9644a7a732fe0223e9742e024/src/main/java/com/jakewharton/disklrucache/DiskLruCache.java#L633-L645 | train |
alibaba/simpleimage | simpleimage.core/src/main/java/com/alibaba/simpleimage/codec/jpeg/JPEGDecoder.java | JPEGDecoder.isSOFnMarker | protected boolean isSOFnMarker(int marker) {
if (marker <= 0xC3 && marker >= 0xC0) {
return true;
}
if (marker <= 0xCB && marker >= 0xC5) {
return true;
}
if (marker <= 0xCF && marker >= 0xCD) {
return true;
}
re... | java | protected boolean isSOFnMarker(int marker) {
if (marker <= 0xC3 && marker >= 0xC0) {
return true;
}
if (marker <= 0xCB && marker >= 0xC5) {
return true;
}
if (marker <= 0xCF && marker >= 0xCD) {
return true;
}
re... | [
"protected",
"boolean",
"isSOFnMarker",
"(",
"int",
"marker",
")",
"{",
"if",
"(",
"marker",
"<=",
"0xC3",
"&&",
"marker",
">=",
"0xC0",
")",
"{",
"return",
"true",
";",
"}",
"if",
"(",
"marker",
"<=",
"0xCB",
"&&",
"marker",
">=",
"0xC5",
")",
"{",
... | can opt using array
@param marker
@return | [
"can",
"opt",
"using",
"array"
] | aabe559c267402b754c2ad606b796c4c6570788c | https://github.com/alibaba/simpleimage/blob/aabe559c267402b754c2ad606b796c4c6570788c/simpleimage.core/src/main/java/com/alibaba/simpleimage/codec/jpeg/JPEGDecoder.java#L627-L641 | train |
alibaba/simpleimage | simpleimage.core/src/main/java/com/alibaba/simpleimage/codec/jpeg/JPEGDecoder.java | JPEGDecoder.writeFull | protected void writeFull() {
byte[] imageData = rawImage.getData();
int numOfComponents = frameHeader.getNf();
int[] pixes = new int[numOfComponents * DCTSIZE2];
int blockIndex = 0;
int startCoordinate = 0, scanlineStride = numOfComponents * rawImage.getWidth(), row = 0;
... | java | protected void writeFull() {
byte[] imageData = rawImage.getData();
int numOfComponents = frameHeader.getNf();
int[] pixes = new int[numOfComponents * DCTSIZE2];
int blockIndex = 0;
int startCoordinate = 0, scanlineStride = numOfComponents * rawImage.getWidth(), row = 0;
... | [
"protected",
"void",
"writeFull",
"(",
")",
"{",
"byte",
"[",
"]",
"imageData",
"=",
"rawImage",
".",
"getData",
"(",
")",
";",
"int",
"numOfComponents",
"=",
"frameHeader",
".",
"getNf",
"(",
")",
";",
"int",
"[",
"]",
"pixes",
"=",
"new",
"int",
"[... | Used by progressive mode | [
"Used",
"by",
"progressive",
"mode"
] | aabe559c267402b754c2ad606b796c4c6570788c | https://github.com/alibaba/simpleimage/blob/aabe559c267402b754c2ad606b796c4c6570788c/simpleimage.core/src/main/java/com/alibaba/simpleimage/codec/jpeg/JPEGDecoder.java#L1101-L1163 | train |
alibaba/simpleimage | simpleimage.analyze/src/main/java/com/alibaba/simpleimage/analyze/search/tree/KMeansTreeNode.java | KMeansTreeNode.getValueId | public int getValueId(Clusterable c) {
currentItems++;
/*
* if(isLeafNode()) { return id; }
*/
int index = TreeUtils.findNearestNodeIndex(subNodes, c);
if (index >= 0) {
KMeansTreeNode node = subNodes.get(index);
return node.getValueId(c);
}
return id;
} | java | public int getValueId(Clusterable c) {
currentItems++;
/*
* if(isLeafNode()) { return id; }
*/
int index = TreeUtils.findNearestNodeIndex(subNodes, c);
if (index >= 0) {
KMeansTreeNode node = subNodes.get(index);
return node.getValueId(c);
}
return id;
} | [
"public",
"int",
"getValueId",
"(",
"Clusterable",
"c",
")",
"{",
"currentItems",
"++",
";",
"/*\r\n\t\t * if(isLeafNode()) { return id; }\r\n\t\t */",
"int",
"index",
"=",
"TreeUtils",
".",
"findNearestNodeIndex",
"(",
"subNodes",
",",
"c",
")",
";",
"if",
"(",
"... | Adds a clusterable to the current vocab tree for word creation | [
"Adds",
"a",
"clusterable",
"to",
"the",
"current",
"vocab",
"tree",
"for",
"word",
"creation"
] | aabe559c267402b754c2ad606b796c4c6570788c | https://github.com/alibaba/simpleimage/blob/aabe559c267402b754c2ad606b796c4c6570788c/simpleimage.analyze/src/main/java/com/alibaba/simpleimage/analyze/search/tree/KMeansTreeNode.java#L97-L108 | train |
alibaba/simpleimage | simpleimage.core/src/main/java/com/alibaba/simpleimage/util/NodeUtils.java | NodeUtils.cloneNode | public static Node cloneNode(Node node) {
if(node == null) {
return null;
}
IIOMetadataNode newNode = new IIOMetadataNode(node.getNodeName());
//clone user object
if(node instanceof IIOMetadataNode) {
IIOMetadataNode iioNode = (IIOMetadataNode)nod... | java | public static Node cloneNode(Node node) {
if(node == null) {
return null;
}
IIOMetadataNode newNode = new IIOMetadataNode(node.getNodeName());
//clone user object
if(node instanceof IIOMetadataNode) {
IIOMetadataNode iioNode = (IIOMetadataNode)nod... | [
"public",
"static",
"Node",
"cloneNode",
"(",
"Node",
"node",
")",
"{",
"if",
"(",
"node",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"IIOMetadataNode",
"newNode",
"=",
"new",
"IIOMetadataNode",
"(",
"node",
".",
"getNodeName",
"(",
")",
")",
... | Currently only use by GIFStreamMetadata and GIFImageMetadata
@param node
@return | [
"Currently",
"only",
"use",
"by",
"GIFStreamMetadata",
"and",
"GIFImageMetadata"
] | aabe559c267402b754c2ad606b796c4c6570788c | https://github.com/alibaba/simpleimage/blob/aabe559c267402b754c2ad606b796c4c6570788c/simpleimage.core/src/main/java/com/alibaba/simpleimage/util/NodeUtils.java#L35-L66 | train |
alibaba/simpleimage | simpleimage.analyze/src/main/java/com/alibaba/simpleimage/analyze/search/cluster/impl/AbstractClusterBuilder.java | AbstractClusterBuilder.calculateInitialClusters | protected Cluster[] calculateInitialClusters(List<? extends Clusterable> values, int numClusters){
Cluster[] clusters = new Cluster[numClusters];
//choose centers and create the initial clusters
Random random = new Random(1);
Set<Integer> clusterCenters = new HashSet<Integer>();
... | java | protected Cluster[] calculateInitialClusters(List<? extends Clusterable> values, int numClusters){
Cluster[] clusters = new Cluster[numClusters];
//choose centers and create the initial clusters
Random random = new Random(1);
Set<Integer> clusterCenters = new HashSet<Integer>();
... | [
"protected",
"Cluster",
"[",
"]",
"calculateInitialClusters",
"(",
"List",
"<",
"?",
"extends",
"Clusterable",
">",
"values",
",",
"int",
"numClusters",
")",
"{",
"Cluster",
"[",
"]",
"clusters",
"=",
"new",
"Cluster",
"[",
"numClusters",
"]",
";",
"//choose... | Calculates the initial clusters randomly, this could be replaced with a better algorithm
@param values
@param numClusters
@return | [
"Calculates",
"the",
"initial",
"clusters",
"randomly",
"this",
"could",
"be",
"replaced",
"with",
"a",
"better",
"algorithm"
] | aabe559c267402b754c2ad606b796c4c6570788c | https://github.com/alibaba/simpleimage/blob/aabe559c267402b754c2ad606b796c4c6570788c/simpleimage.analyze/src/main/java/com/alibaba/simpleimage/analyze/search/cluster/impl/AbstractClusterBuilder.java#L80-L94 | train |
alibaba/simpleimage | simpleimage.analyze/src/main/java/com/alibaba/simpleimage/analyze/search/cluster/impl/Cluster.java | Cluster.getClusterMean | public float[] getClusterMean(){
float[] normedCurrentLocation = new float[mCurrentMeanLocation.length];
for ( int i = 0; i < mCurrentMeanLocation.length; i++ ){
normedCurrentLocation[i] = mCurrentMeanLocation[i]/((float)mClusterItems.size());
}
return normedCurrentLocation;
... | java | public float[] getClusterMean(){
float[] normedCurrentLocation = new float[mCurrentMeanLocation.length];
for ( int i = 0; i < mCurrentMeanLocation.length; i++ ){
normedCurrentLocation[i] = mCurrentMeanLocation[i]/((float)mClusterItems.size());
}
return normedCurrentLocation;
... | [
"public",
"float",
"[",
"]",
"getClusterMean",
"(",
")",
"{",
"float",
"[",
"]",
"normedCurrentLocation",
"=",
"new",
"float",
"[",
"mCurrentMeanLocation",
".",
"length",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"mCurrentMeanLocation",
... | Get the current mean value of the cluster's items
@return | [
"Get",
"the",
"current",
"mean",
"value",
"of",
"the",
"cluster",
"s",
"items"
] | aabe559c267402b754c2ad606b796c4c6570788c | https://github.com/alibaba/simpleimage/blob/aabe559c267402b754c2ad606b796c4c6570788c/simpleimage.analyze/src/main/java/com/alibaba/simpleimage/analyze/search/cluster/impl/Cluster.java#L37-L43 | train |
wdullaer/MaterialDateTimePicker | library/src/main/java/com/wdullaer/materialdatetimepicker/time/RadialPickerLayout.java | RadialPickerLayout.setItem | private void setItem(int index, Timepoint time) {
time = roundToValidTime(time, index);
mCurrentTime = time;
reselectSelector(time, false, index);
} | java | private void setItem(int index, Timepoint time) {
time = roundToValidTime(time, index);
mCurrentTime = time;
reselectSelector(time, false, index);
} | [
"private",
"void",
"setItem",
"(",
"int",
"index",
",",
"Timepoint",
"time",
")",
"{",
"time",
"=",
"roundToValidTime",
"(",
"time",
",",
"index",
")",
";",
"mCurrentTime",
"=",
"time",
";",
"reselectSelector",
"(",
"time",
",",
"false",
",",
"index",
")... | Set either the hour, the minute or the second. Will set the internal value, and set the selection. | [
"Set",
"either",
"the",
"hour",
"the",
"minute",
"or",
"the",
"second",
".",
"Will",
"set",
"the",
"internal",
"value",
"and",
"set",
"the",
"selection",
"."
] | 0a8fe28f19db4f5a5a6cfc525a852416232873a8 | https://github.com/wdullaer/MaterialDateTimePicker/blob/0a8fe28f19db4f5a5a6cfc525a852416232873a8/library/src/main/java/com/wdullaer/materialdatetimepicker/time/RadialPickerLayout.java#L255-L259 | train |
wdullaer/MaterialDateTimePicker | library/src/main/java/com/wdullaer/materialdatetimepicker/time/RadialPickerLayout.java | RadialPickerLayout.isHourInnerCircle | private boolean isHourInnerCircle(int hourOfDay) {
// We'll have the 00 hours on the outside circle.
boolean isMorning = hourOfDay <= 12 && hourOfDay != 0;
// In the version 2 layout the circles are swapped
if (mController.getVersion() != TimePickerDialog.Version.VERSION_1) isMorning = !... | java | private boolean isHourInnerCircle(int hourOfDay) {
// We'll have the 00 hours on the outside circle.
boolean isMorning = hourOfDay <= 12 && hourOfDay != 0;
// In the version 2 layout the circles are swapped
if (mController.getVersion() != TimePickerDialog.Version.VERSION_1) isMorning = !... | [
"private",
"boolean",
"isHourInnerCircle",
"(",
"int",
"hourOfDay",
")",
"{",
"// We'll have the 00 hours on the outside circle.",
"boolean",
"isMorning",
"=",
"hourOfDay",
"<=",
"12",
"&&",
"hourOfDay",
"!=",
"0",
";",
"// In the version 2 layout the circles are swapped",
... | Check if a given hour appears in the outer circle or the inner circle
@return true if the hour is in the inner circle, false if it's in the outer circle. | [
"Check",
"if",
"a",
"given",
"hour",
"appears",
"in",
"the",
"outer",
"circle",
"or",
"the",
"inner",
"circle"
] | 0a8fe28f19db4f5a5a6cfc525a852416232873a8 | https://github.com/wdullaer/MaterialDateTimePicker/blob/0a8fe28f19db4f5a5a6cfc525a852416232873a8/library/src/main/java/com/wdullaer/materialdatetimepicker/time/RadialPickerLayout.java#L265-L271 | train |
wdullaer/MaterialDateTimePicker | library/src/main/java/com/wdullaer/materialdatetimepicker/time/RadialPickerLayout.java | RadialPickerLayout.getCurrentlyShowingValue | private int getCurrentlyShowingValue() {
int currentIndex = getCurrentItemShowing();
switch(currentIndex) {
case HOUR_INDEX:
return mCurrentTime.getHour();
case MINUTE_INDEX:
return mCurrentTime.getMinute();
case SECOND_INDEX:
... | java | private int getCurrentlyShowingValue() {
int currentIndex = getCurrentItemShowing();
switch(currentIndex) {
case HOUR_INDEX:
return mCurrentTime.getHour();
case MINUTE_INDEX:
return mCurrentTime.getMinute();
case SECOND_INDEX:
... | [
"private",
"int",
"getCurrentlyShowingValue",
"(",
")",
"{",
"int",
"currentIndex",
"=",
"getCurrentItemShowing",
"(",
")",
";",
"switch",
"(",
"currentIndex",
")",
"{",
"case",
"HOUR_INDEX",
":",
"return",
"mCurrentTime",
".",
"getHour",
"(",
")",
";",
"case"... | If the hours are showing, return the current hour. If the minutes are showing, return the
current minute. | [
"If",
"the",
"hours",
"are",
"showing",
"return",
"the",
"current",
"hour",
".",
"If",
"the",
"minutes",
"are",
"showing",
"return",
"the",
"current",
"minute",
"."
] | 0a8fe28f19db4f5a5a6cfc525a852416232873a8 | https://github.com/wdullaer/MaterialDateTimePicker/blob/0a8fe28f19db4f5a5a6cfc525a852416232873a8/library/src/main/java/com/wdullaer/materialdatetimepicker/time/RadialPickerLayout.java#L293-L305 | train |
wdullaer/MaterialDateTimePicker | library/src/main/java/com/wdullaer/materialdatetimepicker/time/RadialPickerLayout.java | RadialPickerLayout.roundToValidTime | private Timepoint roundToValidTime(Timepoint newSelection, int currentItemShowing) {
switch(currentItemShowing) {
case HOUR_INDEX:
return mController.roundToNearest(newSelection, null);
case MINUTE_INDEX:
return mController.roundToNearest(newSelection, Tim... | java | private Timepoint roundToValidTime(Timepoint newSelection, int currentItemShowing) {
switch(currentItemShowing) {
case HOUR_INDEX:
return mController.roundToNearest(newSelection, null);
case MINUTE_INDEX:
return mController.roundToNearest(newSelection, Tim... | [
"private",
"Timepoint",
"roundToValidTime",
"(",
"Timepoint",
"newSelection",
",",
"int",
"currentItemShowing",
")",
"{",
"switch",
"(",
"currentItemShowing",
")",
"{",
"case",
"HOUR_INDEX",
":",
"return",
"mController",
".",
"roundToNearest",
"(",
"newSelection",
"... | Snap the input to a selectable value
@param newSelection Timepoint - Time which should be rounded
@param currentItemShowing int - The index of the current view
@return Timepoint - the rounded value | [
"Snap",
"the",
"input",
"to",
"a",
"selectable",
"value"
] | 0a8fe28f19db4f5a5a6cfc525a852416232873a8 | https://github.com/wdullaer/MaterialDateTimePicker/blob/0a8fe28f19db4f5a5a6cfc525a852416232873a8/library/src/main/java/com/wdullaer/materialdatetimepicker/time/RadialPickerLayout.java#L438-L447 | train |
wdullaer/MaterialDateTimePicker | library/src/main/java/com/wdullaer/materialdatetimepicker/time/RadialPickerLayout.java | RadialPickerLayout.trySettingInputEnabled | public boolean trySettingInputEnabled(boolean inputEnabled) {
if (mDoingTouch && !inputEnabled) {
// If we're trying to disable input, but we're in the middle of a touch event,
// we'll allow the touch event to continue before disabling input.
return false;
}
... | java | public boolean trySettingInputEnabled(boolean inputEnabled) {
if (mDoingTouch && !inputEnabled) {
// If we're trying to disable input, but we're in the middle of a touch event,
// we'll allow the touch event to continue before disabling input.
return false;
}
... | [
"public",
"boolean",
"trySettingInputEnabled",
"(",
"boolean",
"inputEnabled",
")",
"{",
"if",
"(",
"mDoingTouch",
"&&",
"!",
"inputEnabled",
")",
"{",
"// If we're trying to disable input, but we're in the middle of a touch event,",
"// we'll allow the touch event to continue befo... | Set touch input as enabled or disabled, for use with keyboard mode. | [
"Set",
"touch",
"input",
"as",
"enabled",
"or",
"disabled",
"for",
"use",
"with",
"keyboard",
"mode",
"."
] | 0a8fe28f19db4f5a5a6cfc525a852416232873a8 | https://github.com/wdullaer/MaterialDateTimePicker/blob/0a8fe28f19db4f5a5a6cfc525a852416232873a8/library/src/main/java/com/wdullaer/materialdatetimepicker/time/RadialPickerLayout.java#L878-L888 | train |
wdullaer/MaterialDateTimePicker | library/src/main/java/com/wdullaer/materialdatetimepicker/Utils.java | Utils.getPulseAnimator | public static ObjectAnimator getPulseAnimator(View labelToAnimate, float decreaseRatio,
float increaseRatio) {
Keyframe k0 = Keyframe.ofFloat(0f, 1f);
Keyframe k1 = Keyframe.ofFloat(0.275f, decreaseRatio);
Keyframe k2 = Keyframe.ofFloat(0.69f, increaseRatio);
Keyframe k3 = Ke... | java | public static ObjectAnimator getPulseAnimator(View labelToAnimate, float decreaseRatio,
float increaseRatio) {
Keyframe k0 = Keyframe.ofFloat(0f, 1f);
Keyframe k1 = Keyframe.ofFloat(0.275f, decreaseRatio);
Keyframe k2 = Keyframe.ofFloat(0.69f, increaseRatio);
Keyframe k3 = Ke... | [
"public",
"static",
"ObjectAnimator",
"getPulseAnimator",
"(",
"View",
"labelToAnimate",
",",
"float",
"decreaseRatio",
",",
"float",
"increaseRatio",
")",
"{",
"Keyframe",
"k0",
"=",
"Keyframe",
".",
"ofFloat",
"(",
"0f",
",",
"1f",
")",
";",
"Keyframe",
"k1"... | Render an animator to pulsate a view in place.
@param labelToAnimate the view to pulsate.
@return The animator object. Use .start() to begin. | [
"Render",
"an",
"animator",
"to",
"pulsate",
"a",
"view",
"in",
"place",
"."
] | 0a8fe28f19db4f5a5a6cfc525a852416232873a8 | https://github.com/wdullaer/MaterialDateTimePicker/blob/0a8fe28f19db4f5a5a6cfc525a852416232873a8/library/src/main/java/com/wdullaer/materialdatetimepicker/Utils.java#L64-L78 | train |
wdullaer/MaterialDateTimePicker | library/src/main/java/com/wdullaer/materialdatetimepicker/Utils.java | Utils.trimToMidnight | public static Calendar trimToMidnight(Calendar calendar) {
calendar.set(Calendar.HOUR_OF_DAY, 0);
calendar.set(Calendar.MINUTE, 0);
calendar.set(Calendar.SECOND, 0);
calendar.set(Calendar.MILLISECOND, 0);
return calendar;
} | java | public static Calendar trimToMidnight(Calendar calendar) {
calendar.set(Calendar.HOUR_OF_DAY, 0);
calendar.set(Calendar.MINUTE, 0);
calendar.set(Calendar.SECOND, 0);
calendar.set(Calendar.MILLISECOND, 0);
return calendar;
} | [
"public",
"static",
"Calendar",
"trimToMidnight",
"(",
"Calendar",
"calendar",
")",
"{",
"calendar",
".",
"set",
"(",
"Calendar",
".",
"HOUR_OF_DAY",
",",
"0",
")",
";",
"calendar",
".",
"set",
"(",
"Calendar",
".",
"MINUTE",
",",
"0",
")",
";",
"calenda... | Trims off all time information, effectively setting it to midnight
Makes it easier to compare at just the day level
@param calendar The Calendar object to trim
@return The trimmed Calendar object | [
"Trims",
"off",
"all",
"time",
"information",
"effectively",
"setting",
"it",
"to",
"midnight",
"Makes",
"it",
"easier",
"to",
"compare",
"at",
"just",
"the",
"day",
"level"
] | 0a8fe28f19db4f5a5a6cfc525a852416232873a8 | https://github.com/wdullaer/MaterialDateTimePicker/blob/0a8fe28f19db4f5a5a6cfc525a852416232873a8/library/src/main/java/com/wdullaer/materialdatetimepicker/Utils.java#L150-L156 | train |
wdullaer/MaterialDateTimePicker | library/src/main/java/com/wdullaer/materialdatetimepicker/date/DatePickerDialog.java | DatePickerDialog.newInstance | @SuppressWarnings("unused")
public static DatePickerDialog newInstance(OnDateSetListener callback) {
Calendar now = Calendar.getInstance();
return DatePickerDialog.newInstance(callback, now);
} | java | @SuppressWarnings("unused")
public static DatePickerDialog newInstance(OnDateSetListener callback) {
Calendar now = Calendar.getInstance();
return DatePickerDialog.newInstance(callback, now);
} | [
"@",
"SuppressWarnings",
"(",
"\"unused\"",
")",
"public",
"static",
"DatePickerDialog",
"newInstance",
"(",
"OnDateSetListener",
"callback",
")",
"{",
"Calendar",
"now",
"=",
"Calendar",
".",
"getInstance",
"(",
")",
";",
"return",
"DatePickerDialog",
".",
"newIn... | Create a new DatePickerDialog instance initialised to the current system date.
@param callback How the parent is notified that the date is set.
@return a new DatePickerDialog instance | [
"Create",
"a",
"new",
"DatePickerDialog",
"instance",
"initialised",
"to",
"the",
"current",
"system",
"date",
"."
] | 0a8fe28f19db4f5a5a6cfc525a852416232873a8 | https://github.com/wdullaer/MaterialDateTimePicker/blob/0a8fe28f19db4f5a5a6cfc525a852416232873a8/library/src/main/java/com/wdullaer/materialdatetimepicker/date/DatePickerDialog.java#L214-L218 | train |
wdullaer/MaterialDateTimePicker | library/src/main/java/com/wdullaer/materialdatetimepicker/date/DatePickerDialog.java | DatePickerDialog.setHighlightedDays | @SuppressWarnings("unused")
public void setHighlightedDays(Calendar[] highlightedDays) {
for (Calendar highlightedDay : highlightedDays) {
this.highlightedDays.add(Utils.trimToMidnight((Calendar) highlightedDay.clone()));
}
if (mDayPickerView != null) mDayPickerView.onChange();
... | java | @SuppressWarnings("unused")
public void setHighlightedDays(Calendar[] highlightedDays) {
for (Calendar highlightedDay : highlightedDays) {
this.highlightedDays.add(Utils.trimToMidnight((Calendar) highlightedDay.clone()));
}
if (mDayPickerView != null) mDayPickerView.onChange();
... | [
"@",
"SuppressWarnings",
"(",
"\"unused\"",
")",
"public",
"void",
"setHighlightedDays",
"(",
"Calendar",
"[",
"]",
"highlightedDays",
")",
"{",
"for",
"(",
"Calendar",
"highlightedDay",
":",
"highlightedDays",
")",
"{",
"this",
".",
"highlightedDays",
".",
"add... | Sets an array of dates which should be highlighted when the picker is drawn
@param highlightedDays an Array of Calendar objects containing the dates to be highlighted | [
"Sets",
"an",
"array",
"of",
"dates",
"which",
"should",
"be",
"highlighted",
"when",
"the",
"picker",
"is",
"drawn"
] | 0a8fe28f19db4f5a5a6cfc525a852416232873a8 | https://github.com/wdullaer/MaterialDateTimePicker/blob/0a8fe28f19db4f5a5a6cfc525a852416232873a8/library/src/main/java/com/wdullaer/materialdatetimepicker/date/DatePickerDialog.java#L814-L820 | train |
wdullaer/MaterialDateTimePicker | library/src/main/java/com/wdullaer/materialdatetimepicker/date/DatePickerDialog.java | DatePickerDialog.setTimeZone | @SuppressWarnings("DeprecatedIsStillUsed")
@Deprecated
public void setTimeZone(TimeZone timeZone) {
mTimezone = timeZone;
mCalendar.setTimeZone(timeZone);
YEAR_FORMAT.setTimeZone(timeZone);
MONTH_FORMAT.setTimeZone(timeZone);
DAY_FORMAT.setTimeZone(timeZone);
} | java | @SuppressWarnings("DeprecatedIsStillUsed")
@Deprecated
public void setTimeZone(TimeZone timeZone) {
mTimezone = timeZone;
mCalendar.setTimeZone(timeZone);
YEAR_FORMAT.setTimeZone(timeZone);
MONTH_FORMAT.setTimeZone(timeZone);
DAY_FORMAT.setTimeZone(timeZone);
} | [
"@",
"SuppressWarnings",
"(",
"\"DeprecatedIsStillUsed\"",
")",
"@",
"Deprecated",
"public",
"void",
"setTimeZone",
"(",
"TimeZone",
"timeZone",
")",
"{",
"mTimezone",
"=",
"timeZone",
";",
"mCalendar",
".",
"setTimeZone",
"(",
"timeZone",
")",
";",
"YEAR_FORMAT",... | Set which timezone the picker should use
This has been deprecated in favor of setting the TimeZone using the constructor that
takes a Calendar object
@param timeZone The timezone to use | [
"Set",
"which",
"timezone",
"the",
"picker",
"should",
"use"
] | 0a8fe28f19db4f5a5a6cfc525a852416232873a8 | https://github.com/wdullaer/MaterialDateTimePicker/blob/0a8fe28f19db4f5a5a6cfc525a852416232873a8/library/src/main/java/com/wdullaer/materialdatetimepicker/date/DatePickerDialog.java#L984-L992 | train |
wdullaer/MaterialDateTimePicker | library/src/main/java/com/wdullaer/materialdatetimepicker/date/DatePickerDialog.java | DatePickerDialog.setLocale | public void setLocale(Locale locale) {
mLocale = locale;
mWeekStart = Calendar.getInstance(mTimezone, mLocale).getFirstDayOfWeek();
YEAR_FORMAT = new SimpleDateFormat("yyyy", locale);
MONTH_FORMAT = new SimpleDateFormat("MMM", locale);
DAY_FORMAT = new SimpleDateFormat("dd", loca... | java | public void setLocale(Locale locale) {
mLocale = locale;
mWeekStart = Calendar.getInstance(mTimezone, mLocale).getFirstDayOfWeek();
YEAR_FORMAT = new SimpleDateFormat("yyyy", locale);
MONTH_FORMAT = new SimpleDateFormat("MMM", locale);
DAY_FORMAT = new SimpleDateFormat("dd", loca... | [
"public",
"void",
"setLocale",
"(",
"Locale",
"locale",
")",
"{",
"mLocale",
"=",
"locale",
";",
"mWeekStart",
"=",
"Calendar",
".",
"getInstance",
"(",
"mTimezone",
",",
"mLocale",
")",
".",
"getFirstDayOfWeek",
"(",
")",
";",
"YEAR_FORMAT",
"=",
"new",
"... | Set a custom locale to be used when generating various strings in the picker
@param locale Locale | [
"Set",
"a",
"custom",
"locale",
"to",
"be",
"used",
"when",
"generating",
"various",
"strings",
"in",
"the",
"picker"
] | 0a8fe28f19db4f5a5a6cfc525a852416232873a8 | https://github.com/wdullaer/MaterialDateTimePicker/blob/0a8fe28f19db4f5a5a6cfc525a852416232873a8/library/src/main/java/com/wdullaer/materialdatetimepicker/date/DatePickerDialog.java#L998-L1004 | train |
wdullaer/MaterialDateTimePicker | library/src/main/java/com/wdullaer/materialdatetimepicker/HapticFeedbackController.java | HapticFeedbackController.start | public void start() {
if (hasVibratePermission(mContext)) {
mVibrator = (Vibrator) mContext.getSystemService(Service.VIBRATOR_SERVICE);
}
// Setup a listener for changes in haptic feedback settings
mIsGloballyEnabled = checkGlobalSetting(mContext);
Uri uri = Settings... | java | public void start() {
if (hasVibratePermission(mContext)) {
mVibrator = (Vibrator) mContext.getSystemService(Service.VIBRATOR_SERVICE);
}
// Setup a listener for changes in haptic feedback settings
mIsGloballyEnabled = checkGlobalSetting(mContext);
Uri uri = Settings... | [
"public",
"void",
"start",
"(",
")",
"{",
"if",
"(",
"hasVibratePermission",
"(",
"mContext",
")",
")",
"{",
"mVibrator",
"=",
"(",
"Vibrator",
")",
"mContext",
".",
"getSystemService",
"(",
"Service",
".",
"VIBRATOR_SERVICE",
")",
";",
"}",
"// Setup a list... | Call to setup the controller. | [
"Call",
"to",
"setup",
"the",
"controller",
"."
] | 0a8fe28f19db4f5a5a6cfc525a852416232873a8 | https://github.com/wdullaer/MaterialDateTimePicker/blob/0a8fe28f19db4f5a5a6cfc525a852416232873a8/library/src/main/java/com/wdullaer/materialdatetimepicker/HapticFeedbackController.java#L44-L53 | train |
wdullaer/MaterialDateTimePicker | library/src/main/java/com/wdullaer/materialdatetimepicker/HapticFeedbackController.java | HapticFeedbackController.hasVibratePermission | private boolean hasVibratePermission(Context context) {
PackageManager pm = context.getPackageManager();
int hasPerm = pm.checkPermission(android.Manifest.permission.VIBRATE, context.getPackageName());
return hasPerm == PackageManager.PERMISSION_GRANTED;
} | java | private boolean hasVibratePermission(Context context) {
PackageManager pm = context.getPackageManager();
int hasPerm = pm.checkPermission(android.Manifest.permission.VIBRATE, context.getPackageName());
return hasPerm == PackageManager.PERMISSION_GRANTED;
} | [
"private",
"boolean",
"hasVibratePermission",
"(",
"Context",
"context",
")",
"{",
"PackageManager",
"pm",
"=",
"context",
".",
"getPackageManager",
"(",
")",
";",
"int",
"hasPerm",
"=",
"pm",
".",
"checkPermission",
"(",
"android",
".",
"Manifest",
".",
"perm... | Method to verify that vibrate permission has been granted.
Allows users of the library to disabled vibrate support if desired.
@return true if Vibrate permission has been granted | [
"Method",
"to",
"verify",
"that",
"vibrate",
"permission",
"has",
"been",
"granted",
"."
] | 0a8fe28f19db4f5a5a6cfc525a852416232873a8 | https://github.com/wdullaer/MaterialDateTimePicker/blob/0a8fe28f19db4f5a5a6cfc525a852416232873a8/library/src/main/java/com/wdullaer/materialdatetimepicker/HapticFeedbackController.java#L61-L65 | train |
wdullaer/MaterialDateTimePicker | library/src/main/java/com/wdullaer/materialdatetimepicker/time/TimePickerDialog.java | TimePickerDialog.newInstance | @SuppressWarnings("SameParameterValue")
public static TimePickerDialog newInstance(OnTimeSetListener callback,
int hourOfDay, int minute, int second, boolean is24HourMode) {
TimePickerDialog ret = new TimePickerDialog();
ret.initialize(callback, hourOfDay, minute, second, is24HourMode);
... | java | @SuppressWarnings("SameParameterValue")
public static TimePickerDialog newInstance(OnTimeSetListener callback,
int hourOfDay, int minute, int second, boolean is24HourMode) {
TimePickerDialog ret = new TimePickerDialog();
ret.initialize(callback, hourOfDay, minute, second, is24HourMode);
... | [
"@",
"SuppressWarnings",
"(",
"\"SameParameterValue\"",
")",
"public",
"static",
"TimePickerDialog",
"newInstance",
"(",
"OnTimeSetListener",
"callback",
",",
"int",
"hourOfDay",
",",
"int",
"minute",
",",
"int",
"second",
",",
"boolean",
"is24HourMode",
")",
"{",
... | Create a new TimePickerDialog instance with a given intial selection
@param callback How the parent is notified that the time is set.
@param hourOfDay The initial hour of the dialog.
@param minute The initial minute of the dialog.
@param second The initial second of the dialog.
@param is24HourMode Tr... | [
"Create",
"a",
"new",
"TimePickerDialog",
"instance",
"with",
"a",
"given",
"intial",
"selection"
] | 0a8fe28f19db4f5a5a6cfc525a852416232873a8 | https://github.com/wdullaer/MaterialDateTimePicker/blob/0a8fe28f19db4f5a5a6cfc525a852416232873a8/library/src/main/java/com/wdullaer/materialdatetimepicker/time/TimePickerDialog.java#L197-L203 | train |
wdullaer/MaterialDateTimePicker | library/src/main/java/com/wdullaer/materialdatetimepicker/time/TimePickerDialog.java | TimePickerDialog.newInstance | public static TimePickerDialog newInstance(OnTimeSetListener callback,
int hourOfDay, int minute, boolean is24HourMode) {
return TimePickerDialog.newInstance(callback, hourOfDay, minute, 0, is24HourMode);
} | java | public static TimePickerDialog newInstance(OnTimeSetListener callback,
int hourOfDay, int minute, boolean is24HourMode) {
return TimePickerDialog.newInstance(callback, hourOfDay, minute, 0, is24HourMode);
} | [
"public",
"static",
"TimePickerDialog",
"newInstance",
"(",
"OnTimeSetListener",
"callback",
",",
"int",
"hourOfDay",
",",
"int",
"minute",
",",
"boolean",
"is24HourMode",
")",
"{",
"return",
"TimePickerDialog",
".",
"newInstance",
"(",
"callback",
",",
"hourOfDay",... | Create a new TimePickerDialog instance with a given initial selection
@param callback How the parent is notified that the time is set.
@param hourOfDay The initial hour of the dialog.
@param minute The initial minute of the dialog.
@param is24HourMode True to render 24 hour mode, false to render AM / PM se... | [
"Create",
"a",
"new",
"TimePickerDialog",
"instance",
"with",
"a",
"given",
"initial",
"selection"
] | 0a8fe28f19db4f5a5a6cfc525a852416232873a8 | https://github.com/wdullaer/MaterialDateTimePicker/blob/0a8fe28f19db4f5a5a6cfc525a852416232873a8/library/src/main/java/com/wdullaer/materialdatetimepicker/time/TimePickerDialog.java#L213-L216 | train |
wdullaer/MaterialDateTimePicker | library/src/main/java/com/wdullaer/materialdatetimepicker/time/TimePickerDialog.java | TimePickerDialog.newInstance | @SuppressWarnings({"unused", "SameParameterValue"})
public static TimePickerDialog newInstance(OnTimeSetListener callback, boolean is24HourMode) {
Calendar now = Calendar.getInstance();
return TimePickerDialog.newInstance(callback, now.get(Calendar.HOUR_OF_DAY), now.get(Calendar.MINUTE), is24HourMod... | java | @SuppressWarnings({"unused", "SameParameterValue"})
public static TimePickerDialog newInstance(OnTimeSetListener callback, boolean is24HourMode) {
Calendar now = Calendar.getInstance();
return TimePickerDialog.newInstance(callback, now.get(Calendar.HOUR_OF_DAY), now.get(Calendar.MINUTE), is24HourMod... | [
"@",
"SuppressWarnings",
"(",
"{",
"\"unused\"",
",",
"\"SameParameterValue\"",
"}",
")",
"public",
"static",
"TimePickerDialog",
"newInstance",
"(",
"OnTimeSetListener",
"callback",
",",
"boolean",
"is24HourMode",
")",
"{",
"Calendar",
"now",
"=",
"Calendar",
".",
... | Create a new TimePickerDialog instance initialized to the current system time
@param callback How the parent is notified that the time is set.
@param is24HourMode True to render 24 hour mode, false to render AM / PM selectors.
@return a new TimePickerDialog instance. | [
"Create",
"a",
"new",
"TimePickerDialog",
"instance",
"initialized",
"to",
"the",
"current",
"system",
"time"
] | 0a8fe28f19db4f5a5a6cfc525a852416232873a8 | https://github.com/wdullaer/MaterialDateTimePicker/blob/0a8fe28f19db4f5a5a6cfc525a852416232873a8/library/src/main/java/com/wdullaer/materialdatetimepicker/time/TimePickerDialog.java#L224-L228 | train |
wdullaer/MaterialDateTimePicker | library/src/main/java/com/wdullaer/materialdatetimepicker/time/TimePickerDialog.java | TimePickerDialog.processKeyUp | private boolean processKeyUp(int keyCode) {
if (keyCode == KeyEvent.KEYCODE_TAB) {
if(mInKbMode) {
if (isTypedTimeFullyLegal()) {
finishKbMode(true);
}
return true;
}
} else if (keyCode == KeyEvent.KEYCODE_ENTER)... | java | private boolean processKeyUp(int keyCode) {
if (keyCode == KeyEvent.KEYCODE_TAB) {
if(mInKbMode) {
if (isTypedTimeFullyLegal()) {
finishKbMode(true);
}
return true;
}
} else if (keyCode == KeyEvent.KEYCODE_ENTER)... | [
"private",
"boolean",
"processKeyUp",
"(",
"int",
"keyCode",
")",
"{",
"if",
"(",
"keyCode",
"==",
"KeyEvent",
".",
"KEYCODE_TAB",
")",
"{",
"if",
"(",
"mInKbMode",
")",
"{",
"if",
"(",
"isTypedTimeFullyLegal",
"(",
")",
")",
"{",
"finishKbMode",
"(",
"t... | For keyboard mode, processes key events.
@param keyCode the pressed key.
@return true if the key was successfully processed, false otherwise. | [
"For",
"keyboard",
"mode",
"processes",
"key",
"events",
"."
] | 0a8fe28f19db4f5a5a6cfc525a852416232873a8 | https://github.com/wdullaer/MaterialDateTimePicker/blob/0a8fe28f19db4f5a5a6cfc525a852416232873a8/library/src/main/java/com/wdullaer/materialdatetimepicker/time/TimePickerDialog.java#L1287-L1349 | train |
wdullaer/MaterialDateTimePicker | library/src/main/java/com/wdullaer/materialdatetimepicker/date/MonthView.java | MonthView.setMonthParams | public void setMonthParams(int selectedDay, int year, int month, int weekStart) {
if (month == -1 && year == -1) {
throw new InvalidParameterException("You must specify month and year for this view");
}
mSelectedDay = selectedDay;
// Allocate space for caching the day numbe... | java | public void setMonthParams(int selectedDay, int year, int month, int weekStart) {
if (month == -1 && year == -1) {
throw new InvalidParameterException("You must specify month and year for this view");
}
mSelectedDay = selectedDay;
// Allocate space for caching the day numbe... | [
"public",
"void",
"setMonthParams",
"(",
"int",
"selectedDay",
",",
"int",
"year",
",",
"int",
"month",
",",
"int",
"weekStart",
")",
"{",
"if",
"(",
"month",
"==",
"-",
"1",
"&&",
"year",
"==",
"-",
"1",
")",
"{",
"throw",
"new",
"InvalidParameterExce... | Sets all the parameters for displaying this week. The only required
parameter is the week number. Other parameters have a default value and
will only update if a new value is included, except for focus month,
which will always default to no focus month if no value is passed in. | [
"Sets",
"all",
"the",
"parameters",
"for",
"displaying",
"this",
"week",
".",
"The",
"only",
"required",
"parameter",
"is",
"the",
"week",
"number",
".",
"Other",
"parameters",
"have",
"a",
"default",
"value",
"and",
"will",
"only",
"update",
"if",
"a",
"n... | 0a8fe28f19db4f5a5a6cfc525a852416232873a8 | https://github.com/wdullaer/MaterialDateTimePicker/blob/0a8fe28f19db4f5a5a6cfc525a852416232873a8/library/src/main/java/com/wdullaer/materialdatetimepicker/date/MonthView.java#L291-L332 | train |
wdullaer/MaterialDateTimePicker | library/src/main/java/com/wdullaer/materialdatetimepicker/date/MonthView.java | MonthView.getDayFromLocation | public int getDayFromLocation(float x, float y) {
final int day = getInternalDayFromLocation(x, y);
if (day < 1 || day > mNumCells) {
return -1;
}
return day;
} | java | public int getDayFromLocation(float x, float y) {
final int day = getInternalDayFromLocation(x, y);
if (day < 1 || day > mNumCells) {
return -1;
}
return day;
} | [
"public",
"int",
"getDayFromLocation",
"(",
"float",
"x",
",",
"float",
"y",
")",
"{",
"final",
"int",
"day",
"=",
"getInternalDayFromLocation",
"(",
"x",
",",
"y",
")",
";",
"if",
"(",
"day",
"<",
"1",
"||",
"day",
">",
"mNumCells",
")",
"{",
"retur... | Calculates the day that the given x position is in, accounting for week
number. Returns the day or -1 if the position wasn't in a day.
@param x The x position of the touch event
@return The day number, or -1 if the position wasn't in a day | [
"Calculates",
"the",
"day",
"that",
"the",
"given",
"x",
"position",
"is",
"in",
"accounting",
"for",
"week",
"number",
".",
"Returns",
"the",
"day",
"or",
"-",
"1",
"if",
"the",
"position",
"wasn",
"t",
"in",
"a",
"day",
"."
] | 0a8fe28f19db4f5a5a6cfc525a852416232873a8 | https://github.com/wdullaer/MaterialDateTimePicker/blob/0a8fe28f19db4f5a5a6cfc525a852416232873a8/library/src/main/java/com/wdullaer/materialdatetimepicker/date/MonthView.java#L503-L509 | train |
wdullaer/MaterialDateTimePicker | library/src/main/java/com/wdullaer/materialdatetimepicker/date/MonthView.java | MonthView.getInternalDayFromLocation | protected int getInternalDayFromLocation(float x, float y) {
int dayStart = mEdgePadding;
if (x < dayStart || x > mWidth - mEdgePadding) {
return -1;
}
// Selection is (x - start) / (pixels/day) == (x -s) * day / pixels
int row = (int) (y - getMonthHeaderSize()) / mRo... | java | protected int getInternalDayFromLocation(float x, float y) {
int dayStart = mEdgePadding;
if (x < dayStart || x > mWidth - mEdgePadding) {
return -1;
}
// Selection is (x - start) / (pixels/day) == (x -s) * day / pixels
int row = (int) (y - getMonthHeaderSize()) / mRo... | [
"protected",
"int",
"getInternalDayFromLocation",
"(",
"float",
"x",
",",
"float",
"y",
")",
"{",
"int",
"dayStart",
"=",
"mEdgePadding",
";",
"if",
"(",
"x",
"<",
"dayStart",
"||",
"x",
">",
"mWidth",
"-",
"mEdgePadding",
")",
"{",
"return",
"-",
"1",
... | Calculates the day that the given x position is in, accounting for week
number.
@param x The x position of the touch event
@return The day number | [
"Calculates",
"the",
"day",
"that",
"the",
"given",
"x",
"position",
"is",
"in",
"accounting",
"for",
"week",
"number",
"."
] | 0a8fe28f19db4f5a5a6cfc525a852416232873a8 | https://github.com/wdullaer/MaterialDateTimePicker/blob/0a8fe28f19db4f5a5a6cfc525a852416232873a8/library/src/main/java/com/wdullaer/materialdatetimepicker/date/MonthView.java#L518-L530 | train |
wdullaer/MaterialDateTimePicker | library/src/main/java/com/wdullaer/materialdatetimepicker/date/MonthView.java | MonthView.getWeekDayLabel | private String getWeekDayLabel(Calendar day) {
Locale locale = mController.getLocale();
// Localised short version of the string is not available on API < 18
if (Build.VERSION.SDK_INT < 18) {
String dayName = new SimpleDateFormat("E", locale).format(day.getTime());
Strin... | java | private String getWeekDayLabel(Calendar day) {
Locale locale = mController.getLocale();
// Localised short version of the string is not available on API < 18
if (Build.VERSION.SDK_INT < 18) {
String dayName = new SimpleDateFormat("E", locale).format(day.getTime());
Strin... | [
"private",
"String",
"getWeekDayLabel",
"(",
"Calendar",
"day",
")",
"{",
"Locale",
"locale",
"=",
"mController",
".",
"getLocale",
"(",
")",
";",
"// Localised short version of the string is not available on API < 18",
"if",
"(",
"Build",
".",
"VERSION",
".",
"SDK_IN... | Return a 1 or 2 letter String for use as a weekday label
@param day The day for which to generate a label
@return The weekday label | [
"Return",
"a",
"1",
"or",
"2",
"letter",
"String",
"for",
"use",
"as",
"a",
"weekday",
"label"
] | 0a8fe28f19db4f5a5a6cfc525a852416232873a8 | https://github.com/wdullaer/MaterialDateTimePicker/blob/0a8fe28f19db4f5a5a6cfc525a852416232873a8/library/src/main/java/com/wdullaer/materialdatetimepicker/date/MonthView.java#L571-L612 | train |
wdullaer/MaterialDateTimePicker | library/src/main/java/com/wdullaer/materialdatetimepicker/time/RadialTextsView.java | RadialTextsView.calculateGridSizes | private void calculateGridSizes(float numbersRadius, float xCenter, float yCenter,
float textSize, float[] textGridHeights, float[] textGridWidths) {
/*
* The numbers need to be drawn in a 7x7 grid, representing the points on the Unit Circle.
*/
float offset1 = numbersRadiu... | java | private void calculateGridSizes(float numbersRadius, float xCenter, float yCenter,
float textSize, float[] textGridHeights, float[] textGridWidths) {
/*
* The numbers need to be drawn in a 7x7 grid, representing the points on the Unit Circle.
*/
float offset1 = numbersRadiu... | [
"private",
"void",
"calculateGridSizes",
"(",
"float",
"numbersRadius",
",",
"float",
"xCenter",
",",
"float",
"yCenter",
",",
"float",
"textSize",
",",
"float",
"[",
"]",
"textGridHeights",
",",
"float",
"[",
"]",
"textGridWidths",
")",
"{",
"/*\n * The... | Using the trigonometric Unit Circle, calculate the positions that the text will need to be
drawn at based on the specified circle radius. Place the values in the textGridHeights and
textGridWidths parameters. | [
"Using",
"the",
"trigonometric",
"Unit",
"Circle",
"calculate",
"the",
"positions",
"that",
"the",
"text",
"will",
"need",
"to",
"be",
"drawn",
"at",
"based",
"on",
"the",
"specified",
"circle",
"radius",
".",
"Place",
"the",
"values",
"in",
"the",
"textGrid... | 0a8fe28f19db4f5a5a6cfc525a852416232873a8 | https://github.com/wdullaer/MaterialDateTimePicker/blob/0a8fe28f19db4f5a5a6cfc525a852416232873a8/library/src/main/java/com/wdullaer/materialdatetimepicker/time/RadialTextsView.java#L265-L295 | train |
wdullaer/MaterialDateTimePicker | library/src/main/java/com/wdullaer/materialdatetimepicker/time/RadialTextsView.java | RadialTextsView.drawTexts | private void drawTexts(Canvas canvas, float textSize, Typeface typeface, String[] texts,
float[] textGridWidths, float[] textGridHeights) {
mPaint.setTextSize(textSize);
mPaint.setTypeface(typeface);
Paint[] textPaints = assignTextColors(texts);
canvas.drawText(texts[0], text... | java | private void drawTexts(Canvas canvas, float textSize, Typeface typeface, String[] texts,
float[] textGridWidths, float[] textGridHeights) {
mPaint.setTextSize(textSize);
mPaint.setTypeface(typeface);
Paint[] textPaints = assignTextColors(texts);
canvas.drawText(texts[0], text... | [
"private",
"void",
"drawTexts",
"(",
"Canvas",
"canvas",
",",
"float",
"textSize",
",",
"Typeface",
"typeface",
",",
"String",
"[",
"]",
"texts",
",",
"float",
"[",
"]",
"textGridWidths",
",",
"float",
"[",
"]",
"textGridHeights",
")",
"{",
"mPaint",
".",
... | Draw the 12 text values at the positions specified by the textGrid parameters. | [
"Draw",
"the",
"12",
"text",
"values",
"at",
"the",
"positions",
"specified",
"by",
"the",
"textGrid",
"parameters",
"."
] | 0a8fe28f19db4f5a5a6cfc525a852416232873a8 | https://github.com/wdullaer/MaterialDateTimePicker/blob/0a8fe28f19db4f5a5a6cfc525a852416232873a8/library/src/main/java/com/wdullaer/materialdatetimepicker/time/RadialTextsView.java#L311-L328 | train |
wdullaer/MaterialDateTimePicker | library/src/main/java/com/wdullaer/materialdatetimepicker/time/RadialSelectorView.java | RadialSelectorView.setSelection | public void setSelection(int selectionDegrees, boolean isInnerCircle, boolean forceDrawDot) {
mSelectionDegrees = selectionDegrees;
mSelectionRadians = selectionDegrees * Math.PI / 180;
mForceDrawDot = forceDrawDot;
if (mHasInnerCircle) {
if (isInnerCircle) {
... | java | public void setSelection(int selectionDegrees, boolean isInnerCircle, boolean forceDrawDot) {
mSelectionDegrees = selectionDegrees;
mSelectionRadians = selectionDegrees * Math.PI / 180;
mForceDrawDot = forceDrawDot;
if (mHasInnerCircle) {
if (isInnerCircle) {
... | [
"public",
"void",
"setSelection",
"(",
"int",
"selectionDegrees",
",",
"boolean",
"isInnerCircle",
",",
"boolean",
"forceDrawDot",
")",
"{",
"mSelectionDegrees",
"=",
"selectionDegrees",
";",
"mSelectionRadians",
"=",
"selectionDegrees",
"*",
"Math",
".",
"PI",
"/",... | Set the selection.
@param selectionDegrees The degrees to be selected.
@param isInnerCircle Whether the selection should be in the inner circle or outer. Will be
ignored if hasInnerCircle was initialized to false.
@param forceDrawDot Whether to force the dot in the center of the selection circle to be
drawn. If false, ... | [
"Set",
"the",
"selection",
"."
] | 0a8fe28f19db4f5a5a6cfc525a852416232873a8 | https://github.com/wdullaer/MaterialDateTimePicker/blob/0a8fe28f19db4f5a5a6cfc525a852416232873a8/library/src/main/java/com/wdullaer/materialdatetimepicker/time/RadialSelectorView.java#L156-L168 | train |
wdullaer/MaterialDateTimePicker | library/src/main/java/com/wdullaer/materialdatetimepicker/date/DayPickerView.java | DayPickerView.setUpRecyclerView | protected void setUpRecyclerView(DatePickerDialog.ScrollOrientation scrollOrientation) {
setVerticalScrollBarEnabled(false);
setFadingEdgeLength(0);
int gravity = scrollOrientation == DatePickerDialog.ScrollOrientation.VERTICAL
? Gravity.TOP
: Gravity.START;
... | java | protected void setUpRecyclerView(DatePickerDialog.ScrollOrientation scrollOrientation) {
setVerticalScrollBarEnabled(false);
setFadingEdgeLength(0);
int gravity = scrollOrientation == DatePickerDialog.ScrollOrientation.VERTICAL
? Gravity.TOP
: Gravity.START;
... | [
"protected",
"void",
"setUpRecyclerView",
"(",
"DatePickerDialog",
".",
"ScrollOrientation",
"scrollOrientation",
")",
"{",
"setVerticalScrollBarEnabled",
"(",
"false",
")",
";",
"setFadingEdgeLength",
"(",
"0",
")",
";",
"int",
"gravity",
"=",
"scrollOrientation",
"=... | Sets all the required fields for the list view. Override this method to
set a different list view behavior. | [
"Sets",
"all",
"the",
"required",
"fields",
"for",
"the",
"list",
"view",
".",
"Override",
"this",
"method",
"to",
"set",
"a",
"different",
"list",
"view",
"behavior",
"."
] | 0a8fe28f19db4f5a5a6cfc525a852416232873a8 | https://github.com/wdullaer/MaterialDateTimePicker/blob/0a8fe28f19db4f5a5a6cfc525a852416232873a8/library/src/main/java/com/wdullaer/materialdatetimepicker/date/DayPickerView.java#L113-L125 | train |
wdullaer/MaterialDateTimePicker | library/src/main/java/com/wdullaer/materialdatetimepicker/date/AccessibleDateAnimator.java | AccessibleDateAnimator.dispatchPopulateAccessibilityEvent | @Override
public boolean dispatchPopulateAccessibilityEvent(AccessibilityEvent event) {
if (event.getEventType() == AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED) {
// Clear the event's current text so that only the current date will be spoken.
event.getText().clear();
int... | java | @Override
public boolean dispatchPopulateAccessibilityEvent(AccessibilityEvent event) {
if (event.getEventType() == AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED) {
// Clear the event's current text so that only the current date will be spoken.
event.getText().clear();
int... | [
"@",
"Override",
"public",
"boolean",
"dispatchPopulateAccessibilityEvent",
"(",
"AccessibilityEvent",
"event",
")",
"{",
"if",
"(",
"event",
".",
"getEventType",
"(",
")",
"==",
"AccessibilityEvent",
".",
"TYPE_WINDOW_STATE_CHANGED",
")",
"{",
"// Clear the event's cur... | Announce the currently-selected date when launched. | [
"Announce",
"the",
"currently",
"-",
"selected",
"date",
"when",
"launched",
"."
] | 0a8fe28f19db4f5a5a6cfc525a852416232873a8 | https://github.com/wdullaer/MaterialDateTimePicker/blob/0a8fe28f19db4f5a5a6cfc525a852416232873a8/library/src/main/java/com/wdullaer/materialdatetimepicker/date/AccessibleDateAnimator.java#L39-L52 | train |
wdullaer/MaterialDateTimePicker | library/src/main/java/com/wdullaer/materialdatetimepicker/time/AmPmCirclesView.java | AmPmCirclesView.getIsTouchingAmOrPm | public int getIsTouchingAmOrPm(float xCoord, float yCoord) {
if (!mDrawValuesReady) {
return -1;
}
int squaredYDistance = (int) ((yCoord - mAmPmYCenter)*(yCoord - mAmPmYCenter));
int distanceToAmCenter =
(int) Math.sqrt((xCoord - mAmXCenter)*(xCoord - mAmXCe... | java | public int getIsTouchingAmOrPm(float xCoord, float yCoord) {
if (!mDrawValuesReady) {
return -1;
}
int squaredYDistance = (int) ((yCoord - mAmPmYCenter)*(yCoord - mAmPmYCenter));
int distanceToAmCenter =
(int) Math.sqrt((xCoord - mAmXCenter)*(xCoord - mAmXCe... | [
"public",
"int",
"getIsTouchingAmOrPm",
"(",
"float",
"xCoord",
",",
"float",
"yCoord",
")",
"{",
"if",
"(",
"!",
"mDrawValuesReady",
")",
"{",
"return",
"-",
"1",
";",
"}",
"int",
"squaredYDistance",
"=",
"(",
"int",
")",
"(",
"(",
"yCoord",
"-",
"mAm... | Calculate whether the coordinates are touching the AM or PM circle. | [
"Calculate",
"whether",
"the",
"coordinates",
"are",
"touching",
"the",
"AM",
"or",
"PM",
"circle",
"."
] | 0a8fe28f19db4f5a5a6cfc525a852416232873a8 | https://github.com/wdullaer/MaterialDateTimePicker/blob/0a8fe28f19db4f5a5a6cfc525a852416232873a8/library/src/main/java/com/wdullaer/materialdatetimepicker/time/AmPmCirclesView.java#L135-L156 | train |
spotbugs/spotbugs | spotbugs-ant/src/main/java/edu/umd/cs/findbugs/anttask/FindBugsTask.java | FindBugsTask.setExcludeFilter | public void setExcludeFilter(File filterFile) {
if (filterFile != null && filterFile.length() > 0) {
excludeFile = filterFile;
} else {
if (filterFile != null) {
log("Warning: exclude filter file " + filterFile
+ (filterFile.exists() ? " is... | java | public void setExcludeFilter(File filterFile) {
if (filterFile != null && filterFile.length() > 0) {
excludeFile = filterFile;
} else {
if (filterFile != null) {
log("Warning: exclude filter file " + filterFile
+ (filterFile.exists() ? " is... | [
"public",
"void",
"setExcludeFilter",
"(",
"File",
"filterFile",
")",
"{",
"if",
"(",
"filterFile",
"!=",
"null",
"&&",
"filterFile",
".",
"length",
"(",
")",
">",
"0",
")",
"{",
"excludeFile",
"=",
"filterFile",
";",
"}",
"else",
"{",
"if",
"(",
"filt... | Set the exclude filter file
@param filterFile
exclude filter file | [
"Set",
"the",
"exclude",
"filter",
"file"
] | f6365c6eea6515035bded38efa4a7c8b46ccf28c | https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs-ant/src/main/java/edu/umd/cs/findbugs/anttask/FindBugsTask.java#L421-L431 | train |
spotbugs/spotbugs | spotbugs-ant/src/main/java/edu/umd/cs/findbugs/anttask/FindBugsTask.java | FindBugsTask.setIncludeFilter | public void setIncludeFilter(File filterFile) {
if (filterFile != null && filterFile.length() > 0) {
includeFile = filterFile;
} else {
if (filterFile != null) {
log("Warning: include filter file " + filterFile
+ (filterFile.exists() ? " is... | java | public void setIncludeFilter(File filterFile) {
if (filterFile != null && filterFile.length() > 0) {
includeFile = filterFile;
} else {
if (filterFile != null) {
log("Warning: include filter file " + filterFile
+ (filterFile.exists() ? " is... | [
"public",
"void",
"setIncludeFilter",
"(",
"File",
"filterFile",
")",
"{",
"if",
"(",
"filterFile",
"!=",
"null",
"&&",
"filterFile",
".",
"length",
"(",
")",
">",
"0",
")",
"{",
"includeFile",
"=",
"filterFile",
";",
"}",
"else",
"{",
"if",
"(",
"filt... | Set the include filter file
@param filterFile
include filter file | [
"Set",
"the",
"include",
"filter",
"file"
] | f6365c6eea6515035bded38efa4a7c8b46ccf28c | https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs-ant/src/main/java/edu/umd/cs/findbugs/anttask/FindBugsTask.java#L439-L449 | train |
spotbugs/spotbugs | spotbugs-ant/src/main/java/edu/umd/cs/findbugs/anttask/FindBugsTask.java | FindBugsTask.setBaselineBugs | public void setBaselineBugs(File baselineBugs) {
if (baselineBugs != null && baselineBugs.length() > 0) {
this.baselineBugs = baselineBugs;
} else {
if (baselineBugs != null) {
log("Warning: baseline bugs file " + baselineBugs
+ (baselineBu... | java | public void setBaselineBugs(File baselineBugs) {
if (baselineBugs != null && baselineBugs.length() > 0) {
this.baselineBugs = baselineBugs;
} else {
if (baselineBugs != null) {
log("Warning: baseline bugs file " + baselineBugs
+ (baselineBu... | [
"public",
"void",
"setBaselineBugs",
"(",
"File",
"baselineBugs",
")",
"{",
"if",
"(",
"baselineBugs",
"!=",
"null",
"&&",
"baselineBugs",
".",
"length",
"(",
")",
">",
"0",
")",
"{",
"this",
".",
"baselineBugs",
"=",
"baselineBugs",
";",
"}",
"else",
"{... | Set the baseline bugs file
@param baselineBugs
baseline bugs file | [
"Set",
"the",
"baseline",
"bugs",
"file"
] | f6365c6eea6515035bded38efa4a7c8b46ccf28c | https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs-ant/src/main/java/edu/umd/cs/findbugs/anttask/FindBugsTask.java#L457-L467 | train |
spotbugs/spotbugs | spotbugs-ant/src/main/java/edu/umd/cs/findbugs/anttask/FindBugsTask.java | FindBugsTask.setAuxClasspath | public void setAuxClasspath(Path src) {
boolean nonEmpty = false;
String[] elementList = src.list();
for (String anElementList : elementList) {
if (!"".equals(anElementList)) {
nonEmpty = true;
break;
}
}
if (nonEmpty) {
... | java | public void setAuxClasspath(Path src) {
boolean nonEmpty = false;
String[] elementList = src.list();
for (String anElementList : elementList) {
if (!"".equals(anElementList)) {
nonEmpty = true;
break;
}
}
if (nonEmpty) {
... | [
"public",
"void",
"setAuxClasspath",
"(",
"Path",
"src",
")",
"{",
"boolean",
"nonEmpty",
"=",
"false",
";",
"String",
"[",
"]",
"elementList",
"=",
"src",
".",
"list",
"(",
")",
";",
"for",
"(",
"String",
"anElementList",
":",
"elementList",
")",
"{",
... | the auxclasspath to use.
@param src
auxclasspath to use | [
"the",
"auxclasspath",
"to",
"use",
"."
] | f6365c6eea6515035bded38efa4a7c8b46ccf28c | https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs-ant/src/main/java/edu/umd/cs/findbugs/anttask/FindBugsTask.java#L495-L513 | train |
spotbugs/spotbugs | spotbugs-ant/src/main/java/edu/umd/cs/findbugs/anttask/FindBugsTask.java | FindBugsTask.setAuxClasspathRef | public void setAuxClasspathRef(Reference r) {
Path path = createAuxClasspath();
path.setRefid(r);
path.toString(); // Evaluated for its side-effects (throwing a
// BuildException)
} | java | public void setAuxClasspathRef(Reference r) {
Path path = createAuxClasspath();
path.setRefid(r);
path.toString(); // Evaluated for its side-effects (throwing a
// BuildException)
} | [
"public",
"void",
"setAuxClasspathRef",
"(",
"Reference",
"r",
")",
"{",
"Path",
"path",
"=",
"createAuxClasspath",
"(",
")",
";",
"path",
".",
"setRefid",
"(",
"r",
")",
";",
"path",
".",
"toString",
"(",
")",
";",
"// Evaluated for its side-effects (throwing... | Adds a reference to a sourcepath defined elsewhere.
@param r
reference to a sourcepath defined elsewhere | [
"Adds",
"a",
"reference",
"to",
"a",
"sourcepath",
"defined",
"elsewhere",
"."
] | f6365c6eea6515035bded38efa4a7c8b46ccf28c | https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs-ant/src/main/java/edu/umd/cs/findbugs/anttask/FindBugsTask.java#L533-L538 | train |
spotbugs/spotbugs | spotbugs-ant/src/main/java/edu/umd/cs/findbugs/anttask/FindBugsTask.java | FindBugsTask.setAuxAnalyzepath | public void setAuxAnalyzepath(Path src) {
boolean nonEmpty = false;
String[] elementList = src.list();
for (String anElementList : elementList) {
if (!"".equals(anElementList)) {
nonEmpty = true;
break;
}
}
if (nonEmpty) {... | java | public void setAuxAnalyzepath(Path src) {
boolean nonEmpty = false;
String[] elementList = src.list();
for (String anElementList : elementList) {
if (!"".equals(anElementList)) {
nonEmpty = true;
break;
}
}
if (nonEmpty) {... | [
"public",
"void",
"setAuxAnalyzepath",
"(",
"Path",
"src",
")",
"{",
"boolean",
"nonEmpty",
"=",
"false",
";",
"String",
"[",
"]",
"elementList",
"=",
"src",
".",
"list",
"(",
")",
";",
"for",
"(",
"String",
"anElementList",
":",
"elementList",
")",
"{",... | the auxAnalyzepath to use.
@param src
auxAnalyzepath | [
"the",
"auxAnalyzepath",
"to",
"use",
"."
] | f6365c6eea6515035bded38efa4a7c8b46ccf28c | https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs-ant/src/main/java/edu/umd/cs/findbugs/anttask/FindBugsTask.java#L546-L564 | train |
spotbugs/spotbugs | spotbugs-ant/src/main/java/edu/umd/cs/findbugs/anttask/FindBugsTask.java | FindBugsTask.setSourcePath | public void setSourcePath(Path src) {
if (sourcePath == null) {
sourcePath = src;
} else {
sourcePath.append(src);
}
} | java | public void setSourcePath(Path src) {
if (sourcePath == null) {
sourcePath = src;
} else {
sourcePath.append(src);
}
} | [
"public",
"void",
"setSourcePath",
"(",
"Path",
"src",
")",
"{",
"if",
"(",
"sourcePath",
"==",
"null",
")",
"{",
"sourcePath",
"=",
"src",
";",
"}",
"else",
"{",
"sourcePath",
".",
"append",
"(",
"src",
")",
";",
"}",
"}"
] | the sourcepath to use.
@param src
sourcepath | [
"the",
"sourcepath",
"to",
"use",
"."
] | f6365c6eea6515035bded38efa4a7c8b46ccf28c | https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs-ant/src/main/java/edu/umd/cs/findbugs/anttask/FindBugsTask.java#L594-L600 | train |
spotbugs/spotbugs | spotbugs-ant/src/main/java/edu/umd/cs/findbugs/anttask/FindBugsTask.java | FindBugsTask.setExcludePath | public void setExcludePath(Path src) {
if (excludePath == null) {
excludePath = src;
} else {
excludePath.append(src);
}
} | java | public void setExcludePath(Path src) {
if (excludePath == null) {
excludePath = src;
} else {
excludePath.append(src);
}
} | [
"public",
"void",
"setExcludePath",
"(",
"Path",
"src",
")",
"{",
"if",
"(",
"excludePath",
"==",
"null",
")",
"{",
"excludePath",
"=",
"src",
";",
"}",
"else",
"{",
"excludePath",
".",
"append",
"(",
"src",
")",
";",
"}",
"}"
] | the excludepath to use.
@param src
excludepath | [
"the",
"excludepath",
"to",
"use",
"."
] | f6365c6eea6515035bded38efa4a7c8b46ccf28c | https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs-ant/src/main/java/edu/umd/cs/findbugs/anttask/FindBugsTask.java#L630-L636 | train |
spotbugs/spotbugs | spotbugs-ant/src/main/java/edu/umd/cs/findbugs/anttask/FindBugsTask.java | FindBugsTask.setIncludePath | public void setIncludePath(Path src) {
if (includePath == null) {
includePath = src;
} else {
includePath.append(src);
}
} | java | public void setIncludePath(Path src) {
if (includePath == null) {
includePath = src;
} else {
includePath.append(src);
}
} | [
"public",
"void",
"setIncludePath",
"(",
"Path",
"src",
")",
"{",
"if",
"(",
"includePath",
"==",
"null",
")",
"{",
"includePath",
"=",
"src",
";",
"}",
"else",
"{",
"includePath",
".",
"append",
"(",
"src",
")",
";",
"}",
"}"
] | the includepath to use.
@param src
includepath | [
"the",
"includepath",
"to",
"use",
"."
] | f6365c6eea6515035bded38efa4a7c8b46ccf28c | https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs-ant/src/main/java/edu/umd/cs/findbugs/anttask/FindBugsTask.java#L666-L672 | train |
spotbugs/spotbugs | spotbugs-ant/src/main/java/edu/umd/cs/findbugs/anttask/FindBugsTask.java | FindBugsTask.checkParameters | @Override
protected void checkParameters() {
super.checkParameters();
if (projectFile == null && classLocations.size() == 0 && filesets.size() == 0 && dirsets.size() == 0 && auxAnalyzepath == null) {
throw new BuildException("either projectfile, <class/>, <fileset/> or <auxAnalyzepath/>... | java | @Override
protected void checkParameters() {
super.checkParameters();
if (projectFile == null && classLocations.size() == 0 && filesets.size() == 0 && dirsets.size() == 0 && auxAnalyzepath == null) {
throw new BuildException("either projectfile, <class/>, <fileset/> or <auxAnalyzepath/>... | [
"@",
"Override",
"protected",
"void",
"checkParameters",
"(",
")",
"{",
"super",
".",
"checkParameters",
"(",
")",
";",
"if",
"(",
"projectFile",
"==",
"null",
"&&",
"classLocations",
".",
"size",
"(",
")",
"==",
"0",
"&&",
"filesets",
".",
"size",
"(",
... | Check that all required attributes have been set | [
"Check",
"that",
"all",
"required",
"attributes",
"have",
"been",
"set"
] | f6365c6eea6515035bded38efa4a7c8b46ccf28c | https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs-ant/src/main/java/edu/umd/cs/findbugs/anttask/FindBugsTask.java#L752-L787 | train |
spotbugs/spotbugs | eclipsePlugin/src/de/tobject/findbugs/properties/DetectorProvider.java | DetectorProvider.isEclipsePluginDisabled | static boolean isEclipsePluginDisabled(String pluginId, Map<URI, Plugin> allPlugins) {
for (Plugin plugin : allPlugins.values()) {
if(pluginId.equals(plugin.getPluginId())) {
return false;
}
}
return true;
} | java | static boolean isEclipsePluginDisabled(String pluginId, Map<URI, Plugin> allPlugins) {
for (Plugin plugin : allPlugins.values()) {
if(pluginId.equals(plugin.getPluginId())) {
return false;
}
}
return true;
} | [
"static",
"boolean",
"isEclipsePluginDisabled",
"(",
"String",
"pluginId",
",",
"Map",
"<",
"URI",
",",
"Plugin",
">",
"allPlugins",
")",
"{",
"for",
"(",
"Plugin",
"plugin",
":",
"allPlugins",
".",
"values",
"(",
")",
")",
"{",
"if",
"(",
"pluginId",
".... | Eclipse plugin can be disabled ONLY by user, so it must NOT be in the
list of loaded plugins | [
"Eclipse",
"plugin",
"can",
"be",
"disabled",
"ONLY",
"by",
"user",
"so",
"it",
"must",
"NOT",
"be",
"in",
"the",
"list",
"of",
"loaded",
"plugins"
] | f6365c6eea6515035bded38efa4a7c8b46ccf28c | https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/eclipsePlugin/src/de/tobject/findbugs/properties/DetectorProvider.java#L135-L142 | train |
spotbugs/spotbugs | spotbugs/src/main/java/edu/umd/cs/findbugs/ba/DataflowCFGPrinter.java | DataflowCFGPrinter.printCFG | public static <Fact, AnalysisType extends BasicAbstractDataflowAnalysis<Fact>> void printCFG(
Dataflow<Fact, AnalysisType> dataflow, PrintStream out) {
DataflowCFGPrinter<Fact, AnalysisType> printer = new DataflowCFGPrinter<>(dataflow);
printer.print(out);
} | java | public static <Fact, AnalysisType extends BasicAbstractDataflowAnalysis<Fact>> void printCFG(
Dataflow<Fact, AnalysisType> dataflow, PrintStream out) {
DataflowCFGPrinter<Fact, AnalysisType> printer = new DataflowCFGPrinter<>(dataflow);
printer.print(out);
} | [
"public",
"static",
"<",
"Fact",
",",
"AnalysisType",
"extends",
"BasicAbstractDataflowAnalysis",
"<",
"Fact",
">",
">",
"void",
"printCFG",
"(",
"Dataflow",
"<",
"Fact",
",",
"AnalysisType",
">",
"dataflow",
",",
"PrintStream",
"out",
")",
"{",
"DataflowCFGPrin... | Print CFG annotated with results from given dataflow analysis.
@param <Fact>
Dataflow fact type
@param <AnalysisType>
Dataflow analysis type
@param dataflow
dataflow driver
@param out
PrintStream to use | [
"Print",
"CFG",
"annotated",
"with",
"results",
"from",
"given",
"dataflow",
"analysis",
"."
] | f6365c6eea6515035bded38efa4a7c8b46ccf28c | https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/ba/DataflowCFGPrinter.java#L107-L111 | train |
spotbugs/spotbugs | eclipsePlugin/src/de/tobject/findbugs/classify/AccuracyClassificationPulldownAction.java | AccuracyClassificationPulldownAction.fillMenu | private void fillMenu() {
isBugItem = new MenuItem(menu, SWT.RADIO);
isBugItem.setText("Bug");
notBugItem = new MenuItem(menu, SWT.RADIO);
notBugItem.setText("Not Bug");
isBugItem.addSelectionListener(new SelectionAdapter() {
/*
* (non-Javadoc)
... | java | private void fillMenu() {
isBugItem = new MenuItem(menu, SWT.RADIO);
isBugItem.setText("Bug");
notBugItem = new MenuItem(menu, SWT.RADIO);
notBugItem.setText("Not Bug");
isBugItem.addSelectionListener(new SelectionAdapter() {
/*
* (non-Javadoc)
... | [
"private",
"void",
"fillMenu",
"(",
")",
"{",
"isBugItem",
"=",
"new",
"MenuItem",
"(",
"menu",
",",
"SWT",
".",
"RADIO",
")",
";",
"isBugItem",
".",
"setText",
"(",
"\"Bug\"",
")",
";",
"notBugItem",
"=",
"new",
"MenuItem",
"(",
"menu",
",",
"SWT",
... | Fill the classification menu. | [
"Fill",
"the",
"classification",
"menu",
"."
] | f6365c6eea6515035bded38efa4a7c8b46ccf28c | https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/eclipsePlugin/src/de/tobject/findbugs/classify/AccuracyClassificationPulldownAction.java#L98-L147 | train |
spotbugs/spotbugs | eclipsePlugin/src/de/tobject/findbugs/classify/AccuracyClassificationPulldownAction.java | AccuracyClassificationPulldownAction.syncMenu | private void syncMenu() {
if (bugInstance != null) {
isBugItem.setEnabled(true);
notBugItem.setEnabled(true);
BugProperty isBugProperty = bugInstance.lookupProperty(BugProperty.IS_BUG);
if (isBugProperty == null) {
// Unclassified
... | java | private void syncMenu() {
if (bugInstance != null) {
isBugItem.setEnabled(true);
notBugItem.setEnabled(true);
BugProperty isBugProperty = bugInstance.lookupProperty(BugProperty.IS_BUG);
if (isBugProperty == null) {
// Unclassified
... | [
"private",
"void",
"syncMenu",
"(",
")",
"{",
"if",
"(",
"bugInstance",
"!=",
"null",
")",
"{",
"isBugItem",
".",
"setEnabled",
"(",
"true",
")",
";",
"notBugItem",
".",
"setEnabled",
"(",
"true",
")",
";",
"BugProperty",
"isBugProperty",
"=",
"bugInstance... | Update menu to match currently selected BugInstance. | [
"Update",
"menu",
"to",
"match",
"currently",
"selected",
"BugInstance",
"."
] | f6365c6eea6515035bded38efa4a7c8b46ccf28c | https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/eclipsePlugin/src/de/tobject/findbugs/classify/AccuracyClassificationPulldownAction.java#L257-L282 | train |
spotbugs/spotbugs | spotbugs/src/main/java/edu/umd/cs/findbugs/ba/bcp/PatternMatcher.java | PatternMatcher.execute | public PatternMatcher execute() throws DataflowAnalysisException {
workList.addLast(cfg.getEntry());
while (!workList.isEmpty()) {
BasicBlock basicBlock = workList.removeLast();
visitedBlockMap.put(basicBlock, basicBlock);
// Scan instructions of basic block for pos... | java | public PatternMatcher execute() throws DataflowAnalysisException {
workList.addLast(cfg.getEntry());
while (!workList.isEmpty()) {
BasicBlock basicBlock = workList.removeLast();
visitedBlockMap.put(basicBlock, basicBlock);
// Scan instructions of basic block for pos... | [
"public",
"PatternMatcher",
"execute",
"(",
")",
"throws",
"DataflowAnalysisException",
"{",
"workList",
".",
"addLast",
"(",
"cfg",
".",
"getEntry",
"(",
")",
")",
";",
"while",
"(",
"!",
"workList",
".",
"isEmpty",
"(",
")",
")",
"{",
"BasicBlock",
"basi... | Search for examples of the ByteCodePattern.
@return this object
@throws DataflowAnalysisException
if the ValueNumberAnalysis did not produce useful values for
the method | [
"Search",
"for",
"examples",
"of",
"the",
"ByteCodePattern",
"."
] | f6365c6eea6515035bded38efa4a7c8b46ccf28c | https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/ba/bcp/PatternMatcher.java#L114-L140 | train |
spotbugs/spotbugs | spotbugs/src/main/java/edu/umd/cs/findbugs/ba/bcp/PatternMatcher.java | PatternMatcher.attemptMatch | private void attemptMatch(BasicBlock basicBlock, BasicBlock.InstructionIterator instructionIterator)
throws DataflowAnalysisException {
work(new State(basicBlock, instructionIterator, pattern.getFirst()));
} | java | private void attemptMatch(BasicBlock basicBlock, BasicBlock.InstructionIterator instructionIterator)
throws DataflowAnalysisException {
work(new State(basicBlock, instructionIterator, pattern.getFirst()));
} | [
"private",
"void",
"attemptMatch",
"(",
"BasicBlock",
"basicBlock",
",",
"BasicBlock",
".",
"InstructionIterator",
"instructionIterator",
")",
"throws",
"DataflowAnalysisException",
"{",
"work",
"(",
"new",
"State",
"(",
"basicBlock",
",",
"instructionIterator",
",",
... | Attempt to begin a match.
@param basicBlock
the basic block
@param instructionIterator
the instruction iterator positioned just before the first
instruction to be matched | [
"Attempt",
"to",
"begin",
"a",
"match",
"."
] | f6365c6eea6515035bded38efa4a7c8b46ccf28c | https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/ba/bcp/PatternMatcher.java#L159-L162 | train |
spotbugs/spotbugs | spotbugs/src/main/java/edu/umd/cs/findbugs/ba/generic/GenericUtilities.java | GenericUtilities.getString | public static final String getString(Type type) {
if (type instanceof GenericObjectType) {
return ((GenericObjectType) type).toString(true);
} else if (type instanceof ArrayType) {
return TypeCategory.asString((ArrayType) type);
} else {
return type.toString()... | java | public static final String getString(Type type) {
if (type instanceof GenericObjectType) {
return ((GenericObjectType) type).toString(true);
} else if (type instanceof ArrayType) {
return TypeCategory.asString((ArrayType) type);
} else {
return type.toString()... | [
"public",
"static",
"final",
"String",
"getString",
"(",
"Type",
"type",
")",
"{",
"if",
"(",
"type",
"instanceof",
"GenericObjectType",
")",
"{",
"return",
"(",
"(",
"GenericObjectType",
")",
"type",
")",
".",
"toString",
"(",
"true",
")",
";",
"}",
"el... | Get String representation of a Type including Generic information | [
"Get",
"String",
"representation",
"of",
"a",
"Type",
"including",
"Generic",
"information"
] | f6365c6eea6515035bded38efa4a7c8b46ccf28c | https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/ba/generic/GenericUtilities.java#L210-L218 | train |
spotbugs/spotbugs | spotbugs/src/gui/main/edu/umd/cs/findbugs/gui2/MainFrameLoadSaveHelper.java | MainFrameLoadSaveHelper.askToSave | private boolean askToSave() {
if (mainFrame.isProjectChanged()) {
int response = JOptionPane.showConfirmDialog(mainFrame, L10N.getLocalString("dlg.save_current_changes",
"The current project has been changed, Save current changes?"), L10N.getLocalString("dlg.save_changes",
... | java | private boolean askToSave() {
if (mainFrame.isProjectChanged()) {
int response = JOptionPane.showConfirmDialog(mainFrame, L10N.getLocalString("dlg.save_current_changes",
"The current project has been changed, Save current changes?"), L10N.getLocalString("dlg.save_changes",
... | [
"private",
"boolean",
"askToSave",
"(",
")",
"{",
"if",
"(",
"mainFrame",
".",
"isProjectChanged",
"(",
")",
")",
"{",
"int",
"response",
"=",
"JOptionPane",
".",
"showConfirmDialog",
"(",
"mainFrame",
",",
"L10N",
".",
"getLocalString",
"(",
"\"dlg.save_curre... | Returns true if cancelled | [
"Returns",
"true",
"if",
"cancelled"
] | f6365c6eea6515035bded38efa4a7c8b46ccf28c | https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/gui/main/edu/umd/cs/findbugs/gui2/MainFrameLoadSaveHelper.java#L161-L180 | train |
spotbugs/spotbugs | spotbugs/src/gui/main/edu/umd/cs/findbugs/gui2/MainFrameLoadSaveHelper.java | MainFrameLoadSaveHelper.saveAnalysis | SaveReturn saveAnalysis(final File f) {
Future<Object> waiter = mainFrame.getBackgroundExecutor().submit(() -> {
BugSaver.saveBugs(f, mainFrame.getBugCollection(), mainFrame.getProject());
return null;
});
try {
waiter.get();
} catch (InterruptedExcep... | java | SaveReturn saveAnalysis(final File f) {
Future<Object> waiter = mainFrame.getBackgroundExecutor().submit(() -> {
BugSaver.saveBugs(f, mainFrame.getBugCollection(), mainFrame.getProject());
return null;
});
try {
waiter.get();
} catch (InterruptedExcep... | [
"SaveReturn",
"saveAnalysis",
"(",
"final",
"File",
"f",
")",
"{",
"Future",
"<",
"Object",
">",
"waiter",
"=",
"mainFrame",
".",
"getBackgroundExecutor",
"(",
")",
".",
"submit",
"(",
"(",
")",
"->",
"{",
"BugSaver",
".",
"saveBugs",
"(",
"f",
",",
"m... | Save current analysis as file passed in. Return SAVE_SUCCESSFUL if save
successful. Method doesn't do much. This method is more if need to do
other things in the future for saving analysis. And to keep saving naming
convention. | [
"Save",
"current",
"analysis",
"as",
"file",
"passed",
"in",
".",
"Return",
"SAVE_SUCCESSFUL",
"if",
"save",
"successful",
".",
"Method",
"doesn",
"t",
"do",
"much",
".",
"This",
"method",
"is",
"more",
"if",
"need",
"to",
"do",
"other",
"things",
"in",
... | f6365c6eea6515035bded38efa4a7c8b46ccf28c | https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/gui/main/edu/umd/cs/findbugs/gui2/MainFrameLoadSaveHelper.java#L472-L489 | train |
spotbugs/spotbugs | spotbugs/src/main/java/edu/umd/cs/findbugs/ba/URLClassPath.java | URLClassPath.getClassPath | public String getClassPath() {
StringBuilder buf = new StringBuilder();
for (Entry entry : entryList) {
if (buf.length() > 0) {
buf.append(File.pathSeparator);
}
buf.append(entry.getURL());
}
return buf.toString();
} | java | public String getClassPath() {
StringBuilder buf = new StringBuilder();
for (Entry entry : entryList) {
if (buf.length() > 0) {
buf.append(File.pathSeparator);
}
buf.append(entry.getURL());
}
return buf.toString();
} | [
"public",
"String",
"getClassPath",
"(",
")",
"{",
"StringBuilder",
"buf",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"for",
"(",
"Entry",
"entry",
":",
"entryList",
")",
"{",
"if",
"(",
"buf",
".",
"length",
"(",
")",
">",
"0",
")",
"{",
"buf",
"... | Return the classpath string.
@return the classpath string | [
"Return",
"the",
"classpath",
"string",
"."
] | f6365c6eea6515035bded38efa4a7c8b46ccf28c | https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/ba/URLClassPath.java#L342-L351 | train |
spotbugs/spotbugs | spotbugs/src/main/java/edu/umd/cs/findbugs/ba/URLClassPath.java | URLClassPath.getInputStreamForResource | private InputStream getInputStreamForResource(String resourceName) {
// Try each classpath entry, in order, until we find one
// that has the resource. Catch and ignore IOExceptions.
// FIXME: The following code should throw IOException.
//
// URL.openStream() does not seem to ... | java | private InputStream getInputStreamForResource(String resourceName) {
// Try each classpath entry, in order, until we find one
// that has the resource. Catch and ignore IOExceptions.
// FIXME: The following code should throw IOException.
//
// URL.openStream() does not seem to ... | [
"private",
"InputStream",
"getInputStreamForResource",
"(",
"String",
"resourceName",
")",
"{",
"// Try each classpath entry, in order, until we find one",
"// that has the resource. Catch and ignore IOExceptions.",
"// FIXME: The following code should throw IOException.",
"//",
"// URL.open... | Open a stream to read given resource.
@param resourceName
name of resource to load, e.g. "java/lang/Object.class"
@return input stream to read resource, or null if resource could not be
found
@throws IOException
if an IO error occurs trying to determine whether or not the
resource exists | [
"Open",
"a",
"stream",
"to",
"read",
"given",
"resource",
"."
] | f6365c6eea6515035bded38efa4a7c8b46ccf28c | https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/ba/URLClassPath.java#L364-L399 | train |
spotbugs/spotbugs | spotbugs/src/main/java/edu/umd/cs/findbugs/ba/URLClassPath.java | URLClassPath.lookupClass | public JavaClass lookupClass(String className) throws ClassNotFoundException {
if (classesThatCantBeFound.contains(className)) {
throw new ClassNotFoundException("Error while looking for class " + className + ": class not found");
}
String resourceName = className.replace('.', '/') +... | java | public JavaClass lookupClass(String className) throws ClassNotFoundException {
if (classesThatCantBeFound.contains(className)) {
throw new ClassNotFoundException("Error while looking for class " + className + ": class not found");
}
String resourceName = className.replace('.', '/') +... | [
"public",
"JavaClass",
"lookupClass",
"(",
"String",
"className",
")",
"throws",
"ClassNotFoundException",
"{",
"if",
"(",
"classesThatCantBeFound",
".",
"contains",
"(",
"className",
")",
")",
"{",
"throw",
"new",
"ClassNotFoundException",
"(",
"\"Error while looking... | Look up a class from the classpath.
@param className
name of class to look up
@return the JavaClass object for the class
@throws ClassNotFoundException
if the class couldn't be found | [
"Look",
"up",
"a",
"class",
"from",
"the",
"classpath",
"."
] | f6365c6eea6515035bded38efa4a7c8b46ccf28c | https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/ba/URLClassPath.java#L412-L445 | train |
spotbugs/spotbugs | spotbugs/src/main/java/edu/umd/cs/findbugs/ba/URLClassPath.java | URLClassPath.getURLProtocol | public static String getURLProtocol(String urlString) {
String protocol = null;
int firstColon = urlString.indexOf(':');
if (firstColon >= 0) {
String specifiedProtocol = urlString.substring(0, firstColon);
if (FindBugs.knownURLProtocolSet.contains(specifiedProtocol)) {
... | java | public static String getURLProtocol(String urlString) {
String protocol = null;
int firstColon = urlString.indexOf(':');
if (firstColon >= 0) {
String specifiedProtocol = urlString.substring(0, firstColon);
if (FindBugs.knownURLProtocolSet.contains(specifiedProtocol)) {
... | [
"public",
"static",
"String",
"getURLProtocol",
"(",
"String",
"urlString",
")",
"{",
"String",
"protocol",
"=",
"null",
";",
"int",
"firstColon",
"=",
"urlString",
".",
"indexOf",
"(",
"'",
"'",
")",
";",
"if",
"(",
"firstColon",
">=",
"0",
")",
"{",
... | Get the URL protocol of given URL string.
@param urlString
the URL string
@return the protocol name ("http", "file", etc.), or null if there is no
protocol | [
"Get",
"the",
"URL",
"protocol",
"of",
"given",
"URL",
"string",
"."
] | f6365c6eea6515035bded38efa4a7c8b46ccf28c | https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/ba/URLClassPath.java#L466-L476 | train |
spotbugs/spotbugs | spotbugs/src/main/java/edu/umd/cs/findbugs/ba/URLClassPath.java | URLClassPath.getFileExtension | public static String getFileExtension(String fileName) {
int lastDot = fileName.lastIndexOf('.');
return (lastDot >= 0) ? fileName.substring(lastDot) : null;
} | java | public static String getFileExtension(String fileName) {
int lastDot = fileName.lastIndexOf('.');
return (lastDot >= 0) ? fileName.substring(lastDot) : null;
} | [
"public",
"static",
"String",
"getFileExtension",
"(",
"String",
"fileName",
")",
"{",
"int",
"lastDot",
"=",
"fileName",
".",
"lastIndexOf",
"(",
"'",
"'",
")",
";",
"return",
"(",
"lastDot",
">=",
"0",
")",
"?",
"fileName",
".",
"substring",
"(",
"last... | Get the file extension of given fileName.
@return the file extension, or null if there is no file extension | [
"Get",
"the",
"file",
"extension",
"of",
"given",
"fileName",
"."
] | f6365c6eea6515035bded38efa4a7c8b46ccf28c | https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/ba/URLClassPath.java#L483-L486 | train |
spotbugs/spotbugs | spotbugs/src/main/java/edu/umd/cs/findbugs/ba/vna/ValueNumberFrame.java | ValueNumberFrame.killLoadsOfField | public void killLoadsOfField(XField field) {
if (!REDUNDANT_LOAD_ELIMINATION) {
return;
}
HashSet<AvailableLoad> killMe = new HashSet<>();
for (AvailableLoad availableLoad : getAvailableLoadMap().keySet()) {
if (availableLoad.getField().equals(field)) {
... | java | public void killLoadsOfField(XField field) {
if (!REDUNDANT_LOAD_ELIMINATION) {
return;
}
HashSet<AvailableLoad> killMe = new HashSet<>();
for (AvailableLoad availableLoad : getAvailableLoadMap().keySet()) {
if (availableLoad.getField().equals(field)) {
... | [
"public",
"void",
"killLoadsOfField",
"(",
"XField",
"field",
")",
"{",
"if",
"(",
"!",
"REDUNDANT_LOAD_ELIMINATION",
")",
"{",
"return",
";",
"}",
"HashSet",
"<",
"AvailableLoad",
">",
"killMe",
"=",
"new",
"HashSet",
"<>",
"(",
")",
";",
"for",
"(",
"A... | Kill all loads of given field.
@param field
the field | [
"Kill",
"all",
"loads",
"of",
"given",
"field",
"."
] | f6365c6eea6515035bded38efa4a7c8b46ccf28c | https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/ba/vna/ValueNumberFrame.java#L175-L189 | train |
spotbugs/spotbugs | spotbugs/src/main/java/edu/umd/cs/findbugs/xml/MetaCharacterMap.java | MetaCharacterMap.addMeta | public void addMeta(char meta, String replacement) {
metaCharacterSet.set(meta);
replacementMap.put(new String(new char[] { meta }), replacement);
} | java | public void addMeta(char meta, String replacement) {
metaCharacterSet.set(meta);
replacementMap.put(new String(new char[] { meta }), replacement);
} | [
"public",
"void",
"addMeta",
"(",
"char",
"meta",
",",
"String",
"replacement",
")",
"{",
"metaCharacterSet",
".",
"set",
"(",
"meta",
")",
";",
"replacementMap",
".",
"put",
"(",
"new",
"String",
"(",
"new",
"char",
"[",
"]",
"{",
"meta",
"}",
")",
... | Add a metacharacter and its replacement.
@param meta
the metacharacter
@param replacement
the String to replace the metacharacter with | [
"Add",
"a",
"metacharacter",
"and",
"its",
"replacement",
"."
] | f6365c6eea6515035bded38efa4a7c8b46ccf28c | https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/xml/MetaCharacterMap.java#L53-L56 | train |
spotbugs/spotbugs | eclipsePlugin/src/de/tobject/findbugs/FindbugsPlugin.java | FindbugsPlugin.getResourceString | public static String getResourceString(String key) {
ResourceBundle bundle = FindbugsPlugin.getDefault().getResourceBundle();
try {
return bundle.getString(key);
} catch (MissingResourceException e) {
return key;
}
} | java | public static String getResourceString(String key) {
ResourceBundle bundle = FindbugsPlugin.getDefault().getResourceBundle();
try {
return bundle.getString(key);
} catch (MissingResourceException e) {
return key;
}
} | [
"public",
"static",
"String",
"getResourceString",
"(",
"String",
"key",
")",
"{",
"ResourceBundle",
"bundle",
"=",
"FindbugsPlugin",
".",
"getDefault",
"(",
")",
".",
"getResourceBundle",
"(",
")",
";",
"try",
"{",
"return",
"bundle",
".",
"getString",
"(",
... | Returns the string from the plugin's resource bundle, or 'key' if not
found. | [
"Returns",
"the",
"string",
"from",
"the",
"plugin",
"s",
"resource",
"bundle",
"or",
"key",
"if",
"not",
"found",
"."
] | f6365c6eea6515035bded38efa4a7c8b46ccf28c | https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/eclipsePlugin/src/de/tobject/findbugs/FindbugsPlugin.java#L456-L463 | train |
spotbugs/spotbugs | eclipsePlugin/src/de/tobject/findbugs/FindbugsPlugin.java | FindbugsPlugin.getFindBugsEnginePluginLocation | public static String getFindBugsEnginePluginLocation() {
// findbugs.home should be set to the directory the plugin is
// installed in.
URL u = plugin.getBundle().getEntry("/");
try {
URL bundleRoot = FileLocator.resolve(u);
String path = bundleRoot.getPath();
... | java | public static String getFindBugsEnginePluginLocation() {
// findbugs.home should be set to the directory the plugin is
// installed in.
URL u = plugin.getBundle().getEntry("/");
try {
URL bundleRoot = FileLocator.resolve(u);
String path = bundleRoot.getPath();
... | [
"public",
"static",
"String",
"getFindBugsEnginePluginLocation",
"(",
")",
"{",
"// findbugs.home should be set to the directory the plugin is",
"// installed in.",
"URL",
"u",
"=",
"plugin",
".",
"getBundle",
"(",
")",
".",
"getEntry",
"(",
"\"/\"",
")",
";",
"try",
... | Find the filesystem path of the FindBugs plugin directory.
@return the filesystem path of the FindBugs plugin directory, or null if
the FindBugs plugin directory cannot be found | [
"Find",
"the",
"filesystem",
"path",
"of",
"the",
"FindBugs",
"plugin",
"directory",
"."
] | f6365c6eea6515035bded38efa4a7c8b46ccf28c | https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/eclipsePlugin/src/de/tobject/findbugs/FindbugsPlugin.java#L508-L530 | train |
spotbugs/spotbugs | eclipsePlugin/src/de/tobject/findbugs/FindbugsPlugin.java | FindbugsPlugin.logException | public void logException(Throwable e, String message) {
logMessage(IStatus.ERROR, message, e);
} | java | public void logException(Throwable e, String message) {
logMessage(IStatus.ERROR, message, e);
} | [
"public",
"void",
"logException",
"(",
"Throwable",
"e",
",",
"String",
"message",
")",
"{",
"logMessage",
"(",
"IStatus",
".",
"ERROR",
",",
"message",
",",
"e",
")",
";",
"}"
] | Log an exception.
@param e
the exception
@param message
message describing how/why the exception occurred | [
"Log",
"an",
"exception",
"."
] | f6365c6eea6515035bded38efa4a7c8b46ccf28c | https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/eclipsePlugin/src/de/tobject/findbugs/FindbugsPlugin.java#L548-L550 | train |
spotbugs/spotbugs | eclipsePlugin/src/de/tobject/findbugs/FindbugsPlugin.java | FindbugsPlugin.getBugCollectionFile | public static IPath getBugCollectionFile(IProject project) {
// IPath path = project.getWorkingLocation(PLUGIN_ID); //
// project-specific but not user-specific?
IPath path = getDefault().getStateLocation(); // user-specific but not
// project-specific
return path.append(project.... | java | public static IPath getBugCollectionFile(IProject project) {
// IPath path = project.getWorkingLocation(PLUGIN_ID); //
// project-specific but not user-specific?
IPath path = getDefault().getStateLocation(); // user-specific but not
// project-specific
return path.append(project.... | [
"public",
"static",
"IPath",
"getBugCollectionFile",
"(",
"IProject",
"project",
")",
"{",
"// IPath path = project.getWorkingLocation(PLUGIN_ID); //",
"// project-specific but not user-specific?",
"IPath",
"path",
"=",
"getDefault",
"(",
")",
".",
"getStateLocation",
"(",
")... | Get the file resource used to store findbugs warnings for a project.
@param project
the project
@return the IPath to the file (which may not actually exist in the
filesystem yet) | [
"Get",
"the",
"file",
"resource",
"used",
"to",
"store",
"findbugs",
"warnings",
"for",
"a",
"project",
"."
] | f6365c6eea6515035bded38efa4a7c8b46ccf28c | https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/eclipsePlugin/src/de/tobject/findbugs/FindbugsPlugin.java#L610-L616 | train |
spotbugs/spotbugs | eclipsePlugin/src/de/tobject/findbugs/FindbugsPlugin.java | FindbugsPlugin.getBugCollection | public static SortedBugCollection getBugCollection(IProject project, IProgressMonitor monitor)
throws CoreException {
SortedBugCollection bugCollection = (SortedBugCollection) project.getSessionProperty(SESSION_PROPERTY_BUG_COLLECTION);
if (bugCollection == null) {
try {
... | java | public static SortedBugCollection getBugCollection(IProject project, IProgressMonitor monitor)
throws CoreException {
SortedBugCollection bugCollection = (SortedBugCollection) project.getSessionProperty(SESSION_PROPERTY_BUG_COLLECTION);
if (bugCollection == null) {
try {
... | [
"public",
"static",
"SortedBugCollection",
"getBugCollection",
"(",
"IProject",
"project",
",",
"IProgressMonitor",
"monitor",
")",
"throws",
"CoreException",
"{",
"SortedBugCollection",
"bugCollection",
"=",
"(",
"SortedBugCollection",
")",
"project",
".",
"getSessionPro... | Get the stored BugCollection for project. If there is no stored bug
collection for the project, or if an error occurs reading the stored bug
collection, a default empty collection is created and returned.
@param project
the eclipse project
@param monitor
a progress monitor
@return the stored BugCollection, never null
... | [
"Get",
"the",
"stored",
"BugCollection",
"for",
"project",
".",
"If",
"there",
"is",
"no",
"stored",
"bug",
"collection",
"for",
"the",
"project",
"or",
"if",
"an",
"error",
"occurs",
"reading",
"the",
"stored",
"bug",
"collection",
"a",
"default",
"empty",
... | f6365c6eea6515035bded38efa4a7c8b46ccf28c | https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/eclipsePlugin/src/de/tobject/findbugs/FindbugsPlugin.java#L653-L669 | train |
spotbugs/spotbugs | eclipsePlugin/src/de/tobject/findbugs/FindbugsPlugin.java | FindbugsPlugin.readBugCollectionAndProject | private static void readBugCollectionAndProject(IProject project, IProgressMonitor monitor)
throws IOException, DocumentException, CoreException {
SortedBugCollection bugCollection;
IPath bugCollectionPath = getBugCollectionFile(project);
// Don't turn the path to an IFile because i... | java | private static void readBugCollectionAndProject(IProject project, IProgressMonitor monitor)
throws IOException, DocumentException, CoreException {
SortedBugCollection bugCollection;
IPath bugCollectionPath = getBugCollectionFile(project);
// Don't turn the path to an IFile because i... | [
"private",
"static",
"void",
"readBugCollectionAndProject",
"(",
"IProject",
"project",
",",
"IProgressMonitor",
"monitor",
")",
"throws",
"IOException",
",",
"DocumentException",
",",
"CoreException",
"{",
"SortedBugCollection",
"bugCollection",
";",
"IPath",
"bugCollect... | Read saved bug collection and findbugs project from file. Will populate
the bug collection and findbugs project session properties if successful.
If there is no saved bug collection and project for the eclipse project,
then FileNotFoundException will be thrown.
@param project
the eclipse project
@param monitor
a progr... | [
"Read",
"saved",
"bug",
"collection",
"and",
"findbugs",
"project",
"from",
"file",
".",
"Will",
"populate",
"the",
"bug",
"collection",
"and",
"findbugs",
"project",
"session",
"properties",
"if",
"successful",
".",
"If",
"there",
"is",
"no",
"saved",
"bug",
... | f6365c6eea6515035bded38efa4a7c8b46ccf28c | https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/eclipsePlugin/src/de/tobject/findbugs/FindbugsPlugin.java#L703-L729 | train |
spotbugs/spotbugs | eclipsePlugin/src/de/tobject/findbugs/FindbugsPlugin.java | FindbugsPlugin.storeBugCollection | public static void storeBugCollection(IProject project, final SortedBugCollection bugCollection, IProgressMonitor monitor)
throws IOException, CoreException {
// Store the bug collection and findbugs project in the session
project.setSessionProperty(SESSION_PROPERTY_BUG_COLLECTION, bugColle... | java | public static void storeBugCollection(IProject project, final SortedBugCollection bugCollection, IProgressMonitor monitor)
throws IOException, CoreException {
// Store the bug collection and findbugs project in the session
project.setSessionProperty(SESSION_PROPERTY_BUG_COLLECTION, bugColle... | [
"public",
"static",
"void",
"storeBugCollection",
"(",
"IProject",
"project",
",",
"final",
"SortedBugCollection",
"bugCollection",
",",
"IProgressMonitor",
"monitor",
")",
"throws",
"IOException",
",",
"CoreException",
"{",
"// Store the bug collection and findbugs project i... | Store a new bug collection for a project. The collection is stored in the
session, and also in a file in the project.
@param project
the project
@param bugCollection
the bug collection
@param monitor
progress monitor
@throws IOException
@throws CoreException | [
"Store",
"a",
"new",
"bug",
"collection",
"for",
"a",
"project",
".",
"The",
"collection",
"is",
"stored",
"in",
"the",
"session",
"and",
"also",
"in",
"a",
"file",
"in",
"the",
"project",
"."
] | f6365c6eea6515035bded38efa4a7c8b46ccf28c | https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/eclipsePlugin/src/de/tobject/findbugs/FindbugsPlugin.java#L744-L753 | train |
spotbugs/spotbugs | eclipsePlugin/src/de/tobject/findbugs/FindbugsPlugin.java | FindbugsPlugin.saveCurrentBugCollection | public static void saveCurrentBugCollection(IProject project, IProgressMonitor monitor) throws CoreException {
if (isBugCollectionDirty(project)) {
SortedBugCollection bugCollection = (SortedBugCollection) project.getSessionProperty(SESSION_PROPERTY_BUG_COLLECTION);
if (bugCollection !=... | java | public static void saveCurrentBugCollection(IProject project, IProgressMonitor monitor) throws CoreException {
if (isBugCollectionDirty(project)) {
SortedBugCollection bugCollection = (SortedBugCollection) project.getSessionProperty(SESSION_PROPERTY_BUG_COLLECTION);
if (bugCollection !=... | [
"public",
"static",
"void",
"saveCurrentBugCollection",
"(",
"IProject",
"project",
",",
"IProgressMonitor",
"monitor",
")",
"throws",
"CoreException",
"{",
"if",
"(",
"isBugCollectionDirty",
"(",
"project",
")",
")",
"{",
"SortedBugCollection",
"bugCollection",
"=",
... | If necessary, save current bug collection for project to disk.
@param project
the project
@param monitor
a progress monitor
@throws CoreException | [
"If",
"necessary",
"save",
"current",
"bug",
"collection",
"for",
"project",
"to",
"disk",
"."
] | f6365c6eea6515035bded38efa4a7c8b46ccf28c | https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/eclipsePlugin/src/de/tobject/findbugs/FindbugsPlugin.java#L764-L772 | train |
spotbugs/spotbugs | eclipsePlugin/src/de/tobject/findbugs/FindbugsPlugin.java | FindbugsPlugin.getProjectPreferences | public static UserPreferences getProjectPreferences(IProject project, boolean forceRead) {
try {
UserPreferences prefs = (UserPreferences) project.getSessionProperty(SESSION_PROPERTY_USERPREFS);
if (prefs == null || forceRead) {
prefs = readUserPreferences(project);
... | java | public static UserPreferences getProjectPreferences(IProject project, boolean forceRead) {
try {
UserPreferences prefs = (UserPreferences) project.getSessionProperty(SESSION_PROPERTY_USERPREFS);
if (prefs == null || forceRead) {
prefs = readUserPreferences(project);
... | [
"public",
"static",
"UserPreferences",
"getProjectPreferences",
"(",
"IProject",
"project",
",",
"boolean",
"forceRead",
")",
"{",
"try",
"{",
"UserPreferences",
"prefs",
"=",
"(",
"UserPreferences",
")",
"project",
".",
"getSessionProperty",
"(",
"SESSION_PROPERTY_US... | Get project own preferences set.
@param project
must be non null, exist and be opened
@param forceRead
@return current project preferences, independently if project preferences
are enabled or disabled for given project. | [
"Get",
"project",
"own",
"preferences",
"set",
"."
] | f6365c6eea6515035bded38efa4a7c8b46ccf28c | https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/eclipsePlugin/src/de/tobject/findbugs/FindbugsPlugin.java#L907-L922 | train |
spotbugs/spotbugs | eclipsePlugin/src/de/tobject/findbugs/FindbugsPlugin.java | FindbugsPlugin.saveUserPreferences | public static void saveUserPreferences(IProject project, final UserPreferences userPrefs) throws CoreException {
FileOutput userPrefsOutput = new FileOutput() {
@Override
public void writeFile(OutputStream os) throws IOException {
userPrefs.write(os);
}
... | java | public static void saveUserPreferences(IProject project, final UserPreferences userPrefs) throws CoreException {
FileOutput userPrefsOutput = new FileOutput() {
@Override
public void writeFile(OutputStream os) throws IOException {
userPrefs.write(os);
}
... | [
"public",
"static",
"void",
"saveUserPreferences",
"(",
"IProject",
"project",
",",
"final",
"UserPreferences",
"userPrefs",
")",
"throws",
"CoreException",
"{",
"FileOutput",
"userPrefsOutput",
"=",
"new",
"FileOutput",
"(",
")",
"{",
"@",
"Override",
"public",
"... | Save current UserPreferences for given project or workspace.
@param project
the project or null for workspace
@throws CoreException | [
"Save",
"current",
"UserPreferences",
"for",
"given",
"project",
"or",
"workspace",
"."
] | f6365c6eea6515035bded38efa4a7c8b46ccf28c | https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/eclipsePlugin/src/de/tobject/findbugs/FindbugsPlugin.java#L960-L1020 | train |
spotbugs/spotbugs | eclipsePlugin/src/de/tobject/findbugs/FindbugsPlugin.java | FindbugsPlugin.resetStore | private static void resetStore(IPreferenceStore store, String prefix) {
int start = 0;
// 99 is paranoia.
while(start < 99){
String name = prefix + start;
if(store.contains(name)){
store.setToDefault(name);
} else {
break;
... | java | private static void resetStore(IPreferenceStore store, String prefix) {
int start = 0;
// 99 is paranoia.
while(start < 99){
String name = prefix + start;
if(store.contains(name)){
store.setToDefault(name);
} else {
break;
... | [
"private",
"static",
"void",
"resetStore",
"(",
"IPreferenceStore",
"store",
",",
"String",
"prefix",
")",
"{",
"int",
"start",
"=",
"0",
";",
"// 99 is paranoia.",
"while",
"(",
"start",
"<",
"99",
")",
"{",
"String",
"name",
"=",
"prefix",
"+",
"start",
... | Removes all consequent enumerated keys from given store staring with given prefix | [
"Removes",
"all",
"consequent",
"enumerated",
"keys",
"from",
"given",
"store",
"staring",
"with",
"given",
"prefix"
] | f6365c6eea6515035bded38efa4a7c8b46ccf28c | https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/eclipsePlugin/src/de/tobject/findbugs/FindbugsPlugin.java#L1025-L1037 | train |
spotbugs/spotbugs | eclipsePlugin/src/de/tobject/findbugs/FindbugsPlugin.java | FindbugsPlugin.ensureReadWrite | private static void ensureReadWrite(IFile file) throws CoreException {
/*
* fix for bug 1683264: we should checkout file before writing to it
*/
if (file.isReadOnly()) {
IStatus checkOutStatus = ResourcesPlugin.getWorkspace().validateEdit(new IFile[] { file }, null);
... | java | private static void ensureReadWrite(IFile file) throws CoreException {
/*
* fix for bug 1683264: we should checkout file before writing to it
*/
if (file.isReadOnly()) {
IStatus checkOutStatus = ResourcesPlugin.getWorkspace().validateEdit(new IFile[] { file }, null);
... | [
"private",
"static",
"void",
"ensureReadWrite",
"(",
"IFile",
"file",
")",
"throws",
"CoreException",
"{",
"/*\n * fix for bug 1683264: we should checkout file before writing to it\n */",
"if",
"(",
"file",
".",
"isReadOnly",
"(",
")",
")",
"{",
"IStatus",
... | Ensure that a file is writable. If not currently writable, check it as so
that we can edit it.
@param file
- file that should be made writable
@throws CoreException | [
"Ensure",
"that",
"a",
"file",
"is",
"writable",
".",
"If",
"not",
"currently",
"writable",
"check",
"it",
"as",
"so",
"that",
"we",
"can",
"edit",
"it",
"."
] | f6365c6eea6515035bded38efa4a7c8b46ccf28c | https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/eclipsePlugin/src/de/tobject/findbugs/FindbugsPlugin.java#L1047-L1057 | train |
spotbugs/spotbugs | eclipsePlugin/src/de/tobject/findbugs/FindbugsPlugin.java | FindbugsPlugin.readUserPreferences | private static UserPreferences readUserPreferences(IProject project) throws CoreException {
IFile userPrefsFile = getUserPreferencesFile(project);
if (!userPrefsFile.exists()) {
return null;
}
try {
// force is preventing us for out-of-sync exception if file was
... | java | private static UserPreferences readUserPreferences(IProject project) throws CoreException {
IFile userPrefsFile = getUserPreferencesFile(project);
if (!userPrefsFile.exists()) {
return null;
}
try {
// force is preventing us for out-of-sync exception if file was
... | [
"private",
"static",
"UserPreferences",
"readUserPreferences",
"(",
"IProject",
"project",
")",
"throws",
"CoreException",
"{",
"IFile",
"userPrefsFile",
"=",
"getUserPreferencesFile",
"(",
"project",
")",
";",
"if",
"(",
"!",
"userPrefsFile",
".",
"exists",
"(",
... | Read UserPreferences for project from the file in the project directory.
Returns null if the preferences have not been saved to a file, or if
there is an error reading the preferences file.
@param project
the project to get the UserPreferences for
@return the UserPreferences, or null if the UserPreferences file could
... | [
"Read",
"UserPreferences",
"for",
"project",
"from",
"the",
"file",
"in",
"the",
"project",
"directory",
".",
"Returns",
"null",
"if",
"the",
"preferences",
"have",
"not",
"been",
"saved",
"to",
"a",
"file",
"or",
"if",
"there",
"is",
"an",
"error",
"readi... | f6365c6eea6515035bded38efa4a7c8b46ccf28c | https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/eclipsePlugin/src/de/tobject/findbugs/FindbugsPlugin.java#L1070-L1086 | train |
spotbugs/spotbugs | spotbugs/src/main/java/edu/umd/cs/findbugs/RecursiveFileSearch.java | RecursiveFileSearch.search | public RecursiveFileSearch search() throws InterruptedException {
File baseFile = new File(baseDir);
String basePath = bestEffortCanonicalPath(baseFile);
directoryWorkList.add(baseFile);
directoriesScanned.add(basePath);
directoriesScannedList.add(basePath);
while (!dire... | java | public RecursiveFileSearch search() throws InterruptedException {
File baseFile = new File(baseDir);
String basePath = bestEffortCanonicalPath(baseFile);
directoryWorkList.add(baseFile);
directoriesScanned.add(basePath);
directoriesScannedList.add(basePath);
while (!dire... | [
"public",
"RecursiveFileSearch",
"search",
"(",
")",
"throws",
"InterruptedException",
"{",
"File",
"baseFile",
"=",
"new",
"File",
"(",
"baseDir",
")",
";",
"String",
"basePath",
"=",
"bestEffortCanonicalPath",
"(",
"baseFile",
")",
";",
"directoryWorkList",
".",... | Perform the search.
@return this object
@throws InterruptedException
if the thread is interrupted before the search completes | [
"Perform",
"the",
"search",
"."
] | f6365c6eea6515035bded38efa4a7c8b46ccf28c | https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/RecursiveFileSearch.java#L83-L124 | train |
spotbugs/spotbugs | spotbugs/src/main/java/edu/umd/cs/findbugs/bcel/BCELUtil.java | BCELUtil.getMethodDescriptor | public static MethodDescriptor getMethodDescriptor(JavaClass jclass, Method method) {
return DescriptorFactory.instance().getMethodDescriptor(jclass.getClassName().replace('.', '/'), method.getName(),
method.getSignature(), method.isStatic());
} | java | public static MethodDescriptor getMethodDescriptor(JavaClass jclass, Method method) {
return DescriptorFactory.instance().getMethodDescriptor(jclass.getClassName().replace('.', '/'), method.getName(),
method.getSignature(), method.isStatic());
} | [
"public",
"static",
"MethodDescriptor",
"getMethodDescriptor",
"(",
"JavaClass",
"jclass",
",",
"Method",
"method",
")",
"{",
"return",
"DescriptorFactory",
".",
"instance",
"(",
")",
".",
"getMethodDescriptor",
"(",
"jclass",
".",
"getClassName",
"(",
")",
".",
... | Construct a MethodDescriptor from JavaClass and method.
@param jclass
a JavaClass
@param method
a Method belonging to the JavaClass
@return a MethodDescriptor identifying the method | [
"Construct",
"a",
"MethodDescriptor",
"from",
"JavaClass",
"and",
"method",
"."
] | f6365c6eea6515035bded38efa4a7c8b46ccf28c | https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/bcel/BCELUtil.java#L52-L55 | train |
spotbugs/spotbugs | spotbugs/src/main/java/edu/umd/cs/findbugs/bcel/BCELUtil.java | BCELUtil.getClassDescriptor | public static ClassDescriptor getClassDescriptor(JavaClass jclass) {
return DescriptorFactory.instance().getClassDescriptor(ClassName.toSlashedClassName(jclass.getClassName()));
} | java | public static ClassDescriptor getClassDescriptor(JavaClass jclass) {
return DescriptorFactory.instance().getClassDescriptor(ClassName.toSlashedClassName(jclass.getClassName()));
} | [
"public",
"static",
"ClassDescriptor",
"getClassDescriptor",
"(",
"JavaClass",
"jclass",
")",
"{",
"return",
"DescriptorFactory",
".",
"instance",
"(",
")",
".",
"getClassDescriptor",
"(",
"ClassName",
".",
"toSlashedClassName",
"(",
"jclass",
".",
"getClassName",
"... | Construct a ClassDescriptor from a JavaClass.
@param jclass
a JavaClass
@return a ClassDescriptor identifying that JavaClass | [
"Construct",
"a",
"ClassDescriptor",
"from",
"a",
"JavaClass",
"."
] | f6365c6eea6515035bded38efa4a7c8b46ccf28c | https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/bcel/BCELUtil.java#L64-L66 | train |
spotbugs/spotbugs | spotbugs/src/main/java/edu/umd/cs/findbugs/bcel/BCELUtil.java | BCELUtil.preTiger | public static boolean preTiger(JavaClass jclass) {
return jclass.getMajor() < JDK15_MAJOR || (jclass.getMajor() == JDK15_MAJOR && jclass.getMinor() < JDK15_MINOR);
} | java | public static boolean preTiger(JavaClass jclass) {
return jclass.getMajor() < JDK15_MAJOR || (jclass.getMajor() == JDK15_MAJOR && jclass.getMinor() < JDK15_MINOR);
} | [
"public",
"static",
"boolean",
"preTiger",
"(",
"JavaClass",
"jclass",
")",
"{",
"return",
"jclass",
".",
"getMajor",
"(",
")",
"<",
"JDK15_MAJOR",
"||",
"(",
"jclass",
".",
"getMajor",
"(",
")",
"==",
"JDK15_MAJOR",
"&&",
"jclass",
".",
"getMinor",
"(",
... | Checks if classfile was compiled for pre 1.5 target | [
"Checks",
"if",
"classfile",
"was",
"compiled",
"for",
"pre",
"1",
".",
"5",
"target"
] | f6365c6eea6515035bded38efa4a7c8b46ccf28c | https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/bcel/BCELUtil.java#L75-L78 | train |
spotbugs/spotbugs | spotbugs/src/main/java/edu/umd/cs/findbugs/Plugin.java | Plugin.addBugCategory | public void addBugCategory(BugCategory bugCategory) {
BugCategory old = bugCategories.get(bugCategory.getCategory());
if (old != null) {
throw new IllegalArgumentException("Category already exists");
}
bugCategories.put(bugCategory.getCategory(), bugCategory);
} | java | public void addBugCategory(BugCategory bugCategory) {
BugCategory old = bugCategories.get(bugCategory.getCategory());
if (old != null) {
throw new IllegalArgumentException("Category already exists");
}
bugCategories.put(bugCategory.getCategory(), bugCategory);
} | [
"public",
"void",
"addBugCategory",
"(",
"BugCategory",
"bugCategory",
")",
"{",
"BugCategory",
"old",
"=",
"bugCategories",
".",
"get",
"(",
"bugCategory",
".",
"getCategory",
"(",
")",
")",
";",
"if",
"(",
"old",
"!=",
"null",
")",
"{",
"throw",
"new",
... | Add a BugCategory reported by the Plugin.
@param bugCategory | [
"Add",
"a",
"BugCategory",
"reported",
"by",
"the",
"Plugin",
"."
] | f6365c6eea6515035bded38efa4a7c8b46ccf28c | https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/Plugin.java#L272-L278 | train |
spotbugs/spotbugs | spotbugs/src/main/java/edu/umd/cs/findbugs/Plugin.java | Plugin.getFactoryByShortName | public DetectorFactory getFactoryByShortName(final String shortName) {
return findFirstMatchingFactory(factory -> factory.getShortName().equals(shortName));
} | java | public DetectorFactory getFactoryByShortName(final String shortName) {
return findFirstMatchingFactory(factory -> factory.getShortName().equals(shortName));
} | [
"public",
"DetectorFactory",
"getFactoryByShortName",
"(",
"final",
"String",
"shortName",
")",
"{",
"return",
"findFirstMatchingFactory",
"(",
"factory",
"->",
"factory",
".",
"getShortName",
"(",
")",
".",
"equals",
"(",
"shortName",
")",
")",
";",
"}"
] | Look up a DetectorFactory by short name.
@param shortName
the short name
@return the DetectorFactory | [
"Look",
"up",
"a",
"DetectorFactory",
"by",
"short",
"name",
"."
] | f6365c6eea6515035bded38efa4a7c8b46ccf28c | https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/Plugin.java#L317-L319 | train |
spotbugs/spotbugs | spotbugs/src/main/java/edu/umd/cs/findbugs/Plugin.java | Plugin.getFactoryByFullName | public DetectorFactory getFactoryByFullName(final String fullName) {
return findFirstMatchingFactory(factory -> factory.getFullName().equals(fullName));
} | java | public DetectorFactory getFactoryByFullName(final String fullName) {
return findFirstMatchingFactory(factory -> factory.getFullName().equals(fullName));
} | [
"public",
"DetectorFactory",
"getFactoryByFullName",
"(",
"final",
"String",
"fullName",
")",
"{",
"return",
"findFirstMatchingFactory",
"(",
"factory",
"->",
"factory",
".",
"getFullName",
"(",
")",
".",
"equals",
"(",
"fullName",
")",
")",
";",
"}"
] | Look up a DetectorFactory by full name.
@param fullName
the full name
@return the DetectorFactory | [
"Look",
"up",
"a",
"DetectorFactory",
"by",
"full",
"name",
"."
] | f6365c6eea6515035bded38efa4a7c8b46ccf28c | https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/Plugin.java#L328-L330 | train |
spotbugs/spotbugs | spotbugs/src/main/java/edu/umd/cs/findbugs/ba/jsr305/DirectlyRelevantTypeQualifiersDatabase.java | DirectlyRelevantTypeQualifiersDatabase.getDirectlyRelevantTypeQualifiers | public Collection<TypeQualifierValue<?>> getDirectlyRelevantTypeQualifiers(MethodDescriptor m) {
Collection<TypeQualifierValue<?>> result = methodToDirectlyRelevantQualifiersMap.get(m);
if (result != null) {
return result;
}
return Collections.<TypeQualifierValue<?>> emptyLis... | java | public Collection<TypeQualifierValue<?>> getDirectlyRelevantTypeQualifiers(MethodDescriptor m) {
Collection<TypeQualifierValue<?>> result = methodToDirectlyRelevantQualifiersMap.get(m);
if (result != null) {
return result;
}
return Collections.<TypeQualifierValue<?>> emptyLis... | [
"public",
"Collection",
"<",
"TypeQualifierValue",
"<",
"?",
">",
">",
"getDirectlyRelevantTypeQualifiers",
"(",
"MethodDescriptor",
"m",
")",
"{",
"Collection",
"<",
"TypeQualifierValue",
"<",
"?",
">",
">",
"result",
"=",
"methodToDirectlyRelevantQualifiersMap",
"."... | Get the directly-relevant type qualifiers applied to given method.
@param m
MethodDescriptor identifying a method
@return Collection of type qualifiers applied directly to that method | [
"Get",
"the",
"directly",
"-",
"relevant",
"type",
"qualifiers",
"applied",
"to",
"given",
"method",
"."
] | f6365c6eea6515035bded38efa4a7c8b46ccf28c | https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/ba/jsr305/DirectlyRelevantTypeQualifiersDatabase.java#L58-L64 | train |
spotbugs/spotbugs | spotbugs/src/main/java/edu/umd/cs/findbugs/ba/jsr305/DirectlyRelevantTypeQualifiersDatabase.java | DirectlyRelevantTypeQualifiersDatabase.setDirectlyRelevantTypeQualifiers | public void setDirectlyRelevantTypeQualifiers(MethodDescriptor methodDescriptor, Collection<TypeQualifierValue<?>> qualifiers) {
methodToDirectlyRelevantQualifiersMap.put(methodDescriptor, qualifiers);
allKnownQualifiers.addAll(qualifiers);
} | java | public void setDirectlyRelevantTypeQualifiers(MethodDescriptor methodDescriptor, Collection<TypeQualifierValue<?>> qualifiers) {
methodToDirectlyRelevantQualifiersMap.put(methodDescriptor, qualifiers);
allKnownQualifiers.addAll(qualifiers);
} | [
"public",
"void",
"setDirectlyRelevantTypeQualifiers",
"(",
"MethodDescriptor",
"methodDescriptor",
",",
"Collection",
"<",
"TypeQualifierValue",
"<",
"?",
">",
">",
"qualifiers",
")",
"{",
"methodToDirectlyRelevantQualifiersMap",
".",
"put",
"(",
"methodDescriptor",
",",... | Set the collection of directly-relevant type qualifiers for a given
method.
@param methodDescriptor
MethodDescriptor identifying a method
@param qualifiers
collection of directly-relevant type qualifiers for the method | [
"Set",
"the",
"collection",
"of",
"directly",
"-",
"relevant",
"type",
"qualifiers",
"for",
"a",
"given",
"method",
"."
] | f6365c6eea6515035bded38efa4a7c8b46ccf28c | https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/ba/jsr305/DirectlyRelevantTypeQualifiersDatabase.java#L84-L87 | train |
spotbugs/spotbugs | spotbugs/src/main/java/edu/umd/cs/findbugs/detect/InheritanceUnsafeGetResource.java | InheritanceUnsafeGetResource.adjustPriority | private int adjustPriority(int priority) {
try {
Subtypes2 subtypes2 = AnalysisContext.currentAnalysisContext().getSubtypes2();
if (!subtypes2.hasSubtypes(getClassDescriptor())) {
priority++;
} else {
Set<ClassDescriptor> mySubtypes = subtype... | java | private int adjustPriority(int priority) {
try {
Subtypes2 subtypes2 = AnalysisContext.currentAnalysisContext().getSubtypes2();
if (!subtypes2.hasSubtypes(getClassDescriptor())) {
priority++;
} else {
Set<ClassDescriptor> mySubtypes = subtype... | [
"private",
"int",
"adjustPriority",
"(",
"int",
"priority",
")",
"{",
"try",
"{",
"Subtypes2",
"subtypes2",
"=",
"AnalysisContext",
".",
"currentAnalysisContext",
"(",
")",
".",
"getSubtypes2",
"(",
")",
";",
"if",
"(",
"!",
"subtypes2",
".",
"hasSubtypes",
... | Adjust the priority of a warning about to be reported.
@param priority
initial priority
@return adjusted priority | [
"Adjust",
"the",
"priority",
"of",
"a",
"warning",
"about",
"to",
"be",
"reported",
"."
] | f6365c6eea6515035bded38efa4a7c8b46ccf28c | https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/detect/InheritanceUnsafeGetResource.java#L136-L162 | train |
spotbugs/spotbugs | spotbugs/src/main/java/edu/umd/cs/findbugs/DetectorFactoryCollection.java | DetectorFactoryCollection.registerDetector | void registerDetector(DetectorFactory factory) {
if (FindBugs.DEBUG) {
System.out.println("Registering detector: " + factory.getFullName());
}
String detectorName = factory.getShortName();
if(!factoryList.contains(factory)) {
factoryList.add(factory);
} el... | java | void registerDetector(DetectorFactory factory) {
if (FindBugs.DEBUG) {
System.out.println("Registering detector: " + factory.getFullName());
}
String detectorName = factory.getShortName();
if(!factoryList.contains(factory)) {
factoryList.add(factory);
} el... | [
"void",
"registerDetector",
"(",
"DetectorFactory",
"factory",
")",
"{",
"if",
"(",
"FindBugs",
".",
"DEBUG",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"\"Registering detector: \"",
"+",
"factory",
".",
"getFullName",
"(",
")",
")",
";",
"}",
"S... | Register a DetectorFactory. | [
"Register",
"a",
"DetectorFactory",
"."
] | f6365c6eea6515035bded38efa4a7c8b46ccf28c | https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/DetectorFactoryCollection.java#L268-L281 | train |
spotbugs/spotbugs | spotbugs/src/main/java/edu/umd/cs/findbugs/DetectorFactoryCollection.java | DetectorFactoryCollection.lookupBugPattern | public @CheckForNull BugPattern lookupBugPattern(String bugType) {
if (bugType == null) {
return null;
}
return bugPatternMap.get(bugType);
} | java | public @CheckForNull BugPattern lookupBugPattern(String bugType) {
if (bugType == null) {
return null;
}
return bugPatternMap.get(bugType);
} | [
"public",
"@",
"CheckForNull",
"BugPattern",
"lookupBugPattern",
"(",
"String",
"bugType",
")",
"{",
"if",
"(",
"bugType",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"return",
"bugPatternMap",
".",
"get",
"(",
"bugType",
")",
";",
"}"
] | Look up bug pattern.
@param bugType
the bug type for the bug pattern
@return the BugPattern, or null if it can't be found | [
"Look",
"up",
"bug",
"pattern",
"."
] | f6365c6eea6515035bded38efa4a7c8b46ccf28c | https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/DetectorFactoryCollection.java#L475-L480 | train |
spotbugs/spotbugs | spotbugs/src/main/java/edu/umd/cs/findbugs/DetectorFactoryCollection.java | DetectorFactoryCollection.getBugCategories | public Collection<String> getBugCategories() {
ArrayList<String> result = new ArrayList<>(categoryDescriptionMap.size());
for(BugCategory c : categoryDescriptionMap.values()) {
if (!c.isHidden()) {
result.add(c.getCategory());
}
}
return result;
... | java | public Collection<String> getBugCategories() {
ArrayList<String> result = new ArrayList<>(categoryDescriptionMap.size());
for(BugCategory c : categoryDescriptionMap.values()) {
if (!c.isHidden()) {
result.add(c.getCategory());
}
}
return result;
... | [
"public",
"Collection",
"<",
"String",
">",
"getBugCategories",
"(",
")",
"{",
"ArrayList",
"<",
"String",
">",
"result",
"=",
"new",
"ArrayList",
"<>",
"(",
"categoryDescriptionMap",
".",
"size",
"(",
")",
")",
";",
"for",
"(",
"BugCategory",
"c",
":",
... | Get a Collection containing all known bug category keys. E.g.,
"CORRECTNESS", "MT_CORRECTNESS", "PERFORMANCE", etc.
Excludes hidden bug categories
@return Collection of bug category keys. | [
"Get",
"a",
"Collection",
"containing",
"all",
"known",
"bug",
"category",
"keys",
".",
"E",
".",
"g",
".",
"CORRECTNESS",
"MT_CORRECTNESS",
"PERFORMANCE",
"etc",
"."
] | f6365c6eea6515035bded38efa4a7c8b46ccf28c | https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/DetectorFactoryCollection.java#L539-L547 | train |
spotbugs/spotbugs | spotbugs/src/main/java/edu/umd/cs/findbugs/detect/FindInconsistentSync2.java | FindInconsistentSync2.isGetterMethod | public static boolean isGetterMethod(ClassContext classContext, Method method) {
MethodGen methodGen = classContext.getMethodGen(method);
if (methodGen == null) {
return false;
}
InstructionList il = methodGen.getInstructionList();
// System.out.println("Checking gett... | java | public static boolean isGetterMethod(ClassContext classContext, Method method) {
MethodGen methodGen = classContext.getMethodGen(method);
if (methodGen == null) {
return false;
}
InstructionList il = methodGen.getInstructionList();
// System.out.println("Checking gett... | [
"public",
"static",
"boolean",
"isGetterMethod",
"(",
"ClassContext",
"classContext",
",",
"Method",
"method",
")",
"{",
"MethodGen",
"methodGen",
"=",
"classContext",
".",
"getMethodGen",
"(",
"method",
")",
";",
"if",
"(",
"methodGen",
"==",
"null",
")",
"{"... | Determine whether or not the the given method is a getter method. I.e.,
if it just returns the value of an instance field.
@param classContext
the ClassContext for the class containing the method
@param method
the method | [
"Determine",
"whether",
"or",
"not",
"the",
"the",
"given",
"method",
"is",
"a",
"getter",
"method",
".",
"I",
".",
"e",
".",
"if",
"it",
"just",
"returns",
"the",
"value",
"of",
"an",
"instance",
"field",
"."
] | f6365c6eea6515035bded38efa4a7c8b46ccf28c | https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/detect/FindInconsistentSync2.java#L813-L865 | train |
spotbugs/spotbugs | spotbugs/src/main/java/edu/umd/cs/findbugs/detect/FindInconsistentSync2.java | FindInconsistentSync2.getStats | private FieldStats getStats(XField field) {
FieldStats stats = statMap.get(field);
if (stats == null) {
stats = new FieldStats(field);
statMap.put(field, stats);
}
return stats;
} | java | private FieldStats getStats(XField field) {
FieldStats stats = statMap.get(field);
if (stats == null) {
stats = new FieldStats(field);
statMap.put(field, stats);
}
return stats;
} | [
"private",
"FieldStats",
"getStats",
"(",
"XField",
"field",
")",
"{",
"FieldStats",
"stats",
"=",
"statMap",
".",
"get",
"(",
"field",
")",
";",
"if",
"(",
"stats",
"==",
"null",
")",
"{",
"stats",
"=",
"new",
"FieldStats",
"(",
"field",
")",
";",
"... | Get the access statistics for given field. | [
"Get",
"the",
"access",
"statistics",
"for",
"given",
"field",
"."
] | f6365c6eea6515035bded38efa4a7c8b46ccf28c | https://github.com/spotbugs/spotbugs/blob/f6365c6eea6515035bded38efa4a7c8b46ccf28c/spotbugs/src/main/java/edu/umd/cs/findbugs/detect/FindInconsistentSync2.java#L870-L877 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.