idx
int64
0
165k
question
stringlengths
73
5.81k
target
stringlengths
5
918
5,900
public static Vector2dfx convert ( Tuple2D < ? > tuple ) { if ( tuple instanceof Vector2dfx ) { return ( Vector2dfx ) tuple ; } return new Vector2dfx ( tuple . getX ( ) , tuple . getY ( ) ) ; }
Convert the given tuple to a real Vector2dfx .
5,901
public static Point2d convert ( Tuple2D < ? > tuple ) { if ( tuple instanceof Point2d ) { return ( Point2d ) tuple ; } return new Point2d ( tuple . getX ( ) , tuple . getY ( ) ) ; }
Convert the given tuple to a real Point2d .
5,902
public static < R , C , V , C2 > ImmutableTable < R , C2 , V > columnTransformerByCell ( final Table < R , C , V > table , final Function < Table . Cell < R , C , V > , C2 > columnTransformer ) { final ImmutableTable . Builder < R , C2 , V > newTable = ImmutableTable . builder ( ) ; for ( Table . Cell < R , C , V > cel...
columnTransformer has access to Key Value information in each Table . Cell
5,903
public static double setDistanceEpsilon ( double newPrecisionValue ) { if ( ( newPrecisionValue >= 1 ) || ( newPrecisionValue <= 0 ) ) { throw new IllegalArgumentException ( ) ; } final double old = distancePrecision ; distancePrecision = newPrecisionValue ; return old ; }
Replies the precision used to test a distance value .
5,904
public static boolean epsilonEqualsDistance ( double value1 , double value2 ) { return value1 >= ( value2 - distancePrecision ) && value1 <= ( value2 + distancePrecision ) ; }
Replies if the specified distances are approximatively equal .
5,905
public static int epsilonCompareToDistance ( double distance1 , double distance2 ) { final double min = distance2 - distancePrecision ; final double max = distance2 + distancePrecision ; if ( distance1 >= min && distance1 <= max ) { return 0 ; } if ( distance1 < min ) { return - 1 ; } return 1 ; }
Replies if the specified distances are approximatively equal less or greater than .
5,906
public static String makeInternalId ( float x , float y ) { final StringBuilder buf = new StringBuilder ( "point" ) ; buf . append ( x ) ; buf . append ( ';' ) ; buf . append ( y ) ; return Encryption . md5 ( buf . toString ( ) ) ; }
Compute and replies the internal identifier that may be used to create a GeoId from the given point .
5,907
public static String makeInternalId ( UUID uid ) { final StringBuilder buf = new StringBuilder ( "nowhere(?" ) ; buf . append ( uid . toString ( ) ) ; buf . append ( "?)" ) ; return Encryption . md5 ( buf . toString ( ) ) ; }
Compute and replies the internal identifier that may be used to create a GeoId from the given identifier . The replied identifier is not geolocalized .
5,908
public static String makeInternalId ( float minx , float miny , float maxx , float maxy ) { final StringBuilder buf = new StringBuilder ( "rectangle" ) ; buf . append ( '(' ) ; buf . append ( minx ) ; buf . append ( ';' ) ; buf . append ( miny ) ; buf . append ( ")-(" ) ; buf . append ( maxx ) ; buf . append ( ';' ) ; ...
Compute and replies the internal identifier that may be used to create a GeoId from the given rectangle .
5,909
public static String get2BitCrid ( String str ) { if ( str != null ) { String crid = LookupCodes . lookupCode ( "CRID" , str , "DSSAT" ) ; if ( crid . equals ( str ) && crid . length ( ) > 2 ) { crid = def2BitVal ; } return crid . toUpperCase ( ) ; } else { return def2BitVal ; } }
get 2 - bit version of crop id by given string
5,910
public static String get3BitCrid ( String str ) { if ( str != null ) { return LookupCodes . lookupCode ( "CRID" , str , "code" , "DSSAT" ) . toUpperCase ( ) ; } else { return def3BitVal ; } }
get 3 - bit version of crop id by given string
5,911
private static CharBuffer decodeString ( byte [ ] bytes , Charset charset , int referenceLength ) { try { final Charset autodetectedCharset ; final CharsetDecoder decoder = charset . newDecoder ( ) ; final CharBuffer buffer = decoder . decode ( ByteBuffer . wrap ( bytes ) ) ; if ( ( decoder . isAutoDetecting ( ) ) && (...
Decode the specified array of bytes with the specified charset .
5,912
public Iterator < E > iterator ( Rectangle2afp < ? , ? , ? , ? , ? , ? > bounds ) { return new BoundedElementIterator < > ( bounds , iterator ( ) ) ; }
Iterates on the elements that intersect the specified bounds .
5,913
protected HashMap readFile ( HashMap brMap ) throws IOException { HashMap ret = new HashMap ( ) ; ArrayList < HashMap > expArr = new ArrayList < HashMap > ( ) ; HashMap < String , HashMap > files = readObvData ( brMap ) ; ArrayList < HashMap > obvData ; HashMap obv ; HashMap expData ; for ( String exname : files . keyS...
DSSAT TFile Data input method for Controller using
5,914
public Path normalizeOutputPath ( FileResource resource ) { Path resourcePath = resource . getPath ( ) ; Path rel = Optional . ofNullable ( ( contentDir . relativize ( resourcePath ) ) . getParent ( ) ) . orElseGet ( ( ) -> resourcePath . getFileSystem ( ) . getPath ( "" ) ) ; String finalOutput = rel . resolve ( final...
Generate the output path given the resource and the output dir .
5,915
public void setModel ( Progression model ) { this . model . removeProgressionListener ( new WeakListener ( this , this . model ) ) ; if ( model == null ) { this . model = new DefaultProgression ( ) ; } else { this . model = model ; } this . previousValue = this . model . getValue ( ) ; this . model . addProgressionList...
Change the task progression model .
5,916
@ SuppressWarnings ( "static-method" ) protected String buildMessage ( double progress , String comment , boolean isRoot , boolean isFinished , NumberFormat numberFormat ) { final StringBuilder txt = new StringBuilder ( ) ; txt . append ( '[' ) ; txt . append ( numberFormat . format ( progress ) ) ; txt . append ( "] "...
Build the logging message from the given data . This function is defined for enabling overriding in sub classes .
5,917
public boolean setLeftChild ( N newChild ) { final N oldChild = this . left ; if ( oldChild == newChild ) { return false ; } if ( oldChild != null ) { oldChild . setParentNodeReference ( null , true ) ; -- this . notNullChildCount ; firePropertyChildRemoved ( 0 , oldChild ) ; } if ( newChild != null ) { final N oldPare...
Set the left child of this node .
5,918
public boolean setMiddleChild ( N newChild ) { final N oldChild = this . middle ; if ( oldChild == newChild ) { return false ; } if ( oldChild != null ) { oldChild . setParentNodeReference ( null , true ) ; -- this . notNullChildCount ; firePropertyChildRemoved ( 1 , oldChild ) ; } if ( newChild != null ) { final N old...
Set the middle child of this node .
5,919
public boolean hasChild ( N potentialChild ) { if ( ( this . left == potentialChild ) || ( this . middle == potentialChild ) || ( this . right == potentialChild ) ) { return true ; } return false ; }
Returns true if the specified node is effectively a child of this node false otherwise .
5,920
protected void getHeights ( int currentHeight , List < Integer > heights ) { if ( isLeaf ( ) ) { heights . add ( new Integer ( currentHeight ) ) ; } else { if ( this . left != null ) { this . left . getHeights ( currentHeight + 1 , heights ) ; } if ( this . middle != null ) { this . middle . getHeights ( currentHeight ...
Replies the heights of all the leaf nodes . The order of the heights is given by a depth - first iteration .
5,921
private static Iterable < List < Map . Entry < Symbol , File > > > splitToNChunks ( final ImmutableMap < Symbol , File > inputMap , int numChunks ) { checkArgument ( numChunks > 0 ) ; final List < Map . Entry < Symbol , File > > emptyChunk = ImmutableList . of ( ) ; if ( inputMap . isEmpty ( ) ) { return Collections . ...
If there are fewer files than chunks fewer than numChunks will be returned .
5,922
private static ImmutableMap < Symbol , File > loadDocIdToFileMap ( final Optional < File > inputFileListFile , final Optional < File > inputFileMapFile ) throws IOException { checkArgument ( inputFileListFile . isPresent ( ) || inputFileMapFile . isPresent ( ) ) ; final Optional < ImmutableList < File > > fileList ; if...
Gets a doc - id - to - file map for the input either directly or making a fake one based on an input file list .
5,923
public void writeFile ( String arg0 , Map result ) { HashMap culData ; ArrayList < HashMap > culArr ; BufferedWriter bwC ; StringBuilder sbData = new StringBuilder ( ) ; try { setDefVal ( ) ; culData = getObjectOr ( result , "dssat_cultivar_info" , new HashMap ( ) ) ; culArr = getObjectOr ( culData , "data" , new Array...
DSSAT Cultivar Data Output method
5,924
public static CodepointMatcher anyOf ( final String sequence ) { switch ( sequence . length ( ) ) { case 0 : return none ( ) ; case 1 : return is ( sequence ) ; default : return new AnyOf ( sequence ) ; } }
Matches any character in the sequence
5,925
public final String removeFrom ( String s ) { final StringBuilder sb = new StringBuilder ( ) ; for ( int offset = 0 ; offset < s . length ( ) ; ) { final int codePoint = s . codePointAt ( offset ) ; if ( ! matches ( codePoint ) ) { sb . appendCodePoint ( codePoint ) ; } offset += Character . charCount ( codePoint ) ; }...
Returns a copy of the input string with all Unicode codepoints matching this matcher removed
5,926
public final String trimFrom ( String s ) { int first ; int last ; for ( first = 0 ; first < s . length ( ) ; ) { final int codePoint = s . codePointAt ( first ) ; if ( ! matches ( codePoint ) ) { break ; } first += Character . charCount ( codePoint ) ; } for ( last = s . length ( ) - 1 ; last >= first ; -- last ) { if...
Returns a copy of the input string with all leading and trailing codepoints matching this matcher removed
5,927
private UTF16Offset codeUnitOffsetFor ( final CharOffset codePointOffset ) { int charOffset = 0 ; int codePointsConsumed = 0 ; for ( ; charOffset < utf16CodeUnits ( ) . length ( ) && codePointsConsumed < codePointOffset . asInt ( ) ; ++ codePointsConsumed ) { final int codePoint = utf16CodeUnits ( ) . codePointAt ( cha...
something like LocatedString s like CharacterRegions
5,928
public static void expandAll ( JTree tree , TreePath path , boolean expand ) { TreeNode node = ( TreeNode ) path . getLastPathComponent ( ) ; if ( node . getChildCount ( ) >= 0 ) { Enumeration < ? > enumeration = node . children ( ) ; while ( enumeration . hasMoreElements ( ) ) { TreeNode n = ( TreeNode ) enumeration ....
Expand all nodes recursive
5,929
protected void fireValidityChangedFor ( Object changedObject , int index , BusPrimitiveInvalidity oldReason , BusPrimitiveInvalidity newReason ) { resetBoundingBox ( ) ; final BusChangeEvent event = new BusChangeEvent ( this , BusChangeEventType . VALIDITY , changedObject , index , "validity" , oldReason , newReason ) ...
Fire the event that indicates the validity of the object has changed .
5,930
public int getColor ( int defaultColor ) { final Integer c = getRawColor ( ) ; if ( c != null ) { return c ; } final BusContainer < ? > container = getContainer ( ) ; if ( container != null ) { return container . getColor ( ) ; } return defaultColor ; }
Replies the color of this element or the color of the container .
5,931
@ SuppressWarnings ( "unlikely-arg-type" ) protected final void setPrimitiveValidity ( BusPrimitiveInvalidity invalidityReason ) { if ( ( invalidityReason == null && this . invalidityReason != null ) || ( invalidityReason != null && ! invalidityReason . equals ( BusPrimitiveInvalidityType . VALIDITY_NOT_CHECKED ) && ! ...
Set if this component has invalid or not .
5,932
public UnitVectorProperty secondAxisProperty ( ) { if ( this . saxis == null ) { this . saxis = new UnitVectorProperty ( this , MathFXAttributeNames . SECOND_AXIS , getGeomFactory ( ) ) ; } return this . saxis ; }
Replies the property for the second axis .
5,933
public DoubleProperty firstAxisExtentProperty ( ) { if ( this . extentR == null ) { this . extentR = new SimpleDoubleProperty ( this , MathFXAttributeNames . FIRST_AXIS_EXTENT ) { protected void invalidated ( ) { if ( get ( ) < 0. ) { set ( 0. ) ; } } } ; } return this . extentR ; }
Replies the property for the extent of the first axis .
5,934
public DoubleProperty secondAxisExtentProperty ( ) { if ( this . extentS == null ) { this . extentS = new SimpleDoubleProperty ( this , MathFXAttributeNames . SECOND_AXIS_EXTENT ) { protected void invalidated ( ) { if ( get ( ) < 0. ) { set ( 0. ) ; } } } ; } return this . extentS ; }
Replies the property for the extent of the second axis .
5,935
public View < ? , ? > getRootParentView ( ) { View < ? , ? > currentView = this ; while ( currentView . hasParent ( ) ) { currentView = currentView . getParent ( ) ; } return currentView ; }
Gets the root parent view .
5,936
public Optional < CoreNLPParseNode > terminalHead ( ) { if ( terminal ( ) ) { return Optional . of ( this ) ; } if ( immediateHead ( ) . isPresent ( ) ) { return immediateHead ( ) . get ( ) . terminalHead ( ) ; } return Optional . absent ( ) ; }
Resolves a head down to a terminal node . A terminal node is its own head here .
5,937
public static AbstractPathElement3D newInstance ( PathElementType type , Point3d last , Point3d [ ] coords ) { switch ( type ) { case MOVE_TO : return new MovePathElement3d ( coords [ 0 ] ) ; case LINE_TO : return new LinePathElement3d ( last , coords [ 0 ] ) ; case QUAD_TO : return new QuadPathElement3d ( last , coord...
Create an instance of path element associating properties of points to the PathElement .
5,938
protected void extractConfigValues ( Map < String , Object > yaml , List < ConfigMetadataNode > configs ) { for ( final ConfigMetadataNode config : configs ) { Configs . defineConfig ( yaml , config , this . injector ) ; } }
Extract the definition from the given configurations .
5,939
@ SuppressWarnings ( "static-method" ) protected String generateYaml ( Map < String , Object > map ) throws JsonProcessingException { final YAMLFactory yamlFactory = new YAMLFactory ( ) ; yamlFactory . configure ( Feature . WRITE_DOC_START_MARKER , false ) ; final ObjectMapper mapper = new ObjectMapper ( yamlFactory ) ...
Generate the Yaml representation of the given map .
5,940
@ SuppressWarnings ( "static-method" ) protected String generateJson ( Map < String , Object > map ) throws JsonProcessingException { final ObjectMapper mapper = new ObjectMapper ( ) ; return mapper . writerWithDefaultPrettyPrinter ( ) . writeValueAsString ( map ) ; }
Generate the Json representation of the given map .
5,941
@ SuppressWarnings ( { "static-method" } ) protected String generateXml ( Map < String , Object > map ) throws JsonProcessingException { final XmlMapper mapper = new XmlMapper ( ) ; return mapper . writerWithDefaultPrettyPrinter ( ) . withRootName ( XML_ROOT_NAME ) . writeValueAsString ( map ) ; }
Generate the Xml representation of the given map .
5,942
@ SuppressWarnings ( "unchecked" ) private void parseOptionsFromFile ( String optionFileName ) throws ParseException { List < String > options = OptionsFileLoader . loadOptions ( optionFileName ) ; options . addAll ( commandLine . getArgList ( ) ) ; commandLine = cliParser . parse ( cliOptions , options . toArray ( new...
Parse options from a file . Reload commandLine that after calling this method contains both options coming from the command line and from the file .
5,943
void disconnect ( ) { final DefaultProgression parentInstance = getParent ( ) ; if ( parentInstance != null ) { parentInstance . disconnectSubTask ( this , this . maxValueInParent , this . overwriteCommentWhenDisconnect ) ; } this . parent = null ; }
Set the parent value and disconnect this subtask from its parent .
5,944
private void initOptions ( ) { List < CLIOption > options = new ArrayList < CLIOption > ( ) ; options . addAll ( Arrays . asList ( ProxyDestroyOptions . values ( ) ) ) ; initOptions ( options ) ; }
Initialize options .
5,945
@ SuppressWarnings ( "checkstyle:cyclomaticcomplexity" ) void updateSizes ( int fieldLength , int decimalPointPosition ) { switch ( this . type ) { case STRING : if ( fieldLength > this . length ) { this . length = fieldLength ; } break ; case FLOATING_NUMBER : case NUMBER : if ( decimalPointPosition > this . decimal )...
Update the sizes with the given ones if and only if they are greater than the existing ones . This test is done according to the type of the field .
5,946
public int compare ( HashMap m1 , HashMap m2 ) { double val1 ; double val2 ; for ( String sortId : sortIds ) { val1 = getValue ( m1 , sortId ) ; val2 = getValue ( m2 , sortId ) ; if ( val1 > val2 ) { return decVal ; } else if ( val1 < val2 ) { return ascVal ; } } return 0 ; }
Compare two element in the array by using sorting IDs .
5,947
private double getValue ( HashMap m , String key ) { try { return Double . parseDouble ( getValueOr ( m , key , "" ) ) ; } catch ( Exception e ) { return Double . MIN_VALUE ; } }
Get number value by using key from map
5,948
protected void onNext ( ) { stateMachine . next ( ) ; updateButtonState ( ) ; final String name = getStateMachine ( ) . getCurrentState ( ) . getName ( ) ; final CardLayout cardLayout = getWizardContentPanel ( ) . getCardLayout ( ) ; cardLayout . show ( getWizardContentPanel ( ) , name ) ; }
Callback method for the next action .
5,949
protected void onPrevious ( ) { stateMachine . previous ( ) ; updateButtonState ( ) ; final String name = getStateMachine ( ) . getCurrentState ( ) . getName ( ) ; final CardLayout cardLayout = getWizardContentPanel ( ) . getCardLayout ( ) ; cardLayout . show ( getWizardContentPanel ( ) , name ) ; }
Callback method for the previous action .
5,950
protected void updateButtonState ( ) { getNavigationPanel ( ) . getBtnPrevious ( ) . setEnabled ( getStateMachine ( ) . getCurrentState ( ) . hasPrevious ( ) ) ; getNavigationPanel ( ) . getBtnNext ( ) . setEnabled ( getStateMachine ( ) . getCurrentState ( ) . hasNext ( ) ) ; }
Update the button states . Overwrite this method for activate or disable the navigation buttons .
5,951
public final void conjugate ( Quaternion q1 ) { this . x = - q1 . x ; this . y = - q1 . y ; this . z = - q1 . z ; this . w = q1 . w ; }
Sets the value of this quaternion to the conjugate of quaternion q1 .
5,952
public final void inverse ( Quaternion q1 ) { double norm ; norm = 1f / ( q1 . w * q1 . w + q1 . x * q1 . x + q1 . y * q1 . y + q1 . z * q1 . z ) ; this . w = norm * q1 . w ; this . x = - norm * q1 . x ; this . y = - norm * q1 . y ; this . z = - norm * q1 . z ; }
Sets the value of this quaternion to quaternion inverse of quaternion q1 .
5,953
public final void inverse ( ) { double norm ; norm = 1f / ( this . w * this . w + this . x * this . x + this . y * this . y + this . z * this . z ) ; this . w *= norm ; this . x *= - norm ; this . y *= - norm ; this . z *= - norm ; }
Sets the value of this quaternion to the quaternion inverse of itself .
5,954
public final void normalize ( Quaternion q1 ) { double norm ; norm = ( q1 . x * q1 . x + q1 . y * q1 . y + q1 . z * q1 . z + q1 . w * q1 . w ) ; if ( norm > 0f ) { norm = 1f / Math . sqrt ( norm ) ; this . x = norm * q1 . x ; this . y = norm * q1 . y ; this . z = norm * q1 . z ; this . w = norm * q1 . w ; } else { this...
Sets the value of this quaternion to the normalized value of quaternion q1 .
5,955
public final void normalize ( ) { double norm ; norm = ( this . x * this . x + this . y * this . y + this . z * this . z + this . w * this . w ) ; if ( norm > 0f ) { norm = 1f / Math . sqrt ( norm ) ; this . x *= norm ; this . y *= norm ; this . z *= norm ; this . w *= norm ; } else { this . x = 0f ; this . y = 0f ; th...
Normalizes the value of this quaternion in place .
5,956
public final void setFromMatrix ( Matrix4f m1 ) { double ww = 0.25f * ( m1 . m00 + m1 . m11 + m1 . m22 + m1 . m33 ) ; if ( ww >= 0 ) { if ( ww >= EPS2 ) { this . w = Math . sqrt ( ww ) ; ww = 0.25f / this . w ; this . x = ( m1 . m21 - m1 . m12 ) * ww ; this . y = ( m1 . m02 - m1 . m20 ) * ww ; this . z = ( m1 . m10 - m...
Sets the value of this quaternion to the rotational component of the passed matrix .
5,957
public final Vector3f getAxis ( ) { double mag = this . x * this . x + this . y * this . y + this . z * this . z ; if ( mag > EPS ) { mag = Math . sqrt ( mag ) ; double invMag = 1f / mag ; return new Vector3f ( this . x * invMag , this . y * invMag , this . z * invMag ) ; } return new Vector3f ( 0f , 0f , 1f ) ; }
Replies the rotation axis - angle represented by this quaternion .
5,958
public final double getAngle ( ) { double mag = this . x * this . x + this . y * this . y + this . z * this . z ; if ( mag > EPS ) { mag = Math . sqrt ( mag ) ; return ( 2.f * Math . atan2 ( mag , this . w ) ) ; } return 0f ; }
Replies the rotation angle represented by this quaternion .
5,959
@ SuppressWarnings ( "synthetic-access" ) public final AxisAngle getAxisAngle ( ) { double mag = this . x * this . x + this . y * this . y + this . z * this . z ; if ( mag > EPS ) { mag = Math . sqrt ( mag ) ; double invMag = 1f / mag ; return new AxisAngle ( this . x * invMag , this . y * invMag , this . z * invMag , ...
Replies the rotation axis represented by this quaternion .
5,960
public final void interpolate ( Quaternion q1 , double alpha ) { double dot , s1 , s2 , om , sinom ; dot = this . x * q1 . x + this . y * q1 . y + this . z * q1 . z + this . w * q1 . w ; if ( dot < 0 ) { q1 . x = - q1 . x ; q1 . y = - q1 . y ; q1 . z = - q1 . z ; q1 . w = - q1 . w ; dot = - dot ; } if ( ( 1.0 - dot ) >...
Performs a great circle interpolation between this quaternion and the quaternion parameter and places the result into this quaternion .
5,961
@ SuppressWarnings ( "synthetic-access" ) public EulerAngles getEulerAngles ( CoordinateSystem3D system ) { Quaternion q = new Quaternion ( this ) ; system . toSystem ( q , CoordinateSystem3D . XZY_RIGHT_HAND ) ; double sqw = q . w * q . w ; double sqx = q . x * q . x ; double sqy = q . y * q . y ; double sqz = q . z *...
Replies the Euler s angles that corresponds to the quaternion .
5,962
public static void writeRoadNetwork ( Element xmlNode , RoadNetwork primitive , URL geometryURL , MapMetricProjection mapProjection , URL attributeURL , XMLBuilder builder , PathBuilder pathBuilder , XMLResources resources ) throws IOException { final ContainerWrapper w = new ContainerWrapper ( primitive ) ; w . setEle...
Write the XML description for the given container of roads .
5,963
@ SuppressWarnings ( "static-method" ) protected void printSynopsis ( HelpAppender out , String name , String argumentSynopsis ) { out . printSectionName ( SYNOPSIS ) ; assert name != null ; if ( Strings . isNullOrEmpty ( argumentSynopsis ) ) { out . printText ( name , OPTION_SYNOPSIS ) ; } else { out . printText ( nam...
Print the synopsis of the command .
5,964
@ SuppressWarnings ( "static-method" ) protected void printDetailedDescription ( SynopsisHelpAppender out , String detailedDescription ) { if ( ! Strings . isNullOrEmpty ( detailedDescription ) ) { out . printSectionName ( DETAILED_DESCRIPTION ) ; out . printLongDescription ( detailedDescription . split ( "[\r\n\f]+" )...
Print the detailed description of the command .
5,965
protected Drawer < ? super T > draw ( ZoomableGraphicsContext gc , GISElementContainer < T > primitive , Drawer < ? super T > drawer ) { Drawer < ? super T > drw = drawer ; final Iterator < T > iterator = primitive . iterator ( gc . getVisibleArea ( ) ) ; while ( iterator . hasNext ( ) ) { final T mapelement = iterator...
Draw the primitive with the given drawer .
5,966
public static boolean intersectsSolidSphereOrientedBox ( double sphereCenterx , double sphereCentery , double sphereCenterz , double sphereRadius , double boxCenterx , double boxCentery , double boxCenterz , double boxAxis1x , double boxAxis1y , double boxAxis1z , double boxAxis2x , double boxAxis2y , double boxAxis2z ...
Replies if the specified box intersects the specified sphere .
5,967
public static boolean intersectsSphereCapsule ( double sphereCenterx , double sphereCentery , double sphereCenterz , double sphereRadius , double capsuleAx , double capsuleAy , double capsuleAz , double capsuleBx , double capsuleBy , double capsuleBz , double capsuleRadius ) { double dist2 = AbstractSegment3F . distanc...
Replies if the specified sphere intersects the specified capsule .
5,968
public static boolean containsSpherePoint ( double cx , double cy , double cz , double radius , double px , double py , double pz ) { return FunctionalPoint3D . distanceSquaredPointPoint ( px , py , pz , cx , cy , cz ) <= ( radius * radius ) ; }
Replies if the given point is inside the given sphere .
5,969
public static boolean containsSphereAlignedBox ( double cx , double cy , double cz , double radius , double bx , double by , double bz , double bsx , double bsy , double bsz ) { double rcx = ( bx + bsx / 2f ) ; double rcy = ( by + bsy / 2f ) ; double rcz = ( bz + bsz / 2f ) ; double farX ; if ( cx <= rcx ) farX = bx + ...
Replies if an aligned box is inside in the sphere .
5,970
public static boolean intersectsSphereSphere ( double x1 , double y1 , double z1 , double radius1 , double x2 , double y2 , double z2 , double radius2 ) { double r = radius1 + radius2 ; return FunctionalPoint3D . distanceSquaredPointPoint ( x1 , y1 , z1 , x2 , y2 , z2 ) < ( r * r ) ; }
Replies if two spheres are intersecting .
5,971
public static boolean intersectsSphereLine ( double x1 , double y1 , double z1 , double radius , double x2 , double y2 , double z2 , double x3 , double y3 , double z3 ) { double d = AbstractSegment3F . distanceSquaredLinePoint ( x2 , y2 , z2 , x3 , y3 , z3 , x1 , y1 , z1 ) ; return d < ( radius * radius ) ; }
Replies if a sphere and a line are intersecting .
5,972
public static boolean intersectsSphereSegment ( double x1 , double y1 , double z1 , double radius , double x2 , double y2 , double z2 , double x3 , double y3 , double z3 ) { double d = AbstractSegment3F . distanceSquaredSegmentPoint ( x2 , y2 , z2 , x3 , y3 , z3 , x1 , y1 , z1 ) ; return d < ( radius * radius ) ; }
Replies if a sphere and a segment are intersecting .
5,973
protected String encodeCookie ( SerializableHttpCookie cookie ) { if ( cookie == null ) return null ; ByteArrayOutputStream os = new ByteArrayOutputStream ( ) ; try { ObjectOutputStream outputStream = new ObjectOutputStream ( os ) ; outputStream . writeObject ( cookie ) ; } catch ( IOException e ) { Util . log ( "IOExc...
Serializes Cookie object into String
5,974
protected Cookie decodeCookie ( String cookieString ) { byte [ ] bytes = hexStringToByteArray ( cookieString ) ; ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream ( bytes ) ; Cookie cookie = null ; try { ObjectInputStream objectInputStream = new ObjectInputStream ( byteArrayInputStream ) ; cookie = (...
Returns cookie decoded from cookie string
5,975
public static < T > Collection < Class < ? super T > > getSuperClasses ( Class < T > className ) { assert className != null ; final Collection < Class < ? super T > > list = new ArrayList < > ( ) ; Class < ? super T > type = className . getSuperclass ( ) ; while ( type != null && ! Object . class . equals ( type ) ) { ...
Replies the list of all the superclasses of the given class .
5,976
public static Class < ? > getCommonType ( Class < ? > type1 , Class < ? > type2 ) { if ( type1 == null ) { return type2 ; } if ( type2 == null ) { return type1 ; } Class < ? > top = type1 ; while ( ! top . isAssignableFrom ( type2 ) ) { top = top . getSuperclass ( ) ; assert top != null ; } return top ; }
Replies the top - most type which is common to both given types .
5,977
public static Class < ? > getCommonType ( Object instance1 , Object instance2 ) { if ( instance1 == null ) { return instance2 == null ? null : instance2 . getClass ( ) ; } if ( instance2 == null ) { return instance1 . getClass ( ) ; } Class < ? > top = instance1 . getClass ( ) ; while ( ! top . isInstance ( instance2 )...
Replies the top - most type which is common to both given objects .
5,978
@ SuppressWarnings ( { "checkstyle:returncount" , "npathcomplexity" } ) public static Class < ? > getOutboxingType ( Class < ? > type ) { if ( void . class . equals ( type ) ) { return Void . class ; } if ( boolean . class . equals ( type ) ) { return Boolean . class ; } if ( byte . class . equals ( type ) ) { return B...
Replies the outboxing type for the given type .
5,979
public static boolean matchesParameters ( Class < ? > [ ] formalParameters , Object ... parameterValues ) { if ( formalParameters == null ) { return parameterValues == null ; } if ( parameterValues != null && formalParameters . length == parameterValues . length ) { for ( int i = 0 ; i < formalParameters . length ; ++ ...
Replies if the formal parameters are matching the given values .
5,980
@ Inline ( value = "ReflectionUtil.matchesParameters(($1).getParameterTypes(), ($2))" , imported = { ReflectionUtil . class } ) public static boolean matchesParameters ( Method method , Object ... parameters ) { return matchesParameters ( method . getParameterTypes ( ) , parameters ) ; }
Replies if the parameters of the given method are matching the given values .
5,981
public static void toJson ( Object object , JsonBuffer output ) { if ( object == null ) { return ; } for ( final Method method : object . getClass ( ) . getMethods ( ) ) { try { if ( ! method . isSynthetic ( ) && ! Modifier . isStatic ( method . getModifiers ( ) ) && method . getParameterCount ( ) == 0 && ( method . ge...
Replies the string representation of the given object .
5,982
public Point3d getCenter ( ) { return new Point3d ( ( this . medial1 . getX ( ) + this . medial2 . getX ( ) ) / 2. , ( this . medial1 . getY ( ) + this . medial2 . getY ( ) ) / 2. , ( this . medial1 . getZ ( ) + this . medial2 . getZ ( ) ) / 2. ) ; }
Replies the center point of the capsule .
5,983
protected void onSetColumnNames ( ) { columnNames = ReflectionExtensions . getDeclaredFieldNames ( getType ( ) , "serialVersionUID" ) ; for ( int i = 0 ; i < columnNames . length ; i ++ ) { columnNames [ i ] = StringUtils . capitalize ( columnNames [ i ] ) ; } }
Callback method for set the column names array from the generic given type . This method is invoked in the constructor from the derived classes and can be overridden so users can provide their own version of a column names
5,984
protected void onSetCanEdit ( ) { Field [ ] fields = ReflectionExtensions . getDeclaredFields ( getType ( ) , "serialVersionUID" ) ; canEdit = new boolean [ fields . length ] ; for ( int i = 0 ; i < fields . length ; i ++ ) { canEdit [ i ] = false ; } }
Callback method for set the canEdit array from the generic given type . This method is invoked in the constructor from the derived classes and can be overridden so users can provide their own version of a column classes
5,985
public boolean setChildAt ( int index , N newChild ) throws IndexOutOfBoundsException { final N oldChild = ( index < this . children . length ) ? this . children [ index ] : null ; if ( oldChild == newChild ) { return false ; } if ( oldChild != null ) { oldChild . setParentNodeReference ( null , true ) ; -- this . notN...
Set the child at the given index in this node .
5,986
public void addIterator ( SizedIterator < ? extends M > iterator ) { if ( this . iterators . add ( iterator ) ) { this . total += iterator . totalSize ( ) ; this . update = true ; } }
Add an iterator in the list of iterators .
5,987
public void write ( Collection < ? extends MapLayer > layers ) throws IOException { if ( this . progression != null ) { this . progression . setProperties ( 0 , 0 , layers . size ( ) + 1 , false ) ; } if ( ! this . isHeaderWritten ) { this . isHeaderWritten = true ; writeHeader ( ) ; } if ( this . progression != null )...
Write the given layers into the output .
5,988
protected void writeHeader ( ) throws IOException { this . tmpOutput . write ( HEADER_KEY . getBytes ( ) ) ; this . tmpOutput . write ( new byte [ ] { MAJOR_SPEC_NUMBER , MINOR_SPEC_NUMBER } ) ; this . tmpOutput . write ( new byte [ ] { 0 , 0 , 0 , 0 } ) ; }
Write the header of the file .
5,989
protected static String runCommand ( String ... command ) { try { final Process p = Runtime . getRuntime ( ) . exec ( command ) ; if ( p == null ) { return null ; } final StringBuilder bStr = new StringBuilder ( ) ; try ( InputStream standardOutput = p . getInputStream ( ) ) { final byte [ ] buffer = new byte [ BUFFER_...
Run a shell command .
5,990
protected static String grep ( String selector , String text ) { if ( text == null || text . isEmpty ( ) ) { return null ; } final StringBuilder line = new StringBuilder ( ) ; final int textLength = text . length ( ) ; char c ; String string ; for ( int i = 0 ; i < textLength ; ++ i ) { c = text . charAt ( i ) ; if ( c...
Replies the first line that contains the given selector .
5,991
protected static String cut ( String delimiter , int column , String lineText ) { if ( lineText == null || lineText . isEmpty ( ) ) { return null ; } final String [ ] columns = lineText . split ( Pattern . quote ( delimiter ) ) ; if ( columns != null && column >= 0 && column < columns . length ) { return columns [ colu...
Cut the line in columns and replies the given column .
5,992
protected static Plane3D < ? > toPlane ( double tx1 , double ty1 , double tz1 , double tx2 , double ty2 , double tz2 , double tx3 , double ty3 , double tz3 ) { Vector3f norm = new Vector3f ( ) ; FunctionalVector3D . crossProduct ( tx2 - tx1 , ty2 - ty1 , tz2 - tz1 , tx3 - tx1 , ty3 - ty1 , tz3 - tz1 , norm ) ; assert (...
Compute the plane of the given triangle .
5,993
public static void computeClosestPointTrianglePoint ( double tx1 , double ty1 , double tz1 , double tx2 , double ty2 , double tz2 , double tx3 , double ty3 , double tz3 , double px , double py , double pz , Point3D closestPoint ) { if ( containsTrianglePoint ( tx1 , ty1 , tz1 , tx2 , ty2 , tz2 , tx3 , ty3 , tz3 , px , ...
Replies the closest point from the triangle to the point .
5,994
public static double distanceSquaredTriangleSegment ( double tx1 , double ty1 , double tz1 , double tx2 , double ty2 , double tz2 , double tx3 , double ty3 , double tz3 , double sx1 , double sy1 , double sz1 , double sx2 , double sy2 , double sz2 ) { double t = getTriangleSegmentIntersectionFactorWithJimenezAlgorithm (...
Replies the squared distance from the triangle to the segment .
5,995
public static boolean intersectsTriangleCapsule ( double tx1 , double ty1 , double tz1 , double tx2 , double ty2 , double tz2 , double tx3 , double ty3 , double tz3 , double cx1 , double cy1 , double cz1 , double cx2 , double cy2 , double cz2 , double radius ) { double d = distanceSquaredTriangleSegment ( tx1 , ty1 , t...
Replies if the triangle intersects the capsule .
5,996
public static boolean intersectsTriangleOrientedBox ( double tx1 , double ty1 , double tz1 , double tx2 , double ty2 , double tz2 , double tx3 , double ty3 , double tz3 , double cx , double cy , double cz , double ax1 , double ay1 , double az1 , double ax2 , double ay2 , double az2 , double ax3 , double ay3 , double az...
Replies if the triangle intersects the oriented box .
5,997
public static boolean intersectsTriangleSegment ( double tx1 , double ty1 , double tz1 , double tx2 , double ty2 , double tz2 , double tx3 , double ty3 , double tz3 , double sx1 , double sy1 , double sz1 , double sx2 , double sy2 , double sz2 ) { double factor = getTriangleSegmentIntersectionFactorWithJimenezAlgorithm ...
Replies if the triangle intersects the segment .
5,998
private static boolean containsTrianglePoint ( int i0 , int i1 , double [ ] v , double [ ] u1 , double [ ] u2 , double [ ] u3 ) { double a = u2 [ i1 ] - u1 [ i1 ] ; double b = - ( u2 [ i0 ] - u1 [ i0 ] ) ; double c = - a * u1 [ i0 ] - b * u1 [ i1 ] ; double d0 = a * v [ i0 ] + b * v [ i1 ] + c ; a = u3 [ i1 ] - u2 [ i1...
Replies if a point is inside a triangle .
5,999
private static boolean intersectsCoplanarTriangle ( int i0 , int i1 , int con , double [ ] s1 , double [ ] s2 , double [ ] u1 , double [ ] u2 , double [ ] u3 ) { double Ax , Ay ; Ax = s2 [ i0 ] - s1 [ i0 ] ; Ay = s2 [ i1 ] - s1 [ i1 ] ; if ( intersectEdgeEdge ( i0 , i1 , con , Ax , Ay , s1 , u1 , u2 ) ) return true ; i...
Replies if coplanar segment - triangle intersect .