_id stringlengths 2 7 | title stringlengths 3 140 | partition stringclasses 3
values | text stringlengths 73 34.1k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q22500 | DatabaseUtils.concatenateWhere | train | public static String concatenateWhere(String a, String b) {
if (TextUtils.isEmpty(a)) {
return b;
}
if (TextUtils.isEmpty(b)) {
return a;
}
return "(" + a + ") AND (" + b + ")";
} | java | {
"resource": ""
} |
q22501 | DatabaseUtils.getCollationKey | train | public static String getCollationKey(String name) {
byte [] arr = getCollationKeyInBytes(name);
try {
return new String(arr, 0, getKeyLen(arr), "ISO8859_1");
} catch (Exception ex) {
return "";
}
} | java | {
"resource": ""
} |
q22502 | DatabaseUtils.getHexCollationKey | train | public static String getHexCollationKey(String name) {
byte[] arr = getCollationKeyInBytes(name);
char[] keys = encodeHex(arr);
return new String(keys, 0, getKeyLen(arr) * 2);
} | java | {
"resource": ""
} |
q22503 | DatabaseUtils.dumpCursor | train | public static void dumpCursor(Cursor cursor, PrintStream stream) {
stream.println(">>>>> Dumping cursor " + cursor);
if (cursor != null) {
int startPos = cursor.getPosition();
cursor.moveToPosition(-1);
while (cursor.moveToNext()) {
dumpCurrentRow(cur... | java | {
"resource": ""
} |
q22504 | DatabaseUtils.dumpCursor | train | public static void dumpCursor(Cursor cursor, StringBuilder sb) {
sb.append(">>>>> Dumping cursor " + cursor + "\n");
if (cursor != null) {
int startPos = cursor.getPosition();
cursor.moveToPosition(-1);
while (cursor.moveToNext()) {
dumpCurrentRow(cur... | java | {
"resource": ""
} |
q22505 | DatabaseUtils.dumpCursorToString | train | public static String dumpCursorToString(Cursor cursor) {
StringBuilder sb = new StringBuilder();
dumpCursor(cursor, sb);
return sb.toString();
} | java | {
"resource": ""
} |
q22506 | DatabaseUtils.dumpCurrentRow | train | public static void dumpCurrentRow(Cursor cursor, PrintStream stream) {
String[] cols = cursor.getColumnNames();
stream.println("" + cursor.getPosition() + " {");
int length = cols.length;
for (int i = 0; i< length; i++) {
String value;
try {
value ... | java | {
"resource": ""
} |
q22507 | DatabaseUtils.dumpCurrentRow | train | public static void dumpCurrentRow(Cursor cursor, StringBuilder sb) {
String[] cols = cursor.getColumnNames();
sb.append("" + cursor.getPosition() + " {\n");
int length = cols.length;
for (int i = 0; i < length; i++) {
String value;
try {
value = cu... | java | {
"resource": ""
} |
q22508 | DatabaseUtils.dumpCurrentRowToString | train | public static String dumpCurrentRowToString(Cursor cursor) {
StringBuilder sb = new StringBuilder();
dumpCurrentRow(cursor, sb);
return sb.toString();
} | java | {
"resource": ""
} |
q22509 | DatabaseUtils.cursorStringToInsertHelper | train | public static void cursorStringToInsertHelper(Cursor cursor, String field,
InsertHelper inserter, int index) {
inserter.bind(index, cursor.getString(cursor.getColumnIndexOrThrow(field)));
} | java | {
"resource": ""
} |
q22510 | DatabaseUtils.cursorIntToContentValues | train | public static void cursorIntToContentValues(Cursor cursor, String field, ContentValues values) {
cursorIntToContentValues(cursor, field, values, field);
} | java | {
"resource": ""
} |
q22511 | DatabaseUtils.cursorIntToContentValues | train | public static void cursorIntToContentValues(Cursor cursor, String field, ContentValues values,
String key) {
int colIndex = cursor.getColumnIndex(field);
if (!cursor.isNull(colIndex)) {
values.put(key, cursor.getInt(colIndex));
} else {
values.put(key, (Intege... | java | {
"resource": ""
} |
q22512 | DatabaseUtils.cursorRowToContentValues | train | public static void cursorRowToContentValues(Cursor cursor, ContentValues values) {
String[] columns = cursor.getColumnNames();
int length = columns.length;
for (int i = 0; i < length; i++) {
if (cursor.getType(i) == Cursor.FIELD_TYPE_BLOB) {
values.put(columns[i], cur... | java | {
"resource": ""
} |
q22513 | DatabaseUtils.queryIsEmpty | train | public static boolean queryIsEmpty(SQLiteDatabase db, String table) {
long isEmpty = longForQuery(db, "select exists(select 1 from " + table + ")", null);
return isEmpty == 0;
} | java | {
"resource": ""
} |
q22514 | DatabaseUtils.blobFileDescriptorForQuery | train | public static ParcelFileDescriptor blobFileDescriptorForQuery(SQLiteDatabase db,
String query, String[] selectionArgs) {
SQLiteStatement prog = db.compileStatement(query);
try {
return blobFileDescriptorForQuery(prog, selectionArgs);
} finally {
prog.close();
... | java | {
"resource": ""
} |
q22515 | DatabaseUtils.blobFileDescriptorForQuery | train | public static ParcelFileDescriptor blobFileDescriptorForQuery(SQLiteStatement prog,
String[] selectionArgs) {
prog.bindAllArgsAsStrings(selectionArgs);
return prog.simpleQueryForBlobFileDescriptor();
} | java | {
"resource": ""
} |
q22516 | DatabaseUtils.cursorStringToContentValuesIfPresent | train | public static void cursorStringToContentValuesIfPresent(Cursor cursor, ContentValues values,
String column) {
final int index = cursor.getColumnIndex(column);
if (index != -1 && !cursor.isNull(index)) {
values.put(column, cursor.getString(index));
}
} | java | {
"resource": ""
} |
q22517 | DatabaseUtils.cursorLongToContentValuesIfPresent | train | public static void cursorLongToContentValuesIfPresent(Cursor cursor, ContentValues values,
String column) {
final int index = cursor.getColumnIndex(column);
if (index != -1 && !cursor.isNull(index)) {
values.put(column, cursor.getLong(index));
}
} | java | {
"resource": ""
} |
q22518 | DatabaseUtils.cursorShortToContentValuesIfPresent | train | public static void cursorShortToContentValuesIfPresent(Cursor cursor, ContentValues values,
String column) {
final int index = cursor.getColumnIndex(column);
if (index != -1 && !cursor.isNull(index)) {
values.put(column, cursor.getShort(index));
}
} | java | {
"resource": ""
} |
q22519 | DatabaseUtils.cursorIntToContentValuesIfPresent | train | public static void cursorIntToContentValuesIfPresent(Cursor cursor, ContentValues values,
String column) {
final int index = cursor.getColumnIndex(column);
if (index != -1 && !cursor.isNull(index)) {
values.put(column, cursor.getInt(index));
}
} | java | {
"resource": ""
} |
q22520 | DatabaseUtils.cursorFloatToContentValuesIfPresent | train | public static void cursorFloatToContentValuesIfPresent(Cursor cursor, ContentValues values,
String column) {
final int index = cursor.getColumnIndex(column);
if (index != -1 && !cursor.isNull(index)) {
values.put(column, cursor.getFloat(index));
}
} | java | {
"resource": ""
} |
q22521 | DatabaseUtils.cursorDoubleToContentValuesIfPresent | train | public static void cursorDoubleToContentValuesIfPresent(Cursor cursor, ContentValues values,
String column) {
final int index = cursor.getColumnIndex(column);
if (index != -1 && !cursor.isNull(index)) {
values.put(column, cursor.getDouble(index));
}
} | java | {
"resource": ""
} |
q22522 | DatabaseUtils.createDbFromSqlStatements | train | static public void createDbFromSqlStatements(
Context context, String dbName, int dbVersion, String sqlStatements) {
File f = context.getDatabasePath(dbName);
f.getParentFile().mkdirs();
SQLiteDatabase db = SQLiteDatabase.openOrCreateDatabase(f, null);
// TODO: this is not ... | java | {
"resource": ""
} |
q22523 | DatabaseUtils.appendSelectionArgs | train | public static String[] appendSelectionArgs(String[] originalValues, String[] newValues) {
if (originalValues == null || originalValues.length == 0) {
return newValues;
}
String[] result = new String[originalValues.length + newValues.length ];
System.arraycopy(originalValues, ... | java | {
"resource": ""
} |
q22524 | DatabaseUtils.findRowIdColumnIndex | train | public static int findRowIdColumnIndex(String[] columnNames) {
int length = columnNames.length;
for (int i = 0; i < length; i++) {
if (columnNames[i].equals("_id")) {
return i;
}
}
return -1;
} | java | {
"resource": ""
} |
q22525 | MercatorProjection.getPixelRelativeToTile | train | public static Point getPixelRelativeToTile(LatLong latLong, Tile tile) {
return getPixelRelative(latLong, tile.mapSize, tile.getOrigin());
} | java | {
"resource": ""
} |
q22526 | MercatorProjection.metersToPixelsWithScaleFactor | train | public static double metersToPixelsWithScaleFactor(float meters, double latitude, double scaleFactor, int tileSize) {
return meters / MercatorProjection.calculateGroundResolutionWithScaleFactor(latitude, scaleFactor, tileSize);
} | java | {
"resource": ""
} |
q22527 | MercatorProjection.pixelXToLongitudeWithScaleFactor | train | public static double pixelXToLongitudeWithScaleFactor(double pixelX, double scaleFactor, int tileSize) {
long mapSize = getMapSizeWithScaleFactor(scaleFactor, tileSize);
if (pixelX < 0 || pixelX > mapSize) {
throw new IllegalArgumentException("invalid pixelX coordinate at scale " + scaleFact... | java | {
"resource": ""
} |
q22528 | MercatorProjection.pixelXToLongitude | train | public static double pixelXToLongitude(double pixelX, long mapSize) {
if (pixelX < 0 || pixelX > mapSize) {
throw new IllegalArgumentException("invalid pixelX coordinate " + mapSize + ": " + pixelX);
}
return 360 * ((pixelX / mapSize) - 0.5);
} | java | {
"resource": ""
} |
q22529 | MercatorProjection.pixelYToLatitudeWithScaleFactor | train | public static double pixelYToLatitudeWithScaleFactor(double pixelY, double scaleFactor, int tileSize) {
long mapSize = getMapSizeWithScaleFactor(scaleFactor, tileSize);
if (pixelY < 0 || pixelY > mapSize) {
throw new IllegalArgumentException("invalid pixelY coordinate at scale " + scaleFacto... | java | {
"resource": ""
} |
q22530 | MercatorProjection.pixelYToLatitude | train | public static double pixelYToLatitude(double pixelY, long mapSize) {
if (pixelY < 0 || pixelY > mapSize) {
throw new IllegalArgumentException("invalid pixelY coordinate " + mapSize + ": " + pixelY);
}
double y = 0.5 - (pixelY / mapSize);
return 90 - 360 * Math.atan(Math.exp(-... | java | {
"resource": ""
} |
q22531 | HillsRenderConfig.indexOnThread | train | public HillsRenderConfig indexOnThread() {
ShadeTileSource cache = tileSource;
if (cache != null) cache.applyConfiguration(true);
return this;
} | java | {
"resource": ""
} |
q22532 | DeltaEncoder.encode | train | public static List<WayDataBlock> encode(List<WayDataBlock> blocks, Encoding encoding) {
if (blocks == null) {
return null;
}
if (encoding == Encoding.NONE) {
return blocks;
}
List<WayDataBlock> results = new ArrayList<>();
for (WayDataBlock wayD... | java | {
"resource": ""
} |
q22533 | DeltaEncoder.simulateSerialization | train | public static int simulateSerialization(List<WayDataBlock> blocks) {
int sum = 0;
for (WayDataBlock wayDataBlock : blocks) {
sum += mSimulateSerialization(wayDataBlock.getOuterWay());
if (wayDataBlock.getInnerWays() != null) {
for (List<Integer> list : wayDataBloc... | java | {
"resource": ""
} |
q22534 | AndroidResourceBitmap.clearResourceBitmaps | train | public static void clearResourceBitmaps() {
if (!AndroidGraphicFactory.KEEP_RESOURCE_BITMAPS) {
return;
}
synchronized (RESOURCE_BITMAPS) {
for (Pair<android.graphics.Bitmap, Integer> p : RESOURCE_BITMAPS.values()) {
p.first.recycle();
if (... | java | {
"resource": ""
} |
q22535 | AndroidResourceBitmap.destroyBitmap | train | @Override
protected void destroyBitmap() {
if (this.bitmap != null) {
if (removeBitmap(this.hash)) {
this.bitmap.recycle();
}
this.bitmap = null;
}
} | java | {
"resource": ""
} |
q22536 | OSMTag.fromOSMTag | train | public static OSMTag fromOSMTag(OSMTag otherTag, short newID) {
return new OSMTag(newID, otherTag.getKey(), otherTag.getValue(), otherTag.getZoomAppear(),
otherTag.isRenderable(), otherTag.isForcePolygonLine(), otherTag.isLabelPosition());
} | java | {
"resource": ""
} |
q22537 | DirectRenderer.executeJob | train | public TileBitmap executeJob(RendererJob rendererJob) {
RenderContext renderContext = null;
try {
renderContext = new RenderContext(rendererJob, new CanvasRasterer(graphicFactory));
if (renderBitmap(renderContext)) {
TileBitmap bitmap = null;
if ... | java | {
"resource": ""
} |
q22538 | SQLiteDatabase.getThreadDefaultConnectionFlags | train | int getThreadDefaultConnectionFlags(boolean readOnly) {
int flags = readOnly ? SQLiteConnectionPool.CONNECTION_FLAG_READ_ONLY :
SQLiteConnectionPool.CONNECTION_FLAG_PRIMARY_CONNECTION_AFFINITY;
if (isMainThread()) {
flags |= SQLiteConnectionPool.CONNECTION_FLAG_INTERACTIVE;
... | java | {
"resource": ""
} |
q22539 | SQLiteDatabase.deleteDatabase | train | public static boolean deleteDatabase(File file) {
if (file == null) {
throw new IllegalArgumentException("file must not be null");
}
boolean deleted = false;
deleted |= file.delete();
deleted |= new File(file.getPath() + "-journal").delete();
deleted |= new F... | java | {
"resource": ""
} |
q22540 | SQLiteDatabase.reopenReadWrite | train | public void reopenReadWrite() {
synchronized (mLock) {
throwIfNotOpenLocked();
if (!isReadOnlyLocked()) {
return; // nothing to do
}
// Reopen the database in read-write mode.
final int oldOpenFlags = mConfigurationLocked.openFlags;
... | java | {
"resource": ""
} |
q22541 | SQLiteDatabase.addCustomFunction | train | public void addCustomFunction(String name, int numArgs, CustomFunction function) {
// Create wrapper (also validates arguments).
SQLiteCustomFunction wrapper = new SQLiteCustomFunction(name, numArgs, function);
synchronized (mLock) {
throwIfNotOpenLocked();
mConfigurati... | java | {
"resource": ""
} |
q22542 | SQLiteDatabase.setMaximumSize | train | public long setMaximumSize(long numBytes) {
long pageSize = getPageSize();
long numPages = numBytes / pageSize;
// If numBytes isn't a multiple of pageSize, bump up a page
if ((numBytes % pageSize) != 0) {
numPages++;
}
long newPageCount = DatabaseUtils.longFo... | java | {
"resource": ""
} |
q22543 | SQLiteDatabase.findEditTable | train | public static String findEditTable(String tables) {
if (!TextUtils.isEmpty(tables)) {
// find the first word terminated by either a space or a comma
int spacepos = tables.indexOf(' ');
int commapos = tables.indexOf(',');
if (spacepos > 0 && (spacepos < commapos |... | java | {
"resource": ""
} |
q22544 | SQLiteDatabase.replaceOrThrow | train | public long replaceOrThrow(String table, String nullColumnHack,
ContentValues initialValues) throws SQLException {
return insertWithOnConflict(table, nullColumnHack, initialValues,
CONFLICT_REPLACE);
} | java | {
"resource": ""
} |
q22545 | SQLiteDatabase.insertWithOnConflict | train | public long insertWithOnConflict(String table, String nullColumnHack,
ContentValues initialValues, int conflictAlgorithm) {
acquireReference();
try {
StringBuilder sql = new StringBuilder();
sql.append("INSERT");
sql.append(CONFLICT_VALUES[conflictAlgorith... | java | {
"resource": ""
} |
q22546 | SQLiteDatabase.dumpAll | train | static void dumpAll(Printer printer, boolean verbose) {
for (SQLiteDatabase db : getActiveDatabases()) {
db.dump(printer, verbose);
}
} | java | {
"resource": ""
} |
q22547 | SQLiteDatabase.getAttachedDbs | train | public List<Pair<String, String>> getAttachedDbs() {
ArrayList<Pair<String, String>> attachedDbs = new ArrayList<Pair<String, String>>();
synchronized (mLock) {
if (mConnectionPoolLocked == null) {
return null; // not open
}
if (!mHasAttachedDbsLocked... | java | {
"resource": ""
} |
q22548 | TDWay.fromWay | train | public static TDWay fromWay(Way way, NodeResolver resolver, List<String> preferredLanguages) {
if (way == null)
return null;
SpecialTagExtractionResult ster = OSMUtils.extractSpecialFields(way, preferredLanguages);
Map<Short, Object> knownWayTags = OSMUtils.extractKnownWayTags(way);... | java | {
"resource": ""
} |
q22549 | TDWay.mergeRelationInformation | train | public void mergeRelationInformation(TDRelation relation) {
if (relation.hasTags()) {
addTags(relation.getTags());
}
if (getName() == null && relation.getName() != null) {
setName(relation.getName());
}
if (getRef() == null && relation.getRef() != null) {
... | java | {
"resource": ""
} |
q22550 | TDNode.fromNode | train | public static TDNode fromNode(Node node, List<String> preferredLanguages) {
SpecialTagExtractionResult ster = OSMUtils.extractSpecialFields(node, preferredLanguages);
Map<Short, Object> knownWayTags = OSMUtils.extractKnownPOITags(node);
return new TDNode(node.getId(), LatLongUtils.degreesToMicr... | java | {
"resource": ""
} |
q22551 | RenderContext.setScaleStrokeWidth | train | private void setScaleStrokeWidth(byte zoomLevel) {
int zoomLevelDiff = Math.max(zoomLevel - STROKE_MIN_ZOOM_LEVEL, 0);
this.renderTheme.scaleStrokeWidth((float) Math.pow(STROKE_INCREASE, zoomLevelDiff), this.rendererJob.tile.zoomLevel);
} | java | {
"resource": ""
} |
q22552 | MapFile.closeFileChannel | train | private void closeFileChannel() {
try {
if (this.databaseIndexCache != null) {
this.databaseIndexCache.destroy();
}
if (this.inputChannel != null) {
this.inputChannel.close();
}
} catch (Exception e) {
LOGGER.log... | java | {
"resource": ""
} |
q22553 | MapFile.processBlockSignature | train | private boolean processBlockSignature(ReadBuffer readBuffer) {
if (this.mapFileHeader.getMapFileInfo().debugFile) {
// get and check the block signature
String signatureBlock = readBuffer.readUTF8EncodedString(SIGNATURE_LENGTH_BLOCK);
if (!signatureBlock.startsWith("###TileSt... | java | {
"resource": ""
} |
q22554 | MapFile.readLabels | train | @Override
public MapReadResult readLabels(Tile tile) {
return readMapData(tile, tile, Selector.LABELS);
} | java | {
"resource": ""
} |
q22555 | MapFile.readMapData | train | @Override
public MapReadResult readMapData(Tile tile) {
return readMapData(tile, tile, Selector.ALL);
} | java | {
"resource": ""
} |
q22556 | MapFile.readPoiData | train | @Override
public MapReadResult readPoiData(Tile tile) {
return readMapData(tile, tile, Selector.POIS);
} | java | {
"resource": ""
} |
q22557 | MapFile.readPoiData | train | @Override
public MapReadResult readPoiData(Tile upperLeft, Tile lowerRight) {
return readMapData(upperLeft, lowerRight, Selector.POIS);
} | java | {
"resource": ""
} |
q22558 | Cluster.addItem | train | public synchronized void addItem(T item) {
synchronized (items) {
items.add(item);
}
// clusterMarker.setMarkerBitmap();
if (center == null) {
center = item.getLatLong();
} else {
// computing the centroid
double lat = 0, lon = 0;
... | java | {
"resource": ""
} |
q22559 | Cluster.clear | train | public void clear() {
if (clusterMarker != null) {
Layers mapOverlays = clusterManager.getMapView().getLayerManager().getLayers();
if (mapOverlays.contains(clusterMarker)) {
mapOverlays.remove(clusterMarker);
}
clusterManager = null;
cl... | java | {
"resource": ""
} |
q22560 | Cluster.redraw | train | public void redraw() {
Layers mapOverlays = clusterManager.getMapView().getLayerManager().getLayers();
if (clusterMarker != null && !clusterManager.getCurBounds().contains(center)
&& mapOverlays.contains(clusterMarker)) {
mapOverlays.remove(clusterMarker);
return;... | java | {
"resource": ""
} |
q22561 | GeometryUtils.calculateCenterOfBoundingBox | train | static Point calculateCenterOfBoundingBox(Point[] coordinates) {
double pointXMin = coordinates[0].x;
double pointXMax = coordinates[0].x;
double pointYMin = coordinates[0].y;
double pointYMax = coordinates[0].y;
for (Point immutablePoint : coordinates) {
if (immutab... | java | {
"resource": ""
} |
q22562 | ZoomIntervalConfiguration.fromString | train | public static ZoomIntervalConfiguration fromString(String confString) {
String[] splitted = confString.split(",");
if (splitted.length % 3 != 0) {
throw new IllegalArgumentException(
"invalid zoom interval configuration, amount of comma-separated values must be a multiple... | java | {
"resource": ""
} |
q22563 | WorkingSetCache.setWorkingSet | train | public void setWorkingSet(Set<K> workingSet) {
synchronized(workingSet) {
for (K key : workingSet) {
this.get(key);
}
}
} | java | {
"resource": ""
} |
q22564 | GraphicUtils.filterColor | train | public static int filterColor(int color, Filter filter) {
if (filter == Filter.NONE) {
return color;
}
int a = color >>> 24;
int r = (color >> 16) & 0xFF;
int g = (color >> 8) & 0xFF;
int b = color & 0xFF;
switch (filter) {
case GRAYSCALE:
... | java | {
"resource": ""
} |
q22565 | GraphicUtils.imageSize | train | public static float[] imageSize(float picWidth, float picHeight, float scaleFactor, int width, int height, int percent) {
float bitmapWidth = picWidth * scaleFactor;
float bitmapHeight = picHeight * scaleFactor;
float aspectRatio = picWidth / picHeight;
if (width != 0 && height != 0) {... | java | {
"resource": ""
} |
q22566 | MapWriterConfiguration.validate | train | public void validate() {
if (this.mapStartPosition != null && this.bboxConfiguration != null
&& !this.bboxConfiguration.contains(this.mapStartPosition)) {
throw new IllegalArgumentException(
"map start position is not valid, must be included in bounding box of the... | java | {
"resource": ""
} |
q22567 | GeoUtils.clipToTile | train | public static Geometry clipToTile(TDWay way, Geometry geometry, TileCoordinate tileCoordinate,
int enlargementInMeters) {
Geometry tileBBJTS = null;
Geometry ret = null;
// create tile bounding box
tileBBJTS = tileToJTSGeometry(tileCoordinate.getX()... | java | {
"resource": ""
} |
q22568 | GeoUtils.simplifyGeometry | train | public static Geometry simplifyGeometry(TDWay way, Geometry geometry, byte zoomlevel, int tileSize,
double simplificationFactor) {
Geometry ret = null;
Envelope bbox = geometry.getEnvelopeInternal();
// compute maximal absolute latitude (so that we do... | java | {
"resource": ""
} |
q22569 | GeoUtils.deltaLat | train | private static double deltaLat(double deltaPixel, double lat, byte zoom, int tileSize) {
long mapSize = MercatorProjection.getMapSize(zoom, tileSize);
double pixelY = MercatorProjection.latitudeToPixelY(lat, mapSize);
double lat2 = MercatorProjection.pixelYToLatitude(pixelY + deltaPixel, mapSize... | java | {
"resource": ""
} |
q22570 | MapViewPosition.moveCenterAndZoom | train | @Override
public void moveCenterAndZoom(double moveHorizontal, double moveVertical, byte zoomLevelDiff) {
moveCenterAndZoom(moveHorizontal, moveVertical, zoomLevelDiff, true);
} | java | {
"resource": ""
} |
q22571 | MapViewPosition.moveCenterAndZoom | train | public void moveCenterAndZoom(double moveHorizontal, double moveVertical, byte zoomLevelDiff, boolean animated) {
synchronized (this) {
long mapSize = MercatorProjection.getMapSize(this.zoomLevel, this.displayModel.getTileSize());
double pixelX = MercatorProjection.longitudeToPixelX(this... | java | {
"resource": ""
} |
q22572 | MapViewPosition.setCenter | train | @Override
public void setCenter(LatLong latLong) {
synchronized (this) {
setCenterInternal(latLong.latitude, latLong.longitude);
}
notifyObservers();
} | java | {
"resource": ""
} |
q22573 | MapViewPosition.setMapPosition | train | @Override
public void setMapPosition(MapPosition mapPosition, boolean animated) {
synchronized (this) {
setCenterInternal(mapPosition.latLong.latitude, mapPosition.latLong.longitude);
setZoomLevelInternal(mapPosition.zoomLevel, animated);
}
notifyObservers();
} | java | {
"resource": ""
} |
q22574 | MapViewPosition.setZoomLevel | train | @Override
public void setZoomLevel(byte zoomLevel, boolean animated) {
if (zoomLevel < 0) {
throw new IllegalArgumentException("zoomLevel must not be negative: " + zoomLevel);
}
synchronized (this) {
setZoomLevelInternal(zoomLevel, animated);
}
notifyO... | java | {
"resource": ""
} |
q22575 | MapScaleBar.calculateScaleBarLengthAndValue | train | protected ScaleBarLengthAndValue calculateScaleBarLengthAndValue(DistanceUnitAdapter unitAdapter) {
this.prevMapPosition = this.mapViewPosition.getMapPosition();
double groundResolution = MercatorProjection.calculateGroundResolution(this.prevMapPosition.latLong.latitude,
MercatorProjecti... | java | {
"resource": ""
} |
q22576 | MapScaleBar.isRedrawNecessary | train | protected boolean isRedrawNecessary() {
if (this.redrawNeeded || this.prevMapPosition == null) {
return true;
}
MapPosition currentMapPosition = this.mapViewPosition.getMapPosition();
if (currentMapPosition.zoomLevel != this.prevMapPosition.zoomLevel) {
return tr... | java | {
"resource": ""
} |
q22577 | JobQueue.get | train | public synchronized T get(int maxAssigned) throws InterruptedException {
while (this.queueItems.isEmpty() || this.assignedJobs.size() >= maxAssigned) {
this.wait(200);
if (this.isInterrupted) {
this.isInterrupted = false;
return null;
}
... | java | {
"resource": ""
} |
q22578 | SQLiteOpenHelper.setWriteAheadLoggingEnabled | train | public void setWriteAheadLoggingEnabled(boolean enabled) {
synchronized (this) {
if (mEnableWriteAheadLogging != enabled) {
if (mDatabase != null && mDatabase.isOpen() && !mDatabase.isReadOnly()) {
if (enabled) {
mDatabase.enableWriteAheadL... | java | {
"resource": ""
} |
q22579 | SQLiteOpenHelper.close | train | public synchronized void close() {
if (mIsInitializing) throw new IllegalStateException("Closed during initialization");
if (mDatabase != null && mDatabase.isOpen()) {
mDatabase.close();
mDatabase = null;
}
} | java | {
"resource": ""
} |
q22580 | MapFileHeader.readHeader | train | public void readHeader(ReadBuffer readBuffer, long fileSize) throws IOException {
RequiredFields.readMagicByte(readBuffer);
RequiredFields.readRemainingHeader(readBuffer);
MapFileInfoBuilder mapFileInfoBuilder = new MapFileInfoBuilder();
RequiredFields.readFileVersion(readBuffer, mapFi... | java | {
"resource": ""
} |
q22581 | SamplesBaseActivity.setMapScaleBar | train | protected void setMapScaleBar() {
String value = this.sharedPreferences.getString(SETTING_SCALEBAR, SETTING_SCALEBAR_BOTH);
if (SETTING_SCALEBAR_NONE.equals(value)) {
AndroidUtil.setMapScaleBar(this.mapView, null, null);
} else {
if (SETTING_SCALEBAR_BOTH.equals(value)) ... | java | {
"resource": ""
} |
q22582 | SamplesBaseActivity.setMaxTextWidthFactor | train | protected void setMaxTextWidthFactor() {
mapView.getModel().displayModel.setMaxTextWidthFactor(Float.valueOf(sharedPreferences.getString(SamplesApplication.SETTING_TEXTWIDTH, "0.7")));
} | java | {
"resource": ""
} |
q22583 | Utils.enableHome | train | @TargetApi(Build.VERSION_CODES.HONEYCOMB)
public static void enableHome(Activity a) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
// Show the Up button in the action bar.
a.getActionBar().setDisplayHomeAsUpEnabled(true);
}
} | java | {
"resource": ""
} |
q22584 | TileBasedLabelStore.storeMapItems | train | public synchronized void storeMapItems(Tile tile, List<MapElementContainer> mapItems) {
this.put(tile, LayerUtil.collisionFreeOrdered(mapItems));
this.version += 1;
} | java | {
"resource": ""
} |
q22585 | DoubleLinkedPoiCategory.getGraphVizString | train | public static String getGraphVizString(DoubleLinkedPoiCategory rootNode) {
StringBuilder sb = new StringBuilder();
Stack<PoiCategory> stack = new Stack<>();
stack.push(rootNode);
DoubleLinkedPoiCategory currentNode;
sb.append("// dot test.dot -Tpng > test.png\r\n");
sb.a... | java | {
"resource": ""
} |
q22586 | BoundingBox.fromString | train | public static BoundingBox fromString(String boundingBoxString) {
double[] coordinates = LatLongUtils.parseCoordinateString(boundingBoxString, 4);
return new BoundingBox(coordinates[0], coordinates[1], coordinates[2], coordinates[3]);
} | java | {
"resource": ""
} |
q22587 | BoundingBox.getPositionRelativeToTile | train | public Rectangle getPositionRelativeToTile(Tile tile) {
Point upperLeft = MercatorProjection.getPixelRelativeToTile(new LatLong(this.maxLatitude, minLongitude), tile);
Point lowerRight = MercatorProjection.getPixelRelativeToTile(new LatLong(this.minLatitude, maxLongitude), tile);
return new Rect... | java | {
"resource": ""
} |
q22588 | RenderTheme.destroy | train | public void destroy() {
this.poiMatchingCache.clear();
this.wayMatchingCache.clear();
for (Rule r : this.rulesList) {
r.destroy();
}
} | java | {
"resource": ""
} |
q22589 | RenderTheme.matchClosedWay | train | public void matchClosedWay(RenderCallback renderCallback, final RenderContext renderContext, PolylineContainer way) {
matchWay(renderCallback, renderContext, Closed.YES, way);
} | java | {
"resource": ""
} |
q22590 | RenderTheme.matchLinearWay | train | public void matchLinearWay(RenderCallback renderCallback, final RenderContext renderContext, PolylineContainer way) {
matchWay(renderCallback, renderContext, Closed.NO, way);
} | java | {
"resource": ""
} |
q22591 | RenderTheme.matchNode | train | public synchronized void matchNode(RenderCallback renderCallback, final RenderContext renderContext, PointOfInterest poi) {
MatchingCacheKey matchingCacheKey = new MatchingCacheKey(poi.tags, renderContext.rendererJob.tile.zoomLevel, Closed.NO);
List<RenderInstruction> matchingList = this.poiMatchingCac... | java | {
"resource": ""
} |
q22592 | RenderTheme.scaleStrokeWidth | train | public synchronized void scaleStrokeWidth(float scaleFactor, byte zoomLevel) {
if (!strokeScales.containsKey(zoomLevel) || scaleFactor != strokeScales.get(zoomLevel)) {
for (int i = 0, n = this.rulesList.size(); i < n; ++i) {
Rule rule = this.rulesList.get(i);
if (rul... | java | {
"resource": ""
} |
q22593 | RenderTheme.scaleTextSize | train | public synchronized void scaleTextSize(float scaleFactor, byte zoomLevel) {
if (!textScales.containsKey(zoomLevel) || scaleFactor != textScales.get(zoomLevel)) {
for (int i = 0, n = this.rulesList.size(); i < n; ++i) {
Rule rule = this.rulesList.get(i);
if (rule.zoomM... | java | {
"resource": ""
} |
q22594 | MapViewerTemplate.createMapViews | train | protected void createMapViews() {
mapView = getMapView();
mapView.getModel().init(this.preferencesFacade);
mapView.setClickable(true);
mapView.getMapScaleBar().setVisible(true);
mapView.setBuiltInZoomControls(hasZoomControls());
mapView.getMapZoomControls().setAutoHide(is... | java | {
"resource": ""
} |
q22595 | MapViewerTemplate.getInitialPosition | train | protected MapPosition getInitialPosition() {
MapDataStore mapFile = getMapFile();
if (mapFile.startPosition() != null) {
Byte startZoomLevel = mapFile.startZoomLevel();
if (startZoomLevel == null) {
// it is actually possible to have no start zoom level in the fi... | java | {
"resource": ""
} |
q22596 | MapViewerTemplate.initializePosition | train | protected IMapViewPosition initializePosition(IMapViewPosition mvp) {
LatLong center = mvp.getCenter();
if (center.equals(new LatLong(0, 0))) {
mvp.setMapPosition(this.getInitialPosition());
}
mvp.setZoomLevelMax(getZoomLevelMax());
mvp.setZoomLevelMin(getZoomLevelMi... | java | {
"resource": ""
} |
q22597 | MapViewerTemplate.onCreate | train | @Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
createSharedPreferences();
createMapViews();
createTileCaches();
checkPermissionsAndCreateLayersAndControls();
} | java | {
"resource": ""
} |
q22598 | GroupMarker.onTap | train | @Override
public boolean onTap(LatLong tapLatLong, Point layerXY, Point tapXY) {
this.expanded = !this.expanded;
double centerX = layerXY.x + this.getHorizontalOffset();
double centerY = layerXY.y + this.getVerticalOffset();
double radiusX = this.getBitmap().getWidth() / 2;
... | java | {
"resource": ""
} |
q22599 | SQLiteConnectionPool.shouldYieldConnection | train | public boolean shouldYieldConnection(SQLiteConnection connection, int connectionFlags) {
synchronized (mLock) {
if (!mAcquiredConnections.containsKey(connection)) {
throw new IllegalStateException("Cannot perform this operation "
+ "because the specified conne... | java | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.