signature
stringlengths
43
39.1k
implementation
stringlengths
0
450k
public class ButtonlessDfuImpl { /** * Checks whether the response received is valid and returns the status code . * @ param response the response received from the DFU device . * @ param request the expected Op Code . * @ return The status code . * @ throws UnknownResponseException if response was not valid . */ @ SuppressWarnings ( "SameParameterValue" ) private int getStatusCode ( final byte [ ] response , final int request ) throws UnknownResponseException { } }
if ( response == null || response . length < 3 || response [ 0 ] != OP_CODE_RESPONSE_CODE_KEY || response [ 1 ] != request || ( response [ 2 ] != DFU_STATUS_SUCCESS && response [ 2 ] != SecureDfuError . BUTTONLESS_ERROR_OP_CODE_NOT_SUPPORTED && response [ 2 ] != SecureDfuError . BUTTONLESS_ERROR_OPERATION_FAILED ) ) throw new UnknownResponseException ( "Invalid response received" , response , OP_CODE_RESPONSE_CODE_KEY , request ) ; return response [ 2 ] ;
public class Parser { /** * Parser rule for parsing a literal atom . * An literal atom is a numeric constant . * @ return an atom parsed from the given input */ @ SuppressWarnings ( "squid:S1698" ) private Expression literalAtom ( ) { } }
if ( tokenizer . current ( ) . isSymbol ( "+" ) && tokenizer . next ( ) . isNumber ( ) ) { // Parse numbers with a leading + sign like + 2.02 by simply ignoring the + tokenizer . consume ( ) ; } if ( tokenizer . current ( ) . isNumber ( ) ) { double value = Double . parseDouble ( tokenizer . consume ( ) . getContents ( ) ) ; if ( tokenizer . current ( ) . is ( Token . TokenType . ID ) ) { String quantifier = tokenizer . current ( ) . getContents ( ) . intern ( ) ; if ( "n" == quantifier ) { value /= 1000000000d ; tokenizer . consume ( ) ; } else if ( "u" == quantifier ) { value /= 1000000d ; tokenizer . consume ( ) ; } else if ( "m" == quantifier ) { value /= 1000d ; tokenizer . consume ( ) ; } else if ( "K" == quantifier || "k" == quantifier ) { value *= 1000d ; tokenizer . consume ( ) ; } else if ( "M" == quantifier ) { value *= 1000000d ; tokenizer . consume ( ) ; } else if ( "G" == quantifier ) { value *= 1000000000d ; tokenizer . consume ( ) ; } else { Token token = tokenizer . consume ( ) ; errors . add ( ParseError . error ( token , String . format ( "Unexpected token: '%s'. Expected a valid quantifier." , token . getSource ( ) ) ) ) ; } } return new Constant ( value ) ; } Token token = tokenizer . consume ( ) ; errors . add ( ParseError . error ( token , String . format ( "Unexpected token: '%s'. Expected an expression." , token . getSource ( ) ) ) ) ; return Constant . EMPTY ;
public class METSContentHandler { /** * { @ inheritDoc } */ @ Override public void startElement ( String uri , String localName , String qName , Attributes a ) throws SAXException { } }
if ( uri . equals ( METS . uri ) && ! m_inXMLMetadata ) { // a new mets element is starting if ( localName . equals ( "mets" ) ) { m_rootElementFound = true ; m_obj . setPid ( grab ( a , METS . uri , "OBJID" ) ) ; m_obj . setLabel ( grab ( a , METS . uri , "LABEL" ) ) ; if ( m_format . equals ( METS_EXT1_0 ) ) { // In METS _ EXT 1.0 , the PROFILE attribute mapped to an // object property , fedora - model : contentModel . This will be // retained as an extended property in the DigitalObject . m_obj . setExtProperty ( MODEL . CONTENT_MODEL . uri , grab ( a , METS . uri , "PROFILE" ) ) ; // Similarly , the TYPE attribute mapped to rdf : type , and // will also be retained as an external property . m_obj . setExtProperty ( RDF . TYPE . uri , grab ( a , METS . uri , "TYPE" ) ) ; } } else if ( localName . equals ( "metsHdr" ) ) { m_obj . setCreateDate ( DateUtility . convertStringToDate ( grab ( a , METS . uri , "CREATEDATE" ) ) ) ; m_obj . setLastModDate ( DateUtility . convertStringToDate ( grab ( a , METS . uri , "LASTMODDATE" ) ) ) ; try { m_obj . setState ( DOTranslationUtility . readStateAttribute ( grab ( a , METS . uri , "RECORDSTATUS" ) ) ) ; } catch ( ParseException e ) { throw new SAXException ( "Could not read object state" , e ) ; } } else if ( localName . equals ( "agent" ) ) { m_agentRole = grab ( a , METS . uri , "ROLE" ) ; } else if ( localName . equals ( "name" ) && m_agentRole . equals ( "IPOWNER" ) ) { m_readingContent = true ; m_elementContent = new StringBuffer ( ) ; } else if ( localName . equals ( "amdSec" ) ) { m_dsId = grab ( a , METS . uri , "ID" ) ; m_dsState = grab ( a , METS . uri , "STATUS" ) ; String dsVersionable = grab ( a , METS . uri , "VERSIONABLE" ) ; if ( dsVersionable != null && ! dsVersionable . isEmpty ( ) ) { m_dsVersionable = Boolean . parseBoolean ( grab ( a , METS . uri , "VERSIONABLE" ) ) ; } else { m_dsVersionable = true ; } } else if ( localName . equals ( "dmdSecFedora" ) ) { m_dsId = grab ( a , METS . uri , "ID" ) ; m_dsState = grab ( a , METS . uri , "STATUS" ) ; String dsVersionable = grab ( a , METS . uri , "VERSIONABLE" ) ; if ( dsVersionable != null && ! dsVersionable . isEmpty ( ) ) { m_dsVersionable = Boolean . parseBoolean ( grab ( a , METS . uri , "VERSIONABLE" ) ) ; } else { m_dsVersionable = true ; } } else if ( localName . equals ( "techMD" ) || localName . equals ( "descMD" ) || localName . equals ( "sourceMD" ) || localName . equals ( "rightsMD" ) || localName . equals ( "digiprovMD" ) ) { m_dsVersId = grab ( a , METS . uri , "ID" ) ; if ( localName . equals ( "techMD" ) ) { m_dsMDClass = DatastreamXMLMetadata . TECHNICAL ; } if ( localName . equals ( "sourceMD" ) ) { m_dsMDClass = DatastreamXMLMetadata . SOURCE ; } if ( localName . equals ( "rightsMD" ) ) { m_dsMDClass = DatastreamXMLMetadata . RIGHTS ; } if ( localName . equals ( "digiprovMD" ) ) { m_dsMDClass = DatastreamXMLMetadata . DIGIPROV ; } if ( localName . equals ( "descMD" ) ) { m_dsMDClass = DatastreamXMLMetadata . DESCRIPTIVE ; } String dateString = grab ( a , METS . uri , "CREATED" ) ; if ( dateString != null && ! dateString . isEmpty ( ) ) { m_dsCreateDate = DateUtility . convertStringToDate ( dateString ) ; } } else if ( localName . equals ( "mdWrap" ) ) { m_dsInfoType = grab ( a , METS . uri , "MDTYPE" ) ; m_dsOtherInfoType = grab ( a , METS . uri , "OTHERMDTYPE" ) ; m_dsLabel = grab ( a , METS . uri , "LABEL" ) ; m_dsMimeType = grab ( a , METS . uri , "MIMETYPE" ) ; m_dsFormatURI = grab ( a , METS . uri , "FORMAT_URI" ) ; String altIDs = grab ( a , METS . uri , "ALT_IDS" ) ; if ( altIDs . length ( ) == 0 ) { m_dsAltIDs = EMPTY_STRING_ARRAY ; } else { m_dsAltIDs = altIDs . split ( " " ) ; } m_dsChecksum = grab ( a , METS . uri , "CHECKSUM" ) ; m_dsChecksumType = grab ( a , METS . uri , "CHECKSUMTYPE" ) ; } else if ( localName . equals ( "xmlData" ) ) { m_dsXMLBuffer = new StringBuilder ( ) ; m_xmlDataLevel = 0 ; m_inXMLMetadata = true ; } else if ( localName . equals ( "fileGrp" ) ) { m_dsId = grab ( a , METS . uri , "ID" ) ; String dsVersionable = grab ( a , METS . uri , "VERSIONABLE" ) ; if ( dsVersionable != null && ! dsVersionable . isEmpty ( ) ) { m_dsVersionable = Boolean . parseBoolean ( grab ( a , METS . uri , "VERSIONABLE" ) ) ; } else { m_dsVersionable = true ; } // reset the values for the next file m_dsVersId = "" ; m_dsCreateDate = null ; m_dsMimeType = "" ; m_dsControlGrp = "" ; m_dsFormatURI = "" ; m_dsAltIDs = EMPTY_STRING_ARRAY ; m_dsState = grab ( a , METS . uri , "STATUS" ) ; m_dsSize = - 1 ; m_dsChecksum = "" ; m_dsChecksumType = "" ; } else if ( localName . equals ( "file" ) ) { m_dsVersId = grab ( a , METS . uri , "ID" ) ; String dateString = grab ( a , METS . uri , "CREATED" ) ; if ( dateString != null && ! dateString . isEmpty ( ) ) { m_dsCreateDate = DateUtility . convertStringToDate ( dateString ) ; } m_dsMimeType = grab ( a , METS . uri , "MIMETYPE" ) ; m_dsControlGrp = grab ( a , METS . uri , "OWNERID" ) ; String ADMID = grab ( a , METS . uri , "ADMID" ) ; if ( ADMID != null && ! ADMID . isEmpty ( ) ) { ArrayList < String > al = new ArrayList < String > ( ) ; if ( ADMID . indexOf ( " " ) != - 1 ) { String [ ] admIds = ADMID . split ( " " ) ; for ( String element : admIds ) { al . add ( element ) ; } } else { al . add ( ADMID ) ; } m_dsADMIDs . put ( m_dsVersId , al ) ; } String DMDID = grab ( a , METS . uri , "DMDID" ) ; if ( DMDID != null && ! DMDID . isEmpty ( ) ) { ArrayList < String > al = new ArrayList < String > ( ) ; if ( DMDID . indexOf ( " " ) != - 1 ) { String [ ] dmdIds = DMDID . split ( " " ) ; for ( String element : dmdIds ) { al . add ( element ) ; } } else { al . add ( DMDID ) ; } m_dsDMDIDs . put ( m_dsVersId , al ) ; } String sizeString = grab ( a , METS . uri , "SIZE" ) ; if ( sizeString != null && ! sizeString . isEmpty ( ) ) { try { m_dsSize = Long . parseLong ( sizeString ) ; } catch ( NumberFormatException nfe ) { throw new SAXException ( "If specified, a datastream's " + "SIZE attribute must be an xsd:long." ) ; } } String formatURI = grab ( a , METS . uri , "FORMAT_URI" ) ; if ( formatURI != null && ! formatURI . isEmpty ( ) ) { m_dsFormatURI = formatURI ; } String altIDs = grab ( a , METS . uri , "ALT_IDS" ) ; if ( altIDs . length ( ) == 0 ) { m_dsAltIDs = EMPTY_STRING_ARRAY ; } else { m_dsAltIDs = altIDs . split ( " " ) ; } m_dsChecksum = grab ( a , METS . uri , "CHECKSUM" ) ; m_dsChecksumType = grab ( a , METS . uri , "CHECKSUMTYPE" ) ; // inside a " file " element , it ' s either going to be // FLocat ( a reference ) or FContent ( inline ) } else if ( localName . equals ( "FLocat" ) ) { m_dsLabel = grab ( a , m_xlink . uri , "title" ) ; String dsLocation = grab ( a , m_xlink . uri , "href" ) ; if ( dsLocation == null || dsLocation . isEmpty ( ) ) { throw new SAXException ( "xlink:href must be specified in FLocat element" ) ; } if ( m_dsControlGrp . equalsIgnoreCase ( "E" ) || m_dsControlGrp . equalsIgnoreCase ( "R" ) ) { // URL FORMAT VALIDATION for dsLocation : // make sure we have a properly formed URL ( must have protocol ) try { ValidationUtility . validateURL ( dsLocation , m_dsControlGrp ) ; } catch ( ValidationException ve ) { throw new SAXException ( ve . getMessage ( ) ) ; } // system will set dsLocationType for E and R datastreams . . . m_dsLocationType = Datastream . DS_LOCATION_TYPE_URL ; m_dsInfoType = "DATA" ; m_dsLocation = dsLocation ; instantiateDatastream ( new DatastreamReferencedContent ( ) ) ; } else if ( m_dsControlGrp . equalsIgnoreCase ( "M" ) ) { // URL FORMAT VALIDATION for dsLocation : // For Managed Content the URL is only checked when we are parsing a // a NEW ingest file because the URL is replaced with an internal identifier // once the repository has sucked in the content for storage . if ( m_obj . isNew ( ) ) { try { ValidationUtility . validateURL ( dsLocation , m_dsControlGrp ) ; m_dsLocationType = Datastream . DS_LOCATION_TYPE_URL ; } catch ( ValidationException ve ) { throw new SAXException ( ve . getMessage ( ) ) ; } } else { m_dsLocationType = Datastream . DS_LOCATION_TYPE_INTERNAL ; } m_dsInfoType = "DATA" ; m_dsLocation = dsLocation ; instantiateDatastream ( new DatastreamManagedContent ( ) ) ; } } else if ( localName . equals ( "FContent" ) ) { // In METS _ EXT , the FContent element contains base64 - encoded // data . m_readingContent = true ; m_elementContent = new StringBuffer ( ) ; if ( m_dsControlGrp . equalsIgnoreCase ( "M" ) ) { m_readingBinaryContent = true ; m_binaryContentTempFile = null ; try { m_binaryContentTempFile = File . createTempFile ( "binary-datastream" , null ) ; } catch ( IOException ioe ) { throw new SAXException ( new StreamIOException ( "Unable to create temporary file for binary content" ) ) ; } } } else if ( m_format . equals ( METS_EXT1_0 ) ) { startDisseminators ( localName , a ) ; } } else { if ( m_inXMLMetadata ) { // must be in xmlData . . . just output it , remembering the number // of METS : xmlData elements we see appendElementStart ( uri , localName , qName , a , m_dsXMLBuffer ) ; // METS INSIDE METS ! we have an inline XML datastream // that is itself METS . We do not want to parse this ! if ( uri . equals ( METS . uri ) && localName . equals ( "xmlData" ) ) { m_xmlDataLevel ++ ; } // remember this stuff . . . ( we don ' t have to look at level // because the audit schema doesn ' t allow for xml elements inside // these , so they ' re never set incorrectly ) // signaling that we ' re interested in sending char data to // the m _ auditBuffer by making it non - null , and getting // ready to accept data by allocating a new StringBuffer if ( m_dsId . equals ( "FEDORA-AUDITTRAIL" ) || m_dsId . equals ( "AUDIT" ) ) { if ( localName . equals ( "record" ) ) { m_auditId = grab ( a , uri , "ID" ) ; } else if ( localName . equals ( "process" ) ) { m_auditProcessType = grab ( a , uri , "type" ) ; } else if ( localName . equals ( "action" ) || localName . equals ( "componentID" ) || localName . equals ( "responsibility" ) || localName . equals ( "date" ) || localName . equals ( "justification" ) ) { m_auditBuffer = new StringBuffer ( ) ; } } } else { // ignore all else } }
public class AcceptDirectConnectGatewayAssociationProposalRequest { /** * Overrides the Amazon VPC prefixes advertised to the Direct Connect gateway . * @ return Overrides the Amazon VPC prefixes advertised to the Direct Connect gateway . */ public java . util . List < RouteFilterPrefix > getOverrideAllowedPrefixesToDirectConnectGateway ( ) { } }
if ( overrideAllowedPrefixesToDirectConnectGateway == null ) { overrideAllowedPrefixesToDirectConnectGateway = new com . amazonaws . internal . SdkInternalList < RouteFilterPrefix > ( ) ; } return overrideAllowedPrefixesToDirectConnectGateway ;
public class ScalingThreadPoolExecutor { /** * Creates a { @ link ScalingThreadPoolExecutor } . * @ param min Core thread pool size . * @ param max Max number of threads allowed . * @ param keepAliveTime Keep alive time for unused threads in milliseconds . * @ return A { @ link ScalingThreadPoolExecutor } . */ public static ScalingThreadPoolExecutor newScalingThreadPool ( int min , int max , long keepAliveTime ) { } }
return newScalingThreadPool ( min , max , keepAliveTime , Executors . defaultThreadFactory ( ) ) ;
public class CmsDefaultUserSettings { /** * Sets the publish related resources mode . < p > * @ param publishRelatedResourcesMode the publish related resources mode to set */ public void setPublishRelatedResourcesMode ( String publishRelatedResourcesMode ) { } }
m_publishRelatedResourcesMode = CmsPublishRelatedResourcesMode . valueOf ( publishRelatedResourcesMode ) ; if ( ( m_publishRelatedResourcesMode != null ) && CmsLog . INIT . isInfoEnabled ( ) ) { CmsLog . INIT . info ( Messages . get ( ) . getBundle ( ) . key ( Messages . INIT_PUBLISH_RELATED_RESOURCES_MODE_1 , m_publishRelatedResourcesMode . toString ( ) ) ) ; }
public class HttpUtils { /** * Execute http request and produce a response . * @ param url the url * @ param method the method * @ param basicAuthUsername the basic auth username * @ param basicAuthPassword the basic auth password * @ param parameters the parameters * @ param headers the headers * @ param entity the entity * @ return the http response */ public static HttpResponse execute ( final String url , final String method , final String basicAuthUsername , final String basicAuthPassword , final Map < String , Object > parameters , final Map < String , Object > headers , final String entity ) { } }
try { val uri = buildHttpUri ( url , parameters ) ; val request = getHttpRequestByMethod ( method . toLowerCase ( ) . trim ( ) , entity , uri ) ; headers . forEach ( ( k , v ) -> request . addHeader ( k , v . toString ( ) ) ) ; prepareHttpRequest ( request , basicAuthUsername , basicAuthPassword , parameters ) ; return HTTP_CLIENT . execute ( request ) ; } catch ( final Exception e ) { LOGGER . error ( e . getMessage ( ) , e ) ; } return null ;
public class BaseSamlIdPMetadataGenerator { /** * Generate certificate and key pair . * @ return the pair where key / left is the certificate and value is the key */ @ SneakyThrows protected Pair < String , String > generateCertificateAndKey ( ) { } }
try ( val certWriter = new StringWriter ( ) ; val keyWriter = new StringWriter ( ) ) { samlIdPMetadataGeneratorConfigurationContext . getSamlIdPCertificateAndKeyWriter ( ) . writeCertificateAndKey ( keyWriter , certWriter ) ; val encryptionKey = samlIdPMetadataGeneratorConfigurationContext . getMetadataCipherExecutor ( ) . encode ( keyWriter . toString ( ) ) ; return Pair . of ( certWriter . toString ( ) , encryptionKey ) ; }
public class ResultSetIterator { /** * Does this iterater have more elements ? * @ return true if there is another element */ public boolean hasNext ( ) { } }
if ( _primed ) { return true ; } try { _primed = _rs . next ( ) ; } catch ( SQLException sqle ) { return false ; } return _primed ;
public class NodeImpl { /** * { @ inheritDoc } * Not supported for namespace declaration . Overrided by DocumentImpl and * ElementImpl */ public boolean isDefaultNamespace ( String namespaceURI ) { } }
int type = getNodeType ( ) ; if ( type == NodeKind . ATTR ) { if ( this instanceof AttrImpl == false ) { // ns decl throw new UnsupportedOperationException ( ) ; } } Node p = getParentNode ( ) ; return p . isDefaultNamespace ( namespaceURI ) ;
public class ObjectFactory { /** * Create an instance of { @ link JAXBElement } { @ code < } { @ link List } { @ code < } { @ link BigInteger } { @ code > } { @ code > } * @ param value * Java instance representing xml element ' s value . * @ return * the new instance of { @ link JAXBElement } { @ code < } { @ link List } { @ code < } { @ link BigInteger } { @ code > } { @ code > } */ @ XmlElementDecl ( namespace = "http://www.opengis.net/gml" , name = "integerValueList" ) public JAXBElement < List < BigInteger > > createIntegerValueList ( List < BigInteger > value ) { } }
return new JAXBElement < List < BigInteger > > ( _IntegerValueList_QNAME , ( ( Class ) List . class ) , null , ( ( List < BigInteger > ) value ) ) ;
public class TextModuleBuilder { /** * / * ( non - Javadoc ) * @ see com . ibm . domino . servlets . aggrsvc . modules . JsModule # getSourceFile ( ) */ @ Override public ModuleBuild build ( String mid , IResource resource , HttpServletRequest request , List < ICacheKeyGenerator > keyGens ) throws Exception { } }
StringBuffer sb = new StringBuffer ( ) ; Boolean exportMid = TypeUtil . asBoolean ( request . getAttribute ( IHttpTransport . EXPORTMODULENAMES_REQATTRNAME ) ) ; Boolean noTextAdorn = TypeUtil . asBoolean ( request . getAttribute ( IHttpTransport . NOTEXTADORN_REQATTRNAME ) ) ; if ( noTextAdorn ) { sb . append ( "'" ) ; // $ NON - NLS - 1 $ } else if ( exportMid != null && exportMid . booleanValue ( ) ) { sb . append ( "define(\"" ) . append ( mid ) . append ( "\",'" ) ; // $ NON - NLS - 1 $ / / $ NON - NLS - 2 $ } else { sb . append ( "define('" ) ; // $ NON - NLS - 1 $ } StringWriter writer = new StringWriter ( ) ; MutableObject < List < ICacheKeyGenerator > > keyGensRef = new MutableObject < List < ICacheKeyGenerator > > ( keyGens ) ; CopyUtil . copy ( new JavaScriptEscapingReader ( getContentReader ( mid , resource , request , keyGensRef ) ) , writer ) ; sb . append ( writer . toString ( ) ) ; sb . append ( noTextAdorn ? "'" : "');" ) ; // $ NON - NLS - 1 $ / / $ NON - NLS - 2 $ return new ModuleBuild ( sb . toString ( ) , keyGensRef . getValue ( ) , null ) ;
public class Configurator { /** * Removes all events provided by the protocol above protocol from events * @ param protocol * @ param events */ protected static void removeProvidedDownServices ( Protocol protocol , List < Integer > events ) { } }
if ( protocol == null || events == null ) return ; for ( Protocol prot = protocol . getUpProtocol ( ) ; prot != null && ! events . isEmpty ( ) ; prot = prot . getUpProtocol ( ) ) { List < Integer > provided_down_services = prot . providedDownServices ( ) ; if ( provided_down_services != null && ! provided_down_services . isEmpty ( ) ) events . removeAll ( provided_down_services ) ; }
public class EDBConverter { /** * Gets a map object out of an EDBObject . */ private Object getMapValue ( Class < ? > keyType , Class < ? > valueType , String propertyName , EDBObject object ) { } }
Map < Object , Object > temp = new HashMap < > ( ) ; for ( int i = 0 ; ; i ++ ) { String keyProperty = getEntryNameForMapKey ( propertyName , i ) ; String valueProperty = getEntryNameForMapValue ( propertyName , i ) ; if ( ! object . containsKey ( keyProperty ) ) { break ; } Object key = object . getObject ( keyProperty ) ; Object value = object . getObject ( valueProperty ) ; if ( OpenEngSBModel . class . isAssignableFrom ( keyType ) ) { key = convertEDBObjectToUncheckedModel ( keyType , edbService . getObject ( key . toString ( ) ) ) ; } if ( OpenEngSBModel . class . isAssignableFrom ( valueType ) ) { value = convertEDBObjectToUncheckedModel ( valueType , edbService . getObject ( value . toString ( ) ) ) ; } temp . put ( key , value ) ; object . remove ( keyProperty ) ; object . remove ( valueProperty ) ; } return temp ;
public class Arguments { /** * end helpers */ @ Override public boolean has ( int index , Scriptable start ) { } }
if ( arg ( index ) != NOT_FOUND ) { return true ; } return super . has ( index , start ) ;
public class ParaClient { /** * Grants a permission to a subject that allows them to call the specified HTTP methods on a given resource . * @ param subjectid subject id ( user id ) * @ param resourcePath resource path or object type * @ param permission a set of HTTP methods * @ param allowGuestAccess if true - all unauthenticated requests will go through , ' false ' by default . * @ return a map of the permissions for this subject id */ public Map < String , Map < String , List < String > > > grantResourcePermission ( String subjectid , String resourcePath , EnumSet < App . AllowedMethods > permission , boolean allowGuestAccess ) { } }
if ( StringUtils . isBlank ( subjectid ) || StringUtils . isBlank ( resourcePath ) || permission == null ) { return Collections . emptyMap ( ) ; } if ( allowGuestAccess && App . ALLOW_ALL . equals ( subjectid ) ) { permission . add ( App . AllowedMethods . GUEST ) ; } resourcePath = Utils . urlEncode ( resourcePath ) ; return getEntity ( invokePut ( Utils . formatMessage ( "_permissions/{0}/{1}" , subjectid , resourcePath ) , Entity . json ( permission ) ) , Map . class ) ;
public class AccessControlStore { /** * - - - - - roles */ @ Process ( actionType = ModifyStandardRole . class ) public void modifyStandardRole ( final ModifyStandardRole action , final Channel channel ) { } }
Role role = action . getRole ( ) ; new Async < FunctionContext > ( ) . waterfall ( new FunctionContext ( ) , new ReloadOutcome ( channel ) , new AccessControlFunctions . CheckAssignment ( dispatcher , role ) , new AccessControlFunctions . AddAssignment ( dispatcher , role , status -> status == 404 ) , new AccessControlFunctions . ModifyIncludeAll ( dispatcher , role ) ) ;
public class DiGraph { /** * Computes the union of two directed graphs . The resulting * directed graph contains all the arcs of the two original * directed arcs . The union < code > DiGraph < / code > is not computed * explicitly ; instead , the lists of predecessors / successors are * generated on - demand . */ public static < V > DiGraph < V > union ( final DiGraph < V > dg1 , final DiGraph < V > dg2 ) { } }
return new DiGraph < V > ( ) { public Collection < V > getRoots ( ) { return DSUtil . unionColl ( dg1 . getRoots ( ) , dg2 . getRoots ( ) ) ; } public BiDiNavigator < V > getBiDiNavigator ( ) { return GraphUtil . < V > unionNav ( dg1 . getBiDiNavigator ( ) , dg2 . getBiDiNavigator ( ) ) ; } public ForwardNavigator < V > getForwardNavigator ( ) { return GraphUtil . < V > unionFwdNav ( dg1 . getForwardNavigator ( ) , dg2 . getForwardNavigator ( ) ) ; } } ;
public class Wings { /** * Gets the instance of a specific endpoint that Wings can share to . * @ param endpointClazz the endpoint { @ link java . lang . Class } . * @ return the endpoint instance ; or { @ code null } if unavailable . * @ throws IllegalStateException Wings must be initialized . See { @ link Wings # init ( IWingsModule , Class [ ] ) } . */ public static final WingsEndpoint getEndpoint ( Class < ? extends WingsEndpoint > endpointClazz ) throws IllegalStateException { } }
if ( ! sIsInitialized ) { throw new IllegalStateException ( "Wings must be initialized. See Wings#init()." ) ; } WingsEndpoint selectedEndpoint = null ; for ( WingsEndpoint endpoint : sEndpoints ) { if ( endpointClazz . isInstance ( endpoint ) ) { selectedEndpoint = endpoint ; break ; } } return selectedEndpoint ;
public class Transport { /** * Returns all objects found using the provided parameters . * This method IGNORES " limit " and " offset " parameters and handles paging AUTOMATICALLY for you . * Please use getObjectsListNoPaging ( ) method if you want to control paging yourself with " limit " and " offset " parameters . * @ return objects list , never NULL * @ see # getObjectsListNoPaging ( Class , Collection ) */ public < T > List < T > getObjectsList ( Class < T > objectClass , Collection < ? extends NameValuePair > params ) throws RedmineException { } }
final List < T > result = new ArrayList < > ( ) ; int offset = 0 ; Integer totalObjectsFoundOnServer ; do { final List < NameValuePair > newParams = new ArrayList < > ( params ) ; newParams . add ( new BasicNameValuePair ( "limit" , String . valueOf ( objectsPerPage ) ) ) ; newParams . add ( new BasicNameValuePair ( "offset" , String . valueOf ( offset ) ) ) ; final ResultsWrapper < T > wrapper = getObjectsListNoPaging ( objectClass , newParams ) ; result . addAll ( wrapper . getResults ( ) ) ; totalObjectsFoundOnServer = wrapper . getTotalFoundOnServer ( ) ; // Necessary for trackers . // TODO Alexey : is this still necessary for Redmine 2 . x ? if ( totalObjectsFoundOnServer == null ) { break ; } if ( ! wrapper . hasSomeResults ( ) ) { break ; } offset += wrapper . getResultsNumber ( ) ; } while ( offset < totalObjectsFoundOnServer ) ; return result ;
public class AsyncTask { /** * get the default Executor * @ return the default Executor */ public static Executor getDefaultExecutor ( ) { } }
Executor exec = null ; Class < ? > c = null ; Field field = null ; try { c = Class . forName ( "android.os.AsyncTask" ) ; field = c . getDeclaredField ( "sDefaultExecutor" ) ; field . setAccessible ( true ) ; exec = ( Executor ) field . get ( null ) ; field . setAccessible ( false ) ; } catch ( IllegalArgumentException e ) { e . printStackTrace ( ) ; Log . e ( "IllegalArgumentException" , e ) ; } catch ( ClassNotFoundException e ) { e . printStackTrace ( ) ; Log . e ( "ClassNotFoundException" , e ) ; } catch ( NoSuchFieldException e ) { e . printStackTrace ( ) ; Log . e ( "NoSuchFieldException" , e ) ; } catch ( IllegalAccessException e ) { e . printStackTrace ( ) ; Log . e ( "IllegalAccessException" , e ) ; } return exec ;
public class StaticTypeCheckingVisitor { /** * This method returns the list of methods named against the supplied parameter that * are defined on the specified receiver , but it will also add " non existing " methods * that will be generated afterwards by the compiler , for example if a method is using * default values and that the specified class node isn ' t compiled yet . * @ param receiver the receiver where to find methods * @ param name the name of the methods to return * @ return the methods that are defined on the receiver completed with stubs for future methods */ protected List < MethodNode > findMethodsWithGenerated ( ClassNode receiver , String name ) { } }
List < MethodNode > methods = receiver . getMethods ( name ) ; if ( methods . isEmpty ( ) || receiver . isResolved ( ) ) return methods ; List < MethodNode > result = addGeneratedMethods ( receiver , methods ) ; return result ;
public class RequestUtils { /** * / * package */ static Request . Builder preemptivelySetAuthCredentials ( Request . Builder builder , String userInfo , boolean isUrlBased ) { } }
if ( userInfo == null ) return builder ; if ( ! userInfo . contains ( ":" ) || ":" . equals ( userInfo . trim ( ) ) ) { Log . w ( TAG , "RemoteRequest Unable to parse user info, not setting credentials" ) ; return builder ; } String [ ] userInfoElements = userInfo . split ( ":" ) ; String username = isUrlBased ? URIUtils . decode ( userInfoElements [ 0 ] ) : userInfoElements [ 0 ] ; String password = "" ; if ( userInfoElements . length >= 2 ) password = isUrlBased ? URIUtils . decode ( userInfoElements [ 1 ] ) : userInfoElements [ 1 ] ; String credential = Credentials . basic ( username , password ) ; return builder . addHeader ( "Authorization" , credential ) ;
public class ApiOvhEmaildomain { /** * Alter this object properties * REST : PUT / email / domain / { domain } / account / { accountName } * @ param body [ required ] New object properties * @ param domain [ required ] Name of your domain name * @ param accountName [ required ] Name of account */ public void domain_account_accountName_PUT ( String domain , String accountName , OvhAccount body ) throws IOException { } }
String qPath = "/email/domain/{domain}/account/{accountName}" ; StringBuilder sb = path ( qPath , domain , accountName ) ; exec ( qPath , "PUT" , sb . toString ( ) , body ) ;
public class TurfMeasurement { /** * Takes a set of features , calculates the bbox of all input features , and returns a bounding box . * @ param multiPolygon a { @ link MultiPolygon } object * @ return a double array defining the bounding box in this order { @ code [ minX , minY , maxX , maxY ] } * @ since 2.0.0 */ public static double [ ] bbox ( MultiPolygon multiPolygon ) { } }
List < Point > resultCoords = TurfMeta . coordAll ( multiPolygon , false ) ; return bboxCalculator ( resultCoords ) ;
public class PlayRecordContext { /** * Defines a key sequence consisting of a command key optionally followed by zero or more keys . This key sequence has the * following action : discard any digits collected or recording in progress , replay the prompt , and resume digit collection * or recording . * < b > No default . < / b > An application that defines more than one command key sequence , will typically use the same command * key for all command key sequences . * If more than one command key sequence is defined , then all key sequences must consist of a command key plus at least one * other key . * @ return */ public char getRestartKey ( ) { } }
String value = Optional . fromNullable ( getParameter ( SignalParameters . RESTART_KEY . symbol ( ) ) ) . or ( "" ) ; return value . isEmpty ( ) ? ' ' : value . charAt ( 0 ) ;
public class XPathTopicSyntaxChecker { /** * checkTopicSyntax : Rules out syntactically inappropriate wildcard usages and * determines if there are any wildcards * @ param topic the topic to check * @ return true if topic contains wildcards * @ throws InvalidTopicSyntaxException if topic is syntactically invalid */ public boolean checkTopicSyntax ( String topic ) throws InvalidTopicSyntaxException { } }
checkTopicNotNull ( topic ) ; char [ ] chars = topic . toCharArray ( ) ; boolean acceptSeparator = true ; // becomes false when hash seen , stays false thereafter boolean acceptDot = false ; // becomes false when hash seen , stays false thereafter boolean acceptStar = true ; // becomes false on non - separator , true on separator boolean acceptOrdinary = true ; // becomes false on wildcard , true on separator boolean prevSeparator = false ; // becomes true on separator boolean hasWild = false ; for ( int i = 0 ; i < chars . length ; i ++ ) { char cand = chars [ i ] ; if ( cand == MatchSpace . SUBTOPIC_MATCHONE_CHAR ) { if ( acceptStar ) { hasWild = true ; acceptStar = acceptOrdinary = prevSeparator = acceptDot = false ; acceptSeparator = true ; } else throw new InvalidTopicSyntaxException ( NLS . format ( "INVALID_TOPIC_ERROR_CWSIH0001" , new Object [ ] { topic , new Integer ( i + 1 ) } ) ) ; } else if ( cand == MatchSpace . SUBTOPIC_STOP_CHAR ) { if ( acceptDot ) { if ( prevSeparator ) { acceptOrdinary = false ; } else { acceptOrdinary = true ; } acceptStar = prevSeparator = acceptDot = false ; acceptSeparator = true ; } else throw new InvalidTopicSyntaxException ( NLS . format ( "INVALID_TOPIC_ERROR_CWSIH0002" , new Object [ ] { topic , new Integer ( i + 1 ) } ) ) ; } else if ( cand == MatchSpace . SUBTOPIC_SEPARATOR_CHAR ) { if ( acceptSeparator ) { // A separator is disallowed at the end of a publication if ( i == chars . length - 1 ) { throw new InvalidTopicSyntaxException ( NLS . format ( "INVALID_TOPIC_ERROR_CWSIH0003" , new Object [ ] { topic , new Integer ( i + 1 ) } ) ) ; } if ( prevSeparator ) { // We ' ve found a ' / / ' acceptSeparator = false ; hasWild = true ; acceptDot = true ; } else // First separator { acceptStar = acceptOrdinary = prevSeparator = true ; acceptDot = true ; } } else // Three separators together throw new InvalidTopicSyntaxException ( NLS . format ( "INVALID_TOPIC_ERROR_CWSIH0003" , new Object [ ] { topic , new Integer ( i + 1 ) } ) ) ; } else if ( cand == ':' ) { // : ' s are disallowed in topic name parts throw new InvalidTopicSyntaxException ( NLS . format ( "TEMPORARY_CWSIH9999" , new Object [ ] { " ':' characters are not allowed in topics. A ':' was found at character " + ( i + 1 ) } ) ) ; } else // Ordinary character { if ( ! acceptOrdinary ) throw new InvalidTopicSyntaxException ( NLS . format ( "INVALID_TOPIC_ERROR_CWSIH0004" , new Object [ ] { topic , new Integer ( i + 1 ) } ) ) ; else { acceptStar = prevSeparator = false ; acceptSeparator = acceptDot = true ; } } } return hasWild ;
public class BundleService { /** * < p > Registers { @ link Bundler } instances with this service . See that interface for details . */ public void register ( Bundler bundler ) { } }
if ( bundler == null ) throw new NullPointerException ( "Cannot register null bundler." ) ; if ( runner . state == BundleServiceRunner . State . SAVING ) { throw new IllegalStateException ( "Cannot register during onSave" ) ; } if ( bundlers . add ( bundler ) ) bundler . onEnterScope ( scope ) ; String mortarBundleKey = bundler . getMortarBundleKey ( ) ; if ( mortarBundleKey == null || mortarBundleKey . trim ( ) . equals ( "" ) ) { throw new IllegalArgumentException ( format ( "%s has null or empty bundle key" , bundler ) ) ; } switch ( runner . state ) { case IDLE : toBeLoaded . add ( bundler ) ; runner . servicesToBeLoaded . add ( this ) ; runner . finishLoading ( ) ; break ; case LOADING : if ( ! toBeLoaded . contains ( bundler ) ) { toBeLoaded . add ( bundler ) ; runner . servicesToBeLoaded . add ( this ) ; } break ; default : throw new AssertionError ( "Unexpected state " + runner . state ) ; }
public class DataModelDtoConverters { /** * Converts a { @ link DataModelDto } to { @ link IDataModel } . */ static IDataModel toDataModel ( final DataModelDto dto ) { } }
IDataModel dataModel = new DataModel ( dto . name ) ; dataModel . setDataModelId ( new DataModelId ( dto . dataModelId ) ) ; for ( Entry < String , Object > cell : dto . table . entrySet ( ) ) { ICellAddress address = new CellAddress ( dataModel . getDataModelId ( ) , fromA1Address ( cell . getKey ( ) ) ) ; Object content = cell . getValue ( ) ; DmCell dmcell = new DmCell ( ) ; dmcell . setAddress ( address ) ; dmcell . setContent ( CellValue . from ( content ) ) ; dataModel . setCell ( address , dmcell ) ; } for ( Entry < String , Object > cell : dto . result . entrySet ( ) ) { Object value = cell . getValue ( ) ; if ( value == null ) { continue ; } ICellAddress address = new CellAddress ( dataModel . getDataModelId ( ) , fromA1Address ( cell . getKey ( ) ) ) ; ( ( DmCell ) dataModel . getCell ( address ) ) . setValue ( Optional . of ( CellValue . from ( value ) ) ) ; } for ( Entry < String , Object > entry : dto . getNames ( ) . entrySet ( ) ) { Object aliasValue = entry . getValue ( ) ; if ( isAddress ( aliasValue ) ) { dataModel . setNamedAddress ( entry . getKey ( ) , fromA1Address ( ( String ) aliasValue ) ) ; } else { dataModel . setNamedValue ( entry . getKey ( ) , CellValue . from ( aliasValue ) ) ; } } return dataModel ;
public class ProducerRegistryAPIImpl { /** * Creates the list of existing intervals . */ private void createIntervalList ( ) { } }
synchronized ( intervalLock ) { if ( _cachedIntervalInfos != null ) return ; List < Interval > intervals = intervalRegistry . getIntervals ( ) ; _cachedIntervalInfos = new ArrayList < IntervalInfo > ( intervals . size ( ) ) ; for ( Interval interval : intervals ) { _cachedIntervalInfos . add ( new IntervalInfo ( interval ) ) ; interval . addSecondaryIntervalListener ( this ) ; } }
public class LocalTranCurrentImpl { /** * Setter for the _ coord member var . */ void setCoordinator ( LocalTranCoordImpl ltc ) { } }
_coord = ltc ; if ( tc . isDebugEnabled ( ) ) Tr . debug ( tc , "setCoordinator: LTC=" + ltc ) ;
public class UnauthenticatedSubjectServiceImpl { /** * { @ inheritDoc } */ @ Override public void notifyOfUserRegistryChange ( ) { } }
if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Resetting unauthenticatedSubject as UserRegistry configuration has changed" ) ; } synchronized ( unauthenticatedSubjectLock ) { unauthenticatedSubject = null ; }
public class FSDirectory { /** * Get the depth of node inode from root * @ param inode an inode * @ return depth * @ throws IOException if the given inode is invalid */ static private int getPathDepth ( INode inode ) throws IOException { } }
// calculate the depth of this inode from root int depth = 1 ; INode node ; // node on the path to the root for ( node = inode ; node . parent != null ; node = node . parent ) { depth ++ ; } // parent should be root if ( node . isRoot ( ) ) { return depth ; } // invalid inode throw new IOException ( "Invalid inode: " + inode . getLocalName ( ) ) ;
public class DZcs_post { /** * Postorders a tree of forest . * @ param parent * defines a tree of n nodes * @ param n * length of parent * @ return post [ k ] = i , null on error */ public static int [ ] cs_post ( int [ ] parent , int n ) { } }
int j , k = 0 , post [ ] , w [ ] , head [ ] , next [ ] , stack [ ] ; if ( parent == null ) return ( null ) ; /* check inputs */ post = new int [ n ] ; /* allocate result */ w = new int [ 3 * n ] ; /* get workspace */ if ( w == null || post == null ) return ( cs_idone ( post , null , w , false ) ) ; head = w ; next = w ; int next_offset = n ; stack = w ; int stack_offset = 2 * n ; for ( j = 0 ; j < n ; j ++ ) head [ j ] = - 1 ; /* empty linked lists */ for ( j = n - 1 ; j >= 0 ; j -- ) /* traverse nodes in reverse order */ { if ( parent [ j ] == - 1 ) continue ; /* j is a root */ next [ next_offset + j ] = head [ parent [ j ] ] ; /* add j to list of its parent */ head [ parent [ j ] ] = j ; } for ( j = 0 ; j < n ; j ++ ) { if ( parent [ j ] != - 1 ) continue ; /* skip j if it is not a root */ k = cs_tdfs ( j , k , head , 0 , next , next_offset , post , 0 , stack , stack_offset ) ; } return ( post ) ;
public class SurefireMojoInterceptor { /** * Checks that Surefire has all the metohds that are needed , i . e . , check * Surefire version . Currently we support 2.7 and newer . * @ param mojo * Surefire plugin * @ throws Exception * MojoExecutionException if Surefire version is not supported */ private static void checkSurefireVersion ( Object mojo ) throws Exception { } }
try { // Check version specific methods / fields . // mojo . getClass ( ) . getMethod ( GET _ RUN _ ORDER ) ; getField ( SKIP_TESTS_FIELD , mojo ) ; getField ( FORK_MODE_FIELD , mojo ) ; // We will always require the following . getField ( ARGLINE_FIELD , mojo ) ; getField ( EXCLUDES_FIELD , mojo ) ; } catch ( NoSuchMethodException ex ) { throwMojoExecutionException ( mojo , "Unsupported surefire version. An alternative is to use select/restore goals." , ex ) ; }
public class ReplicatedHashMap { /** * Removes the key ( and its corresponding value ) from this map . This method * does nothing if the key is not in the map . * @ param key * the key that needs to be removed * @ return the previous value associated with < tt > key < / tt > , or * < tt > null < / tt > if there was no mapping for < tt > key < / tt > * @ throws NullPointerException * if the specified key is null */ public V remove ( Object key ) { } }
V retval = get ( key ) ; try { MethodCall call = new MethodCall ( REMOVE , key ) ; disp . callRemoteMethods ( null , call , call_options ) ; } catch ( Exception e ) { throw new RuntimeException ( "remove(" + key + ") failed" , e ) ; } return retval ;
public class AbstractRadial { /** * Sets the orientation of the tickmark labels * @ param TICKLABEL _ ORIENTATION */ public void setTicklabelOrientation ( final TicklabelOrientation TICKLABEL_ORIENTATION ) { } }
getModel ( ) . setTicklabelOrienatation ( TICKLABEL_ORIENTATION ) ; init ( getInnerBounds ( ) . width , getInnerBounds ( ) . height ) ; repaint ( getInnerBounds ( ) ) ;
public class ExtensionKeyboard { /** * Gets the default accelerator of the given menu , taken into account duplicated default accelerators . * @ param menuItem the menu item to return the default accelerator * @ return the KeyStroke or { @ code null } if duplicated or does not have a default . */ private KeyStroke getDefaultAccelerator ( ZapMenuItem menuItem ) { } }
if ( isIdentifierWithDuplicatedAccelerator ( menuItem . getIdentifier ( ) ) ) { return null ; } return menuItem . getDefaultAccelerator ( ) ;
public class RPC { /** * Construct a client - side protocol proxy that contains a set of server * methods and a proxy object implementing the named protocol , * talking to a server at the named address . */ public static < T extends VersionedProtocol > ProtocolProxy < T > getProtocolProxy ( Class < T > protocol , long clientVersion , InetSocketAddress addr , Configuration conf , SocketFactory factory ) throws IOException { } }
UserGroupInformation ugi = null ; try { ugi = UserGroupInformation . login ( conf ) ; } catch ( LoginException le ) { throw new RuntimeException ( "Couldn't login!" ) ; } return getProtocolProxy ( protocol , clientVersion , addr , ugi , conf , factory ) ;
public class DeviceCapabilityTargeting { /** * Gets the excludedDeviceCapabilities value for this DeviceCapabilityTargeting . * @ return excludedDeviceCapabilities * Device capabilities that are being excluded by the { @ link LineItem } . */ public com . google . api . ads . admanager . axis . v201902 . Technology [ ] getExcludedDeviceCapabilities ( ) { } }
return excludedDeviceCapabilities ;
public class DelaunayTriangulation { /** * assumes v is an halfplane ! - returns another ( none halfplane ) triangle */ private static Triangle findnext2 ( Vector3 p , Triangle v ) { } }
if ( v . abnext != null && ! v . abnext . halfplane ) return v . abnext ; if ( v . bcnext != null && ! v . bcnext . halfplane ) return v . bcnext ; if ( v . canext != null && ! v . canext . halfplane ) return v . canext ; return null ;
public class JIT_Tie { /** * Adds the default ( no arg ) constructor . < p > * There are no exceptions in the throws clause ; none are required * for the constructors of EJB Wrappers ( local or remote ) . < p > * Currently , the generated method body is intentionally empty ; * EJB Wrappers require no initialization in the constructor . < p > * @ param cw ASM ClassWriter to add the constructor to . * @ param tieClassName fully qualified name of the Tie class * with ' / ' as the separator character * ( i . e . internal name ) . * @ param servantDescriptor fully qualified name of the servant * ( wrapper ) class with ' / ' as the separator * character ( i . e . internal name ) , and * wrapped with L ; ( jni style ) . */ private static void addCtor ( ClassWriter cw , String tieClassName , String parentClassName , String servantDescriptor ) { } }
MethodVisitor mv ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) Tr . debug ( tc , INDENT + "adding method : <init> ()V" ) ; // public < Class Name > _ Tie ( ) // target = null ; // orb = null ; mv = cw . visitMethod ( ACC_PUBLIC , "<init>" , "()V" , null , null ) ; mv . visitCode ( ) ; mv . visitVarInsn ( ALOAD , 0 ) ; mv . visitMethodInsn ( INVOKESPECIAL , parentClassName , "<init>" , "()V" ) ; mv . visitVarInsn ( ALOAD , 0 ) ; mv . visitInsn ( ACONST_NULL ) ; mv . visitFieldInsn ( PUTFIELD , tieClassName , "target" , servantDescriptor ) ; mv . visitVarInsn ( ALOAD , 0 ) ; mv . visitInsn ( ACONST_NULL ) ; mv . visitFieldInsn ( PUTFIELD , tieClassName , "orb" , "Lorg/omg/CORBA/ORB;" ) ; mv . visitInsn ( RETURN ) ; mv . visitMaxs ( 2 , 1 ) ; mv . visitEnd ( ) ;
public class Cryptography { /** * 获取文件的指定信息 * @ param filePath 文件路径 * @ param algorithm 算法 * @ return 字符串 */ private static String fileMessageDigest ( String filePath , String algorithm ) { } }
String result = null ; try { result = new ComputeTask ( ) . exec ( filePath , algorithm ) . get ( ) ; } catch ( Exception e ) { e . printStackTrace ( ) ; } return result ;
public class MemcachedNodesManager { /** * Can be used to determine if the given sessionId can be used to interact with memcached . * This also checks if the related memcached is available . * @ see # isValidForMemcached ( String ) */ public boolean canHitMemcached ( final String sessionId ) { } }
if ( isEncodeNodeIdInSessionId ( ) ) { final String nodeId = _sessionIdFormat . extractMemcachedId ( sessionId ) ; if ( nodeId == null ) { LOG . debug ( "The sessionId does not contain a nodeId so that the memcached node could not be identified." ) ; return false ; } if ( ! _nodeIdService . isNodeAvailable ( nodeId ) ) { LOG . debug ( "The node " + nodeId + " is not available, therefore " + sessionId + " cannot be loaded from this memcached." ) ; return false ; } } return true ;
public class ErrorLoggerManager { /** * Gets the error log * @ param name The logger name * @ return ErrorLogger */ public ErrorLogger getLog ( final String name ) { } }
return hasLog ( name ) ? logs . get ( name ) : null ;
public class Matchers { /** * Throwable matcher to be used with { @ link # isThrowable ( Class , Matcher ) } * @ see # isThrowable ( Class , Matcher ) * @ param message the message * @ param < T > the throwable type * @ return the matcher */ public static < T extends Throwable > Matcher < T > withMessage ( String message ) { } }
return IsThrowable . withMessage ( message ) ;
public class JsDestinationAddressFactoryImpl { /** * Create a JsDestinationAddress from the given parameters * @ param destinationName The name of the SIBus Destination * @ param localOnly Indicates that the Destination should be limited * to only the queue or mediation point on the Messaging * Engine that the application is connected to , if one * exists . If no such message point exists then the option * is ignored . * @ param localOnly Indicates that the Destination should be localized * to the local Messaging Engine . * @ param meId The Id of the Message Engine where the destination is localized * @ return JsDestinationAddress The JsDestinationAddress corresponding to the buffer contents . * @ exception NullPointerException Thrown if the destinationName parameter is null . */ public final JsDestinationAddress createJsDestinationAddress ( String destinationName , boolean localOnly , SIBUuid8 meId ) throws NullPointerException { } }
if ( destinationName == null ) { throw new NullPointerException ( "destinationName" ) ; } return new JsDestinationAddressImpl ( destinationName , localOnly , meId , null , false ) ;
public class ModelsImpl { /** * Adds a list to an existing closed list . * @ param appId The application ID . * @ param versionId The version ID . * @ param clEntityId The closed list entity extractor ID . * @ param wordListCreateObject Words list . * @ 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 < Integer > addSubListAsync ( UUID appId , String versionId , UUID clEntityId , WordListObject wordListCreateObject , final ServiceCallback < Integer > serviceCallback ) { } }
return ServiceFuture . fromResponse ( addSubListWithServiceResponseAsync ( appId , versionId , clEntityId , wordListCreateObject ) , serviceCallback ) ;
public class CommonOps_DDRM { /** * Multiplies every element in row i by value [ i ] . * @ param values array . Not modified . * @ param A Matrix . Modified . */ public static void multRows ( double [ ] values , DMatrixRMaj A ) { } }
if ( values . length < A . numRows ) { throw new IllegalArgumentException ( "Not enough elements in values." ) ; } int index = 0 ; for ( int row = 0 ; row < A . numRows ; row ++ ) { double v = values [ row ] ; for ( int col = 0 ; col < A . numCols ; col ++ , index ++ ) { A . data [ index ] *= v ; } }
public class PoiWorkSheet { /** * Create cell cell . * @ param value the value * @ return the cell */ public Cell createCell ( double value ) { } }
Cell cell = this . getNextCell ( CellType . NUMERIC ) ; cell . setCellValue ( value ) ; cell . setCellStyle ( this . style . getNumberCs ( ) ) ; return cell ;
public class ActionMarshaller { /** * Marshall the given parameter object . */ public void marshall ( Action action , ProtocolMarshaller protocolMarshaller ) { } }
if ( action == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( action . getActionType ( ) , ACTIONTYPE_BINDING ) ; protocolMarshaller . marshall ( action . getAwsApiCallAction ( ) , AWSAPICALLACTION_BINDING ) ; protocolMarshaller . marshall ( action . getDnsRequestAction ( ) , DNSREQUESTACTION_BINDING ) ; protocolMarshaller . marshall ( action . getNetworkConnectionAction ( ) , NETWORKCONNECTIONACTION_BINDING ) ; protocolMarshaller . marshall ( action . getPortProbeAction ( ) , PORTPROBEACTION_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
public class HttpTunnel { /** * handle method . * This method is called by the HttpConnection . handleNext ( ) method if * this HttpTunnel has been set on that connection . * The default implementation of this method copies between the HTTP * socket and the socket passed in the constructor . * @ param in * @ param out */ public void handle ( InputStream in , OutputStream out ) { } }
Copy copy = new Copy ( ) ; _in = in ; _out = out ; try { _thread = Thread . currentThread ( ) ; copy . start ( ) ; copydata ( _sIn , _out ) ; } catch ( Exception e ) { LogSupport . ignore ( log , e ) ; } finally { try { _in . close ( ) ; if ( _socket != null ) { _socket . shutdownOutput ( ) ; _socket . close ( ) ; } else { _sIn . close ( ) ; _sOut . close ( ) ; } } catch ( Exception e ) { LogSupport . ignore ( log , e ) ; } copy . interrupt ( ) ; }
public class SQLiteDatabase { /** * Gets default connection flags that are appropriate for this thread , taking into * account whether the thread is acting on behalf of the UI . * @ param readOnly True if the connection should be read - only . * @ return The connection flags . */ int getThreadDefaultConnectionFlags ( boolean readOnly ) { } }
int flags = readOnly ? SQLiteConnectionPool . CONNECTION_FLAG_READ_ONLY : SQLiteConnectionPool . CONNECTION_FLAG_PRIMARY_CONNECTION_AFFINITY ; if ( isMainThread ( ) ) { flags |= SQLiteConnectionPool . CONNECTION_FLAG_INTERACTIVE ; } return flags ;
public class JsonObject { /** * used by java serialization */ void writeObject ( java . io . ObjectOutputStream out ) throws IOException { } }
// when using object serialization , write the json bytes byte [ ] bytes = toString ( ) . getBytes ( StandardCharsets . UTF_8 ) ; out . writeInt ( bytes . length ) ; out . write ( bytes ) ;
public class LuisRuntimeManager { /** * Initializes an instance of Language Understanding ( LUIS ) Runtime API client . * @ param endpointAPI the endpoint API * @ param luisAuthoringKey the Language Understanding ( LUIS ) Authoring API key ( see https : / / www . luis . ai ) * @ return the Language Understanding Runtime API client */ public static LuisRuntimeAPI authenticate ( EndpointAPI endpointAPI , String luisAuthoringKey ) { } }
return authenticate ( String . format ( "https://%s/luis/v2.0/" , endpointAPI . toString ( ) ) , luisAuthoringKey ) . withEndpoint ( endpointAPI . toString ( ) ) ;
public class SimulatorSettings { /** * TODO use plist utils . */ private void writeOnDisk ( JSONObject plistJSON , File destination ) throws IOException , JSONException { } }
if ( destination . exists ( ) ) { // This is possible if we start with capability " reuseContentAndSettings " log . info ( destination + " already exists. Overwriting data" ) ; } // make sure the folder is ready for the plist file destination . getParentFile ( ) . mkdirs ( ) ; checkPlUtil ( ) ; File from = createTmpFile ( plistJSON ) ; List < String > command = new ArrayList < > ( ) ; command . add ( PLUTIL ) ; command . add ( "-convert" ) ; command . add ( "binary1" ) ; command . add ( "-o" ) ; command . add ( destination . getAbsolutePath ( ) ) ; command . add ( from . getAbsolutePath ( ) ) ; ProcessBuilder b = new ProcessBuilder ( command ) ; int i ; try { Process p = b . start ( ) ; i = p . waitFor ( ) ; } catch ( Exception e ) { throw new WebDriverException ( "failed to run " + command . toString ( ) , e ) ; } if ( i != 0 ) { throw new WebDriverException ( "conversion to binary plist failed. exitCode=" + i ) ; }
public class CachedObjectFactory { /** * { @ inheritDoc } */ @ Override // CHECKSTYLE : OFF public synchronized Object getObjectInstance ( Object obj , Name name , Context nameCtx , // NOPMD Hashtable < ? , ? > environment ) throws NamingException { } }
// NOPMD // CHECKSTYLE : ON final Reference reference = ( Reference ) obj ; final RefAddr jndiRefAddr = reference . get ( "jndi-ref" ) ; if ( jndiRefAddr == null ) { throw new NamingException ( "You must specify a 'jndi-ref' in the <Resource> tag" ) ; } final String jndiRef = ( String ) jndiRefAddr . getContent ( ) ; Object cachedObject = CACHED_OBJECTS . get ( jndiRef ) ; if ( cachedObject == null ) { final InitialContext context = new InitialContext ( ) ; cachedObject = context . lookup ( jndiRef ) ; if ( cachedObject == null ) { throw new NamingException ( "No jndi object found for the 'jndi-ref': " + jndiRef ) ; } CACHED_OBJECTS . put ( jndiRef , cachedObject ) ; } return cachedObject ;
public class AbstractElementFactory { /** * This method builds object from provided JSON * @ param json JSON for restored object * @ return restored object */ @ Override public T deserialize ( String json ) { } }
ObjectMapper mapper = SequenceElement . mapper ( ) ; try { T ret = ( T ) mapper . readValue ( json , targetClass ) ; return ret ; } catch ( IOException e ) { throw new RuntimeException ( e ) ; }
public class PreferenceFragment { /** * Returns , whether the divider , which is located above the dialog ' s buttons , should be shown , * or not . * @ return True , if the divider should be shown , false otherwise */ private boolean shouldButtonBarDividerBeShown ( ) { } }
SharedPreferences sharedPreferences = PreferenceManager . getDefaultSharedPreferences ( getActivity ( ) ) ; String key = getString ( R . string . show_button_bar_divider_preference_key ) ; boolean defaultValue = getResources ( ) . getBoolean ( R . bool . show_button_bar_divider_preference_default_value ) ; return sharedPreferences . getBoolean ( key , defaultValue ) ;
public class ConsumerFactory { /** * Base template for a resource representation . * Covers the resource attributes * @ param index * @ param plan * @ return */ public JavaType create ( ClassIndex index , ClassPlan plan ) { } }
// base class JavaInterfaceSource type = Roaster . parse ( JavaInterfaceSource . class , "public interface " + plan . getClassName ( ) + "Consumer<T extends " + plan . getClassName ( ) + "<T>> {}" ) ; type . setPackage ( plan . getPackageName ( ) ) ; type . addImport ( plan . getPackageName ( ) + "." + plan . getClassName ( ) ) ; type . addAnnotation ( FunctionalInterface . class ) ; addAccept ( type , plan ) ; addAndThen ( type , plan ) ; return type ;
public class I18nUtilities { /** * Get the locale currently in use . * @ return The currently active locale . */ public static Locale getEffectiveLocale ( ) { } }
Locale effectiveLocale = null ; UIContext uic = UIContextHolder . getCurrent ( ) ; if ( uic != null ) { effectiveLocale = uic . getLocale ( ) ; } if ( effectiveLocale == null ) { String defaultLocale = ConfigurationProperties . getDefaultLocale ( ) ; effectiveLocale = new Locale ( defaultLocale ) ; } // Don ' t use Locale . getDefault ( ) because it is too nebulous ( depends on host environment ) return effectiveLocale ;
public class SessionListener { /** * { @ inheritDoc } */ @ Override public void contextInitialized ( ServletContextEvent event ) { } }
final long start = System . currentTimeMillis ( ) ; // NOPMD // lecture de la propriété système java . io . tmpdir uniquement // pour lancer une java . security . AccessControlException si le SecurityManager est activé , // avant d ' avoir une ExceptionInInitializerError pour la classe Parameters System . getProperty ( "java.io.tmpdir" ) ; final String contextPath = Parameters . getContextPath ( event . getServletContext ( ) ) ; if ( ! instanceEnabled ) { if ( ! CONTEXT_PATHS . contains ( contextPath ) ) { // si jars dans tomcat / lib , il y a plusieurs instances mais dans des webapps différentes ( issue 193) instanceEnabled = true ; } else { return ; } } CONTEXT_PATHS . add ( contextPath ) ; Parameters . initialize ( event . getServletContext ( ) ) ; LOG . debug ( "JavaMelody listener init started" ) ; // on initialise le monitoring des DataSource jdbc même si cette initialisation // sera refaite dans MonitoringFilter au cas où ce listener ait été oublié dans web . xml final JdbcWrapper jdbcWrapper = JdbcWrapper . SINGLETON ; jdbcWrapper . initServletContext ( event . getServletContext ( ) ) ; if ( ! Parameters . isNoDatabase ( ) ) { jdbcWrapper . rebindDataSources ( ) ; } final long duration = System . currentTimeMillis ( ) - start ; LOG . debug ( "JavaMelody listener init done in " + duration + " ms" ) ;
public class XbaseSyntacticSequencer { /** * Syntax : */ @ Override protected void emit_XBlockExpression_SemicolonKeyword_2_1_q ( EObject semanticObject , ISynNavigable transition , List < INode > nodes ) { } }
if ( semicolonBeforeNextExpressionRequired ) { ILeafNode node = nodes != null && nodes . size ( ) == 1 && nodes . get ( 0 ) instanceof ILeafNode ? ( ILeafNode ) nodes . get ( 0 ) : null ; Keyword kw = grammarAccess . getXBlockExpressionAccess ( ) . getSemicolonKeyword_2_1 ( ) ; acceptUnassignedKeyword ( kw , kw . getValue ( ) , node ) ; } else acceptNodes ( transition , nodes ) ;
public class CmsContainerConfigurationCacheState { /** * Returns the base path for a given configuration file . * E . g . the result for the input ' / sites / default / . container - config ' will be ' / sites / default ' . < p > * @ param rootPath the root path of the configuration file * @ return the base path for the configuration file */ protected String getBasePath ( String rootPath ) { } }
if ( rootPath . endsWith ( INHERITANCE_CONFIG_FILE_NAME ) ) { return rootPath . substring ( 0 , rootPath . length ( ) - INHERITANCE_CONFIG_FILE_NAME . length ( ) ) ; } return rootPath ;
public class HiveRegistrationUnit { /** * Set storage parameters for a table / partition . * When using { @ link org . apache . gobblin . hive . metastore . HiveMetaStoreBasedRegister } , since it internally use * { @ link org . apache . hadoop . hive . metastore . api . Table } and { @ link org . apache . hadoop . hive . metastore . api . Partition } * which distinguishes between table / partition parameters , storage descriptor parameters , and serde parameters , * one may need to distinguish them when constructing a { @ link HiveRegistrationUnit } by using * { @ link # setProps ( State ) } , { @ link # setStorageProps ( State ) } and * { @ link # setSerDeProps ( State ) } . When using query - based Hive registration , they do not need to be * distinguished since all parameters will be passed via TBLPROPERTIES . */ public void setStorageProps ( State storageProps ) { } }
for ( String propKey : storageProps . getPropertyNames ( ) ) { setStorageProp ( propKey , storageProps . getProp ( propKey ) ) ; }
public class CmsSitemapTab { /** * Collects the structure ids belonging to open tree entries . < p > * @ return the collected set of structure ids */ Set < CmsUUID > getOpenItemIds ( ) { } }
Set < CmsUUID > result = new HashSet < CmsUUID > ( ) ; for ( CmsLazyTreeItem item : m_items ) { CmsSitemapEntryBean entryBean = item . getData ( ) ; if ( item . isOpen ( ) ) { result . add ( entryBean . getStructureId ( ) ) ; } } return result ;
public class TcpTransporter { /** * - - - GOSSIP RESPONSE MESSAGE RECEIVED - - - */ protected void processGossipResponse ( Tree data ) throws Exception { } }
// Debug if ( debugHeartbeats ) { String sender = data . get ( "sender" , ( String ) null ) ; logger . info ( "Gossip response received from \"" + sender + "\" node:\r\n" + data ) ; } // Online / offline nodes in responnse Tree online = data . get ( "online" ) ; Tree offline = data . get ( "offline" ) ; // Process " online " block if ( online != null ) { for ( Tree row : online ) { // Get nodeID String nodeID = row . getName ( ) ; if ( this . nodeID . equals ( nodeID ) ) { continue ; } int size = row . size ( ) ; if ( ! row . isEnumeration ( ) || size < 1 || size > 3 ) { logger . warn ( "Invalid \"offline\" block: " + row ) ; continue ; } // Get parameters from input Tree info = null ; long cpuSeq = 0 ; int cpu = 0 ; if ( row . size ( ) == 1 ) { info = row . get ( 0 ) ; } else if ( row . size ( ) == 2 ) { cpuSeq = row . get ( 0 ) . asLong ( ) ; cpu = row . get ( 1 ) . asInteger ( ) ; } else if ( row . size ( ) == 3 ) { info = row . get ( 0 ) ; cpuSeq = row . get ( 1 ) . asLong ( ) ; cpu = row . get ( 2 ) . asInteger ( ) ; } else { logger . warn ( "Invalid \"online\" block: " + row . toString ( false ) ) ; continue ; } if ( info != null ) { // Update " info " block , // send updated , connected or reconnected event updateNodeInfo ( nodeID , info ) ; } if ( cpuSeq > 0 ) { // We update our CPU info NodeDescriptor node = nodes . get ( nodeID ) ; if ( node != null ) { node . writeLock . lock ( ) ; try { node . updateCpu ( cpuSeq , cpu ) ; } finally { node . writeLock . unlock ( ) ; } } } } } // Process " offline " block if ( offline != null ) { for ( Tree row : offline ) { String nodeID = row . getName ( ) ; NodeDescriptor node ; if ( this . nodeID . equals ( nodeID ) ) { long seq = row . asLong ( ) ; node = getDescriptor ( ) ; node . writeLock . lock ( ) ; try { long newSeq = Math . max ( node . seq , seq + 1 ) ; if ( node . seq < newSeq ) { node . seq = newSeq ; node . info . put ( "seq" , newSeq ) ; } } finally { node . writeLock . unlock ( ) ; } continue ; } node = nodes . get ( nodeID ) ; if ( node == null ) { return ; } if ( ! row . isPrimitive ( ) ) { logger . warn ( "Invalid \"offline\" block: " + row ) ; continue ; } // Get parameters from input boolean disconnected = false ; node . writeLock . lock ( ) ; try { long seq = row . asLong ( ) ; if ( node . seq < seq && node . markAsOffline ( seq ) ) { // We know it is online , so we change it to offline // Remove remote actions and listeners registry . removeActions ( node . nodeID ) ; eventbus . removeListeners ( node . nodeID ) ; writer . close ( node . nodeID ) ; disconnected = true ; } } finally { node . writeLock . unlock ( ) ; } if ( node != null && disconnected ) { // Notify listeners ( not unexpected disconnection ) logger . info ( "Node \"" + node . nodeID + "\" disconnected." ) ; broadcastNodeDisconnected ( node . info , false ) ; } } }
public class Unchecked { /** * Returns a Supplier for the { @ code callable } that wraps and re - throws any checked Exception in a RuntimeException . */ static < T > Supplier < T > supplier ( Callable < T > callable ) { } }
return ( ) -> { try { return callable . call ( ) ; } catch ( Exception e ) { throw e instanceof RuntimeException ? ( RuntimeException ) e : new RuntimeException ( e ) ; } } ;
public class ConstructionNodeImpl { /** * TODO : explain */ private Stream < ImmutableSubstitution < ImmutableTerm > > splitSubstitution ( ImmutableSubstitution < ImmutableTerm > substitution , VariableGenerator variableGenerator ) { } }
ImmutableMultimap < Variable , Integer > functionSubTermMultimap = substitution . getImmutableMap ( ) . entrySet ( ) . stream ( ) . filter ( e -> e . getValue ( ) instanceof ImmutableFunctionalTerm ) . flatMap ( e -> { ImmutableList < ? extends ImmutableTerm > subTerms = ( ( ImmutableFunctionalTerm ) e . getValue ( ) ) . getTerms ( ) ; return IntStream . range ( 0 , subTerms . size ( ) ) . filter ( i -> subTerms . get ( i ) instanceof ImmutableFunctionalTerm ) . boxed ( ) . map ( i -> Maps . immutableEntry ( e . getKey ( ) , i ) ) ; } ) . collect ( ImmutableCollectors . toMultimap ( ) ) ; if ( functionSubTermMultimap . isEmpty ( ) ) return Stream . of ( substitution ) ; ImmutableTable < Variable , Integer , Variable > subTermNames = functionSubTermMultimap . entries ( ) . stream ( ) . map ( e -> Tables . immutableCell ( e . getKey ( ) , e . getValue ( ) , variableGenerator . generateNewVariable ( ) ) ) . collect ( ImmutableCollectors . toTable ( ) ) ; ImmutableMap < Variable , ImmutableTerm > parentSubstitutionMap = substitution . getImmutableMap ( ) . entrySet ( ) . stream ( ) . map ( e -> Optional . ofNullable ( functionSubTermMultimap . get ( e . getKey ( ) ) ) . map ( indexes -> { Variable v = e . getKey ( ) ; ImmutableFunctionalTerm def = ( ImmutableFunctionalTerm ) substitution . get ( v ) ; ImmutableList < ImmutableTerm > newArgs = IntStream . range ( 0 , def . getArity ( ) ) . boxed ( ) . map ( i -> Optional . ofNullable ( ( ImmutableTerm ) subTermNames . get ( v , i ) ) . orElseGet ( ( ) -> def . getTerm ( i ) ) ) . collect ( ImmutableCollectors . toList ( ) ) ; ImmutableTerm newDef = termFactory . getImmutableFunctionalTerm ( def . getFunctionSymbol ( ) , newArgs ) ; return Maps . immutableEntry ( v , newDef ) ; } ) . orElse ( e ) ) . collect ( ImmutableCollectors . toMap ( ) ) ; ImmutableSubstitution < ImmutableTerm > parentSubstitution = substitutionFactory . getSubstitution ( parentSubstitutionMap ) ; ImmutableSubstitution < ImmutableTerm > childSubstitution = substitutionFactory . getSubstitution ( subTermNames . cellSet ( ) . stream ( ) . collect ( ImmutableCollectors . toMap ( Table . Cell :: getValue , c -> ( ( ImmutableFunctionalTerm ) substitution . get ( c . getRowKey ( ) ) ) . getTerm ( c . getColumnKey ( ) ) ) ) ) ; return Stream . concat ( // Recursive splitSubstitution ( childSubstitution , variableGenerator ) , Stream . of ( parentSubstitution ) ) ;
public class XAResourceWrapperStatImpl { /** * { @ inheritDoc } */ public void start ( Xid xid , int flags ) throws XAException { } }
long l1 = System . currentTimeMillis ( ) ; try { super . start ( xid , flags ) ; } finally { xastat . deltaStart ( System . currentTimeMillis ( ) - l1 ) ; }
public class ArrayContainer { /** * running time is in O ( n ) time if insert is not in order . */ @ Override public Container add ( final short x ) { } }
if ( cardinality == 0 || ( cardinality > 0 && toIntUnsigned ( x ) > toIntUnsigned ( content [ cardinality - 1 ] ) ) ) { if ( cardinality >= DEFAULT_MAX_SIZE ) { return toBitmapContainer ( ) . add ( x ) ; } if ( cardinality >= this . content . length ) { increaseCapacity ( ) ; } content [ cardinality ++ ] = x ; } else { int loc = Util . unsignedBinarySearch ( content , 0 , cardinality , x ) ; if ( loc < 0 ) { // Transform the ArrayContainer to a BitmapContainer // when cardinality = DEFAULT _ MAX _ SIZE if ( cardinality >= DEFAULT_MAX_SIZE ) { return toBitmapContainer ( ) . add ( x ) ; } if ( cardinality >= this . content . length ) { increaseCapacity ( ) ; } // insertion : shift the elements > x by one position to // the right // and put x in it ' s appropriate place System . arraycopy ( content , - loc - 1 , content , - loc , cardinality + loc + 1 ) ; content [ - loc - 1 ] = x ; ++ cardinality ; } } return this ;
public class EmailApi { /** * Save email information to UCS * Save email information of interaction specified in the id path parameter * @ param id id of interaction to save ( required ) * @ param saveData Request parameters . ( optional ) * @ return ApiSuccessResponse * @ throws ApiException If fail to call the API , e . g . server error or cannot deserialize the response body */ public ApiSuccessResponse saveEmail ( String id , SaveData saveData ) throws ApiException { } }
ApiResponse < ApiSuccessResponse > resp = saveEmailWithHttpInfo ( id , saveData ) ; return resp . getData ( ) ;
public class AllocationRecorder { /** * Returns the size of the given object . If the object is not an array , we check the cache first , * and update it as necessary . * @ param obj the object . * @ param isArray indicates if the given object is an array . * @ param instr the instrumentation object to use for finding the object size * @ return the size of the given object . */ private static long getObjectSize ( Object obj , boolean isArray , Instrumentation instr ) { } }
if ( isArray ) { return instr . getObjectSize ( obj ) ; } Class < ? > clazz = obj . getClass ( ) ; Long classSize = classSizesMap . get ( clazz ) ; if ( classSize == null ) { classSize = instr . getObjectSize ( obj ) ; classSizesMap . put ( clazz , classSize ) ; } return classSize ;
public class WebSocketStreamHandler { /** * Gets a specific output stream using it ' s identified * @ param stream The stream to return * @ return The specified stream . */ public synchronized OutputStream getOutputStream ( int stream ) { } }
if ( ! output . containsKey ( stream ) ) { output . put ( stream , new WebSocketOutputStream ( stream ) ) ; } return output . get ( stream ) ;
public class AppServiceEnvironmentsInner { /** * Move an App Service Environment to a different VNET . * Move an App Service Environment to a different VNET . * @ param resourceGroupName Name of the resource group to which the resource belongs . * @ param name Name of the App Service Environment . * @ param vnetInfo Details for the new virtual network . * @ throws IllegalArgumentException thrown if parameters fail the validation * @ throws DefaultErrorResponseException thrown if the request is rejected by server * @ throws RuntimeException all other wrapped checked exceptions if the request fails to be sent * @ return the PagedList & lt ; SiteInner & gt ; object if successful . */ public PagedList < SiteInner > beginChangeVnet ( final String resourceGroupName , final String name , final VirtualNetworkProfile vnetInfo ) { } }
ServiceResponse < Page < SiteInner > > response = beginChangeVnetSinglePageAsync ( resourceGroupName , name , vnetInfo ) . toBlocking ( ) . single ( ) ; return new PagedList < SiteInner > ( response . body ( ) ) { @ Override public Page < SiteInner > nextPage ( String nextPageLink ) { return beginChangeVnetNextSinglePageAsync ( nextPageLink ) . toBlocking ( ) . single ( ) . body ( ) ; } } ;
public class HijriCalendar { /** * / * [ deutsch ] * < p > Erzeugt ein neues Hijri - Kalenderdatum in der angegebenen Variante . < / p > * @ param variant calendar variant * @ param hyear islamic year * @ param hmonth islamic month * @ param hdom islamic day of month * @ return new instance of { @ code HijriCalendar } * @ throws ChronoException if given variant is not supported * @ throws IllegalArgumentException in case of any inconsistencies * @ since 3.5/4.3 */ public static HijriCalendar of ( String variant , int hyear , HijriMonth hmonth , int hdom ) { } }
return HijriCalendar . of ( variant , hyear , hmonth . getValue ( ) , hdom ) ;
public class WaspError { /** * HTTP response body parsed via provided { @ code type } . { @ code null } if there is no response * or no body . * @ throws RuntimeException if unable to convert the body to the provided { @ code type } . */ public Object getBodyAs ( Type type ) { } }
if ( response == null ) { return null ; } String body = response . getBody ( ) ; if ( TextUtils . isEmpty ( body ) ) { return null ; } try { return Wasp . getParser ( ) . fromBody ( response . getBody ( ) , type ) ; } catch ( Exception e ) { throw new RuntimeException ( e ) ; }
public class ListManagementImagesImpl { /** * Add an image to the list with list Id equal to list Id passed . * @ param listId List Id of the image list . * @ param contentType The content type . * @ param imageUrl The image url . * @ param tag Tag for the image . * @ param label The image label . * @ throws IllegalArgumentException thrown if parameters fail the validation * @ return the observable to the Image object */ public Observable < ServiceResponse < Image > > addImageUrlInputWithServiceResponseAsync ( String listId , String contentType , BodyModelModel imageUrl , Integer tag , String label ) { } }
if ( this . client . baseUrl ( ) == null ) { throw new IllegalArgumentException ( "Parameter this.client.baseUrl() is required and cannot be null." ) ; } if ( listId == null ) { throw new IllegalArgumentException ( "Parameter listId is required and cannot be null." ) ; } if ( contentType == null ) { throw new IllegalArgumentException ( "Parameter contentType is required and cannot be null." ) ; } if ( imageUrl == null ) { throw new IllegalArgumentException ( "Parameter imageUrl is required and cannot be null." ) ; } Validator . validate ( imageUrl ) ; String parameterizedHost = Joiner . on ( ", " ) . join ( "{baseUrl}" , this . client . baseUrl ( ) ) ; return service . addImageUrlInput ( listId , tag , label , contentType , imageUrl , this . client . acceptLanguage ( ) , parameterizedHost , this . client . userAgent ( ) ) . flatMap ( new Func1 < Response < ResponseBody > , Observable < ServiceResponse < Image > > > ( ) { @ Override public Observable < ServiceResponse < Image > > call ( Response < ResponseBody > response ) { try { ServiceResponse < Image > clientResponse = addImageUrlInputDelegate ( response ) ; return Observable . just ( clientResponse ) ; } catch ( Throwable t ) { return Observable . error ( t ) ; } } } ) ;
public class SqlFunctionUtils { /** * Split target string with custom separator and pick the index - th ( start with 0 ) result . * @ param str target string . * @ param character int value of the separator character * @ param index index of the result which you want . * @ return the string at the index of split results . */ public static String splitIndex ( String str , int character , int index ) { } }
if ( character > 255 || character < 1 || index < 0 ) { return null ; } String [ ] values = StringUtils . splitPreserveAllTokens ( str , ( char ) character ) ; if ( index >= values . length ) { return null ; } else { return values [ index ] ; }
public class ZoneFallbackIterator { /** * Returns the next zone from the set excluding the given zone which should * get the request . * @ return - the next zone in the iterator . If there are none then null is * returned . */ public String next ( String ignoreZone ) { } }
if ( entry == null ) return null ; entry = entry . next ; if ( entry . element . equals ( ignoreZone ) ) { return entry . next . element ; } else { return entry . element ; }
public class NameGenerator { /** * Returns a unique string which identifies the object instance . Invocations * are cached so that if an object has been previously passed into this * method then the same identifier is returned . * @ param instance * object used to generate string * @ return a unique string representing the object */ public String instanceName ( Object instance ) { } }
if ( instance == null ) { return "null" ; } if ( instance instanceof Class ) { return unqualifiedClassName ( ( Class < ? > ) instance ) ; } else { String result = valueToName . get ( instance ) ; if ( result != null ) { return result ; } Class < ? > type = instance . getClass ( ) ; String className = unqualifiedClassName ( type ) ; Integer size = nameToCount . get ( className ) ; int instanceNumber = ( size == null ) ? 0 : ( size ) . intValue ( ) + 1 ; nameToCount . put ( className , new Integer ( instanceNumber ) ) ; result = className + instanceNumber ; valueToName . put ( instance , result ) ; return result ; }
public class XMLProcessor { /** * Does nothing if only one of nodes1 or nodes2 contains more than zero nodes . Throws InvalidCfgDocException otherwise . * @ param nodes1 * @ param nodes2 * @ param nodeTypeForDebugging * @ throws XMLParsingException */ public static void xorCheck ( final Nodes nodes1 , final Nodes nodes2 , final String nodeTypeForDebugging ) throws XMLParsingException { } }
if ( nodes1 . size ( ) > 0 && nodes2 . size ( ) > 0 ) { throw new XMLParsingException ( "Message contains more than one " + nodeTypeForDebugging + " node. Only one permitted." ) ; }
public class dnszone_binding { /** * Use this API to fetch dnszone _ binding resource of given name . */ public static dnszone_binding get ( nitro_service service , String zonename ) throws Exception { } }
dnszone_binding obj = new dnszone_binding ( ) ; obj . set_zonename ( zonename ) ; dnszone_binding response = ( dnszone_binding ) obj . get_resource ( service ) ; return response ;
public class Op { /** * Indicates whether ` x ` is within the boundaries ( open or closed ) * @ param x is the value * @ param min is the minimum of the range * @ param max is the maximum of the range * @ param geq determines whether the maximum is a closed interval * @ param leq determines whether the minimum is a closed interval * @ return ` \ begin { cases } x \ in [ \ min , \ max ] & \ mbox { if $ geq \ wedge leq $ } * \ cr x \ in ( \ min , \ max ] & \ mbox { if $ geq \ wedge \ bar { leq } $ } \ cr x \ in [ \ min , * \ max ) & \ mbox { if $ \ bar { geq } \ wedge leq $ } \ cr x \ in ( \ min , \ max ) & \ mbox { if * $ \ bar { geq } \ wedge \ bar { leq } $ } \ cr \ end { cases } */ public static boolean in ( double x , double min , double max , boolean geq , boolean leq ) { } }
boolean left = geq ? isGE ( x , min ) : isGt ( x , min ) ; boolean right = leq ? isLE ( x , max ) : isLt ( x , max ) ; return ( left && right ) ;
public class AWSSupportClient { /** * Adds one or more attachments to an attachment set . If an < code > attachmentSetId < / code > is not specified , a new * attachment set is created , and the ID of the set is returned in the response . If an < code > attachmentSetId < / code > * is specified , the attachments are added to the specified set , if it exists . * An attachment set is a temporary container for attachments that are to be added to a case or case communication . * The set is available for one hour after it is created ; the < code > expiryTime < / code > returned in the response * indicates when the set expires . The maximum number of attachments in a set is 3 , and the maximum size of any * attachment in the set is 5 MB . * @ param addAttachmentsToSetRequest * @ return Result of the AddAttachmentsToSet operation returned by the service . * @ throws InternalServerErrorException * An internal server error occurred . * @ throws AttachmentSetIdNotFoundException * An attachment set with the specified ID could not be found . * @ throws AttachmentSetExpiredException * The expiration time of the attachment set has passed . The set expires 1 hour after it is created . * @ throws AttachmentSetSizeLimitExceededException * A limit for the size of an attachment set has been exceeded . The limits are 3 attachments and 5 MB per * attachment . * @ throws AttachmentLimitExceededException * The limit for the number of attachment sets created in a short period of time has been exceeded . * @ sample AWSSupport . AddAttachmentsToSet * @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / support - 2013-04-15 / AddAttachmentsToSet " target = " _ top " > AWS * API Documentation < / a > */ @ Override public AddAttachmentsToSetResult addAttachmentsToSet ( AddAttachmentsToSetRequest request ) { } }
request = beforeClientExecution ( request ) ; return executeAddAttachmentsToSet ( request ) ;
public class Invocable { /** * Abstraction to cleanly apply the primitive result wrapping . * @ param base represents the base object instance . * @ param pars parameter arguments * @ return invocation result * @ throws InvocationTargetException wrapped target exceptions */ public synchronized Object invoke ( Object base , Object ... pars ) throws InvocationTargetException { } }
if ( null == pars ) pars = Reflect . ZERO_ARGS ; try { return Primitive . wrap ( invokeTarget ( base , pars ) , getReturnType ( ) ) ; } catch ( Throwable ite ) { throw new InvocationTargetException ( ite ) ; }
public class Connect { /** * Trims an Fst , removing states and arcs that are not on successful paths . * @ param fst the fst to trim */ public static void apply ( MutableFst fst ) { } }
fst . throwIfInvalid ( ) ; IntOpenHashSet accessible = new IntOpenHashSet ( fst . getStateCount ( ) ) ; IntOpenHashSet coaccessible = new IntOpenHashSet ( fst . getStateCount ( ) ) ; dfsForward ( fst . getStartState ( ) , accessible ) ; int numStates = fst . getStateCount ( ) ; for ( int i = 0 ; i < numStates ; i ++ ) { MutableState s = fst . getState ( i ) ; if ( fst . getSemiring ( ) . isNotZero ( s . getFinalWeight ( ) ) ) { dfsBackward ( s , coaccessible ) ; } } if ( accessible . size ( ) == fst . getStateCount ( ) && coaccessible . size ( ) == fst . getStateCount ( ) ) { // common case , optimization bail early return ; } ArrayList < MutableState > toDelete = new ArrayList < > ( ) ; int startId = fst . getStartState ( ) . getId ( ) ; for ( int i = 0 ; i < numStates ; i ++ ) { MutableState s = fst . getState ( i ) ; if ( s . getId ( ) == startId ) { continue ; // cant delete the start state } if ( ! accessible . contains ( s . getId ( ) ) || ! coaccessible . contains ( s . getId ( ) ) ) { toDelete . add ( s ) ; } } fst . deleteStates ( toDelete ) ;
public class EdgeRcClientCredentialProvider { /** * Loads an EdgeRc configuration file and returns an { @ link EdgeRcClientCredentialProvider } to * read { @ link ClientCredential } s from it . * @ param inputStream an open { @ link InputStream } to an EdgeRc file * @ param section a config section ( { @ code null } for the default section ) * @ return a { @ link EdgeRcClientCredentialProvider } * @ throws ConfigurationException If an error occurs while reading the configuration * @ throws IOException if an I / O error occurs */ public static EdgeRcClientCredentialProvider fromEdgeRc ( InputStream inputStream , String section ) throws ConfigurationException , IOException { } }
Objects . requireNonNull ( inputStream , "inputStream cannot be null" ) ; return fromEdgeRc ( new InputStreamReader ( inputStream ) , section ) ;
public class CMM_GTAnalysis { /** * TODO : Cache the connection value for a point to the different clusters ? ? ? */ protected double getConnectionValue ( CMMPoint cmmp , int clusterID ) { } }
AutoExpandVector < Double > knnDist = new AutoExpandVector < Double > ( ) ; AutoExpandVector < Integer > knnPointIndex = new AutoExpandVector < Integer > ( ) ; // calculate the knn distance of the point to the cluster getKnnInCluster ( cmmp , knnNeighbourhood , gt0Clusters . get ( clusterID ) . points , knnDist , knnPointIndex ) ; // TODO : What to do if we have less then k neighbors ? double avgDist = 0 ; for ( int i = 0 ; i < knnDist . size ( ) ; i ++ ) { avgDist += knnDist . get ( i ) ; } // what to do if we only have a single point ? ? ? if ( knnDist . size ( ) != 0 ) avgDist /= knnDist . size ( ) ; else return 0 ; // get the upper knn distance of the cluster double upperKnn = gt0Clusters . get ( clusterID ) . knnMeanAvg + gt0Clusters . get ( clusterID ) . knnDevAvg ; /* calculate the connectivity based on knn distance of the point within the cluster and the upper knn distance of the cluster */ if ( avgDist < upperKnn ) { return 1 ; } else { // value that should be reached at upperKnn distance // Choose connection formula double conn ; if ( useExpConnectivity ) conn = Math . pow ( 2 , - lamdaConn * ( avgDist - upperKnn ) / upperKnn ) ; else conn = upperKnn / avgDist ; if ( Double . isNaN ( conn ) ) System . out . println ( "Connectivity NaN at " + cmmp . p . getTimestamp ( ) ) ; return conn ; }
public class MiniCluster { /** * Factory method to instantiate the RPC service . * @ param akkaRpcServiceConfig * The default RPC timeout for asynchronous " ask " requests . * @ param remoteEnabled * True , if the RPC service should be reachable from other ( remote ) RPC services . * @ param bindAddress * The address to bind the RPC service to . Only relevant when " remoteEnabled " is true . * @ return The instantiated RPC service */ protected RpcService createRpcService ( AkkaRpcServiceConfiguration akkaRpcServiceConfig , boolean remoteEnabled , String bindAddress ) { } }
final Config akkaConfig ; if ( remoteEnabled ) { akkaConfig = AkkaUtils . getAkkaConfig ( akkaRpcServiceConfig . getConfiguration ( ) , bindAddress , 0 ) ; } else { akkaConfig = AkkaUtils . getAkkaConfig ( akkaRpcServiceConfig . getConfiguration ( ) ) ; } final Config effectiveAkkaConfig = AkkaUtils . testDispatcherConfig ( ) . withFallback ( akkaConfig ) ; final ActorSystem actorSystem = AkkaUtils . createActorSystem ( effectiveAkkaConfig ) ; return new AkkaRpcService ( actorSystem , akkaRpcServiceConfig ) ;
public class LayersModelImpl { /** * Return the layer at a certain index . If the index can ' t be found , null is returned . * @ param index * The specified index . * @ return Returns the layer , or null if the index can ' t be found . */ public Layer getLayerAt ( int index ) { } }
org . geomajas . gwt . client . map . layer . Layer < ? > layer = mapModel . getLayers ( ) . get ( index ) ; if ( layer instanceof org . geomajas . gwt . client . map . layer . VectorLayer ) { return new VectorLayer ( ( org . geomajas . gwt . client . map . layer . VectorLayer ) layer ) ; } return new LayerImpl ( layer ) ;
public class ExcelReader { /** * Parses the content of one sheet using the specified styles and shared - strings tables . * @ param styles a { @ link StylesTable } object * @ param sharedStringsTable a { @ link ReadOnlySharedStringsTable } object * @ param sheetInputStream a { @ link InputStream } object * @ throws IOException * @ throws ParserConfigurationException * @ throws SAXException */ private void readSheet ( StylesTable styles , ReadOnlySharedStringsTable sharedStringsTable , InputStream sheetInputStream ) throws IOException , ParserConfigurationException , SAXException { } }
SAXParserFactory saxFactory = SAXParserFactory . newInstance ( ) ; XMLReader sheetParser = saxFactory . newSAXParser ( ) . getXMLReader ( ) ; ContentHandler handler = new XSSFSheetXMLHandler ( styles , sharedStringsTable , sheetContentsHandler , true ) ; sheetParser . setContentHandler ( handler ) ; sheetParser . parse ( new InputSource ( sheetInputStream ) ) ;
public class PageOverlayConditionalProcessingImpl { /** * < ! - - begin - user - doc - - > * < ! - - end - user - doc - - > * @ generated */ @ Override public void eSet ( int featureID , Object newValue ) { } }
switch ( featureID ) { case AfplibPackage . PAGE_OVERLAY_CONDITIONAL_PROCESSING__PG_OV_TYPE : setPgOvType ( ( Integer ) newValue ) ; return ; case AfplibPackage . PAGE_OVERLAY_CONDITIONAL_PROCESSING__LEVEL : setLevel ( ( Integer ) newValue ) ; return ; } super . eSet ( featureID , newValue ) ;
public class CmsContentEditorHandler { /** * Gets the editor context to use for the Acacia editor . < p > * @ return the editor context */ CmsEditorContext getEditorContext ( ) { } }
CmsEditorContext result = new CmsEditorContext ( ) ; result . getPublishParameters ( ) . put ( CmsPublishOptions . PARAM_CONTAINERPAGE , "" + CmsCoreProvider . get ( ) . getStructureId ( ) ) ; result . getPublishParameters ( ) . put ( CmsPublishOptions . PARAM_DETAIL , "" + CmsContainerpageController . get ( ) . getData ( ) . getDetailId ( ) ) ; result . getPublishParameters ( ) . put ( CmsPublishOptions . PARAM_START_WITH_CURRENT_PAGE , "" ) ; return result ;
public class UpdateGlobalTableRequest { /** * A list of regions that should be added or removed from the global table . * @ param replicaUpdates * A list of regions that should be added or removed from the global table . */ public void setReplicaUpdates ( java . util . Collection < ReplicaUpdate > replicaUpdates ) { } }
if ( replicaUpdates == null ) { this . replicaUpdates = null ; return ; } this . replicaUpdates = new java . util . ArrayList < ReplicaUpdate > ( replicaUpdates ) ;
public class CommandActionSupport { /** * Discover the completer for the command . * @ since 3.0 */ @ Nonnull protected Completer discoverCompleter ( ) { } }
log . debug ( "Discovering completer" ) ; // TODO : Could probably use CliProcessorAware to avoid re - creating this CliProcessor cli = new CliProcessor ( ) ; cli . addBean ( this ) ; List < ArgumentDescriptor > argumentDescriptors = cli . getArgumentDescriptors ( ) ; Collections . sort ( argumentDescriptors ) ; if ( log . isDebugEnabled ( ) ) { log . debug ( "Argument descriptors:" ) ; argumentDescriptors . forEach ( descriptor -> log . debug ( " {}" , descriptor ) ) ; } List < Completer > completers = new LinkedList < > ( ) ; // attempt to resolve @ Complete on each argument argumentDescriptors . forEach ( descriptor -> { AccessibleObject accessible = descriptor . getSetter ( ) . getAccessible ( ) ; if ( accessible != null ) { Complete complete = accessible . getAnnotation ( Complete . class ) ; if ( complete != null ) { Completer completer = namedCompleters . get ( complete . value ( ) ) ; checkState ( completer != null , "Missing named completer: %s" , complete . value ( ) ) ; completers . add ( completer ) ; } } } ) ; // short - circuit if no completers detected if ( completers . isEmpty ( ) ) { return NullCompleter . INSTANCE ; } if ( log . isDebugEnabled ( ) ) { log . debug ( "Discovered completers:" ) ; completers . forEach ( completer -> { log . debug ( " {}" , completer ) ; } ) ; } // append terminal completer for strict completers . add ( NullCompleter . INSTANCE ) ; ArgumentCompleter completer = new ArgumentCompleter ( completers ) ; completer . setStrict ( true ) ; return completer ;
public class ModelsImpl { /** * Update an entity role for a given entity . * @ param appId The application ID . * @ param versionId The version ID . * @ param entityId The entity ID . * @ param roleId The entity role ID . * @ param updatePrebuiltEntityRoleOptionalParameter the object representing the optional parameters to be set before calling this API * @ throws IllegalArgumentException thrown if parameters fail the validation * @ return the observable to the OperationStatus object */ public Observable < ServiceResponse < OperationStatus > > updatePrebuiltEntityRoleWithServiceResponseAsync ( UUID appId , String versionId , UUID entityId , UUID roleId , UpdatePrebuiltEntityRoleOptionalParameter updatePrebuiltEntityRoleOptionalParameter ) { } }
if ( this . client . endpoint ( ) == null ) { throw new IllegalArgumentException ( "Parameter this.client.endpoint() is required and cannot be null." ) ; } if ( appId == null ) { throw new IllegalArgumentException ( "Parameter appId is required and cannot be null." ) ; } if ( versionId == null ) { throw new IllegalArgumentException ( "Parameter versionId is required and cannot be null." ) ; } if ( entityId == null ) { throw new IllegalArgumentException ( "Parameter entityId is required and cannot be null." ) ; } if ( roleId == null ) { throw new IllegalArgumentException ( "Parameter roleId is required and cannot be null." ) ; } final String name = updatePrebuiltEntityRoleOptionalParameter != null ? updatePrebuiltEntityRoleOptionalParameter . name ( ) : null ; return updatePrebuiltEntityRoleWithServiceResponseAsync ( appId , versionId , entityId , roleId , name ) ;
public class DenyAssignmentsInner { /** * Gets deny assignments for a scope . * @ param nextPageLink The NextLink from the previous successful call to List operation . * @ throws IllegalArgumentException thrown if parameters fail the validation * @ throws CloudException thrown if the request is rejected by server * @ throws RuntimeException all other wrapped checked exceptions if the request fails to be sent * @ return the PagedList & lt ; DenyAssignmentInner & gt ; object if successful . */ public PagedList < DenyAssignmentInner > listForScopeNext ( final String nextPageLink ) { } }
ServiceResponse < Page < DenyAssignmentInner > > response = listForScopeNextSinglePageAsync ( nextPageLink ) . toBlocking ( ) . single ( ) ; return new PagedList < DenyAssignmentInner > ( response . body ( ) ) { @ Override public Page < DenyAssignmentInner > nextPage ( String nextPageLink ) { return listForScopeNextSinglePageAsync ( nextPageLink ) . toBlocking ( ) . single ( ) . body ( ) ; } } ;
public class CSKLR { /** * Computes the margin score for the given data point * @ param x the input vector * @ return the margin score */ private double getPreScore ( Vec x ) { } }
return k . evalSum ( vecs , accelCache , alpha . getBackingArray ( ) , x , 0 , alpha . size ( ) ) ;
public class SourceContextPlugin { /** * inject source - context into the META - INF directory of a jar or war */ private void configureArchiveTask ( AbstractArchiveTask archiveTask ) { } }
if ( archiveTask == null ) { return ; } archiveTask . dependsOn ( "_createSourceContext" ) ; archiveTask . from ( extension . getOutputDirectory ( ) , copySpec -> copySpec . into ( "WEB-INF/classes" ) ) ;