signature
stringlengths 43
39.1k
| implementation
stringlengths 0
450k
|
|---|---|
public class JPAPCtxtInjectionBinding { /** * This transient PersistenceContext annotation class has no default value .
* i . e . null is a valid value for some fields . */
private static PersistenceContext newPersistenceContext ( final String fJndiName , final String fUnitName , final int fCtxType , final List < Property > fCtxProperties ) { } }
|
return new PersistenceContext ( ) { @ Override public Class < ? extends Annotation > annotationType ( ) { return PersistenceContext . class ; } @ Override public String name ( ) { return fJndiName ; } @ Override public PersistenceProperty [ ] properties ( ) { // TODO not ideal doing this conversion processing here
PersistenceProperty [ ] props = new PersistenceProperty [ fCtxProperties . size ( ) ] ; int i = 0 ; for ( Property property : fCtxProperties ) { final String name = property . getName ( ) ; final String value = property . getValue ( ) ; PersistenceProperty prop = new PersistenceProperty ( ) { @ Override public Class < ? extends Annotation > annotationType ( ) { return PersistenceProperty . class ; } @ Override public String name ( ) { return name ; } @ Override public String value ( ) { return value ; } } ; props [ i ++ ] = prop ; } return props ; } @ Override public PersistenceContextType type ( ) { if ( fCtxType == PersistenceContextRef . TYPE_TRANSACTION ) { return PersistenceContextType . TRANSACTION ; } else { return PersistenceContextType . EXTENDED ; } } @ Override public String unitName ( ) { return fUnitName ; } @ Override public String toString ( ) { return "JPA.PersistenceContext(name=" + fJndiName + ", unitName=" + fUnitName + ")" ; } } ;
|
public class SpringUtilities { /** * A debugging utility that prints to stdout the component ' s
* minimum , preferred , and maximum sizes . */
public static void printSizes ( Component c ) { } }
|
System . out . println ( "minimumSize = " + c . getMinimumSize ( ) ) ; System . out . println ( "preferredSize = " + c . getPreferredSize ( ) ) ; System . out . println ( "maximumSize = " + c . getMaximumSize ( ) ) ;
|
public class DOM2DTM { /** * A document type declaration information item has the following properties :
* 1 . [ system identifier ] The system identifier of the external subset , if
* it exists . Otherwise this property has no value .
* @ return the system identifier String object , or null if there is none . */
public String getDocumentTypeDeclarationSystemIdentifier ( ) { } }
|
Document doc ; if ( m_root . getNodeType ( ) == Node . DOCUMENT_NODE ) doc = ( Document ) m_root ; else doc = m_root . getOwnerDocument ( ) ; if ( null != doc ) { DocumentType dtd = doc . getDoctype ( ) ; if ( null != dtd ) { return dtd . getSystemId ( ) ; } } return null ;
|
public class EphemerisTileSkin { /** * * * * * * Resizing * * * * * */
@ Override protected void resizeDynamicText ( ) { } }
|
double fontSize = size * TextSize . SMALL . factor ; Font font = Fonts . latoRegular ( fontSize ) ; blueHourSunriseText . setFont ( font ) ; sunriseText . setFont ( font ) ; goldenHourSunriseText . setFont ( font ) ; goldenHourSunsetText . setFont ( font ) ; sunsetText . setFont ( font ) ; blueHourSunsetText . setFont ( font ) ; fontSize = size * TextSize . SMALLER . factor ; font = Fonts . latoRegular ( fontSize ) ; blueHourTitleMorning . setFont ( font ) ; sunriseTitle . setFont ( font ) ; goldenHourTitleMorning . setFont ( font ) ; goldenHourTitleEvening . setFont ( font ) ; sunsetTitle . setFont ( font ) ; blueHourTitleEvening . setFont ( font ) ;
|
public class AutomaticScaling { /** * < pre >
* Target scaling by network usage .
* < / pre >
* < code > . google . appengine . v1 . NetworkUtilization network _ utilization = 12 ; < / code > */
public com . google . appengine . v1 . NetworkUtilization getNetworkUtilization ( ) { } }
|
return networkUtilization_ == null ? com . google . appengine . v1 . NetworkUtilization . getDefaultInstance ( ) : networkUtilization_ ;
|
public class MainFooterPanel { /** * Left toolbar for alerts */
private JToolBar getToolbarLeft ( ) { } }
|
if ( footerToolbarLeft == null ) { footerToolbarLeft = new JToolBar ( ) ; footerToolbarLeft . setEnabled ( true ) ; footerToolbarLeft . setFloatable ( false ) ; footerToolbarLeft . setRollover ( true ) ; footerToolbarLeft . setName ( "Footer Toolbar Left" ) ; footerToolbarLeft . setBorder ( BorderFactory . createEmptyBorder ( ) ) ; } return footerToolbarLeft ;
|
public class XsdAnnotationEmitter { /** * Adds the COXB namespace and associated prefixes to the XML schema . */
protected void addNamespaceContext ( ) { } }
|
NamespaceMap prefixmap = new NamespaceMap ( ) ; NamespacePrefixList npl = getXsd ( ) . getNamespaceContext ( ) ; if ( npl == null ) { /* We get an NPE if we don ' t add this . */
prefixmap . add ( "" , XMLConstants . W3C_XML_SCHEMA_NS_URI ) ; } else { for ( int i = 0 ; i < npl . getDeclaredPrefixes ( ) . length ; i ++ ) { prefixmap . add ( npl . getDeclaredPrefixes ( ) [ i ] , npl . getNamespaceURI ( npl . getDeclaredPrefixes ( ) [ i ] ) ) ; } } prefixmap . add ( getCOXBNamespacePrefix ( ) , getCOXBNamespace ( ) ) ; getXsd ( ) . setNamespaceContext ( prefixmap ) ;
|
public class FileUtils { public static void writeCompletely ( WritableByteChannel channel , ByteBuffer src ) throws IOException { } }
|
while ( src . hasRemaining ( ) ) { channel . write ( src ) ; }
|
public class RootAndNestedDTOResourceGenerator { /** * Creates a collection of DTOs for the provided JPA entity , and any JPA entities referenced in the JPA entity .
* @ param entity The JPA entity for which DTOs are to be generated
* @ param dtoPackage The Java package in which the DTOs are to be created
* @ return The { @ link DTOCollection } containing the DTOs created for the JPA entity . */
public DTOCollection from ( Project project , JavaClass < ? > entity , String dtoPackage ) { } }
|
DTOCollection dtoCollection = new DTOCollection ( ) ; if ( entity == null ) { throw new IllegalArgumentException ( "The argument entity was null." ) ; } generatedDTOGraphForEntity ( project , entity , dtoPackage , true , false , dtoCollection ) ; return dtoCollection ;
|
public class Utils4J { /** * Concatenate a path and a filename taking < code > null < / code > and empty string values into account .
* @ param path
* Path - Can be < code > null < / code > or an empty string .
* @ param filename
* Filename - Cannot be < code > null < / code > .
* @ param separator
* Separator for directories - Can be < code > null < / code > or an empty string .
* @ return Path and filename divided by the separator . */
public static String concatPathAndFilename ( final String path , final String filename , final String separator ) { } }
|
checkNotNull ( "filename" , filename ) ; checkNotNull ( "separator" , separator ) ; checkNotEmpty ( "separator" , separator ) ; if ( path == null ) { return filename ; } final String trimmedPath = path . trim ( ) ; if ( trimmedPath . length ( ) == 0 ) { return filename ; } final String trimmedFilename = filename . trim ( ) ; if ( trimmedPath . endsWith ( separator ) ) { return trimmedPath + trimmedFilename ; } return trimmedPath + separator + trimmedFilename ;
|
public class RelationalOperationsMatrix { /** * Invokes the 9 relational predicates of Line vs Line . */
private boolean lineLinePredicates_ ( int half_edge , int id_a , int id_b ) { } }
|
boolean bRelationKnown = true ; if ( m_perform_predicates [ MatrixPredicate . InteriorInterior ] ) { interiorLineInteriorLine_ ( half_edge , id_a , id_b , m_cluster_index_a , m_cluster_index_b ) ; bRelationKnown &= isPredicateKnown_ ( MatrixPredicate . InteriorInterior ) ; } if ( m_perform_predicates [ MatrixPredicate . InteriorBoundary ] ) { interiorLineBoundaryLine_ ( half_edge , id_a , id_b , m_cluster_index_a , m_cluster_index_b , MatrixPredicate . InteriorBoundary ) ; bRelationKnown &= isPredicateKnown_ ( MatrixPredicate . InteriorBoundary ) ; } if ( m_perform_predicates [ MatrixPredicate . InteriorExterior ] ) { interiorLineExteriorLine_ ( half_edge , id_a , id_b , MatrixPredicate . InteriorExterior ) ; bRelationKnown &= isPredicateKnown_ ( MatrixPredicate . InteriorExterior ) ; } if ( m_perform_predicates [ MatrixPredicate . BoundaryInterior ] ) { interiorLineBoundaryLine_ ( half_edge , id_b , id_a , m_cluster_index_b , m_cluster_index_a , MatrixPredicate . BoundaryInterior ) ; bRelationKnown &= isPredicateKnown_ ( MatrixPredicate . BoundaryInterior ) ; } if ( m_perform_predicates [ MatrixPredicate . BoundaryBoundary ] ) { boundaryLineBoundaryLine_ ( half_edge , id_a , id_b , m_cluster_index_a , m_cluster_index_b ) ; bRelationKnown &= isPredicateKnown_ ( MatrixPredicate . BoundaryBoundary ) ; } if ( m_perform_predicates [ MatrixPredicate . BoundaryExterior ] ) { boundaryLineExteriorLine_ ( half_edge , id_a , id_b , m_cluster_index_a , MatrixPredicate . BoundaryExterior ) ; bRelationKnown &= isPredicateKnown_ ( MatrixPredicate . BoundaryExterior ) ; } if ( m_perform_predicates [ MatrixPredicate . ExteriorInterior ] ) { interiorLineExteriorLine_ ( half_edge , id_b , id_a , MatrixPredicate . ExteriorInterior ) ; bRelationKnown &= isPredicateKnown_ ( MatrixPredicate . ExteriorInterior ) ; } if ( m_perform_predicates [ MatrixPredicate . ExteriorBoundary ] ) { boundaryLineExteriorLine_ ( half_edge , id_b , id_a , m_cluster_index_b , MatrixPredicate . ExteriorBoundary ) ; bRelationKnown &= isPredicateKnown_ ( MatrixPredicate . ExteriorBoundary ) ; } return bRelationKnown ;
|
public class SCM { /** * Get a chance to do operations after the workspace i checked out and the changelog is written .
* @ since 1.568 */
public void postCheckout ( @ Nonnull Run < ? , ? > build , @ Nonnull Launcher launcher , @ Nonnull FilePath workspace , @ Nonnull TaskListener listener ) throws IOException , InterruptedException { } }
|
if ( build instanceof AbstractBuild && listener instanceof BuildListener ) { postCheckout ( ( AbstractBuild ) build , launcher , workspace , ( BuildListener ) listener ) ; }
|
public class CloudTraceFormat { /** * Using big - endian encoding . */
private static long spanIdToLong ( SpanId spanId ) { } }
|
ByteBuffer buffer = ByteBuffer . allocate ( SpanId . SIZE ) ; buffer . put ( spanId . getBytes ( ) ) ; return buffer . getLong ( 0 ) ;
|
public class URLConnectionRequestPropertiesBuilder { /** * Add provided cookie to ' Cookie ' request property .
* @ param cookieName The cookie name
* @ param cookieValue The ccokie value
* @ return this */
public URLConnectionRequestPropertiesBuilder withCookie ( String cookieName , String cookieValue ) { } }
|
if ( requestProperties . containsKey ( "Cookie" ) ) { // there are existing cookies so just append the new cookie at the end
final String cookies = requestProperties . get ( "Cookie" ) ; requestProperties . put ( "Cookie" , cookies + COOKIES_SEPARATOR + buildCookie ( cookieName , cookieValue ) ) ; } else { // this is the first cookie to be added
requestProperties . put ( "Cookie" , buildCookie ( cookieName , cookieValue ) ) ; } return this ;
|
public class PropertyProcessor { /** * < p > findAllProperties < / p >
* @ param configuration a { @ link com . github . nmorel . gwtjackson . rebind . RebindConfiguration } object .
* @ param logger a { @ link com . google . gwt . core . ext . TreeLogger } object .
* @ param typeOracle a { @ link com . github . nmorel . gwtjackson . rebind . JacksonTypeOracle } object .
* @ param beanInfo a { @ link com . github . nmorel . gwtjackson . rebind . bean . BeanInfo } object .
* @ param mapperInSamePackageAsType a boolean .
* @ return a { @ link com . github . nmorel . gwtjackson . rebind . property . PropertiesContainer } object .
* @ throws com . google . gwt . core . ext . UnableToCompleteException if any . */
public static PropertiesContainer findAllProperties ( RebindConfiguration configuration , TreeLogger logger , JacksonTypeOracle typeOracle , BeanInfo beanInfo , boolean mapperInSamePackageAsType ) throws UnableToCompleteException { } }
|
// we first parse the bean to retrieve all the properties
ImmutableMap < String , PropertyAccessors > fieldsMap = PropertyParser . findPropertyAccessors ( configuration , logger , beanInfo ) ; // value , any getter and any setter properties
PropertyInfo valuePropertyInfo = null ; PropertyInfo anyGetterPropertyInfo = null ; PropertyInfo anySetterPropertyInfo = null ; // Processing all the properties accessible via field , getter or setter
Map < String , PropertyInfo > propertiesMap = new LinkedHashMap < String , PropertyInfo > ( ) ; for ( PropertyAccessors propertyAccessors : fieldsMap . values ( ) ) { Optional < PropertyInfo > propertyInfoOptional = processProperty ( configuration , logger , typeOracle , propertyAccessors , beanInfo , mapperInSamePackageAsType ) ; if ( propertyInfoOptional . isPresent ( ) ) { PropertyInfo propertyInfo = propertyInfoOptional . get ( ) ; boolean put = true ; if ( propertyInfo . isValue ( ) ) { if ( null != valuePropertyInfo ) { logger . log ( TreeLogger . Type . WARN , "More than one method annotated with @JsonValue on " + beanInfo . getType ( ) . getName ( ) + ". Using the first one." ) ; } else { valuePropertyInfo = propertyInfo ; } put = false ; } if ( propertyInfo . isAnyGetter ( ) ) { if ( null != anyGetterPropertyInfo ) { logger . log ( TreeLogger . Type . WARN , "More than one method annotated with @JsonAnyGetter on " + beanInfo . getType ( ) . getName ( ) + ". Using the first one." ) ; } else { anyGetterPropertyInfo = propertyInfo ; } put = false ; } if ( propertyInfo . isAnySetter ( ) ) { if ( null != anySetterPropertyInfo ) { logger . log ( TreeLogger . Type . WARN , "More than one method annotated with @JsonAnySetter on " + beanInfo . getType ( ) . getName ( ) + ". Using the first one." ) ; } else { anySetterPropertyInfo = propertyInfo ; } put = false ; } if ( put ) { propertiesMap . put ( propertyInfo . getPropertyName ( ) , propertyInfo ) ; } } else { logger . log ( TreeLogger . Type . DEBUG , "Field " + propertyAccessors . getPropertyName ( ) + " of type " + beanInfo . getType ( ) + " is not visible" ) ; } } ImmutableMap . Builder < String , PropertyInfo > result = ImmutableMap . builder ( ) ; // we first add the properties defined in order
for ( String orderedProperty : beanInfo . getPropertyOrderList ( ) ) { // we remove the entry to have the map with only properties with natural or alphabetic order
PropertyInfo property = propertiesMap . remove ( orderedProperty ) ; if ( null != property ) { result . put ( property . getPropertyName ( ) , property ) ; } } // if the user asked for an alphabetic order , we sort the rest of the properties
if ( beanInfo . isPropertyOrderAlphabetic ( ) ) { List < Entry < String , PropertyInfo > > entries = new ArrayList < Entry < String , PropertyInfo > > ( propertiesMap . entrySet ( ) ) ; // sorting entries alphabetically on their key
Lists . sort ( entries , Ordering . natural ( ) . onResultOf ( new Function < Entry < String , PropertyInfo > , String > ( ) { @ Override public String apply ( Entry < String , PropertyInfo > entry ) { return null == entry ? null : entry . getKey ( ) ; } } ) ) ; for ( Map . Entry < String , PropertyInfo > entry : entries ) { result . put ( entry . getKey ( ) , entry . getValue ( ) ) ; } } else { // no specified order , we add the rest of the properties in the order we found them
for ( Map . Entry < String , PropertyInfo > entry : propertiesMap . entrySet ( ) ) { result . put ( entry . getKey ( ) , entry . getValue ( ) ) ; } } return new PropertiesContainer ( result . build ( ) , Optional . fromNullable ( valuePropertyInfo ) , Optional . fromNullable ( anyGetterPropertyInfo ) , Optional . fromNullable ( anySetterPropertyInfo ) ) ;
|
public class SaveSliceInfoDef { /** * < pre >
* Name of the full variable of which this is a slice .
* < / pre >
* < code > optional string full _ name = 1 ; < / code > */
public java . lang . String getFullName ( ) { } }
|
java . lang . Object ref = fullName_ ; if ( ref instanceof java . lang . String ) { return ( java . lang . String ) ref ; } else { com . google . protobuf . ByteString bs = ( com . google . protobuf . ByteString ) ref ; java . lang . String s = bs . toStringUtf8 ( ) ; fullName_ = s ; return s ; }
|
public class ManagerFactoryBean { /** * Get simon manager instance .
* If singleton is enabled SimonManager . manager ( ) is invoked else new
* Manager is created .
* Then callbacks are appended to this manager
* @ return Simon manager */
public Manager getObject ( ) throws Exception { } }
|
Manager manager ; if ( singleton ) { manager = SimonManager . manager ( ) ; } else { manager = new SwitchingManager ( ) ; } registerCallbacks ( manager ) ; configureEnabled ( manager ) ; return manager ;
|
public class ApiOvhCloud { /** * Migrate your instance to another flavor
* REST : POST / cloud / project / { serviceName } / instance / { instanceId } / resize
* @ param flavorId [ required ] Flavor id
* @ param instanceId [ required ] Instance id
* @ param serviceName [ required ] Service name */
public OvhInstanceDetail project_serviceName_instance_instanceId_resize_POST ( String serviceName , String instanceId , String flavorId ) throws IOException { } }
|
String qPath = "/cloud/project/{serviceName}/instance/{instanceId}/resize" ; StringBuilder sb = path ( qPath , serviceName , instanceId ) ; HashMap < String , Object > o = new HashMap < String , Object > ( ) ; addBody ( o , "flavorId" , flavorId ) ; String resp = exec ( qPath , "POST" , sb . toString ( ) , o ) ; return convertTo ( resp , OvhInstanceDetail . class ) ;
|
public class CSSBoxTree { /** * Creates an empty block style definition .
* @ return */
protected NodeData createBlockStyle ( ) { } }
|
NodeData ret = CSSFactory . createNodeData ( ) ; TermFactory tf = CSSFactory . getTermFactory ( ) ; ret . push ( createDeclaration ( "display" , tf . createIdent ( "block" ) ) ) ; return ret ;
|
public class ClassName { /** * Returns { @ code true } if { @ code name } is < em > syntactically < / em > a
* valid binary name . */
@ Ensures ( "result == isQualifiedName(name.replace('/', '.'))" ) public static boolean isBinaryName ( String name ) { } }
|
if ( name == null || name . isEmpty ( ) ) { return false ; } String [ ] parts = name . split ( "/" ) ; for ( String part : parts ) { if ( ! isSimpleName ( part ) ) { return false ; } } return true ;
|
public class AbstractPrintQuery { /** * Add an AttributeSet to the PrintQuery . It is used to get editable values
* from the eFaps DataBase .
* @ param _ setName Name of the AttributeSet to add
* @ return this PrintQuery
* @ throws EFapsException on error */
public AbstractPrintQuery addAttributeSet ( final String _setName ) throws EFapsException { } }
|
final Type type = getMainType ( ) ; if ( type != null ) { final AttributeSet set = AttributeSet . find ( type . getName ( ) , _setName ) ; addAttributeSet ( set ) ; } return this ;
|
public class DigitalOceanClient { @ Override public Regions getAvailableRegions ( Integer pageNo ) throws DigitalOceanException , RequestUnsuccessfulException { } }
|
validatePageNo ( pageNo ) ; return ( Regions ) perform ( new ApiRequest ( ApiAction . AVAILABLE_REGIONS , pageNo , DEFAULT_PAGE_SIZE ) ) . getData ( ) ;
|
public class NodeWrapper { /** * { @ inheritDoc } */
@ Override public NodeInfo getParent ( ) { } }
|
try { NodeInfo parent = null ; final INodeReadTrx rtx = createRtxAndMove ( ) ; if ( rtx . getNode ( ) . hasParent ( ) ) { // Parent transaction .
parent = new NodeWrapper ( mDocWrapper , rtx . getNode ( ) . getParentKey ( ) ) ; } rtx . close ( ) ; return parent ; } catch ( final TTException exc ) { LOGGER . error ( exc . toString ( ) ) ; return null ; }
|
public class PageFlowUtils { /** * Make a set of form beans available as attributets in the request / session ( as appropriate ) .
* @ param mapping the ActionMapping for the current Struts action being processed .
* @ param outputForms an array of ActionForm instances to be made available in the
* request / session ( as appropriate ) .
* @ param overwrite if < code > false < / code > a form from < code > fwd < / code > will only be set
* in the request if there is no existing form with the same name .
* @ param request the current HttpServletRequest . */
public static void setOutputForms ( ActionMapping mapping , ActionForm [ ] outputForms , HttpServletRequest request , boolean overwrite ) { } }
|
try { // Now set any output forms in the request or session , as appropriate .
assert mapping . getScope ( ) == null || mapping . getScope ( ) . equals ( "request" ) || mapping . getScope ( ) . equals ( "session" ) : mapping . getScope ( ) ; for ( int i = 0 ; i < outputForms . length ; ++ i ) { setOutputForm ( mapping , outputForms [ i ] , request , overwrite ) ; } } catch ( Exception e ) { _log . error ( "Error while setting Struts form-beans" , e ) ; }
|
public class Operations { /** * Reads the result of an operation and returns the result . If the operation does not have a { @ link
* ClientConstants # RESULT } attribute , a new undefined { @ link org . jboss . dmr . ModelNode } is returned .
* @ param result the result of executing an operation
* @ return the result of the operation or a new undefined model node */
public static ModelNode readResult ( final ModelNode result ) { } }
|
return ( result . hasDefined ( RESULT ) ? result . get ( RESULT ) : new ModelNode ( ) ) ;
|
public class Configurer { /** * Loads and merges application configuration with default properties .
* @ param confname - optional configuration filename
* @ param rootPath - only load configuration properties underneath this path that this code
* module owns and understands
* @ return Configuration loaded from the provided filename or from default properties . */
public Config loadConfig ( final @ Nullable String confname , final String rootPath ) { } }
|
// load configuration properties
Config config ; final String confname2 = trimToNull ( confname ) ; if ( confname2 != null ) { final ConfigParseOptions options = ConfigParseOptions . defaults ( ) . setAllowMissing ( false ) ; final Config customConfig = ConfigFactory . parseFileAnySyntax ( new File ( confname2 ) , options ) ; final Config regularConfig = ConfigFactory . load ( ) ; final Config combined = customConfig . withFallback ( regularConfig ) ; config = ConfigFactory . load ( combined ) ; } else { config = ConfigFactory . load ( ) ; } // validate
config . checkValid ( ConfigFactory . defaultReference ( ) , rootPath ) ; return config ;
|
public class BatchGetDeploymentGroupsRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( BatchGetDeploymentGroupsRequest batchGetDeploymentGroupsRequest , ProtocolMarshaller protocolMarshaller ) { } }
|
if ( batchGetDeploymentGroupsRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( batchGetDeploymentGroupsRequest . getApplicationName ( ) , APPLICATIONNAME_BINDING ) ; protocolMarshaller . marshall ( batchGetDeploymentGroupsRequest . getDeploymentGroupNames ( ) , DEPLOYMENTGROUPNAMES_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
|
public class RelativeTimeframe { /** * Construct the Timeframe map to send in the query .
* @ return the Timeframe Json map to send in the query . */
@ Override public Map < String , Object > constructTimeframeArgs ( ) { } }
|
Map < String , Object > timeframe = new HashMap < String , Object > ( 3 ) ; if ( null != this . relativeTimeframe ) { timeframe . put ( KeenQueryConstants . TIMEFRAME , this . relativeTimeframe ) ; } if ( null != this . timezone ) { timeframe . put ( KeenQueryConstants . TIMEZONE , this . timezone ) ; } return timeframe ;
|
public class CommonsLogger { /** * Delegates to the { @ link Log # debug ( Object ) } method of the underlying
* { @ link Log } instance .
* However , this form avoids superfluous object creation when the logger is disabled
* for level DEBUG .
* @ param format
* the format string
* @ param arg
* the argument */
@ Override public void debug ( String format , Object arg ) { } }
|
if ( logger . isDebugEnabled ( ) ) { FormattingTuple ft = MessageFormatter . format ( format , arg ) ; logger . debug ( ft . getMessage ( ) , ft . getThrowable ( ) ) ; }
|
public class NameUtils { /** * Tries to convert < code > string < / code > to a Java class name by following
* a few simple steps :
* < ul >
* < li > First of all , < code > string < / code > gets < i > camel cased < / i > , the
* usual Java class naming convention .
* < li > Secondly , any whitespace , by virtue of
* < code > Character . isWhitespace ( ) < / code > is removed from the camel cased
* < code > string < / code > .
* < li > Third , all accented characters ( diacritis ) are replaced by their
* non - accented equivalent ( ex : \ u00e9 - > e ) < / li >
* < li > Fourth , all non java identifier characters are removed < / li >
* < / ul >
* The only exception to executing these two steps is when
* < code > string < / code > represents a fully - qualified class name . To check
* if < code > string < / code > represents a fully - qualified class name , a
* simple validation of the existence of the ' . ' character is made on
* < code > string < / code > .
* @ param s The String that may represent a Java class name
* @ return The input string converted by following the documented steps */
public static String toClassName ( String s ) { } }
|
if ( StringUtil . isEmpty ( s ) || s . contains ( "." ) ) return s ; return removeNonJavaIdentifierCharacters ( removeDiacritics ( toUpperCamelCase ( s ) ) ) ;
|
public class GHEventsSubscriber { /** * Should return true only if this subscriber interested in { @ link # events ( ) } set for this project
* Don ' t call it directly , use { @ link # isApplicableFor } static function
* @ param project to check
* @ return { @ code true } to provide events to register and subscribe for this project
* @ deprecated override { @ link # isApplicable ( Item ) } instead . */
@ Deprecated protected boolean isApplicable ( @ Nullable Job < ? , ? > project ) { } }
|
if ( checkIsApplicableItem ( ) ) { return isApplicable ( ( Item ) project ) ; } // a legacy implementation which should not have been calling super . isApplicable ( Job )
throw new AbstractMethodError ( "you must override the new overload of isApplicable" ) ;
|
public class SemanticAPI { /** * 微信翻译
* @ param accessToken 接口调用凭证
* @ param lfrom 源语言 , zh _ CN 或 en _ US
* @ param lto 目标语言 , zh _ CN 或 en _ US
* @ param content 源内容放body里或者上传文件的形式 ( utf8格式 , 最大600Byte )
* @ return TranslatecontentResult
* @ since 2.8.22 */
public static TranslatecontentResult translatecontent ( String accessToken , String lfrom , String lto , String content ) { } }
|
HttpPost httpPost = new HttpPost ( BASE_URI + "/cgi-bin/media/voice/translatecontent" ) ; byte [ ] data ; try { data = content . getBytes ( "UTF-8" ) ; } catch ( IOException e ) { logger . error ( "" , e ) ; throw new RuntimeException ( e ) ; } HttpEntity reqEntity = MultipartEntityBuilder . create ( ) . addBinaryBody ( "media" , data , ContentType . DEFAULT_BINARY , "temp.txt" ) . addTextBody ( PARAM_ACCESS_TOKEN , API . accessToken ( accessToken ) ) . addTextBody ( "lfrom" , lfrom ) . addTextBody ( "lto" , lto ) . build ( ) ; httpPost . setEntity ( reqEntity ) ; return LocalHttpClient . executeJsonResult ( httpPost , TranslatecontentResult . class ) ;
|
public class MPD9DatabaseReader { /** * Process a single outline code .
* @ param parentRow outline code to task mapping table
* @ throws SQLException */
private void processOutlineCodeFields ( Row parentRow ) throws SQLException { } }
|
Integer entityID = parentRow . getInteger ( "CODE_REF_UID" ) ; Integer outlineCodeEntityID = parentRow . getInteger ( "CODE_UID" ) ; for ( ResultSetRow row : getRows ( "SELECT * FROM MSP_OUTLINE_CODES WHERE CODE_UID=?" , outlineCodeEntityID ) ) { processOutlineCodeField ( entityID , row ) ; }
|
public class GroupLayout { /** * Computes dimensions of the children widgets that are useful for the
* group layout managers . */
protected DimenInfo computeDimens ( Container parent , int type ) { } }
|
int count = parent . getComponentCount ( ) ; DimenInfo info = new DimenInfo ( ) ; info . dimens = new Dimension [ count ] ; for ( int i = 0 ; i < count ; i ++ ) { Component child = parent . getComponent ( i ) ; if ( ! child . isVisible ( ) ) { continue ; } Dimension csize ; switch ( type ) { case MINIMUM : csize = child . getMinimumSize ( ) ; break ; case MAXIMUM : csize = child . getMaximumSize ( ) ; break ; default : csize = child . getPreferredSize ( ) ; break ; } info . count ++ ; info . totwid += csize . width ; info . tothei += csize . height ; if ( csize . width > info . maxwid ) { info . maxwid = csize . width ; } if ( csize . height > info . maxhei ) { info . maxhei = csize . height ; } Constraints c = getConstraints ( child ) ; if ( c . isFixed ( ) ) { info . fixwid += csize . width ; info . fixhei += csize . height ; info . numfix ++ ; } else { info . totweight += c . getWeight ( ) ; if ( csize . width > info . maxfreewid ) { info . maxfreewid = csize . width ; } if ( csize . height > info . maxfreehei ) { info . maxfreehei = csize . height ; } } info . dimens [ i ] = csize ; } return info ;
|
public class AbstractGauge { /** * Sets the state of the user led .
* The led could blink which will be triggered by a javax . swing . Timer
* that triggers every 500 ms . The blinking will be done by switching
* between two images .
* @ param USER _ LED _ BLINKING */
public void setUserLedBlinking ( final boolean USER_LED_BLINKING ) { } }
|
this . userLedBlinking = USER_LED_BLINKING ; if ( USER_LED_BLINKING ) { USER_LED_BLINKING_TIMER . start ( ) ; } else { setCurrentUserLedImage ( getUserLedImageOff ( ) ) ; USER_LED_BLINKING_TIMER . stop ( ) ; }
|
public class DeleteBatchPredictionRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( DeleteBatchPredictionRequest deleteBatchPredictionRequest , ProtocolMarshaller protocolMarshaller ) { } }
|
if ( deleteBatchPredictionRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( deleteBatchPredictionRequest . getBatchPredictionId ( ) , BATCHPREDICTIONID_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
|
public class AmazonDirectConnectClient { /** * Deprecated . Use < a > AllocateHostedConnection < / a > instead .
* Creates a hosted connection on an interconnect .
* Allocates a VLAN number and a specified amount of bandwidth for use by a hosted connection on the specified
* interconnect .
* < note >
* Intended for use by AWS Direct Connect Partners only .
* < / note >
* @ param allocateConnectionOnInterconnectRequest
* @ return Result of the AllocateConnectionOnInterconnect operation returned by the service .
* @ throws DirectConnectServerException
* A server - side error occurred .
* @ throws DirectConnectClientException
* One or more parameters are not valid .
* @ sample AmazonDirectConnect . AllocateConnectionOnInterconnect
* @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / directconnect - 2012-10-25 / AllocateConnectionOnInterconnect "
* target = " _ top " > AWS API Documentation < / a > */
@ Override @ Deprecated public AllocateConnectionOnInterconnectResult allocateConnectionOnInterconnect ( AllocateConnectionOnInterconnectRequest request ) { } }
|
request = beforeClientExecution ( request ) ; return executeAllocateConnectionOnInterconnect ( request ) ;
|
public class VRPResourceManager { /** * Undeploy a VM in given VRP , hub pair .
* @ param vrpId The unique Id of the VRP .
* @ param vm VirtualMachine
* @ param cluster Cluster Object
* @ throws InvalidState
* @ throws NotFound
* @ throws RuntimeFault
* @ throws RemoteException */
public void undeployVM ( String vrpId , VirtualMachine vm , ClusterComputeResource cluster ) throws InvalidState , NotFound , RuntimeFault , RemoteException { } }
|
getVimService ( ) . undeployVM ( getMOR ( ) , vrpId , vm . getMOR ( ) , cluster . getMOR ( ) ) ;
|
public class FisExporter { /** * Returns a string representation for the Rule in the Fuzzy Inference System
* format
* @ param rule is the rule
* @ param engine is the engine in which the rule is registered
* @ return a string representation for the rule in the Fuzzy Inference System
* format */
public String exportRule ( Rule rule , Engine engine ) { } }
|
List < Proposition > propositions = new ArrayList < Proposition > ( ) ; List < Operator > operators = new ArrayList < Operator > ( ) ; Deque < Expression > queue = new ArrayDeque < Expression > ( ) ; queue . offer ( rule . getAntecedent ( ) . getExpression ( ) ) ; while ( ! queue . isEmpty ( ) ) { Expression front = queue . poll ( ) ; if ( front instanceof Operator ) { Operator op = ( Operator ) front ; queue . offer ( op . getLeft ( ) ) ; queue . offer ( op . getRight ( ) ) ; operators . add ( op ) ; } else if ( front instanceof Proposition ) { propositions . add ( ( Proposition ) front ) ; } else { throw new RuntimeException ( String . format ( "[export error] unexpected class <%s>" , front . getClass ( ) . getName ( ) ) ) ; } } boolean equalOperators = true ; for ( int i = 0 ; i < operators . size ( ) - 1 ; ++ i ) { if ( ! operators . get ( i ) . getName ( ) . equals ( operators . get ( i + 1 ) . getName ( ) ) ) { equalOperators = false ; break ; } } if ( ! equalOperators ) { throw new RuntimeException ( "[export error] " + "fis files do not support rules with different connectors " + "(i.e. ['and', 'or']). All connectors within a rule must be the same" ) ; } List < Variable > inputVariables = new ArrayList < Variable > ( ) ; List < Variable > outputVariables = new ArrayList < Variable > ( ) ; for ( InputVariable inputVariable : engine . getInputVariables ( ) ) { inputVariables . add ( inputVariable ) ; } for ( OutputVariable outputVariable : engine . getOutputVariables ( ) ) { outputVariables . add ( outputVariable ) ; } StringBuilder result = new StringBuilder ( ) ; result . append ( translate ( propositions , inputVariables ) ) . append ( ", " ) ; result . append ( translate ( rule . getConsequent ( ) . getConclusions ( ) , outputVariables ) ) ; result . append ( String . format ( "(%s)" , Op . str ( rule . getWeight ( ) ) ) ) ; String connector ; if ( operators . isEmpty ( ) ) { connector = "1" ; } else if ( Rule . FL_AND . equals ( operators . get ( 0 ) . getName ( ) ) ) { connector = "1" ; } else if ( Rule . FL_OR . equals ( operators . get ( 0 ) . getName ( ) ) ) { connector = "2" ; } else { connector = operators . get ( 0 ) . getName ( ) ; } result . append ( " : " ) . append ( connector ) ; return result . toString ( ) ;
|
public class DisassociateS3ResourcesRequest { /** * The S3 resources ( buckets or prefixes ) that you want to remove from being monitored and classified by Amazon
* Macie .
* @ param associatedS3Resources
* The S3 resources ( buckets or prefixes ) that you want to remove from being monitored and classified by
* Amazon Macie . */
public void setAssociatedS3Resources ( java . util . Collection < S3Resource > associatedS3Resources ) { } }
|
if ( associatedS3Resources == null ) { this . associatedS3Resources = null ; return ; } this . associatedS3Resources = new java . util . ArrayList < S3Resource > ( associatedS3Resources ) ;
|
public class LinkedList { /** * Retrieves , but does not remove , the last element of this list ,
* or returns { @ code null } if this list is empty .
* @ return the last element of this list , or { @ code null }
* if this list is empty
* @ since 1.6 */
public E peekLast ( ) { } }
|
final Node < E > l = last ; return ( l == null ) ? null : l . item ;
|
public class HELM2NotationUtils { /** * method to get all peptide polymers given a list of PolymerNotation objects
* @ param polymers List of PolymerNotation objects
* @ return list of peptide polymers */
public final static List < PolymerNotation > getPeptidePolymers ( List < PolymerNotation > polymers ) { } }
|
List < PolymerNotation > peptidePolymers = new ArrayList < PolymerNotation > ( ) ; for ( PolymerNotation polymer : polymers ) { if ( polymer . getPolymerID ( ) instanceof PeptideEntity ) { peptidePolymers . add ( polymer ) ; } } return peptidePolymers ;
|
public class ConcurrentHashMultiset { /** * Adds or removes occurrences of { @ code element } such that the { @ link # count } of the
* element becomes { @ code count } .
* @ return the count of { @ code element } in the multiset before this call
* @ throws IllegalArgumentException if { @ code count } is negative */
@ Override public int setCount ( E element , int count ) { } }
|
checkNotNull ( element ) ; checkNonnegative ( count , "count" ) ; while ( true ) { AtomicInteger existingCounter = Maps . safeGet ( countMap , element ) ; if ( existingCounter == null ) { if ( count == 0 ) { return 0 ; } else { existingCounter = countMap . putIfAbsent ( element , new AtomicInteger ( count ) ) ; if ( existingCounter == null ) { return 0 ; } // existingCounter ! = null : fall through
} } while ( true ) { int oldValue = existingCounter . get ( ) ; if ( oldValue == 0 ) { if ( count == 0 ) { return 0 ; } else { AtomicInteger newCounter = new AtomicInteger ( count ) ; if ( ( countMap . putIfAbsent ( element , newCounter ) == null ) || countMap . replace ( element , existingCounter , newCounter ) ) { return 0 ; } } break ; } else { if ( existingCounter . compareAndSet ( oldValue , count ) ) { if ( count == 0 ) { // Just CASed to 0 ; remove the entry to clean up the map . If the removal fails ,
// another thread has already replaced it with a new counter , which is fine .
countMap . remove ( element , existingCounter ) ; } return oldValue ; } } } }
|
public class AVMixPushManager { /** * 打开 / 关闭通知栏消息
* Turn on / off notification bar messages
* @ param enable 打开 / 关闭 ( 默认为打开 )
* Turn ON / off */
public static void setHMSReceiveNotifyMsg ( final boolean enable ) { } }
|
com . huawei . android . hms . agent . HMSAgent . Push . enableReceiveNotifyMsg ( enable , new com . huawei . android . hms . agent . push . handler . EnableReceiveNotifyMsgHandler ( ) { @ Override public void onResult ( int rst ) { LOGGER . d ( "[HMS] enableReceiveNotifyMsg(flag=" + enable + ") returnCode=" + rst ) ; } } ) ;
|
public class IfmapJ { /** * Create a new { @ link SSRC } object to operate on the given url
* using basic authentication .
* @ param url
* the URL to connect to
* @ param user
* basic authentication user
* @ param pass
* basic authentication password
* @ param tms
* TrustManager instances to initialize the { @ link SSLContext } with .
* @ return a new { @ link SSRC } that uses basic authentication
* @ throws IOException
* @ deprecated use createSsrc ( BasicAuthConfig ) instead */
@ Deprecated public static SSRC createSsrc ( String url , String user , String pass , TrustManager [ ] tms ) throws InitializationException { } }
|
return new SsrcImpl ( url , user , pass , tms , 120 * 1000 ) ;
|
public class ScriptableObject { /** * If hasProperty ( obj , name ) would return true , then if the property that
* was found is compatible with the new property , this method just returns .
* If the property is not compatible , then an exception is thrown .
* A property redefinition is incompatible if the first definition was a
* const declaration or if this one is . They are compatible only if neither
* was const . */
public static void redefineProperty ( Scriptable obj , String name , boolean isConst ) { } }
|
Scriptable base = getBase ( obj , name ) ; if ( base == null ) return ; if ( base instanceof ConstProperties ) { ConstProperties cp = ( ConstProperties ) base ; if ( cp . isConst ( name ) ) throw ScriptRuntime . typeError1 ( "msg.const.redecl" , name ) ; } if ( isConst ) throw ScriptRuntime . typeError1 ( "msg.var.redecl" , name ) ;
|
public class VoiceApi { /** * Attach user data to a call
* Attach the provided data to the specified call . This adds the data to the call even if data already exists with the provided keys .
* @ param id The connection ID of the call . ( required )
* @ param userData The data to attach to the call . This is an array of objects with the properties key , type , and value . ( required )
* @ return ApiResponse & lt ; ApiSuccessResponse & gt ;
* @ throws ApiException If fail to call the API , e . g . server error or cannot deserialize the response body */
public ApiResponse < ApiSuccessResponse > attachUserDataWithHttpInfo ( String id , UserDataOperationId userData ) throws ApiException { } }
|
com . squareup . okhttp . Call call = attachUserDataValidateBeforeCall ( id , userData , null , null ) ; Type localVarReturnType = new TypeToken < ApiSuccessResponse > ( ) { } . getType ( ) ; return apiClient . execute ( call , localVarReturnType ) ;
|
public class JSON { /** * Parses JSON data from a file .
* The character set of the file is auto - detected .
* The file will be opened 2 times ( once for detecting the character set , and once
* for the actual parsing )
* @ param file the file to read the data from
* @ return the parsed JSON Value .
* @ throws JSONException */
public static Value parse ( File file ) throws JSONException { } }
|
InputStream input = null ; try { byte [ ] header = new byte [ 4 ] ; // Guess charset
input = new FileInputStream ( file ) ; input . read ( header ) ; Charset charset ; if ( header [ 0 ] == 0 ) { charset = ( header [ 1 ] == 0 ? UTF32BE : UTF16BE ) ; } else if ( header [ 1 ] == 0 ) { charset = ( header [ 2 ] == 0 ? UTF32LE : UTF16LE ) ; } else { charset = UTF8 ; } input . close ( ) ; input = null ; // Parse the whole file
return parse ( file , charset ) ; } catch ( IOException e ) { throw new JSONException ( e ) ; } finally { if ( input != null ) { try { input . close ( ) ; } catch ( IOException e ) { } } }
|
public class GraphiteEventReporter { /** * Non - numeric event values may be emitted as part of the key by applying them to the end of the key if
* { @ link ConfigurationKeys # METRICS _ REPORTING _ GRAPHITE _ EVENTS _ VALUE _ AS _ KEY } is set . Thus such events can be still
* reported even when the backend doesn ' t accept text values through Graphite
* @ param field name of the metric ' s metadata fields
* @ return true if event value is emitted in the key */
private boolean emitAsKey ( String field ) { } }
|
return emitValueAsKey && ( field . equals ( TaskEvent . METADATA_TASK_WORKING_STATE ) || field . equals ( JobEvent . METADATA_JOB_STATE ) ) ;
|
public class JspHelper { /** * Get an array of nodes that can serve the streaming request
* The best one is the first in the array which has maximum
* local copies of all blocks */
public DatanodeInfo [ ] bestNode ( LocatedBlocks blks ) throws IOException { } }
|
// insert all known replica locations into a tree map where the
// key is the DatanodeInfo
TreeMap < DatanodeInfo , NodeRecord > map = new TreeMap < DatanodeInfo , NodeRecord > ( ) ; for ( int i = 0 ; i < blks . getLocatedBlocks ( ) . size ( ) ; i ++ ) { DatanodeInfo [ ] nodes = blks . get ( i ) . getLocations ( ) ; for ( int j = 0 ; j < nodes . length ; j ++ ) { NodeRecord obj = map . get ( nodes [ j ] ) ; if ( obj != null ) { obj . frequency ++ ; } else { map . put ( nodes [ j ] , new NodeRecord ( nodes [ j ] , 1 ) ) ; } } } // sort all locations by their frequency of occurance
Collection < NodeRecord > values = map . values ( ) ; NodeRecord [ ] nodes = ( NodeRecord [ ] ) values . toArray ( new NodeRecord [ values . size ( ) ] ) ; Arrays . sort ( nodes , new NodeRecordComparator ( ) ) ; try { List < NodeRecord > candidates = bestNode ( nodes , false ) ; return candidates . toArray ( new DatanodeInfo [ candidates . size ( ) ] ) ; } catch ( IOException e ) { return new DatanodeInfo [ ] { randomNode ( ) } ; }
|
public class XmlEntity { /** * Parses content from given reader input stream and namespace dictionary . */
protected void parseXml ( Reader reader , XmlNamespaceDictionary namespaceDictionary ) throws IOException , XmlPullParserException { } }
|
this . xmlPullParser . setInput ( reader ) ; Xml . parseElement ( this . xmlPullParser , this , namespaceDictionary , null ) ;
|
public class Iterate { /** * Return the specified collection as a sorted List . */
public static < T extends Comparable < ? super T > > MutableList < T > toSortedList ( Iterable < T > iterable ) { } }
|
return Iterate . toSortedList ( iterable , Comparators . naturalOrder ( ) ) ;
|
public class StreamGraphGenerator { /** * Determines the slot sharing group for an operation based on the slot sharing group set by
* the user and the slot sharing groups of the inputs .
* < p > If the user specifies a group name , this is taken as is . If nothing is specified and
* the input operations all have the same group name then this name is taken . Otherwise the
* default group is chosen .
* @ param specifiedGroup The group specified by the user .
* @ param inputIds The IDs of the input operations . */
private String determineSlotSharingGroup ( String specifiedGroup , Collection < Integer > inputIds ) { } }
|
if ( specifiedGroup != null ) { return specifiedGroup ; } else { String inputGroup = null ; for ( int id : inputIds ) { String inputGroupCandidate = streamGraph . getSlotSharingGroup ( id ) ; if ( inputGroup == null ) { inputGroup = inputGroupCandidate ; } else if ( ! inputGroup . equals ( inputGroupCandidate ) ) { return "default" ; } } return inputGroup == null ? "default" : inputGroup ; }
|
public class RestUtils { /** * Returns the query parameter values .
* @ param param a parameter name
* @ param ctx ctx
* @ return a list of values */
public static List < String > queryParams ( String param , ContainerRequestContext ctx ) { } }
|
return ctx . getUriInfo ( ) . getQueryParameters ( ) . get ( param ) ;
|
public class PippoSettings { /** * Returns the float value for the specified name . If the name does not
* exist or the value for the name can not be interpreted as a float , the
* defaultValue is returned .
* @ param name
* @ param defaultValue
* @ return name value or defaultValue */
public float getFloat ( String name , float defaultValue ) { } }
|
try { String value = getString ( name , null ) ; if ( ! StringUtils . isNullOrEmpty ( value ) ) { return Float . parseFloat ( value . trim ( ) ) ; } } catch ( NumberFormatException e ) { log . warn ( "Failed to parse float for " + name + USING_DEFAULT_OF + defaultValue ) ; } return defaultValue ;
|
public class DoublesPmfCdfImpl { /** * Shared algorithm for both PMF and CDF functions . The splitPoints must be unique , monotonically
* increasing values .
* @ param sketch the given quantiles DoublesSketch
* @ param splitPoints an array of < i > m < / i > unique , monotonically increasing doubles
* that divide the real number line into < i > m + 1 < / i > consecutive disjoint intervals .
* @ return the unnormalized , accumulated counts of < i > m + 1 < / i > intervals . */
private static double [ ] internalBuildHistogram ( final DoublesSketch sketch , final double [ ] splitPoints ) { } }
|
final DoublesSketchAccessor sketchAccessor = DoublesSketchAccessor . wrap ( sketch ) ; Util . checkSplitPointsOrder ( splitPoints ) ; final int numSplitPoints = splitPoints . length ; final int numCounters = numSplitPoints + 1 ; final double [ ] counters = new double [ numCounters ] ; long weight = 1 ; sketchAccessor . setLevel ( DoublesSketchAccessor . BB_LVL_IDX ) ; if ( numSplitPoints < 50 ) { // empirically determined crossover
// sort not worth it when few split points
DoublesPmfCdfImpl . bilinearTimeIncrementHistogramCounters ( sketchAccessor , weight , splitPoints , counters ) ; } else { sketchAccessor . sort ( ) ; // sort is worth it when many split points
DoublesPmfCdfImpl . linearTimeIncrementHistogramCounters ( sketchAccessor , weight , splitPoints , counters ) ; } long myBitPattern = sketch . getBitPattern ( ) ; final int k = sketch . getK ( ) ; assert myBitPattern == sketch . getN ( ) / ( 2L * k ) ; // internal consistency check
for ( int lvl = 0 ; myBitPattern != 0L ; lvl ++ , myBitPattern >>>= 1 ) { weight <<= 1 ; // double the weight
if ( ( myBitPattern & 1L ) > 0L ) { // valid level exists
// the levels are already sorted so we can use the fast version
sketchAccessor . setLevel ( lvl ) ; DoublesPmfCdfImpl . linearTimeIncrementHistogramCounters ( sketchAccessor , weight , splitPoints , counters ) ; } } return counters ;
|
public class Convertor { /** * Converts a { @ link Resource } object into the matching { @ link Order } .
* @ param rdfOrder Resource for which the matching { @ link Order } should be given .
* @ return the matching { @ link Order } . */
public static Order resource2Order ( Resource rdfOrder ) { } }
|
if ( rdfOrder . equals ( CDK . SINGLEBOND ) ) { return Order . SINGLE ; } else if ( rdfOrder . equals ( CDK . DOUBLEBOND ) ) { return Order . DOUBLE ; } else if ( rdfOrder . equals ( CDK . TRIPLEBOND ) ) { return Order . TRIPLE ; } else if ( rdfOrder . equals ( CDK . QUADRUPLEBOND ) ) { return Order . QUADRUPLE ; } return null ;
|
public class MapDotApi { /** * Get string value by path .
* @ param map subject
* @ param pathString nodes to walk in map
* @ return value */
public static Optional < String > dotGetString ( final Map map , final String pathString ) { } }
|
return dotGet ( map , String . class , pathString ) ;
|
public class PolicyUtils { /** * Build the default Event Bridge Policies .
* @ param accountSid account sid
* @ param channelId channel id
* @ return generated Policies */
public static List < Policy > defaultEventBridgePolicies ( String accountSid , String channelId ) { } }
|
String url = Joiner . on ( '/' ) . join ( TASKROUTER_EVENT_URL , accountSid , channelId ) ; Policy get = new Policy . Builder ( ) . url ( url ) . method ( HttpMethod . GET ) . allowed ( true ) . build ( ) ; Policy post = new Policy . Builder ( ) . url ( url ) . method ( HttpMethod . POST ) . allowed ( true ) . build ( ) ; return Lists . newArrayList ( get , post ) ;
|
public class CommerceRegionLocalServiceUtil { /** * Updates the commerce region in the database or adds it if it does not yet exist . Also notifies the appropriate model listeners .
* @ param commerceRegion the commerce region
* @ return the commerce region that was updated */
public static com . liferay . commerce . model . CommerceRegion updateCommerceRegion ( com . liferay . commerce . model . CommerceRegion commerceRegion ) { } }
|
return getService ( ) . updateCommerceRegion ( commerceRegion ) ;
|
public class EntryUtils { /** * Returns the day given a string in format dd - MMM - yyyy . */
public static Date getDay ( String string ) { } }
|
if ( string == null ) { return null ; } Date date = null ; try { date = ( new SimpleDateFormat ( "dd-MMM-yyyy" ) . parse ( string ) ) ; } catch ( ParseException ex ) { return null ; } return date ;
|
public class BusJacksonAutoConfiguration { /** * otherwise RemoteApplicationEventRegistrar will register the bean */
@ Bean @ ConditionalOnMissingBean ( name = "busJsonConverter" ) @ StreamMessageConverter public AbstractMessageConverter busJsonConverter ( @ Autowired ( required = false ) ObjectMapper objectMapper ) { } }
|
return new BusJacksonMessageConverter ( objectMapper ) ;
|
public class StringUtil { /** * string keys are converted from camel style to underline style . a new map is returned , the original map is not changed . */
public static Map < String , Object > camelToUnderline ( Map < String , Object > map ) { } }
|
Map < String , Object > newMap = new HashMap < > ( ) ; for ( String key : map . keySet ( ) ) { newMap . put ( camelToUnderline ( key ) , map . get ( key ) ) ; } return newMap ;
|
public class Logger { /** * Sets the log level . Only log messages with a rank greater or equal than the rank of the
* currently applied log level , are written to the output .
* @ param logLevel
* The log level , which should be set , as a value of the enum { @ link LogLevel } . The log
* level may not be null */
public final void setLogLevel ( @ NonNull final LogLevel logLevel ) { } }
|
Condition . INSTANCE . ensureNotNull ( logLevel , "The log level may not be null" ) ; this . logLevel = logLevel ;
|
public class IotHubResourcesInner { /** * Get the health for routing endpoints .
* Get the health for routing endpoints .
* @ param resourceGroupName the String value
* @ param iotHubName the String value
* @ throws IllegalArgumentException thrown if parameters fail the validation
* @ return the observable to the PagedList & lt ; EndpointHealthDataInner & gt ; object */
public Observable < Page < EndpointHealthDataInner > > getEndpointHealthAsync ( final String resourceGroupName , final String iotHubName ) { } }
|
return getEndpointHealthWithServiceResponseAsync ( resourceGroupName , iotHubName ) . map ( new Func1 < ServiceResponse < Page < EndpointHealthDataInner > > , Page < EndpointHealthDataInner > > ( ) { @ Override public Page < EndpointHealthDataInner > call ( ServiceResponse < Page < EndpointHealthDataInner > > response ) { return response . body ( ) ; } } ) ;
|
public class UrlSyntaxProviderImpl { /** * Add the provided portlet url builder data to the url string builder */
protected void addPortletUrlData ( final HttpServletRequest request , final UrlStringBuilder url , final UrlType urlType , final IPortletUrlBuilder portletUrlBuilder , final IPortletWindowId targetedPortletWindowId , final boolean statelessUrl ) { } }
|
final IPortletWindowId portletWindowId = portletUrlBuilder . getPortletWindowId ( ) ; final boolean targeted = portletWindowId . equals ( targetedPortletWindowId ) ; IPortletWindow portletWindow = null ; // The targeted portlet doesn ' t need namespaced parameters
final String prefixedPortletWindowId ; final String suffixedPortletWindowId ; // Track whether or not we are adding parameters to the URL for non - targeted or delegate
// portlets .
boolean addedNonTargetedPortletParam = false ; if ( targeted ) { prefixedPortletWindowId = "" ; suffixedPortletWindowId = "" ; } else { final String portletWindowIdStr = portletWindowId . toString ( ) ; prefixedPortletWindowId = SEPARATOR + portletWindowIdStr ; suffixedPortletWindowId = portletWindowIdStr + SEPARATOR ; // targeted portlets can never be delegates ( it is always the top most parent that is
// targeted )
portletWindow = this . portletWindowRegistry . getPortletWindow ( request , portletWindowId ) ; final IPortletWindowId delegationParentId = portletWindow . getDelegationParentId ( ) ; if ( delegationParentId != null ) { url . addParameter ( PARAM_DELEGATE_PARENT + prefixedPortletWindowId , delegationParentId . getStringId ( ) ) ; addedNonTargetedPortletParam = true ; } } switch ( urlType ) { case RESOURCE : { final String cacheability = portletUrlBuilder . getCacheability ( ) ; if ( cacheability != null ) { url . addParameter ( PARAM_CACHEABILITY + prefixedPortletWindowId , cacheability ) ; addedNonTargetedPortletParam = ! targeted ? true : addedNonTargetedPortletParam ; } final String resourceId = portletUrlBuilder . getResourceId ( ) ; if ( ! targeted && resourceId != null ) { url . addParameter ( PARAM_RESOURCE_ID + prefixedPortletWindowId , resourceId ) ; // We know we are ! targeted , but kept the assignement consistent with the
// other similar
// assignments for clarity .
addedNonTargetedPortletParam = ! targeted ? true : addedNonTargetedPortletParam ; } break ; } default : { // Add requested portlet mode
final PortletMode portletMode = portletUrlBuilder . getPortletMode ( ) ; if ( portletMode != null ) { url . addParameter ( PARAM_PORTLET_MODE + prefixedPortletWindowId , portletMode . toString ( ) ) ; addedNonTargetedPortletParam = ! targeted ? true : addedNonTargetedPortletParam ; } else if ( targeted && statelessUrl ) { portletWindow = portletWindow != null ? portletWindow : this . portletWindowRegistry . getPortletWindow ( request , portletWindowId ) ; final PortletMode currentPortletMode = portletWindow . getPortletMode ( ) ; url . addParameter ( PARAM_PORTLET_MODE + prefixedPortletWindowId , currentPortletMode . toString ( ) ) ; // We know we are targeted , but kept the assignement consistent with the
// other similar
// assignments for clarity . Will always be a nop .
addedNonTargetedPortletParam = ! targeted ? true : addedNonTargetedPortletParam ; } // Add requested window state if it isn ' t included on the path
final WindowState windowState = portletUrlBuilder . getWindowState ( ) ; if ( windowState != null && ( ! targeted || ! PATH_WINDOW_STATES . contains ( windowState ) ) ) { url . addParameter ( PARAM_WINDOW_STATE + prefixedPortletWindowId , windowState . toString ( ) ) ; addedNonTargetedPortletParam = ! targeted ? true : addedNonTargetedPortletParam ; } break ; } } if ( portletUrlBuilder . getCopyCurrentRenderParameters ( ) ) { url . addParameter ( PARAM_COPY_PARAMETERS + suffixedPortletWindowId ) ; addedNonTargetedPortletParam = ! targeted ? true : addedNonTargetedPortletParam ; } final Map < String , String [ ] > parameters = portletUrlBuilder . getParameters ( ) ; if ( ! parameters . isEmpty ( ) ) { url . addParametersArray ( PORTLET_PARAM_PREFIX + suffixedPortletWindowId , parameters ) ; addedNonTargetedPortletParam = ! targeted ? true : addedNonTargetedPortletParam ; } // UP - 4566 If we have added a portlet parameter for a non - targeted ( or delegate ) portlet add
// in the
// additional - portlet parameter to aid in URL parsing later on . Among other things the
// practical impact
// of this is when we do a search which sends an event to all porlets the user has access to
// which adds a
// bunch of portletUrlBuilders to the request , we don ' t add a bunch of unnecessary & PCa
// parameters to the
// URL since there are no parameters actually being passed to the searched portlets .
if ( addedNonTargetedPortletParam ) { url . addParameter ( PARAM_ADDITIONAL_PORTLET , portletWindowId . toString ( ) ) ; }
|
public class TraceNLSResolver { /** * Like { @ link # getResourceBundle ( Class , String , List ) } , but takes a single
* Locale .
* @ see # getResourceBundle ( Class , String , List ) */
public ResourceBundle getResourceBundle ( Class < ? > aClass , String bundleName , Locale locale ) { } }
|
return getResourceBundle ( aClass , bundleName , ( locale == null ) ? null : Collections . singletonList ( locale ) ) ;
|
public class PluginMessageDescription { /** * Create a description for an CompareCondition object .
* It supports Condition . context properties :
* - " description " : Description of the dataId used for this condition , if not present , description will use
* dataId literal
* i . e . " description " : " Response Time "
* - " description2 " : Description of the data2Id used for this comparition , if not present , description will use
* data2Id literal
* i . e . " description2 " : " Response Time 2"
* @ param condition the condition
* @ return a description to be used on email templates */
public String compare ( CompareCondition condition ) { } }
|
String description ; if ( condition . getContext ( ) != null && condition . getContext ( ) . get ( CONTEXT_PROPERTY_DESCRIPTION ) != null ) { description = condition . getContext ( ) . get ( CONTEXT_PROPERTY_DESCRIPTION ) ; } else { description = condition . getDataId ( ) ; } CompareCondition . Operator operator = condition . getOperator ( ) ; switch ( operator ) { case LT : description += " less than " ; break ; case LTE : description += " less or equals than " ; break ; case GT : description += " greater than " ; break ; case GTE : description += " greater or equals than " ; break ; default : throw new IllegalArgumentException ( operator . name ( ) ) ; } if ( condition . getData2Multiplier ( ) != 1.0 ) { description += "( " + decimalFormat . format ( condition . getData2Multiplier ( ) ) + " " ; } if ( condition . getContext ( ) != null && condition . getContext ( ) . get ( CONTEXT_PROPERTY_DESCRIPTION2 ) != null ) { description += condition . getContext ( ) . get ( CONTEXT_PROPERTY_DESCRIPTION2 ) ; } else { description += condition . getData2Id ( ) ; } if ( condition . getData2Multiplier ( ) != 1.0 ) { description += " )" ; } return description ;
|
public class ExtensibleArray { private final T get ( int index , List < T > array ) { } }
|
while ( index >= array . size ( ) ) { array . add ( this . createNode ( ) ) ; } return array . get ( index ) ;
|
public class TunnelRequestService { /** * Notifies bound listeners that a new tunnel has been connected .
* Listeners may veto a connected tunnel by throwing any GuacamoleException .
* @ param authenticatedUser
* The AuthenticatedUser associated with the user for whom the tunnel
* is being created .
* @ param credentials
* Credentials that authenticate the user .
* @ param tunnel
* The tunnel that was connected .
* @ throws GuacamoleException
* If thrown by a listener or if any listener vetoes the connected tunnel . */
private void fireTunnelConnectEvent ( AuthenticatedUser authenticatedUser , Credentials credentials , GuacamoleTunnel tunnel ) throws GuacamoleException { } }
|
listenerService . handleEvent ( new TunnelConnectEvent ( authenticatedUser , credentials , tunnel ) ) ;
|
public class AttachedRemoteSubscriberIterator { /** * / * ( non - Javadoc )
* @ see java . util . Iterator # remove ( ) */
public void remove ( ) { } }
|
if ( tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "remove" ) ; if ( anycastIHIterator != null ) { anycastIHIterator . remove ( ) ; } if ( tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "remove" ) ;
|
public class ThriftClientFactory { /** * Gets the connection .
* @ param pool the pool
* @ return the connection */
Connection getConnection ( ConnectionPool pool ) { } }
|
ConnectionPool connectionPool = pool ; boolean success = false ; while ( ! success ) { try { success = true ; Cassandra . Client client = connectionPool . getConnection ( ) ; if ( logger . isDebugEnabled ( ) ) { logger . debug ( "Returning connection of {} :{} ." , pool . getPoolProperties ( ) . getHost ( ) , pool . getPoolProperties ( ) . getPort ( ) ) ; } return new Connection ( client , connectionPool ) ; } catch ( TException te ) { success = false ; logger . warn ( "{} :{} host appears to be down, trying for next " , pool . getPoolProperties ( ) . getHost ( ) , pool . getPoolProperties ( ) . getPort ( ) ) ; connectionPool = getNewPool ( pool . getPoolProperties ( ) . getHost ( ) , pool . getPoolProperties ( ) . getPort ( ) ) ; } } throw new KunderaException ( "All hosts are down. please check servers manully." ) ;
|
public class SAMFileMerger { /** * Terminate the aggregated output stream with an appropriate SAMOutputFormat - dependent terminator block */
private static void writeTerminatorBlock ( final OutputStream out , final SAMFormat samOutputFormat ) throws IOException { } }
|
if ( SAMFormat . CRAM == samOutputFormat ) { CramIO . issueEOF ( CramVersions . DEFAULT_CRAM_VERSION , out ) ; // terminate with CRAM EOF container
} else if ( SAMFormat . BAM == samOutputFormat ) { out . write ( BlockCompressedStreamConstants . EMPTY_GZIP_BLOCK ) ; // add the BGZF terminator
} // no terminator for SAM
|
public class Tree { /** * Sets this node ' s type and converts the value into the specified type .
* @ param type
* new type
* @ return this node */
public Tree setType ( Class < ? > type ) { } }
|
if ( value == null || value . getClass ( ) == type ) { return this ; } value = DataConverterRegistry . convert ( type , value ) ; if ( parent != null && key != null ) { if ( key instanceof String ) { parent . putObjectInternal ( ( String ) key , value , false ) ; } else { parent . remove ( ( int ) key ) ; parent . insertObjectInternal ( ( int ) key , value ) ; } } return this ;
|
public class SequenceUtil { /** * Reads fasta sequences from inStream into the list of FastaSequence
* objects
* @ param inStream
* from
* @ return list of FastaSequence objects
* @ throws IOException */
public static List < FastaSequence > readFasta ( final InputStream inStream ) throws IOException { } }
|
final List < FastaSequence > seqs = new ArrayList < FastaSequence > ( ) ; final BufferedReader infasta = new BufferedReader ( new InputStreamReader ( inStream , "UTF8" ) , 16000 ) ; final Pattern pattern = Pattern . compile ( "//s+" ) ; String line ; String sname = "" , seqstr = null ; do { line = infasta . readLine ( ) ; if ( ( line == null ) || line . startsWith ( ">" ) ) { if ( seqstr != null ) { seqs . add ( new FastaSequence ( sname . substring ( 1 ) , seqstr ) ) ; } sname = line ; // remove >
seqstr = "" ; } else { final String subseq = pattern . matcher ( line ) . replaceAll ( "" ) ; seqstr += subseq ; } } while ( line != null ) ; infasta . close ( ) ; return seqs ;
|
public class SDRandom { /** * Generate a new random SDVariable , where values are randomly sampled according to a Bernoulli distribution ,
* with the specified probability . Array values will have value 1 with probability P and value 0 with probability
* 1 - P . < br >
* See { @ link # bernoulli ( String , double , SDVariable ) } for the equivalent function where the shape is
* specified as a SDVarible instead
* @ param name Name of the new SDVariable
* @ param p Probability of value 1
* @ param shape Shape of the new random SDVariable , as a 1D array
* @ return New SDVariable */
public SDVariable bernoulli ( String name , double p , long ... shape ) { } }
|
SDVariable ret = f ( ) . randomBernoulli ( p , shape ) ; return updateVariableNameAndReference ( ret , name ) ;
|
public class RpcNettyClient { /** * 当连接废弃时 , 需要将缓存map中的那个废弃连接释放掉 , 此操作是并发安全的 */
static void removeClosedChannel ( String nodeId ) { } }
|
if ( lock . tryLock ( ) ) { try { nodeId_to_connectedChannel_map . remove ( nodeId ) ; LOG . info ( String . format ( "RpcClient:与%s的空闲长连接缓存释放完毕..." , nodeId ) ) ; } finally { lock . unlock ( ) ; } } else { LOG . info ( String . format ( "RpcClient删除缓存的与%s的废弃的连接:已经有新连接正在建立,那么这里不做操作,由新建连接的线程去覆盖掉缓存中的废弃连接" , nodeId ) ) ; }
|
public class CmsFlexBucketConfiguration { /** * Returns true if for the given publish list , the complete Flex cache should be cleared based on this configuration . < p >
* @ param publishedResources a publish list
* @ return true if the complete Flex cache should be cleared */
public boolean shouldClearAll ( List < CmsPublishedResource > publishedResources ) { } }
|
for ( CmsPublishedResource pubRes : publishedResources ) { for ( String clearPath : m_clearAll ) { if ( CmsStringUtil . isPrefixPath ( clearPath , pubRes . getRootPath ( ) ) ) { return true ; } } } return false ;
|
public class DeviceHelper { /** * Gets device mac address .
* @ param context App context .
* @ return Device mac address . */
private static String getMacAddress ( @ NonNull Context context ) { } }
|
if ( isWifiStatePermissionGranted ( context ) ) { WifiManager wifiManager = ( WifiManager ) context . getApplicationContext ( ) . getSystemService ( Context . WIFI_SERVICE ) ; if ( wifiManager != null ) { WifiInfo wifiInfo = wifiManager . getConnectionInfo ( ) ; if ( wifiInfo != null ) { return wifiInfo . getMacAddress ( ) ; } } } return null ;
|
public class AmazonAppStreamClient { /** * Retrieves a list that describes one or more specified Directory Config objects for AppStream 2.0 , if the names
* for these objects are provided . Otherwise , all Directory Config objects in the account are described . These
* objects include the information required to join streaming instances to an Active Directory domain .
* Although the response syntax in this topic includes the account password , this password is not returned in the
* actual response .
* @ param describeDirectoryConfigsRequest
* @ return Result of the DescribeDirectoryConfigs operation returned by the service .
* @ throws ResourceNotFoundException
* The specified resource was not found .
* @ sample AmazonAppStream . DescribeDirectoryConfigs
* @ see < a href = " http : / / docs . aws . amazon . com / goto / WebAPI / appstream - 2016-12-01 / DescribeDirectoryConfigs "
* target = " _ top " > AWS API Documentation < / a > */
@ Override public DescribeDirectoryConfigsResult describeDirectoryConfigs ( DescribeDirectoryConfigsRequest request ) { } }
|
request = beforeClientExecution ( request ) ; return executeDescribeDirectoryConfigs ( request ) ;
|
public class TreeMultiMap { /** * { @ inheritDoc } */
public boolean putMany ( K key , Collection < V > values ) { } }
|
// Short circuit when adding empty values to avoid adding a key with an
// empty mapping
if ( values . isEmpty ( ) ) return false ; Set < V > vals = map . get ( key ) ; if ( vals == null ) { vals = new HashSet < V > ( ) ; map . put ( key , vals ) ; } int oldSize = vals . size ( ) ; boolean added = vals . addAll ( values ) ; range += ( vals . size ( ) - oldSize ) ; return added ;
|
public class AbstractComponent { /** * Notify all the listeners . */
protected void notifyListeners ( ) { } }
|
Iterator it = listeners . iterator ( ) ; while ( it . hasNext ( ) ) { ( ( ComponentListener ) it . next ( ) ) . componentActivated ( this ) ; }
|
public class NTLMUtilities { /** * Extracts the target information block from the type 2 message .
* @ param msg the type 2 message byte array
* @ param msgFlags the flags if null then flags are extracted from the
* type 2 message
* @ return the target info */
public static byte [ ] extractTargetInfoFromType2Message ( byte [ ] msg , Integer msgFlags ) { } }
|
int flags = msgFlags == null ? extractFlagsFromType2Message ( msg ) : msgFlags ; if ( ! ByteUtilities . isFlagSet ( flags , FLAG_NEGOTIATE_TARGET_INFO ) ) return null ; int pos = 40 ; // isFlagSet ( flags , FLAG _ NEGOTIATE _ LOCAL _ CALL ) ? 40 : 32;
return readSecurityBufferTarget ( msg , pos ) ;
|
public class JsonGenerator { /** * Convenience method for outputting a field entry ( " member " )
* that has a boolean value . Equivalent to :
* < pre >
* writeFieldName ( fieldName ) ;
* writeBoolean ( value ) ;
* < / pre > */
public final void writeBooleanField ( String fieldName , boolean value ) throws IOException , JsonGenerationException { } }
|
writeFieldName ( fieldName ) ; writeBoolean ( value ) ;
|
public class LifecycleInjector { /** * This is a shortcut to configuring the LifecycleInjectorBuilder using annotations .
* Using bootstrap a main application class can simply be annotated with
* custom annotations that are mapped to { @ link BootstrapModule } s .
* Each annotations can then map to a subsystem or feature that is enabled on
* the main application class . { @ link BootstrapModule } s are installed in the order in which
* they are defined .
* @ see { @ link Bootstrap }
* @ param main Main application bootstrap class
* @ param externalBindings Bindings that are provided externally by the caller to bootstrap . These
* bindings are injectable into the BootstrapModule instances
* @ param externalBootstrapModules Optional modules that are processed after all the main class bootstrap modules
* @ return The created injector */
@ Beta public static Injector bootstrap ( final Class < ? > main , final Module externalBindings , final BootstrapModule ... externalBootstrapModules ) { } }
|
final LifecycleInjectorBuilder builder = LifecycleInjector . builder ( ) ; // Create a temporary Guice injector for the purpose of constructing the list of
// BootstrapModules which can inject any of the bootstrap annotations as well as
// the externally provided bindings .
// Creation order ,
// 1 . Construct all BootstrapModule classes
// 2 . Inject external bindings into BootstrapModule instances
// 3 . Create the bootstrap injector with these modules
Injector injector = Guice . createInjector ( new AbstractModule ( ) { @ SuppressWarnings ( { "unchecked" , "rawtypes" } ) @ Override protected void configure ( ) { if ( externalBindings != null ) install ( externalBindings ) ; Multibinder < BootstrapModule > bootstrapModules = Multibinder . newSetBinder ( binder ( ) , BootstrapModule . class ) ; Multibinder < LifecycleInjectorBuilderSuite > suites = Multibinder . newSetBinder ( binder ( ) , LifecycleInjectorBuilderSuite . class ) ; if ( externalBootstrapModules != null ) { for ( final BootstrapModule bootstrapModule : externalBootstrapModules ) { bootstrapModules . addBinding ( ) . toProvider ( new MemberInjectingInstanceProvider < BootstrapModule > ( bootstrapModule ) ) ; } } // Iterate through all annotations of the main class and convert them into
// their BootstrapModules
for ( final Annotation annot : main . getDeclaredAnnotations ( ) ) { final Class < ? extends Annotation > type = annot . annotationType ( ) ; LOG . info ( "Found bootstrap annotation {}" , type . getName ( ) ) ; Bootstrap bootstrap = type . getAnnotation ( Bootstrap . class ) ; if ( bootstrap != null ) { boolean added = false ; // This is a suite
if ( ! bootstrap . value ( ) . equals ( Bootstrap . NullLifecycleInjectorBuilderSuite . class ) ) { LOG . info ( "Adding Suite {}" , bootstrap . bootstrap ( ) ) ; suites . addBinding ( ) . to ( bootstrap . value ( ) ) . asEagerSingleton ( ) ; added = true ; } // This is a bootstrap module
if ( ! bootstrap . bootstrap ( ) . equals ( Bootstrap . NullBootstrapModule . class ) ) { Preconditions . checkState ( added == false , "%s already added as a LifecycleInjectorBuilderSuite" , bootstrap . annotationType ( ) . getName ( ) ) ; added = true ; LOG . info ( "Adding BootstrapModule {}" , bootstrap . bootstrap ( ) ) ; bootstrapModules . addBinding ( ) . to ( bootstrap . bootstrap ( ) ) . asEagerSingleton ( ) ; // Make this annotation injectable into any plain Module
builder . withAdditionalBootstrapModules ( forAnnotation ( annot ) ) ; } // This is a plain guice module
if ( ! bootstrap . module ( ) . equals ( Bootstrap . NullModule . class ) ) { Preconditions . checkState ( added == false , "%s already added as a BootstrapModule" , bootstrap . annotationType ( ) . getName ( ) ) ; added = true ; LOG . info ( "Adding Module {}" , bootstrap . bootstrap ( ) ) ; builder . withAdditionalModuleClasses ( bootstrap . module ( ) ) ; // Make the annotation injectable into the module
builder . withAdditionalBootstrapModules ( forAnnotation ( annot ) ) ; } // Makes the annotation injectable into LifecycleInjectorBuilderSuite
bind ( Key . get ( type ) ) . toProvider ( new Provider ( ) { @ Override public Object get ( ) { return annot ; } } ) . in ( Scopes . SINGLETON ) ; } } } } ) ; // First , give all LifecycleInjectorBuilderSuite ' s priority
Set < LifecycleInjectorBuilderSuite > suites = injector . getInstance ( Key . get ( new TypeLiteral < Set < LifecycleInjectorBuilderSuite > > ( ) { } ) ) ; for ( LifecycleInjectorBuilderSuite suite : suites ) { suite . configure ( builder ) ; } // Next , install BootstrapModule ' s
builder . withAdditionalBootstrapModules ( injector . getInstance ( Key . get ( new TypeLiteral < Set < BootstrapModule > > ( ) { } ) ) ) ; // The main class is added last so it can override any bindings from the BootstrapModule ' s and LifecycleInjectorBuilderSuite ' s
if ( Module . class . isAssignableFrom ( main ) ) { try { builder . withAdditionalModuleClasses ( main ) ; } catch ( Exception e ) { throw new ProvisionException ( String . format ( "Failed to create module for main class '%s'" , main . getName ( ) ) , e ) ; } } // Finally , create and return the injector
return builder . build ( ) . createInjector ( ) ;
|
public class MalformedTypeException { /** * Returns first message , prefixed with the malformed type . */
@ Override public String getMessage ( ) { } }
|
String message = super . getMessage ( ) ; if ( mType != null ) { message = mType . getName ( ) + ": " + message ; } return message ;
|
public class Sql { /** * Performs the given SQL query and return the rows of the result set .
* In addition , the < code > metaClosure < / code > will be called once passing in the
* < code > ResultSetMetaData < / code > as argument .
* Example usage :
* < pre >
* def printNumCols = { meta { @ code - > } println " Found $ meta . columnCount columns " }
* def ans = sql . rows ( " select * from PERSON " , printNumCols )
* println " Found $ { ans . size ( ) } rows "
* < / pre >
* Resource handling is performed automatically where appropriate .
* @ param sql the SQL statement
* @ param metaClosure called with meta data of the ResultSet
* @ return a list of GroovyRowResult objects
* @ throws SQLException if a database access error occurs */
public List < GroovyRowResult > rows ( String sql , @ ClosureParams ( value = SimpleType . class , options = "java.sql.ResultSetMetaData" ) Closure metaClosure ) throws SQLException { } }
|
return rows ( sql , 0 , 0 , metaClosure ) ;
|
public class CronUtils { /** * Converts repeating segments from " short " Quartz form to " extended "
* SauronSoftware form . For example & quot ; 0/5 & quot ; will be converted to
* & quot ; 0-59/5 & quot ; , & quot ; / 3 & quot ; will be converted to & quot ; * & # 47;3 & quot ;
* @ param eSource item
* @ param maxMaximal value in this item ( " 59 " for minutes , " 23 " for hours , etc . )
* @ return Modified string */
private static String extendRepeating ( String e , String max ) { } }
|
String [ ] parts = e . split ( "," ) ; for ( int i = 0 ; i < parts . length ; ++ i ) { if ( parts [ i ] . indexOf ( '-' ) == - 1 && parts [ i ] . indexOf ( '*' ) == - 1 ) { int indSlash = parts [ i ] . indexOf ( '/' ) ; if ( indSlash == 0 ) { parts [ i ] = "*" + parts [ i ] ; } else if ( indSlash > 0 ) { parts [ i ] = parts [ i ] . substring ( 0 , indSlash ) + "-" + max + parts [ i ] . substring ( indSlash ) ; } } } return concat ( ',' , parts ) ;
|
public class ConsonantUtil { /** * * * * * * BEGINNING OF FUNCTION * * * * * */
/ * / public static boolean is_ashanta ( String str ) { } }
|
String s1 = VarnaUtil . getAntyaVarna ( str ) ; if ( is_ash ( s1 ) ) return true ; return false ;
|
public class JsCodeBuilder { /** * Serializes the given { @ link JsDoc } into the code builder , respecting the code builder ' s current
* indentation level . */
public JsCodeBuilder append ( JsDoc jsDoc ) { } }
|
jsDoc . collectRequires ( requireCollector ) ; return appendLine ( jsDoc . toString ( ) ) ;
|
public class CoalescedWriteBehindQueue { /** * If this is an existing key in this queue , use previously set store time ;
* since we do not want to shift store time of an existing key on every update . */
private void calculateStoreTime ( DelayedEntry delayedEntry ) { } }
|
Data key = ( Data ) delayedEntry . getKey ( ) ; DelayedEntry currentEntry = map . get ( key ) ; if ( currentEntry != null ) { long currentStoreTime = currentEntry . getStoreTime ( ) ; delayedEntry . setStoreTime ( currentStoreTime ) ; }
|
public class ListResourcesRequestMarshaller { /** * Marshall the given parameter object . */
public void marshall ( ListResourcesRequest listResourcesRequest , ProtocolMarshaller protocolMarshaller ) { } }
|
if ( listResourcesRequest == null ) { throw new SdkClientException ( "Invalid argument passed to marshall(...)" ) ; } try { protocolMarshaller . marshall ( listResourcesRequest . getOrganizationId ( ) , ORGANIZATIONID_BINDING ) ; protocolMarshaller . marshall ( listResourcesRequest . getNextToken ( ) , NEXTTOKEN_BINDING ) ; protocolMarshaller . marshall ( listResourcesRequest . getMaxResults ( ) , MAXRESULTS_BINDING ) ; } catch ( Exception e ) { throw new SdkClientException ( "Unable to marshall request to JSON: " + e . getMessage ( ) , e ) ; }
|
public class DividerAdapterBuilder { /** * Sets the divider that appears between all of the wrapped adapters items . */
@ NonNull public DividerAdapterBuilder innerView ( @ NonNull ViewFactory viewFactory ) { } }
|
mInnerItem = new Item ( checkNotNull ( viewFactory , "viewFactory" ) , false ) ; return this ;
|
public class GrowQueue_I8 { /** * Removes elements from the list starting at ' first ' and ending at ' last '
* @ param first First index you wish to remove . Inclusive .
* @ param last Last index you wish to remove . Inclusive . */
public void remove ( int first , int last ) { } }
|
if ( last < first ) throw new IllegalArgumentException ( "first <= last" ) ; if ( last >= size ) throw new IllegalArgumentException ( "last must be less than the max size" ) ; int delta = last - first + 1 ; for ( int i = last + 1 ; i < size ; i ++ ) { data [ i - delta ] = data [ i ] ; } size -= delta ;
|
public class DependencyResolver { /** * Creates an instance of the resolver .
* @ param elements
* The elements to resolve .
* @ param dependencyProvider
* The dependency provider .
* @ param < T >
* The element type .
* @ return The resolver . */
public static < T > DependencyResolver < T > newInstance ( Collection < T > elements , DependencyProvider < T > dependencyProvider ) { } }
|
return new DependencyResolver < T > ( elements , dependencyProvider ) ;
|
public class CompositeQuery { /** * Validate as rule body , Ensure :
* - no negation nesting
* - no disjunctions
* - at most single negation block
* @ param graph transaction to be validated against
* @ param pattern pattern to be validated
* @ return set of error messages applicable */
public static Set < String > validateAsRuleBody ( Conjunction < Pattern > pattern , Rule rule , TransactionOLTP graph ) { } }
|
Set < String > errors = new HashSet < > ( ) ; try { CompositeQuery body = ReasonerQueries . composite ( pattern , graph ) ; Set < ResolvableQuery > complementQueries = body . getComplementQueries ( ) ; if ( complementQueries . size ( ) > 1 ) { errors . add ( ErrorMessage . VALIDATION_RULE_MULTIPLE_NEGATION_BLOCKS . getMessage ( rule . label ( ) ) ) ; } if ( ! body . isPositive ( ) && complementQueries . stream ( ) . noneMatch ( ReasonerQuery :: isPositive ) ) { errors . add ( ErrorMessage . VALIDATION_RULE_NESTED_NEGATION . getMessage ( rule . label ( ) ) ) ; } } catch ( GraqlQueryException e ) { errors . add ( ErrorMessage . VALIDATION_RULE_INVALID . getMessage ( rule . label ( ) , e . getMessage ( ) ) ) ; } return errors ;
|
public class TriggerBuilder { /** * Produce the < code > OperableTrigger < / code > .
* @ return a OperableTrigger that meets the specifications of the builder . */
public OperableTrigger build ( ) { } }
|
// if ( scheduleBuilder = = null ) {
// scheduleBuilder = SimpleScheduleBuilder . simpleScheduleBuilder ( ) ;
// get a trigger impl . but without the meta data filled in yet
// OperableTrigger operableTrigger = operableTrigger ;
operableTrigger = instantiate ( ) ; // fill in metadata
operableTrigger . setCalendarName ( calendarName ) ; operableTrigger . setDescription ( description ) ; operableTrigger . setEndTime ( endTime ) ; if ( name == null ) { name = UUID . randomUUID ( ) . toString ( ) ; } operableTrigger . setName ( name ) ; if ( jobName != null ) { operableTrigger . setJobName ( jobName ) ; } operableTrigger . setPriority ( priority ) ; operableTrigger . setStartTime ( startTime ) ; if ( ! jobDataMap . isEmpty ( ) ) { operableTrigger . setJobDataMap ( jobDataMap ) ; } return operableTrigger ;
|
public class RevisionUtils { /** * For a given article revision , the method returns the revision of the article discussion
* page which was current at the time the revision was created .
* @ param revisionId revision of the article for which the talk page revision should be retrieved
* @ return the revision of the talk page that was current at the creation time of the given article revision
* @ throws WikiApiException if any error occurred accessing the Wiki db
* @ throws WikiPageNotFoundException if no discussion page was available at the time of the given article revision */
public Revision getDiscussionRevisionForArticleRevision ( int revisionId ) throws WikiApiException , WikiPageNotFoundException { } }
|
// get article revision
Revision rev = revApi . getRevision ( revisionId ) ; Timestamp revTime = rev . getTimeStamp ( ) ; // get corresponding discussion page
Page discussion = wiki . getDiscussionPage ( rev . getArticleID ( ) ) ; /* * find correct revision of discussion page */
List < Timestamp > discussionTs = revApi . getRevisionTimestamps ( discussion . getPageId ( ) ) ; // sort in reverse order - newest first
Collections . sort ( discussionTs , new Comparator < Timestamp > ( ) { public int compare ( Timestamp ts1 , Timestamp ts2 ) { return ts2 . compareTo ( ts1 ) ; } } ) ; // find first timestamp equal to or before the article revision timestamp
for ( Timestamp curDiscTime : discussionTs ) { if ( curDiscTime == revTime || curDiscTime . before ( revTime ) ) { return revApi . getRevision ( discussion . getPageId ( ) , curDiscTime ) ; } } throw new WikiPageNotFoundException ( "Not discussion page was available at the time of the given article revision" ) ;
|
public class FileUtils { /** * Metodo encargado de limpiar la estructura de directorios temporales . Esta
* metodo va borrando del currentPathDir hasta el basePathFile siempre que
* los directorios esten vacios .
* Ej : currentPathFile = / export / share - images / 2009/03/12 / LOCAL Ej :
* basePathFile = / export / share - images Iria borrando los directorios LOCAL ,
* 12 , 03 , 2009 solo si estos entan vacios
* @ param currentPathFile
* Representa el directorio del inicio de la limpieza . */
public static void cleanParentDirectories ( File currentPathFile , File basePathFile ) { } }
|
if ( currentPathFile == null ) { log . warn ( "El path inicial es nulo" ) ; return ; } if ( basePathFile == null ) { log . warn ( "El path final es nulo" ) ; return ; } try { if ( ! basePathFile . equals ( currentPathFile ) ) { if ( currentPathFile . isDirectory ( ) && currentPathFile . list ( ) . length == 0 ) { if ( log . isDebugEnabled ( ) ) { log . debug ( "Borrando el directorio vacio:'" + currentPathFile . getAbsolutePath ( ) + "'" ) ; } if ( currentPathFile . delete ( ) ) { cleanParentDirectories ( currentPathFile . getParentFile ( ) , basePathFile ) ; } } } } catch ( Exception e ) { log . error ( "Borando los directorios desde :" + currentPathFile . getAbsolutePath ( ) + " hasta:" + basePathFile . getAbsolutePath ( ) + "." ) ; return ; }
|
public class NullArgumentException { /** * Validates that the string is not null and not an empty string without trimming the string .
* @ param stringToCheck The object to be tested .
* @ param argumentName The name of the object , which is used to construct the exception message .
* @ throws NullArgumentException if the stringToCheck is either null or zero characters long . */
public static void validateNotEmpty ( String stringToCheck , String argumentName ) throws NullArgumentException { } }
|
validateNotEmpty ( stringToCheck , false , argumentName ) ;
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.