idx int64 0 41.2k | question stringlengths 74 4.21k | target stringlengths 5 888 |
|---|---|---|
13,100 | private void readHeader ( RandomAccessInputStream raf ) throws IOException { raf . seek ( HEAD_LOCATION ) ; byte [ ] head = new byte [ HEAD_SIZE ] ; if ( raf . read ( head ) != HEAD_SIZE ) { throw new IOException ( "Error encountered reading id3v2 header" ) ; } majorVersion = ( int ) head [ 3 ] ; if ( majorVersion <= N... | Extracts the information from the header . |
13,101 | public byte [ ] getBytes ( ) { byte [ ] b = new byte [ HEAD_SIZE ] ; int bytesCopied = 0 ; System . arraycopy ( Helpers . getBytesFromString ( TAG_START , TAG_START . length ( ) , ENC_TYPE ) , 0 , b , 0 , TAG_START . length ( ) ) ; bytesCopied += TAG_START . length ( ) ; b [ bytesCopied ++ ] = ( byte ) majorVersion ; b... | Return an array of bytes representing the header . This can be used to easily write the header to a file . |
13,102 | private byte getFlagByte ( ) { byte ret = 0 ; if ( unsynchronisation ) ret |= 0x80 ; if ( extended ) ret |= 0x40 ; if ( experimental ) ret |= 0x20 ; if ( footer ) ret |= 0x10 ; return ret ; } | A helper function for the getBytes function that returns a byte with the proper flags set . |
13,103 | public double module ( ) { double v = 0 ; for ( int i = 0 ; i < vector . length ; i ++ ) { v = Math . pow ( vector [ i ] , 2 ) ; } return Math . sqrt ( v ) ; } | Calculates the module of this vector |
13,104 | public MyVector normalize ( ) { double vmodule = module ( ) ; double [ ] associatedVector = new double [ vector . length ] ; for ( int i = 0 ; i < vector . length ; i ++ ) { associatedVector [ i ] = ( 1 / vmodule ) * vector [ i ] ; } return new MyVector ( associatedVector ) ; } | Calculates the associated normalized Vector of this Vector |
13,105 | public Iterator < Object > valueIterator ( ) { final Iterator < String > iter = keyIterator ( ) ; return new Iterator < Object > ( ) { public boolean hasNext ( ) { return iter . hasNext ( ) ; } public Object next ( ) { String key = iter . next ( ) ; return get ( key ) ; } public void remove ( ) { throw new UnsupportedO... | Convenience method for getting an iterator over the values . |
13,106 | public BeanInvoker getReadInvoker ( String name ) { BeanInvoker invoker ; if ( readInvokers . containsKey ( name ) ) { invoker = readInvokers . get ( name ) ; } else { invoker = getInvoker ( readHandleType . get ( name ) , name ) ; readInvokers . put ( name , invoker ) ; } return invoker ; } | Returns the accessor for the property with the given name . |
13,107 | public BeanInvoker getWriteInvoker ( String name ) { BeanInvoker invoker ; if ( writeInvokers . containsKey ( name ) ) { invoker = writeInvokers . get ( name ) ; } else { invoker = getInvoker ( HandleType . SET , name ) ; writeInvokers . put ( name , invoker ) ; } return invoker ; } | Returns the mutator for the property with the given name . |
13,108 | public static AsyncWork < XMLStreamReader , Exception > start ( IO . Readable . Buffered io , int charactersBufferSize , int maxBuffers ) { AsyncWork < XMLStreamReader , Exception > result = new AsyncWork < > ( ) ; new Task . Cpu . FromRunnable ( "Start reading XML " + io . getSourceDescription ( ) , io . getPriority (... | Utility method that initialize a XMLStreamReader initialize it and return an AsyncWork which is unblocked when characters are available to be read . |
13,109 | public void next ( ) throws XMLException , IOException { reset ( ) ; char c ; if ( ( c = stream . read ( ) ) == '<' ) readTag ( ) ; else readChars ( c ) ; } | Move forward to the next event . |
13,110 | protected boolean evaluateCondition ( String script , Log log ) throws EnforcerRuleException { Boolean evaluation = Boolean . FALSE ; try { evaluation = ( Boolean ) bsh . eval ( script ) ; log . debug ( "Echo evaluating : " + evaluation ) ; } catch ( EvalError ex ) { throw new EnforcerRuleException ( "Couldn't evaluate... | Evaluate expression using Beanshell . |
13,111 | public void configurationSave ( Properties props ) { ModConfigPanel configPanel = ( ModConfigPanel ) getConfigPanel ( ) ; props . setProperty ( PROPERTY_PLAYER_FREQUENCY , configPanel . getPlayerSetUp_SampleRate ( ) . getSelectedItem ( ) . toString ( ) ) ; props . setProperty ( PROPERTY_PLAYER_MSBUFFERSIZE , configPane... | Get the values from the gui and store them into the main Propertys |
13,112 | public void set_chip_model ( chip_model model ) { if ( model == chip_model . MOS6581 ) { wave__ST = Wave . wave6581__ST ; wave_P_T = Wave . wave6581_P_T ; wave_PS_ = Wave . wave6581_PS_ ; wave_PST = Wave . wave6581_PST ; } else { wave__ST = Wave . wave8580__ST ; wave_P_T = Wave . wave8580_P_T ; wave_PS_ = Wave . wave85... | Set chip model . |
13,113 | public void writeCONTROL_REG ( int control ) { waveform = ( control >> 4 ) & 0x0f ; ring_mod = control & 0x04 ; sync = control & 0x02 ; int test_next = control & 0x08 ; if ( ANTTI_LANKILA_PATCH ) { if ( test_next != 0 && test == 0 ) { accumulator = 0 ; int bit19 = ( shift_register >> 19 ) & 1 ; shift_register = ( shift... | Register functions . |
13,114 | public void reset ( ) { accumulator = 0 ; if ( ANTTI_LANKILA_PATCH ) shift_register = 0x7ffffc ; else shift_register = 0x7ffff8 ; freq = 0 ; pw = 0 ; test = 0 ; ring_mod = 0 ; sync = 0 ; msb_rising = false ; } | SID reset . |
13,115 | public void clock ( ) { if ( test != 0 ) { return ; } int accumulator_prev = accumulator ; accumulator += freq ; accumulator &= 0xffffff ; msb_rising = ! ( ( accumulator_prev & 0x800000 ) != 0 ) && ( ( accumulator & 0x800000 ) != 0 ) ; if ( ! ( ( accumulator_prev & 0x080000 ) != 0 ) && ( ( accumulator & 0x080000 ) != 0... | SID clocking - 1 cycle . |
13,116 | public void clock ( int delta_t ) { if ( test != 0 ) { return ; } int accumulator_prev = accumulator ; int delta_accumulator = delta_t * freq ; accumulator += delta_accumulator ; accumulator &= 0xffffff ; msb_rising = ! ( ( accumulator_prev & 0x800000 ) != 0 ) && ( ( accumulator & 0x800000 ) != 0 ) ; int shift_period =... | SID clocking - delta_t cycles . |
13,117 | private void filterRelevantFields ( List < Field > fields ) { Iterator < Field > fieldIterator = fields . iterator ( ) ; while ( fieldIterator . hasNext ( ) ) { Field field = fieldIterator . next ( ) ; if ( Modifier . isStatic ( field . getModifiers ( ) ) ) { fieldIterator . remove ( ) ; } } } | Filters out fields for which we don t want matcher methods created . This currently only excludes static fields . |
13,118 | public void setLen ( int len ) { if ( len > data . length ) { len = data . length ; } this . len = len ; } | Set the length of this ByteData object without re - allocating the underlying array . It is not possible to set the length larger than the underlying byte array . |
13,119 | public void initializeMixer ( ) { calculateGlobalTuning ( ) ; frequencyTableType = mod . getFrequencyTable ( ) ; currentTempo = mod . getTempo ( ) ; currentBPM = mod . getBPMSpeed ( ) ; globalVolume = mod . getBaseVolume ( ) ; globalVolumSlideValue = 0 ; useFastSlides = mod . doFastSlides ( ) ; samplePerTicks = calcula... | Call this first! |
13,120 | protected long cutOffToFrequency ( long cutOff , int flt_modifier , boolean isExFilterRange ) { double fac = ( isExFilterRange ) ? ( 20.0d * 512.0d ) : ( 24.0d * 512.0d ) ; double fc = 110.0d * Math . pow ( 2.0d , 0.25d + ( ( double ) ( cutOff * ( flt_modifier + 256 ) ) ) / fac ) ; long freq = ( long ) fc ; if ( freq <... | calc the cut off |
13,121 | protected void setupChannelFilter ( ChannelMemory aktMemo , boolean bReset , int flt_modifier ) { double cutOff = ( double ) ( ( aktMemo . nCutOff + aktMemo . nCutSwing ) & 0x7F ) ; double resonance = ( double ) ( ( aktMemo . nResonance + aktMemo . nResSwing ) & 0x7F ) ; double fc = cutOffToFrequency ( ( long ) cutOff ... | Simple 2 - poles resonant filter |
13,122 | protected void resetInstrument ( ChannelMemory aktMemo ) { aktMemo . autoVibratoTablePos = aktMemo . autoVibratoAmplitude = aktMemo . currentDirection = aktMemo . currentTuningPos = aktMemo . currentSamplePos = 0 ; aktMemo . volEnvPos = aktMemo . panEnvPos = aktMemo . pitchEnvPos = - 1 ; aktMemo . filterOn = aktMemo . ... | Set all index values back to zero! |
13,123 | protected void doRowEvent ( ) { final PatternRow patternRow = currentPattern . getPatternRow ( currentRow ) ; if ( patternRow == null ) return ; patternRow . setRowPlayed ( ) ; final int nChannels = mod . getNChannels ( ) ; for ( int c = 0 ; c < nChannels ; c ++ ) { final PatternElement element = patternRow . getPatter... | Do the Events of a new Row! |
13,124 | protected boolean doTickEvents ( ) { if ( doFadeOut ) { fadeOutValue -= fadeOutSub ; if ( fadeOutValue <= 0 ) return true ; } final int nChannels = maxChannels ; if ( patternTicksDelayCount > 0 ) { for ( int c = 0 ; c < nChannels ; c ++ ) { final ChannelMemory aktMemo = channelMemory [ c ] ; processEffekts ( true , akt... | Do the events during a Tick . |
13,125 | protected void fitIntoLoops ( final ChannelMemory actMemo ) { final Sample ins = actMemo . currentSample ; if ( actMemo . currentDirection >= 0 ) { actMemo . currentTuningPos += actMemo . currentTuning ; if ( actMemo . currentTuningPos >= Helpers . SHIFT_ONE ) { actMemo . currentSamplePos += ( actMemo . currentTuningPo... | Add current speed to samplepos and fit currentSamplePos into loop values or signal Sample finished |
13,126 | private void mixChannelIntoBuffers ( final int [ ] leftBuffer , final int [ ] rightBuffer , final int startIndex , final int endIndex , final ChannelMemory actMemo ) { for ( int i = startIndex ; i < endIndex ; i ++ ) { long sample = actMemo . currentSample . getInterpolatedSample ( doISP , actMemo . currentSamplePos , ... | Fill the buffers with channel data |
13,127 | public static XslTransformer getTransformer ( Source source ) throws TransformerConfigurationException { if ( source == null ) { throw new IllegalArgumentException ( "source is null" ) ; } XslTransformer transformer = new XslTransformer ( ) ; transformer . transformerImpl = transformerFactory . newTransformer ( source ... | Get a wrapped XSL transformer instance for supplied stylesheet source . |
13,128 | public static XslTransformer getTransformer ( File xslFile ) throws TransformerConfigurationException { if ( xslFile == null ) { throw new IllegalArgumentException ( "xslFile is null" ) ; } return getTransformer ( new StreamSource ( xslFile ) ) ; } | Get a wrapped XSL transformer instance for supplied stylesheet file . |
13,129 | public void transform ( Source xmlSource , URIResolver uriResolver , ErrorListener errorListener , Result outputTarget ) throws TransformerException { if ( xmlSource == null ) { throw new IllegalArgumentException ( "xmlSource is null" ) ; } if ( outputTarget == null ) { throw new IllegalArgumentException ( "outputTarge... | Transform XML source using the wrapped XSL transformer of this instance and output to supplied target . |
13,130 | public byte [ ] transform ( Source xmlSource , URIResolver uriResolver , ErrorListener errorListener ) throws TransformerException { if ( xmlSource == null ) { throw new IllegalArgumentException ( "xmlSource is null" ) ; } ByteArrayOutputStream out = new ByteArrayOutputStream ( ) ; StreamResult result = new StreamResul... | Transform XML source using the wrapped XSL transformer of this instance and return a byte array of the result . |
13,131 | public void execute ( String statement ) throws SQLException { if ( logger . isDebugEnabled ( ) ) { logger . debug ( "Executing SQL statement [" + statement + "]" ) ; } Connection connection = null ; Statement stm = null ; try { connection = ds . getConnection ( ) ; stm = connection . createStatement ( ) ; stm . execut... | Execute a statement . |
13,132 | public int queryForInt ( String sql ) throws SQLException { Number number = queryForObject ( sql , Integer . class ) ; return ( number != null ? number . intValue ( ) : 0 ) ; } | Execute a query that returns a single int field . |
13,133 | public < T > T queryForObject ( String sql , Class < T > requiredType ) throws SQLException { return queryForObject ( sql , getSingleColumnRowMapper ( requiredType ) ) ; } | Execute a query that returns a single value that can be cast to the given type . |
13,134 | public void skipBitsNoCRC ( int bits ) throws IOException { if ( bits == 0 ) return ; int bitsToAlign = getBit & 7 ; if ( bitsToAlign != 0 ) { int bitsToTake = Math . min ( 8 - bitsToAlign , bits ) ; readRawUInt ( bitsToTake ) ; bits -= bitsToTake ; } int bytesNeeded = bits / 8 ; if ( bytesNeeded > 0 ) { readByteBlockA... | skip over bits in bit stream without updating CRC . |
13,135 | public int readBit ( ) throws IOException { while ( true ) { if ( availBits > 0 ) { int val = ( ( buffer [ getByte ] & ( 0x80 >> getBit ) ) != 0 ) ? 1 : 0 ; getBit ++ ; if ( getBit == BITS_PER_BLURB ) { readCRC16 = CRC16 . update ( buffer [ getByte ] , readCRC16 ) ; getByte ++ ; getBit = 0 ; } availBits -- ; totalBitsR... | read a single bit . |
13,136 | public int peekBitToInt ( int val , int bit ) throws IOException { while ( true ) { if ( bit < availBits ) { val <<= 1 ; if ( ( getBit + bit ) >= BITS_PER_BLURB ) { bit = ( getBit + bit ) % BITS_PER_BLURB ; val |= ( ( buffer [ getByte + 1 ] & ( 0x80 >> bit ) ) != 0 ) ? 1 : 0 ; } else { val |= ( ( buffer [ getByte ] & (... | peek at the next bit and add it to the input integer . The bits of the input integer are shifted left and the read bit is placed into bit 0 . |
13,137 | public int readRawUInt ( int bits ) throws IOException { int val = 0 ; for ( int i = 0 ; i < bits ; i ++ ) { val = readBitToInt ( val ) ; } return val ; } | read bits into an unsigned integer . |
13,138 | public int peekRawUInt ( int bits ) throws IOException { int val = 0 ; for ( int i = 0 ; i < bits ; i ++ ) { val = peekBitToInt ( val , i ) ; } return val ; } | peek at bits into an unsigned integer without advancing the input stream . |
13,139 | public int readRawInt ( int bits ) throws IOException { if ( bits == 0 ) { return 0 ; } int uval = 0 ; for ( int i = 0 ; i < bits ; i ++ ) { uval = readBitToInt ( uval ) ; } int val ; int bitsToleft = 32 - bits ; if ( bitsToleft != 0 ) { uval <<= bitsToleft ; val = uval ; val >>= bitsToleft ; } else { val = uval ; } re... | read bits into a signed integer . |
13,140 | public long readRawULong ( int bits ) throws IOException { long val = 0 ; for ( int i = 0 ; i < bits ; i ++ ) { val = readBitToLong ( val ) ; } return val ; } | read bits into an unsigned long . |
13,141 | public int readRawIntLittleEndian ( ) throws IOException { int x32 = readRawUInt ( 8 ) ; int x8 = readRawUInt ( 8 ) ; x32 |= ( x8 << 8 ) ; x8 = readRawUInt ( 8 ) ; x32 |= ( x8 << 16 ) ; x8 = readRawUInt ( 8 ) ; x32 |= ( x8 << 24 ) ; return x32 ; } | read bits into an unsigned little endian integer . |
13,142 | private int updateElementInReadBuffer ( Data data , int indexInChunk ) { workingBuffer . position ( indexInChunk ) ; int minElement = indexInChunk / gp . getElementSize ( ) ; int numberOfEntries = workingBuffer . limit ( ) / gp . getElementSize ( ) ; byte [ ] actualKey = data . getKey ( ) ; int maxElement = numberOfEnt... | traverses the readBuffer |
13,143 | public static byte [ ] toGUID ( long p1 , int p2 , int p3 , int p4 , long p5 ) { byte [ ] guid = new byte [ 16 ] ; guid [ 0 ] = ( byte ) ( p1 & 0xFF ) ; guid [ 1 ] = ( byte ) ( ( p1 >> 8 ) & 0xFF ) ; guid [ 2 ] = ( byte ) ( ( p1 >> 16 ) & 0xFF ) ; guid [ 3 ] = ( byte ) ( ( p1 >> 24 ) & 0xFF ) ; guid [ 4 ] = ( byte ) ( ... | Create a GUID . |
13,144 | protected void init ( File file , String directory , String fileName , InfoLocationOptions option ) { super . init ( file , directory , fileName , option ) ; if ( ! this . errors . hasErrors ( ) ) { if ( ! "stg" . equals ( this . getFileExtension ( ) ) ) { this . errors . addError ( "file name must have '.stg' extensio... | Initialize the file source with any parameters presented by the constructors . |
13,145 | public void afterPropertiesSet ( ) throws Exception { super . afterPropertiesSet ( ) ; Assert . notNull ( sql , "The SQL query must be provided" ) ; Assert . notNull ( rowMapper , "RowMapper must be provided" ) ; } | Assert that mandatory properties are set . |
13,146 | public static < T > T getRandomItem ( T [ ] arr ) { return arr [ rand . nextInt ( arr . length ) ] ; } | Returns a random element of the given array . |
13,147 | public static < T > T [ ] reverseArray ( T [ ] arr ) { for ( int left = 0 , right = arr . length - 1 ; left < right ; left ++ , right -- ) { T temp = arr [ left ] ; arr [ left ] = arr [ right ] ; arr [ right ] = temp ; } return arr ; } | Reverses the entries of a given array . |
13,148 | public static < T > void shuffleArray ( T [ ] arr ) { for ( int i = arr . length ; i > 1 ; i -- ) swap ( arr , i - 1 , rand . nextInt ( i ) ) ; } | Permutes the elements of the given array . |
13,149 | private static < T > String getFormat ( T [ ] arr , int precision , char valueSeparation ) { StringBuilder builder = new StringBuilder ( ) ; builder . append ( '[' ) ; for ( int i = 0 ; i < arr . length - 1 ; i ++ ) { builder . append ( FormatUtils . getFormat ( arr [ i ] , precision ) ) ; builder . append ( valueSepar... | Returns a format - String that can be used to generate a String representation of an array using the String . format method . |
13,150 | public void setLoopValue ( int newLoopValue ) { if ( newLoopValue == Helpers . PLAYER_LOOP_DEACTIVATED ) { getPlayerSetUp_fadeOutLoops ( ) . setSelected ( false ) ; getPlayerSetUp_ignoreLoops ( ) . setSelected ( false ) ; } else if ( newLoopValue == Helpers . PLAYER_LOOP_FADEOUT ) { getPlayerSetUp_fadeOutLoops ( ) . se... | Never ever call this Method from an event handler for those two buttons - endless loop! |
13,151 | public void removeTags ( int type ) throws FileNotFoundException , IOException { RandomAccessFile raf = null ; try { raf = new RandomAccessFile ( mp3File , "rw" ) ; if ( allow ( type & ID3V1 ) ) { id3v1 . removeTag ( raf ) ; } if ( allow ( type & ID3V2 ) ) { id3v2 . removeTag ( raf ) ; } } finally { if ( raf != null ) ... | Removes id3 tags from the file . The argument specifies which tags to remove . This can either be BOTH_TAGS ID3V1_ONLY ID3V2_ONLY or EXISTING_TAGS_ONLY . |
13,152 | public void writeTags ( ) throws FileNotFoundException , IOException { RandomAccessFile raf = null ; try { raf = new RandomAccessFile ( mp3File , "rw" ) ; if ( id3v2 . tagExists ( ) ) { id3v2 . writeTag ( raf ) ; } if ( id3v1 . tagExists ( ) ) { id3v1 . writeTag ( raf ) ; } } finally { if ( raf != null ) raf . close ( ... | Writes the current state of the id3 tags to the file . What tags are written depends upon the tagType passed to the constructor . |
13,153 | public void setTitle ( String title , int type ) { if ( allow ( type & ID3V1 ) ) { id3v1 . setTitle ( title ) ; } if ( allow ( type & ID3V2 ) ) { id3v2 . setTextFrame ( ID3v2Frames . TITLE , title ) ; } } | Set the title of this mp3 . |
13,154 | public void setAlbum ( String album , int type ) { if ( allow ( type & ID3V1 ) ) { id3v1 . setAlbum ( album ) ; } if ( allow ( type & ID3V2 ) ) { id3v2 . setTextFrame ( ID3v2Frames . ALBUM , album ) ; } } | Set the album of this mp3 . |
13,155 | public void setArtist ( String artist , int type ) { if ( allow ( type & ID3V1 ) ) { id3v1 . setArtist ( artist ) ; } if ( allow ( type & ID3V2 ) ) { id3v2 . setTextFrame ( ID3v2Frames . LEAD_PERFORMERS , artist ) ; } } | Set the artist of this mp3 . |
13,156 | public void setComment ( String comment , int type ) { if ( allow ( type & ID3V1 ) ) { id3v1 . setComment ( comment ) ; } if ( allow ( type & ID3V2 ) ) { id3v2 . setCommentFrame ( "" , comment ) ; } } | Add a comment to this mp3 . |
13,157 | public void setGenre ( String genre , int type ) { if ( allow ( type & ID3V1 ) ) { id3v1 . setGenreString ( genre ) ; } if ( allow ( type & ID3V2 ) ) { id3v2 . setTextFrame ( ID3v2Frames . CONTENT_TYPE , genre ) ; } } | Set the genre of this mp3 . |
13,158 | public void setYear ( String year , int type ) { if ( allow ( type & ID3V1 ) ) { id3v1 . setYear ( year ) ; } if ( allow ( type & ID3V2 ) ) { id3v2 . setTextFrame ( ID3v2Frames . YEAR , year ) ; } } | Set the year of this mp3 . |
13,159 | public void setTrack ( int track , int type ) { if ( allow ( type & ID3V1 ) ) { id3v1 . setTrack ( track ) ; } if ( allow ( type & ID3V2 ) ) { id3v2 . setTextFrame ( ID3v2Frames . TRACK_NUMBER , String . valueOf ( track ) ) ; } } | Set the track number of this mp3 . |
13,160 | public String getArtist ( int type ) { if ( allow ( type & ID3V1 ) ) { return id3v1 . getArtist ( ) ; } if ( allow ( type & ID3V2 ) ) { return id3v2 . getFrameDataString ( ID3v2Frames . LEAD_PERFORMERS ) ; } return null ; } | Returns the artist of the mp3 if set and the empty string if not . |
13,161 | public String getAlbum ( int type ) { if ( allow ( type & ID3V1 ) ) { return id3v1 . getAlbum ( ) ; } if ( allow ( type & ID3V2 ) ) { return id3v2 . getFrameDataString ( ID3v2Frames . ALBUM ) ; } return null ; } | Returns the album of the mp3 if set and the empty string if not . |
13,162 | public String getComment ( int type ) { if ( allow ( type & ID3V1 ) ) { return id3v1 . getComment ( ) ; } if ( allow ( type & ID3V2 ) ) { return id3v2 . getFrameDataString ( ID3v2Frames . COMMENTS ) ; } return null ; } | Returns the comment field of this mp3 if set and the empty string if not . |
13,163 | public String getGenre ( int type ) { if ( allow ( type & ID3V1 ) ) { return id3v1 . getGenreString ( ) ; } if ( allow ( type & ID3V2 ) ) { return id3v2 . getFrameDataString ( ID3v2Frames . CONTENT_TYPE ) ; } return null ; } | Returns the genre of this mp3 if set and the empty string if not . |
13,164 | public String getTitle ( int type ) { if ( allow ( type & ID3V1 ) ) { return id3v1 . getTitle ( ) ; } if ( allow ( type & ID3V2 ) ) { return id3v2 . getFrameDataString ( ID3v2Frames . TITLE ) ; } return null ; } | Returns the title of this mp3 if set and the empty string if not . |
13,165 | public String getTrack ( int type ) { if ( allow ( type & ID3V1 ) ) { return Integer . toString ( id3v1 . getTrack ( ) ) ; } if ( allow ( type & ID3V2 ) ) { return id3v2 . getFrameDataString ( ID3v2Frames . TRACK_NUMBER ) ; } return null ; } | Returns the track of this mp3 if set and the empty string if not . |
13,166 | public String getYear ( int type ) { if ( allow ( type & ID3V1 ) ) { return id3v1 . getYear ( ) ; } if ( allow ( type & ID3V2 ) ) { return id3v2 . getFrameDataString ( ID3v2Frames . YEAR ) ; } return null ; } | Returns the year of this mp3 if set and the empty string if not . |
13,167 | public String getFileName ( ) { if ( mp3File == null ) return "" ; try { return mp3File . getCanonicalPath ( ) ; } catch ( IOException ex ) { return mp3File . getAbsolutePath ( ) ; } } | returns the full path of this mp3 file |
13,168 | public Link deserialize ( JsonParser jp , DeserializationContext ctxt ) throws IOException { String tmp = jp . getText ( ) ; validate ( jp , tmp , "{" ) ; jp . nextToken ( ) ; String rel = jp . getText ( ) ; validateText ( jp , rel ) ; jp . nextToken ( ) ; tmp = jp . getText ( ) ; validate ( jp , tmp , "{" ) ; jp . nex... | Non whitespace ; could possibly be narrowed |
13,169 | public final AsyncWork < T , Exception > start ( ) { AsyncWork < T , Exception > result = new AsyncWork < > ( ) ; resume ( result ) ; return result ; } | Start to read lines in a separate task . |
13,170 | public final void listenInline ( AsyncWorkListener < T , TError > listener ) { synchronized ( this ) { if ( ! unblocked || listenersInline != null ) { if ( listenersInline == null ) listenersInline = new ArrayList < > ( 5 ) ; listenersInline . add ( listener ) ; return ; } } if ( error != null ) listener . error ( erro... | Add a listener to be called when this AsyncWork is unblocked . |
13,171 | public final void listenInline ( Listener < T > onready , Listener < TError > onerror , Listener < CancelException > oncancel ) { listenInline ( new AsyncWorkListener < T , TError > ( ) { public void ready ( T result ) { onready . fire ( result ) ; } public void error ( TError error ) { onerror . fire ( error ) ; } pub... | Call one of the given listener depending on result . |
13,172 | public final void listenInline ( Listener < T > onSuccess ) { listenInline ( new AsyncWorkListener < T , TError > ( ) { public void ready ( T result ) { onSuccess . fire ( result ) ; } public void error ( TError error ) { } public void cancelled ( CancelException event ) { } public String toString ( ) { return "AsyncWo... | Register a listener to be called only on success with the result . |
13,173 | public final void listenInlineGenericError ( AsyncWork < T , Exception > sp ) { listenInline ( new AsyncWorkListener < T , TError > ( ) { public void ready ( T result ) { sp . unblockSuccess ( result ) ; } public void error ( TError error ) { sp . unblockError ( error ) ; } public void cancelled ( CancelException event... | Forward the result error or cancellation to the given AsyncWork . |
13,174 | public final void unblockSuccess ( T result ) { ArrayList < AsyncWorkListener < T , TError > > listeners ; synchronized ( this ) { if ( unblocked ) return ; unblocked = true ; this . result = result ; if ( listenersInline == null ) { this . notifyAll ( ) ; return ; } listeners = listenersInline ; listenersInline = new ... | Unblock this AsyncWork with the given result . |
13,175 | public final void unblockError ( TError error ) { ArrayList < AsyncWorkListener < T , TError > > listeners ; synchronized ( this ) { if ( unblocked ) return ; unblocked = true ; this . error = error ; if ( listenersInline == null ) { this . notifyAll ( ) ; return ; } listeners = listenersInline ; listenersInline = new ... | Unblock this AsyncWork with an error . Equivalent to the method error . |
13,176 | public void unblockCancel ( CancelException event ) { ArrayList < AsyncWorkListener < T , TError > > listeners ; synchronized ( this ) { if ( unblocked ) return ; unblocked = true ; this . cancel = event ; if ( listenersInline == null ) { this . notifyAll ( ) ; return ; } listeners = listenersInline ; listenersInline =... | Cancel this AsyncWork . Equivalent to the method cancel . |
13,177 | public final T blockResult ( long timeout ) throws TError , CancelException { Thread t ; BlockedThreadHandler blockedHandler ; synchronized ( this ) { if ( unblocked && listenersInline == null ) { if ( error != null ) throw error ; if ( cancel != null ) throw cancel ; return result ; } t = Thread . currentThread ( ) ; ... | Block until this AsyncWork is unblocked or the given timeout expired and return the result in case of success or throw the error or cancellation . |
13,178 | public final void reset ( ) { unblocked = false ; result = null ; error = null ; cancel = null ; listenersInline = null ; } | Reset this AsyncWork point to reuse it . This method remove any previous result error or cancellation and mark this AsyncWork as blocked . Any previous listener is also removed . |
13,179 | public String generarIdentificador ( ) { String UUID = Long . toHexString ( System . currentTimeMillis ( ) ) ; UUID = UUID . concat ( obtenerDireccionIP ( ) ) ; UUID = UUID . concat ( identityHashCode ) ; UUID = UUID . concat ( Integer . toHexString ( _oAleatorioSeguro . nextInt ( ) ) ) ; return UUID ; } | Este metodo genera una nueva cadena de identificador Unico . La cadena devuelta tiene un maximo de 40 caracteres . |
13,180 | public void fillInfoPanelWith ( Sequence currentSequence , String songName ) { getMidiDuration ( ) . setText ( Helpers . getTimeStringFromMilliseconds ( currentSequence . getMicrosecondLength ( ) / 1000L ) ) ; getMidiName ( ) . setText ( songName ) ; Track [ ] tracks = currentSequence . getTracks ( ) ; StringBuilder fu... | private static final int INSTRUMENTNAME = 0x04 ; |
13,181 | public < T > T getClone ( String key , Class < T > c ) { IPrototype prototype = prototypes . get ( new PrototypeKey ( key , c ) ) ; if ( prototype != null ) { return ( T ) prototype . clone ( ) ; } else return null ; } | Obtains a key associated clone of the prototype for the specified class and key |
13,182 | public void registerPrototype ( String key , IPrototype prototype ) { prototypes . put ( new PrototypeKey ( key , prototype . getClass ( ) ) , prototype ) ; } | Registers a new prototype associated to the specified key |
13,183 | public void unregisterPrototype ( String key , Class c ) { prototypes . remove ( new PrototypeKey ( key , c ) ) ; } | Unregisters a prototype associated to the specified key |
13,184 | public void displayOSInfo ( Log log , boolean info ) { String string = "OS Info: Arch: " + Os . OS_ARCH + " Family: " + Os . OS_FAMILY + " Name: " + Os . OS_NAME + " Version: " + Os . OS_VERSION ; if ( ! info ) { log . debug ( string ) ; } else { log . info ( string ) ; } } | Log the current OS information . |
13,185 | public boolean allParamsEmpty ( ) { return ( StringUtils . isEmpty ( family ) && StringUtils . isEmpty ( arch ) && StringUtils . isEmpty ( name ) && StringUtils . isEmpty ( version ) ) ; } | Helper method to check that at least one of family name version or arch is set . |
13,186 | private Activation createActivation ( ) { Activation activation = new Activation ( ) ; activation . setActiveByDefault ( false ) ; activation . setOs ( createOsBean ( ) ) ; return activation ; } | Creates an Activation object that contains the ActivationOS information . |
13,187 | private ActivationOS createOsBean ( ) { ActivationOS os = new ActivationOS ( ) ; os . setArch ( arch ) ; os . setFamily ( family ) ; os . setName ( name ) ; os . setVersion ( version ) ; return os ; } | Creates an ActivationOS object containing family name version and arch . |
13,188 | protected void determineCoordinates ( ) { for ( int i = 0 ; i < numPoints ; i ++ ) { coordinates . set ( i , getPointCoordinate ( i ) ) ; } } | Determines the properties of the underlying circle and the point coordinates . |
13,189 | public void handleMessage ( String message , E_MessageType type , ST max100 , Object appID ) { this . count ++ ; boolean doMax = false ; if ( this . maxCount != - 1 && this . count > this . maxCount ) { max100 . add ( "name" , appID ) ; max100 . add ( "number" , this . maxCount ) ; doMax = true ; } if ( this . useSkbCo... | Handles the message . |
13,190 | public void executeInBackground ( ) { Thread t = new Thread ( ) { public void run ( ) { try { execute ( ) ; } catch ( Exception e ) { notifyException ( e ) ; } } } ; t . start ( ) ; } | A new thread is automatically created to execute the action |
13,191 | public E getNextValue ( ) throws ValueGenerationException { if ( ! isValid ( ) ) throw new ValueGenerationException ( "Cannot provide elements in invalid state." ) ; Double random = rand . nextDouble ( ) ; for ( int i = 0 ; i < limits . size ( ) ; i ++ ) if ( random <= limits . get ( i ) ) { return keys . get ( i ) ; }... | Conducts a stochastic element choice based on the maintained occurrence probabilities . |
13,192 | public static Extension deserialize ( byte [ ] extensionBytes ) throws ServiceLocationException { int extensionId = readInt ( extensionBytes , 0 , ID_BYTES_LENGTH ) ; Extension extension = createExtension ( extensionId ) ; if ( extension != null ) { byte [ ] bodyBytes = new byte [ extensionBytes . length - ID_BYTES_LEN... | Returns an Extension subclass object obtained deserializing the given bytes or null if the bytes contain an extension that is not understood . |
13,193 | public void addHeader ( String name , String value ) { headers . add ( name , value ) ; List < String > list = caseSensitiveHeaders . get ( name ) ; if ( list == null ) { list = new ArrayList < String > ( ) ; caseSensitiveHeaders . put ( name , list ) ; } list . add ( value ) ; } | Adds and normalizes the header . |
13,194 | public static Callable < String > getCallWTimeout ( BufferedReader reader , HasPrompt emptyPrint ) { return NonBlockingReader . getCallWTimeout ( reader , 200 , emptyPrint ) ; } | Returns a new callable for reading strings from a reader with a set timeout of 200ms . |
13,195 | public static Callable < String > getCallWTimeout ( BufferedReader reader , int timeout , HasPrompt emptyPrint ) { return new Callable < String > ( ) { public String call ( ) throws IOException { String ret = "" ; while ( "" . equals ( ret ) ) { try { while ( ! reader . ready ( ) ) { Thread . sleep ( timeout ) ; } ret ... | Returns a new callable for reading strings from a reader with a given timeout . |
13,196 | public boolean isAncestor ( XMLNode node ) { return node == parent || ( parent != null && parent . isAncestor ( node ) ) ; } | Check if the given node is an ancestor of this node . |
13,197 | public URIBuilder addParameter ( final String param , final String value ) { if ( this . queryParams == null ) { this . queryParams = new ArrayList < NameValuePair > ( ) ; } this . queryParams . add ( new BasicNameValuePair ( param , value ) ) ; this . encodedQuery = null ; this . encodedSchemeSpecificPart = null ; ret... | Adds parameter to URI query . The parameter name and value are expected to be unescaped and may contain non ASCII characters . |
13,198 | public URIBuilder setParameter ( final String param , final String value ) { if ( this . queryParams == null ) { this . queryParams = new ArrayList < NameValuePair > ( ) ; } if ( ! this . queryParams . isEmpty ( ) ) { for ( Iterator < NameValuePair > it = this . queryParams . iterator ( ) ; it . hasNext ( ) ; ) { NameV... | Sets parameter of URI query overriding existing value if set . The parameter name and value are expected to be unescaped and may contain non ASCII characters . |
13,199 | public boolean has ( Element ele ) { return tmap . containsKey ( ele ) && ! tmap . get ( ele ) . isEmpty ( ) ; } | check the presence of ele in translation map |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.