signature stringlengths 43 39.1k | implementation stringlengths 0 450k |
|---|---|
public class EndpointActivationService { /** * Declarative Services method for unsetting the JCA feature version
* @ param ref the version */
protected void unsetJcaRuntimeVersion ( JCARuntimeVersion ref ) { } } | Version toUnset = ref . getVersion ( ) ; // If we are removing the jca feature completely , unset jca version to DEFAULT _ VERSION
if ( runtimeVersion . getVersion ( ) . compareTo ( toUnset ) == 0 ) runtimeVersion = DEFAULT_VERSION ; |
public class BlockingCommunicator { /** * Reads a datagram from the socket ( blocking until a datagram has arrived ) . */
protected DownstreamMessage receiveDatagram ( ) throws IOException { } } | // clear the buffer and read a datagram
_buf . clear ( ) ; int size = readDatagram ( _buf ) ; if ( size <= 0 ) { throw new IOException ( "No datagram available to read." ) ; } _buf . flip ( ) ; // decode through the sequencer
try { DownstreamMessage msg = ( DownstreamMessage ) _sequencer . readDatagram ( ) ; if ( _client != null ) { _client . getMessageTracker ( ) . messageReceived ( true , size , msg , ( msg == null ) ? 0 : _sequencer . getMissedCount ( ) ) ; } if ( msg == null ) { return null ; // received out of order
} if ( debugLogMessages ( ) ) { log . info ( "DATAGRAM " + msg ) ; } return msg ; } catch ( ClassNotFoundException cnfe ) { throw ( IOException ) new IOException ( "Unable to decode incoming datagram." ) . initCause ( cnfe ) ; } |
public class CodedInput { /** * Read a raw Varint from the stream . */
public long readRawVarint64 ( ) throws IOException { } } | int shift = 0 ; long result = 0 ; while ( shift < 64 ) { final byte b = readRawByte ( ) ; result |= ( long ) ( b & 0x7F ) << shift ; if ( ( b & 0x80 ) == 0 ) { return result ; } shift += 7 ; } throw ProtobufException . malformedVarint ( ) ; |
public class Relation { /** * Determines whether < code > position1 < / code > plus < code > distance < / code > is
* greater than or equal to < code > position2 < / code > .
* @ param position1
* a < code > long < / code > .
* @ param position2
* a < code > long < / code > .
* @ param distance
* a < code > long < / code > .
* @ return < code > true < / code > if < code > position1 < / code > plus
* < code > distance < / code > is greater than or equal to
* < code > position2 < / code > , < code > false < / code > if not . */
static boolean isGreaterThanOrEqualToDuration ( Unit unit , long position1 , long position2 , int duration ) { } } | return unit . addToPosition ( position1 , duration + 1 ) - 1 >= position2 ; |
public class OnheapIncrementalIndex { /** * Gives estimated max size per aggregator . It is assumed that every aggregator will have enough overhead for its own
* object header and for a pointer to a selector . We are adding a overhead - factor for each object as additional 16
* bytes .
* These 16 bytes or 128 bits is the object metadata for 64 - bit JVM process and consists of :
* < ul >
* < li > Class pointer which describes the object type : 64 bits
* < li > Flags which describe state of the object including hashcode : 64 bits
* < ul / >
* total size estimation consists of :
* < ul >
* < li > metrics length : Integer . BYTES * len
* < li > maxAggregatorIntermediateSize : getMaxIntermediateSize per aggregator + overhead - factor ( 16 bytes )
* < / ul >
* @ param incrementalIndexSchema
* @ return long max aggregator size in bytes */
private static long getMaxBytesPerRowForAggregators ( IncrementalIndexSchema incrementalIndexSchema ) { } } | long maxAggregatorIntermediateSize = Integer . BYTES * incrementalIndexSchema . getMetrics ( ) . length ; maxAggregatorIntermediateSize += Arrays . stream ( incrementalIndexSchema . getMetrics ( ) ) . mapToLong ( aggregator -> aggregator . getMaxIntermediateSizeWithNulls ( ) + Long . BYTES * 2 ) . sum ( ) ; return maxAggregatorIntermediateSize ; |
public class DoubleDoublePair { /** * Implementation of comparableSwapped interface , sorting by second then
* first .
* @ param other Object to compare to
* @ return comparison result */
public int compareSwappedTo ( DoubleDoublePair other ) { } } | int fdiff = Double . compare ( this . second , other . second ) ; if ( fdiff != 0 ) { return fdiff ; } return Double . compare ( this . first , other . first ) ; |
public class ProvFactory { /** * / * A convenience function . */
public QualifiedName newQualifiedName ( javax . xml . namespace . QName qname ) { } } | return newQualifiedName ( qname . getNamespaceURI ( ) , qname . getLocalPart ( ) , qname . getPrefix ( ) ) ; |
public class UserstreamEndpoint { /** * Corresponds to setting ` with = followings ` when true .
* See https : / / dev . twitter . com / docs / streaming - apis / parameters # with */
public void withFollowings ( boolean followings ) { } } | if ( followings ) { addQueryParameter ( Constants . WITH_PARAM , Constants . WITH_FOLLOWINGS ) ; } else { removeQueryParameter ( Constants . WITH_PARAM ) ; } |
public class AdminParserUtils { /** * Adds OPT _ S | OPT _ STORE option to OptionParser , with one argument .
* @ param parser OptionParser to be modified
* @ param required Tells if this option is required or optional */
public static void acceptsStoreMultiple ( OptionParser parser ) { } } | parser . acceptsAll ( Arrays . asList ( OPT_S , OPT_STORE ) , "store name list" ) . withRequiredArg ( ) . describedAs ( "store-name-list" ) . withValuesSeparatedBy ( ',' ) . ofType ( String . class ) ; |
public class BaseResourceMessage { /** * Returns an attribute stored in this message .
* Attributes are just a spot for user data of any kind to be
* added to the message for pasing along the subscription processing
* pipeline ( typically by interceptors ) . Values will be carried from the beginning to the end .
* Note that messages are designed to be passed into queueing systems
* and serialized as JSON . As a result , only strings are currently allowed
* as values . */
public Optional < String > getAttribute ( String theKey ) { } } | Validate . notBlank ( theKey ) ; if ( myAttributes == null ) { return Optional . empty ( ) ; } return Optional . ofNullable ( myAttributes . get ( theKey ) ) ; |
public class GodHandableAction { protected void prepareTransactionMemoriesIfExists ( ) { } } | final SavedTransactionMemories memories = ThreadCacheContext . findTransactionMemories ( ) ; if ( memories != null ) { final List < TransactionMemoriesProvider > providerList = memories . getOrderedProviderList ( ) ; final StringBuilder sb = new StringBuilder ( ) ; for ( TransactionMemoriesProvider provider : providerList ) { provider . provide ( ) . ifPresent ( result -> sb . append ( "\n*" ) . append ( result ) ) ; } final WholeShowAttribute attribute = new WholeShowAttribute ( sb . toString ( ) . trim ( ) ) ; requestManager . setAttribute ( LastaWebKey . DBFLUTE_TRANSACTION_MEMORIES_KEY , attribute ) ; } |
public class SimpleDOReader { /** * { @ inheritDoc } */
@ Override public InputStream Export ( String format , String exportContext ) throws ObjectIntegrityException , StreamIOException , UnsupportedTranslationException , ServerException { } } | // allocate the ByteArrayOutputStream with a 4k initial capacity to constrain copying up
ReadableByteArrayOutputStream bytes = new ReadableByteArrayOutputStream ( 4096 ) ; try { Stream ( format , exportContext ) . write ( bytes ) ; } catch ( Exception e ) { throw new StreamIOException ( e . getMessage ( ) , e ) ; } return bytes . toInputStream ( ) ; |
public class ApacheHttpClient { /** * Invoke a given method with supplied { @ link com . vmware . vim25 . ws . Argument } on the remote vi server .
* This method typically creates the payload needed to send to the vi server . For example you would
* pass in RetrieveServiceContent for the methodName , next the params needed for the method . Next give
* the returnType the parser should convert the response to in this case the string ServiceContent
* Returns an { @ link Object } of the given return type . Using the example above you would get
* a { @ link com . vmware . vim25 . ServiceContent } Object .
* @ param methodName Name of the method to execute
* @ param paras Array of Arguments aka params for the method
* @ param returnType String name of the return type
* @ return Object
* @ throws java . rmi . RemoteException */
@ Override public Object invoke ( String methodName , Argument [ ] paras , String returnType ) throws RemoteException { } } | log . trace ( "Invoking method: " + methodName ) ; String soapMsg = marshall ( methodName , paras ) ; InputStream is = null ; try { is = post ( soapMsg ) ; log . trace ( "Converting xml response from server to: " + returnType ) ; return unMarshall ( returnType , is ) ; } catch ( Exception e1 ) { log . error ( "Exception caught while invoking method." , e1 ) ; throw new RemoteException ( "VI SDK invoke exception:" + e1 , e1 ) ; } finally { if ( is != null ) { try { is . close ( ) ; } catch ( IOException ignored ) { } } } |
public class EFGImpl { /** * < ! - - begin - user - doc - - >
* < ! - - end - user - doc - - >
* @ generated */
@ Override public void eUnset ( int featureID ) { } } | switch ( featureID ) { case AfplibPackage . EFG__FEG_NAME : setFEGName ( FEG_NAME_EDEFAULT ) ; return ; } super . eUnset ( featureID ) ; |
public class DefaultCommandRegistry { /** * { @ inheritDoc } */
public void removeCommandRegistryListener ( CommandRegistryListener listener ) { } } | if ( logger . isDebugEnabled ( ) ) { logger . debug ( "Removing command registry listener " + listener ) ; } commandRegistryListeners . remove ( listener ) ; |
public class AmazonMQClient { /** * Returns a list of all revisions for the specified configuration .
* @ param listConfigurationRevisionsRequest
* @ return Result of the ListConfigurationRevisions operation returned by the service .
* @ throws NotFoundException
* HTTP Status Code 404 : Resource not found due to incorrect input . Correct your request and then retry it .
* @ throws BadRequestException
* HTTP Status Code 400 : Bad request due to incorrect input . Correct your request and then retry it .
* @ throws InternalServerErrorException
* HTTP Status Code 500 : Unexpected internal server error . Retrying your request might resolve the issue .
* @ throws ForbiddenException
* HTTP Status Code 403 : Access forbidden . Correct your credentials and then retry your request .
* @ sample AmazonMQ . ListConfigurationRevisions
* @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / mq - 2017-11-27 / ListConfigurationRevisions " target = " _ top " > AWS
* API Documentation < / a > */
@ Override public ListConfigurationRevisionsResult listConfigurationRevisions ( ListConfigurationRevisionsRequest request ) { } } | request = beforeClientExecution ( request ) ; return executeListConfigurationRevisions ( request ) ; |
public class CreateDeploymentGroupRequest { /** * The Amazon EC2 tags on which to filter . The deployment group includes EC2 instances with any of the specified
* tags . Cannot be used in the same call as ec2TagSet .
* @ return The Amazon EC2 tags on which to filter . The deployment group includes EC2 instances with any of the
* specified tags . Cannot be used in the same call as ec2TagSet . */
public java . util . List < EC2TagFilter > getEc2TagFilters ( ) { } } | if ( ec2TagFilters == null ) { ec2TagFilters = new com . amazonaws . internal . SdkInternalList < EC2TagFilter > ( ) ; } return ec2TagFilters ; |
public class RadixTreeImpl { /** * Recursively insert the key in the radix tree .
* @ param key The key to be inserted
* @ param node The current node
* @ param value The value associated with the key
* @ throws DuplicateKeyException If the key already exists in the database . */
private void insert ( String key , RadixTreeNode < T > node , T value ) throws DuplicateKeyException { } } | int numberOfMatchingCharacters = node . getNumberOfMatchingCharacters ( key ) ; // we are either at the root node
// or we need to go down the tree
if ( node . getKey ( ) . equals ( "" ) == true || numberOfMatchingCharacters == 0 || ( numberOfMatchingCharacters < key . length ( ) && numberOfMatchingCharacters >= node . getKey ( ) . length ( ) ) ) { boolean flag = false ; String newText = key . substring ( numberOfMatchingCharacters , key . length ( ) ) ; for ( RadixTreeNode < T > child : node . getChildern ( ) ) { if ( child . getKey ( ) . startsWith ( newText . charAt ( 0 ) + "" ) ) { flag = true ; insert ( newText , child , value ) ; break ; } } // just add the node as the child of the current node
if ( flag == false ) { RadixTreeNode < T > n = new RadixTreeNode < T > ( ) ; n . setKey ( newText ) ; n . setReal ( true ) ; n . setValue ( value ) ; node . getChildern ( ) . add ( n ) ; } } // there is a exact match just make the current node as data node
else if ( numberOfMatchingCharacters == key . length ( ) && numberOfMatchingCharacters == node . getKey ( ) . length ( ) ) { if ( node . isReal ( ) == true ) { throw new DuplicateKeyException ( "Duplicate key" ) ; } node . setReal ( true ) ; node . setValue ( value ) ; } // This node need to be split as the key to be inserted
// is a prefix of the current node key
else if ( numberOfMatchingCharacters > 0 && numberOfMatchingCharacters < node . getKey ( ) . length ( ) ) { RadixTreeNode < T > n1 = new RadixTreeNode < T > ( ) ; n1 . setKey ( node . getKey ( ) . substring ( numberOfMatchingCharacters , node . getKey ( ) . length ( ) ) ) ; n1 . setReal ( node . isReal ( ) ) ; n1 . setValue ( node . getValue ( ) ) ; n1 . setChildern ( node . getChildern ( ) ) ; node . setKey ( key . substring ( 0 , numberOfMatchingCharacters ) ) ; node . setReal ( false ) ; node . setChildern ( new ArrayList < RadixTreeNode < T > > ( ) ) ; node . getChildern ( ) . add ( n1 ) ; if ( numberOfMatchingCharacters < key . length ( ) ) { RadixTreeNode < T > n2 = new RadixTreeNode < T > ( ) ; n2 . setKey ( key . substring ( numberOfMatchingCharacters , key . length ( ) ) ) ; n2 . setReal ( true ) ; n2 . setValue ( value ) ; node . getChildern ( ) . add ( n2 ) ; } else { node . setValue ( value ) ; node . setReal ( true ) ; } } // this key need to be added as the child of the current node
else { RadixTreeNode < T > n = new RadixTreeNode < T > ( ) ; n . setKey ( node . getKey ( ) . substring ( numberOfMatchingCharacters , node . getKey ( ) . length ( ) ) ) ; n . setChildern ( node . getChildern ( ) ) ; n . setReal ( node . isReal ( ) ) ; n . setValue ( node . getValue ( ) ) ; node . setKey ( key ) ; node . setReal ( true ) ; node . setValue ( value ) ; node . getChildern ( ) . add ( n ) ; } |
public class BuildStepsInner { /** * Updates a build step in a build task .
* @ param resourceGroupName The name of the resource group to which the container registry belongs .
* @ param registryName The name of the container registry .
* @ param buildTaskName The name of the container registry build task .
* @ param stepName The name of a build step for a container registry build task .
* @ param buildStepUpdateParameters The parameters for updating a build step .
* @ param serviceCallback the async ServiceCallback to handle successful and failed responses .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the { @ link ServiceFuture } object */
public ServiceFuture < BuildStepInner > beginUpdateAsync ( String resourceGroupName , String registryName , String buildTaskName , String stepName , BuildStepUpdateParameters buildStepUpdateParameters , final ServiceCallback < BuildStepInner > serviceCallback ) { } } | return ServiceFuture . fromResponse ( beginUpdateWithServiceResponseAsync ( resourceGroupName , registryName , buildTaskName , stepName , buildStepUpdateParameters ) , serviceCallback ) ; |
public class U { /** * Documented , # zip */
@ SuppressWarnings ( "unchecked" ) public static < T > List < List < T > > zip ( final List < T > ... lists ) { } } | final List < List < T > > zipped = newArrayList ( ) ; each ( Arrays . asList ( lists ) , new Consumer < List < T > > ( ) { @ Override public void accept ( final List < T > list ) { int index = 0 ; for ( T elem : list ) { final List < T > nTuple = index >= zipped . size ( ) ? U . < T > newArrayList ( ) : zipped . get ( index ) ; if ( index >= zipped . size ( ) ) { zipped . add ( nTuple ) ; } index += 1 ; nTuple . add ( elem ) ; } } } ) ; return zipped ; |
public class UnicodeSet { /** * Returns true if this set contains all the characters and strings
* of the given set .
* @ param b set to be checked for containment
* @ return true if the test condition is met */
public boolean containsAll ( UnicodeSet b ) { } } | // The specified set is a subset if all of its pairs are contained in
// this set . This implementation accesses the lists directly for speed .
// TODO : this could be faster if size ( ) were cached . But that would affect building speed
// so it needs investigation .
int [ ] listB = b . list ; boolean needA = true ; boolean needB = true ; int aPtr = 0 ; int bPtr = 0 ; int aLen = len - 1 ; int bLen = b . len - 1 ; int startA = 0 , startB = 0 , limitA = 0 , limitB = 0 ; while ( true ) { // double iterations are such a pain . . .
if ( needA ) { if ( aPtr >= aLen ) { // ran out of A . If B is also exhausted , then break ;
if ( needB && bPtr >= bLen ) { break ; } return false ; } startA = list [ aPtr ++ ] ; limitA = list [ aPtr ++ ] ; } if ( needB ) { if ( bPtr >= bLen ) { // ran out of B . Since we got this far , we have an A and we are ok so far
break ; } startB = listB [ bPtr ++ ] ; limitB = listB [ bPtr ++ ] ; } // if B doesn ' t overlap and is greater than A , get new A
if ( startB >= limitA ) { needA = true ; needB = false ; continue ; } // if B is wholy contained in A , then get a new B
if ( startB >= startA && limitB <= limitA ) { needA = false ; needB = true ; continue ; } // all other combinations mean we fail
return false ; } if ( ! strings . containsAll ( b . strings ) ) return false ; return true ; |
public class SimpleBase { /** * Returns the transpose of this matrix . < br >
* a < sup > T < / sup >
* @ see CommonOps _ DDRM # transpose ( DMatrixRMaj , DMatrixRMaj )
* @ return A matrix that is n by m . */
public T transpose ( ) { } } | T ret = createMatrix ( mat . getNumCols ( ) , mat . getNumRows ( ) , mat . getType ( ) ) ; ops . transpose ( mat , ret . mat ) ; return ret ; |
public class ScriptUtil { /** * Creates a new { @ link ExecutableScript } from a dynamic source . Dynamic means that the source
* is an expression which will be evaluated during execution .
* @ param language the language of the script
* @ param sourceExpression the expression which evaluates to the source code
* @ param scriptFactory the script factory used to create the script
* @ return the newly created script
* @ throws NotValidException if language is null or empty or sourceExpression is null */
public static ExecutableScript getScriptFromSourceExpression ( String language , Expression sourceExpression , ScriptFactory scriptFactory ) { } } | ensureNotEmpty ( NotValidException . class , "Script language" , language ) ; ensureNotNull ( NotValidException . class , "Script source expression" , sourceExpression ) ; return scriptFactory . createScriptFromSource ( language , sourceExpression ) ; |
public class AxiomType { /** * Gets the set of axioms from a source set of axioms that are not of the
* specified type
* @ param sourceAxioms
* The source set of axioms
* @ param axiomTypes
* The types that will be filtered out of the source set
* @ return A set of axioms that represents the sourceAxioms without the
* specified types . Note that sourceAxioms will not be modified . The
* returned set is a copy . */
@ Nonnull public static Set < OWLAxiom > getAxiomsWithoutTypes ( @ Nonnull Set < OWLAxiom > sourceAxioms , @ Nonnull AxiomType < ? > ... axiomTypes ) { } } | Set < OWLAxiom > result = new HashSet < > ( ) ; Set < AxiomType < ? > > disallowed = Sets . newHashSet ( axiomTypes ) ; for ( OWLAxiom ax : sourceAxioms ) { if ( ! disallowed . contains ( ax . getAxiomType ( ) ) ) { result . add ( ax ) ; } } return result ; |
public class CdnClient { /** * Update cache policies of specified domain acceleration .
* @ param request The request containing all of the options related to the update request .
* @ return Result of the setDomainCacheTTL operation returned by the service . */
public SetDomainCacheTTLResponse setDomainCacheTTL ( SetDomainCacheTTLRequest request ) { } } | checkNotNull ( request , "The parameter request should NOT be null." ) ; InternalRequest internalRequest = createRequest ( request , HttpMethodName . PUT , DOMAIN , request . getDomain ( ) , "config" ) ; internalRequest . addParameter ( "cacheTTL" , "" ) ; this . attachRequestToBody ( request , internalRequest ) ; return invokeHttpClient ( internalRequest , SetDomainCacheTTLResponse . class ) ; |
public class MapComposedElement { /** * Add the specified point at the end of the specified group .
* @ param x x coordinate
* @ param y y coordinate
* @ param groupIndex the index of the group .
* @ return the index of the point in the element .
* @ throws IndexOutOfBoundsException in case of error . */
public int addPoint ( double x , double y , int groupIndex ) { } } | final int groupCount = getGroupCount ( ) ; if ( groupIndex < 0 ) { throw new IndexOutOfBoundsException ( groupIndex + "<0" ) ; // $ NON - NLS - 1 $
} if ( groupIndex >= groupCount ) { throw new IndexOutOfBoundsException ( groupIndex + ">=" + groupCount ) ; // $ NON - NLS - 1 $
} int pointIndex ; if ( this . pointCoordinates == null ) { this . pointCoordinates = new double [ ] { x , y } ; this . partIndexes = null ; pointIndex = 0 ; } else { pointIndex = lastInGroup ( groupIndex ) ; double [ ] pts = new double [ this . pointCoordinates . length + 2 ] ; pointIndex += 2 ; System . arraycopy ( this . pointCoordinates , 0 , pts , 0 , pointIndex ) ; System . arraycopy ( this . pointCoordinates , pointIndex , pts , pointIndex + 2 , this . pointCoordinates . length - pointIndex ) ; pts [ pointIndex ] = x ; pts [ pointIndex + 1 ] = y ; this . pointCoordinates = pts ; pts = null ; // Shift the following groups ' s indexes
if ( this . partIndexes != null ) { for ( int idx = groupIndex ; idx < this . partIndexes . length ; ++ idx ) { this . partIndexes [ idx ] += 2 ; } } pointIndex /= 2. ; } fireShapeChanged ( ) ; fireElementChanged ( ) ; return pointIndex ; |
public class SyncMembersInner { /** * Gets a sync member database schema .
* ServiceResponse < PageImpl < SyncFullSchemaPropertiesInner > > * @ param nextPageLink The NextLink from the previous successful call to List operation .
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the PagedList & lt ; SyncFullSchemaPropertiesInner & gt ; object wrapped in { @ link ServiceResponse } if successful . */
public Observable < ServiceResponse < Page < SyncFullSchemaPropertiesInner > > > listMemberSchemasNextSinglePageAsync ( final String nextPageLink ) { } } | if ( nextPageLink == null ) { throw new IllegalArgumentException ( "Parameter nextPageLink is required and cannot be null." ) ; } String nextUrl = String . format ( "%s" , nextPageLink ) ; return service . listMemberSchemasNext ( nextUrl , this . client . acceptLanguage ( ) , this . client . userAgent ( ) ) . flatMap ( new Func1 < Response < ResponseBody > , Observable < ServiceResponse < Page < SyncFullSchemaPropertiesInner > > > > ( ) { @ Override public Observable < ServiceResponse < Page < SyncFullSchemaPropertiesInner > > > call ( Response < ResponseBody > response ) { try { ServiceResponse < PageImpl < SyncFullSchemaPropertiesInner > > result = listMemberSchemasNextDelegate ( response ) ; return Observable . just ( new ServiceResponse < Page < SyncFullSchemaPropertiesInner > > ( result . body ( ) , result . response ( ) ) ) ; } catch ( Throwable t ) { return Observable . error ( t ) ; } } } ) ; |
public class KeenClient { /** * Sets the base API URL associated with this instance of the { @ link KeenClient } .
* Use this if you want to disable SSL .
* @ param baseUrl The new base URL ( i . e . ' http : / / api . keen . io ' ) , or null to reset the base URL to
* the default ( ' https : / / api . keen . io ' ) . */
public void setBaseUrl ( String baseUrl ) { } } | if ( baseUrl == null ) { this . baseUrl = KeenConstants . SERVER_ADDRESS ; } else { this . baseUrl = baseUrl ; } |
public class AstaTextFileReader { /** * Process resource assignments .
* @ throws SQLException */
private void processAssignments ( ) throws SQLException { } } | List < Row > allocationRows = getTable ( "PERMANENT_SCHEDUL_ALLOCATION" ) ; List < Row > skillRows = getTable ( "PERM_RESOURCE_SKILL" ) ; List < Row > permanentAssignments = join ( allocationRows , "ALLOCATIOP_OF" , "PERM_RESOURCE_SKILL" , skillRows , "PERM_RESOURCE_SKILLID" ) ; Collections . sort ( permanentAssignments , ALLOCATION_COMPARATOR ) ; m_reader . processAssignments ( permanentAssignments ) ; |
public class UserFileAccessObject { /** * Finds all the available users .
* @ return the list of available users */
public List < User > findAllUsers ( ) { } } | List < User > list = new ArrayList < > ( ) ; List < String > usernames ; try { usernames = readLines ( usersFile ) ; } catch ( IOException e ) { throw new FileBasedRuntimeException ( e ) ; } for ( String username : usernames ) { if ( StringUtils . isNotBlank ( username ) ) { list . add ( new User ( username ) ) ; } } return list ; |
public class AbstractBox { /** * Verifies that a box can be reconstructed byte - exact after parsing .
* @ param content the raw content of the box
* @ return < code > true < / code > if raw content exactly matches the reconstructed content */
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 ) ; } } content . rewind ( ) ; bb . rewind ( ) ; if ( content . remaining ( ) != bb . remaining ( ) ) { LOG . error ( "{}: remaining differs {} vs. {}" , this . getType ( ) , content . remaining ( ) , bb . remaining ( ) ) ; return false ; } int p = content . position ( ) ; for ( int i = content . limit ( ) - 1 , j = bb . limit ( ) - 1 ; i >= p ; i -- , j -- ) { byte v1 = content . get ( i ) ; byte v2 = bb . get ( j ) ; if ( v1 != v2 ) { LOG . error ( "{}: buffers differ at {}: {}/{}" , this . getType ( ) , i , v1 , v2 ) ; byte [ ] b1 = new byte [ content . remaining ( ) ] ; byte [ ] b2 = new byte [ bb . remaining ( ) ] ; content . get ( b1 ) ; bb . get ( b2 ) ; LOG . error ( "original : {}" , Hex . encodeHex ( b1 , 4 ) ) ; LOG . error ( "reconstructed : {}" , Hex . encodeHex ( b2 , 4 ) ) ; return false ; } } return true ; |
public class TaskDataAccess { /** * new task instance group mapping */
public void setTaskInstanceGroups ( Long taskInstId , String [ ] groups ) throws DataAccessException { } } | try { db . openConnection ( ) ; // get group IDs
StringBuffer sb = new StringBuffer ( ) ; sb . append ( "select USER_GROUP_ID from USER_GROUP where GROUP_NAME in (" ) ; for ( int i = 0 ; i < groups . length ; i ++ ) { if ( i > 0 ) sb . append ( "," ) ; sb . append ( "'" ) . append ( groups [ i ] ) . append ( "'" ) ; } sb . append ( ")" ) ; ResultSet rs = db . runSelect ( sb . toString ( ) ) ; List < Long > groupIds = new ArrayList < Long > ( ) ; while ( rs . next ( ) ) { groupIds . add ( rs . getLong ( 1 ) ) ; } // delete existing groups
String query = "" ; if ( db . isMySQL ( ) ) query = "delete TG1 from TASK_INST_GRP_MAPP TG1 join TASK_INST_GRP_MAPP TG2 " + "using (TASK_INSTANCE_ID, USER_GROUP_ID) " + "where TG2.TASK_INSTANCE_ID=?" ; else query = "delete from TASK_INST_GRP_MAPP where TASK_INSTANCE_ID=?" ; db . runUpdate ( query , taskInstId ) ; if ( db . isMySQL ( ) ) db . commit ( ) ; // MySQL will lock even when no rows were deleted and using unique index , so commit so that multiple session inserts aren ' t deadlocked
// insert groups
query = "insert into TASK_INST_GRP_MAPP " + "(TASK_INSTANCE_ID,USER_GROUP_ID,CREATE_DT) values (?,?," + now ( ) + ")" ; db . prepareStatement ( query ) ; Object [ ] args = new Object [ 2 ] ; args [ 0 ] = taskInstId ; for ( Long group : groupIds ) { args [ 1 ] = group ; db . runUpdateWithPreparedStatement ( args ) ; } db . commit ( ) ; } catch ( Exception e ) { db . rollback ( ) ; throw new DataAccessException ( 0 , "failed to associate task instance groups" , e ) ; } finally { db . closeConnection ( ) ; } |
public class JsSrcNameGenerators { /** * Returns a name generator suitable for generating local variable names . */
public static UniqueNameGenerator forLocalVariables ( ) { } } | UniqueNameGenerator generator = new UniqueNameGenerator ( DANGEROUS_CHARACTERS , "$$" ) ; generator . reserve ( JsSrcUtils . JS_LITERALS ) ; generator . reserve ( JsSrcUtils . JS_RESERVED_WORDS ) ; return generator ; |
public class JdbcMapperFactory { /** * Will create a newInstance of JdbcMapper based on the specified metadata and the target class .
* @ param target the target class of the jdbcMapper
* @ param metaData the metadata to create the jdbcMapper from
* @ param < T > the jdbcMapper target type
* @ return a jdbcMapper that will map the data represented by the metadata to an newInstance of target
* @ throws java . sql . SQLException if an error occurs getting the metaData */
public < T > JdbcMapper < T > newMapper ( final Class < T > target , final ResultSetMetaData metaData ) throws SQLException { } } | JdbcMapperBuilder < T > builder = newBuilder ( target ) ; builder . addMapping ( metaData ) ; return builder . mapper ( ) ; |
public class OrientedBox3f { /** * Set the first axis of the second .
* The third axis is updated to be perpendicular to the two other axis .
* @ param x
* @ param y
* @ param z
* @ param extent
* @ param system */
@ Override public void setFirstAxis ( double x , double y , double z , double extent , CoordinateSystem3D system ) { } } | this . axis1 . set ( x , y , z ) ; assert ( this . axis1 . isUnitVector ( ) ) ; if ( system . isLeftHanded ( ) ) { this . axis3 . set ( this . axis1 . crossLeftHand ( this . axis2 ) ) ; } else { this . axis3 . set ( this . axis3 . crossRightHand ( this . axis2 ) ) ; } this . extent1 = extent ; |
public class PortletEventQueue { /** * Queue an { @ link Event } for the specified { @ link IPortletWindowId } */
public void offerEvent ( IPortletWindowId portletWindowId , QueuedEvent event ) { } } | Queue < QueuedEvent > events = resolvedEventQueues . get ( portletWindowId ) ; if ( events == null ) { events = ConcurrentMapUtils . putIfAbsent ( resolvedEventQueues , portletWindowId , new ConcurrentLinkedQueue < QueuedEvent > ( ) ) ; } events . offer ( event ) ; |
public class Grid { /** * Add the element in the grid .
* @ param element the element .
* @ return < code > true < / code > if the element was added ;
* otherwise < code > false < / code > . */
public boolean addElement ( P element ) { } } | boolean changed = false ; if ( element != null ) { final GridCellElement < P > gridElement = new GridCellElement < > ( element ) ; for ( final GridCell < P > cell : getGridCellsOn ( element . getGeoLocation ( ) . toBounds2D ( ) , true ) ) { if ( cell . addElement ( gridElement ) ) { changed = true ; } } } if ( changed ) { ++ this . elementCount ; } return changed ; |
public class PlatformTimezone { /** * ~ Methoden - - - - - */
@ Override public TZID getID ( ) { } } | if ( this . id == null ) { String zoneID = java . util . TimeZone . getDefault ( ) . getID ( ) ; return new NamedID ( zoneID ) ; } else { return this . id ; } |
public class SecureUtil { /** * 读取Certification文件 < br >
* Certification为证书文件 < br >
* see : http : / / snowolf . iteye . com / blog / 391931
* @ param type 类型 , 例如X . 509
* @ param in { @ link InputStream } 如果想从文件读取 . cer文件 , 使用 { @ link FileUtil # getInputStream ( java . io . File ) } 读取
* @ param password 密码
* @ param alias 别名
* @ return { @ link KeyStore }
* @ since 4.4.1 */
public static Certificate readCertificate ( String type , InputStream in , char [ ] password , String alias ) { } } | return KeyUtil . readCertificate ( type , in , password , alias ) ; |
public class Call { /** * Executes a method on the target object which returns Calendar . Parameters must match
* those of the method .
* @ param methodName the name of the method
* @ param optionalParameters the ( optional ) parameters of the method .
* @ return the result of the method execution */
public static Function < Object , Calendar > methodForCalendar ( final String methodName , final Object ... optionalParameters ) { } } | return new Call < Object , Calendar > ( Types . CALENDAR , methodName , VarArgsUtil . asOptionalObjectArray ( Object . class , optionalParameters ) ) ; |
public class Annotate { /** * It takes a KAF document calls to getParse ( ) and outputs the parse tree as
* KAF constituents elements .
* @ param kaf
* document containing WF and Term elements
* @ throws IOException
* if io error */
public void parseToKAF ( final KAFDocument kaf ) throws IOException { } } | final StringBuffer parsingDoc = getParse ( kaf ) ; try { kaf . addConstituencyFromParentheses ( parsingDoc . toString ( ) ) ; } catch ( final Exception e ) { e . printStackTrace ( ) ; } |
public class ClusterServiceKrakenImpl { /** * Asks for updates from the message */
@ Override public void requestStartupUpdates ( String from , byte [ ] tableKey , int podIndex , long deltaTime , Result < Boolean > cont ) { } } | if ( log . isLoggable ( Level . FINEST ) ) { log . finest ( "CacheRequestUpdates " + from + " shard=" + podIndex + " delta=" + deltaTime ) ; } // ChampCloudManager cloudManager = ChampCloudManager . create ( ) ;
// ServiceManagerAmp rampManager = AmpSystem . getCurrentManager ( ) ;
// String address = " champ : / / " + from + ClusterServiceKraken . UID ;
// ClusterServiceKraken peerService = rampManager . lookup ( address ) . as ( ClusterServiceKraken . class ) ;
// ArrayList < CacheData > entryList = null ;
long accessTime = CurrentTime . currentTime ( ) + deltaTime ; // int count = 0;
TablePod tablePod = _clientKraken . getTable ( tableKey ) ; if ( tablePod == null ) { // This server does not have any information about the table .
if ( log . isLoggable ( Level . FINEST ) ) { log . finest ( L . l ( "{0} is an unknown table key ({1})" , Hex . toShortHex ( tableKey ) , BartenderSystem . getCurrentSelfServer ( ) ) ) ; } cont . ok ( true ) ; return ; } tablePod . getUpdatesFromLocal ( podIndex , accessTime , cont ) ; // new ResultUpdate ( peerService , cont ) ) ;
// start reciprocating update request
// tablePod . startRequestUpdates ( ) ; |
public class CommerceOrderNoteLocalServiceUtil { /** * Returns a range of all the commerce order notes .
* Useful when paginating results . Returns a maximum of < code > end - start < / code > instances . < code > start < / code > and < code > end < / code > are not primary keys , they are indexes in the result set . Thus , < code > 0 < / code > refers to the first result in the set . Setting both < code > start < / code > and < code > end < / code > to { @ link com . liferay . portal . kernel . dao . orm . QueryUtil # ALL _ POS } will return the full result set . If < code > orderByComparator < / code > is specified , then the query will include the given ORDER BY logic . If < code > orderByComparator < / code > is absent and pagination is required ( < code > start < / code > and < code > end < / code > are not { @ link com . liferay . portal . kernel . dao . orm . QueryUtil # ALL _ POS } ) , then the query will include the default ORDER BY logic from { @ link com . liferay . commerce . model . impl . CommerceOrderNoteModelImpl } . If both < code > orderByComparator < / code > and pagination are absent , for performance reasons , the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order .
* @ param start the lower bound of the range of commerce order notes
* @ param end the upper bound of the range of commerce order notes ( not inclusive )
* @ return the range of commerce order notes */
public static java . util . List < com . liferay . commerce . model . CommerceOrderNote > getCommerceOrderNotes ( int start , int end ) { } } | return getService ( ) . getCommerceOrderNotes ( start , end ) ; |
public class RecentList { /** * Returns true if the supplied value is equal ( using { @ link
* Object # equals } ) to any value in the list . */
public boolean contains ( Object value ) { } } | for ( int ii = 0 , nn = size ( ) ; ii < nn ; ii ++ ) { if ( ObjectUtil . equals ( value , _list [ ii ] ) ) { return true ; } } return false ; |
public class ObjectFactory { /** * Create an instance of { @ link JAXBElement } { @ code < } { @ link Object } { @ code > }
* @ param value
* Java instance representing xml element ' s value .
* @ return
* the new instance of { @ link JAXBElement } { @ code < } { @ link Object } { @ code > } */
@ XmlElementDecl ( namespace = "http://www.opengis.net/citygml/tunnel/2.0" , name = "_GenericApplicationPropertyOfTunnel" ) public JAXBElement < Object > create_GenericApplicationPropertyOfTunnel ( Object value ) { } } | return new JAXBElement < Object > ( __GenericApplicationPropertyOfTunnel_QNAME , Object . class , null , value ) ; |
public class EJBApplicationMetaData { /** * F54184.1 F54184.2 */
void validateVersionedModuleBaseName ( String appBaseName , String modBaseName ) { } } | for ( EJBModuleMetaDataImpl ejbMMD : ivModules ) { String versionedAppBaseName = ejbMMD . ivVersionedAppBaseName ; if ( versionedAppBaseName != null && ! versionedAppBaseName . equals ( appBaseName ) ) { throw new IllegalArgumentException ( "appBaseName (" + appBaseName + ") does not equal previously set value : " + versionedAppBaseName ) ; } if ( modBaseName . equals ( ejbMMD . ivVersionedModuleBaseName ) ) { throw new IllegalArgumentException ( "duplicate baseName : " + modBaseName ) ; } } |
public class Solo { /** * Waits for a Dialog to open . Default timeout is 20 seconds .
* @ return { @ code true } if the { @ link android . app . Dialog } is opened before the timeout and { @ code false } if it is not opened */
public boolean waitForDialogToOpen ( ) { } } | if ( config . commandLogging ) { Log . d ( config . commandLoggingTag , "waitForDialogToOpen()" ) ; } return dialogUtils . waitForDialogToOpen ( Timeout . getLargeTimeout ( ) , true ) ; |
public class JDBDT { /** * Create a new database handle for given { @ link javax . sql . DataSource }
* instance , user , and password .
* < p > Calling this method is shorthand for : < br >
* & nbsp ; & nbsp ; & nbsp ; & nbsp ;
* < code > database ( xds . getConnection ( user , password ) ) < / code > .
* @ param xds { @ link javax . sql . DataSource } instance .
* @ param user Database user .
* @ param password Database password .
* @ return A new database handle for the connection .
* @ throws SQLException If the connection cannot be created .
* @ see # database ( Connection )
* @ see javax . sql . DataSource # getConnection ( String , String )
* @ since 1.2 */
public static DB database ( javax . sql . DataSource xds , String user , String password ) throws SQLException { } } | return database ( xds . getConnection ( user , password ) ) ; |
public class CoordinatorAdminUtils { /** * Utility function that copies a string array and add another string to
* first
* @ param arr Original array of strings
* @ param add
* @ return Copied array of strings */
public static String [ ] copyArrayAddFirst ( String [ ] arr , String add ) { } } | String [ ] arrCopy = new String [ arr . length + 1 ] ; arrCopy [ 0 ] = add ; System . arraycopy ( arr , 0 , arrCopy , 1 , arr . length ) ; return arrCopy ; |
public class InfoWindow { /** * refresh the infowindow drawing . Must be called every time the view changes ( drag , zoom , . . . ) .
* Best practice is to call this method in the draw method of its overlay . */
public void draw ( ) { } } | if ( ! mIsVisible ) return ; try { MapView . LayoutParams lp = new MapView . LayoutParams ( MapView . LayoutParams . WRAP_CONTENT , MapView . LayoutParams . WRAP_CONTENT , mPosition , MapView . LayoutParams . BOTTOM_CENTER , mOffsetX , mOffsetY ) ; mMapView . updateViewLayout ( mView , lp ) ; // supposed to work only on the UI Thread
} catch ( Exception e ) { if ( MapSnapshot . isUIThread ( ) ) { throw e ; } // in order to avoid a CalledFromWrongThreadException crash
} |
public class UBench { /** * Benchmark all added tasks until they complete the desired iteration
* count , reaches stability , or exceed the given time limit , whichever comes
* first .
* @ param mode
* The UMode execution model to use for task execution
* @ param iterations
* maximum number of iterations to run .
* @ param stableSpan
* If this many iterations in a row are all within the
* maxVariance , then the benchmark ends . A value less than , or
* equal to 0 turns off this check
* @ param stableBound
* Expressed as a percent from 0.0 to 100.0 , and so on
* @ param timeLimit
* combined with the timeUnit , indicates how long to run tests
* for . A value less than or equal to 0 turns off this check .
* @ param timeUnit
* combined with the timeLimit , indicates how long to run tests
* for .
* @ return the results of all completed tasks . */
public UReport press ( final UMode mode , final int iterations , final int stableSpan , final double stableBound , final long timeLimit , final TimeUnit timeUnit ) { } } | // make sense of any out - of - bounds input parameters .
UMode vmode = mode == null ? UMode . INTERLEAVED : mode ; int vit = iterations <= 0 ? 0 : Math . min ( MAX_RESULTS , iterations ) ; int vmin = ( stableSpan <= 0 || stableBound <= 0 ) ? 0 : Math . min ( stableSpan , vit ) ; long vtime = timeLimit <= 0 ? 0 : ( timeUnit == null ? 0 : timeUnit . toNanos ( timeLimit ) ) ; final long start = System . nanoTime ( ) ; LOGGER . fine ( ( ) -> String . format ( "UBench suite %s: running all tasks in mode %s" , suiteName , vmode . name ( ) ) ) ; TaskRunner [ ] mytasks = getTasks ( vit , vmin , stableBound , vtime ) ; UStats [ ] ret = vmode . getModel ( ) . executeTasks ( suiteName , mytasks ) ; final long time = System . nanoTime ( ) - start ; LOGGER . info ( ( ) -> String . format ( "UBench suite %s: completed benchmarking all tasks using mode %s in %.3fms" , suiteName , vmode . name ( ) , time / 1000000.0 ) ) ; return new UReport ( Arrays . asList ( ret ) ) ; |
public class DataBuilder { /** * Appends a copy of the given { @ code Browser . Builder } to the internal data structure .
* @ param browserBuilder
* { @ code Browser . Builder } to be copied and appended
* @ return this { @ code Builder } , for chaining
* @ throws net . sf . qualitycheck . exception . IllegalNullArgumentException
* if the given argument is { @ code null }
* @ throws net . sf . qualitycheck . exception . IllegalStateOfArgumentException
* if the ID of the given builder is invalid
* @ throws net . sf . qualitycheck . exception . IllegalStateOfArgumentException
* if a builder with the same ID already exists */
@ Nonnull public DataBuilder appendBrowserBuilder ( @ Nonnull final Browser . Builder browserBuilder ) { } } | Check . notNull ( browserBuilder , "browserBuilder" ) ; Check . notNegative ( browserBuilder . getId ( ) , "browserBuilder.getId()" ) ; if ( browserBuilder . getType ( ) == null && browserBuilder . getTypeId ( ) < 0 ) { throw new IllegalStateOfArgumentException ( "A Type or Type-ID of argument 'browserBuilder' must be set." ) ; } if ( browserBuilders . containsKey ( browserBuilder . getId ( ) ) ) { throw new IllegalStateOfArgumentException ( "The browser builder '" + browserBuilder . getProducer ( ) + " " + browserBuilder . getFamily ( ) + "' is already in the map." ) ; } final Browser . Builder builder = browserBuilder . copy ( ) ; browserBuilders . put ( builder . getId ( ) , builder ) ; return this ; |
public class GenderInfo { /** * Get the gender of a list , based on locale usage .
* @ param genders a list of genders .
* @ return the gender of the list .
* @ deprecated This API is ICU internal only .
* @ hide draft / provisional / internal are hidden on Android */
@ Deprecated public Gender getListGender ( List < Gender > genders ) { } } | if ( genders . size ( ) == 0 ) { return Gender . OTHER ; // degenerate case
} if ( genders . size ( ) == 1 ) { return genders . get ( 0 ) ; // degenerate case
} switch ( style ) { case NEUTRAL : return Gender . OTHER ; case MIXED_NEUTRAL : boolean hasFemale = false ; boolean hasMale = false ; for ( Gender gender : genders ) { switch ( gender ) { case FEMALE : if ( hasMale ) { return Gender . OTHER ; } hasFemale = true ; break ; case MALE : if ( hasFemale ) { return Gender . OTHER ; } hasMale = true ; break ; case OTHER : return Gender . OTHER ; } } return hasMale ? Gender . MALE : Gender . FEMALE ; // Note : any OTHER would have caused a return in the loop , which always happens .
case MALE_TAINTS : for ( Gender gender : genders ) { if ( gender != Gender . FEMALE ) { return Gender . MALE ; } } return Gender . FEMALE ; default : return Gender . OTHER ; } |
public class SphereUtil { /** * Compute the approximate great - circle distance of two points .
* Reference :
* T . Vincenty < br >
* Direct and inverse solutions of geodesics on the ellipsoid with application
* of nested equations < br >
* Survey review 23 176 , 1975
* @ param f Ellipsoid flattening
* @ param lat1 Latitude of first point in degree
* @ param lon1 Longitude of first point in degree
* @ param lat2 Latitude of second point in degree
* @ param lon2 Longitude of second point in degree
* @ return Distance for a minor axis of 1. */
@ Reference ( authors = "T. Vincenty" , title = "Direct and inverse solutions of geodesics on the ellipsoid with application of nested equations" , booktitle = "Survey Review 23:176" , url = "https://doi.org/10.1179/sre.1975.23.176.88" , bibkey = "doi:10.1179/sre.1975.23.176.88" ) public static double ellipsoidVincentyFormulaRad ( double f , double lat1 , double lon1 , double lat2 , double lon2 ) { } } | final double dlon = ( lon2 >= lon1 ) ? ( lon2 - lon1 ) : ( lon1 - lon2 ) ; final double onemf = 1 - f ; // = 1 - ( a - b ) / a = b / a
// Second eccentricity squared
final double a_b = 1. / onemf ; // = a / b
final double ecc2 = ( a_b + 1 ) * ( a_b - 1 ) ; // ( a ^ 2 - b ^ 2 ) / ( b ^ 2)
// Reduced latitudes :
final double u1 = atan ( onemf * tan ( lat1 ) ) ; final double u2 = atan ( onemf * tan ( lat2 ) ) ; // Trigonometric values
final DoubleWrapper tmp = new DoubleWrapper ( ) ; // To return cosine
final double su1 = sinAndCos ( u1 , tmp ) , cu1 = tmp . value ; final double su2 = sinAndCos ( u2 , tmp ) , cu2 = tmp . value ; // Eqn ( 13 ) - initial value
double lambda = dlon ; for ( int i = 0 ; ; i ++ ) { final double slon = sinAndCos ( lambda , tmp ) , clon = tmp . value ; // Eqn ( 14 ) - \ sin \ sigma
final double term1 = cu2 * slon , term2 = cu1 * su2 - su1 * cu2 * clon ; final double ssig = sqrt ( term1 * term1 + term2 * term2 ) ; // Eqn ( 15 ) - \ cos \ sigma
final double csig = su1 * su2 + cu1 * cu2 * clon ; // Two identical points ?
if ( ! ( ssig > 0 ) ) { return 0. ; } // Eqn ( 16 ) - \ sigma from \ tan \ sigma
final double sigma = atan2 ( ssig , csig ) ; // Eqn ( 17 ) - \ sin \ alpha , and this way \ cos ^ 2 \ alpha
final double salp = cu1 * cu2 * slon / ssig ; final double c2alp = ( 1. + salp ) * ( 1. - salp ) ; // Eqn ( 18 ) - \ cos 2 \ sigma _ m
final double ctwosigm = ( Math . abs ( c2alp ) > 0 ) ? csig - 2.0 * su1 * su2 / c2alp : 0. ; final double c2twosigm = ctwosigm * ctwosigm ; // Eqn ( 10 ) - C
final double cc = f * .0625 * c2alp * ( 4.0 + f * ( 4.0 - 3.0 * c2alp ) ) ; // Eqn ( 11 ) - new \ lambda
final double prevlambda = lambda ; lambda = dlon + ( 1.0 - cc ) * f * salp * ( sigma + cc * ssig * ( ctwosigm + cc * csig * ( - 1.0 + 2.0 * c2twosigm ) ) ) ; // Check for convergence :
if ( Math . abs ( prevlambda - lambda ) < PRECISION || i >= MAX_ITER ) { // TODO : what is the proper result to return on MAX _ ITER ( antipodal
// points ) ?
// Definition of u ^ 2 , rewritten to use second eccentricity .
final double usq = c2alp * ecc2 ; // Eqn ( 3 ) - A
final double aa = 1.0 + usq / 16384.0 * ( 4096.0 + usq * ( - 768.0 + usq * ( 320.0 - 175.0 * usq ) ) ) ; // Eqn ( 4 ) - B
final double bb = usq / 1024.0 * ( 256.0 + usq * ( - 128.0 + usq * ( 74.0 - 47.0 * usq ) ) ) ; // Eqn ( 6 ) - \ Delta \ sigma
final double dsig = bb * ssig * ( ctwosigm + .25 * bb * ( csig * ( - 1.0 + 2.0 * c2twosigm ) - ONE_SIXTH * bb * ctwosigm * ( - 3.0 + 4.0 * ssig * ssig ) * ( - 3.0 + 4.0 * c2twosigm ) ) ) ; // Eqn ( 19 ) - s
return aa * ( sigma - dsig ) ; } } |
public class JdbcDatabaseConnection { /** * Returns whether the connection has already been closed . Used by { @ link JdbcConnectionSource } . */
@ Override public boolean isClosed ( ) throws SQLException { } } | boolean isClosed = connection . isClosed ( ) ; logger . trace ( "connection is closed returned {}" , isClosed ) ; return isClosed ; |
public class StringKit { /** * Generate a number of numeric strings randomly
* @ param size string count
* @ return return random string value */
public static String rand ( int size ) { } } | StringBuilder num = new StringBuilder ( ) ; for ( int i = 0 ; i < size ; i ++ ) { double a = Math . random ( ) * 9 ; a = Math . ceil ( a ) ; int randomNum = new Double ( a ) . intValue ( ) ; num . append ( randomNum ) ; } return num . toString ( ) ; |
public class PdfCopyFieldsImp { /** * Creates the new PDF by merging the fields and forms . */
protected void closeIt ( ) throws IOException { } } | for ( int k = 0 ; k < readers . size ( ) ; ++ k ) { ( ( PdfReader ) readers . get ( k ) ) . removeFields ( ) ; } for ( int r = 0 ; r < readers . size ( ) ; ++ r ) { PdfReader reader = ( PdfReader ) readers . get ( r ) ; for ( int page = 1 ; page <= reader . getNumberOfPages ( ) ; ++ page ) { pageRefs . add ( getNewReference ( reader . getPageOrigRef ( page ) ) ) ; pageDics . add ( reader . getPageN ( page ) ) ; } } mergeFields ( ) ; createAcroForms ( ) ; for ( int r = 0 ; r < readers . size ( ) ; ++ r ) { PdfReader reader = ( PdfReader ) readers . get ( r ) ; for ( int page = 1 ; page <= reader . getNumberOfPages ( ) ; ++ page ) { PdfDictionary dic = reader . getPageN ( page ) ; PdfIndirectReference pageRef = getNewReference ( reader . getPageOrigRef ( page ) ) ; PdfIndirectReference parent = root . addPageRef ( pageRef ) ; dic . put ( PdfName . PARENT , parent ) ; propagate ( dic , pageRef , false ) ; } } for ( Iterator it = readers2intrefs . entrySet ( ) . iterator ( ) ; it . hasNext ( ) ; ) { Map . Entry entry = ( Map . Entry ) it . next ( ) ; PdfReader reader = ( PdfReader ) entry . getKey ( ) ; try { file = reader . getSafeFile ( ) ; file . reOpen ( ) ; IntHashtable t = ( IntHashtable ) entry . getValue ( ) ; int keys [ ] = t . toOrderedKeys ( ) ; for ( int k = 0 ; k < keys . length ; ++ k ) { PRIndirectReference ref = new PRIndirectReference ( reader , keys [ k ] ) ; addToBody ( PdfReader . getPdfObjectRelease ( ref ) , t . get ( keys [ k ] ) ) ; } } finally { try { file . close ( ) ; reader . close ( ) ; } catch ( Exception e ) { // empty on purpose
} } } pdf . close ( ) ; |
public class OnDiskSemanticSpace { /** * { @ inheritDoc }
* @ throws IOError if any { @ code IOException } occurs when reading the data
* from the underlying semantic space file . */
public synchronized Vector getVector ( String word ) { } } | try { switch ( format ) { case TEXT : return new DenseVector ( loadTextVector ( word ) ) ; case BINARY : return new DenseVector ( loadBinaryVector ( word ) ) ; case SPARSE_TEXT : return new CompactSparseVector ( loadSparseTextVector ( word ) ) ; case SPARSE_BINARY : return new CompactSparseVector ( loadSparseBinaryVector ( word ) ) ; } } catch ( IOException ioe ) { // rethrow as something catastrophic must have happened to the
// underlying . sspace file
throw new IOError ( ioe ) ; } return null ; |
public class HttpSupport { /** * Synonym of { @ link # sessionObject ( String ) } .
* @ param name name of session attribute
* @ return value of session attribute of null if not found */
protected Object session ( String name ) { } } | Object val = session ( ) . get ( name ) ; return val == null ? null : val ; |
public class LoginContextBuilder { /** * Provides a RunAs client login context */
private LoginContext getClientLoginContext ( ) throws LoginException { } } | Configuration config = new Configuration ( ) { @ Override public AppConfigurationEntry [ ] getAppConfigurationEntry ( String name ) { Map < String , String > options = new HashMap < String , String > ( ) ; options . put ( "multi-threaded" , "true" ) ; options . put ( "restore-login-identity" , "true" ) ; AppConfigurationEntry clmEntry = new AppConfigurationEntry ( ClientLoginModule . class . getName ( ) , LoginModuleControlFlag . REQUIRED , options ) ; return new AppConfigurationEntry [ ] { clmEntry } ; } } ; return getLoginContext ( config ) ; |
public class RedBlackTreeInteger { /** * flip the colors of a node and its two children */
private void flipColors ( Node < T > h ) { } } | // h must have opposite color of its two children
// assert ( h ! = null ) & & ( h . left ! = null ) & & ( h . right ! = null ) ;
// assert ( ! isRed ( h ) & & isRed ( h . left ) & & isRed ( h . right ) )
// | | ( isRed ( h ) & & ! isRed ( h . left ) & & ! isRed ( h . right ) ) ;
h . red = ! h . red ; h . left . red = ! h . left . red ; h . right . red = ! h . right . red ; |
public class FunctionType { /** * Given a constructor or an interface type , get its superclass constructor or { @ code null } if
* none exists . */
@ Override public final FunctionType getSuperClassConstructor ( ) { } } | checkArgument ( isConstructor ( ) || isInterface ( ) ) ; ObjectType maybeSuperInstanceType = getPrototype ( ) . getImplicitPrototype ( ) ; if ( maybeSuperInstanceType == null ) { return null ; } return maybeSuperInstanceType . getConstructor ( ) ; |
public class SparseMatrix { /** * Get all row ' s items
* @ param row row index
* @ return Collection with row ' s Objects */
@ NonNull Collection < TObj > getRowItems ( int row ) { } } | Collection < TObj > result = new LinkedList < > ( ) ; SparseArrayCompat < TObj > array = mData . get ( row ) ; for ( int count = array . size ( ) , i = 0 ; i < count ; i ++ ) { int key = array . keyAt ( i ) ; TObj columnObj = array . get ( key ) ; if ( columnObj != null ) { result . add ( columnObj ) ; } } return result ; |
public class Union { /** * Union the given source and destination sketches . This static method examines the state of
* the current internal gadget and the incoming sketch and determines the optimum way to
* perform the union . This may involve swapping , down - sampling , transforming , and / or
* copying one of the arguments and may completely replace the internals of the union .
* @ param incomingImpl the given incoming sketch , which may not be modified .
* @ param gadgetImpl the given gadget sketch , which must have a target of HLL _ 8 and may be
* modified .
* @ param lgMaxK the maximum value of log2 K for this union .
* @ return the union of the two sketches in the form of the internal HllSketchImpl , which for
* the union is always in HLL _ 8 form . */
private static final HllSketchImpl unionImpl ( final HllSketchImpl incomingImpl , final HllSketchImpl gadgetImpl , final int lgMaxK ) { } } | assert gadgetImpl . getTgtHllType ( ) == HLL_8 ; HllSketchImpl srcImpl = incomingImpl ; // default
HllSketchImpl dstImpl = gadgetImpl ; // default
if ( ( incomingImpl == null ) || incomingImpl . isEmpty ( ) ) { return gadgetImpl ; } final int hi2bits = ( gadgetImpl . isEmpty ( ) ) ? 3 : gadgetImpl . getCurMode ( ) . ordinal ( ) ; final int lo2bits = incomingImpl . getCurMode ( ) . ordinal ( ) ; final int sw = ( hi2bits << 2 ) | lo2bits ; switch ( sw ) { case 0 : { // src : LIST , gadget : LIST
final PairIterator srcItr = srcImpl . iterator ( ) ; // LIST
while ( srcItr . nextValid ( ) ) { dstImpl = dstImpl . couponUpdate ( srcItr . getPair ( ) ) ; // assignment required
} // whichever is True wins :
dstImpl . putOutOfOrderFlag ( dstImpl . isOutOfOrderFlag ( ) | srcImpl . isOutOfOrderFlag ( ) ) ; break ; } case 1 : { // src : SET , gadget : LIST
// consider a swap here
final PairIterator srcItr = srcImpl . iterator ( ) ; // SET
while ( srcItr . nextValid ( ) ) { dstImpl = dstImpl . couponUpdate ( srcItr . getPair ( ) ) ; // assignment required
} dstImpl . putOutOfOrderFlag ( true ) ; // SET oooFlag is always true
break ; } case 2 : { // src : HLL , gadget : LIST
// swap so that src is gadget - LIST , tgt is HLL
// use lgMaxK because LIST has effective K of 2 ^ 26
srcImpl = gadgetImpl ; dstImpl = copyOrDownsampleHll ( incomingImpl , lgMaxK ) ; final PairIterator srcItr = srcImpl . iterator ( ) ; while ( srcItr . nextValid ( ) ) { dstImpl = dstImpl . couponUpdate ( srcItr . getPair ( ) ) ; // assignment required
} // whichever is True wins :
dstImpl . putOutOfOrderFlag ( srcImpl . isOutOfOrderFlag ( ) | dstImpl . isOutOfOrderFlag ( ) ) ; break ; } case 4 : { // src : LIST , gadget : SET
final PairIterator srcItr = srcImpl . iterator ( ) ; // LIST
while ( srcItr . nextValid ( ) ) { dstImpl = dstImpl . couponUpdate ( srcItr . getPair ( ) ) ; // assignment required
} dstImpl . putOutOfOrderFlag ( true ) ; // SET oooFlag is always true
break ; } case 5 : { // src : SET , gadget : SET
final PairIterator srcItr = srcImpl . iterator ( ) ; // SET
while ( srcItr . nextValid ( ) ) { dstImpl = dstImpl . couponUpdate ( srcItr . getPair ( ) ) ; // assignment required
} dstImpl . putOutOfOrderFlag ( true ) ; // SET oooFlag is always true
break ; } case 6 : { // src : HLL , gadget : SET
// swap so that src is gadget - SET , tgt is HLL
// use lgMaxK because LIST has effective K of 2 ^ 26
srcImpl = gadgetImpl ; dstImpl = copyOrDownsampleHll ( incomingImpl , lgMaxK ) ; final PairIterator srcItr = srcImpl . iterator ( ) ; // LIST
assert dstImpl . getCurMode ( ) == HLL ; while ( srcItr . nextValid ( ) ) { dstImpl = dstImpl . couponUpdate ( srcItr . getPair ( ) ) ; // assignment required
} dstImpl . putOutOfOrderFlag ( true ) ; // merging SET into non - empty HLL - > true
break ; } case 8 : { // src : LIST , gadget : HLL
assert dstImpl . getCurMode ( ) == HLL ; final PairIterator srcItr = srcImpl . iterator ( ) ; // LIST
while ( srcItr . nextValid ( ) ) { dstImpl = dstImpl . couponUpdate ( srcItr . getPair ( ) ) ; // assignment required
} // whichever is True wins :
dstImpl . putOutOfOrderFlag ( dstImpl . isOutOfOrderFlag ( ) | srcImpl . isOutOfOrderFlag ( ) ) ; break ; } case 9 : { // src : SET , gadget : HLL
assert dstImpl . getCurMode ( ) == HLL ; final PairIterator srcItr = srcImpl . iterator ( ) ; // SET
while ( srcItr . nextValid ( ) ) { dstImpl = dstImpl . couponUpdate ( srcItr . getPair ( ) ) ; // assignment required
} dstImpl . putOutOfOrderFlag ( true ) ; // merging SET into existing HLL - > true
break ; } case 10 : { // src : HLL , gadget : HLL
final int srcLgK = srcImpl . getLgConfigK ( ) ; final int dstLgK = dstImpl . getLgConfigK ( ) ; if ( ( srcLgK < dstLgK ) || ( dstImpl . getTgtHllType ( ) != HLL_8 ) ) { dstImpl = copyOrDownsampleHll ( dstImpl , min ( dstLgK , srcLgK ) ) ; // TODO Fix for off - heap
} final PairIterator srcItr = srcImpl . iterator ( ) ; // HLL
while ( srcItr . nextValid ( ) ) { dstImpl = dstImpl . couponUpdate ( srcItr . getPair ( ) ) ; // assignment required
} dstImpl . putOutOfOrderFlag ( true ) ; // union of two HLL modes is always true
break ; } case 12 : { // src : LIST , gadget : empty
final PairIterator srcItr = srcImpl . iterator ( ) ; // LIST
while ( srcItr . nextValid ( ) ) { dstImpl = dstImpl . couponUpdate ( srcItr . getPair ( ) ) ; // assignment required
} dstImpl . putOutOfOrderFlag ( srcImpl . isOutOfOrderFlag ( ) ) ; // whatever source is
break ; } case 13 : { // src : SET , gadget : empty
final PairIterator srcItr = srcImpl . iterator ( ) ; // SET
while ( srcItr . nextValid ( ) ) { dstImpl = dstImpl . couponUpdate ( srcItr . getPair ( ) ) ; // assignment required
} dstImpl . putOutOfOrderFlag ( true ) ; // SET oooFlag is always true
break ; } case 14 : { // src : HLL , gadget : empty
dstImpl = copyOrDownsampleHll ( srcImpl , lgMaxK ) ; dstImpl . putOutOfOrderFlag ( srcImpl . isOutOfOrderFlag ( ) ) ; // whatever source is .
break ; } } if ( gadgetImpl . isMemory ( ) && ! dstImpl . isMemory ( ) ) { // dstImpl is on heap , gadget is Memory ; we have to put dstImpl back into the gadget
final WritableMemory gadgetWmem = gadgetImpl . getWritableMemory ( ) ; assert gadgetWmem != null ; final int bytes = HllSketch . getMaxUpdatableSerializationBytes ( dstImpl . getLgConfigK ( ) , HLL_8 ) ; gadgetWmem . clear ( 0 , bytes ) ; final byte [ ] dstByteArr = dstImpl . toUpdatableByteArray ( ) ; gadgetWmem . putByteArray ( 0 , dstByteArr , 0 , dstByteArr . length ) ; dstImpl = HllSketch . writableWrap ( gadgetWmem ) . hllSketchImpl ; } return dstImpl ; |
public class JSONObject { /** * Method to write aa standard attribute / subtag containing object
* @ param writer The writer object to render the XML to .
* @ param indentDepth How far to indent .
* @ param contentOnly Whether or not to write the object name as part of the output
* @ param compact Flag to denote whether or not to write the object in compact form .
* @ throws IOException Trhown if an error occurs on write . */
private void writeComplexObject ( Writer writer , int indentDepth , boolean contentOnly , boolean compact ) throws IOException { } } | if ( logger . isLoggable ( Level . FINER ) ) logger . entering ( className , "writeComplexObject(Writer, int, boolean, boolean)" ) ; boolean wroteTagText = false ; if ( ! contentOnly ) { if ( logger . isLoggable ( Level . FINEST ) ) logger . logp ( Level . FINEST , className , "writeComplexObject(Writer, int, boolean, boolean)" , "Writing object: [" + this . objectName + "]" ) ; if ( ! compact ) { writeIndention ( writer , indentDepth ) ; } writer . write ( "\"" + this . objectName + "\"" ) ; if ( ! compact ) { writer . write ( " : {\n" ) ; } else { writer . write ( ":{" ) ; } } else { if ( logger . isLoggable ( Level . FINEST ) ) logger . logp ( Level . FINEST , className , "writeObject(Writer, int, boolean, boolean)" , "Writing object contents as an anonymous object (usually an array entry)" ) ; if ( ! compact ) { writeIndention ( writer , indentDepth ) ; writer . write ( "{\n" ) ; } else { writer . write ( "{" ) ; } } if ( this . tagText != null && ! this . tagText . equals ( "" ) && ! this . tagText . trim ( ) . equals ( "" ) ) { writeAttribute ( writer , "content" , this . tagText . trim ( ) , indentDepth + 1 , compact ) ; wroteTagText = true ; } if ( this . attrs != null && ! this . attrs . isEmpty ( ) && wroteTagText ) { if ( ! compact ) { writer . write ( ",\n" ) ; } else { writer . write ( "," ) ; } } writeAttributes ( writer , this . attrs , indentDepth , compact ) ; if ( ! this . jsonObjects . isEmpty ( ) ) { if ( this . attrs != null && ( ! this . attrs . isEmpty ( ) || wroteTagText ) ) { if ( ! compact ) { writer . write ( ",\n" ) ; } else { writer . write ( "," ) ; } } else { if ( ! compact ) { writer . write ( "\n" ) ; } } writeChildren ( writer , indentDepth , compact ) ; } else { if ( ! compact ) { writer . write ( "\n" ) ; } } if ( ! compact ) { writeIndention ( writer , indentDepth ) ; writer . write ( "}\n" ) ; // writer . write ( " \ n " ) ;
} else { writer . write ( "}" ) ; } if ( logger . isLoggable ( Level . FINER ) ) logger . exiting ( className , "writeComplexObject(Writer, int, boolean, boolean)" ) ; |
public class Vectors { /** * Returns an immutable view of the given { @ code DoubleVector } .
* @ param vector The { @ code DoubleVector } to decorate as immutable .
* @ return An immutable version of { @ code vector } . */
public static DoubleVector immutable ( DoubleVector vector ) { } } | if ( vector == null ) throw new NullPointerException ( "Cannot create an immutable " + "null vector" ) ; return new DoubleVectorView ( vector , true ) ; |
public class XmlDataHandler { /** * Logs an issue while parsing XML .
* @ param prefix
* log level as string to add at the beginning of the message
* @ param e
* exception to log */
protected static void logParsingIssue ( final String prefix , final SAXParseException e ) { } } | final StringBuilder buffer = new StringBuilder ( ) ; buffer . append ( prefix ) ; buffer . append ( " while reading UAS data: " ) ; buffer . append ( e . getMessage ( ) ) ; buffer . append ( " (line: " ) ; buffer . append ( e . getLineNumber ( ) ) ; if ( e . getSystemId ( ) != null ) { buffer . append ( " uri: " ) ; buffer . append ( e . getSystemId ( ) ) ; } buffer . append ( ")" ) ; LOG . warn ( buffer . toString ( ) ) ; |
public class Files { /** * Convenience for
* { @ link # readObjectFromFile ( String file , Class clazz , boolean printException ) }
* where :
* < ul >
* < li > { @ code printException } is false < / li >
* < / ul > */
public static < T > T readObjectFromFile ( String file , Class < T > clazz ) { } } | return readObjectFromFile ( file , clazz , false ) ; |
public class CmsAliasList { /** * Creates an icon button for editing aliases . < p >
* @ param icon the icon css class to use
* @ return the new icon button */
protected PushButton createIconButton ( String icon ) { } } | CmsPushButton button = new CmsPushButton ( ) ; button . setImageClass ( icon ) ; button . setButtonStyle ( ButtonStyle . FONT_ICON , null ) ; return button ; |
public class PopulationFitnessView { /** * If " all data " is selected , set the range of the domain axis to include all
* values . Otherwise set it to show the most recent 200 generations . */
private void updateDomainAxisRange ( ) { } } | int count = dataSet . getSeries ( 0 ) . getItemCount ( ) ; if ( count < SHOW_FIXED_GENERATIONS ) { domainAxis . setRangeWithMargins ( 0 , SHOW_FIXED_GENERATIONS ) ; } else if ( allDataButton . isSelected ( ) ) { domainAxis . setRangeWithMargins ( 0 , Math . max ( SHOW_FIXED_GENERATIONS , count ) ) ; } else { domainAxis . setRangeWithMargins ( count - SHOW_FIXED_GENERATIONS , count ) ; } |
public class CreateVpnGatewayRequest { /** * This method is intended for internal use only . Returns the marshaled request configured with additional
* parameters to enable operation dry - run . */
@ Override public Request < CreateVpnGatewayRequest > getDryRunRequest ( ) { } } | Request < CreateVpnGatewayRequest > request = new CreateVpnGatewayRequestMarshaller ( ) . marshall ( this ) ; request . addParameter ( "DryRun" , Boolean . toString ( true ) ) ; return request ; |
public class IntArrayList { /** * Removes the element at the specified position in this list .
* Shifts any subsequent elements to the left ( subtracts one from their
* indices ) .
* @ param index the index of the element to removed .
* @ return the element that was removed from the list .
* @ throws IndexOutOfBoundsException if index out of range < tt > ( index
* & lt ; 0 | | index & gt ; = size ( ) ) < / tt > . */
@ Override public int removeAtIndex ( int index ) { } } | RangeCheck ( index ) ; modCount ++ ; int oldValue = elementData [ index ] ; int numMoved = size - index - 1 ; if ( numMoved > 0 ) System . arraycopy ( elementData , index + 1 , elementData , index , numMoved ) ; elementData [ -- size ] = 0 ; // Let gc do its work
return oldValue ; |
public class BaseCalendar { /** * Build a < code > { @ link Calendar } < / code > with the current time . The new
* Calendar will use the < code > BaseCalendar < / code > time zone if it is not
* < code > null < / code > . */
protected Calendar createJavaCalendar ( ) { } } | return Calendar . getInstance ( getTimeZone ( ) != null ? getTimeZone ( ) : TimeZone . getDefault ( ) , Locale . getDefault ( Locale . Category . FORMAT ) ) ; |
public class NioGroovyMethods { /** * Create an object input stream for this path using the given class loader .
* @ param self a { @ code Path } object
* @ param classLoader the class loader to use when loading the class
* @ return an object input stream
* @ throws java . io . IOException if an IOException occurs .
* @ since 2.3.0 */
public static ObjectInputStream newObjectInputStream ( Path self , final ClassLoader classLoader ) throws IOException { } } | return IOGroovyMethods . newObjectInputStream ( Files . newInputStream ( self ) , classLoader ) ; |
public class NodeUtil { /** * Return a BLOCK node for the given FUNCTION node . */
public static Node getFunctionBody ( Node fn ) { } } | checkArgument ( fn . isFunction ( ) , fn ) ; return fn . getLastChild ( ) ; |
public class Transliterator { /** * Returns the set of all characters that may be modified in the
* input text by this Transliterator . This incorporates this
* object ' s current filter ; if the filter is changed , the return
* value of this function will change . The default implementation
* returns an empty set . Some subclasses may override { @ link
* # handleGetSourceSet } to return a more precise result . The
* return result is approximate in any case and is intended for
* use by tests , tools , or utilities .
* @ see # getTargetSet
* @ see # handleGetSourceSet */
public final UnicodeSet getSourceSet ( ) { } } | UnicodeSet result = new UnicodeSet ( ) ; addSourceTargetSet ( getFilterAsUnicodeSet ( UnicodeSet . ALL_CODE_POINTS ) , result , new UnicodeSet ( ) ) ; return result ; |
public class FileAuthHandler { /** * Sign is called by the library when the server sends a nonce .
* The client ' s NKey should be used to sign the provided value .
* @ param nonce the nonce to sign
* @ return the signature for the nonce */
public byte [ ] sign ( byte [ ] nonce ) { } } | try { char [ ] keyChars = this . readKeyChars ( ) ; NKey nkey = NKey . fromSeed ( keyChars ) ; byte [ ] sig = nkey . sign ( nonce ) ; nkey . clear ( ) ; return sig ; } catch ( Exception exp ) { throw new IllegalStateException ( "problem signing nonce" , exp ) ; } |
public class RefCountedBufferingFileStream { /** * - - - - - Factory Methods - - - - - */
public static RefCountedBufferingFileStream openNew ( final FunctionWithException < File , RefCountedFile , IOException > tmpFileProvider ) throws IOException { } } | return new RefCountedBufferingFileStream ( tmpFileProvider . apply ( null ) , BUFFER_SIZE ) ; |
public class SparkComputationGraph { /** * Perform ROC analysis / evaluation on the given DataSet in a distributed manner , using the default number of
* threshold steps ( { @ link # DEFAULT _ ROC _ THRESHOLD _ STEPS } ) and the default minibatch size ( { @ link # DEFAULT _ EVAL _ SCORE _ BATCH _ SIZE } )
* @ param data Test set data ( to evaluate on )
* @ return ROC for the entire data set */
public < T extends ROC > T evaluateROC ( JavaRDD < DataSet > data ) { } } | return evaluateROC ( data , DEFAULT_ROC_THRESHOLD_STEPS , DEFAULT_EVAL_SCORE_BATCH_SIZE ) ; |
public class ResourceIOUtils { /** * Parse the SQL statements for the base resource path and sql file name
* @ param path
* base resource path
* @ param name
* sql file name
* @ return list of sql statements */
public static List < String > parseSQLStatements ( String path , String name ) { } } | return parseSQLStatements ( "/" + path + "/" + name ) ; |
public class MBLinkObjectFactory { /** * d702400 */
public static void validateLifeCycleSignature ( String lifeCycle , Method m , boolean beanClass ) throws InjectionConfigurationException { } } | // Get the modifiers for the interceptor method and verify that it
// is neither final nor static as required by EJB specification .
int mod = m . getModifiers ( ) ; if ( Modifier . isFinal ( mod ) || Modifier . isStatic ( mod ) ) { // CNTR0229E : The { 0 } interceptor method must not be declared as final or static .
String method = m . toGenericString ( ) ; Tr . error ( tc , "INVALID_INTERCEPTOR_METHOD_MODIFIER_CNTR0229E" , method ) ; throw new InjectionConfigurationException ( lifeCycle + " interceptor \"" + method + "\" must not be declared as final or static." ) ; } // Verify return type is void .
Class < ? > returnType = m . getReturnType ( ) ; if ( returnType == java . lang . Void . TYPE ) { // Return type is void as required .
} else { // CNTR0231E : The { 0 } method signature is not valid as
// a { 1 } method of an enterprise bean class .
String method = m . toGenericString ( ) ; Tr . error ( tc , "INVALID_LIFECYCLE_SIGNATURE_CNTR0231E" , method , lifeCycle ) ; throw new InjectionConfigurationException ( lifeCycle + " interceptor \"" + method + "\" must have void as return type." ) ; } // Verify method does not have a throws clause since lifecycle methods not allowed
// to throw checked exceptions .
Class < ? > [ ] exceptionTypes = m . getExceptionTypes ( ) ; // d629675 - The spec requires that lifecycle interceptor methods do not
// have a throws clause , but we keep this checking for compatibility with
// previous releases .
if ( exceptionTypes . length != 0 ) { // CNTR0231E : The { 1 } method specifies the { 0 } method signature of the
// lifecycle interceptor , which is not correct for an enterprise bean .
String method = m . toGenericString ( ) ; Tr . error ( tc , "INVALID_LIFECYCLE_SIGNATURE_CNTR0231E" , lifeCycle , method ) ; throw new InjectionConfigurationException ( lifeCycle + " interceptor \"" + method + "\" must not throw application exceptions." ) ; } // Now verify method parameter types .
Class < ? > [ ] parmTypes = m . getParameterTypes ( ) ; if ( beanClass ) { // This is bean class , so interceptor should have no parameters .
if ( parmTypes . length != 0 ) { // CNTR0231E : " { 0 } " interceptor method " { 1 } " signature is incorrect .
String method = m . toGenericString ( ) ; Tr . error ( tc , "INVALID_LIFECYCLE_SIGNATURE_CNTR0231E" , lifeCycle , method ) ; throw new InjectionConfigurationException ( lifeCycle + " interceptor \"" + method + "\" must have zero parameters." ) ; } } else { // This is an interceptor class , so InvocationContext is a required parameter
// for the interceptor method .
if ( ( parmTypes . length == 1 ) ) // & & ( parmTypes [ 0 ] . equals ( InvocationContext . class ) ) )
{ // Has correct signature of 1 parameter of type InvocationContext
} else { // CNTR0232E : The { 0 } method does not have the required
// method signature for a { 1 } method of a interceptor class .
String method = m . toGenericString ( ) ; Tr . error ( tc , "INVALID_LIFECYCLE_SIGNATURE_CNTR0232E" , method , lifeCycle ) ; throw new InjectionConfigurationException ( "CNTR0232E: The \"" + method + "\" method does not have the required method signature for a \"" + lifeCycle + "\" method of a interceptor class." ) ; } } |
public class InstanceHelpers { /** * Gets the exported variables for an instance .
* It includes the component variables , and the variables
* overridden by the instance .
* @ param instance an instance ( not null )
* @ return a non - null map ( key = variable name , value = default variable value - can be null ) . */
public static Map < String , String > findAllExportedVariables ( Instance instance ) { } } | // Find the variables
Map < String , String > result = new HashMap < > ( ) ; if ( instance . getComponent ( ) != null ) result . putAll ( ComponentHelpers . findAllExportedVariables ( instance . getComponent ( ) ) ) ; // Overridden variables may not contain the facet or component prefix .
// To remain as flexible as possible , we will try to resolve them as component or facet variables .
Map < String , Set < String > > localNameToFullNames = new HashMap < > ( ) ; for ( String inheritedVarName : result . keySet ( ) ) { String localName = VariableHelpers . parseVariableName ( inheritedVarName ) . getValue ( ) ; Set < String > fullNames = localNameToFullNames . get ( localName ) ; if ( fullNames == null ) fullNames = new HashSet < > ( ) ; fullNames . add ( inheritedVarName ) ; localNameToFullNames . put ( localName , fullNames ) ; } for ( Map . Entry < String , String > entry : instance . overriddenExports . entrySet ( ) ) { Set < String > fullNames = localNameToFullNames . get ( entry . getKey ( ) ) ; // No inherited variable = > Put it in raw mode .
if ( fullNames == null ) { result . put ( entry . getKey ( ) , entry . getValue ( ) ) ; } // Only one prefix , override the inherited variable
else if ( fullNames . size ( ) == 1 ) { result . put ( fullNames . iterator ( ) . next ( ) , entry . getValue ( ) ) ; } // Too many inherited ones ? = > Put it in raw mode AND override all .
// There will be a warning in the validation . See # 420
else { result . put ( entry . getKey ( ) , entry . getValue ( ) ) ; for ( String name : fullNames ) result . put ( name , entry . getValue ( ) ) ; } } // Update some values
String ip = findRootInstance ( instance ) . data . get ( Instance . IP_ADDRESS ) ; if ( ip != null ) VariableHelpers . updateNetworkVariables ( result , ip ) ; // Replace Roboconf meta - variables
Map < String , String > updatedResult = new LinkedHashMap < > ( result . size ( ) ) ; for ( Map . Entry < String , String > entry : result . entrySet ( ) ) { String value = entry . getValue ( ) ; if ( value != null ) { for ( Map . Entry < String , String > rbcfMetaVar : DockerAndScriptUtils . buildReferenceMap ( instance ) . entrySet ( ) ) { value = value . replace ( "$(" + rbcfMetaVar . getKey ( ) + ")" , rbcfMetaVar . getValue ( ) ) ; } } updatedResult . put ( entry . getKey ( ) , value ) ; } return updatedResult ; |
public class ObjectSchemeInitializer { /** * Register model scheme . If model class extends other classes , superclasses will be processed first
* ( bottom to top ) . On each class from hierarchy extensions are searched and applied . Processed classes are
* cashed to avoid multiple processing of the same base model class .
* @ param model model class */
public void register ( final Class < ? > model ) { } } | final ODatabaseObject db = dbProvider . get ( ) ; // auto create schema for new classes
( ( OObjectDatabaseTx ) db ) . setAutomaticSchemaGeneration ( true ) ; // processing lower hierarchy types first
try { for ( Class < ? > type : Lists . reverse ( SchemeUtils . resolveHierarchy ( model ) ) ) { processType ( db , type ) ; } } catch ( Throwable th ) { throw new SchemeInitializationException ( "Failed to register model class " + model . getName ( ) , th ) ; } |
public class HostProfileManager { /** * SDK5.0 signature */
public Task applyHostConfig_Task ( HostSystem host , HostConfigSpec configSpec , ProfileDeferredPolicyOptionParameter [ ] userInputs ) throws HostConfigFailed , InvalidState , RuntimeFault , RemoteException { } } | ManagedObjectReference taskMor = getVimService ( ) . applyHostConfig_Task ( getMOR ( ) , host . getMOR ( ) , configSpec , userInputs ) ; return new Task ( getServerConnection ( ) , taskMor ) ; |
public class CountingErrorConsumer { /** * Initializes the map of data transformation errors for each column that is not related to response variable ,
* excluding response column . The map is initialized as unmodifiable and thread - safe .
* @ param model { @ link GenModel } the data trasnformation errors count map is initialized for */
private void initializeDataTransformationErrorsCount ( GenModel model ) { } } | String responseColumnName = model . isSupervised ( ) ? model . getResponseName ( ) : null ; dataTransformationErrorsCountPerColumn = new ConcurrentHashMap < > ( ) ; for ( String column : model . getNames ( ) ) { // Do not perform check for response column if the model is unsupervised
if ( ! model . isSupervised ( ) || ! column . equals ( responseColumnName ) ) { dataTransformationErrorsCountPerColumn . put ( column , new AtomicLong ( ) ) ; } } dataTransformationErrorsCountPerColumn = Collections . unmodifiableMap ( dataTransformationErrorsCountPerColumn ) ; |
public class UIContextDelegate { /** * { @ inheritDoc } */
@ Override public void setModel ( final WebComponent component , final WebModel model ) { } } | backing . setModel ( component , model ) ; |
public class XMLLibImpl { /** * If value represents Uint32 index , make it available through
* ScriptRuntime . lastUint32Result ( cx ) and return null .
* Otherwise return the same value as toXMLName ( cx , value ) . */
XMLName toXMLNameOrIndex ( Context cx , Object value ) { } } | XMLName result ; if ( value instanceof XMLName ) { result = ( XMLName ) value ; } else if ( value instanceof String ) { String str = ( String ) value ; long test = ScriptRuntime . testUint32String ( str ) ; if ( test >= 0 ) { ScriptRuntime . storeUint32Result ( cx , test ) ; result = null ; } else { result = toXMLNameFromString ( cx , str ) ; } } else if ( value instanceof Number ) { double d = ( ( Number ) value ) . doubleValue ( ) ; long l = ( long ) d ; if ( l == d && 0 <= l && l <= 0xFFFFFFFFL ) { ScriptRuntime . storeUint32Result ( cx , l ) ; result = null ; } else { throw badXMLName ( value ) ; } } else if ( value instanceof QName ) { QName qname = ( QName ) value ; String uri = qname . uri ( ) ; boolean number = false ; result = null ; if ( uri != null && uri . length ( ) == 0 ) { // Only in this case qname . toString ( ) can resemble uint32
long test = ScriptRuntime . testUint32String ( uri ) ; if ( test >= 0 ) { ScriptRuntime . storeUint32Result ( cx , test ) ; number = true ; } } if ( ! number ) { result = XMLName . formProperty ( uri , qname . localName ( ) ) ; } } else if ( value instanceof Boolean || value == Undefined . instance || value == null ) { throw badXMLName ( value ) ; } else { String str = ScriptRuntime . toString ( value ) ; long test = ScriptRuntime . testUint32String ( str ) ; if ( test >= 0 ) { ScriptRuntime . storeUint32Result ( cx , test ) ; result = null ; } else { result = toXMLNameFromString ( cx , str ) ; } } return result ; |
public class FileLoadAction { /** * 多线程处理文件加载 , 使用 fast - fail 策略 */
private void moveFiles ( FileLoadContext context , List < FileData > fileDatas , File rootDir ) { } } | Exception exception = null ; adjustPoolSize ( context ) ; ExecutorCompletionService < Exception > executorComplition = new ExecutorCompletionService < Exception > ( executor ) ; List < Future < Exception > > results = new ArrayList < Future < Exception > > ( ) ; for ( FileData fileData : fileDatas ) { Future < Exception > future = executorComplition . submit ( new FileLoadWorker ( context , rootDir , fileData ) ) ; results . add ( future ) ; // fast fail
if ( future . isDone ( ) ) { // 如果是自己执行的任务 ( 线程池采用 CallerRunsPolicy ) , 则立刻进行检查
try { exception = future . get ( ) ; } catch ( Exception e ) { exception = e ; } if ( exception != null ) { for ( Future < Exception > result : results ) { if ( ! result . isDone ( ) && ! result . isCancelled ( ) ) { result . cancel ( true ) ; } } throw exception instanceof LoadException ? ( LoadException ) exception : new LoadException ( exception ) ; } } } int resultSize = results . size ( ) ; int cursor = 0 ; while ( cursor < resultSize ) { try { Future < Exception > result = executorComplition . take ( ) ; exception = result . get ( ) ; } catch ( Exception e ) { exception = e ; break ; } cursor ++ ; } if ( cursor != resultSize ) { // 发现任务出错 , 立刻把正在进行的任务取消
for ( Future < Exception > future : results ) { if ( ! future . isDone ( ) && ! future . isCancelled ( ) ) { future . cancel ( true ) ; } } } if ( exception != null ) { throw exception instanceof LoadException ? ( LoadException ) exception : new LoadException ( exception ) ; } |
public class BooleanObjectArrayStringConverterFactory { /** * Finds a converter by type .
* @ param cls the type to lookup , not null
* @ return the converter , null if not found
* @ throws RuntimeException ( or subclass ) if source code is invalid */
@ Override public StringConverter < ? > findConverter ( Class < ? > cls ) { } } | if ( cls == Boolean [ ] . class ) { return BooleanArrayStringConverter . INSTANCE ; } return null ; |
public class EntryStream { /** * Returns a { @ link NavigableMap } containing the elements of this stream .
* There are no guarantees on the type or serializability of the
* { @ code NavigableMap } returned ; if more control over the returned
* { @ code Map } is required , use
* { @ link # toCustomMap ( BinaryOperator , Supplier ) } .
* If the mapped keys contains duplicates ( according to
* { @ link Object # equals ( Object ) } ) , the value mapping function is applied to
* each equal element , and the results are merged using the provided merging
* function .
* This is a < a href = " package - summary . html # StreamOps " > terminal < / a >
* operation .
* Returned { @ code NavigableMap } is guaranteed to be modifiable .
* @ param mergeFunction a merge function , used to resolve collisions between
* values associated with the same key , as supplied to
* { @ link Map # merge ( Object , Object , BiFunction ) }
* @ return a { @ code NavigableMap } containing the elements of this stream
* @ see Collectors # toMap ( Function , Function )
* @ since 0.6.5 */
public NavigableMap < K , V > toNavigableMap ( BinaryOperator < V > mergeFunction ) { } } | return collect ( Collectors . toMap ( Entry :: getKey , Entry :: getValue , mergeFunction , TreeMap :: new ) ) ; |
public class GrapesClient { /** * Promote a module in the Grapes server
* @ param name
* @ param version
* @ throws GrapesCommunicationException
* @ throws javax . naming . AuthenticationException */
public void promoteModule ( final String name , final String version , final String user , final String password ) throws GrapesCommunicationException , AuthenticationException { } } | final Client client = getClient ( user , password ) ; final WebResource resource = client . resource ( serverURL ) . path ( RequestUtils . promoteModulePath ( name , version ) ) ; final ClientResponse response = resource . type ( MediaType . APPLICATION_JSON ) . post ( ClientResponse . class ) ; client . destroy ( ) ; if ( ClientResponse . Status . OK . getStatusCode ( ) != response . getStatus ( ) ) { final String message = String . format ( FAILED_TO_GET_MODULE , "promote module" , name , version ) ; if ( LOG . isErrorEnabled ( ) ) { LOG . error ( String . format ( HTTP_STATUS_TEMPLATE_MSG , message , response . getStatus ( ) ) ) ; } throw new GrapesCommunicationException ( message , response . getStatus ( ) ) ; } |
public class MainActivity { /** * Creates and returns a listener , which allows to show a default { @ link PreferenceActivity } .
* @ return The listener , which has been created as an instance of the type { @ link
* OnClickListener } */
private OnClickListener createPreferenceButtonListener ( ) { } } | return new OnClickListener ( ) { @ Override public void onClick ( final View v ) { Intent intent = new Intent ( MainActivity . this , SettingsActivity . class ) ; startActivity ( intent ) ; } } ; |
public class AWSOrganizationsClient { /** * Lists the policies that are directly attached to the specified target root , organizational unit ( OU ) , or account .
* You must specify the policy type that you want included in the returned list .
* < note >
* Always check the < code > NextToken < / code > response parameter for a < code > null < / code > value when calling a
* < code > List * < / code > operation . These operations can occasionally return an empty set of results even when there
* are more results available . The < code > NextToken < / code > response parameter value is < code > null < / code > < i > only < / i >
* when there are no more results to display .
* < / note >
* This operation can be called only from the organization ' s master account .
* @ param listPoliciesForTargetRequest
* @ return Result of the ListPoliciesForTarget operation returned by the service .
* @ throws AccessDeniedException
* You don ' t have permissions to perform the requested operation . The user or role that is making the
* request must have at least one IAM permissions policy attached that grants the required permissions . For
* more information , see < a href = " https : / / docs . aws . amazon . com / IAM / latest / UserGuide / access . html " > Access
* Management < / a > in the < i > IAM User Guide < / i > .
* @ throws AWSOrganizationsNotInUseException
* Your account isn ' t a member of an organization . To make this request , you must use the credentials of an
* account that belongs to an organization .
* @ throws InvalidInputException
* The requested operation failed because you provided invalid values for one or more of the request
* parameters . This exception includes a reason that contains additional information about the violated
* limit : < / p > < note >
* Some of the reasons in the following list might not be applicable to this specific API or operation :
* < / note >
* < ul >
* < li >
* IMMUTABLE _ POLICY : You specified a policy that is managed by AWS and can ' t be modified .
* < / li >
* < li >
* INPUT _ REQUIRED : You must include a value for all required parameters .
* < / li >
* < li >
* INVALID _ ENUM : You specified a value that isn ' t valid for that parameter .
* < / li >
* < li >
* INVALID _ FULL _ NAME _ TARGET : You specified a full name that contains invalid characters .
* < / li >
* < li >
* INVALID _ LIST _ MEMBER : You provided a list to a parameter that contains at least one invalid value .
* < / li >
* < li >
* INVALID _ PARTY _ TYPE _ TARGET : You specified the wrong type of entity ( account , organization , or email ) as a
* party .
* < / li >
* < li >
* INVALID _ PAGINATION _ TOKEN : Get the value for the < code > NextToken < / code > parameter from the response to a
* previous call of the operation .
* < / li >
* < li >
* INVALID _ PATTERN : You provided a value that doesn ' t match the required pattern .
* < / li >
* < li >
* INVALID _ PATTERN _ TARGET _ ID : You specified a policy target ID that doesn ' t match the required pattern .
* < / li >
* < li >
* INVALID _ ROLE _ NAME : You provided a role name that isn ' t valid . A role name can ' t begin with the reserved
* prefix < code > AWSServiceRoleFor < / code > .
* < / li >
* < li >
* INVALID _ SYNTAX _ ORGANIZATION _ ARN : You specified an invalid Amazon Resource Name ( ARN ) for the
* organization .
* < / li >
* < li >
* INVALID _ SYNTAX _ POLICY _ ID : You specified an invalid policy ID .
* < / li >
* < li >
* MAX _ FILTER _ LIMIT _ EXCEEDED : You can specify only one filter parameter for the operation .
* < / li >
* < li >
* MAX _ LENGTH _ EXCEEDED : You provided a string parameter that is longer than allowed .
* < / li >
* < li >
* MAX _ VALUE _ EXCEEDED : You provided a numeric parameter that has a larger value than allowed .
* < / li >
* < li >
* MIN _ LENGTH _ EXCEEDED : You provided a string parameter that is shorter than allowed .
* < / li >
* < li >
* MIN _ VALUE _ EXCEEDED : You provided a numeric parameter that has a smaller value than allowed .
* < / li >
* < li >
* MOVING _ ACCOUNT _ BETWEEN _ DIFFERENT _ ROOTS : You can move an account only between entities in the same root .
* < / li >
* @ throws ServiceException
* AWS Organizations can ' t complete your request because of an internal service error . Try again later .
* @ throws TargetNotFoundException
* We can ' t find a root , OU , or account with the < code > TargetId < / code > that you specified .
* @ throws TooManyRequestsException
* You ' ve sent too many requests in too short a period of time . The limit helps protect against
* denial - of - service attacks . Try again later . < / p >
* For information on limits that affect Organizations , see < a
* href = " https : / / docs . aws . amazon . com / organizations / latest / userguide / orgs _ reference _ limits . html " > Limits of
* AWS Organizations < / a > in the < i > AWS Organizations User Guide < / i > .
* @ sample AWSOrganizations . ListPoliciesForTarget
* @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / organizations - 2016-11-28 / ListPoliciesForTarget "
* target = " _ top " > AWS API Documentation < / a > */
@ Override public ListPoliciesForTargetResult listPoliciesForTarget ( ListPoliciesForTargetRequest request ) { } } | request = beforeClientExecution ( request ) ; return executeListPoliciesForTarget ( request ) ; |
public class FileExecutor { /** * 读取文件
* @ param file 文件
* @ return { @ link String }
* @ throws IOException 异常 */
public static String readFile ( File file ) throws IOException { } } | StringBuilder content = new StringBuilder ( ) ; String line ; try ( BufferedReader reader = new BufferedReader ( new FileReader ( file ) ) ) { while ( ( line = reader . readLine ( ) ) != null ) { content . append ( line ) . append ( "\r\n" ) ; } } return content . toString ( ) ; |
public class MapHelper { /** * Stores list of values in map .
* @ param values comma separated list of values .
* @ param name name to use this list for .
* @ param map map to store values in . */
public void setValuesForIn ( String values , String name , Map < String , Object > map ) { } } | String cleanName = htmlCleaner . cleanupValue ( name ) ; String [ ] valueArrays = values . split ( "\\s*,\\s*" ) ; List < Object > valueObjects = new ArrayList < Object > ( valueArrays . length ) ; for ( int i = 0 ; i < valueArrays . length ; i ++ ) { Object cleanValue = getCleanValue ( valueArrays [ i ] ) ; valueObjects . add ( cleanValue ) ; } setValueForIn ( valueObjects , cleanName , map ) ; |
public class AbstractCommand { /** * Used for asynchronous execution of command with a callback by subscribing to the { @ link Observable } .
* This eagerly starts execution of the command the same as { @ link HystrixCommand # queue ( ) } and { @ link HystrixCommand # execute ( ) } .
* A lazy { @ link Observable } can be obtained from { @ link # toObservable ( ) } .
* See https : / / github . com / Netflix / RxJava / wiki for more information .
* @ return { @ code Observable < R > } that executes and calls back with the result of command execution or a fallback if the command fails for any reason .
* @ throws HystrixRuntimeException
* if a fallback does not exist
* < ul >
* < li > via { @ code Observer # onError } if a failure occurs < / li >
* < li > or immediately if the command can not be queued ( such as short - circuited , thread - pool / semaphore rejected ) < / li >
* < / ul >
* @ throws HystrixBadRequestException
* via { @ code Observer # onError } if invalid arguments or state were used representing a user failure , not a system failure
* @ throws IllegalStateException
* if invoked more than once */
public Observable < R > observe ( ) { } } | // us a ReplaySubject to buffer the eagerly subscribed - to Observable
ReplaySubject < R > subject = ReplaySubject . create ( ) ; // eagerly kick off subscription
final Subscription sourceSubscription = toObservable ( ) . subscribe ( subject ) ; // return the subject that can be subscribed to later while the execution has already started
return subject . doOnUnsubscribe ( new Action0 ( ) { @ Override public void call ( ) { sourceSubscription . unsubscribe ( ) ; } } ) ; |
public class SizeConfig { /** * Import the size data from configurer .
* @ param root The root reference ( must not be < code > null < / code > ) .
* @ return The size data .
* @ throws LionEngineException If unable to read node . */
public static SizeConfig imports ( Xml root ) { } } | Check . notNull ( root ) ; final Xml node = root . getChild ( NODE_SIZE ) ; final int width = node . readInteger ( ATT_WIDTH ) ; final int height = node . readInteger ( ATT_HEIGHT ) ; return new SizeConfig ( width , height ) ; |
public class ServerConfiguration { /** * Find related detection systems based on a given detection system .
* This simply means those systems that have been configured along with the
* specified system id as part of a correlation set .
* @ param detectionSystemId system ID to evaluate and find correlated systems
* @ return collection of strings representing correlation set , INCLUDING specified system ID */
public Collection < String > getRelatedDetectionSystems ( DetectionSystem detectionSystem ) { } } | Collection < String > relatedDetectionSystems = new HashSet < String > ( ) ; relatedDetectionSystems . add ( detectionSystem . getDetectionSystemId ( ) ) ; if ( correlationSets != null ) { for ( CorrelationSet correlationSet : correlationSets ) { if ( correlationSet . getClientApplications ( ) != null ) { if ( correlationSet . getClientApplications ( ) . contains ( detectionSystem . getDetectionSystemId ( ) ) ) { relatedDetectionSystems . addAll ( correlationSet . getClientApplications ( ) ) ; } } } } return relatedDetectionSystems ; |
public class LocalDate { /** * Converts this object to a DateTime using a LocalTime to fill in the
* missing fields .
* The resulting chronology is determined by the chronology of this
* LocalDate plus the time zone . The chronology of the time must match .
* If the time is null , this method delegates to { @ link # toDateTimeAtCurrentTime ( DateTimeZone ) }
* and the following documentation does not apply .
* When the time zone is applied , the local date - time may be affected by daylight saving .
* In a daylight saving gap , when the local time does not exist ,
* this method will throw an exception .
* In a daylight saving overlap , when the same local time occurs twice ,
* this method returns the first occurrence of the local time .
* This instance is immutable and unaffected by this method call .
* @ param time the time of day to use , null uses current time
* @ param zone the zone to get the DateTime in , null means default
* @ return the DateTime instance
* @ throws IllegalArgumentException if the chronology of the time does not match
* @ throws IllegalInstantException if the local time does not exist when the time zone is applied */
public DateTime toDateTime ( LocalTime time , DateTimeZone zone ) { } } | if ( time == null ) { return toDateTimeAtCurrentTime ( zone ) ; } if ( getChronology ( ) != time . getChronology ( ) ) { throw new IllegalArgumentException ( "The chronology of the time does not match" ) ; } Chronology chrono = getChronology ( ) . withZone ( zone ) ; return new DateTime ( getYear ( ) , getMonthOfYear ( ) , getDayOfMonth ( ) , time . getHourOfDay ( ) , time . getMinuteOfHour ( ) , time . getSecondOfMinute ( ) , time . getMillisOfSecond ( ) , chrono ) ; |
public class AccessHelper { /** * creates a new nameless non - daemon Timer
* @ return new Timer instance or < code > null < / code > on access violation . */
static Timer createTimer ( ) { } } | try { return getInstance ( ) . doPrivileged ( new PrivilegedAction < Timer > ( ) { @ Override public Timer run ( ) { return new Timer ( true ) ; // 691649
} } ) ; } catch ( SecurityException se ) { // TODO : Add logging here but be careful since this code is used in logging logic itself
// and may result in an indefinite loop .
return null ; } |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.