idx
int64
0
41.2k
question
stringlengths
83
4.15k
target
stringlengths
5
715
15,400
public AmqpChannel getBasic ( String queue , boolean noAck ) { Object [ ] args = { 0 , queue , noAck } ; WrappedByteBuffer bodyArg = null ; HashMap < String , Object > headersArg = null ; String methodName = "getBasic" ; String methodId = "60" + "70" ; AmqpMethod amqpMethod = MethodLookup . LookupMethod ( methodId ) ; ...
Gets messages from the queue and dispatches it to the listener
15,401
private void fireOnOpen ( ChannelEvent e ) { if ( readyState == ReadyState . OPEN ) { return ; } readyState = ReadyState . OPEN ; List < EventListener > listeners = changes . getListenerList ( AMQP ) ; for ( EventListener listener : listeners ) { ChannelListener amqpListener = ( ChannelListener ) listener ; amqpListene...
Fired when channel is opened
15,402
private void fireOnDeclareExchange ( ChannelEvent e ) { List < EventListener > listeners = changes . getListenerList ( AMQP ) ; for ( EventListener listener : listeners ) { ChannelListener amqpListener = ( ChannelListener ) listener ; amqpListener . onDeclareExchange ( e ) ; } }
Fired when exchange is declared
15,403
private void fireOnDeclareQueue ( ChannelEvent e ) { List < EventListener > listeners = changes . getListenerList ( AMQP ) ; for ( EventListener listener : listeners ) { ChannelListener amqpListener = ( ChannelListener ) listener ; amqpListener . onDeclareQueue ( e ) ; } }
Fired when Queue is declared
15,404
private void fireOnBindQueue ( ChannelEvent e ) { List < EventListener > listeners = changes . getListenerList ( AMQP ) ; for ( EventListener listener : listeners ) { ChannelListener amqpListener = ( ChannelListener ) listener ; amqpListener . onBindQueue ( e ) ; } }
Fired when Queue is bound
15,405
private void fireOnConsumeBasic ( ChannelEvent e ) { List < EventListener > listeners = changes . getListenerList ( AMQP ) ; for ( EventListener listener : listeners ) { ChannelListener amqpListener = ( ChannelListener ) listener ; amqpListener . onConsumeBasic ( e ) ; } }
Fired on consume basic
15,406
private void fireOnCommitTransaction ( ChannelEvent e ) { List < EventListener > listeners = changes . getListenerList ( AMQP ) ; for ( EventListener listener : listeners ) { ChannelListener amqpListener = ( ChannelListener ) listener ; amqpListener . onCommit ( e ) ; } }
Fired on transaction commit
15,407
private void fireOnRollbackTransaction ( ChannelEvent e ) { List < EventListener > listeners = changes . getListenerList ( AMQP ) ; for ( EventListener listener : listeners ) { ChannelListener amqpListener = ( ChannelListener ) listener ; amqpListener . onRollback ( e ) ; } }
Fired on transaction rollbacked
15,408
private void fireOnSelectTransaction ( ChannelEvent e ) { List < EventListener > listeners = changes . getListenerList ( AMQP ) ; for ( EventListener listener : listeners ) { ChannelListener amqpListener = ( ChannelListener ) listener ; amqpListener . onSelect ( e ) ; } }
Fired on transaction select
15,409
private void fireOnMessage ( ChannelEvent e ) { List < EventListener > listeners = changes . getListenerList ( AMQP ) ; for ( EventListener listener : listeners ) { ChannelListener amqpListener = ( ChannelListener ) listener ; amqpListener . onMessage ( e ) ; } }
Fired on message retreival
15,410
private void fireOnUnbind ( ChannelEvent e ) { List < EventListener > listeners = changes . getListenerList ( AMQP ) ; for ( EventListener listener : listeners ) { ChannelListener amqpListener = ( ChannelListener ) listener ; amqpListener . onUnbind ( e ) ; } }
Fired on Unbind event
15,411
private void fireOnDeleteQueue ( ChannelEvent e ) { List < EventListener > listeners = changes . getListenerList ( AMQP ) ; for ( EventListener listener : listeners ) { ChannelListener amqpListener = ( ChannelListener ) listener ; amqpListener . onDeleteQueue ( e ) ; } }
Fired when queue is deleted
15,412
private void fireOnDeleteExchange ( ChannelEvent e ) { List < EventListener > listeners = changes . getListenerList ( AMQP ) ; for ( EventListener listener : listeners ) { ChannelListener amqpListener = ( ChannelListener ) listener ; amqpListener . onDeleteExchange ( e ) ; } }
Fired when exchange is deleted
15,413
private void fireOnCancelBasic ( ChannelEvent e ) { List < EventListener > listeners = changes . getListenerList ( AMQP ) ; for ( EventListener listener : listeners ) { ChannelListener amqpListener = ( ChannelListener ) listener ; amqpListener . onCancelBasic ( e ) ; } }
Fired on cancel basic
15,414
private void fireOnGetBasic ( ChannelEvent e ) { List < EventListener > listeners = changes . getListenerList ( AMQP ) ; for ( EventListener listener : listeners ) { ChannelListener amqpListener = ( ChannelListener ) listener ; amqpListener . onGetBasic ( e ) ; } }
Fired on get basic
15,415
private void fireOnPurgeQueue ( ChannelEvent e ) { List < EventListener > listeners = changes . getListenerList ( AMQP ) ; for ( EventListener listener : listeners ) { ChannelListener amqpListener = ( ChannelListener ) listener ; amqpListener . onPurgeQueue ( e ) ; } }
Fired on purge queue
15,416
private void fireOnRecoverBasic ( ChannelEvent e ) { List < EventListener > listeners = changes . getListenerList ( AMQP ) ; for ( EventListener listener : listeners ) { ChannelListener amqpListener = ( ChannelListener ) listener ; amqpListener . onRecoverBasic ( e ) ; } }
Fired on recover basic
15,417
private void fireOnRejectBasic ( ChannelEvent e ) { List < EventListener > listeners = changes . getListenerList ( AMQP ) ; for ( EventListener listener : listeners ) { ChannelListener amqpListener = ( ChannelListener ) listener ; amqpListener . onRejectBasic ( e ) ; } }
Fired on reject basic
15,418
public void processConnect ( WebSocketChannel channel , WSURI location , String [ ] protocols ) { LOG . entering ( CLASS_NAME , "connect" , channel ) ; WebSocketCompositeChannel compositeChannel = ( WebSocketCompositeChannel ) channel ; if ( compositeChannel . readyState != ReadyState . CLOSED ) { LOG . warning ( "Atte...
Connect the WebSocket object to the remote location
15,419
public void processTextMessage ( WebSocketChannel channel , String message ) { LOG . entering ( CLASS_NAME , "send" , message ) ; WebSocketCompositeChannel parent = ( WebSocketCompositeChannel ) channel ; if ( parent . readyState != ReadyState . OPEN ) { LOG . warning ( "Attempt to post message on unopened or closed we...
Writes the message to the WebSocket .
15,420
public void removeChatGrabber ( JTextComponent comp ) { comp . removeAncestorListener ( this ) ; _chatGrabbers . remove ( comp ) ; _curChatGrabber = _chatGrabbers . isEmpty ( ) ? null : _chatGrabbers . getLast ( ) ; }
Removes the specified component from the list of chat grabbers so that it will no longer be notified of chat - like key events .
15,421
protected boolean isTypeableTarget ( Component target ) { return target . isShowing ( ) && ( ( ( target instanceof JTextComponent ) && ( ( JTextComponent ) target ) . isEditable ( ) ) || ( target instanceof JComboBox ) || ( target instanceof JTable ) || ( target instanceof JRootPane ) ) ; }
Returns true if the specified target component supports being typed into and thus we shouldn t steal focus away from it if the user starts typing .
15,422
public void windowLostFocus ( WindowEvent e ) { if ( ! _downKeys . isEmpty ( ) ) { long now = System . currentTimeMillis ( ) ; for ( KeyEvent down : _downKeys . values ( ) ) { KeyEvent up = new KeyEvent ( down . getComponent ( ) , KeyEvent . KEY_RELEASED , now , down . getModifiers ( ) , down . getKeyCode ( ) , down . ...
documentation inherited from interface WindowFocusListener
15,423
public static < T > CloseableIterable < T > distinct ( final CloseableIterable < T > iterable ) { return wrap ( Iterables2 . distinct ( iterable ) , iterable ) ; }
If we can assume the closeable iterable is sorted return the distinct elements . This only works if the data provided is sorted .
15,424
public void delete ( ) { IntBuffer idbuf = BufferUtils . createIntBuffer ( 1 ) ; idbuf . put ( _id ) . rewind ( ) ; AL10 . alDeleteBuffers ( idbuf ) ; _id = 0 ; }
Deletes this buffer rendering it unusable .
15,425
public void visitObjects ( ObjectVisitor visitor , boolean interestingOnly ) { for ( Iterator < Section > iter = getSections ( ) ; iter . hasNext ( ) ; ) { Section sect = iter . next ( ) ; for ( ObjectInfo oinfo : sect . objectInfo ) { visitor . visit ( oinfo ) ; } if ( ! interestingOnly ) { for ( int oo = 0 ; oo < sec...
Informs the supplied visitor of each object in this scene .
15,426
public void setSection ( Section section ) { _sections . put ( key ( section . x , section . y ) , section ) ; }
Don t call this method! This is only public so that the scene parser can construct a scene from raw data . If only Java supported class friendship .
15,427
protected final int key ( int x , int y ) { int sx = MathUtil . floorDiv ( x , swidth ) ; int sy = MathUtil . floorDiv ( y , sheight ) ; return ( sx << 16 ) | ( sy & 0xFFFF ) ; }
Returns the key for the specified section .
15,428
protected final Section getSection ( int x , int y , boolean create ) { int key = key ( x , y ) ; Section sect = _sections . get ( key ) ; if ( sect == null && create ) { short sx = ( short ) ( MathUtil . floorDiv ( x , swidth ) * swidth ) ; short sy = ( short ) ( MathUtil . floorDiv ( y , sheight ) * sheight ) ; _sect...
Returns the section for the specified tile coordinate .
15,429
public void forEach ( final Function < T , Void > function ) { for ( final ListenerEntry < T > entry : listeners . values ( ) ) { entry . executor . execute ( new Runnable ( ) { public void run ( ) { try { function . apply ( entry . listener ) ; } catch ( Throwable e ) { log . error ( String . format ( "Listener (%s) t...
Utility - apply the given function to each listener . The function receives the listener as an argument .
15,430
public String summarizeState ( ) { StringBuilder buf = new StringBuilder ( ) ; buf . append ( "clipVol=" ) . append ( _clipVol ) ; buf . append ( ", disabled=[" ) ; int ii = 0 ; for ( SoundType soundType : _disabledTypes ) { if ( ii ++ > 0 ) { buf . append ( ", " ) ; } buf . append ( soundType ) ; } return buf . append...
Returns a string summarizing our volume settings and disabled sound types .
15,431
public boolean shouldPlay ( SoundType type ) { if ( type == null ) { type = DEFAULT ; } return _clipVol != 0f && isEnabled ( type ) ; }
Is sound on and is the specified soundtype enabled?
15,432
public void setEnabled ( final SoundType type , final boolean enabled ) { boolean changed ; if ( enabled ) { changed = _disabledTypes . remove ( type ) ; } else { changed = _disabledTypes . add ( type ) ; } if ( changed ) { _enabledObservers . apply ( new ObserverOp < SoundEnabledObserver > ( ) { public boolean apply (...
Turns on or off the specified sound type .
15,433
public boolean play ( SoundType type , String pkgPath , String key , float pan ) { return play ( type , pkgPath , key , 0 , pan ) ; }
Play the specified sound as the specified type of sound immediately with the specified pan value . Note that a sound need not be locked prior to playing .
15,434
private void addMetaPageInternal ( final MetaHelpPage page ) { log . debug ( "Adding meta-page: {}" , page ) ; metaPages . put ( page . getName ( ) , page ) ; events . publish ( new MetaHelpPageAddedEvent ( page ) ) ; }
Exposed for discovery ; which is before lifecycle has been started .
15,435
public static void main ( String [ ] args ) { boolean enabled = ( args . length > 0 && args [ 0 ] . equals ( "on" ) ) ; Keyboard . setKeyRepeat ( enabled ) ; }
Tests keyboard functionality .
15,436
public static Point getSize ( float scale , Mirage image ) { int width = Math . max ( 0 , Math . round ( image . getWidth ( ) * scale ) ) ; int height = Math . max ( 0 , Math . round ( image . getHeight ( ) * scale ) ) ; return new Point ( width , height ) ; }
Computes the width and height to which an image should be scaled .
15,437
public static Point getCorner ( Point center , Point size ) { return new Point ( center . x - size . x / 2 , center . y - size . y / 2 ) ; }
Computes the upper left corner where the image should be drawn given the center and dimensions to which the image should be scaled .
15,438
private static DecoratorMap group_map_ ( Map < String , PathMatcher > paths ) { if ( paths . isEmpty ( ) ) return concat ( ) ; return new DecoratorMap ( ) { public Stream < Consumer < MutableContext > > map ( Stream < Consumer < MutableContext > > in , Context ctx ) { final Map < String , TimeSeriesValueSet > pathMappi...
Create a decorator map from a mapping of GroupMatchers .
15,439
private static DecoratorMap metric_map_ ( Map < IdentifierPair , MetricMatcher > matchers ) { if ( matchers . isEmpty ( ) ) return concat ( ) ; return new DecoratorMap ( ) { public Stream < Consumer < MutableContext > > map ( Stream < Consumer < MutableContext > > in , Context ctx ) { final Map < IdentifierPair , List ...
Create a decorator map from a mapping of metric matchers .
15,440
private static DecoratorMap concat ( DecoratorMap ... d_maps ) { return ( Stream < Consumer < MutableContext > > in , Context ctx ) -> { for ( DecoratorMap d_map : d_maps ) { in = d_map . map ( in , ctx ) ; } return in ; } ; }
Create a decorator map by chaining zero or more decorator maps .
15,441
public void add ( Metric m ) { final MetricName key = m . getName ( ) ; metrics_ . put ( key , m ) ; }
Add a new metric to the metric group .
15,442
@ SuppressWarnings ( "SynchronizationOnLocalVariableOrMethodParameter" ) private void waitForJobCompletion ( final CommandSessionImpl session ) throws InterruptedException { while ( true ) { Job job = session . foregroundJob ( ) ; if ( job == null ) break ; log . debug ( "Waiting for job completion: {}" , job ) ; synch...
Wait for current job if any to complete .
15,443
protected Object getInstantiatedClass ( String query ) { if ( query . equals ( Constants . ROBOTIUM_SOLO ) ) { return solo ; } else if ( query . equals ( Constants . REMOTE_TEST_CLASS ) ) { return testClass ; } return null ; }
Get the instantiated solo if it is requested
15,444
protected View getView ( String viewName ) { for ( View view : solo . getCurrentViews ( ) ) { if ( view . toString ( ) . contains ( viewName ) ) { return view ; } } return null ; }
Return a view with the specified name or null
15,445
public < T > T access ( Class < T > clazz ) { if ( configuration . getClass ( ) . equals ( clazz ) ) { return clazz . cast ( configuration ) ; } try { return clazz . cast ( fieldCache . get ( clazz ) . get ( configuration ) ) ; } catch ( Exception e ) { log . error ( "Could not access field for " + clazz , e ) ; throw ...
Access a custom configuration of the given type . The fields of the configuration object are searched for one that is of the given type .
15,446
public < T > boolean has ( Class < T > clazz ) { return configuration . getClass ( ) . equals ( clazz ) || ( fieldCache . getIfPresent ( clazz ) != null ) ; }
Return true if there is a custom configuration of the given type .
15,447
public static StreamDecoder createInstance ( URL url ) throws IOException { String path = url . getPath ( ) ; int idx = path . lastIndexOf ( '.' ) ; if ( idx == - 1 ) { log . warning ( "Missing extension for URL." , "url" , url ) ; return null ; } String extension = path . substring ( idx + 1 ) ; Class < ? extends Stre...
Creates and initializes a stream decoder for the specified URL .
15,448
public void setTarget ( JComponent target , KeyTranslator xlate ) { setEnabled ( false ) ; _target = target ; _xlate = xlate ; }
Initializes the keyboard manager with the supplied target component and key translator and disables the keyboard manager if it is currently active .
15,449
public void setEnabled ( boolean enabled ) { if ( enabled && _target == null ) { log . warning ( "Attempt to enable uninitialized keyboard manager!" , new Exception ( ) ) ; return ; } if ( enabled == _enabled ) { return ; } if ( ! enabled ) { if ( Keyboard . isAvailable ( ) ) { Keyboard . setKeyRepeat ( _nativeRepeat )...
Sets whether the keyboard manager processes keyboard input .
15,450
public void releaseAllKeys ( ) { long now = System . currentTimeMillis ( ) ; Iterator < KeyInfo > iter = _keys . elements ( ) ; while ( iter . hasNext ( ) ) { iter . next ( ) . release ( now ) ; } }
Releases all keys and ceases any hot repeating action that may be going on .
15,451
protected boolean keyPressed ( KeyEvent e ) { logKey ( "keyPressed" , e ) ; int keyCode = e . getKeyCode ( ) ; boolean hasCommand = _xlate . hasCommand ( keyCode ) ; if ( hasCommand ) { KeyInfo info = _keys . get ( keyCode ) ; if ( info == null ) { info = new KeyInfo ( keyCode ) ; _keys . put ( keyCode , info ) ; } inf...
Called when Swing notifies us that a key has been pressed while the keyboard manager is active .
15,452
protected boolean keyTyped ( KeyEvent e ) { logKey ( "keyTyped" , e ) ; char keyChar = e . getKeyChar ( ) ; boolean hasCommand = _xlate . hasCommand ( keyChar ) ; if ( hasCommand ) { if ( _shouldDisableNativeRepeat ) { _shouldDisableNativeRepeat = false ; if ( Keyboard . isAvailable ( ) ) { Keyboard . setKeyRepeat ( ! ...
Called when Swing notifies us that a key has been typed while the keyboard manager is active .
15,453
protected boolean keyReleased ( KeyEvent e ) { logKey ( "keyReleased" , e ) ; KeyInfo info = _keys . get ( e . getKeyCode ( ) ) ; if ( info != null ) { info . setReleaseTime ( RunAnywhere . getWhen ( e ) ) ; } notifyObservers ( KeyEvent . KEY_RELEASED , e . getKeyCode ( ) , RunAnywhere . getWhen ( e ) ) ; return ( info...
Called when Swing notifies us that a key has been released while the keyboard manager is active .
15,454
protected void logKey ( String msg , KeyEvent e ) { if ( DEBUG_EVENTS || _debugTyping . getValue ( ) ) { int keyCode = e . getKeyCode ( ) ; log . info ( msg , "key" , KeyEvent . getKeyText ( keyCode ) ) ; } }
Logs the given message and key .
15,455
public void paint ( Graphics g , int x , int y , int width , int height ) { if ( _tiles == null ) { return ; } int rwid = width - 2 * _w3 , rhei = height - 2 * _h3 ; g . drawImage ( _tiles [ 0 ] , x , y , _w3 , _h3 , null ) ; g . drawImage ( _tiles [ 1 ] , x + _w3 , y , rwid , _h3 , null ) ; g . drawImage ( _tiles [ 2 ...
Fills the requested region with the background defined by our source image .
15,456
public Icon getIcon ( String iconSet , int index ) { try { TileSet set = _icons . get ( iconSet ) ; if ( set == null ) { String path = _config . getProperty ( iconSet + PATH_SUFFIX ) ; if ( StringUtil . isBlank ( path ) ) { throw new Exception ( "No path specified for icon set" ) ; } String metstr = _config . getProper...
Fetches the icon with the specified index from the named icon set .
15,457
public ByteOrder order ( ByteOrder o ) { _isBigEndian = "BIG_ENDIAN" . equals ( o . toString ( ) ) ; _buf . order ( o ) ; return o ; }
Set the byte order for this buffer
15,458
public WrappedByteBuffer compact ( ) { int remaining = remaining ( ) ; int capacity = capacity ( ) ; if ( capacity == 0 ) { return this ; } if ( remaining <= capacity >>> 2 && capacity > _minimumCapacity ) { int newCapacity = capacity ; int minCapacity = max ( _minimumCapacity , remaining << 1 ) ; for ( ; ; ) { if ( ne...
Compacts the buffer by removing leading bytes up to the buffer position and decrements the limit and position values accordingly .
15,459
public WrappedByteBuffer fillWith ( byte b , int size ) { _autoExpand ( size ) ; while ( size -- > 0 ) { _buf . put ( b ) ; } return this ; }
Fills the buffer with a specific number of repeated bytes .
15,460
public int indexOf ( byte b ) { if ( _buf . hasArray ( ) ) { byte [ ] array = _buf . array ( ) ; int arrayOffset = _buf . arrayOffset ( ) ; int startAt = arrayOffset + position ( ) ; int endAt = arrayOffset + limit ( ) ; for ( int i = startAt ; i < endAt ; i ++ ) { if ( array [ i ] == b ) { return i - arrayOffset ; } }...
Returns the index of the specified byte in the buffer .
15,461
public WrappedByteBuffer put ( byte [ ] v , int offset , int length ) { _autoExpand ( length ) ; for ( int i = 0 ; i < length ; i ++ ) { _buf . put ( v [ offset + i ] ) ; } return this ; }
Puts segment of a single - byte array into the buffer at the current position .
15,462
public WrappedByteBuffer putAt ( int index , byte v ) { _checkForWriteAt ( index , 1 ) ; _buf . put ( index , v ) ; return this ; }
Puts a single byte number into the buffer at the specified index .
15,463
public WrappedByteBuffer putUnsignedAt ( int index , int v ) { _checkForWriteAt ( index , 1 ) ; byte b = ( byte ) ( v & 0xFF ) ; return this . putAt ( index , b ) ; }
Puts an unsigned single byte into the buffer at the specified position .
15,464
public WrappedByteBuffer putShortAt ( int index , short v ) { _checkForWriteAt ( index , 2 ) ; _buf . putShort ( index , v ) ; return this ; }
Puts a two - byte short into the buffer at the specified index .
15,465
public WrappedByteBuffer putIntAt ( int index , int v ) { _checkForWriteAt ( index , 4 ) ; _buf . putInt ( index , v ) ; return this ; }
Puts a four - byte int into the buffer at the specified index .
15,466
public WrappedByteBuffer putLongAt ( int index , long v ) { _checkForWriteAt ( index , 8 ) ; _buf . putLong ( index , v ) ; return this ; }
Puts an eight - byte long into the buffer at the specified index .
15,467
public WrappedByteBuffer putString ( String v , Charset cs ) { java . nio . ByteBuffer strBuf = cs . encode ( v ) ; _autoExpand ( strBuf . limit ( ) ) ; _buf . put ( strBuf ) ; return this ; }
Puts a string into the buffer at the current position using the character set to encode the string as bytes .
15,468
public WrappedByteBuffer putPrefixedString ( int fieldSize , String v , Charset cs ) { if ( fieldSize == 0 ) { return this ; } boolean utf16 = cs . name ( ) . startsWith ( "UTF-16" ) ; if ( utf16 && ( fieldSize == 1 ) ) { throw new IllegalArgumentException ( "fieldSize is not even for UTF-16 character set" ) ; } java ....
Puts a string into the buffer at the specified index using the character set to encode the string as bytes .
15,469
public WrappedByteBuffer putBytesAt ( int index , byte [ ] b ) { _checkForWriteAt ( index , b . length ) ; int pos = _buf . position ( ) ; _buf . position ( index ) ; _buf . put ( b , 0 , b . length ) ; _buf . position ( pos ) ; return this ; }
Puts a single - byte array into the buffer at the specified index .
15,470
public WrappedByteBuffer putBuffer ( WrappedByteBuffer v ) { _autoExpand ( v . remaining ( ) ) ; _buf . put ( v . _buf ) ; return this ; }
Puts a buffer into the buffer at the current position .
15,471
public WrappedByteBuffer putBufferAt ( int index , WrappedByteBuffer v ) { int pos = _buf . position ( ) ; _buf . position ( index ) ; _buf . put ( v . _buf ) ; _buf . position ( pos ) ; return this ; }
Puts a buffer into the buffer at the specified index .
15,472
public byte [ ] getBytes ( int size ) { _checkForRead ( size ) ; byte [ ] dst = new byte [ size ] ; _buf . get ( dst , 0 , size ) ; return dst ; }
Returns a byte array of length size from the buffer from current position
15,473
public byte [ ] getBytesAt ( int index , int size ) { _checkForReadAt ( index , size ) ; byte [ ] dst = new byte [ size ] ; int i = 0 ; int j = index ; while ( i < size ) { dst [ i ++ ] = _buf . get ( j ++ ) ; } return dst ; }
Returns a byte array of length size from the buffer starting from the specified position .
15,474
public int getUnsignedMediumInt ( ) { int b1 = getUnsigned ( ) ; int b2 = getUnsigned ( ) ; int b3 = getUnsigned ( ) ; if ( _isBigEndian ) { return ( b1 << 16 ) | ( b2 << 8 ) | b3 ; } else { return ( b3 << 16 ) | ( b2 << 8 ) | b1 ; } }
Returns an unsigned three - byte medium int from the buffer at the current position
15,475
public long getUnsignedIntAt ( int index ) { _checkForReadAt ( index , 4 ) ; long val = ( long ) ( _buf . getInt ( index ) & 0xffffffffL ) ; return val ; }
Returns an unsigned four - byte int from the buffer at the specified index
15,476
public String getPrefixedString ( int fieldSize , Charset cs ) { int len = 0 ; switch ( fieldSize ) { case 1 : len = _buf . get ( ) ; break ; case 2 : len = _buf . getShort ( ) ; break ; case 4 : len = _buf . getInt ( ) ; break ; default : throw new IllegalArgumentException ( "Illegal argument, field size should be 1,2...
Returns a length - prefixed string from the buffer at the current position .
15,477
public String getString ( Charset cs ) { int nullAt = indexOf ( ( byte ) 0 ) ; boolean utf16 = cs . name ( ) . startsWith ( "UTF-16" ) ; if ( utf16 ) { int oldPos = _buf . position ( ) ; boolean nullFound = false ; while ( ! nullFound && ( nullAt != - 1 ) ) { if ( _buf . get ( nullAt + 1 ) == 0 ) { nullFound = true ; b...
Returns a null - terminated string from the buffer at the current position . If the end of buffer if reached before discovering a null terminator byte then the decoded string includes all bytes up to the end of the buffer .
15,478
public WrappedByteBuffer skip ( int size ) { _autoExpand ( size ) ; _buf . position ( _buf . position ( ) + size ) ; return this ; }
Skips the specified number of bytes from the current position .
15,479
public String getHexDump ( ) { if ( _buf . position ( ) == _buf . limit ( ) ) { return "empty" ; } StringBuilder hexDump = new StringBuilder ( ) ; for ( int i = _buf . position ( ) ; i < _buf . limit ( ) ; i ++ ) { hexDump . append ( Integer . toHexString ( _buf . get ( i ) & 0xFF ) ) . append ( ' ' ) ; } return hexDum...
Returns a hex dump of this buffer .
15,480
WrappedByteBuffer expandAt ( int i , int expectedRemaining ) { if ( ( i + expectedRemaining ) <= _buf . limit ( ) ) { return this ; } else { if ( ( i + expectedRemaining ) <= _buf . capacity ( ) ) { _buf . limit ( i + expectedRemaining ) ; } else { int newCapacity = _buf . capacity ( ) + ( ( expectedRemaining > INITIAL...
Expands the buffer to support the expected number of remaining bytes at the specified index .
15,481
static void setArrayIndex ( Map < String , String > meta , int level , int index ) { meta . put ( level + ARRAY_IDX_SUFFIX , Integer . toString ( index ) ) ; }
Sets an array index on a map of metadata for a specific level of a nested json tree . Since the json requires that arrays have preserved order it s imported that it is constrained from the flattened to the re - expanded representation .
15,482
static Integer getArrayIndex ( Map < String , String > meta , int level ) { return Integer . parseInt ( meta . get ( level + ARRAY_IDX_SUFFIX ) ) ; }
Returns an array index for a specific level from the metadata from a flattened json tree .
15,483
static boolean hasArrayIndex ( Map < String , String > meta , int level ) { return meta . containsKey ( level + ARRAY_IDX_SUFFIX ) ; }
Determines whether or not a map of metadata contains array index information at the given level in a flattened json tree .
15,484
static Map < Integer , Integer > levelsToIndices ( Map < String , String > meta ) { Set < Map . Entry < String , String > > entries = meta . entrySet ( ) ; Map < Integer , Integer > levelToIdx = new HashMap < > ( ) ; for ( Map . Entry < String , String > entry : entries ) if ( entry . getKey ( ) . endsWith ( ARRAY_IDX_...
Converts all array index information in a given map of metadata to a map that is keyed only by the level and each value is the index in the array for that level . This is used to optimize lookup since a string is used for the key in the metadata that should not conflict with keys that other applications may want to set...
15,485
public void stream ( final String bundle , final String path , final boolean loop , final ResultListener < Stream > listener ) throws IOException { if ( ! path . endsWith ( ".ogg" ) ) { log . warning ( "Unknown file type for streaming" , "bundle" , bundle , "path" , path ) ; return ; } InputStream rsrc = _loader . getS...
Streams ogg files from the given bundle and path .
15,486
private Map < Any2 < Integer , String > , String > resolve_template_args_ ( Matcher matcher ) { return template_ . getArguments ( ) . stream ( ) . collect ( Collectors . toMap ( arg -> arg , arg -> arg . mapCombine ( matcher :: group , matcher :: group ) ) ) ; }
Convert a regexp match to a map of matcher arguments .
15,487
private Optional < MetricValue > rewrite_ ( MetricValue v ) { return v . asString ( ) . map ( pattern_ :: matcher ) . filter ( matcher -> matcher . find ( ) ) . map ( this :: resolve_template_args_ ) . map ( template_ :: apply ) . map ( MetricValue :: fromStrValue ) ; }
Rewrite a string metric according to matcher and template . Strings that don t match the regexp are omitted .
15,488
public Serializable parseConfig ( File source ) throws IOException , SAXException { Digester digester = new Digester ( ) ; Serializable config = createConfigObject ( ) ; addRules ( digester ) ; digester . push ( config ) ; digester . parse ( new FileInputStream ( source ) ) ; return config ; }
Parses the supplied configuration file into a serializable configuration object .
15,489
public Tags filter ( Set < String > tag_names ) { return Tags . valueOf ( tags_ . entrySet ( ) . stream ( ) . filter ( entry -> tag_names . contains ( entry . getKey ( ) ) ) ) ; }
Reduce the list of tags to only those specified in the argument set .
15,490
protected void trackPathable ( ) { if ( _fpath == null ) { return ; } int width = getWidth ( ) , height = getHeight ( ) ; int nx = _vbounds . x , ny = _vbounds . y ; switch ( _fmode ) { case TRACK_PATHABLE : nx = _fpath . getX ( ) ; ny = _fpath . getY ( ) ; break ; case CENTER_ON_PATHABLE : nx = _fpath . getX ( ) - wid...
Implements the standard pathable tracking support . Derived classes may wish to override this if they desire custom tracking functionality .
15,491
public void updateBounds ( ) { Dimension size = _label . getSize ( ) ; _bounds . width = size . width ; _bounds . height = size . height ; }
Updates the bounds of the sprite after a change to the label .
15,492
protected void layoutLabel ( ) { Graphics2D gfx = _mgr . createGraphics ( ) ; if ( gfx == null ) { return ; } try { gfx . setRenderingHint ( RenderingHints . KEY_ANTIALIASING , ( _antiAliased ) ? RenderingHints . VALUE_ANTIALIAS_ON : RenderingHints . VALUE_ANTIALIAS_OFF ) ; _label . layout ( gfx ) ; } finally { gfx . d...
Lays out our underlying label which must be done if the text is changed .
15,493
public void addRuleInstances ( Digester digester ) { digester . addObjectCreate ( _prefix + ACTION_PATH , ActionSequence . class . getName ( ) ) ; digester . addRule ( _prefix + ACTION_PATH , new SetPropertyFieldsRule ( ) ) ; digester . addRule ( _prefix + ACTION_PATH + "/framesPerSecond" , new SetFieldRule ( "framesPe...
Adds the necessary rules to the digester to parse our actions .
15,494
public static String validate ( ActionSequence seq ) { if ( StringUtil . isBlank ( seq . name ) ) { return "Missing 'name' definition." ; } if ( seq . framesPerSecond == 0 ) { return "Missing 'framesPerSecond' definition." ; } if ( seq . orients == null ) { return "Missing 'orients' definition." ; } return null ; }
Validates that all necessary fields have been parsed and set in this action sequence object and are valid .
15,495
private boolean getNextEviction ( ) { long nowTime = System . currentTimeMillis ( ) ; final long sleepEndTime = nowTime + evictionInverval ; while ( nowTime < sleepEndTime ) { final long toSleep = Math . max ( 100 , sleepEndTime - nowTime ) ; synchronized ( this ) { if ( terminate ) return false ; try { wait ( toSleep ...
Waits for a next eviction .
15,496
public static List < Point > getPath ( TraversalPred tpred , Object trav , int longest , int ax , int ay , int bx , int by , boolean partial ) { return getPath ( tpred , new Stepper ( ) , trav , longest , ax , ay , bx , by , partial ) ; }
Gets a path with the default stepper which assumes the piece can move one in any of the eight cardinal directions .
15,497
protected void computeTransformedBounds ( ) { int w = _base . getWidth ( ) ; int h = _base . getHeight ( ) ; Point [ ] points = new Point [ ] { new Point ( 0 , 0 ) , new Point ( w , 0 ) , new Point ( 0 , h ) , new Point ( w , h ) } ; _transform . transform ( points , 0 , points , 0 , 4 ) ; int minX , minY , maxX , maxY...
Compute the bounds of the base Mirage after it has been transformed .
15,498
public BufferedImage createImage ( int width , int height , int trans ) { trans = Transparency . TRANSLUCENT ; if ( _gc != null ) { return _gc . createCompatibleImage ( width , height , trans ) ; } else { return new BufferedImage ( width , height , BufferedImage . TYPE_INT_ARGB ) ; } }
documentation inherited from interface BaseImageManager . OptimalImageCreator
15,499
static ConverterFactory getConverterFactory ( Configuration conf ) { Class < ? extends ConverterFactory > converterFactoryClass = conf . getClass ( CONVERTER_FACTORY , null , ConverterFactory . class ) ; if ( converterFactoryClass == null ) { throw new RuntimeException ( "ConverterFactory class was not set on the confi...
Gets the ConverterFactory from the configuration