idx
int64
0
165k
question
stringlengths
73
4.15k
target
stringlengths
5
918
len_question
int64
21
890
len_target
int64
3
255
138,400
public Colorization getColorization ( String className , int colorId ) { ClassRecord crec = getClassRecord ( className ) ; if ( crec != null ) { ColorRecord color = crec . colors . get ( colorId ) ; if ( color != null ) { return color . getColorization ( ) ; } } return null ; }
Looks up a colorization by name .
74
8
138,401
public Colorization getColorization ( String className , String colorName ) { ClassRecord crec = getClassRecord ( className ) ; if ( crec != null ) { int colorId = 0 ; try { colorId = crec . getColorId ( colorName ) ; } catch ( ParseException pe ) { log . info ( "Error getting colorization by name" , "error" , pe ) ; return null ; } ColorRecord color = crec . colors . get ( colorId ) ; if ( color != null ) { return color . getColorization ( ) ; } } return null ; }
Looks up a colorization by class and color names .
129
11
138,402
public ClassRecord getClassRecord ( String className ) { Iterator < ClassRecord > iter = _classes . values ( ) . iterator ( ) ; while ( iter . hasNext ( ) ) { ClassRecord crec = iter . next ( ) ; if ( crec . name . equals ( className ) ) { return crec ; } } log . warning ( "No such color class" , "class" , className , new Exception ( ) ) ; return null ; }
Loads up a colorization class by name and logs a warning if it doesn t exist .
100
19
138,403
public ColorRecord getColorRecord ( int classId , int colorId ) { ClassRecord record = getClassRecord ( classId ) ; if ( record == null ) { // if they request color class zero, we assume they're just // decoding a blank colorprint, otherwise we complain if ( classId != 0 ) { log . warning ( "Requested unknown color class" , "classId" , classId , "colorId" , colorId , new Exception ( ) ) ; } return null ; } return record . colors . get ( colorId ) ; }
Looks up the requested color record .
117
7
138,404
public ColorRecord getColorRecord ( String className , String colorName ) { ClassRecord record = getClassRecord ( className ) ; if ( record == null ) { log . warning ( "Requested unknown color class" , "className" , className , "colorName" , colorName , new Exception ( ) ) ; return null ; } int colorId = 0 ; try { colorId = record . getColorId ( colorName ) ; } catch ( ParseException pe ) { log . info ( "Error getting color record by name" , "error" , pe ) ; return null ; } return record . colors . get ( colorId ) ; }
Looks up the requested color record by class and color names .
139
12
138,405
public void addClass ( ClassRecord record ) { // validate the class id if ( record . classId > 255 ) { log . warning ( "Refusing to add class; classId > 255 " + record + "." ) ; } else { _classes . put ( record . classId , record ) ; } }
Adds a fully configured color class record to the pository . This is only called by the XML parsing code so pay it no mind .
66
27
138,406
public static void saveColorPository ( ColorPository posit , File root ) { File path = new File ( root , CONFIG_PATH ) ; try { CompiledConfig . saveConfig ( path , posit ) ; } catch ( IOException ioe ) { log . warning ( "Failure saving color pository" , "path" , path , "error" , ioe ) ; } }
Serializes and saves color pository to the supplied file .
81
12
138,407
public void init ( CharacterDescriptor descrip , CharacterManager charmgr ) { // keep track of this stuff _descrip = descrip ; _charmgr = charmgr ; // sanity check our values sanityCheckDescrip ( ) ; // assign an arbitrary starting orientation _orient = SOUTHWEST ; // pass the buck to derived classes didInit ( ) ; }
Initializes this character sprite with the specified character descriptor and character manager . It will obtain animation data from the supplied character manager .
77
25
138,408
public void setActionSequence ( String action ) { // sanity check if ( action == null ) { log . warning ( "Refusing to set null action sequence " + this + "." , new Exception ( ) ) ; return ; } // no need to noop if ( action . equals ( _action ) ) { return ; } _action = action ; updateActionFrames ( ) ; }
Sets the action sequence used when rendering the character from the set of available sequences .
81
17
138,409
protected void updateActionFrames ( ) { // get a reference to the action sequence so that we can obtain // our animation frames and configure our frames per second ActionSequence actseq = _charmgr . getActionSequence ( _action ) ; if ( actseq == null ) { String errmsg = "No such action '" + _action + "'." ; throw new IllegalArgumentException ( errmsg ) ; } try { // obtain our animation frames for this action sequence _aframes = _charmgr . getActionFrames ( _descrip , _action ) ; // clear out our frames so that we recomposite on next tick _frames = null ; // update the sprite render attributes setFrameRate ( actseq . framesPerSecond ) ; } catch ( NoSuchComponentException nsce ) { log . warning ( "Character sprite references non-existent component" , "sprite" , this , "err" , nsce ) ; } catch ( Exception e ) { log . warning ( "Failed to obtain action frames" , "sprite" , this , "descrip" , _descrip , "action" , _action , e ) ; } }
Rebuilds our action frames given our current character descriptor and action sequence . This is called when either of those two things changes .
247
26
138,410
protected void sanityCheckDescrip ( ) { if ( _descrip . getComponentIds ( ) == null || _descrip . getComponentIds ( ) . length == 0 ) { log . warning ( "Invalid character descriptor [sprite=" + this + ", descrip=" + _descrip + "]." , new Exception ( ) ) ; } }
Makes it easier to track down problems with bogus character descriptors .
75
14
138,411
protected void halt ( ) { // only do something if we're actually animating if ( _animMode != NO_ANIMATION ) { // disable animation setAnimationMode ( NO_ANIMATION ) ; // come to a halt looking settled and at peace String rest = getRestingAction ( ) ; if ( rest != null ) { setActionSequence ( rest ) ; } } }
Updates the sprite animation frame to reflect the cessation of movement and disables any further animation .
81
19
138,412
public static void unmask ( WrappedByteBuffer buf , int mask ) { byte b ; int remainder = buf . remaining ( ) % 4 ; int remaining = buf . remaining ( ) - remainder ; int end = remaining + buf . position ( ) ; // xor a 32bit word at a time as long as possible while ( buf . position ( ) < end ) { int plaintext = buf . getIntAt ( buf . position ( ) ) ^ mask ; buf . putInt ( plaintext ) ; } // xor the remaining 3, 2, or 1 bytes switch ( remainder ) { case 3 : b = ( byte ) ( buf . getAt ( buf . position ( ) ) ^ ( ( mask >> 24 ) & 0xff ) ) ; buf . put ( b ) ; b = ( byte ) ( buf . getAt ( buf . position ( ) ) ^ ( ( mask >> 16 ) & 0xff ) ) ; buf . put ( b ) ; b = ( byte ) ( buf . getAt ( buf . position ( ) ) ^ ( ( mask >> 8 ) & 0xff ) ) ; buf . put ( b ) ; break ; case 2 : b = ( byte ) ( buf . getAt ( buf . position ( ) ) ^ ( ( mask >> 24 ) & 0xff ) ) ; buf . put ( b ) ; b = ( byte ) ( buf . getAt ( buf . position ( ) ) ^ ( ( mask >> 16 ) & 0xff ) ) ; buf . put ( b ) ; break ; case 1 : b = ( byte ) ( buf . getAt ( buf . position ( ) ) ^ ( mask >> 24 ) ) ; buf . put ( b ) ; break ; case 0 : default : break ; } //buf.position(start); }
Performs an in - situ unmasking of the readable buf bytes . Preserves the position of the buffer whilst unmasking all the readable bytes such that the unmasked bytes will be readable after this invocation .
371
42
138,413
private static stream_response newTscStream ( Stream < TimeSeriesCollection > tsc , int fetch ) { final BufferedIterator < TimeSeriesCollection > iter = new BufferedIterator ( tsc . iterator ( ) , TSC_QUEUE_SIZE ) ; final long idx = TSC_ITERS_ALLOC . getAndIncrement ( ) ; final IteratorAndCookie < TimeSeriesCollection > iterAndCookie = new IteratorAndCookie <> ( iter ) ; TSC_ITERS . put ( idx , iterAndCookie ) ; final List < TimeSeriesCollection > result = fetchFromIter ( iter , fetch , MAX_TSC_FETCH ) ; EncDec . NewIterResponse < TimeSeriesCollection > responseObj = new EncDec . NewIterResponse <> ( idx , result , iter . atEnd ( ) , iterAndCookie . getCookie ( ) ) ; LOG . log ( Level . FINE , "responseObj = {0}" , responseObj ) ; return EncDec . encodeStreamResponse ( responseObj ) ; }
Create a new TimeSeriesCollection iterator from the given stream .
231
12
138,414
private static evaluate_response newEvalStream ( Stream < Collection < CollectHistory . NamedEvaluation > > tsc , int fetch ) { final BufferedIterator < Collection < CollectHistory . NamedEvaluation > > iter = new BufferedIterator ( tsc . iterator ( ) , EVAL_QUEUE_SIZE ) ; final long idx = EVAL_ITERS_ALLOC . getAndIncrement ( ) ; final IteratorAndCookie < Collection < CollectHistory . NamedEvaluation > > iterAndCookie = new IteratorAndCookie <> ( iter ) ; EVAL_ITERS . put ( idx , iterAndCookie ) ; final List < Collection < CollectHistory . NamedEvaluation > > result = fetchFromIter ( iter , fetch , MAX_EVAL_FETCH ) ; EncDec . NewIterResponse < Collection < CollectHistory . NamedEvaluation > > responseObj = new EncDec . NewIterResponse <> ( idx , result , iter . atEnd ( ) , iterAndCookie . getCookie ( ) ) ; LOG . log ( Level . FINE , "responseObj = {0}" , responseObj ) ; return EncDec . encodeEvaluateResponse ( responseObj ) ; }
Create a new evaluation iterator from the given stream .
268
10
138,415
private static group_stream_response newGroupStream ( Stream < Map . Entry < DateTime , TimeSeriesValue > > tsc , int fetch ) { final BufferedIterator < Map . Entry < DateTime , TimeSeriesValue > > iter = new BufferedIterator <> ( tsc . iterator ( ) , GROUP_STREAM_QUEUE_SIZE ) ; final long idx = GROUP_STREAM_ITERS_ALLOC . getAndIncrement ( ) ; final IteratorAndCookie < Map . Entry < DateTime , TimeSeriesValue > > iterAndCookie = new IteratorAndCookie <> ( iter ) ; GROUP_STREAM_ITERS . put ( idx , iterAndCookie ) ; final List < Map . Entry < DateTime , TimeSeriesValue > > result = fetchFromIter ( iter , fetch , MAX_GROUP_STREAM_FETCH ) ; EncDec . NewIterResponse < Map . Entry < DateTime , TimeSeriesValue > > responseObj = new EncDec . NewIterResponse <> ( idx , result , iter . atEnd ( ) , iterAndCookie . getCookie ( ) ) ; LOG . log ( Level . FINE , "responseObj = {0}" , responseObj ) ; return EncDec . encodeStreamGroupResponse ( responseObj ) ; }
Create a new group iterator from the given stream .
283
10
138,416
private static < T > List < T > fetchFromIter ( BufferedIterator < T > iter , int fetch , int max_fetch ) { final long t0 = System . currentTimeMillis ( ) ; assert ( max_fetch >= 1 ) ; if ( fetch < 0 || fetch > max_fetch ) fetch = max_fetch ; final List < T > result = new ArrayList <> ( fetch ) ; for ( int i = 0 ; i < fetch && ! iter . atEnd ( ) ; ++ i ) { if ( iter . nextAvail ( ) ) result . add ( iter . next ( ) ) ; // Decide if we should cut the fetch short. // We stop fetching more items if the time delay exceeds the deadline. final long tCur = System . currentTimeMillis ( ) ; if ( ! result . isEmpty ( ) && tCur - t0 >= MIN_REQUEST_DURATION . getMillis ( ) ) break ; else if ( tCur - t0 >= MAX_REQUEST_DURATION . getMillis ( ) ) break ; else if ( ! iter . nextAvail ( ) ) { // Block until next is available, or until deadline is exceeded. try { iter . waitAvail ( ( t0 + MAX_REQUEST_DURATION . getMillis ( ) - tCur ) , TimeUnit . MILLISECONDS ) ; } catch ( InterruptedException ex ) { /* SKIP */ } } } return result ; }
Fetch up to a given amount of items from the iterator .
321
13
138,417
public static Object loadObject ( ResourceBundle bundle , String path , boolean wipeOnFailure ) throws IOException , ClassNotFoundException { InputStream bin = null ; try { bin = bundle . getResource ( path ) ; if ( bin == null ) { return null ; } return new ObjectInputStream ( bin ) . readObject ( ) ; } catch ( InvalidClassException ice ) { log . warning ( "Aiya! Serialized object is hosed [bundle=" + bundle + ", element=" + path + ", error=" + ice . getMessage ( ) + "]." ) ; return null ; } catch ( IOException ioe ) { log . warning ( "Error reading resource from bundle [bundle=" + bundle + ", path=" + path + ", wiping?=" + wipeOnFailure + "]." ) ; if ( wipeOnFailure ) { StreamUtil . close ( bin ) ; bin = null ; if ( bundle instanceof FileResourceBundle ) { ( ( FileResourceBundle ) bundle ) . wipeBundle ( false ) ; } } throw ioe ; } finally { StreamUtil . close ( bin ) ; } }
Attempts to load an object from the supplied resource bundle with the specified path .
238
15
138,418
protected String getTargetPath ( File fromDir , String path ) { return path . substring ( 0 , path . length ( ) - 4 ) + ".jar" ; }
Returns the target path in which our bundler will write the tile set .
36
15
138,419
public void updateBounds ( ) { // invalidate the old... invalidate ( ) ; // size the bounds to fit our label Dimension size = _label . getSize ( ) ; _bounds . width = size . width + PADDING * 2 + ( _style == ROUNDED ? _arcWidth : 0 ) ; _bounds . height = size . height + PADDING * 2 ; // ...and the new invalidate ( ) ; }
Updates this sprite s bounds after a change to the label .
96
13
138,420
public static int getClosest ( int direction , int [ ] possible , boolean preferCW ) { // rotate a tick at a time, looking for matches int first = direction ; int second = direction ; for ( int ii = 0 ; ii <= FINE_DIRECTION_COUNT / 2 ; ii ++ ) { if ( IntListUtil . contains ( possible , first ) ) { return first ; } if ( ii != 0 && IntListUtil . contains ( possible , second ) ) { return second ; } first = preferCW ? rotateCW ( first , 1 ) : rotateCCW ( first , 1 ) ; second = preferCW ? rotateCCW ( second , 1 ) : rotateCW ( second , 1 ) ; } return NONE ; }
Get the direction closest to the specified direction out of the directions in the possible list .
159
17
138,421
public static void moveDirection ( Point p , int direction , int dx , int dy ) { if ( direction >= DIRECTION_COUNT ) { throw new IllegalArgumentException ( "Fine coordinates not supported." ) ; } switch ( direction ) { case NORTH : case NORTHWEST : case NORTHEAST : p . y -= dy ; } switch ( direction ) { case SOUTH : case SOUTHWEST : case SOUTHEAST : p . y += dy ; } switch ( direction ) { case WEST : case SOUTHWEST : case NORTHWEST : p . x -= dx ; } switch ( direction ) { case EAST : case SOUTHEAST : case NORTHEAST : p . x += dx ; } }
Move the specified point in the specified screen direction adjusting by the specified adjustments . Fine directions are not supported .
156
21
138,422
protected Component getRoot ( Component comp ) { for ( Component c = comp ; c != null ; c = c . getParent ( ) ) { boolean hidden = ! c . isDisplayable ( ) ; // on the mac, the JRootPane is invalidated before it is visible and is never again // invalidated or repainted, so we punt and allow all invisible components to be // invalidated and revalidated if ( ! RunAnywhere . isMacOS ( ) ) { hidden |= ! c . isVisible ( ) ; } if ( hidden ) { return null ; } if ( c instanceof Window || c instanceof Applet ) { return c ; } } return null ; }
Returns the root component for the supplied component or null if it is not part of a rooted hierarchy or if any parent along the way is found to be hidden or without a peer .
146
36
138,423
public void validateComponents ( ) { // swap out our invalid array Object [ ] invalid = null ; synchronized ( this ) { invalid = _invalid ; _invalid = null ; } // if there's nothing to validate, we're home free if ( invalid == null ) { return ; } // validate everything therein int icount = invalid . length ; for ( int ii = 0 ; ii < icount ; ii ++ ) { if ( invalid [ ii ] != null ) { if ( DEBUG ) { log . info ( "Validating " + invalid [ ii ] ) ; } ( ( Component ) invalid [ ii ] ) . validate ( ) ; } } }
Validates the invalid components that have been queued up since the last frame tick .
137
17
138,424
protected static void dumpHierarchy ( Component comp ) { for ( String indent = "" ; comp != null ; indent += " " ) { log . info ( indent + toString ( comp ) ) ; comp = comp . getParent ( ) ; } }
Dumps the containment hierarchy for the supplied component .
53
10
138,425
public void addNode ( int x , int y , int dir ) { _nodes . add ( new PathNode ( x , y , dir ) ) ; }
Add a node to the path with the specified destination point and facing direction .
34
15
138,426
public void setDuration ( long millis ) { // if we have only zero or one nodes, we don't have enough // information to compute our velocity int ncount = _nodes . size ( ) ; if ( ncount < 2 ) { log . warning ( "Requested to set duration of bogus path" , "path" , this , "duration" , millis ) ; return ; } // compute the total distance along our path float distance = 0 ; PathNode start = _nodes . get ( 0 ) ; for ( int ii = 1 ; ii < ncount ; ii ++ ) { PathNode end = _nodes . get ( ii ) ; distance += MathUtil . distance ( start . loc . x , start . loc . y , end . loc . x , end . loc . y ) ; start = end ; } // set the velocity accordingly setVelocity ( distance / millis ) ; }
Computes the velocity at which the pathable will need to travel along this path such that it will arrive at the destination in approximately the specified number of milliseconds . Efforts are taken to get the pathable there as close to the desired time as possible but framerate variation may prevent it from arriving exactly on time .
192
63
138,427
protected boolean headToNextNode ( Pathable pable , long startstamp , long now ) { if ( _niter == null ) { throw new IllegalStateException ( "headToNextNode() called before init()" ) ; } // check to see if we've completed our path if ( ! _niter . hasNext ( ) ) { // move the pathable to the location of our last destination pable . setLocation ( _dest . loc . x , _dest . loc . y ) ; pable . pathCompleted ( now ) ; return true ; } // our previous destination is now our source _src = _dest ; // pop the next node off the path _dest = getNextNode ( ) ; // adjust the pathable's orientation if ( _dest . dir != NONE ) { pable . setOrientation ( _dest . dir ) ; } // make a note of when we started traversing this node _nodestamp = startstamp ; // figure out the distance from source to destination _seglength = MathUtil . distance ( _src . loc . x , _src . loc . y , _dest . loc . x , _dest . loc . y ) ; // if we're already there (the segment length is zero), we skip to // the next segment if ( _seglength == 0 ) { return headToNextNode ( pable , startstamp , now ) ; } // now update the pathable's position based on our progress thus far return tick ( pable , now ) ; }
Place the pathable moving along the path at the end of the previous path node face it appropriately for the next node and start it on its way . Returns whether the pathable position moved .
324
38
138,428
protected void createPath ( List < Point > points ) { Point last = null ; int size = points . size ( ) ; for ( int ii = 0 ; ii < size ; ii ++ ) { Point p = points . get ( ii ) ; int dir = ( ii == 0 ) ? NORTH : DirectionUtil . getDirection ( last , p ) ; addNode ( p . x , p . y , dir ) ; last = p ; } }
Populate the path with the path nodes that lead the pathable from its starting position to the given destination coordinates following the given list of screen coordinates .
96
30
138,429
public static void browseURL ( URL url , ResultListener < Void > listener , String genagent ) { String [ ] cmd ; if ( RunAnywhere . isWindows ( ) ) { // TODO: test this on Vinders 98 // cmd = new String[] { "rundll32", "url.dll,FileProtocolHandler", // url.toString() }; String osName = System . getProperty ( "os.name" ) ; if ( osName . indexOf ( "9" ) != - 1 || osName . indexOf ( "Me" ) != - 1 ) { cmd = new String [ ] { "command.com" , "/c" , "start" , "\"" + url . toString ( ) + "\"" } ; } else { cmd = new String [ ] { "cmd.exe" , "/c" , "start" , "\"\"" , "\"" + url . toString ( ) + "\"" } ; } } else if ( RunAnywhere . isMacOS ( ) ) { cmd = new String [ ] { "open" , url . toString ( ) } ; } else { // Linux, Solaris, etc cmd = new String [ ] { genagent , url . toString ( ) } ; } // obscure any password information String logcmd = StringUtil . join ( cmd , " " ) ; logcmd = logcmd . replaceAll ( "password=[^&]*" , "password=XXX" ) ; log . info ( "Browsing URL [cmd=" + logcmd + "]." ) ; try { Process process = Runtime . getRuntime ( ) . exec ( cmd ) ; BrowserTracker tracker = new BrowserTracker ( process , url , listener ) ; tracker . start ( ) ; } catch ( Exception e ) { log . warning ( "Failed to launch browser [url=" + url + ", error=" + e + "]." ) ; listener . requestFailed ( e ) ; } }
Opens the user s web browser with the specified URL .
419
12
138,430
public void setPosition ( float x , float y , float z ) { if ( _px != x || _py != y || _pz != z ) { AL10 . alSource3f ( _id , AL10 . AL_POSITION , _px = x , _py = y , _pz = z ) ; } }
Sets the position of the source .
72
8
138,431
public void setVelocity ( float x , float y , float z ) { if ( _vx != x || _vy != y || _vz != z ) { AL10 . alSource3f ( _id , AL10 . AL_VELOCITY , _vx = x , _vy = y , _vz = z ) ; } }
Sets the velocity of the source .
76
8
138,432
public void setGain ( float gain ) { if ( _gain != gain ) { AL10 . alSourcef ( _id , AL10 . AL_GAIN , _gain = gain ) ; } }
Sets the gain of the source .
44
8
138,433
public void setSourceRelative ( boolean relative ) { if ( _sourceRelative != relative ) { _sourceRelative = relative ; AL10 . alSourcei ( _id , AL10 . AL_SOURCE_RELATIVE , relative ? AL10 . AL_TRUE : AL10 . AL_FALSE ) ; } }
Sets whether or not the position velocity etc . of the source are relative to the listener .
69
19
138,434
public void setLooping ( boolean looping ) { if ( _looping != looping ) { _looping = looping ; AL10 . alSourcei ( _id , AL10 . AL_LOOPING , looping ? AL10 . AL_TRUE : AL10 . AL_FALSE ) ; } }
Sets whether or not the source is looping .
69
11
138,435
public void setMinGain ( float gain ) { if ( _minGain != gain ) { AL10 . alSourcef ( _id , AL10 . AL_MIN_GAIN , _minGain = gain ) ; } }
Sets the minimum gain .
51
6
138,436
public void setMaxGain ( float gain ) { if ( _maxGain != gain ) { AL10 . alSourcef ( _id , AL10 . AL_MAX_GAIN , _maxGain = gain ) ; } }
Sets the maximum gain .
51
6
138,437
public void setReferenceDistance ( float distance ) { if ( _referenceDistance != distance ) { AL10 . alSourcef ( _id , AL10 . AL_REFERENCE_DISTANCE , _referenceDistance = distance ) ; } }
Sets the reference distance for attenuation .
51
9
138,438
public void setRolloffFactor ( float rolloff ) { if ( _rolloffFactor != rolloff ) { AL10 . alSourcef ( _id , AL10 . AL_ROLLOFF_FACTOR , _rolloffFactor = rolloff ) ; } }
Sets the rolloff factor for attenuation .
57
10
138,439
public void setMaxDistance ( float distance ) { if ( _maxDistance != distance ) { AL10 . alSourcef ( _id , AL10 . AL_MAX_DISTANCE , _maxDistance = distance ) ; } }
Sets the maximum distance for attenuation .
49
9
138,440
public void setPitch ( float pitch ) { if ( _pitch != pitch ) { AL10 . alSourcef ( _id , AL10 . AL_PITCH , _pitch = pitch ) ; } }
Sets the pitch multiplier .
46
6
138,441
public void setDirection ( float x , float y , float z ) { if ( _dx != x || _dy != y || _dz != z ) { AL10 . alSource3f ( _id , AL10 . AL_DIRECTION , _dx = x , _dy = y , _dz = z ) ; } }
Sets the direction of the source .
74
8
138,442
public void setConeInnerAngle ( float angle ) { if ( _coneInnerAngle != angle ) { AL10 . alSourcef ( _id , AL10 . AL_CONE_INNER_ANGLE , _coneInnerAngle = angle ) ; } }
Sets the inside angle of the sound cone .
62
10
138,443
public void setConeOuterAngle ( float angle ) { if ( _coneOuterAngle != angle ) { AL10 . alSourcef ( _id , AL10 . AL_CONE_OUTER_ANGLE , _coneOuterAngle = angle ) ; } }
Sets the outside angle of the sound cone .
62
10
138,444
public void setConeOuterGain ( float gain ) { if ( _coneOuterGain != gain ) { AL10 . alSourcef ( _id , AL10 . AL_CONE_OUTER_GAIN , _coneOuterGain = gain ) ; } }
Sets the gain outside of the sound cone .
62
10
138,445
public void setBuffer ( Buffer buffer ) { _queue . clear ( ) ; if ( buffer != null ) { _queue . add ( buffer ) ; } AL10 . alSourcei ( _id , AL10 . AL_BUFFER , buffer == null ? AL10 . AL_NONE : buffer . getId ( ) ) ; }
Sets the source buffer . Equivalent to unqueueing all buffers then queuing the provided buffer . Cannot be called when the source is playing or paused .
71
32
138,446
public void queueBuffers ( Buffer ... buffers ) { IntBuffer idbuf = BufferUtils . createIntBuffer ( buffers . length ) ; for ( int ii = 0 ; ii < buffers . length ; ii ++ ) { Buffer buffer = buffers [ ii ] ; _queue . add ( buffer ) ; idbuf . put ( ii , buffer . getId ( ) ) ; } AL10 . alSourceQueueBuffers ( _id , idbuf ) ; }
Enqueues the specified buffers .
95
7
138,447
public void unqueueBuffers ( Buffer ... buffers ) { IntBuffer idbuf = BufferUtils . createIntBuffer ( buffers . length ) ; for ( int ii = 0 ; ii < buffers . length ; ii ++ ) { Buffer buffer = buffers [ ii ] ; _queue . remove ( buffer ) ; idbuf . put ( ii , buffer . getId ( ) ) ; } AL10 . alSourceUnqueueBuffers ( _id , idbuf ) ; }
Removes the specified buffers from the queue .
97
9
138,448
public void delete ( ) { IntBuffer idbuf = BufferUtils . createIntBuffer ( 1 ) ; idbuf . put ( _id ) . rewind ( ) ; AL10 . alDeleteSources ( idbuf ) ; _id = 0 ; _queue . clear ( ) ; }
Deletes this source rendering it unusable .
60
9
138,449
public UniformTileSet loadTileSet ( String imgPath , int width , int height ) { return loadCachedTileSet ( "" , imgPath , width , height ) ; }
Loads up a tileset from the specified image with the specified metadata parameters .
37
16
138,450
public TileSet getTileSet ( String name ) throws NoSuchTileSetException { // make sure we have a repository configured if ( _setrep == null ) { throw new NoSuchTileSetException ( name ) ; } try { return _setrep . getTileSet ( name ) ; } catch ( PersistenceException pe ) { log . warning ( "Failure loading tileset" , "name" , name , "error" , pe ) ; throw new NoSuchTileSetException ( name ) ; } }
Returns the tileset with the specified name .
106
9
138,451
public Map < String , Object > getProperties ( ) { // Shallow copy entries to a newly instantiated HashMap. Map < String , Object > clone = new HashMap < String , Object > ( ) ; Set < Entry < String , Object > > set = _properties . entrySet ( ) ; for ( Entry < String , Object > entry : set ) { // There wouldn't be any entry with a null value. clone . put ( entry . getKey ( ) , entry . getValue ( ) ) ; } return clone ; }
Returns a clone of the properties HashMap by shallow copying the values .
113
14
138,452
public void setAppId ( String appId ) { if ( appId == null ) { _properties . remove ( AMQP_PROP_APP_ID ) ; return ; } _properties . put ( AMQP_PROP_APP_ID , appId ) ; }
Sets the value of appId property . If a null value is passed in it indicates that the property is not set .
60
25
138,453
public void setContentType ( String contentType ) { if ( contentType == null ) { _properties . remove ( AMQP_PROP_CONTENT_TYPE ) ; return ; } _properties . put ( AMQP_PROP_CONTENT_TYPE , contentType ) ; }
Sets the value of contentType property . If a null value is passed in it indicates that the property is not set .
62
25
138,454
public void setContentEncoding ( String encoding ) { if ( encoding == null ) { _properties . remove ( AMQP_PROP_CONTENT_ENCODING ) ; return ; } _properties . put ( AMQP_PROP_CONTENT_ENCODING , encoding ) ; }
Sets the value of contentEncoding property . If a null value is passed in it indicates that the property is not set .
64
26
138,455
public void setCorrelationId ( String correlationId ) { if ( correlationId == null ) { _properties . remove ( AMQP_PROP_CORRELATION_ID ) ; return ; } _properties . put ( AMQP_PROP_CORRELATION_ID , correlationId ) ; }
Sets the value of correlationId property . If a null value is passed in it indicates that the property is not set .
65
25
138,456
public void setDeliveryMode ( Integer deliveryMode ) { if ( deliveryMode == null ) { _properties . remove ( AMQP_PROP_DELIVERY_MODE ) ; return ; } // Perhaps, we could do an enum for deliveryMode. But, it will require // some major changes in encoding and decoding and we don't have much // time to do it across all the clients. int value = deliveryMode . intValue ( ) ; if ( ( value != 1 ) && ( value != 2 ) ) { String s = "AMQP 0-9-1 spec mandates 'deliveryMode' value to be " + "either 1(for non-persistent) or 2(for persistent)" ; throw new IllegalStateException ( s ) ; } _properties . put ( AMQP_PROP_DELIVERY_MODE , deliveryMode ) ; }
Sets the value of deliveryMode property . If a null value is passed in it indicates that the property is not set .
184
25
138,457
public void setExpiration ( String expiration ) { if ( expiration == null ) { _properties . remove ( AMQP_PROP_EXPIRATION ) ; return ; } _properties . put ( AMQP_PROP_EXPIRATION , expiration ) ; }
Sets the value of expiration property . If a null value is passed in it indicates that the property is not set .
57
24
138,458
public void setHeaders ( AmqpArguments headers ) { if ( headers == null ) { _properties . remove ( AMQP_PROP_HEADERS ) ; return ; } _properties . put ( AMQP_PROP_HEADERS , headers ) ; }
Sets the value of headers property . If a null value is passed in it indicates that the property is not set .
59
24
138,459
public void setMessageId ( String messageId ) { if ( messageId == null ) { _properties . remove ( AMQP_PROP_MESSAGE_ID ) ; return ; } _properties . put ( AMQP_PROP_MESSAGE_ID , messageId ) ; }
Sets the value of messageId property . If a null value is passed in it indicates that the property is not set .
66
25
138,460
public void setPriority ( Integer priority ) { if ( priority == null ) { _properties . remove ( AMQP_PROP_PRIORITY ) ; return ; } int priorityValue = priority . intValue ( ) ; if ( ( priorityValue < 0 ) || ( priorityValue > 9 ) ) { String s = "AMQP 0-9-1 spec mandates 'priority' value to be between 0 and 9" ; throw new IllegalStateException ( s ) ; } _properties . put ( AMQP_PROP_PRIORITY , priority ) ; }
Sets the value of priority property . If a null value is passed in it indicates that the property is not set .
121
24
138,461
public void setReplyTo ( String replyTo ) { if ( replyTo == null ) { _properties . remove ( AMQP_PROP_REPLY_TO ) ; return ; } _properties . put ( AMQP_PROP_REPLY_TO , replyTo ) ; }
Sets the value of replyTo property . If a null value is passed in it indicates that the property is not set .
64
25
138,462
public void setTimestamp ( Timestamp timestamp ) { if ( timestamp == null ) { _properties . remove ( AMQP_PROP_TIMESTAMP ) ; return ; } _properties . put ( AMQP_PROP_TIMESTAMP , timestamp ) ; }
Sets the value of timestamp property . If a null value is passed in it indicates that the property is not set .
60
24
138,463
public void setType ( String type ) { if ( type == null ) { _properties . remove ( AMQP_PROP_TYPE ) ; return ; } _properties . put ( AMQP_PROP_TYPE , type ) ; }
Sets the value of type property . If a null value is passed in it indicates that the property is not set .
52
24
138,464
public void setUserId ( String userId ) { if ( userId == null ) { _properties . remove ( AMQP_PROP_USER_ID ) ; return ; } _properties . put ( AMQP_PROP_USER_ID , userId ) ; }
Sets the value of userId property . If a null value is passed in it indicates that the property is not set .
60
25
138,465
public boolean createBundle ( File target , TileSetBundle bundle , ImageProvider improv , String imageBase , long newestMod ) throws IOException { return createBundleJar ( target , bundle , improv , imageBase , _keepRawPngs , _uncompressed ) ; }
Finish the creation of a tileset bundle jar file .
60
11
138,466
protected void initBundles ( ResourceManager rmgr , String name ) { // first we obtain the resource set from which we will load up our // tileset bundles ResourceBundle [ ] rbundles = rmgr . getResourceSet ( name ) ; // sanity check if ( rbundles == null ) { log . warning ( "Unable to fetch tileset resource set " + "[name=" + name + "]. Perhaps it's not defined " + "in the resource manager config?" ) ; return ; } HashIntMap < TileSet > idmap = new HashIntMap < TileSet > ( ) ; HashMap < String , Integer > namemap = Maps . newHashMap ( ) ; // iterate over the resource bundles in the set, loading up the // tileset bundles in each resource bundle for ( ResourceBundle rbundle : rbundles ) { addBundle ( idmap , namemap , rbundle ) ; } // fill in our bundles array and wake up any waiters synchronized ( this ) { _idmap = idmap ; _namemap = namemap ; notifyAll ( ) ; } }
Initializes our bundles
246
4
138,467
protected void addBundle ( HashIntMap < TileSet > idmap , HashMap < String , Integer > namemap , ResourceBundle bundle ) { try { TileSetBundle tsb = BundleUtil . extractBundle ( bundle ) ; // initialize it and add it to the list tsb . init ( bundle ) ; addBundle ( idmap , namemap , tsb ) ; } catch ( Exception e ) { log . warning ( "Unable to load tileset bundle '" + BundleUtil . METADATA_PATH + "' from resource bundle [rbundle=" + bundle + "]." , e ) ; } }
Extracts the tileset bundle from the supplied resource bundle and registers it .
138
16
138,468
protected void addBundle ( HashIntMap < TileSet > idmap , HashMap < String , Integer > namemap , TileSetBundle bundle ) { IMImageProvider improv = ( _imgr == null ) ? null : new IMImageProvider ( _imgr , bundle ) ; // map all of the tilesets in this bundle for ( IntMap . IntEntry < TileSet > entry : bundle . intEntrySet ( ) ) { Integer tsid = entry . getKey ( ) ; TileSet tset = entry . getValue ( ) ; tset . setImageProvider ( improv ) ; idmap . put ( tsid . intValue ( ) , tset ) ; namemap . put ( tset . getName ( ) , tsid ) ; } }
Adds the tilesets in the supplied bundle to our tileset mapping tables . Any tilesets with the same name or id will be overwritten .
165
29
138,469
public SceneObjectIndicator createIndicator ( MisoScenePanel panel , String text , Icon icon ) { return new SceneObjectTip ( text , icon ) ; }
Creates an indicator for this type of object action .
34
11
138,470
public static void register ( String prefix , ObjectActionHandler handler ) { // make sure we know about potential funny business if ( _oahandlers . containsKey ( prefix ) ) { log . warning ( "Warning! Overwriting previous object action handler registration, all " + "hell could shortly break loose" , "prefix" , prefix , "handler" , handler ) ; } _oahandlers . put ( prefix , handler ) ; }
Registers an object action handler which will be called when a user clicks on an object in a scene that has an associated action .
92
26
138,471
public static int bound ( int low , int value , int high ) { return Math . min ( high , Math . max ( low , value ) ) ; }
Bounds the supplied value within the specified range .
33
10
138,472
public static int distanceSq ( int x0 , int y0 , int x1 , int y1 ) { return ( ( x1 - x0 ) * ( x1 - x0 ) ) + ( ( y1 - y0 ) * ( y1 - y0 ) ) ; }
Return the squared distance between the given points .
62
9
138,473
public static float [ ] stddev ( int [ ] values , int start , int length ) { // first we need the mean float mean = 0f ; for ( int ii = start , end = start + length ; ii < end ; ii ++ ) { mean += values [ ii ] ; } mean /= length ; // next we compute the variance float variance = 0f ; for ( int ii = start , end = start + length ; ii < end ; ii ++ ) { float value = values [ ii ] - mean ; variance += value * value ; } variance /= ( length - 1 ) ; // the standard deviation is the square root of the variance return new float [ ] { mean , variance , ( float ) Math . sqrt ( variance ) } ; }
Computes the standard deviation of the supplied values .
160
10
138,474
private void validateNamesUnique ( List < String > names ) { List < String > seenNames = new ArrayList <> ( names . size ( ) ) ; for ( int i = 0 ; i < names . size ( ) ; i ++ ) { String lowerCaseName = names . get ( i ) . toLowerCase ( ) ; int index = seenNames . indexOf ( lowerCaseName ) ; if ( index != - 1 ) { throw new IllegalArgumentException ( "Duplicate field: " + lowerCaseName + " found at positions " + i + "and" + index + ". Field names are case insensitive and must be unique." ) ; } seenNames . add ( lowerCaseName ) ; } }
For full ORC compatibility field names should be unique when lowercased .
151
15
138,475
public void setSpot ( int x , int y , byte orient ) { _spot = new Point ( x , y ) ; _sorient = orient ; }
Configures the spot associated with this object .
33
9
138,476
public boolean hasConstraint ( String constraint ) { return ( _constraints == null ) ? false : ListUtil . contains ( _constraints , constraint ) ; }
Checks whether this object has the given constraint .
38
10
138,477
public String getSyntax ( ) { if ( name != null && longName != null ) { return String . format ( "-%s (--%s)" , name , longName ) ; } else if ( name != null ) { return String . format ( "-%s" , name ) ; } else if ( longName != null ) { return String . format ( "--%s" , longName ) ; } throw new Error ( ) ; }
Returns the option syntax sans optional token if option takes an argument .
95
13
138,478
public void setLocalePrefix ( final String prefix ) { setLocaleHandler ( new LocaleHandler ( ) { public String getLocalePath ( String path ) { return PathUtil . appendPath ( prefix , path ) ; } } ) ; }
Configure a default LocaleHandler with the specified prefix .
54
12
138,479
public void initBundles ( String resourceDir , String configPath , InitObserver initObs ) throws IOException { // reinitialize our resource dir if it was specified if ( resourceDir != null ) { initResourceDir ( resourceDir ) ; } // load up our configuration Properties config = loadConfig ( configPath ) ; // resolve the configured resource sets List < ResourceBundle > dlist = Lists . newArrayList ( ) ; Enumeration < ? > names = config . propertyNames ( ) ; while ( names . hasMoreElements ( ) ) { String key = ( String ) names . nextElement ( ) ; if ( ! key . startsWith ( RESOURCE_SET_PREFIX ) ) { continue ; } String setName = key . substring ( RESOURCE_SET_PREFIX . length ( ) ) ; String resourceSetType = config . getProperty ( RESOURCE_SET_TYPE_PREFIX + setName , FILE_SET_TYPE ) ; resolveResourceSet ( setName , config . getProperty ( key ) , resourceSetType , dlist ) ; } // if an observer was passed in, then we do not need to block the caller final boolean [ ] shouldWait = new boolean [ ] { false } ; if ( initObs == null ) { // if there's no observer, we'll need to block the caller shouldWait [ 0 ] = true ; initObs = new InitObserver ( ) { public void progress ( int percent , long remaining ) { if ( percent >= 100 ) { synchronized ( this ) { // turn off shouldWait, in case we reached 100% progress before the // calling thread even gets a chance to get to the blocking code, below shouldWait [ 0 ] = false ; notify ( ) ; } } } public void initializationFailed ( Exception e ) { synchronized ( this ) { shouldWait [ 0 ] = false ; notify ( ) ; } } } ; } // start a thread to unpack our bundles Unpacker unpack = new Unpacker ( dlist , initObs ) ; unpack . start ( ) ; if ( shouldWait [ 0 ] ) { synchronized ( initObs ) { if ( shouldWait [ 0 ] ) { try { initObs . wait ( ) ; } catch ( InterruptedException ie ) { log . warning ( "Interrupted while waiting for bundles to unpack." ) ; } } } } }
Initializes the bundle sets to be made available by this resource manager . Applications that wish to make use of resource bundles should call this method after constructing the resource manager .
501
33
138,480
public boolean checkBundle ( String path ) { File bfile = getResourceFile ( path ) ; return ( bfile == null ) ? false : new FileResourceBundle ( bfile , true , _unpack ) . isUnpacked ( ) ; }
Checks to see if the specified bundle exists is unpacked and is ready to be used .
54
19
138,481
public InputStream getResource ( String path ) throws IOException { String localePath = getLocalePath ( path ) ; InputStream in ; // first look for this resource in our default resource bundle for ( ResourceBundle bundle : _default ) { // Try a localized version first. if ( localePath != null ) { in = bundle . getResource ( localePath ) ; if ( in != null ) { return in ; } } // If that didn't work, try generic. in = bundle . getResource ( path ) ; if ( in != null ) { return in ; } } // fallback next to an unpacked resource file File file = getResourceFile ( path ) ; if ( file != null && file . exists ( ) ) { return new FileInputStream ( file ) ; } // if we still didn't find anything, try the classloader; first try a locale-specific file if ( localePath != null ) { in = getInputStreamFromClasspath ( PathUtil . appendPath ( _rootPath , localePath ) ) ; if ( in != null ) { return in ; } } // if we didn't find that, try locale-neutral in = getInputStreamFromClasspath ( PathUtil . appendPath ( _rootPath , path ) ) ; if ( in != null ) { return in ; } // if we still haven't found it, we throw an exception throw new FileNotFoundException ( "Unable to locate resource [path=" + path + "]" ) ; }
Fetches a resource from the local repository .
314
10
138,482
public void addModificationObserver ( String path , ModificationObserver obs ) { ObservedResource resource = _observed . get ( path ) ; if ( resource == null ) { File file = getResourceFile ( path ) ; if ( file == null ) { return ; // only resource files will ever be modified } _observed . put ( path , resource = new ObservedResource ( file ) ) ; } resource . observers . add ( obs ) ; }
Adds a modification observer for the specified resource . Note that only a weak reference to the observer will be retained and thus this will not prevent the observer from being garbage - collected .
97
35
138,483
public void removeModificationObserver ( String path , ModificationObserver obs ) { ObservedResource resource = _observed . get ( path ) ; if ( resource != null ) { resource . observers . remove ( obs ) ; } }
Removes a modification observer from the list maintained for the specified resource .
50
14
138,484
protected Properties loadConfig ( String configPath ) throws IOException { Properties config = new Properties ( ) ; try { config . load ( new FileInputStream ( new File ( _rdir , configPath ) ) ) ; } catch ( Exception e ) { String errmsg = "Unable to load resource manager config [rdir=" + _rdir + ", cpath=" + configPath + "]" ; log . warning ( errmsg + "." , e ) ; throw new IOException ( errmsg ) ; } return config ; }
Loads the configuration properties for our resource sets .
111
10
138,485
protected void resolveResourceSet ( String setName , String definition , String setType , List < ResourceBundle > dlist ) { List < ResourceBundle > set = Lists . newArrayList ( ) ; StringTokenizer tok = new StringTokenizer ( definition , ":" ) ; while ( tok . hasMoreTokens ( ) ) { set . add ( createResourceBundle ( setType , tok . nextToken ( ) . trim ( ) , dlist ) ) ; } // convert our array list into an array and stick it in the table ResourceBundle [ ] setvec = set . toArray ( new ResourceBundle [ set . size ( ) ] ) ; _sets . put ( setName , setvec ) ; // if this is our default resource bundle, keep a reference to it if ( DEFAULT_RESOURCE_SET . equals ( setName ) ) { _default = setvec ; } }
Loads up a resource set based on the supplied definition information .
193
13
138,486
protected ResourceBundle createResourceBundle ( String setType , String path , List < ResourceBundle > dlist ) { if ( setType . equals ( FILE_SET_TYPE ) ) { FileResourceBundle bundle = createFileResourceBundle ( getResourceFile ( path ) , true , _unpack ) ; if ( ! bundle . isUnpacked ( ) || ! bundle . sourceIsReady ( ) ) { dlist . add ( bundle ) ; } return bundle ; } else if ( setType . equals ( NETWORK_SET_TYPE ) ) { return createNetworkResourceBundle ( _networkRootPath , path , getResourceList ( ) ) ; } else { throw new IllegalArgumentException ( "Unknown set type: " + setType ) ; } }
Creates a ResourceBundle based on the supplied definition information .
161
13
138,487
protected FileResourceBundle createFileResourceBundle ( File source , boolean delay , boolean unpack ) { return new FileResourceBundle ( source , delay , unpack ) ; }
Creates an appropriate bundle for fetching resources from files .
38
12
138,488
protected ResourceBundle createNetworkResourceBundle ( String root , String path , Set < String > rsrcList ) { return new NetworkResourceBundle ( root , path , rsrcList ) ; }
Creates an appropriate bundle for fetching resources from the network .
42
13
138,489
protected InputStream getInputStreamFromClasspath ( final String fullyQualifiedPath ) { return AccessController . doPrivileged ( new PrivilegedAction < InputStream > ( ) { public InputStream run ( ) { return _loader . getResourceAsStream ( fullyQualifiedPath ) ; } } ) ; }
Returns an InputStream from this manager s classloader for the given path .
64
15
138,490
protected String getLocalePath ( String path ) { return ( _localeHandler == null ) ? null : _localeHandler . getLocalePath ( path ) ; }
Transform the path into a locale - specific one or return null .
37
13
138,491
protected static int getNumericJavaVersion ( String verstr ) { Matcher m = Pattern . compile ( "(\\d+)\\.(\\d+)\\.(\\d+)(_\\d+)?.*" ) . matcher ( verstr ) ; if ( ! m . matches ( ) ) { // if we can't parse the java version we're in weird land and should probably just try // our luck with what we've got rather than try to download a new jvm log . warning ( "Unable to parse VM version, hoping for the best [version=" + verstr + "]" ) ; return 0 ; } int one = Integer . parseInt ( m . group ( 1 ) ) ; // will there ever be a two? int major = Integer . parseInt ( m . group ( 2 ) ) ; int minor = Integer . parseInt ( m . group ( 3 ) ) ; int patch = m . group ( 4 ) == null ? 0 : Integer . parseInt ( m . group ( 4 ) . substring ( 1 ) ) ; return patch + 100 * ( minor + 100 * ( major + 100 * one ) ) ; }
Converts the java version string to a more comparable numeric version number .
239
14
138,492
private void writeObject ( ObjectOutputStream out ) throws IOException { out . writeInt ( size ( ) ) ; for ( IntEntry < TileSet > entry : intEntrySet ( ) ) { out . writeInt ( entry . getIntKey ( ) ) ; out . writeObject ( entry . getValue ( ) ) ; } }
custom serialization process
70
4
138,493
private void readObject ( ObjectInputStream in ) throws IOException , ClassNotFoundException { int count = in . readInt ( ) ; for ( int ii = 0 ; ii < count ; ii ++ ) { int tileSetId = in . readInt ( ) ; TileSet set = ( TileSet ) in . readObject ( ) ; put ( tileSetId , set ) ; } }
custom unserialization process
82
5
138,494
public void run ( ) { boolean validation_fail = false ; boolean arg_seen = true ; for ( String file : files ) { final Report v = new Report ( new File ( file ) . getAbsoluteFile ( ) , recursive ) ; if ( v . hasErrors ( ) ) validation_fail = true ; if ( arg_seen ) { arg_seen = false ; } else { System . out . println ( Stream . generate ( ( ) -> "-" ) . limit ( 72 ) . collect ( Collectors . joining ( ) ) ) ; } System . out . print ( v . configString ( ) . filter ( ( x ) - > print ) . orElseGet ( ( ) -> v . toString ( ) ) ) ; } if ( validation_fail ) System . exit ( EX_TEMPFAIL ) ; }
Perform validation .
176
4
138,495
private synchronized void onNewMbean ( ObjectName obj ) { if ( detected_groups_ . keySet ( ) . contains ( obj ) ) { LOG . log ( Level . WARNING , "skipping registration of {0}: already present" , obj ) ; return ; } MBeanGroup instance = new MBeanGroup ( obj , resolvedMap ) ; detected_groups_ . put ( obj , instance ) ; LOG . log ( Level . FINE , "registered metrics for {0}: {1}" , new Object [ ] { obj , instance } ) ; }
Respond to MBeans being added .
119
9
138,496
private synchronized void onRemovedMbean ( ObjectName obj ) { if ( ! detected_groups_ . keySet ( ) . contains ( obj ) ) { LOG . log ( Level . WARNING , "skipping de-registration of {0}: not present" , obj ) ; return ; } MBeanGroup instance = detected_groups_ . get ( obj ) ; detected_groups_ . remove ( obj ) ; LOG . log ( Level . FINE , "de-registered metrics for {0}: {1}" , new Object [ ] { obj , instance } ) ; }
Respond to MBeans being removed .
121
9
138,497
public static void renderIndex ( final PrintWriter out , final Collection < ? extends HelpPage > pages ) { checkNotNull ( out ) ; checkNotNull ( pages ) ; checkArgument ( ! pages . isEmpty ( ) , "No help pages to render index" ) ; // construct a printf format with sizing for showing columns int max = pages . stream ( ) . mapToInt ( page -> page . getName ( ) . length ( ) ) . max ( ) . orElse ( 0 ) ; String nameFormat = "%-" + max + ' ' ; for ( HelpPage page : pages ) { String formattedName = String . format ( nameFormat , page . getName ( ) ) ; out . format ( " @{bold %s}" , formattedName ) ; String description = page . getDescription ( ) ; if ( description != null ) { out . printf ( " %s%n" , description ) ; } else { out . println ( ) ; } } }
Render a column - formatted index of help pages .
204
10
138,498
public void addDirtyRegion ( Rectangle rect ) { // Only add dirty regions where rect intersects our actual media as the set region will // propagate out to the repaint manager. for ( AbstractMedia media : _metamgr ) { Rectangle intersection = media . getBounds ( ) . intersection ( rect ) ; if ( ! intersection . isEmpty ( ) ) { _metamgr . getRegionManager ( ) . addDirtyRegion ( intersection ) ; } } }
Adds a dirty region to this overlay .
100
8
138,499
private void runEvictor ( ConnectionEvictor evictor2 ) { final Thread evictorThread = new Thread ( evictor2 ) ; evictorThread . setDaemon ( true ) ; evictorThread . setName ( "Redmine communicator connection eviction thread" ) ; evictorThread . start ( ) ; }
Runs an evictor thread .
68
7