idx int64 0 165k | question stringlengths 73 5.81k | target stringlengths 5 918 |
|---|---|---|
131,800 | public static < T > Serializer < T > dummySerializer ( ) { return new Serializer < T > ( ) { public void write ( PrimitivO output , T object ) { throw new RuntimeException ( "Dummy serializer." ) ; } public T read ( PrimitivI input ) { throw new RuntimeException ( "Dummy serializer." ) ; } public boolean isReference ( ... | Serializer that throws exception for any serialization . Use for known objects . |
131,801 | public static AffineGapAlignmentScoring < NucleotideSequence > getNucleotideBLASTScoring ( int gapOpenPenalty , int gapExtensionPenalty ) { return new AffineGapAlignmentScoring < > ( NucleotideSequence . ALPHABET , 5 , - 4 , gapOpenPenalty , gapExtensionPenalty ) ; } | Returns Nucleotide BLAST scoring |
131,802 | public static AffineGapAlignmentScoring < AminoAcidSequence > getAminoAcidBLASTScoring ( BLASTMatrix matrix , int gapOpenPenalty , int gapExtensionPenalty ) { return new AffineGapAlignmentScoring < > ( AminoAcidSequence . ALPHABET , matrix . getMatrix ( ) , gapOpenPenalty , gapExtensionPenalty ) ; } | Returns AminoAcid BLAST scoring |
131,803 | public static boolean belongsToAlphabet ( Alphabet < ? > alphabet , String string ) { for ( int i = 0 ; i < string . length ( ) ; ++ i ) if ( alphabet . symbolToCode ( string . charAt ( i ) ) == - 1 ) return false ; return true ; } | Check if a sequence contains letters only from specified alphabet . So in can be converted to corresponding type of sequence . |
131,804 | public static Set < Alphabet < ? > > possibleAlphabets ( String string ) { HashSet < Alphabet < ? > > alphabets = new HashSet < > ( ) ; for ( Alphabet alphabet : Alphabets . getAll ( ) ) { if ( belongsToAlphabet ( alphabet , string ) ) alphabets . add ( alphabet ) ; } return alphabets ; } | Returns a set of possible alphabets for a given string . |
131,805 | public static < S extends Seq < S > > S concatenate ( S ... sequences ) { if ( sequences . length == 0 ) throw new IllegalArgumentException ( "Zero arguments" ) ; if ( sequences . length == 1 ) return sequences [ 0 ] ; int size = 0 ; for ( S s : sequences ) size += s . size ( ) ; SeqBuilder < S > builder = sequences [ ... | Returns a concatenation of several sequences . |
131,806 | public static Bit2Array convertNSequenceToBit2Array ( NucleotideSequence seq ) { if ( seq . containWildcards ( ) ) throw new IllegalArgumentException ( "Sequences with wildcards are not supported." ) ; Bit2Array bar = new Bit2Array ( seq . size ( ) ) ; for ( int i = 0 ; i < seq . size ( ) ; i ++ ) bar . set ( i , seq .... | Used to write legacy file formats . |
131,807 | public static NucleotideSequence convertBit2ArrayToNSequence ( Bit2Array bar ) { SequenceBuilder < NucleotideSequence > seq = NucleotideSequence . ALPHABET . createBuilder ( ) . ensureCapacity ( bar . size ( ) ) ; for ( int i = 0 ; i < bar . size ( ) ; i ++ ) seq . append ( ( byte ) bar . get ( i ) ) ; return seq . cre... | Used to read legacy file formats . |
131,808 | public FileIndexBuilder setStartingRecordNumber ( long recordNumber ) { checkIfDestroyed ( ) ; if ( index . size ( ) != 1 ) throw new IllegalStateException ( "Initial record is already initialised to " + index . get ( 0 ) ) ; startingRecordNumber = recordNumber ; return this ; } | Sets the starting record number to a specified one . |
131,809 | public FileIndexBuilder putMetadata ( String key , String value ) { checkIfDestroyed ( ) ; metadata . put ( key , value ) ; return this ; } | Puts metadata . |
131,810 | public FileIndexBuilder appendNextRecord ( long recordSize ) { checkIfDestroyed ( ) ; if ( recordSize < 0 ) throw new IllegalArgumentException ( "Size cannot be negative." ) ; if ( currentRecord == step ) { index . add ( startingByte + currentByte ) ; currentRecord = 0 ; } currentByte += recordSize ; ++ currentRecord ;... | Appends next record to this index builder and returns this . |
131,811 | public static int computeRawVarint64Size ( final long value ) { if ( ( value & ( 0xffffffffffffffffL << 7 ) ) == 0 ) return 1 ; if ( ( value & ( 0xffffffffffffffffL << 14 ) ) == 0 ) return 2 ; if ( ( value & ( 0xffffffffffffffffL << 21 ) ) == 0 ) return 3 ; if ( ( value & ( 0xffffffffffffffffL << 28 ) ) == 0 ) return 4... | Compute the number of bytes that would be needed to encode a varint . |
131,812 | public boolean checkModified ( LightFileDescriptor other ) { if ( isAlwaysModified ( ) || other . isAlwaysModified ( ) ) return true ; if ( ! name . equals ( other . name ) ) return true ; if ( ! ( hasChecksum ( ) && other . hasChecksum ( ) ) && ! ( hasModificationDate ( ) && other . hasModificationDate ( ) ) ) return ... | Returns true if file modified |
131,813 | public String toBase64 ( ) { return name + ( checksum == null ? "null" : Base64 . getDecoder ( ) . decode ( checksum ) ) + ( lastModified == null ? "null" : lastModified ) ; } | A string representation of this . |
131,814 | public byte minValue ( ) { if ( data . length == 0 ) return 0 ; byte min = Byte . MAX_VALUE ; for ( byte b : data ) if ( b < min ) min = b ; return min ; } | Returns the worst sequence quality value |
131,815 | public byte meanValue ( ) { if ( data . length == 0 ) return 0 ; int sum = 0 ; for ( byte b : data ) sum += b ; return ( byte ) ( sum / data . length ) ; } | Returns average sequence quality value |
131,816 | public SequenceQuality getRange ( Range range ) { byte [ ] rdata = Arrays . copyOfRange ( data , range . getLower ( ) , range . getUpper ( ) ) ; if ( range . isReverse ( ) ) ArraysUtils . reverse ( rdata ) ; return new SequenceQuality ( rdata , true ) ; } | Returns substring of current quality scores line . |
131,817 | public void encodeTo ( QualityFormat format , byte [ ] buffer , int offset ) { byte vo = format . getOffset ( ) ; for ( int i = 0 ; i < data . length ; ++ i ) buffer [ offset ++ ] = ( byte ) ( data [ i ] + vo ) ; } | Encodes current quality line with given offset . Common values for offset are 33 and 64 . |
131,818 | public static SequenceQuality getUniformQuality ( byte qualityValue , int length ) { byte [ ] data = new byte [ length ] ; Arrays . fill ( data , qualityValue ) ; return new SequenceQuality ( data , true ) ; } | Creates a phred sequence quality containing only given values of quality . |
131,819 | public static Alignment < NucleotideSequence > alignLeftAdded ( LinearGapAlignmentScoring scoring , NucleotideSequence seq1 , NucleotideSequence seq2 , int offset1 , int length1 , int addedNucleotides1 , int offset2 , int length2 , int addedNucleotides2 , int width ) { try { MutationsBuilder < NucleotideSequence > muta... | Semi - semi - global alignment with artificially added letters . |
131,820 | public int addReference ( NucleotideSequence sequence ) { if ( sequence . containWildcards ( ) ) throw new IllegalArgumentException ( "Reference sequences with wildcards not supported." ) ; int id = mapper . addReference ( sequence ) ; assert sequences . size ( ) == id ; sequences . add ( sequence ) ; return id ; } | Adds new reference sequence to the base of this mapper and returns index assigned to it . |
131,821 | public Motif < S > or ( Motif < S > other ) { if ( other . size != size ) throw new IllegalArgumentException ( "Supports only motifs with the same size as this." ) ; BitArray result = data . clone ( ) ; result . or ( other . data ) ; return new Motif < > ( alphabet , size , result ) ; } | Returns per - position or of two motifs . |
131,822 | public static Alignment < NucleotideSequence > alignGlobal ( final AlignmentScoring < NucleotideSequence > scoring , final NucleotideSequence seq1 , final NucleotideSequence seq2 , final int offset1 , final int length1 , final int offset2 , final int length2 , final int width ) { if ( scoring instanceof AffineGapAlignm... | Classical Banded Alignment . |
131,823 | public static < S extends Sequence < S > > Alignment < S > alignGlobal ( AlignmentScoring < S > alignmentScoring , S seq1 , S seq2 ) { if ( alignmentScoring instanceof AffineGapAlignmentScoring ) return alignGlobalAffine ( ( AffineGapAlignmentScoring < S > ) alignmentScoring , seq1 , seq2 ) ; if ( alignmentScoring inst... | Performs global alignment |
131,824 | public static < S extends Sequence < S > > Alignment < S > alignLocal ( AlignmentScoring < S > alignmentScoring , S seq1 , S seq2 ) { if ( alignmentScoring instanceof AffineGapAlignmentScoring ) return alignLocalAffine ( ( AffineGapAlignmentScoring < S > ) alignmentScoring , seq1 , seq2 ) ; if ( alignmentScoring instan... | Performs local alignment |
131,825 | public void processAllChildren ( TObjectProcedure < Cluster < T > > procedure ) { if ( children == null ) return ; for ( Cluster < T > child : children ) { procedure . execute ( child ) ; child . processAllChildren ( procedure ) ; } } | do not process this cluster |
131,826 | public S getEmptySequence ( ) { if ( empty == null ) synchronized ( this ) { if ( empty == null ) empty = createBuilder ( ) . createAndDestroy ( ) ; } return empty ; } | Returns empty sequence singleton |
131,827 | public final S parse ( String string ) { SequenceBuilder < S > builder = createBuilder ( ) . ensureCapacity ( string . length ( ) ) ; for ( int i = 0 ; i < string . length ( ) ; ++ i ) { byte code = symbolToCode ( string . charAt ( i ) ) ; if ( code == - 1 ) throw new IllegalArgumentException ( "Letter \'" + string . c... | Parses string representation of sequence . |
131,828 | public boolean compatibleWith ( PipelineConfiguration oth ) { if ( oth == null ) return false ; if ( pipelineSteps . length != oth . pipelineSteps . length ) return false ; for ( int i = 0 ; i < pipelineSteps . length ; ++ i ) if ( ! pipelineSteps [ i ] . compatibleWith ( oth . pipelineSteps [ i ] ) ) return false ; re... | Whether configurations are fully compatible |
131,829 | public static PipelineConfiguration appendStep ( PipelineConfiguration history , List < String > inputFiles , ActionConfiguration configuration , AppVersionInfo versionInfo ) { LightFileDescriptor [ ] inputDescriptors = inputFiles . stream ( ) . map ( f -> LightFileDescriptor . calculate ( Paths . get ( f ) ) ) . toArr... | Appends a new pipeline step |
131,830 | public static PipelineConfiguration mkInitial ( List < String > inputFiles , ActionConfiguration configuration , AppVersionInfo versionInfo ) { LightFileDescriptor [ ] inputDescriptors = inputFiles . stream ( ) . map ( f -> LightFileDescriptor . calculate ( Paths . get ( f ) ) ) . toArray ( LightFileDescriptor [ ] :: n... | Creates initial history |
131,831 | public static < S extends Sequence < S > > Alignment < S > shiftIndelsAtHomopolymers ( Alignment < S > alignment ) { return new Alignment < > ( alignment . sequence1 , MutationsUtil . shiftIndelsAtHomopolymers ( alignment . sequence1 , alignment . sequence1Range . getFrom ( ) , alignment . mutations ) , alignment . seq... | Shifts indels to the left at homopolymer regions |
131,832 | public static int [ ] btopDecode ( String alignment , Alphabet alphabet ) { Matcher matcher = btopPattern . matcher ( alignment ) ; IntArrayList mutations = new IntArrayList ( ) ; int sPosition = 0 ; while ( matcher . find ( ) ) { String g = matcher . group ( ) ; if ( isPositiveInteger ( g ) ) sPosition += Integer . pa... | Decodes btop - encoded mutations . |
131,833 | public static MutationNt2AADescriptor [ ] nt2aaDetailed ( NucleotideSequence seq1 , Mutations < NucleotideSequence > mutations , TranslationParameters translationParameters , int maxShiftedTriplets ) { MutationsWitMapping mutationsWitMapping = nt2aaWithMapping ( seq1 , mutations , translationParameters , maxShiftedTrip... | Performs a comprehensive translation of mutations present in a nucleotide sequence to effective mutations in corresponding amino acid sequence . |
131,834 | public int convertPointToRelativePosition ( int absolutePosition ) { if ( absolutePosition < lower || absolutePosition >= upper ) throw new IllegalArgumentException ( "Position outside this range (" + absolutePosition + ")." ) ; if ( reversed ) return upper - 1 - absolutePosition ; else return absolutePosition - lower ... | Returns relative point position inside this range . |
131,835 | public int convertBoundaryToRelativePosition ( int absolutePosition ) { if ( absolutePosition < lower || absolutePosition > upper ) throw new IllegalArgumentException ( "Position outside this range (" + absolutePosition + ") this=" + this + "." ) ; if ( reversed ) return upper - absolutePosition ; else return absoluteP... | Returns relative boundary position inside this range . |
131,836 | @ SuppressWarnings ( "unchecked" ) public List < Range > without ( Range range ) { if ( ! intersectsWith ( range ) ) return Collections . singletonList ( this ) ; if ( upper <= range . upper ) return range . lower <= lower ? Collections . EMPTY_LIST : Collections . singletonList ( new Range ( lower , range . lower , re... | Subtract provided range and return list of ranges contained in current range and not intersecting with other range . |
131,837 | public int convertPointToAbsolutePosition ( int relativePosition ) { if ( relativePosition < 0 || relativePosition >= length ( ) ) throw new IllegalArgumentException ( "Relative position outside this range (" + relativePosition + ")." ) ; if ( reversed ) return upper - 1 - relativePosition ; else return relativePositio... | Converts relative point position to absolute position |
131,838 | public int convertBoundaryToAbsolutePosition ( int relativePosition ) { if ( relativePosition < 0 || relativePosition > length ( ) ) throw new IllegalArgumentException ( "Relative position outside this range (" + relativePosition + ")." ) ; if ( reversed ) return upper - relativePosition ; else return relativePosition ... | Converts relative boundary position to absolute position |
131,839 | public final void write ( byte [ ] data ) { if ( sendBinary ) { int prev = 0 ; for ( int i = 0 ; i < data . length ; i ++ ) { if ( data [ i ] == - 1 ) { rawWrite ( data , prev , i - prev ) ; send ( new byte [ ] { - 1 , - 1 } ) ; prev = i + 1 ; } } rawWrite ( data , prev , data . length - prev ) ; } else { for ( int i =... | Write data to the client escaping data if necessary or truncating it . The original buffer can be mutated if incorrect data is provided . |
131,840 | private void readFile ( ) { if ( historyFile . exists ( ) ) { try ( BufferedReader reader = new BufferedReader ( new FileReader ( historyFile ) ) ) { String line ; while ( ( line = reader . readLine ( ) ) != null ) push ( Parser . toCodePoints ( line ) ) ; } catch ( FileNotFoundException ignored ) { } catch ( IOExcepti... | Read specified history file to history buffer |
131,841 | private void writeFile ( ) throws IOException { historyFile . delete ( ) ; try ( FileWriter fw = new FileWriter ( historyFile ) ) { for ( int i = 0 ; i < size ( ) ; i ++ ) fw . write ( Parser . fromCodePoints ( get ( i ) ) + ( Config . getLineSeparator ( ) ) ) ; } if ( historyFilePermission != null ) { historyFile . se... | Write the content of the history buffer to file |
131,842 | private static boolean setVTMode ( ) { long console = GetStdHandle ( STD_OUTPUT_HANDLE ) ; int [ ] mode = new int [ 1 ] ; if ( Kernel32 . GetConsoleMode ( console , mode ) == 0 ) { return false ; } if ( Kernel32 . SetConsoleMode ( console , mode [ 0 ] | VIRTUAL_TERMINAL_PROCESSING ) == 0 ) { return false ; } return tru... | This allows to take benefit from Windows 10 + new features . |
131,843 | public static String formatDisplayCompactListTerminalString ( List < TerminalString > displayList , int termWidth ) { if ( displayList == null || displayList . size ( ) < 1 ) return "" ; if ( termWidth < 1 ) termWidth = 80 ; int numRows = 1 ; while ( ! canDisplayColumns ( displayList , numRows , termWidth ) && numRows ... | Format output to columns with flexible sizes and no redundant space between them |
131,844 | private static boolean canDisplayColumns ( List < TerminalString > displayList , int numRows , int terminalWidth ) { int numColumns = displayList . size ( ) / numRows ; if ( displayList . size ( ) % numRows > 0 ) { numColumns ++ ; } int [ ] columnSizes = calculateColumnSizes ( displayList , numColumns , numRows , termi... | Decides if it s possible to format provided Strings into calculated number of columns while the output will not exceed terminal width |
131,845 | public static String trimOptionName ( String word ) { if ( word . startsWith ( "--" ) ) return word . substring ( 2 ) ; else if ( word . startsWith ( "-" ) ) return word . substring ( 1 ) ; else return word ; } | remove leading dashes from word |
131,846 | public static String findStartsWithOperation ( List < ? extends CompleteOperation > coList ) { List < String > tmpList = new ArrayList < > ( ) ; for ( CompleteOperation co : coList ) { String s = findStartsWith ( co . getFormattedCompletionCandidates ( ) ) ; if ( s . length ( ) > 0 ) tmpList . add ( s ) ; else return "... | If there is any common start string in the completion list return it |
131,847 | public static String findCurrentWordFromCursor ( String text , int cursor ) { if ( text . length ( ) <= cursor + 1 ) { if ( text . contains ( SPACE ) ) { if ( doWordContainEscapedSpace ( text ) ) { if ( doWordContainOnlyEscapedSpace ( text ) ) return switchEscapedSpacesToSpacesInWord ( text ) ; else { return switchEsca... | Return the word connected to cursor the word ends at cursor position . Note that cursor position starts at 0 |
131,848 | public static String findEscapedSpaceWordCloseToEnd ( String text ) { int index ; String originalText = text ; while ( ( index = text . lastIndexOf ( SPACE ) ) > - 1 ) { if ( index > 0 && text . charAt ( index - 1 ) == BACK_SLASH ) { text = text . substring ( 0 , index - 1 ) ; } else return originalText . substring ( i... | Search backwards for a non - escaped space and only return work containing non - escaped space |
131,849 | public static boolean doesStringContainOpenQuote ( String text ) { boolean doubleQuote = false ; boolean singleQuote = false ; boolean escapedByBackSlash = false ; if ( commentPattern . matcher ( text ) . find ( ) ) return false ; for ( int i = 0 ; i < text . length ( ) ; i ++ ) { if ( text . charAt ( i ) == BACK_SLASH... | Check if a string contain openBlocking quotes . Escaped quotes does not count . |
131,850 | public static int findNumberOfSpacesInWord ( String word ) { int count = 0 ; for ( int i = 0 ; i < word . length ( ) ; i ++ ) if ( word . charAt ( i ) == SPACE_CHAR && ( i == 0 || word . charAt ( i - 1 ) != BACK_SLASH ) ) count ++ ; return count ; } | find number of spaces in the given word . escaped spaces are not counted |
131,851 | public static String trimInFront ( String buffer ) { int count = 0 ; for ( int i = 0 ; i < buffer . length ( ) ; i ++ ) { if ( buffer . charAt ( i ) == SPACE_CHAR ) count ++ ; else break ; } if ( count > 0 ) return buffer . substring ( count ) ; else return buffer ; } | Only trim space in front of the word |
131,852 | public static int [ ] mapQuoteKeys ( String keys ) { if ( keys != null && keys . length ( ) > 1 ) return mapKeys ( keys . substring ( 1 ) ) ; else return null ; } | Parse key mapping lines that start with |
131,853 | public static int [ ] printAnsi ( char ... out ) { int [ ] ansi = new int [ out . length + 2 ] ; ansi [ 0 ] = 27 ; ansi [ 1 ] = '[' ; int counter = 0 ; for ( char anOut : out ) { if ( anOut == '\t' ) { Arrays . fill ( ansi , counter + 2 , counter + 2 + TAB , ' ' ) ; counter += TAB - 1 ; } else ansi [ counter + 2 ] = an... | Return a ansified string based on param |
131,854 | @ SuppressWarnings ( "unchecked" ) public static < T extends Annotation > T createAnnotation ( final Class < T > clazz ) { return ( T ) Proxy . newProxyInstance ( clazz . getClassLoader ( ) , new Class [ ] { clazz , Annotation . class } , new SimpleAnnoInvocationHandler ( clazz ) ) ; } | Create an annotation instance from annotation class . |
131,855 | static int hashMember ( String name , Object value ) { int part1 = name . hashCode ( ) * 127 ; if ( value . getClass ( ) . isArray ( ) ) { return part1 ^ arrayMemberHash ( value . getClass ( ) . getComponentType ( ) , value ) ; } if ( value instanceof Annotation ) { return part1 ^ hashCode ( ( Annotation ) value ) ; } ... | Helper method for generating a hash code for a member of an annotation . |
131,856 | private BeanSpec beanSpecOf ( Field field , Type genericType ) { return of ( field , genericType , injector ) ; } | find the beanspec of a field with generic type |
131,857 | private void storeTagAnnotation ( Annotation anno ) { Class < ? extends Annotation > annoType = anno . annotationType ( ) ; Annotation [ ] tags = annoType . getAnnotations ( ) ; for ( Annotation tag : tags ) { Class < ? extends Annotation > tagType = tag . annotationType ( ) ; if ( WAIVE_TAG_TYPES . contains ( tagType ... | Walk through anno s tag annotations |
131,858 | public OpenStackRequest < R > queryString ( String queryString ) { if ( queryString != null ) { String [ ] params = queryString . split ( "&" ) ; for ( String param : params ) { String [ ] s = param . split ( "=" ) ; if ( s [ 0 ] != null && s [ 1 ] != null ) { queryParam ( s [ 0 ] , s [ 1 ] ) ; } } } return this ; } | This method will parse the query string which is a collection of name value pairs and put then in queryParam hash map |
131,859 | public EvacuateAction evacuate ( String serverId , String host ) { return evacuate ( serverId , host , null , null ) ; } | Evacuates the server to a new host . The caller can supply the host name or id . |
131,860 | private SSLContext getSSLContext ( ) throws NoSuchAlgorithmException , KeyManagementException { SSLContext sslContext = SSLContext . getInstance ( "SSL" ) ; sslContext . init ( null , new TrustManager [ ] { new X509TrustManager ( ) { public void checkClientTrusted ( X509Certificate [ ] certs , String authType ) { } pub... | This SSLContext is used only when the protocol is HTTPS AND a trusted hosts list has been provided . In that case this SSLContext accepts all certificates whether they are expired or not and regardless of the CA that issued them . |
131,861 | public RetentionStrategy getRetentionStrategyCopy ( ) { if ( retentionStrategy instanceof DockerOnceRetentionStrategy ) { DockerOnceRetentionStrategy onceRetention = ( DockerOnceRetentionStrategy ) retentionStrategy ; return new DockerOnceRetentionStrategy ( onceRetention . getIdleMinutes ( ) ) ; } return retentionStra... | tmp fix for terminating boolean caching |
131,862 | @ SuppressWarnings ( "unused" ) public Object readResolve ( ) { if ( configVersion < 1 ) { if ( isNull ( nodeProperties ) ) nodeProperties = new ArrayList < > ( ) ; nodeProperties . add ( new DockerNodeProperty ( "DOCKER_CONTAINER_ID" , "JENKINS_CLOUD_ID" , "DOCKER_HOST" ) ) ; configVersion = 1 ; } if ( mode == null ) ... | Initializes data structure that we don t persist . |
131,863 | public DockerComputerLauncher getPreparedLauncher ( String cloudId , DockerSlaveTemplate template , InspectContainerResponse containerInspectResponse ) { final DockerComputerJNLPLauncher cloneJNLPlauncher = new DockerComputerJNLPLauncher ( ) ; cloneJNLPlauncher . setLaunchTimeout ( getLaunchTimeout ( ) ) ; cloneJNLPlau... | Clone object . |
131,864 | public String runContainer ( DockerSlaveTemplate slaveTemplate ) throws DockerException , IOException { final DockerCreateContainer dockerCreateContainer = slaveTemplate . getDockerContainerLifecycle ( ) . getCreateContainer ( ) ; final String image = slaveTemplate . getDockerContainerLifecycle ( ) . getImage ( ) ; Cre... | Run docker container for given template |
131,865 | private void appendContainerConfig ( DockerSlaveTemplate slaveTemplate , CreateContainerCmd containerConfig ) { Map < String , String > labels = containerConfig . getLabels ( ) ; if ( labels == null ) labels = new HashMap < > ( ) ; labels . put ( DOCKER_CLOUD_LABEL , getDisplayName ( ) ) ; labels . put ( DOCKER_TEMPLAT... | Cloud specific container config options |
131,866 | private OsType determineOsType ( String imageId ) { InspectImageResponse ir = getClient ( ) . inspectImageCmd ( imageId ) . exec ( ) ; if ( "linux" . equalsIgnoreCase ( ir . getOs ( ) ) ) { LOG . trace ( "Detected LINUX operating system for image: {}" , imageId ) ; return OsType . LINUX ; } else if ( "windows" . equals... | Determine the operating system associated with an image . |
131,867 | public int countCurrentDockerSlaves ( final DockerSlaveTemplate template ) throws Exception { int count = 0 ; List < Container > containers = getClient ( ) . listContainersCmd ( ) . exec ( ) ; for ( Container container : containers ) { final Map < String , String > labels = container . getLabels ( ) ; if ( labels . con... | Counts the number of instances in Docker currently running that are using the specified template . |
131,868 | private synchronized boolean addProvisionedSlave ( DockerSlaveTemplate template ) throws Exception { final DockerContainerLifecycle dockerCreateContainer = template . getDockerContainerLifecycle ( ) ; String dockerImageName = dockerCreateContainer . getImage ( ) ; int templateCapacity = template . getMaxCapacity ( ) ; ... | Check not too many already running . |
131,869 | public static List < Descriptor < ComputerLauncher > > getDockerComputerLauncherDescriptors ( ) { List < Descriptor < ComputerLauncher > > launchers = new ArrayList < > ( ) ; launchers . add ( getInstance ( ) . getDescriptor ( DockerComputerSSHLauncher . class ) ) ; launchers . add ( getInstance ( ) . getDescriptor ( D... | Only this plugin specific launchers . |
131,870 | public static List < Descriptor < RetentionStrategy < ? > > > getDockerRetentionStrategyDescriptors ( ) { List < Descriptor < RetentionStrategy < ? > > > strategies = new ArrayList < > ( ) ; strategies . add ( getInstance ( ) . getDescriptor ( DockerOnceRetentionStrategy . class ) ) ; strategies . add ( getInstance ( )... | Only this plugin specific strategies . |
131,871 | public static List < DockerCloud > getAllDockerClouds ( ) { return getInstance ( ) . clouds . stream ( ) . filter ( Objects :: nonNull ) . filter ( DockerCloud . class :: isInstance ) . map ( cloud -> ( DockerCloud ) cloud ) . collect ( Collectors . toList ( ) ) ; } | Get the list of Docker servers . |
131,872 | public RestartPolicy getRestartPolicy ( ) { if ( isNull ( policyName ) ) return null ; return RestartPolicy . parse ( String . format ( "%s:%d" , policyName . toString ( ) . toLowerCase ( Locale . ENGLISH ) . replace ( "_" , "-" ) , getMaximumRetryCount ( ) ) ) ; } | runtime ABI dependency on docker - java |
131,873 | public static String resolveVar ( String var , Run run , TaskListener taskListener ) { String resolvedVar = var ; try { final EnvVars envVars = run . getEnvironment ( taskListener ) ; resolvedVar = envVars . expand ( var ) ; } catch ( IOException | InterruptedException e ) { LOG . warn ( "Can't resolve variable " + var... | Resolve on remoting side during execution . Because node may have some specific node vars . |
131,874 | protected CliPort getCliTcpPort ( String jenkinsAddr ) throws IOException { URL jenkinsUrl = new URL ( jenkinsAddr ) ; if ( jenkinsUrl . getHost ( ) == null || jenkinsUrl . getHost ( ) . length ( ) == 0 ) { throw new IOException ( "Invalid URL: " + jenkinsAddr ) ; } URLConnection head = jenkinsUrl . openConnection ( ) ... | If the server advertises CLI endpoint returns its location . |
131,875 | public void close ( ) throws IOException , InterruptedException { channel . close ( ) ; channel . join ( ) ; if ( ownsPool ) pool . shutdown ( ) ; for ( Closeable c : closables ) c . close ( ) ; } | Shuts down the channel and closes the underlying connection . |
131,876 | public void upgrade ( ) { ByteArrayOutputStream out = new ByteArrayOutputStream ( ) ; if ( execute ( Arrays . asList ( "groovy" , "=" ) , new ByteArrayInputStream ( "hudson.remoting.Channel.current().setRestricted(false)" . getBytes ( defaultCharset ( ) ) ) , out , out ) != 0 ) { throw new SecurityException ( out . toS... | Attempts to lift the security restriction on the underlying channel . This requires the administer privilege on the server . |
131,877 | protected static EnvVars getEnvVars ( Run run , TaskListener listener ) throws IOException , InterruptedException { final EnvVars envVars = run . getCharacteristicEnvVars ( ) ; for ( EnvironmentContributor ec : EnvironmentContributor . all ( ) . reverseView ( ) ) { ec . buildEnvironmentFor ( run . getParent ( ) , envVa... | Return all job related vars without executor vars . I . e . slave is running in osx but docker image for shell is linux . |
131,878 | protected static void insertLabels ( CreateContainerCmd containerConfig , Run run ) { Map < String , String > labels = containerConfig . getLabels ( ) ; if ( labels == null ) labels = new HashMap < > ( ) ; labels . put ( "YAD_PLUGIN" , DockerShellStep . class . getName ( ) ) ; labels . put ( "JENKINS_JOB_BASE_NAME" , r... | Append some tags to identify who created this container . |
131,879 | public void setEnabled ( boolean enabled ) { final ExtensionList < NodeProvisioner . Strategy > strategies = lookup ( NodeProvisioner . Strategy . class ) ; DockerProvisioningStrategy strategy = strategies . get ( DockerProvisioningStrategy . class ) ; if ( isNull ( strategy ) ) { LOG . debug ( "YAD strategy was null, ... | For groovy . |
131,880 | public static < T extends RingPosition < T > > boolean isWrapAround ( T left , T right ) { return left . compareTo ( right ) >= 0 ; } | Tells if the given range is a wrap around . |
131,881 | private ArrayList < Range < T > > subtractContained ( Range < T > contained ) { ArrayList < Range < T > > difference = new ArrayList < Range < T > > ( 2 ) ; if ( ! left . equals ( contained . left ) ) difference . add ( new Range < T > ( left , contained . left , partitioner ) ) ; if ( ! right . equals ( contained . ri... | Subtracts a portion of this range . |
131,882 | private static < T extends RingPosition < T > > List < Range < T > > deoverlap ( List < Range < T > > ranges ) { if ( ranges . isEmpty ( ) ) return ranges ; List < Range < T > > output = new ArrayList < Range < T > > ( ) ; Iterator < Range < T > > iter = ranges . iterator ( ) ; Range < T > current = iter . next ( ) ; @... | Given a list of unwrapped ranges sorted by left position return an equivalent list of ranges but with no overlapping ranges . |
131,883 | public static Range < RowPosition > makeRowRange ( Token left , Token right , IPartitioner partitioner ) { return new Range < RowPosition > ( left . maxKeyBound ( partitioner ) , right . maxKeyBound ( partitioner ) , partitioner ) ; } | Compute a range of keys corresponding to a given range of token . |
131,884 | public final int compareTo ( final Composite that ) { if ( isStatic ( ) != that . isStatic ( ) ) { if ( isEmpty ( ) ) return that . isEmpty ( ) ? 0 : - 1 ; if ( that . isEmpty ( ) ) return 1 ; return isStatic ( ) ? - 1 : 1 ; } int size = size ( ) ; int size2 = that . size ( ) ; int minSize = Math . min ( size , size2 )... | requires isByteOrderComparable to be true . Compares the name components only ; ; may need to compare EOC etc still |
131,885 | private ColumnFamily processModifications ( ColumnFamily changesCF ) { ColumnFamilyStore cfs = Keyspace . open ( getKeyspaceName ( ) ) . getColumnFamilyStore ( changesCF . id ( ) ) ; ColumnFamily resultCF = changesCF . cloneMeShallow ( ) ; List < CounterUpdateCell > counterUpdateCells = new ArrayList < > ( changesCF . ... | Replaces all the CounterUpdateCell - s with updated regular CounterCell - s |
131,886 | private int getCurrentValuesFromCache ( List < CounterUpdateCell > counterUpdateCells , ColumnFamilyStore cfs , ClockAndCount [ ] currentValues ) { int cacheMisses = 0 ; for ( int i = 0 ; i < counterUpdateCells . size ( ) ; i ++ ) { ClockAndCount cached = cfs . getCachedCounter ( key ( ) , counterUpdateCells . get ( i ... | Returns the count of cache misses . |
131,887 | private void getCurrentValuesFromCFS ( List < CounterUpdateCell > counterUpdateCells , ColumnFamilyStore cfs , ClockAndCount [ ] currentValues ) { SortedSet < CellName > names = new TreeSet < > ( cfs . metadata . comparator ) ; for ( int i = 0 ; i < currentValues . length ; i ++ ) if ( currentValues [ i ] == null ) nam... | Reads the missing current values from the CFS . |
131,888 | public static Function makeToBlobFunction ( AbstractType < ? > fromType ) { String name = fromType . asCQL3Type ( ) + "asblob" ; return new AbstractFunction ( name , BytesType . instance , fromType ) { public ByteBuffer execute ( List < ByteBuffer > parameters ) { return parameters . get ( 0 ) ; } } ; } | bytes internally . They only trick the type system . |
131,889 | public void run ( ) { outer : while ( run || ! queue . isEmpty ( ) ) { List < ByteBuffer > bindVariables ; try { bindVariables = queue . take ( ) ; } catch ( InterruptedException e ) { continue ; } Iterator < InetAddress > iter = endpoints . iterator ( ) ; while ( true ) { try { int i = 0 ; int itemId = preparedStateme... | Loops collecting cql binded variable values from the queue and sending to Cassandra |
131,890 | private int preparedStatement ( Cassandra . Client client ) { Integer itemId = preparedStatements . get ( client ) ; if ( itemId == null ) { CqlPreparedResult result ; try { result = client . prepare_cql3_query ( ByteBufferUtil . bytes ( cql ) , Compression . NONE ) ; } catch ( InvalidRequestException e ) { throw new R... | get prepared statement id from cache otherwise prepare it from Cassandra server |
131,891 | public void complete ( ) { completeTree ( ) ; StageManager . getStage ( Stage . ANTI_ENTROPY ) . execute ( this ) ; if ( logger . isDebugEnabled ( ) ) { logger . debug ( "Validated {} partitions for {}. Partitions per leaf are:" , validated , desc . sessionId ) ; tree . histogramOfRowCountPerLeaf ( ) . log ( logger ) ... | Registers the newly created tree for rendezvous in Stage . ANTIENTROPY . |
131,892 | public void fail ( ) { logger . error ( "Failed creating a merkle tree for {}, {} (see log for details)" , desc , initiator ) ; MessagingService . instance ( ) . sendOneWay ( new ValidationComplete ( desc ) . createMessage ( ) , initiator ) ; } | Called when some error during the validation happened . This sends RepairStatus to inform the initiator that the validation has failed . The actual reason for failure should be looked up in the log of the host calling this function . |
131,893 | public void run ( ) { if ( ! initiator . equals ( FBUtilities . getBroadcastAddress ( ) ) ) logger . info ( String . format ( "[repair #%s] Sending completed merkle tree to %s for %s/%s" , desc . sessionId , initiator , desc . keyspace , desc . columnFamily ) ) ; MessagingService . instance ( ) . sendOneWay ( new Valid... | Called after the validation lifecycle to respond with the now valid tree . Runs in Stage . ANTIENTROPY . |
131,894 | boolean maybeSchedule ( ) { if ( pool . spinningCount . get ( ) > 0 || ! takeWorkPermit ( true ) ) return false ; pool . schedule ( new Work ( this ) ) ; return true ; } | will self - assign to it in the immediate future |
131,895 | void returnWorkPermit ( ) { while ( true ) { long current = permits . get ( ) ; int workPermits = workPermits ( current ) ; if ( permits . compareAndSet ( current , updateWorkPermits ( current , workPermits + 1 ) ) ) return ; } } | gives up a work permit |
131,896 | private static boolean areTokensValid ( Token ... tokens ) { for ( Token token : tokens ) { if ( ! isTokenValid ( token ) ) return false ; } return true ; } | Checks if the specified tokens are valid . |
131,897 | private static String highlightToken ( String line , Token token ) { String newLine = insertChar ( line , getLastCharPositionInLine ( token ) , ']' ) ; return insertChar ( newLine , token . getCharPositionInLine ( ) , '[' ) ; } | Puts the specified token within square brackets . |
131,898 | public void run ( ) { differences . addAll ( MerkleTree . difference ( r1 . tree , r2 . tree ) ) ; String format = String . format ( "[repair #%s] Endpoints %s and %s %%s for %s" , desc . sessionId , r1 . endpoint , r2 . endpoint , desc . columnFamily ) ; if ( differences . isEmpty ( ) ) { logger . info ( String . form... | Compares our trees and triggers repairs for any ranges that mismatch . |
131,899 | private InetAddress minEndpoint ( ) { return FBUtilities . compareUnsigned ( r1 . endpoint . getAddress ( ) , r2 . endpoint . getAddress ( ) ) < 0 ? r1 . endpoint : r2 . endpoint ; } | So we just order endpoint deterministically to simplify this |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.