idx
int64
0
41.2k
question
stringlengths
83
4.15k
target
stringlengths
5
715
30,600
public void onItemBind ( int position , T item ) { if ( onItemBind != null ) { variableId = VAR_INVALID ; layoutRes = LAYOUT_NONE ; onItemBind . onItemBind ( this , position , item ) ; if ( variableId == VAR_INVALID ) { throw new IllegalStateException ( "variableId not set in onItemBind()" ) ; } if ( layoutRes == LAYOU...
Updates the state of the binding for the given item and position . This is called internally by the binding collection adapters .
30,601
public MergeObservableList < T > insertItem ( T object ) { lists . add ( Collections . singletonList ( object ) ) ; modCount += 1 ; listeners . notifyInserted ( this , size ( ) - 1 , 1 ) ; return this ; }
Inserts the given item into the merge list .
30,602
public boolean removeItem ( T object ) { int size = 0 ; for ( int i = 0 , listsSize = lists . size ( ) ; i < listsSize ; i ++ ) { List < ? extends T > list = lists . get ( i ) ; if ( ! ( list instanceof ObservableList ) ) { Object item = list . get ( 0 ) ; if ( ( object == null ) ? ( item == null ) : object . equals ( ...
Removes the given item from the merge list .
30,603
public void removeAll ( ) { int size = size ( ) ; if ( size == 0 ) { return ; } for ( int i = 0 , listSize = lists . size ( ) ; i < listSize ; i ++ ) { List < ? extends T > list = lists . get ( i ) ; if ( list instanceof ObservableList ) { ( ( ObservableList ) list ) . removeOnListChangedCallback ( callback ) ; } } lis...
Removes all items and lists from the merge list .
30,604
public static void endTransitions ( final ViewGroup sceneRoot ) { sPendingTransitions . remove ( sceneRoot ) ; final ArrayList < Transition > runningTransitions = getRunningTransitions ( sceneRoot ) ; if ( ! runningTransitions . isEmpty ( ) ) { ArrayList < Transition > copy = new ArrayList ( runningTransitions ) ; for ...
Ends all pending and ongoing transitions on the specified scene root .
30,605
public TransitionSet setOrdering ( int ordering ) { switch ( ordering ) { case ORDERING_SEQUENTIAL : mPlayTogether = false ; break ; case ORDERING_TOGETHER : mPlayTogether = true ; break ; default : throw new AndroidRuntimeException ( "Invalid parameter for TransitionSet " + "ordering: " + ordering ) ; } return this ; ...
Sets the play order of this set s child transitions .
30,606
public Transition getTransitionAt ( int index ) { if ( index < 0 || index >= mTransitions . size ( ) ) { return null ; } return mTransitions . get ( index ) ; }
Returns the child Transition at the specified position in the TransitionSet .
30,607
private static void extract ( String s , int start , ExtractFloatResult result ) { int currentIndex = start ; boolean foundSeparator = false ; result . mEndWithNegOrDot = false ; boolean secondDot = false ; boolean isExponential = false ; for ( ; currentIndex < s . length ( ) ; currentIndex ++ ) { boolean isPrevExponen...
Calculate the position of the next comma or space or negative sign
30,608
protected void runAnimators ( ) { if ( DBG ) { Log . d ( LOG_TAG , "runAnimators() on " + this ) ; } start ( ) ; ArrayMap < Animator , AnimationInfo > runningAnimators = getRunningAnimators ( ) ; for ( Animator anim : mAnimators ) { if ( DBG ) { Log . d ( LOG_TAG , " anim: " + anim ) ; } if ( runningAnimators . contai...
This is called internally once all animations have been set up by the transition hierarchy .
30,609
protected void start ( ) { if ( mNumInstances == 0 ) { if ( mListeners != null && mListeners . size ( ) > 0 ) { ArrayList < TransitionListener > tmpListeners = ( ArrayList < TransitionListener > ) mListeners . clone ( ) ; int numListeners = tmpListeners . size ( ) ; for ( int i = 0 ; i < numListeners ; ++ i ) { tmpList...
This method is called automatically by the transition and TransitionSet classes prior to a Transition subclass starting ; subclasses should not need to call it directly .
30,610
protected void cancel ( ) { int numAnimators = mCurrentAnimators . size ( ) ; for ( int i = numAnimators - 1 ; i >= 0 ; i -- ) { Animator animator = mCurrentAnimators . get ( i ) ; animator . cancel ( ) ; } if ( mListeners != null && mListeners . size ( ) > 0 ) { ArrayList < TransitionListener > tmpListeners = ( ArrayL...
This method cancels a transition that is currently running .
30,611
public BatchPoints point ( final Point point ) { point . getTags ( ) . putAll ( this . tags ) ; this . points . add ( point ) ; return this ; }
Add a single Point to these batches .
30,612
public String lineProtocol ( ) { StringBuilder sb = new StringBuilder ( ) ; for ( Point point : this . points ) { sb . append ( point . lineProtocol ( this . precision ) ) . append ( "\n" ) ; } return sb . toString ( ) ; }
calculate the lineprotocol for all Points .
30,613
public boolean isMergeAbleWith ( final BatchPoints that ) { return Objects . equals ( database , that . database ) && Objects . equals ( retentionPolicy , that . retentionPolicy ) && Objects . equals ( tags , that . tags ) && consistency == that . consistency ; }
Test whether is possible to merge two BatchPoints objects .
30,614
public boolean mergeIn ( final BatchPoints that ) { boolean mergeAble = isMergeAbleWith ( that ) ; if ( mergeAble ) { this . points . addAll ( that . points ) ; } return mergeAble ; }
Merge two BatchPoints objects .
30,615
public Iterable < QueryResult > traverse ( final InputStream is ) { MessageUnpacker unpacker = MessagePack . newDefaultUnpacker ( is ) ; return ( ) -> { return new Iterator < QueryResult > ( ) { public boolean hasNext ( ) { try { return unpacker . hasNext ( ) ; } catch ( IOException e ) { throw new InfluxDBException ( ...
Traverse over the whole message pack stream . This method can be used for converting query results in chunk .
30,616
public QueryResult parse ( final InputStream is ) { MessageUnpacker unpacker = MessagePack . newDefaultUnpacker ( is ) ; return parse ( unpacker ) ; }
Parse the message pack stream . This method can be used for converting query result from normal query response where exactly one QueryResult returned
30,617
public static void checkPositiveNumber ( final Number number , final String name ) throws IllegalArgumentException { if ( number == null || number . doubleValue ( ) <= 0 ) { throw new IllegalArgumentException ( "Expecting a positive number for " + name ) ; } }
Enforces that the number is larger than 0 .
30,618
public static void checkNotNegativeNumber ( final Number number , final String name ) throws IllegalArgumentException { if ( number == null || number . doubleValue ( ) < 0 ) { throw new IllegalArgumentException ( "Expecting a positive or zero number for " + name ) ; } }
Enforces that the number is not negative .
30,619
public static void checkDuration ( final String duration , final String name ) throws IllegalArgumentException { if ( ! duration . matches ( "(\\d+[wdmhs])+|inf" ) ) { throw new IllegalArgumentException ( "Invalid InfluxDB duration: " + duration + " for " + name ) ; } }
Enforces that the duration is a valid influxDB duration .
30,620
public BatchOptions jitterDuration ( final int jitterDuration ) { BatchOptions clone = getClone ( ) ; clone . jitterDuration = jitterDuration ; return clone ; }
Jitters the batch flush interval by a random amount . This is primarily to avoid large write spikes for users running a large number of client instances . ie a jitter of 5s and flush duration 10s means flushes will happen every 10 - 15s .
30,621
public BatchOptions bufferLimit ( final int bufferLimit ) { BatchOptions clone = getClone ( ) ; clone . bufferLimit = bufferLimit ; return clone ; }
The client maintains a buffer for failed writes so that the writes will be retried later on . This may help to overcome temporary network problems or InfluxDB load spikes . When the buffer is full and new points are written oldest entries in the buffer are lost .
30,622
private Call < QueryResult > callQuery ( final Query query ) { Call < QueryResult > call ; String db = query . getDatabase ( ) ; if ( db == null ) { db = this . database ; } if ( query instanceof BoundParameterQuery ) { BoundParameterQuery boundParameterQuery = ( BoundParameterQuery ) query ; call = this . influxDBServ...
Calls the influxDBService for the query .
30,623
public static InfluxDBException buildExceptionForErrorState ( final InputStream messagePackErrorBody ) { try { MessageUnpacker unpacker = MessagePack . newDefaultUnpacker ( messagePackErrorBody ) ; ImmutableMapValue mapVal = ( ImmutableMapValue ) unpacker . unpackValue ( ) ; return InfluxDBException . buildExceptionFro...
Create corresponding InfluxDBException from the message pack error body .
30,624
void put ( final AbstractBatchEntry batchEntry ) { try { this . queue . put ( batchEntry ) ; } catch ( InterruptedException e ) { throw new RuntimeException ( e ) ; } if ( this . queue . size ( ) >= this . actions ) { this . scheduler . submit ( new Runnable ( ) { public void run ( ) { write ( ) ; } } ) ; } }
Put a single BatchEntry to the cache for later processing .
30,625
public static Builder measurementByPOJO ( final Class < ? > clazz ) { Objects . requireNonNull ( clazz , "clazz" ) ; throwExceptionIfMissingAnnotation ( clazz , Measurement . class ) ; String measurementName = findMeasurementName ( clazz ) ; return new Builder ( measurementName ) ; }
Create a new Point Build build to create a new Point in a fluent manner from a POJO .
30,626
protected void restoreState ( View view , Set < ViewCommand < View > > currentState ) { if ( mViewCommands . isEmpty ( ) ) { return ; } mViewCommands . reapply ( view , currentState ) ; }
Apply saved state to attached view
30,627
public void attachView ( View view ) { if ( view == null ) { throw new IllegalArgumentException ( "Mvp view must be not null" ) ; } boolean isViewAdded = mViews . add ( view ) ; if ( ! isViewAdded ) { return ; } mInRestoreState . add ( view ) ; Set < ViewCommand < View > > currentState = mViewStates . get ( view ) ; cu...
Attach view to view state and apply saves state
30,628
public < T extends MvpPresenter > void add ( String tag , T instance ) { mPresenters . put ( tag , instance ) ; }
Add presenter to storage
30,629
@ SuppressWarnings ( "unused" ) public boolean isInRestoreState ( View view ) { if ( mViewState != null ) { return mViewState . isInRestoreState ( view ) ; } return false ; }
Check if view is in restore state or not
30,630
@ SuppressWarnings ( { "unchecked" , "unused" } ) public void setViewState ( MvpViewState < View > viewState ) { mViewStateAsView = ( View ) viewState ; mViewState = ( MvpViewState ) viewState ; }
Set view state to presenter
30,631
private static boolean hasMoxyReflector ( ) { if ( hasMoxyReflector != null ) { return hasMoxyReflector ; } try { new MoxyReflector ( ) ; hasMoxyReflector = true ; } catch ( NoClassDefFoundError error ) { hasMoxyReflector = false ; } return hasMoxyReflector ; }
Check is it have generated MoxyReflector without usage of reflection API
30,632
public void onSaveInstanceState ( Bundle outState ) { if ( mParentDelegate == null ) { Bundle moxyDelegateBundle = new Bundle ( ) ; outState . putBundle ( MOXY_DELEGATE_TAGS_KEY , moxyDelegateBundle ) ; outState = moxyDelegateBundle ; } outState . putAll ( mBundle ) ; outState . putString ( mKeyTag , mDelegateTag ) ; f...
Save presenters tag prefix to save state for restore presenters at future after delegate recreate
30,633
private static SortedMap < TypeElement , List < TypeElement > > getPresenterBinders ( List < TypeElement > presentersContainers ) { Map < TypeElement , TypeElement > extendingMap = new HashMap < > ( ) ; for ( TypeElement presentersContainer : presentersContainers ) { TypeMirror superclass = presentersContainer . getSup...
Collects presenter binders from superclasses that are also presenter containers .
30,634
public void injectPresenter ( MvpPresenter < ? > presenter , String delegateTag ) { Set < String > delegateTags = mConnections . get ( presenter ) ; if ( delegateTags == null ) { delegateTags = new HashSet < > ( ) ; mConnections . put ( presenter , delegateTags ) ; } delegateTags . add ( delegateTag ) ; Set < MvpPresen...
Save delegate tag when it inject presenter to delegate s object
30,635
public boolean rejectPresenter ( MvpPresenter < ? > presenter , String delegateTag ) { Set < MvpPresenter > presenters = mTags . get ( delegateTag ) ; if ( presenters != null ) { presenters . remove ( presenter ) ; } if ( presenters == null || presenters . isEmpty ( ) ) { mTags . remove ( delegateTag ) ; } Set < String...
Remove tag when delegate s object was fully destroyed
30,636
public void bind ( boolean wholeCore ) { if ( bound && assignedThread != null && assignedThread . isAlive ( ) ) throw new IllegalStateException ( "cpu " + cpuId + " already bound to " + assignedThread ) ; if ( areAssertionsEnabled ( ) ) boundHere = new Throwable ( "Bound here" ) ; if ( wholeCore ) { lockInventory . bin...
Bind the current thread to this reservable lock .
30,637
public static String toHexString ( final BitSet set ) { ByteArrayOutputStream out = new ByteArrayOutputStream ( ) ; PrintWriter writer = new PrintWriter ( out ) ; final long [ ] longs = set . toLongArray ( ) ; for ( long aLong : longs ) { writer . write ( Long . toHexString ( aLong ) ) ; } writer . flush ( ) ; return n...
Creates a hexademical representation of the bit set
30,638
int [ ] getChunkSizes ( Track track ) { long [ ] referenceChunkStarts = fragmenter . sampleNumbers ( track ) ; int [ ] chunkSizes = new int [ referenceChunkStarts . length ] ; for ( int i = 0 ; i < referenceChunkStarts . length ; i ++ ) { long start = referenceChunkStarts [ i ] - 1 ; long end ; if ( referenceChunkStart...
Gets the chunk sizes for the given track .
30,639
private void print ( FileChannel fc , int level , long start , long end ) throws IOException { fc . position ( start ) ; if ( end <= 0 ) { end = start + fc . size ( ) ; System . out . println ( "Setting END to " + end ) ; } while ( end - fc . position ( ) > 8 ) { long begin = fc . position ( ) ; ByteBuffer bb = ByteBuf...
Parses the FileChannel in the range [ start end ) and prints the elements found
30,640
public ParsableBox parseBox ( ReadableByteChannel byteChannel , String parentType ) throws IOException { header . get ( ) . rewind ( ) . limit ( 8 ) ; int bytesRead = 0 ; int b ; while ( ( b = byteChannel . read ( header . get ( ) ) ) + bytesRead < 8 ) { if ( b < 0 ) { throw new EOFException ( ) ; } else { bytesRead +=...
Parses the next size and type creates a box instance and parses the box s content .
30,641
public static List < long [ ] > getSyncSamplesTimestamps ( Movie movie , Track track ) { List < long [ ] > times = new LinkedList < long [ ] > ( ) ; for ( Track currentTrack : movie . getTracks ( ) ) { if ( currentTrack . getHandler ( ) . equals ( track . getHandler ( ) ) ) { long [ ] currentTrackSyncSamples = currentT...
Calculates the timestamp of all tracks sync samples .
30,642
public static int [ ] blowupCompositionTimes ( List < CompositionTimeToSample . Entry > entries ) { long numOfSamples = 0 ; for ( CompositionTimeToSample . Entry entry : entries ) { numOfSamples += entry . getCount ( ) ; } assert numOfSamples <= Integer . MAX_VALUE ; int [ ] decodingTime = new int [ ( int ) numOfSample...
Decompresses the list of entries and returns the list of composition times .
30,643
public static String readString ( ByteBuffer byteBuffer ) { ByteArrayOutputStream out = new ByteArrayOutputStream ( ) ; int read ; while ( ( read = byteBuffer . get ( ) ) != 0 ) { out . write ( read ) ; } return Utf8 . convert ( out . toByteArray ( ) ) ; }
Reads a zero terminated UTF - 8 string .
30,644
protected boolean isChunkReady ( StreamingTrack streamingTrack , StreamingSample next ) { long ts = nextSampleStartTime . get ( streamingTrack ) ; long cfst = nextChunkCreateStartTime . get ( streamingTrack ) ; return ( ts >= cfst + 2 * streamingTrack . getTimescale ( ) ) ; }
Tests if the currently received samples for a given track are already a chunk as we want to have it . The next sample will not be part of the chunk will be added to the fragment buffer later .
30,645
protected boolean isFragmentReady ( StreamingTrack streamingTrack , StreamingSample next ) { long ts = nextSampleStartTime . get ( streamingTrack ) ; long cfst = nextFragmentCreateStartTime . get ( streamingTrack ) ; if ( ( ts > cfst + 3 * streamingTrack . getTimescale ( ) ) ) { SampleFlagsSampleExtension sfExt = next ...
Tests if the currently received samples for a given track form a valid fragment taking the latest received sample into account . The next sample is not part of the segment and will be added to the fragment buffer later .
30,646
protected long [ ] getSampleSizes ( long startSample , long endSample , Track track , int sequenceNumber ) { List < Sample > samples = getSamples ( startSample , endSample , track ) ; long [ ] sampleSizes = new long [ samples . size ( ) ] ; for ( int i = 0 ; i < sampleSizes . length ; i ++ ) { sampleSizes [ i ] = sampl...
Gets the sizes of a sequence of samples .
30,647
protected ParsableBox createMoof ( long startSample , long endSample , Track track , int sequenceNumber ) { MovieFragmentBox moof = new MovieFragmentBox ( ) ; createMfhd ( startSample , endSample , track , sequenceNumber , moof ) ; createTraf ( startSample , endSample , track , sequenceNumber , moof ) ; TrackRunBox fir...
Creates a moof box for a given sequence of samples .
30,648
protected ParsableBox createMvhd ( Movie movie ) { MovieHeaderBox mvhd = new MovieHeaderBox ( ) ; mvhd . setVersion ( 1 ) ; mvhd . setCreationTime ( getDate ( ) ) ; mvhd . setModificationTime ( getDate ( ) ) ; mvhd . setDuration ( 0 ) ; long movieTimeScale = movie . getTimescale ( ) ; mvhd . setTimescale ( movieTimeSca...
Creates a single mvhd movie header box for a given movie .
30,649
public synchronized final void parseDetails ( ) { LOG . debug ( "parsing details of {}" , this . getType ( ) ) ; if ( content != null ) { ByteBuffer content = this . content ; isParsed = true ; content . rewind ( ) ; _parseDetails ( content ) ; if ( content . remaining ( ) > 0 ) { deadBytes = content . slice ( ) ; } th...
Parses the raw content of the box . It surrounds the actual parsing which is done
30,650
public long getSize ( ) { long size = isParsed ? getContentSize ( ) : content . limit ( ) ; size += ( 8 + ( size >= ( ( 1L << 32 ) - 8 ) ? 8 : 0 ) + ( UserBox . TYPE . equals ( getType ( ) ) ? 16 : 0 ) ) ; size += ( deadBytes == null ? 0 : deadBytes . limit ( ) ) ; return size ; }
Gets the full size of the box including header and content .
30,651
private boolean verify ( ByteBuffer content ) { ByteBuffer bb = ByteBuffer . allocate ( l2i ( getContentSize ( ) + ( deadBytes != null ? deadBytes . limit ( ) : 0 ) ) ) ; getContent ( bb ) ; if ( deadBytes != null ) { deadBytes . rewind ( ) ; while ( deadBytes . remaining ( ) > 0 ) { bb . put ( deadBytes ) ; } } conten...
Verifies that a box can be reconstructed byte - exact after parsing .
30,652
static int [ ] allTags ( ) { int [ ] ints = new int [ 0xFE - 0x6A ] ; for ( int i = 0x6A ; i < 0xFE ; i ++ ) { final int pos = i - 0x6A ; LOG . trace ( "pos: {}" , pos ) ; ints [ pos ] = i ; } return ints ; }
ExtDescrTagEndRange = 0xFE
30,653
public String [ ] getAllTagNames ( ) { String names [ ] = new String [ tags . size ( ) ] ; for ( int i = 0 ; i < tags . size ( ) ; i ++ ) { XtraTag tag = tags . elementAt ( i ) ; names [ i ] = tag . tagName ; } return names ; }
Returns a list of the tag names present in this Xtra Box
30,654
public String getFirstStringValue ( String name ) { Object objs [ ] = getValues ( name ) ; for ( Object obj : objs ) { if ( obj instanceof String ) { return ( String ) obj ; } } return null ; }
Returns the first String value found for this tag
30,655
public Date getFirstDateValue ( String name ) { Object objs [ ] = getValues ( name ) ; for ( Object obj : objs ) { if ( obj instanceof Date ) { return ( Date ) obj ; } } return null ; }
Returns the first Date value found for this tag
30,656
public Long getFirstLongValue ( String name ) { Object objs [ ] = getValues ( name ) ; for ( Object obj : objs ) { if ( obj instanceof Long ) { return ( Long ) obj ; } } return null ; }
Returns the first Long value found for this tag
30,657
public Object [ ] getValues ( String name ) { XtraTag tag = getTagByName ( name ) ; Object values [ ] ; if ( tag != null ) { values = new Object [ tag . values . size ( ) ] ; for ( int i = 0 ; i < tag . values . size ( ) ; i ++ ) { values [ i ] = tag . values . elementAt ( i ) . getValueAsObject ( ) ; } } else { values...
Returns an array of values for this tag . Empty array when tag is not present
30,658
public void setTagValues ( String name , String values [ ] ) { removeTag ( name ) ; XtraTag tag = new XtraTag ( name ) ; for ( int i = 0 ; i < values . length ; i ++ ) { tag . values . addElement ( new XtraValue ( values [ i ] ) ) ; } tags . addElement ( tag ) ; }
Removes and recreates tag using specified String values
30,659
public void setTagValue ( String name , Date date ) { removeTag ( name ) ; XtraTag tag = new XtraTag ( name ) ; tag . values . addElement ( new XtraValue ( date ) ) ; tags . addElement ( tag ) ; }
Removes and recreates tag using specified Date value
30,660
public void setTagValue ( String name , long value ) { removeTag ( name ) ; XtraTag tag = new XtraTag ( name ) ; tag . values . addElement ( new XtraValue ( value ) ) ; tags . addElement ( tag ) ; }
Removes and recreates tag using specified Long value
30,661
public long [ ] blowup ( int chunkCount ) { long [ ] numberOfSamples = new long [ chunkCount ] ; int j = 0 ; List < SampleToChunkBox . Entry > sampleToChunkEntries = new LinkedList < Entry > ( entries ) ; Collections . reverse ( sampleToChunkEntries ) ; Iterator < Entry > iterator = sampleToChunkEntries . iterator ( ) ...
Decompresses the list of entries and returns the number of samples per chunk for every single chunk .
30,662
public static synchronized long [ ] blowupTimeToSamples ( List < TimeToSampleBox . Entry > entries ) { SoftReference < long [ ] > cacheEntry ; if ( ( cacheEntry = cache . get ( entries ) ) != null ) { long [ ] cacheVal ; if ( ( cacheVal = cacheEntry . get ( ) ) != null ) { return cacheVal ; } } long numOfSamples = 0 ; ...
Decompresses the list of entries and returns the list of decoding times .
30,663
void register ( Object listener ) { Multimap < Class < ? > , Subscriber > listenerMethods = findAllSubscribers ( listener ) ; for ( Map . Entry < Class < ? > , Collection < Subscriber > > entry : listenerMethods . asMap ( ) . entrySet ( ) ) { Class < ? > eventType = entry . getKey ( ) ; Collection < Subscriber > eventM...
Registers all subscriber methods on the given listener object .
30,664
public int deleteRow ( ) { String deleteString = "DELETE FROM " + tableName + this . generatePKWhere ( ) ; PreparedStatement ps = null ; try { ps = cConn . prepareStatement ( deleteString ) ; ps . clearParameters ( ) ; int i ; for ( int j = 0 ; j < primaryKeys . length ; j ++ ) { ps . setObject ( j + 1 , resultRowPKs [...
delete current row answer special action codes see comment below
30,665
public String getPrimaryKeysString ( ) { String result = "" ; for ( int i = 0 ; i < primaryKeys . length ; i ++ ) { if ( result != "" ) { result += ", " ; } result += primaryKeys [ i ] ; } return result ; }
answer a String containing a String list of primary keys i . e . pk1 pk2 pk3
30,666
public void insertNewRow ( ) { for ( int i = 0 ; i < komponente . length ; i ++ ) { komponente [ i ] . clearContent ( ) ; } for ( int i = 0 ; i < primaryKeys . length ; i ++ ) { komponente [ pkColIndex [ i ] ] . setEditable ( true ) ; } ZaurusEditor . printStatus ( "enter a new row for table " + tableName ) ; }
open the panel to insert a new row into the table
30,667
public boolean saveChanges ( ) { int [ ] changedColumns = new int [ columns . length ] ; int countChanged = 0 ; String updateString = "" ; for ( int i = 0 ; i < columns . length ; i ++ ) { if ( komponente [ i ] . hasChanged ( ) ) { if ( updateString != "" ) { updateString += ", " ; } updateString += columns [ i ] + "=?...
answer true if the update succeeds
30,668
public boolean saveNewRow ( ) { boolean onePKempty = false ; int tmp ; PreparedStatement ps = null ; for ( tmp = 0 ; tmp < primaryKeys . length ; tmp ++ ) { if ( komponente [ pkColIndex [ tmp ] ] . getContent ( ) . equals ( "" ) ) { onePKempty = true ; break ; } } if ( onePKempty ) { komponente [ pkColIndex [ tmp ] ] ....
answer true if saving succeeds
30,669
public int searchRows ( String [ ] words , boolean allWords , boolean ignoreCase , boolean noMatchWhole ) { String where = this . generateWhere ( words , allWords , ignoreCase , noMatchWhole ) ; Vector temp = new Vector ( 20 ) ; Statement stmt = null ; try { stmt = cConn . createStatement ( ) ; ResultSet rs = stmt . ex...
answer the number of found rows - 1 if there is an SQL exception
30,670
private void disablePKFields ( ) { for ( int i = 0 ; i < primaryKeys . length ; i ++ ) { komponente [ pkColIndex [ i ] ] . setEditable ( false ) ; } }
set all fields for primary keys to not editable
30,671
private void fillZChoice ( ZaurusChoice zc , String tab , String col ) { Statement stmt = null ; try { if ( cConn == null ) { return ; } stmt = cConn . createStatement ( ) ; ResultSet rs = stmt . executeQuery ( "SELECT * FROM " + tab + " ORDER BY " + col ) ; ResultSetMetaData rsmd = rs . getMetaData ( ) ; int numberOfC...
and the column values as values
30,672
private void fetchColumns ( ) { Vector temp = new Vector ( 20 ) ; Vector tempType = new Vector ( 20 ) ; try { if ( cConn == null ) { return ; } if ( dbmeta == null ) { dbmeta = cConn . getMetaData ( ) ; } ResultSet colList = dbmeta . getColumns ( null , null , tableName , "%" ) ; while ( colList . next ( ) ) { temp . a...
fetch all column names
30,673
private String generateWhere ( String [ ] words , boolean allWords , boolean ignoreCase , boolean noMatchWhole ) { String result = "" ; String join ; if ( allWords ) { join = " AND " ; } else { join = " OR " ; } for ( int wordInd = 0 ; wordInd < words . length ; wordInd ++ ) { String oneCondition = "" ; for ( int col =...
generate the Where - condition for the words
30,674
private int getColIndex ( String name ) { for ( int i = 0 ; i < columns . length ; i ++ ) { if ( name . equals ( columns [ i ] ) ) { return i ; } } return - 1 ; }
answer the index of the column named name in the actual table
30,675
private int getColIndex ( String colName , String tabName ) { int ordPos = 0 ; try { if ( cConn == null ) { return - 1 ; } if ( dbmeta == null ) { dbmeta = cConn . getMetaData ( ) ; } ResultSet colList = dbmeta . getColumns ( null , null , tabName , colName ) ; colList . next ( ) ; ordPos = colList . getInt ( "ORDINAL_...
answer the index of the column named colName in the table tabName
30,676
private int getConstraintIndex ( int colIndex ) { for ( int i = 0 ; i < imColIndex . length ; i ++ ) { for ( int j = 0 ; j < imColIndex [ i ] . length ; j ++ ) { if ( colIndex == imColIndex [ i ] [ j ] ) { return i ; } } } return - 1 ; }
answer - 1 if the column is not part of any constraint
30,677
private void showAktRow ( ) { try { pStmt . clearParameters ( ) ; for ( int i = 0 ; i < primaryKeys . length ; i ++ ) { pStmt . setObject ( i + 1 , resultRowPKs [ aktRowNr ] [ i ] ) ; } ResultSet rs = pStmt . executeQuery ( ) ; rs . next ( ) ; for ( int i = 0 ; i < columns . length ; i ++ ) { komponente [ i ] . setCont...
get and show the values of the actual row in the GUI
30,678
private void voltConvertBinaryLiteralOperandsToBigint ( ) { assert ( opType != OpTypes . CONCAT ) ; for ( int i = 0 ; i < nodes . length ; ++ i ) { Expression e = nodes [ i ] ; ExpressionValue . voltMutateToBigintType ( e , this , i ) ; } }
A VoltDB extension to use X .. as a numeric value
30,679
public int findColumn ( String tableName , String columnName ) { if ( namedJoinColumnExpressions != null && tableName == null && namedJoinColumnExpressions . containsKey ( columnName ) ) { return - 1 ; } if ( variables != null ) { return variables . getIndex ( columnName ) ; } else if ( columnAliases != null ) { return...
Returns the index for the column given the column s table name and column name . If the table name is null there is no table name specified . For example in a query select C from T there is no table name so tableName would be null . In the query select T . C from T tableName would be the string T . Don t return any col...
30,680
void addIndexCondition ( Expression [ ] exprList , Index index , int colCount , boolean isJoin ) { if ( rangeIndex == index && isJoinIndex && ( ! isJoin ) && ( multiColumnCount > 0 ) && ( colCount == 0 ) ) { return ; } rangeIndex = index ; isJoinIndex = isJoin ; for ( int i = 0 ; i < colCount ; i ++ ) { Expression e = ...
Only multiple EQUAL conditions are used
30,681
public HsqlName getSubqueryTableName ( ) { HsqlName hsqlName = new HsqlName ( this , SqlInvariants . SYSTEM_SUBQUERY , false , SchemaObject . TABLE ) ; hsqlName . schema = SqlInvariants . SYSTEM_SCHEMA_HSQLNAME ; return hsqlName ; }
Same name string but different objects and serial number
30,682
static public HsqlName getAutoColumnName ( int i ) { if ( i < autoColumnNames . length ) { return autoColumnNames [ i ] ; } return new HsqlName ( staticManager , makeAutoColumnName ( "C_" , i ) , 0 , false ) ; }
Column index i is 0 based returns 1 based numbered column .
30,683
public String getString ( String key ) { String value = wrappedBundle . getString ( key ) ; if ( value . length ( ) < 1 ) { value = getStringFromFile ( key ) ; if ( value . indexOf ( '\r' ) > - 1 ) value = value . replaceAll ( "\\Q\r\n" , "\n" ) . replaceAll ( "\\Q\r" , "\n" ) ; if ( value . length ( ) > 0 && value . c...
Returns value defined in this RefCapablePropertyResourceBundle s . properties file unless that value is empty . If the value in the . properties file is empty then this returns the entire contents of the referenced text file .
30,684
static private RefCapablePropertyResourceBundle getRef ( String baseName , ResourceBundle rb , ClassLoader loader ) { if ( ! ( rb instanceof PropertyResourceBundle ) ) throw new MissingResourceException ( "Found a Resource Bundle, but it is a " + rb . getClass ( ) . getName ( ) , PropertyResourceBundle . class . getNam...
Return a ref to a new or existing RefCapablePropertyResourceBundle or throw a MissingResourceException .
30,685
private static boolean checkPureColumnIndex ( Index index , int aggCol , List < AbstractExpression > filterExprs ) { boolean found = false ; for ( AbstractExpression expr : filterExprs ) { if ( expr . getExpressionType ( ) != ExpressionType . COMPARE_EQUAL ) { return false ; } if ( ! ( expr . getLeft ( ) instanceof Tup...
or all filters compose the complete set of prefix key components
30,686
public static Runnable writeHashinatorConfig ( InstanceId instId , String path , String nonce , int hostId , HashinatorSnapshotData hashData , boolean isTruncationSnapshot ) throws IOException { final File file = new VoltFile ( path , constructHashinatorConfigFilenameForNonce ( nonce , hostId ) ) ; if ( file . exists (...
Write the hashinator config file for a snapshot
30,687
public static String parseNonceFromDigestFilename ( String filename ) { if ( filename == null || ! filename . endsWith ( ".digest" ) ) { throw new IllegalArgumentException ( "Bad digest filename: " + filename ) ; } return parseNonceFromSnapshotFilename ( filename ) ; }
Get the nonce from the filename of the digest file .
30,688
public static String parseNonceFromHashinatorConfigFilename ( String filename ) { if ( filename == null || ! filename . endsWith ( HASH_EXTENSION ) ) { throw new IllegalArgumentException ( "Bad hashinator config filename: " + filename ) ; } return parseNonceFromSnapshotFilename ( filename ) ; }
Get the nonce from the filename of the hashinator config file .
30,689
public static String parseNonceFromSnapshotFilename ( String filename ) { if ( filename == null ) { throw new IllegalArgumentException ( "Bad snapshot filename: " + filename ) ; } if ( filename . endsWith ( ".jar" ) ) { return filename . substring ( 0 , filename . indexOf ( ".jar" ) ) ; } else if ( filename . indexOf (...
Get the nonce from any snapshot - related file .
30,690
public static List < ByteBuffer > retrieveHashinatorConfigs ( String path , String nonce , int maxConfigs , VoltLogger logger ) throws IOException { VoltFile directory = new VoltFile ( path ) ; ArrayList < ByteBuffer > configs = new ArrayList < ByteBuffer > ( ) ; if ( directory . listFiles ( ) == null ) { return config...
Read hashinator snapshots into byte buffers .
30,691
public static Runnable writeSnapshotCatalog ( String path , String nonce , boolean isTruncationSnapshot ) throws IOException { String filename = SnapshotUtil . constructCatalogFilenameForNonce ( nonce ) ; try { return VoltDB . instance ( ) . getCatalogContext ( ) . writeCatalogJarToFile ( path , filename , CatalogJarWr...
Write the current catalog associated with the database snapshot to the snapshot location
30,692
public static Runnable writeTerminusMarker ( final String nonce , final NodeSettings paths , final VoltLogger logger ) { final File f = new File ( paths . getVoltDBRoot ( ) , VoltDB . TERMINUS_MARKER ) ; return new Runnable ( ) { public void run ( ) { try ( PrintWriter pw = new PrintWriter ( new FileWriter ( f ) , true...
Write the shutdown save snapshot terminus marker
30,693
public static void retrieveSnapshotFiles ( File directory , Map < String , Snapshot > namedSnapshotMap , FileFilter filter , boolean validate , SnapshotPathType stype , VoltLogger logger ) { NamedSnapshots namedSnapshots = new NamedSnapshots ( namedSnapshotMap , stype ) ; retrieveSnapshotFilesInternal ( directory , nam...
Spider the provided directory applying the provided FileFilter . Optionally validate snapshot files . Return a summary of partition counts partition information files digests etc . that can be used to determine if a valid restore plan exists .
30,694
public static final String constructFilenameForTable ( Table table , String fileNonce , SnapshotFormat format , int hostId ) { String extension = ".vpt" ; if ( format == SnapshotFormat . CSV ) { extension = ".csv" ; } StringBuilder filename_builder = new StringBuilder ( fileNonce ) ; filename_builder . append ( "-" ) ;...
Generates a Filename to the snapshot file for the given table .
30,695
public static void requestSnapshot ( final long clientHandle , final String path , final String nonce , final boolean blocking , final SnapshotFormat format , final SnapshotPathType stype , final String data , final SnapshotResponseHandler handler , final boolean notifyChanges ) { final SnapshotInitiationInfo snapInfo ...
Request a new snapshot . It will retry for a couple of times . If it doesn t succeed in the specified time an error response will be sent to the response handler otherwise a success response will be passed to the handler .
30,696
public static ListenableFuture < SnapshotCompletionInterest . SnapshotCompletionEvent > watchSnapshot ( final String nonce ) { final SettableFuture < SnapshotCompletionInterest . SnapshotCompletionEvent > result = SettableFuture . create ( ) ; SnapshotCompletionInterest interest = new SnapshotCompletionInterest ( ) { p...
Watch for the completion of a snapshot
30,697
public static HashinatorSnapshotData retrieveHashinatorConfig ( String path , String nonce , int hostId , VoltLogger logger ) throws IOException { HashinatorSnapshotData hashData = null ; String expectedFileName = constructHashinatorConfigFilenameForNonce ( nonce , hostId ) ; File [ ] files = new VoltFile ( path ) . li...
Retrieve hashinator config for restore .
30,698
public static String getRealPath ( SnapshotPathType stype , String path ) { if ( stype == SnapshotPathType . SNAP_CL ) { return VoltDB . instance ( ) . getCommandLogSnapshotPath ( ) ; } else if ( stype == SnapshotPathType . SNAP_AUTO ) { return VoltDB . instance ( ) . getSnapshotPath ( ) ; } return path ; }
Return path based on type if type is not CL or AUTO return provided path .
30,699
public void close ( ) throws SQLException { validate ( ) ; try { this . connection . rollback ( ) ; this . connection . clearWarnings ( ) ; this . connectionDefaults . setDefaults ( this . connection ) ; this . connection . reset ( ) ; fireCloseEvent ( ) ; } catch ( SQLException e ) { fireSqlExceptionEvent ( e ) ; thro...
Rolls the connection back resets the connection back to defaults clears warnings resets the connection on the server side and returns the connection to the pool .