idx int64 0 165k | question stringlengths 73 5.81k | target stringlengths 5 918 |
|---|---|---|
17,500 | void mapIn ( String in , Object comp , String comp_in ) { if ( comp == ca . getComponent ( ) ) { throw new ComponentException ( "cannot connect 'In' with itself for " + in ) ; } ComponentAccess ac_dest = lookup ( comp ) ; FieldAccess destAccess = ( FieldAccess ) ac_dest . input ( comp_in ) ; checkFA ( destAccess , comp... | Map two input fields . |
17,501 | void mapInVal ( Object val , Object to , String to_in ) { if ( val == null ) { throw new ComponentException ( "Null value for " + name ( to , to_in ) ) ; } if ( to == ca . getComponent ( ) ) { throw new ComponentException ( "field and component ar ethe same for mapping :" + to_in ) ; } ComponentAccess ca_to = lookup ( ... | Directly map a value to a input field . |
17,502 | void mapInField ( Object from , String from_field , Object to , String to_in ) { if ( to == ca . getComponent ( ) ) { throw new ComponentException ( "wrong connect:" + from_field ) ; } ComponentAccess ca_to = lookup ( to ) ; Access to_access = ca_to . input ( to_in ) ; checkFA ( to_access , to , to_in ) ; try { FieldCo... | Map an input field . |
17,503 | void mapOutField ( Object from , String from_out , Object to , String to_field ) { if ( from == ca . getComponent ( ) ) { throw new ComponentException ( "wrong connect:" + to_field ) ; } ComponentAccess ca_from = lookup ( from ) ; Access from_access = ca_from . output ( from_out ) ; checkFA ( from_access , from , from_... | Map a object to an output field . |
17,504 | void connect ( Object from , String from_out , Object to , String to_in ) { if ( from == to ) { throw new ComponentException ( "src == dest." ) ; } if ( to_in == null || from_out == null ) { throw new ComponentException ( "Some field arguments are null" ) ; } ComponentAccess ca_from = lookup ( from ) ; ComponentAccess ... | Connect out to in |
17,505 | void feedback ( Object from , String from_out , Object to , String to_in ) { if ( from == to ) { throw new ComponentException ( "src == dest." ) ; } if ( to_in == null || from_out == null ) { throw new ComponentException ( "Some field arguments are null" ) ; } ComponentAccess ca_from = lookup ( from ) ; ComponentAccess... | Feedback connect out to in |
17,506 | void callAnnotated ( Class < ? extends Annotation > ann , boolean lazy ) { for ( ComponentAccess p : oMap . values ( ) ) { p . callAnnotatedMethod ( ann , lazy ) ; } } | Call an annotated method . |
17,507 | public double addPoint ( double x , double y ) { pts . add ( new Coordinate ( x , y ) ) ; return selection = pts . size ( ) - 1 ; } | add a control point return index of new control point |
17,508 | public void setPoint ( double x , double y ) { if ( selection >= 0 ) { Coordinate coordinate = new Coordinate ( x , y ) ; pts . set ( selection , coordinate ) ; } } | set selected control point |
17,509 | public static Object sim ( String file , String ll , String cmd ) throws Exception { String f = CLI . readFile ( file ) ; Object o = CLI . createSim ( f , false , ll ) ; return CLI . invoke ( o , cmd ) ; } | Executes a simulation . |
17,510 | public static void groovy ( String file , String ll , String cmd ) throws Exception { String f = CLI . readFile ( file ) ; Object o = CLI . createSim ( f , true , ll ) ; } | Executed plain groovy . |
17,511 | public static String readFile ( String name ) throws IOException { StringBuilder b = new StringBuilder ( ) ; BufferedReader r = new BufferedReader ( new FileReader ( name ) ) ; String line ; while ( ( line = r . readLine ( ) ) != null ) { b . append ( line ) . append ( '\n' ) ; } r . close ( ) ; return b . toString ( )... | Read a file and provide its content as String . |
17,512 | public static Object createSim ( String script , boolean groovy , String ll ) throws Exception { setOMSProperties ( ) ; Level . parse ( ll ) ; String prefix = groovy ? "" : "import static oms3.SimConst.*\n" + "def __sb__ = new oms3.SimBuilder(logging:'" + ll + "')\n" + "__sb__." ; ClassLoader parent = Thread . currentT... | Create a simulation object . |
17,513 | private Object getPropertyTypeValue ( Class propertyType , Object value ) { if ( propertyType . equals ( String . class ) ) { return value . toString ( ) ; } else if ( propertyType . equals ( Boolean . class ) || propertyType . equals ( Boolean . TYPE ) ) { Boolean arg = null ; if ( value instanceof Boolean ) { arg = (... | converts ths incoming value to an object for the property type . |
17,514 | public static < T , K , V > Map < K , V > toMap ( Stream < T > stream , Function < T , K > keySupplier , Function < T , V > valueSupplier ) { return stream . collect ( Collectors . toMap ( keySupplier , valueSupplier ) ) ; } | Collect stream to map . |
17,515 | public static < T , K , R > Map < R , List < T > > toMapGroupBy ( Stream < T > stream , Function < T , R > groupingFunction ) { return stream . collect ( Collectors . groupingBy ( groupingFunction ) ) ; } | Collect a map by grouping based on the object s field . |
17,516 | public static < T > Map < Boolean , List < T > > toMapPartition ( Stream < T > stream , Predicate < T > predicate ) { return stream . collect ( Collectors . partitioningBy ( predicate ) ) ; } | Split a stream into a map with true and false . |
17,517 | public static < T > T findAny ( Stream < T > stream , Predicate < T > predicate ) { Optional < T > element = stream . filter ( predicate ) . findAny ( ) ; return element . orElse ( null ) ; } | Find an element in the stream . |
17,518 | public void createSpatialTable ( String tableName , int tableSrid , String geometryFieldData , String [ ] fieldData ) throws Exception { createSpatialTable ( tableName , tableSrid , geometryFieldData , fieldData , null , false ) ; } | Creates a spatial table with default values for foreign keys and index . |
17,519 | public void createSpatialIndex ( String tableName , String geomColumnName ) throws Exception { if ( geomColumnName == null ) { geomColumnName = "the_geom" ; } String realColumnName = getProperColumnNameCase ( tableName , geomColumnName ) ; String realTableName = getProperTableNameCase ( tableName ) ; String sql = "CREA... | Create a spatial index . |
17,520 | public void insertGeometry ( String tableName , Geometry geometry , String epsg ) throws Exception { String epsgStr = "4326" ; if ( epsg == null ) { epsgStr = epsg ; } GeometryColumn gc = getGeometryColumnsForTable ( tableName ) ; String sql = "INSERT INTO " + tableName + " (" + gc . geometryColumnName + ") VALUES (ST_... | Insert a geometry into a table . |
17,521 | public boolean isTableSpatial ( String tableName ) throws Exception { GeometryColumn geometryColumns = getGeometryColumnsForTable ( tableName ) ; return geometryColumns != null ; } | Checks if a table is spatial . |
17,522 | public List < Geometry > getGeometriesIn ( String tableName , Envelope envelope , String ... prePostWhere ) throws Exception { List < Geometry > geoms = new ArrayList < Geometry > ( ) ; List < String > wheres = new ArrayList < > ( ) ; String pre = "" ; String post = "" ; String where = "" ; if ( prePostWhere != null &&... | Get the geometries of a table inside a given envelope . |
17,523 | public List < Geometry > getGeometriesIn ( String tableName , Geometry intersectionGeometry , String ... prePostWhere ) throws Exception { List < Geometry > geoms = new ArrayList < Geometry > ( ) ; List < String > wheres = new ArrayList < > ( ) ; String pre = "" ; String post = "" ; String where = "" ; if ( prePostWher... | Get the geometries of a table intersecting a given geometry . |
17,524 | public static boolean fEq ( float a , float b , float epsilon ) { if ( isNaN ( a ) && isNaN ( b ) ) { return true ; } float diffAbs = abs ( a - b ) ; return a == b ? true : diffAbs < epsilon ? true : diffAbs / Math . max ( abs ( a ) , abs ( b ) ) < epsilon ; } | Returns true if two floats are considered equal based on an supplied epsilon . |
17,525 | public static double logGamma ( double x ) { double ret ; if ( Double . isNaN ( x ) || ( x <= 0.0 ) ) { ret = Double . NaN ; } else { double g = 607.0 / 128.0 ; double sum = 0.0 ; for ( int i = LANCZOS . length - 1 ; i > 0 ; -- i ) { sum = sum + ( LANCZOS [ i ] / ( x + i ) ) ; } sum = sum + LANCZOS [ 0 ] ; double tmp =... | Gamma function ported from the apache math package . |
17,526 | public static List < int [ ] > getNegativeRanges ( double [ ] x ) { int firstNegative = - 1 ; int lastNegative = - 1 ; List < int [ ] > rangeList = new ArrayList < int [ ] > ( ) ; for ( int i = 0 ; i < x . length ; i ++ ) { double xValue = x [ i ] ; if ( firstNegative == - 1 && xValue < 0 ) { firstNegative = i ; } else... | Get the range index for which x is negative . |
17,527 | public static double [ ] range2Bins ( double min , double max , int binsNum ) { double delta = ( max - min ) / binsNum ; double [ ] bins = new double [ binsNum + 1 ] ; int count = 0 ; double running = min ; for ( int i = 0 ; i < binsNum ; i ++ ) { bins [ count ] = running ; running = running + delta ; count ++ ; } bins... | Creates an array of equal bin from a range and the number of bins . |
17,528 | public static double [ ] range2Bins ( double min , double max , double step , boolean doLastEqual ) { double intervalsDouble = ( max - min ) / step ; int intervals = ( int ) intervalsDouble ; double rest = intervalsDouble - intervals ; if ( rest > D_TOLERANCE ) { intervals ++ ; } double [ ] bins = new double [ interval... | Creates an array of bins from a range and a step to use . |
17,529 | private void verifyInput ( ) { if ( inData == null || inStations == null ) { throw new NullPointerException ( msg . message ( "kriging.stationproblem" ) ) ; } if ( pMode < 0 || pMode > 1 ) { throw new IllegalArgumentException ( msg . message ( "kriging.defaultMode" ) ) ; } if ( defaultVariogramMode != 0 && defaultVario... | Verify the input of the model . |
17,530 | private LinkedHashMap < Integer , Coordinate > getCoordinate ( int nStaz , SimpleFeatureCollection collection , String idField ) throws Exception { LinkedHashMap < Integer , Coordinate > id2CoordinatesMap = new LinkedHashMap < Integer , Coordinate > ( ) ; FeatureIterator < SimpleFeature > iterator = collection . featur... | Extract the coordinate of a FeatureCollection in a HashMap with an ID as a key . |
17,531 | private double variogram ( double c0 , double a , double sill , double rx , double ry , double rz ) { if ( isNovalue ( rz ) ) { rz = 0 ; } double value = 0 ; double h2 = Math . sqrt ( rx * rx + rz * rz + ry * ry ) ; if ( pSemivariogramType == 0 ) { value = c0 + sill * ( 1 - Math . exp ( - ( h2 * h2 ) / ( a * a ) ) ) ; ... | The gaussian variogram |
17,532 | public static void figureOutConnect ( PrintStream w , Object ... comps ) { List < ComponentAccess > l = new ArrayList < ComponentAccess > ( ) ; for ( Object c : comps ) { l . add ( new ComponentAccess ( c ) ) ; } for ( ComponentAccess cp_out : l ) { w . println ( "// connect " + objName ( cp_out ) ) ; for ( Access fout... | Figure out connectivity and generate Java statements . |
17,533 | public static List < Class < ? > > getComponentClasses ( URL jar ) throws IOException { JarInputStream jarFile = new JarInputStream ( jar . openStream ( ) ) ; URLClassLoader cl = new URLClassLoader ( new URL [ ] { jar } , Thread . currentThread ( ) . getContextClassLoader ( ) ) ; List < Class < ? > > idx = new ArrayLis... | Get all components from a jar file |
17,534 | public static URL getDocumentation ( Class < ? > comp , Locale loc ) { Documentation doc = ( Documentation ) comp . getAnnotation ( Documentation . class ) ; if ( doc != null ) { String v = doc . value ( ) ; try { URL url = new URL ( v ) ; return url ; } catch ( MalformedURLException E ) { String name = v . substring (... | Get the documentation as URL reference ; |
17,535 | public static String getDescription ( Class < ? > comp , Locale loc ) { Description descr = ( Description ) comp . getAnnotation ( Description . class ) ; if ( descr != null ) { String lang = loc . getLanguage ( ) ; Method [ ] m = descr . getClass ( ) . getMethods ( ) ; for ( Method method : m ) { if ( method . getName... | Get the Component Description |
17,536 | public static Object [ ] stringListToArray ( List < String > list ) { Object [ ] params = null ; if ( list != null ) { params = list . toArray ( new String [ list . size ( ) ] ) ; } return params ; } | Converts list of strings to an array . |
17,537 | public static boolean notMatches ( String value , String prefix , String middle , String postfix ) { return ! matches ( value , prefix , middle , postfix ) ; } | Check whether value NOT matches the pattern build with prefix middle part and post - fixer . |
17,538 | public static boolean matches ( String value , String prefix , String middle , String postfix ) { String pattern = prefix + middle + postfix ; boolean result = value . matches ( pattern ) ; return result ; } | Check whether value matches the pattern build with prefix middle part and post - fixer . |
17,539 | public static boolean matchesWithoutPrefixes ( String value1 , String prefix1 , String value2 , String prefix2 ) { if ( ! value1 . startsWith ( prefix1 ) ) { return false ; } value1 = value1 . substring ( prefix1 . length ( ) ) ; if ( ! value2 . startsWith ( prefix2 ) ) { return false ; } value2 = value2 . substring ( ... | It removes prefixes from values and compare remaining parts . |
17,540 | public static ValidationMessage shiftReferenceLocation ( Entry entry , long newSequenceLength ) { Collection < Reference > references = entry . getReferences ( ) ; for ( Reference reference : references ) { for ( Location rlocation : reference . getLocations ( ) . getLocations ( ) ) { { rlocation . setEndPosition ( new... | Reference Location shifting |
17,541 | @ SuppressWarnings ( "nls" ) public void dumpChart ( File chartFile , boolean autoRange , boolean withLegend , int imageWidth , int imageHeight ) throws IOException { JFreeChart chart = ChartFactory . createXYLineChart ( title , xLabel , yLabel , collection , PlotOrientation . VERTICAL , withLegend , false , false ) ; ... | Creates the chart image and dumps it to file . |
17,542 | public RuleWrapper getFirstRule ( ) { if ( featureTypeStylesWrapperList . size ( ) > 0 ) { FeatureTypeStyleWrapper featureTypeStyleWrapper = featureTypeStylesWrapperList . get ( 0 ) ; List < RuleWrapper > rulesWrapperList = featureTypeStyleWrapper . getRulesWrapperList ( ) ; if ( rulesWrapperList . size ( ) > 0 ) { Rul... | Facility to get the first rule if available . |
17,543 | public boolean isSimpleType ( ) { if ( fieldType . equals ( Double . class . getCanonicalName ( ) ) || fieldType . equals ( Float . class . getCanonicalName ( ) ) || fieldType . equals ( Integer . class . getCanonicalName ( ) ) || fieldType . equals ( double . class . getCanonicalName ( ) ) || fieldType . equals ( floa... | Checks if this field is a simple type . |
17,544 | private Long [ ] checkLocation ( Location location ) { Long [ ] positions = new Long [ 2 ] ; if ( location . isComplement ( ) ) { positions [ 0 ] = location . getEndPosition ( ) ; positions [ 1 ] = location . getBeginPosition ( ) ; } else { positions [ 0 ] = location . getBeginPosition ( ) ; positions [ 1 ] = location ... | Checks and swaps positions if in wrong order . |
17,545 | public String getSequence ( Long beginPosition , Long endPosition ) { if ( beginPosition == null || endPosition == null || ( beginPosition > endPosition ) || beginPosition < 1 || endPosition > getLength ( ) ) { return null ; } int length = ( int ) ( endPosition . longValue ( ) - beginPosition . longValue ( ) ) + 1 ; in... | Overridden so we can create appropriate sized buffer before making string . |
17,546 | String convertCase ( String str ) { if ( str == null ) { return null ; } return sensitive ? str : str . toLowerCase ( ) ; } | Converts the case of the input String to a standard format . Subsequent operations can then use standard String methods . |
17,547 | private void set ( Matrix m ) { this . nRows = 1 ; this . nCols = m . nCols ; this . values = m . values ; } | Set this row vector from a matrix . Only the first row is used . |
17,548 | public RowVector getRow ( int r ) throws MatrixException { if ( ( r < 0 ) || ( r >= nRows ) ) { throw new MatrixException ( MatrixException . INVALID_INDEX ) ; } RowVector rv = new RowVector ( nCols ) ; for ( int c = 0 ; c < nCols ; ++ c ) { rv . values [ 0 ] [ c ] = this . values [ r ] [ c ] ; } return rv ; } | Get a row of this matrix . |
17,549 | public ColumnVector getColumn ( int c ) throws MatrixException { if ( ( c < 0 ) || ( c >= nCols ) ) { throw new MatrixException ( MatrixException . INVALID_INDEX ) ; } ColumnVector cv = new ColumnVector ( nRows ) ; for ( int r = 0 ; r < nRows ; ++ r ) { cv . values [ r ] [ 0 ] = this . values [ r ] [ c ] ; } return cv ... | Get a column of this matrix . |
17,550 | protected void set ( double values [ ] [ ] ) { this . nRows = values . length ; this . nCols = values [ 0 ] . length ; this . values = values ; for ( int r = 1 ; r < nRows ; ++ r ) { nCols = Math . min ( nCols , values [ r ] . length ) ; } } | Set this matrix from a 2 - d array of values . If the rows do not have the same length then the matrix column count is the length of the shortest row . |
17,551 | public void setRow ( RowVector rv , int r ) throws MatrixException { if ( ( r < 0 ) || ( r >= nRows ) ) { throw new MatrixException ( MatrixException . INVALID_INDEX ) ; } if ( nCols != rv . nCols ) { throw new MatrixException ( MatrixException . INVALID_DIMENSIONS ) ; } for ( int c = 0 ; c < nCols ; ++ c ) { this . va... | Set a row of this matrix from a row vector . |
17,552 | public void setColumn ( ColumnVector cv , int c ) throws MatrixException { if ( ( c < 0 ) || ( c >= nCols ) ) { throw new MatrixException ( MatrixException . INVALID_INDEX ) ; } if ( nRows != cv . nRows ) { throw new MatrixException ( MatrixException . INVALID_DIMENSIONS ) ; } for ( int r = 0 ; r < nRows ; ++ r ) { thi... | Set a column of this matrix from a column vector . |
17,553 | public Matrix transpose ( ) { double tv [ ] [ ] = new double [ nCols ] [ nRows ] ; for ( int r = 0 ; r < nRows ; ++ r ) { for ( int c = 0 ; c < nCols ; ++ c ) { tv [ c ] [ r ] = values [ r ] [ c ] ; } } return new Matrix ( tv ) ; } | Return the transpose of this matrix . |
17,554 | public Matrix add ( Matrix m ) throws MatrixException { if ( ( nRows != m . nRows ) && ( nCols != m . nCols ) ) { throw new MatrixException ( MatrixException . INVALID_DIMENSIONS ) ; } double sv [ ] [ ] = new double [ nRows ] [ nCols ] ; for ( int r = 0 ; r < nRows ; ++ r ) { for ( int c = 0 ; c < nCols ; ++ c ) { sv [... | Add another matrix to this matrix . |
17,555 | public Matrix subtract ( Matrix m ) throws MatrixException { if ( ( nRows != m . nRows ) && ( nCols != m . nCols ) ) { throw new MatrixException ( MatrixException . INVALID_DIMENSIONS ) ; } double dv [ ] [ ] = new double [ nRows ] [ nCols ] ; for ( int r = 0 ; r < nRows ; ++ r ) { for ( int c = 0 ; c < nCols ; ++ c ) {... | Subtract another matrix from this matrix . |
17,556 | public Matrix multiply ( double k ) { double pv [ ] [ ] = new double [ nRows ] [ nCols ] ; for ( int r = 0 ; r < nRows ; ++ r ) { for ( int c = 0 ; c < nCols ; ++ c ) { pv [ r ] [ c ] = k * values [ r ] [ c ] ; } } return new Matrix ( pv ) ; } | Multiply this matrix by a constant . |
17,557 | public Matrix multiply ( Matrix m ) throws MatrixException { if ( nCols != m . nRows ) { throw new MatrixException ( MatrixException . INVALID_DIMENSIONS ) ; } double pv [ ] [ ] = new double [ nRows ] [ m . nCols ] ; for ( int r = 0 ; r < nRows ; ++ r ) { for ( int c = 0 ; c < m . nCols ; ++ c ) { double dot = 0 ; for ... | Multiply this matrix by another matrix . |
17,558 | public static void printInfo ( String filePath ) throws Exception { LasInfo lasInfo = new LasInfo ( ) ; lasInfo . inLas = filePath ; lasInfo . process ( ) ; } | Utility method to run info . |
17,559 | private double internalPipeVerify ( int k , double [ ] cDelays , double [ ] [ ] net , double [ ] [ ] timeDischarge , double [ ] [ ] timeFillDegree , int tp ) { int num ; double localdelay , olddelay , qMax , B , known , theta , u ; double [ ] [ ] qPartial ; qPartial = new double [ timeDischarge . length ] [ timeDischar... | verify of the no - head pipes . |
17,560 | private void calculateDelays ( int k , double [ ] cDelays , double [ ] [ ] net ) { double t ; int ind , r = 1 ; for ( int j = 0 ; j < net . length ; ++ j ) { t = 0 ; r = 1 ; ind = ( int ) net [ j ] [ 0 ] ; while ( networkPipes [ ind ] . getIndexPipeWhereDrain ( ) != k ) { ind = networkPipes [ ind ] . getIndexPipeWhereD... | Calcola il ritardo della tubazione k . |
17,561 | private double getHydrograph ( int k , double [ ] [ ] Qpartial , double localdelay , double delay , int tp ) { double Qmax = 0 ; double tmin = rainData [ 0 ] [ 0 ] ; int j = 0 ; double t = tmin ; double Q ; double rain ; int maxRain = 0 ; if ( tMax == tpMaxCalibration ) { maxRain = rainData . length ; } else { maxRain ... | Restituisce l idrogramma . |
17,562 | public void geoSewer ( ) throws Exception { if ( ! foundMaxrainTime ) { evaluateDischarge ( lastTimeDischarge , lastTimeFillDegree , tpMaxCalibration ) ; } else { int minTime = ( int ) ModelsEngine . approximate2Multiple ( INITIAL_TIME , dt ) ; double qMax = 0 ; for ( int i = minTime ; i < tpMaxCalibration ; i = i + dt... | Estimate the discharge for each time and for each pipes . |
17,563 | private double scanNetwork ( int k , int l , double [ ] one , double [ ] [ ] net ) { int ind ; double t ; double length ; double totalarea = 0 ; int r = 0 ; int i = 0 ; for ( int j = 0 ; j < k ; j ++ ) { t = 0 ; i = ( int ) one [ j ] ; ind = i ; length = networkPipes [ ind ] . getLenght ( ) ; while ( networkPipes [ ind... | Compila la mantrice net con tutte i dati del sottobacino con chiusura nel tratto che si sta analizzando e restituisce la sua superfice |
17,564 | public void readDwgBlockV15 ( int [ ] data , int offset ) throws Exception { int bitPos = offset ; bitPos = readObjectHeaderV15 ( data , bitPos ) ; Vector v = DwgUtil . getTextString ( data , bitPos ) ; bitPos = ( ( Integer ) v . get ( 0 ) ) . intValue ( ) ; String text = ( String ) v . get ( 1 ) ; name = text ; bitPos... | Read a Block in the DWG format Version 15 |
17,565 | public void setRepeatTimerDelay ( int delay ) { if ( delay <= 0 ) { String message = Logging . getMessage ( "generic.ArgumentOutOfRange" , delay ) ; Logging . logger ( ) . severe ( message ) ; throw new IllegalArgumentException ( message ) ; } this . repeatTimer . setDelay ( delay ) ; } | Set the repeat timer delay in milliseconds . |
17,566 | public void setPitchIncrement ( double value ) { if ( value < 0 ) { String message = Logging . getMessage ( "generic.ArgumentOutOfRange" , value ) ; Logging . logger ( ) . severe ( message ) ; throw new IllegalArgumentException ( message ) ; } this . pitchStep = value ; } | Set the pitch increment value in decimal degrees . Doubling this value will double the pitch change speed . Must be positive . Default value is 1 degree . |
17,567 | public void setFovIncrement ( double value ) { if ( value < 1 ) { String message = Logging . getMessage ( "generic.ArgumentOutOfRange" , value ) ; Logging . logger ( ) . severe ( message ) ; throw new IllegalArgumentException ( message ) ; } this . fovStep = value ; } | Set the field of view increment factor . At each iteration the current field of view will be multiplied or divided by this value . Must be greater then or equal to one . Default value is 1 . 05 . |
17,568 | public void setVeIncrement ( double value ) { if ( value < 0 ) { String message = Logging . getMessage ( "generic.ArgumentOutOfRange" , value ) ; Logging . logger ( ) . severe ( message ) ; throw new IllegalArgumentException ( message ) ; } this . veStep = value ; } | Set the vertical exaggeration increment . At each iteration the current vertical exaggeration will be increased or decreased by this amount . Must be greater than or equal to zero . Default value is 0 . 1 . |
17,569 | protected Vec4 computeSurfacePoint ( OrbitView view , Angle heading , Angle pitch ) { Globe globe = wwd . getModel ( ) . getGlobe ( ) ; Matrix transform = globe . computeSurfaceOrientationAtPosition ( view . getCenterPosition ( ) ) ; transform = transform . multiply ( Matrix . fromRotationZ ( heading . multiply ( - 1 )... | Find out where on the terrain surface the eye would be looking at with the given heading and pitch angles . |
17,570 | public static void enableProxy ( String url , String port , String user , String pwd , String nonProxyHosts ) { _url = url ; _port = port ; _user = user ; _pwd = pwd ; System . setProperty ( "http.proxyHost" , url ) ; System . setProperty ( "https.proxyHost" , url ) ; if ( port != null && port . trim ( ) . length ( ) !... | Enable the proxy usage based on the url user and pwd . |
17,571 | public static void disableProxy ( ) { System . clearProperty ( "http.proxyHost" ) ; System . clearProperty ( "http.proxyPort" ) ; System . clearProperty ( "http.proxyUserName" ) ; System . clearProperty ( "http.proxyUser" ) ; System . clearProperty ( "http.proxyPassword" ) ; System . clearProperty ( "https.proxyHost" )... | Disable the proxy usage . |
17,572 | public static String loadNativeLibrary ( String nativeLibPath , String libName ) { try { String name = "las_c" ; if ( libName == null ) libName = name ; if ( nativeLibPath != null ) { NativeLibrary . addSearchPath ( libName , nativeLibPath ) ; } WRAPPER = ( LiblasJNALibrary ) Native . loadLibrary ( libName , LiblasJNAL... | Loads the native libs creating the native wrapper . |
17,573 | public static void createTables ( Connection connection ) throws Exception { StringBuilder sB = new StringBuilder ( ) ; sB . append ( "CREATE TABLE " ) ; sB . append ( TABLE_LOG ) ; sB . append ( " (" ) ; sB . append ( COLUMN_ID ) ; sB . append ( " INTEGER PRIMARY KEY AUTOINCREMENT, " ) ; sB . append ( COLUMN_DATAORA )... | Create the default log table . |
17,574 | public static String convert ( long x , int n , String d ) { if ( x == 0 ) { return "0" ; } String r = "" ; int m = 1 << n ; m -- ; while ( x != 0 ) { r = d . charAt ( ( int ) ( x & m ) ) + r ; x = x >>> n ; } return r ; } | Converts number to string |
17,575 | public static String sprintf ( String s , Object [ ] params ) { if ( ( s == null ) || ( params == null ) ) { return s ; } StringBuffer result = new StringBuffer ( "" ) ; String [ ] ss = split ( s ) ; int p = 0 ; for ( int i = 0 ; i < ss . length ; i ++ ) { char c = ss [ i ] . charAt ( 0 ) ; String t = ss [ i ] . substr... | Sprintf multiple strings . |
17,576 | public void setLowerAndUpperBounds ( double lower , double upper ) { if ( data == null ) { return ; } this . originalLowerBound = lower ; this . originalUpperBound = upper ; if ( originalLowerBound < min ) { offset = Math . abs ( originalLowerBound ) + 10 ; } else { offset = Math . abs ( min ) + 10 ; } if ( calibration... | Set the lower and upper bounds and the actual bounds are determined . |
17,577 | private boolean checkLocations ( long length , CompoundLocation < Location > locations ) { for ( Location location : locations . getLocations ( ) ) { if ( location instanceof RemoteLocation ) continue ; if ( location . getIntBeginPosition ( ) == null || location . getIntBeginPosition ( ) < 0 ) { return false ; } if ( l... | Checks that the locations are within the sequence length |
17,578 | public static SimpleFeatureSource readFeatureSource ( String path ) throws Exception { File shapeFile = new File ( path ) ; FileDataStore store = FileDataStoreFinder . getDataStore ( shapeFile ) ; SimpleFeatureSource featureSource = store . getFeatureSource ( ) ; return featureSource ; } | Get the feature source from a file . |
17,579 | public static GEOMTYPE getGeometryType ( SimpleFeatureCollection featureCollection ) { GeometryDescriptor geometryDescriptor = featureCollection . getSchema ( ) . getGeometryDescriptor ( ) ; if ( EGeometryType . isPolygon ( geometryDescriptor ) ) { return GEOMTYPE . POLYGON ; } else if ( EGeometryType . isLine ( geomet... | Get the geometry type from a featurecollection . |
17,580 | public static void insertBeforeCompass ( WorldWindow wwd , Layer layer ) { int compassPosition = 0 ; LayerList layers = wwd . getModel ( ) . getLayers ( ) ; for ( Layer l : layers ) { if ( l instanceof CompassLayer ) compassPosition = layers . indexOf ( l ) ; } layers . add ( compassPosition , layer ) ; } | Insert a layer before the compass layer . |
17,581 | public void readDwgVertex2DV15 ( int [ ] data , int offset ) throws Exception { int bitPos = offset ; bitPos = readObjectHeaderV15 ( data , bitPos ) ; Vector v = DwgUtil . getRawChar ( data , bitPos ) ; bitPos = ( ( Integer ) v . get ( 0 ) ) . intValue ( ) ; int flags = ( ( Integer ) v . get ( 1 ) ) . intValue ( ) ; th... | Read a Vertex2D in the DWG format Version 15 |
17,582 | public static double runoffCoefficientError ( double [ ] obs , double [ ] sim , double [ ] precip ) { sameArrayLen ( sim , obs , precip ) ; double mean_pred = Stats . mean ( sim ) ; double mean_val = Stats . mean ( obs ) ; double mean_ppt = Stats . mean ( precip ) ; double error = Math . abs ( ( mean_pred / mean_ppt ) ... | Runoff coefficient error ROCE |
17,583 | public double [ ] update ( double w , double c1 , double rand1 , double c2 , double rand2 , double [ ] globalBest ) { for ( int i = 0 ; i < locations . length ; i ++ ) { particleVelocities [ i ] = w * particleVelocities [ i ] + c1 * rand1 * ( particleLocalBests [ i ] - locations [ i ] ) + c2 * rand2 * ( globalBest [ i ... | Particle swarming formula to update positions . |
17,584 | public void setParticleLocalBeststoCurrent ( ) { for ( int i = 0 ; i < locations . length ; i ++ ) { particleLocalBests [ i ] = locations [ i ] ; } } | Setter to set the current positions to be the local best positions . |
17,585 | public static File getLastFile ( ) { Preferences preferences = Preferences . userRoot ( ) . node ( GuiBridgeHandler . PREFS_NODE_NAME ) ; String userHome = System . getProperty ( "user.home" ) ; String lastPath = preferences . get ( LAST_PATH , userHome ) ; File file = new File ( lastPath ) ; if ( ! file . exists ( ) )... | Handle the last set path preference . |
17,586 | public static void setLastPath ( String lastPath ) { File file = new File ( lastPath ) ; if ( ! file . isDirectory ( ) ) { lastPath = file . getParentFile ( ) . getAbsolutePath ( ) ; } Preferences preferences = Preferences . userRoot ( ) . node ( GuiBridgeHandler . PREFS_NODE_NAME ) ; preferences . put ( LAST_PATH , la... | Save the passed path as last path available . |
17,587 | public static void setPreference ( String preferenceKey , String value ) { if ( preferencesDb != null ) { preferencesDb . setPreference ( preferenceKey , value ) ; return ; } Preferences preferences = Preferences . userRoot ( ) . node ( GuiBridgeHandler . PREFS_NODE_NAME ) ; if ( value != null ) { preferences . put ( p... | Set a preference . |
17,588 | @ SuppressWarnings ( { "unchecked" , "rawtypes" } ) public static String [ ] showMultiInputDialog ( Component parentComponent , String title , String [ ] labels , String [ ] defaultValues , HashMap < String , String [ ] > fields2ValuesMap ) { Component [ ] valuesFields = new Component [ labels . length ] ; JPanel panel... | Create a simple multi input pane that returns what the use inserts . |
17,589 | public static void colorButton ( JButton button , Color color , Integer size ) { if ( size == null ) size = 15 ; BufferedImage bi = new BufferedImage ( size , size , BufferedImage . TYPE_INT_RGB ) ; Graphics2D gr = ( Graphics2D ) bi . getGraphics ( ) ; gr . setColor ( color ) ; gr . fillRect ( 0 , 0 , size , size ) ; g... | Create an image to make a color picker button . |
17,590 | public static void setFileBrowsingOnWidgets ( JTextField pathTextField , JButton browseButton , String [ ] allowedExtensions , Runnable postRunnable ) { FileFilter filter = null ; if ( allowedExtensions != null ) { filter = new FileFilter ( ) { public String getDescription ( ) { return Arrays . toString ( allowedExtens... | Adds to a textfield and button the necessary to browse for a file . |
17,591 | public static void setFolderBrowsingOnWidgets ( JTextField pathTextField , JButton browseButton ) { browseButton . addActionListener ( e -> { File lastFile = GuiUtilities . getLastFile ( ) ; File [ ] res = showOpenFolderDialog ( browseButton , "Select folder" , false , lastFile ) ; if ( res != null && res . length == 1... | Adds to a textfield and button the necessary to browse for a folder . |
17,592 | private static double [ ] calculateParameters ( final double [ ] [ ] elevationValues ) { int rows = elevationValues . length ; int cols = elevationValues [ 0 ] . length ; int pointsNum = rows * cols ; final double [ ] [ ] xyMatrix = new double [ pointsNum ] [ 6 ] ; final double [ ] valueArray = new double [ pointsNum ]... | Calculates the parameters of a bivariate quadratic equation . |
17,593 | public Object column ( int col ) throws jsqlite . Exception { switch ( column_type ( col ) ) { case Constants . SQLITE_INTEGER : return new Long ( column_long ( col ) ) ; case Constants . SQLITE_FLOAT : return new Double ( column_double ( col ) ) ; case Constants . SQLITE_BLOB : return column_bytes ( col ) ; case Const... | Retrieve column data as object from exec ed SQLite3 statement . |
17,594 | protected void processGrid ( int cols , int rows , boolean ignoreBorder , Calculator calculator ) throws Exception { ExecutionPlanner planner = createDefaultPlanner ( ) ; planner . setNumberOfTasks ( rows * cols ) ; int startC = 0 ; int startR = 0 ; int endC = cols ; int endR = rows ; if ( ignoreBorder ) { startC = 1 ;... | Loops through all rows and cols of the given grid . |
17,595 | public int compare ( SimpleFeature f1 , SimpleFeature f2 ) { int linkid1 = ( Integer ) f1 . getAttribute ( LINKID ) ; int linkid2 = ( Integer ) f2 . getAttribute ( LINKID ) ; if ( linkid1 < linkid2 ) { return - 1 ; } else if ( linkid1 > linkid2 ) { return 1 ; } else { return 0 ; } } | establish the position of each net point respect to the others |
17,596 | public static Color colorFromRbgString ( String rbgString ) { String [ ] split = rbgString . split ( "," ) ; if ( split . length < 3 || split . length > 4 ) { throw new IllegalArgumentException ( "Color string has to be of type r,g,b." ) ; } int r = ( int ) Double . parseDouble ( split [ 0 ] . trim ( ) ) ; int g = ( in... | Converts a color string . |
17,597 | public static Color fromHex ( String hex ) { if ( hex . startsWith ( "#" ) ) { hex = hex . substring ( 1 ) ; } int length = hex . length ( ) ; int total = 6 ; if ( length < total ) { String token = hex ; int tokenLength = token . length ( ) ; for ( int i = 0 ; i < total ; i = i + tokenLength ) { hex += token ; } } int ... | Convert hex color to Color . |
17,598 | public int getFlowAt ( Direction direction ) { switch ( direction ) { case E : return eFlow ; case W : return wFlow ; case N : return nFlow ; case S : return sFlow ; case EN : return enFlow ; case NW : return nwFlow ; case WS : return wsFlow ; case SE : return seFlow ; default : throw new IllegalArgumentException ( ) ;... | Get the value of the flow in one of the surrounding direction . |
17,599 | public FlowNode goDownstream ( ) { if ( isValid ) { Direction direction = Direction . forFlow ( flow ) ; if ( direction != null ) { FlowNode nextNode = new FlowNode ( gridIter , cols , rows , col + direction . col , row + direction . row ) ; if ( nextNode . isValid ) { return nextNode ; } } } return null ; } | Get the next downstream node . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.