idx int64 0 41.2k | question stringlengths 74 4.21k | target stringlengths 5 888 |
|---|---|---|
20,800 | private boolean buildConfigured ( BuildImageConfiguration config , ValueProvider valueProvider , MavenProject project ) { if ( isStringValueNull ( valueProvider , config , FROM , ( ) -> config . getFrom ( ) ) ) { return true ; } if ( valueProvider . getMap ( FROM_EXT , config == null ? null : config . getFromExt ( ) ) ... | Enable build config only when a . from . . dockerFile . or . dockerFileDir . is configured |
20,801 | private List < String > extractPortValues ( List < String > config , ValueProvider valueProvider ) { List < String > ret = new ArrayList < > ( ) ; List < String > ports = valueProvider . getList ( PORTS , config ) ; if ( ports == null ) { return null ; } List < String [ ] > parsedPorts = EnvUtil . splitOnLastColon ( po... | Extract only the values of the port mapping |
20,802 | private void processImageConfig ( ServiceHub hub , ImageConfiguration aImageConfig ) throws IOException , MojoExecutionException { BuildImageConfiguration buildConfig = aImageConfig . getBuildConfiguration ( ) ; if ( buildConfig != null ) { if ( buildConfig . skip ( ) ) { log . info ( "%s : Skipped building" , aImageCo... | Helper method to process an ImageConfiguration . |
20,803 | private Builder u ( String format , String ... args ) { return new Builder ( createUrl ( String . format ( format , ( Object [ ] ) encodeArgs ( args ) ) ) ) ; } | Entry point for builder |
20,804 | public String getSimpleName ( ) { String prefix = user + "/" ; return repository . startsWith ( prefix ) ? repository . substring ( prefix . length ( ) ) : repository ; } | Get the simple name of the image which is the repository sans the user parts . |
20,805 | private void doValidate ( ) { List < String > errors = new ArrayList < > ( ) ; String image = user != null ? repository . substring ( user . length ( ) + 1 ) : repository ; Object [ ] checks = new Object [ ] { "registry" , DOMAIN_REGEXP , registry , "image" , IMAGE_NAME_REGEXP , image , "user" , NAME_COMP_REGEXP , user... | Validate parts and throw an IllegalArgumentException if a part is not valid |
20,806 | public static ImageArchiveManifestEntry findEntryByRepoTag ( String repoTag , ImageArchiveManifest manifest ) { if ( repoTag == null || manifest == null ) { return null ; } for ( ImageArchiveManifestEntry entry : manifest . getEntries ( ) ) { for ( String entryRepoTag : entry . getRepoTags ( ) ) { if ( repoTag . equals... | Search the manifest for an entry that has the repository and tag provided . |
20,807 | public static Map < String , ImageArchiveManifestEntry > mapEntriesById ( Iterable < ImageArchiveManifestEntry > entries ) { Map < String , ImageArchiveManifestEntry > mapped = new LinkedHashMap < > ( ) ; for ( ImageArchiveManifestEntry entry : entries ) { mapped . put ( entry . getId ( ) , entry ) ; } return mapped ; ... | Build a map of entries by id from an iterable of entries . |
20,808 | private boolean hasBeenAllImagesStarted ( Queue < ImageConfiguration > imagesWaitingToStart , Queue < ImageConfiguration > imagesStarting ) { return imagesWaitingToStart . isEmpty ( ) && imagesStarting . isEmpty ( ) ; } | Check if we are done |
20,809 | private List < ImageConfiguration > getImagesWhoseDependenciesHasStarted ( Queue < ImageConfiguration > imagesRemaining , Set < String > containersStarted , Set < String > aliases ) { final List < ImageConfiguration > ret = new ArrayList < > ( ) ; for ( ImageConfiguration imageWaitingToStart : imagesRemaining ) { List ... | Pick out all images who can be started right now because all their dependencies has been started |
20,810 | private Queue < ImageConfiguration > prepareStart ( ServiceHub hub , QueryService queryService , RunService runService , Set < String > imageAliases ) throws DockerAccessException , MojoExecutionException { final Queue < ImageConfiguration > imagesWaitingToStart = new ArrayDeque < > ( ) ; for ( StartOrderResolver . Res... | to start in the correct order |
20,811 | public static List < String [ ] > extractLines ( File dockerFile , String keyword , FixedStringSearchInterpolator interpolator ) throws IOException { List < String [ ] > ret = new ArrayList < > ( ) ; try ( BufferedReader reader = new BufferedReader ( new FileReader ( dockerFile ) ) ) { String line ; while ( ( line = re... | Extract all lines containing the given keyword |
20,812 | public static String interpolate ( File dockerFile , FixedStringSearchInterpolator interpolator ) throws IOException { StringBuilder ret = new StringBuilder ( ) ; try ( BufferedReader reader = new BufferedReader ( new FileReader ( dockerFile ) ) ) { String line ; while ( ( line = reader . readLine ( ) ) != null ) { ret... | Interpolate a docker file with the given properties and filter |
20,813 | public static FixedStringSearchInterpolator createInterpolator ( MojoParameters params , String filter ) { String [ ] delimiters = extractDelimiters ( filter ) ; if ( delimiters == null ) { return FixedStringSearchInterpolator . create ( ) ; } DockerAssemblyConfigurationSource configSource = new DockerAssemblyConfigura... | Create an interpolator for the given maven parameters and filter configuration . |
20,814 | public FieldScopeLogicMap < V > with ( FieldScopeLogic fieldScopeLogic , V value ) { ImmutableList . Builder < Entry < V > > newEntries = ImmutableList . builder ( ) ; newEntries . add ( Entry . of ( fieldScopeLogic , value ) ) ; newEntries . addAll ( entries ) ; return new FieldScopeLogicMap < > ( newEntries . build (... | Returns a new immutable map that adds the given fields - > value mapping . |
20,815 | public static < V > FieldScopeLogicMap < V > defaultValue ( V value ) { return new FieldScopeLogicMap < > ( ImmutableList . of ( Entry . of ( FieldScopeLogic . all ( ) , value ) ) ) ; } | Returns a map which maps all fields to the given value by default . |
20,816 | static Function < Optional < Descriptor > , String > fieldNumbersFunction ( final String fmt , final Iterable < Integer > fieldNumbers ) { return new Function < Optional < Descriptor > , String > ( ) { public String apply ( Optional < Descriptor > optDescriptor ) { return resolveFieldNumbers ( optDescriptor , fmt , fie... | Returns a function which translates integer field numbers into field names using the Descriptor if available . |
20,817 | static Function < Optional < Descriptor > , String > fieldScopeFunction ( final String fmt , final FieldScope fieldScope ) { return new Function < Optional < Descriptor > , String > ( ) { public String apply ( Optional < Descriptor > optDescriptor ) { return String . format ( fmt , fieldScope . usingCorrespondenceStrin... | Returns a function which formats the given string by getting the usingCorrespondenceString from the given FieldScope with the argument descriptor . |
20,818 | static Function < Optional < Descriptor > , String > concat ( final Function < ? super Optional < Descriptor > , String > function1 , final Function < ? super Optional < Descriptor > , String > function2 ) { return new Function < Optional < Descriptor > , String > ( ) { public String apply ( Optional < Descriptor > opt... | Returns a function which concatenates the outputs of the two input functions . |
20,819 | static Optional < Descriptor > getSingleDescriptor ( Iterable < ? extends Message > messages ) { Optional < Descriptor > optDescriptor = Optional . absent ( ) ; for ( Message message : messages ) { if ( message != null ) { Descriptor descriptor = message . getDescriptorForType ( ) ; if ( ! optDescriptor . isPresent ( )... | Returns the singular descriptor used by all non - null messages in the list . |
20,820 | public Ordered containsExactly ( ) { return check ( ) . about ( iterableEntries ( ) ) . that ( actual ( ) . entries ( ) ) . containsExactly ( ) ; } | Fails if the multimap is not empty . |
20,821 | private static boolean advanceToFind ( Iterator < ? > iterator , Object value ) { while ( iterator . hasNext ( ) ) { if ( Objects . equal ( iterator . next ( ) , value ) ) { return true ; } } return false ; } | Advances the iterator until it either returns value or has no more elements . |
20,822 | public IterableSubject factKeys ( ) { if ( ! ( actual ( ) instanceof ErrorWithFacts ) ) { failWithActual ( simpleFact ( "expected a failure thrown by Truth's new failure API" ) ) ; return ignoreCheck ( ) . that ( ImmutableList . of ( ) ) ; } ErrorWithFacts error = ( ErrorWithFacts ) actual ( ) ; return check ( "factKey... | Returns a subject for the list of fact keys . |
20,823 | public MapWithProtoValuesFluentAssertion < M > usingFloatToleranceForFieldDescriptorsForValues ( float tolerance , FieldDescriptor firstFieldDescriptor , FieldDescriptor ... rest ) { return usingConfig ( config . usingFloatToleranceForFieldDescriptors ( tolerance , asList ( firstFieldDescriptor , rest ) ) ) ; } | Compares float fields with these explicitly specified fields using the provided absolute tolerance . |
20,824 | FieldScopeLogic ignoringFields ( Iterable < Integer > fieldNumbers ) { if ( isEmpty ( fieldNumbers ) ) { return this ; } return and ( this , new NegationFieldScopeLogic ( new FieldNumbersLogic ( fieldNumbers , true ) ) ) ; } | something else that doesn t tightly couple FieldScopeLogic to the ignore concept . |
20,825 | @ SuppressWarnings ( "GoodTime" ) public void containsAnyOf ( int first , int second , int ... rest ) { check ( ) . that ( actualList ) . containsAnyOf ( first , second , box ( rest ) ) ; } | Fails if the subject does not contain at least one of the given elements . |
20,826 | public void hasLength ( int expectedLength ) { checkArgument ( expectedLength >= 0 , "expectedLength(%s) must be >= 0" , expectedLength ) ; check ( "length()" ) . that ( actual ( ) . length ( ) ) . isEqualTo ( expectedLength ) ; } | Fails if the string does not have the given length . |
20,827 | public void contains ( CharSequence string ) { checkNotNull ( string ) ; if ( actual ( ) == null ) { failWithActual ( "expected a string that contains" , string ) ; } else if ( ! actual ( ) . contains ( string ) ) { failWithActual ( "expected to contain" , string ) ; } } | Fails if the string does not contain the given sequence . |
20,828 | public void startsWith ( String string ) { checkNotNull ( string ) ; if ( actual ( ) == null ) { failWithActual ( "expected a string that starts with" , string ) ; } else if ( ! actual ( ) . startsWith ( string ) ) { failWithActual ( "expected to start with" , string ) ; } } | Fails if the string does not start with the given string . |
20,829 | public void endsWith ( String string ) { checkNotNull ( string ) ; if ( actual ( ) == null ) { failWithActual ( "expected a string that ends with" , string ) ; } else if ( ! actual ( ) . endsWith ( string ) ) { failWithActual ( "expected to end with" , string ) ; } } | Fails if the string does not end with the given string . |
20,830 | @ GwtIncompatible ( "java.util.regex.Pattern" ) public void matches ( Pattern regex ) { if ( ! regex . matcher ( actual ( ) ) . matches ( ) ) { failWithActual ( "expected to match" , regex ) ; } } | Fails if the string does not match the given regex . |
20,831 | @ GwtIncompatible ( "java.util.regex.Pattern" ) public void containsMatch ( Pattern regex ) { if ( ! regex . matcher ( actual ( ) ) . find ( ) ) { failWithActual ( "expected to contain a match for" , regex ) ; } } | Fails if the string does not contain a match on the given regex . |
20,832 | @ GwtIncompatible ( "java.util.regex.Pattern" ) public void doesNotContainMatch ( Pattern regex ) { Matcher matcher = regex . matcher ( actual ( ) ) ; if ( matcher . find ( ) ) { failWithoutActual ( fact ( "expected not to contain a match for" , regex ) , fact ( "but contained" , matcher . group ( ) ) , fact ( "full st... | Fails if the string contains a match on the given regex . |
20,833 | static boolean containsMatch ( String actual , String regex ) { return Pattern . compile ( regex ) . matcher ( actual ) . find ( ) ; } | Determines if the given subject contains a match for the given regex . |
20,834 | public Correspondence < A , E > formattingDiffsUsing ( DiffFormatter < ? super A , ? super E > formatter ) { return new FormattingDiffs < > ( this , formatter ) ; } | Returns a new correspondence which is like this one except that the given formatter may be used to format the difference between a pair of elements that do not correspond . |
20,835 | static ImmutableList < Fact > formatExpectedAndActual ( String expected , String actual ) { ImmutableList < Fact > result ; result = Platform . makeDiff ( expected , actual ) ; if ( result != null ) { return result ; } result = removeCommonPrefixAndSuffix ( expected , actual ) ; if ( result != null ) { return result ; ... | Returns one or more facts describing the difference between the given expected and actual values . |
20,836 | private static boolean validSurrogatePairAt ( CharSequence string , int index ) { return index >= 0 && index <= ( string . length ( ) - 2 ) && isHighSurrogate ( string . charAt ( index ) ) && isLowSurrogate ( string . charAt ( index + 1 ) ) ; } | From c . g . c . base . Strings . |
20,837 | static boolean isInstanceOfType ( Object instance , Class < ? > clazz ) { if ( clazz . isInterface ( ) ) { throw new UnsupportedOperationException ( "Under GWT, we can't determine whether an object is an instance of an interface Class" ) ; } for ( Class < ? > current = instance . getClass ( ) ; current != null ; curren... | Returns true if the instance is assignable to the type Clazz . |
20,838 | DiffResult diffMessages ( Message actual , Message expected ) { checkNotNull ( actual ) ; checkNotNull ( expected ) ; checkArgument ( actual . getDescriptorForType ( ) == expected . getDescriptorForType ( ) , "The actual [%s] and expected [%s] message descriptors do not match." , actual . getDescriptorForType ( ) , exp... | Compare the two non - null messages and return a detailed comparison report . |
20,839 | private RepeatedField . PairResult findMatchingPairResult ( Deque < Integer > actualIndices , List < ? > actualValues , int expectedIndex , Object expectedValue , boolean excludeNonRecursive , FieldDescriptor fieldDescriptor , FluentEqualityConfig config ) { Iterator < Integer > actualIndexIter = actualIndices . iterat... | If there is no match returns null . |
20,840 | static < T > Iterable < T > annotateEmptyStrings ( Iterable < T > items ) { if ( Iterables . contains ( items , "" ) ) { List < T > annotatedItems = Lists . newArrayList ( ) ; for ( T item : items ) { if ( Objects . equal ( item , "" ) ) { @ SuppressWarnings ( "unchecked" ) T newItem = ( T ) HUMAN_UNDERSTANDABLE_EMPTY_... | Returns an iterable with all empty strings replaced by a non - empty human understandable indicator for an empty string . |
20,841 | private ImmutableList < Fact > description ( ) { String description = null ; boolean descriptionWasDerived = false ; for ( Step step : steps ) { if ( step . isCheckCall ( ) ) { checkState ( description != null ) ; if ( step . descriptionUpdate == null ) { description = null ; descriptionWasDerived = false ; } else { de... | Returns a description of how the final actual value was derived from earlier actual values in the chain if the chain ends with at least one derivation that we have a name for . |
20,842 | public Ordered containsExactlyEntriesIn ( Map < ? , ? > expectedMap ) { if ( expectedMap . isEmpty ( ) ) { if ( actual ( ) . isEmpty ( ) ) { return IN_ORDER ; } else { isEmpty ( ) ; return ALREADY_FAILED ; } } boolean containsAnyOrder = containsEntriesInAnyOrder ( expectedMap , "contains exactly" , false ) ; if ( conta... | Fails if the map does not contain exactly the given set of entries in the given map . |
20,843 | public Ordered containsAtLeastEntriesIn ( Map < ? , ? > expectedMap ) { if ( expectedMap . isEmpty ( ) ) { return IN_ORDER ; } boolean containsAnyOrder = containsEntriesInAnyOrder ( expectedMap , "contains at least" , true ) ; if ( containsAnyOrder ) { return new MapInOrder ( expectedMap , "contains at least these entr... | Fails if the map does not contain at least the given set of entries in the given map . |
20,844 | static String makeMessage ( ImmutableList < String > messages , ImmutableList < Fact > facts ) { int longestKeyLength = 0 ; boolean seenNewlineInValue = false ; for ( Fact fact : facts ) { if ( fact . value != null ) { longestKeyLength = max ( longestKeyLength , fact . key . length ( ) ) ; seenNewlineInValue |= fact . ... | Formats the given messages and facts into a string for use as the message of a test failure . In particular this method horizontally aligns the beginning of fact values . |
20,845 | final String shortName ( ) { if ( fieldDescriptor ( ) . isPresent ( ) ) { return fieldDescriptor ( ) . get ( ) . isExtension ( ) ? "[" + fieldDescriptor ( ) . get ( ) + "]" : fieldDescriptor ( ) . get ( ) . getName ( ) ; } else { return String . valueOf ( unknownFieldDescriptor ( ) . get ( ) . fieldNumber ( ) ) ; } } | Returns a short human - readable version of this identifier . |
20,846 | public final void hasSize ( int expectedSize ) { checkArgument ( expectedSize >= 0 , "expectedSize(%s) must be >= 0" , expectedSize ) ; int actualSize = size ( actual ( ) ) ; check ( "size()" ) . that ( actualSize ) . isEqualTo ( expectedSize ) ; } | Fails if the subject does not have the given size . |
20,847 | public final void containsNoDuplicates ( ) { List < Entry < ? > > duplicates = newArrayList ( ) ; for ( Multiset . Entry < ? > entry : LinkedHashMultiset . create ( actual ( ) ) . entrySet ( ) ) { if ( entry . getCount ( ) > 1 ) { duplicates . add ( entry ) ; } } if ( ! duplicates . isEmpty ( ) ) { failWithoutActual ( ... | Checks that the subject does not contain duplicate elements . |
20,848 | public final Ordered containsAtLeastElementsIn ( Iterable < ? > expectedIterable ) { List < ? > actual = Lists . newLinkedList ( actual ( ) ) ; final Collection < ? > expected = iterableToCollection ( expectedIterable ) ; List < Object > missing = newArrayList ( ) ; List < Object > actualNotInOrder = newArrayList ( ) ;... | Checks that the actual iterable contains at least all of the expected elements or fails . If an element appears more than once in the expected elements then it must appear at least that number of times in the actual elements . |
20,849 | private static void moveElements ( List < ? > input , Collection < Object > output , int maxElements ) { for ( int i = 0 ; i < maxElements ; i ++ ) { output . add ( input . remove ( 0 ) ) ; } } | Removes at most the given number of available elements from the input list and adds them to the given output collection . |
20,850 | final boolean isAnyChildMatched ( ) { if ( isAnyChildMatched == null ) { isAnyChildMatched = false ; for ( RecursableDiffEntity entity : childEntities ( ) ) { if ( ( entity . isMatched ( ) && ! entity . isContentEmpty ( ) ) || entity . isAnyChildMatched ( ) ) { isAnyChildMatched = true ; break ; } } } return isAnyChild... | Returns true if some child entity matched . |
20,851 | final boolean isAnyChildIgnored ( ) { if ( isAnyChildIgnored == null ) { isAnyChildIgnored = false ; for ( RecursableDiffEntity entity : childEntities ( ) ) { if ( ( entity . isIgnored ( ) && ! entity . isContentEmpty ( ) ) || entity . isAnyChildIgnored ( ) ) { isAnyChildIgnored = true ; break ; } } } return isAnyChild... | Returns true if some child entity was ignored . |
20,852 | private void addToStreak ( StackTraceElementWrapper stackTraceElementWrapper ) { if ( stackTraceElementWrapper . getStackFrameType ( ) != currentStreakType ) { endStreak ( ) ; currentStreakType = stackTraceElementWrapper . getStackFrameType ( ) ; currentStreakLength = 1 ; } else { currentStreakLength ++ ; } } | Either adds the given frame to the running streak or closes out the running streak and starts a new one . |
20,853 | private void endStreak ( ) { if ( currentStreakLength == 0 ) { return ; } if ( currentStreakLength == 1 ) { cleanedStackTrace . add ( lastStackFrameElementWrapper ) ; } else { cleanedStackTrace . add ( createStreakReplacementFrame ( currentStreakType , currentStreakLength ) ) ; } clearStreak ( ) ; } | Ends the current streak adding a summary frame to the result . Resets the streak counter . |
20,854 | public static void writeFile ( MapWriterConfiguration configuration , TileBasedDataProcessor dataProcessor ) throws IOException { EXECUTOR_SERVICE = Executors . newFixedThreadPool ( configuration . getThreads ( ) ) ; RandomAccessFile randomAccessFile = new RandomAccessFile ( configuration . getOutputFile ( ) , "rw" ) ;... | Writes the map file according to the given configuration using the given data processor . |
20,855 | protected static Set < Tag > stringToTags ( String data ) { Set < Tag > tags = new HashSet < > ( ) ; String [ ] split = data . split ( "\r" ) ; for ( String s : split ) { if ( s . indexOf ( Tag . KEY_VALUE_SEPARATOR ) > - 1 ) { String [ ] keyValue = s . split ( String . valueOf ( Tag . KEY_VALUE_SEPARATOR ) ) ; if ( ke... | Convert tags string representation with \ r delimiter to collection . |
20,856 | protected static String tagsToString ( Set < Tag > tags ) { StringBuilder sb = new StringBuilder ( ) ; for ( Tag tag : tags ) { if ( sb . length ( ) > 0 ) { sb . append ( '\r' ) ; } sb . append ( tag . key ) . append ( Tag . KEY_VALUE_SEPARATOR ) . append ( tag . value ) ; } return sb . toString ( ) ; } | Convert tags collection to string representation with \ r delimiter . |
20,857 | private void storeData ( Job key , TileBitmap bitmap ) { OutputStream outputStream = null ; try { File file = getOutputFile ( key ) ; if ( file == null ) { return ; } outputStream = new FileOutputStream ( file ) ; bitmap . compress ( outputStream ) ; try { lock . writeLock ( ) . lock ( ) ; if ( this . lruCache . put ( ... | stores the bitmap data on disk with filename key |
20,858 | public boolean onOptionsItemSelected ( MenuItem item ) { super . onOptionsItemSelected ( item ) ; switch ( item . getItemId ( ) ) { case 1234 : if ( clusterer != null ) { break ; } clusterer = new ClusterManager ( mapView , getMarkerBitmap ( ) , getZoomLevelMax ( ) , false ) ; Toast toast = Toast . makeText ( this , ""... | onOptionsItemSelected handler since clustering need MapView to be created and visible this sample do clustering here . |
20,859 | private void updateTagData ( Map < Poi , Map < String , String > > pois , String key , String value ) { for ( Map . Entry < Poi , Map < String , String > > entry : pois . entrySet ( ) ) { Poi poi = entry . getKey ( ) ; String tmpValue = value ; Map < String , String > tagmap = entry . getValue ( ) ; if ( ! tagmap . key... | Updates the tags of a POI - List with key and value . |
20,860 | public static TDRelation fromRelation ( Relation relation , WayResolver resolver , List < String > preferredLanguages ) { if ( relation == null ) { return null ; } if ( relation . getMembers ( ) . isEmpty ( ) ) { return null ; } SpecialTagExtractionResult ster = OSMUtils . extractSpecialFields ( relation , preferredLan... | Creates a new TDRelation from an osmosis entity using the given WayResolver . |
20,861 | public boolean onTap ( LatLong tapLatLong , Point layerXY , Point tapXY ) { for ( int i = layers . size ( ) - 1 ; i >= 0 ; i -- ) { Layer layer = layers . get ( i ) ; if ( layer . onTap ( tapLatLong , layerXY , tapXY ) ) { return true ; } } return false ; } | GroupLayer does not have a position layerXY is null . |
20,862 | protected boolean isItemInViewport ( final GeoItem item ) { BoundingBox curBounds = getCurBounds ( ) ; return curBounds != null && curBounds . contains ( item . getLatLong ( ) ) ; } | check if the item is within current viewport . |
20,863 | protected synchronized BoundingBox getCurBounds ( ) { if ( currBoundingBox == null ) { if ( mapView == null ) { throw new NullPointerException ( "mapView == null" ) ; } if ( mapView . getWidth ( ) <= 0 || mapView . getHeight ( ) <= 0 ) { throw new IllegalArgumentException ( " mapView.getWidth() <= 0 " + "|| mapView.get... | get the current BoundingBox of the viewport |
20,864 | private void addLeftItems ( ) { if ( leftItems . size ( ) == 0 ) { return ; } ArrayList < T > currentLeftItems = new ArrayList < T > ( ) ; currentLeftItems . addAll ( leftItems ) ; synchronized ( leftItems ) { leftItems . clear ( ) ; } for ( T currentLeftItem : currentLeftItems ) { addItem ( currentLeftItem ) ; } } | add items that were not clustered in last isClustering . |
20,865 | private synchronized void resetViewport ( boolean isMoving ) { isClustering = true ; clusterTask = new ClusterTask ( ) ; clusterTask . execute ( new Boolean [ ] { isMoving } ) ; } | reset current viewport re - cluster the items when zoom has changed else add not clustered items . |
20,866 | private void commit ( ) throws SQLException { LOGGER . info ( "Committing..." ) ; this . progressManager . setMessage ( "Committing..." ) ; this . pStmtIndex . executeBatch ( ) ; this . pStmtData . executeBatch ( ) ; this . pStmtCatMap . executeBatch ( ) ; if ( this . configuration . isGeoTags ( ) ) { this . geoTagger ... | Commit changes . |
20,867 | public void complete ( ) { if ( this . configuration . isGeoTags ( ) ) { this . geoTagger . processBoundaries ( ) ; } NumberFormat nfMegabyte = NumberFormat . getInstance ( ) ; nfMegabyte . setMaximumFractionDigits ( 2 ) ; try { commit ( ) ; if ( this . configuration . isFilterCategories ( ) ) { filterCategories ( ) ; ... | Complete task . |
20,868 | private void filterCategories ( ) throws SQLException { LOGGER . info ( "Filtering categories..." ) ; PreparedStatement pStmtChildren = this . conn . prepareStatement ( "SELECT COUNT(*) FROM poi_categories WHERE parent = ?;" ) ; PreparedStatement pStmtPoi = this . conn . prepareStatement ( "SELECT COUNT(*) FROM poi_cat... | Filter categories i . e . without POIs and children . |
20,869 | List < Long > findWayNodesByWayID ( long id ) { try { this . pStmtWayNodesR . setLong ( 1 , id ) ; ResultSet rs = this . pStmtWayNodesR . executeQuery ( ) ; Map < Integer , Long > nodeList = new TreeMap < > ( ) ; while ( rs . next ( ) ) { Long nodeID = rs . getLong ( 1 ) ; Integer pos = rs . getInt ( 2 ) ; nodeList . p... | Find way nodes by its ID . |
20,870 | String getTagValue ( Collection < Tag > tags , String key ) { for ( Tag tag : tags ) { if ( tag . getKey ( ) . toLowerCase ( Locale . ENGLISH ) . equals ( key . toLowerCase ( Locale . ENGLISH ) ) ) { return tag . getValue ( ) ; } } return null ; } | Returns value of given tag in a set of tags . |
20,871 | private void postProcess ( ) throws SQLException { LOGGER . info ( "Post-processing..." ) ; this . conn = DriverManager . getConnection ( "jdbc:sqlite:" + this . configuration . getOutputFile ( ) . getAbsolutePath ( ) ) ; this . conn . createStatement ( ) . execute ( DbConstants . DROP_NODES_STATEMENT ) ; this . conn .... | Post - process . |
20,872 | private void prepareDatabase ( ) throws ClassNotFoundException , SQLException , UnknownPoiCategoryException { Class . forName ( "org.sqlite.JDBC" ) ; this . conn = DriverManager . getConnection ( "jdbc:sqlite:" + this . configuration . getOutputFile ( ) . getAbsolutePath ( ) ) ; this . conn . setAutoCommit ( false ) ; ... | Prepare database . |
20,873 | public void process ( EntityContainer entityContainer ) { Entity entity = entityContainer . getEntity ( ) ; LOGGER . finest ( "Processing entity: " + entity . toString ( ) ) ; switch ( entity . getType ( ) ) { case Node : Node node = ( Node ) entity ; if ( this . nNodes == 0 ) { LOGGER . info ( "Processing nodes..." ) ... | Process task . |
20,874 | Map < String , String > stringToTags ( String tagsmapstring ) { String [ ] sb = tagsmapstring . split ( "\\r" ) ; Map < String , String > map = new HashMap < > ( ) ; for ( String key : sb ) { if ( key . contains ( "=" ) ) { String [ ] set = key . split ( "=" ) ; if ( set . length == 2 ) map . put ( set [ 0 ] , set [ 1 ... | Convert string representation back to tags map . |
20,875 | String tagsToString ( Map < String , String > tagMap ) { StringBuilder sb = new StringBuilder ( ) ; for ( String key : tagMap . keySet ( ) ) { if ( key . equalsIgnoreCase ( "created_by" ) ) { continue ; } if ( sb . length ( ) > 0 ) { sb . append ( '\r' ) ; } sb . append ( key ) . append ( '=' ) . append ( tagMap . get ... | Convert tags to a string representation using \ r delimiter . |
20,876 | private void writeMetadata ( ) throws SQLException { LOGGER . info ( "Writing metadata..." ) ; PreparedStatement pStmtMetadata = this . conn . prepareStatement ( DbConstants . INSERT_METADATA_STATEMENT ) ; pStmtMetadata . setString ( 1 , DbConstants . METADATA_BOUNDS ) ; BoundingBox bb = this . configuration . getBboxC... | Write the metadata to the database . |
20,877 | private void writePOI ( long id , double latitude , double longitude , Map < String , String > poiData , Set < PoiCategory > categories ) { try { this . pStmtIndex . setLong ( 1 , id ) ; this . pStmtIndex . setDouble ( 2 , latitude ) ; this . pStmtIndex . setDouble ( 3 , latitude ) ; this . pStmtIndex . setDouble ( 4 ,... | Write a POI to the database . |
20,878 | public int compareTo ( Tag tag ) { int keyResult = this . key . compareTo ( tag . key ) ; if ( keyResult != 0 ) { return keyResult ; } return this . value . compareTo ( tag . value ) ; } | Compares this tag to the specified tag . The tag comparison is based on a comparison of key and value in that order . |
20,879 | public Rectangle enlarge ( double left , double top , double right , double bottom ) { return new Rectangle ( this . left - left , this . top - top , this . right + right , this . bottom + bottom ) ; } | Enlarges the Rectangle sides individually |
20,880 | protected void createLayers2 ( ) { this . mapView2 . getLayerManager ( ) . getLayers ( ) . add ( AndroidUtil . createTileRendererLayer ( this . tileCaches . get ( 1 ) , this . mapView2 . getModel ( ) . mapViewPosition , getMapFile2 ( ) , getRenderTheme2 ( ) , false , true , false ) ) ; } | creates the layers for the second map view . |
20,881 | private void startupDialog ( String prefs , int message , final Class clazz ) { final SharedPreferences preferences = getSharedPreferences ( prefs , Activity . MODE_PRIVATE ) ; final String accepted = "accepted" ; if ( ! preferences . getBoolean ( accepted , false ) ) { AlertDialog . Builder builder = new AlertDialog .... | Warning startup dialog . |
20,882 | public int compareTo ( MapElementContainer other ) { if ( this . priority < other . priority ) { return - 1 ; } if ( this . priority > other . priority ) { return 1 ; } return 0 ; } | Compares elements according to their priority . |
20,883 | public boolean clashesWith ( MapElementContainer other ) { if ( Display . ALWAYS == this . display || Display . ALWAYS == other . display ) { return false ; } return this . getBoundaryAbsolute ( ) . intersects ( other . getBoundaryAbsolute ( ) ) ; } | Returns if MapElementContainers clash with each other |
20,884 | public static Map < Short , Object > extractKnownPOITags ( Entity entity ) { Map < Short , Object > tagMap = new HashMap < > ( ) ; OSMTagMapping mapping = OSMTagMapping . getInstance ( ) ; if ( entity . getTags ( ) != null ) { for ( Tag tag : entity . getTags ( ) ) { OSMTag poiTag = mapping . getPoiTag ( tag . getKey (... | Extracts known POI tags and returns their ids . |
20,885 | public static Map < Short , Object > extractKnownWayTags ( Entity entity ) { Map < Short , Object > tagMap = new HashMap < > ( ) ; OSMTagMapping mapping = OSMTagMapping . getInstance ( ) ; if ( entity . getTags ( ) != null ) { for ( Tag tag : entity . getTags ( ) ) { OSMTag wayTag = mapping . getWayTag ( tag . getKey (... | Extracts known way tags and returns their ids . |
20,886 | private TileBitmap createBackgroundBitmap ( RenderContext renderContext ) { TileBitmap bitmap = this . graphicFactory . createTileBitmap ( renderContext . rendererJob . tile . tileSize , renderContext . rendererJob . hasAlpha ) ; renderContext . canvasRasterer . setCanvasBitmap ( bitmap ) ; if ( ! renderContext . rende... | Draws a bitmap just with outside colour used for bitmaps outside of map area . |
20,887 | public static TileCache createExternalStorageTileCache ( Context c , String id , int firstLevelSize , int tileSize ) { return createExternalStorageTileCache ( c , id , firstLevelSize , tileSize , false ) ; } | Utility function to create a two - level tile cache along with its backends . This is the compatibility version that by default creates a non - persistent cache . |
20,888 | public static TileCache createTileCache ( Context c , String id , int tileSize , float screenRatio , double overdraw ) { return createTileCache ( c , id , tileSize , screenRatio , overdraw , false ) ; } | Utility function to create a two - level tile cache with the right size . When the cache is created we do not actually know the size of the mapview so the screenRatio is an approximation of the required size . This is the compatibility version that by default creates a non - persistent cache . |
20,889 | public static TileCache createTileCache ( Context c , String id , int tileSize , int width , int height , double overdraw ) { return createTileCache ( c , id , tileSize , width , height , overdraw , false ) ; } | Utility function to create a two - level tile cache with the right size using the size of the map view . This is the compatibility version that by default creates a non - persistent cache . |
20,890 | @ SuppressWarnings ( "deprecation" ) @ TargetApi ( Build . VERSION_CODES . JELLY_BEAN_MR2 ) public static long getAvailableCacheSlots ( String directory , int fileSize ) { StatFs statfs = new StatFs ( directory ) ; if ( Build . VERSION . SDK_INT >= Build . VERSION_CODES . JELLY_BEAN_MR2 ) { return statfs . getAvailable... | Get the number of tiles that can be stored on the file system . |
20,891 | @ SuppressWarnings ( "deprecation" ) @ TargetApi ( Build . VERSION_CODES . HONEYCOMB_MR2 ) public static int getMinimumCacheSize ( Context c , int tileSize , double overdrawFactor , float screenRatio ) { WindowManager wm = ( WindowManager ) c . getSystemService ( Context . WINDOW_SERVICE ) ; Display display = wm . getD... | Compute the minimum cache size for a view . When the cache is created we do not actually know the size of the mapview so the screenRatio is an approximation of the required size . For the view size we use the frame buffer calculated dimension . |
20,892 | public static int getMinimumCacheSize ( int tileSize , double overdrawFactor , int width , int height ) { Dimension dimension = FrameBufferController . calculateFrameBufferDimension ( new Dimension ( width , height ) , overdrawFactor ) ; return Math . max ( 4 , ( 2 + ( dimension . height / tileSize ) ) * ( 2 + ( dimens... | Compute the minimum cache size for a view using the size of the map view . For the view size we use the frame buffer calculated dimension . |
20,893 | public static void setMapScaleBar ( MapView mapView , DistanceUnitAdapter primaryDistanceUnitAdapter , DistanceUnitAdapter secondaryDistanceUnitAdapter ) { if ( null == primaryDistanceUnitAdapter && null == secondaryDistanceUnitAdapter ) { mapView . setMapScaleBar ( null ) ; } else { MapScaleBar scaleBar = mapView . ge... | Sets the scale bar on a map view with implicit arguments . If no distance unit adapters are supplied there will be no scalebar with only a primary adapter supplied the mode will be single with two adapters supplied the mode will be dual . |
20,894 | private List < DummyItem > loadXmlFromNetwork ( String urlString ) throws IOException { String jString ; List < Entry > entries = null ; List < DummyItem > rtnArray = new ArrayList < DummyItem > ( ) ; BufferedReader streamReader = null ; try { streamReader = new BufferedReader ( downloadUrl ( urlString ) ) ; StringBuil... | Uploads XML from nominatim . openstreetmap . org parses it and create DummyItems from it |
20,895 | private InputStreamReader downloadUrl ( String urlString ) throws IOException { URL url = new URL ( urlString ) ; HttpURLConnection conn = ( HttpURLConnection ) url . openConnection ( ) ; conn . setReadTimeout ( 10000 ) ; conn . setConnectTimeout ( 15000 ) ; conn . setRequestMethod ( "GET" ) ; conn . setDoInput ( true ... | an input stream . |
20,896 | public synchronized void setCapacity ( int capacity ) { BitmapLRUCache lruCacheNew = new BitmapLRUCache ( capacity ) ; lruCacheNew . putAll ( this . lruCache ) ; this . lruCache = lruCacheNew ; } | Sets the new size of this cache . If this cache already contains more items than the new capacity allows items are discarded based on the cache policy . |
20,897 | public static Tile getUpperLeft ( BoundingBox boundingBox , byte zoomLevel , int tileSize ) { int tileLeft = MercatorProjection . longitudeToTileX ( boundingBox . minLongitude , zoomLevel ) ; int tileTop = MercatorProjection . latitudeToTileY ( boundingBox . maxLatitude , zoomLevel ) ; return new Tile ( tileLeft , tile... | Upper left tile for an area . |
20,898 | public static Tile getLowerRight ( BoundingBox boundingBox , byte zoomLevel , int tileSize ) { int tileRight = MercatorProjection . longitudeToTileX ( boundingBox . maxLongitude , zoomLevel ) ; int tileBottom = MercatorProjection . latitudeToTileY ( boundingBox . minLatitude , zoomLevel ) ; return new Tile ( tileRight ... | Lower right tile for an area . |
20,899 | public static List < MapElementContainer > collisionFreeOrdered ( List < MapElementContainer > input ) { Collections . sort ( input , Collections . reverseOrder ( ) ) ; List < MapElementContainer > output = new LinkedList < MapElementContainer > ( ) ; for ( MapElementContainer item : input ) { boolean hasSpace = true ;... | Transforms a list of MapElements orders it and removes those elements that overlap . This operation is useful for an early elimination of elements in a list that will never be drawn because they overlap . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.