idx
int64
0
41.2k
question
stringlengths
83
4.15k
target
stringlengths
5
715
15,200
protected void dirtyIndicator ( SceneObjectIndicator indic ) { if ( indic != null ) { Rectangle r = indic . getBounds ( ) ; if ( r != null ) { _remgr . invalidateRegion ( r ) ; } } }
Dirties the specified indicator .
15,201
protected void changeHoverObject ( Object newHover ) { if ( newHover == _hobject ) { return ; } Object oldHover = _hobject ; _hobject = newHover ; hoverObjectChanged ( oldHover , newHover ) ; }
Change the hover object to the new object .
15,202
protected void hoverObjectChanged ( Object oldHover , Object newHover ) { if ( oldHover instanceof SceneObject ) { SceneObject oldhov = ( SceneObject ) oldHover ; if ( oldhov . setHovered ( false ) ) { _remgr . invalidateRegion ( oldhov . bounds ) ; } } if ( newHover instanceof SceneObject ) { SceneObject newhov = ( Sc...
A place for subclasses to react to the hover object changing . One of the supplied arguments may be null .
15,203
protected void getHitObjects ( DirtyItemList list , int x , int y ) { for ( SceneObject scobj : _vizobjs ) { Rectangle pbounds = scobj . bounds ; if ( ! pbounds . contains ( x , y ) ) { continue ; } if ( skipHitObject ( scobj ) ) { continue ; } if ( ! scobj . tile . hitTest ( x - pbounds . x , y - pbounds . y ) ) { con...
Adds to the supplied dirty item list all of the object tiles that are hit by the specified point ( meaning the point is contained within their bounds and intersects a non - transparent pixel in the actual object image .
15,204
protected void paintBits ( Graphics2D gfx , int layer , Rectangle dirty ) { _animmgr . paint ( gfx , layer , dirty ) ; }
We don t want sprites rendered using the standard mechanism because we intersperse them with objects in our scene and need to manage their z - order .
15,205
protected void paintDirtyItems ( Graphics2D gfx , Rectangle clip ) { _dirtySprites . clear ( ) ; _spritemgr . getIntersectingSprites ( _dirtySprites , clip ) ; int size = _dirtySprites . size ( ) ; for ( int ii = 0 ; ii < size ; ii ++ ) { Sprite sprite = _dirtySprites . get ( ii ) ; Rectangle bounds = sprite . getBound...
Renders the dirty sprites and objects in the scene to the given graphics context .
15,206
protected void paintIndicators ( Graphics2D gfx , Rectangle clip ) { if ( ! _indicatorsLaidOut ) { for ( Map . Entry < SceneObject , SceneObjectIndicator > entry : _indicators . entrySet ( ) ) { SceneObjectIndicator indic = entry . getValue ( ) ; if ( ! indic . isLaidOut ( ) ) { indic . layout ( gfx , entry . getKey ( ...
Paint all the appropriate indicators for our scene objects .
15,207
protected void paintIndicator ( Graphics2D gfx , Rectangle clip , SceneObjectIndicator tip ) { if ( clip . intersects ( tip . getBounds ( ) ) ) { tip . paint ( gfx ) ; } }
Paint the specified indicator if it intersects the clipping rectangle .
15,208
protected void paintTiles ( Graphics2D gfx , Rectangle clip ) { _paintOp . setGraphics ( gfx ) ; _applicator . applyToTiles ( clip , _paintOp ) ; _paintOp . setGraphics ( null ) ; }
Renders the base and fringe layer tiles that intersect the specified clipping rectangle .
15,209
protected void fillTile ( Graphics2D gfx , int tx , int ty , Color color ) { Composite ocomp = gfx . getComposite ( ) ; gfx . setComposite ( ALPHA_FILL_TILE ) ; Polygon poly = MisoUtil . getTilePolygon ( _metrics , tx , ty ) ; gfx . setColor ( color ) ; gfx . fill ( poly ) ; gfx . setComposite ( ocomp ) ; }
Fills the specified tile with the given color at 50% alpha . Intended for debug - only tile highlighting purposes .
15,210
protected BaseTile getBaseTile ( int tx , int ty ) { SceneBlock block = getBlock ( tx , ty ) ; return ( block == null ) ? null : block . getBaseTile ( tx , ty ) ; }
Returns the base tile for the specified tile coordinate .
15,211
protected BaseTile getFringeTile ( int tx , int ty ) { SceneBlock block = getBlock ( tx , ty ) ; return ( block == null ) ? null : block . getFringeTile ( tx , ty ) ; }
Returns the fringe tile for the specified tile coordinate .
15,212
protected void notifyListeners ( int event ) { int size = _listeners . size ( ) ; for ( int ii = 0 ; ii < size ; ii ++ ) { _listeners . get ( ii ) . modelChanged ( event ) ; } }
Notifies all model listeners that the builder model has changed .
15,213
public List < Integer > getComponents ( ComponentClass cclass ) { List < Integer > list = _components . get ( cclass ) ; if ( list == null ) { list = Lists . newArrayList ( ) ; } return list ; }
Returns the list of components available in the specified class .
15,214
public int [ ] getSelectedComponents ( ) { int [ ] values = new int [ _selected . size ( ) ] ; Iterator < Integer > iter = _selected . values ( ) . iterator ( ) ; for ( int ii = 0 ; iter . hasNext ( ) ; ii ++ ) { values [ ii ] = iter . next ( ) . intValue ( ) ; } return values ; }
Returns the selected components in an array .
15,215
public void setSelectedComponent ( ComponentClass cclass , int cid ) { _selected . put ( cclass , Integer . valueOf ( cid ) ) ; notifyListeners ( BuilderModelListener . COMPONENT_CHANGED ) ; }
Sets the selected component for the given component class .
15,216
protected void gatherComponentInfo ( ComponentRepository crepo ) { Iterators . addAll ( _classes , crepo . enumerateComponentClasses ( ) ) ; for ( int ii = 0 ; ii < _classes . size ( ) ; ii ++ ) { ComponentClass cclass = _classes . get ( ii ) ; Iterator < Integer > iter = crepo . enumerateComponentIds ( cclass ) ; whil...
Gathers component class and component information from the character manager for later reference by others .
15,217
public static long getOldestLastModified ( File dir ) { long oldest = dir . lastModified ( ) ; File [ ] files = dir . listFiles ( ) ; if ( files != null ) { for ( File file : files ) { if ( file . isDirectory ( ) ) { oldest = Math . min ( oldest , getOldestLastModified ( file ) ) ; } else { oldest = Math . min ( oldest...
Returns the timestamp of the oldest modification date of any file within the directory .
15,218
public Set < Integer > intKeySet ( ) { return data . keySet ( ) . stream ( ) . map ( Any2 :: getLeft ) . flatMap ( opt -> opt . map ( Stream :: of ) . orElseGet ( Stream :: empty ) ) . collect ( Collectors . toSet ( ) ) ; }
The numeric set of keys held by the resolver map .
15,219
public Set < String > stringKeySet ( ) { return data . keySet ( ) . stream ( ) . map ( Any2 :: getRight ) . flatMap ( opt -> opt . map ( Stream :: of ) . orElseGet ( Stream :: empty ) ) . collect ( Collectors . toSet ( ) ) ; }
The string set of keys held by the resolver map .
15,220
public Map < Any2 < Integer , String > , Any3 < Boolean , Integer , String > > getRawMap ( ) { return unmodifiableMap ( data ) ; }
Get the underlying map of data .
15,221
public Map < Any2 < Integer , String > , String > getStringMap ( ) { return data . entrySet ( ) . stream ( ) . collect ( Collectors . toMap ( Map . Entry :: getKey , entry -> entry . getValue ( ) . mapCombine ( Object :: toString , Object :: toString , Object :: toString ) ) ) ; }
Get the underlying map but with all values converted to string .
15,222
protected void generateSprite ( ) { int components [ ] = _model . getSelectedComponents ( ) ; CharacterDescriptor desc = new CharacterDescriptor ( components , null ) ; CharacterSprite sprite = _charmgr . getCharacter ( desc ) ; setSprite ( sprite ) ; }
Generates a new character sprite for display to reflect the currently selected character components .
15,223
protected void setSprite ( CharacterSprite sprite ) { sprite . setActionSequence ( StandardActions . STANDING ) ; sprite . setOrientation ( WEST ) ; _sprite = sprite ; centerSprite ( ) ; repaint ( ) ; }
Sets the sprite to be displayed .
15,224
protected void centerSprite ( ) { if ( _sprite != null ) { Dimension d = getSize ( ) ; int shei = _sprite . getHeight ( ) ; int x = d . width / 2 , y = ( d . height + shei ) / 2 ; _sprite . setLocation ( x , y ) ; } }
Sets the sprite s location to render it centered within the panel .
15,225
public SimpleMisoSceneModel parseScene ( InputStream in ) throws IOException , SAXException { _model = null ; _digester . push ( this ) ; _digester . parse ( in ) ; return _model ; }
Parses the XML file on the supplied input stream into a scene model instance .
15,226
public void setGain ( float gain ) { _gain = gain ; if ( _fadeMode == FadeMode . NONE ) { _source . setGain ( _gain ) ; } }
Sets the base gain of the stream .
15,227
public void play ( ) { if ( _state == AL10 . AL_PLAYING ) { log . warning ( "Tried to play stream already playing." ) ; return ; } if ( _state == AL10 . AL_INITIAL ) { _qidx = _qlen = 0 ; queueBuffers ( _buffers . length ) ; } _source . play ( ) ; _state = AL10 . AL_PLAYING ; }
Starts playing this stream .
15,228
public void pause ( ) { if ( _state != AL10 . AL_PLAYING ) { log . warning ( "Tried to pause stream that wasn't playing." ) ; return ; } _source . pause ( ) ; _state = AL10 . AL_PAUSED ; }
Pauses this stream .
15,229
public void stop ( ) { if ( _state == AL10 . AL_STOPPED ) { log . warning ( "Tried to stop stream that was already stopped." ) ; return ; } _source . stop ( ) ; _state = AL10 . AL_STOPPED ; }
Stops this stream .
15,230
public void fadeIn ( float interval ) { if ( _state != AL10 . AL_PLAYING ) { play ( ) ; } _source . setGain ( 0f ) ; _fadeMode = FadeMode . IN ; _fadeInterval = interval ; _fadeElapsed = 0f ; }
Fades this stream in over the specified interval . If the stream isn t playing it will be started .
15,231
public void fadeOut ( float interval , boolean dispose ) { _fadeMode = dispose ? FadeMode . OUT_DISPOSE : FadeMode . OUT ; _fadeInterval = interval ; _fadeElapsed = 0f ; }
Fades this stream out over the specified interval .
15,232
public void dispose ( ) { if ( _state != AL10 . AL_STOPPED ) { stop ( ) ; } _source . delete ( ) ; for ( Buffer buffer : _buffers ) { buffer . delete ( ) ; } _soundmgr . removeStream ( this ) ; }
Releases the resources held by this stream and removes it from the manager .
15,233
protected void updateFade ( float time ) { if ( _fadeMode == FadeMode . NONE ) { return ; } float alpha = Math . min ( ( _fadeElapsed += time ) / _fadeInterval , 1f ) ; _source . setGain ( _gain * ( _fadeMode == FadeMode . IN ? alpha : ( 1f - alpha ) ) ) ; if ( alpha == 1f ) { if ( _fadeMode == FadeMode . OUT ) { stop ...
Updates the gain of the stream according to the fade state .
15,234
protected boolean populateBuffer ( Buffer buffer ) { if ( _abuf == null ) { _abuf = ByteBuffer . allocateDirect ( getBufferSize ( ) ) . order ( ByteOrder . nativeOrder ( ) ) ; } _abuf . clear ( ) ; int read = 0 ; try { read = Math . max ( populateBuffer ( _abuf ) , 0 ) ; } catch ( IOException e ) { log . warning ( "Err...
Populates the identified buffer with as much data as it can hold .
15,235
private Map < MetricName , MetricValue > get_metrics_ ( DateTime now , Context ctx ) { final Consumer < Alert > alert_manager = ctx . getAlertManager ( ) ; final long failed_collections = registry_ . getFailedCollections ( ) ; final boolean has_config = registry_ . hasConfig ( ) ; final Optional < Duration > scrape_dur...
Get metrics for the monitor .
15,236
public void transform ( Context < MutableTimeSeriesCollectionPair > ctx ) { DateTime now = ctx . getTSData ( ) . getCurrentCollection ( ) . getTimestamp ( ) ; ctx . getTSData ( ) . getCurrentCollection ( ) . addMetrics ( MONITOR_GROUP , get_metrics_ ( now , ctx ) ) ; ctx . getAlertManager ( ) . accept ( new Alert ( now...
Emit an alert monitor . down which is in the OK state .
15,237
private static MetricValue opt_duration_to_metricvalue_ ( Optional < Duration > duration ) { return duration . map ( MonitorMonitor :: duration_to_metricvalue_ ) . orElse ( MetricValue . EMPTY ) ; }
Convert an optional duration to a metric value .
15,238
private void validate ( ) { try { DateTime ts ; ts = current . getTimestamp ( ) ; for ( TimeSeriesCollection b : backward ) { if ( b . getTimestamp ( ) . isAfter ( ts ) ) throw new IllegalArgumentException ( "backwards collection must be before current and be ordered in reverse chronological order" ) ; ts = b . getTime...
Check the forward and backward invariants .
15,239
private static Set < GroupName > calculateNames ( TimeSeriesCollection current , Collection < TimeSeriesCollection > backward , Collection < TimeSeriesCollection > forward ) { final Set < GroupName > names = backward . stream ( ) . flatMap ( tsc -> tsc . getGroups ( x -> true ) . stream ( ) ) . collect ( Collectors . t...
Calculate all names that can be interpolated . The returned set will not have any names present in the current collection .
15,240
private TimeSeriesValue interpolateTSV ( GroupName name ) { final Map . Entry < DateTime , TimeSeriesValue > backTSV = findName ( backward , name ) , forwTSV = findName ( forward , name ) ; final long backMillis = max ( new Duration ( backTSV . getKey ( ) , getTimestamp ( ) ) . getMillis ( ) , 0 ) , forwMillis = max ( ...
Interpolates a group name based on the most recent backward and oldest forward occurence .
15,241
private static Map . Entry < DateTime , TimeSeriesValue > findName ( List < TimeSeriesCollection > c , GroupName name ) { ListIterator < TimeSeriesCollection > iter = c . listIterator ( ) ; while ( iter . hasNext ( ) ) { final int idx = iter . nextIndex ( ) ; final TimeSeriesCollection tsdata = iter . next ( ) ; final ...
Finds the first resolution of name in the given TimeSeriesCollections . The cache is used and updated to skip the linear search phase .
15,242
protected void createBackBuffer ( GraphicsConfiguration gc ) { if ( _backimg != null ) { _backimg . flush ( ) ; _bgfx . dispose ( ) ; } int width = _window . getWidth ( ) , height = _window . getHeight ( ) ; _backimg = gc . createCompatibleVolatileImage ( width , height ) ; _bgfx = ( Graphics2D ) _backimg . getGraphics...
Creates the off - screen buffer used to perform double buffered rendering of the animated panel .
15,243
public static void trimTileSet ( TileSet source , OutputStream destImage , TrimMetricsReceiver tmr ) throws IOException { trimTileSet ( source , destImage , tmr , FastImageIO . FILE_SUFFIX ) ; }
Convenience function to trim the tile set using FastImageIO to save the result .
15,244
public static void setRegisterWithVM ( final boolean registerWithVM ) { if ( Converters . registerWithVM != registerWithVM ) { Converters . registerWithVM = registerWithVM ; if ( registerWithVM ) { for ( Entry < Class , Converter > entry : REGISTRY . entrySet ( ) ) { Class type = entry . getKey ( ) ; Converter converte...
Sets if converters registered with the VM PropertyEditorManager . If the new value is true all currently registered converters are immediately registered with the VM .
15,245
private static PropertyEditor findEditor ( final Type type ) { assert type != null ; Class clazz = toClass ( type ) ; PropertyEditor editor = PropertyEditorManager . findEditor ( clazz ) ; if ( editor != null ) { return editor ; } if ( clazz . isArray ( ) && ! clazz . getComponentType ( ) . isArray ( ) ) { editor = fin...
Locate a property editor for given class of object .
15,246
public static int [ ] quantizeImage ( int pixels [ ] [ ] , int max_colors ) { Cube cube = new Cube ( pixels , max_colors ) ; cube . classification ( ) ; cube . reduction ( ) ; cube . assignment ( ) ; return cube . colormap ; }
Reduce the image to the given number of colors .
15,247
public void paint ( Graphics2D gfx , int layer , Shape clip ) { for ( int ii = 0 , nn = _media . size ( ) ; ii < nn ; ii ++ ) { AbstractMedia media = _media . get ( ii ) ; int order = media . getRenderOrder ( ) ; try { if ( ( ( layer == ALL ) || ( layer == FRONT && order >= 0 ) || ( layer == BACK && order < 0 ) ) && cl...
Renders all registered media in the given layer that intersect the supplied clipping rectangle to the given graphics context .
15,248
public void fastForward ( long timeDelta ) { if ( _tickStamp > 0 ) { log . warning ( "Egads! Asked to fastForward() during a tick." , new Exception ( ) ) ; } for ( int ii = 0 , nn = _media . size ( ) ; ii < nn ; ii ++ ) { _media . get ( ii ) . fastForward ( timeDelta ) ; } }
If the manager is paused for some length of time it should be fast forwarded by the appropriate number of milliseconds . This allows media to smoothly pick up where they left off rather than abruptly jumping into the future thinking that some outrageous amount of time passed since their last tick .
15,249
protected boolean insertMedia ( AbstractMedia media ) { if ( _media . contains ( media ) ) { log . warning ( "Attempt to insert media more than once [media=" + media + "]." , new Exception ( ) ) ; return false ; } media . init ( this ) ; int ipos = _media . insertSorted ( media , RENDER_ORDER ) ; if ( _tickStamp > 0L )...
Inserts the specified media into this manager return true on success .
15,250
protected boolean removeMedia ( AbstractMedia media ) { int mpos = _media . indexOf ( media ) ; if ( mpos != - 1 ) { _media . remove ( mpos ) ; media . invalidate ( ) ; media . shutdown ( ) ; if ( mpos <= _tickpos ) { _tickpos -- ; } return true ; } log . warning ( "Attempt to remove media that wasn't inserted [media="...
Removes the specified media from this manager return true on success .
15,251
public void queueNotification ( ObserverList < Object > observers , ObserverOp < Object > event ) { _notify . add ( new Tuple < ObserverList < Object > , ObserverOp < Object > > ( observers , event ) ) ; }
Queues the notification for dispatching after we ve ticked all the media .
15,252
protected void dispatchNotifications ( ) { for ( int ii = 0 , nn = _notify . size ( ) ; ii < nn ; ii ++ ) { Tuple < ObserverList < Object > , ObserverOp < Object > > tuple = _notify . get ( ii ) ; tuple . left . apply ( tuple . right ) ; } _notify . clear ( ) ; }
Dispatches all queued media notifications .
15,253
public static < T > void addArrayIfNotNull ( JSONWriter writer , String field , Collection < T > items , JsonObjectWriter < T > objWriter ) throws JSONException { if ( items == null ) return ; addCollection ( writer , field , items , objWriter ) ; }
Adds a list .
15,254
protected void startAnimation ( Animation anim , long tickStamp ) { if ( _vdx != 0 || _vdy != 0 ) { anim . viewLocationDidChange ( _vdx , _vdy ) ; } _animmgr . registerAnimation ( anim ) ; }
Called when the time comes to start an animation . Derived classes may override this method and pass the animation on to their animation manager and do whatever else they need to do with operating animations . The default implementation simply adds them to the media panel supplied when we were constructed .
15,255
public void setScrollableArea ( int x , int y , int width , int height ) { Rectangle vb = _panel . getViewBounds ( ) ; int hmax = x + width , vmax = y + height , value ; if ( width > vb . width ) { value = MathUtil . bound ( x , _hrange . getValue ( ) , hmax - vb . width ) ; _hrange . setRangeProperties ( value , vb . ...
Informs the virtual range model the extent of the area over which we can scroll .
15,256
public BufferedImage createImage ( int width , int height , int transparency ) { return _icreator . createImage ( width , height , transparency ) ; }
Creates a buffered image optimized for display on our graphics device .
15,257
public ImageKey getImageKey ( String rset , String path ) { return getImageKey ( getDataProvider ( rset ) , path ) ; }
Returns an image key that can be used to fetch the image identified by the specified resource set and image path .
15,258
public BufferedImage getImage ( ImageKey key , Colorization [ ] zations ) { CacheRecord crec = null ; synchronized ( _ccache ) { crec = _ccache . get ( key ) ; } if ( crec != null ) { return crec . getImage ( zations , _ccache ) ; } BufferedImage image = loadImage ( key ) ; if ( image == null ) { log . warning ( "Faile...
Obtains the image identified by the specified key caching if possible . The image will be recolored using the supplied colorizations if requested .
15,259
public Mirage getMirage ( String rsrcPath ) { return getMirage ( getImageKey ( _defaultProvider , rsrcPath ) , null , null ) ; }
Creates a mirage which is an image optimized for display on our current display device and which will be stored into video memory if possible .
15,260
protected ImageDataProvider getDataProvider ( final String rset ) { if ( rset == null ) { return _defaultProvider ; } ImageDataProvider dprov = _providers . get ( rset ) ; if ( dprov == null ) { dprov = new ImageDataProvider ( ) { public BufferedImage loadImage ( String path ) throws IOException { try { return _rmgr . ...
Returns the data provider configured to obtain image data from the specified resource set .
15,261
protected BufferedImage loadImage ( ImageKey key ) { BufferedImage image = null ; try { log . debug ( "Loading image " + key + "." ) ; image = key . daprov . loadImage ( key . path ) ; if ( image == null ) { log . warning ( "ImageDataProvider.loadImage(" + key + ") returned null." ) ; } } catch ( Exception e ) { log . ...
Loads and returns the image with the specified key from the supplied data provider .
15,262
public void setPosition ( float x , float y , float z ) { if ( _source != null ) { _source . setPosition ( x , y , z ) ; } _px = x ; _py = y ; _pz = z ; }
Sets the position of the sound .
15,263
public void setVelocity ( float x , float y , float z ) { if ( _source != null ) { _source . setVelocity ( x , y , z ) ; } _vx = x ; _vy = y ; _vz = z ; }
Sets the velocity of the sound .
15,264
public void setDirection ( float x , float y , float z ) { if ( _source != null ) { _source . setDirection ( x , y , z ) ; } _dx = x ; _dy = y ; _dz = z ; }
Sets the direction of the sound .
15,265
public static MediaTimer createTimer ( ) { MediaTimer timer = null ; for ( String timerClass : PERF_TIMERS ) { try { timer = ( MediaTimer ) Class . forName ( timerClass ) . newInstance ( ) ; break ; } catch ( Throwable t ) { } } if ( timer == null ) { log . info ( "Can't use high performance timer, reverting to " + "Sy...
Attempts to create a high resolution timer but if that isn t possible uses a System . currentTimeMillis based timer .
15,266
public static FrameManager newInstance ( ManagedRoot root , MediaTimer timer ) { FrameManager fmgr = ( root instanceof ManagedJFrame && _useFlip . getValue ( ) ) ? new FlipFrameManager ( ) : new BackFrameManager ( ) ; fmgr . init ( root , timer ) ; return fmgr ; }
Constructs a frame manager that will do its rendering to the supplied root and use the supplied media timer for timing information .
15,267
public void registerFrameParticipant ( FrameParticipant participant ) { Object [ ] nparts = ListUtil . testAndAddRef ( _participants , participant ) ; if ( nparts == null ) { log . warning ( "Refusing to add duplicate frame participant! " + participant ) ; } else { _participants = nparts ; } }
Registers a frame participant . The participant will be given the opportunity to do processing and rendering on each frame .
15,268
public TrailingAverage [ ] getPerfMetrics ( ) { if ( _metrics == null ) { _metrics = new TrailingAverage [ ] { new TrailingAverage ( 150 ) , new TrailingAverage ( 150 ) , new TrailingAverage ( 150 ) } ; } return _metrics ; }
Returns debug performance metrics .
15,269
public static Component getRoot ( Component comp , Rectangle rect ) { for ( Component c = comp ; c != null ; c = c . getParent ( ) ) { if ( ! c . isVisible ( ) || ! c . isDisplayable ( ) ) { return null ; } if ( c instanceof Window || c instanceof Applet ) { return c ; } rect . x += c . getX ( ) ; rect . y += c . getY ...
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 . Along the way it adjusts the supplied component - relative rectangle to be relative to the returned root component .
15,270
protected void init ( ManagedRoot root , MediaTimer timer ) { _window = root . getWindow ( ) ; _root = root ; _root . init ( this ) ; _timer = timer ; _repainter = new ActiveRepaintManager ( ( _root instanceof Component ) ? ( Component ) _root : _window ) ; RepaintManager . setCurrentManager ( _repainter ) ; _repainter...
Initializes this frame manager and prepares it for operation .
15,271
protected void tick ( long tickStamp ) { long start = 0L , paint = 0L ; if ( _perfDebug . getValue ( ) ) { start = paint = _timer . getElapsedMicros ( ) ; } if ( _window . isShowing ( ) && _window . getWidth ( ) > 0 && _window . getHeight ( ) > 0 ) { tickParticipants ( tickStamp ) ; paint = _timer . getElapsedMicros ( ...
Called to perform the frame processing and rendering .
15,272
protected boolean paint ( Graphics2D gfx ) { int painted = 0 ; for ( Object participant : _participants ) { FrameParticipant part = ( FrameParticipant ) participant ; if ( part == null ) { continue ; } Component pcomp = part . getComponent ( ) ; if ( pcomp == null || ! part . needsPaint ( ) ) { continue ; } long start ...
Paints our frame participants and any dirty components via the repaint manager .
15,273
protected void renderLayer ( Graphics2D g , Rectangle bounds , JLayeredPane pane , boolean [ ] clipped , Integer layer ) { int ccount = pane . getComponentCountInLayer ( layer . intValue ( ) ) ; if ( ccount == 0 ) { return ; } Component [ ] comps = pane . getComponentsInLayer ( layer . intValue ( ) ) ; for ( int ii = 0...
Renders all components in the specified layer of the supplied layered pane that intersect the supplied bounds .
15,274
public static < T > Iterator < T > distinct ( final Iterator < T > iterator ) { requireNonNull ( iterator ) ; return new AbstractIterator < T > ( ) { private final PeekingIterator < T > peekingIterator = peekingIterator ( iterator ) ; private T curr = null ; protected T computeNext ( ) { while ( peekingIterator . hasNe...
If we can assume the iterator is sorted return the distinct elements . This only works if the data provided is sorted .
15,275
public ActionFrames getFrames ( String action , String type ) { return _frameProvider . getFrames ( this , action , type ) ; }
Returns the image frames for the specified action animation or null if no animation for the specified action is available for this component .
15,276
public String getFramePath ( String action , String type , Set < String > existentPaths ) { return _frameProvider . getFramePath ( this , action , type , existentPaths ) ; }
Returns the path to the image frames for the specified action animation or null if no animation for the specified action is available for this component .
15,277
protected OutputStream nextEntry ( OutputStream lastEntry , String path ) throws IOException { ( ( JarOutputStream ) lastEntry ) . putNextEntry ( new JarEntry ( path ) ) ; return lastEntry ; }
Advances to the next named entry in the bundle and returns the stream to which to write that entry .
15,278
public QueryBuilder map ( String query , String method_name , Object ... items ) throws Exception { JSONObject op = new JSONObject ( ) ; if ( query != null ) op . put ( Constants . REQUEST_QUERY , query ) ; java . util . Map < String , Object > operation = new LinkedHashMap < String , Object > ( ) ; operation . put ( C...
Used to get the return from a method call
15,279
public QueryBuilder instantiate ( String query , Object ... items ) throws Exception { JSONObject op = new JSONObject ( ) ; if ( query != null ) op . put ( Constants . REQUEST_INSTANTIATE , query ) ; if ( query != null ) queryStringRepresentation += query ; op . put ( Constants . REQUEST_ARGUMENTS , buildArgsArray ( it...
Used to instantiate a class
15,280
private JSONArray buildArgsArray ( Object ... items ) throws Exception { JSONArray args = new JSONArray ( ) ; for ( int i = 0 ; i < items . length ; i ++ ) { if ( items [ i ] instanceof java . lang . String ) { args . put ( ( String ) items [ i ] ) ; } else if ( items [ i ] instanceof Number ) { args . put ( ( Number )...
Internal function used to build a JSON Array of arguments from a list of items
15,281
private QueryBuilder genericRequest ( String type , String value ) throws Exception { JSONObject op = new JSONObject ( ) ; op . put ( type , value ) ; JSONArray operations = ( JSONArray ) request . get ( Constants . REQUEST_OPERATIONS ) ; operations . put ( op ) ; request . remove ( Constants . REQUEST_OPERATIONS ) ; r...
Creates a key value request
15,282
public JSONArray execute ( ) throws Exception { try { JSONArray retVal = Client . getInstance ( port ) . map ( toString ( ) ) ; return retVal ; } catch ( Exception e ) { throw new Exception ( queryStringRepresentation + ": " + e . getMessage ( ) ) ; } }
Execute a series of commands
15,283
protected Object getInstantiatedClass ( String query ) { if ( query . equals ( Constants . UIAUTOMATOR_UIDEVICE ) ) { return device ; } return null ; }
Implementation of getInstantiatedClass that returns a UiDevice if one is requested
15,284
public synchronized void setHistory ( CollectHistory history ) { history_ = Optional . of ( history ) ; history_ . ifPresent ( getApi ( ) :: setHistory ) ; data_ . initWithHistoricalData ( history , getDecoratorLookBack ( ) ) ; }
Set the history module that the push processor is to use .
15,285
protected synchronized CollectionContext beginCollection ( DateTime now ) { data_ . startNewCycle ( now , getDecoratorLookBack ( ) ) ; return new CollectionContext ( ) { final Map < GroupName , Alert > alerts = new HashMap < > ( ) ; public Consumer < Alert > alertManager ( ) { return ( Alert alert ) -> { Alert combined...
Begin a new collection cycle .
15,286
private static Alert combine_alert_with_past_ ( Alert alert , Map < GroupName , Alert > previous ) { Alert result = Optional . ofNullable ( previous . get ( alert . getName ( ) ) ) . map ( ( prev ) -> prev . extend ( alert ) ) . orElse ( alert ) ; logger . log ( Level . FINE , "emitting alert {0} -> {1}" , new Object [...
Combine a new alert with its previous state .
15,287
public static synchronized PushMetricRegistryInstance create ( Supplier < DateTime > now , boolean has_config , EndpointRegistration api ) { return new PushMetricRegistryInstance ( now , has_config , api ) ; }
Create a plain uninitialized metric registry .
15,288
public static Mirage newNinePatchContaining ( NinePatch ninePatch , Rectangle content ) { Rectangle bounds = ninePatch . getBoundsSurrounding ( content ) ; Mirage mirage = new NinePatchMirage ( ninePatch , bounds . width , bounds . height ) ; return new TransformedMirage ( mirage , AffineTransform . getTranslateInstanc...
Returns a new Mirage that s a NinePatch stretched and positioned to contain the given Rectangle .
15,289
public static boolean isDisjoint ( Collection < Range > ranges ) { List < Range > rangesList = new ArrayList < Range > ( ranges . size ( ) ) ; rangesList . addAll ( ranges ) ; Collections . sort ( rangesList ) ; for ( int i = 0 ; i < rangesList . size ( ) - 1 ; i ++ ) { Range rCurrent = rangesList . get ( i ) ; Range r...
Checks weather the given set of ranges are disjoint i . e . none of the ranges overlap .
15,290
private static EscapeStringResult escapeString ( String s , char quote ) { final String [ ] octal_strings = { "\\0" , "\\001" , "\\002" , "\\003" , "\\004" , "\\005" , "\\006" , "\\a" , "\\b" , "\\t" , "\\n" , "\\v" , "\\f" , "\\r" , "\\016" , "\\017" , "\\020" , "\\021" , "\\022" , "\\023" , "\\024" , "\\025" , "\\026...
Escape a string configuration element .
15,291
public static StringBuilder quotedString ( String s ) { final EscapeStringResult escapeString = escapeString ( s , '\"' ) ; final StringBuilder result = escapeString . buffer ; result . insert ( 0 , '\"' ) ; result . append ( '\"' ) ; return result ; }
Create a quoted string configuration element .
15,292
public static StringBuilder maybeQuoteIdentifier ( String s ) { final EscapeStringResult escapeString = escapeString ( s , '\'' ) ; final StringBuilder result = escapeString . buffer ; final boolean need_quotes = s . isEmpty ( ) || escapeString . needQuotes || KEYWORDS . contains ( s ) || ! IDENTIFIER_MATCHER . test ( ...
Create an identifier configuration element .
15,293
public static StringBuilder durationConfigString ( Duration duration ) { Duration remainder = duration ; long days = remainder . getStandardDays ( ) ; remainder = remainder . minus ( Duration . standardDays ( days ) ) ; long hours = remainder . getStandardHours ( ) ; remainder = remainder . minus ( Duration . standardH...
Convert duration to an representation accepted by Configuration parser .
15,294
public < R > R download ( String uri , ContentHandler < BasicHttpResponse , R > handler ) throws RedmineException { final HttpGet request = new HttpGet ( uri ) ; return errorCheckingCommunicator . sendRequest ( request , handler ) ; }
Downloads a redmine content .
15,295
public String upload ( InputStream content ) throws RedmineException { final URI uploadURI = getURIConfigurator ( ) . getUploadURI ( ) ; final HttpPost request = new HttpPost ( uploadURI ) ; final AbstractHttpEntity entity = new InputStreamEntity ( content , - 1 ) ; entity . setContentType ( "application/octet-stream" ...
UPloads content on a server .
15,296
public < T > List < T > getObjectsList ( Class < T > objectClass , Collection < ? extends NameValuePair > params ) throws RedmineException { final EntityConfig < T > config = getConfig ( objectClass ) ; final List < T > result = new ArrayList < T > ( ) ; final List < NameValuePair > newParams = new ArrayList < NameValu...
Returns an object list .
15,297
protected Completer discoverCompleter ( ) { log . debug ( "Discovering completer" ) ; CliProcessor cli = new CliProcessor ( ) ; cli . addBean ( this ) ; List < ArgumentDescriptor > argumentDescriptors = cli . getArgumentDescriptors ( ) ; Collections . sort ( argumentDescriptors ) ; if ( log . isDebugEnabled ( ) ) { log...
Discover the completer for the command .
15,298
public static SimpleGraph < String , DefaultEdge > getSimpleGraphFromUser ( ) { Scanner sc = new Scanner ( System . in ) ; SimpleGraph < String , DefaultEdge > graph = new SimpleGraph < String , DefaultEdge > ( DefaultEdge . class ) ; int verticeAmount ; do { System . out . print ( "Enter the number of vertices (more t...
Asks the user to input an graph
15,299
public void getTrimmedBounds ( Rectangle tbounds ) { tbounds . setBounds ( _tbounds . x , _tbounds . y , _mirage . getWidth ( ) , _mirage . getHeight ( ) ) ; }
Fills in the bounds of the trimmed image within the coordinate system defined by the complete virtual tile .