idx int64 0 165k | question stringlengths 73 4.15k | target stringlengths 5 918 | len_question int64 21 890 | len_target int64 3 255 |
|---|---|---|---|---|
11,300 | public static String propertyNameFromMethodName ( Configuration configuration , String name ) { String propertyName = null ; if ( name . startsWith ( "get" ) || name . startsWith ( "set" ) ) { propertyName = name . substring ( 3 ) ; } else if ( name . startsWith ( "is" ) ) { propertyName = name . substring ( 2 ) ; } if... | A convenience method to get property name from the name of the getter or setter method . | 140 | 19 |
11,301 | public static boolean isJava5DeclarationElementType ( FieldDoc elt ) { return elt . name ( ) . contentEquals ( ElementType . ANNOTATION_TYPE . name ( ) ) || elt . name ( ) . contentEquals ( ElementType . CONSTRUCTOR . name ( ) ) || elt . name ( ) . contentEquals ( ElementType . FIELD . name ( ) ) || elt . name ( ) . co... | Test whether the given FieldDoc is one of the declaration annotation ElementTypes defined in Java 5 . Instead of testing for one of the new enum constants added in Java 8 test for the old constants . This prevents bootstrapping problems . | 205 | 46 |
11,302 | void normalizeMethod ( JCMethodDecl md , List < JCStatement > initCode , List < TypeCompound > initTAs ) { if ( md . name == names . init && TreeInfo . isInitialConstructor ( md ) ) { // We are seeing a constructor that does not call another // constructor of the same class. List < JCStatement > stats = md . body . sta... | Insert instance initializer code into initial constructor . | 353 | 9 |
11,303 | void implementInterfaceMethods ( ClassSymbol c , ClassSymbol site ) { for ( List < Type > l = types . interfaces ( c . type ) ; l . nonEmpty ( ) ; l = l . tail ) { ClassSymbol i = ( ClassSymbol ) l . head . tsym ; for ( Scope . Entry e = i . members ( ) . elems ; e != null ; e = e . sibling ) { if ( e . sym . kind == M... | Add abstract methods for all methods defined in one of the interfaces of a given class provided they are not already implemented in the class . | 220 | 26 |
11,304 | private void addAbstractMethod ( ClassSymbol c , MethodSymbol m ) { MethodSymbol absMeth = new MethodSymbol ( m . flags ( ) | IPROXY | SYNTHETIC , m . name , m . type , // was c.type.memberType(m), but now only !generics supported c ) ; c . members ( ) . enter ( absMeth ) ; // add to symbol table } | Add an abstract methods to a class which implicitly implements a method defined in some interface implemented by the class . These methods are called Miranda methods . Enter the newly created method into its enclosing class scope . Note that it is not entered into the class tree as the emitter doesn t need to see it th... | 93 | 67 |
11,305 | void makeStringBuffer ( DiagnosticPosition pos ) { code . emitop2 ( new_ , makeRef ( pos , stringBufferType ) ) ; code . emitop0 ( dup ) ; callMethod ( pos , stringBufferType , names . init , List . < Type > nil ( ) , false ) ; } | Make a new string buffer . | 66 | 6 |
11,306 | void appendStrings ( JCTree tree ) { tree = TreeInfo . skipParens ( tree ) ; if ( tree . hasTag ( PLUS ) && tree . type . constValue ( ) == null ) { JCBinary op = ( JCBinary ) tree ; if ( op . operator . kind == MTH && ( ( OperatorSymbol ) op . operator ) . opcode == string_add ) { appendStrings ( op . lhs ) ; appendSt... | Add all strings in tree to string buffer . | 134 | 9 |
11,307 | void bufferToString ( DiagnosticPosition pos ) { callMethod ( pos , stringBufferType , names . toString , List . < Type > nil ( ) , false ) ; } | Convert string buffer on tos to string . | 38 | 10 |
11,308 | public static < E > OptionalFunction < Selection < Element > , E > getValue ( ) { return OptionalFunction . of ( selection -> selection . result ( ) . getValue ( ) ) ; } | Returns a function that gets the value of a selected element . | 41 | 12 |
11,309 | public static Consumer < Selection < Element > > setValue ( Object newValue ) { return selection -> selection . result ( ) . setValue ( newValue ) ; } | Returns a function that sets the value of a selected element . | 34 | 12 |
11,310 | static public boolean validate ( String id ) { if ( id . equals ( "" ) ) { return false ; } else if ( id . equals ( "." ) || id . equals ( ".." ) ) { return false ; } Matcher matcher = IdUtil . pattern . matcher ( id ) ; return matcher . matches ( ) ; } | Verifies the correctness of an identifier . | 74 | 8 |
11,311 | private UiSelector buildSelector ( int selectorId , Object selectorValue ) { if ( selectorId == SELECTOR_CHILD || selectorId == SELECTOR_PARENT ) { throw new UnsupportedOperationException ( ) ; // selector.getLastSubSelector().mSelectorAttributes.put(selectorId, selectorValue); } else { this . mSelectorAttributes . put... | Building a UiSelector always returns a new UiSelector and never modifies the existing UiSelector being used . | 95 | 27 |
11,312 | public void get ( String key , UserDataHandler handler ) { if ( cache . containsKey ( key ) ) { try { handler . data ( key , cache . get ( key ) ) ; } catch ( Exception e ) { e . printStackTrace ( ) ; } return ; } user . sendGlobal ( "JWWF-storageGet" , "{\"key\":" + Json . escapeString ( key ) + "}" ) ; if ( waitingHa... | Gets userData string . if data exists in cache the callback is fired immediately if not async request is sent to user . If user don t have requested data empty string will arrive | 165 | 36 |
11,313 | public void set ( String key , String value ) { cache . put ( key , value ) ; user . sendGlobal ( "JWWF-storageSet" , "{\"key\":" + Json . escapeString ( key ) + ",\"value\":" + Json . escapeString ( value ) + "}" ) ; } | Sets userData for user data is set in cache and sent to user | 69 | 15 |
11,314 | public void setObjects ( Map < String , Object > objects ) { for ( Map . Entry < String , Object > entry : objects . entrySet ( ) ) { js . put ( entry . getKey ( ) , entry . getValue ( ) ) ; } } | Provides objects to the JavaScript engine under various names . | 56 | 11 |
11,315 | protected ApplicationContext initializeContext ( ) { Function < Class < Object > , List < Object > > getBeans = this :: getBeans ; BeanFactory beanFactory = new BeanFactory ( getBeans ) ; InitContext context = new InitContext ( ) ; AutoConfigurer . configureInitializers ( ) . forEach ( initializer -> initializer . init... | Method causes the initialization of the application context using the methods which returns a collection of beans such as | 631 | 19 |
11,316 | public synchronized T slow ( Factory < T > p , Object ... args ) throws Exception { T result = _value ; if ( isMissing ( result ) ) { _value = result = p . make ( args ) ; } return result ; } | For performance evaluation only - do not use . | 50 | 9 |
11,317 | public void clear ( ) { mPackedAxisBits = 0 ; x = 0 ; y = 0 ; pressure = 0 ; size = 0 ; touchMajor = 0 ; touchMinor = 0 ; toolMajor = 0 ; toolMinor = 0 ; orientation = 0 ; } | Clears the contents of this object . Resets all axes to zero . | 57 | 15 |
11,318 | public void copyFrom ( PointerCoords other ) { final long bits = other . mPackedAxisBits ; mPackedAxisBits = bits ; if ( bits != 0 ) { final float [ ] otherValues = other . mPackedAxisValues ; final int count = Long . bitCount ( bits ) ; float [ ] values = mPackedAxisValues ; if ( values == null || count > values . len... | Copies the contents of another pointer coords object . | 198 | 11 |
11,319 | public float getAxisValue ( int axis ) { switch ( axis ) { case AXIS_X : return x ; case AXIS_Y : return y ; case AXIS_PRESSURE : return pressure ; case AXIS_SIZE : return size ; case AXIS_TOUCH_MAJOR : return touchMajor ; case AXIS_TOUCH_MINOR : return touchMinor ; case AXIS_TOOL_MAJOR : return toolMajor ; case AXIS_T... | Gets the value associated with the specified axis . | 227 | 10 |
11,320 | public void setAxisValue ( int axis , float value ) { switch ( axis ) { case AXIS_X : x = value ; break ; case AXIS_Y : y = value ; break ; case AXIS_PRESSURE : pressure = value ; break ; case AXIS_SIZE : size = value ; break ; case AXIS_TOUCH_MAJOR : touchMajor = value ; break ; case AXIS_TOUCH_MINOR : touchMinor = va... | Sets the value associated with the specified axis . | 434 | 10 |
11,321 | public static Set < String > set ( String ... ss ) { Set < String > set = new HashSet < String > ( ) ; set . addAll ( Arrays . asList ( ss ) ) ; return set ; } | Convenience method to create a set with strings . | 47 | 11 |
11,322 | public static ThreadFactory newThreadFactory ( final String format , final boolean daemon ) { final String nameFormat ; if ( ! format . contains ( "%d" ) ) { nameFormat = format + "-%d" ; } else { nameFormat = format ; } return new ThreadFactoryBuilder ( ) // . setNameFormat ( nameFormat ) // . setDaemon ( daemon ) // ... | Returns a new thread factory that uses the given pattern to set the thread name . | 85 | 16 |
11,323 | Tag [ ] tags ( String tagname ) { ListBuffer < Tag > found = new ListBuffer < Tag > ( ) ; String target = tagname ; if ( target . charAt ( 0 ) != ' ' ) { target = "@" + target ; } for ( Tag tag : tagList ) { if ( tag . kind ( ) . equals ( target ) ) { found . append ( tag ) ; } } return found . toArray ( new Tag [ foun... | Return tags of the specified kind in this comment . | 104 | 10 |
11,324 | private ParamTag [ ] paramTags ( boolean typeParams ) { ListBuffer < ParamTag > found = new ListBuffer < ParamTag > ( ) ; for ( Tag next : tagList ) { if ( next instanceof ParamTag ) { ParamTag p = ( ParamTag ) next ; if ( typeParams == p . isTypeParameter ( ) ) { found . append ( p ) ; } } } return found . toArray ( n... | Return param tags in this comment . If typeParams is true include only type param tags otherwise include only ordinary param tags . | 104 | 25 |
11,325 | SeeTag [ ] seeTags ( ) { ListBuffer < SeeTag > found = new ListBuffer < SeeTag > ( ) ; for ( Tag next : tagList ) { if ( next instanceof SeeTag ) { found . append ( ( SeeTag ) next ) ; } } return found . toArray ( new SeeTag [ found . length ( ) ] ) ; } | Return see also tags in this comment . | 77 | 8 |
11,326 | public C get ( String id ) { C container = this . containerMap . get ( id ) ; if ( container != null && ( container . getState ( ) ) . equals ( State . REMOVED ) ) { return null ; } return container ; } | Looks up a Container by its identifier . | 54 | 8 |
11,327 | public Collection < C > getAll ( Collection < String > ids ) { Set < C > list = new LinkedHashSet < C > ( ) ; for ( String id : ids ) { C container = get ( id ) ; if ( container != null ) { list . add ( container ) ; } } return list ; } | Looks up a Collection of Containers by their identifiers . | 70 | 11 |
11,328 | public static void main ( String argv [ ] ) throws Exception { String idlFile = null ; String pkgName = null ; String outDir = null ; String nsPkgName = null ; boolean allImmutable = false ; List < String > immutableSubstr = new ArrayList < String > ( ) ; for ( int i = 0 ; i < argv . length ; i ++ ) { if ( argv [ i ] .... | Runs the code generator on the command line . | 409 | 10 |
11,329 | public void init ( ) throws ServletException { _application = ( ( ManagedPlatform ) ServicePlatform . getService ( ManagedPlatform . INSTANCE ) . first ) . getName ( ) ; /* ApplicationContext wac = WebApplicationContextUtils.getWebApplicationContext(getServletContext()); if (wac.containsBean("persistence")) { // persis... | Initializes the servlet | 110 | 5 |
11,330 | public static ProfileSummaryBuilder getInstance ( Context context , Profile profile , ProfileSummaryWriter profileWriter ) { return new ProfileSummaryBuilder ( context , profile , profileWriter ) ; } | Construct a new ProfileSummaryBuilder . | 36 | 7 |
11,331 | public void buildProfileDoc ( XMLNode node , Content contentTree ) throws Exception { contentTree = profileWriter . getProfileHeader ( profile . name ) ; buildChildren ( node , contentTree ) ; profileWriter . addProfileFooter ( contentTree ) ; profileWriter . printDocument ( contentTree ) ; profileWriter . close ( ) ; ... | Build the profile documentation . | 93 | 5 |
11,332 | public void buildContent ( XMLNode node , Content contentTree ) { Content profileContentTree = profileWriter . getContentHeader ( ) ; buildChildren ( node , profileContentTree ) ; contentTree . addContent ( profileContentTree ) ; } | Build the content for the profile doc . | 50 | 8 |
11,333 | public void buildSummary ( XMLNode node , Content profileContentTree ) { Content summaryContentTree = profileWriter . getSummaryHeader ( ) ; buildChildren ( node , summaryContentTree ) ; profileContentTree . addContent ( profileWriter . getSummaryTree ( summaryContentTree ) ) ; } | Build the profile summary . | 60 | 5 |
11,334 | public void buildPackageSummary ( XMLNode node , Content summaryContentTree ) { PackageDoc [ ] packages = configuration . profilePackages . get ( profile . name ) ; for ( int i = 0 ; i < packages . length ; i ++ ) { this . pkg = packages [ i ] ; Content packageSummaryContentTree = profileWriter . getPackageSummaryHeade... | Build the profile package summary . | 117 | 6 |
11,335 | public void buildInterfaceSummary ( XMLNode node , Content packageSummaryContentTree ) { String interfaceTableSummary = configuration . getText ( "doclet.Member_Table_Summary" , configuration . getText ( "doclet.Interface_Summary" ) , configuration . getText ( "doclet.interfaces" ) ) ; String [ ] interfaceTableHeader =... | Build the summary for the interfaces in the package . | 170 | 10 |
11,336 | public void buildClassSummary ( XMLNode node , Content packageSummaryContentTree ) { String classTableSummary = configuration . getText ( "doclet.Member_Table_Summary" , configuration . getText ( "doclet.Class_Summary" ) , configuration . getText ( "doclet.classes" ) ) ; String [ ] classTableHeader = new String [ ] { c... | Build the summary for the classes in the package . | 171 | 10 |
11,337 | public void buildEnumSummary ( XMLNode node , Content packageSummaryContentTree ) { String enumTableSummary = configuration . getText ( "doclet.Member_Table_Summary" , configuration . getText ( "doclet.Enum_Summary" ) , configuration . getText ( "doclet.enums" ) ) ; String [ ] enumTableHeader = new String [ ] { configu... | Build the summary for the enums in the package . | 178 | 11 |
11,338 | public void buildExceptionSummary ( XMLNode node , Content packageSummaryContentTree ) { String exceptionTableSummary = configuration . getText ( "doclet.Member_Table_Summary" , configuration . getText ( "doclet.Exception_Summary" ) , configuration . getText ( "doclet.exceptions" ) ) ; String [ ] exceptionTableHeader =... | Build the summary for the exceptions in the package . | 170 | 10 |
11,339 | public void buildErrorSummary ( XMLNode node , Content packageSummaryContentTree ) { String errorTableSummary = configuration . getText ( "doclet.Member_Table_Summary" , configuration . getText ( "doclet.Error_Summary" ) , configuration . getText ( "doclet.errors" ) ) ; String [ ] errorTableHeader = new String [ ] { co... | Build the summary for the errors in the package . | 169 | 10 |
11,340 | public void buildAnnotationTypeSummary ( XMLNode node , Content packageSummaryContentTree ) { String annotationtypeTableSummary = configuration . getText ( "doclet.Member_Table_Summary" , configuration . getText ( "doclet.Annotation_Types_Summary" ) , configuration . getText ( "doclet.annotationtypes" ) ) ; String [ ] ... | Build the summary for the annotation type in the package . | 189 | 11 |
11,341 | public static < T > T trueOrFalse ( final T trueCase , final T falseCase , final boolean ... flags ) { boolean interlink = true ; if ( flags != null && 0 < flags . length ) { interlink = false ; } for ( int i = 0 ; i < flags . length ; i ++ ) { if ( i == 0 ) { interlink = ! flags [ i ] ; continue ; } interlink &= ! fla... | Decides over the given flags if the true - case or the false - case will be return . | 114 | 20 |
11,342 | public void add ( Collection < AlertChannel > channels ) { for ( AlertChannel channel : channels ) this . channels . put ( channel . getId ( ) , channel ) ; } | Adds the channel list to the channels for the account . | 37 | 11 |
11,343 | void addAllClasses ( ListBuffer < ClassDocImpl > l , boolean filtered ) { try { if ( isSynthetic ( ) ) return ; // sometimes synthetic classes are not marked synthetic if ( ! JavadocTool . isValidClassName ( tsym . name . toString ( ) ) ) return ; if ( filtered && ! env . shouldDocument ( tsym ) ) return ; if ( l . con... | Adds all inner classes of this class and their inner classes recursively to the list l . | 283 | 19 |
11,344 | public static long randomLong ( final long min , final long max ) { return Math . round ( Math . random ( ) * ( max - min ) + min ) ; } | Returns a natural long value between given minimum value and max value . | 36 | 13 |
11,345 | public static Set < Class < ? > > getAllAnnotatedClasses ( final String packagePath , final Class < ? extends Annotation > annotationClass ) throws ClassNotFoundException , IOException , URISyntaxException { final List < File > directories = ClassExtensions . getDirectoriesFromResources ( packagePath , true ) ; final S... | Gets all annotated classes that belongs from the given package path and the given annotation class . | 126 | 19 |
11,346 | public static Set < Class < ? > > getAllAnnotatedClassesFromSet ( final String packagePath , final Set < Class < ? extends Annotation > > annotationClasses ) throws ClassNotFoundException , IOException , URISyntaxException { final List < File > directories = ClassExtensions . getDirectoriesFromResources ( packagePath ,... | Gets all annotated classes that belongs from the given package path and the given list with annotation classes . | 135 | 21 |
11,347 | public static < T extends Annotation > T getAnnotation ( final Class < ? > componentClass , final Class < T > annotationClass ) { T annotation = componentClass . getAnnotation ( annotationClass ) ; if ( annotation != null ) { return annotation ; } for ( final Class < ? > ifc : componentClass . getInterfaces ( ) ) { ann... | Search for the given annotationClass in the given componentClass and return it if search was successful . | 218 | 19 |
11,348 | public static Set < Class < ? > > scanForClasses ( final File directory , final String packagePath ) throws ClassNotFoundException { return AnnotationExtensions . scanForAnnotatedClasses ( directory , packagePath , null ) ; } | Scan recursive for classes in the given directory . | 52 | 9 |
11,349 | @ SuppressWarnings ( "unchecked" ) public static Object setAnnotationValue ( final Annotation annotation , final String key , final Object value ) throws NoSuchFieldException , SecurityException , IllegalArgumentException , IllegalAccessException { final Object invocationHandler = Proxy . getInvocationHandler ( annotat... | Sets the annotation value for the given key of the given annotation to the given new value at runtime . | 185 | 21 |
11,350 | public Iterator < S > iterator ( ) { return new Iterator < S > ( ) { Iterator < Map . Entry < String , S > > knownProviders = providers . entrySet ( ) . iterator ( ) ; public boolean hasNext ( ) { if ( knownProviders . hasNext ( ) ) return true ; return lookupIterator . hasNext ( ) ; } public S next ( ) { if ( knownPro... | Lazily loads the available providers of this loader s service . | 137 | 13 |
11,351 | public Function getFunction ( String name ) { for ( Function f : functions ) { if ( f . getName ( ) . equals ( name ) ) return f ; } return null ; } | Returns the Function with the given name or null if none matches . | 39 | 13 |
11,352 | @ Override public void setContract ( Contract c ) { super . setContract ( c ) ; for ( Function f : functions ) { f . setContract ( c ) ; } } | Sets the Contract this Interface is a part of . Propegates to its Functions | 38 | 17 |
11,353 | public static Collector < Triple , ? , Graph > toGraph ( ) { return of ( rdf :: createGraph , Graph :: add , ( left , right ) -> { right . iterate ( ) . forEach ( left :: add ) ; return left ; } , UNORDERED ) ; } | Collect a stream of Triples into a Graph | 62 | 9 |
11,354 | public static Collector < Quad , ? , Dataset > toDataset ( ) { return of ( rdf :: createDataset , Dataset :: add , ( left , right ) -> { right . iterate ( ) . forEach ( left :: add ) ; return left ; } , UNORDERED ) ; } | Collect a stream of Quads into a Dataset | 70 | 11 |
11,355 | public ContextFactory toCreate ( BiFunction < Constructor , Object [ ] , Object > function ) { return new ContextFactory ( this . context , function ) ; } | Changes the way the objects are created by using the given function . | 34 | 13 |
11,356 | public < E > Optional < E > create ( Class < E > type ) { List < Constructor < ? > > constructors = reflect ( ) . constructors ( ) . filter ( declared ( Modifier . PUBLIC ) ) . from ( type ) ; Optional created ; for ( Constructor < ? > constructor : constructors ) { created = tryCreate ( constructor ) ; if ( created . ... | Creates a new instance of the given type by looping through its public constructors to find one which all parameters are resolved by the context . | 100 | 29 |
11,357 | private Optional tryCreate ( Constructor < ? > constructor ) { Object [ ] args = new Object [ constructor . getParameterCount ( ) ] ; Object arg ; Optional < Object > resolved ; int i = 0 ; for ( Parameter parameter : constructor . getParameters ( ) ) { resolved = context . resolve ( parameter ) ; if ( ! resolved . isP... | tries to create the object using the given constructor | 120 | 10 |
11,358 | @ Override public void reportPublicApi ( ClassSymbol sym ) { // The next test will catch when source files are located in the wrong directory! // This ought to be moved into javac as a new warning, or perhaps as part // of the auxiliary class warning. // For example if sun.swing.BeanInfoUtils // is in fact stored in: /... | Collect the public apis of classes supplied explicitly for compilation . | 483 | 12 |
11,359 | public void execute ( ) throws MojoExecutionException { getLog ( ) . debug ( "starting packaging" ) ; AbstractConfiguration [ ] configurations = ( AbstractConfiguration [ ] ) getPluginContext ( ) . get ( ConfiguratorMojo . GENERATED_CONFIGURATIONS_KEY ) ; try { for ( AbstractConfiguration configuration : configurations... | Generates the JAD . | 297 | 6 |
11,360 | public List < Map < String , Object > > resultSetToMap ( ResultSet rows ) { try { List < Map < String , Object > > beans = new ArrayList < Map < String , Object > > ( ) ; int columnCount = rows . getMetaData ( ) . getColumnCount ( ) ; while ( rows . next ( ) ) { LinkedHashMap < String , Object > bean = new LinkedHashMa... | Returns a preparedStatement result into a List of Maps . Not the most efficient way of storing the values however the results should be limited at this stage . | 243 | 30 |
11,361 | private JCExpression makeMetafactoryIndyCall ( TranslationContext < ? > context , int refKind , Symbol refSym , List < JCExpression > indy_args ) { JCFunctionalExpression tree = context . tree ; //determine the static bsm args MethodSymbol samSym = ( MethodSymbol ) types . findDescriptorSymbol ( tree . type . tsym ) ; ... | Generate an indy method call to the meta factory | 697 | 11 |
11,362 | private JCExpression makeIndyCall ( DiagnosticPosition pos , Type site , Name bsmName , List < Object > staticArgs , MethodType indyType , List < JCExpression > indyArgs , Name methName ) { int prevPos = make . pos ; try { make . at ( pos ) ; List < Type > bsm_staticArgs = List . of ( syms . methodHandleLookupType , sy... | Generate an indy method call with given name type and static bootstrap arguments types | 335 | 17 |
11,363 | protected String lookupServerURL ( DataBinder binder ) { _logger . info ( "STANDARD lookupServerURL: servers=" + _servers + ", selector='" + _selector + ' ' ) ; if ( _servers != null ) { if ( _selector != null ) { return _servers . get ( binder . get ( _selector ) ) ; } else if ( _servers . size ( ) == 1 ) { return _se... | Looks up server URL based on request parameters in the data binder . | 130 | 14 |
11,364 | public void clean ( ) { log . debug ( "[clean] Cleaning world" ) ; for ( Robot bot : robotsPosition . keySet ( ) ) { bot . die ( "World cleanup" ) ; if ( robotsPosition . containsKey ( bot ) ) { log . warn ( "[clean] Robot did not unregister itself. Removing it" ) ; remove ( bot ) ; } } } | Called to dispose of the world | 83 | 7 |
11,365 | public void move ( Robot robot ) { if ( ! robotsPosition . containsKey ( robot ) ) { throw new IllegalArgumentException ( "Robot doesn't exist" ) ; } if ( ! robot . getData ( ) . isMobile ( ) ) { throw new IllegalArgumentException ( "Robot can't move" ) ; } Point newPosition = getReferenceField ( robot , 1 ) ; if ( ! i... | Changes the position of a robot to its current reference field | 145 | 11 |
11,366 | public Robot getNeighbour ( Robot robot ) { Point neighbourPos = getReferenceField ( robot , 1 ) ; return getRobotAt ( neighbourPos ) ; } | Gets the robot in the reference field | 34 | 8 |
11,367 | public ScanResult scan ( Robot robot , int dist ) { Point space = getReferenceField ( robot , dist ) ; Robot inPosition = getRobotAt ( space ) ; ScanResult ret = null ; if ( inPosition == null ) { ret = new ScanResult ( Found . EMPTY , dist ) ; } else { if ( robot . getData ( ) . getTeamId ( ) == inPosition . getData (... | Scans up to a number of fields in front of the robot stopping on the first field that contains a robot | 135 | 22 |
11,368 | public int getBotsCount ( int teamId , boolean invert ) { int total = 0 ; for ( Robot bot : robotsPosition . keySet ( ) ) { if ( bot . getData ( ) . getTeamId ( ) == teamId ) { if ( ! invert ) { total ++ ; } } else { if ( invert ) { total ++ ; } } } return total ; } | Get the total number of living robots from or not from a team | 84 | 13 |
11,369 | public CompilerThread grabCompilerThread ( ) throws InterruptedException { available . acquire ( ) ; if ( compilers . empty ( ) ) { return new CompilerThread ( this ) ; } return compilers . pop ( ) ; } | Acquire a compiler thread from the pool or block until a thread is available . If the pools is empty create a new thread but never more than is available . | 50 | 32 |
11,370 | public void add ( Collection < Server > servers ) { for ( Server server : servers ) this . servers . put ( server . getId ( ) , server ) ; } | Adds the server list to the servers for the account . | 35 | 11 |
11,371 | public Symbol resolveIdent ( String name ) { if ( name . equals ( "" ) ) return syms . errSymbol ; JavaFileObject prev = log . useSource ( null ) ; try { JCExpression tree = null ; for ( String s : name . split ( "\\." , - 1 ) ) { if ( ! SourceVersion . isIdentifier ( s ) ) // TODO: check for keywords return syms . err... | Resolve an identifier . | 215 | 5 |
11,372 | JavaFileObject printSource ( Env < AttrContext > env , JCClassDecl cdef ) throws IOException { JavaFileObject outFile = fileManager . getJavaFileForOutput ( CLASS_OUTPUT , cdef . sym . flatname . toString ( ) , JavaFileObject . Kind . SOURCE , null ) ; if ( inputFiles . contains ( outFile ) ) { log . error ( cdef . pos... | Emit plain Java source for a class . | 198 | 9 |
11,373 | public List < JCCompilationUnit > enterTreesIfNeeded ( List < JCCompilationUnit > roots ) { if ( shouldStop ( CompileState . ATTR ) ) return List . nil ( ) ; return enterTrees ( roots ) ; } | Enter the symbols found in a list of parse trees if the compilation is expected to proceed beyond anno processing into attr . As a side - effect this puts elements on the todo list . Also stores a list of all top level classes in rootClasses . | 56 | 53 |
11,374 | public List < JCCompilationUnit > enterTrees ( List < JCCompilationUnit > roots ) { //enter symbols for all files if ( ! taskListener . isEmpty ( ) ) { for ( JCCompilationUnit unit : roots ) { TaskEvent e = new TaskEvent ( TaskEvent . Kind . ENTER , unit ) ; taskListener . started ( e ) ; } } enter . main ( roots ) ; i... | Enter the symbols found in a list of parse trees . As a side - effect this puts elements on the todo list . Also stores a list of all top level classes in rootClasses . | 373 | 39 |
11,375 | protected void flow ( Env < AttrContext > env , Queue < Env < AttrContext > > results ) { if ( compileStates . isDone ( env , CompileState . FLOW ) ) { results . add ( env ) ; return ; } try { if ( shouldStop ( CompileState . FLOW ) ) return ; if ( relax ) { results . add ( env ) ; return ; } if ( verboseCompilePolicy ... | Perform dataflow checks on an attributed parse tree . | 305 | 11 |
11,376 | private void setPackages ( DocEnv env , List < String > packages ) { ListBuffer < PackageDocImpl > packlist = new ListBuffer < PackageDocImpl > ( ) ; for ( String name : packages ) { PackageDocImpl pkg = env . lookupPackage ( name ) ; if ( pkg != null ) { pkg . isIncluded = true ; packlist . append ( pkg ) ; } else { e... | Initialize packages information . | 129 | 5 |
11,377 | public ClassDoc [ ] specifiedClasses ( ) { ListBuffer < ClassDocImpl > classesToDocument = new ListBuffer < ClassDocImpl > ( ) ; for ( ClassDocImpl cd : cmdLineClasses ) { cd . addAllClasses ( classesToDocument , true ) ; } return ( ClassDoc [ ] ) classesToDocument . toArray ( new ClassDocImpl [ classesToDocument . len... | Classes and interfaces specified on the command line . | 91 | 10 |
11,378 | @ SuppressWarnings ( "unchecked" ) public Object unmarshal ( Object obj ) throws RpcException { if ( obj == null ) { return returnNullIfOptional ( ) ; } else if ( obj . getClass ( ) != String . class ) { String msg = "'" + obj + "' enum must be String, got: " + obj . getClass ( ) . getSimpleName ( ) ; throw RpcExceptio... | Enforces that obj is a String contained in the Enum s values list | 272 | 15 |
11,379 | protected boolean loadReport ( ReportsConfig result , InputStream report , String reportName ) { ObjectMapper mapper = new ObjectMapper ( new YAMLFactory ( ) ) ; ReportConfig reportConfig = null ; try { reportConfig = mapper . readValue ( report , ReportConfig . class ) ; } catch ( IOException e ) { e . printStackTrace... | Loads a report this does the deserialization this method can be substituted with another called by child classes . Once it has deserialized it it put it into the map . | 139 | 36 |
11,380 | public ReportsConfig getReportsConfig ( Collection < String > restrictToNamed ) { resetErrors ( ) ; ReportsConfig result = new ReportsConfig ( ) ; InternalType [ ] reports = getReportList ( ) ; if ( reports == null ) { errors . add ( "No reports found." ) ; return result ; } for ( InternalType report : reports ) { Stri... | Returns a list of reports in a ReportsConfig - uration object it only loads reports in restrictedToNamed this is useful as a secondary report - restriction mechanism . So you would pass in all reports the user can access . | 176 | 45 |
11,381 | public static ApruveResponse < SubscriptionAdjustment > get ( String subscriptionId , String adjustmentId ) { return ApruveClient . getInstance ( ) . get ( getSubscriptionAdjustmentsPath ( subscriptionId ) + adjustmentId , SubscriptionAdjustment . class ) ; } | Get the SubscriptionAdjustment with the given ID | 59 | 10 |
11,382 | public static ApruveResponse < List < SubscriptionAdjustment > > getAllAdjustments ( String subscriptionId ) { return ApruveClient . getInstance ( ) . index ( getSubscriptionAdjustmentsPath ( subscriptionId ) , new GenericType < List < SubscriptionAdjustment > > ( ) { } ) ; } | Get all SubscriptionAdjustments for the specified Subscription . | 68 | 12 |
11,383 | public ApruveResponse < SubscriptionAdjustmentCreateResponse > create ( String subscriptionId ) { return ApruveClient . getInstance ( ) . post ( getSubscriptionAdjustmentsPath ( subscriptionId ) , this , SubscriptionAdjustmentCreateResponse . class ) ; } | Create this SubscriptionAdjustment on the Apruve servers . | 57 | 13 |
11,384 | public static ApruveResponse < SubscriptionAdjustmentDeleteResponse > delete ( String subscriptionId , String adjustmentId ) { return ApruveClient . getInstance ( ) . delete ( getSubscriptionAdjustmentsPath ( subscriptionId ) + adjustmentId , SubscriptionAdjustmentDeleteResponse . class ) ; } | Delete the specified SubscriptionAdjustment from the Apruve servers . This is only allowed for SubscriptionAdjustments that are not in APPLIED status . | 63 | 31 |
11,385 | public String wrap ( String text ) { StringBuilder sb = new StringBuilder ( ) ; int continuationLength = continuation . length ( ) ; int currentPosition = 0 ; for ( String word : text . split ( " " ) ) { String lastWord ; int wordLength = word . length ( ) ; if ( currentPosition + wordLength <= width ) { if ( currentPo... | Wrap the specified text . | 321 | 6 |
11,386 | public void printMessage ( Diagnostic . Kind kind , CharSequence msg , Element e , AnnotationMirror a , AnnotationValue v ) { JavaFileObject oldSource = null ; JavaFileObject newSource = null ; JCDiagnostic . DiagnosticPosition pos = null ; JavacElements elemUtils = processingEnv . getElementUtils ( ) ; Pair < JCTree ,... | Prints a message of the specified kind at the location of the annotation value inside the annotation mirror of the annotated element . | 371 | 25 |
11,387 | public void addWhereClause ( FreemarkerWhereClause freemarkerWhereClause ) { String outputBody = freemarkerWhereClause . getOutputBody ( ) ; if ( StringUtils . isNotBlank ( outputBody ) ) freemarkerWhereClauses . add ( outputBody ) ; } | Adds a where clause to the current context . Only performed on where clauses which are rendered . | 67 | 18 |
11,388 | public static Object invoke ( Object object , String methodName , Object ... parameters ) { Method method = getMethodThatMatchesParameters ( object . getClass ( ) , methodName , parameters ) ; if ( method != null ) { try { return method . invoke ( object , parameters ) ; } catch ( IllegalAccessException e ) { throw new... | Silently invoke the specified methodName using reflection . | 201 | 10 |
11,389 | public byte [ ] getContents ( FileColumn [ ] columns , List < String [ ] > lines ) throws IOException { byte [ ] ret ; // Excel spreadsheet if ( format . isExcel ( ) ) { ret = getExcelOutput ( columns , lines ) ; } else // Assume it's a CSV file { ret = getCSVOutput ( lines ) ; } return ret ; } | Returns the formatted output file contents . | 82 | 7 |
11,390 | private byte [ ] getCSVOutput ( List < String [ ] > lines ) { StringWriter writer = new StringWriter ( ) ; csv = new CSVWriter ( writer , delimiter . separator ( ) . charAt ( 0 ) ) ; for ( int i = 0 ; i < lines . size ( ) ; i ++ ) { csv . writeNext ( ( String [ ] ) lines . get ( i ) , quotes ) ; } // The contents retur... | Returns the CSV output file data . | 115 | 7 |
11,391 | private byte [ ] getExcelOutput ( FileColumn [ ] columns , List < String [ ] > lines ) throws IOException { // Create the workbook baos = new ByteArrayOutputStream ( 1024 ) ; if ( existing != null ) workbook = Workbook . createWorkbook ( format , baos , existing ) ; else workbook = Workbook . createWorkbook ( format , ... | Returns the XLS or XLSX output file data . | 190 | 12 |
11,392 | public MainFrame put ( Widget widget ) { widget . addTo ( user ) ; content = widget != null ? widget . getID ( ) : - 1 ; this . sendElement ( ) ; return this ; } | Adds widget to page | 45 | 4 |
11,393 | public static < T extends Comparable < ? super T > > boolean greaterThanOrEquals ( final T object , final T other ) { return JudgeUtils . greaterThanOrEquals ( object , other ) ; } | Returns true if object equals other or object greater than other ; false otherwise . | 48 | 15 |
11,394 | public static < T extends Comparable < ? super T > > boolean greaterThan ( final T object , final T other ) { return JudgeUtils . greaterThan ( object , other ) ; } | Returns true if object greater than other ; false otherwise . | 42 | 11 |
11,395 | public static < T extends Comparable < ? super T > > boolean lessThanOrEquals ( final T object , final T other ) { return JudgeUtils . lessThanOrEquals ( object , other ) ; } | Returns true if object equals other or object less than other ; false otherwise . | 48 | 15 |
11,396 | public static < T extends Comparable < ? super T > > boolean lessThan ( final T object , final T other ) { return JudgeUtils . lessThan ( object , other ) ; } | Returns true if object less than other ; false otherwise . | 42 | 11 |
11,397 | public static < T extends Comparable < ? super T > > void ascDeep ( final T [ ] comparableArray ) { if ( ArrayUtils . isEmpty ( comparableArray ) ) { return ; } ascByReflex ( comparableArray ) ; } | Orders given comparable array by ascending . | 52 | 8 |
11,398 | public static < T extends Comparable < ? super T > > void descDeep ( final T [ ] comparableArray ) { if ( ArrayUtils . isEmpty ( comparableArray ) ) { return ; } descByReflex ( comparableArray ) ; } | Orders given comparable array by descending . | 52 | 8 |
11,399 | public static < T > void reverse ( final T array ) { if ( ArrayUtils . isArray ( array ) ) { int mlength = Array . getLength ( array ) - 1 ; Object temp = null ; for ( int i = 0 , j = mlength ; i < mlength ; i ++ , j -- ) { Object arg0 = Array . get ( array , i ) ; Object arg1 = Array . get ( array , j ) ; temp = arg0 ... | Sort the array in reverse order . | 126 | 7 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.