idx int64 0 165k | question stringlengths 73 5.81k | target stringlengths 5 918 |
|---|---|---|
132,600 | 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 . |
132,601 | 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 . |
132,602 | 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 . |
132,603 | 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 . |
132,604 | public T next ( ) { if ( ! hasNext ( ) ) { throw new NoSuchElementException ( ) ; } T returnObj = this . next ; this . next = null ; return returnObj ; } | Return the next item . |
132,605 | 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 |
132,606 | 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 |
132,607 | 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 . |
132,608 | private int readInt ( InputStream in , CRC32 crc ) throws IOException { int s = readShort ( in , crc ) ; return ( ( readShort ( in , crc ) << 16 ) & 0xffff0000 ) | s ; } | Read an int . |
132,609 | 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 . |
132,610 | 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 . |
132,611 | 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 . |
132,612 | 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 . |
132,613 | 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 . |
132,614 | 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 |
132,615 | 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 . |
132,616 | 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 . |
132,617 | 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 . |
132,618 | 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 . |
132,619 | 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 . |
132,620 | 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 . |
132,621 | 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 . |
132,622 | 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 . |
132,623 | 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 |
132,624 | public void close ( ) throws IOException { if ( ! isOpen ( ) ) { throw new IOException ( "device is already closed" ) ; } session . closeDevice ( handle ) ; handle = null ; } | Closes the device . |
132,625 | 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 . |
132,626 | void addOption ( SaneOption option ) { Preconditions . checkState ( option . getGroup ( ) == this ) ; options . add ( option ) ; } | Adds an option to the group . |
132,627 | 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 . |
132,628 | 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 . |
132,629 | 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 . |
132,630 | 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 . |
132,631 | 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 . |
132,632 | 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 |
132,633 | 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 . |
132,634 | public PolygonOrientation getOrientation ( List < LatLng > points ) { return SphericalUtil . computeSignedArea ( points ) >= 0 ? PolygonOrientation . COUNTERCLOCKWISE : PolygonOrientation . CLOCKWISE ; } | Determine the closed points orientation |
132,635 | 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 |
132,636 | 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 |
132,637 | 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 |
132,638 | 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 |
132,639 | 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 |
132,640 | 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 |
132,641 | 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 |
132,642 | 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 |
132,643 | 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 |
132,644 | 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 |
132,645 | 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 |
132,646 | 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 |
132,647 | 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 . |
132,648 | 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 . |
132,649 | 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 . |
132,650 | 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 . |
132,651 | 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 . |
132,652 | 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 . |
132,653 | 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 . |
132,654 | 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 . |
132,655 | 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 . |
132,656 | 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 . |
132,657 | 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 . |
132,658 | 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 . |
132,659 | 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 . |
132,660 | 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 |
132,661 | 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 |
132,662 | 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 |
132,663 | 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 |
132,664 | 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 |
132,665 | 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 |
132,666 | 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 |
132,667 | 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 |
132,668 | 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 |
132,669 | 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 |
132,670 | 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 |
132,671 | 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 |
132,672 | 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 |
132,673 | 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 |
132,674 | 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 |
132,675 | 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 |
132,676 | 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 |
132,677 | 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 |
132,678 | 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 |
132,679 | 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 |
132,680 | 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 |
132,681 | 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 |
132,682 | 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 |
132,683 | private void expandBoundingBox ( BoundingBox boundingBox , List < LatLng > latLngs ) { for ( LatLng latLng : latLngs ) { expandBoundingBox ( boundingBox , latLng ) ; } } | Expand the bounding box by the LatLngs |
132,684 | private void expandBoundingBoxMarkers ( BoundingBox boundingBox , List < Marker > markers ) { for ( Marker marker : markers ) { expandBoundingBox ( boundingBox , marker . getPosition ( ) ) ; } } | Expand the bounding box by the markers |
132,685 | 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 |
132,686 | 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 |
132,687 | 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 |
132,688 | 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 |
132,689 | public boolean isWithinZoom ( float zoom ) { return ( minZoom == null || zoom >= minZoom ) && ( maxZoom == null || zoom <= maxZoom ) ; } | Check if the zoom is within the overlay zoom range |
132,690 | public boolean isWithinBoundingBox ( int x , int y , int zoom ) { boolean withinBounds = true ; if ( webMercatorBoundingBox != null ) { BoundingBox tileWebMercatorBoundingBox = TileBoundingBoxUtils . getWebMercatorBoundingBox ( x , y , zoom ) ; BoundingBox adjustedWebMercatorBoundingBox = getWebMercatorBoundingBox ( ti... | Check if the tile request is within the desired tile bounds |
132,691 | public boolean isOnAtCurrentZoom ( GoogleMap map , LatLng latLng ) { float zoom = MapUtils . getCurrentZoom ( map ) ; boolean on = isOnAtCurrentZoom ( zoom , latLng ) ; return on ; } | Determine if the the feature overlay is on for the current zoom level of the map at the location |
132,692 | public boolean isOnAtCurrentZoom ( double zoom , LatLng latLng ) { Point point = new Point ( latLng . longitude , latLng . latitude ) ; TileGrid tileGrid = TileBoundingBoxUtils . getTileGridFromWGS84 ( point , ( int ) zoom ) ; boolean on = boundedOverlay . hasTile ( ( int ) tileGrid . getMinX ( ) , ( int ) tileGrid . g... | Determine if the feature overlay is on for the provided zoom level at the location |
132,693 | public BoundingBox buildClickBoundingBox ( LatLng latLng , BoundingBox mapBounds ) { double width = TileBoundingBoxMapUtils . getLongitudeDistance ( mapBounds ) * screenClickPercentage ; double height = TileBoundingBoxMapUtils . getLatitudeDistance ( mapBounds ) * screenClickPercentage ; LatLng leftCoordinate = Spheric... | Build a bounding box using the location coordinate click location and map view bounds |
132,694 | public FeatureIndexResults queryFeatures ( BoundingBox boundingBox ) { FeatureIndexResults results = queryFeatures ( boundingBox , null ) ; return results ; } | Query for features in the WGS84 projected bounding box |
132,695 | public FeatureIndexResults queryFeatures ( BoundingBox boundingBox , Projection projection ) { if ( projection == null ) { projection = ProjectionFactory . getProjection ( ProjectionConstants . EPSG_WORLD_GEODETIC_SYSTEM ) ; } FeatureIndexManager indexManager = featureTiles . getIndexManager ( ) ; if ( indexManager == ... | Query for features in the bounding box |
132,696 | public static double getToleranceDistance ( View view , GoogleMap map ) { BoundingBox boundingBox = getBoundingBox ( map ) ; double boundingBoxWidth = TileBoundingBoxMapUtils . getLongitudeDistance ( boundingBox ) ; double boundingBoxHeight = TileBoundingBoxMapUtils . getLatitudeDistance ( boundingBox ) ; int viewWidth... | Get the tolerance distance meters in the current region of the map |
132,697 | public static BoundingBox getBoundingBox ( GoogleMap map ) { LatLngBounds visibleBounds = map . getProjection ( ) . getVisibleRegion ( ) . latLngBounds ; LatLng southwest = visibleBounds . southwest ; LatLng northeast = visibleBounds . northeast ; double minLatitude = southwest . latitude ; double maxLatitude = northea... | Get the WGS84 bounding box of the current map view screen . The max longitude will be larger than the min resulting in values larger than 180 . 0 . |
132,698 | public static BoundingBox buildClickBoundingBox ( LatLng latLng , View view , GoogleMap map , float screenClickPercentage ) { LatLngBoundingBox latLngBoundingBox = buildClickLatLngBoundingBox ( latLng , view , map , screenClickPercentage ) ; BoundingBox boundingBox = new BoundingBox ( latLngBoundingBox . getLeftCoordin... | Build a bounding box using the click location map view map and screen percentage tolerance . The bounding box can be used to query for features that were clicked |
132,699 | public static LatLngBounds buildClickLatLngBounds ( LatLng latLng , View view , GoogleMap map , float screenClickPercentage ) { LatLngBoundingBox latLngBoundingBox = buildClickLatLngBoundingBox ( latLng , view , map , screenClickPercentage ) ; double southWestLongitude = Math . min ( latLngBoundingBox . getLeftCoordina... | Build a lat lng bounds using the click location map view map and screen percentage tolerance . The bounding box can be used to query for features that were clicked |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.