idx
int64
0
165k
question
stringlengths
73
5.81k
target
stringlengths
5
918
141,100
public void indexDocument ( final ODocument iDocument ) { modificationLock . requestModificationLock ( ) ; try { Object fieldValue ; for ( final String fieldName : iDocument . fieldNames ( ) ) { fieldValue = iDocument . field ( fieldName ) ; put ( fieldValue , iDocument ) ; } acquireExclusiveLock ( ) ; try { map . save...
Index an entire document field by field and save the index at the end .
141,101
public OIndexFullText put ( final Object iKey , final OIdentifiable iSingleValue ) { if ( iKey == null ) return this ; modificationLock . requestModificationLock ( ) ; try { final List < String > words = splitIntoWords ( iKey . toString ( ) ) ; for ( final String word : words ) { acquireExclusiveLock ( ) ; try { Set < ...
Indexes a value and save the index . Splits the value in single words and index each one . Save of the index is responsibility of the caller .
141,102
public boolean remove ( final Object iKey , final OIdentifiable value ) { modificationLock . requestModificationLock ( ) ; try { final List < String > words = splitIntoWords ( iKey . toString ( ) ) ; boolean removed = false ; for ( final String word : words ) { acquireExclusiveLock ( ) ; try { final Set < OIdentifiable...
Splits passed in key on several words and remove records with keys equals to any item of split result and values equals to passed in value .
141,103
public List < ORecordOperation > getRecordEntriesByClass ( final String iClassName ) { final List < ORecordOperation > result = new ArrayList < ORecordOperation > ( ) ; if ( iClassName == null || iClassName . length ( ) == 0 ) for ( ORecordOperation entry : recordEntries . values ( ) ) { result . add ( entry ) ; } else...
Called by class iterator .
141,104
public List < ORecordOperation > getRecordEntriesByClusterIds ( final int [ ] iIds ) { final List < ORecordOperation > result = new ArrayList < ORecordOperation > ( ) ; if ( iIds == null ) for ( ORecordOperation entry : recordEntries . values ( ) ) { result . add ( entry ) ; } else for ( ORecordOperation entry : record...
Called by cluster iterator .
141,105
protected static int getValueByBinStr ( String binaryString , boolean signed ) { Integer value = Integer . parseInt ( binaryString , 2 ) ; if ( signed && binaryString . charAt ( 0 ) == '1' ) { char [ ] invert = new char [ binaryString . length ( ) ] ; Arrays . fill ( invert , '1' ) ; value ^= Integer . parseInt ( new S...
Get a value for specified bits from the binary string .
141,106
static byte [ ] ascii8To6bitBin ( byte [ ] toDecBytes ) { byte [ ] convertedBytes = new byte [ toDecBytes . length ] ; int sum = 0 ; int _6bitBin = 0 ; for ( int i = 0 ; i < toDecBytes . length ; i ++ ) { sum = 0 ; _6bitBin = 0 ; if ( toDecBytes [ i ] < 48 ) { throw new AisParseException ( AisParseException . INVALID_C...
Returns conversion of ASCII - coded character to 6 - bit binary byte array .
141,107
private static String getDecodedStr ( byte [ ] decBytes ) { int n = decBytes . length * 6 ; int capacity = leastPowerOf2GreaterThanOrEqualTo ( n ) ; StringBuilder decStr = new StringBuilder ( capacity ) ; for ( int i = 0 ; i < decBytes . length ; i ++ ) { int decByte = decBytes [ i ] ; String bitStr = Integer . toBinar...
Get decoded string from bytes .
141,108
protected static String getAsciiStringFrom6BitStr ( String str ) { StringBuilder txt = new StringBuilder ( ) ; for ( int i = 0 ; i < str . length ( ) ; i = i + 6 ) { byte _byte = ( byte ) Integer . parseInt ( str . substring ( i , i + 6 ) , 2 ) ; _byte = convert6BitCharToStandardAscii ( _byte ) ; char convChar = ( char...
Decode 6 bit String to standard ASCII String
141,109
static byte convert6BitCharToStandardAscii ( byte byteToConvert ) { byte b = 0 ; if ( byteToConvert < 32 ) { b = ( byte ) ( byteToConvert + 64 ) ; } else if ( byteToConvert < 63 ) { b = byteToConvert ; } return b ; }
Convert one 6 bit ASCII character to 8 bit ASCII character
141,110
public static void checkLatLong ( double lat , double lon ) { checkArgument ( lon <= 181.0 , "longitude out of range " + lon ) ; checkArgument ( lon > - 180.0 , "longitude out of range " + lon ) ; checkArgument ( lat <= 91.0 , "latitude out of range " + lat ) ; checkArgument ( lat > - 90.0 , "latitude out of range " + ...
Check lat lon are withing allowable range as per 1371 - 4 . pdf . Note that values of long = 181 lat = 91 have special meaning .
141,111
public static void checkMessageId ( int messageId , AisMessageType ... messageTypes ) { boolean found = false ; for ( AisMessageType messageType : messageTypes ) { if ( messageType . getId ( ) == messageId ) found = true ; } if ( ! found ) { StringBuffer s = new StringBuffer ( ) ; for ( AisMessageType messageType : mes...
Check message id corresponds to one of the given list of message types .
141,112
public static OMMapManager getInstance ( ) { if ( instanceRef . get ( ) == null ) { synchronized ( instanceRef ) { if ( instanceRef . compareAndSet ( null , createInstance ( ) ) ) { instanceRef . get ( ) . init ( ) ; } } } return instanceRef . get ( ) ; }
This method returns instance of mmap manager .
141,113
public void addArrayIdentity ( String array , String ... identities ) { arrayIdentities . put ( array , new ArrayIdentityFields ( identities ) ) ; }
Adds a group of fields that can uniquely identify array elements for object arrays
141,114
public Difference < BaseType > compareNodes ( BaseType node1 , BaseType node2 ) throws InvalidArrayIdentity , DuplicateArrayIdentity { return compareNodes ( new ArrayList < String > ( ) , node1 , new ArrayList < String > ( ) , node2 ) ; }
Compares two documents and returns the difference
141,115
public Difference < BaseType > compareObjects ( List < String > field1 , ObjectType node1 , List < String > field2 , ObjectType node2 ) throws InvalidArrayIdentity , DuplicateArrayIdentity { Difference < BaseType > ret = new Difference < > ( ) ; for ( Iterator < Map . Entry < String , BaseType > > fields = getFields ( ...
Compares two object nodes recursively and returns the differences
141,116
public Difference < BaseType > compareArraysWithId ( List < String > field1 , ArrayType node1 , List < String > field2 , ArrayType node2 , IdentityExtractor idex ) throws InvalidArrayIdentity , DuplicateArrayIdentity { Difference < BaseType > ret = new Difference < > ( ) ; final Map < Object , Integer > identities1 = g...
Computes difference between arrays whose elements can be identitied by a unique identifier
141,117
public OPropertyImpl dropIndexes ( ) { getDatabase ( ) . checkSecurity ( ODatabaseSecurityResources . SCHEMA , ORole . PERMISSION_DELETE ) ; final OIndexManager indexManager = getDatabase ( ) . getMetadata ( ) . getIndexManager ( ) ; final ArrayList < OIndex < ? > > relatedIndexes = new ArrayList < OIndex < ? > > ( ) ;...
Remove the index on property
141,118
public OIndex < ? > getIndex ( ) { Set < OIndex < ? > > indexes = owner . getInvolvedIndexes ( name ) ; if ( indexes != null && ! indexes . isEmpty ( ) ) return indexes . iterator ( ) . next ( ) ; return null ; }
Returns the first index defined for the property .
141,119
public OClass getLinkedClass ( ) { if ( linkedClass == null && linkedClassName != null ) linkedClass = owner . owner . getClass ( linkedClassName ) ; return linkedClass ; }
Returns the linked class in lazy mode because while unmarshalling the class could be not loaded yet .
141,120
public void setTypeInternal ( final OType iType ) { getDatabase ( ) . checkSecurity ( ODatabaseSecurityResources . SCHEMA , ORole . PERMISSION_UPDATE ) ; if ( iType == type ) return ; boolean ok = false ; switch ( type ) { case LINKLIST : ok = iType == OType . LINKSET ; break ; case LINKSET : ok = iType == OType . LINK...
Change the type . It checks for compatibility between the change of type .
141,121
public void putAll ( final Map < ? extends K , ? extends V > map ) { int mapSize = map . size ( ) ; if ( size ( ) == 0 && mapSize != 0 && map instanceof SortedMap ) { Comparator < ? > c = ( ( SortedMap < ? extends K , ? extends V > ) map ) . comparator ( ) ; if ( c == comparator || ( c != null && c . equals ( comparato...
Copies all of the mappings from the specified map to this map . These mappings replace any mappings that this map had for any of the keys currently in the specified map .
141,122
public V remove ( final Object key ) { OMVRBTreeEntry < K , V > p = getEntry ( key , PartialSearchMode . NONE ) ; setLastSearchNode ( null , null ) ; if ( p == null ) return null ; V oldValue = p . getValue ( ) ; deleteEntry ( p ) ; return oldValue ; }
Removes the mapping for this key from this OMVRBTree if present .
141,123
public static < K , V > OMVRBTreeEntry < K , V > next ( final OMVRBTreeEntry < K , V > t ) { if ( t == null ) return null ; final OMVRBTreeEntry < K , V > succ ; if ( t . tree . pageIndex < t . getSize ( ) - 1 ) { succ = t ; t . tree . pageIndex ++ ; } else { succ = OMVRBTree . successor ( t ) ; t . tree . pageIndex = ...
Returns the next item of the tree .
141,124
public static < K , V > OMVRBTreeEntry < K , V > previous ( final OMVRBTreeEntry < K , V > t ) { if ( t == null ) return null ; final int index = t . getTree ( ) . getPageIndex ( ) ; final OMVRBTreeEntry < K , V > prev ; if ( index <= 0 ) { prev = predecessor ( t ) ; if ( prev != null ) t . tree . pageIndex = prev . ge...
Returns the previous item of the tree .
141,125
OMVRBTreeEntry < K , V > deleteEntry ( OMVRBTreeEntry < K , V > p ) { setSizeDelta ( - 1 ) ; modCount ++ ; if ( pageIndex > - 1 ) { p . remove ( ) ; if ( p . getSize ( ) > 0 ) return p ; } final OMVRBTreeEntry < K , V > next = successor ( p ) ; removeNode ( p ) ; return next ; }
Delete node p and then re - balance the tree .
141,126
protected OMVRBTreeEntry < K , V > removeNode ( OMVRBTreeEntry < K , V > p ) { modCount ++ ; if ( p . getLeft ( ) != null && p . getRight ( ) != null ) { OMVRBTreeEntry < K , V > s = next ( p ) ; p . copyFrom ( s ) ; p = s ; } final OMVRBTreeEntry < K , V > replacement = ( p . getLeft ( ) != null ? p . getLeft ( ) : p ...
Remove a node from the tree .
141,127
void readOTreeSet ( int iSize , ObjectInputStream s , V defaultVal ) throws java . io . IOException , ClassNotFoundException { buildFromSorted ( iSize , null , s , defaultVal ) ; }
Intended to be called only from OTreeSet . readObject
141,128
void addAllForOTreeSet ( SortedSet < ? extends K > set , V defaultVal ) { try { buildFromSorted ( set . size ( ) , set . iterator ( ) , null , defaultVal ) ; } catch ( java . io . IOException cannotHappen ) { } catch ( ClassNotFoundException cannotHappen ) { } }
Intended to be called only from OTreeSet . addAll
141,129
public static Observable < Fix > from ( final File file , BinaryFixesFormat format ) { Func0 < InputStream > resourceFactory = new Func0 < InputStream > ( ) { public InputStream call ( ) { try { if ( file . getName ( ) . endsWith ( ".gz" ) ) return new GZIPInputStream ( new FileInputStream ( file ) ) ; else return new ...
Returns stream of fixes from the given file . If the file name ends in . gz then the file is unzipped before being read .
141,130
protected String parserOptionalWord ( final boolean iUpperCase ) { previousPos = currentPos ; parserNextWord ( iUpperCase ) ; if ( parserLastWord . length ( ) == 0 ) return null ; return parserLastWord . toString ( ) ; }
Parses the next word . It returns the word parsed if any .
141,131
protected String parseOptionalWord ( final boolean iUpperCase , final String ... iWords ) { parserNextWord ( iUpperCase ) ; if ( iWords . length > 0 ) { if ( parserLastWord . length ( ) == 0 ) return null ; boolean found = false ; for ( String w : iWords ) { if ( parserLastWord . toString ( ) . equals ( w ) ) { found =...
Parses the next word . If any word is parsed it s checked against the word array received as parameter . If the parsed word is not enlisted in it a SyntaxError exception is thrown . It returns the word parsed if any .
141,132
protected String parserRequiredWord ( final boolean iUpperCase , final String iCustomMessage , String iSeparators ) { if ( iSeparators == null ) iSeparators = " =><(),\r\n" ; parserNextWord ( iUpperCase , iSeparators ) ; if ( parserLastWord . length ( ) == 0 ) throwSyntaxErrorException ( iCustomMessage ) ; return parse...
Parses the next word . If no word is found or the parsed word is not present in the word array received as parameter then a SyntaxError exception with the custom message received as parameter is thrown . It returns the word parsed if any .
141,133
protected void parserNextWord ( final boolean iForceUpperCase , final String iSeparatorChars ) { previousPos = currentPos ; parserLastWord . setLength ( 0 ) ; parserSkipWhiteSpaces ( ) ; if ( currentPos == - 1 ) return ; char stringBeginChar = ' ' ; final String text2Use = iForceUpperCase ? textUpperCase : text ; while...
Parses the next word .
141,134
public HandlerBuilder < ContextHandler > createRootContextHandler ( String subPath ) { ContextHandler contextHandler = new ContextHandler ( ) ; HandlerBuilder < ContextHandler > e = new HandlerBuilder < > ( contextHandler ) ; String usePath = contextPath + subPath ; setPath ( contextHandler , usePath ) ; handlers . add...
Creates a HandlerBuilder that is mounted on top of the root path of this builder
141,135
public Optional < List < NmeaMessage > > add ( NmeaMessage nmea ) { while ( true ) { if ( adding . compareAndSet ( false , true ) ) { Optional < List < NmeaMessage > > result = doAdd ( nmea ) ; adding . set ( false ) ; return result ; } } }
Returns the complete message only once the whole group of messages has arrived otherwise returns null .
141,136
public static String getServiceName ( MuleEventContext event ) { FlowConstruct service = ( event == null ) ? null : event . getFlowConstruct ( ) ; String name = ( service == null ) ? "" : service . getName ( ) ; return name ; }
Different implementations for retrieving the service name from a MuleEventContext - object in Mule 2 . 2 . x and Mule
141,137
public static ImmutableEndpoint getImmutableEndpoint ( MuleContext muleContext , String endpointName ) throws IOException { ImmutableEndpoint endpoint = null ; Object o = muleContext . getRegistry ( ) . lookupObject ( endpointName ) ; if ( o instanceof ImmutableEndpoint ) { endpoint = ( ImmutableEndpoint ) o ; } else i...
Lookup an ImmutableEndpoint based on its name
141,138
public OMVRBTreeEntryMemory < K , V > getNextInMemory ( ) { OMVRBTreeEntryMemory < K , V > t = this ; OMVRBTreeEntryMemory < K , V > p = null ; if ( t . right != null ) { p = t . right ; while ( p . left != null ) p = p . left ; } else { p = t . parent ; while ( p != null && t == p . right ) { t = p ; p = p . parent ; ...
Returns the successor of the current Entry only by traversing the memory or null if no such .
141,139
public V setValue ( final V value ) { V oldValue = this . getValue ( ) ; this . values [ tree . pageIndex ] = value ; return oldValue ; }
Replaces the value currently associated with the key with the given value .
141,140
private void convertLink2Record ( final int iIndex ) { if ( ridOnly || ! autoConvertToRecord ) return ; final OIdentifiable o = super . get ( iIndex ) ; if ( contentType == MULTIVALUE_CONTENT_TYPE . ALL_RECORDS && ! o . getIdentity ( ) . isNew ( ) ) return ; if ( o != null && o instanceof ORecordId ) { final ORecordId ...
Convert the item requested from link to record .
141,141
private boolean convertRecord2Link ( final int iIndex ) { if ( contentType == MULTIVALUE_CONTENT_TYPE . ALL_RIDS ) return true ; final Object o = super . get ( iIndex ) ; if ( o != null ) { if ( o instanceof ORecord < ? > && ! ( ( ORecord < ? > ) o ) . isDirty ( ) ) { marshalling = true ; try { super . set ( iIndex , (...
Convert the item requested from record to link .
141,142
public static String convertStreamToString ( InputStream is , String charset ) { if ( is == null ) return null ; StringBuilder sb = new StringBuilder ( ) ; String line ; long linecount = 0 ; long size = 0 ; try { boolean emptyBuffer = true ; BufferedReader reader = new BufferedReader ( new InputStreamReader ( new BOMSt...
Converts an InputStream to a String .
141,143
static Properties convertResourceBundleToProperties ( ResourceBundle resource ) { Properties properties = new Properties ( ) ; Enumeration < String > keys = resource . getKeys ( ) ; while ( keys . hasMoreElements ( ) ) { String key = keys . nextElement ( ) ; properties . put ( key , resource . getString ( key ) ) ; } r...
Convert ResourceBundle into a Properties object .
141,144
protected Map < Method , Object > getConsoleMethods ( ) { final Iterator < OConsoleCommandCollection > ite = ServiceRegistry . lookupProviders ( OConsoleCommandCollection . class ) ; final Collection < Object > candidates = new ArrayList < Object > ( ) ; candidates . add ( this ) ; while ( ite . hasNext ( ) ) { try { f...
Returns a map of all console method and the object they can be called on .
141,145
static public List < String > listFilesInDirectory ( MuleContext muleContext , String endpointName ) { logger . info ( "List endpoint: {}" , endpointName ) ; FTPClient ftpClient = null ; List < String > fileNames = new ArrayList < String > ( ) ; try { ftpClient = getFtpClient ( muleContext , endpointName ) ; EndpointUR...
List files in a directory . Do not return sub - directories just plain files
141,146
static public void recursiveDeleteDirectory ( FTPClient ftpClient , String path ) throws IOException { logger . info ( "Delete directory: {}" , path ) ; FTPFile [ ] ftpFiles = ftpClient . listFiles ( path ) ; logger . debug ( "Number of files that will be deleted: {}" , ftpFiles . length ) ; for ( FTPFile ftpFile : ftp...
Deletes a directory with all its files and sub - directories .
141,147
static public void recursiveCreateDirectory ( FTPClient ftpClient , String path ) throws IOException { logger . info ( "Create Directory: {}" , path ) ; int createDirectoryStatus = ftpClient . mkd ( path ) ; logger . debug ( "Create Directory Status: {}" , createDirectoryStatus ) ; if ( createDirectoryStatus == FTP_FIL...
Create a directory and all missing parent - directories .
141,148
private void insertLinks ( Theme theme ) { if ( theme != null ) { for ( CssLink link : theme . getLinks ( ) ) { this . getHead ( ) . appendChild ( link . getLink ( ) ) ; } } }
Insert links in the document head tag .
141,149
private void removeCssLinks ( ) { if ( this . isInit ) { return ; } this . isInit = true ; NodeList < Element > links = this . getHead ( ) . getElementsByTagName ( LinkElement . TAG ) ; int size = links . getLength ( ) ; for ( int i = 0 ; i < size ; i ++ ) { LinkElement elem = LinkElement . as ( links . getItem ( 0 ) )...
Removes all link tags in the head if not initialized .
141,150
protected HeadElement getHead ( ) { if ( this . head == null ) { Element elt = Document . get ( ) . getElementsByTagName ( "head" ) . getItem ( 0 ) ; assert elt != null : "The host HTML page does not have a <head> element" + " which is required by this injector" ; this . head = HeadElement . as ( elt ) ; } return this ...
Gets the head tag element .
141,151
public static void reset ( ) { deactivateLogging ( ) ; deactivateReporting ( ) ; defaultLogLevel = Constants . INFO ; defaultReportLevel = Constants . INFO ; detectWTFMethods ( ) ; logLevels . clear ( ) ; maxOfEntriesInReports = 25 ; enableLogEntryCollection = false ; entries = null ; reporters . clear ( ) ; reportTrig...
Resets the configuration .
141,152
private static Integer getLogLevel ( String tag ) { Integer result = logLevels . get ( tag ) ; if ( tag != null && result == null ) { int index = tag . lastIndexOf ( "." ) ; while ( result == null && index > - 1 ) { result = logLevels . get ( tag . substring ( 0 , index ) ) ; index = tag . lastIndexOf ( "." , index - 1...
If called with a . b . c . d it will test for a . b . c . d a . b . c a . b a
141,153
public static boolean report ( String message , Throwable error ) { boolean acc = true ; for ( Reporter reporter : reporters ) { if ( reportFactory != null && reporter instanceof EnhancedReporter ) { Report report = reportFactory . create ( context , message , error ) ; acc = acc && ( ( EnhancedReporter ) reporter ) . ...
Triggers a Report . This method generates the report and send it with all configured reporters .
141,154
private static synchronized void collectLogEntry ( int level , String tag , final String message , final Throwable err ) { if ( ! isReportable ( level ) ) { return ; } if ( maxOfEntriesInReports > 0 && entries . size ( ) == maxOfEntriesInReports ) { entries . remove ( 0 ) ; } entries . add ( LogHelper . print ( level ,...
Adds a log entry to the collected entry list . This method managed the maximum number of entries and triggers report if the entry priority is superior or equals to the report trigger level .
141,155
public void grant ( final String iResource , final int iOperation ) { final Byte current = rules . get ( iResource ) ; byte currentValue = current == null ? PERMISSION_NONE : current . byteValue ( ) ; currentValue |= ( byte ) iOperation ; rules . put ( iResource , currentValue ) ; document . field ( "rules" , rules ) ;...
Grant a permission to the resource .
141,156
public static String permissionToString ( final int iPermission ) { int permission = iPermission ; final StringBuilder returnValue = new StringBuilder ( ) ; for ( Entry < Integer , String > p : PERMISSION_BIT_NAMES . entrySet ( ) ) { if ( ( permission & p . getKey ( ) ) == p . getKey ( ) ) { if ( returnValue . length (...
Convert the permission code to a readable string .
141,157
public void start ( ) { try { while ( keepGoing ) { try { final Socket socket = ss . accept ( ) ; final String socketName = socket . getInetAddress ( ) . getHostAddress ( ) + ":" + socket . getPort ( ) ; log . info ( "accepted socket connection from " + socketName ) ; try { final OutputStream out = socket . getOutputSt...
Starts the server . Each connection to the server will bring about another subscription to the source .
141,158
protected static int getLevel ( String level , int defaultLogLevel ) { try { return Integer . parseInt ( level ) ; } catch ( NumberFormatException e ) { if ( "VERBOSE" . equalsIgnoreCase ( level ) ) { return Constants . VERBOSE ; } else if ( "DEBUG" . equalsIgnoreCase ( level ) ) { return Constants . DEBUG ; } else if ...
Parses the given level to get the log level . This method supports both integer level and String level .
141,159
public static String getCaller ( ) { StackTraceElement [ ] stacks = Thread . currentThread ( ) . getStackTrace ( ) ; if ( stacks != null ) { for ( int i = 0 ; i < stacks . length ; i ++ ) { String cn = stacks [ i ] . getClassName ( ) ; if ( cn != null && ! Constants . CLASSNAME_TO_ESCAPE . contains ( cn ) ) { return cn...
Extracts the tag from the current stack trace .
141,160
protected static InputStream getConfigurationFileFromSDCard ( String fileName ) { File sdcard = Environment . getExternalStorageDirectory ( ) ; if ( sdcard == null || ! sdcard . exists ( ) || ! sdcard . canRead ( ) ) { return null ; } String sdCardPath = sdcard . getAbsolutePath ( ) ; File propFile = new File ( sdCardP...
Gets an input on a configuration file placed on the the SDCard .
141,161
protected static InputStream getConfigurationFileFromAssets ( Context context , String fileName ) { if ( context == null ) { return null ; } AssetManager assets = context . getAssets ( ) ; if ( assets == null ) { return null ; } try { return assets . open ( fileName ) ; } catch ( IOException e ) { return null ; } }
Gets an input on a configuration file placed in the application assets .
141,162
public static String print ( int priority , String tag , String msg , Throwable tr , boolean addTimestamp ) { String p = "X" ; switch ( priority ) { case Constants . DEBUG : p = "D" ; break ; case Constants . INFO : p = "I" ; break ; case Constants . WARN : p = "W" ; break ; case Constants . ERROR : p = "E" ; break ; c...
Gets a String form of the log data .
141,163
public int readLength ( ) throws IOException { int length = 0 ; byte b = ( byte ) this . read ( ) ; if ( ( b & 0x80 ) == 0 ) { return b ; } b = ( byte ) ( b & 0x7F ) ; if ( b == 0 ) { return Tag . Indefinite_Length ; } byte temp ; for ( int i = 0 ; i < b ; i ++ ) { temp = ( byte ) this . read ( ) ; length = ( length <<...
Reads and returns the length field . In case of indefinite length returns Tag . Indefinite_Length value
141,164
public AsnInputStream readSequenceStreamData ( int length ) throws AsnException , IOException { if ( length == Tag . Indefinite_Length ) { return this . readSequenceIndefinite ( ) ; } else { int startPos = this . pos ; this . advance ( length ) ; return new AsnInputStream ( this , startPos , length ) ; } }
This method can be invoked after the sequence tag and length has been read . Returns the AsnInputStream that contains the sequence data . The origin stream advances to the begin of the next record
141,165
public byte [ ] readSequenceData ( int length ) throws AsnException , IOException { AsnInputStream ais = this . readSequenceStreamData ( length ) ; byte [ ] res = new byte [ ais . length ] ; System . arraycopy ( ais . buffer , ais . start + ais . pos , res , 0 , ais . length ) ; return res ; }
This method can be invoked after the sequence tag and length has been read . Returns the byte stream that contains the sequence data . The origin stream advances to the begin of the next record
141,166
public void addPages ( ) { page = new CreateComponentStartPage ( selection ) ; addPage ( page ) ; integrationComponentPage = new CreateIntegrationComponentPage ( selection ) ; addPage ( integrationComponentPage ) ; serviceDescriptionComponentPage = new CreateServiceDescriptionComponentPage ( selection ) ; addPage ( ser...
Adding the page to the wizard .
141,167
@ SuppressWarnings ( "unchecked" ) public REC next ( ) { checkDirection ( true ) ; ORecordInternal < ? > record = getRecord ( ) ; while ( hasNext ( ) ) { record = getTransactionEntry ( ) ; if ( record != null ) return ( REC ) record ; if ( ( record = readCurrentRecord ( null , + 1 ) ) != null ) return ( REC ) record ; ...
Return the element at the current position and move forward the cursor to the next position available .
141,168
public ORecordIteratorCluster < REC > setRange ( final long iFrom , final long iEnd ) { firstClusterPosition = iFrom ; rangeTo = iEnd ; current . clusterPosition = firstClusterPosition ; return this ; }
Define the range where move the iterator forward and backward .
141,169
public long getRangeFrom ( ) { final long limit = ( liveUpdated ? database . getStorage ( ) . getClusterDataRange ( current . clusterId ) [ 1 ] : firstClusterPosition ) - 1 ; if ( rangeFrom > - 1 ) return Math . max ( rangeFrom , limit ) ; return limit ; }
Return the lower bound limit of the range if any otherwise 0 .
141,170
public long getRangeTo ( ) { final long limit = ( liveUpdated ? database . getStorage ( ) . getClusterDataRange ( current . clusterId ) [ 1 ] : lastClusterPosition ) + 1 ; if ( rangeTo > - 1 ) return Math . min ( rangeTo , limit ) ; return limit ; }
Return the upper bound limit of the range if any otherwise the last record .
141,171
public AisMessage getMessage ( ) { AisMessage m = aisParser . parse ( aisMessage , nmea . getSource ( ) , padBits ) ; return m ; }
Returns the parsed contents of column 5 of the AIS NMEA line .
141,172
public Object command ( final OCommandRequestText iCommand ) { final OCommandExecutor executor = OCommandManager . instance ( ) . getExecutor ( iCommand ) ; executor . setProgressListener ( iCommand . getProgressListener ( ) ) ; executor . parse ( iCommand ) ; return executeCommand ( iCommand , executor ) ; }
Executes the command request and return the result back .
141,173
public long pushPosition ( final long iPosition ) throws IOException { final int position = getHoles ( ) * RECORD_SIZE ; file . allocateSpace ( RECORD_SIZE ) ; file . writeLong ( position , iPosition ) ; if ( OLogManager . instance ( ) . isDebugEnabled ( ) ) OLogManager . instance ( ) . debug ( this , "Pushed new hole ...
Append the hole to the end of segment
141,174
public long popLastEntryPosition ( ) throws IOException { for ( int pos = getHoles ( ) - 1 ; pos >= 0 ; -- pos ) { final long recycledPosition = file . readLong ( pos * RECORD_SIZE ) ; if ( recycledPosition > - 1 ) { if ( OLogManager . instance ( ) . isDebugEnabled ( ) ) OLogManager . instance ( ) . debug ( this , "Rec...
Returns and remove the recycled position if any .
141,175
public boolean removeEntryWithPosition ( final long iPosition ) throws IOException { boolean canShrink = true ; for ( int pos = getHoles ( ) - 1 ; pos >= 0 ; -- pos ) { final long recycledPosition = file . readLong ( pos * RECORD_SIZE ) ; if ( recycledPosition == iPosition ) { if ( OLogManager . instance ( ) . isDebugE...
Removes a hole . Called on transaction recover to invalidate a delete for a record . Try to shrink the file if the invalidated entry is not in the middle of valid entries .
141,176
public void requestModificationLock ( ) { lock . readLock ( ) . lock ( ) ; if ( ! veto ) return ; if ( throwException ) { lock . readLock ( ) . unlock ( ) ; throw new OModificationOperationProhibitedException ( "Modification requests are prohibited" ) ; } boolean wasInterrupted = false ; Thread thread = Thread . curren...
Tells the lock that thread is going to perform data modifications in storage . This method allows to perform several data modifications in parallel .
141,177
public OClass setSuperClass ( final OClass iSuperClass ) { getDatabase ( ) . checkSecurity ( ODatabaseSecurityResources . SCHEMA , ORole . PERMISSION_UPDATE ) ; final String cmd = String . format ( "alter class %s superclass %s" , name , iSuperClass . getName ( ) ) ; getDatabase ( ) . command ( new OCommandSQL ( cmd ) ...
Set the super class .
141,178
private OClass addBaseClasses ( final OClass iBaseClass ) { if ( baseClasses == null ) baseClasses = new ArrayList < OClass > ( ) ; if ( baseClasses . contains ( iBaseClass ) ) return this ; baseClasses . add ( iBaseClass ) ; OClassImpl currentClass = this ; while ( currentClass != null ) { currentClass . addPolymorphi...
Adds a base class to the current one . It adds also the base class cluster ids to the polymorphic cluster ids array .
141,179
public void truncate ( ) throws IOException { getDatabase ( ) . checkSecurity ( ODatabaseSecurityResources . CLASS , ORole . PERMISSION_UPDATE ) ; getDatabase ( ) . getStorage ( ) . callInLock ( new Callable < Object > ( ) { public Object call ( ) throws Exception { for ( int id : clusterIds ) { getDatabase ( ) . getSt...
Truncates all the clusters the class uses .
141,180
private void addPolymorphicClusterIds ( final OClassImpl iBaseClass ) { boolean found ; for ( int i : iBaseClass . polymorphicClusterIds ) { found = false ; for ( int k : polymorphicClusterIds ) { if ( i == k ) { found = true ; break ; } } if ( ! found ) { polymorphicClusterIds = OArrays . copyOf ( polymorphicClusterId...
Add different cluster id to the polymorphic cluster ids array .
141,181
protected long [ ] allocateSpace ( final int iRecordSize ) throws IOException { OFile file ; for ( int i = 0 ; i < files . length ; ++ i ) { file = files [ i ] ; if ( file . getFreeSpace ( ) >= iRecordSize ) return new long [ ] { i , file . allocateSpace ( iRecordSize ) } ; } for ( int i = 0 ; i < files . length ; ++ i...
Find free space for iRecordSize bytes .
141,182
private void deleteHoleRecords ( ) { listener . onMessage ( "\nDelete temporary records..." ) ; final ORecordId rid = new ORecordId ( ) ; final ODocument doc = new ODocument ( rid ) ; for ( String recId : recordToDelete ) { doc . reset ( ) ; rid . fromString ( recId ) ; doc . delete ( ) ; } listener . onMessage ( "OK (...
Delete all the temporary records created to fill the holes and to mantain the same record ID
141,183
public PrintStream createStatusPrintStream ( ) { return new PrintStream ( new OutputStream ( ) { StringBuffer sb = new StringBuffer ( ) ; public void write ( int b ) throws IOException { if ( b == '\n' ) { String str = sb . toString ( ) ; sb . delete ( 0 , sb . length ( ) ) ; writeLine ( str ) ; } else { sb . append ( ...
Returns a new PrinstStream that can be used to update the status - text - area on this page .
141,184
protected void writeLine ( final String line ) { getContainer ( ) . getShell ( ) . getDisplay ( ) . syncExec ( new Runnable ( ) { public void run ( ) { if ( statusTextArea != null ) { statusTextArea . setText ( line + '\n' + statusTextArea . getText ( ) ) ; } } } ) ; }
Writes a line to the status - text - area in the GUI - thread
141,185
public Object attemptTrade ( String summonerInternalName , int championId ) { return client . sendRpcAndWait ( SERVICE , "attemptTrade" , summonerInternalName , championId , false ) ; }
Attempt to trade with the target player
141,186
public Object acceptTrade ( String summonerInternalName , int championId ) { return client . sendRpcAndWait ( SERVICE , "attemptTrade" , summonerInternalName , championId , true ) ; }
Accept a trade
141,187
public MigrationConfiguration getMigrationConfiguration ( String configurationName ) throws IOException , LightblueException { DataFindRequest findRequest = new DataFindRequest ( "migrationConfiguration" , null ) ; findRequest . where ( Query . and ( Query . withValue ( "configurationName" , Query . eq , configurationN...
Read a configuration from the database whose name matches the the given configuration name
141,188
public MigrationConfiguration loadMigrationConfiguration ( String migrationConfigurationId ) throws IOException , LightblueException { DataFindRequest findRequest = new DataFindRequest ( "migrationConfiguration" , null ) ; findRequest . where ( Query . withValue ( "_id" , Query . eq , migrationConfigurationId ) ) ; fin...
Load migration configuration based on its id
141,189
public void createControllers ( MigrationConfiguration [ ] configurations ) throws Exception { for ( MigrationConfiguration cfg : configurations ) { MigrationProcess process = migrationMap . get ( cfg . get_id ( ) ) ; if ( process == null ) { LOGGER . debug ( "Creating a controller thread for configuration {}: {}" , cf...
Creates controller threads for migrators and consistency checkers based on the configuration loaded from the db .
141,190
public OIdentifiable getKeyAt ( final int iIndex ) { if ( rids != null && rids [ iIndex ] != null ) return rids [ iIndex ] ; final ORecordId rid = itemFromStream ( iIndex ) ; if ( rids != null ) rids [ iIndex ] = rid ; return rid ; }
Lazy unmarshall the RID if not in memory .
141,191
public void close ( ) { if ( indexManager != null ) indexManager . flush ( ) ; if ( schema != null ) schema . close ( ) ; if ( security != null ) security . close ( ) ; }
Closes internal objects
141,192
public MuleMessage doHttpSendRequest ( String url , String method , String payload , String contentType ) { Map < String , String > properties = new HashMap < String , String > ( ) ; properties . put ( "http.method" , method ) ; properties . put ( "Content-Type" , contentType ) ; MuleMessage response = send ( url , pay...
Perform a HTTP call sending information to the server using POST or PUT
141,193
public MuleMessage doHttpReceiveRequest ( String url , String method , String acceptConentType , String acceptCharSet ) { Map < String , String > properties = new HashMap < String , String > ( ) ; properties . put ( "http.method" , method ) ; properties . put ( "Accept" , acceptConentType ) ; properties . put ( "Accept...
Perform a HTTP call receiving information from the server using GET or DELETE
141,194
public byte [ ] toByteArray ( ) { if ( this . pos == this . length ) return this . buffer ; else { byte [ ] res = new byte [ this . pos ] ; System . arraycopy ( this . buffer , 0 , res , 0 , this . pos ) ; return res ; } }
Returns the written to the stream data as a byte array
141,195
public void write ( byte [ ] b , int off , int len ) { this . checkIncreaseArray ( len ) ; System . arraycopy ( b , off , this . buffer , this . pos , len ) ; this . pos += len ; }
Writes a byte array content into the stream
141,196
public void writeTag ( int tagClass , boolean primitive , int tag ) throws AsnException { if ( tag < 0 ) throw new AsnException ( "Tag must not be negative" ) ; if ( tag <= 30 ) { int toEncode = ( tagClass & 0x03 ) << 6 ; toEncode |= ( primitive ? 0 : 1 ) << 5 ; toEncode |= tag & 0x1F ; this . write ( toEncode ) ; } el...
Writes a tag field into the atream
141,197
public void writeLength ( int v ) throws IOException { if ( v == Tag . Indefinite_Length ) { this . write ( 0x80 ) ; return ; } else if ( v > 0x7F ) { int count ; byte [ ] buf = new byte [ 4 ] ; if ( ( v & 0xFF000000 ) > 0 ) { buf [ 0 ] = ( byte ) ( ( v >> 24 ) & 0xFF ) ; buf [ 1 ] = ( byte ) ( ( v >> 16 ) & 0xFF ) ; b...
Write the length field into the stream Use Tag . Indefinite_Length for writing the indefinite length
141,198
public void FinalizeContent ( int lenPos ) { if ( lenPos == Tag . Indefinite_Length ) { this . write ( 0 ) ; this . write ( 0 ) ; } else { int length = this . pos - lenPos - 1 ; if ( length <= 0x7F ) { this . buffer [ lenPos ] = ( byte ) length ; } else { int count ; byte [ ] buf = new byte [ 4 ] ; if ( ( length & 0xFF...
This method must be invoked after finishing the content writing
141,199
private static byte _getByte ( int startIndex , BitSetStrictLength set ) throws AsnException { int count = 8 ; byte data = 0 ; while ( count > 0 ) { if ( set . length ( ) - 1 < startIndex ) { break ; } else { boolean lit = set . get ( startIndex ) ; if ( lit ) { data |= ( 0x01 << ( count - 1 ) ) ; } startIndex ++ ; cou...
Attepts to read up to 8 bits and store into byte . If less is found only those are returned