idx int64 0 165k | question stringlengths 73 5.81k | target stringlengths 5 918 |
|---|---|---|
153,000 | 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 . knownObjects == null )... | Replace the item forcibly . |
153,001 | 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 ( ) ; } } | Re - sync the delta FIFO . First It locks the queue to block any more write operation until it finishes processing all the pending items in the queue . |
153,002 | 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... | List keys list . |
153,003 | public Object get ( Object obj ) { String key = this . keyOf ( obj ) ; return this . getByKey ( key ) ; } | Get object . |
153,004 | public List < Object > list ( ) { lock . readLock ( ) . lock ( ) ; List < Object > objects = new ArrayList < > ( ) ; try { for ( Map . Entry < String , Deque < MutablePair < DeltaType , Object > > > entry : items . entrySet ( ) ) { Deque < MutablePair < DeltaType , Object > > copiedDeltas = new LinkedList < > ( entry .... | List list . |
153,005 | 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 ( ) ; } String id = this . queue . removeFirst ( ) ; if ( thi... | Pop deltas . |
153,006 | private void queueActionLocked ( DeltaType actionType , Object obj ) { String id = this . keyOf ( obj ) ; if ( actionType == DeltaType . Sync && this . willObjectBeDeletedLocked ( id ) ) { return ; } Deque < MutablePair < DeltaType , Object > > deltas = items . get ( id ) ; if ( deltas == null ) { Deque < MutablePair <... | queueActionLocked appends to the delta list for the object . Caller must hold the lock . |
153,007 | 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 . ... | willObjectBeDeletedLocked returns true only if the last delta for the give object is Deleted . Caller must hold the lock . |
153,008 | 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" ) ; } innerO... | DeletedFinalStateUnknown objects . |
153,009 | 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 ) ) ... | Add Sync delta . Caller must hold the lock . |
153,010 | 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... | order . This will combine the most recent two deltas if they are the same . |
153,011 | 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 ; } | If d1 & d2 represent the same event returns the delta that ought to be kept . |
153,012 | 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 insta... | keep the one with the most information if both are deletions . |
153,013 | 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 ( ) ; List... | run first lists all items and get the resource version at the moment of call and then use the resource version to watch . |
153,014 | 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 = new Str... | Creates a builder which is pre - configured from the cluster configuration . |
153,015 | 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 ( ) . map ( v1Namespace -> v1Namesp... | Get all namespaces in k8s cluster |
153,016 | 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 ( ) . getName ( ) ) . collect... | List all pod names in all namespaces in k8s cluster |
153,017 | 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 , null , TIME_OUT_VALUE , Boolean . FALSE ) ; List < String > listPods = listNamespa... | List pod in specific namespace with label |
153,018 | public static List < String > getServices ( ) throws ApiException { V1ServiceList listNamespacedService = COREV1_API . listNamespacedService ( DEFAULT_NAME_SPACE , null , null , null , null , null , Integer . MAX_VALUE , null , TIME_OUT_VALUE , Boolean . FALSE ) ; return listNamespacedService . getItems ( ) . stream ( ... | List all Services in default namespace |
153,019 | public static void printLog ( String namespace , String podName ) throws ApiException { String readNamespacedPodLog = COREV1_API . readNamespacedPodLog ( podName , namespace , null , Boolean . FALSE , Integer . MAX_VALUE , null , Boolean . FALSE , Integer . MAX_VALUE , 40 , Boolean . FALSE ) ; System . out . println ( ... | Print out the Log for specific Pods |
153,020 | 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 > c... | Load a Kubernetes config from a Reader |
153,021 | @ 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.io... | Attempt to create an access token by running a configured external program . |
153,022 | private Call getNextCall ( Integer nextLimit , String continueToken ) { PagerParams params = new PagerParams ( ( nextLimit != null ) ? nextLimit : limit , continueToken ) ; return listFunc . apply ( params ) ; } | returns next list call by setting continue variable and limit |
153,023 | private ApiListType executeRequest ( Call call ) throws IOException , ApiException { return client . handleResponse ( call . execute ( ) , listType ) ; } | executes the list call and sets the continue variable for next list call |
153,024 | public PortForwardResult forward ( V1Pod pod , List < Integer > ports ) throws ApiException , IOException { return forward ( pod . getMetadata ( ) . getNamespace ( ) , pod . getMetadata ( ) . getName ( ) , ports ) ; } | PortForward to a container |
153,025 | 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 < P... | PortForward to a container . |
153,026 | 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 ( ) ; } } | Add objects . |
153,027 | 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 ( ) ; } } | Delete the object . |
153,028 | 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 ; this . indices = new HashMap < > ( ... | Replace the content in the cache completely . |
153,029 | 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 ( ) ; } } | List keys . |
153,030 | public ApiType get ( ApiType obj ) { String key = this . keyFunc . apply ( obj ) ; lock . lock ( ) ; try { return this . getByKey ( key ) ; } finally { lock . unlock ( ) ; } } | Get object t . |
153,031 | 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 ( ) ; } } | List all objects in the cache . |
153,032 | 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 . get (... | Get objects . |
153,033 | 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 ( ind... | Index keys list . |
153,034 | 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 ( inde... | By index list . |
153,035 | public void updateIndices ( ApiType oldObj , ApiType newObj , String key ) { if ( oldObj != null ) { deleteFromIndices ( oldObj , key ) ; } for ( Map . Entry < String , Function < ApiType , List < String > > > indexEntry : indexers . entrySet ( ) ) { String indexName = indexEntry . getKey ( ) ; Function < ApiType , Lis... | updateIndices modifies the objects location in the managed indexes if this is an update you must provide an oldObj . |
153,036 | 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 )... | deleteFromIndices removes the object from each of the managed indexes . |
153,037 | public static < ApiType > String deletionHandlingMetaNamespaceKeyFunc ( ApiType object ) { if ( object instanceof DeltaFIFO . DeletedFinalStateUnknown ) { DeltaFIFO . DeletedFinalStateUnknown deleteObj = ( DeltaFIFO . DeletedFinalStateUnknown ) object ; return deleteObj . getKey ( ) ; } return metaNamespaceKeyFunc ( ob... | deletionHandlingMetaNamespaceKeyFunc checks for DeletedFinalStateUnknown objects before calling metaNamespaceKeyFunc . |
153,038 | 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 ) { throw ne... | metaNamespaceIndexFunc is a default index function that indexes based on an object s namespace . |
153,039 | public < T extends Message > ObjectOrStatus < T > list ( T . Builder builder , String path ) throws ApiException , IOException { return get ( builder , path ) ; } | List is fluent semantic sugar method on top of get which is intended to convey that the object is a List of objects rather than a single object |
153,040 | 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 ) ; } | Create a Kubernetes API object using protocol buffer encoding . Performs a POST |
153,041 | 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 ( "Acce... | Generic protocol buffer based HTTP request . Not intended for general consumption but public for advance use cases . |
153,042 | public static void stream ( String path , String method , ApiClient client , SocketListener listener ) throws ApiException , IOException { stream ( path , method , new ArrayList < Pair > ( ) , client , listener ) ; } | Create a new WebSocket stream |
153,043 | 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 ) ; pipedOutput . put ( str... | Get a specific input stream using its identifier . Caller is responsible for closing these streams . |
153,044 | public synchronized OutputStream getOutputStream ( int stream ) { if ( ! output . containsKey ( stream ) ) { output . put ( stream , new WebSocketOutputStream ( stream ) ) ; } return output . get ( stream ) ; } | Gets a specific output stream using it s identified |
153,045 | 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 . put ( stream , pipeIn )... | Get the pipe to write data to a specific InputStream . This is called when new data is read from the web socket to send the data on to the right stream . |
153,046 | 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 ( resyncPeriodMillis > 0 ) { if ( resyncPeriodMillis <... | add event callback with a resync period |
153,047 | private void handleDeltas ( Deque < MutablePair < DeltaFIFO . DeltaType , Object > > deltas ) { if ( Collections . isEmptyCollection ( deltas ) ) { return ; } for ( MutablePair < DeltaFIFO . DeltaType , Object > delta : deltas ) { DeltaFIFO . DeltaType deltaType = delta . getLeft ( ) ; switch ( deltaType ) { case Sync ... | handleDeltas handles deltas and call processor distribute . |
153,048 | public static < T > T loadAs ( String content , Class < T > clazz ) { return getSnakeYaml ( ) . loadAs ( new StringReader ( content ) , clazz ) ; } | Load an API object from a YAML string representation . Returns a concrete typed object using the type specified . |
153,049 | public static < T > T loadAs ( File f , Class < T > clazz ) throws IOException { return getSnakeYaml ( ) . loadAs ( new FileReader ( f ) , clazz ) ; } | Load an API object from a YAML file . Returns a concrete typed object using the type specified . |
153,050 | public static < T > T loadAs ( Reader reader , Class < T > clazz ) { return getSnakeYaml ( ) . loadAs ( reader , clazz ) ; } | Load an API object from a YAML stream . Returns a concrete typed object using the type specified . |
153,051 | public static void dumpAll ( Iterator < ? extends Object > data , Writer output ) { getSnakeYaml ( ) . dumpAll ( data , output ) ; } | Takes an Iterator of YAML API objects and writes a YAML String representing all of them . |
153,052 | public synchronized < ApiType , ApiListType > SharedIndexInformer < ApiType > sharedIndexInformerFor ( Function < CallGeneratorParams , Call > callGenerator , Class < ApiType > apiTypeClass , Class < ApiListType > apiListTypeClass ) { return sharedIndexInformerFor ( callGenerator , apiTypeClass , apiListTypeClass , 0 )... | Shared index informer for shared index informer . |
153,053 | public synchronized void startAllRegisteredInformers ( ) { if ( Collections . isEmptyMap ( informers ) ) { return ; } informers . forEach ( ( informerType , informer ) -> { if ( ! startedInformers . containsKey ( informerType ) ) { startedInformers . put ( informerType , informerExecutor . submit ( informer :: run ) ) ... | Start all registered informers . |
153,054 | public synchronized void stopAllRegisteredInformers ( ) { if ( Collections . isEmptyMap ( informers ) ) { return ; } informers . forEach ( ( informerType , informer ) -> { if ( startedInformers . containsKey ( informerType ) ) { startedInformers . remove ( informerType ) ; informer . stop ( ) ; } } ) ; informerExecutor... | Stop all registered informers . |
153,055 | public void setSwipeItemMenuEnabled ( int position , boolean enabled ) { if ( enabled ) { if ( mDisableSwipeItemMenuList . contains ( position ) ) { mDisableSwipeItemMenuList . remove ( Integer . valueOf ( position ) ) ; } } else { if ( ! mDisableSwipeItemMenuList . contains ( position ) ) { mDisableSwipeItemMenuList .... | Set the item menu to enable status . |
153,056 | public void addHeaderView ( View view ) { mHeaderViewList . add ( view ) ; if ( mAdapterWrapper != null ) { mAdapterWrapper . addHeaderViewAndNotify ( view ) ; } } | Add view at the headers . |
153,057 | public void removeHeaderView ( View view ) { mHeaderViewList . remove ( view ) ; if ( mAdapterWrapper != null ) { mAdapterWrapper . removeHeaderViewAndNotify ( view ) ; } } | Remove view from header . |
153,058 | public void addFooterView ( View view ) { mFooterViewList . add ( view ) ; if ( mAdapterWrapper != null ) { mAdapterWrapper . addFooterViewAndNotify ( view ) ; } } | Add view at the footer . |
153,059 | public final void expandParent ( int parentPosition ) { if ( ! isExpanded ( parentPosition ) ) { mExpandItemArray . append ( parentPosition , true ) ; int position = positionFromParentPosition ( parentPosition ) ; int childCount = childItemCount ( parentPosition ) ; notifyItemRangeInserted ( position + 1 , childCount )... | Expand parent . |
153,060 | public final void collapseParent ( int parentPosition ) { if ( isExpanded ( parentPosition ) ) { mExpandItemArray . append ( parentPosition , false ) ; int position = positionFromParentPosition ( parentPosition ) ; int childCount = childItemCount ( parentPosition ) ; notifyItemRangeRemoved ( position + 1 , childCount )... | Collapse parent . |
153,061 | 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 ( isExpanded ( i ) ) { itemCount += childItemCount ( i ) ; } else { } } return fa... | Item is a parent item . |
153,062 | 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 ; } if ( adapterPosition < itemCount ) { return i ; } } throw new IllegalState... | Get the position of the parent item from the adapter position . |
153,063 | 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 ) ; itemCount += childCount ; if ( childAdapterPosition < itemCount ) ... | Get the position of the child item from the adapter position . |
153,064 | 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 ) ; } | Draw the divider on the left side of the Item . |
153,065 | 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 ) ; final f... | compute finish duration . |
153,066 | protected MapTileModuleProviderBase findNextAppropriateProvider ( final MapTileRequestState aState ) { MapTileModuleProviderBase provider ; boolean providerDoesntExist = false , providerCantGetDataConnection = false , providerCantServiceZoomlevel = false ; do { provider = aState . getNextProvider ( ) ; if ( provider !=... | We want to not use a provider that doesn t exist anymore in the chain and we want to not use a provider that requires a data connection when one is not available . |
153,067 | private void reloadMarker ( BoundingBox latLonArea , double zoom ) { Log . d ( TAG , "reloadMarker " + latLonArea + ", zoom " + zoom ) ; this . mCurrentBackgroundMarkerLoaderTask = new BackgroundMarkerLoaderTask ( ) ; this . mCurrentBackgroundMarkerLoaderTask . execute ( latLonArea . getLatSouth ( ) , latLonArea . getL... | called by MapView if zoom or scroll has changed to reload marker for new visible region |
153,068 | private long next ( ) { while ( true ) { final long index ; synchronized ( mTileAreas ) { if ( ! mTileIndices . hasNext ( ) ) { return - 1 ; } index = mTileIndices . next ( ) ; } final Drawable drawable = mCache . getMapTile ( index ) ; if ( drawable == null ) { return index ; } } } | Get the next tile to search for |
153,069 | private void search ( final long pMapTileIndex ) { for ( final MapTileModuleProviderBase provider : mProviders ) { try { if ( provider instanceof MapTileDownloader ) { final ITileSource tileSource = ( ( MapTileDownloader ) provider ) . getTileSource ( ) ; if ( tileSource instanceof OnlineTileSourceBase ) { if ( ! ( ( O... | Search for a tile bitmap into the list of providers and put it in the memory cache |
153,070 | 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 File ( DialogConfi... | step 1 users selects files |
153,071 | 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 > (... | step 3 ask for the tile source |
153,072 | 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 ) ; if ( mapDatabase == null ) return null ; try { Rend... | The synchronized here is VERY important . If missing the mapDatabase read gets corrupted by multiple threads reading the file at once . |
153,073 | public GeoPoint destinationPoint ( final double aDistanceInMeters , final double aBearingInDegrees ) { final double dist = aDistanceInMeters / RADIUS_EARTH_METERS ; final double brng = DEG2RAD * aBearingInDegrees ; final double lat1 = DEG2RAD * getLatitude ( ) ; final double lon1 = DEG2RAD * getLongitude ( ) ; final do... | Calculate a point that is the specified distance and bearing away from this point . |
153,074 | 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 ; } | Square of the distance between two points |
153,075 | 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 ( pFromX , pFromY , pAX , pAY , pBX , pBY ... | Square of the distance between a point and line AB |
153,076 | 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 , getProjectionFactorToSegment ( pFromX , pFromY , pAX , pAY , pBX ... | Square of the distance between a point and segment AB |
153,077 | 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 ) ; } | Compute the dot product AB x AC |
153,078 | private void debugProjection ( ) { new Thread ( ) { public void run ( ) { try { sleep ( 1000 ) ; } catch ( InterruptedException ignore ) { } runOnUiThread ( new Runnable ( ) { public void run ( ) { final IProjection projection = mMap . getProjection ( ) ; final IGeoPoint northEast = projection . getNorthEast ( ) ; fina... | This is just used for debugging |
153,079 | 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 ) ... | this starts executing the download and packaging |
153,080 | public void disableCompass ( ) { mIsCompassEnabled = false ; if ( mOrientationProvider != null ) { mOrientationProvider . stopOrientationProvider ( ) ; } mAzimuth = Float . NaN ; if ( mMapView != null ) { this . invalidateCompass ( ) ; } } | Disable orientation updates . |
153,081 | private void createCompassRosePicture ( ) { final Paint northPaint = new Paint ( ) ; northPaint . setColor ( 0xFFA00000 ) ; northPaint . setAntiAlias ( true ) ; northPaint . setStyle ( Style . FILL ) ; northPaint . setAlpha ( 220 ) ; final Paint southPaint = new Paint ( ) ; southPaint . setColor ( Color . BLACK ) ; sou... | A conventional red and black compass needle . |
153,082 | private void createPointerPicture ( ) { final Paint arrowPaint = new Paint ( ) ; arrowPaint . setColor ( Color . BLACK ) ; arrowPaint . setAntiAlias ( true ) ; arrowPaint . setStyle ( Style . FILL ) ; arrowPaint . setAlpha ( 220 ) ; final Paint centerPaint = new Paint ( ) ; centerPaint . setColor ( Color . WHITE ) ; ce... | A black pointer arrow . |
153,083 | static double wrap ( double n , double min , double max ) { return ( n >= min && n < max ) ? n : ( mod ( n - min , max - min ) + min ) ; } | Wraps the given value into the inclusive - exclusive interval between min and max . |
153,084 | public static double computeHeading ( IGeoPoint from , IGeoPoint to ) { double fromLat = toRadians ( from . getLatitude ( ) ) ; double fromLng = toRadians ( from . getLongitude ( ) ) ; double toLat = toRadians ( to . getLatitude ( ) ) ; double toLng = toRadians ( to . getLongitude ( ) ) ; double dLng = toLng - fromLng ... | Returns the heading from one LatLng to another LatLng . Headings are expressed in degrees clockwise from North within the range [ - 180 180 ) . |
153,085 | public static IGeoPoint computeOffsetOrigin ( IGeoPoint to , double distance , double heading ) { heading = toRadians ( heading ) ; distance /= EARTH_RADIUS ; double n1 = cos ( distance ) ; double n2 = sin ( distance ) * cos ( heading ) ; double n3 = sin ( distance ) * sin ( heading ) ; double n4 = sin ( toRadians ( to... | Returns the location of origin when provided with a IGeoPoint destination meters travelled and original heading . Headings are expressed in degrees clockwise from North . This function returns null when no solution is available . |
153,086 | public static IGeoPoint interpolate ( IGeoPoint from , IGeoPoint to , double fraction ) { double fromLat = toRadians ( from . getLatitude ( ) ) ; double fromLng = toRadians ( from . getLongitude ( ) ) ; double toLat = toRadians ( to . getLatitude ( ) ) ; double toLng = toRadians ( to . getLongitude ( ) ) ; double cosFr... | Returns the IGeoPoint which lies the given fraction of the way between the origin IGeoPoint and the destination IGeoPoint . |
153,087 | private static double distanceRadians ( double lat1 , double lng1 , double lat2 , double lng2 ) { return arcHav ( havDistance ( lat1 , lat2 , lng1 - lng2 ) ) ; } | Returns distance on the unit sphere ; the arguments are in radians . |
153,088 | static double computeAngleBetween ( IGeoPoint from , IGeoPoint to ) { return distanceRadians ( toRadians ( from . getLatitude ( ) ) , toRadians ( from . getLongitude ( ) ) , toRadians ( to . getLatitude ( ) ) , toRadians ( to . getLongitude ( ) ) ) ; } | Returns the angle between two IGeoPoints in radians . This is the same as the distance on the unit sphere . |
153,089 | 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 ( IGeoPoint point : path ) { double lat ... | Returns the length of the given path in meters on Earth . |
153,090 | 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 = toRadians ( prev . ... | Returns the signed area of a closed path on a sphere of given radius . The computed area uses the same units as the radius squared . Used by SphericalUtilTest . |
153,091 | 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 = TileS... | Populates the tile provider s memory cache with the list of displayed tiles |
153,092 | protected boolean setViewPort ( final Canvas pCanvas , final Projection pProjection ) { setProjection ( pProjection ) ; getProjection ( ) . getMercatorViewPort ( mViewPort ) ; return true ; } | Get the area we are drawing to |
153,093 | public static void closeStream ( final Closeable stream ) { if ( stream != null ) { try { stream . close ( ) ; } catch ( final IOException e ) { e . printStackTrace ( ) ; } } } | Closes the specified stream . |
153,094 | private void addPoints ( final List < GeoPoint > pPoints , final double pBeginLat , final double pBeginLon , final double pEndLat , final double pEndLon ) { final double increment = 10 ; pPoints . add ( new GeoPoint ( pBeginLat , pBeginLon ) ) ; double lat = pBeginLat ; double lon = pBeginLon ; double incLat = pBeginLa... | Add a succession of GeoPoint s separated by an increment taken from the segment between two GeoPoint s |
153,095 | void buildLinePortion ( final Projection pProjection , final boolean pStorePoints ) { final int size = mOriginalPoints . size ( ) ; if ( size < 2 ) { return ; } computeProjected ( pProjection ) ; computeDistances ( ) ; final PointL offset = new PointL ( ) ; getBestOffset ( pProjection , offset ) ; mSegmentClipper . ini... | Dedicated to Polyline as they can run much faster with drawLine than through a Path |
153,096 | boolean isCloseTo ( final GeoPoint pPoint , final double tolerance , final Projection pProjection , final boolean pClosePath ) { return getCloseTo ( pPoint , tolerance , pProjection , pClosePath ) != null ; } | Detection is done in screen coordinates . |
153,097 | 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 ... | Parse a JSON string containing resource field of a ImageryMetaData response |
153,098 | 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_subdomainsCo... | When several subdomains are available get subdomain pointed by internal cycle counter on subdomains and increment this counter |
153,099 | 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 ) ; } | Get the tile source with the specified name . The tile source must be one of the registered sources as defined in the static list mTileSources of this class . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.