idx int64 0 41.2k | question stringlengths 73 5.81k | target stringlengths 5 918 |
|---|---|---|
5,900 | static boolean requireLeftAlignment ( String reference , String alternate ) { return StringUtils . isEmpty ( reference ) || StringUtils . isEmpty ( alternate ) || reference . charAt ( reference . length ( ) - 1 ) == alternate . charAt ( alternate . length ( ) - 1 ) ; } | Reference and alternate are either empty or last base from each is equal |
5,901 | private boolean isNormalizable ( Variant variant ) { return ! variant . getType ( ) . equals ( VariantType . NO_VARIATION ) && ! variant . getType ( ) . equals ( VariantType . SYMBOLIC ) ; } | Non normalizable variants |
5,902 | private int [ ] getGenotypesReorderingMap ( int numAllele , int [ ] alleleMap ) { int numAlleles = alleleMap . length ; int key = numAllele * 100 + numAlleles ; int [ ] map = genotypeReorderMapCache . get ( key ) ; if ( map != null ) { return map ; } else { ArrayList < Integer > mapList = new ArrayList < > ( ) ; for ( ... | Gets an array for reordening the positions of a format field with Number = G and ploidy = 2 . |
5,903 | public static void calculateCoverate ( Path bamPath , Path sqlPath ) throws IOException , AlignmentCoverageException { BamManager bamManager = new BamManager ( bamPath ) ; if ( ! bamPath . getParent ( ) . resolve ( bamPath . getFileName ( ) . toString ( ) + ".bai" ) . toFile ( ) . exists ( ) ) { bamManager . createInde... | Calculate the coverage for the input BAM file . The coverage is stored in a SQLite database located in the sqlPath output directory . |
5,904 | public List < MeasureType . MeasureRelationship > getMeasureRelationship ( ) { if ( measureRelationship == null ) { measureRelationship = new ArrayList < MeasureType . MeasureRelationship > ( ) ; } return this . measureRelationship ; } | Gets the value of the measureRelationship property . |
5,905 | public List < String > getFormat ( ) { return impl . getFormat ( ) == null ? null : Collections . unmodifiableList ( impl . getFormat ( ) ) ; } | Do not modify this list |
5,906 | public static void calculateStatsForVariantsList ( List < Variant > variants , Pedigree ped ) { for ( Variant variant : variants ) { for ( StudyEntry entry : variant . getStudies ( ) ) { VariantStats stats = calculate ( variant , entry ) ; entry . setStats ( StudyEntry . DEFAULT_COHORT , stats ) ; } } } | Calculates the statistics for some variants read from a set of files and optionally given pedigree information . Some statistics like inheritance patterns can only be calculated if pedigree information is provided . |
5,907 | private static int [ ] getGenotypeReorderingMap ( int ploidy , int [ ] map ) { int [ ] gMap ; if ( ploidy == 1 ) { gMap = new int [ map . length + 1 ] ; gMap [ 0 ] = 0 ; for ( int i = 0 ; i < map . length ; i ++ ) { gMap [ i + 1 ] = map [ i ] + 1 ; } } else if ( ploidy == 2 ) { int l = map . length ; gMap = new int [ l... | Gets an array for reordering the positions of a format field with Number = G and ploidy = 2 . |
5,908 | public static void getOrdering ( int p , int n , List < String > list , int [ ] gt , int pos , int [ ] map ) { for ( int a = 0 ; a <= n ; a ++ ) { if ( map == null ) { gt [ pos ] = a ; } else { gt [ pos ] = remapAllele ( map , a ) ; } if ( p == 1 ) { int prev = gt [ 0 ] ; int [ ] gtSorted = gt ; for ( int g : gt ) { if... | Recursive genotype ordering algorithm as seen in VCF - spec . |
5,909 | private List < ConsequenceType > setConsequenceTypeParams ( ) { List < ConsequenceType > consequenceTypeList = new ArrayList < > ( ) ; ConsequenceType . Builder consequenceType = ConsequenceType . newBuilder ( ) ; consequenceType . setGeneName ( null ) ; consequenceType . setEnsemblGeneId ( null ) ; consequenceType . s... | method to set Consequence Type Parameters |
5,910 | private List < VariantAnnotationProto . PopulationFrequency > setPopulationFrequencyParams ( ) { List < VariantAnnotationProto . PopulationFrequency > populationFrequencyList = new ArrayList < > ( ) ; VariantAnnotationProto . PopulationFrequency . Builder populationFrequency = VariantAnnotationProto . PopulationFrequen... | method to set Population Frequency Parameters |
5,911 | private VariantAnnotationProto . VariantAnnotation setVaraintAnnotationParams ( ) { VariantAnnotationProto . VariantAnnotation . Builder variantAnnotation = VariantAnnotationProto . VariantAnnotation . newBuilder ( ) ; HashMap < String , VariantAnnotationProto . VariantAnnotation . AdditionalAttribute > map = new HashM... | method to set Varaint Annotation Parameters |
5,912 | public Part < T > setContentType ( MediaType contentType ) { headers . add ( HttpHeaders . CONTENT_TYPE , contentType . toString ( ) ) ; return this ; } | Sets the Content - Type of this request . |
5,913 | public void setPartConverters ( List < HttpMessageConverter > partConverters ) { checkNotNull ( partConverters , "'partConverters' must not be null" ) ; checkArgument ( ! partConverters . isEmpty ( ) , "'partConverters' must not be empty" ) ; this . partConverters = partConverters ; } | Set the message body converters to use . These converters are used to convert objects to MIME parts . |
5,914 | public void addPartConverter ( HttpMessageConverter partConverter ) { checkNotNull ( partConverters , "'partConverters' must not be null" ) ; checkArgument ( ! partConverters . isEmpty ( ) , "'partConverters' must not be empty" ) ; this . partConverters . add ( partConverter ) ; } | Add a message body converter . Such a converter is used to convert objects to MIME parts . |
5,915 | public RestClientOptions putGlobalHeaders ( MultiMap headers ) { for ( Map . Entry < String , String > header : headers ) { globalHeaders . add ( header . getKey ( ) , header . getValue ( ) ) ; } return this ; } | Set global headers which will be appended to every HTTP request . The headers defined per request will override this headers . |
5,916 | public RestClientOptions putGlobalHeader ( String name , String value ) { globalHeaders . add ( name , value ) ; return this ; } | Add a global header which will be appended to every HTTP request . The headers defined per request will override this headers . |
5,917 | public byte [ ] getResponseBodyAsByteArray ( ) { final ByteBuf bodyByteBuf = httpInputMessage . getBody ( ) ; final byte [ ] bytes = new byte [ bodyByteBuf . readableBytes ( ) ] ; bodyByteBuf . readBytes ( bytes ) ; return bytes ; } | Return the response body as a byte array . |
5,918 | public < T > T getResponseBody ( Class < T > clazz ) { final ByteBuf byteBuf = httpInputMessage . getBody ( ) ; if ( byteBuf . readableBytes ( ) == 0 || Void . class . isAssignableFrom ( clazz ) ) return null ; final MediaType mediaType = MediaType . parseMediaType ( httpInputMessage . getHeaders ( ) . get ( HttpHeader... | Return the response body converted to the given class |
5,919 | public String getResponseBodyAsString ( ) { final ByteBuf bodyByteBuf = httpInputMessage . getBody ( ) ; final String contentEncoding = httpInputMessage . getHeaders ( ) . get ( HttpHeaders . CONTENT_ENCODING ) ; byte [ ] bytes = new byte [ bodyByteBuf . readableBytes ( ) ] ; bodyByteBuf . readBytes ( bytes ) ; return ... | Return the response body as a string . |
5,920 | public File locateResource ( String name ) { for ( int i = 0 ; i < resourcePath . length ; i ++ ) { File fi = new File ( resourcePath [ i ] . getAbsolutePath ( ) + File . separator + name ) ; if ( fi . exists ( ) ) return fi ; } return null ; } | iterate component directories in order and return full path of first file matching |
5,921 | public byte [ ] retrieveBytes ( File impFi ) { if ( resourceLocator != null ) { byte [ ] bytes = resourceLocator . retrieveBytes ( impFi ) ; if ( bytes != null ) return bytes ; } return HtmlImportShim . ResourceLocator . super . retrieveBytes ( impFi ) ; } | this part of locator interface is only implemented if another resourcelocator is set . |
5,922 | private RLSupplier < Value > evaluate ( ) { if ( stackRPN . empty ( ) ) { return ( ) -> new StringValue ( "" ) ; } stackAnswer . clear ( ) ; @ SuppressWarnings ( "unchecked" ) Stack stackRPN = ( Stack ) this . stackRPN . clone ( ) ; while ( ! stackRPN . empty ( ) ) { Object token = stackRPN . pop ( ) ; if ( token insta... | Evaluates once parsed to a lambda term |
5,923 | public WebSocketPublisher toWS ( ) { return new WebSocketPublisher ( ) . coding ( coding ) . facade ( facade ) . hostName ( hostName ) . port ( port ) . urlPath ( urlPath ) ; } | enables sharing of common settings if publishing also as websocket service |
5,924 | public IPromise scheduleSendLoop ( ConnectionRegistry reg ) { Promise promise = new Promise ( ) ; sendJobs . add ( new ScheduleEntry ( reg , promise ) ) ; synchronized ( this ) { if ( ! loopStarted ) { loopStarted = true ; Actor . current ( ) . execute ( this ) ; } } return promise ; } | return a future which is completed upon connection close |
5,925 | public void run ( ) { pollThread = Thread . currentThread ( ) ; if ( underway ) return ; underway = true ; try { int count = 1 ; while ( count > 0 ) { count = onePoll ( ) ; if ( sendJobs . size ( ) > 0 ) { if ( count > 0 ) { int debug = 1 ; } else { if ( remoteRefCounter == 0 ) { Actor . current ( ) . delayed ( 100 , t... | counts active remote refs if none backoff remoteref polling massively eats cpu |
5,926 | public void withCallback ( String arg , Callback callback ) { callback . pipe ( "Hello" ) ; callback . pipe ( arg ) ; callback . finish ( ) ; } | identical but uses convenience methods |
5,927 | public KUrl unified ( ) { KUrl res = new KUrl ( toUrlString ( false ) ) ; res . elements [ 0 ] = normalizeDomain ( elements [ 0 ] ) ; return res ; } | removes www protocol and country |
5,928 | protected String normalizeDomain ( String s ) { int idx = s . lastIndexOf ( "." ) ; if ( idx >= 0 ) { s = s . substring ( 0 , idx ) ; } if ( s . startsWith ( "www." ) ) s = s . substring ( 4 ) ; return s ; } | removes www in case and removes country code . EXPECT protocol to be absent |
5,929 | public IPromise < T > then ( Runnable result ) { return then ( ( r , e ) -> result . run ( ) ) ; } | see IPromise interface |
5,930 | public Promise getNext ( ) { while ( ! lock . compareAndSet ( false , true ) ) { } try { if ( nextFuture == null ) return new Promise ( ) ; else return ( Promise ) nextFuture ; } finally { lock . set ( false ) ; } } | special method for tricky things . Creates a nextFuture or returns it . current |
5,931 | public void finallyDo ( Callback resultCB ) { while ( ! lock . compareAndSet ( false , true ) ) { } try { if ( resultReceiver != null ) throw new RuntimeException ( "Double register of future listener" ) ; resultReceiver = resultCB ; if ( hadResult ) { hasFired = true ; lock . set ( false ) ; resultCB . complete ( resu... | same as then but avoid creation of new promise |
5,932 | public static < T extends Actor > T AsActor ( Class < T > actorClazz ) { return ( T ) instance . newProxy ( actorClazz , defaultScheduler . get ( ) , - 1 ) ; } | create an new actor . If this is called outside an actor a new DispatcherThread will be scheduled . If called from inside actor code the new actor will share the thread + queue with the caller . |
5,933 | public static < T extends Actor > T AsActor ( Class < T > actorClazz , Scheduler scheduler , int qsize ) { return ( T ) instance . newProxy ( actorClazz , scheduler , qsize ) ; } | create an new actor dispatched in the given DispatcherThread |
5,934 | public static < T > IPromise < IPromise < T > [ ] > all ( IPromise < T > ... futures ) { Promise res = new Promise ( ) ; awaitSettle ( futures , res ) ; return res ; } | similar to es6 Promise . all method however non - IPromise objects are not allowed |
5,935 | public static < T > IPromise < List < T > > allMapped ( List < IPromise < T > > futures ) { Promise returned = new Promise ( ) ; Promise res = new Promise ( ) ; awaitSettle ( futures , res ) ; res . then ( ( r , e ) -> { if ( r != null ) { returned . resolve ( ( ( List < Promise > ) r ) . stream ( ) . map ( p -> p . ge... | similar all but map promises to their content |
5,936 | public static < T > IPromise < T > complete ( T res , Object err ) { return new Promise < > ( res , err ) ; } | abbreviation for Promise creation to make code more concise |
5,937 | public static void main ( String [ ] args ) { Actor remote = ( Actor ) new WebSocketConnectable ( ) . actorClass ( Actor . class ) . url ( "ws://localhost:3999" ) . serType ( SerializerType . JsonNoRef ) . connect ( ( x , y ) -> System . out . println ( "disconnect " + x + " " + y ) ) . await ( ) ; remote . ask ( "gree... | with Java - implemented Servers . Use typed clients meanwhile |
5,938 | protected IPromise < JsonObject > getDistributions ( String module ) { Promise res = new Promise ( ) ; http . getContent ( config . getRepo ( ) + "/-/package/" + module + "/dist-tags" ) . then ( ( cont , err ) -> { if ( cont != null ) { JsonObject parse = Json . parse ( cont ) . asObject ( ) ; res . resolve ( parse ) ;... | map of tag = > version |
5,939 | public void addTagName ( char c ) { if ( tagName == null ) tagName = new StringBuilder ( 10 ) ; if ( c > 0 ) tagName . append ( c ) ; } | attrs if this is tag |
5,940 | void removeActorImmediate ( Actor act ) { if ( Thread . currentThread ( ) != this ) throw new RuntimeException ( "wrong thread" ) ; Actor newAct [ ] = new Actor [ actors . length - 1 ] ; int idx = 0 ; for ( int i = 0 ; i < actors . length ; i ++ ) { Actor actor = actors [ i ] ; if ( actor != act ) newAct [ idx ++ ] = a... | removes immediate must be called from this thread |
5,941 | public void schedulePendingAdds ( ) { ArrayList < Actor > newOnes = new ArrayList < > ( ) ; Actor a ; while ( ( a = toAdd . poll ( ) ) != null ) { newOnes . add ( a ) ; } if ( newOnes . size ( ) > 0 ) { Actor newQueue [ ] = new Actor [ newOnes . size ( ) + actors . length ] ; System . arraycopy ( actors , 0 , newQueue ... | add actors which have been marked to be scheduled on this |
5,942 | public int getAccumulatedQSizes ( ) { int res = 0 ; final Actor actors [ ] = this . actors ; for ( int i = 0 ; i < actors . length ; i ++ ) { res += actors [ i ] . getQSizes ( ) ; } return res ; } | accumulated queue sizes of all actors |
5,943 | public boolean schedules ( Object receiverRef ) { if ( Thread . currentThread ( ) != this ) { throw new RuntimeException ( "cannot call from foreign thread" ) ; } if ( receiverRef instanceof Actor ) { return ( ( Actor ) receiverRef ) . __currentDispatcher == this ; } return false ; } | can be called from the dispacther thread itself only |
5,944 | protected String [ ] getResourcePathElements ( BasicWebAppConfig cfg ) { return new String [ ] { cfg . getClientRoot ( ) , cfg . getClientRoot ( ) + "/node_modules" , } ; } | need to patch resourcepath as browserify expects node modules at same level as local imports |
5,945 | public void finish ( ) { if ( finSignal == null && finished ) return ; cb . complete ( null , null ) ; finished = true ; } | to be called at remote side when using streaming to deliver multiple results call this in order to signal no further results are expected . |
5,946 | public String scanLastNWSDouble ( ) { int off = - 1 ; while ( Character . isWhitespace ( ch ( off ) ) && off + index >= 0 ) { off -- ; } return "" + ch ( off ) + ch ( off - 1 ) ; } | last two nonws chars |
5,947 | protected IPromise < BasicAuthenticationResult > getCredentials ( String user , String pw , String jwt ) { Promise p = new Promise ( ) ; if ( SESSIONID_SPECIAL_STRING . equals ( pw ) ) { sessionStorage . getUserFromSessionId ( user ) . then ( ( r , e ) -> { if ( r != null ) { sessionStorage . getUser ( r ) . then ( ( r... | does a lookup for a user record using user as key . Compares pw with pwd of user record if found if user denotes a vaild old session id and pwd == SESSION_ID a session is created from a previous authentication |
5,948 | public IPromise < Actor > reanimate ( String sessionId , long remoteRefId ) { if ( sessionStorage == null ) return resolve ( null ) ; Promise res = new Promise ( ) ; sessionStorage . getUserFromSessionId ( sessionId ) . then ( ( user , err ) -> { if ( user == null ) res . resolve ( null ) ; else { getSessionForReanimat... | An existing spa client made a request after being inactive for a long time . |
5,949 | public void handleDirectRequest ( HttpServerExchange exchange ) { Log . Info ( this , "direct request received " + exchange ) ; getDirectRequestResponse ( exchange . getRequestPath ( ) ) . then ( ( s , err ) -> { exchange . setResponseCode ( 200 ) ; exchange . getResponseHeaders ( ) . put ( Headers . CONTENT_TYPE , "te... | reply a request catched by interceptor note this is server dependent and bound to undertow . for servlet containers just override KontraktorServlet methods |
5,950 | public void msg ( Thread t , int severity , Object source , Throwable ex , String msg ) { logger . msg ( t , severity , source , ex , msg ) ; } | async mother method |
5,951 | public void sendShortPoll ( ) { myExec . execute ( new Runnable ( ) { public void run ( ) { Object [ ] req = new Object [ ] { "SP" , lastSeenSeq } ; sendCallArray ( req ) ; } } ) ; } | send an empty request polling for messages on server side . Unlike long poll this request returns immediately and is not delayed by the server |
5,952 | protected int processResponse ( byte [ ] b ) { if ( DumpProtocol ) { try { System . out . println ( "resp:" + new String ( b , "UTF-8" ) ) ; } catch ( UnsupportedEncodingException e ) { e . printStackTrace ( ) ; } } Object o [ ] = ( Object [ ] ) conf . asObject ( b ) ; if ( SENDDEBUG ) System . out . println ( "RECEIVE... | caches early responses in case of response race |
5,953 | public byte [ ] retrieveBytes ( File impFi ) { String fname = impFi . getName ( ) ; int idx = fname . indexOf ( '.' ) ; if ( idx >= 0 ) { String ext = fname . substring ( idx + 1 ) . toLowerCase ( ) ; TranspilerHook transpilerHook = transpilerMap . get ( ext ) ; if ( transpilerHook != null ) { return transpilerHook . t... | invoke transpilers during prodmode inlining |
5,954 | public Pair < Boolean , Object > hasValueChanged ( String fieldId ) { for ( int i = 0 ; i < changedFields . length ; i ++ ) { String changedField = changedFields [ i ] ; if ( fieldId . equals ( changedField ) ) { return new Pair < > ( true , oldValues [ i ] ) ; } } return new Pair < > ( false , null ) ; } | return wether field is in changedfieldlist and old value of this field |
5,955 | public int originalSize ( ) { Block < T > currentHeadBlock = getHeadBlock ( ) ; int head = currentHeadBlock . head ( ) ; int size = 0 ; while ( true ) { if ( head == getBlockSize ( ) ) { Block < T > nextHeadBlock = currentHeadBlock . next ( ) ; if ( nextHeadBlock == null ) { break ; } else { currentHeadBlock = nextHead... | this method has been modified from original jetty version it only returns a size rounded to blockSize |
5,956 | public void tellSubscribers ( Actor sender , String topic , Object message ) { List < ReceiverActor > subscriber = topic2Subscriber . get ( topic ) ; if ( subscriber != null ) { subscriber . stream ( ) . filter ( subs -> ! subs . equals ( sender ) ) . forEach ( subs -> subs . receiveTell ( topic , message ) ) ; } } | send a fire and forget message to all |
5,957 | public void askSubscribers ( Actor sender , String topic , Object message , Callback cb ) { List < ReceiverActor > subscriber = topic2Subscriber . get ( topic ) ; if ( subscriber != null ) { List < IPromise > results = subscriber . stream ( ) . filter ( subs -> ! subs . equals ( sender ) ) . map ( subs -> subs . receiv... | send a message to all and stream the result of each receiver back to sender |
5,958 | public void complete ( T result , Object error ) { synchronized ( this ) { if ( isComplete ) { throw new RuntimeException ( "Promise can be completed only once" ) ; } this . result = result ; this . error = error ; isComplete = true ; tryFire ( ) ; } } | to be called by code returning an result or error . |
5,959 | private boolean couldBeRegexp ( Inp in ) { return "(,=:[!&|?{};" . indexOf ( in . scanLastNWS ( ) ) >= 0 || "*/" . equalsIgnoreCase ( in . scanLastNWSDouble ( ) ) || in . isFirstCharAfterLineBreak ( ) ; } | assumes comments are logically excluded |
5,960 | public IPromise atomicQuery ( String key , RLFunction < Record , Object > action ) { Record rec = getStore ( ) . get ( key ) ; if ( rec == null ) { final Object apply = action . apply ( rec ) ; if ( apply instanceof ChangeMessage ) { receive ( ( ChangeMessage ) apply ) ; } return new Promise ( apply ) ; } else { Patchi... | apply the function to the record with given key and return the result inside a promise |
5,961 | public RealLiveTable tbl ( String name ) { return ( RealLiveTable ) getActor ( ) . syncTableAccess . get ( name ) ; } | shorthand for getTable |
5,962 | public static ServiceActor RunTCP ( String args [ ] , Class < ? extends ServiceActor > serviceClazz , Class < ? extends ServiceArgs > argsClazz ) { ServiceActor myService = AsActor ( serviceClazz ) ; ServiceArgs options = null ; try { options = ServiceRegistry . parseCommandLine ( args , null , argsClazz . newInstance ... | run & connect a service with given cmdline args and classes |
5,963 | protected void registerSelf ( ) { publishSelf ( ) ; serviceRegistry . get ( ) . registerService ( getServiceDescription ( ) ) ; serviceRegistry . get ( ) . subscribe ( ( pair , err ) -> { serviceEvent ( pair . car ( ) , pair . cdr ( ) , err ) ; } ) ; heartBeat ( ) ; Log . Info ( this , "registered at serviceRegistry." ... | register at service registry |
5,964 | public void initFromIterator ( Iterator < IN > iterator ) { this . pending = new ArrayDeque < > ( ) ; isIteratorBased = true ; Executor iteratorThread = new ThreadPoolExecutor ( 0 , 1 , 10L , TimeUnit . MILLISECONDS , new LinkedBlockingQueue < Runnable > ( ) ) ; producer = new Subscription ( ) { boolean complete = fals... | acts as an pull based event producer then |
5,965 | public void _cancel ( int id ) { if ( doOnSubscribe != null ) { doOnSubscribe . add ( ( ) -> _cancel ( id ) ) ; } else subscribers . remove ( id ) ; } | private . remoted cancel |
5,966 | public void _rq ( long l , int id ) { if ( doOnSubscribe != null ) { doOnSubscribe . add ( ( ) -> _rq ( l , id ) ) ; } else { SubscriberEntry se = getSE ( id ) ; if ( se != null ) { se . addCredits ( l ) ; } else { Log . Warn ( this , "ignored credits " + l + " on id " + id ) ; } emitRequestNext ( ) ; } } | private . remoted request next |
5,967 | public void onNext ( IN in ) { if ( in == null ) throw null ; _onNext ( in ) ; } | same as with onError |
5,968 | protected IPromise directWrite ( ByteBuffer buf ) { checkThread ( ) ; if ( myActor == null ) myActor = Actor . current ( ) ; if ( writePromise != null ) throw new RuntimeException ( "concurrent write con:" + chan . isConnected ( ) + " open:" + chan . isOpen ( ) ) ; writePromise = new Promise ( ) ; writingBuffer = buf ;... | originally for debugging but now used to reschedule .. |
5,969 | void writeFinished ( Object error ) { checkThread ( ) ; writingBuffer = null ; Promise wp = this . writePromise ; writePromise = null ; if ( ! wp . isSettled ( ) ) { if ( error != null ) wp . reject ( error ) ; else wp . resolve ( ) ; } } | error = null = > ok |
5,970 | public synchronized Pair < PathHandler , Undertow > getServer ( int port , String hostName ) { return getServer ( port , hostName , null ) ; } | creates or gets an undertow web server instance mapped by port . hostname must be given in case a new server instance has to be instantiated |
5,971 | public Http4K publishFileSystem ( String hostName , String urlPath , int port , File root ) { if ( ! root . exists ( ) ) root . mkdirs ( ) ; if ( ! root . isDirectory ( ) ) { throw new RuntimeException ( "root must be an existing direcory:" + root . getAbsolutePath ( ) ) ; } Pair < PathHandler , Undertow > server = get... | publishes given file root |
5,972 | static byte [ ] gzip ( byte [ ] val ) throws IOException { ByteArrayOutputStream bos = new ByteArrayOutputStream ( val . length ) ; GZIPOutputStream gos = null ; try { gos = new GZIPOutputStream ( bos ) ; gos . write ( val , 0 , val . length ) ; gos . finish ( ) ; gos . flush ( ) ; bos . flush ( ) ; val = bos . toByteA... | only called once in case no need for optimization |
5,973 | public Hoarde < T > each ( BiConsumer < T , Integer > init ) { for ( int i = 0 ; i < actors . length ; i ++ ) { init . accept ( ( T ) actors [ i ] , i ) ; } return this ; } | same as other each but with index |
5,974 | public < T > KxPublisher < T > asKxPublisher ( Publisher < T > p ) { if ( p instanceof KxPublisher ) return ( KxPublisher < T > ) p ; return new KxPublisher < T > ( ) { public void subscribe ( Subscriber < ? super T > s ) { p . subscribe ( s ) ; } public KxReactiveStreams getKxStreamsInstance ( ) { return KxReactiveStr... | interop obtain a RxPublisher from an arbitrary rxstreams publisher . |
5,975 | public IPromise < String > getDataSimple ( ) { Promise result = new Promise ( ) ; result . complete ( "Data" , null ) ; return result ; } | these methods are identical ... |
5,976 | public static KeybindComponent of ( final String keybind , final TextColor color ) { return of ( keybind , color , Collections . emptySet ( ) ) ; } | Creates a keybind component with content and optional color . |
5,977 | public static KeybindComponent of ( final String keybind , final TextColor color , final Set < TextDecoration > decorations ) { return builder ( keybind ) . color ( color ) . decorations ( decorations , true ) . build ( ) ; } | Creates a keybind component with content and optional color and decorations . |
5,978 | public KeybindComponent keybind ( final String keybind ) { return new KeybindComponent ( this . children , this . color , this . obfuscated , this . bold , this . strikethrough , this . underlined , this . italic , this . clickEvent , this . hoverEvent , this . insertion , requireNonNull ( keybind , "keybind" ) ) ; } | Sets the keybind . |
5,979 | public static TranslatableComponent of ( final String key , final TextColor color ) { return builder ( key ) . color ( color ) . build ( ) ; } | Creates a translatable component with a translation key . |
5,980 | public TranslatableComponent key ( final String key ) { return new TranslatableComponent ( this . children , this . color , this . obfuscated , this . bold , this . strikethrough , this . underlined , this . italic , this . clickEvent , this . hoverEvent , this . insertion , requireNonNull ( key , "key" ) , this . args... | Sets the translation key . |
5,981 | public TranslatableComponent args ( final List < Component > args ) { return new TranslatableComponent ( this . children , this . color , this . obfuscated , this . bold , this . strikethrough , this . underlined , this . italic , this . clickEvent , this . hoverEvent , this . insertion , this . key , args ) ; } | Sets the translation arguments for this component . |
5,982 | public static Builder builder ( final String name , final String objective ) { return new Builder ( ) . name ( name ) . objective ( objective ) ; } | Creates a score component builder with a name and objective . |
5,983 | public static ScoreComponent of ( final String name , final String objective ) { return of ( name , objective , null ) ; } | Creates a score component with a name and objective . |
5,984 | public static ScoreComponent of ( final String name , final String objective , final String value ) { return builder ( ) . name ( name ) . objective ( objective ) . value ( value ) . build ( ) ; } | Creates a score component with a name objective and optional value . |
5,985 | public static ClickEvent openUrl ( final String url ) { return new ClickEvent ( Action . OPEN_URL , url ) ; } | Creates a click event that opens a url . |
5,986 | public static ClickEvent openFile ( final String file ) { return new ClickEvent ( Action . OPEN_FILE , file ) ; } | Creates a click event that opens a file . |
5,987 | public static ClickEvent runCommand ( final String command ) { return new ClickEvent ( Action . RUN_COMMAND , command ) ; } | Creates a click event that runs a command . |
5,988 | public static ClickEvent suggestCommand ( final String command ) { return new ClickEvent ( Action . SUGGEST_COMMAND , command ) ; } | Creates a click event that suggests a command . |
5,989 | public static ClickEvent changePage ( final String page ) { return new ClickEvent ( Action . CHANGE_PAGE , page ) ; } | Creates a click event that changes to a page . |
5,990 | public SelectorComponent pattern ( final String pattern ) { return new SelectorComponent ( this . children , this . color , this . obfuscated , this . bold , this . strikethrough , this . underlined , this . italic , this . clickEvent , this . hoverEvent , this . insertion , requireNonNull ( pattern , "pattern" ) ) ; } | Sets the selector pattern . |
5,991 | public static TextComponent of ( final String content , final TextColor color ) { return of ( content , color , Collections . emptySet ( ) ) ; } | Creates a text component with content and optional color . |
5,992 | public TextComponent content ( final String content ) { return new TextComponent ( this . children , this . color , this . obfuscated , this . bold , this . strikethrough , this . underlined , this . italic , this . clickEvent , this . hoverEvent , this . insertion , requireNonNull ( content , "content" ) ) ; } | Sets the plain text content . |
5,993 | public static GsonBuilder populate ( final GsonBuilder builder ) { builder . registerTypeHierarchyAdapter ( Component . class , INSTANCE ) . registerTypeAdapter ( ClickEvent . Action . class , new NameMapSerializer < > ( "click action" , ClickEvent . Action . NAMES ) ) . registerTypeAdapter ( HoverEvent . Action . clas... | Populate a builder with our serializers . |
5,994 | public static < T extends Enum < T > > NameMap < T > create ( final T [ ] constants , final Function < T , String > namer ) { final Map < String , T > byName = new HashMap < > ( constants . length ) ; final Map < T , String > byValue = new HashMap < > ( constants . length ) ; for ( int i = 0 , length = constants . leng... | Creates a name map . |
5,995 | public Optional < T > get ( final String name ) { return Optional . ofNullable ( this . byName . get ( name ) ) ; } | Gets a value by its name . |
5,996 | public static HoverEvent showText ( final Component text ) { return new HoverEvent ( Action . SHOW_TEXT , text ) ; } | Creates a hover event that shows text on hover . |
5,997 | public static HoverEvent showItem ( final Component item ) { return new HoverEvent ( Action . SHOW_ITEM , item ) ; } | Creates a hover event that shows an item on hover . |
5,998 | public static HoverEvent showEntity ( final Component entity ) { return new HoverEvent ( Action . SHOW_ENTITY , entity ) ; } | Creates a hover event that shows an entity on hover . |
5,999 | private static void commitSuicide ( String msg ) { Thread t = new Thread ( ( ) -> { try { System . exit ( - 1 ) ; } catch ( SecurityException ex ) { LOGGER . info ( "SecurityException prevented system exit" , ex ) ; } try { while ( true ) { Thread . sleep ( 5000L ) ; LOGGER . error ( "VM is in an unreliable state - ple... | Try to terminate the VM as soon as possible no matter the method and how abrupt it may be . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.