_id
stringlengths
2
7
title
stringlengths
3
140
partition
stringclasses
3 values
text
stringlengths
73
34.1k
language
stringclasses
1 value
meta_information
dict
q22400
PoiWriter.complete
train
public void complete() { if (this.configuration.isGeoTags()) { this.geoTagger.processBoundaries(); } NumberFormat nfMegabyte = NumberFormat.getInstance(); nfMegabyte.setMaximumFractionDigits(2); try { commit(); if (this.configuration.isFilterC...
java
{ "resource": "" }
q22401
PoiWriter.filterCategories
train
private void filterCategories() throws SQLException { LOGGER.info("Filtering categories..."); PreparedStatement pStmtChildren = this.conn.prepareStatement("SELECT COUNT(*) FROM poi_categories WHERE parent = ?;"); PreparedStatement pStmtPoi = this.conn.prepareStatement("SELECT COUNT(*) FROM poi_c...
java
{ "resource": "" }
q22402
PoiWriter.findWayNodesByWayID
train
List<Long> findWayNodesByWayID(long id) { try { this.pStmtWayNodesR.setLong(1, id); ResultSet rs = this.pStmtWayNodesR.executeQuery(); Map<Integer, Long> nodeList = new TreeMap<>(); while (rs.next()) { // way, node, position Long n...
java
{ "resource": "" }
q22403
PoiWriter.getTagValue
train
String getTagValue(Collection<Tag> tags, String key) { for (Tag tag : tags) { if (tag.getKey().toLowerCase(Locale.ENGLISH).equals(key.toLowerCase(Locale.ENGLISH))) { return tag.getValue(); } } return null; }
java
{ "resource": "" }
q22404
PoiWriter.postProcess
train
private void postProcess() throws SQLException { LOGGER.info("Post-processing..."); this.conn = DriverManager.getConnection("jdbc:sqlite:" + this.configuration.getOutputFile().getAbsolutePath()); this.conn.createStatement().execute(DbConstants.DROP_NODES_STATEMENT); this.conn.createStat...
java
{ "resource": "" }
q22405
PoiWriter.prepareDatabase
train
private void prepareDatabase() throws ClassNotFoundException, SQLException, UnknownPoiCategoryException { Class.forName("org.sqlite.JDBC"); this.conn = DriverManager.getConnection("jdbc:sqlite:" + this.configuration.getOutputFile().getAbsolutePath()); this.conn.setAutoCommit(false); Sta...
java
{ "resource": "" }
q22406
PoiWriter.process
train
public void process(EntityContainer entityContainer) { Entity entity = entityContainer.getEntity(); LOGGER.finest("Processing entity: " + entity.toString()); switch (entity.getType()) { case Node: Node node = (Node) entity; if (this.nNodes == 0) { ...
java
{ "resource": "" }
q22407
PoiWriter.stringToTags
train
Map<String, String> stringToTags(String tagsmapstring) { String[] sb = tagsmapstring.split("\\r"); Map<String, String> map = new HashMap<>(); for (String key : sb) { if (key.contains("=")) { String[] set = key.split("="); if (set.length == 2) ...
java
{ "resource": "" }
q22408
PoiWriter.tagsToString
train
String tagsToString(Map<String, String> tagMap) { StringBuilder sb = new StringBuilder(); for (String key : tagMap.keySet()) { // Skip some tags if (key.equalsIgnoreCase("created_by")) { continue; } if (sb.length() > 0) { sb...
java
{ "resource": "" }
q22409
PoiWriter.writeMetadata
train
private void writeMetadata() throws SQLException { LOGGER.info("Writing metadata..."); PreparedStatement pStmtMetadata = this.conn.prepareStatement(DbConstants.INSERT_METADATA_STATEMENT); // Bounds pStmtMetadata.setString(1, DbConstants.METADATA_BOUNDS); BoundingBox bb = this.co...
java
{ "resource": "" }
q22410
PoiWriter.writePOI
train
private void writePOI(long id, double latitude, double longitude, Map<String, String> poiData, Set<PoiCategory> categories) { try { // Index data this.pStmtIndex.setLong(1, id); this.pStmtIndex.setDouble(2, latitude); this.pStmtIndex.setDouble(3, latitude); ...
java
{ "resource": "" }
q22411
Tag.compareTo
train
@Override public int compareTo(Tag tag) { int keyResult = this.key.compareTo(tag.key); if (keyResult != 0) { return keyResult; } return this.value.compareTo(tag.value); }
java
{ "resource": "" }
q22412
Rectangle.enlarge
train
public Rectangle enlarge(double left, double top, double right, double bottom) { return new Rectangle(this.left - left, this.top - top, this.right + right, this.bottom + bottom); }
java
{ "resource": "" }
q22413
DualMapViewer.createLayers2
train
protected void createLayers2() { this.mapView2.getLayerManager() .getLayers().add(AndroidUtil.createTileRendererLayer(this.tileCaches.get(1), this.mapView2.getModel().mapViewPosition, getMapFile2(), getRenderTheme2(), false, true, false)); }
java
{ "resource": "" }
q22414
Samples.startupDialog
train
private void startupDialog(String prefs, int message, final Class clazz) { final SharedPreferences preferences = getSharedPreferences(prefs, Activity.MODE_PRIVATE); final String accepted = "accepted"; if (!preferences.getBoolean(accepted, false)) { AlertDialog.Builder builder = new A...
java
{ "resource": "" }
q22415
MapElementContainer.compareTo
train
@Override public int compareTo(MapElementContainer other) { if (this.priority < other.priority) { return -1; } if (this.priority > other.priority) { return 1; } return 0; }
java
{ "resource": "" }
q22416
MapElementContainer.clashesWith
train
public boolean clashesWith(MapElementContainer other) { // if either of the elements is always drawn, the elements do not clash if (Display.ALWAYS == this.display || Display.ALWAYS == other.display) { return false; } return this.getBoundaryAbsolute().intersects(other.getBound...
java
{ "resource": "" }
q22417
OSMUtils.extractKnownPOITags
train
public static Map<Short, Object> extractKnownPOITags(Entity entity) { Map<Short, Object> tagMap = new HashMap<>(); OSMTagMapping mapping = OSMTagMapping.getInstance(); if (entity.getTags() != null) { for (Tag tag : entity.getTags()) { OSMTag poiTag = mapping.getPoiTag...
java
{ "resource": "" }
q22418
OSMUtils.extractKnownWayTags
train
public static Map<Short, Object> extractKnownWayTags(Entity entity) { Map<Short, Object> tagMap = new HashMap<>(); OSMTagMapping mapping = OSMTagMapping.getInstance(); if (entity.getTags() != null) { for (Tag tag : entity.getTags()) { OSMTag wayTag = mapping.getWayTag...
java
{ "resource": "" }
q22419
DatabaseRenderer.createBackgroundBitmap
train
private TileBitmap createBackgroundBitmap(RenderContext renderContext) { TileBitmap bitmap = this.graphicFactory.createTileBitmap(renderContext.rendererJob.tile.tileSize, renderContext.rendererJob.hasAlpha); renderContext.canvasRasterer.setCanvasBitmap(bitmap); if (!renderContext.rendererJob.has...
java
{ "resource": "" }
q22420
AndroidUtil.createExternalStorageTileCache
train
public static TileCache createExternalStorageTileCache(Context c, String id, int firstLevelSize, int tileSize) { return createExternalStorageTileCache(c, id, firstLevelSize, tileSize, false); }
java
{ "resource": "" }
q22421
AndroidUtil.createTileCache
train
public static TileCache createTileCache(Context c, String id, int tileSize, float screenRatio, double overdraw) { return createTileCache(c, id, tileSize, screenRatio, overdraw, false); }
java
{ "resource": "" }
q22422
AndroidUtil.createTileCache
train
public static TileCache createTileCache(Context c, String id, int tileSize, int width, int height, double overdraw) { return createTileCache(c, id, tileSize, width, height, overdraw, false); }
java
{ "resource": "" }
q22423
AndroidUtil.getAvailableCacheSlots
train
@SuppressWarnings("deprecation") @TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR2) public static long getAvailableCacheSlots(String directory, int fileSize) { StatFs statfs = new StatFs(directory); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) { return statfs.getAvail...
java
{ "resource": "" }
q22424
AndroidUtil.getMinimumCacheSize
train
@SuppressWarnings("deprecation") @TargetApi(Build.VERSION_CODES.HONEYCOMB_MR2) public static int getMinimumCacheSize(Context c, int tileSize, double overdrawFactor, float screenRatio) { WindowManager wm = (WindowManager) c.getSystemService(Context.WINDOW_SERVICE); Display display = wm.getDefault...
java
{ "resource": "" }
q22425
AndroidUtil.getMinimumCacheSize
train
public static int getMinimumCacheSize(int tileSize, double overdrawFactor, int width, int height) { // height * overdrawFactor / tileSize calculates the number of tiles that would cover // the view port, adding 1 is required since we can have part tiles on either side, // adding 2 adds another r...
java
{ "resource": "" }
q22426
AndroidUtil.setMapScaleBar
train
public static void setMapScaleBar(MapView mapView, DistanceUnitAdapter primaryDistanceUnitAdapter, DistanceUnitAdapter secondaryDistanceUnitAdapter) { if (null == primaryDistanceUnitAdapter && null == secondaryDistanceUnitAdapter) { ...
java
{ "resource": "" }
q22427
ManyDummyContent.loadXmlFromNetwork
train
private List<DummyItem> loadXmlFromNetwork(String urlString) throws IOException { String jString; // Instantiate the parser List<Entry> entries = null; List<DummyItem> rtnArray = new ArrayList<DummyItem>(); BufferedReader streamReader = null; try { streamReade...
java
{ "resource": "" }
q22428
ManyDummyContent.downloadUrl
train
private InputStreamReader downloadUrl(String urlString) throws IOException { URL url = new URL(urlString); HttpURLConnection conn = (HttpURLConnection) url.openConnection(); conn.setReadTimeout(10000 /* milliseconds */); conn.setConnectTimeout(15000 /* milliseconds */); conn.setR...
java
{ "resource": "" }
q22429
InMemoryTileCache.setCapacity
train
public synchronized void setCapacity(int capacity) { BitmapLRUCache lruCacheNew = new BitmapLRUCache(capacity); lruCacheNew.putAll(this.lruCache); this.lruCache = lruCacheNew; }
java
{ "resource": "" }
q22430
LayerUtil.getUpperLeft
train
public static Tile getUpperLeft(BoundingBox boundingBox, byte zoomLevel, int tileSize) { int tileLeft = MercatorProjection.longitudeToTileX(boundingBox.minLongitude, zoomLevel); int tileTop = MercatorProjection.latitudeToTileY(boundingBox.maxLatitude, zoomLevel); return new Tile(tileLeft, tileTo...
java
{ "resource": "" }
q22431
LayerUtil.getLowerRight
train
public static Tile getLowerRight(BoundingBox boundingBox, byte zoomLevel, int tileSize) { int tileRight = MercatorProjection.longitudeToTileX(boundingBox.maxLongitude, zoomLevel); int tileBottom = MercatorProjection.latitudeToTileY(boundingBox.minLatitude, zoomLevel); return new Tile(tileRight, ...
java
{ "resource": "" }
q22432
LayerUtil.collisionFreeOrdered
train
public static List<MapElementContainer> collisionFreeOrdered(List<MapElementContainer> input) { // sort items by priority (highest first) Collections.sort(input, Collections.reverseOrder()); // in order of priority, see if an item can be drawn, i.e. none of the items // in the currentIte...
java
{ "resource": "" }
q22433
XmlUtils.inputStreamFromFile
train
private static InputStream inputStreamFromFile(String relativePathPrefix, String src) throws IOException { File file = getFile(relativePathPrefix, src); if (!file.exists()) { if (src.length() > 0 && src.charAt(0) == File.separatorChar) { file = getFile(relativePathPrefix, src...
java
{ "resource": "" }
q22434
XmlUtils.inputStreamFromJar
train
private static InputStream inputStreamFromJar(String relativePathPrefix, String src) throws IOException { String absoluteName = getAbsoluteName(relativePathPrefix, src); return XmlUtils.class.getResourceAsStream(absoluteName); }
java
{ "resource": "" }
q22435
Layers.add
train
public synchronized void add(int index, Layer layer, boolean redraw) { checkIsNull(layer); layer.setDisplayModel(this.displayModel); this.layersList.add(index, layer); layer.assign(this.redrawer); if (redraw) { this.redrawer.redrawLayers(); } }
java
{ "resource": "" }
q22436
Layers.addAll
train
public synchronized void addAll(Collection<Layer> layers, boolean redraw) { checkIsNull(layers); for (Layer layer : layers) { layer.setDisplayModel(this.displayModel); } this.layersList.addAll(layers); for (Layer layer : layers) { layer.assign(this.redrawe...
java
{ "resource": "" }
q22437
Layers.clear
train
public synchronized void clear(boolean redraw) { for (Layer layer : this.layersList) { layer.unassign(); } this.layersList.clear(); if (redraw) { this.redrawer.redrawLayers(); } }
java
{ "resource": "" }
q22438
SQLiteQuery.fillWindow
train
int fillWindow(CursorWindow window, int startPos, int requiredPos, boolean countAllRows) { acquireReference(); try { window.acquireReference(); try { int numRows = getSession().executeForCursorWindow(getSql(), getBindArgs(), window, startPo...
java
{ "resource": "" }
q22439
TileDependencies.getOverlappingElements
train
Set<MapElementContainer> getOverlappingElements(Tile from, Tile to) { if (overlapData.containsKey(from) && overlapData.get(from).containsKey(to)) { return overlapData.get(from).get(to); } return new HashSet<MapElementContainer>(0); }
java
{ "resource": "" }
q22440
TileDependencies.removeTileData
train
void removeTileData(Tile from, Tile to) { if (overlapData.containsKey(from)) { overlapData.get(from).remove(to); } }
java
{ "resource": "" }
q22441
MapViewProjection.fromPixels
train
public LatLong fromPixels(double x, double y) { if (this.mapView.getWidth() <= 0 || this.mapView.getHeight() <= 0) { return null; } // this uses the framebuffer position, the mapview position can be out of sync with // what the user sees on the screen if an animation is in p...
java
{ "resource": "" }
q22442
MapViewProjection.getLatitudeSpan
train
public double getLatitudeSpan() { if (this.mapView.getWidth() > 0 && this.mapView.getHeight() > 0) { LatLong top = fromPixels(0, 0); LatLong bottom = fromPixels(0, this.mapView.getHeight()); return Math.abs(top.latitude - bottom.latitude); } throw new IllegalS...
java
{ "resource": "" }
q22443
MapViewProjection.getLongitudeSpan
train
public double getLongitudeSpan() { if (this.mapView.getWidth() > 0 && this.mapView.getHeight() > 0) { LatLong left = fromPixels(0, 0); LatLong right = fromPixels(this.mapView.getWidth(), 0); return Math.abs(left.longitude - right.longitude); } throw new Illega...
java
{ "resource": "" }
q22444
LineSegment.angleTo
train
public double angleTo(LineSegment other) { double angle1 = Math.atan2(this.start.y - this.end.y, this.start.x - this.end.x); double angle2 = Math.atan2(other.start.y - other.end.y, other.start.x - other.end.x); double angle = Math.toDegrees(angle1 - angle2); if (angle <= -180) { ...
java
{ "resource": "" }
q22445
LineSegment.intersectsRectangle
train
public boolean intersectsRectangle(Rectangle r, boolean bias) { int codeStart = code(r, this.start); int codeEnd = code(r, this.end); if (0 == (codeStart | codeEnd)) { // both points are inside, trivial case return true; } else if (0 != (codeStart & codeEnd)) { ...
java
{ "resource": "" }
q22446
LineSegment.pointAlongLineSegment
train
public Point pointAlongLineSegment(double distance) { if (start.x == end.x) { // we have a vertical line if (start.y > end.y) { return new Point(end.x, end.y + distance); } else { return new Point(start.x, start.y + distance); } ...
java
{ "resource": "" }
q22447
LineSegment.subSegment
train
public LineSegment subSegment(double offset, double length) { Point subSegmentStart = pointAlongLineSegment(offset); Point subSegmentEnd = pointAlongLineSegment(offset + length); return new LineSegment(subSegmentStart, subSegmentEnd); }
java
{ "resource": "" }
q22448
ReadBuffer.readFromFile
train
public boolean readFromFile(int length) throws IOException { // ensure that the read buffer is large enough if (this.bufferData == null || this.bufferData.length < length) { // ensure that the read buffer is not too large if (length > Parameters.MAXIMUM_BUFFER_SIZE) { ...
java
{ "resource": "" }
q22449
ReadBuffer.readUTF8EncodedString
train
public String readUTF8EncodedString(int stringLength) { if (stringLength > 0 && this.bufferPosition + stringLength <= this.bufferData.length) { this.bufferPosition += stringLength; try { return new String(this.bufferData, this.bufferPosition - stringLength, stringLength, ...
java
{ "resource": "" }
q22450
CanvasRasterer.fillOutsideAreas
train
void fillOutsideAreas(int color, Rectangle insideArea) { this.canvas.setClipDifference((int) insideArea.left, (int) insideArea.top, (int) insideArea.getWidth(), (int) insideArea.getHeight()); this.canvas.fillColor(color); this.canvas.resetClip(); }
java
{ "resource": "" }
q22451
DiffuseLightShadingAlgorithm.calculateRaw
train
double calculateRaw(double n, double e) { // calculate the distance of the normal vector to a plane orthogonal to the light source and passing through zero, // the fraction of distance to vector lenght is proportional to the amount of light that would be hitting a disc // orthogonal to the norma...
java
{ "resource": "" }
q22452
IndexCache.getIndexEntry
train
long getIndexEntry(SubFileParameter subFileParameter, long blockNumber) throws IOException { // check if the block number is out of bounds if (blockNumber >= subFileParameter.numberOfBlocks) { throw new IOException("invalid block number: " + blockNumber); } // calculate the ...
java
{ "resource": "" }
q22453
PoiCategoryRangeQueryGenerator.getSQLWhereClauseString
train
private static String getSQLWhereClauseString(PoiCategoryFilter filter, int version) { Collection<PoiCategory> superCategories = filter.getAcceptedSuperCategories(); if (superCategories.isEmpty()) { return ""; } StringBuilder sb = new StringBuilder(); sb.append(" AN...
java
{ "resource": "" }
q22454
PolyLabel.getCentroidCell
train
private static Cell getCentroidCell(Polygon polygon) { double area = 0.0; double x = 0.0; double y = 0.0; LineString exterior = polygon.getExteriorRing(); for (int i = 0, n = exterior.getNumPoints() - 1, j = n - 1; i < n; j = i, i++) { Coordinate a = exterior.getCoo...
java
{ "resource": "" }
q22455
PolyLabel.getSegDistSq
train
private static double getSegDistSq(double px, double py, Coordinate a, Coordinate b) { double x = a.x; double y = a.y; double dx = b.x - x; double dy = b.y - y; if (dx != 0f || dy != 0f) { double t = ((px - x) * dx + (py - y) * dy) / (dx * dx + dy * dy); ...
java
{ "resource": "" }
q22456
PolyLabel.latitudeToY
train
private static double latitudeToY(double latitude) { double sinLatitude = Math.sin(latitude * (Math.PI / 180)); return 0.5 - Math.log((1 + sinLatitude) / (1 - sinLatitude)) / (4 * Math.PI); }
java
{ "resource": "" }
q22457
TileCoordinate.translateToZoomLevel
train
public List<TileCoordinate> translateToZoomLevel(byte zoomlevelNew) { List<TileCoordinate> tiles = null; int zoomlevelDistance = zoomlevelNew - this.zoomlevel; int factor = (int) Math.pow(2, Math.abs(zoomlevelDistance)); if (zoomlevelDistance > 0) { tiles = new ArrayList<>((...
java
{ "resource": "" }
q22458
JTSUtils.toJtsGeometry
train
public static Geometry toJtsGeometry(TDWay way, List<TDWay> innerWays) { if (way == null) { LOGGER.warning("way is null"); return null; } if (way.isForcePolygonLine()) { // may build a single line string if inner ways are empty return buildMultiLi...
java
{ "resource": "" }
q22459
LineString.extractPart
train
public LineString extractPart(double startDistance, double endDistance) { LineString result = new LineString(); for (int i = 0; i < this.segments.size(); startDistance -= this.segments.get(i).length(), endDistance -= this.segments.get(i).length(), i++) { LineSegment segment = this.segments....
java
{ "resource": "" }
q22460
SQLiteDebug.shouldLogSlowQuery
train
public static final boolean shouldLogSlowQuery(long elapsedTimeMillis) { int slowQueryMillis = Integer.parseInt( System.getProperty("db.log.slow_query_threshold", "10000") ); return slowQueryMillis >= 0 && elapsedTimeMillis >= slowQueryMillis; }
java
{ "resource": "" }
q22461
SQLiteDebug.getDatabaseInfo
train
public static PagerStats getDatabaseInfo() { PagerStats stats = new PagerStats(); nativeGetPagerStats(stats); stats.dbStats = SQLiteDatabase.getDbStats(); return stats; }
java
{ "resource": "" }
q22462
SQLiteDebug.dump
train
public static void dump(Printer printer, String[] args) { boolean verbose = false; for (String arg : args) { if (arg.equals("-v")) { verbose = true; } } SQLiteDatabase.dumpAll(printer, verbose); }
java
{ "resource": "" }
q22463
LatLongUtils.distance
train
public static double distance(LatLong latLong1, LatLong latLong2) { return Math.hypot(latLong1.longitude - latLong2.longitude, latLong1.latitude - latLong2.latitude); }
java
{ "resource": "" }
q22464
LatLongUtils.fromString
train
public static LatLong fromString(String latLongString) { double[] coordinates = parseCoordinateString(latLongString, 2); return new LatLong(coordinates[0], coordinates[1]); }
java
{ "resource": "" }
q22465
LatLongUtils.longitudeDistance
train
public static double longitudeDistance(int meters, double latitude) { return (meters * 360) / (2 * Math.PI * EQUATORIAL_RADIUS * Math.cos(Math.toRadians(latitude))); }
java
{ "resource": "" }
q22466
LatLongUtils.parseCoordinateString
train
public static double[] parseCoordinateString(String coordinatesString, int numberOfCoordinates) { StringTokenizer stringTokenizer = new StringTokenizer(coordinatesString, DELIMITER, true); boolean isDelimiter = true; List<String> tokens = new ArrayList<>(numberOfCoordinates); while (str...
java
{ "resource": "" }
q22467
ClusterMarker.setMarkerBitmap
train
private void setMarkerBitmap() { for (markerType = 0; markerType < cluster.getClusterManager().markerIconBmps.size(); markerType++) { // Check if the number of items in this cluster is below or equal the limit of the MarkerBitMap if (cluster.getItems().size() <= cluster.getClusterManager...
java
{ "resource": "" }
q22468
SQLiteSession.executeSpecial
train
private boolean executeSpecial(String sql, Object[] bindArgs, int connectionFlags, CancellationSignal cancellationSignal) { if (cancellationSignal != null) { cancellationSignal.throwIfCanceled(); } final int type = DatabaseUtils.getSqlStatementType(sql); switch (...
java
{ "resource": "" }
q22469
DefaultDatabaseErrorHandler.onCorruption
train
public void onCorruption(SQLiteDatabase dbObj) { Log.e(TAG, "Corruption reported by sqlite on database: " + dbObj.getPath()); // If this is a SEE build, do not delete any database files. // It may be that the user has specified an incorrect password. if( SQLiteDatabase.hasCodec() ) return; /...
java
{ "resource": "" }
q22470
SQLiteConnection.executeForBlobFileDescriptor
train
public ParcelFileDescriptor executeForBlobFileDescriptor(String sql, Object[] bindArgs, CancellationSignal cancellationSignal) { if (sql == null) { throw new IllegalArgumentException("sql must not be null."); } final int cookie = mRecentOperations.beginOperation("execute...
java
{ "resource": "" }
q22471
SQLiteConnection.executeForChangedRowCount
train
public int executeForChangedRowCount(String sql, Object[] bindArgs, CancellationSignal cancellationSignal) { if (sql == null) { throw new IllegalArgumentException("sql must not be null."); } int changedRows = 0; final int cookie = mRecentOperations.beginOperation...
java
{ "resource": "" }
q22472
MultiMapDataStore.addMapDataStore
train
public void addMapDataStore(MapDataStore mapDataStore, boolean useStartZoomLevel, boolean useStartPosition) { if (this.mapDatabases.contains(mapDataStore)) { throw new IllegalArgumentException("Duplicate map database"); } this.mapDatabases.add(mapDataStore); if (useStartZoomL...
java
{ "resource": "" }
q22473
SQLiteProgram.bindAllArgsAsStrings
train
public void bindAllArgsAsStrings(String[] bindArgs) { if (bindArgs != null) { for (int i = bindArgs.length; i != 0; i--) { bindString(i, bindArgs[i - 1]); } } }
java
{ "resource": "" }
q22474
CloseGuard.warnIfOpen
train
public void warnIfOpen() { if (allocationSite == null || !ENABLED) { return; } String message = ("A resource was acquired at attached stack trace but never released. " + "See java.io.Closeable for information on avoiding resource leaks."); R...
java
{ "resource": "" }
q22475
LatLong.compareTo
train
@Override public int compareTo(LatLong latLong) { if (this.latitude > latLong.latitude || this.longitude > latLong.longitude) { return 1; } else if (this.latitude < latLong.latitude || this.longitude < latLong.longitude) { return -1; } return 0...
java
{ "resource": "" }
q22476
LatLong.fromMicroDegrees
train
public static LatLong fromMicroDegrees(int latitudeE6, int longitudeE6) { return new LatLong(LatLongUtils.microdegreesToDegrees(latitudeE6), LatLongUtils.microdegreesToDegrees(longitudeE6)); }
java
{ "resource": "" }
q22477
SimplestMapViewer.createLayers
train
@Override protected void createLayers() { TileRendererLayer tileRendererLayer = AndroidUtil.createTileRendererLayer(this.tileCaches.get(0), this.mapView.getModel().mapViewPosition, getMapFile(), getRenderTheme(), false, true, false); this.mapView.getLayerManager().getLayers().add(til...
java
{ "resource": "" }
q22478
SimplestMapViewer.createTileCaches
train
@Override protected void createTileCaches() { this.tileCaches.add(AndroidUtil.createTileCache(this, getPersistableId(), this.mapView.getModel().displayModel.getTileSize(), this.getScreenRatio(), this.mapView.getModel().frameBufferModel.getOverdrawFactor())); }
java
{ "resource": "" }
q22479
Tile.getBoundingBox
train
public static BoundingBox getBoundingBox(Tile upperLeft, Tile lowerRight) { BoundingBox ul = upperLeft.getBoundingBox(); BoundingBox lr = lowerRight.getBoundingBox(); return ul.extendBoundingBox(lr); }
java
{ "resource": "" }
q22480
Tile.getBoundaryAbsolute
train
public static Rectangle getBoundaryAbsolute(Tile upperLeft, Tile lowerRight) { return new Rectangle(upperLeft.getOrigin().x, upperLeft.getOrigin().y, lowerRight.getOrigin().x + upperLeft.tileSize, lowerRight.getOrigin().y + upperLeft.tileSize); }
java
{ "resource": "" }
q22481
Tile.getBoundingBox
train
public BoundingBox getBoundingBox() { if (this.boundingBox == null) { double minLatitude = Math.max(MercatorProjection.LATITUDE_MIN, MercatorProjection.tileYToLatitude(tileY + 1, zoomLevel)); double minLongitude = Math.max(-180, MercatorProjection.tileXToLongitude(this.tileX, zoomLevel))...
java
{ "resource": "" }
q22482
Tile.getNeighbours
train
public Set<Tile> getNeighbours() { Set<Tile> neighbours = new HashSet<Tile>(8); neighbours.add(getLeft()); neighbours.add(getAboveLeft()); neighbours.add(getAbove()); neighbours.add(getAboveRight()); neighbours.add(getRight()); neighbours.add(getBelowRight()); ...
java
{ "resource": "" }
q22483
Tile.getBoundaryAbsolute
train
public Rectangle getBoundaryAbsolute() { return new Rectangle(getOrigin().x, getOrigin().y, getOrigin().x + tileSize, getOrigin().y + tileSize); }
java
{ "resource": "" }
q22484
Tile.getOrigin
train
public Point getOrigin() { if (this.origin == null) { double x = MercatorProjection.tileToPixel(this.tileX, this.tileSize); double y = MercatorProjection.tileToPixel(this.tileY, this.tileSize); this.origin = new Point(x, y); } return this.origin; }
java
{ "resource": "" }
q22485
Tile.getLeft
train
public Tile getLeft() { int x = tileX - 1; if (x < 0) { x = getMaxTileNumber(this.zoomLevel); } return new Tile(x, this.tileY, this.zoomLevel, this.tileSize); }
java
{ "resource": "" }
q22486
Tile.getRight
train
public Tile getRight() { int x = tileX + 1; if (x > getMaxTileNumber(this.zoomLevel)) { x = 0; } return new Tile(x, this.tileY, this.zoomLevel, this.tileSize); }
java
{ "resource": "" }
q22487
Tile.getAbove
train
public Tile getAbove() { int y = tileY - 1; if (y < 0) { y = getMaxTileNumber(this.zoomLevel); } return new Tile(this.tileX, y, this.zoomLevel, this.tileSize); }
java
{ "resource": "" }
q22488
Tile.getBelow
train
public Tile getBelow() { int y = tileY + 1; if (y > getMaxTileNumber(this.zoomLevel)) { y = 0; } return new Tile(this.tileX, y, this.zoomLevel, this.tileSize); }
java
{ "resource": "" }
q22489
Tile.getAboveLeft
train
public Tile getAboveLeft() { int y = tileY - 1; int x = tileX - 1; if (y < 0) { y = getMaxTileNumber(this.zoomLevel); } if (x < 0) { x = getMaxTileNumber(this.zoomLevel); } return new Tile(x, y, this.zoomLevel, this.tileSize); }
java
{ "resource": "" }
q22490
ChildMarker.init
train
public void init(int index, Bitmap bitmap, int horizontalOffset, int verticalOffset) { this.index = index; this.groupBitmapHalfHeight = bitmap.getHeight() / 2; this.groupBitmapHalfWidth = bitmap.getWidth() / 2; this.groupHOffset = horizontalOffset; this.groupVOffset = verticalOf...
java
{ "resource": "" }
q22491
BaseTileBasedDataProcessor.addImplicitRelationInformation
train
protected void addImplicitRelationInformation(TDWay tdWay) { if (!this.tagValues) { return; } // FEATURE Remove this to add id to all elements (increase of space around 1/8) if (!this.partRootRelations.containsKey(tdWay.getId())) { return; } Long...
java
{ "resource": "" }
q22492
BaseTileBasedDataProcessor.countPoiTags
train
protected void countPoiTags(TDNode poi) { if (poi == null || poi.getTags() == null) { return; } for (short tag : poi.getTags().keySet()) { this.histogramPoiTags.adjustOrPutValue(tag, 1, 1); } }
java
{ "resource": "" }
q22493
BaseTileBasedDataProcessor.handleImplicitWayRelations
train
protected void handleImplicitWayRelations() { if (!this.tagValues) { return; } /*int progressImplicitRelations = 0; float limitImplicitRelations = this.tilesToPartElements.entrySet().size();*/ // Iterate through tiles which contain parts for (Map.Entry<TileC...
java
{ "resource": "" }
q22494
WayDecorator.renderText
train
static void renderText(GraphicFactory graphicFactory, Tile upperLeft, Tile lowerRight, String text, Display display, int priority, float dy, Paint fill, Paint stroke, boolean repeat, float repeatGap, float repeatStart, boolean rotate, Point[][] coordinates, ...
java
{ "resource": "" }
q22495
DatabaseUtils.writeExceptionToParcel
train
public static final void writeExceptionToParcel(Parcel reply, Exception e) { int code = 0; boolean logException = true; if (e instanceof FileNotFoundException) { code = 1; logException = false; } else if (e instanceof IllegalArgumentException) { code =...
java
{ "resource": "" }
q22496
DatabaseUtils.cursorFillWindow
train
public static void cursorFillWindow(final Cursor cursor, int position, final CursorWindow window) { if (position < 0 || position >= cursor.getCount()) { return; } final int oldPos = cursor.getPosition(); final int numColumns = cursor.getColumnCount(); wind...
java
{ "resource": "" }
q22497
DatabaseUtils.appendEscapedSQLString
train
public static void appendEscapedSQLString(StringBuilder sb, String sqlString) { sb.append('\''); if (sqlString.indexOf('\'') != -1) { int length = sqlString.length(); for (int i = 0; i < length; i++) { char c = sqlString.charAt(i); if (c == '\'') {...
java
{ "resource": "" }
q22498
DatabaseUtils.sqlEscapeString
train
public static String sqlEscapeString(String value) { StringBuilder escaper = new StringBuilder(); DatabaseUtils.appendEscapedSQLString(escaper, value); return escaper.toString(); }
java
{ "resource": "" }
q22499
DatabaseUtils.appendValueToSql
train
public static final void appendValueToSql(StringBuilder sql, Object value) { if (value == null) { sql.append("NULL"); } else if (value instanceof Boolean) { Boolean bool = (Boolean)value; if (bool) { sql.append('1'); } else { ...
java
{ "resource": "" }