signature
stringlengths
43
39.1k
implementation
stringlengths
0
450k
public class NetUtils { /** * Find a non - occupied port . * @ return A non - occupied port . */ public static int getAvailablePort ( ) { } }
for ( int i = 0 ; i < 50 ; i ++ ) { try ( ServerSocket serverSocket = new ServerSocket ( 0 ) ) { int port = serverSocket . getLocalPort ( ) ; if ( port != 0 ) { return port ; } } catch ( IOException ignored ) { } } throw new RuntimeException ( "Could not find a free permitted port on the machine." ) ;
public class UpdateApplicationBase { /** * Check if something should run based on admin / paused / internal status */ static protected boolean allowPausedModeWork ( boolean internalCall , boolean adminConnection ) { } }
return ( VoltDB . instance ( ) . getMode ( ) != OperationMode . PAUSED || internalCall || adminConnection ) ;
public class StorageUtil { /** * create xml file from a resource definition * @ param res * @ param resourcePath * @ throws IOException */ public void loadFile ( Resource res , String resourcePath ) throws IOException { } }
res . createFile ( true ) ; InputStream is = InfoImpl . class . getResourceAsStream ( resourcePath ) ; IOUtil . copy ( is , res , true ) ;
public class SourceLineAnnotation { /** * Factory method for creating a source line annotation describing the * source line number for a visited instruction . * @ param classContext * the ClassContext * @ param methodGen * the MethodGen object representing the method * @ param handle * the InstructionHandle containing the visited instruction * @ return the SourceLineAnnotation , or null if we do not have line number * information for the instruction */ @ Nonnull public static SourceLineAnnotation fromVisitedInstruction ( ClassContext classContext , MethodGen methodGen , String sourceFile , @ Nonnull InstructionHandle handle ) { } }
LineNumberTable table = methodGen . getLineNumberTable ( methodGen . getConstantPool ( ) ) ; String className = methodGen . getClassName ( ) ; int bytecodeOffset = handle . getPosition ( ) ; if ( table == null ) { return createUnknown ( className , sourceFile , bytecodeOffset , bytecodeOffset ) ; } int lineNumber = table . getSourceLine ( handle . getPosition ( ) ) ; return new SourceLineAnnotation ( className , sourceFile , lineNumber , lineNumber , bytecodeOffset , bytecodeOffset ) ;
public class AbstractHylaFAXClientConnectionFactory { /** * This function initializes the connection factory . */ @ Override protected void initializeImpl ( ) { } }
// get values this . host = this . factoryConfigurationHolder . getConfigurationValue ( FaxClientSpiConfigurationConstants . HOST_PROPERTY_KEY ) ; if ( this . host == null ) { throw new FaxException ( "Host name not defined in fax4j.properties. Property: " + FaxClientSpiConfigurationConstants . HOST_PROPERTY_KEY ) ; } String valueStr = this . factoryConfigurationHolder . getConfigurationValue ( FaxClientSpiConfigurationConstants . PORT_PROPERTY_KEY ) ; if ( valueStr == null ) { this . port = HylaFaxClientSpi . DEFAULT_PORT_PROPERTY_VALUE ; } else { this . port = Integer . parseInt ( valueStr ) ; } this . userName = this . factoryConfigurationHolder . getConfigurationValue ( FaxClientSpiConfigurationConstants . USER_NAME_PROPERTY_KEY ) ; if ( this . userName == null ) { throw new FaxException ( "User name not defined in fax4j.properties. Property: " + FaxClientSpiConfigurationConstants . USER_NAME_PROPERTY_KEY ) ; } this . password = this . factoryConfigurationHolder . getConfigurationValue ( FaxClientSpiConfigurationConstants . PASSWORD_PROPERTY_KEY ) ; this . enableAdminOperations = Boolean . parseBoolean ( this . factoryConfigurationHolder . getConfigurationValue ( FaxClientSpiConfigurationConstants . ENABLE_ADMIN_OPERATIONS_PROPERTY_KEY ) ) ; valueStr = this . factoryConfigurationHolder . getConfigurationValue ( FaxClientSpiConfigurationConstants . MODE_PROPERTY_KEY ) ; if ( valueStr == null ) { throw new FaxException ( "Mode not defined in fax4j.properties. Property: " + FaxClientSpiConfigurationConstants . MODE_PROPERTY_KEY ) ; } this . mode = valueStr . charAt ( 0 ) ; valueStr = this . factoryConfigurationHolder . getConfigurationValue ( FaxClientSpiConfigurationConstants . TYPE_PROPERTY_KEY ) ; if ( valueStr == null ) { throw new FaxException ( "Type not defined in fax4j.properties. Property: " + FaxClientSpiConfigurationConstants . TYPE_PROPERTY_KEY ) ; } this . type = valueStr . charAt ( 0 ) ;
public class LibGmp { /** * Set rop from an array of word data at op . * The parameters specify the format of the data . count many words are read , each size bytes . * order can be 1 for most significant word first or - 1 for least significant first . Within each * word endian can be 1 for most significant byte first , - 1 for least significant first , or 0 for * the native endianness of the host CPU . The most significant nails bits of each word are * skipped , this can be 0 to use the full words . * There is no sign taken from the data , rop will simply be a positive integer . An application can * handle any sign itself , and apply it for instance with mpz _ neg . * There are no data alignment restrictions on op , any address is allowed . * Here ' s an example converting an array of unsigned long data , most significant element first , * and host byte order within each value . * < pre > { @ code * unsigned long a [ 20 ] ; * / / Initialize z and a * mpzImport ( z , 20 , 1 , sizeof ( a [ 0 ] ) , 0 , 0 , a ) ; * } < / pre > * This example assumes the full sizeof bytes are used for data in the given type , which is * usually true , and certainly true for unsigned long everywhere we know of . However on Cray * vector systems it may be noted that short and int are always stored in 8 bytes ( and with sizeof * indicating that ) but use only 32 or 46 bits . The nails feature can account for this , by passing * for instance 8 * sizeof ( int ) - INT _ BIT . */ public static void __gmpz_import ( mpz_t rop , int count , int order , int size , int endian , int nails , Pointer buffer ) { } }
if ( SIZE_T_CLASS == SizeT4 . class ) { SizeT4 . __gmpz_import ( rop , count , order , size , endian , nails , buffer ) ; } else { SizeT8 . __gmpz_import ( rop , count , order , size , endian , nails , buffer ) ; }
public class DefaultLogger { /** * Get the project name or null * @ param event the event * @ return the project that raised this event * @ since Ant1.7.1 */ protected String extractProjectName ( final BuildEvent event ) { } }
final Project project = event . getProject ( ) ; return ( project != null ) ? project . getName ( ) : null ;
public class ServerTaskExecutor { /** * Execute the operation . * @ param listener the transactional operation listener * @ param client the transactional protocol client * @ param identity the server identity * @ param operation the operation * @ param transformer the operation result transformer * @ return whether the operation was executed */ protected boolean executeOperation ( final TransactionalProtocolClient . TransactionalOperationListener < ServerOperation > listener , TransactionalProtocolClient client , final ServerIdentity identity , final ModelNode operation , final OperationResultTransformer transformer ) { } }
if ( client == null ) { return false ; } final OperationMessageHandler messageHandler = new DelegatingMessageHandler ( context ) ; final OperationAttachments operationAttachments = new DelegatingOperationAttachments ( context ) ; final ServerOperation serverOperation = new ServerOperation ( identity , operation , messageHandler , operationAttachments , transformer ) ; try { DomainControllerLogger . HOST_CONTROLLER_LOGGER . tracef ( "Sending %s to %s" , operation , identity ) ; final Future < OperationResponse > result = client . execute ( listener , serverOperation ) ; recordExecutedRequest ( new ExecutedServerRequest ( identity , result , transformer ) ) ; } catch ( IOException e ) { final TransactionalProtocolClient . PreparedOperation < ServerOperation > result = BlockingQueueOperationListener . FailedOperation . create ( serverOperation , e ) ; listener . operationPrepared ( result ) ; recordExecutedRequest ( new ExecutedServerRequest ( identity , result . getFinalResult ( ) , transformer ) ) ; } return true ;
public class SerializerBase { /** * Report the comment trace event * @ param chars content of comment * @ param start starting index of comment to output * @ param length number of characters to output */ protected void fireCommentEvent ( char [ ] chars , int start , int length ) throws org . xml . sax . SAXException { } }
if ( m_tracer != null ) { flushMyWriter ( ) ; m_tracer . fireGenerateEvent ( SerializerTrace . EVENTTYPE_COMMENT , new String ( chars , start , length ) ) ; }
public class SObject { /** * Construct an sobject with key , content and attributes specified in sequence * key1 , val1 , key2 , val2 , . . . * @ see # of ( String , String , Map ) */ public static SObject of ( String key , String content , String ... attrs ) { } }
SObject sobj = of ( key , content ) ; Map < String , String > map = C . Map ( attrs ) ; sobj . setAttributes ( map ) ; return sobj ;
public class ConstructorTypeImpl { /** * If not already created , a new < code > return - value < / code > element with the given value will be created . * Otherwise , the existing < code > return - value < / code > element will be returned . * @ return a new or existing instance of < code > ReturnValueType < ConstructorType < T > > < / code > */ public ReturnValueType < ConstructorType < T > > getOrCreateReturnValue ( ) { } }
Node node = childNode . getOrCreate ( "return-value" ) ; ReturnValueType < ConstructorType < T > > returnValue = new ReturnValueTypeImpl < ConstructorType < T > > ( this , "return-value" , childNode , node ) ; return returnValue ;
public class AmazonPinpointClient { /** * Returns information about a segment . * @ param getSegmentRequest * @ return Result of the GetSegment operation returned by the service . * @ throws BadRequestException * 400 response * @ throws InternalServerErrorException * 500 response * @ throws ForbiddenException * 403 response * @ throws NotFoundException * 404 response * @ throws MethodNotAllowedException * 405 response * @ throws TooManyRequestsException * 429 response * @ sample AmazonPinpoint . GetSegment * @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / pinpoint - 2016-12-01 / GetSegment " target = " _ top " > AWS API * Documentation < / a > */ @ Override public GetSegmentResult getSegment ( GetSegmentRequest request ) { } }
request = beforeClientExecution ( request ) ; return executeGetSegment ( request ) ;
public class AbstractController { /** * Link the creation of a wave to an event triggered on a node . * This method doesn ' t use any callback function to trigger the launch the wave . * @ param node the node to follow * @ param eventType the type of the event to follow * @ param waveType the type of the wave to create * @ param waveData additional Wave data * @ param < E > The type of JavaFX Event to track */ protected < E extends Event > void linkWave ( final Node node , final javafx . event . EventType < E > eventType , final WaveType waveType , final WaveData < ? > ... waveData ) { } }
linkWave ( node , eventType , waveType , null , waveData ) ;
public class ClassLoaderDistribution { /** * { @ inheritDoc } * Note : requested resources will automatically be prefixed with " resources / " . */ @ Override public InputStream get ( String path ) throws IOException { } }
InputStream stream = _cl . getResourceAsStream ( rewritePath ( path ) ) ; if ( stream == null ) { throw new FileNotFoundException ( "Not found in classpath: " + path ) ; } else { return stream ; }
public class PathBuilder { /** * Create a new List typed path * @ param < A > * @ param property property name * @ param type property type * @ return property path */ public < A > ListPath < A , PathBuilder < A > > getList ( String property , Class < A > type ) { } }
return this . < A , PathBuilder < A > > getList ( property , type , PathBuilder . class ) ;
public class StatefulBeanO { /** * StatefulBeanO */ @ Override protected void injectInstance ( ManagedObject < ? > managedObject , Object instance , InjectionTargetContext injectionContext ) throws EJBException { } }
// If present , setSessionContext should be called before performing injection if ( sessionBean != null ) { try { sessionBean . setSessionContext ( this ) ; } catch ( RemoteException rex ) { // RemoteException is only on the signature for backwards compatibility // with EJB 1.0 ; should throw an EJBException instead . throw ExceptionUtil . EJBException ( rex ) ; } } super . injectInstance ( managedObject , instance , injectionContext ) ;
public class Application { /** * Given the servlet path ( the part of the URI after the context path ) this generates the * classname of the logic class that should handle the request . */ protected String generateClass ( String path ) { } }
// remove the trailing file extension int ldidx = path . lastIndexOf ( "." ) ; if ( ldidx != - 1 ) { path = path . substring ( 0 , ldidx ) ; } // convert slashes to dots path = path . replace ( '/' , '.' ) ; // prepend the base logic package and we ' re all set return _logicPkg + path ;
public class AsmDiagramClass { /** * SGS : */ public IAsmListElementsUml < IAsmElementUml < ClassFull < ClassUml > , DRI , SD , PRI > , DRI , SD , IMG , PRI , ClassFull < ClassUml > > getAsmListAsmClassesFull ( ) { } }
return assemblyListClassesUml ;
public class RandomAccessStorageModule { /** * Creating a new file if not existing at the path defined in the config . Note that it is advised to create the file * beforehand . * @ param pConf configuration to be updated * @ return true if creation successful , false if file already exists . * @ throws IOException if anything weird happens */ private static synchronized boolean createStorageVolume ( final File pToCreate , final long pLength ) throws IOException { } }
FileOutputStream outStream = null ; try { // if file exists , remove it after questioning . if ( pToCreate . exists ( ) ) { if ( ! pToCreate . delete ( ) ) { LOGGER . debug ( "Removal of old storage " + pToCreate . toString ( ) + " unsucessful." ) ; return false ; } LOGGER . debug ( "Removal of old storage " + pToCreate . toString ( ) + " sucessful." ) ; } // create file final File parent = pToCreate . getCanonicalFile ( ) . getParentFile ( ) ; if ( ! parent . exists ( ) && ! parent . mkdirs ( ) ) { throw new FileNotFoundException ( "Unable to create directory: " + parent . getAbsolutePath ( ) ) ; } pToCreate . createNewFile ( ) ; outStream = new FileOutputStream ( pToCreate ) ; final FileChannel fcout = outStream . getChannel ( ) ; fcout . position ( pLength ) ; outStream . write ( 26 ) ; // Write EOF ( not normally needed ) fcout . force ( true ) ; LOGGER . debug ( "Creation of storage " + pToCreate . toString ( ) + " sucessful." ) ; return true ; } catch ( IOException e ) { LOGGER . error ( "Exception creating storage volume " + pToCreate . getAbsolutePath ( ) + ": " + e . getMessage ( ) , e ) ; throw e ; } finally { if ( outStream != null ) { try { outStream . close ( ) ; } catch ( IOException e ) { LOGGER . error ( "Exception closing storage volume: " + e . getMessage ( ) , e ) ; } } }
public class Zendesk { /** * https : / / support . zendesk . com / hc / communities / public / posts / 203464106 - Managing - Organization - Memberships - via - the - Zendesk - API */ public List < OrganizationMembership > getOrganizationMembershipByUser ( long user_id ) { } }
return complete ( submit ( req ( "GET" , tmpl ( "/users/{user_id}/organization_memberships.json" ) . set ( "user_id" , user_id ) ) , handleList ( OrganizationMembership . class , "organization_memberships" ) ) ) ;
public class AppearancePreferenceFragment { /** * Creates and returns a listener , which allows to adapt the width of the navigation , when the * value of the corresponding preference has been changed . * @ return The listener , which has been created , as an instance of the type { @ link * OnPreferenceChangeListener } */ private OnPreferenceChangeListener createNavigationWidthChangeListener ( ) { } }
return new OnPreferenceChangeListener ( ) { @ Override public boolean onPreferenceChange ( final Preference preference , final Object newValue ) { int width = Integer . valueOf ( ( String ) newValue ) ; ( ( PreferenceActivity ) getActivity ( ) ) . setNavigationWidth ( dpToPixels ( getActivity ( ) , width ) ) ; return true ; } } ;
public class LicenseWriter { /** * Write the license into the output . * @ param license the license itself * @ param format the desired format of the license , can be { @ link IOFormat # STRING } , * { @ link IOFormat # BASE64 } or { @ link IOFormat # BINARY } * @ throws IOException if the output cannot be written */ public void write ( License license , IOFormat format ) throws IOException { } }
switch ( format ) { case BINARY : os . write ( license . serialized ( ) ) ; return ; case BASE64 : os . write ( Base64 . getEncoder ( ) . encode ( license . serialized ( ) ) ) ; return ; case STRING : os . write ( license . toString ( ) . getBytes ( StandardCharsets . UTF_8 ) ) ; return ; } throw new IllegalArgumentException ( "License format " + format + " is unknown" ) ;
public class GwtBootstrap3EntryPoint { /** * { @ inheritDoc } */ @ Override public void onModuleLoad ( ) { } }
ScriptInjector . fromString ( GwtBootstrap3ClientBundle . INSTANCE . gwtBootstrap3 ( ) . getText ( ) ) . setWindow ( ScriptInjector . TOP_WINDOW ) . inject ( ) ; if ( ! isjQueryLoaded ( ) ) { ScriptInjector . fromString ( GwtBootstrap3ClientBundle . INSTANCE . jQuery ( ) . getText ( ) ) . setWindow ( ScriptInjector . TOP_WINDOW ) . inject ( ) ; } if ( ! isBootstrapLoaded ( ) ) { ScriptInjector . fromString ( GwtBootstrap3ClientBundle . INSTANCE . bootstrap ( ) . getText ( ) ) . setWindow ( ScriptInjector . TOP_WINDOW ) . inject ( ) ; }
public class UdpServer { /** * Setup all lifecycle callbacks called on or after { @ link io . netty . channel . Channel } * has been bound and after it has been unbound . * @ param onBind a consumer observing server start event * @ param onBound a consumer observing server started event * @ param onUnbound a consumer observing server stop event * @ return a new { @ link UdpServer } */ public final UdpServer doOnLifecycle ( Consumer < ? super Bootstrap > onBind , Consumer < ? super Connection > onBound , Consumer < ? super Connection > onUnbound ) { } }
Objects . requireNonNull ( onBind , "onBind" ) ; Objects . requireNonNull ( onBound , "onBound" ) ; Objects . requireNonNull ( onUnbound , "onUnbound" ) ; return new UdpServerDoOn ( this , onBind , onBound , onUnbound ) ;
public class CmsRequestUtil { /** * Converts the given parameter map into an JSON object . < p > * @ param params the parameters map to convert * @ return the JSON representation of the given parameter map */ public static JSONObject getJsonParameterMap ( Map < String , String [ ] > params ) { } }
JSONObject result = new JSONObject ( ) ; for ( Map . Entry < String , String [ ] > entry : params . entrySet ( ) ) { String paramKey = entry . getKey ( ) ; JSONArray paramValue = new JSONArray ( ) ; for ( int i = 0 , l = entry . getValue ( ) . length ; i < l ; i ++ ) { paramValue . put ( entry . getValue ( ) [ i ] ) ; } try { result . putOpt ( paramKey , paramValue ) ; } catch ( JSONException e ) { // should never happen LOG . warn ( e . getLocalizedMessage ( ) , e ) ; } } return result ;
public class ObjectFactory { /** * Create an instance of { @ link JAXBElement } { @ code < } { @ link BigInteger } * { @ code > } */ @ XmlElementDecl ( namespace = "http://docs.oasis-open.org/ns/cmis/messaging/200908/" , name = "skipCount" , scope = GetObjectRelationships . class ) public JAXBElement < BigInteger > createGetObjectRelationshipsSkipCount ( BigInteger value ) { } }
return new JAXBElement < BigInteger > ( _GetTypeChildrenSkipCount_QNAME , BigInteger . class , GetObjectRelationships . class , value ) ;
public class FormatUtil { /** * Formats the array of double arrays d with the specified separators and * fraction digits . * @ param buf Output buffer * @ param d the double array to be formatted * @ param pre Row prefix ( e . g . " [ " ) * @ param pos Row postfix ( e . g . " ] \ n " ) * @ param csep Separator for columns ( e . g . " , " ) * @ param nf the number format to use * @ return Output buffer buf */ public static StringBuilder formatTo ( StringBuilder buf , double [ ] [ ] d , String pre , String pos , String csep , NumberFormat nf ) { } }
if ( d == null ) { return buf . append ( "null" ) ; } if ( d . length == 0 ) { return buf ; } for ( int i = 0 ; i < d . length ; i ++ ) { formatTo ( buf . append ( pre ) , d [ i ] , csep , nf ) . append ( pos ) ; } return buf ;
public class CommandWrapper { /** * Unwrap a wrapped command . * @ param wrapped * @ return */ @ SuppressWarnings ( "unchecked" ) public static < K , V , T > RedisCommand < K , V , T > unwrap ( RedisCommand < K , V , T > wrapped ) { } }
RedisCommand < K , V , T > result = wrapped ; while ( result instanceof DecoratedCommand < ? , ? , ? > ) { result = ( ( DecoratedCommand < K , V , T > ) result ) . getDelegate ( ) ; } return result ;
public class AnnotatedViewDialogController { /** * Creates instance of the managed dialog actor . */ public void prepareDialogInstance ( ) { } }
final LmlParser parser = interfaceService . getParser ( ) ; if ( actionContainer != null ) { parser . getData ( ) . addActionContainer ( getId ( ) , actionContainer ) ; } dialog = ( Window ) parser . createView ( wrappedObject , Gdx . files . internal ( dialogData . value ( ) ) ) . first ( ) ; if ( actionContainer != null ) { parser . getData ( ) . removeActionContainer ( getId ( ) ) ; }
public class UtilIO { /** * Reads an entire file and converts it into a text string */ public static String readAsString ( String path ) { } }
InputStream stream = openStream ( path ) ; if ( stream == null ) { System . err . println ( "Failed to open " + path ) ; return null ; } return readAsString ( stream ) ;
public class CountMessageLabel { /** * TenantAwareEvent Listener to show the message count . * @ param event * ManagementUIEvent which describes the action to execute */ @ EventBusListenerMethod ( scope = EventScope . UI ) public void onEvent ( final ManagementUIEvent event ) { } }
if ( event == ManagementUIEvent . TARGET_TABLE_FILTER || event == ManagementUIEvent . SHOW_COUNT_MESSAGE ) { displayTargetCountStatus ( ) ; }
public class LongStream { /** * Returns a { @ code LongStream } produced by iterative application of a accumulation function * to reduction value and next element of the current stream . * Produces a { @ code LongStream } consisting of { @ code value1 } , { @ code acc ( value1 , value2 ) } , * { @ code acc ( acc ( value1 , value2 ) , value3 ) } , etc . * < p > This is an intermediate operation . * < p > Example : * < pre > * accumulator : ( a , b ) - & gt ; a + b * stream : [ 1 , 2 , 3 , 4 , 5] * result : [ 1 , 3 , 6 , 10 , 15] * < / pre > * @ param accumulator the accumulation function * @ return the new stream * @ throws NullPointerException if { @ code accumulator } is null * @ since 1.1.6 */ @ NotNull public LongStream scan ( @ NotNull final LongBinaryOperator accumulator ) { } }
Objects . requireNonNull ( accumulator ) ; return new LongStream ( params , new LongScan ( iterator , accumulator ) ) ;
public class Ifc4PackageImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ @ Override public EClass getIfcNonNegativeLengthMeasure ( ) { } }
if ( ifcNonNegativeLengthMeasureEClass == null ) { ifcNonNegativeLengthMeasureEClass = ( EClass ) EPackage . Registry . INSTANCE . getEPackage ( Ifc4Package . eNS_URI ) . getEClassifiers ( ) . get ( 898 ) ; } return ifcNonNegativeLengthMeasureEClass ;
public class Tree { /** * Changes this node ' s name . Sample code : < br > * < br > * Tree node = new Tree ( " { \ " a \ " : 3 } " ) ; < br > * node . get ( " a " ) . setName ( " b " ) ; < br > * System . out . println ( node . toJSON ( ) ) ; < br > * < br > * This code above prints " { \ " b \ " : 3 } " . * @ param name * the new name * @ return this node */ public Tree setName ( String name ) { } }
if ( parent == null ) { throw new UnsupportedOperationException ( "Root node has no name!" ) ; } if ( ! parent . isMap ( ) ) { throw new UnsupportedOperationException ( "Unable to set name (this node's parent is not a Map)!" ) ; } parent . remove ( ( String ) key ) ; key = name ; parent . putObjectInternal ( name , value , false ) ; return this ;
public class PoliciesCache { /** * Create a cache from a single file source * @ param singleFile file * @ return cache */ public static PoliciesCache fromFile ( File singleFile , Set < Attribute > forcedContext ) { } }
return fromSourceProvider ( YamlProvider . getFileProvider ( singleFile ) , forcedContext ) ;
public class ContentValues { /** * Gets a value and converts it to a Boolean . * @ param key the value to get * @ return the Boolean value , or false if the value is missing or cannot be converted */ public Boolean getAsBoolean ( String key ) { } }
Object value = mValues . get ( key ) ; try { return ( Boolean ) value ; } catch ( ClassCastException e ) { if ( value instanceof CharSequence ) { return Boolean . valueOf ( value . toString ( ) ) ; } else if ( value instanceof Number ) { return ( ( Number ) value ) . intValue ( ) != 0 ; } else { logger . log ( Level . SEVERE , "Cannot cast value for " + key + " to a Boolean: " + value , e ) ; return false ; } }
public class CmsSitemapView { /** * Reloads the sitemap editor for the currently selected locale when leaving locale compare mode . < p > * @ param editorMode the new editor mode */ private void reloadForLocaleCompareRoot ( final EditorMode editorMode ) { } }
final String localeRootIdStr = CmsJsUtil . getAttributeString ( CmsJsUtil . getWindow ( ) , CmsGwtConstants . VAR_LOCALE_ROOT ) ; CmsRpcAction < String > action = new CmsRpcAction < String > ( ) { @ SuppressWarnings ( "synthetic-access" ) @ Override public void execute ( ) { start ( 0 , false ) ; m_controller . getService ( ) . prepareReloadSitemap ( new CmsUUID ( localeRootIdStr ) , editorMode , this ) ; } @ Override protected void onResponse ( String result ) { stop ( false ) ; if ( result != null ) { Window . Location . assign ( result ) ; } else { Window . Location . reload ( ) ; } } } ; action . execute ( ) ;
public class SignalSlot { /** * Get and clear the slot - MUST be called while holding the lock ! ! * @ return The data or null if no data or error exists * @ throws Throwable If producer encountered an error */ private T getAndClearUnderLock ( ) throws Throwable { } }
if ( error != null ) { throw error ; } else { // Return and clear current T retValue = data ; data = null ; return retValue ; }
public class RulesPlugin { /** * Clear all the fields that were originally flagged as unknown on this object * we should assume the dynamic flag has been removed and we need to reset it . * Also set the current value of each to null , ie we lose any data from the unknown fields for this object . * Because you only do this one object at a time there may be problems if the unknowns use * rules that cross multiple objects . * @ param object */ public void clearUnknowns ( ValidationObject object ) { } }
ObjectMetadata objectMetadata = object . getMetadata ( ) ; ValidationSession session = object . getMetadata ( ) . getProxyObject ( ) . getSession ( ) ; session . setEnabled ( false ) ; Map < String , ProxyField > fieldMap = objectMetadata . getProxyObject ( ) . getFieldMap ( ) ; for ( Map . Entry < String , ProxyField > entry : fieldMap . entrySet ( ) ) { FieldMetadata fieldMetadata = entry . getValue ( ) . getFieldMetadata ( ) ; ProxyFieldImpl proxyField = ( ProxyFieldImpl ) session . getProxyField ( fieldMetadata ) ; if ( proxyField . getPropertyMetadata ( ) . isUnknown ( ) ) // this tests the static unknown flag { // force the value to null and then set the dynamic unknown flag proxyField . reset ( ) ; proxyField . setValue ( null ) ; proxyField . updateValue ( ) ; proxyField . setUnknown ( true ) ; logger . debug ( "Cleared {}" , proxyField . toString ( ) ) ; } } session . setEnabled ( true ) ;
public class ResourceMapper { /** * The age old json . org library in Android doesn ' t support * mapping bean - style objects directly to JSON , so we have * to call this from a more recent version of JSONObject that * we include in our jar . */ public byte [ ] toJsonBytes ( final Object resource ) throws UnsupportedEncodingException { } }
if ( resource instanceof JSONObject ) { final JSONObject json = ( JSONObject ) resource ; return json . toString ( ) . getBytes ( "UTF-8" ) ; } final HashMap < String , Object > out = new HashMap < String , Object > ( ) ; final JSONObject res = beanSerialize ( resource , out ) ; if ( res == null || res . length ( ) == 0 ) { return new JSONObject ( out ) . toString ( ) . getBytes ( "UTF-8" ) ; } else { return res . toString ( ) . getBytes ( "UTF-8" ) ; }
public class BlobStoreUtils { /** * Download missing blobs from potential nimbodes */ public static boolean downloadMissingBlob ( Map conf , BlobStore blobStore , String key , Set < NimbusInfo > nimbusInfos ) throws TTransportException { } }
NimbusClient client ; ReadableBlobMeta rbm ; ClientBlobStore remoteBlobStore ; InputStreamWithMeta in ; boolean isSuccess = false ; LOG . debug ( "Download blob NimbusInfos {}" , nimbusInfos ) ; for ( NimbusInfo nimbusInfo : nimbusInfos ) { if ( isSuccess ) { break ; } try { client = new NimbusClient ( conf , nimbusInfo . getHost ( ) , nimbusInfo . getPort ( ) , null ) ; rbm = client . getClient ( ) . getBlobMeta ( key ) ; remoteBlobStore = new NimbusBlobStore ( ) ; remoteBlobStore . setClient ( conf , client ) ; in = remoteBlobStore . getBlob ( key ) ; blobStore . createBlob ( key , in , rbm . get_settable ( ) ) ; // if key already exists while creating the blob else update it Iterator < String > keyIterator = blobStore . listKeys ( ) ; while ( keyIterator . hasNext ( ) ) { if ( keyIterator . next ( ) . equals ( key ) ) { LOG . debug ( "Success creating key, {}" , key ) ; isSuccess = true ; break ; } } } catch ( IOException exception ) { throw new RuntimeException ( exception ) ; } catch ( KeyAlreadyExistsException kae ) { LOG . info ( "KeyAlreadyExistsException Key: {} {}" , key , kae ) ; } catch ( KeyNotFoundException knf ) { // Catching and logging KeyNotFoundException because , if // there is a subsequent update and delete , the non - leader // nimbodes might throw an exception . LOG . info ( "KeyNotFoundException Key: {} {}" , key , knf ) ; } catch ( Exception exp ) { // Logging an exception while client is connecting LOG . error ( "Exception " , exp ) ; } } if ( ! isSuccess ) { LOG . error ( "Could not download blob with key " + key ) ; } return isSuccess ;
public class ConfigRuleComplianceSummaryFiltersMarshaller { /** * Marshall the given parameter object . */ public void marshall ( ConfigRuleComplianceSummaryFilters configRuleComplianceSummaryFilters , ProtocolMarshaller protocolMarshaller ) { } }
if ( configRuleComplianceSummaryFilters == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( configRuleComplianceSummaryFilters . getAccountId ( ) , ACCOUNTID_BINDING ) ; protocolMarshaller . marshall ( configRuleComplianceSummaryFilters . getAwsRegion ( ) , AWSREGION_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
public class Queue { /** * Gets the next item from the queue , blocking until an item is added * to the queue if the queue is empty at time of invocation . */ public synchronized T get ( ) { } }
while ( _count == 0 ) { try { wait ( ) ; } catch ( InterruptedException e ) { } } // pull the object off , and clear our reference to it T retval = _items [ _start ] ; _items [ _start ] = null ; _start = ( _start + 1 ) % _size ; _count -- ; // if we are only filling 1/8th of the space , shrink by half if ( ( _size > MIN_SHRINK_SIZE ) && ( _size > _suggestedSize ) && ( _count < ( _size >> 3 ) ) ) shrink ( ) ; return retval ;
public class EmailSender { /** * blocking sending emails . * TODO Make this asynchronous in the future . */ public void blockingSend ( ) { } }
Properties prop = new Properties ( ) ; prop . setProperty ( "mail.transport.protocol" , protocol ) ; prop . setProperty ( "mail.smtp.host" , host ) ; prop . setProperty ( "mail.smtp.port" , port ) ; prop . setProperty ( "mail.smtp.auth" , "true" ) ; // 使用smtp身份验证 // 使用SSL , 企业邮箱必需 ! // 开启安全协议 MailSSLSocketFactory sf = null ; try { sf = new MailSSLSocketFactory ( ) ; sf . setTrustAllHosts ( true ) ; } catch ( GeneralSecurityException e1 ) { LOG . error ( e1 ) ; } prop . put ( "mail.smtp.ssl.enable" , "true" ) ; prop . put ( "mail.smtp.ssl.socketFactory" , sf ) ; Session session = Session . getDefaultInstance ( prop , new MyAuthenricator ( account , pass ) ) ; session . setDebug ( true ) ; MimeMessage mimeMessage = new MimeMessage ( session ) ; try { mimeMessage . setFrom ( new InternetAddress ( from , "xian" ) ) ; for ( String to : tos ) { mimeMessage . addRecipient ( Message . RecipientType . TO , new InternetAddress ( to ) ) ; } mimeMessage . setSubject ( subject ) ; mimeMessage . setSentDate ( new Date ( ) ) ; mimeMessage . setText ( content ) ; mimeMessage . saveChanges ( ) ; Transport . send ( mimeMessage ) ; } catch ( MessagingException | UnsupportedEncodingException e ) { LOG . error ( e ) ; throw new RuntimeException ( e ) ; }
public class SocialWebUtils { /** * Invalidates the original request URL cookie or removes the same respective session attributes , depending on how the data * was saved . */ public void removeRequestUrlAndParameters ( HttpServletRequest request , HttpServletResponse response ) { } }
ReferrerURLCookieHandler referrerURLCookieHandler = getCookieHandler ( ) ; referrerURLCookieHandler . invalidateReferrerURLCookie ( request , response , ReferrerURLCookieHandler . REFERRER_URL_COOKIENAME ) ; WebAppSecurityConfig webAppSecConfig = getWebAppSecurityConfig ( ) ; if ( isPostDataSavedInCookie ( webAppSecConfig ) ) { deleteCookie ( request , response , PostParameterHelper . POSTPARAM_COOKIE , webAppSecConfig ) ; } else { removePostParameterSessionAttributes ( request ) ; }
public class RowMapperFactory { /** * Sets the rowmapper for XmlObject . class * @ param rowMapperClass */ public static Class < ? extends RowMapper > setDefaultXmlRowMapping ( Class mapToClass , Class < ? extends RowMapper > rowMapperClass ) { } }
Class < ? extends RowMapper > ret = DEFAULT_XMLOBJ_ROWMAPPING ; DEFAULT_XMLOBJ_ROWMAPPING = rowMapperClass ; XMLOBJ_CLASS = mapToClass ; return ret ;
public class PathConstraint { /** * Uses the encapsulated PAthAccessor to generate satisfying elements . * @ param match current pattern match * @ param ind mapped indices * @ return generated elements */ @ Override public Collection < BioPAXElement > generate ( Match match , int ... ind ) { } }
BioPAXElement ele0 = match . get ( ind [ 0 ] ) ; if ( ele0 == null ) throw new RuntimeException ( "Constraint cannot generate based on null value" ) ; Set vals = pa . getValueFromBean ( ele0 ) ; List < BioPAXElement > list = new ArrayList < BioPAXElement > ( vals . size ( ) ) ; for ( Object o : vals ) { assert o instanceof BioPAXElement ; list . add ( ( BioPAXElement ) o ) ; } return list ;
public class CmsDriverManager { /** * Deletes all log entries matching the given filter . < p > * @ param dbc the current db context * @ param filter the filter to use for deletion * @ throws CmsException if something goes wrong * @ see CmsSecurityManager # deleteLogEntries ( CmsRequestContext , CmsLogFilter ) */ public void deleteLogEntries ( CmsDbContext dbc , CmsLogFilter filter ) throws CmsException { } }
updateLog ( dbc ) ; m_projectDriver . deleteLog ( dbc , filter ) ;
public class Versions { /** * Resolves the asset index . * @ param minecraftDir the minecraft directory * @ param assets the name of the asset index , you can get this via * { @ link Version # getAssets ( ) } * @ return the asset index , null if the asset index does not exist * @ throws IOException if an I / O error has occurred during resolving asset * index * @ throws NullPointerException if * < code > minecraftDir = = null | | assets = = null < / code > */ public static Set < Asset > resolveAssets ( MinecraftDirectory minecraftDir , String assets ) throws IOException { } }
Objects . requireNonNull ( minecraftDir ) ; Objects . requireNonNull ( assets ) ; if ( ! minecraftDir . getAssetIndex ( assets ) . isFile ( ) ) { return null ; } try { return getVersionParser ( ) . parseAssetIndex ( IOUtils . toJson ( minecraftDir . getAssetIndex ( assets ) ) ) ; } catch ( JSONException e ) { throw new IOException ( "Couldn't parse asset index: " + assets , e ) ; }
public class SearchUsersRequestMarshaller { /** * Marshall the given parameter object . */ public void marshall ( SearchUsersRequest searchUsersRequest , ProtocolMarshaller protocolMarshaller ) { } }
if ( searchUsersRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( searchUsersRequest . getNextToken ( ) , NEXTTOKEN_BINDING ) ; protocolMarshaller . marshall ( searchUsersRequest . getMaxResults ( ) , MAXRESULTS_BINDING ) ; protocolMarshaller . marshall ( searchUsersRequest . getFilters ( ) , FILTERS_BINDING ) ; protocolMarshaller . marshall ( searchUsersRequest . getSortCriteria ( ) , SORTCRITERIA_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
public class StorageHandlerImpl { /** * Legacy hashing method to calculate the SHA256 hash of a key . * In some circumstances , this approach produces hashes with incorrect encoding , leading to issues * with loading preferences ( see # 53 ) . * This method is only present for migration reasons , to ensure preferences with the old * hashing format can still be loaded and then saved using the new hashing method * ( { @ link # hash ( String ) } ) . * This method may get removed in a later release , so DON ' T use this method to save settings ! * @ return SHA - 256 representation of breadcrumb */ @ Deprecated private String deprecatedHash ( String key ) { } }
Objects . requireNonNull ( key ) ; MessageDigest messageDigest = null ; try { messageDigest = MessageDigest . getInstance ( "SHA-256" ) ; } catch ( NoSuchAlgorithmException e ) { LOGGER . error ( "Hashing algorithm not found!" ) ; } messageDigest . update ( key . getBytes ( ) ) ; return new String ( messageDigest . digest ( ) ) ;
public class InternalXbaseParser { /** * $ ANTLR start synpred8 _ InternalXbase */ public final void synpred8_InternalXbase_fragment ( ) throws RecognitionException { } }
// InternalXbase . g : 1005:6 : ( ( ' > ' ' > ' ) ) // InternalXbase . g : 1005:7 : ( ' > ' ' > ' ) { // InternalXbase . g : 1005:7 : ( ' > ' ' > ' ) // InternalXbase . g : 1006:7 : ' > ' ' > ' { match ( input , 20 , FOLLOW_16 ) ; if ( state . failed ) return ; match ( input , 20 , FOLLOW_2 ) ; if ( state . failed ) return ; } }
public class BaseRTMPTConnection { /** * Decode data sent by the client . * @ param data * the data to decode * @ return a list of decoded objects */ public List < ? > decode ( IoBuffer data ) { } }
log . debug ( "decode - state: {}" , state ) ; if ( closing || state . getState ( ) == RTMP . STATE_DISCONNECTED ) { // Connection is being closed , don ' t decode any new packets return Collections . EMPTY_LIST ; } readBytes . addAndGet ( data . limit ( ) ) ; buffer . put ( data ) ; buffer . flip ( ) ; return decoder . decodeBuffer ( this , buffer ) ;
public class OrcFile { /** * For full ORC compatibility , field names should be unique when lowercased . */ private void validateNamesUnique ( List < String > names ) { } }
List < String > seenNames = new ArrayList < > ( names . size ( ) ) ; for ( int i = 0 ; i < names . size ( ) ; i ++ ) { String lowerCaseName = names . get ( i ) . toLowerCase ( ) ; int index = seenNames . indexOf ( lowerCaseName ) ; if ( index != - 1 ) { throw new IllegalArgumentException ( "Duplicate field: " + lowerCaseName + " found at positions " + i + "and" + index + ". Field names are case insensitive and must be unique." ) ; } seenNames . add ( lowerCaseName ) ; }
public class UCharacterName { /** * Sets the token data * @ param token array of tokens * @ param tokenstring array of string values of the tokens * @ return false if there is a data error */ boolean setToken ( char token [ ] , byte tokenstring [ ] ) { } }
if ( token != null && tokenstring != null && token . length > 0 && tokenstring . length > 0 ) { m_tokentable_ = token ; m_tokenstring_ = tokenstring ; return true ; } return false ;
public class RouteClient { /** * Get the detail information of route table for specific route table or / and vpc * @ param routeTableId id of route table , routeTableId and vpcId cannot be empty at the same time * @ param vpcId vpcId , routeTableId and vpcId cannot be empty at the same time * @ return A route table detail model for the specific route table or / and vpc */ public GetRouteResponse getRoute ( String routeTableId , String vpcId ) { } }
GetRouteRequest request = new GetRouteRequest ( ) ; if ( Strings . isNullOrEmpty ( vpcId ) && Strings . isNullOrEmpty ( routeTableId ) ) { throw new IllegalArgumentException ( "routeTableId and vpcId should not be empty at the same time" ) ; } else if ( ! Strings . isNullOrEmpty ( routeTableId ) ) { request . withRouteTableId ( routeTableId ) ; } else if ( ! Strings . isNullOrEmpty ( vpcId ) ) { request . withVpcId ( vpcId ) ; } return getRoutes ( request ) ;
public class EditGeometryBaseController { public void onActivate ( MapPresenter mapPresenter ) { } }
super . onActivate ( mapPresenter ) ; idleController . onActivate ( mapPresenter ) ; insertController . setMaxBounds ( mapPresenter . getConfiguration ( ) . getMaxBounds ( ) ) ; dragController . setMaxBounds ( mapPresenter . getConfiguration ( ) . getMaxBounds ( ) ) ;
public class XSLTAttributeDef { /** * StringBuffer containing comma delimited list of valid values for ENUM type . * Used to build error message . */ private StringBuffer getListOfEnums ( ) { } }
StringBuffer enumNamesList = new StringBuffer ( ) ; String [ ] enumValues = this . getEnumNames ( ) ; for ( int i = 0 ; i < enumValues . length ; i ++ ) { if ( i > 0 ) { enumNamesList . append ( ' ' ) ; } enumNamesList . append ( enumValues [ i ] ) ; } return enumNamesList ;
public class TaskAction { /** * Clears the error status . */ @ RequirePOST public synchronized void doClearError ( StaplerRequest req , StaplerResponse rsp ) throws IOException , ServletException { } }
getACL ( ) . checkPermission ( getPermission ( ) ) ; if ( workerThread != null && ! workerThread . isRunning ( ) ) workerThread = null ; rsp . sendRedirect ( "." ) ;
public class FontResolutionImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ @ Override public void eUnset ( int featureID ) { } }
switch ( featureID ) { case AfplibPackage . FONT_RESOLUTION__MET_TECH : setMetTech ( MET_TECH_EDEFAULT ) ; return ; case AfplibPackage . FONT_RESOLUTION__RPU_BASE : setRPuBase ( RPU_BASE_EDEFAULT ) ; return ; case AfplibPackage . FONT_RESOLUTION__RP_UNITS : setRPUnits ( RP_UNITS_EDEFAULT ) ; return ; } super . eUnset ( featureID ) ;
public class AbstractProducerBean { /** * Initializes the type */ protected void initType ( ) { } }
try { this . type = getEnhancedAnnotated ( ) . getJavaClass ( ) ; } catch ( ClassCastException e ) { Type type = Beans . getDeclaredBeanType ( getClass ( ) ) ; throw BeanLogger . LOG . producerCastError ( getEnhancedAnnotated ( ) . getJavaClass ( ) , ( type == null ? " unknown " : type ) , e ) ; }
public class NetworkServiceRecordAgent { /** * Executes a script at runtime for a VNFR of a defined VNFD in a running NSR . * @ param idNsr the ID of the NetworkServiceRecord * @ param idVnfr the ID of the VNFR to be upgraded * @ param script the script to execute * @ throws SDKException if the request fails */ @ Help ( help = "Executes a script at runtime for a VNFR of a defined VNFD in a running NSR with specific id" ) public void executeScript ( final String idNsr , final String idVnfr , String script ) throws SDKException { } }
String url = idNsr + "/vnfrecords" + "/" + idVnfr + "/execute-script" ; requestPost ( url , script ) ;
public class ScheduledDropwizardReporter { @ Override public void report ( ) { } }
// we do not need to lock here , because the dropwizard registry is // internally a concurrent map @ SuppressWarnings ( "rawtypes" ) final SortedMap < String , com . codahale . metrics . Gauge > gauges = registry . getGauges ( ) ; final SortedMap < String , com . codahale . metrics . Counter > counters = registry . getCounters ( ) ; final SortedMap < String , com . codahale . metrics . Histogram > histograms = registry . getHistograms ( ) ; final SortedMap < String , com . codahale . metrics . Meter > meters = registry . getMeters ( ) ; final SortedMap < String , com . codahale . metrics . Timer > timers = registry . getTimers ( ) ; this . reporter . report ( gauges , counters , histograms , meters , timers ) ;
public class EmptyView { /** * Set the Icon by resource identifier * @ param resId the icon resource identifier */ public void setIcon ( @ DrawableRes int resId ) { } }
mIcon . setImageResource ( resId ) ; mIcon . setVisibility ( View . VISIBLE ) ;
public class BoundedInputStreamBuffer { /** * Convenience method for checking if we can get the byte at the specified * index . If we can ' t , then we will try and read the missing bytes off of * the underlying { @ link InputStream } . If that fails , e . g . we don ' t ready * enough bytes off of the stream , then we will eventually throw an * { @ link IndexOutOfBoundsException } * @ param index * the actual index to check . I . e . , this is the actual index in * our byte array , irrespective of what the lowerBoundary is set * to . * @ throws IndexOutOfBoundsException * @ throws IOException */ private void checkIndex ( final long index ) throws IndexOutOfBoundsException { } }
final long missingBytes = index + 1 - this . writerIndex ; if ( missingBytes <= 0 ) { // we got all the bytes needed return ; } try { final int read = readFromStream ( missingBytes ) ; if ( read == - 1 || read < missingBytes ) { throw new IndexOutOfBoundsException ( ) ; } } catch ( final IOException e ) { throw new IndexOutOfBoundsException ( ) ; }
public class EventLog { /** * Closes the session . */ public boolean close ( ) { } }
if ( open . compareAndSet ( true , false ) ) { futures . forEach ( future -> future . completeExceptionally ( new IllegalStateException ( "Closed session" ) ) ) ; return true ; } return false ;
public class Where { /** * This method needs to be used carefully . This will absorb a number of clauses that were registered previously with * calls to { @ link Where # eq ( String , Object ) } or other methods and will string them together with AND ' s . There is no * way to verify the number of previous clauses so the programmer has to count precisely . * < b > NOTE : < / b > There is no guarantee of the order of the clauses that are generated in the final query . * < b > NOTE : < / b > This will throw an exception if numClauses is 0 but will work with 1 or more . */ public Where < T , ID > and ( int numClauses ) { } }
if ( numClauses == 0 ) { throw new IllegalArgumentException ( "Must have at least one clause in and(numClauses)" ) ; } Clause [ ] clauses = new Clause [ numClauses ] ; for ( int i = numClauses - 1 ; i >= 0 ; i -- ) { clauses [ i ] = pop ( "AND" ) ; } addClause ( new ManyClause ( clauses , ManyClause . AND_OPERATION ) ) ; return this ;
public class CryptoPrimitives { /** * Resets curve name , hash algorithm and cert factory . Call this method when a config value changes * @ throws CryptoException * @ throws InvalidArgumentException */ private void resetConfiguration ( ) throws CryptoException , InvalidArgumentException { } }
setSecurityLevel ( securityLevel ) ; setHashAlgorithm ( hashAlgorithm ) ; try { cf = CertificateFactory . getInstance ( CERTIFICATE_FORMAT ) ; } catch ( CertificateException e ) { CryptoException ex = new CryptoException ( "Cannot initialize " + CERTIFICATE_FORMAT + " certificate factory. Error = " + e . getMessage ( ) , e ) ; logger . error ( ex . getMessage ( ) , ex ) ; throw ex ; }
public class MMCImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ @ Override public boolean eIsSet ( int featureID ) { } }
switch ( featureID ) { case AfplibPackage . MMC__MM_CID : return MM_CID_EDEFAULT == null ? mmCid != null : ! MM_CID_EDEFAULT . equals ( mmCid ) ; case AfplibPackage . MMC__PARAMETER1 : return PARAMETER1_EDEFAULT == null ? parameter1 != null : ! PARAMETER1_EDEFAULT . equals ( parameter1 ) ; case AfplibPackage . MMC__RG : return rg != null && ! rg . isEmpty ( ) ; } return super . eIsSet ( featureID ) ;
public class AWSSimpleSystemsManagementClient { /** * Describes a specific delete inventory operation . * @ param describeInventoryDeletionsRequest * @ return Result of the DescribeInventoryDeletions operation returned by the service . * @ throws InternalServerErrorException * An error occurred on the server side . * @ throws InvalidDeletionIdException * The ID specified for the delete operation does not exist or is not valide . Verify the ID and try again . * @ throws InvalidNextTokenException * The specified token is not valid . * @ sample AWSSimpleSystemsManagement . DescribeInventoryDeletions * @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / ssm - 2014-11-06 / DescribeInventoryDeletions " target = " _ top " > AWS * API Documentation < / a > */ @ Override public DescribeInventoryDeletionsResult describeInventoryDeletions ( DescribeInventoryDeletionsRequest request ) { } }
request = beforeClientExecution ( request ) ; return executeDescribeInventoryDeletions ( request ) ;
public class FctBnCnvIbnToColumnValues { /** * < p > Get CnvIbnDoubleToCv ( create and put into map ) . < / p > * @ return requested CnvIbnDoubleToCv * @ throws Exception - an exception */ protected final CnvIbnDoubleToCv createPutCnvIbnDoubleToCv ( ) throws Exception { } }
CnvIbnDoubleToCv convrt = new CnvIbnDoubleToCv ( ) ; this . convertersMap . put ( CnvIbnDoubleToCv . class . getSimpleName ( ) , convrt ) ; return convrt ;
public class JsonWriter { /** * Marshall an enum value . * @ param value The value to marshall . Can be { @ code null } . * @ param enumType The OData enum type . */ private void marshallEnum ( Object value , EnumType enumType ) throws IOException { } }
LOG . trace ( "Enum value: {} of type: {}" , value , enumType ) ; jsonGenerator . writeString ( value . toString ( ) ) ;
public class JulianChronology { /** * Obtains a local date in Julian calendar system from the * era , year - of - era and day - of - year fields . * @ param era the Julian era , not null * @ param yearOfEra the year - of - era * @ param dayOfYear the day - of - year * @ return the Julian local date , not null * @ throws DateTimeException if unable to create the date * @ throws ClassCastException if the { @ code era } is not a { @ code JulianEra } */ @ Override public JulianDate dateYearDay ( Era era , int yearOfEra , int dayOfYear ) { } }
return dateYearDay ( prolepticYear ( era , yearOfEra ) , dayOfYear ) ;
public class AdditionalHeaderSegment { /** * This method checks the integrity of the this Additional Header Segment object to garantee a valid specification . * @ throws InternetSCSIException If the fields are not valid for this AHS type . */ private final void checkIntegrity ( ) throws InternetSCSIException { } }
switch ( type ) { case EXTENDED_CDB : case EXPECTED_BIDIRECTIONAL_READ_DATA_LENGTH : break ; default : throw new InternetSCSIException ( "AHS Package is not valid." ) ; } // this field is AHSType independent specificField . rewind ( ) ; Utils . isReserved ( specificField . get ( ) ) ; switch ( type ) { case EXTENDED_CDB : break ; case EXPECTED_BIDIRECTIONAL_READ_DATA_LENGTH : Utils . isExpected ( specificField . limit ( ) , EXPECTED_BIDIRECTIONAL_SPECIFIC_FIELD_LENGTH ) ; Utils . isExpected ( length , EXPECTED_BIDIRECTIONAL_LENGTH ) ; break ; default : throw new InternetSCSIException ( "Unknown additional header segment type." ) ; } specificField . rewind ( ) ;
public class AppClassLoader { /** * { @ inheritDoc } */ @ Override @ Trivial public Enumeration < URL > getResources ( String name ) throws IOException { } }
/* * The default implementation of getResources never calls getResources on its parent , instead it just calls findResources on all of the loaders parents . We know that our * parent will be a gateway class loader that changes the order that resources are loaded but it does this in getResources ( as that is where the order * should * be changed * according to the JavaDoc ) . Therefore call getResources on our parent and then findResources on ourself . */ // Note we don ' t need to worry about getSystemResources as our parent will do that for us try { final String f_name = name ; final ClassLoader f_parent = parent ; Enumeration < URL > eURL = AccessController . doPrivileged ( new java . security . PrivilegedExceptionAction < Enumeration < URL > > ( ) { @ Override public Enumeration < URL > run ( ) throws Exception { return f_parent . getResources ( f_name ) ; } } ) ; return new CompositeEnumeration < URL > ( eURL ) . add ( this . findResources ( name ) ) ; } catch ( PrivilegedActionException pae ) { return null ; }
public class Neo4JIndexManager { /** * Deletes a { @ link Node } from manually created index if auto - indexing is * disabled * @ param entityMetadata * @ param graphDb * @ param node */ public void deleteNodeIndex ( EntityMetadata entityMetadata , GraphDatabaseService graphDb , Node node ) { } }
if ( ! isNodeAutoIndexingEnabled ( graphDb ) && entityMetadata . isIndexable ( ) ) { Index < Node > nodeIndex = graphDb . index ( ) . forNodes ( entityMetadata . getIndexName ( ) ) ; nodeIndex . remove ( node ) ; }
public class StreamDescription { /** * The shards that comprise the stream . * @ return The shards that comprise the stream . */ public java . util . List < Shard > getShards ( ) { } }
if ( shards == null ) { shards = new com . amazonaws . internal . SdkInternalList < Shard > ( ) ; } return shards ;
public class GenericTemplate { /** * Set Element Button * @ param index the element index * @ param title the element title * @ param type the element type * @ param url the element url * @ param messenger _ extensions the messenger extensions * @ param webview _ height _ ratio the webview height ratio * @ param fallback _ url the fallback url */ public void setElementButton ( Integer index , String title , String type , String url , Boolean messenger_extensions , String webview_height_ratio , String fallback_url ) { } }
if ( this . elements . get ( index ) . containsKey ( "buttons" ) ) { HashMap < String , String > button = new HashMap < String , String > ( ) ; button . put ( "title" , title ) ; button . put ( "type" , type ) ; button . put ( "url" , url ) ; button . put ( "messenger_extensions" , String . valueOf ( messenger_extensions ) ) ; button . put ( "webview_height_ratio" , webview_height_ratio ) ; button . put ( "fallback_url" , fallback_url ) ; @ SuppressWarnings ( "unchecked" ) ArrayList < HashMap < String , String > > element_buttons = ( ArrayList < HashMap < String , String > > ) this . elements . get ( index ) . get ( "buttons" ) ; element_buttons . add ( button ) ; this . elements . get ( index ) . put ( "buttons" , element_buttons ) ; } else { ArrayList < HashMap < String , String > > element_buttons = new ArrayList < HashMap < String , String > > ( ) ; HashMap < String , String > button = new HashMap < String , String > ( ) ; button . put ( "title" , title ) ; button . put ( "type" , type ) ; button . put ( "url" , url ) ; button . put ( "messenger_extensions" , String . valueOf ( messenger_extensions ) ) ; button . put ( "webview_height_ratio" , webview_height_ratio ) ; button . put ( "fallback_url" , fallback_url ) ; element_buttons . add ( button ) ; this . elements . get ( index ) . put ( "buttons" , element_buttons ) ; }
public class StringContext { /** * Replaces the first exact match of the given pattern in the source * string with the provided replacement . * @ param source the source string * @ param pattern the simple string pattern to search for * @ param replacement the string to use for replacing matched patterns * @ return the string with any replacements applied */ public String replaceFirst ( String source , String pattern , String replacement ) { } }
return StringReplacer . replaceFirst ( source , pattern , replacement ) ;
public class MolgenisInterceptor { /** * Make sure Spring does not add the attributes as query parameters to the url when doing a * redirect . You can do this by introducing an object instead of a string key value pair . * < p > See < a * href = " https : / / github . com / molgenis / molgenis / issues / 6515 " > https : / / github . com / molgenis / molgenis / issues / 6515 < / a > * @ return environmentAttributeMap */ private Map < String , String > getEnvironmentAttributes ( ) { } }
Map < String , String > environmentAttributes = new HashMap < > ( ) ; environmentAttributes . put ( ATTRIBUTE_ENVIRONMENT_TYPE , environment ) ; return environmentAttributes ;
public class BundledTileSetRepository { /** * Extracts the tileset bundle from the supplied resource bundle * and registers it . */ protected void addBundle ( HashIntMap < TileSet > idmap , HashMap < String , Integer > namemap , ResourceBundle bundle ) { } }
try { TileSetBundle tsb = BundleUtil . extractBundle ( bundle ) ; // initialize it and add it to the list tsb . init ( bundle ) ; addBundle ( idmap , namemap , tsb ) ; } catch ( Exception e ) { log . warning ( "Unable to load tileset bundle '" + BundleUtil . METADATA_PATH + "' from resource bundle [rbundle=" + bundle + "]." , e ) ; }
public class Requests { /** * < p > headers . < / p > * @ param name a { @ link java . lang . String } object . * @ param values a { @ link java . lang . Iterable } object . * @ return a { @ link org . glassfish . jersey . message . internal . InboundMessageContext } object . */ public static InboundMessageContext headers ( String name , Iterable < ? > values ) { } }
return getRequest ( ) . headers ( name , values ) ;
public class SibRaMessagingEngineConnection { /** * Creates a new listener to the given destination . * @ param destination * the destination to listen to * @ return a listener * @ throws ResourceException * if the creation fails */ SibRaListener createListener ( final SIDestinationAddress destination , MessageEndpointFactory messageEndpointFactory ) throws ResourceException { } }
final String methodName = "createListener" ; if ( TraceComponent . isAnyTracingEnabled ( ) && TRACE . isEntryEnabled ( ) ) { SibTr . entry ( this , TRACE , methodName , new Object [ ] { destination , messageEndpointFactory } ) ; } if ( _closed ) { throw new IllegalStateException ( NLS . getString ( "LISTENER_CLOSED_CWSIV0952" ) ) ; } final SibRaListener listener ; listener = new SibRaSingleProcessListener ( this , destination , messageEndpointFactory ) ; _listeners . put ( destination , listener ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && TRACE . isEntryEnabled ( ) ) { SibTr . exit ( this , TRACE , methodName , listener ) ; } return listener ;
public class DistributedStore { /** * Issue a { @ link KayVeeCommand . GETCommand } . * Returns the value associated with a key . * @ param key key for which to get the value * @ return future that will be triggered when the command is successfully * < strong > committed < / strong > to replicated storage or is < strong > known < / strong > * to have failed . This future < strong > may not < / strong > be triggered . Callers * are advised < strong > not < / strong > to wait indefinitely , and instead , use * timed waits . */ public ListenableFuture < KeyValue > get ( String key ) { } }
checkThatDistributedStoreIsActive ( ) ; KayVeeCommand . GETCommand getCommand = new KayVeeCommand . GETCommand ( getCommandId ( ) , key ) ; return issueCommandToCluster ( getCommand ) ;
public class LocalNetworkGatewaysInner { /** * Creates or updates a local network gateway in the specified resource group . * @ param resourceGroupName The name of the resource group . * @ param localNetworkGatewayName The name of the local network gateway . * @ param parameters Parameters supplied to the create or update local network gateway operation . * @ throws IllegalArgumentException thrown if parameters fail the validation * @ return the observable for the request */ public Observable < LocalNetworkGatewayInner > createOrUpdateAsync ( String resourceGroupName , String localNetworkGatewayName , LocalNetworkGatewayInner parameters ) { } }
return createOrUpdateWithServiceResponseAsync ( resourceGroupName , localNetworkGatewayName , parameters ) . map ( new Func1 < ServiceResponse < LocalNetworkGatewayInner > , LocalNetworkGatewayInner > ( ) { @ Override public LocalNetworkGatewayInner call ( ServiceResponse < LocalNetworkGatewayInner > response ) { return response . body ( ) ; } } ) ;
public class JSONArray { /** * Get the collection type from a getter or setter , or null if no type was * found . < br / > * Contributed by [ Matt Small @ WaveMaker ] . */ public static Class [ ] getCollectionType ( PropertyDescriptor pd , boolean useGetter ) throws JSONException { } }
Type type ; if ( useGetter ) { Method m = pd . getReadMethod ( ) ; type = m . getGenericReturnType ( ) ; } else { Method m = pd . getWriteMethod ( ) ; Type [ ] gpts = m . getGenericParameterTypes ( ) ; if ( 1 != gpts . length ) { throw new JSONException ( "method " + m + " is not a standard setter" ) ; } type = gpts [ 0 ] ; } if ( ! ( type instanceof ParameterizedType ) ) { return null ; // throw new JSONException ( " type not instanceof ParameterizedType : // " + type . getClass ( ) ) ; } ParameterizedType pType = ( ParameterizedType ) type ; Type [ ] actualTypes = pType . getActualTypeArguments ( ) ; Class [ ] ret = new Class [ actualTypes . length ] ; for ( int i = 0 ; i < ret . length ; i ++ ) { ret [ i ] = ( Class ) actualTypes [ i ] ; } return ret ;
public class DefaultParser { /** * Tells if the token looks like a long option . * @ param token */ private boolean isLongOption ( String token ) { } }
if ( ! token . startsWith ( "-" ) || token . length ( ) == 1 ) { return false ; } int pos = token . indexOf ( "=" ) ; String t = pos == - 1 ? token : token . substring ( 0 , pos ) ; if ( ! options . getMatchingOptions ( t ) . isEmpty ( ) ) { // long or partial long options ( - - L , - L , - - L = V , - L = V , - - l , - - l = V ) return true ; } else if ( getLongPrefix ( token ) != null && ! token . startsWith ( "--" ) ) { // - LV return true ; } return false ;
public class AbstractAttributeDefinitionBuilder { /** * Sets the { @ link AttributeDefinition # getName ( ) name } for the attribute , which is only needed * if the attribute was created from an existing { @ link SimpleAttributeDefinition } using * { @ link SimpleAttributeDefinitionBuilder # create ( org . jboss . as . controller . SimpleAttributeDefinition ) } * method . * @ param name the attribute ' s name . { @ code null } is not allowed * @ return a builder that can be used to continue building the attribute definition * @ deprecated may be removed at any time ; the name should be immutable */ @ Deprecated public BUILDER setName ( String name ) { } }
assert name != null ; // noinspection deprecation this . name = name ; return ( BUILDER ) this ;
public class AsyncTask { /** * Start asynchronous task execution . */ public void start ( ) { } }
Thread thread = new Thread ( new Runnable ( ) { @ Override public void run ( ) { try { onPreExecute ( ) ; Value value = execute ( ) ; onPostExecute ( value ) ; } catch ( Throwable throwable ) { onThrowable ( throwable ) ; } } } ) ; thread . start ( ) ;
public class ColumnDataUtils { /** * Performs a database query to find the next integer in the sequence reserved for * the given column . * @ param autoIncrementIntegerColumn Column data where a new integer is required * @ return The next integer in sequence * @ throws Exception */ static public int obtainNextIncrementInteger ( Connection connection , ColumnData autoIncrementIntegerColumn ) throws Exception { } }
try { String sqlQuery = "SELECT nextval(?);" ; // Create SQL command PreparedStatement pstmt = null ; { pstmt = connection . prepareStatement ( sqlQuery ) ; // Populate prepared statement pstmt . setString ( 1 , autoIncrementIntegerColumn . getAutoIncrementSequence ( ) ) ; } if ( pstmt . execute ( ) ) { ResultSet rs = pstmt . getResultSet ( ) ; if ( rs . next ( ) ) { int nextValue = rs . getInt ( 1 ) ; return nextValue ; } else { throw new Exception ( "Empty result returned by SQL: " + sqlQuery ) ; } } else { throw new Exception ( "No result returned by SQL: " + sqlQuery ) ; } } catch ( Exception e ) { throw new Exception ( "Error while attempting to get a auto increment integer value for: " + autoIncrementIntegerColumn . getColumnName ( ) + " (" + autoIncrementIntegerColumn . getAutoIncrementSequence ( ) + ")" , e ) ; }
public class TimePickerDialog { /** * Show either Hours or Minutes . */ private void setCurrentItemShowing ( int index , boolean animateCircle , boolean delayLabelAnimate , boolean announce ) { } }
mTimePicker . setCurrentItemShowing ( index , animateCircle ) ; TextView labelToAnimate ; switch ( index ) { case HOUR_INDEX : int hours = mTimePicker . getHours ( ) ; if ( ! mIs24HourMode ) { hours = hours % 12 ; } mTimePicker . setContentDescription ( mHourPickerDescription + ": " + hours ) ; if ( announce ) { Utils . tryAccessibilityAnnounce ( mTimePicker , mSelectHours ) ; } labelToAnimate = mHourView ; break ; case MINUTE_INDEX : int minutes = mTimePicker . getMinutes ( ) ; mTimePicker . setContentDescription ( mMinutePickerDescription + ": " + minutes ) ; if ( announce ) { Utils . tryAccessibilityAnnounce ( mTimePicker , mSelectMinutes ) ; } labelToAnimate = mMinuteView ; break ; default : int seconds = mTimePicker . getSeconds ( ) ; mTimePicker . setContentDescription ( mSecondPickerDescription + ": " + seconds ) ; if ( announce ) { Utils . tryAccessibilityAnnounce ( mTimePicker , mSelectSeconds ) ; } labelToAnimate = mSecondView ; } int hourColor = ( index == HOUR_INDEX ) ? mSelectedColor : mUnselectedColor ; int minuteColor = ( index == MINUTE_INDEX ) ? mSelectedColor : mUnselectedColor ; int secondColor = ( index == SECOND_INDEX ) ? mSelectedColor : mUnselectedColor ; mHourView . setTextColor ( hourColor ) ; mMinuteView . setTextColor ( minuteColor ) ; mSecondView . setTextColor ( secondColor ) ; ObjectAnimator pulseAnimator = Utils . getPulseAnimator ( labelToAnimate , 0.85f , 1.1f ) ; if ( delayLabelAnimate ) { pulseAnimator . setStartDelay ( PULSE_ANIMATOR_DELAY ) ; } pulseAnimator . start ( ) ;
public class gslbsite { /** * Use this API to fetch gslbsite resources of given names . */ public static gslbsite [ ] get ( nitro_service service , String sitename [ ] ) throws Exception { } }
if ( sitename != null && sitename . length > 0 ) { gslbsite response [ ] = new gslbsite [ sitename . length ] ; gslbsite obj [ ] = new gslbsite [ sitename . length ] ; for ( int i = 0 ; i < sitename . length ; i ++ ) { obj [ i ] = new gslbsite ( ) ; obj [ i ] . set_sitename ( sitename [ i ] ) ; response [ i ] = ( gslbsite ) obj [ i ] . get_resource ( service ) ; } return response ; } return null ;
public class MOMBI2History { /** * Adds a new vector of maxs values to the history . The method ensures that only the * newest MAX _ LENGTH vectors will be kept in the history * @ param maxs */ public void add ( List < Double > maxs ) { } }
List < Double > aux = new ArrayList < > ( this . numberOfObjectives ) ; aux . addAll ( maxs ) ; this . history . add ( aux ) ; if ( history . size ( ) > MAX_LENGHT ) history . remove ( 0 ) ;
public class Elements { /** * Get all of the parents and ancestor elements of the matched elements . * @ return all of the parents and ancestor elements of the matched elements */ public Elements parents ( ) { } }
HashSet < Element > combo = new LinkedHashSet < > ( ) ; for ( Element e : this ) { combo . addAll ( e . parents ( ) ) ; } return new Elements ( combo ) ;
public class ConstraintContextProperties { /** * Returns the names of all activities with routing constraints . * @ return A set of all activities with routing constraints . */ public Set < String > getActivitiesWithRoutingConstraints ( ) { } }
Set < String > result = new HashSet < > ( ) ; String propertyValue = getProperty ( ConstraintContextProperty . ACTIVITIES_WITH_CONSTRAINTS ) ; if ( propertyValue == null ) return result ; StringTokenizer activityTokens = StringUtils . splitArrayString ( propertyValue , " " ) ; while ( activityTokens . hasMoreTokens ( ) ) { result . add ( activityTokens . nextToken ( ) ) ; } return result ;
public class PersonBuilderImpl { /** * { @ inheritDoc } */ @ Override public Person createPerson ( final String idString ) { } }
if ( idString == null ) { return new Person ( ) ; } final Person person = new Person ( getRoot ( ) , new ObjectId ( idString ) ) ; getRoot ( ) . insert ( person ) ; return person ;
public class HtmlServlet { /** * Check if the given page is visible for the requested site defined by * a hostname and a port . * @ param request * @ param page * @ return */ private boolean isVisibleForSite ( final HttpServletRequest request , final Page page ) { } }
final Site site = page . getSite ( ) ; if ( site == null ) { return true ; } final String serverName = request . getServerName ( ) ; final int serverPort = request . getServerPort ( ) ; if ( StringUtils . isNotBlank ( serverName ) && ! serverName . equals ( site . getHostname ( ) ) ) { return false ; } final Integer sitePort = site . getPort ( ) ; if ( sitePort != null && serverPort != sitePort ) { return false ; } return true ;
public class MessageProtocol { /** * Parse a message protocol from a content type header , if defined . * @ param contentType The content type header to parse . * @ return The parsed message protocol . */ public static MessageProtocol fromContentTypeHeader ( Optional < String > contentType ) { } }
return contentType . map ( ct -> { String [ ] parts = ct . split ( ";" ) ; String justContentType = parts [ 0 ] ; Optional < String > charset = Optional . empty ( ) ; for ( int i = 1 ; i < parts . length ; i ++ ) { String toTest = parts [ i ] . trim ( ) ; if ( toTest . startsWith ( "charset=" ) ) { charset = Optional . of ( toTest . split ( "=" , 2 ) [ 1 ] ) ; break ; } } return new MessageProtocol ( Optional . of ( justContentType ) , charset , Optional . empty ( ) ) ; } ) . orElse ( new MessageProtocol ( ) ) ;
public class AlignedBlock { /** * Outputs the block , with the given separator appended to each line except the last , and the given * terminator appended to the last line . * @ param separator text added to each line except the last / * @ param terminator text added to the last line . */ public void print ( String separator , String terminator ) { } }
for ( int i = 0 ; i < maxColumnLength . size ( ) ; i ++ ) { maxColumnLength . set ( i , ( ( ( maxColumnLength . get ( i ) / TAB_SIZE ) + 1 ) * TAB_SIZE ) ) ; } for ( int r = 0 ; r < rows . size ( ) ; r ++ ) { String [ ] s = rows . get ( r ) ; for ( int i = 0 ; i < s . length ; i ++ ) { out . print ( s [ i ] ) ; if ( i < s . length - 1 ) { for ( int l = ( s [ i ] == null ? 0 : s [ i ] . length ( ) ) ; l < maxColumnLength . get ( i ) ; l ++ ) { out . print ( ' ' ) ; } } } if ( separator != null && r < rows . size ( ) - 1 ) { out . println ( separator ) ; } else if ( terminator != null && r == rows . size ( ) - 1 ) { out . println ( terminator ) ; } else { out . println ( ) ; } }
public class DirectorySelector { /** * Show the monitor dialog . If called outside the EDT this method will switch * to the UI thread using * < code > SwingUtilities . invokeAndWait ( Runnable ) < / code > . */ public final void show ( ) { } }
if ( firstTime ) { firstTime = false ; if ( SwingUtilities . isEventDispatchThread ( ) ) { showIntern ( ) ; } else { try { SwingUtilities . invokeAndWait ( new Runnable ( ) { public void run ( ) { showIntern ( ) ; } } ) ; } catch ( final Exception ex ) { ignore ( ) ; } } } else { throw new IllegalStateException ( "This object cannot be reused!" ) ; }