idx
int64
0
165k
question
stringlengths
73
5.81k
target
stringlengths
5
918
138,900
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 .
138,901
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 .
138,902
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 .
138,903
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 .
138,904
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 .
138,905
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 .
138,906
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 .
138,907
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 .
138,908
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 .
138,909
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 .
138,910
public Map < Any2 < Integer , String > , Any3 < Boolean , Integer , String > > getRawMap ( ) { return unmodifiableMap ( data ) ; }
Get the underlying map of data .
138,911
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 .
138,912
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 .
138,913
protected void setSprite ( CharacterSprite sprite ) { sprite . setActionSequence ( StandardActions . STANDING ) ; sprite . setOrientation ( WEST ) ; _sprite = sprite ; centerSprite ( ) ; repaint ( ) ; }
Sets the sprite to be displayed .
138,914
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 .
138,915
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 .
138,916
public void setGain ( float gain ) { _gain = gain ; if ( _fadeMode == FadeMode . NONE ) { _source . setGain ( _gain ) ; } }
Sets the base gain of the stream .
138,917
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 .
138,918
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 .
138,919
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 .
138,920
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 .
138,921
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 .
138,922
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 .
138,923
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 .
138,924
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 .
138,925
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 .
138,926
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 .
138,927
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 .
138,928
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 .
138,929
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 .
138,930
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 .
138,931
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 .
138,932
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 .
138,933
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 .
138,934
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 .
138,935
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 .
138,936
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 .
138,937
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 .
138,938
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 .
138,939
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 .
138,940
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 .
138,941
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 .
138,942
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 .
138,943
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 .
138,944
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 .
138,945
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 .
138,946
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 .
138,947
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 .
138,948
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 .
138,949
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 .
138,950
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 .
138,951
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 .
138,952
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 .
138,953
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 .
138,954
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 .
138,955
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 .
138,956
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 .
138,957
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 .
138,958
public TrailingAverage [ ] getPerfMetrics ( ) { if ( _metrics == null ) { _metrics = new TrailingAverage [ ] { new TrailingAverage ( 150 ) , new TrailingAverage ( 150 ) , new TrailingAverage ( 150 ) } ; } return _metrics ; }
Returns debug performance metrics .
138,959
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 .
138,960
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 .
138,961
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 .
138,962
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 .
138,963
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 .
138,964
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 .
138,965
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 .
138,966
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 .
138,967
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 .
138,968
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
138,969
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
138,970
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
138,971
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
138,972
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
138,973
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
138,974
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 .
138,975
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 .
138,976
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 .
138,977
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 .
138,978
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 .
138,979
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 .
138,980
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 .
138,981
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 .
138,982
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 .
138,983
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 .
138,984
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 .
138,985
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 .
138,986
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 .
138,987
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 .
138,988
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
138,989
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 .
138,990
public Rectangle getBoundsSurrounding ( Rectangle content ) { Rectangle bounds = new Rectangle ( content ) ; bounds . width += _leftPad + _rightPad ; bounds . height += _topPad + _bottomPad ; bounds . x -= _leftPad ; bounds . y -= _topPad ; return bounds ; }
Returns a rectangle describing the bounds of this NinePatch when drawn such that it frames the given content rectangle .
138,991
protected static Rectangle getRectangle ( BufferedImage img , boolean stretch ) { Rectangle rect = new Rectangle ( 0 , 0 , img . getWidth ( ) - 2 , img . getHeight ( ) - 2 ) ; for ( int xx = 1 ; xx < rect . width + 1 ; xx ++ ) { if ( ImageUtil . hitTest ( img , xx , stretch ? 0 : img . getHeight ( ) - 1 ) ) { rect . x ...
Parses the image to find the bounds of the rectangle defined by pixels on the outside .
138,992
public void appendDirtySprite ( Sprite sprite , int tx , int ty ) { DirtyItem item = getDirtyItem ( ) ; item . init ( sprite , tx , ty ) ; _items . add ( item ) ; }
Appends the dirty sprite at the given coordinates to the dirty item list .
138,993
public void appendDirtyObject ( SceneObject scobj ) { DirtyItem item = getDirtyItem ( ) ; item . init ( scobj , scobj . info . x , scobj . info . y ) ; _items . add ( item ) ; }
Appends the dirty object tile at the given coordinates to the dirty item list .
138,994
public void paintAndClear ( Graphics2D gfx ) { int icount = _items . size ( ) ; for ( int ii = 0 ; ii < icount ; ii ++ ) { DirtyItem item = _items . get ( ii ) ; item . paint ( gfx ) ; item . clear ( ) ; _freelist . add ( item ) ; } _items . clear ( ) ; }
Paints all the dirty items in this list using the supplied graphics context . The items are removed from the dirty list after being painted and the dirty list ends up empty .
138,995
public void clear ( ) { for ( int icount = _items . size ( ) ; icount > 0 ; icount -- ) { DirtyItem item = _items . remove ( 0 ) ; item . clear ( ) ; _freelist . add ( item ) ; } }
Clears out any items that were in this list .
138,996
private Intermediate mapAndReduce ( Context ctx ) { final List < Map . Entry < Tags , MetricValue > > matcher_tsvs = matchers_ . stream ( ) . flatMap ( m -> m . filter ( ctx ) ) . map ( named_entry -> SimpleMapEntry . create ( named_entry . getKey ( ) . getTags ( ) , named_entry . getValue ( ) ) ) . collect ( Collector...
Create a reduction of the matchers and expressions for a given context .
138,997
public List < Issue > getIssues ( Map < String , String > pParameters ) throws RedmineException { Set < NameValuePair > params = new HashSet < NameValuePair > ( ) ; for ( final Entry < String , String > param : pParameters . entrySet ( ) ) { params . add ( new BasicNameValuePair ( param . getKey ( ) , param . getValue ...
Generic method to search for issues .
138,998
public void deleteRelation ( Integer id ) throws RedmineException { transport . deleteObject ( IssueRelation . class , Integer . toString ( id ) ) ; }
Delete Issue Relation with the given ID .
138,999
public Attachment uploadAttachment ( String fileName , String contentType , InputStream content ) throws RedmineException , IOException { final InputStream wrapper = new MarkedInputStream ( content , "uploadStream" ) ; final String token ; try { token = transport . upload ( wrapper ) ; final Attachment result = new Att...
Uploads an attachement .