idx int64 0 165k | question stringlengths 73 5.81k | target stringlengths 5 918 |
|---|---|---|
152,800 | private String getSuperMethodCallParameters ( ExecutableElement sourceMethod ) { return sourceMethod . getParameters ( ) . stream ( ) . map ( parameter -> parameter . getSimpleName ( ) . toString ( ) ) . collect ( Collectors . joining ( ", " ) ) ; } | Return the list of parameters name to pass to the super call on proxy methods . |
152,801 | private void addEmitEventCall ( ExecutableElement originalMethod , MethodSpec . Builder proxyMethodBuilder , String methodCallParameters ) { String methodName = "$emit" ; if ( methodCallParameters != null && ! "" . equals ( methodCallParameters ) ) { proxyMethodBuilder . addStatement ( "vue().$L($S, $L)" , methodName ,... | Add a call to emit an event at the end of the function |
152,802 | private boolean isHookMethod ( TypeElement component , ExecutableElement method , Set < ExecutableElement > hookMethodsFromInterfaces ) { if ( hasAnnotation ( method , HookMethod . class ) ) { validateHookMethod ( method ) ; return true ; } for ( ExecutableElement hookMethodsFromInterface : hookMethodsFromInterfaces ) ... | Return true of the given method is a proxy method |
152,803 | private String getNativeNameForJavaType ( TypeMirror typeMirror ) { TypeName typeName = TypeName . get ( typeMirror ) ; if ( typeName . equals ( TypeName . INT ) || typeName . equals ( TypeName . BYTE ) || typeName . equals ( TypeName . SHORT ) || typeName . equals ( TypeName . LONG ) || typeName . equals ( TypeName . ... | Transform a Java type name into a JavaScript type name . Takes care of primitive types . |
152,804 | private void processInjectedFields ( TypeElement component ) { getInjectedFields ( component ) . stream ( ) . peek ( this :: validateField ) . forEach ( field -> { String fieldName = field . getSimpleName ( ) . toString ( ) ; addInjectedVariable ( field , fieldName ) ; injectedFieldsName . add ( fieldName ) ; } ) ; } | Process all the injected fields from our Component . |
152,805 | private void processInjectedMethods ( TypeElement component ) { getInjectedMethods ( component ) . stream ( ) . peek ( this :: validateMethod ) . forEach ( this :: processInjectedMethod ) ; } | Process all the injected methods from our Component . |
152,806 | private void addInjectedVariable ( VariableElement element , String fieldName ) { TypeName typeName = resolveVariableTypeName ( element , messager ) ; FieldSpec . Builder fieldBuilder = FieldSpec . builder ( typeName , fieldName , Modifier . PUBLIC ) ; element . getAnnotationMirrors ( ) . stream ( ) . map ( AnnotationS... | Add an injected variable to our component |
152,807 | public LocalVariableInfo addLocalVariable ( String typeQualifiedName , String name ) { return contextLayers . getFirst ( ) . addLocalVariable ( typeQualifiedName , name ) ; } | Add a local variable in the current context . |
152,808 | public DestructuredPropertyInfo addDestructuredProperty ( String propertyType , String propertyName , LocalVariableInfo destructuredVariable ) { return contextLayers . getFirst ( ) . addDestructuredProperty ( propertyType , propertyName , destructuredVariable ) ; } | Add a local variable coming from a Variable destructuring to the current context . |
152,809 | public VariableInfo findVariable ( String name ) { for ( ContextLayer contextLayer : contextLayers ) { VariableInfo variableInfo = contextLayer . getVariableInfo ( name ) ; if ( variableInfo != null ) { return variableInfo ; } } return null ; } | Find a variable in the context stack . |
152,810 | public void addImport ( String fullyQualifiedName ) { String [ ] importSplit = fullyQualifiedName . split ( "\\." ) ; String className = importSplit [ importSplit . length - 1 ] ; classNameToFullyQualifiedName . put ( className , fullyQualifiedName ) ; } | Add a Java Import to the context . |
152,811 | public String getFullyQualifiedNameForClassName ( String className ) { if ( ! classNameToFullyQualifiedName . containsKey ( className ) ) { return className ; } return classNameToFullyQualifiedName . get ( className ) ; } | Return the fully qualified name for a given class . Only works if the class has been imported . |
152,812 | public void addStaticImport ( String fullyQualifiedName ) { String [ ] importSplit = fullyQualifiedName . split ( "\\." ) ; String symbolName = importSplit [ importSplit . length - 1 ] ; methodNameToFullyQualifiedName . put ( symbolName , fullyQualifiedName ) ; propertyNameToFullyQualifiedName . put ( symbolName , full... | Add a Java Static Import to the context . |
152,813 | public String getFullyQualifiedNameForMethodName ( String methodName ) { if ( ! methodNameToFullyQualifiedName . containsKey ( methodName ) ) { return methodName ; } return methodNameToFullyQualifiedName . get ( methodName ) ; } | Return the fully qualified name for a given method . Only works if the method has been statically imported . |
152,814 | public String getFullyQualifiedNameForPropertyName ( String propertyName ) { if ( ! propertyNameToFullyQualifiedName . containsKey ( propertyName ) ) { return propertyName ; } return propertyNameToFullyQualifiedName . get ( propertyName ) ; } | Return the fully qualified name for a given property . Only works if the property has been statically imported . |
152,815 | public Optional < Integer > getCurrentLine ( ) { if ( currentSegment == null ) { return Optional . empty ( ) ; } return Optional . of ( currentSegment . getSource ( ) . getRow ( currentSegment . getBegin ( ) ) ) ; } | Return the number of the line currently processed in the HTML |
152,816 | public static void initWithoutVueLib ( ) { if ( ! isVueLibInjected ( ) ) { throw new RuntimeException ( "Couldn't find Vue.js on init. Either include it Vue.js in your index.html or call VueGWT.init() instead of initWithoutVueLib." ) ; } VueGWTObserverManager . get ( ) . registerVueGWTObserver ( new CollectionObserver ... | Inject scripts necessary for Vue GWT to work Requires Vue to be defined in Window . |
152,817 | public static void onReady ( Runnable callback ) { if ( isReady ) { callback . run ( ) ; return ; } onReadyCallbacks . push ( callback ) ; } | Ask to be warned when Vue GWT is ready . If Vue GWT is ready the callback is called immediately . |
152,818 | public static void resolveRichTextField ( ArrayResource array , CDAClient client ) { for ( CDAEntry entry : array . entries ( ) . values ( ) ) { ensureContentType ( entry , client ) ; for ( CDAField field : entry . contentType ( ) . fields ( ) ) { if ( "RichText" . equals ( field . type ( ) ) ) { resolveRichDocument ( ... | Walk through the given array and resolve all rich text fields . |
152,819 | private static void resolveRichDocument ( CDAEntry entry , CDAField field ) { final Map < String , Object > rawValue = ( Map < String , Object > ) entry . rawFields ( ) . get ( field . id ( ) ) ; if ( rawValue == null ) { return ; } for ( final String locale : rawValue . keySet ( ) ) { final Object raw = rawValue . get... | Resolve all children of the top most document block . |
152,820 | private static void resolveRichLink ( ArrayResource array , CDAEntry entry , CDAField field ) { final Map < String , Object > rawValue = ( Map < String , Object > ) entry . rawFields ( ) . get ( field . id ( ) ) ; if ( rawValue == null ) { return ; } for ( final String locale : rawValue . keySet ( ) ) { final CDARichDo... | Resolve all links if possible . If linked to entry is not found null it s field . |
152,821 | private static void resolveOneLink ( ArrayResource array , CDAField field , String locale , CDARichNode node ) { if ( node instanceof CDARichHyperLink && ( ( CDARichHyperLink ) node ) . data instanceof Map ) { final CDARichHyperLink link = ( CDARichHyperLink ) node ; final Map < String , Object > data = ( Map < String ... | Link found resolve it . |
152,822 | private static boolean isLink ( Object data ) { try { final Map < String , Object > map = ( Map < String , Object > ) data ; final Map < String , Object > sys = ( Map < String , Object > ) map . get ( "sys" ) ; final String type = ( String ) sys . get ( "type" ) ; final String linkType = ( String ) sys . get ( "linkTyp... | Is the give object a link of any kind? |
152,823 | public < T > T getField ( String locale , String key ) { return localize ( locale ) . getField ( key ) ; } | Extracts a field from the fields set of the active locale result type is inferred . |
152,824 | public Flowable < Transformed > one ( String id ) { try { return baseQuery ( ) . one ( id ) . filter ( new Predicate < CDAEntry > ( ) { public boolean test ( CDAEntry entry ) { return entry . contentType ( ) . id ( ) . equals ( contentTypeId ) ; } } ) . map ( new Function < CDAEntry , Transformed > ( ) { public Transfo... | Retrieve the transformed entry from Contentful . |
152,825 | public CDACallback < Transformed > one ( String id , CDACallback < Transformed > callback ) { return Callbacks . subscribeAsync ( baseQuery ( ) . one ( id ) . filter ( new Predicate < CDAEntry > ( ) { public boolean test ( CDAEntry entry ) { return entry . contentType ( ) . id ( ) . equals ( contentTypeId ) ; } } ) . m... | Retrieve the transformed entry from Contentful by using the given callback . |
152,826 | public Flowable < Collection < Transformed > > all ( ) { return baseQuery ( ) . all ( ) . map ( new Function < CDAArray , Collection < Transformed > > ( ) { public Collection < Transformed > apply ( CDAArray array ) { final ArrayList < Transformed > result = new ArrayList < > ( array . total ( ) ) ; for ( final CDAReso... | Retrieve all transformed entries from Contentful . |
152,827 | public CDACallback < Collection < Transformed > > all ( CDACallback < Collection < Transformed > > callback ) { return Callbacks . subscribeAsync ( baseQuery ( ) . all ( ) . map ( new Function < CDAArray , List < Transformed > > ( ) { public List < Transformed > apply ( CDAArray array ) { final ArrayList < Transformed ... | Retrieve all transformed entries from Contentful by the use of a callback . |
152,828 | @ SuppressWarnings ( "unchecked" ) public < T > T getAttribute ( String key ) { return ( T ) attrs . get ( key ) ; } | Retrieve a specific attribute of this resource . |
152,829 | public Flowable < CDAArray > all ( ) { return client . cacheAll ( false ) . flatMap ( new Function < Cache , Publisher < Response < CDAArray > > > ( ) { public Publisher < Response < CDAArray > > apply ( Cache cache ) { return client . service . array ( client . spaceId , client . environmentId , path ( ) , params ) ; ... | Observe an array of all resources matching the type of this query . |
152,830 | public static ImageOption jpegQualityOf ( int quality ) { if ( quality < 1 || quality > 100 ) { throw new IllegalArgumentException ( "Quality has to be in the range from 1 to 100." ) ; } return new ImageOption ( "q" , Integer . toString ( quality ) ) ; } | Define the quality of the jpg image to be returned . |
152,831 | public String apply ( String url ) { return format ( getDefault ( ) , "%s%s%s=%s" , url , concatenationOperator ( url ) , operation , argument ) ; } | Apply this image option to a url replacing and updating this url . |
152,832 | @ SuppressWarnings ( "unchecked" ) public < C extends CDACallback < CDASpace > > C fetchSpace ( C callback ) { return ( C ) Callbacks . subscribeAsync ( observeSpace ( ) , callback , this ) ; } | Asynchronously fetch the space . |
152,833 | public static void ensureContentType ( CDAEntry entry , CDAClient client ) { CDAContentType contentType = entry . contentType ( ) ; if ( contentType != null ) { return ; } String contentTypeId = extractNested ( entry . attrs ( ) , "contentType" , "sys" , "id" ) ; try { contentType = client . cacheTypeWithId ( contentTy... | Make sure that the given entry has a filled in content type . |
152,834 | @ SuppressWarnings ( "unchecked" ) public < C extends CDACallback < CDAArray > > C all ( C callback ) { return ( C ) Callbacks . subscribeAsync ( baseQuery ( ) . all ( ) , callback , client ) ; } | Async fetch all resources matching the type of this query . |
152,835 | public static CamundaBpmProducer createProducer ( final CamundaBpmEndpoint endpoint , final ParsedUri uri , final Map < String , Object > parameters ) throws IllegalArgumentException { switch ( uri . getType ( ) ) { case StartProcess : return new StartProcessProducer ( endpoint , parameters ) ; case SendSignal : case S... | Prevent instantiation of helper class |
152,836 | protected void removeExcessiveInProgressTasks ( Queue < Exchange > exchanges , int limit ) { while ( exchanges . size ( ) > limit ) { Exchange exchange = exchanges . poll ( ) ; releaseTask ( exchange ) ; } } | Drain any in progress files as we are done with this batch |
152,837 | @ SuppressWarnings ( "rawtypes" ) public static Map < String , Object > prepareVariables ( Exchange exchange , Map < String , Object > parameters ) { Map < String , Object > processVariables = new HashMap < String , Object > ( ) ; Object camelBody = exchange . getIn ( ) . getBody ( ) ; if ( camelBody instanceof String ... | Copies variables from Camel into the process engine . |
152,838 | public void close ( ) { if ( closed ) { return ; } if ( SHOULD_CHECK && ! txn . isReadOnly ( ) ) { txn . checkReady ( ) ; } LIB . mdb_cursor_close ( ptrCursor ) ; kv . close ( ) ; closed = true ; } | Close a cursor handle . |
152,839 | public long count ( ) { if ( SHOULD_CHECK ) { checkNotClosed ( ) ; txn . checkReady ( ) ; } final NativeLongByReference longByReference = new NativeLongByReference ( ) ; checkRc ( LIB . mdb_cursor_count ( ptrCursor , longByReference ) ) ; return longByReference . longValue ( ) ; } | Return count of duplicates for current key . |
152,840 | public boolean put ( final T key , final T val , final PutFlags ... op ) { if ( SHOULD_CHECK ) { requireNonNull ( key ) ; requireNonNull ( val ) ; checkNotClosed ( ) ; txn . checkReady ( ) ; txn . checkWritesAllowed ( ) ; } kv . keyIn ( key ) ; kv . valIn ( val ) ; final int mask = mask ( op ) ; final int rc = LIB . md... | Store by cursor . |
152,841 | public void renew ( final Txn < T > newTxn ) { if ( SHOULD_CHECK ) { requireNonNull ( newTxn ) ; checkNotClosed ( ) ; this . txn . checkReadOnly ( ) ; newTxn . checkReadOnly ( ) ; newTxn . checkReady ( ) ; } checkRc ( LIB . mdb_cursor_renew ( newTxn . pointer ( ) , ptrCursor ) ) ; this . txn = newTxn ; } | Renew a cursor handle . |
152,842 | public long runFor ( final long duration , final TimeUnit unit ) { final long deadline = System . currentTimeMillis ( ) + unit . toMillis ( duration ) ; final ExecutorService es = Executors . newSingleThreadExecutor ( ) ; final Future < Long > future = es . submit ( this ) ; try { while ( System . currentTimeMillis ( )... | Execute the verifier for the given duration . |
152,843 | public static Version version ( ) { final IntByReference major = new IntByReference ( ) ; final IntByReference minor = new IntByReference ( ) ; final IntByReference patch = new IntByReference ( ) ; LIB . mdb_version ( major , minor , patch ) ; return new Version ( major . intValue ( ) , minor . intValue ( ) , patch . i... | Obtains the LMDB C library version information . |
152,844 | public void copy ( final File path , final CopyFlags ... flags ) { requireNonNull ( path ) ; if ( ! path . exists ( ) ) { throw new InvalidCopyDestination ( "Path must exist" ) ; } if ( ! path . isDirectory ( ) ) { throw new InvalidCopyDestination ( "Path must be a directory" ) ; } final String [ ] files = path . list ... | Copies an LMDB environment to the specified destination path . |
152,845 | public List < byte [ ] > getDbiNames ( ) { final List < byte [ ] > result = new ArrayList < > ( ) ; final Dbi < T > names = openDbi ( ( byte [ ] ) null ) ; try ( Txn < T > txn = txnRead ( ) ; Cursor < T > cursor = names . openCursor ( txn ) ) { if ( ! cursor . first ( ) ) { return Collections . emptyList ( ) ; } do { f... | Obtain the DBI names . |
152,846 | public EnvInfo info ( ) { if ( closed ) { throw new AlreadyClosedException ( ) ; } final MDB_envinfo info = new MDB_envinfo ( RUNTIME ) ; checkRc ( LIB . mdb_env_info ( ptr , info ) ) ; final long mapAddress ; if ( info . f0_me_mapaddr . get ( ) == null ) { mapAddress = 0 ; } else { mapAddress = info . f0_me_mapaddr . ... | Return information about this environment . |
152,847 | public Stat stat ( ) { if ( closed ) { throw new AlreadyClosedException ( ) ; } final MDB_stat stat = new MDB_stat ( RUNTIME ) ; checkRc ( LIB . mdb_env_stat ( ptr , stat ) ) ; return new Stat ( stat . f0_ms_psize . intValue ( ) , stat . f1_ms_depth . intValue ( ) , stat . f2_ms_branch_pages . longValue ( ) , stat . f3... | Return statistics about this environment . |
152,848 | public void sync ( final boolean force ) { if ( closed ) { throw new AlreadyClosedException ( ) ; } final int f = force ? 1 : 0 ; checkRc ( LIB . mdb_env_sync ( ptr , f ) ) ; } | Flushes the data buffers to disk . |
152,849 | public Txn < T > txn ( final Txn < T > parent , final TxnFlags ... flags ) { if ( closed ) { throw new AlreadyClosedException ( ) ; } return new Txn < > ( this , parent , proxy , flags ) ; } | Obtain a transaction with the requested parent and flags . |
152,850 | @ SuppressWarnings ( "checkstyle:ReturnCount" ) public static int compareBuff ( final DirectBuffer o1 , final DirectBuffer o2 ) { requireNonNull ( o1 ) ; requireNonNull ( o2 ) ; if ( o1 . equals ( o2 ) ) { return 0 ; } final int minLength = Math . min ( o1 . capacity ( ) , o2 . capacity ( ) ) ; final int minWords = min... | Lexicographically compare two buffers . |
152,851 | public boolean delete ( final T key ) { try ( Txn < T > txn = env . txnWrite ( ) ) { final boolean ret = delete ( txn , key ) ; txn . commit ( ) ; return ret ; } } | Starts a new read - write transaction and deletes the key . |
152,852 | public boolean delete ( final Txn < T > txn , final T key ) { return delete ( txn , key , null ) ; } | Deletes the key using the passed transaction . |
152,853 | public Cursor < T > openCursor ( final Txn < T > txn ) { if ( SHOULD_CHECK ) { requireNonNull ( txn ) ; txn . checkReady ( ) ; } final PointerByReference cursorPtr = new PointerByReference ( ) ; checkRc ( LIB . mdb_cursor_open ( txn . pointer ( ) , ptr , cursorPtr ) ) ; return new Cursor < > ( cursorPtr . getValue ( ) ... | Create a cursor handle . |
152,854 | public Stat stat ( final Txn < T > txn ) { if ( SHOULD_CHECK ) { requireNonNull ( txn ) ; txn . checkReady ( ) ; } final MDB_stat stat = new MDB_stat ( RUNTIME ) ; checkRc ( LIB . mdb_stat ( txn . pointer ( ) , ptr , stat ) ) ; return new Stat ( stat . f0_ms_psize . intValue ( ) , stat . f1_ms_depth . intValue ( ) , st... | Return statistics about this database . |
152,855 | public void close ( ) { if ( state == RELEASED ) { return ; } if ( state == READY ) { LIB . mdb_txn_abort ( ptr ) ; } keyVal . close ( ) ; state = RELEASED ; } | Closes this transaction by aborting if not already committed . |
152,856 | protected String getNextLine ( int newlineCount ) throws IOException { if ( newlineCount == 0 ) { return "" ; } StringBuffer str = new StringBuffer ( ) ; int b ; while ( pis . available ( ) > 0 ) { b = pis . read ( ) ; if ( b == - 1 ) { return "" ; } if ( b == '\n' ) { newlineCount -- ; if ( newlineCount == 0 ) { log .... | Method retrieves next line from received bytes sequence |
152,857 | public static Transport getTransport ( SocketAddress addr ) throws IOException { Transport trans ; try { log . debug ( "Connecting TCP" ) ; trans = TCPInstance ( addr ) ; if ( ! trans . test ( ) ) { throw new IOException ( "Agent is unreachable via TCP" ) ; } return trans ; } catch ( IOException e ) { log . info ( "Can... | Primary transport getting method . Tries to connect and test UDP Transport . If UDP failed tries TCP transport . If it fails too throws IOException |
152,858 | public static Transport TCPInstance ( SocketAddress addr ) throws IOException { Socket sock = new Socket ( ) ; sock . setSoTimeout ( getTimeout ( ) ) ; sock . connect ( addr ) ; StreamTransport trans = new StreamTransport ( ) ; trans . setStreams ( sock . getInputStream ( ) , sock . getOutputStream ( ) ) ; trans . setA... | Returns TCP transport instance connected to specified address |
152,859 | public static Transport UDPInstance ( SocketAddress addr ) throws IOException { DatagramSocket sock = new DatagramSocket ( ) ; sock . setSoTimeout ( getTimeout ( ) ) ; sock . connect ( addr ) ; StreamTransport trans = new StreamTransport ( ) ; trans . setStreams ( new UDPInputStream ( sock ) , new UDPOutputStream ( soc... | Returns new UDP Transport instance connected to specified socket address |
152,860 | public ProgressBar maxHint ( long n ) { if ( n < 0 ) progress . setAsIndefinite ( ) ; else { progress . setAsDefinite ( ) ; progress . maxHint ( n ) ; } return this ; } | Gives a hint to the maximum value of the progress bar . |
152,861 | public static < R , S > Tuple2 < R , S > create ( R r , S s ) { return new Tuple2 < R , S > ( r , s ) ; } | Returns a new instance . |
152,862 | public static BigDecimal factorial ( int n ) { if ( n < 0 ) { throw new ArithmeticException ( "Illegal factorial(n) for n < 0: n = " + n ) ; } if ( n < factorialCache . length ) { return factorialCache [ n ] ; } BigDecimal result = factorialCache [ factorialCache . length - 1 ] ; return result . multiply ( factorialRec... | Calculates the factorial of the specified integer argument . |
152,863 | public static BigDecimal pi ( MathContext mathContext ) { checkMathContext ( mathContext ) ; BigDecimal result = null ; synchronized ( piCacheLock ) { if ( piCache != null && mathContext . getPrecision ( ) <= piCache . precision ( ) ) { result = piCache ; } else { piCache = piChudnovski ( mathContext ) ; return piCache... | Returns the number pi . |
152,864 | public static BigDecimal e ( MathContext mathContext ) { checkMathContext ( mathContext ) ; BigDecimal result = null ; synchronized ( eCacheLock ) { if ( eCache != null && mathContext . getPrecision ( ) <= eCache . precision ( ) ) { result = eCache ; } else { eCache = exp ( ONE , mathContext ) ; return eCache ; } } ret... | Returns the number e . |
152,865 | private BigRational multiply ( BigDecimal value ) { BigDecimal n = numerator . multiply ( value ) ; BigDecimal d = denominator ; return of ( n , d ) ; } | private because we want to hide that we use BigDecimal internally |
152,866 | public static BigRational valueOf ( int integer , int fractionNumerator , int fractionDenominator ) { if ( fractionNumerator < 0 || fractionDenominator < 0 ) { throw new ArithmeticException ( "Negative value" ) ; } BigRational integerPart = valueOf ( integer ) ; BigRational fractionPart = valueOf ( fractionNumerator , ... | Creates a rational number of the specified integer and fraction parts . |
152,867 | public static BigRational valueOf ( double value ) { if ( value == 0.0 ) { return ZERO ; } if ( value == 1.0 ) { return ONE ; } if ( Double . isInfinite ( value ) ) { throw new NumberFormatException ( "Infinite" ) ; } if ( Double . isNaN ( value ) ) { throw new NumberFormatException ( "NaN" ) ; } return valueOf ( new B... | Creates a rational number of the specified double value . |
152,868 | public static BigRational valueOf ( String string ) { String [ ] strings = string . split ( "/" ) ; BigRational result = valueOfSimple ( strings [ 0 ] ) ; for ( int i = 1 ; i < strings . length ; i ++ ) { result = result . divide ( valueOfSimple ( strings [ i ] ) ) ; } return result ; } | Creates a rational number of the specified string representation . |
152,869 | public static BigRational min ( BigRational ... values ) { if ( values . length == 0 ) { return BigRational . ZERO ; } BigRational result = values [ 0 ] ; for ( int i = 1 ; i < values . length ; i ++ ) { result = result . min ( values [ i ] ) ; } return result ; } | Returns the smallest of the specified rational numbers . |
152,870 | public static BigRational max ( BigRational ... values ) { if ( values . length == 0 ) { return BigRational . ZERO ; } BigRational result = values [ 0 ] ; for ( int i = 1 ; i < values . length ; i ++ ) { result = result . max ( values [ i ] ) ; } return result ; } | Returns the largest of the specified rational numbers . |
152,871 | public BigComplex add ( BigComplex value ) { return valueOf ( re . add ( value . re ) , im . add ( value . im ) ) ; } | Calculates the addition of the given complex value to this complex number . |
152,872 | public BigComplex subtract ( BigComplex value ) { return valueOf ( re . subtract ( value . re ) , im . subtract ( value . im ) ) ; } | Calculates the subtraction of the given complex value from this complex number . |
152,873 | public BigComplex multiply ( BigComplex value ) { return valueOf ( re . multiply ( value . re ) . subtract ( im . multiply ( value . im ) ) , re . multiply ( value . im ) . add ( im . multiply ( value . re ) ) ) ; } | Calculates the multiplication of the given complex value to this complex number . |
152,874 | public BigDecimal absSquare ( MathContext mathContext ) { return re . multiply ( re , mathContext ) . add ( im . multiply ( im , mathContext ) , mathContext ) ; } | Calculates the square of the absolute value of this complex number . |
152,875 | public BigComplex round ( MathContext mathContext ) { return valueOf ( re . round ( mathContext ) , im . round ( mathContext ) ) ; } | Returns this complex nuber rounded to the specified precision . |
152,876 | public boolean strictEquals ( Object obj ) { if ( this == obj ) return true ; if ( obj == null ) return false ; if ( getClass ( ) != obj . getClass ( ) ) return false ; BigComplex other = ( BigComplex ) obj ; return re . equals ( other . re ) && im . equals ( other . im ) ; } | Returns whether the real and imaginary parts of this complex number are strictly equal . |
152,877 | protected BigRational getFactor ( int index ) { while ( factors . size ( ) <= index ) { BigRational factor = getCurrentFactor ( ) ; factors . add ( factor ) ; calculateNextFactor ( ) ; } return factors . get ( index ) ; } | Returns the factor of the term with specified index . |
152,878 | protected static DBFField createField ( DataInput in , Charset charset , boolean useFieldFlags ) throws IOException { DBFField field = new DBFField ( ) ; byte t_byte = in . readByte ( ) ; if ( t_byte == ( byte ) 0x0d ) { return null ; } byte [ ] fieldName = new byte [ 11 ] ; in . readFully ( fieldName , 1 , 10 ) ; fiel... | Creates a DBFField object from the data read from the given DataInputStream . |
152,879 | protected void write ( DataOutput out , Charset charset ) throws IOException { out . write ( this . name . getBytes ( charset ) ) ; out . write ( new byte [ 11 - this . name . length ( ) ] ) ; out . writeByte ( this . type . getCode ( ) ) ; out . writeInt ( 0x00 ) ; out . writeByte ( this . length ) ; out . writeByte (... | Writes the content of DBFField object into the stream as per DBF format specifications . |
152,880 | public void setName ( String name ) { if ( name == null ) { throw new IllegalArgumentException ( "Field name cannot be null" ) ; } if ( name . length ( ) == 0 || name . length ( ) > 10 ) { throw new IllegalArgumentException ( "Field name should be of length 0-10" ) ; } if ( ! DBFUtils . isPureAscii ( name ) ) { throw n... | Sets the name of the field . |
152,881 | public void setType ( DBFDataType type ) { if ( ! type . isWriteSupported ( ) ) { throw new IllegalArgumentException ( "No support for writting " + type ) ; } this . type = type ; if ( type . getDefaultSize ( ) > 0 ) { this . length = type . getDefaultSize ( ) ; } } | Set the type for this field |
152,882 | public static Charset getCharsetByByte ( int b ) { switch ( b ) { case 0x01 : return forName ( "IBM437" ) ; case 0x02 : return forName ( "IBM850" ) ; case 0x03 : return forName ( "windows-1252" ) ; case 0x04 : return forName ( "MacRoman" ) ; case 0x57 : return forName ( "windows-1252" ) ; case 0x59 : return forName ( "... | Gets Java charset from DBF code |
152,883 | public static int getDBFCodeForCharset ( Charset charset ) { if ( charset == null ) { return 0 ; } String charsetName = charset . toString ( ) ; if ( "ibm437" . equalsIgnoreCase ( charsetName ) ) { return 0x01 ; } if ( "ibm850" . equalsIgnoreCase ( charsetName ) ) { return 0x02 ; } if ( "windows-1252" . equalsIgnoreCas... | gets the DBF code for a given Java charset |
152,884 | public Date getLastModificationDate ( ) { if ( this . year == 0 || this . month == 0 || this . day == 0 ) { return null ; } try { Calendar calendar = Calendar . getInstance ( ) ; calendar . set ( this . year , this . month , this . day , 0 , 0 , 0 ) ; calendar . set ( Calendar . MILLISECOND , 0 ) ; return calendar . ge... | Gets the date the file was modified |
152,885 | public static Number readNumericStoredAsText ( DataInputStream dataInput , int length ) throws IOException { try { byte t_float [ ] = new byte [ length ] ; int readed = dataInput . read ( t_float ) ; if ( readed != length ) { throw new EOFException ( "failed to read:" + length + " bytes" ) ; } t_float = DBFUtils . remo... | Reads a number from a stream |
152,886 | public static int littleEndian ( int value ) { int num1 = value ; int mask = 0xff ; int num2 = 0x00 ; num2 |= num1 & mask ; for ( int i = 1 ; i < 4 ; i ++ ) { num2 <<= 8 ; mask <<= 8 ; num2 |= ( num1 & mask ) >> ( 8 * i ) ; } return num2 ; } | Convert an int value to littleEndian |
152,887 | public static byte [ ] doubleFormating ( Number num , Charset charset , int fieldLength , int sizeDecimalPart ) { int sizeWholePart = fieldLength - ( sizeDecimalPart > 0 ? ( sizeDecimalPart + 1 ) : 0 ) ; StringBuilder format = new StringBuilder ( fieldLength ) ; for ( int i = 0 ; i < sizeWholePart - 1 ; i ++ ) { format... | Format a double number to write to a dbf file |
152,888 | public static boolean contains ( byte [ ] array , byte value ) { if ( array != null ) { for ( byte data : array ) { if ( data == value ) { return true ; } } } return false ; } | Checks that a byte array contains some specific byte |
152,889 | public static boolean isPureAscii ( String stringToCheck ) { if ( stringToCheck == null || stringToCheck . length ( ) == 0 ) { return true ; } synchronized ( ASCII_ENCODER ) { return ASCII_ENCODER . canEncode ( stringToCheck ) ; } } | Checks if a string is pure Ascii |
152,890 | public static boolean isPureAscii ( byte [ ] data ) { if ( data == null ) { return false ; } for ( byte b : data ) { if ( b < 0x20 ) { return false ; } } return true ; } | Test if the data in the array is pure ASCII |
152,891 | public static byte [ ] trimRightSpaces ( byte [ ] b_array ) { if ( b_array == null || b_array . length == 0 ) { return new byte [ 0 ] ; } int pos = getRightPos ( b_array ) ; int length = pos + 1 ; byte [ ] newBytes = new byte [ length ] ; System . arraycopy ( b_array , 0 , newBytes , 0 , length ) ; return newBytes ; } | Trims right spaces from string |
152,892 | public void setFields ( DBFField [ ] fields ) { if ( this . closed ) { throw new IllegalStateException ( "You can not set fields to a closed DBFWriter" ) ; } if ( this . header . fieldArray != null ) { throw new DBFException ( "Fields has already been set" ) ; } if ( fields == null || fields . length == 0 ) { throw new... | Sets fields definition |
152,893 | public void addRecord ( Object [ ] values ) { if ( this . closed ) { throw new IllegalStateException ( "You can add records a closed DBFWriter" ) ; } if ( this . header . fieldArray == null ) { throw new DBFException ( "Fields should be set before adding records" ) ; } if ( values == null ) { throw new DBFException ( "... | Add a record . |
152,894 | public void close ( ) { if ( this . closed ) { return ; } this . closed = true ; if ( this . raf != null ) { try { this . header . numberOfRecords = this . recordCount ; this . raf . seek ( 0 ) ; this . header . write ( this . raf ) ; this . raf . seek ( this . raf . length ( ) ) ; this . raf . writeByte ( END_OF_DATA ... | In sync mode write the header and close the file |
152,895 | public String getString ( int columnIndex ) { if ( columnIndex < 0 || columnIndex >= data . length ) { throw new IllegalArgumentException ( "Invalid index field: (" + columnIndex + "). Valid range is 0 to " + ( data . length - 1 ) ) ; } Object fieldValue = data [ columnIndex ] ; if ( fieldValue == null ) { return null ... | Reads the data as string |
152,896 | public BigDecimal getBigDecimal ( int columnIndex ) { Object fieldValue = data [ columnIndex ] ; if ( fieldValue == null ) { return null ; } if ( fieldValue instanceof BigDecimal ) { return ( BigDecimal ) fieldValue ; } throw new DBFException ( "Unsupported type for BigDecimal at column:" + columnIndex + " " + fieldVal... | Reads the data as BigDecimal |
152,897 | public boolean getBoolean ( int columnIndex ) { Object fieldValue = data [ columnIndex ] ; if ( fieldValue == null ) { return Boolean . FALSE ; } if ( fieldValue instanceof Boolean ) { return ( Boolean ) fieldValue ; } throw new DBFException ( "Unsupported type for Boolean at column:" + columnIndex + " " + fieldValue .... | Reads the data as Boolean |
152,898 | public Date getDate ( int columnIndex ) { Object fieldValue = data [ columnIndex ] ; if ( fieldValue == null ) { return null ; } if ( fieldValue instanceof Date ) { return ( Date ) fieldValue ; } throw new DBFException ( "Unsupported type for Date at column:" + columnIndex + " " + fieldValue . getClass ( ) . getCanonic... | Reads the data as Date |
152,899 | public double getDouble ( int columnIndex ) { Object fieldValue = data [ columnIndex ] ; if ( fieldValue == null ) { return 0.0 ; } if ( fieldValue instanceof Number ) { return ( ( Number ) fieldValue ) . doubleValue ( ) ; } throw new DBFException ( "Unsupported type for Number at column:" + columnIndex + " " + fieldVa... | Reads the data as Double |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.