idx int64 0 41.2k | question stringlengths 83 4.15k | target stringlengths 5 715 |
|---|---|---|
8,900 | protected void generateNewBasename ( ) { Properties localProps = new Properties ( ) ; localProps . setProperty ( "prefix" , settings . getPrefix ( ) ) ; synchronized ( this . getClass ( ) ) { String paddedSerialNumber = WriterPoolMember . serialNoFormatter . format ( serialNo . getAndIncrement ( ) ) ; String timestamp1... | Generate a new basename by interpolating values in the configured template . Values come from local state other configured values and global system properties . The recommended default template will generate a unique basename under reasonable assumptions . |
8,901 | protected String getBaseFilename ( ) { String name = this . f . getName ( ) ; if ( settings . getCompress ( ) && name . endsWith ( DOT_COMPRESSED_FILE_EXTENSION ) ) { return name . substring ( 0 , name . length ( ) - 3 ) ; } else if ( settings . getCompress ( ) && name . endsWith ( DOT_COMPRESSED_FILE_EXTENSION + OCCUP... | Get the file name |
8,902 | protected void preWriteRecordTasks ( ) throws IOException { if ( this . out == null ) { createFile ( ) ; } if ( settings . getCompress ( ) ) { this . out = new CompressedStream ( this . out ) ; } } | Post write tasks . |
8,903 | protected void postWriteRecordTasks ( ) throws IOException { if ( settings . getCompress ( ) ) { CompressedStream o = ( CompressedStream ) this . out ; o . finish ( ) ; o . flush ( ) ; o . end ( ) ; this . out = o . getWrappedStream ( ) ; } } | Post file write tasks . If compressed finishes up compression and flushes stream so any subsequent checks get good reading . |
8,904 | public long computeTotalLines ( ) { long numLines = 0 ; try { numLines = this . getNumLines ( summary . getRange ( "" , "" ) ) ; } catch ( IOException e ) { LOGGER . warning ( e . toString ( ) ) ; return 0 ; } long adjustment = getTotalAdjustment ( ) ; numLines -= ( getNumBlocks ( ) - 1 ) ; numLines *= this . getCdxLin... | Adjust from shorter blocks if loaded |
8,905 | protected String getCharsetFromMeta ( byte buffer [ ] , int len ) throws IOException { String charsetName = null ; String sample = new String ( buffer , 0 , len , DEFAULT_CHARSET ) ; String metaContentType = findMetaContentType ( sample ) ; if ( metaContentType != null ) { charsetName = contentTypeToCharset ( metaConte... | Attempt to find a META tag in the HTML that hints at the character set used to write the document . |
8,906 | protected String getCharsetFromBytes ( byte buffer [ ] , int len ) throws IOException { String charsetName = null ; UniversalDetector detector = new UniversalDetector ( null ) ; detector . handleData ( buffer , 0 , len ) ; detector . dataEnd ( ) ; charsetName = detector . getDetectedCharset ( ) ; detector . reset ( ) ;... | Attempts to figure out the character set of the document using the excellent juniversalchardet library . |
8,907 | public void readContentTo ( OutputStream os , long maxSize ) throws IOException { setToResponseBodyStart ( ) ; byte [ ] buf = new byte [ 4096 ] ; int c = read ( buf ) ; long tot = 0 ; while ( c != - 1 && tot < maxSize ) { os . write ( buf , 0 , c ) ; c = read ( buf ) ; tot += c ; } } | Convenience method to copy content out to target stream . |
8,908 | public void position ( long p ) throws IOException { if ( p < 0 ) { throw new IOException ( "Negative seek offset." ) ; } if ( p > size ) { throw new IOException ( "Desired position exceeds size." ) ; } if ( p < buffer . length ) { if ( position > buffer . length ) { diskStream . position ( 0 ) ; } } else { diskStream ... | Reposition the stream . |
8,909 | public void close ( ) throws IOException { if ( this . in != null ) { skip ( ) ; this . in = null ; if ( this . digest != null ) { this . digestStr = Base32 . encode ( this . digest . digest ( ) ) ; } } } | Calling close on a record skips us past this record to the next record in the stream . |
8,910 | public int available ( ) { long amount = getHeader ( ) . getLength ( ) - getPosition ( ) ; return ( amount > Integer . MAX_VALUE ? Integer . MAX_VALUE : ( int ) amount ) ; } | This available is not the stream s available . Its an available based on what the stated Archive record length is minus what we ve read to date . |
8,911 | protected void skip ( ) throws IOException { if ( this . eor ) { return ; } int r = available ( ) ; while ( r > 0 && ! this . eor ) { skip ( r ) ; r = available ( ) ; } } | Skip over this records content . |
8,912 | public GenerationFileHandler rotate ( String storeSuffix , String activeSuffix ) throws IOException { return rotate ( storeSuffix , activeSuffix , false ) ; } | Move the current file to a new filename with the storeSuffix in place of the activeSuffix ; continuing logging to a new file under the original filename . |
8,913 | public static GenerationFileHandler makeNew ( String filename , boolean append , boolean shouldManifest ) throws SecurityException , IOException { FileUtils . moveAsideIfExists ( new File ( filename ) ) ; return new GenerationFileHandler ( filename , append , shouldManifest ) ; } | Constructor - helper that rather than clobbering any existing file moves it aside with a timestamp suffix . |
8,914 | public T next ( ) { if ( ! hasNext ( ) ) { throw new NoSuchElementException ( ) ; } T returnObj = this . next ; this . next = null ; return returnObj ; } | Return the next item . |
8,915 | public static byte [ ] readToNull ( InputStream is , int maxSize ) throws IOException { byte [ ] bytes = new byte [ maxSize ] ; int i = 0 ; while ( i < maxSize ) { int b = is . read ( ) ; if ( b == - 1 ) { throw new EOFException ( "NO NULL" ) ; } bytes [ i ] = ( byte ) ( b & 0xff ) ; i ++ ; if ( b == 0 ) { return copy ... | Read buffer and return bytes from is until a null byte is encountered |
8,916 | static public void main ( String [ ] args ) { if ( args . length == 0 ) { System . out . println ( "Supply a Base32-encoded argument." ) ; return ; } System . out . println ( " Original: " + args [ 0 ] ) ; byte [ ] decoded = Base32 . decode ( args [ 0 ] ) ; System . out . print ( " Hex: " ) ; for ( int i = 0 ; i <... | For testing take a command - line argument in Base32 decode print in hex encode print |
8,917 | public void readHeader ( InputStream in ) throws IOException { CRC32 crc = new CRC32 ( ) ; crc . reset ( ) ; if ( ! testGzipMagic ( in , crc ) ) { throw new NoGzipMagicException ( ) ; } this . length += 2 ; if ( readByte ( in , crc ) != Deflater . DEFLATED ) { throw new IOException ( "Unknown compression" ) ; } this . ... | Read in gzip header . |
8,918 | private int readInt ( InputStream in , CRC32 crc ) throws IOException { int s = readShort ( in , crc ) ; return ( ( readShort ( in , crc ) << 16 ) & 0xffff0000 ) | s ; } | Read an int . |
8,919 | public String getHostBasename ( ) throws URIException { return ( this . getReferencedHost ( ) == null ) ? null : TextUtils . replaceFirst ( MASSAGEHOST_PATTERN , this . getReferencedHost ( ) , UsableURIFactory . EMPTY_STRING ) ; } | Strips www variants from the host . |
8,920 | protected void coalesceUriStrings ( ) { if ( this . cachedString != null && this . cachedEscapedURI != null && this . cachedString . length ( ) == this . cachedEscapedURI . length ( ) ) { this . cachedString = this . cachedEscapedURI ; } } | The two String fields cachedString and cachedEscapedURI are usually identical ; if so coalesce into a single instance . |
8,921 | protected void coalesceHostAuthorityStrings ( ) { if ( this . cachedAuthorityMinusUserinfo != null && this . cachedHost != null && this . cachedHost . length ( ) == this . cachedAuthorityMinusUserinfo . length ( ) ) { this . cachedAuthorityMinusUserinfo = this . cachedHost ; } } | The two String fields cachedHost and cachedAuthorityMinusUserInfo are usually identical ; if so coalesce into a single instance . |
8,922 | public String getReferencedHost ( ) throws URIException { String referencedHost = this . getHost ( ) ; if ( referencedHost == null && this . getScheme ( ) . equals ( "dns" ) ) { String possibleHost = this . getCurrentHierPath ( ) ; if ( possibleHost != null && possibleHost . matches ( "[-_\\w\\.:]+" ) ) { referencedHos... | Return the referenced host in the UURI if any also extracting the host of a DNS - lookup URI where necessary . |
8,923 | public static boolean hasScheme ( String possibleUrl ) { boolean result = false ; for ( int i = 0 ; i < possibleUrl . length ( ) ; i ++ ) { char c = possibleUrl . charAt ( i ) ; if ( c == ':' ) { if ( i != 0 ) { result = true ; } break ; } if ( ! scheme . get ( c ) ) { break ; } } return result ; } | Test if passed String has likely URI scheme prefix . |
8,924 | public void write ( OutputStream out ) throws IOException { for ( HttpHeader header : this ) { header . write ( out ) ; } out . write ( CR ) ; out . write ( LF ) ; } | Write all Headers and a trailing CRLF CRLF |
8,925 | private static boolean finishLastResponse ( final HttpConnection conn ) { InputStream lastResponse = conn . getLastResponseInputStream ( ) ; if ( lastResponse != null ) { conn . setLastResponseInputStream ( null ) ; try { lastResponse . close ( ) ; return true ; } catch ( IOException ioe ) { return false ; } } else { r... | Since the same connection is about to be reused make sure the previous request was completely processed and if not consume it now . |
8,926 | private byte [ ] generateARCFileMetaData ( String date ) throws IOException { if ( date != null && date . length ( ) > 14 ) { date = date . substring ( 0 , 14 ) ; } int metadataBodyLength = getMetadataLength ( ) ; String metadataHeaderLinesTwoAndThree = getMetadataHeaderLinesTwoAndThree ( "1 " + ( ( metadataBodyLength ... | Write out the ARCMetaData . |
8,927 | protected String validateMetaLine ( String metaLineStr ) throws IOException { if ( metaLineStr . length ( ) > MAX_METADATA_LINE_LENGTH ) { throw new IOException ( "Metadata line too long (" + metaLineStr . length ( ) + ">" + MAX_METADATA_LINE_LENGTH + "): " + metaLineStr ) ; } Matcher m = METADATA_LINE_PATTERN . matche... | Test that the metadata line is valid before writing . |
8,928 | private void writeRecord ( OutputStream out , HttpHeaders headers , byte [ ] contents ) throws IOException { if ( contents == null ) { headers . add ( CONTENT_LENGTH , "0" ) ; } else { headers . add ( CONTENT_LENGTH , String . valueOf ( contents . length ) ) ; } out . write ( WARC_ID . getBytes ( DEFAULT_ENCODING ) ) ;... | Write the headers and contents as a WARC record to the given output stream . |
8,929 | public static ArchiveReader get ( final String arcFileOrUrl ) throws MalformedURLException , IOException { return ArchiveReaderFactory . factory . getArchiveReader ( arcFileOrUrl ) ; } | Get an Archive file Reader on passed path or url . Does primitive heuristic figuring if path or URL . |
8,930 | public int getIntegerValue ( ) throws IOException , SaneException { Preconditions . checkState ( getValueType ( ) == OptionValueType . INT , "option is not an integer" ) ; Preconditions . checkState ( getValueCount ( ) == 1 , "option is an integer array, not integer" ) ; ControlOptionResult result = readOption ( ) ; Pr... | Reads the current Integer value option . We do not cache value from previous get or set operations so each get involves a round trip to the server . |
8,931 | public boolean setBooleanValue ( boolean value ) throws IOException , SaneException { ControlOptionResult result = writeOption ( SaneWord . forInt ( value ? 1 : 0 ) ) ; Preconditions . checkState ( result . getType ( ) == OptionValueType . BOOLEAN ) ; return SaneWord . fromBytes ( result . getValue ( ) ) . integerValue... | Sets the value of the current option to the supplied boolean value . Option value must be of boolean type . SANE may ignore your preference so if you need to ensure the value has been set correctly you should examine the return value of this method . |
8,932 | public double setFixedValue ( double value ) throws IOException , SaneException { Preconditions . checkArgument ( value >= - 32768 && value <= 32767.9999 , "value " + value + " is out of range" ) ; SaneWord wordValue = SaneWord . forFixedPrecision ( value ) ; ControlOptionResult result = writeOption ( wordValue ) ; Pre... | Sets the value of the current option to the supplied fixed - precision value . Option value must be of fixed - precision type . |
8,933 | public int setIntegerValue ( int newValue ) throws IOException , SaneException { Preconditions . checkState ( getValueCount ( ) == 1 , "option is an array" ) ; Preconditions . checkState ( isWriteable ( ) ) ; ControlOptionResult result = writeOption ( ImmutableList . of ( newValue ) ) ; Preconditions . checkState ( res... | Set the value of the current option to the supplied value . Option value must be of integer type |
8,934 | public void close ( ) throws IOException { if ( ! isOpen ( ) ) { throw new IOException ( "device is already closed" ) ; } session . closeDevice ( handle ) ; handle = null ; } | Closes the device . |
8,935 | public List < SaneOption > listOptions ( ) throws IOException { if ( optionTitleMap == null ) { groups . clear ( ) ; optionTitleMap = Maps . uniqueIndex ( SaneOption . optionsFor ( this ) , new Function < SaneOption , String > ( ) { public String apply ( SaneOption input ) { return input . getName ( ) ; } } ) ; } retur... | Returns the list of options applicable to this device . |
8,936 | void addOption ( SaneOption option ) { Preconditions . checkState ( option . getGroup ( ) == this ) ; options . add ( option ) ; } | Adds an option to the group . |
8,937 | public static SaneSession withRemoteSane ( InetAddress saneAddress , int port ) throws IOException { return withRemoteSane ( saneAddress , port , 0 , TimeUnit . MILLISECONDS , 0 , TimeUnit . MILLISECONDS ) ; } | Establishes a connection to the SANE daemon running on the given host on the given port with no connection timeout . |
8,938 | public List < SaneDevice > listDevices ( ) throws IOException , SaneException { outputStream . write ( SaneRpcCode . SANE_NET_GET_DEVICES ) ; outputStream . flush ( ) ; return inputStream . readDeviceList ( ) ; } | Lists the devices known to the SANE daemon . |
8,939 | public void close ( ) throws IOException { try { outputStream . write ( SaneRpcCode . SANE_NET_EXIT ) ; outputStream . close ( ) ; } finally { socket . close ( ) ; } } | Closes the connection to the SANE server . This is done immediately by closing the socket . |
8,940 | boolean authorize ( String resource ) throws IOException { if ( passwordProvider == null ) { throw new IOException ( "Authorization failed - no password provider present " + "(you must call setPasswordProvider)" ) ; } if ( passwordProvider . canAuthenticate ( resource ) ) { outputStream . write ( SaneRpcCode . SANE_NET... | Authorize the resource for access . |
8,941 | private void writePassword ( String resource , String password ) throws IOException { String [ ] resourceParts = resource . split ( "\\$MD5\\$" ) ; if ( resourceParts . length == 1 ) { outputStream . write ( password ) ; } else { outputStream . write ( "$MD5$" + SanePasswordEncoder . derivePassword ( resourceParts [ 1 ... | Write password to outputstream depending on resource provided by saned . |
8,942 | public void ignoreTileDao ( TileDao tileDao ) { GeoPackageOverlay tileOverlay = new GeoPackageOverlay ( tileDao ) ; linkedOverlays . add ( tileOverlay ) ; } | Ignore drawing tiles if they exist in the tile table represented by the tile dao |
8,943 | private List < Point > simplifyPoints ( List < Point > points ) { List < Point > simplifiedPoints = null ; if ( simplifyTolerance != null ) { if ( projection != null && ! projection . isUnit ( Units . METRES ) ) { points = toWebMercator . transform ( points ) ; } simplifiedPoints = GeometryUtils . simplifyPoints ( poin... | When the simplify tolerance is set simplify the points to a similar curve with fewer points . |
8,944 | public PolygonOrientation getOrientation ( List < LatLng > points ) { return SphericalUtil . computeSignedArea ( points ) >= 0 ? PolygonOrientation . COUNTERCLOCKWISE : PolygonOrientation . CLOCKWISE ; } | Determine the closed points orientation |
8,945 | public static GoogleMapShape addShapeToMap ( GoogleMap map , GoogleMapShape shape ) { GoogleMapShape addedShape = null ; switch ( shape . getShapeType ( ) ) { case LAT_LNG : addedShape = new GoogleMapShape ( shape . getGeometryType ( ) , GoogleMapShapeType . MARKER , addLatLngToMap ( map , ( LatLng ) shape . getShape (... | Add a shape to the map |
8,946 | public static mil . nga . geopackage . map . geom . MultiPolygon addPolygonsToMap ( GoogleMap map , MultiPolygonOptions polygons ) { mil . nga . geopackage . map . geom . MultiPolygon multiPolygon = new mil . nga . geopackage . map . geom . MultiPolygon ( ) ; for ( PolygonOptions polygonOption : polygons . getPolygonOp... | Add a list of Polygons to the map |
8,947 | public List < Marker > addPointsToMapAsMarkers ( GoogleMap map , List < LatLng > points , MarkerOptions customMarkerOptions , boolean ignoreIdenticalEnds ) { List < Marker > markers = new ArrayList < Marker > ( ) ; for ( int i = 0 ; i < points . size ( ) ; i ++ ) { LatLng latLng = points . get ( i ) ; if ( points . siz... | Add the list of points as markers |
8,948 | public PolylineMarkers addPolylineToMapAsMarkers ( GoogleMap map , PolylineOptions polylineOptions , MarkerOptions polylineMarkerOptions , PolylineOptions globalPolylineOptions ) { PolylineMarkers polylineMarkers = new PolylineMarkers ( this ) ; if ( globalPolylineOptions != null ) { polylineOptions . color ( globalPol... | Add a Polyline to the map as markers |
8,949 | public PolygonMarkers addPolygonToMapAsMarkers ( GoogleMapShapeMarkers shapeMarkers , GoogleMap map , PolygonOptions polygonOptions , MarkerOptions polygonMarkerOptions , MarkerOptions polygonMarkerHoleOptions , PolygonOptions globalPolygonOptions ) { PolygonMarkers polygonMarkers = new PolygonMarkers ( this ) ; if ( g... | Add a Polygon to the map as markers |
8,950 | public MultiPolylineMarkers addMultiPolylineToMapAsMarkers ( GoogleMapShapeMarkers shapeMarkers , GoogleMap map , MultiPolylineOptions multiPolyline , MarkerOptions polylineMarkerOptions , PolylineOptions globalPolylineOptions ) { MultiPolylineMarkers polylines = new MultiPolylineMarkers ( ) ; for ( PolylineOptions pol... | Add a MultiPolylineOptions to the map as markers |
8,951 | public MultiPolygonMarkers addMultiPolygonToMapAsMarkers ( GoogleMapShapeMarkers shapeMarkers , GoogleMap map , MultiPolygonOptions multiPolygon , MarkerOptions polygonMarkerOptions , MarkerOptions polygonMarkerHoleOptions , PolygonOptions globalPolygonOptions ) { MultiPolygonMarkers multiPolygonMarkers = new MultiPoly... | Add a MultiPolygonOptions to the map as markers |
8,952 | public List < LatLng > getPointsFromMarkers ( List < Marker > markers ) { List < LatLng > points = new ArrayList < LatLng > ( ) ; for ( Marker marker : markers ) { points . add ( marker . getPosition ( ) ) ; } return points ; } | Get a list of points as LatLng from a list of Markers |
8,953 | public BoundingBox boundingBoxToWebMercator ( BoundingBox boundingBox ) { if ( projection == null ) { throw new GeoPackageException ( "Shape Converter projection is null" ) ; } return boundingBox . transform ( toWebMercator ) ; } | Transform the bounding box in the feature projection to web mercator |
8,954 | public BoundingBox boundingBoxToWgs84 ( BoundingBox boundingBox ) { if ( projection == null ) { throw new GeoPackageException ( "Shape Converter projection is null" ) ; } return boundingBox . transform ( toWgs84 ) ; } | Transform the bounding box in the feature projection to WGS84 |
8,955 | public BoundingBox boundingBoxFromWebMercator ( BoundingBox boundingBox ) { if ( projection == null ) { throw new GeoPackageException ( "Shape Converter projection is null" ) ; } return boundingBox . transform ( fromWebMercator ) ; } | Transform the bounding box in web mercator to the feature projection |
8,956 | public BoundingBox boundingBoxFromWgs84 ( BoundingBox boundingBox ) { if ( projection == null ) { throw new GeoPackageException ( "Shape Converter projection is null" ) ; } return boundingBox . transform ( fromWgs84 ) ; } | Transform the bounding box in WGS84 to the feature projection |
8,957 | public void setDateFormat ( java . text . DateFormat dateFormat , java . text . DateFormat numbersDateFormat ) { this . customDateFormat = dateFormat ; this . secondaryDateFormat = numbersDateFormat ; if ( showMonthItem ) { int monthPosition = getAdapterItemPosition ( 4 ) ; boolean reselectMonthItem = getSelectedItemPo... | Sets the custom date format to use for formatting Calendar objects to displayable strings . |
8,958 | public void setShowPastItems ( boolean enable ) { if ( enable && ! showPastItems ) { if ( getMinDate ( ) != null && compareCalendarDates ( getMinDate ( ) , Calendar . getInstance ( ) ) == 0 ) setMinDate ( null ) ; final Resources res = getResources ( ) ; final Calendar date = Calendar . getInstance ( ) ; date . add ( C... | Toggles showing the past items . Past mode shows the yesterday and last weekday item . |
8,959 | public void setShowMonthItem ( boolean enable ) { if ( enable && ! showMonthItem ) { final Calendar date = Calendar . getInstance ( ) ; date . add ( Calendar . MONTH , 1 ) ; addAdapterItem ( new DateItem ( formatDate ( date ) , date , R . id . date_month ) ) ; } else if ( ! enable && showMonthItem ) { removeAdapterItem... | Toggles showing the month item . Month mode an item in exactly one month from now . |
8,960 | public void setFlags ( int modeOrFlags ) { setShowPastItems ( ( modeOrFlags & ReminderDatePicker . FLAG_PAST ) != 0 ) ; setShowMonthItem ( ( modeOrFlags & ReminderDatePicker . FLAG_MONTH ) != 0 ) ; setShowWeekdayNames ( ( modeOrFlags & ReminderDatePicker . FLAG_WEEKDAY_NAMES ) != 0 ) ; setShowNumbersInView ( ( modeOrFl... | Set the flags to use for this date spinner . |
8,961 | private float brightness ( int color ) { int r = ( color >> 16 ) & 0xFF ; int g = ( color >> 8 ) & 0xFF ; int b = color & 0xFF ; int V = Math . max ( b , Math . max ( r , g ) ) ; return ( V / 255.f ) ; } | Returns the brightness component of a color int . Taken from android . graphics . Color . |
8,962 | private Calendar getNextItemDate ( Calendar searchDate ) { final int last = dateSpinner . getLastItemPosition ( ) ; for ( int i = 0 ; i <= last ; i ++ ) { final Calendar date = ( ( DateItem ) dateSpinner . getItemAtPosition ( i ) ) . getDate ( ) ; if ( DateSpinner . compareCalendarDates ( date , searchDate ) >= 0 ) ret... | Gets the next date item s date equal to or later than the given date in the DateSpinner . Requires that the items are in ascending order . |
8,963 | public void setSelectedDate ( Calendar date ) { if ( date != null ) { dateSpinner . setSelectedDate ( date ) ; timeSpinner . setSelectedTime ( date . get ( Calendar . HOUR_OF_DAY ) , date . get ( Calendar . MINUTE ) ) ; shouldSelectDefault = false ; } } | Sets the Spinners selection as date considering both time and day . |
8,964 | public void setSelectedDate ( int year , int month , int day ) { dateSpinner . setSelectedDate ( new GregorianCalendar ( year , month , day ) ) ; shouldSelectDefault = false ; } | Sets the Spinners date selection as integers considering only day . |
8,965 | public void setHideTime ( boolean enable , final boolean useDarkTheme ) { if ( enable && ! shouldHideTime ) { timeSpinner . setVisibility ( GONE ) ; ImageButton timeButton = ( ImageButton ) LayoutInflater . from ( getContext ( ) ) . inflate ( R . layout . time_button , null ) ; timeButton . setImageResource ( useDarkTh... | Toggles hiding the Time Spinner and replaces it with a Button . |
8,966 | public void setFlags ( int modeOrFlags ) { setHideTime ( ( modeOrFlags & FLAG_HIDE_TIME ) != 0 , isActivityUsingDarkTheme ( ) ) ; dateSpinner . setFlags ( modeOrFlags ) ; timeSpinner . setFlags ( modeOrFlags ) ; } | Set the flags to use for the picker . |
8,967 | public void setTimeFormat ( java . text . DateFormat timeFormat ) { this . timeFormat = timeFormat ; initTimePickerDialog ( getContext ( ) ) ; final PickerSpinnerAdapter adapter = ( ( PickerSpinnerAdapter ) getAdapter ( ) ) ; final boolean moreTimeItems = isShowingMoreTimeItems ( ) ; final boolean numbersInView = adapt... | Sets the time format to use for formatting Calendar objects to displayable strings . |
8,968 | public void setShowMoreTimeItems ( boolean enable ) { if ( enable && ! showMoreTimeItems ) { final Resources res = getResources ( ) ; insertAdapterItem ( new TimeItem ( res . getString ( R . string . time_afternoon_2 ) , formatTime ( 14 , 0 ) , 14 , 0 , R . id . time_afternoon_2 ) , 2 ) ; removeAdapterItemById ( R . id... | Toggles showing more time items . If enabled a noon and a late night time item are shown . |
8,969 | public void setFlags ( int modeOrFlags ) { setShowMoreTimeItems ( ( modeOrFlags & ReminderDatePicker . FLAG_MORE_TIME ) != 0 ) ; setShowNumbersInView ( ( modeOrFlags & ReminderDatePicker . FLAG_NUMBERS ) != 0 ) ; } | Set the flags to use for this time spinner . |
8,970 | public Map < String , Map < Long , FeatureShape > > getTables ( String database ) { Map < String , Map < Long , FeatureShape > > tables = databases . get ( database ) ; if ( tables == null ) { tables = new HashMap < > ( ) ; databases . put ( database , tables ) ; } return tables ; } | Get the mapping between tables and feature ids for the database |
8,971 | public Map < Long , FeatureShape > getFeatureIds ( String database , String table ) { Map < String , Map < Long , FeatureShape > > tables = getTables ( database ) ; Map < Long , FeatureShape > featureIds = getFeatureIds ( tables , table ) ; return featureIds ; } | Get the mapping between feature ids and map shapes for the database and table |
8,972 | private Map < Long , FeatureShape > getFeatureIds ( Map < String , Map < Long , FeatureShape > > tables , String table ) { Map < Long , FeatureShape > featureIds = tables . get ( table ) ; if ( featureIds == null ) { featureIds = new HashMap < > ( ) ; tables . put ( table , featureIds ) ; } return featureIds ; } | Get the feature ids and map shapes for the tables and table |
8,973 | public FeatureShape getFeatureShape ( String database , String table , long featureId ) { Map < Long , FeatureShape > featureIds = getFeatureIds ( database , table ) ; FeatureShape featureShape = getFeatureShape ( featureIds , featureId ) ; return featureShape ; } | Get the feature shape for the database table and feature id |
8,974 | public int getFeatureShapeCount ( String database , String table , long featureId ) { return getFeatureShape ( database , table , featureId ) . count ( ) ; } | Get the feature shape count for the database table and feature id |
8,975 | private FeatureShape getFeatureShape ( Map < Long , FeatureShape > featureIds , long featureId ) { FeatureShape featureShape = featureIds . get ( featureId ) ; if ( featureShape == null ) { featureShape = new FeatureShape ( featureId ) ; featureIds . put ( featureId , featureShape ) ; } return featureShape ; } | Get the map shapes for the feature ids and feature id |
8,976 | public void addMapShape ( GoogleMapShape mapShape , long featureId , String database , String table ) { FeatureShape featureShape = getFeatureShape ( database , table , featureId ) ; featureShape . addShape ( mapShape ) ; } | Add a map shape with the feature id database and table |
8,977 | public void addMapMetadataShape ( GoogleMapShape mapShape , long featureId , String database , String table ) { FeatureShape featureShape = getFeatureShape ( database , table , featureId ) ; featureShape . addMetadataShape ( mapShape ) ; } | Add a map metadata shape with the feature id database and table |
8,978 | public boolean exists ( long featureId , String database , String table ) { boolean exists = false ; Map < String , Map < Long , FeatureShape > > tables = databases . get ( database ) ; if ( tables != null ) { Map < Long , FeatureShape > featureIds = tables . get ( table ) ; if ( featureIds != null ) { FeatureShape sha... | Check if map shapes exist for the feature id database and table |
8,979 | public int removeShapesWithExclusions ( String database , Set < GoogleMapShapeType > excludedTypes ) { int count = 0 ; Map < String , Map < Long , FeatureShape > > tables = getTables ( database ) ; if ( tables != null ) { Iterator < String > iterator = tables . keySet ( ) . iterator ( ) ; while ( iterator . hasNext ( )... | Remove all map shapes in the database from the map excluding shapes with the excluded types |
8,980 | public int removeShapesWithExclusion ( String database , String table , GoogleMapShapeType excludedType ) { Set < GoogleMapShapeType > excludedTypes = new HashSet < > ( ) ; excludedTypes . add ( excludedType ) ; return removeShapesWithExclusions ( database , table , excludedTypes ) ; } | Remove all map shapes in the database and table from the map excluding shapes with the excluded type |
8,981 | public int removeShapesWithExclusions ( String database , String table , Set < GoogleMapShapeType > excludedTypes ) { int count = 0 ; Map < Long , FeatureShape > featureIds = getFeatureIds ( database , table ) ; if ( featureIds != null ) { Iterator < Long > iterator = featureIds . keySet ( ) . iterator ( ) ; while ( it... | Remove all map shapes in the database and table from the map excluding shapes with the excluded types |
8,982 | public int removeShapesNotWithinMap ( GoogleMap map ) { int count = 0 ; BoundingBox boundingBox = MapUtils . getBoundingBox ( map ) ; for ( String database : databases . keySet ( ) ) { count += removeShapesNotWithinMap ( boundingBox , database ) ; } return count ; } | Remove all map shapes that are not visible in the map |
8,983 | public int removeShapesNotWithinMap ( BoundingBox boundingBox , String database ) { int count = 0 ; Map < String , Map < Long , FeatureShape > > tables = getTables ( database ) ; if ( tables != null ) { for ( String table : tables . keySet ( ) ) { count += removeShapesNotWithinMap ( boundingBox , database , table ) ; }... | Remove all map shapes in the database that are not visible in the bounding box |
8,984 | public int removeShapesNotWithinMap ( BoundingBox boundingBox , String database , String table ) { int count = 0 ; Map < Long , FeatureShape > featureIds = getFeatureIds ( database , table ) ; if ( featureIds != null ) { List < Long > deleteFeatureIds = new ArrayList < > ( ) ; for ( long featureId : featureIds . keySet... | Remove all map shapes in the database and table that are not visible in the bounding box |
8,985 | public boolean removeFeatureShape ( String database , String table , long featureId ) { boolean removed = false ; Map < Long , FeatureShape > featureIds = getFeatureIds ( database , table ) ; if ( featureIds != null ) { FeatureShape featureShape = featureIds . remove ( featureId ) ; if ( featureShape != null ) { featur... | Remove the feature shape from the database and table |
8,986 | public void remove ( ) { switch ( shapeType ) { case MARKER : ( ( Marker ) shape ) . remove ( ) ; break ; case POLYGON : ( ( Polygon ) shape ) . remove ( ) ; break ; case POLYLINE : ( ( Polyline ) shape ) . remove ( ) ; break ; case MULTI_MARKER : ( ( MultiMarker ) shape ) . remove ( ) ; break ; case MULTI_POLYLINE : (... | Removes all objects added to the map |
8,987 | public void setVisible ( boolean visible ) { switch ( shapeType ) { case MARKER_OPTIONS : ( ( MarkerOptions ) shape ) . visible ( visible ) ; break ; case POLYLINE_OPTIONS : ( ( PolylineOptions ) shape ) . visible ( visible ) ; break ; case POLYGON_OPTIONS : ( ( PolygonOptions ) shape ) . visible ( visible ) ; break ; ... | Updates visibility of all objects |
8,988 | public void update ( ) { switch ( shapeType ) { case POLYLINE_MARKERS : ( ( PolylineMarkers ) shape ) . update ( ) ; break ; case POLYGON_MARKERS : ( ( PolygonMarkers ) shape ) . update ( ) ; break ; case MULTI_POLYLINE_MARKERS : ( ( MultiPolylineMarkers ) shape ) . update ( ) ; break ; case MULTI_POLYGON_MARKERS : ( (... | Updates all objects that could have changed from moved markers |
8,989 | public boolean isValid ( ) { boolean valid = true ; switch ( shapeType ) { case POLYLINE_MARKERS : valid = ( ( PolylineMarkers ) shape ) . isValid ( ) ; break ; case POLYGON_MARKERS : valid = ( ( PolygonMarkers ) shape ) . isValid ( ) ; break ; case MULTI_POLYLINE_MARKERS : valid = ( ( MultiPolylineMarkers ) shape ) . ... | Determines if the shape is in a valid state |
8,990 | public BoundingBox boundingBox ( ) { BoundingBox boundingBox = new BoundingBox ( Double . MAX_VALUE , Double . MAX_VALUE , - Double . MAX_VALUE , - Double . MAX_VALUE ) ; expandBoundingBox ( boundingBox ) ; return boundingBox ; } | Get a bounding box that includes the shape |
8,991 | public void expandBoundingBox ( BoundingBox boundingBox ) { switch ( shapeType ) { case LAT_LNG : expandBoundingBox ( boundingBox , ( LatLng ) shape ) ; break ; case MARKER_OPTIONS : expandBoundingBox ( boundingBox , ( ( MarkerOptions ) shape ) . getPosition ( ) ) ; break ; case POLYLINE_OPTIONS : expandBoundingBox ( b... | Expand the bounding box to include the shape |
8,992 | private void expandBoundingBox ( BoundingBox boundingBox , LatLng latLng ) { double latitude = latLng . latitude ; double longitude = latLng . longitude ; if ( boundingBox . getMinLongitude ( ) <= 3 * ProjectionConstants . WGS84_HALF_WORLD_LON_WIDTH && boundingBox . getMaxLongitude ( ) >= 3 * - ProjectionConstants . WG... | Expand the bounding box by the LatLng |
8,993 | private void expandBoundingBox ( BoundingBox boundingBox , List < LatLng > latLngs ) { for ( LatLng latLng : latLngs ) { expandBoundingBox ( boundingBox , latLng ) ; } } | Expand the bounding box by the LatLngs |
8,994 | private void expandBoundingBoxMarkers ( BoundingBox boundingBox , List < Marker > markers ) { for ( Marker marker : markers ) { expandBoundingBox ( boundingBox , marker . getPosition ( ) ) ; } } | Expand the bounding box by the markers |
8,995 | public void setBoundingBox ( BoundingBox boundingBox , Projection projection ) { ProjectionTransform projectionToWebMercator = projection . getTransformation ( ProjectionConstants . EPSG_WEB_MERCATOR ) ; webMercatorBoundingBox = boundingBox . transform ( projectionToWebMercator ) ; } | Set the bounding box provided as the indicated projection |
8,996 | public BoundingBox getBoundingBox ( Projection projection ) { ProjectionTransform webMercatorToProjection = ProjectionFactory . getProjection ( ProjectionConstants . EPSG_WEB_MERCATOR ) . getTransformation ( projection ) ; return webMercatorBoundingBox . transform ( webMercatorToProjection ) ; } | Get the bounding box as the provided projection |
8,997 | public boolean hasTile ( int x , int y , int zoom ) { boolean hasTile = isWithinBounds ( x , y , zoom ) ; if ( hasTile ) { hasTile = hasTileToRetrieve ( x , y , zoom ) ; } return hasTile ; } | Determine if there is a tile for the x y and zoom |
8,998 | public boolean isWithinBounds ( int x , int y , int zoom ) { return isWithinZoom ( zoom ) && isWithinBoundingBox ( x , y , zoom ) ; } | Is the tile within the zoom and bounding box bounds |
8,999 | public boolean isWithinZoom ( float zoom ) { return ( minZoom == null || zoom >= minZoom ) && ( maxZoom == null || zoom <= maxZoom ) ; } | Check if the zoom is within the overlay zoom range |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.