idx
int64
0
165k
question
stringlengths
73
5.81k
target
stringlengths
5
918
6,500
public static Point2d WSG84_L1 ( double lambda , double phi ) { final Point2d ntfLambdaPhi = WSG84_NTFLamdaPhi ( lambda , phi ) ; return NTFLambdaPhi_NTFLambert ( ntfLambdaPhi . getX ( ) , ntfLambdaPhi . getY ( ) , LAMBERT_1_N , LAMBERT_1_C , LAMBERT_1_XS , LAMBERT_1_YS ) ; }
This function convert WSG84 GPS coordinate to France Lambert I coordinate .
6,501
public static Point2d WSG84_L2 ( double lambda , double phi ) { final Point2d ntfLambdaPhi = WSG84_NTFLamdaPhi ( lambda , phi ) ; return NTFLambdaPhi_NTFLambert ( ntfLambdaPhi . getX ( ) , ntfLambdaPhi . getY ( ) , LAMBERT_2_N , LAMBERT_2_C , LAMBERT_2_XS , LAMBERT_2_YS ) ; }
This function convert WSG84 GPS coordinate to France Lambert II coordinate .
6,502
public static Point2d WSG84_L3 ( double lambda , double phi ) { final Point2d ntfLambdaPhi = WSG84_NTFLamdaPhi ( lambda , phi ) ; return NTFLambdaPhi_NTFLambert ( ntfLambdaPhi . getX ( ) , ntfLambdaPhi . getY ( ) , LAMBERT_3_N , LAMBERT_3_C , LAMBERT_3_XS , LAMBERT_3_YS ) ; }
This function convert WSG84 GPS coordinate to France Lambert III coordinate .
6,503
public static Point2d WSG84_L4 ( double lambda , double phi ) { final Point2d ntfLambdaPhi = WSG84_NTFLamdaPhi ( lambda , phi ) ; return NTFLambdaPhi_NTFLambert ( ntfLambdaPhi . getX ( ) , ntfLambdaPhi . getY ( ) , LAMBERT_4_N , LAMBERT_4_C , LAMBERT_4_XS , LAMBERT_4_YS ) ; }
This function convert WSG84 GPS coordinate to France Lambert IV coordinate .
6,504
public static Point2d WSG84_L93 ( double lambda , double phi ) { final Point2d ntfLambdaPhi = WSG84_NTFLamdaPhi ( lambda , phi ) ; return NTFLambdaPhi_NTFLambert ( ntfLambdaPhi . getX ( ) , ntfLambdaPhi . getY ( ) , LAMBERT_93_N , LAMBERT_93_C , LAMBERT_93_XS , LAMBERT_93_YS ) ; }
This function convert WSG84 GPS coordinate to France Lambert 93 coordinate .
6,505
@ SuppressWarnings ( { "checkstyle:parametername" , "checkstyle:magicnumber" , "checkstyle:localfinalvariablename" , "checkstyle:localvariablename" } ) private static Point2d NTFLambdaPhi_NTFLambert ( double lambda , double phi , double n , double c , double Xs , double Ys ) { final double a_n = 6378249.2 ; final double b_n = 6356515.0 ; final double e2_n = ( a_n * a_n - b_n * b_n ) / ( a_n * a_n ) ; final double e_n = Math . sqrt ( e2_n ) ; final double lambda0 = 0.04079234433198 ; final double L = Math . log ( Math . tan ( Math . PI / 4. + phi / 2. ) * Math . pow ( ( 1. - e_n * Math . sin ( phi ) ) / ( 1. + e_n * Math . sin ( phi ) ) , e_n / 2. ) ) ; final double X_l2e = Xs + c * Math . exp ( - n * L ) * Math . sin ( n * ( lambda - lambda0 ) ) ; final double Y_l2e = Ys - c * Math . exp ( - n * L ) * Math . cos ( n * ( lambda - lambda0 ) ) ; return new Point2d ( X_l2e , Y_l2e ) ; }
This function convert the geographical NTF Lambda - Phi coordinate to one of the France NTF standard coordinate .
6,506
@ SuppressWarnings ( { "checkstyle:parametername" , "checkstyle:magicnumber" , "checkstyle:localfinalvariablename" , "checkstyle:localvariablename" } ) private static Point2d WSG84_NTFLamdaPhi ( double lambda , double phi ) { final double lambda_w = Math . toRadians ( lambda ) ; final double phi_w = Math . toRadians ( phi ) ; final double a_w = 6378137.0 ; final double b_w = 6356752.314 ; final double e2_w = ( a_w * a_w - b_w * b_w ) / ( a_w * a_w ) ; final double N = a_w / Math . sqrt ( 1. - e2_w * Math . pow ( Math . sin ( phi_w ) , 2. ) ) ; final double X_w = N * Math . cos ( phi_w ) * Math . cos ( lambda_w ) ; final double Y_w = N * Math . cos ( phi_w ) * Math . sin ( lambda_w ) ; final double Z_w = N * ( 1 - e2_w ) * Math . sin ( phi_w ) ; final double dX = 168.0 ; final double dY = 60.0 ; final double dZ = - 320.0 ; final double X_n = X_w + dX ; final double Y_n = Y_w + dY ; final double Z_n = Z_w + dZ ; final double a_n = 6378249.2 ; final double b_n = 6356515.0 ; final double e2_n = ( a_n * a_n - b_n * b_n ) / ( a_n * a_n ) ; final double epsilon = 1e-10 ; double p0 = Math . atan ( Z_n / Math . sqrt ( X_n * X_n + Y_n * Y_n ) * ( 1 - ( a_n * e2_n ) / ( Math . sqrt ( X_n * X_n + Y_n * Y_n + Z_n * Z_n ) ) ) ) ; double p1 = Math . atan ( ( Z_n / Math . sqrt ( X_n * X_n + Y_n * Y_n ) ) / ( 1 - ( a_n * e2_n * Math . cos ( p0 ) ) / ( Math . sqrt ( ( X_n * X_n + Y_n * Y_n ) * ( 1 - e2_n * Math . pow ( Math . sin ( p0 ) , 2 ) ) ) ) ) ) ; while ( Math . abs ( p1 - p0 ) >= epsilon ) { p0 = p1 ; p1 = Math . atan ( ( Z_n / Math . sqrt ( X_n * X_n + Y_n * Y_n ) ) / ( 1 - ( a_n * e2_n * Math . cos ( p0 ) ) / ( Math . sqrt ( ( X_n * X_n + Y_n * Y_n ) * ( 1 - e2_n * Math . pow ( Math . sin ( p0 ) , 2 ) ) ) ) ) ) ; } final double phi_n = p1 ; final double lambda_n = Math . atan ( Y_n / X_n ) ; return new Point2d ( lambda_n , phi_n ) ; }
This function convert WSG84 GPS coordinate to one of the NTF Lambda - Phi coordinate .
6,507
public ObjectProperty < WeakReference < Segment1D < ? , ? > > > segmentProperty ( ) { if ( this . segment == null ) { this . segment = new SimpleObjectProperty < > ( this , MathFXAttributeNames . SEGMENT ) ; } return this . segment ; }
Replies the segment property .
6,508
void set ( ObjectProperty < WeakReference < Segment1D < ? , ? > > > segment , DoubleProperty x , DoubleProperty y ) { this . segment = segment ; this . x = x ; this . y = y ; }
Change the x and y properties .
6,509
public static boolean intersectsSegmentCapsule ( double sx1 , double sy1 , double sz1 , double sx2 , double sy2 , double sz2 , double mx1 , double my1 , double mz1 , double mx2 , double my2 , double mz2 , double radius ) { double d = distanceSquaredSegmentSegment ( sx1 , sy1 , sz1 , sx2 , sy2 , sz2 , mx1 , my1 , mz1 , mx2 , my2 , mz2 ) ; return d < ( radius * radius ) ; }
Tests if the capsule is intersecting a segment .
6,510
public static boolean intersectsLineLine ( double x1 , double y1 , double z1 , double x2 , double y2 , double z2 , double x3 , double y3 , double z3 , double x4 , double y4 , double z4 ) { double s = computeLineLineIntersectionFactor ( x1 , y1 , z1 , x2 , y2 , z2 , x3 , y3 , z3 , x4 , y4 , z4 ) ; return ! Double . isNaN ( s ) ; }
Replies if two lines are intersecting .
6,511
public static double distanceSquaredSegmentPoint ( double sx1 , double sy1 , double sz1 , double sx2 , double sy2 , double sz2 , double px , double py , double pz ) { double ratio = getPointProjectionFactorOnSegmentLine ( px , py , pz , sx1 , sy1 , sz1 , sx2 , sy2 , sz2 ) ; if ( ratio <= 0. ) return FunctionalPoint3D . distanceSquaredPointPoint ( px , py , pz , sx1 , sy1 , sz1 ) ; if ( ratio >= 1. ) return FunctionalPoint3D . distanceSquaredPointPoint ( px , py , pz , sx2 , sy2 , sz2 ) ; return FunctionalPoint3D . distanceSquaredPointPoint ( px , py , pz , ( 1. - ratio ) * sx1 + ratio * sx2 , ( 1. - ratio ) * sy1 + ratio * sy2 , ( 1. - ratio ) * sz1 + ratio * sz2 ) ; }
Compute and replies the perpendicular squared distance from a point to a segment .
6,512
public static double distanceSegmentPoint ( double sx1 , double sy1 , double sz1 , double sx2 , double sy2 , double sz2 , double px , double py , double pz ) { double ratio = getPointProjectionFactorOnSegmentLine ( px , py , pz , sx1 , sy1 , sz1 , sx2 , sy2 , sz2 ) ; if ( ratio <= 0. ) return FunctionalPoint3D . distancePointPoint ( px , py , pz , sx1 , sy1 , sz1 ) ; if ( ratio >= 1. ) return FunctionalPoint3D . distancePointPoint ( px , py , pz , sx2 , sy2 , sz2 ) ; return FunctionalPoint3D . distancePointPoint ( px , py , pz , ( 1. - ratio ) * sx1 + ratio * sx2 , ( 1. - ratio ) * sy1 + ratio * sy2 , ( 1. - ratio ) * sz1 + ratio * sz2 ) ; }
Compute and replies the perpendicular distance from a point to a segment .
6,513
public static double getPointProjectionFactorOnSegmentLine ( double px , double py , double pz , double s1x , double s1y , double s1z , double s2x , double s2y , double s2z ) { double dx = s2x - s1x ; double dy = s2y - s1y ; double dz = s2z - s1z ; if ( dx == 0. && dy == 0. && dz == 0. ) return 0. ; return ( ( px - s1x ) * dx + ( py - s1y ) * dy + ( pz - s1z ) * dz ) / ( dx * dx + dy * dy + dz * dz ) ; }
Replies the projection a point on a segment .
6,514
public static double distanceSegmentSegment ( double ax1 , double ay1 , double az1 , double ax2 , double ay2 , double az2 , double bx1 , double by1 , double bz1 , double bx2 , double by2 , double bz2 ) { return Math . sqrt ( distanceSquaredSegmentSegment ( ax1 , ay1 , az1 , ax2 , ay2 , az2 , bx1 , by1 , bz1 , bx2 , by2 , bz2 ) ) ; }
Compute and replies the distance between two segments .
6,515
public static double distanceSquaredSegmentSegment ( double ax1 , double ay1 , double az1 , double ax2 , double ay2 , double az2 , double bx1 , double by1 , double bz1 , double bx2 , double by2 , double bz2 ) { Vector3f u = new Vector3f ( ax2 - ax1 , ay2 - ay1 , az2 - az1 ) ; Vector3f v = new Vector3f ( bx2 - bx1 , by2 - by1 , bz2 - bz1 ) ; Vector3f w = new Vector3f ( ax1 - bx1 , ay1 - by1 , az1 - bz1 ) ; double a = u . dot ( u ) ; double b = u . dot ( v ) ; double c = v . dot ( v ) ; double d = u . dot ( w ) ; double e = v . dot ( w ) ; double D = a * c - b * b ; double sc , sN , tc , tN ; double sD = D ; double tD = D ; if ( MathUtil . isEpsilonZero ( D ) ) { sN = 0. ; sD = 1. ; tN = e ; tD = c ; } else { sN = b * e - c * d ; tN = a * e - b * d ; if ( sN < 0. ) { sN = 0. ; tN = e ; tD = c ; } else if ( sN > sD ) { sN = sD ; tN = e + b ; tD = c ; } } if ( tN < 0. ) { tN = 0. ; if ( - d < 0. ) sN = 0. ; else if ( - d > a ) sN = sD ; else { sN = - d ; sD = a ; } } else if ( tN > tD ) { tN = tD ; if ( ( - d + b ) < 0. ) sN = 0 ; else if ( ( - d + b ) > a ) sN = sD ; else { sN = ( - d + b ) ; sD = a ; } } sc = ( MathUtil . isEpsilonZero ( sN ) ? 0. : sN / sD ) ; tc = ( MathUtil . isEpsilonZero ( tN ) ? 0. : tN / tD ) ; u . scale ( sc ) ; w . add ( u ) ; v . scale ( tc ) ; w . sub ( v ) ; return w . lengthSquared ( ) ; }
Compute and replies the squared distance between two segments .
6,516
public double distanceSegment ( Point3D point ) { return distanceSegmentPoint ( getX1 ( ) , getY1 ( ) , getZ1 ( ) , getX2 ( ) , getY2 ( ) , getZ2 ( ) , point . getX ( ) , point . getY ( ) , point . getZ ( ) ) ; }
Replies the distance between this segment and the given point .
6,517
public double distanceLine ( Point3D point ) { return distanceLinePoint ( getX1 ( ) , getY1 ( ) , getZ1 ( ) , getX2 ( ) , getY2 ( ) , getZ2 ( ) , point . getX ( ) , point . getY ( ) , point . getZ ( ) ) ; }
Replies the distance between the line of this segment and the given point .
6,518
public double distanceSquaredSegment ( Point3D point ) { return distanceSquaredSegmentPoint ( getX1 ( ) , getY1 ( ) , getZ1 ( ) , getX2 ( ) , getY2 ( ) , getZ2 ( ) , point . getX ( ) , point . getY ( ) , point . getZ ( ) ) ; }
Replies the squared distance between this segment and the given point .
6,519
public double distanceSquaredLine ( Point3D point ) { return distanceSquaredLinePoint ( getX1 ( ) , getY1 ( ) , getZ1 ( ) , getX2 ( ) , getY2 ( ) , getZ2 ( ) , point . getX ( ) , point . getY ( ) , point . getZ ( ) ) ; }
Replies the squared distance between the line of this segment and the given point .
6,520
protected boolean onBusLineAdded ( BusLine line , int index ) { if ( this . autoUpdate . get ( ) ) { try { addMapLayer ( index , new BusLineLayer ( line , isLayerAutoUpdated ( ) ) ) ; return true ; } catch ( Throwable exception ) { } } return false ; }
Invoked when a bus line was added in the attached network .
6,521
protected boolean onBusLineRemoved ( BusLine line , int index ) { if ( this . autoUpdate . get ( ) ) { try { removeMapLayerAt ( index ) ; return true ; } catch ( Throwable exception ) { } } return false ; }
Invoked when a bus line was removed from the attached network .
6,522
public static ImmutableKeyValueSource < Symbol , ByteSource > fromFileMap ( final Map < Symbol , File > fileMap ) { return new FileMapKeyToByteSource ( fileMap ) ; }
Creates a new key - value source based on the contents of the specified symbol to file map .
6,523
public static ImmutableKeyValueSource < Symbol , ByteSource > fromPalDB ( final File dbFile ) throws IOException { return PalDBKeyValueSource . fromFile ( dbFile ) ; }
Creates a new key - value source based on the contents of the specified embedded database .
6,524
protected JTree newTree ( ) { JTree tree = new JTree ( ) ; tree . setModel ( newTreeModel ( getModel ( ) ) ) ; tree . setEditable ( true ) ; tree . getSelectionModel ( ) . setSelectionMode ( TreeSelectionModel . SINGLE_TREE_SELECTION ) ; tree . addMouseListener ( new MouseAdapter ( ) { public void mousePressed ( MouseEvent e ) { int selRow = tree . getRowForLocation ( e . getX ( ) , e . getY ( ) ) ; if ( selRow != - 1 ) { if ( e . getClickCount ( ) == 1 ) { onSingleClick ( e ) ; } else if ( e . getClickCount ( ) == 2 ) { onDoubleClick ( e ) ; } } } } ) ; return tree ; }
New tree .
6,525
public void add ( Iterator < AbstractPathElement3F > iterator ) { AbstractPathElement3F element ; while ( iterator . hasNext ( ) ) { element = iterator . next ( ) ; switch ( element . type ) { case MOVE_TO : moveTo ( element . getToX ( ) , element . getToY ( ) , element . getToZ ( ) ) ; break ; case LINE_TO : lineTo ( element . getToX ( ) , element . getToY ( ) , element . getToZ ( ) ) ; break ; case QUAD_TO : quadTo ( element . getCtrlX1 ( ) , element . getCtrlY1 ( ) , element . getCtrlZ1 ( ) , element . getToX ( ) , element . getToY ( ) , element . getToZ ( ) ) ; break ; case CURVE_TO : curveTo ( element . getCtrlX1 ( ) , element . getCtrlY1 ( ) , element . getCtrlZ1 ( ) , element . getCtrlX2 ( ) , element . getCtrlY2 ( ) , element . getCtrlZ2 ( ) , element . getToX ( ) , element . getToY ( ) , element . getToZ ( ) ) ; break ; case CLOSE : closePath ( ) ; break ; default : } } }
Add the elements replied by the iterator into this path .
6,526
public double length ( ) { if ( this . isEmpty ( ) ) return 0 ; double length = 0 ; PathIterator3f pi = getPathIterator ( MathConstants . SPLINE_APPROXIMATION_RATIO ) ; AbstractPathElement3F pathElement = pi . next ( ) ; if ( pathElement . type != PathElementType . MOVE_TO ) { throw new IllegalArgumentException ( "missing initial moveto in path definition" ) ; } Path3f subPath ; double curx , cury , curz , movx , movy , movz , endx , endy , endz ; curx = movx = pathElement . getToX ( ) ; cury = movy = pathElement . getToY ( ) ; curz = movz = pathElement . getToZ ( ) ; while ( pi . hasNext ( ) ) { pathElement = pi . next ( ) ; switch ( pathElement . type ) { case MOVE_TO : movx = curx = pathElement . getToX ( ) ; movy = cury = pathElement . getToY ( ) ; movz = curz = pathElement . getToZ ( ) ; break ; case LINE_TO : endx = pathElement . getToX ( ) ; endy = pathElement . getToY ( ) ; endz = pathElement . getToZ ( ) ; length += FunctionalPoint3D . distancePointPoint ( curx , cury , curz , endx , endy , endz ) ; curx = endx ; cury = endy ; curz = endz ; break ; case QUAD_TO : endx = pathElement . getToX ( ) ; endy = pathElement . getToY ( ) ; endz = pathElement . getToZ ( ) ; subPath = new Path3f ( ) ; subPath . moveTo ( curx , cury , curz ) ; subPath . quadTo ( pathElement . getCtrlX1 ( ) , pathElement . getCtrlY1 ( ) , pathElement . getCtrlZ1 ( ) , endx , endy , endz ) ; length += subPath . length ( ) ; curx = endx ; cury = endy ; curz = endz ; break ; case CURVE_TO : endx = pathElement . getToX ( ) ; endy = pathElement . getToY ( ) ; endz = pathElement . getToZ ( ) ; subPath = new Path3f ( ) ; subPath . moveTo ( curx , cury , curz ) ; subPath . curveTo ( pathElement . getCtrlX1 ( ) , pathElement . getCtrlY1 ( ) , pathElement . getCtrlZ1 ( ) , pathElement . getCtrlX2 ( ) , pathElement . getCtrlY2 ( ) , pathElement . getCtrlZ2 ( ) , endx , endy , endz ) ; length += subPath . length ( ) ; curx = endx ; cury = endy ; curz = endz ; break ; case CLOSE : if ( curx != movx || cury != movy || curz != movz ) { length += FunctionalPoint3D . distancePointPoint ( curx , cury , curz , movx , movy , movz ) ; } curx = movx ; cury = movy ; cury = movz ; break ; default : } } return length ; }
FIXME TO BE IMPLEMENTED IN POLYLINE
6,527
private ImmutableMap < Integer , Integer > lightEREOffsetToEDTOffset ( String document ) { final ImmutableMap . Builder < Integer , Integer > offsetMap = ImmutableMap . builder ( ) ; int EDT = 0 ; document = document . replaceAll ( "\\r\\n" , "\n" ) ; for ( int i = 0 ; i < document . length ( ) ; i ++ ) { final String c = document . substring ( i , i + 1 ) ; if ( c . equals ( "<" ) ) { i = document . indexOf ( '>' , i ) ; continue ; } offsetMap . put ( i , EDT ) ; EDT ++ ; } return offsetMap . build ( ) ; }
lightERE offsets are indexed into the document including text inside tags EDT offsets are
6,528
protected boolean validate ( String text ) { try { String [ ] strings = text . split ( "," ) ; for ( int i = 0 ; i < strings . length ; i ++ ) { Integer . parseInt ( strings [ i ] . trim ( ) ) ; } return true ; } catch ( NumberFormatException e ) { return false ; } }
Validate the given string that it is a int array
6,529
private Collection < EqClassT > getAlignedTo ( final Object item ) { if ( rightEquivalenceClassesToProvenances . containsKey ( item ) && leftEquivalenceClassesToProvenances . containsKey ( item ) ) { return ImmutableList . of ( ( EqClassT ) item ) ; } else { return ImmutableList . of ( ) ; } }
Any equivalence class is by definition aligned to itself if it is present on both the left and the right . Otherwise it has no alignment .
6,530
public synchronized < T extends EventListener > void add ( Class < T > type , T listener ) { assert listener != null ; if ( this . listeners == NULL ) { this . listeners = new Object [ ] { type , listener } ; } else { final int i = this . listeners . length ; final Object [ ] tmp = new Object [ i + 2 ] ; System . arraycopy ( this . listeners , 0 , tmp , 0 , i ) ; tmp [ i ] = type ; tmp [ i + 1 ] = listener ; this . listeners = tmp ; } }
Adds the listener as a listener of the specified type .
6,531
public synchronized < T extends EventListener > void remove ( Class < T > type , T listener ) { assert listener != null ; int index = - 1 ; for ( int i = this . listeners . length - 2 ; i >= 0 ; i -= 2 ) { if ( ( this . listeners [ i ] == type ) && ( this . listeners [ i + 1 ] . equals ( listener ) ) ) { index = i ; break ; } } if ( index != - 1 ) { final Object [ ] tmp = new Object [ this . listeners . length - 2 ] ; System . arraycopy ( this . listeners , 0 , tmp , 0 , index ) ; if ( index < tmp . length ) { System . arraycopy ( this . listeners , index + 2 , tmp , index , tmp . length - index ) ; } this . listeners = ( tmp . length == 0 ) ? NULL : tmp ; } }
Removes the listener as a listener of the specified type .
6,532
private void writeObject ( ObjectOutputStream stream ) throws IOException { final Object [ ] lList = this . listeners ; stream . defaultWriteObject ( ) ; for ( int i = 0 ; i < lList . length ; i += 2 ) { final Class < ? > t = ( Class < ? > ) lList [ i ] ; final EventListener l = ( EventListener ) lList [ i + 1 ] ; if ( ( l != null ) && ( l instanceof Serializable ) ) { stream . writeObject ( t . getName ( ) ) ; stream . writeObject ( l ) ; } } stream . writeObject ( null ) ; }
Serialization support .
6,533
public static MathFunctionRange [ ] createDiscreteSet ( double ... values ) { final MathFunctionRange [ ] bounds = new MathFunctionRange [ values . length ] ; for ( int i = 0 ; i < values . length ; ++ i ) { bounds [ i ] = new MathFunctionRange ( values [ i ] ) ; } return bounds ; }
Create a set of bounds that correspond to the specified discrete values .
6,534
public static MathFunctionRange [ ] createSet ( double ... values ) { final MathFunctionRange [ ] bounds = new MathFunctionRange [ values . length / 2 ] ; for ( int i = 0 , j = 0 ; i < values . length ; i += 2 , ++ j ) { bounds [ j ] = new MathFunctionRange ( values [ i ] , values [ i + 1 ] ) ; } return bounds ; }
Create a set of bounds that correspond to the specified values .
6,535
public Interceptor interceptToProgressResponse ( ) { return new Interceptor ( ) { public Response intercept ( Chain chain ) throws IOException { Response response = chain . proceed ( chain . request ( ) ) ; ResponseBody body = new ForwardResponseBody ( response . body ( ) ) ; return response . newBuilder ( ) . body ( body ) . build ( ) ; } } ; }
intercept the Response body stream progress
6,536
void setStartPoint ( StandardRoadConnection desiredConnection ) { final StandardRoadConnection oldPoint = getBeginPoint ( StandardRoadConnection . class ) ; if ( oldPoint != null ) { oldPoint . removeConnectedSegment ( this , true ) ; } this . firstConnection = desiredConnection ; if ( desiredConnection != null ) { final Point2d pts = desiredConnection . getPoint ( ) ; if ( pts != null ) { setPointAt ( 0 , pts , true ) ; } desiredConnection . addConnectedSegment ( this , true ) ; } }
Move the start point of a road segment .
6,537
void setEndPoint ( StandardRoadConnection desiredConnection ) { final StandardRoadConnection oldPoint = getEndPoint ( StandardRoadConnection . class ) ; if ( oldPoint != null ) { oldPoint . removeConnectedSegment ( this , false ) ; } this . lastConnection = desiredConnection ; if ( desiredConnection != null ) { final Point2d pts = desiredConnection . getPoint ( ) ; if ( pts != null ) { setPointAt ( - 1 , pts , true ) ; } desiredConnection . addConnectedSegment ( this , false ) ; } }
Move the end point of a road segment .
6,538
private static < K , V > ImmutableMap < K , V > filterMapToKeysPreservingOrder ( final ImmutableMap < ? extends K , ? extends V > map , Iterable < ? extends K > keys ) { final ImmutableMap . Builder < K , V > ret = ImmutableMap . builder ( ) ; for ( final K key : keys ) { final V value = map . get ( key ) ; checkArgument ( value != null , "Key " + key + " not in map" ) ; ret . put ( key , value ) ; } return ret . build ( ) ; }
Filters a map down to the specified keys such that the new map has the same iteration order as the specified keys .
6,539
public static Component getRootJDialog ( Component component ) { while ( null != component . getParent ( ) ) { component = component . getParent ( ) ; if ( component instanceof JDialog ) { break ; } } return component ; }
Gets the root JDialog from the given Component Object .
6,540
public static Component getRootJFrame ( Component component ) { while ( null != component . getParent ( ) ) { component = component . getParent ( ) ; if ( component instanceof JFrame ) { break ; } } return component ; }
Gets the root JFrame from the given Component Object .
6,541
public static Component getRootParent ( Component component ) { while ( null != component . getParent ( ) ) { component = component . getParent ( ) ; } return component ; }
Gets the root parent from the given Component Object .
6,542
public static void setIconImage ( final String resourceName , final Window window ) throws IOException { final InputStream isLogo = ClassExtensions . getResourceAsStream ( resourceName ) ; final BufferedImage biLogo = ImageIO . read ( isLogo ) ; window . setIconImage ( biLogo ) ; }
Sets the icon image from the given resource name and add it to the given window object .
6,543
public double getDistance ( Point2D < ? , ? > point ) { double dist = super . getDistance ( point ) ; dist -= this . radius ; return dist ; }
Replies the distance between this MapCircle and point .
6,544
public static Point3dfx convert ( Tuple3D < ? > tuple ) { if ( tuple instanceof Point3dfx ) { return ( Point3dfx ) tuple ; } return new Point3dfx ( tuple . getX ( ) , tuple . getY ( ) , tuple . getZ ( ) ) ; }
Convert the given tuple to a real Point3dfx .
6,545
@ SuppressWarnings ( { "TypeParameterUnusedInFormals" , "unchecked" } ) private < T > T fetch ( final String id ) { checkNotNull ( id ) ; checkArgument ( ! id . isEmpty ( ) ) ; final T ret = ( T ) idMap . get ( id ) ; if ( ret == null ) { throw new EREException ( String . format ( "Lookup failed for id %s." , id ) ) ; } return ret ; }
no way around unchecked cast for heterogeneous container
6,546
public void setSpecialChars ( String [ ] [ ] chars ) { assert chars != null : AssertMessages . notNullParameter ( ) ; this . specialChars . clear ( ) ; for ( final String [ ] pair : chars ) { assert pair != null ; assert pair . length == 2 ; assert pair [ 0 ] . length ( ) > 0 ; assert pair [ 1 ] . length ( ) > 0 ; this . specialChars . put ( pair [ 0 ] , pair [ 1 ] ) ; } }
Change the special characters .
6,547
public void setValidCharRange ( int minValidChar , int maxValidChar ) { if ( minValidChar <= maxValidChar ) { this . minValidChar = minValidChar ; this . maxValidChar = maxValidChar ; } else { this . maxValidChar = minValidChar ; this . minValidChar = maxValidChar ; } }
Change the range of the valid characters that should not be escaped . Any character outside the given range is automatically escaped .
6,548
@ SuppressWarnings ( "checkstyle:magicnumber" ) public String escape ( CharSequence text ) { final StringBuilder result = new StringBuilder ( ) ; for ( int i = 0 ; i < text . length ( ) ; ++ i ) { final char c = text . charAt ( i ) ; final String cs = Character . toString ( c ) ; if ( this . escapeCharacters . contains ( cs ) ) { result . append ( this . toEscapeCharacter ) ; result . append ( cs ) ; } else { final String special = this . specialChars . get ( cs ) ; if ( special != null ) { result . append ( special ) ; } else if ( c < this . minValidChar || c > this . maxValidChar ) { if ( this . maxValidChar > 0 ) { result . append ( "\\u" ) ; result . append ( formatHex ( c , 4 ) ) ; } } else { result . append ( cs ) ; } } } return result . toString ( ) ; }
Escape the given text .
6,549
public static void shuffle ( final int [ ] arr , final Random rng ) { for ( int i = arr . length ; i > 1 ; i -- ) { final int a = i - 1 ; final int b = rng . nextInt ( i ) ; final int tmp = arr [ b ] ; arr [ b ] = arr [ a ] ; arr [ a ] = tmp ; } }
Fisher - Yates suffer a primitive int array
6,550
protected void setupRoadBorders ( ZoomableGraphicsContext gc , RoadPolyline element ) { final Color color = gc . rgb ( getDrawingColor ( element ) ) ; gc . setStroke ( color ) ; final double width ; if ( element . isWidePolyline ( ) ) { width = 2 + gc . doc2fxSize ( element . getWidth ( ) ) ; } else { width = 3 ; } gc . setLineWidthInPixels ( width ) ; }
Setup for drawing the road borders .
6,551
protected void setupRoadInterior ( ZoomableGraphicsContext gc , RoadPolyline element ) { final Color color ; if ( isSelected ( element ) ) { color = gc . rgb ( SELECTED_ROAD_COLOR ) ; } else { color = gc . rgb ( ROAD_COLOR ) ; } gc . setStroke ( color ) ; if ( element . isWidePolyline ( ) ) { gc . setLineWidthInMeters ( element . getWidth ( ) ) ; } else { gc . setLineWidthInPixels ( 1 ) ; } }
Setup for drawing the road interior .
6,552
public static String lowerEqualParameter ( int aindex , Object avalue , Object value ) { return msg ( "A11" , aindex , avalue , value ) ; }
Parameter A must be lower than or equal to the given value .
6,553
public static String lowerEqualParameters ( int aindex , Object avalue , int bindex , Object bvalue ) { return msg ( "A3" , aindex , avalue , bindex , bvalue ) ; }
Parameter A must be lower than or equal to Parameter B .
6,554
public static String outsideRangeInclusiveParameter ( int parameterIndex , Object currentValue , Object minValue , Object maxValue ) { return msg ( "A6" , parameterIndex , currentValue , minValue , maxValue ) ; }
Value is outside range .
6,555
@ Inline ( value = "AssertMessages.outsideRangeInclusiveParameter(0, $1, $2, $3)" , imported = { AssertMessages . class } ) public static String outsideRangeInclusiveParameter ( Object currentValue , Object minValue , Object maxValue ) { return outsideRangeInclusiveParameter ( 0 , currentValue , minValue , maxValue ) ; }
First parameter value is outside range .
6,556
@ Inline ( value = "AssertMessages.tooSmallArrayParameter(0, $1, $2)" , imported = { AssertMessages . class } ) public static String tooSmallArrayParameter ( int currentSize , int expectedSize ) { return tooSmallArrayParameter ( 0 , currentSize , expectedSize ) ; }
Size of the first array parameter is too small .
6,557
public static String tooSmallArrayParameter ( int parameterIndex , int currentSize , int expectedSize ) { return msg ( "A5" , parameterIndex , currentSize , expectedSize ) ; }
Size of the array parameter is too small .
6,558
public static ShapeElementType toESRI ( Class < ? extends MapElement > type ) { if ( MapPolyline . class . isAssignableFrom ( type ) ) { return ShapeElementType . POLYLINE ; } if ( MapPolygon . class . isAssignableFrom ( type ) ) { return ShapeElementType . POLYGON ; } if ( MapMultiPoint . class . isAssignableFrom ( type ) ) { return ShapeElementType . MULTIPOINT ; } if ( MapPoint . class . isAssignableFrom ( type ) ) { return ShapeElementType . POINT ; } throw new IllegalArgumentException ( ) ; }
Replies the type of map element which is corresponding to the given GIS class .
6,559
@ SuppressWarnings ( "unchecked" ) public static < T , V > ImmutableMap < V , Alignment < T , T > > splitAlignmentByKeyFunction ( Alignment < ? extends T , ? extends T > alignment , Function < ? super T , ? extends V > keyFunction ) { final ImmutableSet < ? extends V > allKeys = FluentIterable . from ( ( ImmutableSet < T > ) alignment . allLeftItems ( ) ) . append ( alignment . allRightItems ( ) ) . transform ( keyFunction ) . toSet ( ) ; final ImmutableMap . Builder < V , MultimapAlignment . Builder < T , T > > keysToAlignmentsB = ImmutableMap . builder ( ) ; for ( final V key : allKeys ) { keysToAlignmentsB . put ( key , MultimapAlignment . < T , T > builder ( ) ) ; } final ImmutableMap < V , MultimapAlignment . Builder < T , T > > keysToAlignments = keysToAlignmentsB . build ( ) ; for ( final T leftItem : alignment . allLeftItems ( ) ) { final V keyVal = keyFunction . apply ( leftItem ) ; final MultimapAlignment . Builder < T , T > alignmentForKey = keysToAlignments . get ( keyVal ) ; alignmentForKey . addLeftItem ( leftItem ) ; for ( T rightItem : alignment . alignedToLeftItem ( leftItem ) ) { if ( keyFunction . apply ( rightItem ) . equals ( keyVal ) ) { alignmentForKey . align ( leftItem , rightItem ) ; } } } for ( final T rightItem : alignment . allRightItems ( ) ) { final V keyVal = keyFunction . apply ( rightItem ) ; final MultimapAlignment . Builder < T , T > alignmentForKey = keysToAlignments . get ( keyVal ) ; alignmentForKey . addRightItem ( rightItem ) ; for ( final T leftItem : alignment . alignedToRightItem ( rightItem ) ) { if ( keyVal . equals ( keyFunction . apply ( leftItem ) ) ) { alignmentForKey . align ( leftItem , rightItem ) ; } } } final ImmutableMap . Builder < V , Alignment < T , T > > ret = ImmutableMap . builder ( ) ; for ( final Map . Entry < V , MultimapAlignment . Builder < T , T > > entry : keysToAlignments . entrySet ( ) ) { ret . put ( entry . getKey ( ) , entry . getValue ( ) . build ( ) ) ; } return ret . build ( ) ; }
Splits an alignment into many alignments based on a function mapping aligned items to some set of keys . Returns a map where the keys are all observed outputs of the key function on items in the alignment and the values are new alignments containing only elements which yield that output when the key function is applied . For example if you had an alignment of EventMentions you could use an event type key function to produce one alignment per event type .
6,560
protected void fireStateChange ( ) { if ( this . listeners != null ) { final ProgressionEvent event = new ProgressionEvent ( this , isRootModel ( ) ) ; for ( final ProgressionListener listener : this . listeners . getListeners ( ProgressionListener . class ) ) { listener . onProgressionStateChanged ( event ) ; } } }
Notify listeners about state change .
6,561
protected void fireValueChange ( ) { if ( this . listeners != null ) { final ProgressionEvent event = new ProgressionEvent ( this , isRootModel ( ) ) ; for ( final ProgressionListener listener : this . listeners . getListeners ( ProgressionListener . class ) ) { listener . onProgressionValueChanged ( event ) ; } } }
Notify listeners about value change .
6,562
void setValue ( SubProgressionModel subTask , double newValue , String comment ) { setProperties ( newValue , this . min , this . max , this . isAdjusting , comment == null ? this . comment : comment , true , true , false , subTask ) ; }
Set the value with a float - point precision . This method is invoked from a subtask .
6,563
void disconnectSubTask ( SubProgressionModel subTask , double value , boolean overwriteComment ) { if ( this . child == subTask ) { if ( overwriteComment ) { final String cmt = subTask . getComment ( ) ; if ( cmt != null ) { this . comment = cmt ; } } this . child = null ; setProperties ( value , this . min , this . max , this . isAdjusting , this . comment , overwriteComment , true , false , null ) ; } }
Set the parent value and disconnect this subtask from its parent . This method is invoked from a subtask .
6,564
protected boolean onBusItineraryAdded ( BusItinerary itinerary , int index ) { if ( this . autoUpdate . get ( ) ) { try { addMapLayer ( index , new BusItineraryLayer ( itinerary , isLayerAutoUpdated ( ) ) ) ; return true ; } catch ( Throwable exception ) { } } return false ; }
Invoked when a bus itinerary was added in the attached line .
6,565
protected boolean onBusItineraryRemoved ( BusItinerary itinerary , int index ) { if ( this . autoUpdate . get ( ) ) { try { removeMapLayerAt ( index ) ; return true ; } catch ( Throwable exception ) { } } return false ; }
Invoked when a bus itinerary was removed from the attached line .
6,566
@ SuppressWarnings ( "checkstyle:cyclomaticcomplexity" ) public static Class < ? extends MapElement > fromESRI ( ShapeElementType type ) { switch ( type ) { case MULTIPOINT : case MULTIPOINT_M : case MULTIPOINT_Z : return MapMultiPoint . class ; case POINT : case POINT_M : case POINT_Z : return MapPoint . class ; case POLYGON : case POLYGON_M : case POLYGON_Z : return MapPolygon . class ; case POLYLINE : case POLYLINE_M : case POLYLINE_Z : return MapPolyline . class ; default : } throw new IllegalArgumentException ( ) ; }
Replies the type of map element which is corresponding to the given ESRI type .
6,567
public Class < ? extends MapElement > getMapElementType ( ) { if ( this . elementType != null ) { return this . elementType ; } try { return fromESRI ( getShapeElementType ( ) ) ; } catch ( IllegalArgumentException exception ) { } return null ; }
Replies the type of map element replied by this reader .
6,568
protected static UUID extractUUID ( AttributeProvider provider ) { AttributeValue value ; value = provider . getAttribute ( UUID_ATTR ) ; if ( value != null ) { try { return value . getUUID ( ) ; } catch ( InvalidAttributeTypeException e ) { } catch ( AttributeNotInitializedException e ) { } } value = provider . getAttribute ( ID_ATTR ) ; if ( value != null ) { try { return value . getUUID ( ) ; } catch ( InvalidAttributeTypeException e ) { } catch ( AttributeNotInitializedException e ) { } } return null ; }
Extract the UUID from the attributes .
6,569
protected void onShowPopup ( final MouseEvent e ) { if ( e . isPopupTrigger ( ) ) { System . out . println ( e . getSource ( ) ) ; popupMenu . show ( e . getComponent ( ) , e . getX ( ) , e . getY ( ) ) ; } }
Callback method that is called on show popup .
6,570
private final Command takeExecutingCommand ( ) { try { return this . commandAlreadySent . take ( ) ; } catch ( InterruptedException e ) { Thread . currentThread ( ) . interrupt ( ) ; } return null ; }
get current command from queue
6,571
public static void load ( URL filename ) throws IOException { if ( disable ) { return ; } if ( URISchemeType . FILE . isURL ( filename ) ) { try { load ( new File ( filename . toURI ( ) ) ) ; } catch ( URISyntaxException e ) { throw new FileNotFoundException ( filename . toExternalForm ( ) ) ; } } else { final String libName = System . mapLibraryName ( "javaDynLib" ) ; String suffix = ".dll" ; String prefix = "javaDynLib" ; final int pos = libName . lastIndexOf ( '.' ) ; if ( pos >= 0 ) { suffix = libName . substring ( pos ) ; prefix = libName . substring ( 0 , pos ) ; } final File file = File . createTempFile ( prefix , suffix ) ; try ( FileOutputStream outs = new FileOutputStream ( file ) ) { try ( InputStream ins = filename . openStream ( ) ) { final byte [ ] buffer = new byte [ BUFFER_SIZE ] ; int lu ; while ( ( lu = ins . read ( buffer ) ) > 0 ) { outs . write ( buffer , 0 , lu ) ; } } } load ( file ) ; file . deleteOnExit ( ) ; } }
Loads a code file with the specified filename from the local file system as a dynamic library . The filename argument must be a complete path name .
6,572
private E readPoint ( int elementIndex , ShapeElementType type ) throws IOException { final boolean hasZ = type . hasZ ( ) ; final boolean hasM = type . hasM ( ) ; final double x = fromESRI_x ( readLEDouble ( ) ) ; final double y = fromESRI_y ( readLEDouble ( ) ) ; double z = 0 ; double measure = Double . NaN ; if ( hasZ ) { z = fromESRI_z ( readLEDouble ( ) ) ; } if ( hasM ) { measure = fromESRI_m ( readLEDouble ( ) ) ; } if ( ! Double . isNaN ( x ) && ! Double . isNaN ( y ) ) { return createPoint ( createAttributeCollection ( elementIndex ) , elementIndex , new ESRIPoint ( x , y , z , measure ) ) ; } return null ; }
Read a point .
6,573
@ SuppressWarnings ( { "checkstyle:cyclomaticcomplexity" , "checkstyle:npathcomplexity" } ) private E readPolyElement ( int elementIndex , ShapeElementType type ) throws IOException { final boolean hasZ = type . hasZ ( ) ; final boolean hasM = type . hasM ( ) ; skipBytes ( 8 * 4 ) ; final int numParts ; if ( type == ShapeElementType . MULTIPOINT || type == ShapeElementType . MULTIPOINT_Z || type == ShapeElementType . MULTIPOINT_M ) { numParts = 0 ; } else { numParts = readLEInt ( ) ; } final int numPoints = readLEInt ( ) ; final int [ ] parts = new int [ numParts ] ; for ( int idxParts = 0 ; idxParts < numParts ; ++ idxParts ) { parts [ idxParts ] = readLEInt ( ) ; } final ESRIPoint [ ] points = new ESRIPoint [ numPoints ] ; for ( int idxPoints = 0 ; idxPoints < numPoints ; ++ idxPoints ) { final double x = fromESRI_x ( readLEDouble ( ) ) ; final double y = fromESRI_y ( readLEDouble ( ) ) ; if ( ! Double . isNaN ( x ) && ! Double . isNaN ( y ) ) { points [ idxPoints ] = new ESRIPoint ( x , y ) ; } else { throw new ShapeFileException ( "invalid (x,y) coordinates" ) ; } } if ( hasZ ) { skipBytes ( 2 * 8 ) ; double z ; for ( int i = 0 ; i < numPoints ; ++ i ) { z = fromESRI_z ( readLEDouble ( ) ) ; if ( ! Double . isNaN ( z ) ) { points [ i ] . setZ ( z ) ; } } } if ( hasM ) { skipBytes ( 2 * 8 ) ; double measure ; for ( int i = 0 ; i < numPoints ; ++ i ) { measure = fromESRI_m ( readLEDouble ( ) ) ; if ( ! Double . isNaN ( measure ) ) { points [ i ] . setM ( measure ) ; } } } E newElement = null ; switch ( type ) { case POLYGON_Z : case POLYGON_M : case POLYGON : newElement = createPolygon ( createAttributeCollection ( elementIndex ) , elementIndex , parts , points , hasZ ) ; break ; case POLYLINE_Z : case POLYLINE_M : case POLYLINE : newElement = createPolyline ( createAttributeCollection ( elementIndex ) , elementIndex , parts , points , hasZ ) ; break ; case MULTIPOINT : case MULTIPOINT_M : case MULTIPOINT_Z : newElement = createMultiPoint ( createAttributeCollection ( elementIndex ) , elementIndex , points , hasZ ) ; break ; default : } return newElement ; }
Read a polyelement .
6,574
private E readMultiPatch ( int elementIndex , ShapeElementType type ) throws IOException { skipBytes ( 8 * 4 ) ; final int partCount = readLEInt ( ) ; final int pointCount = readLEInt ( ) ; final int [ ] parts = new int [ partCount ] ; for ( int idxParts = 0 ; idxParts < partCount ; ++ idxParts ) { parts [ idxParts ] = readLEInt ( ) ; } final ShapeMultiPatchType [ ] partTypes = new ShapeMultiPatchType [ partCount ] ; for ( int idxParts = 0 ; idxParts < partCount ; ++ idxParts ) { partTypes [ idxParts ] = ShapeMultiPatchType . fromESRIInteger ( readLEInt ( ) ) ; } final ESRIPoint [ ] points = new ESRIPoint [ pointCount ] ; for ( int idxPoints = 0 ; idxPoints < pointCount ; ++ idxPoints ) { final double x = fromESRI_x ( readLEDouble ( ) ) ; final double y = fromESRI_y ( readLEDouble ( ) ) ; if ( ! Double . isNaN ( x ) && ! Double . isNaN ( y ) ) { points [ idxPoints ] = new ESRIPoint ( x , y ) ; } else { throw new InvalidNumericValueException ( Double . isNaN ( x ) ? x : y ) ; } } skipBytes ( 2 * 8 ) ; double z ; for ( int i = 0 ; i < pointCount ; ++ i ) { z = fromESRI_z ( readLEDouble ( ) ) ; if ( ! Double . isNaN ( z ) ) { points [ i ] . setZ ( z ) ; } } skipBytes ( 2 * 8 ) ; double measure ; for ( int i = 0 ; i < pointCount ; ++ i ) { measure = fromESRI_m ( readLEDouble ( ) ) ; if ( ! Double . isNaN ( measure ) ) { points [ i ] . setM ( measure ) ; } } return createMultiPatch ( createAttributeCollection ( elementIndex ) , elementIndex , parts , partTypes , points ) ; }
Read a multipatch .
6,575
private void readAttributesFromDBaseFile ( E created_element ) throws IOException { if ( this . dbfReader != null ) { final List < DBaseFileField > dbfColumns = this . dbfReader . getDBFFields ( ) ; final DBaseFileRecord record = this . dbfReader . readNextDBFRecord ( ) ; if ( record != null ) { for ( final DBaseFileField dbfColumn : dbfColumns ) { if ( this . dbfReader . isColumnSelectable ( dbfColumn ) ) { final Object fieldValue = record . getFieldValue ( dbfColumn . getColumnIndex ( ) ) ; final AttributeValueImpl attr = new AttributeValueImpl ( ) ; attr . castAndSet ( dbfColumn . getAttributeType ( ) , fieldValue ) ; putAttributeIn ( created_element , dbfColumn . getName ( ) , attr ) ; } } } } }
Create the attribute values that correspond to the dBase content .
6,576
public static double noiseValue ( double value , MathFunction noiseLaw ) throws MathException { try { double noise = Math . abs ( noiseLaw . f ( value ) ) ; initRandomNumberList ( ) ; noise *= uniformRandomVariableList . nextFloat ( ) ; if ( uniformRandomVariableList . nextBoolean ( ) ) { noise = - noise ; } return value + noise ; } catch ( MathException e ) { return value ; } }
Add a noise to the specified value .
6,577
public void setRotation ( Quaternion rotation ) { this . m00 = 1.0f - 2.0f * rotation . getY ( ) * rotation . getY ( ) - 2.0f * rotation . getZ ( ) * rotation . getZ ( ) ; this . m10 = 2.0f * ( rotation . getX ( ) * rotation . getY ( ) + rotation . getW ( ) * rotation . getZ ( ) ) ; this . m20 = 2.0f * ( rotation . getX ( ) * rotation . getZ ( ) - rotation . getW ( ) * rotation . getY ( ) ) ; this . m01 = 2.0f * ( rotation . getX ( ) * rotation . getY ( ) - rotation . getW ( ) * rotation . getZ ( ) ) ; this . m11 = 1.0f - 2.0f * rotation . getX ( ) * rotation . getX ( ) - 2.0f * rotation . getZ ( ) * rotation . getZ ( ) ; this . m21 = 2.0f * ( rotation . getY ( ) * rotation . getZ ( ) + rotation . getW ( ) * rotation . getX ( ) ) ; this . m02 = 2.0f * ( rotation . getX ( ) * rotation . getZ ( ) + rotation . getW ( ) * rotation . getY ( ) ) ; this . m12 = 2.0f * ( rotation . getY ( ) * rotation . getZ ( ) - rotation . getW ( ) * rotation . getX ( ) ) ; this . m22 = 1.0f - 2.0f * rotation . getX ( ) * rotation . getX ( ) - 2.0f * rotation . getY ( ) * rotation . getY ( ) ; }
Set the rotation for the object but do not change the translation .
6,578
public final void makeRotationMatrix ( Quaternion rotation ) { this . m00 = 1.0f - 2.0f * rotation . getY ( ) * rotation . getY ( ) - 2.0f * rotation . getZ ( ) * rotation . getZ ( ) ; this . m10 = 2.0f * ( rotation . getX ( ) * rotation . getY ( ) + rotation . getW ( ) * rotation . getZ ( ) ) ; this . m20 = 2.0f * ( rotation . getX ( ) * rotation . getZ ( ) - rotation . getW ( ) * rotation . getY ( ) ) ; this . m01 = 2.0f * ( rotation . getX ( ) * rotation . getY ( ) - rotation . getW ( ) * rotation . getZ ( ) ) ; this . m11 = 1.0f - 2.0f * rotation . getX ( ) * rotation . getX ( ) - 2.0f * rotation . getZ ( ) * rotation . getZ ( ) ; this . m21 = 2.0f * ( rotation . getY ( ) * rotation . getZ ( ) + rotation . getW ( ) * rotation . getX ( ) ) ; this . m02 = 2.0f * ( rotation . getX ( ) * rotation . getZ ( ) + rotation . getW ( ) * rotation . getY ( ) ) ; this . m12 = 2.0f * ( rotation . getY ( ) * rotation . getZ ( ) - rotation . getW ( ) * rotation . getX ( ) ) ; this . m22 = 1.0f - 2.0f * rotation . getX ( ) * rotation . getX ( ) - 2.0f * rotation . getY ( ) * rotation . getY ( ) ; this . m03 = 0.0 ; this . m13 = 0.0 ; this . m23 = 0.0 ; this . m30 = 0.0 ; this . m31 = 0.0 ; this . m32 = 0.0 ; this . m33 = 1.0 ; }
Sets the value of this matrix to a rotation matrix and no translation .
6,579
void setPosition ( Point2D < ? , ? > position ) { this . location = position == null ? null : new SoftReference < > ( Point2d . convert ( position ) ) ; }
Set the temporary buffer of the position of the road connection .
6,580
void addConnectedSegment ( RoadPolyline segment , boolean attachToStartPoint ) { if ( segment == null ) { return ; } if ( this . connectedSegments . isEmpty ( ) ) { this . connectedSegments . add ( new Connection ( segment , attachToStartPoint ) ) ; } else { final double newSegmentAngle = computeAngle ( segment , attachToStartPoint ) ; final int insertionIndex = searchInsertionIndex ( newSegmentAngle , 0 , this . connectedSegments . size ( ) - 1 ) ; this . connectedSegments . add ( insertionIndex , new Connection ( segment , attachToStartPoint ) ) ; } fireIteratorUpdate ( ) ; }
Add a segment to this connection point .
6,581
int removeConnectedSegment ( RoadSegment segment , boolean attachToStartPoint ) { if ( segment == null ) { return - 1 ; } final int idx = indexOf ( segment , attachToStartPoint ) ; if ( idx != - 1 ) { this . connectedSegments . remove ( idx ) ; fireIteratorUpdate ( ) ; } return idx ; }
Remove a connection with a segment .
6,582
protected void addListeningIterator ( IClockwiseIterator iterator ) { if ( this . listeningIterators == null ) { this . listeningIterators = new WeakArrayList < > ( ) ; } this . listeningIterators . add ( iterator ) ; }
Add a listening iterator .
6,583
protected void removeListeningIterator ( IClockwiseIterator iterator ) { if ( this . listeningIterators != null ) { this . listeningIterators . remove ( iterator ) ; if ( this . listeningIterators . isEmpty ( ) ) { this . listeningIterators = null ; } } }
Remove a listening iterator .
6,584
protected void fireIteratorUpdate ( ) { if ( this . listeningIterators != null ) { for ( final IClockwiseIterator iterator : this . listeningIterators ) { if ( iterator != null ) { iterator . dataStructureUpdated ( ) ; } } } }
Notify the iterators about changes .
6,585
public static int getPreferredRoadColor ( RoadType roadType , boolean useSystemValue ) { final RoadType rt = roadType == null ? RoadType . OTHER : roadType ; final Preferences prefs = Preferences . userNodeForPackage ( RoadNetworkLayerConstants . class ) ; if ( prefs != null ) { final String str = prefs . get ( "ROAD_COLOR_" + rt . name ( ) . toUpperCase ( ) , null ) ; if ( str != null ) { try { return Integer . valueOf ( str ) ; } catch ( Throwable exception ) { } } } if ( useSystemValue ) { return DEFAULT_ROAD_COLORS [ rt . ordinal ( ) * 2 ] ; } return 0 ; }
Replies the preferred color to draw the content of the roads of the given type .
6,586
public static void setPreferredRoadColor ( RoadType roadType , Integer color ) { final RoadType rt = roadType == null ? RoadType . OTHER : roadType ; final Preferences prefs = Preferences . userNodeForPackage ( RoadNetworkLayerConstants . class ) ; if ( prefs != null ) { if ( color == null || color . intValue ( ) == DEFAULT_ROAD_COLORS [ rt . ordinal ( ) * 2 ] ) { prefs . remove ( "ROAD_COLOR_" + rt . name ( ) . toUpperCase ( ) ) ; } else { prefs . put ( "ROAD_COLOR_" + rt . name ( ) . toUpperCase ( ) , Integer . toString ( color . intValue ( ) ) ) ; } try { prefs . flush ( ) ; } catch ( BackingStoreException exception ) { } } }
Set the preferred color to draw the content of the roads of the given type .
6,587
public static boolean getPreferredRoadInternDrawing ( ) { final Preferences prefs = Preferences . userNodeForPackage ( RoadNetworkLayerConstants . class ) ; if ( prefs != null ) { return prefs . getBoolean ( "ROAD_INTERN_DRAWING" , DEFAULT_ROAD_INTERN_DRAWING ) ; } return DEFAULT_ROAD_INTERN_DRAWING ; }
Replies if the internal data structure used to store the road network may be drawn on the displayers .
6,588
public static void setPreferredRoadInternDrawing ( Boolean draw ) { final Preferences prefs = Preferences . userNodeForPackage ( RoadNetworkLayerConstants . class ) ; if ( prefs != null ) { if ( draw == null ) { prefs . remove ( "ROAD_INTERN_DRAWING" ) ; } else { prefs . putBoolean ( "ROAD_INTERN_DRAWING" , draw ) ; } try { prefs . flush ( ) ; } catch ( BackingStoreException exception ) { } } }
Set if the internal data structure used to store the road network may be drawn on the displayers .
6,589
public static int getPreferredRoadInternColor ( ) { final Preferences prefs = Preferences . userNodeForPackage ( RoadNetworkLayerConstants . class ) ; if ( prefs != null ) { final String color = prefs . get ( "ROAD_INTERN_COLOR" , null ) ; if ( color != null ) { try { return Integer . valueOf ( color ) ; } catch ( Throwable exception ) { } } } return DEFAULT_ROAD_INTERN_COLOR ; }
Replies the color of the internal data structures used when they are drawn on the displayers .
6,590
public static void setPreferredRoadInternColor ( Integer color ) { final Preferences prefs = Preferences . userNodeForPackage ( RoadNetworkLayerConstants . class ) ; if ( prefs != null ) { if ( color == null ) { prefs . remove ( "ROAD_INTERN_COLOR" ) ; } else { prefs . put ( "ROAD_INTERN_COLOR" , Integer . toString ( color . intValue ( ) ) ) ; } try { prefs . flush ( ) ; } catch ( BackingStoreException exception ) { } } }
Set the color of the internal data structures used when they are drawn on the displayers .
6,591
public static double clamp ( double v , double min , double max ) { assert min <= max : AssertMessages . lowerEqualParameters ( 1 , min , 2 , max ) ; if ( v < min ) { return min ; } if ( v > max ) { return max ; } return v ; }
Clamp the given value to the given range .
6,592
public static double clampCyclic ( double value , double min , double max ) { assert min <= max : AssertMessages . lowerEqualParameters ( 1 , min , 2 , max ) ; if ( Double . isNaN ( max ) || Double . isNaN ( min ) || Double . isNaN ( max ) ) { return Double . NaN ; } if ( value < min ) { final double perimeter = max - min ; final double nvalue = min - value ; double rest = perimeter - ( nvalue % perimeter ) ; if ( rest >= perimeter ) { rest -= perimeter ; } return min + rest ; } else if ( value >= max ) { final double perimeter = max - min ; final double nvalue = value - max ; final double rest = nvalue % perimeter ; return min + rest ; } return value ; }
Clamp the given value to fit between the min and max values according to a cyclic heuristic . If the given value is not between the minimum and maximum values the replied value is modulo the min - max range .
6,593
public static DoubleRange getMinMax ( double value1 , double value2 , double value3 ) { final double min ; final double max ; if ( value1 <= value2 ) { if ( value1 <= value3 ) { min = value1 ; if ( value2 <= value3 ) { max = value3 ; } else { max = value2 ; } } else { max = value2 ; if ( Double . isNaN ( value3 ) ) { min = value1 ; } else { min = value3 ; } } } else { if ( value1 <= value3 ) { max = value3 ; if ( Double . isNaN ( value2 ) ) { min = value1 ; } else { min = value2 ; } } else if ( Double . isNaN ( value1 ) ) { if ( value2 <= value3 ) { min = value2 ; max = value3 ; } else if ( Double . isNaN ( value2 ) ) { if ( Double . isNaN ( value3 ) ) { return null ; } min = value3 ; max = min ; } else if ( Double . isNaN ( value3 ) ) { min = value2 ; max = min ; } else { min = value3 ; max = value2 ; } } else if ( Double . isNaN ( value3 ) ) { if ( Double . isNaN ( value2 ) ) { min = value1 ; max = min ; } else { min = value2 ; max = value1 ; } } else { max = value1 ; if ( value2 <= value3 ) { min = value2 ; } else { min = value3 ; } } } return new DoubleRange ( min , max ) ; }
Determine the min and max values from a set of three values .
6,594
@ Inline ( value = "1./Math.sin($1)" , imported = { Math . class } ) public static double csc ( double angle ) { return 1. / Math . sin ( angle ) ; }
Replies the cosecant of the specified angle .
6,595
@ Inline ( value = "1./Math.cos($1)" , imported = { Math . class } ) public static double sec ( double angle ) { return 1. / Math . cos ( angle ) ; }
Replies the secant of the specified angle .
6,596
@ Inline ( value = "1./Math.tan($1)" , imported = { Math . class } ) public static double cot ( double angle ) { return 1. / Math . tan ( angle ) ; }
Replies the cotangent of the specified angle .
6,597
@ Inline ( value = "1.-Math.cos($1)" , imported = { Math . class } ) public static double versin ( double angle ) { return 1. - Math . cos ( angle ) ; }
Replies the versine of the specified angle .
6,598
@ Inline ( value = "2.*Math.sin(($1)/2.)" , imported = { Math . class } ) public static double crd ( double angle ) { return 2. * Math . sin ( angle / 2. ) ; }
Replies the chord of the specified angle .
6,599
public static Point2dfx convert ( Tuple2D < ? > tuple ) { if ( tuple instanceof Point2dfx ) { return ( Point2dfx ) tuple ; } return new Point2dfx ( tuple . getX ( ) , tuple . getY ( ) ) ; }
Convert the given tuple to a real Point2dfx .