idx int64 0 41.2k | question stringlengths 73 5.81k | target stringlengths 5 918 |
|---|---|---|
38,900 | public static boolean createFolder ( String path ) { File direct = new File ( Environment . getExternalStorageDirectory ( ) + "/" + path ) ; if ( ! direct . exists ( ) ) { if ( direct . mkdir ( ) ) { return true ; } } return false ; } | Create folder in the SDCard |
38,901 | private static void writeToFile ( String text , String logFilePath , boolean isDetailed ) { if ( isSDCardAvailable ( ) && isSDCardWritable ( ) && text != null ) { try { File file = new File ( logFilePath ) ; OutputStream os = new FileOutputStream ( file , true ) ; if ( isDetailed ) { os . write ( ( "---" + new SimpleDa... | private write to file method |
38,902 | public static byte [ ] readAsBytes ( InputStream inputStream ) throws IOException { int cnt = 0 ; byte [ ] buffer = new byte [ BUFFER_SIZE ] ; InputStream is = new BufferedInputStream ( inputStream ) ; try { ByteArrayOutputStream outputStream = new ByteArrayOutputStream ( ) ; cnt = is . read ( buffer ) ; while ( cnt !=... | Reads the inputStream and returns a byte array with all the information |
38,903 | @ SuppressWarnings ( "InfiniteLoopStatement" ) public void run ( ) { try { while ( true ) { try { cleanUp ( queue . remove ( ) ) ; } catch ( InterruptedException e ) { } } } catch ( ShutDown shutDown ) { } } | Loops continuously pulling references off the queue and cleaning them up . |
38,904 | protected boolean setFrame ( int l , int t , int r , int b ) { if ( getDrawable ( ) == null ) { return super . setFrame ( l , t , r , b ) ; } Matrix matrix = getImageMatrix ( ) ; float scaleFactor = getWidth ( ) / ( float ) getDrawable ( ) . getIntrinsicWidth ( ) ; matrix . setScale ( scaleFactor , scaleFactor , 0 , 0 ... | Top crop scale type |
38,905 | public View newDropDownView ( LayoutInflater inflater , int position , ViewGroup container ) { return newView ( inflater , position , container ) ; } | Create a new instance of a drop - down view for the specified position . |
38,906 | public Map < ModelField , Set < Command > > process ( ModelFactory modelFactory , Erector erector , Object model ) throws PolicyException { Map < ModelField , Set < Command > > modelFieldCommands = new HashMap < ModelField , Set < Command > > ( ) ; for ( ModelField modelField : erector . getModelFields ( ) ) { logger .... | Prevents Model from being set by the Reference Model |
38,907 | protected Object createNewInstance ( Erector erector ) throws BlueprintTemplateException { SpringBlueprint springBlueprint = erector . getBlueprint ( ) . getClass ( ) . getAnnotation ( SpringBlueprint . class ) ; if ( springBlueprint != null && springBlueprint . bean ( ) ) { Class beanClass = springBlueprint . beanClas... | Create new instance of model before blueprint values are set . Autowire them from Spring Context if they have the SpringBlueprint annotation |
38,908 | public void registerBlueprint ( Object blueprint ) throws RegisterBlueprintException { SpringBlueprint springBlueprint = blueprint . getClass ( ) . getAnnotation ( SpringBlueprint . class ) ; if ( springBlueprint != null && springBlueprint . autowire ( ) ) { logger . debug ( "Autowiring blueprint {}" , blueprint ) ; be... | Register Blueprints autowire them from Spring Context if they have the SpringBlueprint annotation |
38,909 | public void addPolicy ( Policy policy ) throws PolicyException { if ( policy instanceof BlueprintPolicy ) { if ( erectors . get ( policy . getTarget ( ) ) == null ) { throw new PolicyException ( "Blueprint does not exist for BlueprintPolicy target: " + policy . getTarget ( ) ) ; } List < BlueprintPolicy > policies = bl... | Add Policy to ModelFactory |
38,910 | public void setRegisterBlueprintsByPackage ( String _package ) throws RegisterBlueprintException { Set < Class < ? > > annotated = null ; try { annotated = new ClassesInPackageScanner ( ) . findAnnotatedClasses ( _package , Blueprint . class ) ; } catch ( IOException e ) { throw new RegisterBlueprintException ( e ) ; }... | Register all Blueprint in package . |
38,911 | public void setRegisterBlueprints ( Collection blueprints ) throws RegisterBlueprintException { for ( Object blueprint : blueprints ) { if ( blueprint instanceof Class ) { registerBlueprint ( ( Class ) blueprint ) ; } else if ( blueprint instanceof String ) { registerBlueprint ( ( String ) blueprint ) ; } else if ( blu... | Register a List of Blueprint Class or String class names of Blueprint |
38,912 | public void registerBlueprint ( String className ) throws RegisterBlueprintException { try { registerBlueprint ( Class . forName ( className ) ) ; } catch ( ClassNotFoundException e ) { throw new RegisterBlueprintException ( e ) ; } } | Register a Blueprint from a String Class name |
38,913 | public void registerBlueprint ( Class clazz ) throws RegisterBlueprintException { Object blueprint = null ; try { blueprint = clazz . newInstance ( ) ; } catch ( InstantiationException e ) { throw new RegisterBlueprintException ( e ) ; } catch ( IllegalAccessException e ) { throw new RegisterBlueprintException ( e ) ; ... | Register a Blueprint from Class |
38,914 | @ SuppressWarnings ( { "rawtypes" , "unchecked" } ) public < T > T createModel ( T referenceModel , boolean withPolicies ) throws CreateModelException { Erector erector = erectors . get ( referenceModel . getClass ( ) ) ; if ( erector == null ) { throw new CreateModelException ( "Unregistered class: " + referenceModel ... | Create a Model for a registered Blueprint . Values set in the model will not be overridden by defaults in the Blueprint . |
38,915 | public static GsonBuilder registerAll ( GsonBuilder gsonBuilder ) { registerInstant ( gsonBuilder ) ; registerLocalDate ( gsonBuilder ) ; registerLocalDateTime ( gsonBuilder ) ; registerLocalTime ( gsonBuilder ) ; registerLocalDate ( gsonBuilder ) ; registerOffsetDateTime ( gsonBuilder ) ; registerOffsetTime ( gsonBuil... | A convenient method to register all supported ThreeTen BP types . |
38,916 | private Set < Class < ? extends Annotation > > getSupportedAnnotations ( ) { Set < Class < ? extends Annotation > > annotations = new LinkedHashSet < > ( ) ; annotations . add ( Remoter . class ) ; return annotations ; } | Only one annotation is supported at class level - |
38,917 | public void generateProxy ( Element element ) { try { getClassBuilder ( element ) . buildProxyClass ( ) . build ( ) . writeTo ( filer ) ; } catch ( Exception ex ) { messager . printMessage ( Diagnostic . Kind . WARNING , "Error while generating Proxy " + ex . getMessage ( ) ) ; } } | Generates the Proxy for the given |
38,918 | public void generateStub ( Element element ) { try { getClassBuilder ( element ) . buildStubClass ( ) . build ( ) . writeTo ( filer ) ; } catch ( Exception ex ) { messager . printMessage ( Diagnostic . Kind . WARNING , "Error while generating Stub " + ex . getMessage ( ) ) ; } } | Generates the Stub for the given |
38,919 | public TypeElement getGenericType ( TypeMirror typeMirror ) { return typeMirror . accept ( new SimpleTypeVisitor6 < TypeElement , Void > ( ) { public TypeElement visitDeclared ( DeclaredType declaredType , Void v ) { TypeElement genericTypeElement = null ; TypeElement typeElement = ( TypeElement ) declaredType . asElem... | Return the generic type if any |
38,920 | public void writeParamsToStub ( VariableElement param , ParamType paramType , String paramName , MethodSpec . Builder methodBuilder ) { methodBuilder . addStatement ( "$T " + paramName , param . asType ( ) ) ; } | Called to generate code to write params for stub |
38,921 | public void writeOutParamsToStub ( VariableElement param , ParamType paramType , String paramName , MethodSpec . Builder methodBuilder ) { if ( paramType != ParamType . IN ) { methodBuilder . addStatement ( "int " + paramName + "_length = data.readInt()" ) ; methodBuilder . beginControlFlow ( "if (" + paramName + "_len... | Called to generate code to write |
38,922 | protected void writeArrayOutParamsToProxy ( VariableElement param , MethodSpec . Builder methodBuilder ) { methodBuilder . beginControlFlow ( "if (" + param . getSimpleName ( ) + " == null)" ) ; methodBuilder . addStatement ( "data.writeInt(-1)" ) ; methodBuilder . endControlFlow ( ) ; methodBuilder . beginControlFlow ... | Called to generate code that writes the out params for array type |
38,923 | public void addStubMethods ( TypeSpec . Builder classBuilder ) { MethodSpec . Builder methodBuilder = MethodSpec . methodBuilder ( "onTransact" ) . addModifiers ( Modifier . PUBLIC ) . addAnnotation ( Override . class ) . returns ( boolean . class ) . addException ( ClassName . get ( "android.os" , "RemoteException" ) ... | Build the stub methods |
38,924 | private void addProxyExtras ( TypeSpec . Builder classBuilder ) { addRemoterProxyMethods ( classBuilder ) ; addProxyDeathMethod ( classBuilder , "linkToDeath" , "Register a {@link android.os.IBinder.DeathRecipient} to know of binder connection lose\n" ) ; addProxyDeathMethod ( classBuilder , "unlinkToDeath" , "UnRegist... | Add other extra methods |
38,925 | private void addProxyDestroyMethods ( TypeSpec . Builder classBuilder ) { MethodSpec . Builder methodBuilder = MethodSpec . methodBuilder ( "destroyStub" ) . addModifiers ( Modifier . PUBLIC ) . addAnnotation ( Override . class ) . addParameter ( Object . class , "object" ) . returns ( TypeName . VOID ) . beginControlF... | Add proxy method for destroystub |
38,926 | private void addProxyDeathMethod ( TypeSpec . Builder classBuilder , String deathMethod , String doc ) { MethodSpec . Builder methodBuilder = MethodSpec . methodBuilder ( deathMethod ) . addModifiers ( Modifier . PUBLIC ) . returns ( TypeName . VOID ) . addParameter ( ClassName . get ( "android.os" , "IBinder.DeathReci... | Add proxy method that exposes the linkToDeath |
38,927 | private void addProxyRemoteAlive ( TypeSpec . Builder classBuilder ) { MethodSpec . Builder methodBuilder = MethodSpec . methodBuilder ( "isRemoteAlive" ) . addModifiers ( Modifier . PUBLIC ) . returns ( boolean . class ) . addStatement ( "boolean alive = false" ) . beginControlFlow ( "try" ) . addStatement ( "alive = ... | Add proxy method that exposes whether remote is alive |
38,928 | private void addProxyCheckException ( TypeSpec . Builder classBuilder ) { MethodSpec . Builder methodBuilder = MethodSpec . methodBuilder ( "checkException" ) . addModifiers ( Modifier . PRIVATE ) . returns ( Throwable . class ) . addParameter ( ClassName . get ( "android.os" , "Parcel" ) , "reply" ) . addStatement ( "... | Add proxy method to check for exception |
38,929 | private void addHashCode ( TypeSpec . Builder classBuilder ) { MethodSpec . Builder methodBuilder = MethodSpec . methodBuilder ( "hashCode" ) . addModifiers ( Modifier . PUBLIC ) . returns ( int . class ) . addAnnotation ( Override . class ) . addStatement ( "return _binderID" ) ; classBuilder . addMethod ( methodBuild... | Add proxy method to set hashcode to uniqueu id of binder |
38,930 | private void addEquals ( TypeSpec . Builder classBuilder ) { MethodSpec . Builder methodBuilder = MethodSpec . methodBuilder ( "equals" ) . addModifiers ( Modifier . PUBLIC ) . addParameter ( ClassName . get ( Object . class ) , "obj" ) . returns ( boolean . class ) . addAnnotation ( Override . class ) . addStatement (... | Add proxy method for equals |
38,931 | private void addGetId ( TypeSpec . Builder classBuilder ) { MethodSpec . Builder methodBuilder = MethodSpec . methodBuilder ( "__getStubID" ) . addModifiers ( Modifier . PRIVATE ) . returns ( int . class ) . addStatement ( "android.os.Parcel data = android.os.Parcel.obtain()" ) . addStatement ( "android.os.Parcel reply... | Add proxy method to get unique id |
38,932 | private TypeSpec getBinderWrapper ( ) { TypeSpec . Builder staticBinderWrapperClassBuilder = TypeSpec . classBuilder ( "BinderWrapper" ) . addModifiers ( Modifier . PRIVATE ) . addModifiers ( Modifier . STATIC ) . addField ( ClassName . get ( "android.os" , "IBinder" ) , "binder" , Modifier . PRIVATE ) . addMethod ( Me... | Add the static inner Binder wrapper |
38,933 | private TypeSpec getDeathRecipientWrapper ( ) { TypeSpec . Builder staticBinderWrapperClassBuilder = TypeSpec . classBuilder ( "DeathRecipient" ) . addModifiers ( Modifier . PRIVATE ) . addModifiers ( Modifier . STATIC ) . addField ( RemoterProxyListener . class , "proxyListener" , Modifier . PRIVATE ) . addMethod ( Me... | Add the static inner DeathRecipient wrapper |
38,934 | protected void processRemoterElements ( TypeSpec . Builder classBuilder , ElementVisitor elementVisitor , MethodSpec . Builder methodBuilder ) { processRemoterElements ( classBuilder , getRemoterInterfaceElement ( ) , 0 , elementVisitor , methodBuilder ) ; } | Finds that elements that needs to be processed |
38,935 | private int processRemoterElements ( TypeSpec . Builder classBuilder , Element element , int methodIndex , ElementVisitor elementVisitor , MethodSpec . Builder methodBuilder ) { if ( element instanceof TypeElement ) { for ( TypeMirror typeMirror : ( ( TypeElement ) element ) . getInterfaces ( ) ) { if ( typeMirror inst... | Recursevely Visit extended elements |
38,936 | public < V extends View > V get ( int id ) { Object result = mViews . get ( id ) ; if ( result == NULL ) { return null ; } if ( result != null ) { return cast ( result ) ; } result = mView . findViewById ( id ) ; if ( result == null ) { mViews . put ( id , NULL ) ; } else { mViews . put ( id , result ) ; } return cast ... | Gets the child view by id . |
38,937 | @ SuppressWarnings ( "unchecked" ) protected final U fromObject ( Object value ) { return value == NULL ? null : ( U ) value ; } | Cast the object back to a typed value . |
38,938 | public final < R > R as ( IxFunction < ? super Ix < T > , R > transformer ) { return transformer . apply ( this ) ; } | Calls the given transformers with this and returns its value allowing fluent conversions to non - Ix types . |
38,939 | @ SuppressWarnings ( "unchecked" ) public final T first ( T defaultValue ) { if ( this instanceof Callable ) { return checkedCall ( ( Callable < T > ) this ) ; } Iterator < T > it = iterator ( ) ; if ( it . hasNext ( ) ) { return it . next ( ) ; } return defaultValue ; } | Returns the first element of this sequence or the defaultValue if this sequence is empty . |
38,940 | public final < U extends Collection < ? super T > > U into ( U collection ) { for ( T v : this ) { collection . add ( v ) ; } return collection ; } | Consumes the entire sequence and adds each element into the given collection that is also returned . |
38,941 | @ SuppressWarnings ( "unchecked" ) public final T last ( ) { if ( this instanceof Callable ) { return checkedCall ( ( Callable < T > ) this ) ; } Iterator < T > it = iterator ( ) ; if ( ! it . hasNext ( ) ) { throw new NoSuchElementException ( ) ; } for ( ; ; ) { T t = it . next ( ) ; if ( ! it . hasNext ( ) ) { return... | Returns the last element of this sequence . |
38,942 | public final void print ( CharSequence separator , int charsPerLine ) { boolean first = true ; int len = 0 ; for ( T v : this ) { String s = String . valueOf ( v ) ; if ( first ) { System . out . print ( s ) ; len += s . length ( ) ; first = false ; } else { System . out . print ( separator ) ; len += separator . lengt... | Prints the elements of this sequence to the console separated by the given separator and with a line break after roughly the given charsPerLine amount . |
38,943 | public final void println ( CharSequence prefix ) { for ( T v : this ) { System . out . print ( prefix ) ; System . out . println ( v ) ; } } | Prints each element of this sequence into a new line on the console prefixed by the given character sequence . |
38,944 | public final void removeAll ( IxPredicate < ? super T > predicate ) { Iterator < T > it = iterator ( ) ; while ( it . hasNext ( ) ) { T v = it . next ( ) ; if ( predicate . test ( v ) ) { it . remove ( ) ; } } } | Consumes this Iterable and removes all elements for which the predicate returns true ; in other words remove those elements of a mutable source that match the predicate . |
38,945 | public final T single ( ) { Iterator < T > it = iterator ( ) ; if ( it . hasNext ( ) ) { T v = it . next ( ) ; if ( it . hasNext ( ) ) { throw new IndexOutOfBoundsException ( "The source has more than one element." ) ; } return v ; } throw new NoSuchElementException ( "The source is empty." ) ; } | Returns the single element of this sequence or throws a NoSuchElementException if this sequence is empty or IndexOutOfBoundsException if this sequence has more than on element |
38,946 | public final void subscribe ( IxConsumer < ? super T > onNext , IxConsumer < Throwable > onError ) { try { for ( T v : this ) { onNext . accept ( v ) ; } } catch ( Throwable ex ) { onError . accept ( ex ) ; } } | Iterates over this sequence and calls the given onNext action with each element and calls the onError with any exception thrown by the iteration or the onNext action . |
38,947 | public final void subscribe ( IxConsumer < ? super T > onNext , IxConsumer < Throwable > onError , Runnable onCompleted ) { try { for ( T v : this ) { onNext . accept ( v ) ; } } catch ( Throwable ex ) { onError . accept ( ex ) ; return ; } onCompleted . run ( ) ; } | Iterates over this sequence and calls the given onNext action with each element and calls the onError with any exception thrown by the iteration or the onNext action ; otherwise calls the onCompleted action when the sequence completes without exception . |
38,948 | protected static < U > U nullCheck ( U value , String message ) { if ( value == null ) { throw new NullPointerException ( message ) ; } return value ; } | Checks if the value is null and if so throws a NullPointerException with the given message . |
38,949 | public static Stream < Statement > encode ( final Stream < ? extends Outcome > stream ) { Preconditions . checkNotNull ( stream ) ; return Record . encode ( stream . transform ( new Function < Outcome , Record > ( ) { public Record apply ( final Outcome outcome ) { return outcome . toRecord ( ) ; } } , 0 ) , ImmutableS... | Performs outcome - to - RDF encoding by converting a stream of outcomes in a stream of RDF statements . |
38,950 | public void createConfiguration ( final Properties properties ) { setHbcfg ( HBaseConfiguration . create ( ) ) ; getHbcfg ( ) . set ( HBASE_ZOOKEEPER_QUORUM , properties . getProperty ( HBASE_ZOOKEEPER_QUORUM , "hlt-services4" ) ) ; getHbcfg ( ) . set ( HBASE_ZOOKEEPER_CLIENT_PORT , properties . getProperty ( HBASE_ZOO... | Creates an HBase configuration object . |
38,951 | public FilterList getFilter ( XPath condition , boolean passAll , String [ ] famNames , String [ ] qualNames , String [ ] params ) { FilterList list = new FilterList ( ( passAll ) ? FilterList . Operator . MUST_PASS_ALL : FilterList . Operator . MUST_PASS_ONE ) ; for ( int iCont = 0 ; iCont < famNames . length ; iCont ... | Gets filter based on the condition to be performed |
38,952 | public Scan getResultScan ( String tableName , String famName , ByteBuffer startKey , ByteBuffer endKey ) throws IOException { logger . debug ( "AbstractHBaseUtils Begin of getResultScan(" + tableName + ", " + famName + ")" ) ; Scan scan = new Scan ( ) ; scan . addFamily ( Bytes . toBytes ( famName ) ) ; if ( startKey ... | Creates a scan |
38,953 | public Scan getScan ( String tableName , String famName ) throws IOException { return getResultScan ( tableName , famName , null , null ) ; } | Creates a result scanner |
38,954 | public static String decompress ( final byte [ ] strBytes ) { if ( strBytes [ 0 ] == UNCOMPRESSED_FLAG ) { return new String ( strBytes , 1 , strBytes . length , Charsets . UTF_8 ) ; } final StringBuilder out = new StringBuilder ( ) ; for ( int i = 0 ; i < strBytes . length ; i ++ ) { final char b = ( char ) ( 0xFF & s... | Decompress byte array from compress back into String |
38,955 | private static void outputVerb ( final ByteArrayOutputStream baos , final String str ) { if ( str . length ( ) == 1 ) { baos . write ( 254 ) ; baos . write ( str . toCharArray ( ) [ 0 ] ) ; } else { final byte [ ] bytes = str . getBytes ( Charsets . UTF_8 ) ; baos . write ( 255 ) ; baos . write ( str . length ( ) ) ; b... | Outputs the verbatim string to the output stream |
38,956 | public static < T > Stream < T > create ( final Iterator < ? extends T > iterator ) { if ( iterator . hasNext ( ) ) { return new IteratorStream < T > ( iterator ) ; } else { return new EmptyStream < T > ( ) ; } } | Creates a new Stream over the elements returned by the supplied Iterator . |
38,957 | public static < T > Stream < T > create ( final Iteration < ? extends T , ? > iteration ) { return new IterationStream < T > ( iteration ) ; } | Creates a new Stream over the elements returned by the supplied Sesame Iteration . |
38,958 | public static < T > Stream < T > create ( final Enumeration < ? extends T > enumeration ) { if ( enumeration . hasMoreElements ( ) ) { return new IteratorStream < T > ( Iterators . forEnumeration ( enumeration ) ) ; } else { return new EmptyStream < T > ( ) ; } } | Creates a new Stream over the elements returned by the supplied Enumeration . |
38,959 | public static < T > Stream < T > concat ( final Iterable < ? extends Iterable < ? extends T > > iterables ) { return new ConcatStream < Iterable < ? extends T > , T > ( create ( iterables ) ) ; } | Returns a Stream concatenating zero or more Iterables . If an input Iterable is a Stream it is closed as soon as exhausted or as iteration completes . |
38,960 | public final long count ( ) { final AtomicLong result = new AtomicLong ( ) ; toHandler ( new Handler < T > ( ) { private long count ; public void handle ( final T element ) { if ( element != null ) { ++ this . count ; } else { result . set ( this . count ) ; } } } ) ; return result . get ( ) ; } | Terminal operation returning the number of elements in this Stream . Note that only few elements are materialized at any time so it is safe to use this method with arbitrarily large Streams . |
38,961 | public final T [ ] toArray ( final Class < T > elementClass ) { return Iterables . toArray ( toCollection ( Lists . < T > newArrayListWithCapacity ( 256 ) ) , elementClass ) ; } | Terminal operation returning an array of the specified type with all the elements of this Stream . Call this method only if there is enough memory to hold the resulting array . |
38,962 | public final < C extends Collection < ? super T > > C toCollection ( final C collection ) { Preconditions . checkNotNull ( collection ) ; toHandler ( new Handler < T > ( ) { public void handle ( final T element ) { if ( element != null ) { collection . add ( element ) ; } } } ) ; return collection ; } | Terminal operation storing all the elements of this Stream in the supplied Collection . Call this method only if the target Collection can hold all the remaining elements . |
38,963 | public final T getUnique ( final T defaultValue ) { try { final T result = getUnique ( ) ; if ( result != null ) { return result ; } } catch ( final Throwable ex ) { } return defaultValue ; } | Terminal operation returning the only element in this Stream or the default value specified if there are no elements multiple elements or an Exception occurs . |
38,964 | public static boolean regexMatch ( String input , String regex ) { return Pattern . compile ( regex ) . matcher ( input ) . matches ( ) ; } | If input matched regex |
38,965 | public synchronized Operation timeout ( final Long timeout ) { this . timeout = timeout == null || timeout > 0 ? timeout : null ; return this ; } | Sets the optional timeout for this operation in milliseconds . Passing null or a non - positive value will remove any timeout previously set . |
38,966 | private void checkAndCreateTable ( final String tabName , final String colFamName ) throws IOException { hbaseUtils . checkAndCreateTable ( tabName , colFamName ) ; } | Verifies the existence of tables . |
38,967 | public final void merge ( final Record oldRecord , final Record newRecord ) { Preconditions . checkNotNull ( oldRecord ) ; for ( final URI property : newRecord . getProperties ( ) ) { if ( appliesTo ( property ) ) { oldRecord . set ( property , merge ( property , oldRecord . get ( property ) , newRecord . get ( propert... | Merges all supported properties in common to the old and new record specified storing the results in the old record . |
38,968 | public static void main ( final String ... args ) { final Options options = new Options ( ) ; options . addOption ( "c" , "config" , true , "use service configuration file / classpath " + "resource (default '" + DEFAULT_CONFIG + "')" ) ; options . addOption ( "v" , "version" , false , "display version and copyright inf... | Program entry point . See class documentation for the supported features . |
38,969 | public void add ( final Statement statement ) throws DataCorruptedException , IOException { Preconditions . checkNotNull ( statement ) ; checkWritable ( ) ; try { this . connection . add ( statement ) ; } catch ( final RepositoryException ex ) { throw new IOException ( "Failed to add statement: " + statement , ex ) ; }... | Adds the specified RDF statement to the triple store . Virtuoso may buffer the operation performing it when more opportune and in any case ensuring that the same effects are produced as obtainable by directly executing the operation . |
38,970 | public void remove ( final Statement statement ) throws DataCorruptedException , IOException { Preconditions . checkState ( ! this . readOnly ) ; checkWritable ( ) ; try { this . connection . remove ( statement ) ; } catch ( final RepositoryException ex ) { throw new IOException ( "Failed to remove statement: " + state... | Removes the specified RDF statement from the triple store . Virtuoso may buffer the operation performing it when more opportune and in any case ensuring that the same effects are produced as obtainable by directly executing the operation . |
38,971 | public void removeBulk ( final Iterable < ? extends Statement > statements , final boolean transaction ) throws DataCorruptedException , IOException { Preconditions . checkNotNull ( statements ) ; checkWritable ( ) ; try { if ( ! transaction && ! this . store . existsTransactionMarker ( ) ) { this . store . addTransact... | Removes the specified RDF statements from the triple store . Implementations are designed to perform high throughput insertion . |
38,972 | public < T > T getUnique ( final URI property , final Class < T > valueClass , final T defaultValue ) { try { final T value = getUnique ( property , valueClass ) ; return value == null ? defaultValue : value ; } catch ( final IllegalStateException ex ) { return defaultValue ; } catch ( final IllegalArgumentException ex... | Returns the unique value of the property converted to an instance of a certain class or the default value supplied in case of failure . |
38,973 | public < T > List < T > get ( final URI property , final Class < T > valueClass , final List < T > defaultValue ) { try { final List < T > values = get ( property , valueClass ) ; return values . isEmpty ( ) ? defaultValue : values ; } catch ( final IllegalArgumentException ex ) { return defaultValue ; } } | Returns the values of the property converted to instances of a certain class or the default value supplied in case of failure or if the property has no values . |
38,974 | public synchronized Record retain ( final URI ... properties ) { for ( final URI property : doGetProperties ( ) ) { boolean retain = false ; for ( int i = 0 ; i < properties . length ; ++ i ) { if ( property . equals ( properties [ i ] ) ) { retain = true ; break ; } } if ( ! retain ) { doSet ( property , ImmutableSet ... | Retains only the properties specified clearing the remaining ones . Note that the ID is not affected . |
38,975 | public synchronized Record clear ( final URI ... properties ) { final List < URI > propertiesToClear ; if ( properties == null || properties . length == 0 ) { propertiesToClear = doGetProperties ( ) ; } else { propertiesToClear = Arrays . asList ( properties ) ; } for ( final URI property : propertiesToClear ) { doSet ... | Clears the properties specified or all the stored properties if no property is specified . Note that the ID is not affected . |
38,976 | public Record get ( final String tableName , final URI id ) throws IOException { logger . debug ( "TEPHRA Begin of get(" + tableName + ", " + id + ")" ) ; final TransactionAwareHTable txTable = ( TransactionAwareHTable ) getTable ( tableName ) ; Record resGotten = null ; if ( txTable != null ) { final Get get = new Get... | Gets a Record based on information passed . |
38,977 | private Record getRecord ( final URI layer , final URI id ) throws Throwable { final Record record = id == null ? null : getSession ( ) . retrieve ( layer ) . ids ( id ) . exec ( ) . getUnique ( ) ; if ( record != null && layer . equals ( KS . MENTION ) ) { final String template = "SELECT ?e WHERE { ?e $$ $$ " + ( getU... | DATA ACCESS METHODS |
38,978 | public static Iterable < String > renderSolutionTable ( final List < String > variables , final Iterable < ? extends BindingSet > solutions ) { final List < String > actualVariables ; if ( variables != null ) { actualVariables = ImmutableList . copyOf ( variables ) ; } else { final Set < String > variableSet = Sets . n... | Render in a streaming - way the solutions of a SPARQL SELECT query to an HTML table emitting an iterable with of HTML fragments . |
38,979 | public static String escapeHtml ( final Object object ) { return object == null ? null : HtmlEscapers . htmlEscaper ( ) . escape ( object . toString ( ) ) ; } | Transforms the supplied object to an escaped HTML string . |
38,980 | public void processPut ( Record record , String tabName , String famName , String quaName ) { logger . debug ( "NATIVE Begin processPut(" + record + ", " + tabName + ")" ) ; HTable hTable = getTable ( tabName ) ; try { Put op = createPut ( record , tabName , famName , quaName ) ; hTable . put ( op ) ; } catch ( IOExcep... | Process put operations on an HBase table . |
38,981 | public void processDelete ( URI id , String tabName , String famName , String quaName ) { logger . debug ( "NATIVE Begin processDelete(" + id + ", " + tabName + ")" ) ; HTable hTable = getTable ( tabName ) ; try { Delete op = createDelete ( id , tabName ) ; hTable . delete ( op ) ; } catch ( IOException e ) { logger . ... | Process delete operations on an HBase table . |
38,982 | public Put createPut ( Record record , String tableName , String famName , String quaName ) throws IOException { HTable hTable = getTable ( tableName ) ; Put put = null ; if ( hTable != null ) { AvroSerializer serializer = getSerializer ( ) ; final byte [ ] bytes = serializer . toBytes ( record ) ; put = new Put ( Byte... | Creates puts for HBase |
38,983 | public List < Object > checkForErrors ( Object [ ] objs ) { List < Object > errors = new ArrayList < Object > ( ) ; if ( objs != null ) { for ( int cont = 0 ; cont < objs . length ; cont ++ ) { if ( objs [ cont ] == null ) { logger . debug ( "A operation could not be performed." ) ; errors . add ( objs [ cont ] ) ; } }... | Checking for errors after operations have been processed . |
38,984 | protected IEncoder getAppliedEncoder ( DataUrlEncoding encoding ) { switch ( encoding ) { case BASE64 : return base64Encoder ; case URL : return urlEncodedEncoder ; } throw new IllegalArgumentException ( ) ; } | Get the matching encoder for the given encoding |
38,985 | private static byte [ ] pad ( byte [ ] in ) { final byte [ ] result = Arrays . copyOf ( in , 16 ) ; new ISO7816d4Padding ( ) . addPadding ( result , in . length ) ; return result ; } | First bit 1 following bits 0 . |
38,986 | public static void shallowCopyFieldState ( final Object src , final Object dest ) { if ( src == null ) { throw new IllegalArgumentException ( "Source for field copy cannot be null" ) ; } if ( dest == null ) { throw new IllegalArgumentException ( "Destination for field copy cannot be null" ) ; } if ( ! src . getClass ( ... | Given the source object and the destination which must be the same class or a subclass copy all fields including inherited fields . Designed to work on objects with public no - arg constructors . |
38,987 | public static Object [ ] insertArray ( Object obj , Object [ ] arr ) { Object [ ] newArr = new Object [ arr . length + 1 ] ; System . arraycopy ( arr , 0 , newArr , 1 , arr . length ) ; newArr [ 0 ] = obj ; return newArr ; } | Insert an Object at front of array |
38,988 | public static Object [ ] appendArray ( Object [ ] arr , Object obj ) { Object [ ] newArr = new Object [ arr . length + 1 ] ; System . arraycopy ( arr , 0 , newArr , 0 , arr . length ) ; newArr [ arr . length ] = obj ; return newArr ; } | Append an Object at end of array |
38,989 | public static String [ ] appendStrArray ( String [ ] arr , String str ) { String [ ] newArr = new String [ arr . length + 1 ] ; System . arraycopy ( arr , 0 , newArr , 0 , arr . length ) ; newArr [ arr . length ] = str ; return newArr ; } | Append a String at end of String array |
38,990 | public static List < String > strArrayToList ( String [ ] arr ) { List < String > result = new ArrayList < String > ( ) ; if ( arr == null || arr . length == 0 ) return result ; for ( String str : arr ) result . add ( str ) ; return result ; } | Transfer a String array to String List |
38,991 | public static String [ ] strListToArray ( List < String > list ) { if ( list == null ) return new String [ 0 ] ; return list . toArray ( new String [ list . size ( ) ] ) ; } | Transfer a String List to String array |
38,992 | public static boolean isReservedWord ( Dialect dialect , String word ) { if ( ! isReservedWord ( word ) ) return false ; String fitDatabases = RESERVED_WORDS . get ( word . toUpperCase ( ) ) . toUpperCase ( ) ; if ( fitDatabases . contains ( "ANSI" ) ) return true ; String dia = dialect . toString ( ) . replace ( "Dial... | Check if is a dialect reserved word of ANSI - SQL reserved word |
38,993 | public static boolean isReservedWord ( String word ) { return ! StrUtils . isEmpty ( word ) && RESERVED_WORDS . containsKey ( word . toUpperCase ( ) ) ; } | Check if is a reserved word of any database |
38,994 | public static Dialect guessDialect ( DataSource dataSource ) { Dialect result = dataSourceDialectCache . get ( dataSource ) ; if ( result != null ) return result ; Connection con = null ; try { con = dataSource . getConnection ( ) ; result = guessDialect ( con ) ; if ( result == null ) return ( Dialect ) DialectExcepti... | Guess dialect based on given dataSource |
38,995 | public static int indexOfIgnoreCase ( final String str , final String searchStr ) { if ( searchStr . isEmpty ( ) || str . isEmpty ( ) ) { return str . indexOf ( searchStr ) ; } for ( int i = 0 ; i < str . length ( ) ; ++ i ) { if ( i + searchStr . length ( ) > str . length ( ) ) { return - 1 ; } int j = 0 ; int ii = i ... | Return first postion ignore case return - 1 if not found |
38,996 | public static int lastIndexOfIgnoreCase ( String str , String searchStr ) { if ( searchStr . isEmpty ( ) || str . isEmpty ( ) ) return - 1 ; return str . toLowerCase ( ) . lastIndexOf ( searchStr . toLowerCase ( ) ) ; } | Return last sub - String position ignore case return - 1 if not found |
38,997 | public static boolean arraysEqual ( Object [ ] array1 , Object [ ] array2 ) { if ( array1 == null || array1 . length == 0 || array2 == null || array2 . length == 0 ) DialectException . throwEX ( "StrUtils arraysEqual() method can not compare empty arrays" ) ; for ( int i = 0 ; array1 != null && array2 != null && i < ar... | Compare 2 array |
38,998 | public static String toLowerCaseFirstOne ( String s ) { if ( Character . isLowerCase ( s . charAt ( 0 ) ) ) return s ; else return ( new StringBuilder ( ) ) . append ( Character . toLowerCase ( s . charAt ( 0 ) ) ) . append ( s . substring ( 1 ) ) . toString ( ) ; } | First letter change to lower |
38,999 | public static String toUpperCaseFirstOne ( String s ) { if ( Character . isUpperCase ( s . charAt ( 0 ) ) ) return s ; else return ( new StringBuilder ( ) ) . append ( Character . toUpperCase ( s . charAt ( 0 ) ) ) . append ( s . substring ( 1 ) ) . toString ( ) ; } | First letter change to capitalised |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.