idx int64 0 165k | question stringlengths 73 5.81k | target stringlengths 5 918 |
|---|---|---|
6,200 | public static Function < EREEventMention , TYPE > typeFunction ( ) { return new Function < EREEventMention , TYPE > ( ) { public TYPE apply ( final EREEventMention input ) { return input . getType ( ) ; } } ; } | guava style functions |
6,201 | public static Object displayURLonStandardBrowser ( final Component parentComponent , final String url ) { Object obj = null ; try { if ( System . getProperty ( SYSTEM_PROPERTY_OS_NAME ) . startsWith ( OS . MAC . getOs ( ) ) ) { obj = openURLinMacOS ( url ) ; } else if ( System . getProperty ( SYSTEM_PROPERTY_OS_NAME ) . startsWith ( OS . WINDOWS . getOs ( ) ) ) { obj = openURLinWindowsOS ( url ) ; } else { obj = openURLinUnixOS ( url ) ; } } catch ( final Exception e ) { JOptionPane . showMessageDialog ( parentComponent , "An exception occured attempting to run the default web browser\n" + e . toString ( ) ) ; } return obj ; } | This method opens the specified url in the standard web - browser . |
6,202 | private static Object openURLinMacOS ( final String url ) throws ClassNotFoundException , NoSuchMethodException , IllegalAccessException , InvocationTargetException { final Class < ? > fileManagerClass = Class . forName ( MAC_FILE_MANAGER ) ; final Method openURL = fileManagerClass . getDeclaredMethod ( "openURL" , new Class [ ] { String . class } ) ; return openURL . invoke ( null , new Object [ ] { url } ) ; } | Opens the given URL in mac os . |
6,203 | private static Boolean openURLinUnixOS ( final String url ) throws InterruptedException , IOException , Exception { Boolean executed = false ; for ( final Browsers browser : Browsers . values ( ) ) { if ( ! executed ) { executed = Runtime . getRuntime ( ) . exec ( new String [ ] { UNIX_COMMAND_WHICH , browser . getBrowserName ( ) } ) . waitFor ( ) == 0 ; if ( executed ) { Runtime . getRuntime ( ) . exec ( new String [ ] { browser . getBrowserName ( ) , url } ) ; } } } if ( ! executed ) { throw new Exception ( Arrays . toString ( Browsers . values ( ) ) ) ; } return executed ; } | Opens the given URL in unix os . |
6,204 | private static Process openURLinWindowsOS ( final String url ) throws IOException { String cmd = null ; cmd = WINDOWS_PATH + " " + WINDOWS_FLAG + " " ; return Runtime . getRuntime ( ) . exec ( cmd + url ) ; } | Opens the given URL in windows os . |
6,205 | protected void onInitializeGroupLayout ( ) { javax . swing . GroupLayout layout = new javax . swing . GroupLayout ( this ) ; this . setLayout ( layout ) ; layout . setHorizontalGroup ( layout . createParallelGroup ( javax . swing . GroupLayout . Alignment . LEADING ) . addGroup ( layout . createSequentialGroup ( ) . addContainerGap ( ) . addComponent ( scrTree , javax . swing . GroupLayout . PREFERRED_SIZE , 384 , javax . swing . GroupLayout . PREFERRED_SIZE ) . addContainerGap ( javax . swing . GroupLayout . DEFAULT_SIZE , Short . MAX_VALUE ) ) ) ; layout . setVerticalGroup ( layout . createParallelGroup ( javax . swing . GroupLayout . Alignment . LEADING ) . addGroup ( layout . createSequentialGroup ( ) . addContainerGap ( ) . addComponent ( scrTree , javax . swing . GroupLayout . DEFAULT_SIZE , 536 , Short . MAX_VALUE ) . addContainerGap ( ) ) ) ; } | On initialize group layout . |
6,206 | public static void displayVersionInfo ( String command ) { String version = ProxyInitStrategy . class . getPackage ( ) . getImplementationVersion ( ) ; if ( version == null ) { version = "N/A" ; } System . out . format ( "%s v. %s (%s)\n" , command , version , getAPIVersionString ( ) ) ; } | Display version information . |
6,207 | public static boolean intersectsOrientedBoxCapsule ( double centerx , double centery , double centerz , double axis1x , double axis1y , double axis1z , double axis2x , double axis2y , double axis2z , double axis3x , double axis3y , double axis3z , double extentAxis1 , double extentAxis2 , double extentAxis3 , double capsule1Ax , double capsule1Ay , double capsule1Az , double capsule1Bx , double capsule1By , double capsule1Bz , double capsule1Radius ) { Point3f closestFromA = new Point3f ( ) ; Point3f closestFromB = new Point3f ( ) ; computeClosestFarestOBBPoints ( capsule1Ax , capsule1Ay , capsule1Az , centerx , centery , centerz , axis1x , axis1y , axis1z , axis2x , axis2y , axis2z , axis3x , axis3y , axis3z , extentAxis1 , extentAxis2 , extentAxis3 , closestFromA , null ) ; computeClosestFarestOBBPoints ( capsule1Bx , capsule1By , capsule1Bz , centerx , centery , centerz , axis1x , axis1y , axis1z , axis2x , axis2y , axis2z , axis3x , axis3y , axis3z , extentAxis1 , extentAxis2 , extentAxis3 , closestFromB , null ) ; double distance = AbstractSegment3F . distanceSquaredSegmentSegment ( capsule1Ax , capsule1Ay , capsule1Az , capsule1Bx , capsule1By , capsule1Bz , closestFromA . getX ( ) , closestFromA . getY ( ) , closestFromA . getZ ( ) , closestFromB . getX ( ) , closestFromB . getY ( ) , closestFromB . getZ ( ) ) ; return ( distance <= ( capsule1Radius * capsule1Radius ) ) ; } | Compute intersection between an OBB and a capsule . |
6,208 | public void setFromPointCloud ( Iterable < ? extends Point3D > pointCloud ) { Vector3f r = new Vector3f ( ) ; Vector3f s = new Vector3f ( ) ; Vector3f t = new Vector3f ( ) ; Point3f c = new Point3f ( ) ; double [ ] extents = new double [ 3 ] ; computeOBBCenterAxisExtents ( pointCloud , r , s , t , c , extents ) ; set ( c . getX ( ) , c . getY ( ) , c . getZ ( ) , r . getX ( ) , r . getY ( ) , r . getZ ( ) , s . getX ( ) , s . getY ( ) , s . getZ ( ) , extents [ 0 ] , extents [ 1 ] , extents [ 2 ] ) ; } | Set the oriented box from a could of points . |
6,209 | public void rotate ( Quaternion rotation ) { Transform3D m = new Transform3D ( ) ; m . transform ( this . getFirstAxis ( ) ) ; m . transform ( this . getSecondAxis ( ) ) ; m . transform ( this . getThirdAxis ( ) ) ; this . setFirstAxisExtent ( this . getFirstAxis ( ) . length ( ) ) ; this . setSecondAxisExtent ( this . getSecondAxis ( ) . length ( ) ) ; this . setThirdAxisExtent ( this . getThirdAxis ( ) . length ( ) ) ; this . getFirstAxis ( ) . normalize ( ) ; this . getSecondAxis ( ) . normalize ( ) ; this . getThirdAxis ( ) . normalize ( ) ; } | Rotate the box around its pivot point . The pivot point is the center of the box . |
6,210 | public void rotate ( Quaternion rotation , Point3D pivot ) { if ( pivot != null ) { Transform3D m1 = new Transform3D ( ) ; m1 . setTranslation ( - pivot . getX ( ) , - pivot . getY ( ) , - pivot . getZ ( ) ) ; Transform3D m2 = new Transform3D ( ) ; m2 . setRotation ( rotation ) ; Transform3D m3 = new Transform3D ( ) ; m3 . setTranslation ( pivot . getX ( ) , pivot . getY ( ) , pivot . getZ ( ) ) ; Transform3D r = new Transform3D ( ) ; r . mul ( m1 , m2 ) ; r . mul ( m3 ) ; r . transform ( this . getCenter ( ) ) ; } rotate ( rotation ) ; } | Rotate the box around a given pivot point . The default pivot point of the center of the box . |
6,211 | protected void definePath ( ZoomableGraphicsContext gc , T element ) { gc . beginPath ( ) ; final PathIterator2afp < PathElement2d > pathIterator = element . toPath2D ( ) . getPathIterator ( ) ; switch ( pathIterator . getWindingRule ( ) ) { case EVEN_ODD : gc . setFillRule ( FillRule . EVEN_ODD ) ; break ; case NON_ZERO : gc . setFillRule ( FillRule . NON_ZERO ) ; break ; default : throw new IllegalStateException ( ) ; } while ( pathIterator . hasNext ( ) ) { final PathElement2d pelement = pathIterator . next ( ) ; switch ( pelement . getType ( ) ) { case LINE_TO : gc . lineTo ( pelement . getToX ( ) , pelement . getToY ( ) ) ; break ; case MOVE_TO : gc . moveTo ( pelement . getToX ( ) , pelement . getToY ( ) ) ; break ; case CLOSE : gc . closePath ( ) ; break ; case CURVE_TO : gc . bezierCurveTo ( pelement . getCtrlX1 ( ) , pelement . getCtrlY1 ( ) , pelement . getCtrlX2 ( ) , pelement . getCtrlY2 ( ) , pelement . getToX ( ) , pelement . getToY ( ) ) ; break ; case QUAD_TO : gc . quadraticCurveTo ( pelement . getCtrlX1 ( ) , pelement . getCtrlY1 ( ) , pelement . getToX ( ) , pelement . getToY ( ) ) ; break ; case ARC_TO : gc . lineTo ( pelement . getToX ( ) , pelement . getToY ( ) ) ; break ; default : break ; } } } | Draw the polyline path . |
6,212 | public static String getFirstFreeBusStopName ( BusNetwork busNetwork ) { if ( busNetwork == null ) { return null ; } int nb = busNetwork . getBusStopCount ( ) ; String name ; do { ++ nb ; name = Locale . getString ( "NAME_TEMPLATE" , Integer . toString ( nb ) ) ; } while ( busNetwork . getBusStop ( name ) != null ) ; return name ; } | Replies a bus stop name that was not exist in the specified bus network . |
6,213 | private void notifyDependencies ( ) { if ( getContainer ( ) != null ) { for ( final BusHub hub : busHubs ( ) ) { hub . checkPrimitiveValidity ( ) ; } for ( final BusItineraryHalt halt : getBindedBusHalts ( ) ) { halt . checkPrimitiveValidity ( ) ; } } } | Notifies any dependent object about a validation change from this bus stop . |
6,214 | public void setPosition ( GeoLocationPoint position ) { if ( ( this . position == null && position != null ) || ( this . position != null && ! this . position . equals ( position ) ) ) { this . position = position ; fireShapeChanged ( ) ; checkPrimitiveValidity ( ) ; } } | Set the position of the element . |
6,215 | public double distance ( double x , double y ) { if ( isValidPrimitive ( ) ) { final GeoLocationPoint p = getGeoPosition ( ) ; return Point2D . getDistancePointPoint ( p . getX ( ) , p . getY ( ) , x , y ) ; } return Double . NaN ; } | Replies the distance between the given point and this bus stop . |
6,216 | public double distance ( BusStop stop ) { if ( isValidPrimitive ( ) && stop . isValidPrimitive ( ) ) { final GeoLocationPoint p = getGeoPosition ( ) ; final GeoLocationPoint p2 = stop . getGeoPosition ( ) ; return Point2D . getDistancePointPoint ( p . getX ( ) , p . getY ( ) , p2 . getX ( ) , p2 . getY ( ) ) ; } return Double . NaN ; } | Replies the distance between the given bus stop and this bus stop . |
6,217 | void addBusHub ( BusHub hub ) { if ( this . hubs == null ) { this . hubs = new WeakArrayList < > ( ) ; } this . hubs . add ( hub ) ; } | Add a hub reference . |
6,218 | void removeBusHub ( BusHub hub ) { if ( this . hubs != null ) { this . hubs . remove ( hub ) ; if ( this . hubs . isEmpty ( ) ) { this . hubs = null ; } } } | Remove a hub reference . |
6,219 | void addBusHalt ( BusItineraryHalt halt ) { if ( this . halts == null ) { this . halts = new WeakArrayList < > ( ) ; } this . halts . add ( halt ) ; } | Add a bus halt reference . |
6,220 | void removeBusHalt ( BusItineraryHalt halt ) { if ( this . halts != null ) { this . halts . remove ( halt ) ; if ( this . halts . isEmpty ( ) ) { this . halts = null ; } } } | Remove a bus halt reference . |
6,221 | public Iterable < BusItineraryHalt > getBindedBusHalts ( ) { if ( this . halts == null ) { return Collections . emptyList ( ) ; } return Collections . unmodifiableCollection ( this . halts ) ; } | Replies the bus itinerary halts associated to this bus stop . |
6,222 | public static Vector2ifx convert ( Tuple2D < ? > tuple ) { if ( tuple instanceof Vector2ifx ) { return ( Vector2ifx ) tuple ; } return new Vector2ifx ( tuple . getX ( ) , tuple . getY ( ) ) ; } | Convert the given tuple to a real Vector2ifx . |
6,223 | public static int compareAttrs ( Attribute arg0 , Attribute arg1 ) { if ( arg0 == arg1 ) { return 0 ; } if ( arg0 == null ) { return 1 ; } if ( arg1 == null ) { return - 1 ; } final String n0 = arg0 . getName ( ) ; final String n1 = arg1 . getName ( ) ; final int cmp = compareAttrNames ( n0 , n1 ) ; if ( cmp == 0 ) { return compareValues ( arg0 , arg1 ) ; } return cmp ; } | Compare the two specified attributes . |
6,224 | public static int compareAttrNames ( String arg0 , String arg1 ) { if ( arg0 == arg1 ) { return 0 ; } if ( arg0 == null ) { return Integer . MAX_VALUE ; } if ( arg1 == null ) { return Integer . MIN_VALUE ; } return arg0 . compareToIgnoreCase ( arg1 ) ; } | Compare the two specified attribute names . |
6,225 | public boolean isTemporaryChange ( ) { final Object src = getSource ( ) ; if ( src instanceof MapLayer ) { return ( ( MapLayer ) src ) . isTemporaryLayer ( ) ; } return false ; } | Replies if the change in the layer was marked as temporary . The usage of this information depends on the listener s behaviour . |
6,226 | protected final Graph < ST , PT > getParentGraph ( ) { return this . parentGraph == null ? null : this . parentGraph . get ( ) ; } | Replies the parent graph is this subgraph was built . |
6,227 | public final void build ( GraphIterator < ST , PT > iterator , SubGraphBuildListener < ST , PT > listener ) { assert iterator != null ; final Set < ComparableWeakReference < PT > > reachedPoints = new TreeSet < > ( ) ; GraphIterationElement < ST , PT > element ; ST segment ; PT point ; PT firstPoint = null ; this . parentGraph = new WeakReference < > ( iterator . getGraph ( ) ) ; this . segments . clear ( ) ; this . pointNumber = 0 ; this . terminalPoints . clear ( ) ; while ( iterator . hasNext ( ) ) { element = iterator . nextElement ( ) ; point = element . getPoint ( ) ; segment = element . getSegment ( ) ; if ( this . segments . isEmpty ( ) ) { firstPoint = point ; } this . segments . add ( segment ) ; if ( listener != null ) { listener . segmentAdded ( this , element ) ; } point = segment . getOtherSidePoint ( point ) ; final ComparableWeakReference < PT > ref = new ComparableWeakReference < > ( point ) ; if ( element . isTerminalSegment ( ) ) { if ( ! reachedPoints . contains ( ref ) ) { this . terminalPoints . add ( ref ) ; if ( listener != null ) { listener . terminalPointReached ( this , point , segment ) ; } } } else { this . terminalPoints . remove ( ref ) ; reachedPoints . add ( ref ) ; if ( listener != null ) { listener . nonTerminalPointReached ( this , point , segment ) ; } } } if ( firstPoint != null ) { final ComparableWeakReference < PT > ref = new ComparableWeakReference < > ( firstPoint ) ; if ( ! reachedPoints . contains ( ref ) ) { this . terminalPoints . add ( ref ) ; } } this . pointNumber = this . terminalPoints . size ( ) + reachedPoints . size ( ) ; reachedPoints . clear ( ) ; } | Build a subgraph from the specified graph . |
6,228 | public List < Object > getAddedValues ( ) { if ( this . newValues == null ) { return Collections . emptyList ( ) ; } return Collections . unmodifiableList ( this . newValues ) ; } | Replies the list of added data . |
6,229 | public List < Object > getRemovedValues ( ) { if ( this . oldValues == null ) { return Collections . emptyList ( ) ; } return Collections . unmodifiableList ( this . oldValues ) ; } | Replies the list of removed data . |
6,230 | public List < Object > getCurrentValues ( ) { if ( this . allValues == null ) { return Collections . emptyList ( ) ; } return Collections . unmodifiableList ( this . allValues ) ; } | Replies the list of current data . |
6,231 | public static < A , B > ImmutableMultiset < B > transformedCopy ( Multiset < A > ms , Function < A , B > func ) { final ImmutableMultiset . Builder < B > ret = ImmutableMultiset . builder ( ) ; for ( final Multiset . Entry < A > entry : ms . entrySet ( ) ) { final B transformedElement = func . apply ( entry . getElement ( ) ) ; ret . addCopies ( transformedElement , entry . getCount ( ) ) ; } return ret . build ( ) ; } | Returns a new Multiset resulting from transforming each element of the input Multiset by a function . If two or more elements are mapped to the same value by the function their counts will be summed in the new Multiset . |
6,232 | public static < A , B > Multiset < B > mutableTransformedCopy ( Multiset < A > ms , Function < A , B > func ) { final Multiset < B > ret = HashMultiset . create ( ) ; for ( final Multiset . Entry < A > entry : ms . entrySet ( ) ) { final B transformedElement = func . apply ( entry . getElement ( ) ) ; ret . add ( transformedElement , entry . getCount ( ) ) ; } return ret ; } | Same as transformedCopy except the returned Multiset is mutable . |
6,233 | public static boolean allSameSize ( List < Collection < ? > > collections ) { if ( collections . isEmpty ( ) ) { return true ; } final int referenceSize = collections . get ( 0 ) . size ( ) ; for ( final Collection < ? > col : collections ) { if ( col . size ( ) != referenceSize ) { return false ; } } return true ; } | Returns true if and only if all the collections in the provided list have the same size . Returns true if the provided list is empty . |
6,234 | public static < T > List < T > coerceNullToEmpty ( List < T > list ) { return MoreObjects . firstNonNull ( list , ImmutableList . < T > of ( ) ) ; } | Turns null into an empty list and leaves other inputs untouched . |
6,235 | protected void update ( DocumentEvent event ) { String text ; try { text = event . getDocument ( ) . getText ( event . getDocument ( ) . getStartPosition ( ) . getOffset ( ) , event . getDocument ( ) . getEndPosition ( ) . getOffset ( ) - 1 ) ; model . setObject ( text ) ; } catch ( BadLocationException e1 ) { log . log ( Level . SEVERE , "some portion of the given range was not a valid part of the document. " + "The location in the exception is the first bad position encountered." , e1 ) ; } } | Update the underlying model object . |
6,236 | public static String makeAndroidApplicationName ( String applicationName ) { final String fullName ; if ( applicationName . indexOf ( '.' ) >= 0 ) { fullName = applicationName ; } else { fullName = "org.arakhne.partnership." + applicationName ; } return fullName ; } | Make a valid android application name from the given application name . A valid android application name is a package name followed by the name of the application . |
6,237 | public static ClassLoader getContextClassLoader ( ) throws AndroidException { synchronized ( Android . class ) { final ClassLoader cl = ( contextClassLoader == null ) ? null : contextClassLoader . get ( ) ; if ( cl != null ) { return cl ; } } final Object context = getContext ( ) ; try { final Method method = context . getClass ( ) . getMethod ( "getClassLoader" ) ; final Object classLoader = method . invoke ( context ) ; final ClassLoader cl = ( ClassLoader ) classLoader ; synchronized ( Android . class ) { contextClassLoader = new WeakReference < > ( cl ) ; } return cl ; } catch ( Exception e ) { throw new AndroidException ( e ) ; } } | Replies the class loader of the current Android context . |
6,238 | public static void showExceptionDialog ( Exception exception , Component parentComponent , String ... additionalMessages ) { String title = exception . getLocalizedMessage ( ) ; StringBuilder sb = new StringBuilder ( ) ; sb . append ( "<html><body width='650'>" ) ; sb . append ( "<h2>" ) ; sb . append ( exception . getLocalizedMessage ( ) ) ; sb . append ( "</h2>" ) ; sb . append ( "<p>" ) ; sb . append ( exception . getMessage ( ) ) ; Stream . of ( additionalMessages ) . forEach ( am -> sb . append ( "<p>" + am ) ) ; String htmlMessage = sb . toString ( ) ; JOptionPane . showMessageDialog ( parentComponent , htmlMessage , title , JOptionPane . ERROR_MESSAGE ) ; } | Show exception dialog . |
6,239 | @ SuppressWarnings ( "unchecked" ) public static < ObsT , SummaryT > Builder < ObsT , SummaryT > forSummarizer ( final ObservationSummarizer < ? super ObsT , ? extends SummaryT > observationSummarizer , int numSamples , final Random rng ) { return new Builder < ObsT , SummaryT > ( ( ObservationSummarizer < ObsT , SummaryT > ) observationSummarizer , numSamples , rng ) ; } | cast is safe - see covariance and contravariance notes on ObservationSummarizer |
6,240 | @ SuppressWarnings ( "static-method" ) public PrintConfigCommand providePrintConfigCommand ( Provider < BootLogger > bootLogger , Provider < ModulesMetadata > modulesMetadata , Injector injector ) { return new PrintConfigCommand ( bootLogger , modulesMetadata , injector ) ; } | Provide the command for running the command for printing out the configuration values . |
6,241 | protected final void fireShapeChanged ( ) { resetBoundingBox ( ) ; if ( isEventFirable ( ) ) { final GISElementContainer < ? > container = getContainer ( ) ; if ( container != null ) { container . onMapElementGraphicalAttributeChanged ( ) ; } } } | Invoked when the shape of this element changed . |
6,242 | protected final boolean boundsIntersects ( Shape2D < ? , ? , ? , ? , ? , ? extends Rectangle2afp < ? , ? , ? , ? , ? , ? > > rectangle ) { final Rectangle2d bounds = getBoundingBox ( ) ; assert bounds != null ; return bounds . intersects ( rectangle ) ; } | Replies if the bounds of this element has an intersection with the specified rectangle . |
6,243 | public boolean isContainerColorUsed ( ) { final AttributeValue val = getAttributeCollection ( ) . getAttribute ( ATTR_USE_CONTAINER_COLOR ) ; if ( val != null ) { try { return val . getBoolean ( ) ; } catch ( AttributeException e ) { } } return false ; } | Replies the flag that indicates if this element use its color or the container s color . |
6,244 | public VisualizationType getVisualizationType ( ) { if ( this . vizualizationType == null ) { final AttributeValue val = getAttributeCollection ( ) . getAttribute ( ATTR_VISUALIZATION_TYPE ) ; if ( val != null ) { try { this . vizualizationType = val . getJavaObject ( ) ; } catch ( Exception e ) { } } if ( this . vizualizationType == null ) { this . vizualizationType = VisualizationType . SHAPE_ONLY ; } } return this . vizualizationType ; } | Replies the type of visualization that must be used by this element . |
6,245 | public void setVisualizationType ( VisualizationType type ) { try { if ( getVisualizationType ( ) != type ) { this . vizualizationType = type ; getAttributeCollection ( ) . setAttribute ( ATTR_VISUALIZATION_TYPE , new AttributeValueImpl ( type ) ) ; } } catch ( AttributeException e ) { } } | Set the type of visualization that must be used by this element . |
6,246 | @ SuppressWarnings ( "static-method" ) public Vector1dfx newVector ( ObjectProperty < WeakReference < Segment1D < ? , ? > > > segment , DoubleProperty x , DoubleProperty y ) { return new Vector1dfx ( segment , x , y ) ; } | Create a vector with properties . |
6,247 | public static final boolean isBlank ( String s ) { if ( s == null || s . trim ( ) . length ( ) == 0 ) { return true ; } return false ; } | Whether string is a space or null |
6,248 | public T set ( T newValue ) { final T obj = this . object ; this . object = newValue ; return obj ; } | Set the parameter . |
6,249 | public static String getPreferredAttributeNameForRoadWidth ( ) { final Preferences prefs = Preferences . userNodeForPackage ( RoadNetworkConstants . class ) ; if ( prefs != null ) { return prefs . get ( "ROAD_WIDTH_ATTR_NAME" , DEFAULT_ATTR_ROAD_WIDTH ) ; } return DEFAULT_ATTR_ROAD_WIDTH ; } | Replies the preferred name for the width of the roads . |
6,250 | public static void setPreferredAttributeNameForRoadWidth ( String name ) { final Preferences prefs = Preferences . userNodeForPackage ( RoadNetworkConstants . class ) ; if ( prefs != null ) { if ( name == null || "" . equals ( name ) || DEFAULT_ATTR_ROAD_WIDTH . equalsIgnoreCase ( name ) ) { prefs . remove ( "ROAD_WIDTH_ATTR_NAME" ) ; } else { prefs . put ( "ROAD_WIDTH_ATTR_NAME" , name ) ; } } } | Set the preferred name for the width of the roads . |
6,251 | public static String getPreferredAttributeNameForLaneCount ( ) { final Preferences prefs = Preferences . userNodeForPackage ( RoadNetworkConstants . class ) ; if ( prefs != null ) { return prefs . get ( "LANE_COUNT_ATTR_NAME" , DEFAULT_ATTR_LANE_COUNT ) ; } return DEFAULT_ATTR_LANE_COUNT ; } | Replies the preferred name for the number of lanes of the roads . |
6,252 | public static void setPreferredAttributeNameForLaneCount ( String name ) { final Preferences prefs = Preferences . userNodeForPackage ( RoadNetworkConstants . class ) ; if ( prefs != null ) { if ( name == null || "" . equals ( name ) || DEFAULT_ATTR_LANE_COUNT . equalsIgnoreCase ( name ) ) { prefs . remove ( "LANE_COUNT_ATTR_NAME" ) ; } else { prefs . put ( "LANE_COUNT_ATTR_NAME" , name ) ; } } } | Set the preferred name for the number of lanes of the roads . |
6,253 | public static int getPreferredLaneCount ( ) { final Preferences prefs = Preferences . userNodeForPackage ( RoadNetworkConstants . class ) ; if ( prefs != null ) { return prefs . getInt ( "LANE_COUNT" , DEFAULT_LANE_COUNT ) ; } return DEFAULT_LANE_COUNT ; } | Replies the preferred number of lanes for a road segment . |
6,254 | public static void setPreferredLaneCount ( int count ) { final Preferences prefs = Preferences . userNodeForPackage ( RoadNetworkConstants . class ) ; if ( prefs != null ) { if ( count < 0 ) { prefs . remove ( "LANE_COUNT" ) ; } else { prefs . putInt ( "LANE_COUNT" , count ) ; } } } | Set the preferred number of lanes for a road segment . |
6,255 | public static double getPreferredLaneWidth ( ) { final Preferences prefs = Preferences . userNodeForPackage ( RoadNetworkConstants . class ) ; if ( prefs != null ) { return prefs . getDouble ( "LANE_WIDTH" , DEFAULT_LANE_WIDTH ) ; } return DEFAULT_LANE_WIDTH ; } | Replies the preferred width of a lane for a road segment . |
6,256 | public static void setPreferredLaneWidth ( double width ) { final Preferences prefs = Preferences . userNodeForPackage ( RoadNetworkConstants . class ) ; if ( prefs != null ) { if ( width <= 0 ) { prefs . remove ( "LANE_WIDTH" ) ; } else { prefs . putDouble ( "LANE_WIDTH" , width ) ; } } } | Set the preferred width of a lane for a road segment . |
6,257 | public static LegalTrafficSide getPreferredLegalTrafficSide ( ) { final Preferences prefs = Preferences . userNodeForPackage ( RoadNetworkConstants . class ) ; String name = null ; if ( prefs != null ) { name = prefs . get ( "LEGAL_TRAFFIC_SIDE" , null ) ; } if ( name != null ) { LegalTrafficSide side ; try { side = LegalTrafficSide . valueOf ( name ) ; } catch ( Throwable exception ) { side = null ; } if ( side != null ) { return side ; } } return LegalTrafficSide . getCurrent ( ) ; } | Replies the preferred side of traffic for vehicles on road segments . |
6,258 | public static void setPreferredLegalTrafficSide ( LegalTrafficSide side ) { final Preferences prefs = Preferences . userNodeForPackage ( RoadNetworkConstants . class ) ; if ( prefs != null ) { if ( side == null ) { prefs . remove ( "LEGAL_TRAFFIC_SIDE" ) ; } else { prefs . put ( "LEGAL_TRAFFIC_SIDE" , side . name ( ) ) ; } } } | Set the preferred side of traffic for vehicles on road segments . |
6,259 | public static String getPreferredAttributeNameForTrafficDirection ( ) { final Preferences prefs = Preferences . userNodeForPackage ( RoadNetworkConstants . class ) ; if ( prefs != null ) { return prefs . get ( "TRAFFIC_DIRECTION_ATTR_NAME" , DEFAULT_ATTR_TRAFFIC_DIRECTION ) ; } return DEFAULT_ATTR_TRAFFIC_DIRECTION ; } | Replies the preferred name for the traffic direction on the roads . |
6,260 | public static void setPreferredAttributeNameForTrafficDirection ( String name ) { final Preferences prefs = Preferences . userNodeForPackage ( RoadNetworkConstants . class ) ; if ( prefs != null ) { if ( name == null || "" . equals ( name ) || DEFAULT_ATTR_TRAFFIC_DIRECTION . equalsIgnoreCase ( name ) ) { prefs . remove ( "TRAFFIC_DIRECTION_ATTR_NAME" ) ; } else { prefs . put ( "TRAFFIC_DIRECTION_ATTR_NAME" , name ) ; } } } | Set the preferred name for the traffic direction on the roads . |
6,261 | public static String getPreferredAttributeValueForTrafficDirection ( TrafficDirection direction , int index ) { final Preferences prefs = Preferences . userNodeForPackage ( RoadNetworkConstants . class ) ; if ( prefs != null ) { final StringBuilder b = new StringBuilder ( ) ; b . append ( "TRAFFIC_DIRECTION_VALUE_" ) ; b . append ( direction . name ( ) ) ; b . append ( "_" ) ; b . append ( index ) ; final String v = prefs . get ( b . toString ( ) , null ) ; if ( v != null && ! "" . equals ( v ) ) { return v ; } } try { return getSystemDefault ( direction , index ) ; } catch ( AssertionError e ) { throw e ; } catch ( Throwable exception ) { return null ; } } | Replies the preferred value of traffic direction used in the attributes for the traffic direction on the roads . |
6,262 | public static List < String > getPreferredAttributeValuesForTrafficDirection ( TrafficDirection direction ) { final List < String > array = new ArrayList < > ( ) ; int i = 0 ; String value = getPreferredAttributeValueForTrafficDirection ( direction , i ) ; while ( value != null ) { array . add ( value ) ; value = getPreferredAttributeValueForTrafficDirection ( direction , ++ i ) ; } return array ; } | Replies the preferred values of traffic direction used in the attributes for the traffic direction on the roads . |
6,263 | public static String getSystemDefault ( TrafficDirection direction , int valueIndex ) { switch ( direction ) { case DOUBLE_WAY : switch ( valueIndex ) { case 0 : return DEFAULT_DOUBLE_WAY_TRAFFIC_DIRECTION_0 ; case 1 : return DEFAULT_DOUBLE_WAY_TRAFFIC_DIRECTION_1 ; default : throw new IndexOutOfBoundsException ( ) ; } case NO_ENTRY : switch ( valueIndex ) { case 0 : return DEFAULT_NO_ENTRY_TRAFFIC_DIRECTION_0 ; case 1 : return DEFAULT_NO_ENTRY_TRAFFIC_DIRECTION_1 ; default : throw new IndexOutOfBoundsException ( ) ; } case NO_WAY : switch ( valueIndex ) { case 0 : return DEFAULT_NO_WAY_TRAFFIC_DIRECTION_0 ; case 1 : return DEFAULT_NO_WAY_TRAFFIC_DIRECTION_1 ; default : throw new IndexOutOfBoundsException ( ) ; } case ONE_WAY : switch ( valueIndex ) { case 0 : return DEFAULT_ONE_WAY_TRAFFIC_DIRECTION_0 ; case 1 : return DEFAULT_ONE_WAY_TRAFFIC_DIRECTION_1 ; default : throw new IndexOutOfBoundsException ( ) ; } default : } throw new IllegalArgumentException ( ) ; } | Replies the system default string - value for the traffic direction at the given index in the list of system default values . |
6,264 | public static String getSystemDefault ( RoadType type ) { switch ( type ) { case OTHER : return DEFAULT_OTHER_ROAD_TYPE ; case PRIVACY_PATH : return DEFAULT_PRIVACY_ROAD_TYPE ; case TRACK : return DEFAULT_TRACK_ROAD_TYPE ; case BIKEWAY : return DEFAULT_BIKEWAY_ROAD_TYPE ; case LOCAL_ROAD : return DEFAULT_LOCAL_ROAD_ROAD_TYPE ; case INTERCHANGE_RAMP : return DEFAULT_INTERCHANGE_RAMP_ROAD_TYPE ; case MAJOR_URBAN_AXIS : return DEFAULT_MAJOR_URBAN_ROAD_TYPE ; case SECONDARY_ROAD : return DEFAULT_SECONDARY_ROAD_TYPE ; case MAJOR_ROAD : return DEFAULT_MAJOR_ROAD_TYPE ; case FREEWAY : return DEFAULT_FREEWAY_ROAD_TYPE ; default : } throw new IllegalArgumentException ( ) ; } | Replies the system - default value for the type of road . |
6,265 | public static List < String > getSystemDefaults ( TrafficDirection direction ) { final List < String > array = new ArrayList < > ( ) ; try { int i = 0 ; while ( true ) { array . add ( getSystemDefault ( direction , i ) ) ; ++ i ; } } catch ( AssertionError e ) { throw e ; } catch ( Throwable exception ) { } return array ; } | Replies the system default string - values for the traffic direction . |
6,266 | public static void setPreferredAttributeValueForTrafficDirection ( TrafficDirection direction , int index , String value ) { final Preferences prefs = Preferences . userNodeForPackage ( RoadNetworkConstants . class ) ; if ( prefs != null ) { final StringBuilder keyName = new StringBuilder ( ) ; keyName . append ( "TRAFFIC_DIRECTION_VALUE_" ) ; keyName . append ( direction . name ( ) ) ; keyName . append ( "_" ) ; keyName . append ( index ) ; String sysDef ; try { sysDef = getSystemDefault ( direction , index ) ; } catch ( IndexOutOfBoundsException exception ) { sysDef = null ; } if ( value == null || "" . equals ( value ) || ( sysDef != null && sysDef . equalsIgnoreCase ( value ) ) ) { prefs . remove ( keyName . toString ( ) ) ; return ; } prefs . put ( keyName . toString ( ) , value ) ; } } | Set the preferred value of traffic direction used in the attributes for the traffic direction on the roads . |
6,267 | public static double getPreferredRoadConnectionDistance ( ) { final Preferences prefs = Preferences . userNodeForPackage ( RoadNetworkConstants . class ) ; if ( prefs != null ) { return prefs . getDouble ( "ROAD_CONNECTION_DISTANCE" , DEFAULT_ROAD_CONNECTION_DISTANCE ) ; } return DEFAULT_ROAD_CONNECTION_DISTANCE ; } | Replies the preferred distance below which roads may be connected . |
6,268 | public static void setPreferredRoadConnectionDistance ( double distance ) { final Preferences prefs = Preferences . userNodeForPackage ( RoadNetworkConstants . class ) ; if ( prefs != null ) { if ( distance <= 0. ) { prefs . remove ( "ROAD_CONNECTION_DISTANCE" ) ; } else { prefs . putDouble ( "ROAD_CONNECTION_DISTANCE" , distance ) ; } } } | Set the preferred distance below which roads may be connected . |
6,269 | public static RoadType getPreferredRoadType ( ) { final Preferences prefs = Preferences . userNodeForPackage ( RoadNetworkConstants . class ) ; String name = null ; if ( prefs != null ) { name = prefs . get ( "ROAD_TYPE" , null ) ; } if ( name != null ) { RoadType type ; try { type = RoadType . valueOf ( name ) ; } catch ( Throwable exception ) { type = null ; } if ( type != null ) { return type ; } } return RoadType . OTHER ; } | Replies the preferred type of road segment . |
6,270 | public static void setPreferredRoadType ( RoadType type ) { final Preferences prefs = Preferences . userNodeForPackage ( RoadNetworkConstants . class ) ; if ( prefs != null ) { if ( type == null ) { prefs . remove ( "ROAD_TYPE" ) ; } else { prefs . put ( "ROAD_TYPE" , type . name ( ) ) ; } } } | Set the preferred type of road segment . |
6,271 | public static String getPreferredAttributeNameForRoadType ( ) { final Preferences prefs = Preferences . userNodeForPackage ( RoadNetworkConstants . class ) ; if ( prefs != null ) { return prefs . get ( "ROAD_TYPE_ATTR_NAME" , DEFAULT_ATTR_ROAD_TYPE ) ; } return DEFAULT_ATTR_ROAD_TYPE ; } | Replies the preferred name for the types of the roads . |
6,272 | public static void setPreferredAttributeNameForRoadType ( String name ) { final Preferences prefs = Preferences . userNodeForPackage ( RoadNetworkConstants . class ) ; if ( prefs != null ) { if ( name == null || "" . equals ( name ) || DEFAULT_ATTR_ROAD_TYPE . equalsIgnoreCase ( name ) ) { prefs . remove ( "ROAD_TYPE_ATTR_NAME" ) ; } else { prefs . put ( "ROAD_TYPE_ATTR_NAME" , name ) ; } } } | Set the preferred name for the types of the roads . |
6,273 | public static String getPreferredAttributeValueForRoadType ( RoadType type ) { final Preferences prefs = Preferences . userNodeForPackage ( RoadNetworkConstants . class ) ; if ( prefs != null ) { final String v = prefs . get ( "ROAD_TYPE_VALUE_" + type . name ( ) , null ) ; if ( v != null && ! "" . equals ( v ) ) { return v ; } } return getSystemDefault ( type ) ; } | Replies the preferred value of road type used in the attributes for the types of the roads . |
6,274 | public static void setPreferredAttributeValueForRoadType ( RoadType type , String value ) { final Preferences prefs = Preferences . userNodeForPackage ( RoadNetworkConstants . class ) ; if ( prefs != null ) { final String sysDef = getSystemDefault ( type ) ; if ( value == null || "" . equals ( value ) || sysDef . equalsIgnoreCase ( value ) ) { prefs . remove ( "ROAD_TYPE_VALUE_" + type . name ( ) ) ; } else { prefs . put ( "ROAD_TYPE_VALUE_" + type . name ( ) , value ) ; } } } | Set the preferred value of road type used in the attributes for the types of the roads . |
6,275 | public static String getPreferredAttributeNameForRoadName ( ) { final Preferences prefs = Preferences . userNodeForPackage ( RoadNetworkConstants . class ) ; if ( prefs != null ) { return prefs . get ( "ROAD_NAME_ATTR_NAME" , DEFAULT_ATTR_ROAD_NAME ) ; } return DEFAULT_ATTR_ROAD_NAME ; } | Replies the preferred name for the name of the roads . |
6,276 | public static void setPreferredAttributeNameForRoadName ( String name ) { final Preferences prefs = Preferences . userNodeForPackage ( RoadNetworkConstants . class ) ; if ( prefs != null ) { if ( name == null || "" . equals ( name ) || DEFAULT_ATTR_ROAD_NAME . equalsIgnoreCase ( name ) ) { prefs . remove ( "ROAD_NAME_ATTR_NAME" ) ; } else { prefs . put ( "ROAD_NAME_ATTR_NAME" , name ) ; } } } | Set the preferred name for the name of the roads . |
6,277 | public static String getPreferredAttributeNameForRoadNumber ( ) { final Preferences prefs = Preferences . userNodeForPackage ( RoadNetworkConstants . class ) ; if ( prefs != null ) { return prefs . get ( "ROAD_NUMBER_ATTR_NAME" , DEFAULT_ATTR_ROAD_NUMBER ) ; } return DEFAULT_ATTR_ROAD_NUMBER ; } | Replies the preferred name for the numbers of the roads . |
6,278 | public static void setPreferredAttributeNameForRoadNumber ( String name ) { final Preferences prefs = Preferences . userNodeForPackage ( RoadNetworkConstants . class ) ; if ( prefs != null ) { if ( name == null || "" . equals ( name ) || DEFAULT_ATTR_ROAD_NUMBER . equalsIgnoreCase ( name ) ) { prefs . remove ( "ROAD_NUMBER_ATTR_NAME" ) ; } else { prefs . put ( "ROAD_NUMBER_ATTR_NAME" , name ) ; } } } | Set the preferred name for the numbers of the roads . |
6,279 | @ SuppressWarnings ( "checkstyle:magicnumber" ) public void readDBFHeader ( ) throws IOException { if ( this . finished ) { throw new EOFDBaseFileException ( ) ; } if ( this . fieldCount != - 1 ) { return ; } this . fileVersion = this . stream . readByte ( ) ; final Calendar cal = new GregorianCalendar ( ) ; cal . set ( Calendar . YEAR , this . stream . readByte ( ) + 1900 ) ; cal . set ( Calendar . MONTH , this . stream . readByte ( ) - 1 ) ; cal . set ( Calendar . DAY_OF_MONTH , this . stream . readByte ( ) ) ; this . lastUpdateDate = cal . getTime ( ) ; this . recordCount = this . stream . readLEInt ( ) ; this . fieldCount = ( this . stream . readLEShort ( ) - 1 ) / 32 - 1 ; this . recordSize = this . stream . readLEShort ( ) ; this . stream . skipBytes ( 17 ) ; final byte b = this . stream . readByte ( ) ; this . codePage = DBaseCodePage . fromLanguageCode ( b ) ; this . stream . skipBytes ( 2 ) ; this . firstRecordOffset = 32 ; } | Read the header of the DBF file . |
6,280 | public String getDBFFieldName ( int index ) { if ( this . fieldCount != - 1 ) { try { final DBaseFileField field = this . fields . get ( index ) ; if ( field != null ) { return field . getName ( ) ; } } catch ( Exception exception ) { } } return null ; } | Replies the name of the i - th field . |
6,281 | public int getDBFFieldIndex ( String name ) { assert name != null ; if ( this . fieldCount != - 1 ) { try { int i = 0 ; for ( final DBaseFileField field : this . fields ) { if ( field != null && name . equals ( field . getName ( ) ) ) { return i ; } ++ i ; } } catch ( Exception exception ) { } } return - 1 ; } | Replies the column index of the specified column name . |
6,282 | public DBaseFieldType getDBFFieldType ( int index ) { if ( this . fieldCount != - 1 ) { try { final DBaseFileField field = this . fields . get ( index ) ; if ( field != null ) { return field . getType ( ) ; } } catch ( Exception exception ) { } } return null ; } | Replies the type of the i - th field . |
6,283 | @ SuppressWarnings ( { "checkstyle:npathcomplexity" , "checkstyle:magicnumber" } ) public List < DBaseFileField > readDBFFields ( ) throws IOException , EOFException { if ( this . fields != null ) { return this . fields ; } if ( this . finished ) { throw new EOFDBaseFileException ( ) ; } if ( this . fieldCount == - 1 ) { throw new MustCallReadHeaderFunctionException ( ) ; } int byteSize = 1 ; final ArrayList < DBaseFileField > array = new ArrayList < > ( ) ; final Charset charSet = ( this . codePage == null ) ? null : this . codePage . getChatset ( ) ; String columnName ; for ( int idxFields = 0 ; idxFields < this . fieldCount ; ++ idxFields ) { final byte [ ] header = new byte [ 32 ] ; this . stream . readFully ( header ) ; this . firstRecordOffset += header . length ; int nbChars = 0 ; for ( int i = 0 ; i <= 10 ; ++ i ) { if ( header [ i ] == 0 ) { break ; } ++ nbChars ; } final byte [ ] bName = new byte [ nbChars ] ; System . arraycopy ( header , 0 , bName , 0 , nbChars ) ; if ( charSet != null ) { columnName = new String ( bName , charSet ) ; } else { columnName = new String ( bName ) ; } final DBaseFieldType dbftype = DBaseFieldType . fromByte ( header [ 11 ] ) ; final DBaseFileField field = new DBaseFileField ( columnName , dbftype , header [ 16 ] & 0xFF , header [ 17 ] & 0xFF , idxFields ) ; array . add ( field ) ; byteSize += field . getLength ( ) ; } if ( byteSize != this . recordSize ) { throw new InvalidRecordSizeException ( this . recordSize , byteSize ) ; } final byte bt = this . stream . readByte ( ) ; if ( bt != 0x0D ) { throw new InvalidDBaseFieldTerminationException ( bt ) ; } ++ this . firstRecordOffset ; this . fields = array ; if ( this . stream . markSupported ( ) ) { this . stream . mark ( this . recordSize * this . recordCount + this . firstRecordOffset + 1 ) ; } return array ; } | Read the field definitions . Multiple calls to this method will return always the same data structure . The column list is red only at the first call to this function . So you could use this method to obtain the list of the dBASE file s columns . |
6,284 | public void skip ( int skipAmount ) throws IOException { if ( this . recordCount == - 1 ) { throw new MustCallReadHeaderFunctionException ( ) ; } if ( ( this . readingPosition + skipAmount ) >= this . recordCount ) { throw new EOFException ( ) ; } if ( skipAmount > 0 ) { this . readingPosition += skipAmount ; final long skippedAmount = this . stream . skipBytes ( this . recordSize * skipAmount ) ; assert skippedAmount == this . recordSize * skipAmount ; } } | Move the reading head by the specified record count amount . |
6,285 | public List < DBaseFileRecord > readRestOfDBFRecords ( ) throws IOException { if ( this . finished ) { throw new EOFDBaseFileException ( ) ; } if ( this . recordCount == - 1 ) { throw new MustCallReadHeaderFunctionException ( ) ; } final Vector < DBaseFileRecord > records = new Vector < > ( ) ; try { while ( this . readingPosition < this . recordCount ) { final DBaseFileRecord record = readNextDBFRecord ( ) ; if ( record != null ) { records . add ( record ) ; } } } catch ( EOFException e ) { } this . finished = true ; this . stream . close ( ) ; return records ; } | Read all the records . |
6,286 | private int readStringRecordValue ( DBaseFileField field , int nrecord , int nfield , byte [ ] rawData , int rawOffset , OutputParameter < String > value ) throws IOException { final byte [ ] recordData = new byte [ field . getLength ( ) ] ; System . arraycopy ( rawData , rawOffset , recordData , 0 , recordData . length ) ; String data ; if ( hasOption ( OPTION_DECODE_STRING ) ) { data = Locale . decodeString ( recordData ) . trim ( ) ; } else { data = new String ( recordData ) . trim ( ) ; } if ( data == null || data . length ( ) == 0 || DBaseFileField . isUnsetValue ( data ) ) { data = null ; } value . set ( data ) ; return recordData . length ; } | Read a STRING record value . |
6,287 | @ SuppressWarnings ( "checkstyle:magicnumber" ) private static int readDateRecordValue ( DBaseFileField field , int nrecord , int nfield , byte [ ] rawData , int rawOffset , OutputParameter < Date > value ) throws IOException { final GregorianCalendar cal = new GregorianCalendar ( ) ; final int year = ( ( rawData [ rawOffset ] & 0xFF ) - '0' ) * 1000 + ( ( rawData [ rawOffset + 1 ] & 0xFF ) - '0' ) * 100 + ( ( rawData [ rawOffset + 2 ] & 0xFF ) - '0' ) * 10 + ( ( rawData [ rawOffset + 3 ] & 0xFF ) - '0' ) ; final int month = ( ( rawData [ rawOffset + 4 ] & 0xFF ) - '0' ) * 10 + ( ( rawData [ rawOffset + 5 ] & 0xFF ) - '0' ) ; final int day = ( ( rawData [ rawOffset + 6 ] & 0xFF ) - '0' ) * 10 + ( ( rawData [ rawOffset + 7 ] & 0xFF ) - '0' ) ; cal . set ( Calendar . YEAR , year ) ; cal . set ( Calendar . MONTH , month ) ; cal . set ( Calendar . DAY_OF_MONTH , day ) ; if ( year == cal . get ( Calendar . YEAR ) && month == cal . get ( Calendar . MONTH ) && day == cal . get ( Calendar . DAY_OF_MONTH ) ) { value . set ( cal . getTime ( ) ) ; return 8 ; } throw new InvalidRawDataFormatException ( nrecord , nfield , new String ( rawData , rawOffset , field . getLength ( ) ) ) ; } | Read a DATE record value . |
6,288 | private static int readNumberRecordValue ( DBaseFileField field , int nrecord , int nfield , byte [ ] rawData , int rawOffset , OutputParameter < Double > value ) throws IOException { final String buffer = new String ( rawData , rawOffset , field . getLength ( ) ) ; try { final String b = buffer . trim ( ) ; if ( b != null && b . length ( ) > 0 ) { value . set ( new Double ( b ) ) ; return field . getLength ( ) ; } } catch ( NumberFormatException e ) { } throw new InvalidRawDataFormatException ( nrecord , nfield , buffer ) ; } | Read a NUMBER record value . |
6,289 | @ SuppressWarnings ( "checkstyle:magicnumber" ) private static int readBooleanRecordValue ( DBaseFileField field , int nrecord , int nfield , byte [ ] rawData , int rawOffset , OutputParameter < Boolean > value ) throws IOException { final int byteCode = rawData [ rawOffset ] & 0xFF ; if ( TRUE_CHARS . indexOf ( byteCode ) != - 1 ) { value . set ( true ) ; return 1 ; } if ( FALSE_CHARS . indexOf ( byteCode ) != - 1 ) { value . set ( false ) ; return 1 ; } throw new InvalidRawDataFormatException ( nrecord , nfield , Integer . toString ( byteCode ) ) ; } | Read a BOOLEAN record value . |
6,290 | private static int read2ByteIntegerRecordValue ( DBaseFileField field , int nrecord , int nfield , byte [ ] rawData , int rawOffset , OutputParameter < Integer > value ) throws IOException { final short rawNumber = EndianNumbers . toLEShort ( rawData [ rawOffset ] , rawData [ rawOffset + 1 ] ) ; try { value . set ( new Integer ( rawNumber ) ) ; return 2 ; } catch ( NumberFormatException exception ) { throw new InvalidRawDataFormatException ( nrecord , nfield , Short . toString ( rawNumber ) ) ; } } | Read a 2 BYTE INTEGER record value . |
6,291 | @ SuppressWarnings ( "checkstyle:magicnumber" ) private static int read4ByteIntegerRecordValue ( DBaseFileField field , int nrecord , int nfield , byte [ ] rawData , int rawOffset , OutputParameter < Long > value ) throws IOException { final int rawNumber = EndianNumbers . toLEInt ( rawData [ rawOffset ] , rawData [ rawOffset + 1 ] , rawData [ rawOffset + 2 ] , rawData [ rawOffset + 3 ] ) ; try { value . set ( new Long ( rawNumber ) ) ; return 4 ; } catch ( NumberFormatException exception ) { throw new InvalidRawDataFormatException ( nrecord , nfield , Long . toString ( rawNumber ) ) ; } } | Read a 4 BYTE INTEGER record value . |
6,292 | @ SuppressWarnings ( "checkstyle:magicnumber" ) private static int read8ByteDoubleRecordValue ( DBaseFileField field , int nrecord , int nfield , byte [ ] rawData , int rawOffset , OutputParameter < Double > value ) throws IOException { final double rawNumber = EndianNumbers . toLEDouble ( rawData [ rawOffset ] , rawData [ rawOffset + 1 ] , rawData [ rawOffset + 2 ] , rawData [ rawOffset + 3 ] , rawData [ rawOffset + 4 ] , rawData [ rawOffset + 5 ] , rawData [ rawOffset + 6 ] , rawData [ rawOffset + 7 ] ) ; try { value . set ( new Double ( rawNumber ) ) ; return 8 ; } catch ( NumberFormatException exception ) { throw new InvalidRawDataFormatException ( nrecord , nfield , Double . toString ( rawNumber ) ) ; } } | Read a 8 BYTE DOUBLE record value . |
6,293 | public boolean isColumnSelectable ( DBaseFileField column ) { return column != null && ( this . selectedColumns . isEmpty ( ) || this . selectedColumns . contains ( column ) ) ; } | Replies if the specified column could be replied or ignored . |
6,294 | public static void loadDefaultEncryptionModule ( ) { final Provider [ ] providers = Security . getProviders ( ) ; boolean found = false ; for ( final Provider provider : providers ) { if ( provider instanceof SunJCE ) { found = true ; break ; } } if ( ! found ) { Security . addProvider ( new SunJCE ( ) ) ; } } | Load the default encryption module . |
6,295 | public static String md5 ( String str ) { if ( str == null ) { return "" ; } final byte [ ] uniqueKey = str . getBytes ( ) ; byte [ ] hash = null ; try { hash = MessageDigest . getInstance ( "MD5" ) . digest ( uniqueKey ) ; } catch ( NoSuchAlgorithmException e ) { throw new Error ( Locale . getString ( "NO_MD5" ) ) ; } final StringBuilder hashString = new StringBuilder ( ) ; for ( int i = 0 ; i < hash . length ; ++ i ) { final String hex = Integer . toHexString ( hash [ i ] ) ; if ( hex . length ( ) == 1 ) { hashString . append ( '0' ) ; hashString . append ( hex . charAt ( hex . length ( ) - 1 ) ) ; } else { hashString . append ( hex . substring ( hex . length ( ) - 2 ) ) ; } } return hashString . toString ( ) ; } | Replies a MD5 key . |
6,296 | public BooleanProperty isMultiPartsProperty ( ) { if ( this . isMultipart == null ) { this . isMultipart = new ReadOnlyBooleanWrapper ( this , MathFXAttributeNames . IS_MULTIPARTS , false ) ; this . isMultipart . bind ( Bindings . createBooleanBinding ( ( ) -> { boolean foundOne = false ; for ( final PathElementType type : innerTypesProperty ( ) ) { if ( type == PathElementType . MOVE_TO ) { if ( foundOne ) { return true ; } foundOne = true ; } } return false ; } , innerTypesProperty ( ) ) ) ; } return this . isMultipart ; } | Replies the isMultiParts property . |
6,297 | private String getWthInsiCodeOr ( Map wthData ) { String insiName = getWthInsiCode ( wthData ) ; if ( insiName . equals ( "" ) ) { return getNextDefName ( ) ; } else { return insiName ; } } | Get the 4 - bit institute code for weather file name if not available from data holder then use default code |
6,298 | public static String getWthInsiCode ( Map wthData ) { String wst_name = getValueOr ( wthData , "wst_name" , "" ) ; if ( wst_name . matches ( "(\\w{4})|(\\w{8})" ) ) { return wst_name ; } String wst_id = getValueOr ( wthData , "wst_id" , "" ) ; if ( wst_id . matches ( "(\\w{4})|(\\w{8})" ) ) { return wst_id ; } wst_id = getValueOr ( wthData , "dssat_insi" , "" ) ; if ( wst_id . matches ( "(\\w{4})|(\\w{8})" ) ) { return wst_id ; } return "" ; } | Get the 4 - bit institute code for weather file nam |
6,299 | public static String getWthYearDuration ( Map wthData ) { String yearDur = "" ; ArrayList < Map > wthRecords = ( ArrayList ) getObjectOr ( wthData , "dailyWeather" , new ArrayList ( ) ) ; if ( ! wthRecords . isEmpty ( ) ) { String startYear = getValueOr ( ( wthRecords . get ( 0 ) ) , "w_date" , " " ) . substring ( 2 , 4 ) . trim ( ) ; String endYear = getValueOr ( ( wthRecords . get ( wthRecords . size ( ) - 1 ) ) , "w_date" , " " ) . substring ( 2 , 4 ) . trim ( ) ; if ( ! startYear . equals ( "" ) && ! endYear . equals ( "" ) ) { yearDur += startYear ; try { int iStartYear = Integer . parseInt ( startYear ) ; int iEndYear = Integer . parseInt ( endYear ) ; iStartYear += iStartYear <= 15 ? 2000 : 1900 ; iEndYear += iEndYear <= 15 ? 2000 : 1900 ; int duration = iEndYear - iStartYear + 1 ; duration = duration > 99 ? 99 : duration ; yearDur += String . format ( "%02d" , duration ) ; } catch ( Exception e ) { yearDur += "01" ; } } } return yearDur ; } | Get the last 2 - bit year number and 2 - bit of the duration for weather file name |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.