idx int64 0 165k | question stringlengths 73 4.15k | target stringlengths 5 918 | len_question int64 21 890 | len_target int64 3 255 |
|---|---|---|---|---|
6,300 | private static < P extends GISPrimitive , N extends AbstractGISTreeSetNode < P , N > > Point2d computeCutPoint ( IcosepQuadTreeZone region , N parent ) { final double w = parent . nodeWidth / 4. ; final double h = parent . nodeHeight / 4. ; final double x ; final double y ; switch ( region ) { case SOUTH_WEST : x = par... | Computes the cut planes position of the given region . | 212 | 11 |
6,301 | private static < P extends GISPrimitive , N extends AbstractGISTreeSetNode < P , N > > N rearrangeTree ( AbstractGISTreeSet < P , N > tree , N node , Rectangle2afp < ? , ? , ? , ? , ? , ? > desiredBounds , GISTreeSetNodeFactory < P , N > builder ) { // Search for the node that completely contains the desired area N top... | Try to rearrange the cut planes of the given node . | 450 | 12 |
6,302 | protected synchronized void addShapeGeometryChangeListener ( ShapeGeometryChangeListener listener ) { assert listener != null : AssertMessages . notNullParameter ( ) ; if ( this . geometryListeners == null ) { this . geometryListeners = new WeakArrayList <> ( ) ; } this . geometryListeners . add ( listener ) ; } | Add listener on geometry changes . | 73 | 6 |
6,303 | protected synchronized void removeShapeGeometryChangeListener ( ShapeGeometryChangeListener listener ) { assert listener != null : AssertMessages . notNullParameter ( ) ; if ( this . geometryListeners != null ) { this . geometryListeners . remove ( listener ) ; if ( this . geometryListeners . isEmpty ( ) ) { this . geo... | Remove listener on geometry changes . | 81 | 6 |
6,304 | protected synchronized void fireGeometryChange ( ) { if ( this . geometryListeners == null ) { return ; } final ShapeGeometryChangeListener [ ] array = new ShapeGeometryChangeListener [ this . geometryListeners . size ( ) ] ; this . geometryListeners . toArray ( array ) ; for ( final ShapeGeometryChangeListener listene... | Notify any listener of a geometry change . | 89 | 9 |
6,305 | protected void setupListeners ( ) { addDrawingListener ( new DrawingListener ( ) { private long time ; @ Override public void onDrawingStart ( ) { this . time = System . currentTimeMillis ( ) ; getCorner ( ) . setColor ( Color . ORANGERED ) ; } @ Override public void onDrawingEnd ( ) { getCorner ( ) . setColor ( null )... | Setup the response based on listeners . | 152 | 7 |
6,306 | @ SuppressWarnings ( { "checkstyle:cyclomaticcomplexity" , "checkstyle:npathcomplexity" , "checkstyle:nestedifdepth" } ) protected void setupMousing ( ) { final ZoomableCanvas < T > canvas = getDocumentCanvas ( ) ; canvas . addEventHandler ( MouseEvent . MOUSE_PRESSED , e -> { this . pressX = e . getX ( ) ; this . pres... | Setup the response of the pane to mouse events . | 517 | 10 |
6,307 | protected void setupKeying ( ) { setOnKeyPressed ( event -> { switch ( event . getCode ( ) ) { case LEFT : moveLeft ( event . isShiftDown ( ) , event . isControlDown ( ) , false ) ; event . consume ( ) ; break ; case RIGHT : moveRight ( event . isShiftDown ( ) , event . isControlDown ( ) , false ) ; event . consume ( )... | Setup the response of the pane to key events . | 313 | 10 |
6,308 | public void moveLeft ( boolean isUnit , boolean isLarge , boolean isVeryLarge ) { double inc = isUnit ? this . hbar . getUnitIncrement ( ) : ( isLarge ? LARGE_MOVE_FACTOR : ( isVeryLarge ? VERY_LARGE_MOVE_FACTOR : STANDARD_MOVE_FACTOR ) ) * this . hbar . getBlockIncrement ( ) ; if ( ! isInvertedAxisX ( ) ) { inc = - in... | Move the viewport left . | 160 | 6 |
6,309 | public void moveUp ( boolean isUnit , boolean isLarge , boolean isVeryLarge ) { double inc = isUnit ? this . vbar . getUnitIncrement ( ) : ( isLarge ? LARGE_MOVE_FACTOR : ( isVeryLarge ? VERY_LARGE_MOVE_FACTOR : STANDARD_MOVE_FACTOR ) ) * this . vbar . getBlockIncrement ( ) ; if ( ! isInvertedAxisY ( ) ) { inc = - inc ... | Move the viewport up . | 160 | 6 |
6,310 | public ObjectProperty < Logger > loggerProperty ( ) { if ( this . logger == null ) { this . logger = new SimpleObjectProperty < Logger > ( this , LOGGER_PROPERTY , Logger . getLogger ( getClass ( ) . getName ( ) ) ) { @ Override protected void invalidated ( ) { final Logger log = get ( ) ; if ( log == null ) { set ( Lo... | Replies the property that contains the logger . | 120 | 9 |
6,311 | public ObjectProperty < MouseButton > panButtonProperty ( ) { if ( this . panButton == null ) { this . panButton = new StyleableObjectProperty < MouseButton > ( DEFAULT_PAN_BUTTON ) { @ SuppressWarnings ( "synthetic-access" ) @ Override protected void invalidated ( ) { final MouseButton button = get ( ) ; if ( button =... | Replies the property for the button that serves for starting the mouse scrolling . | 194 | 15 |
6,312 | public DoubleProperty panSensitivityProperty ( ) { if ( this . panSensitivity == null ) { this . panSensitivity = new StyleableDoubleProperty ( DEFAULT_PAN_SENSITIVITY ) { @ Override public void invalidated ( ) { if ( get ( ) <= MIN_PAN_SENSITIVITY ) { set ( MIN_PAN_SENSITIVITY ) ; } } @ Override public CssMetaData < Z... | Replies the property that indicates the sensibility of the panning moves . The sensibility is a strictly positive number that is multiplied to the distance covered by the mouse motion for obtaining the move to apply to the document . The default value is 1 . | 187 | 50 |
6,313 | public double getPanSensitivity ( boolean unitSensitivityModifier , boolean hugeSensivityModifier ) { if ( unitSensitivityModifier ) { return DEFAULT_PAN_SENSITIVITY ; } final double sens = getPanSensitivity ( ) ; if ( hugeSensivityModifier ) { return sens * LARGE_MOVE_FACTOR ; } return sens ; } | Replies the sensibility of the panning moves after applying dynamic user interaction modifiers . The sensibility is a strictly positive number that is multiplied to the distance covered by the mouse motion for obtaining the move to apply to the document . The default value is 1 . | 85 | 52 |
6,314 | public static void setGlobalSplineApproximationRatio ( Double distance ) { if ( distance == null || Double . isNaN ( distance . doubleValue ( ) ) ) { globalSplineApproximation = GeomConstants . SPLINE_APPROXIMATION_RATIO ; } else { globalSplineApproximation = Math . max ( 0 , distance ) ; } } | Change the maximum distance that the line segments used to approximate the curved segments are allowed to deviate from any point on the original curve . | 84 | 27 |
6,315 | public ESRIBounds createUnion ( ESRIBounds bounds ) { final ESRIBounds eb = new ESRIBounds ( ) ; eb . minx = ( bounds . minx < this . minx ) ? bounds . minx : this . minx ; eb . maxx = ( bounds . maxx < this . maxx ) ? this . maxx : bounds . maxx ; eb . miny = ( bounds . miny < this . miny ) ? bounds . miny : this . mi... | Create and replies an union of this bounds and the given bounds . | 250 | 13 |
6,316 | public void add ( ESRIPoint point ) { if ( point . getX ( ) < this . minx ) { this . minx = point . getX ( ) ; } if ( point . getX ( ) > this . maxx ) { this . maxx = point . getX ( ) ; } if ( point . getY ( ) < this . miny ) { this . miny = point . getY ( ) ; } if ( point . getY ( ) > this . maxy ) { this . maxy = poi... | Add a point to this bounds . | 236 | 7 |
6,317 | @ Pure public Rectangle2d toRectangle2d ( ) { final Rectangle2d bounds = new Rectangle2d ( ) ; bounds . setFromCorners ( this . minx , this . miny , this . maxx , this . maxy ) ; return bounds ; } | Replies the 2D bounds . | 62 | 7 |
6,318 | public void ensureMinMax ( ) { double t ; if ( this . maxx < this . minx ) { t = this . minx ; this . minx = this . maxx ; this . maxx = t ; } if ( this . maxy < this . miny ) { t = this . miny ; this . miny = this . maxy ; this . maxy = t ; } if ( this . maxz < this . minz ) { t = this . minz ; this . minz = this . ma... | Ensure that min and max values are correctly ordered . | 164 | 11 |
6,319 | public ESRIBounds getBoundsFromHeader ( ) { try { readHeader ( ) ; } catch ( IOException exception ) { return null ; } return new ESRIBounds ( this . minx , this . maxx , this . miny , this . maxy , this . minz , this . maxz , this . minm , this . maxm ) ; } | Replies the bounds read from the shape file header . | 81 | 11 |
6,320 | public E read ( ) throws IOException { boolean status = false ; try { // Read header if not already read readHeader ( ) ; // Read the records E element ; try { do { element = readRecord ( this . nextExpectedRecordIndex ) ; if ( ! postRecordReadingStage ( element ) ) { element = null ; } ++ this . nextExpectedRecordInde... | Read the elements for a shape file . | 179 | 8 |
6,321 | protected void setReadingPosition ( int recordIndex , int byteIndex ) throws IOException { if ( this . seekEnabled ) { this . nextExpectedRecordIndex = recordIndex ; this . buffer . position ( byteIndex ) ; } else { throw new SeekOperationDisabledException ( ) ; } } | Set the reading position excluding the header . | 62 | 8 |
6,322 | protected void ensureAvailableBytes ( int amount ) throws IOException { if ( ! this . seekEnabled && amount > this . buffer . remaining ( ) ) { this . bufferPosition += this . buffer . position ( ) ; this . buffer . compact ( ) ; int limit = this . buffer . position ( ) ; final int read = this . stream . read ( this . ... | Ensure that the reading buffer is containing enoug bytes to read . | 152 | 14 |
6,323 | protected void skipBytes ( int amount ) throws IOException { ensureAvailableBytes ( amount ) ; this . buffer . position ( this . buffer . position ( ) + amount ) ; } | Skip an amount of bytes . | 37 | 6 |
6,324 | @ Pure public Point2D < ? , ? > predictTargetPosition ( Point2D < ? , ? > targetPosition , Vector2D < ? , ? > targetLinearMotion ) { return new Point2d ( targetPosition . getX ( ) + targetLinearMotion . getX ( ) * this . predictionDuration , targetPosition . getY ( ) + targetLinearMotion . getY ( ) * this . predictionD... | Predict the next position of the target . | 94 | 9 |
6,325 | protected void reconnect ( Session session ) { if ( this . hsClient . isStarted ( ) ) { if ( log . isDebugEnabled ( ) ) { log . debug ( "Add reconnectRequest to connector " + session . getRemoteSocketAddress ( ) ) ; } HandlerSocketSession hSession = ( HandlerSocketSession ) session ; InetSocketAddress addr = hSession .... | Auto reconect request to hs4j server | 131 | 10 |
6,326 | public AStarSegmentReplacer < ST > setSegmentReplacer ( AStarSegmentReplacer < ST > replacer ) { final AStarSegmentReplacer < ST > old = this . segmentReplacer ; this . segmentReplacer = replacer ; return old ; } | Set the object to use to replace the segments in the shortest path . | 60 | 14 |
6,327 | public AStarSegmentOrientation < ST , PT > setSegmentOrientationTool ( AStarSegmentOrientation < ST , PT > tool ) { final AStarSegmentOrientation < ST , PT > old = this . segmentOrientation ; this . segmentOrientation = tool ; return old ; } | Set the tool that permits to retreive the orinetation of the segments . | 71 | 17 |
6,328 | public AStarCostComputer < ? super ST , ? super PT > setCostComputer ( AStarCostComputer < ? super ST , ? super PT > costComputer ) { final AStarCostComputer < ? super ST , ? super PT > old = this . costComputer ; this . costComputer = costComputer ; return old ; } | Set the tool that permits to compute the costs of the nodes and the edges . | 68 | 16 |
6,329 | @ Pure protected double estimate ( PT p1 , PT p2 ) { assert p1 != null && p2 != null ; if ( this . heuristic == null ) { throw new IllegalStateException ( Locale . getString ( "E1" ) ) ; //$NON-NLS-1$ } return this . heuristic . evaluate ( p1 , p2 ) ; } | Evaluate the distance between two points in the graph . | 82 | 12 |
6,330 | @ Pure protected double computeCostFor ( ST segment ) { if ( this . costComputer != null ) { return this . costComputer . computeCostFor ( segment ) ; } return segment . getLength ( ) ; } | Compute and replies the cost to traverse the given graph segment . | 45 | 13 |
6,331 | @ SuppressWarnings ( { "unchecked" , "rawtypes" } ) @ Pure protected GP newPath ( PT startPoint , ST segment ) { if ( this . pathFactory != null ) { return this . pathFactory . newPath ( startPoint , segment ) ; } try { return ( GP ) new GraphPath ( segment , startPoint ) ; } catch ( Throwable e ) { throw new IllegalSt... | Create an empty path . | 117 | 5 |
6,332 | protected boolean addToPath ( GP path , ST segment ) { if ( this . pathFactory != null ) { return this . pathFactory . addToPath ( path , segment ) ; } assert path != null ; assert segment != null ; try { return path . add ( segment ) ; } catch ( Throwable e ) { throw new IllegalStateException ( e ) ; } } | Add the given segment into the given path . | 78 | 9 |
6,333 | @ Pure protected ST replaceSegment ( int index , ST segment ) { ST rep = null ; if ( this . segmentReplacer != null ) { rep = this . segmentReplacer . replaceSegment ( index , segment ) ; } if ( rep == null ) { rep = segment ; } return rep ; } | Invoked to replace a segment before adding it to the shortest path . | 65 | 14 |
6,334 | public static Vector2d convert ( Tuple2D < ? > tuple ) { if ( tuple instanceof Vector2d ) { return ( Vector2d ) tuple ; } return new Vector2d ( tuple . getX ( ) , tuple . getY ( ) ) ; } | Convert the given tuple to a real Vector2d . | 58 | 12 |
6,335 | public boolean addBusLine ( BusLine busLine ) { if ( busLine == null ) { return false ; } if ( this . busLines . indexOf ( busLine ) != - 1 ) { return false ; } if ( ! this . busLines . add ( busLine ) ) { return false ; } final boolean isValidLine = busLine . isValidPrimitive ( ) ; busLine . setEventFirable ( isEventF... | Add a bus line inside the bus network . | 205 | 9 |
6,336 | public void removeAllBusLines ( ) { for ( final BusLine busline : this . busLines ) { busline . setContainer ( null ) ; busline . setEventFirable ( true ) ; } this . busLines . clear ( ) ; fireShapeChanged ( new BusChangeEvent ( this , BusChangeEventType . ALL_LINES_REMOVED , null , - 1 , "shape" , //$NON-NLS-1$ null ,... | Remove all the bus lines from the current network . | 115 | 10 |
6,337 | public boolean removeBusLine ( BusLine busLine ) { final int index = this . busLines . indexOf ( busLine ) ; if ( index >= 0 ) { return removeBusLine ( index ) ; } return false ; } | Remove a bus line from this network . All the itineraries and the associated stops will be removed also . If this bus line removal implies empty hubs these hubs will be also removed . | 49 | 36 |
6,338 | public boolean removeBusLine ( String name ) { final Iterator < BusLine > iterator = this . busLines . iterator ( ) ; BusLine busLine ; int i = 0 ; while ( iterator . hasNext ( ) ) { busLine = iterator . next ( ) ; if ( name . equals ( busLine . getName ( ) ) ) { iterator . remove ( ) ; busLine . setContainer ( null ) ... | Remove the bus line with the given name . All the itineraries and the associated stops will be removed also . If this bus line removal implies empty hubs these hubs will be also removed . | 167 | 37 |
6,339 | public boolean removeBusLine ( int index ) { try { final BusLine busLine = this . busLines . remove ( index ) ; busLine . setContainer ( null ) ; busLine . setEventFirable ( true ) ; fireShapeChanged ( new BusChangeEvent ( this , BusChangeEventType . LINE_REMOVED , busLine , index , "shape" , //$NON-NLS-1$ null , null ... | Remove the bus line at the specified index . All the itineraries and the associated stops will be removed also . If this bus line removal implies empty hubs these hubs will be also removed . | 121 | 37 |
6,340 | @ Pure public BusLine getBusLine ( UUID uuid ) { if ( uuid == null ) { return null ; } for ( final BusLine busLine : this . busLines ) { if ( uuid . equals ( busLine . getUUID ( ) ) ) { return busLine ; } } return null ; } | Replies the bus line with the specified uuid . | 70 | 11 |
6,341 | @ Pure public BusLine getBusLine ( String name , Comparator < String > nameComparator ) { if ( name == null ) { return null ; } final Comparator < String > cmp = nameComparator == null ? BusNetworkUtilities . NAME_COMPARATOR : nameComparator ; for ( final BusLine busLine : this . busLines ) { if ( cmp . compare ( name ... | Replies the bus line with the specified name . | 109 | 10 |
6,342 | public boolean addBusStop ( BusStop busStop ) { if ( busStop == null ) { return false ; } if ( this . validBusStops . contains ( busStop ) ) { return false ; } if ( ListUtil . contains ( this . invalidBusStops , INVALID_STOP_COMPARATOR , busStop ) ) { return false ; } final boolean isValidPrimitive = busStop . isValidP... | Add a bus stop inside the bus network . | 273 | 9 |
6,343 | public void removeAllBusStops ( ) { for ( final BusStop busStop : this . validBusStops ) { busStop . setContainer ( null ) ; busStop . setEventFirable ( true ) ; } for ( final BusStop busStop : this . invalidBusStops ) { busStop . setContainer ( null ) ; busStop . setEventFirable ( true ) ; } this . validBusStops . cle... | Remove all the bus stops from the current network . | 163 | 10 |
6,344 | public boolean removeBusStop ( BusStop busStop ) { if ( this . validBusStops . remove ( busStop ) ) { busStop . setContainer ( null ) ; busStop . setEventFirable ( true ) ; fireShapeChanged ( new BusChangeEvent ( this , BusChangeEventType . STOP_REMOVED , busStop , - 1 , "shape" , //$NON-NLS-1$ null , null ) ) ; checkP... | Remove a bus stop from this network . If this bus stop removal implies empty hubs these hubs will be also removed . | 222 | 23 |
6,345 | public boolean removeBusStop ( String name ) { Iterator < BusStop > iterator ; BusStop busStop ; iterator = this . validBusStops . iterator ( ) ; while ( iterator . hasNext ( ) ) { busStop = iterator . next ( ) ; if ( name . equals ( busStop . getName ( ) ) ) { iterator . remove ( ) ; busStop . setContainer ( null ) ; ... | Remove the bus stops with the given name . If this bus stop removal implies empty hubs these hubs will be also removed . | 286 | 24 |
6,346 | @ Pure public BusStop getBusStop ( UUID id ) { if ( id == null ) { return null ; } for ( final BusStop busStop : this . validBusStops ) { final UUID busid = busStop . getUUID ( ) ; if ( id . equals ( busid ) ) { return busStop ; } } for ( final BusStop busStop : this . invalidBusStops ) { final UUID busid = busStop . g... | Replies the bus stop with the specified id . | 125 | 10 |
6,347 | @ Pure public BusStop getBusStop ( String name , Comparator < String > nameComparator ) { if ( name == null ) { return null ; } final Comparator < String > cmp = nameComparator == null ? BusNetworkUtilities . NAME_COMPARATOR : nameComparator ; for ( final BusStop busStop : this . validBusStops ) { if ( cmp . compare ( ... | Replies the bus stop with the specified name . | 153 | 10 |
6,348 | @ Pure public Iterator < BusStop > getBusStopsIn ( Rectangle2afp < ? , ? , ? , ? , ? , ? > clipBounds ) { return Iterators . unmodifiableIterator ( this . validBusStops . iterator ( clipBounds ) ) ; } | Replies the set of bus stops that have an intersection with the specified rectangle . | 63 | 16 |
6,349 | @ Pure public BusStop getNearestBusStop ( double x , double y ) { double distance = Double . POSITIVE_INFINITY ; BusStop bestStop = null ; double dist ; for ( final BusStop stop : this . validBusStops ) { dist = stop . distance ( x , y ) ; if ( dist < distance ) { distance = dist ; bestStop = stop ; } } return bestStop... | Replies the nearest bus stops to the given point . | 90 | 11 |
6,350 | private boolean addBusHub ( BusHub hub ) { if ( hub == null ) { return false ; } if ( this . validBusHubs . contains ( hub ) ) { return false ; } if ( ListUtil . contains ( this . invalidBusHubs , INVALID_HUB_COMPARATOR , hub ) ) { return false ; } final boolean isValidPrimitive = hub . isValidPrimitive ( ) ; if ( isVa... | Add the given bus hub in the network . | 252 | 9 |
6,351 | public void removeAllBusHubs ( ) { for ( final BusHub busHub : this . validBusHubs ) { busHub . setContainer ( null ) ; busHub . setEventFirable ( true ) ; } for ( final BusHub busHub : this . invalidBusHubs ) { busHub . setContainer ( null ) ; busHub . setEventFirable ( true ) ; } this . validBusHubs . clear ( ) ; thi... | Remove all the bus hubs from the current network . | 153 | 10 |
6,352 | public boolean removeBusHub ( BusHub busHub ) { if ( this . validBusHubs . remove ( busHub ) ) { busHub . setContainer ( null ) ; busHub . setEventFirable ( true ) ; firePrimitiveChanged ( new BusChangeEvent ( this , BusChangeEventType . HUB_REMOVED , busHub , - 1 , null , null , null ) ) ; checkPrimitiveValidity ( ) ;... | Remove a bus hubs from this network . | 213 | 8 |
6,353 | public boolean removeBusHub ( String name ) { Iterator < BusHub > iterator ; BusHub busHub ; iterator = this . validBusHubs . iterator ( ) ; while ( iterator . hasNext ( ) ) { busHub = iterator . next ( ) ; if ( name . equals ( busHub . getName ( ) ) ) { iterator . remove ( ) ; busHub . setContainer ( null ) ; busHub .... | Remove the bus hub with the given name . | 266 | 9 |
6,354 | @ Pure public BusHub getBusHub ( UUID uuid ) { if ( uuid == null ) { return null ; } for ( final BusHub busHub : this . validBusHubs ) { if ( uuid . equals ( busHub . getUUID ( ) ) ) { return busHub ; } } for ( final BusHub busHub : this . invalidBusHubs ) { if ( uuid . equals ( busHub . getUUID ( ) ) ) { return busHub... | Replies the bus hub with the specified uuid . | 111 | 11 |
6,355 | @ Pure public BusHub getBusHub ( String name , Comparator < String > nameComparator ) { if ( name == null ) { return null ; } final Comparator < String > cmp = nameComparator == null ? BusNetworkUtilities . NAME_COMPARATOR : nameComparator ; for ( final BusHub busHub : this . validBusHubs ) { if ( cmp . compare ( name ... | Replies the bus hub with the specified name . | 153 | 10 |
6,356 | @ Pure public Iterator < BusHub > getBusHubsIn ( Rectangle2afp < ? , ? , ? , ? , ? , ? > clipBounds ) { return Iterators . unmodifiableIterator ( this . validBusHubs . iterator ( clipBounds ) ) ; } | Replies the set of bus hubs that have an intersection with the specified rectangle . | 63 | 16 |
6,357 | public void setValue ( Object instance , Object value ) { try { setMethod . invoke ( instance , value ) ; } catch ( Exception e ) { throw new PropertyNotFoundException ( klass , getType ( ) , fieldName ) ; } } | Set new value | 52 | 3 |
6,358 | public static Vector3dfx convert ( Tuple3D < ? > tuple ) { if ( tuple instanceof Vector3dfx ) { return ( Vector3dfx ) tuple ; } return new Vector3dfx ( tuple . getX ( ) , tuple . getY ( ) , tuple . getZ ( ) ) ; } | Convert the given tuple to a real Vector3dfx . | 65 | 12 |
6,359 | public void shuffleSelectedRightRowToLeftTableModel ( final int selectedRow ) { if ( - 1 < selectedRow ) { final T row = rightTableModel . removeAt ( selectedRow ) ; leftTableModel . add ( row ) ; } } | Shuffle selected right row to left table model . | 53 | 10 |
6,360 | public OffsetGroup startReferenceOffsetsForContentOffset ( CharOffset contentOffset ) { return characterRegions ( ) . get ( regionIndexContainingContentOffset ( contentOffset ) ) . startOffsetGroupForPosition ( contentOffset ) ; } | Get the earliest reference string offsets corresponding to the given content string offset . | 50 | 14 |
6,361 | public OffsetGroup endReferenceOffsetsForContentOffset ( CharOffset contentOffset ) { return characterRegions ( ) . get ( regionIndexContainingContentOffset ( contentOffset ) ) . endOffsetGroupForPosition ( contentOffset ) ; } | Get the latest reference string offsets corresponding to the given content string offset . | 50 | 14 |
6,362 | public final Optional < UnicodeFriendlyString > referenceSubstringByContentOffsets ( final OffsetRange < CharOffset > contentOffsets ) { if ( referenceString ( ) . isPresent ( ) ) { return Optional . of ( referenceString ( ) . get ( ) . substringByCodePoints ( OffsetGroupRange . from ( startReferenceOffsetsForContentOf... | Gets the substring of the reference string corresponding to a range of content string offsets . This will include intervening characters which may not themselves correspond to any content string character . | 130 | 34 |
6,363 | @ SuppressWarnings ( "checkstyle:localvariablename" ) @ Pure public int getLatitudeMinute ( ) { double p = Math . abs ( this . phi ) ; p = p - ( int ) p ; return ( int ) ( p * 60. ) ; } | Replies the minute of the sexagesimal representation of the latitude phi . | 64 | 16 |
6,364 | @ SuppressWarnings ( "checkstyle:localvariablename" ) @ Pure public double getLatitudeSecond ( ) { double p = Math . abs ( this . phi ) ; p = ( p - ( int ) p ) * 60. ; p = p - ( int ) p ; return p * 60. ; } | Replies the second of the sexagesimal representation of the latitude phi . | 72 | 16 |
6,365 | @ SuppressWarnings ( "checkstyle:localvariablename" ) @ Pure public int getLongitudeMinute ( ) { double l = Math . abs ( this . lambda ) ; l = l - ( int ) l ; return ( int ) ( l * 60. ) ; } | Replies the minute of the sexagesimal representation of the longitude phi . | 63 | 17 |
6,366 | @ SuppressWarnings ( "checkstyle:localvariablename" ) @ Pure public double getLongitudeSecond ( ) { double p = Math . abs ( this . lambda ) ; p = ( p - ( int ) p ) * 60. ; p = p - ( int ) p ; return p * 60. ; } | Replies the second of the sexagesimal representation of the longitude phi . | 71 | 17 |
6,367 | public static void setPreferredStringRepresentation ( GeodesicPositionStringRepresentation representation , boolean useSymbolicDirection ) { final Preferences prefs = Preferences . userNodeForPackage ( GeodesicPosition . class ) ; if ( prefs != null ) { if ( representation == null ) { prefs . remove ( "STRING_REPRESENT... | Set the preferred format of the string representation of a geodesic position . | 201 | 15 |
6,368 | @ Pure public static GeodesicPositionStringRepresentation getPreferredStringRepresentation ( boolean allowNullValue ) { final Preferences prefs = Preferences . userNodeForPackage ( GeodesicPosition . class ) ; if ( prefs != null ) { final String v = prefs . get ( "STRING_REPRESENTATION" , null ) ; //$NON-NLS-1$ if ( v ... | Replies the preferred format of the string representation of a geodesic position . | 218 | 16 |
6,369 | @ Pure public static boolean getDirectionSymbolInPreferredStringRepresentation ( ) { final Preferences prefs = Preferences . userNodeForPackage ( GeodesicPosition . class ) ; if ( prefs != null ) { return prefs . getBoolean ( "SYMBOL_IN_STRING_REPRESENTATION" , DEFAULT_SYMBOL_IN_STRING_REPRESENTATION ) ; //$NON-NLS-1$ ... | Replies if the direction symbol should be output in the preferred string representation of a geodesic position . | 119 | 21 |
6,370 | public synchronized void addForestListener ( ForestListener listener ) { if ( this . listeners == null ) { this . listeners = new ArrayList <> ( ) ; } this . listeners . add ( listener ) ; } | Add forest listener . | 44 | 4 |
6,371 | public synchronized void removeForestListener ( ForestListener listener ) { if ( this . listeners != null ) { this . listeners . remove ( listener ) ; if ( this . listeners . isEmpty ( ) ) { this . listeners = null ; } } } | Remove forest listener . | 51 | 4 |
6,372 | @ SuppressWarnings ( "static-method" ) @ Provides @ Singleton public Log4jIntegrationConfig getLog4jIntegrationConfig ( ConfigurationFactory configFactory , Injector injector ) { final Log4jIntegrationConfig config = Log4jIntegrationConfig . getConfiguration ( configFactory ) ; injector . injectMembers ( config ) ; ret... | Replies the instance of the log4j integration configuration .. | 81 | 12 |
6,373 | @ SuppressWarnings ( "static-method" ) @ Singleton @ Provides public Logger provideRootLogger ( ConfigurationFactory configFactory , Provider < Log4jIntegrationConfig > config ) { final Logger root = Logger . getRootLogger ( ) ; // Reroute JUL SLF4JBridgeHandler . removeHandlersForRootLogger ( ) ; SLF4JBridgeHandler . ... | Provide the root logger . | 138 | 6 |
6,374 | @ Override protected void onInitializeComponents ( ) { lpNoProxy = new JLayeredPane ( ) ; lpNoProxy . setBorder ( new EtchedBorder ( EtchedBorder . RAISED , null , null ) ) ; lpHostOrIpaddress = new JLayeredPane ( ) ; lpHostOrIpaddress . setBorder ( new EtchedBorder ( EtchedBorder . RAISED , null , null ) ) ; rdbtnManu... | Initialize components . | 709 | 4 |
6,375 | @ Pure public static Iterator < BusItineraryHalt > getBusHalts ( BusLine busLine ) { assert busLine != null ; return new LineHaltIterator ( busLine ) ; } | Replies all the bus itinerary halts in the given bus line . | 43 | 15 |
6,376 | @ Pure public static Iterator < BusItineraryHalt > getBusHalts ( BusNetwork busNetwork ) { assert busNetwork != null ; return new NetworkHaltIterator ( busNetwork ) ; } | Replies all the bus itinerary halts in the given bus network . | 43 | 15 |
6,377 | protected Method getActionMethod ( Class actionClass , String methodName ) throws NoSuchMethodException { Method method ; try { method = actionClass . getMethod ( methodName , new Class [ 0 ] ) ; } catch ( NoSuchMethodException e ) { // hmm -- OK, try doXxx instead try { String altMethodName = "do" + methodName . subst... | This is copied from DefaultActionInvocation | 146 | 8 |
6,378 | private String cutYear ( String str ) { if ( str . length ( ) > 3 ) { return str . substring ( str . length ( ) - 3 , str . length ( ) ) ; } else { return str ; } } | Remove the 2 - bit year number from input date string | 49 | 11 |
6,379 | @ Override public Point3d getPivot ( ) { Point3d pivot = this . cachedPivot == null ? null : this . cachedPivot . get ( ) ; if ( pivot == null ) { pivot = getProjection ( 0. , 0. , 0. ) ; this . cachedPivot = new WeakReference <> ( pivot ) ; } return pivot ; } | Replies the pivot point around which the rotation must be done . | 81 | 13 |
6,380 | private static String decodeHTMLEntities ( String string ) { if ( string == null ) { return null ; } try { return URLDecoder . decode ( string , Charset . defaultCharset ( ) . displayName ( ) ) ; } catch ( UnsupportedEncodingException exception ) { return string ; } } | Replace the HTML entities by the current charset characters . | 69 | 12 |
6,381 | private static String encodeHTMLEntities ( String string ) { if ( string == null ) { return null ; } try { return URLEncoder . encode ( string , Charset . defaultCharset ( ) . displayName ( ) ) ; } catch ( UnsupportedEncodingException exception ) { return string ; } } | Replace the special characters by HTML entities . | 70 | 9 |
6,382 | @ Pure @ Inline ( value = "URISchemeType.JAR.isURL($1)" , imported = { URISchemeType . class } ) public static boolean isJarURL ( URL url ) { return URISchemeType . JAR . isURL ( url ) ; } | Replies if the given URL has a jar scheme . | 64 | 11 |
6,383 | @ Pure public static URL getJarURL ( URL url ) { if ( ! isJarURL ( url ) ) { return null ; } String path = url . getPath ( ) ; final int idx = path . lastIndexOf ( JAR_URL_FILE_ROOT ) ; if ( idx >= 0 ) { path = path . substring ( 0 , idx ) ; } try { return new URL ( path ) ; } catch ( MalformedURLException exception ) ... | Replies the jar part of the jar - scheme URL . | 108 | 12 |
6,384 | @ Pure public static File getJarFile ( URL url ) { if ( isJarURL ( url ) ) { final String path = url . getPath ( ) ; final int idx = path . lastIndexOf ( JAR_URL_FILE_ROOT ) ; if ( idx >= 0 ) { return new File ( decodeHTMLEntities ( path . substring ( idx + 1 ) ) ) ; } } return null ; } | Replies the file part of the jar - scheme URL . | 94 | 12 |
6,385 | @ Pure public static boolean isCaseSensitiveFilenameSystem ( ) { switch ( OperatingSystem . getCurrentOS ( ) ) { case AIX : case ANDROID : case BSD : case FREEBSD : case NETBSD : case OPENBSD : case LINUX : case SOLARIS : case HPUX : return true ; //$CASES-OMITTED$ default : return false ; } } | Replies if the current operating system uses case - sensitive filename . | 85 | 13 |
6,386 | @ Pure public static String extension ( File filename ) { if ( filename == null ) { return null ; } final String largeBasename = largeBasename ( filename ) ; final int idx = largeBasename . lastIndexOf ( getFileExtensionCharacter ( ) ) ; if ( idx <= 0 ) { return "" ; //$NON-NLS-1$ } return largeBasename . substring ( i... | Reply the extension of the specified file . | 92 | 8 |
6,387 | @ Pure public static boolean hasExtension ( File filename , String extension ) { if ( filename == null ) { return false ; } assert extension != null ; String extent = extension ; if ( ! "" . equals ( extent ) && ! extent . startsWith ( EXTENSION_SEPARATOR ) ) { //$NON-NLS-1$ extent = EXTENSION_SEPARATOR + extent ; } fi... | Replies if the specified file has the specified extension . | 139 | 11 |
6,388 | @ Pure public static File getSystemConfigurationDirectoryFor ( String software ) { if ( software == null || "" . equals ( software ) ) { //$NON-NLS-1$ throw new IllegalArgumentException ( ) ; } final OperatingSystem os = OperatingSystem . getCurrentOS ( ) ; if ( os == OperatingSystem . ANDROID ) { return join ( File . ... | Replies the system configuration directory for the specified software . | 248 | 11 |
6,389 | @ Pure public static String getSystemSharedLibraryDirectoryNameFor ( String software ) { final File f = getSystemSharedLibraryDirectoryFor ( software ) ; if ( f == null ) { return null ; } return f . getAbsolutePath ( ) ; } | Replies the system shared library directory for the specified software . | 55 | 12 |
6,390 | @ Pure public static File convertStringToFile ( String filename ) { if ( filename == null || "" . equals ( filename ) ) { //$NON-NLS-1$ return null ; } if ( isWindowsNativeFilename ( filename ) ) { return normalizeWindowsNativeFilename ( filename ) ; } // Test for malformed filenames. return new File ( extractLocalPath... | Convert a string which represents a local file into a File . | 118 | 13 |
6,391 | @ Pure @ SuppressWarnings ( "checkstyle:npathcomplexity" ) public static File convertURLToFile ( URL url ) { URL theUrl = url ; if ( theUrl == null ) { return null ; } if ( URISchemeType . RESOURCE . isURL ( theUrl ) ) { theUrl = Resources . getResource ( decodeHTMLEntities ( theUrl . getFile ( ) ) ) ; if ( theUrl == n... | Convert an URL which represents a local file or a resource into a File . | 696 | 16 |
6,392 | @ Pure @ SuppressWarnings ( { "checkstyle:cyclomaticcomplexity" , "checkstyle:npathcomplexity" } ) public static URL getParentURL ( URL url ) throws MalformedURLException { if ( url == null ) { return url ; } String path = url . getPath ( ) ; final String prefix ; final String parentStr ; switch ( URISchemeType . getSc... | Replies the parent URL for the given URL . | 420 | 10 |
6,393 | @ Pure @ SuppressWarnings ( "checkstyle:magicnumber" ) private static String extractLocalPath ( String filename ) { if ( filename == null ) { return null ; } final int max = Math . min ( FILE_PREFIX . length , filename . length ( ) ) ; final int inner = max - 2 ; if ( inner <= 0 ) { return filename ; } boolean foundInn... | Test if the given filename is a local filename and extract the path component . | 324 | 15 |
6,394 | @ Pure public static boolean isWindowsNativeFilename ( String filename ) { final String fn = extractLocalPath ( filename ) ; if ( fn == null || fn . length ( ) == 0 ) { return false ; } final Pattern pattern = Pattern . compile ( WINDOW_NATIVE_FILENAME_PATTERN ) ; final Matcher matcher = pattern . matcher ( fn ) ; retu... | Replies if the given string contains a Windows® ; native long filename . | 91 | 16 |
6,395 | @ Pure public static File normalizeWindowsNativeFilename ( String filename ) { final String fn = extractLocalPath ( filename ) ; if ( fn != null && fn . length ( ) > 0 ) { final Pattern pattern = Pattern . compile ( WINDOW_NATIVE_FILENAME_PATTERN ) ; final Matcher matcher = pattern . matcher ( fn ) ; if ( matcher . fin... | Normalize the given string contains a Windows® ; native long filename and replies a Java - standard version . | 121 | 22 |
6,396 | @ Pure public static URL makeCanonicalURL ( URL url ) { if ( url != null ) { final String [ ] pathComponents = url . getPath ( ) . split ( Pattern . quote ( URL_PATH_SEPARATOR ) ) ; final List < String > canonicalPath = new LinkedList <> ( ) ; for ( final String component : pathComponents ) { if ( ! CURRENT_DIRECTORY .... | Make the given URL canonical . | 368 | 6 |
6,397 | public static void zipFile ( File input , File output ) throws IOException { try ( FileOutputStream fos = new FileOutputStream ( output ) ) { zipFile ( input , fos ) ; } } | Create a zip file from the given input file . | 44 | 10 |
6,398 | @ SuppressWarnings ( "checkstyle:npathcomplexity" ) public static void zipFile ( File input , OutputStream output ) throws IOException { try ( ZipOutputStream zos = new ZipOutputStream ( output ) ) { if ( input == null ) { return ; } final LinkedList < File > candidates = new LinkedList <> ( ) ; candidates . add ( inpu... | Create a zip file from the given input file . If the input file is a directory the content of the directory is zipped . If the input file is a standard file it is zipped . | 416 | 39 |
6,399 | public static void unzipFile ( InputStream input , File output ) throws IOException { if ( output == null ) { return ; } output . mkdirs ( ) ; if ( ! output . isDirectory ( ) ) { throw new IOException ( Locale . getString ( "E3" , output ) ) ; //$NON-NLS-1$ } try ( ZipInputStream zis = new ZipInputStream ( input ) ) { ... | Unzip the given stream and write out the file in the output . If the input file is a directory the content of the directory is zipped . If the input file is a standard file it is zipped . | 271 | 43 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.