idx int64 0 41.2k | question stringlengths 74 4.21k | target stringlengths 5 888 |
|---|---|---|
31,600 | public static int murmurhash3x8632 ( byte [ ] data , int offset , int len , int seed ) { int c1 = 0xcc9e2d51 ; int c2 = 0x1b873593 ; int h1 = seed ; int roundedEnd = offset + ( len & 0xfffffffc ) ; for ( int i = offset ; i < roundedEnd ; i += 4 ) { int k1 = ( data [ i ] & 0xff ) | ( ( data [ i + 1 ] & 0xff ) << 8 ) | (... | This code is public domain . |
31,601 | public static Map < String , ? > getMapFromProperties ( Properties properties , String prefix ) { Map < String , Object > result = new HashMap < String , Object > ( ) ; for ( String key : properties . stringPropertyNames ( ) ) { if ( key . startsWith ( prefix ) ) { String name = key . substring ( prefix . length ( ) ) ... | Extract a Map from some properties by removing a prefix from the key names . |
31,602 | public Collection < GrantedAuthority > getGrantedAuthorities ( DirContextOperations user , String username ) { String userDn = user . getNameInNamespace ( ) ; if ( logger . isDebugEnabled ( ) ) { logger . debug ( "Getting authorities for user " + userDn ) ; } Set < GrantedAuthority > roles = getGroupMembershipRoles ( u... | Obtains the authorities for the user who s directory entry is represented by the supplied LdapUserDetails object . |
31,603 | public void setDefaultRole ( String defaultRole ) { Assert . notNull ( defaultRole , "The defaultRole property cannot be set to null" ) ; this . defaultRole = new SimpleGrantedAuthority ( defaultRole ) ; } | The default role which will be assigned to all users . |
31,604 | public void setSearchSubtree ( boolean searchSubtree ) { int searchScope = searchSubtree ? SearchControls . SUBTREE_SCOPE : SearchControls . ONELEVEL_SCOPE ; searchControls . setSearchScope ( searchScope ) ; } | If set to true a subtree scope search will be performed . If false a single - level search is used . |
31,605 | private boolean checkFilter ( SCIMFilter filter ) { switch ( filter . getFilterType ( ) ) { case AND : case OR : return checkFilter ( filter . getFilterComponents ( ) . get ( 0 ) ) | checkFilter ( filter . getFilterComponents ( ) . get ( 1 ) ) ; case EQUALITY : String name = filter . getFilterAttribute ( ) . getAttribu... | Returns true if the field id or userName are present in the query . |
31,606 | private ModelAndView getUserApprovalPageResponse ( Map < String , Object > model , AuthorizationRequest authorizationRequest , Authentication principal ) { logger . debug ( "Loading user approval page: " + userApprovalPage ) ; model . putAll ( userApprovalHandler . getUserApprovalRequest ( authorizationRequest , princi... | We need explicit approval from the user . |
31,607 | protected String getOrigin ( Principal principal ) { if ( principal instanceof Authentication ) { Authentication caller = ( Authentication ) principal ; StringBuilder builder = new StringBuilder ( ) ; if ( caller instanceof OAuth2Authentication ) { OAuth2Authentication oAuth2Authentication = ( OAuth2Authentication ) ca... | due to some OAuth authentication scenarios which don t set it . |
31,608 | public Set < Map < String , String [ ] > > searchForMultipleAttributeValues ( final String base , final String filter , final Object [ ] params , final String [ ] attributeNames ) { Object [ ] encodedParams = new String [ params . length ] ; for ( int i = 0 ; i < params . length ; i ++ ) { encodedParams [ i ] = LdapEnc... | Performs a search using the supplied filter and returns the values of each named attribute found in all entries matched by the search . Note that one directory entry may have several values for the attribute . Intended for role searches and similar scenarios . |
31,609 | public void setParams ( List < AstNode > params ) { if ( params == null ) { this . params = null ; } else { if ( this . params != null ) this . params . clear ( ) ; for ( AstNode param : params ) addParam ( param ) ; } } | Sets the function parameter list and sets the parent for each element of the list . |
31,610 | public void addParam ( AstNode param ) { assertNotNull ( param ) ; if ( params == null ) { params = new ArrayList < AstNode > ( ) ; } params . add ( param ) ; param . setParent ( this ) ; } | Adds a parameter to the function parameter list . Sets the parent of the param node to this node . |
31,611 | public void visit ( NodeVisitor v ) { if ( v . visit ( this ) ) { if ( functionName != null ) { functionName . visit ( v ) ; } for ( AstNode param : getParams ( ) ) { param . visit ( v ) ; } getBody ( ) . visit ( v ) ; if ( ! isExpressionClosure ) { if ( memberExprNode != null ) { memberExprNode . visit ( v ) ; } } } } | Visits this node the function name node if supplied the parameters and the body . If there is a member - expr node it is visited last . |
31,612 | public static Context getCurrentContext ( ) { Object helper = VMBridge . instance . getThreadContextHelper ( ) ; return VMBridge . instance . getContext ( helper ) ; } | Get the current Context . |
31,613 | public static void exit ( ) { Object helper = VMBridge . instance . getThreadContextHelper ( ) ; Context cx = VMBridge . instance . getContext ( helper ) ; if ( cx == null ) { throw new IllegalStateException ( "Calling Context.exit without previous Context.enter" ) ; } if ( cx . enterCount < 1 ) Kit . codeBug ( ) ; if ... | Exit a block of code requiring a Context . |
31,614 | public void setLanguageVersion ( int version ) { if ( sealed ) onSealedMutation ( ) ; checkLanguageVersion ( version ) ; Object listeners = propertyListeners ; if ( listeners != null && version != this . version ) { firePropertyChangeImpl ( listeners , languageVersionProperty , Integer . valueOf ( this . version ) , In... | Set the language version . |
31,615 | public final String getImplementationVersion ( ) { if ( implementationVersion == null ) { Enumeration < URL > urls ; try { urls = Context . class . getClassLoader ( ) . getResources ( "META-INF/MANIFEST.MF" ) ; } catch ( IOException ioe ) { return null ; } while ( urls . hasMoreElements ( ) ) { URL metaUrl = urls . nex... | Get the implementation version . |
31,616 | public final ErrorReporter setErrorReporter ( ErrorReporter reporter ) { if ( sealed ) onSealedMutation ( ) ; if ( reporter == null ) throw new IllegalArgumentException ( ) ; ErrorReporter old = getErrorReporter ( ) ; if ( reporter == old ) { return old ; } Object listeners = propertyListeners ; if ( listeners != null ... | Change the current error reporter . |
31,617 | public final Locale setLocale ( Locale loc ) { if ( sealed ) onSealedMutation ( ) ; Locale result = locale ; locale = loc ; return result ; } | Set the current locale . |
31,618 | public final void addPropertyChangeListener ( PropertyChangeListener l ) { if ( sealed ) onSealedMutation ( ) ; propertyListeners = Kit . addListener ( propertyListeners , l ) ; } | Register an object to receive notifications when a bound property has changed |
31,619 | public final void removePropertyChangeListener ( PropertyChangeListener l ) { if ( sealed ) onSealedMutation ( ) ; propertyListeners = Kit . removeListener ( propertyListeners , l ) ; } | Remove an object from the list of objects registered to receive notification of changes to a bounded property |
31,620 | final void firePropertyChange ( String property , Object oldValue , Object newValue ) { Object listeners = propertyListeners ; if ( listeners != null ) { firePropertyChangeImpl ( listeners , property , oldValue , newValue ) ; } } | Notify any registered listeners that a bounded property has changed |
31,621 | public final Object evaluateString ( Scriptable scope , String source , String sourceName , int lineno , Object securityDomain ) { Script script = compileString ( source , sourceName , lineno , securityDomain ) ; if ( script != null ) { return script . exec ( this , scope ) ; } return null ; } | Evaluate a JavaScript source string . |
31,622 | public final Object evaluateReader ( Scriptable scope , Reader in , String sourceName , int lineno , Object securityDomain ) throws IOException { Script script = compileReader ( scope , in , sourceName , lineno , securityDomain ) ; if ( script != null ) { return script . exec ( this , scope ) ; } return null ; } | Evaluate a reader as JavaScript source . |
31,623 | public Scriptable newObject ( Scriptable scope ) { NativeObject result = new NativeObject ( ) ; ScriptRuntime . setBuiltinProtoAndParent ( result , scope , TopLevel . Builtins . Object ) ; return result ; } | Create a new JavaScript object . |
31,624 | public Scriptable newObject ( Scriptable scope , String constructorName ) { return newObject ( scope , constructorName , ScriptRuntime . emptyArgs ) ; } | Create a new JavaScript object by executing the named constructor . |
31,625 | public Scriptable newObject ( Scriptable scope , String constructorName , Object [ ] args ) { return ScriptRuntime . newObject ( this , scope , constructorName , args ) ; } | Creates a new JavaScript object by executing the named constructor . |
31,626 | public Scriptable newArray ( Scriptable scope , Object [ ] elements ) { if ( elements . getClass ( ) . getComponentType ( ) != ScriptRuntime . ObjectClass ) throw new IllegalArgumentException ( ) ; NativeArray result = new NativeArray ( elements ) ; ScriptRuntime . setBuiltinProtoAndParent ( result , scope , TopLevel .... | Create an array with a set of initial elements . |
31,627 | public static Object jsToJava ( Object value , Class < ? > desiredType ) throws EvaluatorException { return NativeJavaObject . coerceTypeImpl ( desiredType , value ) ; } | Convert a JavaScript value into the desired type . Uses the semantics defined with LiveConnect3 and throws an Illegal argument exception if the conversion cannot be performed . |
31,628 | public final void removeThreadLocal ( Object key ) { if ( sealed ) onSealedMutation ( ) ; if ( threadLocalMap == null ) return ; threadLocalMap . remove ( key ) ; } | Remove values from thread - local storage . |
31,629 | public final void setDebugger ( Debugger debugger , Object contextData ) { if ( sealed ) onSealedMutation ( ) ; this . debugger = debugger ; debuggerData = contextData ; } | Set the associated debugger . |
31,630 | public static DebuggableScript getDebuggableView ( Script script ) { if ( script instanceof NativeFunction ) { return ( ( NativeFunction ) script ) . getDebuggableView ( ) ; } return null ; } | Return DebuggableScript instance if any associated with the script . If callable supports DebuggableScript implementation the method returns it . Otherwise null is returned . |
31,631 | SecurityController getSecurityController ( ) { SecurityController global = SecurityController . global ( ) ; if ( global != null ) { return global ; } return securityController ; } | The method must NOT be public or protected |
31,632 | public void addActivationName ( String name ) { if ( sealed ) onSealedMutation ( ) ; if ( activationNames == null ) activationNames = new HashSet < String > ( ) ; activationNames . add ( name ) ; } | Add a name to the list of names forcing the creation of real activation objects for functions . |
31,633 | public void removeActivationName ( String name ) { if ( sealed ) onSealedMutation ( ) ; if ( activationNames != null ) activationNames . remove ( name ) ; } | Remove a name from the list of names forcing the creation of real activation objects for functions . |
31,634 | private static int preferSignature ( Object [ ] args , Class < ? > [ ] sig1 , boolean vararg1 , Class < ? > [ ] sig2 , boolean vararg2 ) { int totalPreference = 0 ; for ( int j = 0 ; j < args . length ; j ++ ) { Class < ? > type1 = vararg1 && j >= sig1 . length ? sig1 [ sig1 . length - 1 ] : sig1 [ j ] ; Class < ? > ty... | Determine which of two signatures is the closer fit . Returns one of PREFERENCE_EQUAL PREFERENCE_FIRST_ARG PREFERENCE_SECOND_ARG or PREFERENCE_AMBIGUOUS . |
31,635 | static Object callSecurely ( final CodeSource codeSource , Callable callable , Context cx , Scriptable scope , Scriptable thisObj , Object [ ] args ) { final Thread thread = Thread . currentThread ( ) ; final ClassLoader classLoader = ( ClassLoader ) AccessController . doPrivileged ( new PrivilegedAction < Object > ( )... | Call the specified callable using a protection domain belonging to the specified code source . |
31,636 | public void visit ( NodeVisitor v ) { if ( v . visit ( this ) && value != null ) { value . visit ( v ) ; } } | Visits this node and if present the yielded value . |
31,637 | public void visit ( NodeVisitor v ) { if ( v . visit ( this ) ) { initializer . visit ( v ) ; condition . visit ( v ) ; increment . visit ( v ) ; body . visit ( v ) ; } } | Visits this node the initializer expression the loop condition expression the increment expression and then the loop body . |
31,638 | public void setParentScope ( Scope parentScope ) { this . parentScope = parentScope ; this . top = parentScope == null ? ( ScriptNode ) this : parentScope . top ; } | Sets parent scope |
31,639 | public void addChildScope ( Scope child ) { if ( childScopes == null ) { childScopes = new ArrayList < Scope > ( ) ; } childScopes . add ( child ) ; child . setParentScope ( this ) ; } | Add a scope to our list of child scopes . Sets the child s parent scope to this scope . |
31,640 | public void replaceWith ( Scope newScope ) { if ( childScopes != null ) { for ( Scope kid : childScopes ) { newScope . addChildScope ( kid ) ; } childScopes . clear ( ) ; childScopes = null ; } if ( symbolTable != null && ! symbolTable . isEmpty ( ) ) { joinScopes ( this , newScope ) ; } } | Used by the parser ; not intended for typical use . Changes the parent - scope links for this scope s child scopes to the specified new scope . Copies symbols from this scope into new scope . |
31,641 | public static Scope splitScope ( Scope scope ) { Scope result = new Scope ( scope . getType ( ) ) ; result . symbolTable = scope . symbolTable ; scope . symbolTable = null ; result . parent = scope . parent ; result . setParentScope ( scope . getParentScope ( ) ) ; result . setParentScope ( result ) ; scope . parent = ... | Creates a new scope node moving symbol table information from scope to the new node and making scope a nested scope contained by the new node . Useful for injecting a new scope in a scope chain . |
31,642 | public static void joinScopes ( Scope source , Scope dest ) { Map < String , Symbol > src = source . ensureSymbolTable ( ) ; Map < String , Symbol > dst = dest . ensureSymbolTable ( ) ; if ( ! Collections . disjoint ( src . keySet ( ) , dst . keySet ( ) ) ) { codeBug ( ) ; } for ( Map . Entry < String , Symbol > entry ... | Copies all symbols from source scope to dest scope . |
31,643 | public Scope getDefiningScope ( String name ) { for ( Scope s = this ; s != null ; s = s . parentScope ) { Map < String , Symbol > symbolTable = s . getSymbolTable ( ) ; if ( symbolTable != null && symbolTable . containsKey ( name ) ) { return s ; } } return null ; } | Returns the scope in which this name is defined |
31,644 | public Symbol getSymbol ( String name ) { return symbolTable == null ? null : symbolTable . get ( name ) ; } | Looks up a symbol in this scope . |
31,645 | public void putSymbol ( Symbol symbol ) { if ( symbol . getName ( ) == null ) throw new IllegalArgumentException ( "null symbol name" ) ; ensureSymbolTable ( ) ; symbolTable . put ( symbol . getName ( ) , symbol ) ; symbol . setContainingTable ( this ) ; top . addSymbol ( symbol ) ; } | Enters a symbol into this scope . |
31,646 | public void visit ( NodeVisitor v ) { if ( v . visit ( this ) ) { variables . visit ( v ) ; if ( body != null ) { body . visit ( v ) ; } } } | Visits this node the variable list and if present the body expression or statement . |
31,647 | public void setImmunePrototypeProperty ( Object value ) { if ( ( prototypePropertyAttributes & READONLY ) != 0 ) { throw new IllegalStateException ( ) ; } prototypeProperty = ( value != null ) ? value : UniqueTag . NULL_VALUE ; prototypePropertyAttributes = DONTENUM | PERMANENT | READONLY ; } | Make value as DontEnum DontDelete ReadOnly prototype property of this Function object |
31,648 | public Object call ( Context cx , Scriptable scope , Scriptable thisObj , Object [ ] args ) { return Undefined . instance ; } | Should be overridden . |
31,649 | private static Object [ ] getSortedIds ( final Scriptable s ) { final Object [ ] ids = getIds ( s ) ; Arrays . sort ( ids , ( a , b ) -> { if ( a instanceof Integer ) { if ( b instanceof Integer ) { return ( ( Integer ) a ) . compareTo ( ( Integer ) b ) ; } else if ( b instanceof String || b instanceof Symbol ) { retur... | Sort IDs deterministically |
31,650 | public Object intern ( Object keyArg ) { boolean nullKey = false ; if ( keyArg == null ) { nullKey = true ; keyArg = UniqueTag . NULL_VALUE ; } int index = ensureIndex ( keyArg ) ; values [ index ] = 0 ; return ( nullKey ) ? null : keys [ index ] ; } | If table already contains a key that equals to keyArg return that key while setting its value to zero otherwise add keyArg with 0 value to the table and return it . |
31,651 | public void visit ( NodeVisitor v ) { if ( v . visit ( this ) ) { condition . visit ( v ) ; thenPart . visit ( v ) ; if ( elsePart != null ) { elsePart . visit ( v ) ; } } } | Visits this node the condition the then - part and if supplied the else - part . |
31,652 | public Scriptable wrapNewObject ( Context cx , Scriptable scope , Object obj ) { if ( obj instanceof Scriptable ) { return ( Scriptable ) obj ; } Class < ? > cls = obj . getClass ( ) ; if ( cls . isArray ( ) ) { return NativeJavaArray . wrap ( scope , obj ) ; } return wrapAsJavaObject ( cx , scope , obj , null ) ; } | Wrap an object newly created by a constructor call . |
31,653 | public void setBody ( AstNode body ) { this . body = body ; int end = body . getPosition ( ) + body . getLength ( ) ; this . setLength ( end - this . getPosition ( ) ) ; body . setParent ( this ) ; } | Sets loop body . Sets the parent of the body to this loop node and updates its offset to be relative . Extends the length of this node to include the body . |
31,654 | public static boolean equalImplementations ( NativeContinuation c1 , NativeContinuation c2 ) { return Objects . equals ( c1 . implementation , c2 . implementation ) ; } | Returns true if both continuations have equal implementations . |
31,655 | NativeJavaPackage forcePackage ( String name , Scriptable scope ) { Object cached = super . get ( name , this ) ; if ( cached != null && cached instanceof NativeJavaPackage ) { return ( NativeJavaPackage ) cached ; } String newPackage = packageName . length ( ) == 0 ? name : packageName + "." + name ; NativeJavaPackage... | need to look for a class by that name |
31,656 | public boolean hasInstance ( Scriptable value ) { Scriptable proto = value . getPrototype ( ) ; while ( proto != null ) { if ( proto . equals ( this ) ) return true ; proto = proto . getPrototype ( ) ; } return false ; } | instanceof operator . |
31,657 | static boolean accept ( Object nameObj ) { String name ; try { name = ScriptRuntime . toString ( nameObj ) ; } catch ( EcmaError ee ) { if ( "TypeError" . equals ( ee . getName ( ) ) ) { return false ; } throw ee ; } int length = name . length ( ) ; if ( length != 0 ) { if ( isNCNameStartChar ( name . charAt ( 0 ) ) ) ... | See ECMA357 13 . 1 . 2 . 1 |
31,658 | static void loadFromIterable ( Context cx , Scriptable scope , ScriptableObject set , Object arg1 ) { if ( ( arg1 == null ) || Undefined . instance . equals ( arg1 ) ) { return ; } Object ito = ScriptRuntime . callIterator ( arg1 , cx , scope ) ; if ( Undefined . instance . equals ( ito ) ) { return ; } ScriptableObjec... | If an iterable object was passed to the constructor there are many many things to do . This is common code with NativeWeakSet . |
31,659 | public KeywordLiteral setType ( int nodeType ) { if ( ! ( nodeType == Token . THIS || nodeType == Token . NULL || nodeType == Token . TRUE || nodeType == Token . FALSE || nodeType == Token . DEBUGGER ) ) throw new IllegalArgumentException ( "Invalid node type: " + nodeType ) ; type = nodeType ; return this ; } | Sets node token type |
31,660 | public static Class < ? > classOrNull ( ClassLoader loader , String className ) { try { return loader . loadClass ( className ) ; } catch ( ClassNotFoundException ex ) { } catch ( SecurityException ex ) { } catch ( LinkageError ex ) { } catch ( IllegalArgumentException e ) { } return null ; } | Attempt to load the class of the given name . Note that the type parameter isn t checked . |
31,661 | public Scriptable getExtraMethodSource ( Context cx ) { if ( hasSimpleContent ( ) ) { String src = toString ( ) ; return ScriptRuntime . toObjectOrNull ( cx , src ) ; } return null ; } | See ECMA 357 11_2_2_1 Semantics 3_f . |
31,662 | static void normalizedBoundaries ( long d64 , DiyFp m_minus , DiyFp m_plus ) { DiyFp v = asDiyFp ( d64 ) ; boolean significand_is_zero = ( v . f ( ) == kHiddenBit ) ; m_plus . setF ( ( v . f ( ) << 1 ) + 1 ) ; m_plus . setE ( v . e ( ) - 1 ) ; m_plus . normalize ( ) ; if ( significand_is_zero && v . e ( ) != kDenormalE... | exponent as m_plus . |
31,663 | public synchronized static void initGlobal ( ContextFactory factory ) { if ( factory == null ) { throw new IllegalArgumentException ( ) ; } if ( hasCustomGlobal ) { throw new IllegalStateException ( ) ; } hasCustomGlobal = true ; global = factory ; } | Set global ContextFactory . The method can only be called once . |
31,664 | public final void initApplicationClassLoader ( ClassLoader loader ) { if ( loader == null ) throw new IllegalArgumentException ( "loader is null" ) ; if ( ! Kit . testIfCanLoadRhinoClasses ( loader ) ) throw new IllegalArgumentException ( "Loader can not resolve Rhino classes" ) ; if ( this . applicationClassLoader != ... | Set explicit class loader to use when searching for Java classes . |
31,665 | protected Object doTopCall ( Callable callable , Context cx , Scriptable scope , Scriptable thisObj , Object [ ] args ) { Object result = callable . call ( cx , scope , thisObj , args ) ; return result instanceof ConsString ? result . toString ( ) : result ; } | Execute top call to script or function . When the runtime is about to execute a script or function that will create the first stack frame with scriptable code it calls this method to perform the real call . In this way execution of any script happens inside this function . |
31,666 | public ScriptableObject . Slot query ( Object key , int index ) { if ( slots == null ) { return null ; } final int indexOrHash = ( key != null ? key . hashCode ( ) : index ) ; final int slotIndex = getSlotIndex ( slots . length , indexOrHash ) ; for ( ScriptableObject . Slot slot = slots [ slotIndex ] ; slot != null ; ... | Locate the slot with the given name or index . |
31,667 | public ScriptableObject . Slot get ( Object key , int index , ScriptableObject . SlotAccess accessType ) { if ( slots == null && accessType == SlotAccess . QUERY ) { return null ; } final int indexOrHash = ( key != null ? key . hashCode ( ) : index ) ; ScriptableObject . Slot slot = null ; if ( slots != null ) { final ... | Locate the slot with given name or index . Depending on the accessType parameter and the current slot status a new slot may be allocated . |
31,668 | private void addKnownAbsentSlot ( ScriptableObject . Slot [ ] addSlots , ScriptableObject . Slot slot ) { final int insertPos = getSlotIndex ( addSlots . length , slot . indexOrHash ) ; ScriptableObject . Slot old = addSlots [ insertPos ] ; addSlots [ insertPos ] = slot ; slot . next = old ; } | Add slot with keys that are known to absent from the table . This is an optimization to use when inserting into empty table after table growth or during deserialization . |
31,669 | int [ ] getTrimmedLocals ( ) { int last = locals . length - 1 ; while ( last >= 0 && locals [ last ] == TypeInfo . TOP && ! TypeInfo . isTwoWords ( locals [ last - 1 ] ) ) { last -- ; } last ++ ; int size = last ; for ( int i = 0 ; i < last ; i ++ ) { if ( TypeInfo . isTwoWords ( locals [ i ] ) ) { size -- ; } } int [ ... | Get a copy of the super block s locals without any trailing TOP types . |
31,670 | private boolean mergeState ( int [ ] current , int [ ] incoming , int size , ConstantPool pool ) { boolean changed = false ; for ( int i = 0 ; i < size ; i ++ ) { int currentType = current [ i ] ; current [ i ] = TypeInfo . merge ( current [ i ] , incoming [ i ] , pool ) ; if ( currentType != current [ i ] ) { changed ... | Merge an operand stack or local variable array with incoming state . |
31,671 | private DocumentBuilder getDocumentBuilderFromPool ( ) throws ParserConfigurationException { DocumentBuilder builder = documentBuilderPool . pollFirst ( ) ; if ( builder == null ) { builder = getDomFactory ( ) . newDocumentBuilder ( ) ; } builder . setErrorHandler ( errorHandler ) ; return builder ; } | Get from pool or create one without locking if needed . |
31,672 | public void visit ( NodeVisitor v ) { if ( v . visit ( this ) ) { iterator . visit ( v ) ; iteratedObject . visit ( v ) ; } } | Visits the iterator expression and the iterated object expression . There is no body - expression for this loop type . |
31,673 | static BigInteger pow5mult ( BigInteger b , int k ) { return b . multiply ( BigInteger . valueOf ( 5 ) . pow ( k ) ) ; } | XXXX the C version built a cache of these |
31,674 | public boolean has ( Symbol key , Scriptable start ) { return null != slotMap . query ( key , 0 ) ; } | A version of has that supports symbols . |
31,675 | public Object get ( Symbol key , Scriptable start ) { Slot slot = slotMap . query ( key , 0 ) ; if ( slot == null ) { return Scriptable . NOT_FOUND ; } return slot . getValue ( start ) ; } | Another version of Get that supports Symbol keyed properties . |
31,676 | public void put ( Symbol key , Scriptable start , Object value ) { if ( putImpl ( key , 0 , start , value ) ) return ; if ( start == this ) throw Kit . codeBug ( ) ; ensureSymbolScriptable ( start ) . put ( key , start , value ) ; } | Implementation of put required by SymbolScriptable objects . |
31,677 | public void delete ( int index ) { checkNotSealed ( null , index ) ; slotMap . remove ( null , index ) ; } | Removes the indexed property from the object . |
31,678 | public void putConst ( String name , Scriptable start , Object value ) { if ( putConstImpl ( name , 0 , start , value , READONLY ) ) return ; if ( start == this ) throw Kit . codeBug ( ) ; if ( start instanceof ConstProperties ) ( ( ConstProperties ) start ) . putConst ( name , start , value ) ; else start . put ( name... | Sets the value of the named const property creating it if need be . |
31,679 | public boolean isConst ( String name ) { Slot slot = slotMap . query ( name , 0 ) ; if ( slot == null ) { return false ; } return ( slot . getAttributes ( ) & ( PERMANENT | READONLY ) ) == ( PERMANENT | READONLY ) ; } | Returns true if the named property is defined as a const on this object . |
31,680 | public void setAttributes ( String name , int attributes ) { checkNotSealed ( name , 0 ) ; findAttributeSlot ( name , 0 , SlotAccess . MODIFY ) . setAttributes ( attributes ) ; } | Set the attributes of a named property . |
31,681 | public void setAttributes ( int index , int attributes ) { checkNotSealed ( null , index ) ; findAttributeSlot ( null , index , SlotAccess . MODIFY ) . setAttributes ( attributes ) ; } | Set the attributes of an indexed property . |
31,682 | public void setAttributes ( Symbol key , int attributes ) { checkNotSealed ( key , 0 ) ; findAttributeSlot ( key , SlotAccess . MODIFY ) . setAttributes ( attributes ) ; } | Set attributes of a Symbol - keyed property . |
31,683 | protected boolean isGetterOrSetter ( String name , int index , boolean setter ) { Slot slot = slotMap . query ( name , index ) ; if ( slot instanceof GetterSlot ) { if ( setter && ( ( GetterSlot ) slot ) . setter != null ) return true ; if ( ! setter && ( ( GetterSlot ) slot ) . getter != null ) return true ; } return ... | Returns whether a property is a getter or a setter |
31,684 | public static < T extends Scriptable > void defineClass ( Scriptable scope , Class < T > clazz ) throws IllegalAccessException , InstantiationException , InvocationTargetException { defineClass ( scope , clazz , false , false ) ; } | Defines JavaScript objects from a Java class that implements Scriptable . |
31,685 | public static < T extends Scriptable > String defineClass ( Scriptable scope , Class < T > clazz , boolean sealed , boolean mapInheritance ) throws IllegalAccessException , InstantiationException , InvocationTargetException { BaseFunction ctor = buildClassCtor ( scope , clazz , sealed , mapInheritance ) ; if ( ctor == ... | Defines JavaScript objects from a Java class optionally allowing sealing and mapping of Java inheritance to JavaScript prototype - based inheritance . |
31,686 | public void defineProperty ( Symbol key , Object value , int attributes ) { checkNotSealed ( key , 0 ) ; put ( key , this , value ) ; setAttributes ( key , attributes ) ; } | A version of defineProperty that uses a Symbol key . |
31,687 | public void defineProperty ( String propertyName , Class < ? > clazz , int attributes ) { int length = propertyName . length ( ) ; if ( length == 0 ) throw new IllegalArgumentException ( ) ; char [ ] buf = new char [ 3 + length ] ; propertyName . getChars ( 0 , length , buf , 3 ) ; buf [ 3 ] = Character . toUpperCase (... | Define a JavaScript property with getter and setter side effects . |
31,688 | public void defineOwnProperties ( Context cx , ScriptableObject props ) { Object [ ] ids = props . getIds ( false , true ) ; ScriptableObject [ ] descs = new ScriptableObject [ ids . length ] ; for ( int i = 0 , len = ids . length ; i < len ; ++ i ) { Object descObj = ScriptRuntime . getObjectElem ( props , ids [ i ] ,... | Defines one or more properties on this object . |
31,689 | protected boolean sameValue ( Object newValue , Object currentValue ) { if ( newValue == NOT_FOUND ) { return true ; } if ( currentValue == NOT_FOUND ) { currentValue = Undefined . instance ; } if ( currentValue instanceof Number && newValue instanceof Number ) { double d1 = ( ( Number ) currentValue ) . doubleValue ( ... | Implements SameValue as described in ES5 9 . 12 additionally checking if new value is defined . |
31,690 | public void defineFunctionProperties ( String [ ] names , Class < ? > clazz , int attributes ) { Method [ ] methods = FunctionObject . getMethodList ( clazz ) ; for ( int i = 0 ; i < names . length ; i ++ ) { String name = names [ i ] ; Method m = FunctionObject . findSingleMethod ( methods , name ) ; if ( m == null ) ... | Search for names in a class adding the resulting methods as properties . |
31,691 | public static Scriptable getObjectPrototype ( Scriptable scope ) { return TopLevel . getBuiltinPrototype ( getTopLevelScope ( scope ) , TopLevel . Builtins . Object ) ; } | Get the Object . prototype property . See ECMA 15 . 2 . 4 . |
31,692 | public static Scriptable getFunctionPrototype ( Scriptable scope ) { return TopLevel . getBuiltinPrototype ( getTopLevelScope ( scope ) , TopLevel . Builtins . Function ) ; } | Get the Function . prototype property . See ECMA 15 . 3 . 4 . |
31,693 | public static Scriptable getClassPrototype ( Scriptable scope , String className ) { scope = getTopLevelScope ( scope ) ; Object ctor = getProperty ( scope , className ) ; Object proto ; if ( ctor instanceof BaseFunction ) { proto = ( ( BaseFunction ) ctor ) . getPrototypeProperty ( ) ; } else if ( ctor instanceof Scri... | Get the prototype for the named class . |
31,694 | public static Scriptable getTopLevelScope ( Scriptable obj ) { for ( ; ; ) { Scriptable parent = obj . getParentScope ( ) ; if ( parent == null ) { return obj ; } obj = parent ; } } | Get the global scope . |
31,695 | public void sealObject ( ) { if ( ! isSealed ) { final long stamp = slotMap . readLock ( ) ; try { for ( Slot slot : slotMap ) { Object value = slot . value ; if ( value instanceof LazilyLoadedCtor ) { LazilyLoadedCtor initializer = ( LazilyLoadedCtor ) value ; try { initializer . init ( ) ; } finally { slot . value = ... | Seal this object . |
31,696 | public static Object getProperty ( Scriptable obj , Symbol key ) { Scriptable start = obj ; Object result ; do { result = ensureSymbolScriptable ( obj ) . get ( key , start ) ; if ( result != Scriptable . NOT_FOUND ) break ; obj = obj . getPrototype ( ) ; } while ( obj != null ) ; return result ; } | This is a version of getProperty that works with Symbols . |
31,697 | public static void putProperty ( Scriptable obj , Symbol key , Object value ) { Scriptable base = getBase ( obj , key ) ; if ( base == null ) base = obj ; ensureSymbolScriptable ( base ) . put ( key , obj , value ) ; } | This is a version of putProperty for Symbol keys . |
31,698 | public static Object callMethod ( Context cx , Scriptable obj , String methodName , Object [ ] args ) { Object funObj = getProperty ( obj , methodName ) ; if ( ! ( funObj instanceof Function ) ) { throw ScriptRuntime . notFunctionError ( obj , methodName ) ; } Function fun = ( Function ) funObj ; Scriptable scope = Scr... | Call a method of an object . |
31,699 | public final Object getAssociatedValue ( Object key ) { Map < Object , Object > h = associatedValues ; if ( h == null ) return null ; return h . get ( key ) ; } | Get arbitrary application - specific value associated with this object . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.