idx
int64
0
165k
question
stringlengths
73
5.81k
target
stringlengths
5
918
11,200
private Name makeOperatorName ( String name ) { Name opName = names . fromString ( name ) ; operatorNames . add ( opName ) ; return opName ; }
Create a new operator name from corresponding String representation and add the name to the set of known operator names .
11,201
public Widget put ( IWidgetFactory factory , String name ) { Widget widget = factory . getWidget ( ) ; put ( widget , name ) ; return widget ; }
Creates new widget and puts it to container at first free index
11,202
public static String getEventTypeDescription ( final XMLStreamReader reader ) { final int eventType = reader . getEventType ( ) ; if ( eventType == XMLStreamConstants . START_ELEMENT ) { final String namespace = reader . getNamespaceURI ( ) ; return "<" + reader . getLocalName ( ) + ( ! StringUtils . isEmpty ( namespac...
Returns string describing the current event .
11,203
public static boolean isStartElement ( final XMLStreamReader reader , final String namespace , final String localName ) { return reader . getEventType ( ) == XMLStreamConstants . START_ELEMENT && nameEquals ( reader , namespace , localName ) ; }
Method isStartElement .
11,204
public static boolean nameEquals ( final XMLStreamReader reader , final String namespace , final String localName ) { if ( ! reader . getLocalName ( ) . equals ( localName ) ) { return false ; } if ( namespace == null ) { return true ; } final String namespaceURI = reader . getNamespaceURI ( ) ; if ( namespaceURI == nu...
Method nameEquals .
11,205
public static Class optionalClassAttribute ( final XMLStreamReader reader , final String localName , final Class defaultValue ) throws XMLStreamException { return optionalClassAttribute ( reader , null , localName , defaultValue ) ; }
Returns the value of an attribute as a Class . If the attribute is empty this method returns the default value provided .
11,206
public static void skipElement ( final XMLStreamReader reader ) throws XMLStreamException , IOException { if ( reader . getEventType ( ) != XMLStreamConstants . START_ELEMENT ) { return ; } final String namespace = reader . getNamespaceURI ( ) ; final String name = reader . getLocalName ( ) ; for ( ; ; ) { switch ( rea...
Method skipElement .
11,207
public UriBuilder path ( String path ) throws URISyntaxException { path = path . trim ( ) ; if ( getPath ( ) . endsWith ( "/" ) ) { return new UriBuilder ( setPath ( String . format ( "%s%s" , getPath ( ) , path ) ) ) ; } else { return new UriBuilder ( setPath ( String . format ( "%s/%s" , getPath ( ) , path ) ) ) ; } ...
Appends a path to the current one
11,208
public < T > ApruveResponse < List < T > > index ( String path , GenericType < List < T > > resultType ) { Response response = restRequest ( path ) . get ( ) ; List < T > responseObject = null ; ApruveResponse < List < T > > result ; if ( response . getStatusInfo ( ) . getFamily ( ) == Family . SUCCESSFUL ) { responseO...
is kind of a pain and it duplicates processResponse .
11,209
public < T > ApruveResponse < T > get ( String path , Class < T > resultType ) { Response response = restRequest ( path ) . get ( ) ; return processResponse ( response , resultType ) ; }
Issues a GET request against to the Apruve REST API using the specified path .
11,210
public boolean sync ( NewRelicCache cache ) { if ( cache == null ) throw new IllegalArgumentException ( "null cache" ) ; checkInitialize ( cache ) ; boolean ret = isInitialized ( ) ; if ( ! ret ) throw new IllegalStateException ( "cache not initialized" ) ; clear ( cache ) ; if ( ret ) ret = syncApplications ( cache ) ...
Synchronises the cache .
11,211
public boolean syncAlerts ( NewRelicCache cache ) { boolean ret = true ; if ( apiClient == null ) throw new IllegalArgumentException ( "null API client" ) ; if ( cache . isAlertsEnabled ( ) ) { ret = false ; logger . info ( "Getting the alert policies" ) ; Collection < AlertPolicy > policies = apiClient . alertPolicies...
Synchronise the alerts configuration with the cache .
11,212
public boolean syncApplications ( NewRelicCache cache ) { boolean ret = true ; if ( apiClient == null ) throw new IllegalArgumentException ( "null API client" ) ; if ( cache . isApmEnabled ( ) || cache . isBrowserEnabled ( ) || cache . isMobileEnabled ( ) ) { ret = false ; if ( cache . isApmEnabled ( ) ) { logger . inf...
Synchronise the application configuration with the cache .
11,213
public boolean syncPlugins ( NewRelicCache cache ) { boolean ret = true ; if ( apiClient == null ) throw new IllegalArgumentException ( "null API client" ) ; if ( cache . isPluginsEnabled ( ) ) { ret = false ; logger . info ( "Getting the plugins" ) ; Collection < Plugin > plugins = apiClient . plugins ( ) . list ( tru...
Synchronise the Plugins configuration with the cache .
11,214
public boolean syncMonitors ( NewRelicCache cache ) { boolean ret = true ; if ( apiClient == null ) throw new IllegalArgumentException ( "null API client" ) ; if ( cache . isSyntheticsEnabled ( ) ) { ret = false ; logger . info ( "Getting the monitors" ) ; cache . monitors ( ) . add ( syntheticsApiClient . monitors ( )...
Synchronise the Synthetics configuration with the cache .
11,215
public boolean syncServers ( NewRelicCache cache ) { boolean ret = true ; if ( apiClient == null ) throw new IllegalArgumentException ( "null API client" ) ; if ( cache . isServersEnabled ( ) ) { ret = false ; logger . info ( "Getting the servers" ) ; cache . servers ( ) . add ( apiClient . servers ( ) . list ( ) ) ; c...
Synchronise the server configuration with the cache .
11,216
public boolean syncLabels ( NewRelicCache cache ) { boolean ret = true ; if ( apiClient == null ) throw new IllegalArgumentException ( "null API client" ) ; if ( cache . isApmEnabled ( ) || cache . isSyntheticsEnabled ( ) ) { ret = false ; logger . info ( "Getting the labels" ) ; Collection < Label > labels = apiClient...
Synchronise the label configuration with the cache .
11,217
public boolean syncDashboards ( NewRelicCache cache ) { boolean ret = true ; if ( apiClient == null ) throw new IllegalArgumentException ( "null API client" ) ; if ( cache . isInsightsEnabled ( ) ) { ret = false ; logger . info ( "Getting the dashboards" ) ; cache . dashboards ( ) . set ( apiClient . dashboards ( ) . l...
Synchronise the dashboard configuration with the cache .
11,218
public static String stringFor ( int m ) { switch ( m ) { case CUFFT_SUCCESS : return "CUFFT_SUCCESS" ; case CUFFT_INVALID_PLAN : return "CUFFT_INVALID_PLAN" ; case CUFFT_ALLOC_FAILED : return "CUFFT_ALLOC_FAILED" ; case CUFFT_INVALID_TYPE : return "CUFFT_INVALID_TYPE" ; case CUFFT_INVALID_VALUE : return "CUFFT_INVALID...
Returns the String identifying the given cufftResult
11,219
protected SocialProfile parseProfile ( Map < String , Object > props ) { if ( ! props . containsKey ( "id" ) ) { throw new IllegalArgumentException ( "No id in profile" ) ; } SocialProfile profile = SocialProfile . with ( props ) . displayName ( "name" ) . first ( "first_name" ) . last ( "last_name" ) . id ( "id" ) . u...
Property names for Facebook - Override to customize
11,220
private void parsePackageClasses ( String name , List < JavaFileObject > files , ListBuffer < JCCompilationUnit > trees , List < String > excludedPackages ) throws IOException { if ( excludedPackages . contains ( name ) ) { return ; } docenv . notice ( "main.Loading_source_files_for_package" , name ) ; if ( files == nu...
search all directories in path for subdirectory name . Add all . java files found in such a directory to args .
11,221
private static boolean isValidJavaClassFile ( String file ) { if ( ! file . endsWith ( ".class" ) ) return false ; String clazzName = file . substring ( 0 , file . length ( ) - ".class" . length ( ) ) ; return isValidClassName ( clazzName ) ; }
Return true if given file name is a valid class file name .
11,222
public void enter ( Symbol sym , Scope s , Scope origin , boolean staticallyImported ) { Assert . check ( shared == 0 ) ; if ( nelems * 3 >= hashMask * 2 ) dble ( ) ; int hash = getIndex ( sym . name ) ; Entry old = table [ hash ] ; if ( old == null ) { old = sentinel ; nelems ++ ; } Entry e = makeEntry ( sym , old , e...
Enter symbol sym in this scope but mark that it comes from given scope s accessed through origin . The last two arguments are only used in import scopes .
11,223
public void reportDependence ( Symbol from , Symbol to ) { deps . collect ( from . packge ( ) . fullname , to . packge ( ) . fullname ) ; }
Collect dependencies in the enclosing class
11,224
public void put ( Object tree , int flags , int startPc , int endPc ) { entries . append ( new CRTEntry ( tree , flags , startPc , endPc ) ) ; }
Create a new CRTEntry and add it to the entries .
11,225
public int writeCRT ( ByteBuffer databuf , Position . LineMap lineMap , Log log ) { int crtEntries = 0 ; new SourceComputer ( ) . csp ( methodTree ) ; for ( List < CRTEntry > l = entries . toList ( ) ; l . nonEmpty ( ) ; l = l . tail ) { CRTEntry entry = l . head ; if ( entry . startPc == entry . endPc ) continue ; Sou...
Compute source positions and write CRT to the databuf .
11,226
private String getTypes ( int flags ) { String types = "" ; if ( ( flags & CRT_STATEMENT ) != 0 ) types += " CRT_STATEMENT" ; if ( ( flags & CRT_BLOCK ) != 0 ) types += " CRT_BLOCK" ; if ( ( flags & CRT_ASSIGNMENT ) != 0 ) types += " CRT_ASSIGNMENT" ; if ( ( flags & CRT_FLOW_CONTROLLER ) != 0 ) types += " CRT_FLOW_CONT...
Return string describing flags enabled .
11,227
@ Path ( "{id}" ) @ RolesAllowed ( { "ROLE_ADMIN" } ) public Response read ( @ PathParam ( "id" ) Long id ) { checkNotNull ( id ) ; return Response . ok ( userService . getById ( id ) ) . build ( ) ; }
Get details for a single user .
11,228
@ Path ( "search" ) @ RolesAllowed ( { "ROLE_ADMIN" } ) public Response search ( @ QueryParam ( "email" ) String email , @ QueryParam ( "username" ) String username , @ QueryParam ( "pageSize" ) @ DefaultValue ( "10" ) int pageSize , @ QueryParam ( "cursorKey" ) String cursorKey ) { final CursorPage < DUser > page ; if...
Search for users with matching email or username .
11,229
@ RolesAllowed ( { "ROLE_ADMIN" } ) public Response readPage ( @ QueryParam ( "pageSize" ) @ DefaultValue ( "10" ) int pageSize , @ QueryParam ( "cursorKey" ) String cursorKey ) { CursorPage < DUser > page = userService . readPage ( pageSize , cursorKey ) ; return Response . ok ( page ) . build ( ) ; }
Get a page of users .
11,230
@ Path ( "{id}/username" ) @ RolesAllowed ( { "ROLE_ADMIN" } ) public Response changeUsername ( @ PathParam ( "id" ) Long id , UsernameRequest usernameRequest ) { checkUsernameFormat ( usernameRequest . username ) ; userService . changeUsername ( id , usernameRequest . getUsername ( ) ) ; return Response . ok ( id ) . ...
Change a users username . The username must be unique
11,231
@ Path ( "{id}/password" ) public Response changePassword ( @ PathParam ( "id" ) Long userId , PasswordRequest request ) { checkNotNull ( userId ) ; checkNotNull ( request . getToken ( ) ) ; checkPasswordFormat ( request . getNewPassword ( ) ) ; boolean isSuccess = userService . confirmResetPasswordUsingToken ( userId ...
Change password using a temporary token . Used during password reset flow .
11,232
@ Path ( "password/reset" ) public Response resetPassword ( PasswordRequest request ) { checkNotNull ( request . getEmail ( ) ) ; userService . resetPassword ( request . getEmail ( ) ) ; return Response . noContent ( ) . build ( ) ; }
Reset user password by sending out a reset email .
11,233
@ Path ( "{id}/account/confirm" ) public Response confirmAccount ( @ PathParam ( "id" ) Long userId , AccountRequest request ) { checkNotNull ( userId ) ; checkNotNull ( request . getToken ( ) ) ; boolean isSuccess = userService . confirmAccountUsingToken ( userId , request . getToken ( ) ) ; return isSuccess ? Respons...
Confirm a newly create account using a temporary token .
11,234
@ Path ( "{id}/account/resend" ) public Response resendVerifyAccountEmail ( @ PathParam ( "id" ) Long userId ) { checkNotNull ( userId ) ; boolean isSuccess = userService . resendVerifyAccountEmail ( userId ) ; return isSuccess ? Response . noContent ( ) . build ( ) : Response . status ( Response . Status . BAD_REQUEST...
Resend account verification email .
11,235
@ Path ( "{id}/email" ) @ RolesAllowed ( { "ROLE_ADMIN" } ) public Response changeEmail ( @ PathParam ( "id" ) Long userId , EmailRequest request ) { checkNotNull ( userId ) ; checkEmailFormat ( request . getEmail ( ) ) ; boolean isSuccess = userService . changeEmailAddress ( userId , request . getEmail ( ) ) ; return ...
Admin changing a users email .
11,236
@ Path ( "{id}/email/confirm" ) public Response confirmChangeEmail ( @ PathParam ( "id" ) Long userId , EmailRequest request ) { checkNotNull ( userId ) ; checkNotNull ( request . getToken ( ) ) ; boolean isSuccess = userService . confirmEmailAddressChangeUsingToken ( userId , request . getToken ( ) ) ; return isSucces...
User confirm changing email . The token is verified and the temporary stored email will not be permanently saved as the users email .
11,237
public static Protocol createInstance ( ProtocolVersion version , SocketManager socketManager ) { switch ( version ) { case _63 : return new Protocol63 ( socketManager ) ; case _72 : return new Protocol72 ( socketManager ) ; case _73 : return new Protocol73 ( socketManager ) ; case _74 : return new Protocol74 ( socketM...
Create a new protocol instance . This instance cannot be used until the associated socket manager is connected .
11,238
public void prepareParameters ( Map < String , Object > extra ) { if ( paramConfig == null ) return ; for ( ParamConfig param : paramConfig ) { param . prepareParameter ( extra ) ; } }
Prepares the parameters for the report . This populates the Combo and ManyCombo box options if there is a groovy or report backing the data .
11,239
private FieldDoc getFieldDoc ( Configuration config , Tag tag , String name ) { if ( name == null || name . length ( ) == 0 ) { if ( tag . holder ( ) instanceof FieldDoc ) { return ( FieldDoc ) tag . holder ( ) ; } else { return null ; } } StringTokenizer st = new StringTokenizer ( name , "#" ) ; String memberName = nu...
Given the name of the field return the corresponding FieldDoc . Return null due to invalid use of value tag if the name is null or empty string and if the value tag is not used on a field .
11,240
public void constructed ( ) { Context context = factory . enterContext ( ) ; try { scope = new ImporterTopLevel ( context ) ; } finally { Context . exit ( ) ; } Container container = Jaguar . component ( Container . class ) ; Object store = container . component ( container . contexts ( ) . get ( Application . class ) ...
Sets up Mozilla Rhino s script scope . If the application is running on a Servlet container this method instantiates and initializes the Bootleg s default configuration internally .
11,241
public void activated ( ) { logger . info ( "Importing core packages ['org.eiichiro.gig', 'org.eiichiro.bootleg', 'org.eiichiro.jaguar', 'org.eiichiro.jaguar.deployment'] into JavaScript context" ) ; Context context = factory . enterContext ( ) ; try { context . evaluateString ( scope , "importPackage(Packages.org.eiic...
Attempts to load pre - defined configuration files .
11,242
public void load ( String file ) { Context context = factory . enterContext ( ) ; try { URL url = Thread . currentThread ( ) . getContextClassLoader ( ) . getResource ( file ) ; if ( url == null ) { logger . debug ( "Configuration [" + file + "] does not exist" ) ; return ; } File f = new File ( url . getPath ( ) ) ; i...
Loads the specified configuration file written in JavaScript .
11,243
public < T > void set ( String key , T value ) { Preconditions . checkArgument ( key != null && ! key . isEmpty ( ) , "Parameter 'key' must not be [" + key + "]" ) ; values . put ( key , value ) ; scope . put ( key , scope , value ) ; }
Sets the specified configuration setting with the specified key .
11,244
protected static char calcChecksumChar ( final String sMsg , final int nLength ) { ValueEnforcer . notNull ( sMsg , "Msg" ) ; ValueEnforcer . isBetweenInclusive ( nLength , "Length" , 0 , sMsg . length ( ) ) ; return asChar ( calcChecksum ( sMsg . toCharArray ( ) , nLength ) ) ; }
Calculates the check character for a given message
11,245
protected char scanSurrogates ( ) { if ( surrogatesSupported && Character . isHighSurrogate ( ch ) ) { char high = ch ; scanChar ( ) ; if ( Character . isLowSurrogate ( ch ) ) { return high ; } ch = high ; } return 0 ; }
Scan surrogate pairs . If ch is a high surrogate and the next character is a low surrogate then put the low surrogate in ch and return the high surrogate . otherwise just return 0 .
11,246
public static EValidity validateMessage ( final String sMsg ) { final int nLen = StringHelper . getLength ( sMsg ) ; if ( nLen >= 7 && nLen <= 8 ) if ( AbstractUPCEAN . validateMessage ( sMsg ) . isValid ( ) ) return EValidity . VALID ; return EValidity . INVALID ; }
Validates a EAN - 8 message . The method throws IllegalArgumentExceptions if an invalid message is passed .
11,247
protected String makeMethodString ( ExecutableElement e ) { StringBuilder result = new StringBuilder ( ) ; for ( Modifier modifier : e . getModifiers ( ) ) { result . append ( modifier . toString ( ) ) ; result . append ( " " ) ; } result . append ( e . getReturnType ( ) . toString ( ) ) ; result . append ( " " ) ; res...
Creates a String representation of a method element with everything necessary to track all public aspects of it in an API .
11,248
protected String makeVariableString ( VariableElement e ) { StringBuilder result = new StringBuilder ( ) ; for ( Modifier modifier : e . getModifiers ( ) ) { result . append ( modifier . toString ( ) ) ; result . append ( " " ) ; } result . append ( e . asType ( ) . toString ( ) ) ; result . append ( " " ) ; result . a...
Creates a String representation of a variable element with everything necessary to track all public aspects of it in an API .
11,249
public void add ( Collection < Deployment > deployments ) { for ( Deployment deployment : deployments ) this . deployments . put ( deployment . getId ( ) , deployment ) ; }
Adds the deployment list to the deployments for the account .
11,250
Type generateReturnConstraints ( JCTree tree , Attr . ResultInfo resultInfo , MethodType mt , InferenceContext inferenceContext ) { InferenceContext rsInfoInfContext = resultInfo . checkContext . inferenceContext ( ) ; Type from = mt . getReturnType ( ) ; if ( mt . getReturnType ( ) . containsAny ( inferenceContext . i...
Generate constraints from the generic method s return type . If the method call occurs in a context where a type T is expected use the expected type to derive more constraints on the generic method inference variables .
11,251
private void instantiateAsUninferredVars ( List < Type > vars , InferenceContext inferenceContext ) { ListBuffer < Type > todo = new ListBuffer < > ( ) ; for ( Type t : vars ) { UndetVar uv = ( UndetVar ) inferenceContext . asUndetVar ( t ) ; List < Type > upperBounds = uv . getBounds ( InferenceBound . UPPER ) ; if ( ...
Infer cyclic inference variables as described in 15 . 12 . 2 . 8 .
11,252
Type instantiatePolymorphicSignatureInstance ( Env < AttrContext > env , MethodSymbol spMethod , Resolve . MethodResolutionContext resolveContext , List < Type > argtypes ) { final Type restype ; switch ( env . next . tree . getTag ( ) ) { case TYPECAST : JCTypeCast castTree = ( JCTypeCast ) env . next . tree ; restype...
Compute a synthetic method type corresponding to the requested polymorphic method signature . The target return type is computed from the immediately enclosing scope surrounding the polymorphic - signature call .
11,253
void checkWithinBounds ( InferenceContext inferenceContext , Warner warn ) throws InferenceException { MultiUndetVarListener mlistener = new MultiUndetVarListener ( inferenceContext . undetvars ) ; List < Type > saved_undet = inferenceContext . save ( ) ; try { while ( true ) { mlistener . reset ( ) ; if ( ! allowGraph...
Check bounds and perform incorporation
11,254
void checkCompatibleUpperBounds ( UndetVar uv , InferenceContext inferenceContext ) { List < Type > hibounds = Type . filter ( uv . getBounds ( InferenceBound . UPPER ) , new BoundFilter ( inferenceContext ) ) ; Type hb = null ; if ( hibounds . isEmpty ( ) ) hb = syms . objectType ; else if ( hibounds . tail . isEmpty ...
Make sure that the upper bounds we got so far lead to a solvable inference variable by making sure that a glb exists .
11,255
public JwwfServer bindWebapp ( final Class < ? extends User > user , String url ) { if ( ! url . endsWith ( "/" ) ) url = url + "/" ; context . addServlet ( new ServletHolder ( new WebClientServelt ( clientCreator ) ) , url + "" ) ; context . addServlet ( new ServletHolder ( new SkinServlet ( ) ) , url + "__jwwf/skins/...
Binds webapp to address
11,256
public JwwfServer attachPlugin ( JwwfPlugin plugin ) { plugins . add ( plugin ) ; if ( plugin instanceof IPluginGlobal ) ( ( IPluginGlobal ) plugin ) . onAttach ( this ) ; return this ; }
Attahes new plugin to this server
11,257
public JwwfServer startAndJoin ( ) { try { server . start ( ) ; server . join ( ) ; } catch ( Exception e ) { e . printStackTrace ( ) ; } return this ; }
Starts Jetty server and waits for it
11,258
public static InputStream decode ( DataBinder binder , InputStream stream ) throws ParserConfigurationException , SAXException , IOException { XML . newSAXParser ( ) . parse ( stream , new XDBHandler ( binder ) ) ; return stream ; }
Decodes an XML stream . Returns the input stream .
11,259
void addBridge ( DiagnosticPosition pos , MethodSymbol meth , MethodSymbol impl , ClassSymbol origin , boolean hypothetical , ListBuffer < JCTree > bridges ) { make . at ( pos ) ; Type origType = types . memberType ( origin . type , meth ) ; Type origErasure = erasure ( origType ) ; Type bridgeType = meth . erasure ( t...
Add a bridge definition and enter corresponding method symbol in local scope of origin .
11,260
void addBridges ( DiagnosticPosition pos , ClassSymbol origin , ListBuffer < JCTree > bridges ) { Type st = types . supertype ( origin . type ) ; while ( st . hasTag ( CLASS ) ) { addBridges ( pos , st . tsym , origin , bridges ) ; st = types . supertype ( st ) ; } for ( List < Type > l = types . interfaces ( origin . ...
Add all necessary bridges to some class appending them to list buffer .
11,261
public void visitTypeApply ( JCTypeApply tree ) { JCTree clazz = translate ( tree . clazz , null ) ; result = clazz ; }
Visitor method for parameterized types .
11,262
public JCTree translateTopLevelClass ( JCTree cdef , TreeMaker make ) { this . make = make ; pt = null ; return translate ( cdef , null ) ; }
Translate a toplevel class definition .
11,263
protected void addAllProfilesLink ( Content div ) { Content linkContent = getHyperLink ( DocPaths . PROFILE_OVERVIEW_FRAME , allprofilesLabel , "" , "packageListFrame" ) ; Content span = HtmlTree . SPAN ( linkContent ) ; div . addContent ( span ) ; }
Adds All Profiles link for the top of the left - hand frame page to the documentation tree .
11,264
public BiStream < T , U > throwIfNull ( BiPredicate < ? super T , ? super U > biPredicate , Supplier < ? extends RuntimeException > e ) { Predicate < T > predicate = ( t ) -> biPredicate . test ( t , object ) ; return nonEmptyStream ( stream . filter ( predicate ) , e ) ; }
Compares the objects from stream to the injected object . If the rest of the stream equals null so exception is thrown .
11,265
void setCurrent ( TreePath path , DocCommentTree comment ) { currPath = path ; currDocComment = comment ; currElement = trees . getElement ( currPath ) ; currOverriddenMethods = ( ( JavacTypes ) types ) . getOverriddenMethods ( currElement ) ; AccessKind ak = AccessKind . PUBLIC ; for ( TreePath p = path ; p != null ; ...
Set the current declaration and its doc comment .
11,266
public static < E extends Enum < E > > Flags < E > valueOf ( Class < E > type , String values ) { Flags < E > flags = new Flags < E > ( type ) ; for ( String text : values . trim ( ) . split ( MULTI_VALUE_SEPARATOR ) ) { flags . set ( Enum . valueOf ( type , text ) ) ; } return flags ; }
Returns a Flags with a value represented by a string of concatenated enum literal names separated by any combination of a comma a colon or a white space .
11,267
public static void generate ( ConfigurationImpl configuration , PackageDoc packageDoc , int profileValue ) { ProfilePackageFrameWriter profpackgen ; try { String profileName = Profile . lookup ( profileValue ) . name ; profpackgen = new ProfilePackageFrameWriter ( configuration , packageDoc , profileName ) ; StringBuil...
Generate a profile package summary page for the left - hand bottom frame . Construct the ProfilePackageFrameWriter object and then uses it generate the file .
11,268
public static < First , Second > Pair < First , Second > from ( final First first , final Second second ) { return new ImmutablePair < First , Second > ( first , second ) ; }
Create a simple pair from it s first and second component .
11,269
public static < CommonSuperType , First extends CommonSuperType , Second extends CommonSuperType > CommonSuperType [ ] toArray ( final Pair < First , Second > pair , final Class < CommonSuperType > commonSuperType ) { @ SuppressWarnings ( "unchecked" ) final CommonSuperType [ ] array = ( CommonSuperType [ ] ) Array . n...
Transform a pair into an array of the common super type of both components .
11,270
public static < CommonSuperType , First extends CommonSuperType , Second extends CommonSuperType > CommonSuperType [ ] toArray ( final Pair < First , Second > pair , final CommonSuperType [ ] target , final int offset ) { target [ offset ] = pair . getFirst ( ) ; target [ offset + 1 ] = pair . getSecond ( ) ; return ta...
Write a pair into an array of the common super type of both components .
11,271
public void setFilter ( Service . Filter filter ) { _filter = _filter == null ? filter : new CompoundServiceFilter ( filter , _filter ) ; }
Installs a service filter .
11,272
public void setFilters ( List < Service . Filter > filters ) { for ( Service . Filter filter : filters ) setFilter ( filter ) ; }
Installs a list of service filters . This method is designed to facilitate Spring bean assembly .
11,273
private Interaction findContext ( String id ) { for ( int i = _currentInteractions . size ( ) - 1 ; i >= 0 ; i -- ) { Interaction ia = ( Interaction ) _currentInteractions . get ( i ) ; if ( ia . id . equals ( id ) ) { return ia ; } } return null ; }
Caller must hold lock on interactions
11,274
public List < RpcResponse > request ( List < RpcRequest > reqList ) { for ( RpcRequest req : reqList ) { this . reqList . add ( req ) ; } return null ; }
Adds all requests in reqList to internal request list
11,275
public static KindName kindName ( int kind ) { switch ( kind ) { case PCK : return KindName . PACKAGE ; case TYP : return KindName . CLASS ; case VAR : return KindName . VAR ; case VAL : return KindName . VAL ; case MTH : return KindName . METHOD ; default : throw new AssertionError ( "Unexpected kind: " + kind ) ; } }
A KindName representing a given symbol kind
11,276
public static KindName absentKind ( int kind ) { switch ( kind ) { case ABSENT_VAR : return KindName . VAR ; case WRONG_MTHS : case WRONG_MTH : case ABSENT_MTH : case WRONG_STATICNESS : return KindName . METHOD ; case ABSENT_TYP : return KindName . CLASS ; default : throw new AssertionError ( "Unexpected kind: " + kind...
A KindName representing the kind of a missing symbol given an error kind .
11,277
public ICommonsList < IBANElementValue > parseToElementValues ( final String sIBAN ) { ValueEnforcer . notNull ( sIBAN , "IBANString" ) ; final String sRealIBAN = IBANManager . unifyIBAN ( sIBAN ) ; if ( sRealIBAN . length ( ) != m_nExpectedLength ) throw new IllegalArgumentException ( "Passed IBAN has an invalid lengt...
Parse a given IBAN number string and convert it to elements according to this country s definition of IBAN numbers .
11,278
public static IBANCountryData createFromString ( final String sCountryCode , final int nExpectedLength , final String sLayout , final String sFixedCheckDigits , final LocalDate aValidFrom , final LocalDate aValidTo , final String sDesc ) { ValueEnforcer . notEmpty ( sDesc , "Desc" ) ; if ( sDesc . length ( ) < 4 ) thro...
This method is used to create an instance of this class from a string representation .
11,279
protected final void setControllerPath ( String path ) { requireNonNull ( path , "Global path cannot be change to 'null'" ) ; if ( ! "" . equals ( path ) && ! "/" . equals ( path ) ) { this . controllerPath = pathCorrector . apply ( path ) ; } }
Creates a resource part of the path unified for all routes defined in the inherited class
11,280
public void scan ( final String [ ] packages ) { LOGGER . info ( "Scanning packages {}:" , ArrayUtils . toString ( packages ) ) ; for ( final String pkg : packages ) { try { final String pkgFile = pkg . replace ( '.' , '/' ) ; final Enumeration < URL > urls = getRootClassloader ( ) . getResources ( pkgFile ) ; while ( ...
Scans packages for matching Java classes .
11,281
int run ( String [ ] args ) { try { handleOptions ( args ) ; if ( classes == null || classes . size ( ) == 0 ) { if ( options . help || options . version || options . fullVersion ) return EXIT_OK ; else return EXIT_CMDERR ; } try { return run ( ) ; } finally { if ( defaultFileManager != null ) { try { defaultFileManage...
Compiler terminated abnormally
11,282
public String [ ] getMetaKeywords ( Profile profile ) { if ( configuration . keywords ) { String profileName = profile . name ; return new String [ ] { profileName + " " + "profile" } ; } else { return new String [ ] { } ; } }
Get the profile keywords .
11,283
public R scan ( Tree node , P p ) { return ( node == null ) ? null : node . accept ( this , p ) ; }
Scan a single node .
11,284
public void setAuthorizedPatternArray ( String [ ] patterns ) { Matcher matcher ; patterns : for ( String pattern : patterns ) { if ( ( matcher = IPv4_ADDRESS_PATTERN . matcher ( pattern ) ) . matches ( ) ) { short [ ] address = new short [ 4 ] ; for ( int i = 0 ; i < address . length ; ++ i ) { String p = matcher . gr...
Adds authorized address patterns as a String array .
11,285
private boolean findJavaSourceFiles ( String [ ] args ) { String prev = "" ; for ( String s : args ) { if ( s . endsWith ( ".java" ) && ! prev . equals ( "-xf" ) && ! prev . equals ( "-if" ) ) { return true ; } prev = s ; } return false ; }
Are java source files passed on the command line?
11,286
private boolean findAtFile ( String [ ] args ) { for ( String s : args ) { if ( s . startsWith ( "@" ) ) { return true ; } } return false ; }
Is an at file passed on the command line?
11,287
private String findLogLevel ( String [ ] args ) { for ( String s : args ) { if ( s . startsWith ( "--log=" ) && s . length ( ) > 6 ) { return s . substring ( 6 ) ; } if ( s . equals ( "-verbose" ) ) { return "info" ; } } return "info" ; }
Find the log level setting .
11,288
private static boolean makeSureExists ( File dir ) { if ( ! dir . exists ( ) ) { if ( ! dir . mkdirs ( ) ) { Log . error ( "Could not create the directory " + dir . getPath ( ) ) ; return false ; } } return true ; }
Make sure directory exist create it if not .
11,289
private static void checkPattern ( String s ) throws ProblemException { Pattern p = Pattern . compile ( "[a-zA-Z_]{1}[a-zA-Z0-9_]*(\\.[a-zA-Z_]{1}[a-zA-Z0-9_]*)*(\\.\\*)?+" ) ; Matcher m = p . matcher ( s ) ; if ( ! m . matches ( ) ) { throw new ProblemException ( "The string \"" + s + "\" is not a proper package name ...
Verify that a package pattern is valid .
11,290
private static void checkFilePattern ( String s ) throws ProblemException { Pattern p = null ; if ( File . separatorChar == '\\' ) { p = Pattern . compile ( "\\*?(.+\\\\)*.+" ) ; } else if ( File . separatorChar == '/' ) { p = Pattern . compile ( "\\*?(.+/)*.+" ) ; } else { throw new ProblemException ( "This platform u...
Verify that a source file name is valid .
11,291
private static boolean hasOption ( String [ ] args , String option ) { for ( String a : args ) { if ( a . equals ( option ) ) return true ; } return false ; }
Scan the arguments to find an option is used .
11,292
private static void rewriteOptions ( String [ ] args , String option , String new_option ) { for ( int i = 0 ; i < args . length ; ++ i ) { if ( args [ i ] . equals ( option ) ) { args [ i ] = new_option ; } } }
Rewrite a single option into something else .
11,293
private static File findDirectoryOption ( String [ ] args , String option , String name , boolean needed , boolean allow_dups , boolean create ) throws ProblemException , ProblemException { File dir = null ; for ( int i = 0 ; i < args . length ; ++ i ) { if ( args [ i ] . equals ( option ) ) { if ( dir != null ) { thro...
Scan the arguments to find an option that specifies a directory . Create the directory if necessary .
11,294
private static boolean shouldBeFollowedByPath ( String o ) { return o . equals ( "-s" ) || o . equals ( "-h" ) || o . equals ( "-d" ) || o . equals ( "-sourcepath" ) || o . equals ( "-classpath" ) || o . equals ( "-cp" ) || o . equals ( "-bootclasspath" ) || o . equals ( "-src" ) ; }
Option is followed by path .
11,295
private static String [ ] addSrcBeforeDirectories ( String [ ] args ) { List < String > newargs = new ArrayList < String > ( ) ; for ( int i = 0 ; i < args . length ; ++ i ) { File dir = new File ( args [ i ] ) ; if ( dir . exists ( ) && dir . isDirectory ( ) ) { if ( i == 0 || ! shouldBeFollowedByPath ( args [ i - 1 ]...
Add - src before source root directories if not already there .
11,296
private static void checkSrcOption ( String [ ] args ) throws ProblemException { Set < File > dirs = new HashSet < File > ( ) ; for ( int i = 0 ; i < args . length ; ++ i ) { if ( args [ i ] . equals ( "-src" ) ) { if ( i + 1 >= args . length ) { throw new ProblemException ( "You have to specify a directory following -...
Check the - src options .
11,297
private static File findFileOption ( String [ ] args , String option , String name , boolean needed ) throws ProblemException , ProblemException { File file = null ; for ( int i = 0 ; i < args . length ; ++ i ) { if ( args [ i ] . equals ( option ) ) { if ( file != null ) { throw new ProblemException ( "You have alread...
Scan the arguments to find an option that specifies a file .
11,298
public static boolean findBooleanOption ( String [ ] args , String option ) { for ( int i = 0 ; i < args . length ; ++ i ) { if ( args [ i ] . equals ( option ) ) return true ; } return false ; }
Look for a specific switch return true if found .
11,299
public static int findNumberOption ( String [ ] args , String option ) { int rc = 0 ; for ( int i = 0 ; i < args . length ; ++ i ) { if ( args [ i ] . equals ( option ) ) { if ( args . length > i + 1 ) { rc = Integer . parseInt ( args [ i + 1 ] ) ; } } } return rc ; }
Scan the arguments to find an option that specifies a number .