idx
int64
0
165k
question
stringlengths
73
5.81k
target
stringlengths
5
918
141,200
public void startup ( ) { underlying . startup ( ) ; OProfiler . getInstance ( ) . registerHookValue ( profilerPrefix + "enabled" , new OProfilerHookValue ( ) { public Object getValue ( ) { return isEnabled ( ) ; } } ) ; OProfiler . getInstance ( ) . registerHookValue ( profilerPrefix + "current" , new OProfilerHookVal...
All operations running at cache initialization stage
141,201
public Cipher getCipher ( ) throws GeneralSecurityException { Cipher cipher = Cipher . getInstance ( "Blowfish/ECB/PKCS5Padding" ) ; cipher . init ( Cipher . DECRYPT_MODE , new SecretKeySpec ( key , "Blowfish" ) ) ; return cipher ; }
Creates a cipher for decrypting data with the specified key .
141,202
public Cipher getEncryptionCipher ( ) throws GeneralSecurityException { Cipher cipher = Cipher . getInstance ( "Blowfish/ECB/PKCS5Padding" ) ; cipher . init ( Cipher . ENCRYPT_MODE , new SecretKeySpec ( key , "Blowfish" ) ) ; return cipher ; }
Creates a cipher for encrypting data with the specified key .
141,203
public Object execute ( final Map < Object , Object > iArgs ) { if ( className == null ) throw new OCommandExecutionException ( "Cannot execute the command because it has not been parsed yet" ) ; final ODatabaseRecord database = getDatabase ( ) ; final OClass oClass = database . getMetadata ( ) . getSchema ( ) . getCla...
Execute the DROP CLASS .
141,204
public int compareTo ( final OCompositeKey otherKey ) { final Iterator < Object > inIter = keys . iterator ( ) ; final Iterator < Object > outIter = otherKey . keys . iterator ( ) ; while ( inIter . hasNext ( ) && outIter . hasNext ( ) ) { final Object inKey = inIter . next ( ) ; final Object outKey = outIter . next ( ...
Performs partial comparison of two composite keys .
141,205
public Map < String , Object > getVariables ( ) { final HashMap < String , Object > map = new HashMap < String , Object > ( ) ; if ( inherited != null ) map . putAll ( inherited . getVariables ( ) ) ; if ( variables != null ) map . putAll ( variables ) ; return map ; }
Returns a read - only map with all the variables .
141,206
@ SuppressWarnings ( "unchecked" ) public < T > T getPropertyValue ( ElementDescriptor < T > property ) { if ( mProperties == null ) { return null ; } return ( T ) mProperties . get ( property ) ; }
Returns the value of a property in this propstat element .
141,207
public < T > void clear ( ElementDescriptor < T > property ) { if ( mSet != null ) { mSet . remove ( property ) ; } }
Remove a property from the initial values .
141,208
public long countClass ( final String iClassName ) { final OClass cls = getMetadata ( ) . getSchema ( ) . getClass ( iClassName ) ; if ( cls == null ) throw new IllegalArgumentException ( "Class '" + iClassName + "' not found in database" ) ; return cls . count ( ) ; }
Returns the number of the records of the class iClassName .
141,209
public OBinarySerializer < ? > getObjectSerializer ( final byte identifier ) { OBinarySerializer < ? > impl = serializerIdMap . get ( identifier ) ; if ( impl == null ) { final Class < ? extends OBinarySerializer < ? > > cls = serializerClassesIdMap . get ( identifier ) ; if ( cls != null ) try { impl = cls . newInstan...
Obtain OBinarySerializer instance by it s id .
141,210
public long addRecord ( final ORecordId iRid , final byte [ ] iContent ) throws IOException { if ( iContent . length == 0 ) return - 1 ; final int recordSize = iContent . length + RECORD_FIX_SIZE ; acquireExclusiveLock ( ) ; try { final long [ ] newFilePosition = getFreeSpace ( recordSize ) ; writeRecord ( newFilePosit...
Add the record content in file .
141,211
public byte [ ] getRecord ( final long iPosition ) throws IOException { if ( iPosition == - 1 ) return null ; acquireSharedLock ( ) ; try { final long [ ] pos = getRelativePosition ( iPosition ) ; final OFile file = files [ ( int ) pos [ 0 ] ] ; final int recordSize = file . readInt ( pos [ 1 ] ) ; if ( recordSize <= 0...
Returns the record content from file .
141,212
public int getRecordSize ( final long iPosition ) throws IOException { acquireSharedLock ( ) ; try { final long [ ] pos = getRelativePosition ( iPosition ) ; final OFile file = files [ ( int ) pos [ 0 ] ] ; return file . readInt ( pos [ 1 ] ) ; } finally { releaseSharedLock ( ) ; } }
Returns the record size .
141,213
public long setRecord ( final long iPosition , final ORecordId iRid , final byte [ ] iContent ) throws IOException { acquireExclusiveLock ( ) ; try { long [ ] pos = getRelativePosition ( iPosition ) ; final OFile file = files [ ( int ) pos [ 0 ] ] ; final int recordSize = file . readInt ( pos [ 1 ] ) ; final int conten...
Set the record content in file .
141,214
public List < ODataHoleInfo > getHolesList ( ) { acquireSharedLock ( ) ; try { final List < ODataHoleInfo > holes = new ArrayList < ODataHoleInfo > ( ) ; final int tot = holeSegment . getHoles ( ) ; for ( int i = 0 ; i < tot ; ++ i ) { final ODataHoleInfo h = holeSegment . getHole ( i ) ; if ( h != null ) holes . add (...
Returns the list of holes as pair of position & ppos
141,215
private static boolean betweenLongitudes ( double topLeftLon , double bottomRightLon , double lon ) { if ( topLeftLon <= bottomRightLon ) return lon >= topLeftLon && lon <= bottomRightLon ; else return lon >= topLeftLon || lon <= bottomRightLon ; }
Returns true if and only if lon is between the longitudes topLeftLon and bottomRightLon .
141,216
public int getPropertyStatus ( ElementDescriptor < ? > descriptor ) { PropStat propStat = mPropStatByProperty . get ( descriptor ) ; if ( propStat == null ) { return STATUS_NONE ; } return propStat . getStatusCode ( ) ; }
Return the status of a specific property .
141,217
public < T > T getPropertyValue ( ElementDescriptor < T > descriptor ) { PropStat propStat = mPropStatByProperty . get ( descriptor ) ; if ( propStat == null ) { return null ; } return propStat . getPropertyValue ( descriptor ) ; }
Get the value of a specific property .
141,218
private static synchronized Set < OIndexFactory > getFactories ( ) { if ( FACTORIES == null ) { final Iterator < OIndexFactory > ite = lookupProviderWithOrientClassLoader ( OIndexFactory . class , orientClassLoader ) ; final Set < OIndexFactory > factories = new HashSet < OIndexFactory > ( ) ; while ( ite . hasNext ( )...
Cache a set of all factories . we do not use the service loader directly since it is not concurrent .
141,219
public void addListener ( final ORecordListener iListener ) { if ( _listeners == null ) _listeners = Collections . newSetFromMap ( new WeakHashMap < ORecordListener , Boolean > ( ) ) ; _listeners . add ( iListener ) ; }
Add a listener to the current document to catch all the supported events .
141,220
public static String getComponentProjectName ( int componentType , String groupId , String artifactId ) { IModel m = ModelFactory . newModel ( groupId , artifactId , null , null , MuleVersionEnum . MAIN_MULE_VERSION , null , null ) ; String projectFolderName = null ; ComponentEnum compEnum = ComponentEnum . get ( compo...
public static final int IM_SCHEMA_COMPONENT = 3 ;
141,221
protected boolean checkConsistency ( Object o1 , Object o2 ) { return checkConsistency ( o1 , o2 , null , null ) ; }
convenience method for unit testing
141,222
public boolean checkConsistency ( final Object legacyEntity , final Object lightblueEntity , final String methodName , MethodCallStringifier callToLogInCaseOfInconsistency ) { if ( legacyEntity == null && lightblueEntity == null ) { return true ; } if ( callToLogInCaseOfInconsistency == null ) { callToLogInCaseOfIncons...
Check that objects are equal using org . skyscreamer . jsonassert library .
141,223
public Object execute ( final Map < Object , Object > iArgs ) { if ( newRecords == null ) throw new OCommandExecutionException ( "Cannot execute the command because it has not been parsed yet" ) ; final OCommandParameters commandParameters = new OCommandParameters ( iArgs ) ; if ( indexName != null ) { final OIndex < ?...
Execute the INSERT and return the ODocument object created .
141,224
@ SuppressWarnings ( "unchecked" ) public OGraphEdge link ( final OGraphVertex iTargetVertex , final String iClassName ) { if ( iTargetVertex == null ) throw new IllegalArgumentException ( "Missed the target vertex" ) ; final OGraphEdge edge = new OGraphEdge ( database , iClassName , this , iTargetVertex ) ; getOutEdge...
Create a link between the current vertex and the target one . The link is of type iClassName .
141,225
public OGraphVertex unlink ( final OGraphVertex iTargetVertex ) { if ( iTargetVertex == null ) throw new IllegalArgumentException ( "Missed the target vertex" ) ; unlink ( database , document , iTargetVertex . getDocument ( ) ) ; return this ; }
Remove the link between the current vertex and the target one .
141,226
public boolean hasInEdges ( ) { final Set < ODocument > docs = document . field ( OGraphDatabase . VERTEX_FIELD_IN ) ; return docs != null && ! docs . isEmpty ( ) ; }
Returns true if the vertex has at least one incoming edge otherwise false .
141,227
public boolean hasOutEdges ( ) { final Set < ODocument > docs = document . field ( OGraphDatabase . VERTEX_FIELD_OUT ) ; return docs != null && ! docs . isEmpty ( ) ; }
Returns true if the vertex has at least one outgoing edge otherwise false .
141,228
public Set < OGraphEdge > getInEdges ( final String iEdgeLabel ) { Set < OGraphEdge > temp = in != null ? in . get ( ) : null ; if ( temp == null ) { if ( iEdgeLabel == null ) temp = new HashSet < OGraphEdge > ( ) ; in = new SoftReference < Set < OGraphEdge > > ( temp ) ; final Set < Object > docs = document . field ( ...
Returns the incoming edges of current node having the requested label . If there are no edged then an empty set is returned .
141,229
@ SuppressWarnings ( "unchecked" ) public Set < OGraphVertex > browseOutEdgesVertexes ( ) { final Set < OGraphVertex > resultset = new HashSet < OGraphVertex > ( ) ; Set < OGraphEdge > temp = out != null ? out . get ( ) : null ; if ( temp == null ) { final Set < OIdentifiable > docEdges = ( Set < OIdentifiable > ) docu...
Returns the set of Vertexes from the outgoing edges . It avoids to unmarshall edges .
141,230
@ SuppressWarnings ( "unchecked" ) public Set < OGraphVertex > browseInEdgesVertexes ( ) { final Set < OGraphVertex > resultset = new HashSet < OGraphVertex > ( ) ; Set < OGraphEdge > temp = in != null ? in . get ( ) : null ; if ( temp == null ) { final Set < ODocument > docEdges = ( Set < ODocument > ) document . fiel...
Returns the set of Vertexes from the incoming edges . It avoids to unmarshall edges .
141,231
public static void unlink ( final ODatabaseGraphTx iDatabase , final ODocument iSourceVertex , final ODocument iTargetVertex ) { if ( iTargetVertex == null ) throw new IllegalArgumentException ( "Missed the target vertex" ) ; if ( iDatabase . existsUserObjectByRID ( iSourceVertex . getIdentity ( ) ) ) { final OGraphVer...
Unlinks all the edges between iSourceVertex and iTargetVertex
141,232
public SyncCollection limitNumberOfResults ( int limit ) { if ( limit > 0 ) { addLimit ( WebDavSearch . NRESULTS , limit ) ; } else { removeLimit ( WebDavSearch . NRESULTS ) ; } return this ; }
Limit the number of results in the response if supported by the server . A non - positive value will remove the limit .
141,233
public int getNumberOfResultsLimit ( ) { if ( mLimit == null ) { return 0 ; } Integer limit = ( Integer ) mLimit . get ( WebDavSearch . NRESULTS ) ; return limit == null ? 0 : limit ; }
Returns the limit for the number of results in this request .
141,234
private < T > void addLimit ( ElementDescriptor < T > descriptor , T limit ) { if ( mLimit == null ) { mLimit = new HashMap < ElementDescriptor < ? > , Object > ( 6 ) ; } mLimit . put ( descriptor , limit ) ; }
Add a limit to the request .
141,235
public void put ( K k , V v ) { cache . put ( k , v ) ; acquireLock ( k ) . countDown ( ) ; }
Caches the given mapping and releases all waiting locks .
141,236
public V get ( K k ) throws InterruptedException { await ( k ) ; return cache . get ( k ) ; }
Retrieve the value associated with the given key blocking as long as necessary .
141,237
public V get ( K k , long timeout , TimeUnit unit ) throws InterruptedException , TimeoutException { await ( k , timeout , unit ) ; return cache . get ( k ) ; }
Retrieve the value associated with the given key blocking as long as necessary up to the specified maximum .
141,238
public void await ( K k , long timeout , TimeUnit unit ) throws InterruptedException , TimeoutException { if ( ! acquireLock ( k ) . await ( timeout , unit ) ) { throw new TimeoutException ( "Wait time for retrieving value for key " + k + " exceeded " + timeout + " " + unit ) ; } }
Waits until the key has been assigned a value up to the specified maximum .
141,239
public static void initEndpointDirectories ( MuleContext muleContext , String [ ] serviceNames , String [ ] endpointNames ) throws Exception { List < Lifecycle > services = new ArrayList < Lifecycle > ( ) ; for ( String serviceName : serviceNames ) { try { Lifecycle service = muleContext . getRegistry ( ) . lookupObjec...
Initiates a list of sftp - endpoint - directories . Ensures that affected services are stopped during the initiation .
141,240
static protected SftpClient getSftpClient ( MuleContext muleContext , String endpointName ) throws IOException { ImmutableEndpoint endpoint = getImmutableEndpoint ( muleContext , endpointName ) ; try { SftpClient sftpClient = SftpConnectionFactory . createClient ( endpoint ) ; return sftpClient ; } catch ( Exception e ...
Returns a SftpClient that is logged in to the sftp server that the endpoint is configured against .
141,241
static protected void recursiveDelete ( MuleContext muleContext , SftpClient sftpClient , String endpointName , String relativePath ) throws IOException { EndpointURI endpointURI = getImmutableEndpoint ( muleContext , endpointName ) . getEndpointURI ( ) ; String path = endpointURI . getPath ( ) + relativePath ; try { s...
Deletes a directory with all its files and sub - directories . The reason it do a chmod 700 before the delete is that some tests changes the permission and thus we have to restore the right to delete it ...
141,242
public OMVRBTreeEntryPersistent < K , V > save ( ) throws OSerializationException { if ( ! dataProvider . isEntryDirty ( ) ) return this ; final boolean isNew = dataProvider . getIdentity ( ) . isNew ( ) ; if ( left != null && left . dataProvider . getIdentity ( ) . isNew ( ) ) { if ( isNew ) { left . dataProvider . sa...
Assures that all the links versus parent left and right are consistent .
141,243
public OMVRBTreeEntryPersistent < K , V > delete ( ) throws IOException { if ( dataProvider != null ) { pTree . removeNodeFromMemory ( this ) ; pTree . removeEntry ( dataProvider . getIdentity ( ) ) ; if ( getLeft ( ) != null ) ( ( OMVRBTreeEntryPersistent < K , V > ) getLeft ( ) ) . delete ( ) ; if ( getRight ( ) != n...
Delete all the nodes recursively . IF they are not loaded in memory load all the tree .
141,244
protected int disconnect ( final boolean iForceDirty , final int iLevel ) { if ( dataProvider == null ) return 1 ; int totalDisconnected = 0 ; final ORID rid = dataProvider . getIdentity ( ) ; boolean disconnectedFromParent = false ; if ( parent != null ) { if ( canDisconnectFrom ( parent ) || iForceDirty ) { if ( pare...
Disconnect the current node from others .
141,245
public V setValue ( final V iValue ) { V oldValue = getValue ( ) ; int index = tree . getPageIndex ( ) ; if ( dataProvider . setValueAt ( index , iValue ) ) markDirty ( ) ; return oldValue ; }
Invalidate serialized Value associated in order to be re - marshalled on the next node storing .
141,246
public static OIdentifiable readIdentifiable ( final OChannelBinaryClient network ) throws IOException { final int classId = network . readShort ( ) ; if ( classId == RECORD_NULL ) return null ; if ( classId == RECORD_RID ) { return network . readRID ( ) ; } else { final ORecordInternal < ? > record = Orient . instance...
SENT AS SHORT AS FIRST PACKET AFTER SOCKET CONNECTION
141,247
public static Map < Identity , JsonNode > getDocumentIdMap ( List < JsonNode > list , List < String > identityFields ) { Map < Identity , JsonNode > map = new HashMap < > ( ) ; if ( list != null ) { LOGGER . debug ( "Getting doc IDs for {} docs, fields={}" , list . size ( ) , identityFields ) ; for ( JsonNode node : li...
Build an id - doc map from a list of docs
141,248
public static boolean fastCompareDocs ( JsonNode sourceDocument , JsonNode destinationDocument , List < String > exclusionPaths , boolean ignoreTimestampMSDiffs ) { try { JsonDiff diff = new JsonDiff ( ) ; diff . setOption ( JsonDiff . Option . ARRAY_ORDER_INSIGNIFICANT ) ; diff . setOption ( JsonDiff . Option . RETURN...
Compare two docs fast if they are the same excluding exclusions
141,249
public synchronized void createHole ( final long iRecordOffset , final int iRecordSize ) throws IOException { final long timer = OProfiler . getInstance ( ) . startChrono ( ) ; final int recycledPosition ; final ODataHoleInfo hole ; if ( ! freeHoles . isEmpty ( ) ) { recycledPosition = freeHoles . remove ( 0 ) ; hole =...
Appends the hole to the end of the segment .
141,250
public synchronized ODataHoleInfo getHole ( final int iPosition ) { final ODataHoleInfo hole = availableHolesList . get ( iPosition ) ; if ( hole . dataOffset == - 1 ) return null ; return hole ; }
Fills the holes information into OPhysicalPosition object given as parameter .
141,251
public synchronized void updateHole ( final ODataHoleInfo iHole , final long iNewDataOffset , final int iNewRecordSize ) throws IOException { final long timer = OProfiler . getInstance ( ) . startChrono ( ) ; final boolean offsetChanged = iNewDataOffset != iHole . dataOffset ; final boolean sizeChanged = iNewRecordSize...
Update hole data
141,252
public synchronized void deleteHole ( int iHolePosition ) throws IOException { final ODataHoleInfo hole = availableHolesList . get ( iHolePosition ) ; availableHolesBySize . remove ( hole ) ; availableHolesByPosition . remove ( hole ) ; hole . dataOffset = - 1 ; freeHoles . add ( iHolePosition ) ; iHolePosition = iHole...
Delete the hole
141,253
protected T getObject ( ) { final T object ; if ( reusedObject != null ) { object = reusedObject ; object . reset ( ) ; } else object = ( T ) database . newInstance ( className ) ; return object ; }
Returns the object to use for the operation .
141,254
@ SneakyThrows ( IOException . class ) public static String sha1 ( String input ) throws NoSuchAlgorithmException { MessageDigest mDigest = MessageDigest . getInstance ( "SHA1" ) ; byte [ ] result = mDigest . digest ( input . getBytes ( "UTF-8" ) ) ; String resultString = String . format ( "%040x" , new BigInteger ( 1 ...
Calculates the SHA1 Digest of a given input .
141,255
public void saveRecord ( final ORecordInternal < ? > iRecord , final String iClusterName , final OPERATION_MODE iMode , final ORecordCallback < ? extends Number > iCallback ) { try { database . executeSaveRecord ( iRecord , iClusterName , iRecord . getVersion ( ) , iRecord . getRecordType ( ) , true , iMode , iCallback...
Update the record .
141,256
public void deleteRecord ( final ORecordInternal < ? > iRecord , final OPERATION_MODE iMode ) { if ( ! iRecord . getIdentity ( ) . isPersistent ( ) ) return ; try { database . executeDeleteRecord ( iRecord , iRecord . getVersion ( ) , true , true , iMode ) ; } catch ( Exception e ) { final ORecordId rid = ( ORecordId )...
Deletes the record .
141,257
@ SuppressWarnings ( "unchecked" ) public < RET > RET execute ( final Object ... iArgs ) { setParameters ( iArgs ) ; return ( RET ) ODatabaseRecordThreadLocal . INSTANCE . get ( ) . getStorage ( ) . command ( this ) ; }
Delegates the execution to the configured command executor .
141,258
public Collection < ODocument > getEntriesBetween ( final Object iRangeFrom , final Object iRangeTo ) { return getEntriesBetween ( iRangeFrom , iRangeTo , true ) ; }
Returns a set of documents with key between the range passed as parameter . Range bounds are included .
141,259
public long rebuild ( final OProgressListener iProgressListener ) { long documentIndexed = 0 ; final boolean intentInstalled = getDatabase ( ) . declareIntent ( new OIntentMassiveInsert ( ) ) ; acquireExclusiveLock ( ) ; try { try { map . clear ( ) ; } catch ( Exception e ) { } int documentNum = 0 ; long documentTotal ...
Populates the index with all the existent records . Uses the massive insert intent to speed up and keep the consumed memory low .
141,260
public boolean isConnected ( ) { if ( socket != null && socket . isConnected ( ) && ! socket . isInputShutdown ( ) && ! socket . isOutputShutdown ( ) ) return true ; return false ; }
Tells if the channel is connected .
141,261
public void detach ( Object self ) throws NoSuchMethodException , IllegalAccessException , InvocationTargetException { for ( String fieldName : doc . fieldNames ( ) ) { Object value = getValue ( self , fieldName , false , null ) ; if ( value instanceof OLazyObjectMultivalueElement ) ( ( OLazyObjectMultivalueElement ) v...
Method that detaches all fields contained in the document to the given object
141,262
public void attach ( Object self ) throws IllegalArgumentException , IllegalAccessException , NoSuchMethodException , InvocationTargetException { for ( Class < ? > currentClass = self . getClass ( ) ; currentClass != Object . class ; ) { if ( Proxy . class . isAssignableFrom ( currentClass ) ) { currentClass = currentC...
Method that attaches all data contained in the object to the associated document
141,263
private void ensureRespondJsScriptElement ( ) { if ( this . respondJsScript == null ) { this . respondJsScript = Document . get ( ) . createScriptElement ( ) ; this . respondJsScript . setSrc ( GWT . getModuleBaseForStaticFiles ( ) + DefaultIE8ThemeController . RESPOND_JS_LOCATION ) ; this . respondJsScript . setType (...
Ensure respond js script element .
141,264
public static MessageDispatcherServlet createMessageDispatcherServlet ( Class ... contextConfigLocation ) { StringBuilder items = new StringBuilder ( ) ; for ( Class aClass : contextConfigLocation ) { items . append ( aClass . getName ( ) ) ; items . append ( "," ) ; } MessageDispatcherServlet messageDispatcherServlet ...
Creates a spring - ws message dispatcher servlet
141,265
static Integer getReceivedStations ( AisExtractor extractor , int slotTimeout , int startIndex ) { if ( slotTimeout == 3 || slotTimeout == 5 || slotTimeout == 7 ) return extractor . getValue ( startIndex + 5 , startIndex + 19 ) ; else return null ; }
Returns received stations as per 1371 - 4 . pdf .
141,266
private static Integer getHourUtc ( AisExtractor extractor , int slotTimeout , int startIndex ) { if ( slotTimeout == 1 ) { int hours = extractor . getValue ( startIndex + 5 , startIndex + 10 ) ; return hours ; } else return null ; }
Returns hour UTC as per 1371 - 4 . pdf .
141,267
private static Integer getMinuteUtc ( AisExtractor extractor , int slotTimeout , int startIndex ) { if ( slotTimeout == 1 ) { int minutes = extractor . getValue ( startIndex + 10 , startIndex + 17 ) ; return minutes ; } else return null ; }
Returns minute UTC as per 1371 - 4 . pdf .
141,268
private static Integer getSlotOffset ( AisExtractor extractor , int slotTimeout , int startIndex ) { if ( slotTimeout == 0 ) return extractor . getValue ( startIndex + 5 , startIndex + 19 ) ; else return null ; }
Returns slot offset as per 1371 - 4 . pdf .
141,269
public synchronized int getValue ( int from , int to ) { try { SixBit . convertSixBitToBits ( message , padBits , bitSet , calculated , from , to ) ; return ( int ) SixBit . getValue ( from , to , bitSet ) ; } catch ( SixBitException | ArrayIndexOutOfBoundsException e ) { throw new AisParseException ( e ) ; } }
Returns an unsigned integer value using the bits from character position start to position stop in the decoded message .
141,270
public synchronized int getSignedValue ( int from , int to ) { try { SixBit . convertSixBitToBits ( message , padBits , bitSet , calculated , from , to ) ; return ( int ) SixBit . getSignedValue ( from , to , bitSet ) ; } catch ( SixBitException e ) { throw new AisParseException ( e ) ; } }
Returns a signed integer value using the bits from character position start to position stop in the decoded message .
141,271
public static Object getField ( Object obj , String name ) { try { Class < ? extends Object > klass = obj . getClass ( ) ; do { try { Field field = klass . getDeclaredField ( name ) ; field . setAccessible ( true ) ; return field . get ( obj ) ; } catch ( NoSuchFieldException e ) { klass = klass . getSuperclass ( ) ; }...
Gets a field from an object .
141,272
public final double getDistanceToKm ( Position position ) { double lat1 = toRadians ( lat ) ; double lat2 = toRadians ( position . lat ) ; double lon1 = toRadians ( lon ) ; double lon2 = toRadians ( position . lon ) ; double deltaLon = lon2 - lon1 ; double cosLat2 = cos ( lat2 ) ; double cosLat1 = cos ( lat1 ) ; double...
returns distance between two WGS84 positions according to Vincenty s formula from Wikipedia
141,273
public final double getDistanceKmToPath ( Position p1 , Position p2 ) { double d = radiusEarthKm * asin ( sin ( getDistanceToKm ( p1 ) / radiusEarthKm ) * sin ( toRadians ( getBearingDegrees ( p1 ) - p1 . getBearingDegrees ( p2 ) ) ) ) ; return abs ( d ) ; }
calculates the distance of a point to the great circle path between p1 and p2 .
141,274
@ SuppressWarnings ( "unchecked" ) public static void setModelClass ( Class < ? > modelClass ) throws IllegalArgumentException { if ( ! DefaultModelImpl . class . isAssignableFrom ( modelClass ) ) { throw new IllegalArgumentException ( "Modelclass, " + modelClass . getName ( ) + ", is not a subtype of " + DefaultModelI...
Register a custom model class must be a subclass to DefaultModelImpl .
141,275
public static void resetModelClass ( ) { ModelFactory . modelClass = DefaultModelImpl . class ; System . err . println ( "[INFO] Reset model-class: " + ModelFactory . modelClass . getName ( ) ) ; }
Reset model class to the default class .
141,276
public static IModel newModel ( String groupId , String artifactId , String version , String service , MuleVersionEnum muleVersion , TransportEnum inboundTransport , TransportEnum outboundTransport , TransformerEnum transformerType ) { return doCreateNewModel ( groupId , artifactId , version , service , muleVersion , n...
Constructor - method to use when services with inbound and outbound services
141,277
public static void lockMemory ( boolean useSystemJNADisabled ) { if ( useSystemJNADisabled ) disableUsingSystemJNA ( ) ; try { int errorCode = MemoryLockerLinux . INSTANCE . mlockall ( MemoryLockerLinux . LOCK_CURRENT_MEMORY ) ; if ( errorCode != 0 ) { final String errorMessage ; int lastError = Native . getLastError (...
This method locks memory to prevent swapping . This method provide information about success or problems with locking memory . You can reed console output to know if memory locked successfully or not . If system error occurred such as permission any specific exception will be thrown .
141,278
public OMVRBTreeEntry < K , V > getFirstInMemory ( ) { OMVRBTreeEntry < K , V > node = this ; OMVRBTreeEntry < K , V > prev = this ; while ( node != null ) { prev = node ; node = node . getPreviousInMemory ( ) ; } return prev ; }
Returns the first Entry only by traversing the memory or null if no such .
141,279
public OMVRBTreeEntry < K , V > getPreviousInMemory ( ) { OMVRBTreeEntry < K , V > t = this ; OMVRBTreeEntry < K , V > p = null ; if ( t . getLeftInMemory ( ) != null ) { p = t . getLeftInMemory ( ) ; while ( p . getRightInMemory ( ) != null ) p = p . getRightInMemory ( ) ; } else { p = t . getParentInMemory ( ) ; whil...
Returns the previous of the current Entry only by traversing the memory or null if no such .
141,280
private V linearSearch ( final K iKey ) { V value = null ; int i = 0 ; tree . pageItemComparator = - 1 ; for ( int s = getSize ( ) ; i < s ; ++ i ) { if ( tree . comparator != null ) tree . pageItemComparator = tree . comparator . compare ( getKeyAt ( i ) , iKey ) ; else tree . pageItemComparator = ( ( Comparable < ? s...
Linear search inside the node
141,281
private V binarySearch ( final K iKey ) { int low = 0 ; int high = getSize ( ) - 1 ; int mid = 0 ; while ( low <= high ) { mid = ( low + high ) >>> 1 ; Object midVal = getKeyAt ( mid ) ; if ( tree . comparator != null ) tree . pageItemComparator = tree . comparator . compare ( ( K ) midVal , iKey ) ; else tree . pageIt...
Binary search inside the node
141,282
public int compareTo ( final OMVRBTreeEntry < K , V > o ) { if ( o == null ) return 1 ; if ( o == this ) return 0 ; if ( getSize ( ) == 0 ) return - 1 ; if ( o . getSize ( ) == 0 ) return 1 ; if ( tree . comparator != null ) return tree . comparator . compare ( getFirstKey ( ) , o . getFirstKey ( ) ) ; return ( ( Compa...
Compares two nodes by their first keys .
141,283
public static long parsePeriod ( String periodStr ) { PeriodFormatter fmt = PeriodFormat . getDefault ( ) ; Period p = fmt . parsePeriod ( periodStr ) ; return p . toStandardDuration ( ) . getMillis ( ) ; }
Returns the period in msecs
141,284
public Date getEndDate ( Date startDate , long period ) { long now = getNow ( ) . getTime ( ) ; long endDate = startDate . getTime ( ) + period ; if ( now - period > endDate ) { return new Date ( endDate ) ; } else { return null ; } }
Returns the end date given the start date end the period . The end date is startDate + period but only if endDate is at least one period ago . That is we always leave the last incomplete period unprocessed .
141,285
protected List < MigrationJob > createJobs ( Date startDate , Date endDate , ActiveExecution ae ) throws Exception { List < MigrationJob > ret = new ArrayList < MigrationJob > ( ) ; LOGGER . debug ( "Creating the migrator to setup new jobs" ) ; MigrationJob mj = new MigrationJob ( ) ; mj . setConfigurationName ( getMig...
Create a migration job or jobs to process records created between the given dates . startDate is inclusive end date is exclusive
141,286
private OMMapBufferEntry [ ] searchAmongExisting ( OFileMMap file , final OMMapBufferEntry [ ] fileEntries , final long beginOffset , final int size ) { if ( fileEntries . length == 0 ) { return EMPTY_BUFFER_ENTRIES ; } final OMMapBufferEntry lastEntry = fileEntries [ fileEntries . length - 1 ] ; if ( lastEntry . begin...
This method search in already mapped entries to find if necessary entry is already mapped and can be returned .
141,287
private OMMapBufferEntry mapNew ( final OFileMMap file , final long beginOffset ) throws IOException { return new OMMapBufferEntry ( file , file . map ( beginOffset , file . getFileSize ( ) - ( int ) beginOffset ) , beginOffset , file . getFileSize ( ) - ( int ) beginOffset ) ; }
This method maps new part of file if not all file content is mapped .
141,288
private void acquireLocksOnEntries ( final OMMapBufferEntry [ ] entries , OPERATION_TYPE operationType ) { if ( operationType == OPERATION_TYPE . WRITE ) for ( OMMapBufferEntry entry : entries ) { entry . acquireWriteLock ( ) ; entry . setDirty ( ) ; } else for ( OMMapBufferEntry entry : entries ) entry . acquireReadLo...
Locks all entries .
141,289
private void removeFileEntries ( OMMapBufferEntry [ ] fileEntries ) { if ( fileEntries != null ) { for ( OMMapBufferEntry entry : fileEntries ) { removeEntry ( entry ) ; } } }
Removes all files entries . Flush will be performed before removing .
141,290
public static String getRelativePath ( File file , File srcDir ) { String base = srcDir . getPath ( ) ; String filePath = file . getPath ( ) ; String relativePath = new File ( base ) . toURI ( ) . relativize ( new File ( filePath ) . toURI ( ) ) . getPath ( ) ; return relativePath ; }
Returns the relative path .
141,291
public static void copyFile ( File srcFile , File destFile ) { OutputStream out = null ; InputStream in = null ; try { if ( ! destFile . getParentFile ( ) . exists ( ) ) destFile . getParentFile ( ) . mkdirs ( ) ; in = new FileInputStream ( srcFile ) ; out = new FileOutputStream ( destFile ) ; byte [ ] buf = new byte [...
Copy a file to new destination .
141,292
public static ContextLoaderListener createSpringContextLoader ( final WebApplicationContext webApplicationContext ) { return new ContextLoaderListener ( ) { @ SuppressWarnings ( "unchecked" ) protected WebApplicationContext createWebApplicationContext ( ServletContext sc ) { return webApplicationContext ; } } ; }
Creates a spring context loader listener
141,293
public static JsonNode getFieldValue ( JsonNode doc , String field ) { StringTokenizer tkz = new StringTokenizer ( field , ". " ) ; JsonNode trc = doc ; while ( tkz . hasMoreTokens ( ) && trc != null ) { String tok = tkz . nextToken ( ) ; trc = trc . get ( tok ) ; } return trc ; }
Ooes not do array index lookup!
141,294
public OPhysicalPosition getPhysicalPosition ( final OPhysicalPosition iPPosition ) throws IOException { final long filePosition = iPPosition . clusterPosition * RECORD_SIZE ; acquireSharedLock ( ) ; try { final long [ ] pos = fileSegment . getRelativePosition ( filePosition ) ; final OFile f = fileSegment . files [ ( ...
Fills and return the PhysicalPosition object received as parameter with the physical position of logical record iPosition
141,295
public void removePhysicalPosition ( final long iPosition ) throws IOException { final long position = iPosition * RECORD_SIZE ; acquireExclusiveLock ( ) ; try { final long [ ] pos = fileSegment . getRelativePosition ( position ) ; final OFile file = fileSegment . files [ ( int ) pos [ 0 ] ] ; final long p = pos [ 1 ] ...
Removes the Logical position entry . Add to the hole segment and add the minus to the version .
141,296
public void addPhysicalPosition ( final OPhysicalPosition iPPosition ) throws IOException { final long [ ] pos ; final boolean recycled ; long offset ; acquireExclusiveLock ( ) ; try { offset = holeSegment . popLastEntryPosition ( ) ; if ( offset > - 1 ) { pos = fileSegment . getRelativePosition ( offset ) ; recycled =...
Adds a new entry .
141,297
private void setDataSegmentInternal ( final String iName ) { final int dataId = storage . getDataSegmentIdByName ( iName ) ; config . setDataSegmentId ( dataId ) ; storage . getConfiguration ( ) . update ( ) ; }
Assigns a different data - segment id .
141,298
protected Object getCustomEventLoggerFromRegistry ( MuleContext muleContext ) { Object obj = muleContext . getRegistry ( ) . lookupObject ( CUSTOM_EVENT_LOGGER_BEAN_NAME ) ; return obj ; }
open up for testing without a live MuleContext
141,299
public void addIndex ( final OIndexDefinition indexDefinition ) { indexDefinitions . add ( indexDefinition ) ; if ( indexDefinition instanceof OIndexDefinitionMultiValue ) { if ( multiValueDefinitionIndex == - 1 ) multiValueDefinitionIndex = indexDefinitions . size ( ) - 1 ; else throw new OIndexException ( "Composite ...
Add new indexDefinition in current composite .