idx int64 0 41.2k | question stringlengths 73 5.81k | target stringlengths 5 918 |
|---|---|---|
6,200 | public final Operation updateBackendBucket ( String backendBucket , BackendBucket backendBucketResource , List < String > fieldMask ) { UpdateBackendBucketHttpRequest request = UpdateBackendBucketHttpRequest . newBuilder ( ) . setBackendBucket ( backendBucket ) . setBackendBucketResource ( backendBucketResource ) . add... | Updates the specified BackendBucket resource with the data included in the request . |
6,201 | public TableResult list ( Schema schema , TableDataListOption ... options ) throws BigQueryException { return bigquery . listTableData ( getTableId ( ) , schema , options ) ; } | Returns the paginated list rows in this table . |
6,202 | public static Role of ( String value ) { checkNotNull ( value ) ; if ( ! value . contains ( "/" ) ) { value = ROLE_PREFIX + value ; } return new Role ( value ) ; } | Returns a new role given its string value . |
6,203 | @ BetaApi ( "The surface for long-running operations is not stable yet and may change in the future." ) public final OperationFuture < Instance , OperationMetadata > createInstanceAsync ( LocationName parent , String instanceId , Instance instance ) { CreateInstanceRequest request = CreateInstanceRequest . newBuilder (... | Creates a Redis instance based on the specified tier and memory size . |
6,204 | public static ZoneOperationId of ( ZoneId zoneId , String operation ) { return new ZoneOperationId ( zoneId . getProject ( ) , zoneId . getZone ( ) , operation ) ; } | Returns a zone operation identity given the zone identity and the operation name . |
6,205 | public static ZoneOperationId of ( String zone , String operation ) { return new ZoneOperationId ( null , zone , operation ) ; } | Returns a zone operation identity given the zone and operation names . |
6,206 | public static ZoneOperationId of ( String project , String zone , String operation ) { return new ZoneOperationId ( project , zone , operation ) ; } | Returns a zone operation identity given project zone and operation names . |
6,207 | public final DeviceRegistry updateDeviceRegistry ( DeviceRegistry deviceRegistry , FieldMask updateMask ) { UpdateDeviceRegistryRequest request = UpdateDeviceRegistryRequest . newBuilder ( ) . setDeviceRegistry ( deviceRegistry ) . setUpdateMask ( updateMask ) . build ( ) ; return updateDeviceRegistry ( request ) ; } | Updates a device registry configuration . |
6,208 | public final Device updateDevice ( Device device , FieldMask updateMask ) { UpdateDeviceRequest request = UpdateDeviceRequest . newBuilder ( ) . setDevice ( device ) . setUpdateMask ( updateMask ) . build ( ) ; return updateDevice ( request ) ; } | Updates a device . |
6,209 | public final BindDeviceToGatewayResponse bindDeviceToGateway ( String parent , String gatewayId , String deviceId ) { BindDeviceToGatewayRequest request = BindDeviceToGatewayRequest . newBuilder ( ) . setParent ( parent ) . setGatewayId ( gatewayId ) . setDeviceId ( deviceId ) . build ( ) ; return bindDeviceToGateway (... | Associates the device with the gateway . |
6,210 | public final UnbindDeviceFromGatewayResponse unbindDeviceFromGateway ( RegistryName parent , String gatewayId , String deviceId ) { UnbindDeviceFromGatewayRequest request = UnbindDeviceFromGatewayRequest . newBuilder ( ) . setParent ( parent == null ? null : parent . toString ( ) ) . setGatewayId ( gatewayId ) . setDev... | Deletes the association between the device and the gateway . |
6,211 | private void releaseSession ( PooledSession session ) { Preconditions . checkNotNull ( session ) ; synchronized ( lock ) { if ( closureFuture != null ) { return ; } if ( readWaiters . size ( ) == 0 && numSessionsBeingPrepared >= readWriteWaiters . size ( ) ) { if ( shouldPrepareSession ( ) ) { prepareSession ( session ... | Releases a session back to the pool . This might cause one of the waiters to be unblocked . |
6,212 | public final ListUptimeCheckConfigsPagedResponse listUptimeCheckConfigs ( String parent ) { ListUptimeCheckConfigsRequest request = ListUptimeCheckConfigsRequest . newBuilder ( ) . setParent ( parent ) . build ( ) ; return listUptimeCheckConfigs ( request ) ; } | Lists the existing valid uptime check configurations for the project leaving out any invalid configurations . |
6,213 | public final UptimeCheckConfig createUptimeCheckConfig ( String parent , UptimeCheckConfig uptimeCheckConfig ) { CreateUptimeCheckConfigRequest request = CreateUptimeCheckConfigRequest . newBuilder ( ) . setParent ( parent ) . setUptimeCheckConfig ( uptimeCheckConfig ) . build ( ) ; return createUptimeCheckConfig ( req... | Creates a new uptime check configuration . |
6,214 | public final UptimeCheckConfig updateUptimeCheckConfig ( UptimeCheckConfig uptimeCheckConfig ) { UpdateUptimeCheckConfigRequest request = UpdateUptimeCheckConfigRequest . newBuilder ( ) . setUptimeCheckConfig ( uptimeCheckConfig ) . build ( ) ; return updateUptimeCheckConfig ( request ) ; } | Updates an uptime check configuration . You can either replace the entire configuration with a new one or replace only certain fields in the current configuration by specifying the fields to be updated via updateMask . Returns the updated configuration . |
6,215 | public ListTopicsPagedResponse listTopics ( ) throws Exception { try ( TopicAdminClient topicAdminClient = TopicAdminClient . create ( ) ) { ListTopicsRequest listTopicsRequest = ListTopicsRequest . newBuilder ( ) . setProject ( ProjectName . format ( projectId ) ) . build ( ) ; ListTopicsPagedResponse response = topic... | Example of listing topics . |
6,216 | public ListTopicSubscriptionsPagedResponse listTopicSubscriptions ( String topicId ) throws Exception { try ( TopicAdminClient topicAdminClient = TopicAdminClient . create ( ) ) { ProjectTopicName topicName = ProjectTopicName . of ( projectId , topicId ) ; ListTopicSubscriptionsRequest request = ListTopicSubscriptionsR... | Example of listing subscriptions for a topic . |
6,217 | public ProjectTopicName deleteTopic ( String topicId ) throws Exception { try ( TopicAdminClient topicAdminClient = TopicAdminClient . create ( ) ) { ProjectTopicName topicName = ProjectTopicName . of ( projectId , topicId ) ; topicAdminClient . deleteTopic ( topicName ) ; return topicName ; } } | Example of deleting a topic . |
6,218 | public Policy getTopicPolicy ( String topicId ) throws Exception { try ( TopicAdminClient topicAdminClient = TopicAdminClient . create ( ) ) { ProjectTopicName topicName = ProjectTopicName . of ( projectId , topicId ) ; Policy policy = topicAdminClient . getIamPolicy ( topicName . toString ( ) ) ; if ( policy == null )... | Example of getting a topic policy . |
6,219 | public Policy replaceTopicPolicy ( String topicId ) throws Exception { try ( TopicAdminClient topicAdminClient = TopicAdminClient . create ( ) ) { String topicName = ProjectTopicName . format ( projectId , topicId ) ; Policy policy = topicAdminClient . getIamPolicy ( topicName ) ; Binding binding = Binding . newBuilder... | Example of replacing a topic policy . |
6,220 | public Topic getTopic ( String topicId ) throws Exception { try ( TopicAdminClient topicAdminClient = TopicAdminClient . create ( ) ) { ProjectTopicName topicName = ProjectTopicName . of ( projectId , topicId ) ; Topic topic = topicAdminClient . getTopic ( topicName ) ; return topic ; } } | Example of getting a topic . |
6,221 | public final Operation updateHttpsHealthCheck ( ProjectGlobalHttpsHealthCheckName httpsHealthCheck , HttpsHealthCheck2 httpsHealthCheckResource , List < String > fieldMask ) { UpdateHttpsHealthCheckHttpRequest request = UpdateHttpsHealthCheckHttpRequest . newBuilder ( ) . setHttpsHealthCheck ( httpsHealthCheck == null ... | Updates a HttpsHealthCheck resource in the specified project using the data included in the request . |
6,222 | private Span startSpan ( String spanName ) { return tracer . spanBuilder ( spanName ) . setRecordEvents ( censusHttpModule . isRecordEvents ( ) ) . startSpan ( ) ; } | Helper method to start a span . |
6,223 | private Template createAndStoreTemplate ( String key , InputStream inputStream , File file ) throws Exception { if ( verbose ) { log ( "Creating new template from " + key + "..." ) ; } Reader reader = null ; try { String fileEncoding = ( fileEncodingParamVal != null ) ? fileEncodingParamVal : System . getProperty ( GRO... | Compile the template and store it in the cache . |
6,224 | public static boolean parametersCompatible ( Parameter [ ] source , Parameter [ ] target ) { return parametersMatch ( source , target , t -> ClassHelper . getWrapper ( t . getV2 ( ) ) . getTypeClass ( ) . isAssignableFrom ( ClassHelper . getWrapper ( t . getV1 ( ) ) . getTypeClass ( ) ) ) ; } | check whether parameters type are compatible |
6,225 | private static void setSourcePosition ( Expression toSet , Expression origNode ) { toSet . setSourcePosition ( origNode ) ; if ( toSet instanceof PropertyExpression ) { ( ( PropertyExpression ) toSet ) . getProperty ( ) . setSourcePosition ( origNode ) ; } } | Set the source position of toSet including its property expression if it has one . |
6,226 | public GPathResult parse ( final InputSource input ) throws IOException , SAXException { reader . setContentHandler ( this ) ; reader . parse ( input ) ; return getDocument ( ) ; } | Parse the content of the specified input source into a GPathResult object |
6,227 | public GPathResult parse ( final File file ) throws IOException , SAXException { final FileInputStream fis = new FileInputStream ( file ) ; final InputSource input = new InputSource ( fis ) ; input . setSystemId ( "file://" + file . getAbsolutePath ( ) ) ; try { return parse ( input ) ; } finally { fis . close ( ) ; } ... | Parses the content of the given file as XML turning it into a GPathResult object |
6,228 | public void setEntityBaseUrl ( final URL base ) { reader . setEntityResolver ( new EntityResolver ( ) { public InputSource resolveEntity ( final String publicId , final String systemId ) throws IOException { return new InputSource ( new URL ( base , systemId ) . openStream ( ) ) ; } } ) ; } | Resolves entities against using the supplied URL as the base for relative URLs |
6,229 | protected final Statement wrapBlock ( Statement statement ) { BlockStatement stmt = new BlockStatement ( ) ; stmt . addStatement ( createInterruptStatement ( ) ) ; stmt . addStatement ( statement ) ; return stmt ; } | Takes a statement and wraps it into a block statement which first element is the interruption check statement . |
6,230 | private void visitLoop ( LoopingStatement loopStatement ) { Statement statement = loopStatement . getLoopBlock ( ) ; loopStatement . setLoopBlock ( wrapBlock ( statement ) ) ; } | Shortcut method which avoids duplicating code for every type of loop . Actually wraps the loopBlock of different types of loop statements . |
6,231 | private void installMetaClassCreationHandle ( ) { try { final Class customMetaClassHandle = Class . forName ( "groovy.runtime.metaclass.CustomMetaClassCreationHandle" ) ; final Constructor customMetaClassHandleConstructor = customMetaClassHandle . getConstructor ( ) ; this . metaClassCreationHandle = ( MetaClassCreatio... | Looks for a class called groovy . runtime . metaclass . CustomMetaClassCreationHandle and if it exists uses it as the MetaClassCreationHandle otherwise uses the default |
6,232 | private void setMetaClass ( Class theClass , MetaClass oldMc , MetaClass newMc ) { final ClassInfo info = ClassInfo . getClassInfo ( theClass ) ; MetaClass mc = null ; info . lock ( ) ; try { mc = info . getStrongMetaClass ( ) ; info . setStrongMetaClass ( newMc ) ; } finally { info . unlock ( ) ; } if ( ( oldMc == nul... | if oldMc is null newMc will replace whatever meta class was used before . if oldMc is not null then newMc will be used only if he stored mc is the same as oldMc |
6,233 | protected void fireConstantMetaClassUpdate ( Object obj , Class c , final MetaClass oldMC , MetaClass newMc ) { MetaClassRegistryChangeEventListener [ ] listener = getMetaClassRegistryChangeEventListeners ( ) ; MetaClassRegistryChangeEvent cmcu = new MetaClassRegistryChangeEvent ( this , obj , c , oldMC , newMc ) ; for... | Causes the execution of all registered listeners . This method is used mostly internal to kick of the listener notification . It can also be used by subclasses to achieve the same . |
6,234 | public Iterator iterator ( ) { final MetaClass [ ] refs = metaClassInfo . toArray ( EMPTY_METACLASS_ARRAY ) ; return new Iterator ( ) { private int index = 0 ; private MetaClass currentMeta ; private boolean hasNextCalled = false ; private boolean hasNext = false ; public boolean hasNext ( ) { if ( hasNextCalled ) retu... | Returns an iterator to iterate over all constant meta classes . This iterator can be seen as making a snapshot of the current state of the registry . The snapshot will include all meta classes that has been used unless they are already collected . Collected meta classes will be skipped automatically so you can expect t... |
6,235 | public static boolean checkValueIsType ( Object value , Object name , Class type ) { if ( value != null ) { if ( type . isAssignableFrom ( value . getClass ( ) ) ) { return true ; } else { throw new RuntimeException ( "The value argument of '" + name + "' must be of type " + type . getName ( ) + ". Found: " + value . g... | Checks type of value against builder type |
6,236 | public void autoRegisterNodes ( ) { synchronized ( this ) { if ( autoRegistrationRunning || autoRegistrationComplete ) { return ; } } autoRegistrationRunning = true ; try { callAutoRegisterMethods ( getClass ( ) ) ; } finally { autoRegistrationComplete = true ; autoRegistrationRunning = false ; } } | Ask the nodes to be registered |
6,237 | public void registerFactory ( String name , String groupName , Factory factory ) { getProxyBuilder ( ) . factories . put ( name , factory ) ; getRegistrationGroup ( groupName ) . add ( name ) ; factory . onFactoryRegistration ( this , name , groupName ) ; } | Registers a factory for a node name . |
6,238 | protected Object createNode ( Object name , Map attributes , Object value ) { Object node ; Factory factory = getProxyBuilder ( ) . resolveFactory ( name , attributes , value ) ; if ( factory == null ) { LOG . log ( Level . WARNING , "Could not find match for name '" + name + "'" ) ; throw new MissingMethodExceptionNoS... | This method is responsible for instantiating a node and configure its properties . |
6,239 | protected Factory resolveFactory ( Object name , Map attributes , Object value ) { getProxyBuilder ( ) . getContext ( ) . put ( CHILD_BUILDER , getProxyBuilder ( ) ) ; return getProxyBuilder ( ) . getFactories ( ) . get ( name ) ; } | This is a hook for subclasses to plugin a custom strategy for mapping names to factories . |
6,240 | @ SuppressWarnings ( { "UnusedDeclaration" } ) protected Closure resolveExplicitMethod ( String methodName , Object args ) { return getExplicitMethods ( ) . get ( methodName ) ; } | This is a hook for subclasses to plugin a custom strategy for mapping names to explicit methods . |
6,241 | private Object doInvokeMethod ( String methodName , Object name , Object args ) { Reference explicitResult = new Reference ( ) ; if ( checkExplicitMethod ( methodName , args , explicitResult ) ) { return explicitResult . get ( ) ; } else { try { return dispatchNodeCall ( name , args ) ; } catch ( MissingMethodException... | This method is the workhorse of the builder . |
6,242 | public Object getName ( String methodName ) { if ( getProxyBuilder ( ) . nameMappingClosure != null ) { return getProxyBuilder ( ) . nameMappingClosure . call ( methodName ) ; } return methodName ; } | A hook to allow names to be converted into some other object such as a QName in XML or ObjectName in JMX . |
6,243 | protected FactoryBuilderSupport getProxyBuilder ( ) { FactoryBuilderSupport proxy = localProxyBuilder . get ( ) ; if ( proxy == null ) { return globalProxyBuilder ; } else { return proxy ; } } | Proxy builders are useful for changing the building context thus enabling mix & ; match builders . |
6,244 | protected void nodeCompleted ( Object parent , Object node ) { getProxyBuilder ( ) . getCurrentFactory ( ) . onNodeCompleted ( getProxyBuilder ( ) . getChildBuilder ( ) , parent , node ) ; } | A hook to allow nodes to be processed once they have had all of their children applied . |
6,245 | protected Map < String , Object > popContext ( ) { if ( ! getProxyBuilder ( ) . getContexts ( ) . isEmpty ( ) ) { return getProxyBuilder ( ) . getContexts ( ) . removeFirst ( ) ; } return null ; } | Removes the last context from the stack . |
6,246 | protected Map < String , Object > getContinuationData ( ) { Map < String , Object > data = new HashMap < String , Object > ( ) ; data . put ( "proxyBuilder" , localProxyBuilder . get ( ) ) ; data . put ( "contexts" , contexts . get ( ) ) ; return data ; } | Stores the thread local states in a Map that can be passed across threads |
6,247 | protected void restoreFromContinuationData ( Map < String , Object > data ) { localProxyBuilder . set ( ( FactoryBuilderSupport ) data . get ( "proxyBuilder" ) ) ; contexts . set ( ( LinkedList < Map < String , Object > > ) data . get ( "contexts" ) ) ; } | Restores the state of the current builder to the same state as an older build . |
6,248 | public static String repeatString ( String pattern , int repeats ) { StringBuilder buffer = new StringBuilder ( pattern . length ( ) * repeats ) ; for ( int i = 0 ; i < repeats ; i ++ ) { buffer . append ( pattern ) ; } return new String ( buffer ) ; } | Returns a string made up of repetitions of the specified string . |
6,249 | public static boolean isJavaIdentifier ( String name ) { if ( name . length ( ) == 0 || INVALID_JAVA_IDENTIFIERS . contains ( name ) ) return false ; char [ ] chars = name . toCharArray ( ) ; if ( ! Character . isJavaIdentifierStart ( chars [ 0 ] ) ) return false ; for ( int i = 1 ; i < chars . length ; i ++ ) { if ( !... | Tells if the given string is a valid Java identifier . |
6,250 | public void shuttlesort ( int from [ ] , int to [ ] , int low , int high ) { if ( high - low < 2 ) { return ; } int middle = ( low + high ) / 2 ; shuttlesort ( to , from , low , middle ) ; shuttlesort ( to , from , middle , high ) ; int p = low ; int q = middle ; if ( high - low >= 4 && compare ( from [ middle - 1 ] , ... | using it here is that unlike qsort it is stable . |
6,251 | public void addMouseListenerToHeaderInTable ( JTable table ) { final TableSorter sorter = this ; final JTable tableView = table ; tableView . setColumnSelectionAllowed ( false ) ; MouseAdapter listMouseListener = new MouseAdapter ( ) { public void mouseClicked ( MouseEvent e ) { TableColumnModel columnModel = tableView... | when a column heading is clicked in the JTable . |
6,252 | public void write ( PrintWriter output , Janitor janitor ) { String description = "General error during " + owner . getPhaseDescription ( ) + ": " ; String message = cause . getMessage ( ) ; if ( message != null ) { output . println ( description + message ) ; } else { output . println ( description + cause ) ; } outpu... | Writes out a nicely formatted summary of the exception . |
6,253 | public Node appendNode ( Object name , Map attributes , Object value ) { return new Node ( this , name , attributes , value ) ; } | Creates a new node as a child of the current node . |
6,254 | public Node replaceNode ( Closure c ) { if ( parent ( ) == null ) { throw new UnsupportedOperationException ( "Replacing the root node is not supported" ) ; } appendNodes ( c ) ; getParentList ( parent ( ) ) . remove ( this ) ; this . setParent ( null ) ; return this ; } | Replaces the current node with nodes defined using builder - style notation via a Closure . |
6,255 | public Node replaceNode ( Node n ) { if ( parent ( ) == null ) { throw new UnsupportedOperationException ( "Replacing the root node is not supported" ) ; } List tail = getTail ( ) ; parent ( ) . appendNode ( n . name ( ) , n . attributes ( ) , n . value ( ) ) ; parent ( ) . children ( ) . addAll ( tail ) ; getParentLis... | Replaces the current node with the supplied node . |
6,256 | public String text ( ) { if ( value instanceof String ) { return ( String ) value ; } if ( value instanceof NodeList ) { return ( ( NodeList ) value ) . text ( ) ; } if ( value instanceof Collection ) { Collection coll = ( Collection ) value ; String previousText = null ; StringBuilder sb = null ; for ( Object child : ... | Returns the textual representation of the current node and all its child nodes . |
6,257 | public Object attribute ( Object key ) { return ( attributes != null ) ? attributes . get ( key ) : null ; } | Provides lookup of attributes by key . |
6,258 | public Object get ( String key ) { if ( key != null && key . charAt ( 0 ) == '@' ) { String attributeName = key . substring ( 1 ) ; return attributes ( ) . get ( attributeName ) ; } if ( ".." . equals ( key ) ) { return parent ( ) ; } if ( "*" . equals ( key ) ) { return children ( ) ; } if ( "**" . equals ( key ) ) { ... | Provides lookup of elements by non - namespaced name |
6,259 | private NodeList getByName ( String name ) { NodeList answer = new NodeList ( ) ; for ( Object child : children ( ) ) { if ( child instanceof Node ) { Node childNode = ( Node ) child ; Object childNodeName = childNode . name ( ) ; if ( childNodeName instanceof QName ) { QName qn = ( QName ) childNodeName ; if ( qn . ma... | Provides lookup of elements by name . |
6,260 | public List depthFirst ( boolean preorder ) { List answer = new NodeList ( ) ; if ( preorder ) answer . add ( this ) ; answer . addAll ( depthFirstRest ( preorder ) ) ; if ( ! preorder ) answer . add ( this ) ; return answer ; } | Provides a collection of all the nodes in the tree using a depth - first traversal . |
6,261 | public void depthFirst ( Closure c ) { Map < String , Object > options = new ListHashMap < String , Object > ( ) ; options . put ( "preorder" , true ) ; depthFirst ( options , c ) ; } | Provides a collection of all the nodes in the tree using a depth - first preorder traversal . |
6,262 | public void depthFirst ( Map < String , Object > options , Closure c ) { boolean preorder = Boolean . valueOf ( options . get ( "preorder" ) . toString ( ) ) ; if ( preorder ) callClosureForNode ( c , this , 1 ) ; depthFirstRest ( preorder , 2 , c ) ; if ( ! preorder ) callClosureForNode ( c , this , 1 ) ; } | Provides a collection of all the nodes in the tree using a depth - first traversal . A boolean preorder options is supported . |
6,263 | public void breadthFirst ( Map < String , Object > options , Closure c ) { boolean preorder = Boolean . valueOf ( options . get ( "preorder" ) . toString ( ) ) ; if ( preorder ) callClosureForNode ( c , this , 1 ) ; breadthFirstRest ( preorder , 2 , c ) ; if ( ! preorder ) callClosureForNode ( c , this , 1 ) ; } | Calls the provided closure for all the nodes in the tree using a breadth - first traversal . A boolean preorder options is supported . |
6,264 | public void setMetaClass ( final MetaClass metaClass ) { final MetaClass newMetaClass = new DelegatingMetaClass ( metaClass ) { public Object getAttribute ( final Object object , final String attribute ) { return GPathResult . this . getProperty ( "@" + attribute ) ; } public void setAttribute ( final Object object , f... | Replaces the MetaClass of this GPathResult . |
6,265 | public void setProperty ( final String property , final Object newValue ) { if ( property . startsWith ( "@" ) ) { if ( newValue instanceof String || newValue instanceof GString ) { final Iterator iter = iterator ( ) ; while ( iter . hasNext ( ) ) { final NodeChild child = ( NodeChild ) iter . next ( ) ; child . attrib... | Replaces the specified property of this GPathResult with a new value . |
6,266 | public Object plus ( final Object newValue ) { this . replaceNode ( new Closure ( this ) { public void doCall ( Object [ ] args ) { final GroovyObject delegate = ( GroovyObject ) getDelegate ( ) ; delegate . getProperty ( "mkp" ) ; delegate . invokeMethod ( "yield" , args ) ; delegate . getProperty ( "mkp" ) ; delegate... | Lazily adds the specified Object to this GPathResult . |
6,267 | public void putAt ( final int index , final Object newValue ) { final GPathResult result = ( GPathResult ) getAt ( index ) ; if ( newValue instanceof Closure ) { result . replaceNode ( ( Closure ) newValue ) ; } else { result . replaceBody ( newValue ) ; } } | A helper method to allow GPathResults to work with subscript operators |
6,268 | public Iterator depthFirst ( ) { return new Iterator ( ) { private final List list = new LinkedList ( ) ; private final Stack stack = new Stack ( ) ; private Iterator iter = iterator ( ) ; private GPathResult next = getNextByDepth ( ) ; public boolean hasNext ( ) { return this . next != null ; } public Object next ( ) ... | Provides an Iterator over all the nodes of this GPathResult using a depth - first traversal . |
6,269 | public Iterator breadthFirst ( ) { return new Iterator ( ) { private final List list = new LinkedList ( ) ; private Iterator iter = iterator ( ) ; private GPathResult next = getNextByBreadth ( ) ; public boolean hasNext ( ) { return this . next != null ; } public Object next ( ) { try { return this . next ; } finally {... | Provides an Iterator over all the nodes of this GPathResult using a breadth - first traversal . |
6,270 | public List list ( ) { final Iterator iter = nodeIterator ( ) ; final List result = new LinkedList ( ) ; while ( iter . hasNext ( ) ) { result . add ( new NodeChild ( ( Node ) iter . next ( ) , this . parent , this . namespacePrefix , this . namespaceTagHints ) ) ; } return result ; } | Creates a list of objects representing this GPathResult . |
6,271 | public Closure getBody ( ) { return new Closure ( this . parent , this ) { public void doCall ( Object [ ] args ) { final GroovyObject delegate = ( GroovyObject ) getDelegate ( ) ; final GPathResult thisObject = ( GPathResult ) getThisObject ( ) ; Node node = ( Node ) thisObject . getAt ( 0 ) ; List children = node . c... | Creates a Closure representing the body of this GPathResult . |
6,272 | public static int dimension ( Class clazz ) { checkArrayType ( clazz ) ; int result = 0 ; while ( clazz . isArray ( ) ) { result ++ ; clazz = clazz . getComponentType ( ) ; } return result ; } | Calculate the dimension of array |
6,273 | public static Class elementType ( Class clazz ) { checkArrayType ( clazz ) ; while ( clazz . isArray ( ) ) { clazz = clazz . getComponentType ( ) ; } return clazz ; } | Get the type of array elements |
6,274 | public static Class elementType ( Class clazz , int dim ) { checkArrayType ( clazz ) ; if ( dim < 0 ) { throw new IllegalArgumentException ( "The target dimension should not be less than zero: " + dim ) ; } while ( clazz . isArray ( ) && dimension ( clazz ) > dim ) { clazz = clazz . getComponentType ( ) ; } return claz... | Get the type of array elements by the dimension |
6,275 | private static void checkArrayType ( Class clazz ) { if ( null == clazz ) { throw new IllegalArgumentException ( "clazz can not be null" ) ; } if ( ! clazz . isArray ( ) ) { throw new IllegalArgumentException ( clazz . getCanonicalName ( ) + " is not array type" ) ; } } | Check whether the type passed in is array type . If the type is not array type throw IllegalArgumentException . |
6,276 | public static String getText ( Process self ) throws IOException { String text = IOGroovyMethods . getText ( new BufferedReader ( new InputStreamReader ( self . getInputStream ( ) ) ) ) ; closeStreams ( self ) ; return text ; } | Read the text of the output stream of the Process . Closes all the streams associated with the process after retrieving the text . |
6,277 | public static OutputStream leftShift ( Process self , byte [ ] value ) throws IOException { return IOGroovyMethods . leftShift ( self . getOutputStream ( ) , value ) ; } | Overloads the left shift operator to provide an append mechanism to pipe into a Process |
6,278 | public static void waitForOrKill ( Process self , long numberOfMillis ) { ProcessRunner runnable = new ProcessRunner ( self ) ; Thread thread = new Thread ( runnable ) ; thread . start ( ) ; runnable . waitForOrKill ( numberOfMillis ) ; } | Wait for the process to finish during a certain amount of time otherwise stops the process . |
6,279 | public static Thread consumeProcessErrorStream ( Process self , OutputStream err ) { Thread thread = new Thread ( new ByteDumper ( self . getErrorStream ( ) , err ) ) ; thread . start ( ) ; return thread ; } | Gets the error stream from a process and reads it to keep the process from blocking due to a full buffer . The processed stream data is appended to the supplied OutputStream . A new Thread is started so this method will return immediately . |
6,280 | public static Thread consumeProcessErrorStream ( Process self , Appendable error ) { Thread thread = new Thread ( new TextDumper ( self . getErrorStream ( ) , error ) ) ; thread . start ( ) ; return thread ; } | Gets the error stream from a process and reads it to keep the process from blocking due to a full buffer . The processed stream data is appended to the supplied Appendable . A new Thread is started so this method will return immediately . |
6,281 | public static Thread consumeProcessOutputStream ( Process self , Appendable output ) { Thread thread = new Thread ( new TextDumper ( self . getInputStream ( ) , output ) ) ; thread . start ( ) ; return thread ; } | Gets the output stream from a process and reads it to keep the process from blocking due to a full output buffer . The processed stream data is appended to the supplied Appendable . A new Thread is started so this method will return immediately . |
6,282 | public static Thread consumeProcessOutputStream ( Process self , OutputStream output ) { Thread thread = new Thread ( new ByteDumper ( self . getInputStream ( ) , output ) ) ; thread . start ( ) ; return thread ; } | Gets the output stream from a process and reads it to keep the process from blocking due to a full output buffer . The processed stream data is appended to the supplied OutputStream . A new Thread is started so this method will return immediately . |
6,283 | public static void withWriter ( final Process self , final Closure closure ) { new Thread ( new Runnable ( ) { public void run ( ) { try { IOGroovyMethods . withWriter ( new BufferedOutputStream ( getOut ( self ) ) , closure ) ; } catch ( IOException e ) { throw new GroovyRuntimeException ( "exception while reading pro... | Creates a new BufferedWriter as stdin for this process passes it to the closure and ensures the stream is flushed and closed after the closure returns . A new Thread is started so this method will return immediately . |
6,284 | public static Process pipeTo ( final Process left , final Process right ) throws IOException { new Thread ( new Runnable ( ) { public void run ( ) { InputStream in = new BufferedInputStream ( getIn ( left ) ) ; OutputStream out = new BufferedOutputStream ( getOut ( right ) ) ; byte [ ] buf = new byte [ 8192 ] ; int nex... | Allows one Process to asynchronously pipe data to another Process . |
6,285 | public static Process or ( final Process left , final Process right ) throws IOException { return pipeTo ( left , right ) ; } | Overrides the or operator to allow one Process to asynchronously pipe data to another Process . |
6,286 | public void visitMethodCallExpression ( MethodCallExpression call ) { boolean shouldContinueWalking = true ; if ( isBuildInvocation ( call ) ) { shouldContinueWalking = handleTargetMethodCallExpression ( call ) ; } if ( shouldContinueWalking ) { call . getObjectExpression ( ) . visit ( this ) ; call . getMethod ( ) . v... | Attempts to find AstBuilder from code invocations . When found converts them into calls to the from string approach . |
6,287 | public Object invoke ( Object proxy , Method method , Object [ ] args ) throws Throwable { String name = method . getName ( ) ; if ( method . getDeclaringClass ( ) == GroovyObject . class ) { if ( name . equals ( "getMetaClass" ) ) { return getMetaClass ( ) ; } else if ( name . equals ( "setMetaClass" ) ) { return setM... | Invokes a method for the GroovyResultSet . This will try to invoke the given method first on the extension and then on the result set given as proxy parameter . |
6,288 | public static Document parse ( Reader reader ) throws SAXException , IOException , ParserConfigurationException { return parse ( reader , false , true ) ; } | Creates a DocumentBuilder and uses it to parse the XML text read from the given reader . A non - validating namespace aware parser which does not allow DOCTYPE declarations is used . |
6,289 | public static Document parse ( Reader reader , boolean validating , boolean namespaceAware ) throws SAXException , IOException , ParserConfigurationException { return parse ( reader , validating , namespaceAware , false ) ; } | Creates a DocumentBuilder and uses it to parse the XML text read from the given reader allowing parser validation and namespace awareness to be controlled . Documents are not allowed to contain DOCYTYPE declarations . |
6,290 | public static Document parse ( Reader reader , boolean validating , boolean namespaceAware , boolean allowDocTypeDeclaration ) throws SAXException , IOException , ParserConfigurationException { DocumentBuilderFactory factory = FactorySupport . createDocumentBuilderFactory ( ) ; factory . setNamespaceAware ( namespaceAw... | Creates a DocumentBuilder and uses it to parse the XML text read from the given reader allowing parser validation namespace awareness and permission of DOCTYPE declarations to be controlled . |
6,291 | public Document parseText ( String text ) throws SAXException , IOException , ParserConfigurationException { return parse ( new StringReader ( text ) ) ; } | A helper method to parse the given text as XML . |
6,292 | public Object visit ( ParseTree tree ) { if ( ! asBoolean ( tree ) ) { return null ; } return super . visit ( tree ) ; } | Visit tree safely no NPE occurred when the tree is null . |
6,293 | private void configureScriptClassNode ( ) { ClassNode scriptClassNode = moduleNode . getScriptClassDummy ( ) ; if ( ! asBoolean ( scriptClassNode ) ) { return ; } List < Statement > statements = moduleNode . getStatementBlock ( ) . getStatements ( ) ; if ( ! statements . isEmpty ( ) ) { Statement firstStatement = state... | set the script source position |
6,294 | public static Selector getSelector ( MutableCallSite callSite , Class sender , String methodName , int callID , boolean safeNavigation , boolean thisCall , boolean spreadCall , Object [ ] arguments ) { CALL_TYPES callType = CALL_TYPES_VALUES [ callID ] ; switch ( callType ) { case INIT : return new InitSelector ( callS... | Returns the Selector |
6,295 | private static MetaClassImpl getMetaClassImpl ( MetaClass mc , boolean includeEMC ) { Class mcc = mc . getClass ( ) ; boolean valid = mcc == MetaClassImpl . class || mcc == AdaptingMetaClass . class || mcc == ClosureMetaClass . class || ( includeEMC && mcc == ExpandoMetaClass . class ) ; if ( ! valid ) { if ( LOG_ENABL... | Returns the MetaClassImpl if the given MetaClass is one of MetaClassImpl AdaptingMetaClass or ClosureMetaClass . If none of these cases matches this method returns null . |
6,296 | private static Object [ ] removeRealReceiver ( Object [ ] args ) { Object [ ] ar = new Object [ args . length - 1 ] ; System . arraycopy ( args , 1 , ar , 0 , args . length - 1 ) ; return ar ; } | Helper method to remove the receiver from the argument array by producing a new array . |
6,297 | private List parseArray ( JsonLexer lexer ) { List content = new ArrayList ( ) ; JsonToken currentToken ; for ( ; ; ) { currentToken = lexer . nextToken ( ) ; if ( currentToken == null ) { throw new JsonException ( "Expected a value on line: " + lexer . getReader ( ) . getLine ( ) + ", " + "column: " + lexer . getReade... | Parse an array from the lexer |
6,298 | public Map < String , Variable > getReferencedClassVariables ( ) { if ( referencedClassVariables == Collections . EMPTY_MAP ) { return referencedClassVariables ; } else { return Collections . unmodifiableMap ( referencedClassVariables ) ; } } | Gets a map containing the class variables referenced by this scope . This not can not be modified . |
6,299 | public Map < String , Variable > getDeclaredVariables ( ) { if ( declaredVariables == Collections . EMPTY_MAP ) { return declaredVariables ; } else { return Collections . unmodifiableMap ( declaredVariables ) ; } } | Gets a map containing the variables declared in this scope . This map cannot be modified . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.