idx int64 0 41.2k | question stringlengths 74 4.21k | target stringlengths 5 888 |
|---|---|---|
4,000 | public int getNextVisualPositionFrom ( int pos , Position . Bias b , Shape a , int direction , Position . Bias [ ] biasRet ) throws BadLocationException { if ( view != null ) { int nextPos = view . getNextVisualPositionFrom ( pos , b , a , direction , biasRet ) ; if ( nextPos != - 1 ) { pos = nextPos ; } else { biasRet... | Provides a way to determine the next visually represented model location that one might place a caret . Some views may not be visible they might not be in the same order found in the model or they just might not allow access to some of the locations in the model . |
4,001 | public void setSize ( float width , float height ) { if ( view != null ) { view . setSize ( width , height ) ; } } | Sets the view size . |
4,002 | private void updateCommitted ( ) { List < Long > sorted = newArrayList ( ) ; for ( ReplicaManager manager : managers . values ( ) ) { sorted . add ( manager . getMatchIndex ( ) ) ; } sorted . add ( getLog ( ) . lastLogIndex ( ) ) ; Collections . sort ( sorted ) ; int n = sorted . size ( ) ; int quorumSize = ( n / 2 ) +... | Find the median value of the list of matchIndex this value is the committedIndex since by definition half of the matchIndex values are greater and half are less than this value . So at least half of the replicas have stored the median value this is the definition of committed . |
4,003 | @ SuppressWarnings ( "rawtypes" ) public Object invokeMethod ( final Class sender , final Object receiver , final String methodName , final Object [ ] arguments , final boolean isCallToSuper , final boolean fromInsideClass ) { return invokeMethod ( receiver , methodName , arguments ) ; } | Invoke a method on the given receiver for the specified arguments . The sender is the class that invoked the method on the object . Attempt to establish the method to invoke based on the name and arguments provided . |
4,004 | public void setTarget ( final String t ) { final GantTarget gt = new GantTarget ( ) ; gt . setValue ( t ) ; targets . add ( gt ) ; } | Set the target to be achieved . |
4,005 | public void execute ( ) throws BuildException { final Project antProject = getOwningTarget ( ) . getProject ( ) ; final Project newProject = new Project ( ) ; newProject . init ( ) ; for ( final Object o : antProject . getBuildListeners ( ) ) { final BuildListener listener = ( BuildListener ) o ; if ( ! ( listener inst... | Load the file and then execute it . |
4,006 | private void addAlmostAll ( final Project newProject , final Project oldProject ) { final Hashtable < String , Object > properties = oldProject . getProperties ( ) ; final Enumeration < String > e = properties . keys ( ) ; while ( e . hasMoreElements ( ) ) { final String key = e . nextElement ( ) ; if ( ! ( MagicNames ... | Russel Winder rehacked the code provided by Eric Van Dewoestine . |
4,007 | public Object invokeMethod ( final String name , final Object arguments ) { if ( GantState . dryRun ) { if ( GantState . verbosity > GantState . SILENT ) { final StringBuilder sb = new StringBuilder ( ) ; int padding = 9 - name . length ( ) ; if ( padding < 0 ) { padding = 0 ; } sb . append ( " " . substring ( ... | Invoke a method . |
4,008 | private boolean checkMerchant ( PurchaseDataModel details ) { if ( developerMerchantId == null ) return true ; if ( details . getPurchaseTime ( ) . before ( dateMerchantLimit1 ) ) return true ; if ( details . getPurchaseTime ( ) . after ( dateMerchantLimit2 ) ) return true ; if ( details . getOrderId ( ) == null || det... | Checks merchant s id validity . If purchase was generated by Freedom alike program it doesn t know real merchant id unless publisher GoogleId was hacked If merchantId was not supplied function checks nothing |
4,009 | protected static String getClassName ( ProgramElementDoc doc , boolean binaryName ) { PackageDoc containingPackage = doc . containingPackage ( ) ; String className = doc . name ( ) ; if ( binaryName ) { className = className . replaceAll ( "\\." , "\\$" ) ; } return containingPackage . name ( ) . length ( ) > 0 ? Strin... | Reconstitute the class name from the given class JavaDoc object . |
4,010 | public String getSummaryForWorkUnit ( final DocWorkUnit workUnit ) { String summary = workUnit . getDocumentedFeature ( ) . summary ( ) ; if ( summary == null || summary . isEmpty ( ) ) { final CommandLineProgramProperties commandLineProperties = workUnit . getCommandLineProperties ( ) ; if ( commandLineProperties != n... | Get the summary string to be used for a given work unit applying any fallback policy . This is called by the work unit handler after the work unit has been populated and may be overridden by subclasses to provide custom behavior . |
4,011 | public String getGroupNameForWorkUnit ( final DocWorkUnit workUnit ) { String groupName = workUnit . getDocumentedFeature ( ) . groupName ( ) ; if ( groupName == null || groupName . isEmpty ( ) ) { final CommandLineProgramGroup clpGroup = workUnit . getCommandLineProgramGroup ( ) ; if ( clpGroup != null ) { groupName =... | Get the group name string to be used for a given work unit applying any fallback policy . This is called by the work unit handler after the work unit has been populated and may be overridden by subclasses to provide custom behavior . |
4,012 | public String getGroupSummaryForWorkUnit ( final DocWorkUnit workUnit ) { String groupSummary = workUnit . getDocumentedFeature ( ) . groupSummary ( ) ; final CommandLineProgramGroup clpGroup = workUnit . getCommandLineProgramGroup ( ) ; if ( groupSummary == null || groupSummary . isEmpty ( ) ) { if ( clpGroup != null ... | Get the group summary string to be used for a given work unit s group applying any fallback policy . This is called by the work unit handler after the work unit has been populated and may be overridden by subclasses to provide custom behavior . |
4,013 | protected String getDescription ( final DocWorkUnit currentWorkUnit ) { return Arrays . stream ( currentWorkUnit . getClassDoc ( ) . inlineTags ( ) ) . filter ( t -> getTagPrefix ( ) == null || ! t . name ( ) . startsWith ( getTagPrefix ( ) ) ) . map ( t -> t . text ( ) ) . collect ( Collectors . joining ( ) ) ; } | Return the description to be used for the work unit . We need to manually strip out any inline custom javadoc tags since we don t those in the summary . |
4,014 | protected void addHighLevelBindings ( final DocWorkUnit workUnit ) { workUnit . setProperty ( "name" , workUnit . getName ( ) ) ; workUnit . setProperty ( "group" , workUnit . getGroupName ( ) ) ; workUnit . setProperty ( "summary" , workUnit . getSummary ( ) ) ; workUnit . setProperty ( "beta" , workUnit . isBetaFeatu... | Add high - level summary information such as name summary description version etc . |
4,015 | protected void addCustomBindings ( final DocWorkUnit currentWorkUnit ) { final String tagFilterPrefix = getTagPrefix ( ) ; Arrays . stream ( currentWorkUnit . getClassDoc ( ) . inlineTags ( ) ) . filter ( t -> t . name ( ) . startsWith ( tagFilterPrefix ) ) . forEach ( t -> currentWorkUnit . setProperty ( t . name ( ) ... | Add any custom freemarker bindings discovered via custom javadoc tags . Subclasses can override this to provide additional custom bindings . |
4,016 | protected void addExtraDocsBindings ( final DocWorkUnit currentWorkUnit ) { final List < Map < String , Object > > extraDocsData = new ArrayList < Map < String , Object > > ( ) ; for ( final Class < ? > extraDocClass : currentWorkUnit . getDocumentedFeature ( ) . extraDocs ( ) ) { final DocWorkUnit otherUnit = getDocle... | Add bindings describing related capabilities to currentWorkUnit |
4,017 | private Map < String , List < Map < String , Object > > > createArgumentMap ( ) { final Map < String , List < Map < String , Object > > > args = new HashMap < String , List < Map < String , Object > > > ( ) ; args . put ( "all" , new ArrayList < > ( ) ) ; args . put ( "common" , new ArrayList < > ( ) ) ; args . put ( "... | Create the argument map for holding class arguments |
4,018 | private List < Map < String , Object > > sortArguments ( final List < Map < String , Object > > unsorted ) { Collections . sort ( unsorted , new CompareArgumentsByName ( ) ) ; return unsorted ; } | Sorts the individual argument list in unsorted according to CompareArgumentsByName |
4,019 | private Object prettyPrintValueString ( final Object value ) { if ( value instanceof String ) { return value . equals ( "" ) ? "\"\"" : value ; } else { return value . toString ( ) ; } } | Pretty prints value |
4,020 | protected String argumentTypeString ( final Type type ) { if ( type instanceof ParameterizedType ) { final ParameterizedType parameterizedType = ( ParameterizedType ) type ; final List < String > subs = new ArrayList < > ( ) ; for ( final Type actualType : parameterizedType . getActualTypeArguments ( ) ) subs . add ( a... | Returns a human readable string that describes the Type type of an argument . |
4,021 | private List < Map < String , Object > > docForEnumArgument ( final Class < ? > enumClass ) { final ClassDoc doc = this . getDoclet ( ) . getClassDocForClass ( enumClass ) ; if ( doc == null ) { throw new RuntimeException ( "Tried to get docs for enum " + enumClass + " but got null instead" ) ; } final Set < String > e... | Helper routine that provides a FreeMarker map for an enumClass grabbing the values of the enum and their associated javadoc documentation . |
4,022 | public static < T > JoinObservable < T > from ( Observable < T > o ) { return new JoinObservable < T > ( o ) ; } | Creates a JoinObservable from a regular Observable . |
4,023 | private static void prettyPrintWarningMessage ( final List < String > results , final String message ) { for ( final String line : message . split ( "\\r?\\n" ) ) { final StringBuilder builder = new StringBuilder ( line ) ; while ( builder . length ( ) > TEXT_WARNING_WIDTH ) { int space = getLastSpace ( builder , TEXT_... | pretty print the warning message supplied |
4,024 | private static int getLastSpace ( final CharSequence message , int width ) { final int length = message . length ( ) ; int stopPos = width ; int currPos = 0 ; int lastSpace = - 1 ; boolean inEscape = false ; while ( currPos < stopPos && currPos < length ) { final char c = message . charAt ( currPos ) ; if ( c == ESCAPE... | Returns the last whitespace location in string before width characters . |
4,025 | public static String dupString ( char c , int nCopies ) { char [ ] chars = new char [ nCopies ] ; Arrays . fill ( chars , c ) ; return new String ( chars ) ; } | Create a new string thats a n duplicate copies of c |
4,026 | public static String wrapParagraph ( final String input , final int width ) { if ( input == null || input . isEmpty ( ) ) { return input ; } final StringBuilder out = new StringBuilder ( ) ; try ( final BufferedReader bufReader = new BufferedReader ( new StringReader ( input ) ) ) { out . append ( bufReader . lines ( )... | A utility method to wrap multiple lines of text while respecting the original newlines . |
4,027 | public void run ( ) { if ( log . isDebugEnabled ( ) ) { log . debug ( "ListenerThread Starting." ) ; } while ( running ) { try { Socket clientSocket = serverSocket . accept ( ) ; WorkerThread worker = new WorkerThread ( container , clientSocket ) ; worker . start ( ) ; } catch ( SocketTimeoutException ste ) { } catch (... | ListenerThread execution begins . |
4,028 | public static boolean isConcrete ( Class < ? > clazz ) { return ! Modifier . isAbstract ( clazz . getModifiers ( ) ) && ! Modifier . isInterface ( clazz . getModifiers ( ) ) ; } | Is the specified class a concrete implementation of baseClass? |
4,029 | public static Field findField ( Class < ? > type , String fieldName ) { while ( type != null ) { Field [ ] fields = type . getDeclaredFields ( ) ; for ( Field field : fields ) { if ( field . getName ( ) . equals ( fieldName ) ) return field ; } type = type . getSuperclass ( ) ; } return null ; } | Find the field with the given name in the class . Will inspect all fields independent of access level . |
4,030 | public void processDoc ( final List < Map < String , String > > featureMaps , final List < Map < String , String > > groupMaps ) { workUnitHandler . processWorkUnit ( this , featureMaps , groupMaps ) ; } | Populate the property map for this work unit by delegating to the documented feature handler for this work unit . |
4,031 | public CommandLineProgramGroup getCommandLineProgramGroup ( ) { if ( commandLineProperties != null ) { try { return commandLineProperties . programGroup ( ) . newInstance ( ) ; } catch ( IllegalAccessException | InstantiationException e ) { logger . warn ( String . format ( "Can't instantiate program group class to ret... | Get the CommandLineProgramGroup object from the CommandLineProgramProperties of this work unit . |
4,032 | protected boolean startProcessDocs ( final RootDoc rootDoc ) throws IOException { for ( String [ ] options : rootDoc . options ( ) ) { parseOption ( options ) ; } if ( ( useDefaultTemplates && isSettingsDirSet ) || ( ! useDefaultTemplates && ! isSettingsDirSet ) ) { throw new RuntimeException ( "ERROR: must specify onl... | Extracts the contents of certain types of javadoc and adds them to an output file . |
4,033 | public static int optionLength ( final String option ) { if ( option . equals ( DOC_TITLE_OPTION ) || option . equals ( WINDOW_TITLE_OPTION ) || option . equals ( SETTINGS_DIR_OPTION ) || option . equals ( DESTINATION_DIR_OPTION ) || option . equals ( BUILD_TIMESTAMP_OPTION ) || option . equals ( ABSOLUTE_VERSION_OPTIO... | Validates the given options against options supported by this doclet . |
4,034 | private void processDocs ( final RootDoc rootDoc ) { this . rootDoc = rootDoc ; workUnits = computeWorkUnits ( ) ; final Set < String > uniqueGroups = new HashSet < > ( ) ; final List < Map < String , String > > featureMaps = new ArrayList < > ( ) ; final List < Map < String , String > > groupMaps = new ArrayList < > (... | Process the classes that have been included by the javadoc process in the rootDoc object . |
4,035 | private Set < DocWorkUnit > computeWorkUnits ( ) { final TreeSet < DocWorkUnit > workUnits = new TreeSet < > ( ) ; for ( final ClassDoc classDoc : rootDoc . classes ( ) ) { final Class < ? > clazz = getClassForClassDoc ( classDoc ) ; final DocumentedFeature documentedFeature = getDocumentedFeatureForClass ( clazz ) ; i... | For each class in the rootDoc class list delegate to the appropriate DocWorkUnitHandler to determine if it should be included in this run and for each included feature construct a DocWorkUnit . |
4,036 | public boolean includeInDocs ( final DocumentedFeature documentedFeature , final ClassDoc classDoc , final Class < ? > clazz ) { boolean hidden = ! showHiddenFeatures ( ) && clazz . isAnnotationPresent ( Hidden . class ) ; return ! hidden && JVMUtils . isConcrete ( clazz ) ; } | Determine if a particular class should be included in the output . This is called by the doclet to determine if a DocWorkUnit should be created for this feature . |
4,037 | protected DocWorkUnit createWorkUnit ( final DocumentedFeature documentedFeature , final ClassDoc classDoc , final Class < ? > clazz ) { return new DocWorkUnit ( new DefaultDocWorkUnitHandler ( this ) , documentedFeature , classDoc , clazz ) ; } | Create a work unit and handler capable of documenting the feature specified by the input arguments . Returns null if no appropriate handler is found or doc shouldn t be documented at all . |
4,038 | private DocumentedFeature getDocumentedFeatureForClass ( final Class < ? > clazz ) { if ( clazz != null && clazz . isAnnotationPresent ( DocumentedFeature . class ) ) { return clazz . getAnnotation ( DocumentedFeature . class ) ; } else { return null ; } } | Returns the instantiated DocumentedFeature that describes the doc for this class . |
4,039 | private Class < ? extends Object > getClassForClassDoc ( final ClassDoc doc ) { try { return DocletUtils . getClassForDoc ( doc ) ; } catch ( ClassNotFoundException e ) { return null ; } catch ( NoClassDefFoundError e ) { return null ; } catch ( UnsatisfiedLinkError e ) { return null ; } } | Return the Java class described by the ClassDoc doc |
4,040 | protected void processIndexTemplate ( final Configuration cfg , final List < DocWorkUnit > workUnitList , final List < Map < String , String > > groupMaps ) throws IOException { final Template template = cfg . getTemplate ( getIndexTemplateName ( ) ) ; final File indexFile = new File ( getDestinationDir ( ) , getIndexB... | Create the php index listing all of the Docs features |
4,041 | protected Map < String , Object > groupIndexMap ( final List < DocWorkUnit > workUnitList , final List < Map < String , String > > groupMaps ) { Map < String , Object > root = new HashMap < > ( ) ; Collections . sort ( workUnitList ) ; List < Map < String , String > > data = new ArrayList < > ( ) ; workUnitList . strea... | Helpful function to create the php index . Given all of the already run DocWorkUnits create the high - level grouping data listing individual features by group . |
4,042 | protected Map < String , String > getGroupMap ( final DocWorkUnit workUnit ) { Map < String , String > propertyMap = new HashMap < > ( ) ; propertyMap . put ( "id" , getGroupIdFromName ( workUnit . getGroupName ( ) ) ) ; propertyMap . put ( "name" , workUnit . getGroupName ( ) ) ; propertyMap . put ( "summary" , workUn... | Helper routine that returns the map of group name and summary given the workUnit . Subclasses that override this should call this method before doing further processing . |
4,043 | public Map < String , String > indexDataMap ( final DocWorkUnit workUnit ) { Map < String , String > propertyMap = new HashMap < > ( ) ; propertyMap . put ( "name" , workUnit . getName ( ) ) ; propertyMap . put ( "summary" , workUnit . getSummary ( ) ) ; propertyMap . put ( "filename" , workUnit . getTargetFileName ( )... | Return a String - > String map suitable for FreeMarker to create an index to this WorkUnit |
4,044 | public final DocWorkUnit findWorkUnitForClass ( final Class < ? > c ) { for ( final DocWorkUnit workUnit : this . workUnits ) if ( workUnit . getClazz ( ) . equals ( c ) ) return workUnit ; return null ; } | Helper function that finding the DocWorkUnit associated with class from among all of the work units |
4,045 | protected void processWorkUnitTemplate ( final Configuration cfg , final DocWorkUnit workUnit , final List < Map < String , String > > indexByGroupMaps , final List < Map < String , String > > featureMaps ) { try { Template template = cfg . getTemplate ( workUnit . getTemplateName ( ) ) ; File outputPath = new File ( g... | High - level function that processes a single DocWorkUnit unit using its handler |
4,046 | public String [ ] preprocessTaggedOptions ( final String [ ] argArray ) { List < String > finalArgs = new ArrayList < > ( argArray . length ) ; Iterator < String > argIt = Arrays . asList ( argArray ) . iterator ( ) ; while ( argIt . hasNext ( ) ) { final String arg = argIt . next ( ) ; if ( isShortOptionToken ( arg ) ... | Given an array of raw arguments provided by the user return an array of args where tagged arguments have been replaced with curated arguments containing a key to be used by the parser to retrieve the actual values . |
4,047 | private void replaceTaggedOption ( final String optionPrefix , final String optionString , final Iterator < String > userArgIt , final List < String > finalArgList ) { final int separatorIndex = optionString . indexOf ( TaggedArgumentParser . ARGUMENT_TAG_NAME_SEPARATOR ) ; if ( separatorIndex == - 1 ) { detectAndRejec... | Process a single option and add it to the curated args list . If the option is tagged add the curated key and value . Otherwise just add the raw option . |
4,048 | private String getSurrogateKeyForTaggedOption ( final String rawOptionString , final String rawArgumentValue , final String tagString ) { final String surrogateKey = makeSurrogateKey ( rawOptionString , rawArgumentValue ) ; if ( null != tagSurrogates . put ( surrogateKey , Pair . of ( tagString , rawArgumentValue ) ) )... | Stores the option string and value in the tagSurrogates hash map and returns a surrogate key . |
4,049 | public static void populateArgumentTags ( final TaggedArgument taggedArg , final String longArgName , final String tagString ) { if ( tagString == null ) { taggedArg . setTag ( null ) ; taggedArg . setTagAttributes ( Collections . emptyMap ( ) ) ; } else { final ParsedArgument pa = ParsedArgument . of ( longArgName , t... | Parse a tag string and populate a TaggedArgument with values . |
4,050 | public static String getDisplayString ( final String longArgName , final TaggedArgument taggedArg ) { Utils . nonNull ( longArgName ) ; Utils . nonNull ( taggedArg ) ; StringBuilder sb = new StringBuilder ( ) ; sb . append ( longArgName ) ; if ( taggedArg . getTag ( ) != null ) { sb . append ( ARGUMENT_TAG_NAME_SEPARAT... | Given a TaggedArgument implementation and a long argument name return a string representation of argument including the tag and attributes for display purposes . |
4,051 | public static int optionLength ( final String option ) { if ( option . equals ( CALLER_SCRIPT_NAME ) || option . equals ( CALLER_SCRIPT_PREFIX_LEGAL_ARGS ) || option . equals ( CALLER_SCRIPT_PREFIX_ARG_VALUE_TYPES ) || option . equals ( CALLER_SCRIPT_PREFIX_MUTEX_ARGS ) || option . equals ( CALLER_SCRIPT_PREFIX_ALIAS_A... | Must add options that are applicable to this doclet so that they will be accepted . |
4,052 | protected void processIndexTemplate ( final Configuration cfg , final List < DocWorkUnit > workUnitList , final List < Map < String , String > > groupMaps ) throws IOException { final Map < String , Object > propertiesMap = new HashMap < > ( ) ; workUnits . stream ( ) . forEach ( workUnit -> propertiesMap . put ( workU... | The Index file in the Bash Completion Doclet is what generates the actual tab - completion script . |
4,053 | public void run ( ) { String client = socket . getInetAddress ( ) . getHostAddress ( ) ; if ( log . isDebugEnabled ( ) ) { log . info ( "Accepted Connection From: " + client ) ; } PrintWriter out = null ; BufferedReader in = null ; try { socket . setSoTimeout ( 1000 ) ; out = new PrintWriter ( socket . getOutputStream ... | WorkerThread execution begins . |
4,054 | public boolean hasWebDocumentation ( final Class < ? > clazz ) { for ( final String pkg : PACKAGES_WITH_WEB_DOCUMENTATION ) { if ( clazz . getPackage ( ) . getName ( ) . startsWith ( pkg ) ) { return true ; } } return false ; } | Determines if a class has web documentation based on its package name |
4,055 | public String usage ( final boolean printCommon , final boolean printHidden ) { final StringBuilder sb = new StringBuilder ( ) ; if ( ! printHidden ) { logger . warn ( "Hidden arguments are always printed in LegacyCommandLineArgumentParser" ) ; } if ( prefix . isEmpty ( ) ) { final String preamble = htmlUnescape ( conv... | Print a usage message based on the options object passed to the ctor . |
4,056 | static String convertFromHtml ( final String textToConvert ) { final Map < String , String > regexps = new LinkedHashMap < > ( ) ; regexps . put ( "< *a *href=[\'\"](.*?)[\'\"] *>(.*?)</ *a *>" , "$2 ($1)" ) ; regexps . put ( "< *a *href=[\'\"](.*?)[\'\"] *>(.*?)< *a */>" , "$2 ($1)" ) ; regexps . put ( "</ *(br|p|tabl... | package local for testing |
4,057 | public boolean parseArguments ( final PrintStream messageStream , final String [ ] args ) { this . argv = args ; this . messageStream = messageStream ; if ( prefix . isEmpty ( ) ) { commandLine = callerOptions . getClass ( ) . getSimpleName ( ) ; } for ( int i = 0 ; i < args . length ; ++ i ) { final String arg = args ... | Parse command - line options and store values in callerOptions object passed to ctor . |
4,058 | private Class < ? > getUnderlyingType ( final Field field ) { if ( isCollectionField ( field ) ) { final ParameterizedType clazz = ( ParameterizedType ) ( field . getGenericType ( ) ) ; final Type [ ] genericTypes = clazz . getActualTypeArguments ( ) ; if ( genericTypes . length != 1 ) { throw new CommandLineException ... | Returns the type that each instance of the argument needs to be converted to . In the case of primitive fields it will return the wrapper type so that String constructors can be found . |
4,059 | public PatternN and ( Observable < ? extends Object > other ) { if ( other == null ) { throw new NullPointerException ( ) ; } List < Observable < ? extends Object > > list = new ArrayList < Observable < ? extends Object > > ( ) ; list . add ( o1 ) ; list . add ( o2 ) ; list . add ( o3 ) ; list . add ( o4 ) ; list . add... | Creates a pattern that matches when all nine observable sequences have an available element . |
4,060 | public boolean parseArguments ( final PrintStream messageStream , String [ ] args ) { final OptionSet parsedArguments ; final OptionParser parser = getOptionParser ( ) ; try { parsedArguments = parser . parse ( tagParser . preprocessTaggedOptions ( args ) ) ; } catch ( final OptionException e ) { throw new CommandLineE... | Parse command - line arguments and store values in callerArguments object passed to ctor . |
4,061 | public < T > T getPluginDescriptor ( final Class < T > targetDescriptor ) { return targetDescriptor . cast ( pluginDescriptors . get ( targetDescriptor . getName ( ) ) ) ; } | Return the plugin instance corresponding to the targetDescriptor class |
4,062 | private void validateArgumentDefinitions ( ) { for ( final NamedArgumentDefinition mutexSourceDef : namedArgumentDefinitions ) { for ( final String mutexTarget : mutexSourceDef . getMutexTargetList ( ) ) { final NamedArgumentDefinition mutexTargetDef = namedArgumentsDefinitionsByAlias . get ( mutexTarget ) ; if ( mutex... | arguments involved . |
4,063 | private void createCommandLinePluginArgumentDefinitions ( final List < ? extends CommandLinePluginDescriptor < ? > > requestedPluginDescriptors ) { requestedPluginDescriptors . forEach ( descriptor -> { pluginDescriptors . put ( descriptor . getClass ( ) . getName ( ) , descriptor ) ; createArgumentDefinitions ( descri... | Find all the instances of plugins specified by the provided plugin descriptors |
4,064 | private void findPluginsForDescriptor ( final CommandLinePluginDescriptor < ? > pluginDescriptor ) { final ClassFinder classFinder = new ClassFinder ( ) ; pluginDescriptor . getPackageNames ( ) . forEach ( pkg -> classFinder . find ( pkg , pluginDescriptor . getPluginBaseClass ( ) ) ) ; final Set < Class < ? > > plugin... | instance each and add its ArgumentDefinitions |
4,065 | private boolean isSpecialFlagSet ( final OptionSet parsedArguments , final String flagName ) { if ( parsedArguments . has ( flagName ) ) { Object value = parsedArguments . valueOf ( flagName ) ; return ( value == null || ! value . equals ( "false" ) ) ; } else { return false ; } } | helper to deal with the case of special flags that are evaluated before the options are properly set |
4,066 | private List < NamedArgumentDefinition > validatePluginArgumentValues ( ) { final List < NamedArgumentDefinition > actualArgumentDefinitions = new ArrayList < > ( ) ; for ( final NamedArgumentDefinition argumentDefinition : namedArgumentDefinitions ) { if ( ! argumentDefinition . isControlledByPlugin ( ) ) { actualArgu... | other arguments that require validation . |
4,067 | public List < String > expandFromExpansionFile ( final ArgumentDefinition argumentDefinition , final String stringValue , final List < String > originalValuesForPreservation ) { List < String > expandedValues = new ArrayList < > ( ) ; if ( EXPANSION_FILE_EXTENSIONS . stream ( ) . anyMatch ( ext -> stringValue . endsWit... | Expand any collection value that references a filename that ends in one of the accepted expansion extensions and add the contents of the file to the list of values for that argument . |
4,068 | public < T > List < Pair < ArgumentDefinition , T > > gatherArgumentValuesOfType ( final Class < T > type ) { final List < Pair < ArgumentDefinition , T > > argumentValues = new ArrayList < > ( ) ; final List < ArgumentDefinition > allArgDefs = new ArrayList < > ( namedArgumentDefinitions . size ( ) ) ; allArgDefs . ad... | Locates and returns the VALUES of all Argument - annotated fields of a specified type in a given object pairing each field value with its corresponding Field object . |
4,069 | protected void scanDir ( final File file , final String path ) { for ( final File child : file . listFiles ( ) ) { final String newPath = ( path == null ? child . getName ( ) : path + '/' + child . getName ( ) ) ; if ( child . isDirectory ( ) ) { scanDir ( child , newPath ) ; } else { handleItem ( newPath ) ; } } } | Scans a directory on the filesystem for classes . |
4,070 | protected void handleItem ( final String name ) { if ( name . endsWith ( ".class" ) ) { final String classname = toClassName ( name ) ; try { final Class < ? > type = loader . loadClass ( classname ) ; if ( parentType . isAssignableFrom ( type ) ) { this . classes . add ( type ) ; } } catch ( Throwable t ) { log . debu... | Checks an item to see if it is a class and is annotated with the specified annotation . If so adds it to the set otherwise ignores it . |
4,071 | public static < T1 , T2 > Pattern2 < T1 , T2 > and ( Observable < T1 > left , Observable < T2 > right ) { if ( left == null ) { throw new NullPointerException ( "left" ) ; } if ( right == null ) { throw new NullPointerException ( "right" ) ; } return new Pattern2 < T1 , T2 > ( left , right ) ; } | Creates a pattern that matches when both observable sequences have an available element . |
4,072 | public static < T1 , R > Plan0 < R > then ( Observable < T1 > source , Func1 < T1 , R > selector ) { if ( source == null ) { throw new NullPointerException ( "source" ) ; } if ( selector == null ) { throw new NullPointerException ( "selector" ) ; } return new Pattern1 < T1 > ( source ) . then ( selector ) ; } | Matches when the observable sequence has an available element and projects the element by invoking the selector function . |
4,073 | public List < String > getArgumentAliases ( ) { final List < String > aliases = new ArrayList < > ( ) ; if ( ! getShortName ( ) . isEmpty ( ) ) { aliases . add ( getShortName ( ) ) ; } if ( ! getFullName ( ) . isEmpty ( ) ) { aliases . add ( getFullName ( ) ) ; } else { aliases . add ( getUnderlyingField ( ) . getName ... | Get the list of short and long aliases for this argument . |
4,074 | @ SuppressWarnings ( { "rawtypes" , "unchecked" } ) private void setCollectionValues ( final CommandLineArgumentParser commandLineArgumentParser , final List < String > preprocessedValues ) { final Collection c = ( Collection ) getArgumentValue ( ) ; if ( ! commandLineArgumentParser . getAppendToCollectionsParserOption... | surrogate each instance added to the collection must be populated with any tags and attributes . |
4,075 | private void setScalarValue ( final CommandLineArgumentParser commandLineArgumentParser , final List < String > originalValues ) { if ( getHasBeenSet ( ) || originalValues . size ( ) > 1 ) { throw new CommandLineException . BadArgumentValue ( String . format ( "Argument '%s' cannot be specified more than once." , getAr... | one value in which case we throw . |
4,076 | public String getArgumentUsage ( final Map < String , NamedArgumentDefinition > allActualArguments , final Collection < CommandLinePluginDescriptor < ? > > pluginDescriptors , final int argumentColumnWidth , final int descriptionColumnWidth ) { final StringBuilder sb = new StringBuilder ( ) ; sb . append ( "--" ) . app... | Return a string with the usage statement for this argument . |
4,077 | private String getNameValuePairForDisplay ( final Object value ) { if ( value != null ) { if ( argumentAnnotation . sensitive ( ) ) { return String . format ( "--%s ***********" , getLongName ( ) ) ; } else { if ( value instanceof TaggedArgument ) { return String . format ( "--%s %s" , TaggedArgumentParser . getDisplay... | Get a name value pair for this argument and a value suitable for display . |
4,078 | private String convertDefaultValueToString ( ) { final Object initialValue = getArgumentValue ( ) ; if ( initialValue != null ) { if ( isCollection ( ) && ( ( Collection < ? > ) initialValue ) . isEmpty ( ) ) { return NULL_ARGUMENT_STRING ; } else { return initialValue . toString ( ) ; } } else { return NULL_ARGUMENT_S... | Convert the initial value for this argument to a string representation . |
4,079 | private void validateBoundsDefinitions ( ) { if ( ! Number . class . isAssignableFrom ( getUnderlyingFieldClass ( ) ) ) { if ( hasBoundedRange ( ) || hasRecommendedRange ( ) ) { throw new CommandLineException . CommandLineParserInternalException ( String . format ( "Min/max value ranges can only be set for numeric argu... | and are self - consistent . |
4,080 | private Object getValuePopulatedWithTags ( final String originalTag , final String stringValue ) { final Object value = constructFromString ( stringValue , getLongName ( ) ) ; if ( TaggedArgument . class . isAssignableFrom ( getUnderlyingFieldClass ( ) ) ) { TaggedArgument taggedArgument = ( TaggedArgument ) value ; Ta... | populated with the actual value and tags and attributes provided by the user for that argument . |
4,081 | private String getArgumentDescription ( final Map < String , NamedArgumentDefinition > allActualArguments , final Collection < CommandLinePluginDescriptor < ? > > pluginDescriptors ) { final StringBuilder sb = new StringBuilder ( ) ; if ( ! getDocString ( ) . isEmpty ( ) ) { sb . append ( getDocString ( ) ) ; sb . appe... | Return a usage string representing this argument . |
4,082 | private void checkArgumentRange ( final Object argumentValue ) { if ( ! Number . class . isAssignableFrom ( getUnderlyingFieldClass ( ) ) ) { return ; } final Double argumentDoubleValue = ( argumentValue == null ) ? null : ( ( Number ) argumentValue ) . doubleValue ( ) ; if ( hasBoundedRange ( ) && isValueOutOfRange ( ... | Check the provided value against any range constraints specified in the Argument annotation for the corresponding field . Throw an exception if limits are violated . |
4,083 | private void setArgumentValue ( final Object value ) { try { getUnderlyingField ( ) . set ( getContainingObject ( ) , value ) ; } catch ( final IllegalAccessException e ) { throw new CommandLineException . ShouldNeverReachHereException ( String . format ( "Couldn't set field value for %s in %s with value %s." , getUnde... | Set the underlying field to the new value . |
4,084 | private boolean isValueOutOfRange ( final Double value ) { return value == null || getMinValue ( ) != Double . NEGATIVE_INFINITY && value < getMinValue ( ) || getMaxValue ( ) != Double . POSITIVE_INFINITY && value > getMaxValue ( ) ; } | null values are always out of range |
4,085 | public < T5 > Pattern5 < T1 , T2 , T3 , T4 , T5 > and ( Observable < T5 > other ) { if ( other == null ) { throw new NullPointerException ( ) ; } return new Pattern5 < T1 , T2 , T3 , T4 , T5 > ( o1 , o2 , o3 , o4 , other ) ; } | Creates a pattern that matches when all four observable sequences have an available element . |
4,086 | public String [ ] listProviders ( ) { String [ ] providers = new String [ container . size ( ) ] ; int i = 0 ; Iterator < String > ki = container . keySet ( ) . iterator ( ) ; while ( ki . hasNext ( ) ) { providers [ i ++ ] = ( String ) ki . next ( ) ; } return providers ; } | List the MetricsProvider keys in this MetricsContainer . |
4,087 | public void addProvider ( String name , MetricsProvider provider ) { if ( log . isInfoEnabled ( ) ) { log . info ( "Adding Provider: " + provider . getClass ( ) . getName ( ) + "=" + name ) ; } container . put ( name , provider ) ; } | Add a MetricsProvider to this container . |
4,088 | public MetricsProvider getProvider ( String name ) throws MetricsException { if ( container . containsKey ( name ) ) { return ( MetricsProvider ) container . get ( name ) ; } else { throw new MetricsException ( "No MetricsProvider with name: " + name ) ; } } | Retrieve a MetricsProvider . |
4,089 | public Object getMetric ( String key ) throws MetricsException { MetricsKey mk = new MetricsKey ( key ) ; MetricsProvider provider = getProvider ( mk . getProvider ( ) ) ; return provider . getValue ( mk ) ; } | Retrieve a value from this MetricsContainer . |
4,090 | protected void intializeCollection ( final String annotationType ) { final Field field = getUnderlyingField ( ) ; final Object callerArguments = containingObject ; try { if ( field . get ( containingObject ) == null ) { field . set ( callerArguments , field . getType ( ) . newInstance ( ) ) ; } } catch ( final Exceptio... | Initialize a collection value for this field . If the collection can t be instantiated directly because its the underlying type is not a concrete type an attempt assign an ArrayList will be made . |
4,091 | @ SuppressWarnings ( { "unchecked" , "rawtypes" } ) protected String getOptionsAsDisplayString ( ) { final Class < ? > clazz = getUnderlyingFieldClass ( ) ; if ( clazz == Boolean . class ) { return String . format ( "%s%s, %s%s" , OPTION_DOC_PREFIX , Boolean . TRUE , Boolean . FALSE , OPTION_DOC_SUFFIX ) ; } else if ( ... | Returns the list of possible options values for this argument . |
4,092 | public < T9 > Pattern9 < T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 > and ( Observable < T9 > other ) { if ( other == null ) { throw new NullPointerException ( ) ; } return new Pattern9 < T1 , T2 , T3 , T4 , T5 , T6 , T7 , T8 , T9 > ( o1 , o2 , o3 , o4 , o5 , o6 , o7 , o8 , other ) ; } | Creates a pattern that matches when all eight observable sequences have an available element . |
4,093 | public < T6 > Pattern6 < T1 , T2 , T3 , T4 , T5 , T6 > and ( Observable < T6 > other ) { if ( other == null ) { throw new NullPointerException ( ) ; } return new Pattern6 < T1 , T2 , T3 , T4 , T5 , T6 > ( o1 , o2 , o3 , o4 , o5 , other ) ; } | Creates a pattern that matches when all five observable sequences have an available element . |
4,094 | public PatternN and ( Observable < ? extends Object > other ) { if ( other == null ) { throw new NullPointerException ( ) ; } return new PatternN ( observables , other ) ; } | Creates a pattern that matches when all previous observable sequences have an available element . |
4,095 | public void setElementDefaultAction ( Integer index , String type , String url , Boolean messenger_extensions , String webview_height_ratio , String fallback_url ) { this . elements . get ( index ) . put ( "default_action_type" , type ) ; this . elements . get ( index ) . put ( "default_action_url" , url ) ; this . ele... | Set Element Default Action |
4,096 | public void setElementButton ( Integer index , String title , String type , String url , Boolean messenger_extensions , String webview_height_ratio , String fallback_url ) { if ( this . elements . get ( index ) . containsKey ( "buttons" ) ) { HashMap < String , String > button = new HashMap < String , String > ( ) ; bu... | Set Element Button |
4,097 | public Boolean challenge ( ) { if ( ( this . hub_mode . equals ( "subscribe" ) ) && ( this . hub_verify_token . equals ( this . configs . get ( "verify_token" , "" ) ) ) ) { Logger . info ( "Verify token validated successfully." ) ; return true ; } Logger . error ( "Error validating verify token." ) ; return false ; } | Verify Challenge Data |
4,098 | public void setQuickReply ( String content_type , String title , String payload , String image_url ) { HashMap < String , String > quick_reply = new HashMap < String , String > ( ) ; quick_reply . put ( "content_type" , content_type ) ; quick_reply . put ( "title" , title ) ; quick_reply . put ( "payload" , payload ) ;... | Set Quick Reply |
4,099 | public Boolean loadPropertiesFile ( String path ) throws IOException { Properties prop = new Properties ( ) ; InputStream input = null ; try { input = new FileInputStream ( path ) ; prop . load ( input ) ; for ( String key : prop . stringPropertyNames ( ) ) { String value = prop . getProperty ( key ) ; configs . put ( ... | Load Properties File |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.