idx int64 0 41.2k | question stringlengths 74 4.04k | target stringlengths 7 750 |
|---|---|---|
29,800 | public Field getRelationshipField ( Class < ? > clazz , String fieldName ) { return relationshipFieldMap . get ( clazz ) . get ( fieldName ) ; } | Returns relationship field . |
29,801 | public Class < ? > getRelationshipType ( Class < ? > clazz , String fieldName ) { return relationshipTypeMap . get ( clazz ) . get ( fieldName ) ; } | Returns a type of a relationship . |
29,802 | public String getTypeName ( Class < ? > clazz ) { Type type = typeAnnotations . get ( clazz ) ; if ( type != null ) { return type . value ( ) ; } return null ; } | Resolves and returns name of the type given to provided class . |
29,803 | public Field getRelationshipMetaField ( Class < ? > clazz , String relationshipName ) { return relationshipMetaFieldMap . get ( clazz ) . get ( relationshipName ) ; } | Returns relationship meta field . |
29,804 | public Class < ? > getRelationshipMetaType ( Class < ? > clazz , String relationshipName ) { return relationshipMetaTypeMap . get ( clazz ) . get ( relationshipName ) ; } | Returns a type of a relationship meta field . |
29,805 | public Field getRelationshipLinksField ( Class < ? > clazz , String relationshipName ) { return relationshipLinksFieldMap . get ( clazz ) . get ( relationshipName ) ; } | Returns relationship links field . |
29,806 | public void setTypeResolver ( RelationshipResolver resolver , Class < ? > type ) { if ( resolver != null ) { String typeName = ReflectionUtils . getTypeName ( type ) ; if ( typeName != null ) { typedResolvers . put ( type , resolver ) ; } } } | Registers relationship resolver for given type . Resolver will be used if relationship resolution is enabled trough relationship annotation . |
29,807 | public < T > T readObject ( byte [ ] data , Class < T > clazz ) { return readDocument ( data , clazz ) . get ( ) ; } | Converts raw data input into requested target type . |
29,808 | public < T > List < T > readObjectCollection ( byte [ ] data , Class < T > clazz ) { return readDocumentCollection ( data , clazz ) . get ( ) ; } | Converts rawdata input into a collection of requested output objects . |
29,809 | private < T > T readObject ( JsonNode source , Class < T > clazz , boolean handleRelationships ) throws IOException , IllegalAccessException , InstantiationException { String identifier = createIdentifier ( source ) ; T result = ( T ) resourceCache . get ( identifier ) ; if ( result == null ) { Class < ? > type = getAc... | Converts provided input into a target object . After conversion completes any relationships defined are resolved . |
29,810 | private Map < String , Object > parseIncluded ( JsonNode parent ) throws IOException , IllegalAccessException , InstantiationException { Map < String , Object > result = new HashMap < > ( ) ; if ( parent . has ( INCLUDED ) ) { Map < String , Object > includedResources = getIncludedResources ( parent ) ; if ( ! included... | Converts included data and returns it as pairs of its unique identifiers and converted types . |
29,811 | private Map < String , Object > getIncludedResources ( JsonNode parent ) throws IOException , IllegalAccessException , InstantiationException { Map < String , Object > result = new HashMap < > ( ) ; if ( parent . has ( INCLUDED ) ) { for ( JsonNode jsonNode : parent . get ( INCLUDED ) ) { String type = jsonNode . get (... | Parses out included resources excluding relationships . |
29,812 | private Object parseRelationship ( JsonNode relationshipDataNode , Class < ? > type ) throws IOException , IllegalAccessException , InstantiationException { if ( ValidationUtils . isRelationshipParsable ( relationshipDataNode ) ) { String identifier = createIdentifier ( relationshipDataNode ) ; if ( resourceCache . con... | Creates relationship object by consuming provided data node . |
29,813 | private void setIdValue ( Object target , JsonNode idValue ) throws IllegalAccessException { Field idField = configuration . getIdField ( target . getClass ( ) ) ; ResourceIdHandler idHandler = configuration . getIdHandler ( target . getClass ( ) ) ; if ( idValue != null ) { idField . set ( target , idHandler . fromStr... | Sets an id attribute value to a target object . |
29,814 | private RelationshipResolver getResolver ( Class < ? > type ) { RelationshipResolver resolver = typedResolvers . get ( type ) ; return resolver != null ? resolver : globalResolver ; } | Returns relationship resolver for given type . In case no specific type resolver is registered global resolver is returned . |
29,815 | public boolean registerType ( Class < ? > type ) { if ( ! configuration . isRegisteredType ( type ) && ConverterConfiguration . isEligibleType ( type ) ) { return configuration . registerType ( type ) ; } return false ; } | Registers new type to be used with this converter instance . |
29,816 | public static List < Field > getAnnotatedFields ( Class < ? > clazz , Class < ? extends Annotation > annotation , boolean checkSuperclass ) { Field [ ] fields = clazz . getDeclaredFields ( ) ; List < Field > result = new ArrayList < > ( ) ; for ( Field field : fields ) { if ( field . isAnnotationPresent ( annotation ) ... | Returns all field from a given class that are annotated with provided annotation type . |
29,817 | public static String getTypeName ( Class < ? > clazz ) { Type typeAnnotation = clazz . getAnnotation ( Type . class ) ; return typeAnnotation != null ? typeAnnotation . value ( ) : null ; } | Returns the type name defined using Type annotation on provided class . |
29,818 | public void init ( ) { if ( initDepth . get ( ) == null ) { initDepth . set ( 1 ) ; } else { initDepth . set ( initDepth . get ( ) + 1 ) ; } if ( resourceCache . get ( ) == null ) { resourceCache . set ( new HashMap < String , Object > ( ) ) ; } if ( cacheLocked . get ( ) == null ) { cacheLocked . set ( Boolean . FALSE... | Initialises cache for current thread - scope . |
29,819 | public void clear ( ) { verifyState ( ) ; initDepth . set ( initDepth . get ( ) - 1 ) ; if ( initDepth . get ( ) == 0 ) { resourceCache . set ( null ) ; cacheLocked . set ( null ) ; initDepth . set ( null ) ; } } | Clears current thread scope state . |
29,820 | public void cache ( Map < String , Object > resources ) { verifyState ( ) ; if ( ! cacheLocked . get ( ) ) { resourceCache . get ( ) . putAll ( resources ) ; } } | Adds multiple resources to cache . |
29,821 | public void cache ( String identifier , Object resource ) { verifyState ( ) ; if ( ! cacheLocked . get ( ) ) { resourceCache . get ( ) . put ( identifier , resource ) ; } } | Adds resource to cache . |
29,822 | public static < T extends Errors > T parseErrorResponse ( ObjectMapper mapper , ResponseBody errorResponse , Class < T > cls ) throws IOException { return mapper . readValue ( errorResponse . bytes ( ) , cls ) ; } | Parses provided ResponseBody and returns it as T . |
29,823 | public static < T extends Errors > T parseError ( ObjectMapper mapper , JsonNode errorResponse , Class < T > cls ) throws JsonProcessingException { return mapper . treeToValue ( errorResponse , cls ) ; } | Parses provided JsonNode and returns it as T . |
29,824 | public static < L , R > Either < L , R > left ( L l ) { return new Left < > ( l ) ; } | Static factory method for creating a left value . |
29,825 | public static < L , R > Either < L , R > right ( R r ) { return new Right < > ( r ) ; } | Static factory method for creating a right value . |
29,826 | public static < X > Lens . Simple < List < X > , List < X > > asCopy ( ) { return simpleLens ( ArrayList :: new , ( xs , ys ) -> ys ) ; } | Convenience static factory method for creating a lens over a copy of a list . Useful for composition to avoid mutating a list reference . |
29,827 | public static < T extends Throwable , A > Try < T , A > success ( A a ) { return new Success < > ( a ) ; } | Static factory method for creating a success value . |
29,828 | public static < T extends Throwable , A > Try < T , A > failure ( T t ) { return new Failure < > ( t ) ; } | Static factory method for creating a failure value . |
29,829 | public < B > State < S , B > mapState ( Fn1 < ? super Tuple2 < A , S > , ? extends Product2 < B , S > > fn ) { return state ( s -> fn . apply ( run ( s ) ) ) ; } | Map both the result and the final state to a new result and final state . |
29,830 | public State < S , A > withState ( Fn1 < ? super S , ? extends S > fn ) { return state ( s -> run ( fn . apply ( s ) ) ) ; } | Map the final state to a new final state using the provided function . |
29,831 | public static < Head , Tail extends HList > HCons < Head , Tail > cons ( Head head , Tail tail ) { return new HCons < > ( head , tail ) ; } | Static factory method for creating an HList from the given head and tail . |
29,832 | @ SuppressWarnings ( "JavaDoc" ) public static < _1 , _2 > Tuple2 < _1 , _2 > tuple ( _1 _1 , _2 _2 ) { return singletonHList ( _2 ) . cons ( _1 ) ; } | Static factory method for creating a 2 - element HList . |
29,833 | @ SuppressWarnings ( "JavaDoc" ) public static < _1 , _2 , _3 > Tuple3 < _1 , _2 , _3 > tuple ( _1 _1 , _2 _2 , _3 _3 ) { return tuple ( _2 , _3 ) . cons ( _1 ) ; } | Static factory method for creating a 3 - element HList . |
29,834 | @ SuppressWarnings ( "JavaDoc" ) public static < _1 , _2 , _3 , _4 > Tuple4 < _1 , _2 , _3 , _4 > tuple ( _1 _1 , _2 _2 , _3 _3 , _4 _4 ) { return tuple ( _2 , _3 , _4 ) . cons ( _1 ) ; } | Static factory method for creating a 4 - element HList . |
29,835 | @ SuppressWarnings ( "JavaDoc" ) public static < _1 , _2 , _3 , _4 , _5 > Tuple5 < _1 , _2 , _3 , _4 , _5 > tuple ( _1 _1 , _2 _2 , _3 _3 , _4 _4 , _5 _5 ) { return tuple ( _2 , _3 , _4 , _5 ) . cons ( _1 ) ; } | Static factory method for creating a 5 - element HList . |
29,836 | @ SuppressWarnings ( "JavaDoc" ) public static < _1 , _2 , _3 , _4 , _5 , _6 > Tuple6 < _1 , _2 , _3 , _4 , _5 , _6 > tuple ( _1 _1 , _2 _2 , _3 _3 , _4 _4 , _5 _5 , _6 _6 ) { return tuple ( _2 , _3 , _4 , _5 , _6 ) . cons ( _1 ) ; } | Static factory method for creating a 6 - element HList . |
29,837 | @ SuppressWarnings ( "JavaDoc" ) public static < _1 , _2 , _3 , _4 , _5 , _6 , _7 > Tuple7 < _1 , _2 , _3 , _4 , _5 , _6 , _7 > tuple ( _1 _1 , _2 _2 , _3 _3 , _4 _4 , _5 _5 , _6 _6 , _7 _7 ) { return tuple ( _2 , _3 , _4 , _5 , _6 , _7 ) . cons ( _1 ) ; } | Static factory method for creating a 7 - element HList . |
29,838 | @ SuppressWarnings ( "JavaDoc" ) public static < _1 , _2 , _3 , _4 , _5 , _6 , _7 , _8 > Tuple8 < _1 , _2 , _3 , _4 , _5 , _6 , _7 , _8 > tuple ( _1 _1 , _2 _2 , _3 _3 , _4 _4 , _5 _5 , _6 _6 , _7 _7 , _8 _8 ) { return tuple ( _2 , _3 , _4 , _5 , _6 , _7 , _8 ) . cons ( _1 ) ; } | Static factory method for creating an 8 - element HList . |
29,839 | public static < A > Lazy < A > lazy ( Supplier < A > supplier ) { return new Later < > ( fn0 ( supplier ) ) ; } | Wrap a computation in a lazy computation . |
29,840 | public static < K , V > Lens . Simple < Map < K , V > , Map < K , V > > asCopy ( ) { return adapt ( asCopy ( HashMap :: new ) ) ; } | A lens that focuses on a copy of a Map . Useful for composition to avoid mutating a map reference . |
29,841 | public static < K , V > Lens . Simple < Map < K , V > , Set < K > > keys ( ) { return simpleLens ( m -> new HashSet < > ( m . keySet ( ) ) , ( m , ks ) -> { HashSet < K > ksCopy = new HashSet < > ( ks ) ; Map < K , V > updated = new HashMap < > ( m ) ; Set < K > keys = updated . keySet ( ) ; keys . retainAll ( ksCopy )... | A lens that focuses on the keys of a map . |
29,842 | @ SuppressWarnings ( "unchecked" ) public < A , B > Maybe < B > get ( TypeSafeKey < A , B > key ) { return maybe ( ( A ) table . get ( key ) ) . fmap ( view ( key ) ) ; } | Retrieve the value at this key . |
29,843 | public < V > HMap put ( TypeSafeKey < ? , V > key , V value ) { return alter ( t -> t . put ( key , view ( key . mirror ( ) , value ) ) ) ; } | Store a value for the given key . |
29,844 | public static < V > HMap singletonHMap ( TypeSafeKey < ? , V > key , V value ) { return emptyHMap ( ) . put ( key , value ) ; } | Static factory method for creating a singleton HMap . |
29,845 | public static < V1 , V2 > HMap hMap ( TypeSafeKey < ? , V1 > key1 , V1 value1 , TypeSafeKey < ? , V2 > key2 , V2 value2 ) { return singletonHMap ( key1 , value1 ) . put ( key2 , value2 ) ; } | Static factory method for creating an HMap from two given associations . |
29,846 | public static < V1 , V2 , V3 > HMap hMap ( TypeSafeKey < ? , V1 > key1 , V1 value1 , TypeSafeKey < ? , V2 > key2 , V2 value2 , TypeSafeKey < ? , V3 > key3 , V3 value3 ) { return hMap ( key1 , value1 , key2 , value2 ) . put ( key3 , value3 ) ; } | Static factory method for creating an HMap from three given associations . |
29,847 | public final Command createVerbosityCommand ( CountDownLatch latch , int level , boolean noreply ) { return new TextVerbosityCommand ( latch , level , noreply ) ; } | Create verbosity command |
29,848 | protected final int blockingRead ( ) throws ClosedChannelException , IOException { int n = 0 ; int readCount = 0 ; Selector readSelector = SelectorFactory . getSelector ( ) ; SelectionKey tmpKey = null ; try { if ( this . selectableChannel . isOpen ( ) ) { tmpKey = this . selectableChannel . register ( readSelector , 0... | Blocking read using temp selector |
29,849 | protected byte [ ] encodeString ( String in ) { byte [ ] rv = null ; try { rv = in . getBytes ( this . charset ) ; } catch ( UnsupportedEncodingException e ) { throw new RuntimeException ( e ) ; } return rv ; } | Encode a string into the current character set . |
29,850 | @ SuppressWarnings ( "unchecked" ) public final Command optimiezeMergeBuffer ( Command optimiezeCommand , final Queue writeQueue , final Queue < Command > executingCmds , int sendBufferSize ) { if ( log . isDebugEnabled ( ) ) { log . debug ( "Optimieze merge buffer:" + optimiezeCommand . toString ( ) ) ; } if ( this . ... | merge buffers to fit socket s send buffer size |
29,851 | @ SuppressWarnings ( "unchecked" ) public final Command optimiezeGet ( final Queue writeQueue , final Queue < Command > executingCmds , Command optimiezeCommand ) { if ( optimiezeCommand . getCommandType ( ) == CommandType . GET_ONE || optimiezeCommand . getCommandType ( ) == CommandType . GETS_ONE ) { if ( this . opti... | Merge get operation to multi - get operation |
29,852 | public static AuthInfo plain ( String username , String password ) { return new AuthInfo ( new PlainCallbackHandler ( username , password ) , new String [ ] { "PLAIN" } ) ; } | Get a typical auth descriptor for PLAIN auth with the given username and password . |
29,853 | public static AuthInfo cramMD5 ( String username , String password ) { return new AuthInfo ( new PlainCallbackHandler ( username , password ) , new String [ ] { "CRAM-MD5" } ) ; } | Get a typical auth descriptor for CRAM - MD5 auth with the given username and password . |
29,854 | public AWSElasticCacheClient build ( ) throws IOException { AWSElasticCacheClient memcachedClient = new AWSElasticCacheClient ( this . sessionLocator , this . sessionComparator , this . bufferAllocator , this . configuration , this . socketOptions , this . commandFactory , this . transcoder , this . stateListeners , th... | Returns a new instanceof AWSElasticCacheClient . |
29,855 | public static URL getResourceURL ( String resource ) throws IOException { URL url = null ; ClassLoader loader = ResourcesUtils . class . getClassLoader ( ) ; if ( loader != null ) { url = loader . getResource ( resource ) ; } if ( url == null ) { url = ClassLoader . getSystemResource ( resource ) ; } if ( url == null )... | Returns the URL of the resource on the classpath |
29,856 | public static InputStream getResourceAsStream ( String resource ) throws IOException { InputStream in = null ; ClassLoader loader = ResourcesUtils . class . getClassLoader ( ) ; if ( loader != null ) { in = loader . getResourceAsStream ( resource ) ; } if ( in == null ) { in = ClassLoader . getSystemResourceAsStream ( ... | Returns a resource on the classpath as a Stream object |
29,857 | protected void initialSelectorManager ( ) throws IOException { if ( this . selectorManager == null ) { this . selectorManager = new SelectorManager ( this . selectorPoolSize , this , this . configuration ) ; this . selectorManager . start ( ) ; } } | Start selector manager |
29,858 | public void onRead ( SelectionKey key ) { if ( this . readEventDispatcher == null ) { dispatchReadEvent ( key ) ; } else { this . readEventDispatcher . dispatch ( new ReadTask ( key ) ) ; } } | Read event occured |
29,859 | public void onWrite ( final SelectionKey key ) { if ( this . writeEventDispatcher == null ) { dispatchWriteEvent ( key ) ; } else { this . writeEventDispatcher . dispatch ( new WriteTask ( key ) ) ; } } | Writable event occured |
29,860 | public void closeSelectionKey ( SelectionKey key ) { if ( key . attachment ( ) instanceof Session ) { Session session = ( Session ) key . attachment ( ) ; if ( session != null ) { session . close ( ) ; } } } | Cancel selection key |
29,861 | protected final NioSessionConfig buildSessionConfig ( SelectableChannel sc , Queue < WriteMessage > queue ) { final NioSessionConfig sessionConfig = new NioSessionConfig ( sc , getHandler ( ) , this . selectorManager , getCodecFactory ( ) , getStatistics ( ) , queue , this . dispatchMessageDispatcher , isHandleReadWrit... | Build nio session config |
29,862 | protected void readHeader ( ByteBuffer buffer ) { super . readHeader ( buffer ) ; if ( this . responseStatus != ResponseStatus . NO_ERROR ) { if ( ByteUtils . stepBuffer ( buffer , this . responseTotalBodyLength ) ) { this . decodeStatus = BinaryDecodeStatus . DONE ; } } } | optimistic if response status is greater than zero then skip buffer to next response set result as null |
29,863 | public ClusterConfigration getConfig ( String key ) throws MemcachedException , InterruptedException , TimeoutException { Command cmd = this . commandFactory . createAWSElasticCacheConfigCommand ( "get" , key ) ; final Session session = this . sendCommand ( cmd ) ; this . latchWait ( cmd , opTimeout , session ) ; cmd .... | Get config by key from cache node by network command . |
29,864 | public static final String nextLine ( ByteBuffer buffer ) { if ( buffer == null ) { return null ; } int index = MemcachedDecoder . SPLIT_MATCHER . matchFirst ( com . google . code . yanf4j . buffer . IoBuffer . wrap ( buffer ) ) ; if ( index >= 0 ) { int limit = buffer . limit ( ) ; buffer . limit ( index ) ; byte [ ] ... | Read next line from ByteBuffer |
29,865 | protected final void configureSocketChannel ( SocketChannel sc ) throws IOException { sc . socket ( ) . setSoTimeout ( this . soTimeout ) ; sc . configureBlocking ( false ) ; if ( this . socketOptions . get ( StandardSocketOption . SO_REUSEADDR ) != null ) { sc . socket ( ) . setReuseAddress ( StandardSocketOption . SO... | Confiure socket channel |
29,866 | protected void readHeader ( ByteBuffer buffer ) { super . readHeader ( buffer ) ; if ( this . responseStatus == ResponseStatus . NO_ERROR ) { this . decodeStatus = BinaryDecodeStatus . DONE ; } } | optimistic if no error goto done |
29,867 | public void bind ( InetSocketAddress inetSocketAddress ) throws IOException { if ( inetSocketAddress == null ) { throw new IllegalArgumentException ( "Null inetSocketAddress" ) ; } setLocalSocketAddress ( inetSocketAddress ) ; start ( ) ; } | Bind localhost address |
29,868 | public final void onMessageReceived ( final Session session , final Object msg ) { Command command = ( Command ) msg ; if ( this . statisticsHandler . isStatistics ( ) ) { if ( command . getCopiedMergeCount ( ) > 0 && command instanceof MapReturnValueAware ) { Map < String , CachedData > returnValues = ( ( MapReturnVal... | On receive message from memcached server |
29,869 | public void onSessionStarted ( Session session ) { session . setUseBlockingRead ( true ) ; session . setAttribute ( HEART_BEAT_FAIL_COUNT_ATTR , new AtomicInteger ( 0 ) ) ; for ( MemcachedClientStateListener listener : this . client . getStateListeners ( ) ) { listener . onConnected ( this . client , session . getRemot... | On session started |
29,870 | protected void reconnect ( MemcachedTCPSession session ) { if ( ! this . client . isShutdown ( ) ) { synchronized ( session ) { if ( ! session . isAllowReconnect ( ) ) { return ; } session . setAllowReconnect ( false ) ; } MemcachedSession memcachedTCPSession = session ; InetSocketAddressWrapper inetSocketAddressWrappe... | Auto reconect to memcached server |
29,871 | public static void setAllocator ( IoBufferAllocator newAllocator ) { if ( newAllocator == null ) { throw new NullPointerException ( "allocator" ) ; } IoBufferAllocator oldAllocator = allocator ; allocator = newAllocator ; if ( null != oldAllocator ) { oldAllocator . dispose ( ) ; } } | Sets the allocator used by existing and new buffers |
29,872 | public static IoBuffer allocate ( int capacity , boolean direct ) { if ( capacity < 0 ) { throw new IllegalArgumentException ( "capacity: " + capacity ) ; } return allocator . allocate ( capacity , direct ) ; } | Returns the buffer which is capable of the specified size . |
29,873 | public static IoBuffer wrap ( byte [ ] byteArray , int offset , int length ) { return wrap ( ByteBuffer . wrap ( byteArray , offset , length ) ) ; } | Wraps the specified byte array into MINA heap buffer . |
29,874 | private boolean lookJVMBug ( long before , int selected , long wait ) throws IOException { boolean seeing = false ; long now = System . currentTimeMillis ( ) ; if ( JVMBUG_THRESHHOLD > 0 && selected == 0 && wait > JVMBUG_THRESHHOLD && now - before < wait / 4 && ! wakenUp . get ( ) && ! Thread . currentThread ( ) . isIn... | Look jvm bug |
29,875 | public final void dispatchEvent ( Set < SelectionKey > selectedKeySet ) { Iterator < SelectionKey > it = selectedKeySet . iterator ( ) ; boolean skipOpRead = false ; while ( it . hasNext ( ) ) { SelectionKey key = it . next ( ) ; it . remove ( ) ; if ( ! key . isValid ( ) ) { if ( key . attachment ( ) != null ) { contr... | Dispatch selected event |
29,876 | public final void addServer ( final String server , final int port , int weight ) throws IOException { if ( weight <= 0 ) { throw new IllegalArgumentException ( "weight<=0" ) ; } this . checkServerPort ( server , port ) ; this . connect ( new InetSocketAddressWrapper ( this . newSocketAddress ( server , port ) , this .... | add a memcached server to MemcachedClient |
29,877 | private final Collection < List < String > > catalogKeys ( final Collection < String > keyCollections ) { final Map < Session , List < String > > catalogMap = new HashMap < Session , List < String > > ( ) ; for ( String key : keyCollections ) { Session index = this . sessionLocator . getSessionByKey ( key ) ; List < St... | Hash key to servers |
29,878 | public final void deleteWithNoReply ( final String key , final int time ) throws InterruptedException , MemcachedException { try { this . delete0 ( key , time , 0 , true , this . opTimeout ) ; } catch ( TimeoutException e ) { throw new MemcachedException ( e ) ; } } | Delete key s data item from memcached . This method doesn t wait for reply |
29,879 | public String getNamespace ( String ns ) throws TimeoutException , InterruptedException , MemcachedException { String key = this . keyProvider . process ( this . getNSKey ( ns ) ) ; byte [ ] keyBytes = ByteUtils . getBytes ( key ) ; ByteUtils . checkKey ( keyBytes ) ; Object item = this . fetch0 ( key , keyBytes , Comm... | Returns the real namespace of ns . |
29,880 | public final static void setMaxSelectors ( int size ) throws IOException { synchronized ( selectors ) { if ( size < maxSelectors ) { reduce ( size ) ; } else if ( size > maxSelectors ) { grow ( size ) ; } maxSelectors = size ; } } | Set max selector pool size . |
29,881 | private boolean advanceHead ( QNode h , QNode nh ) { if ( h == this . head . get ( ) && this . head . compareAndSet ( h , nh ) ) { h . next = h ; return true ; } return false ; } | Tries to cas nh as new head ; if successful unlink old head s next node to avoid garbage retention . |
29,882 | private QNode getValidatedTail ( ) { for ( ; ; ) { QNode h = this . head . get ( ) ; QNode first = h . next ; if ( first != null && first . next == first ) { advanceHead ( h , first ) ; continue ; } QNode t = this . tail . get ( ) ; QNode last = t . next ; if ( t == this . tail . get ( ) ) { if ( last != null ) { this ... | Returns validated tail for use in cleaning methods |
29,883 | QNode traversalHead ( ) { for ( ; ; ) { QNode t = this . tail . get ( ) ; QNode h = this . head . get ( ) ; if ( h != null && t != null ) { QNode last = t . next ; QNode first = h . next ; if ( t == this . tail . get ( ) ) { if ( last != null ) { this . tail . compareAndSet ( t , last ) ; } else if ( first != null ) { ... | Return head after performing any outstanding helping steps |
29,884 | public static ClusterConfigration parseConfiguration ( String line ) { String [ ] lines = line . trim ( ) . split ( "(?:\\r?\\n)" ) ; if ( lines . length < 2 ) { throw new IllegalArgumentException ( "Incorrect config response:" + line ) ; } String configversion = lines [ 0 ] ; String nodeListStr = lines [ 1 ] ; if ( ! ... | Parse response string to ClusterConfiguration instance . |
29,885 | public long get ( ) throws MemcachedException , InterruptedException , TimeoutException { Object result = this . memcachedClient . get ( this . key ) ; if ( result == null ) { throw new MemcachedClientException ( "key is not existed." ) ; } else { if ( result instanceof Long ) return ( Long ) result ; else return Long ... | Get current value |
29,886 | public void set ( long value ) throws MemcachedException , InterruptedException , TimeoutException { this . memcachedClient . set ( this . key , 0 , String . valueOf ( value ) ) ; } | Set counter s value to expected . |
29,887 | public long addAndGet ( long delta ) throws MemcachedException , InterruptedException , TimeoutException { if ( delta >= 0 ) { return this . memcachedClient . incr ( this . key , delta , this . initialValue ) ; } else { return this . memcachedClient . decr ( this . key , - delta , this . initialValue ) ; } } | Add value and get the result |
29,888 | public static char [ ] getAllowedFunctionCharacters ( ) { char [ ] chars = new char [ 53 ] ; int count = 0 ; for ( int i = 65 ; i < 91 ; i ++ ) { chars [ count ++ ] = ( char ) i ; } for ( int i = 97 ; i < 123 ; i ++ ) { chars [ count ++ ] = ( char ) i ; } chars [ count ] = '_' ; return chars ; } | Get the set of characters which are allowed for use in Function names . |
29,889 | public static Function getBuiltinFunction ( final String name ) { if ( name . equals ( "sin" ) ) { return builtinFunctions [ INDEX_SIN ] ; } else if ( name . equals ( "cos" ) ) { return builtinFunctions [ INDEX_COS ] ; } else if ( name . equals ( "tan" ) ) { return builtinFunctions [ INDEX_TAN ] ; } else if ( name . eq... | Get the builtin function for a given name |
29,890 | public static List < Boolean > unmodifiableView ( boolean [ ] array , int length ) { return Collections . unmodifiableList ( view ( array , length ) ) ; } | Creates an returns an unmodifiable view of the given boolean array that requires only a small object allocation . |
29,891 | public static BooleanList view ( boolean [ ] array , int length ) { if ( length > array . length || length < 0 ) throw new IllegalArgumentException ( "length must be non-negative and no more than the size of the array(" + array . length + "), not " + length ) ; return new BooleanList ( array , length ) ; } | Creates and returns a view of the given boolean array that requires only a small object allocation . Changes to the list will be reflected in the array up to a point . If the modification would require increasing the capacity of the array a new array will be allocated - at which point operations will no longer be refle... |
29,892 | public void setMomentum ( double momentum ) { if ( momentum < 0 || Double . isNaN ( momentum ) || Double . isInfinite ( momentum ) ) throw new ArithmeticException ( "Momentum must be non negative, not " + momentum ) ; this . momentum = momentum ; } | Sets the non negative momentum used in training . |
29,893 | public void setWeightDecay ( double weightDecay ) { if ( weightDecay < 0 || weightDecay >= 1 || Double . isNaN ( weightDecay ) ) throw new ArithmeticException ( "Weight decay must be in [0,1), not " + weightDecay ) ; this . weightDecay = weightDecay ; } | Sets the weight decay used for each update . The weight decay must be in the range [ 0 1 ) . Weight decay values must often be very small often 1e - 8 or less . |
29,894 | private void setUp ( Random rand ) { Ws = new ArrayList < > ( npl . length ) ; bs = new ArrayList < > ( npl . length ) ; DenseMatrix W = new DenseMatrix ( npl [ 0 ] , inputSize ) ; Vec b = new DenseVector ( W . rows ( ) ) ; initializeWeights ( W , rand ) ; initializeWeights ( b , W . cols ( ) , rand ) ; Ws . add ( W ) ... | Creates the weights for the hidden layers and output layer |
29,895 | private double computeOutputDelta ( DataSet dataSet , final int idx , Vec delta_out , Vec a_i , Vec d_i ) { double error = 0 ; if ( dataSet instanceof ClassificationDataSet ) { ClassificationDataSet cds = ( ClassificationDataSet ) dataSet ; final int ct = cds . getDataPointCategory ( idx ) ; for ( int i = 0 ; i < outpu... | Computes the delta between the networks output for a same and its true value |
29,896 | private void feedForward ( Vec input , List < Vec > activations , List < Vec > derivatives ) { Vec x = input ; for ( int i = 0 ; i < Ws . size ( ) ; i ++ ) { Matrix W_i = Ws . get ( i ) ; Vec b_i = bs . get ( i ) ; Vec a_i = activations . get ( i ) ; a_i . zeroOut ( ) ; W_i . multiply ( x , 1 , a_i ) ; a_i . mutableAdd... | Feeds a vector through the network to get an output |
29,897 | private Vec feedForward ( Vec input ) { Vec x = input ; for ( int i = 0 ; i < Ws . size ( ) ; i ++ ) { Matrix W_i = Ws . get ( i ) ; Vec b_i = bs . get ( i ) ; Vec a_i = W_i . multiply ( x ) ; a_i . mutableAdd ( b_i ) ; a_i . applyFunction ( f ) ; x = a_i ; } return x ; } | Feeds an input through the network |
29,898 | public void setRegularization ( double regularization ) { if ( Double . isNaN ( regularization ) || Double . isInfinite ( regularization ) || regularization <= 0 ) throw new ArithmeticException ( "Regularization must be a positive constant, not " + regularization ) ; this . regularization = regularization ; } | Sets the amount of regularization to apply . The regularization must be a positive value |
29,899 | public void sortByEigenValue ( Comparator < Double > cmp ) { if ( isComplex ( ) ) throw new ArithmeticException ( "Eigen values can not be sorted due to complex results" ) ; IndexTable it = new IndexTable ( DoubleList . unmodifiableView ( d , d . length ) , cmp ) ; for ( int i = 0 ; i < d . length ; i ++ ) { RowColumnO... | Sorts the eigen values and the corresponding eigenvector columns by the associated eigen value . Sorting can not occur if complex values are present . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.