idx
int64
0
165k
question
stringlengths
73
4.15k
target
stringlengths
5
918
len_question
int64
21
890
len_target
int64
3
255
5,900
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 ; } // if (str == null) { // return def2BitV...
get 2 - bit version of crop id by given string
170
11
5,901
public static String get3BitCrid ( String str ) { if ( str != null ) { // return LookupCodes.modelLookupCode("DSSAT", "CRID", str).toUpperCase(); return LookupCodes . lookupCode ( "CRID" , str , "code" , "DSSAT" ) . toUpperCase ( ) ; } else { return def3BitVal ; } // if (str == null || !crids.containsValue(str)) { // r...
get 3 - bit version of crop id by given string
177
11
5,902
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 .
323
13
5,903
@ Override @ Pure public Iterator < E > iterator ( Rectangle2afp < ? , ? , ? , ? , ? , ? > bounds ) { return new BoundedElementIterator <> ( bounds , iterator ( ) ) ; }
Iterates on the elements that intersect the specified bounds .
51
11
5,904
@ Override protected HashMap readFile ( HashMap brMap ) throws IOException { HashMap ret = new HashMap ( ) ; ArrayList < HashMap > expArr = new ArrayList < HashMap > ( ) ; HashMap < String , HashMap > files = readObvData ( brMap ) ; // compressData(file); ArrayList < HashMap > obvData ; HashMap obv ; HashMap expData ; ...
DSSAT TFile Data input method for Controller using
327
11
5,905
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 ( fi...
Generate the output path given the resource and the output dir .
120
13
5,906
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 .
95
6
5,907
@ 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 .
120
20
5,908
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 .
170
8
5,909
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 .
170
8
5,910
@ Pure 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 .
50
16
5,911
@ Override 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 ( cur...
Replies the heights of all the leaf nodes . The order of the heights is given by a depth - first iteration .
124
24
5,912
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 .
274
16
5,913
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 .
613
28
5,914
@ Override public void writeFile ( String arg0 , Map result ) { // Initial variables HashMap culData ; // Data holder for one site of cultivar data ArrayList < HashMap > culArr ; // Data holder for one site of cultivar data BufferedWriter bwC ; // output object StringBuilder sbData = new StringBuilder ( ) ; // construc...
DSSAT Cultivar Data Output method
685
9
5,915
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
53
7
5,916
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
97
19
5,917
public final String trimFrom ( String s ) { int first ; int last ; // removes leading matches for ( first = 0 ; first < s . length ( ) ; ) { final int codePoint = s . codePointAt ( first ) ; if ( ! matches ( codePoint ) ) { break ; } first += Character . charCount ( codePoint ) ; } //remove trailing matches for ( last ...
Returns a copy of the input string with all leading and trailing codepoints matching this matcher removed
157
21
5,918
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
178
9
5,919
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
144
5
5,920
protected void fireValidityChangedFor ( Object changedObject , int index , BusPrimitiveInvalidity oldReason , BusPrimitiveInvalidity newReason ) { resetBoundingBox ( ) ; final BusChangeEvent event = new BusChangeEvent ( // source of the event this , // type of the event BusChangeEventType . VALIDITY , changedObject , i...
Fire the event that indicates the validity of the object has changed .
107
13
5,921
@ Pure 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 .
67
14
5,922
@ 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 .
140
9
5,923
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 .
60
9
5,924
@ Pure public DoubleProperty firstAxisExtentProperty ( ) { if ( this . extentR == null ) { this . extentR = new SimpleDoubleProperty ( this , MathFXAttributeNames . FIRST_AXIS_EXTENT ) { @ Override protected void invalidated ( ) { if ( get ( ) < 0. ) { set ( 0. ) ; } } } ; } return this . extentR ; }
Replies the property for the extent of the first axis .
88
12
5,925
@ Pure public DoubleProperty secondAxisExtentProperty ( ) { if ( this . extentS == null ) { this . extentS = new SimpleDoubleProperty ( this , MathFXAttributeNames . SECOND_AXIS_EXTENT ) { @ Override protected void invalidated ( ) { if ( get ( ) < 0. ) { set ( 0. ) ; } } } ; } return this . extentS ; }
Replies the property for the extent of the second axis .
89
12
5,926
public View < ? , ? > getRootParentView ( ) { View < ? , ? > currentView = this ; while ( currentView . hasParent ( ) ) { currentView = currentView . getParent ( ) ; } return currentView ; }
Gets the root parent view .
53
7
5,927
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 .
68
19
5,928
@ Pure 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 ...
Create an instance of path element associating properties of points to the PathElement .
178
16
5,929
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 .
58
9
5,930
@ 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 .
112
11
5,931
@ 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 .
70
11
5,932
@ 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 .
86
11
5,933
@ 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 .
89
28
5,934
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 .
58
13
5,935
private void initOptions ( ) { List < CLIOption > options = new ArrayList < CLIOption > ( ) ; options . addAll ( Arrays . asList ( ProxyDestroyOptions . values ( ) ) ) ; initOptions ( options ) ; }
Initialize options .
54
4
5,936
@ 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 .
156
31
5,937
@ Override 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 .
97
11
5,938
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
49
8
5,939
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 .
78
7
5,940
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 .
78
7
5,941
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 .
79
17
5,942
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 .
54
21
5,943
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 .
110
21
5,944
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 .
81
18
5,945
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 .
158
20
5,946
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 .
129
12
5,947
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 .
404
19
5,948
@ Pure 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 .
112
14
5,949
@ Pure 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 .
81
12
5,950
@ SuppressWarnings ( "synthetic-access" ) @ Pure 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 * in...
Replies the rotation axis represented by this quaternion .
146
12
5,951
public final void interpolate ( Quaternion q1 , double alpha ) { // From "Advanced Animation and Rendering Techniques" // by Watt and Watt pg. 364, function as implemented appeared to be // incorrect. Fails to choose the same quaternion for the double // covering. Resulting in change of direction for rotations. // Fixe...
Performs a great circle interpolation between this quaternion and the quaternion parameter and places the result into this quaternion .
387
28
5,952
@ SuppressWarnings ( "synthetic-access" ) @ Pure public EulerAngles getEulerAngles ( CoordinateSystem3D system ) { // See http://www.euclideanspace.com/maths/geometry/rotations/conversions/quaternionToEuler/index.htm // Standard used: XZY_RIGHT_HAND Quaternion q = new Quaternion ( this ) ; system . toSystem ( q , Coord...
Replies the Euler s angles that corresponds to the quaternion .
471
15
5,953
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 .
246
11
5,954
@ 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 .
103
7
5,955
@ 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 .
97
8
5,956
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 .
195
8
5,957
@ Pure 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 box...
Replies if the specified box intersects the specified sphere .
394
12
5,958
@ Pure 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 ) { // Compute (squared) distance betwe...
Replies if the specified sphere intersects the specified capsule .
169
12
5,959
@ Pure 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 .
67
12
5,960
@ Pure 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 ...
Replies if an aligned box is inside in the sphere .
200
12
5,961
@ Pure 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 .
90
9
5,962
@ Pure 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 .
103
12
5,963
@ Pure 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 .
105
12
5,964
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
109
6
5,965
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
154
7
5,966
@ Pure 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 .
111
14
5,967
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 .
96
15
5,968
@ Pure 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 ( inst...
Replies the top - most type which is common to both given objects .
111
15
5,969
@ Pure @ 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 ) ) { r...
Replies the outboxing type for the given type .
210
11
5,970
@ Pure 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 . lengt...
Replies if the formal parameters are matching the given values .
107
12
5,971
@ Pure @ 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 .
71
15
5,972
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 .
259
10
5,973
@ Pure @ Override 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 .
97
9
5,974
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
74
41
5,975
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
75
41
5,976
@ Override 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 ) ; -- ...
Set the child at the given index in this node .
205
11
5,977
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 .
48
10
5,978
public void write ( Collection < ? extends MapLayer > layers ) throws IOException { if ( this . progression != null ) { this . progression . setProperties ( 0 , 0 , layers . size ( ) + 1 , false ) ; } // Write the header if ( ! this . isHeaderWritten ) { this . isHeaderWritten = true ; writeHeader ( ) ; } if ( this . p...
Write the given layers into the output .
176
8
5,979
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 .
82
7
5,980
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 .
149
5
5,981
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 .
179
11
5,982
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 .
89
11
5,983
@ Pure 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 ) ; a...
Compute the plane of the given triangle .
264
9
5,984
@ Unefficient 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...
Replies the closest point from the triangle to the point .
719
12
5,985
@ Pure @ Unefficient 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 = getTriangleSegmentIntersectionFactorW...
Replies the squared distance from the triangle to the segment .
395
12
5,986
@ Pure @ Unefficient 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 = distanceSquaredTriangleSe...
Replies if the triangle intersects the capsule .
154
10
5,987
@ Pure 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 , do...
Replies if the triangle intersects the oriented box .
575
11
5,988
@ Pure 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 = getTriangleSegmentIntersectionFactorWithJimenezAlg...
Replies if the triangle intersects the segment .
162
10
5,989
@ Pure private static boolean containsTrianglePoint ( int i0 , int i1 , double [ ] v , double [ ] u1 , double [ ] u2 , double [ ] u3 ) { // is T1 completly inside T2? // check if V0 is inside tri(U0,U1,U2) double a = u2 [ i1 ] - u1 [ i1 ] ; double b = - ( u2 [ i0 ] - u1 [ i0 ] ) ; double c = - a * u1 [ i0 ] - b * u1 [ ...
Replies if a point is inside a triangle .
335
10
5,990
@ Pure 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 ] ; // test edge U0,U1 against V0,V1 if ( intersectEdgeEdge ( i0 , i1 , con , Ax...
Replies if coplanar segment - triangle intersect .
231
11
5,991
@ Pure public boolean contains ( FunctionalPoint3D point ) { return containsTrianglePoint ( this . getP1 ( ) . getX ( ) , this . getP1 ( ) . getY ( ) , this . getP1 ( ) . getZ ( ) , this . getP2 ( ) . getX ( ) , this . getP2 ( ) . getY ( ) , this . getP2 ( ) . getZ ( ) , this . getP3 ( ) . getX ( ) , this . getP3 ( ) ....
Checks if a point is inside this triangle .
164
10
5,992
@ Pure public Plane3D < ? > getPlane ( ) { return toPlane ( getX1 ( ) , getY1 ( ) , getZ1 ( ) , getX1 ( ) , getY1 ( ) , getZ1 ( ) , getX1 ( ) , getY1 ( ) , getZ1 ( ) ) ; }
Replies the plane on which this triangle is coplanar .
76
13
5,993
public void writeln ( String text ) throws IOException { this . writer . write ( text ) ; if ( text != null && text . length ( ) > 0 ) { this . writer . write ( "\n" ) ; //$NON-NLS-1$ } }
Write a sequence of characters followed by a carriage return .
59
11
5,994
public static < X , Y > Iterable < ZipPair < X , Y > > zip ( final Iterable < X > iter1 , final Iterable < Y > iter2 ) { return new ZipIterable < X , Y > ( iter1 , iter2 ) ; }
An implementation of Python s zip .
59
7
5,995
public static < A , B > B reduce ( final Iterable < A > iterable , final B initial , final Function2 < A , B > func ) { B b = initial ; for ( final A item : iterable ) { b = func . apply ( b , item ) ; } return b ; }
reduces an iterable to a single value starting from an initial value and applying down the iterable .
65
21
5,996
public static < K , V > ImmutableMap < K , V > mapFromPairedKeyValueSequences ( final Iterable < K > keys , final Iterable < V > values ) { final ImmutableMap . Builder < K , V > builder = ImmutableMap . builder ( ) ; for ( final ZipPair < K , V > pair : zip ( keys , values ) ) { builder . put ( pair . first ( ) , pair...
Given a paired sequence of Iterables produce a map with keys from the first and values from the second . An exception will be raised if the Iterables have different numbers of elements or if there are multiple mappings for the same key .
109
47
5,997
@ Deprecated public static < T > boolean allTheSame ( final Iterable < T > iterable ) { if ( Iterables . isEmpty ( iterable ) ) { return true ; } final T reference = Iterables . getFirst ( iterable , null ) ; for ( final T x : iterable ) { if ( ! x . equals ( reference ) ) { return false ; } } return true ; }
Prefer allEqual whose name is less ambiguous between equality and identity
86
14
5,998
public static Vector1dfx convert ( Tuple1dfx < ? > tuple ) { if ( tuple instanceof Vector1dfx ) { return ( Vector1dfx ) tuple ; } return new Vector1dfx ( tuple . getSegment ( ) , tuple . getX ( ) , tuple . getY ( ) ) ; }
Convert the given tuple to a real Vector1dfx .
66
12
5,999
protected boolean buildGetParams ( StringBuilder sb , boolean isFirst ) { BuilderListener listener = mListener ; if ( listener != null ) { return listener . onBuildGetParams ( sb , isFirst ) ; } else { return isFirst ; } }
In this we should add same default params to the get builder
56
12