idx int64 0 165k | question stringlengths 73 5.81k | target stringlengths 5 918 |
|---|---|---|
6,700 | public static Function < File , Iterable < String > > toLinesFunction ( final Charset charset ) { return new Function < File , Iterable < String > > ( ) { public Iterable < String > apply ( final File input ) { try { return Files . readLines ( input , charset ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; throw new RuntimeException ( e ) ; } } } ; } | wraps any IOException and throws a RuntimeException |
6,701 | public static void recursivelyDeleteDirectory ( File directory ) throws IOException { if ( ! directory . exists ( ) ) { return ; } checkArgument ( directory . isDirectory ( ) , "Cannot recursively delete a non-directory" ) ; walkFileTree ( directory . toPath ( ) , new DeletionFileVisitor ( ) ) ; } | Recursively delete this directory and all its contents . |
6,702 | public static void recursivelyCopyDirectory ( final File sourceDir , final File destDir , final StandardCopyOption copyOption ) throws IOException { checkNotNull ( sourceDir ) ; checkNotNull ( destDir ) ; checkArgument ( sourceDir . isDirectory ( ) , "Source directory does not exist" ) ; java . nio . file . Files . createDirectories ( destDir . toPath ( ) ) ; walkFileTree ( sourceDir . toPath ( ) , new CopyFileVisitor ( sourceDir . toPath ( ) , destDir . toPath ( ) , copyOption ) ) ; } | Recursively copies a directory . |
6,703 | public static ImmutableMultimap < Symbol , Symbol > loadSymbolMultimap ( File multimapFile ) throws IOException { return loadSymbolMultimap ( Files . asCharSource ( multimapFile , Charsets . UTF_8 ) ) ; } | Deprecated in favor of the CharSource version to force the user to define their encoding . If you call this it will use UTF_8 encoding . |
6,704 | public static double toESRI_x ( double x ) throws IOException { if ( Double . isInfinite ( x ) || Double . isNaN ( x ) ) { throw new InvalidNumericValueException ( x ) ; } return x ; } | Translate a x - coordinate from Java standard to ESRI standard . |
6,705 | public static double fromESRI_x ( double x ) throws IOException { if ( Double . isInfinite ( x ) || Double . isNaN ( x ) ) { throw new InvalidNumericValueException ( x ) ; } return x ; } | Translate a x - coordinate from ESRI standard to Java standard . |
6,706 | public static double toESRI_y ( double y ) throws IOException { if ( Double . isInfinite ( y ) || Double . isNaN ( y ) ) { throw new InvalidNumericValueException ( y ) ; } return y ; } | Translate a y - coordinate from Java standard to ESRI standard . |
6,707 | public static double fromESRI_y ( double y ) throws IOException { if ( Double . isInfinite ( y ) || Double . isNaN ( y ) ) { throw new InvalidNumericValueException ( y ) ; } return y ; } | Translate a y - coordinate from ESRI standard to Java standard . |
6,708 | public static double toESRI_z ( double z ) { if ( Double . isInfinite ( z ) || Double . isNaN ( z ) ) { return ESRI_NAN ; } return z ; } | Translate a z - coordinate from Java standard to ESRI standard . |
6,709 | public static double toESRI_m ( double measure ) { if ( Double . isInfinite ( measure ) || Double . isNaN ( measure ) ) { return ESRI_NAN ; } return measure ; } | Translate a M - coordinate from Java standard to ESRI standard . |
6,710 | public static void setAccelerator ( final JMenuItem jmi , final Character keyChar , final int modifiers ) { jmi . setAccelerator ( KeyStroke . getKeyStroke ( keyChar , modifiers ) ) ; } | Sets the accelerator for the given menuitem and the given key char and the given modifiers . |
6,711 | public static void setAccelerator ( final JMenuItem jmi , final int keyCode , final int modifiers ) { jmi . setAccelerator ( KeyStroke . getKeyStroke ( keyCode , modifiers ) ) ; } | Sets the accelerator for the given menuitem and the given key code and the given modifiers . |
6,712 | public static void setAccelerator ( final JMenuItem jmi , final String parsableKeystrokeString ) { jmi . setAccelerator ( KeyStroke . getKeyStroke ( parsableKeystrokeString ) ) ; } | Sets the accelerator for the given menuitem and the given parsable keystroke string . |
6,713 | @ Inline ( value = "Base64Coder.decode(($1).toCharArray())" , imported = { Base64Coder . class } ) public static byte [ ] decode ( String string ) { return decode ( string . toCharArray ( ) ) ; } | Decodes a byte array from Base64 format . |
6,714 | public static void setPreferredClassLoader ( ClassLoader classLoader ) { if ( classLoader != dynamicLoader ) { dynamicLoader = classLoader ; final Thread [ ] threads = new Thread [ Thread . activeCount ( ) ] ; Thread . enumerate ( threads ) ; for ( final Thread t : threads ) { if ( t != null ) { t . setContextClassLoader ( classLoader ) ; } } } } | Set the preferred class loader . |
6,715 | public static void popPreferredClassLoader ( ) { final ClassLoader sysLoader = ClassLoaderFinder . class . getClassLoader ( ) ; if ( ( dynamicLoader == null ) || ( dynamicLoader == sysLoader ) ) { dynamicLoader = null ; final Thread [ ] threads = new Thread [ Thread . activeCount ( ) ] ; Thread . enumerate ( threads ) ; for ( final Thread t : threads ) { if ( t != null ) { t . setContextClassLoader ( sysLoader ) ; } } return ; } final ClassLoader parent = dynamicLoader . getParent ( ) ; dynamicLoader = ( parent == sysLoader ) ? null : parent ; final Thread [ ] threads = new Thread [ Thread . activeCount ( ) ] ; Thread . enumerate ( threads ) ; for ( final Thread t : threads ) { if ( t != null ) { t . setContextClassLoader ( parent ) ; } } } | Pop the preferred class loader . |
6,716 | public static boolean isMinValue ( Progression model ) { if ( model != null ) { return model . getValue ( ) <= model . getMinimum ( ) ; } return true ; } | Replies if the given progression indicators has its value equal to its min value . |
6,717 | protected void defineSmallRectangles ( ZoomableGraphicsContext gc , T element ) { final double ptsSize = element . getPointSize ( ) / 2. ; final Rectangle2afp < ? , ? , ? , ? , ? , ? > visibleArea = gc . getVisibleArea ( ) ; for ( final Point2d point : element . points ( ) ) { if ( visibleArea . contains ( point ) ) { final double x = point . getX ( ) - ptsSize ; final double y = point . getY ( ) - ptsSize ; final double mx = point . getX ( ) + ptsSize ; final double my = point . getY ( ) + ptsSize ; gc . moveTo ( x , y ) ; gc . lineTo ( mx , y ) ; gc . lineTo ( mx , my ) ; gc . lineTo ( x , my ) ; gc . closePath ( ) ; } } } | Define a path that corresponds to the small rectangles around the points . |
6,718 | public static Point1dfx convert ( Tuple1dfx < ? > tuple ) { if ( tuple instanceof Point1dfx ) { return ( Point1dfx ) tuple ; } return new Point1dfx ( tuple . getSegment ( ) , tuple . getX ( ) , tuple . getY ( ) ) ; } | Convert the given tuple to a real Point1dfx . |
6,719 | public OffsetRange < CharOffset > offsets ( ) { final CharOffset start = tokens . get ( 0 ) . offsets ( ) . startInclusive ( ) ; final CharOffset end = tokens . reverse ( ) . get ( 0 ) . offsets ( ) . endInclusive ( ) ; return OffsetRange . charOffsetRange ( start . asInt ( ) , end . asInt ( ) ) ; } | Span from the start of the first token to the end of the last . |
6,720 | public HashMap readFile ( String arg0 ) { HashMap brMap ; try { brMap = getBufferReader ( arg0 ) ; } catch ( FileNotFoundException fe ) { LOG . warn ( "File not found under following path : [" + arg0 + "]!" ) ; return new HashMap ( ) ; } catch ( IOException e ) { LOG . error ( Functions . getStackTrace ( e ) ) ; return new HashMap ( ) ; } return read ( brMap ) ; } | All DSSAT Data input method used for single file or zip package |
6,721 | public HashMap readFile ( List < File > files ) { HashMap brMap ; try { brMap = getBufferReader ( files ) ; } catch ( IOException e ) { LOG . error ( Functions . getStackTrace ( e ) ) ; return new HashMap ( ) ; } return read ( brMap ) ; } | All DSSAT Data input method used for uncompressed multiple files |
6,722 | public HashMap readFileFromCRAFT ( String arg0 ) { HashMap brMap ; try { File dir = new File ( arg0 ) ; if ( dir . isDirectory ( ) ) { List < File > files = new ArrayList ( ) ; for ( File f : dir . listFiles ( ) ) { String name = f . getName ( ) . toUpperCase ( ) ; if ( name . equals ( "FILEX" ) ) { for ( File exp : f . listFiles ( ) ) { if ( exp . isFile ( ) ) { String expName = exp . getName ( ) . toUpperCase ( ) ; if ( expName . matches ( ".+\\.\\w{2}X" ) ) { files . add ( exp ) ; } } } } else if ( name . equals ( "WEATHER" ) ) { for ( File wth : f . listFiles ( ) ) { if ( wth . isFile ( ) ) { String wthName = wth . getName ( ) . toUpperCase ( ) ; if ( wthName . endsWith ( ".WTH" ) ) { files . add ( wth ) ; } } } } else if ( f . isFile ( ) && name . endsWith ( ".SOL" ) ) { files . add ( f ) ; } } brMap = getBufferReader ( files ) ; } else { LOG . error ( "You need to provide the CRAFT working folder used for generating DSSAT files." ) ; return new HashMap ( ) ; } } catch ( IOException e ) { LOG . error ( Functions . getStackTrace ( e ) ) ; return new HashMap ( ) ; } return read ( brMap ) ; } | All DSSAT Data input method specially used for DSSAT files generated by CRAFT |
6,723 | private int ensureBuffer ( int offset , int length ) throws IOException { final int lastPos = offset + length - 1 ; final int desiredSize = ( ( lastPos / BUFFER_SIZE ) + 1 ) * BUFFER_SIZE ; final int currentSize = this . buffer . length ; if ( desiredSize > currentSize ) { final byte [ ] readBuffer = new byte [ desiredSize - currentSize ] ; final int count = this . in . read ( readBuffer ) ; if ( count > 0 ) { final byte [ ] newBuffer = new byte [ currentSize + count ] ; System . arraycopy ( this . buffer , 0 , newBuffer , 0 , currentSize ) ; System . arraycopy ( readBuffer , 0 , newBuffer , currentSize , count ) ; this . buffer = newBuffer ; } return ( lastPos < this . buffer . length ) ? length : length - ( lastPos - this . buffer . length + 1 ) ; } return length ; } | Replies the count of characters available for reading . |
6,724 | public byte [ ] read ( int offset , int length ) throws IOException { if ( ensureBuffer ( offset , length ) >= length ) { final byte [ ] array = new byte [ length ] ; System . arraycopy ( this . buffer , offset , array , 0 , length ) ; this . pos = offset + length ; return array ; } throw new EOFException ( ) ; } | Replies the bytes at the specified offset . |
6,725 | public byte read ( int offset ) throws IOException { if ( ensureBuffer ( offset , 1 ) > 0 ) { this . pos = offset + 1 ; return this . buffer [ offset ] ; } throw new EOFException ( ) ; } | Replies a byte at the specified offset . |
6,726 | public String getString ( final String param ) { checkNotNull ( param ) ; checkArgument ( ! param . isEmpty ( ) ) ; final String ret = params . get ( param ) ; observeWithListeners ( param ) ; if ( ret != null ) { return ret ; } else { throw new MissingRequiredParameter ( fullString ( param ) ) ; } } | Gets the value for a parameter as a raw string . |
6,727 | public < T > T getMapped ( final String param , final Map < String , T > possibleValues ) { checkNotNull ( possibleValues ) ; checkArgument ( ! possibleValues . isEmpty ( ) ) ; final String value = getString ( param ) ; final T ret = possibleValues . get ( value ) ; if ( ret == null ) { throw new InvalidEnumeratedPropertyException ( fullString ( param ) , value , possibleValues . keySet ( ) ) ; } return ret ; } | Looks up a parameter then uses the value as a key in a map lookup . If the value is not a key in the map throws an exception . |
6,728 | public File getExistingFile ( final String param ) { return get ( param , getFileConverter ( ) , new And < > ( new FileExists ( ) , new IsFile ( ) ) , "existing file" ) ; } | Gets a file which is required to exist . |
6,729 | public File getAndMakeDirectory ( final String param ) { final File f = get ( param , new StringToFile ( ) , new AlwaysValid < File > ( ) , "existing or creatable directory" ) ; if ( f . exists ( ) ) { if ( f . isDirectory ( ) ) { return f . getAbsoluteFile ( ) ; } else { throw new ParameterValidationException ( fullString ( param ) , f . getAbsolutePath ( ) . toString ( ) , new ValidationException ( "Not an existing or creatable directory" ) ) ; } } else { f . getAbsoluteFile ( ) . mkdirs ( ) ; return f . getAbsoluteFile ( ) ; } } | Gets a directory which is guaranteed to exist after the execution of this method . If the directory does not already exist it and its parents are created . If this is not possible an exception is throws . |
6,730 | public File getExistingDirectory ( final String param ) { return get ( param , new StringToFile ( ) , new And < > ( new FileExists ( ) , new IsDirectory ( ) ) , "existing directory" ) ; } | Gets a directory which already exists . |
6,731 | public Set < String > getStringSet ( final String param ) { return get ( param , new StringToStringSet ( "," ) , new AlwaysValid < Set < String > > ( ) , "comma-separated list of strings" ) ; } | Gets a - separated set of Strings . |
6,732 | public Set < Symbol > getSymbolSet ( final String param ) { return get ( param , new StringToSymbolSet ( "," ) , new AlwaysValid < Set < Symbol > > ( ) , "comma-separated list of strings" ) ; } | Gets a - separated set of Symbols |
6,733 | public void assertAtLeastOneDefined ( final String param1 , final String param2 ) { if ( ! isPresent ( param1 ) && ! isPresent ( param2 ) ) { throw new ParameterException ( String . format ( "At least one of %s and %s must be defined." , param1 , param2 ) ) ; } } | Throws a ParameterException if neither parameter is defined . |
6,734 | public void assertAtLeastOneDefined ( final String param1 , final String ... moreParams ) { if ( ! isPresent ( param1 ) ) { for ( final String moreParam : moreParams ) { if ( isPresent ( moreParam ) ) { return ; } } final List < String > paramsForError = Lists . newArrayList ( ) ; paramsForError . add ( param1 ) ; paramsForError . addAll ( Arrays . asList ( moreParams ) ) ; throw new ParameterException ( String . format ( "At least one of %s must be defined." , StringUtils . CommaSpaceJoiner . join ( paramsForError ) ) ) ; } } | Throws a ParameterException if none of the supplied parameters are defined . |
6,735 | public Iterator < T > iterator ( ) { final List < T > shuffledList = Lists . newArrayList ( data ) ; Collections . shuffle ( shuffledList , rng ) ; return Collections . unmodifiableList ( shuffledList ) . iterator ( ) ; } | Returns a new iterator that iterates over a new random ordering of the data . |
6,736 | public void writeFile ( String arg0 , Map result ) { BufferedWriter bwB ; StringBuilder sbData = new StringBuilder ( ) ; try { setDefVal ( ) ; if ( dssatVerStr == null ) { dssatVerStr = getObjectOr ( result , "crop_model_version" , "" ) . replaceAll ( "\\D" , "" ) ; if ( ! dssatVerStr . matches ( "\\d+" ) ) { dssatVerStr = DssatVersion . DSSAT45 . toString ( ) ; } } arg0 = revisePath ( arg0 ) ; outputFile = new File ( arg0 + "DSSBatch.v" + dssatVerStr ) ; bwB = new BufferedWriter ( new FileWriter ( outputFile ) ) ; String crop = getCropName ( result ) ; String dssatPath = "C:\\DSSAT" + dssatVerStr + "\\" ; String exFileName = getFileName ( result , "X" ) ; int expNo = 1 ; sbData . append ( "$BATCH(" ) . append ( crop ) . append ( ")\r\n!\r\n" ) ; sbData . append ( String . format ( "! Command Line : %1$sDSCSM0%2$s.EXE B DSSBatch.v%2$s\r\n" , dssatPath , dssatVerStr ) ) ; sbData . append ( "! Crop : " ) . append ( crop ) . append ( "\r\n" ) ; sbData . append ( "! Experiment : " ) . append ( exFileName ) . append ( "\r\n" ) ; sbData . append ( "! ExpNo : " ) . append ( expNo ) . append ( "\r\n" ) ; sbData . append ( String . format ( "! Debug : %1$sDSCSM0%2$s.EXE \" B DSSBatch.v%2$s\"\r\n!\r\n" , dssatPath , dssatVerStr ) ) ; sbData . append ( "@FILEX TRTNO RP SQ OP CO\r\n" ) ; HashMap dssatSeqData = getObjectOr ( result , "dssat_sequence" , new HashMap ( ) ) ; ArrayList < HashMap > dssatSeqArr = getObjectOr ( dssatSeqData , "data" , new ArrayList < HashMap > ( ) ) ; if ( dssatSeqArr . isEmpty ( ) ) { HashMap tmp = new HashMap ( ) ; tmp . put ( "sq" , "1" ) ; tmp . put ( "op" , "1" ) ; tmp . put ( "co" , "0" ) ; dssatSeqArr . add ( tmp ) ; } for ( HashMap dssatSeqSubData : dssatSeqArr ) { sbData . append ( String . format ( "%1$-92s %2$6s %3$6s %4$6s %5$6s %6$6s" , exFileName , "1" , "1" , getObjectOr ( dssatSeqSubData , "sq" , "1" ) , getObjectOr ( dssatSeqSubData , "op" , "1" ) , getObjectOr ( dssatSeqSubData , "co" , "0" ) ) ) ; } bwB . write ( sbError . toString ( ) ) ; bwB . write ( sbData . toString ( ) ) ; bwB . close ( ) ; } catch ( IOException e ) { LOG . error ( DssatCommonOutput . getStackTrace ( e ) ) ; } } | DSSAT Batch File Output method |
6,737 | private String getCropName ( Map result ) { String ret ; String crid ; crid = getCrid ( result ) ; ret = LookupCodes . lookupCode ( "CRID" , crid , "common" , "DSSAT" ) ; if ( ret . equals ( crid ) ) { ret = "Unkown" ; sbError . append ( "! Warning: Undefined crop id: [" ) . append ( crid ) . append ( "]\r\n" ) ; } return ret ; } | Get crop name string |
6,738 | private static < T extends Comparable < T > > Optional < Range < T > > smallestContainerForRange ( Collection < Range < T > > ranges , Range < T > target ) { Range < T > best = Range . all ( ) ; for ( final Range < T > r : ranges ) { if ( r . equals ( target ) ) { continue ; } if ( r . encloses ( target ) && best . encloses ( r ) ) { best = r ; } } if ( best . equals ( Range . < T > all ( ) ) ) { return Optional . absent ( ) ; } return Optional . of ( best ) ; } | Assuming our ranges look tree - structured finds the smallest range for the particular target one . |
6,739 | public void validate ( T arg ) throws ValidationException { for ( final Validator < T > validator : validators ) { validator . validate ( arg ) ; } } | Calls each of its child validators on the input short - circuiting and propagating if one throws an exception . |
6,740 | public < T > void setSocketOption ( SocketOption < T > socketOption , T value ) { this . socketOptions . put ( socketOption , value ) ; } | Set tcp socket option |
6,741 | public void setCenterProperties ( Point3d center1 ) { this . center . setProperties ( center1 . xProperty , center1 . yProperty , center1 . zProperty ) ; } | Set the center property . |
6,742 | protected void onChange ( ) { enabled = false ; if ( getDocument ( ) . getLength ( ) > 0 ) { enabled = true ; } buttonModel . setEnabled ( enabled ) ; } | Callback method that can be overwritten to provide specific action on change of document . |
6,743 | public Context addWebapp ( Host host , String contextPath , String docBase ) { final ContextConfig contextConfig = createContextConfig ( ) ; return addWebapp ( host , contextPath , docBase , contextConfig ) ; } | copied from super Tomcat because of private methods |
6,744 | protected void fireAttributeChange ( AttributeChangeEvent event ) { if ( this . listeners != null && isEventFirable ( ) ) { final AttributeChangeListener [ ] list = new AttributeChangeListener [ this . listeners . size ( ) ] ; this . listeners . toArray ( list ) ; for ( final AttributeChangeListener listener : list ) { listener . onAttributeChangeEvent ( event ) ; } } } | Notifies the listeners about the change of an attribute . |
6,745 | @ SuppressWarnings ( "unchecked" ) private static < T > T maskNull ( T value ) { return ( value == null ) ? ( T ) NULL_VALUE : value ; } | Replies the null value given by the user by the corresponding null object . |
6,746 | protected void assertRange ( int index , boolean allowLast ) { final int csize = expurge ( ) ; if ( index < 0 ) { throw new IndexOutOfBoundsException ( Locale . getString ( "E1" , index ) ) ; } if ( allowLast && ( index > csize ) ) { throw new IndexOutOfBoundsException ( Locale . getString ( "E2" , csize , index ) ) ; } if ( ! allowLast && ( index >= csize ) ) { throw new IndexOutOfBoundsException ( Locale . getString ( "E3" , csize , index ) ) ; } } | Verify if the specified index is inside the array . |
6,747 | public void addReferenceListener ( ReferenceListener listener ) { if ( this . listeners == null ) { this . listeners = new LinkedList < > ( ) ; } final List < ReferenceListener > list = this . listeners ; synchronized ( list ) { list . add ( listener ) ; } } | Add listener on reference s release . |
6,748 | public void removeReferenceListener ( ReferenceListener listener ) { final List < ReferenceListener > list = this . listeners ; if ( list != null ) { synchronized ( list ) { list . remove ( listener ) ; if ( list . isEmpty ( ) ) { this . listeners = null ; } } } } | Remove listener on reference s release . |
6,749 | protected void fireReferenceRelease ( int released ) { final List < ReferenceListener > list = this . listeners ; if ( list != null && ! list . isEmpty ( ) ) { for ( final ReferenceListener listener : list ) { listener . referenceReleased ( released ) ; } } } | Fire the reference release event . |
6,750 | @ SuppressWarnings ( "checkstyle:cyclomaticcomplexity" ) public PT getStartingPointFor ( int index ) { if ( ( index < 1 ) || ( this . segmentList . size ( ) <= 1 ) ) { if ( this . startingPoint != null ) { return this . startingPoint ; } } else { int idx = index ; ST currentSegment = this . segmentList . get ( idx ) ; ST previousSegment = this . segmentList . get ( -- idx ) ; int count = 0 ; while ( ( previousSegment != null ) && ( previousSegment . equals ( currentSegment ) ) ) { currentSegment = previousSegment ; idx -- ; previousSegment = ( idx >= 0 ) ? this . segmentList . get ( idx ) : null ; count ++ ; } if ( count > 0 ) { PT sp = null ; if ( previousSegment != null ) { final PT p1 = currentSegment . getBeginPoint ( ) ; final PT p2 = currentSegment . getEndPoint ( ) ; final PT p3 = previousSegment . getBeginPoint ( ) ; final PT p4 = previousSegment . getEndPoint ( ) ; assert p1 != null && p2 != null && p3 != null && p4 != null ; if ( p1 . equals ( p3 ) || p1 . equals ( p4 ) ) { sp = p1 ; } else if ( p2 . equals ( p3 ) || p2 . equals ( p4 ) ) { sp = p2 ; } } else { sp = this . startingPoint ; } if ( sp != null ) { return ( ( count % 2 ) == 0 ) ? sp : currentSegment . getOtherSidePoint ( sp ) ; } } else if ( ( currentSegment != null ) && ( previousSegment != null ) ) { final PT p1 = currentSegment . getBeginPoint ( ) ; final PT p2 = currentSegment . getEndPoint ( ) ; final PT p3 = previousSegment . getBeginPoint ( ) ; final PT p4 = previousSegment . getEndPoint ( ) ; assert p1 != null && p2 != null && p3 != null && p4 != null ; if ( p1 . equals ( p3 ) || p1 . equals ( p4 ) ) { return p1 ; } if ( p2 . equals ( p3 ) || p2 . equals ( p4 ) ) { return p2 ; } } } return null ; } | Replies the starting point for the segment at the given index . |
6,751 | boolean removeUntil ( int index , boolean inclusive ) { if ( index >= 0 ) { boolean changed = false ; PT startPoint = this . startingPoint ; ST segment ; int limit = index ; if ( inclusive ) { ++ limit ; } for ( int i = 0 ; i < limit ; ++ i ) { segment = this . segmentList . remove ( 0 ) ; this . length -= segment . getLength ( ) ; if ( this . length < 0 ) { this . length = 0 ; } startPoint = segment . getOtherSidePoint ( startPoint ) ; changed = true ; } if ( changed ) { if ( this . segmentList . isEmpty ( ) ) { this . startingPoint = null ; this . endingPoint = null ; this . isReversable = true ; } else { this . startingPoint = startPoint ; } return true ; } } return false ; } | Package access to avoid compilation error . You must not call this function directly . |
6,752 | public void invert ( ) { final PT p = this . startingPoint ; this . startingPoint = this . endingPoint ; this . endingPoint = p ; final int middle = this . segmentList . size ( ) / 2 ; ST segment ; for ( int i = 0 , j = this . segmentList . size ( ) - 1 ; i < middle ; ++ i , -- j ) { segment = this . segmentList . get ( i ) ; this . segmentList . set ( i , this . segmentList . get ( j ) ) ; this . segmentList . set ( j , segment ) ; } } | Revert the order of the graph segment in this path . |
6,753 | public GP splitAt ( ST obj , PT startPoint ) { return splitAt ( indexOf ( obj , startPoint ) , true ) ; } | Split this path and retains the first part of the part in this object and reply the second part . The first occurrence of this specified element will be in the second part . |
6,754 | public GP splitAfterLast ( ST obj , PT startPoint ) { return splitAt ( lastIndexOf ( obj , startPoint ) , false ) ; } | Split this path and retains the first part of the part in this object and reply the second part . The last occurence of the specified element will be in the first part . |
6,755 | public GP splitAtLast ( ST obj , PT startPoint ) { return splitAt ( lastIndexOf ( obj , startPoint ) , true ) ; } | Split this path and retains the first part of the part in this object and reply the second part . The last occurence of the specified element will be in the second part . |
6,756 | public GP splitAfter ( ST obj , PT startPoint ) { return splitAt ( indexOf ( obj , startPoint ) , false ) ; } | Split this path and retains the first part of the part in this object and reply the second part . The first occurrence of specified element will be in the first part . |
6,757 | public void transform ( Transform3D transform , Point3D pivot ) { Point3D refPoint = ( pivot == null ) ? getPivot ( ) : pivot ; Vector3f v = new Vector3f ( this . getEquationComponentA ( ) , this . getEquationComponentB ( ) , this . getEquationComponentC ( ) ) ; transform . transform ( v ) ; this . set ( v . getX ( ) , v . getY ( ) , v . getZ ( ) , - ( this . getEquationComponentA ( ) * ( refPoint . getX ( ) + transform . m03 ) + this . getEquationComponentB ( ) * ( refPoint . getY ( ) + transform . m13 ) + this . getEquationComponentC ( ) * ( refPoint . getZ ( ) + transform . m23 ) ) ) ; clearBufferedValues ( ) ; } | Apply the given transformation matrix on the plane . |
6,758 | public void translate ( double dx , double dy , double dz ) { Point3f refPoint = ( Point3f ) getPivot ( ) ; setPivot ( refPoint . getX ( ) + dx , refPoint . getY ( ) + dy , refPoint . getZ ( ) + dz ) ; } | Translate the pivot point of the plane . |
6,759 | public void rotate ( Quaternion rotation , Point3D pivot ) { Point3D currentPivot = getPivot ( ) ; Transform3D m = new Transform3D ( ) ; m . setRotation ( rotation ) ; Vector3f v = new Vector3f ( this . getEquationComponentA ( ) , this . getEquationComponentB ( ) , this . getEquationComponentC ( ) ) ; m . transform ( v ) ; this . setEquationComponentA ( v . getX ( ) ) ; this . setEquationComponentB ( v . getY ( ) ) ; this . setEquationComponentC ( v . getZ ( ) ) ; if ( pivot == null ) { this . setEquationComponentD ( - ( this . getEquationComponentA ( ) * currentPivot . getX ( ) + this . getEquationComponentB ( ) * currentPivot . getY ( ) + this . getEquationComponentC ( ) * currentPivot . getZ ( ) ) ) ; } else { Point3f nP = new Point3f ( currentPivot . getX ( ) - pivot . getX ( ) , currentPivot . getY ( ) - pivot . getY ( ) , currentPivot . getZ ( ) - pivot . getZ ( ) ) ; m . transform ( nP ) ; nP . setX ( nP . getX ( ) + pivot . getX ( ) ) ; nP . setY ( nP . getY ( ) + pivot . getY ( ) ) ; nP . setZ ( nP . getZ ( ) + pivot . getZ ( ) ) ; this . setEquationComponentD ( - ( this . getEquationComponentA ( ) * nP . getX ( ) + this . getEquationComponentB ( ) * nP . getY ( ) + this . getEquationComponentC ( ) * nP . getZ ( ) ) ) ; } clearBufferedValues ( ) ; } | Rotate the plane around the given pivot point . |
6,760 | public static double cleanProbability ( double prob , double epsilon , boolean allowOne ) { if ( prob < - epsilon || prob > ( 1.0 + epsilon ) ) { throw new InvalidProbabilityException ( prob ) ; } if ( prob < epsilon ) { prob = epsilon ; } else { final double limit = allowOne ? 1.0 : ( 1.0 - epsilon ) ; if ( prob > limit ) { prob = limit ; } } return prob ; } | Cleans up input which should be probabilities . Occasionally due to numerical stability issues you get input which should be a probability but could actually be very slightly less than 0 or more than 1 . 0 . This function will take values within epsilon of being good probabilities and fix them . If the prob is within epsilon of zero it is changed to + epsilon . One the upper end if allowOne is true anything between 1 . 0 and 1 . 0 + epsilon is mapped to 1 . 0 . If allowOne is false anything between 1 . 0 - epsilon and 1 . 0 + epsilon is mapped to 1 . 0 - epsilon . All other probability values throw an unchecked InvalidProbabilityException . |
6,761 | public static boolean propertyArraysEquals ( Property < ? > [ ] array , Property < ? > [ ] array2 ) { if ( array . length == array2 . length ) { for ( int i = 0 ; i < array . length ; i ++ ) { if ( array [ i ] == null ) { if ( array2 [ i ] != null ) return false ; } else if ( array2 [ i ] == null ) { return false ; } else if ( ! array [ i ] . getValue ( ) . equals ( array2 [ i ] . getValue ( ) ) ) { return false ; } } return true ; } return false ; } | Indicates if the two property arrays are strictly equals |
6,762 | public void moveTo ( Point3d point ) { if ( this . numTypesProperty . get ( ) > 0 && this . types [ this . numTypesProperty . get ( ) - 1 ] == PathElementType . MOVE_TO ) { this . coordsProperty [ this . numCoordsProperty . get ( ) - 3 ] = point . xProperty ; this . coordsProperty [ this . numCoordsProperty . get ( ) - 2 ] = point . yProperty ; this . coordsProperty [ this . numCoordsProperty . get ( ) - 1 ] = point . zProperty ; } else { ensureSlots ( false , 3 ) ; this . types [ this . numTypesProperty . get ( ) ] = PathElementType . MOVE_TO ; this . numTypesProperty . set ( this . numTypesProperty . get ( ) + 1 ) ; this . coordsProperty [ this . numCoordsProperty . get ( ) ] = point . xProperty ; this . numCoordsProperty . set ( this . numCoordsProperty . get ( ) + 1 ) ; this . coordsProperty [ this . numCoordsProperty . get ( ) ] = point . yProperty ; this . numCoordsProperty . set ( this . numCoordsProperty . get ( ) + 1 ) ; this . coordsProperty [ this . numCoordsProperty . get ( ) ] = point . zProperty ; this . numCoordsProperty . set ( this . numCoordsProperty . get ( ) + 1 ) ; } this . graphicalBounds = null ; this . logicalBounds = null ; } | Adds a point to the path by moving to the specified coordinates specified in point in paramater . |
6,763 | public void lineTo ( Point3d point ) { ensureSlots ( true , 3 ) ; this . types [ this . numTypesProperty . get ( ) ] = PathElementType . LINE_TO ; this . numTypesProperty . set ( this . numTypesProperty . get ( ) + 1 ) ; this . coordsProperty [ this . numCoordsProperty . get ( ) ] = point . xProperty ; this . numCoordsProperty . set ( this . numCoordsProperty . get ( ) + 1 ) ; this . coordsProperty [ this . numCoordsProperty . get ( ) ] = point . yProperty ; this . numCoordsProperty . set ( this . numCoordsProperty . get ( ) + 1 ) ; this . coordsProperty [ this . numCoordsProperty . get ( ) ] = point . zProperty ; this . numCoordsProperty . set ( this . numCoordsProperty . get ( ) + 1 ) ; this . isEmptyProperty = null ; this . graphicalBounds = null ; this . logicalBounds = null ; } | Adds a point to the path by drawing a straight line from the current coordinates to the new specified coordinates specified in the point in paramater . |
6,764 | public void quadTo ( Point3d controlPoint , Point3d endPoint ) { ensureSlots ( true , 6 ) ; this . types [ this . numTypesProperty . get ( ) ] = PathElementType . QUAD_TO ; this . numTypesProperty . set ( this . numTypesProperty . get ( ) + 1 ) ; this . coordsProperty [ this . numCoordsProperty . get ( ) ] = controlPoint . xProperty ; this . numCoordsProperty . set ( this . numCoordsProperty . get ( ) + 1 ) ; this . coordsProperty [ this . numCoordsProperty . get ( ) ] = controlPoint . yProperty ; this . numCoordsProperty . set ( this . numCoordsProperty . get ( ) + 1 ) ; this . coordsProperty [ this . numCoordsProperty . get ( ) ] = controlPoint . zProperty ; this . numCoordsProperty . set ( this . numCoordsProperty . get ( ) + 1 ) ; this . coordsProperty [ this . numCoordsProperty . get ( ) ] = endPoint . xProperty ; this . numCoordsProperty . set ( this . numCoordsProperty . get ( ) + 1 ) ; this . coordsProperty [ this . numCoordsProperty . get ( ) ] = endPoint . yProperty ; this . numCoordsProperty . set ( this . numCoordsProperty . get ( ) + 1 ) ; this . coordsProperty [ this . numCoordsProperty . get ( ) ] = endPoint . zProperty ; this . numCoordsProperty . set ( this . numCoordsProperty . get ( ) + 1 ) ; this . isEmptyProperty = null ; this . isPolylineProperty . set ( false ) ; this . graphicalBounds = null ; this . logicalBounds = null ; } | Adds a curved segment defined by two new points to the path by drawing a Quadratic curve that intersects both the current coordinates and the specified endPoint using the specified controlPoint as a quadratic parametric control point . All coordinates are specified in Point3d . |
6,765 | public void curveTo ( Point3d controlPoint1 , Point3d controlPoint2 , Point3d endPoint ) { ensureSlots ( true , 9 ) ; this . types [ this . numTypesProperty . get ( ) ] = PathElementType . CURVE_TO ; this . numTypesProperty . set ( this . numTypesProperty . get ( ) + 1 ) ; this . coordsProperty [ this . numCoordsProperty . get ( ) ] = controlPoint1 . xProperty ; this . numCoordsProperty . set ( this . numCoordsProperty . get ( ) + 1 ) ; this . coordsProperty [ this . numCoordsProperty . get ( ) ] = controlPoint1 . yProperty ; this . numCoordsProperty . set ( this . numCoordsProperty . get ( ) + 1 ) ; this . coordsProperty [ this . numCoordsProperty . get ( ) ] = controlPoint1 . zProperty ; this . numCoordsProperty . set ( this . numCoordsProperty . get ( ) + 1 ) ; this . coordsProperty [ this . numCoordsProperty . get ( ) ] = controlPoint2 . xProperty ; this . numCoordsProperty . set ( this . numCoordsProperty . get ( ) + 1 ) ; this . coordsProperty [ this . numCoordsProperty . get ( ) ] = controlPoint2 . yProperty ; this . numCoordsProperty . set ( this . numCoordsProperty . get ( ) + 1 ) ; this . coordsProperty [ this . numCoordsProperty . get ( ) ] = controlPoint2 . zProperty ; this . numCoordsProperty . set ( this . numCoordsProperty . get ( ) + 1 ) ; this . coordsProperty [ this . numCoordsProperty . get ( ) ] = endPoint . xProperty ; this . numCoordsProperty . set ( this . numCoordsProperty . get ( ) + 1 ) ; this . coordsProperty [ this . numCoordsProperty . get ( ) ] = endPoint . yProperty ; this . numCoordsProperty . set ( this . numCoordsProperty . get ( ) + 1 ) ; this . coordsProperty [ this . numCoordsProperty . get ( ) ] = endPoint . zProperty ; this . numCoordsProperty . set ( this . numCoordsProperty . get ( ) + 1 ) ; this . isEmptyProperty = null ; this . isPolylineProperty . set ( false ) ; this . graphicalBounds = null ; this . logicalBounds = null ; } | Adds a curved segment defined by three new points to the path by drawing a Bé ; zier curve that intersects both the current coordinates and the specified endPoint using the specified points controlPoint1 and controlPoint2 as Bé ; zier control points . All coordinates are specified in Point3d . |
6,766 | protected void flush ( ) throws IOException { if ( this . tempStream != null && this . buffer . position ( ) > 0 ) { final int pos = this . buffer . position ( ) ; this . buffer . rewind ( ) ; this . buffer . limit ( pos ) ; this . tempStream . write ( this . buffer ) ; this . buffer . rewind ( ) ; this . buffer . limit ( this . buffer . capacity ( ) ) ; this . bufferPosition += pos ; } } | Force this writer to write the memory buffer inside the temporary file . |
6,767 | protected final void writeBEInt ( int v ) throws IOException { ensureAvailableBytes ( 4 ) ; this . buffer . order ( ByteOrder . BIG_ENDIAN ) ; this . buffer . putInt ( v ) ; } | Write a big endian 4 - byte integer . |
6,768 | protected final void writeBEDouble ( double v ) throws IOException { ensureAvailableBytes ( 8 ) ; this . buffer . order ( ByteOrder . BIG_ENDIAN ) ; this . buffer . putDouble ( v ) ; } | Write a big endian 8 - byte floating point number . |
6,769 | protected final void writeLEInt ( int v ) throws IOException { ensureAvailableBytes ( 4 ) ; this . buffer . order ( ByteOrder . LITTLE_ENDIAN ) ; this . buffer . putInt ( v ) ; } | Write a little endian 4 - byte integer . |
6,770 | protected final void writeLEDouble ( double v ) throws IOException { ensureAvailableBytes ( 8 ) ; this . buffer . order ( ByteOrder . LITTLE_ENDIAN ) ; this . buffer . putDouble ( v ) ; } | Write a little endian 8 - byte floating point number . |
6,771 | private void writeHeader ( ESRIBounds box , ShapeElementType type , Collection < ? extends E > elements ) throws IOException { if ( ! this . headerWasWritten ) { initializeContentBuffer ( ) ; box . ensureMinMax ( ) ; writeBEInt ( SHAPE_FILE_CODE ) ; writeBEInt ( 0 ) ; writeBEInt ( 0 ) ; writeBEInt ( 0 ) ; writeBEInt ( 0 ) ; writeBEInt ( 0 ) ; writeBEInt ( 0 ) ; writeLEInt ( SHAPE_FILE_VERSION ) ; writeLEInt ( type . shapeType ) ; writeLEDouble ( toESRI_x ( box . getMinX ( ) ) ) ; writeLEDouble ( toESRI_y ( box . getMinY ( ) ) ) ; writeLEDouble ( toESRI_x ( box . getMaxX ( ) ) ) ; writeLEDouble ( toESRI_y ( box . getMaxY ( ) ) ) ; writeLEDouble ( toESRI_z ( box . getMinZ ( ) ) ) ; writeLEDouble ( toESRI_z ( box . getMaxZ ( ) ) ) ; writeLEDouble ( toESRI_m ( box . getMinM ( ) ) ) ; writeLEDouble ( toESRI_m ( box . getMaxM ( ) ) ) ; this . headerWasWritten = true ; this . recordIndex = 0 ; onHeaderWritten ( box , type , elements ) ; } } | Write the header of a Shape file . |
6,772 | public void write ( Collection < ? extends E > elements ) throws IOException { final Progression progressBar = getTaskProgression ( ) ; Progression subTask = null ; if ( progressBar != null ) { progressBar . setProperties ( 0 , 0 , ( elements . size ( ) + 1 ) * 100 , false ) ; } if ( this . fileBounds == null ) { this . fileBounds = getFileBounds ( ) ; } if ( this . fileBounds != null ) { writeHeader ( this . fileBounds , this . elementType , elements ) ; if ( progressBar != null ) { progressBar . setValue ( 100 ) ; subTask = progressBar . subTask ( elements . size ( ) * 100 ) ; subTask . setProperties ( 0 , 0 , elements . size ( ) , false ) ; } for ( final E element : elements ) { writeElement ( this . recordIndex , element , this . elementType ) ; if ( subTask != null ) { subTask . setValue ( this . recordIndex + 1 ) ; } ++ this . recordIndex ; } } else { throw new BoundsNotFoundException ( ) ; } if ( progressBar != null ) { progressBar . end ( ) ; } } | Write the Shape file and its associated files . |
6,773 | public static double toSeconds ( double value , TimeUnit inputUnit ) { switch ( inputUnit ) { case DAYS : return value * 86400. ; case HOURS : return value * 3600. ; case MINUTES : return value * 60. ; case SECONDS : break ; case MILLISECONDS : return milli2unit ( value ) ; case MICROSECONDS : return micro2unit ( value ) ; case NANOSECONDS : return nano2unit ( value ) ; default : throw new IllegalArgumentException ( ) ; } return value ; } | Convert the given value expressed in the given unit to seconds . |
6,774 | @ SuppressWarnings ( "checkstyle:returncount" ) public static double toMeters ( double value , SpaceUnit inputUnit ) { switch ( inputUnit ) { case TERAMETER : return value * 1e12 ; case GIGAMETER : return value * 1e9 ; case MEGAMETER : return value * 1e6 ; case KILOMETER : return value * 1e3 ; case HECTOMETER : return value * 1e2 ; case DECAMETER : return value * 1e1 ; case METER : break ; case DECIMETER : return value * 1e-1 ; case CENTIMETER : return value * 1e-2 ; case MILLIMETER : return value * 1e-3 ; case MICROMETER : return value * 1e-6 ; case NANOMETER : return value * 1e-9 ; case PICOMETER : return value * 1e-12 ; case FEMTOMETER : return value * 1e-15 ; default : throw new IllegalArgumentException ( ) ; } return value ; } | Convert the given value expressed in the given unit to meters . |
6,775 | public static double fromSeconds ( double value , TimeUnit outputUnit ) { switch ( outputUnit ) { case DAYS : return value / 86400. ; case HOURS : return value / 3600. ; case MINUTES : return value / 60. ; case SECONDS : break ; case MILLISECONDS : return unit2milli ( value ) ; case MICROSECONDS : return unit2micro ( value ) ; case NANOSECONDS : return unit2nano ( value ) ; default : throw new IllegalArgumentException ( ) ; } return value ; } | Convert the given value expressed in seconds to the given unit . |
6,776 | public static double toMetersPerSecond ( double value , SpeedUnit inputUnit ) { switch ( inputUnit ) { case KILOMETERS_PER_HOUR : return 3.6 * value ; case MILLIMETERS_PER_SECOND : return value / 1000. ; case METERS_PER_SECOND : default : } return value ; } | Convert the given value expressed in the given unit to meters per second . |
6,777 | public static double toRadiansPerSecond ( double value , AngularUnit inputUnit ) { switch ( inputUnit ) { case TURNS_PER_SECOND : return value * ( 2. * MathConstants . PI ) ; case DEGREES_PER_SECOND : return Math . toRadians ( value ) ; case RADIANS_PER_SECOND : default : } return value ; } | Convert the given value expressed in the given unit to radians per second . |
6,778 | public static double fromMetersPerSecond ( double value , SpeedUnit outputUnit ) { switch ( outputUnit ) { case KILOMETERS_PER_HOUR : return value / 3.6 ; case MILLIMETERS_PER_SECOND : return value * 1000. ; case METERS_PER_SECOND : default : } return value ; } | Convert the given value expressed in meters per second to the given unit . |
6,779 | public static double fromRadiansPerSecond ( double value , AngularUnit outputUnit ) { switch ( outputUnit ) { case TURNS_PER_SECOND : return value / ( 2. * MathConstants . PI ) ; case DEGREES_PER_SECOND : return Math . toDegrees ( value ) ; case RADIANS_PER_SECOND : default : } return value ; } | Convert the given value expressed in radians per second to the given unit . |
6,780 | public static SpaceUnit getSmallestUnit ( double amount , SpaceUnit unit ) { final double meters = toMeters ( amount , unit ) ; double v ; final SpaceUnit [ ] units = SpaceUnit . values ( ) ; SpaceUnit u ; for ( int i = units . length - 1 ; i >= 0 ; -- i ) { u = units [ i ] ; v = Math . floor ( fromMeters ( meters , u ) ) ; if ( v > 0. ) { return u ; } } return unit ; } | Compute the smallest unit that permits to have a metric value with its integer part positive . |
6,781 | public static Vector3d convert ( Tuple3D < ? > tuple ) { if ( tuple instanceof Vector3d ) { return ( Vector3d ) tuple ; } return new Vector3d ( tuple . getX ( ) , tuple . getY ( ) , tuple . getZ ( ) ) ; } | Convert the given tuple to a real Vector3d . |
6,782 | private String ljust ( String s , Integer length ) { if ( s . length ( ) >= length ) { return s ; } length -= s . length ( ) ; StringBuffer sb = new StringBuffer ( ) ; for ( Integer i = 0 ; i < length ; i ++ ) { sb . append ( " " ) ; } return s + sb . toString ( ) ; } | Left justify a string by forcing it to be the specified length . This is done by concatonating space characters to the end of the string until the string is of the specified length . If however the string is initially longer than the specified length then the original string is returned . |
6,783 | private void appendProperty ( StringBuffer sb , String propertyName , Object propertyValue ) { if ( propertyValue != null ) { propertyValue = propertyValue . toString ( ) . replaceAll ( "\\s+" , " " ) . trim ( ) ; } sb . append ( ljust ( propertyName + ":" , 45 ) + propertyValue + "\n" ) ; } | Append a property to the specified string . |
6,784 | public void inflate ( double minx , double miny , double minz , double maxx , double maxy , double maxz ) { this . setFromCorners ( this . getMinX ( ) + minx , this . getMinY ( ) + miny , this . getMinZ ( ) + minz , this . getMaxX ( ) + maxx , this . getMaxY ( ) + maxy , this . getMaxZ ( ) + maxz ) ; } | Inflate this box with the given amounts . |
6,785 | public static Point3d computeClosestPoint ( double minx , double miny , double minz , double maxx , double maxy , double maxz , double x , double y , double z ) { Point3d closest = new Point3d ( ) ; if ( x < minx ) { closest . setX ( minx ) ; } else if ( x > maxx ) { closest . setX ( maxx ) ; } else { closest . setX ( x ) ; } if ( y < miny ) { closest . setY ( miny ) ; } else if ( y > maxy ) { closest . setY ( maxy ) ; } else { closest . setY ( y ) ; } if ( z < minz ) { closest . setZ ( minz ) ; } else if ( z > maxz ) { closest . setZ ( maxz ) ; } else { closest . setZ ( z ) ; } return closest ; } | Replies the point on the shape that is closest to the given point . |
6,786 | public void setMinX ( double x ) { double o = this . maxxProperty . doubleValue ( ) ; if ( o < x ) { this . minxProperty . set ( o ) ; this . maxxProperty . set ( x ) ; } else { this . minxProperty . set ( x ) ; } } | Set the min X . |
6,787 | public void setMaxX ( double x ) { double o = this . minxProperty . doubleValue ( ) ; if ( o > x ) { this . maxxProperty . set ( o ) ; this . minxProperty . set ( x ) ; } else { this . maxxProperty . set ( x ) ; } } | Set the max X . |
6,788 | public void setMaxY ( double y ) { double o = this . minyProperty . doubleValue ( ) ; if ( o > y ) { this . maxyProperty . set ( o ) ; this . minyProperty . set ( y ) ; } else { this . maxyProperty . set ( y ) ; } } | Set the max Y . |
6,789 | public static ShapeElementType classifiesElement ( MapElement element ) { final Class < ? extends MapElement > type = element . getClass ( ) ; if ( MapMultiPoint . class . isAssignableFrom ( type ) ) { return ShapeElementType . MULTIPOINT ; } if ( MapPolygon . class . isAssignableFrom ( type ) ) { return ShapeElementType . POLYGON ; } if ( MapPolyline . class . isAssignableFrom ( type ) ) { return ShapeElementType . POLYLINE ; } if ( MapPoint . class . isAssignableFrom ( type ) ) { return ShapeElementType . POINT ; } return ShapeElementType . UNSUPPORTED ; } | Replies the shape type that is corresponding to the given element . |
6,790 | void add ( MapElement element ) { final Rectangle2d r = element . getBoundingBox ( ) ; if ( r != null ) { if ( Double . isNaN ( this . minx ) || this . minx > r . getMinX ( ) ) { this . minx = r . getMinX ( ) ; } if ( Double . isNaN ( this . maxx ) || this . maxx < r . getMaxX ( ) ) { this . maxx = r . getMaxX ( ) ; } if ( Double . isNaN ( this . miny ) || this . miny > r . getMinY ( ) ) { this . miny = r . getMinY ( ) ; } if ( Double . isNaN ( this . maxy ) || this . maxy < r . getMaxY ( ) ) { this . maxy = r . getMaxY ( ) ; } } this . elements . add ( element ) ; } | Add the given element into the group . |
6,791 | public void addCollection ( Collection < ? extends E > collection ) { if ( collection != null && ! collection . isEmpty ( ) ) { this . collections . add ( collection ) ; } } | Add a collection inside this multicollection . |
6,792 | public static Point2ifx convert ( Tuple2D < ? > tuple ) { if ( tuple instanceof Point2ifx ) { return ( Point2ifx ) tuple ; } return new Point2ifx ( tuple . getX ( ) , tuple . getY ( ) ) ; } | Convert the given tuple to a real Point2ifx . |
6,793 | public T remove ( final T row ) { final int index = data . indexOf ( row ) ; if ( index != - 1 ) { try { return data . remove ( index ) ; } finally { fireTableDataChanged ( ) ; } } return null ; } | Removes the given Object . |
6,794 | public List < T > removeAll ( final List < T > toRemove ) { final List < T > removedList = new ArrayList < > ( ) ; for ( final T t : toRemove ) { final int index = data . indexOf ( t ) ; if ( index != - 1 ) { removedList . add ( data . remove ( index ) ) ; } } fireTableDataChanged ( ) ; return removedList ; } | Removes the all the given Object . |
6,795 | public void update ( final T row ) { final int index = data . indexOf ( row ) ; if ( index != - 1 ) { data . set ( index , row ) ; fireTableDataChanged ( ) ; } } | Update the row . |
6,796 | public static Point3ifx convert ( Tuple3D < ? > tuple ) { if ( tuple instanceof Point3ifx ) { return ( Point3ifx ) tuple ; } return new Point3ifx ( tuple . getX ( ) , tuple . getY ( ) , tuple . getZ ( ) ) ; } | Convert the given tuple to a real Point3ifx . |
6,797 | public ReadOnlyBooleanProperty ccwProperty ( ) { if ( this . ccw == null ) { this . ccw = new ReadOnlyBooleanWrapper ( this , MathFXAttributeNames . CCW ) ; this . ccw . bind ( Bindings . createBooleanBinding ( ( ) -> Triangle2afp . isCCW ( getX1 ( ) , getY1 ( ) , getX2 ( ) , getY2 ( ) , getX3 ( ) , getY3 ( ) ) , x1Property ( ) , y1Property ( ) , x2Property ( ) , y2Property ( ) , x3Property ( ) , y3Property ( ) ) ) ; } return this . ccw . getReadOnlyProperty ( ) ; } | Replies the property that indictes if the triangle s points are defined in a counter - clockwise order . |
6,798 | public static final double chooseMostCommonRightHandClassAccuracy ( SummaryConfusionMatrix m ) { final double total = m . sumOfallCells ( ) ; double max = 0.0 ; for ( final Symbol right : m . rightLabels ( ) ) { max = Math . max ( max , m . columnSum ( right ) ) ; } return DoubleUtils . XOverYOrZero ( max , total ) ; } | Returns the maximum accuracy that would be achieved if a single classification were selected for all instances . |
6,799 | public List < GridCell < P > > consumeCells ( ) { final List < GridCell < P > > list = new ArrayList < > ( this . cells ) ; this . cells . clear ( ) ; return list ; } | Replies the cell on which the given element is located . The cell links were removed from the element . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.