code stringlengths 73 34.1k | label stringclasses 1
value |
|---|---|
@Override
public void replace(List list, String resourceVersion) {
lock.writeLock().lock();
try {
Set<String> keys = new HashSet<>();
for (Object obj : list) {
String key = this.keyOf(obj);
keys.add(key);
this.queueActionLocked(DeltaType.Sync, obj);
}
if (this.... | java |
@Override
public void resync() {
lock.writeLock().lock();
try {
if (this.knownObjects == null) {
return;
}
List<String> keys = this.knownObjects.listKeys();
for (String key : keys) {
syncKeyLocked(key);
}
} finally {
lock.writeLock().unlock();
}
} | java |
@Override
public List<String> listKeys() {
lock.readLock().lock();
try {
List<String> keyList = new ArrayList<>(items.size());
for (Map.Entry<String, Deque<MutablePair<DeltaType, Object>>> entry : items.entrySet()) {
keyList.add(entry.getKey());
}
return keyList;
} finally ... | java |
@Override
public Object get(Object obj) {
String key = this.keyOf(obj);
return this.getByKey(key);
} | java |
@Override
public List<Object> list() {
lock.readLock().lock();
List<Object> objects = new ArrayList<>();
try {
// TODO: make a generic deep copy utility
for (Map.Entry<String, Deque<MutablePair<DeltaType, Object>>> entry : items.entrySet()) {
Deque<MutablePair<DeltaType, Object>> copie... | java |
public Deque<MutablePair<DeltaType, Object>> pop(
Consumer<Deque<MutablePair<DeltaType, Object>>> func) throws InterruptedException {
lock.writeLock().lock();
try {
while (true) {
while (queue.isEmpty()) {
notEmpty.await();
}
// there should have data now
St... | java |
private void queueActionLocked(DeltaType actionType, Object obj) {
String id = this.keyOf(obj);
// If object is supposed to be deleted (last event is Deleted),
// then we should ignore Sync events, because it would result in
// recreation of this object.
if (actionType == DeltaType.Sync && this.wil... | java |
private boolean willObjectBeDeletedLocked(String id) {
if (!this.items.containsKey(id)) {
return false;
}
Deque<MutablePair<DeltaType, Object>> deltas = this.items.get(id);
return !(Collections.isEmptyCollection(deltas))
&& deltas.peekLast().getLeft().equals(DeltaType.Deleted);
} | java |
private String keyOf(Object obj) {
Object innerObj = obj;
if (obj instanceof Deque) {
Deque<MutablePair<DeltaType, Object>> deltas = (Deque<MutablePair<DeltaType, Object>>) obj;
if (deltas.size() == 0) {
throw new NoSuchElementException("0 length Deltas object; can't get key");
}
... | java |
private void syncKeyLocked(String key) {
ApiType obj = this.knownObjects.getByKey(key);
if (obj == null) {
return;
}
String id = this.keyOf(obj);
Deque<MutablePair<DeltaType, Object>> deltas = this.items.get(id);
if (deltas != null && !(Collections.isEmptyCollection(deltas))) {
retu... | java |
private Deque<MutablePair<DeltaType, Object>> combineDeltas(
LinkedList<MutablePair<DeltaType, Object>> deltas) {
if (deltas.size() < 2) {
return deltas;
}
int size = deltas.size();
MutablePair<DeltaType, Object> d1 = deltas.peekLast();
MutablePair<DeltaType, Object> d2 = deltas.get(size... | java |
private MutablePair<DeltaType, Object> isDuplicate(
MutablePair<DeltaType, Object> d1, MutablePair<DeltaType, Object> d2) {
MutablePair<DeltaType, Object> deletionDelta = isDeletionDup(d1, d2);
if (deletionDelta != null) {
return deletionDelta;
}
return null;
} | java |
private MutablePair<DeltaType, Object> isDeletionDup(
MutablePair<DeltaType, Object> d1, MutablePair<DeltaType, Object> d2) {
if (!d1.getLeft().equals(DeltaType.Deleted) || !d2.getLeft().equals(DeltaType.Deleted)) {
return null;
}
Object obj = d2.getRight();
if (obj instanceof DeletedFinalSt... | java |
public void run() {
try {
log.info("{}#Start listing and watching...", apiTypeClass);
ApiListType list = listerWatcher.list(new CallGeneratorParams(Boolean.FALSE, null, null));
V1ListMeta listMeta = Reflect.listMetadata(list);
String resourceVersion = listMeta.getResourceVersion();
L... | java |
public static ClientBuilder cluster() throws IOException {
final ClientBuilder builder = new ClientBuilder();
final String host = System.getenv(ENV_SERVICE_HOST);
final String port = System.getenv(ENV_SERVICE_PORT);
builder.setBasePath("https://" + host + ":" + port);
final String token =
... | java |
public static List<String> getAllNameSpaces() throws ApiException {
V1NamespaceList listNamespace =
COREV1_API.listNamespace(
null, "true", null, null, null, 0, null, Integer.MAX_VALUE, Boolean.FALSE);
List<String> list =
listNamespace
.getItems()
.stream()
... | java |
public static List<String> getPods() throws ApiException {
V1PodList v1podList =
COREV1_API.listPodForAllNamespaces(null, null, null, null, null, null, null, null, null);
List<String> podList =
v1podList
.getItems()
.stream()
.map(v1Pod -> v1Pod.getMetadata().... | java |
public static List<String> getNamespacedPod(String namespace, String label) throws ApiException {
V1PodList listNamespacedPod =
COREV1_API.listNamespacedPod(
namespace,
null,
null,
null,
null,
label,
Integer.MAX_VALUE,
... | java |
public static List<String> getServices() throws ApiException {
V1ServiceList listNamespacedService =
COREV1_API.listNamespacedService(
DEFAULT_NAME_SPACE,
null,
null,
null,
null,
null,
Integer.MAX_VALUE,
null,
... | java |
public static void printLog(String namespace, String podName) throws ApiException {
// https://github.com/kubernetes-client/java/blob/master/kubernetes/docs/CoreV1Api.md#readNamespacedPodLog
String readNamespacedPodLog =
COREV1_API.readNamespacedPodLog(
podName,
namespace,
... | java |
public static KubeConfig loadKubeConfig(Reader input) {
Yaml yaml = new Yaml(new SafeConstructor());
Object config = yaml.load(input);
Map<String, Object> configMap = (Map<String, Object>) config;
String currentContext = (String) configMap.get("current-context");
ArrayList<Object> contexts = (Array... | java |
@SuppressWarnings("unchecked")
private String tokenViaExecCredential(Map<String, Object> execMap) {
if (execMap == null) {
return null;
}
String apiVersion = (String) execMap.get("apiVersion");
if (!"client.authentication.k8s.io/v1beta1".equals(apiVersion)
&& !"client.authentication.k8s.... | java |
private Call getNextCall(Integer nextLimit, String continueToken) {
PagerParams params = new PagerParams((nextLimit != null) ? nextLimit : limit, continueToken);
return listFunc.apply(params);
} | java |
private ApiListType executeRequest(Call call) throws IOException, ApiException {
return client.handleResponse(call.execute(), listType);
} | java |
public PortForwardResult forward(V1Pod pod, List<Integer> ports)
throws ApiException, IOException {
return forward(pod.getMetadata().getNamespace(), pod.getMetadata().getName(), ports);
} | java |
public PortForwardResult forward(String namespace, String name, List<Integer> ports)
throws ApiException, IOException {
String path = makePath(namespace, name);
WebSocketStreamHandler handler = new WebSocketStreamHandler();
PortForwardResult result = new PortForwardResult(handler, ports);
List<Pai... | java |
@Override
public void add(ApiType obj) {
String key = keyFunc.apply(obj);
lock.lock();
try {
ApiType oldObj = this.items.get(key);
this.items.put(key, obj);
this.updateIndices(oldObj, obj, key);
} finally {
lock.unlock();
}
} | java |
@Override
public void delete(ApiType obj) {
String key = keyFunc.apply(obj);
lock.lock();
try {
boolean exists = this.items.containsKey(key);
if (exists) {
this.deleteFromIndices(this.items.get(key), key);
this.items.remove(key);
}
} finally {
lock.unlock();
... | java |
@Override
public void replace(List<ApiType> list, String resourceVersion) {
lock.lock();
try {
Map<String, ApiType> newItems = new HashMap<>();
for (ApiType item : list) {
String key = keyFunc.apply(item);
newItems.put(key, item);
}
this.items = newItems;
// rebu... | java |
@Override
public List<String> listKeys() {
lock.lock();
try {
List<String> keys = new ArrayList<>(this.items.size());
for (Map.Entry<String, ApiType> entry : this.items.entrySet()) {
keys.add(entry.getKey());
}
return keys;
} finally {
lock.unlock();
}
} | java |
@Override
public ApiType get(ApiType obj) {
String key = this.keyFunc.apply(obj);
lock.lock();
try {
return this.getByKey(key);
} finally {
lock.unlock();
}
} | java |
@Override
public List<ApiType> list() {
lock.lock();
try {
List<ApiType> itemList = new ArrayList<>(this.items.size());
for (Map.Entry<String, ApiType> entry : this.items.entrySet()) {
itemList.add(entry.getValue());
}
return itemList;
} finally {
lock.unlock();
}... | java |
@Override
public List<ApiType> index(String indexName, Object obj) {
lock.lock();
try {
if (!this.indexers.containsKey(indexName)) {
throw new IllegalArgumentException(String.format("index %s doesn't exist!", indexName));
}
Function<ApiType, List<String>> indexFunc = this.indexers.ge... | java |
@Override
public List<String> indexKeys(String indexName, String indexKey) {
lock.lock();
try {
if (!this.indexers.containsKey(indexName)) {
throw new IllegalArgumentException(String.format("index %s doesn't exist!", indexName));
}
Map<String, Set<String>> index = this.indices.get(in... | java |
@Override
public List<ApiType> byIndex(String indexName, String indexKey) {
lock.lock();
try {
if (!this.indexers.containsKey(indexName)) {
throw new IllegalArgumentException(String.format("index %s doesn't exist!", indexName));
}
Map<String, Set<String>> index = this.indices.get(ind... | java |
public void updateIndices(ApiType oldObj, ApiType newObj, String key) {
// if we got an old object, we need to remove it before we can add
// it again.
if (oldObj != null) {
deleteFromIndices(oldObj, key);
}
for (Map.Entry<String, Function<ApiType, List<String>>> indexEntry : indexers.entrySet... | java |
private void deleteFromIndices(ApiType oldObj, String key) {
for (Map.Entry<String, Function<ApiType, List<String>>> indexEntry : this.indexers.entrySet()) {
Function<ApiType, List<String>> indexFunc = indexEntry.getValue();
List<String> indexValues = indexFunc.apply(oldObj);
if (io.kubernetes.cli... | java |
public static <ApiType> String deletionHandlingMetaNamespaceKeyFunc(ApiType object) {
if (object instanceof DeltaFIFO.DeletedFinalStateUnknown) {
DeltaFIFO.DeletedFinalStateUnknown deleteObj = (DeltaFIFO.DeletedFinalStateUnknown) object;
return deleteObj.getKey();
}
return metaNamespaceKeyFunc(o... | java |
public static List<String> metaNamespaceIndexFunc(Object obj) {
try {
V1ObjectMeta metadata = Reflect.objectMetadata(obj);
if (metadata == null) {
return Collections.emptyList();
}
return Collections.singletonList(metadata.getNamespace());
} catch (ObjectMetaReflectException e) {... | java |
public <T extends Message> ObjectOrStatus<T> list(T.Builder builder, String path)
throws ApiException, IOException {
return get(builder, path);
} | java |
public <T extends Message> ObjectOrStatus<T> create(
T obj, String path, String apiVersion, String kind) throws ApiException, IOException {
return request(obj.newBuilderForType(), path, "POST", obj, apiVersion, kind);
} | java |
public <T extends Message> ObjectOrStatus<T> request(
T.Builder builder, String path, String method, T body, String apiVersion, String kind)
throws ApiException, IOException {
HashMap<String, String> headers = new HashMap<>();
headers.put("Content-Type", MEDIA_TYPE);
headers.put("Accept", MEDIA_... | java |
public static void stream(String path, String method, ApiClient client, SocketListener listener)
throws ApiException, IOException {
stream(path, method, new ArrayList<Pair>(), client, listener);
} | java |
public synchronized InputStream getInputStream(int stream) {
if (state == State.CLOSED) throw new IllegalStateException();
if (!input.containsKey(stream)) {
try {
PipedInputStream pipeIn = new PipedInputStream();
PipedOutputStream pipeOut = new PipedOutputStream(pipeIn);
pi... | java |
public synchronized OutputStream getOutputStream(int stream) {
if (!output.containsKey(stream)) {
output.put(stream, new WebSocketOutputStream(stream));
}
return output.get(stream);
} | java |
private synchronized OutputStream getSocketInputOutputStream(int stream) {
if (!pipedOutput.containsKey(stream)) {
try {
PipedInputStream pipeIn = new PipedInputStream();
PipedOutputStream pipeOut = new PipedOutputStream(pipeIn);
pipedOutput.put(stream, pipeOut);
input.pu... | java |
@Override
public void addEventHandlerWithResyncPeriod(
ResourceEventHandler<ApiType> handler, long resyncPeriodMillis) {
if (stopped) {
log.info(
"DefaultSharedIndexInformer#Handler was not added to shared informer because it has stopped already");
return;
}
if (resyncPeriodMi... | java |
private void handleDeltas(Deque<MutablePair<DeltaFIFO.DeltaType, Object>> deltas) {
if (Collections.isEmptyCollection(deltas)) {
return;
}
// from oldest to newest
for (MutablePair<DeltaFIFO.DeltaType, Object> delta : deltas) {
DeltaFIFO.DeltaType deltaType = delta.getLeft();
switch (... | java |
public static <T> T loadAs(String content, Class<T> clazz) {
return getSnakeYaml().loadAs(new StringReader(content), clazz);
} | java |
public static <T> T loadAs(File f, Class<T> clazz) throws IOException {
return getSnakeYaml().loadAs(new FileReader(f), clazz);
} | java |
public static <T> T loadAs(Reader reader, Class<T> clazz) {
return getSnakeYaml().loadAs(reader, clazz);
} | java |
public static void dumpAll(Iterator<? extends Object> data, Writer output) {
getSnakeYaml().dumpAll(data, output);
} | java |
public synchronized <ApiType, ApiListType> SharedIndexInformer<ApiType> sharedIndexInformerFor(
Function<CallGeneratorParams, Call> callGenerator,
Class<ApiType> apiTypeClass,
Class<ApiListType> apiListTypeClass) {
return sharedIndexInformerFor(callGenerator, apiTypeClass, apiListTypeClass, 0);
... | java |
public synchronized void startAllRegisteredInformers() {
if (Collections.isEmptyMap(informers)) {
return;
}
informers.forEach(
(informerType, informer) -> {
if (!startedInformers.containsKey(informerType)) {
startedInformers.put(informerType, informerExecutor.submit(infor... | java |
public synchronized void stopAllRegisteredInformers() {
if (Collections.isEmptyMap(informers)) {
return;
}
informers.forEach(
(informerType, informer) -> {
if (startedInformers.containsKey(informerType)) {
startedInformers.remove(informerType);
informer.stop()... | java |
public void setSwipeItemMenuEnabled(int position, boolean enabled) {
if (enabled) {
if (mDisableSwipeItemMenuList.contains(position)) {
mDisableSwipeItemMenuList.remove(Integer.valueOf(position));
}
} else {
if (!mDisableSwipeItemMenuList.contains(posi... | java |
public void addHeaderView(View view) {
mHeaderViewList.add(view);
if (mAdapterWrapper != null) {
mAdapterWrapper.addHeaderViewAndNotify(view);
}
} | java |
public void removeHeaderView(View view) {
mHeaderViewList.remove(view);
if (mAdapterWrapper != null) {
mAdapterWrapper.removeHeaderViewAndNotify(view);
}
} | java |
public void addFooterView(View view) {
mFooterViewList.add(view);
if (mAdapterWrapper != null) {
mAdapterWrapper.addFooterViewAndNotify(view);
}
} | java |
public final void expandParent(int parentPosition) {
if (!isExpanded(parentPosition)) {
mExpandItemArray.append(parentPosition, true);
int position = positionFromParentPosition(parentPosition);
int childCount = childItemCount(parentPosition);
notifyItemRangeInser... | java |
public final void collapseParent(int parentPosition) {
if (isExpanded(parentPosition)) {
mExpandItemArray.append(parentPosition, false);
int position = positionFromParentPosition(parentPosition);
int childCount = childItemCount(parentPosition);
notifyItemRangeRem... | java |
public final boolean isParentItem(int adapterPosition) {
int itemCount = 0;
int parentCount = parentItemCount();
for (int i = 0; i < parentCount; i++) {
if (itemCount == adapterPosition) {
return true;
}
itemCount += 1;
if (isExp... | java |
public final int parentItemPosition(int adapterPosition) {
int itemCount = 0;
for (int i = 0; i < parentItemCount(); i++) {
itemCount += 1;
if (isExpanded(i)) {
int childCount = childItemCount(i);
itemCount += childCount;
}
... | java |
public final int childItemPosition(int childAdapterPosition) {
int itemCount = 0;
int parentCount = parentItemCount();
for (int i = 0; i < parentCount; i++) {
itemCount += 1;
if (isExpanded(i)) {
int childCount = childItemCount(i);
itemCo... | java |
public void drawLeft(View view, Canvas c) {
int left = view.getLeft() - mWidth;
int top = view.getTop() - mHeight;
int right = left + mWidth;
int bottom = view.getBottom() + mHeight;
mDivider.setBounds(left, top, right, bottom);
mDivider.draw(c);
} | java |
private int getSwipeDuration(MotionEvent ev, int velocity) {
int sx = getScrollX();
int dx = (int)(ev.getX() - sx);
final int width = mSwipeCurrentHorizontal.getMenuWidth();
final int halfWidth = width / 2;
final float distanceRatio = Math.min(1f, 1.0f * Math.abs(dx) / width);
... | java |
protected MapTileModuleProviderBase findNextAppropriateProvider(final MapTileRequestState aState) {
MapTileModuleProviderBase provider;
boolean providerDoesntExist = false, providerCantGetDataConnection = false, providerCantServiceZoomlevel = false;
// The logic of the while statement is
// "Keep looping until ... | java |
private void reloadMarker(BoundingBox latLonArea, double zoom) {
Log.d(TAG,"reloadMarker " + latLonArea + ", zoom " + zoom);
this.mCurrentBackgroundMarkerLoaderTask = new BackgroundMarkerLoaderTask();
this.mCurrentBackgroundMarkerLoaderTask.execute(
latLonArea.getLatSouth(), latL... | java |
private long next() {
while(true) {
final long index;
synchronized (mTileAreas) {
if(!mTileIndices.hasNext()) {
return -1;
}
index = mTileIndices.next();
}
final Drawable drawable = mCache.getMapT... | java |
private void search(final long pMapTileIndex) {
for (final MapTileModuleProviderBase provider : mProviders) {
try {
if (provider instanceof MapTileDownloader) {
final ITileSource tileSource = ((MapTileDownloader) provider).getTileSource();
if (... | java |
private void promptForFiles() {
DialogProperties properties = new DialogProperties();
properties.selection_mode = DialogConfigs.MULTI_MODE;
properties.selection_type = DialogConfigs.FILE_SELECT;
properties.root = new File(DialogConfigs.DEFAULT_DIR);
properties.error_dir = new Fil... | java |
private void promptForTileSource() {
AlertDialog.Builder builderSingle = new AlertDialog.Builder(getContext());
builderSingle.setIcon(R.drawable.icon);
builderSingle.setTitle("Select Offline Tile source:-");
final ArrayAdapter<ITileSource> arrayAdapter = new ArrayAdapter<ITileSource>(ge... | java |
public synchronized Drawable renderTile(final long pMapTileIndex) {
Tile tile = new Tile(MapTileIndex.getX(pMapTileIndex), MapTileIndex.getY(pMapTileIndex), (byte) MapTileIndex.getZoom(pMapTileIndex), 256);
model.setFixedTileSize(256);
//You could try something like this to load a custom theme... | java |
public GeoPoint destinationPoint(final double aDistanceInMeters, final double aBearingInDegrees) {
// convert distance to angular distance
final double dist = aDistanceInMeters / RADIUS_EARTH_METERS;
// convert bearing to radians
final double brng = DEG2RAD * aBearingInDegrees;
// get current location in r... | java |
public static double getSquaredDistanceToPoint(
final double pFromX, final double pFromY, final double pToX, final double pToY) {
final double dX = pFromX - pToX;
final double dY = pFromY - pToY;
return dX * dX + dY * dY;
} | java |
public static double getSquaredDistanceToLine(
final double pFromX, final double pFromY,
final double pAX, final double pAY, final double pBX, final double pBY
) {
return getSquaredDistanceToProjection(pFromX, pFromY, pAX, pAY, pBX, pBY,
getProjectionFactorToLine(pFro... | java |
public static double getSquaredDistanceToSegment(
final double pFromX, final double pFromY,
final double pAX, final double pAY, final double pBX, final double pBY
) {
return getSquaredDistanceToProjection(pFromX, pFromY, pAX, pAY, pBX, pBY,
getProjectionFactorToSegmen... | java |
private static double dotProduct(
final double pAX, final double pAY, final double pBX, final double pBY,
final double pCX, final double pCY) {
return (pBX - pAX) * (pCX - pAX) + (pBY - pAY) * (pCY - pAY);
} | java |
private void debugProjection() {
new Thread() {
@Override
public void run() {
// let the map get redrawn and a new projection calculated
try {
sleep(1000);
} catch (InterruptedException ignore) {
}
... | java |
private static void run(final String pServerURL, final String pDestinationFile, final String pTempFolder, final int pThreadCount, final String pFileAppendix, final int pMinZoom, final int pMaxZoom, final double pNorth, final double pSouth, final double pEast, final double pWest) {
new File(pTempFolder).mkdir... | java |
public void disableCompass() {
mIsCompassEnabled = false;
if (mOrientationProvider != null) {
mOrientationProvider.stopOrientationProvider();
}
// Reset values
mAzimuth = Float.NaN;
// Update the screen to see changes take effect
if (mMapView != nul... | java |
private void createCompassRosePicture() {
// Paint design of north triangle (it's common to paint north in red color)
final Paint northPaint = new Paint();
northPaint.setColor(0xFFA00000);
northPaint.setAntiAlias(true);
northPaint.setStyle(Style.FILL);
northPaint.setAlpha... | java |
private void createPointerPicture() {
final Paint arrowPaint = new Paint();
arrowPaint.setColor(Color.BLACK);
arrowPaint.setAntiAlias(true);
arrowPaint.setStyle(Style.FILL);
arrowPaint.setAlpha(220);
// Create a little white dot in the middle of the compass rose
... | java |
static double wrap(double n, double min, double max) {
return (n >= min && n < max) ? n : (mod(n - min, max - min) + min);
} | java |
public static double computeHeading(IGeoPoint from, IGeoPoint to) {
// http://williams.best.vwh.net/avform.htm#Crs
double fromLat = toRadians(from.getLatitude());
double fromLng = toRadians(from.getLongitude());
double toLat = toRadians(to.getLatitude());
double toLng = toRadians... | java |
public static IGeoPoint computeOffsetOrigin(IGeoPoint to, double distance, double heading) {
heading = toRadians(heading);
distance /= EARTH_RADIUS;
// http://lists.maptools.org/pipermail/proj/2008-October/003939.html
double n1 = cos(distance);
double n2 = sin(distance) * cos(hea... | java |
public static IGeoPoint interpolate(IGeoPoint from, IGeoPoint to, double fraction) {
// http://en.wikipedia.org/wiki/Slerp
double fromLat = toRadians(from.getLatitude());
double fromLng = toRadians(from.getLongitude());
double toLat = toRadians(to.getLatitude());
double toLng = t... | java |
private static double distanceRadians(double lat1, double lng1, double lat2, double lng2) {
return arcHav(havDistance(lat1, lat2, lng1 - lng2));
} | java |
static double computeAngleBetween(IGeoPoint from, IGeoPoint to) {
return distanceRadians(toRadians(from.getLatitude()), toRadians(from.getLongitude()),
toRadians(to.getLatitude()), toRadians(to.getLongitude()));
} | java |
public static double computeLength(List<IGeoPoint> path) {
if (path.size() < 2) {
return 0;
}
double length = 0;
IGeoPoint prev = path.get(0);
double prevLat = toRadians(prev.getLatitude());
double prevLng = toRadians(prev.getLongitude());
for (IGeoPoi... | java |
static double computeSignedArea(List<IGeoPoint> path, double radius) {
int size = path.size();
if (size < 3) { return 0; }
double total = 0;
IGeoPoint prev = path.get(size - 1);
double prevTanLat = tan((PI / 2 - toRadians(prev.getLatitude())) / 2);
double prevLng = toRadi... | java |
public void protectDisplayedTilesForCache(final Canvas pCanvas, final Projection pProjection) {
if (!setViewPort(pCanvas, pProjection)) {
return;
}
TileSystem.getTileFromMercator(mViewPort, TileSystem.getTileSize(mProjection.getZoomLevel()), mProtectedTiles);
final int tileZoomLevel = TileSystem.getInputTile... | java |
protected boolean setViewPort(final Canvas pCanvas, final Projection pProjection) {
setProjection(pProjection);
getProjection().getMercatorViewPort(mViewPort);
return true;
} | java |
public static void closeStream(final Closeable stream) {
if (stream != null) {
try {
stream.close();
} catch (final IOException e) {
//don't use android classes here, since this class is used outside of android
e.printStackTrace();
}
}
} | java |
private void addPoints(final List<GeoPoint> pPoints,
final double pBeginLat, final double pBeginLon,
final double pEndLat, final double pEndLon) {
final double increment = 10; // in degrees
pPoints.add(new GeoPoint(pBeginLat, pBeginLon));
dou... | java |
void buildLinePortion(final Projection pProjection,
final boolean pStorePoints){
final int size = mOriginalPoints.size();
if (size < 2) { // nothing to paint
return;
}
computeProjected(pProjection);
computeDistances();
final PointL offset = new PointL();
getBestOffset(pProjection, o... | java |
boolean isCloseTo(final GeoPoint pPoint, final double tolerance,
final Projection pProjection, final boolean pClosePath) {
return getCloseTo(pPoint, tolerance, pProjection, pClosePath) != null;
} | java |
static public ImageryMetaDataResource getInstanceFromJSON(final JSONObject a_jsonObject, final JSONObject parent) throws Exception
{
final ImageryMetaDataResource result = new ImageryMetaDataResource();
if(a_jsonObject==null) {
throw new Exception("JSON to parse is null");
}
result.copyright = parent.getSt... | java |
public synchronized String getSubDomain()
{
if(m_imageUrlSubdomains==null || m_imageUrlSubdomains.length<=0) {
return null;
}
final String result = m_imageUrlSubdomains[m_subdomainsCounter];
if(m_subdomainsCounter<m_imageUrlSubdomains.length-1) {
m_subdomainsCounter++;
} else {
m_subdomainsCounter=... | java |
public static ITileSource getTileSource(final String aName) throws IllegalArgumentException {
for (final ITileSource tileSource : mTileSources) {
if (tileSource.name().equals(aName)) {
return tileSource;
}
}
throw new IllegalArgumentException("No such tile source: " + aName);
} | java |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.