idx
int64
0
41.2k
question
stringlengths
73
5.81k
target
stringlengths
5
918
38,300
private void linkToEmitter ( String name , LinearInterpolator interpol ) { valueMap . put ( name , interpol ) ; boolean checked = interpol . isActive ( ) ; JCheckBox enableControl = ( JCheckBox ) valueNameToControl . get ( name ) ; enableControl . setSelected ( false ) ; if ( checked ) enableControl . setSelected ( che...
Link this set of controls to a linear interpolater within the particle emitter
38,301
private void blur ( BufferedImage image ) { float [ ] matrix = GAUSSIAN_BLUR_KERNELS [ blurKernelSize - 1 ] ; Kernel gaussianBlur1 = new Kernel ( matrix . length , 1 , matrix ) ; Kernel gaussianBlur2 = new Kernel ( 1 , matrix . length , matrix ) ; RenderingHints hints = new RenderingHints ( RenderingHints . KEY_RENDERI...
Apply blurring to the generate image
38,302
public Texture getTexture ( File source , boolean flipped , int filter ) throws IOException { String resourceName = source . getAbsolutePath ( ) ; InputStream in = new FileInputStream ( source ) ; return getTexture ( in , resourceName , flipped , filter , null ) ; }
Get a texture from a specific file
38,303
public Texture getTexture ( String resourceName , boolean flipped , int filter ) throws IOException { InputStream in = ResourceLoader . getResourceAsStream ( resourceName ) ; return getTexture ( in , resourceName , flipped , filter , null ) ; }
Get a texture from a resource location
38,304
public void reload ( ) { Iterator texs = texturesLinear . values ( ) . iterator ( ) ; while ( texs . hasNext ( ) ) { ( ( TextureImpl ) texs . next ( ) ) . reload ( ) ; } texs = texturesNearest . values ( ) . iterator ( ) ; while ( texs . hasNext ( ) ) { ( ( TextureImpl ) texs . next ( ) ) . reload ( ) ; } }
Reload all the textures loaded in this loader
38,305
public int reload ( TextureImpl texture , int srcPixelFormat , int componentCount , int minFilter , int magFilter , ByteBuffer textureBuffer ) { int target = SGL . GL_TEXTURE_2D ; int textureID = createTextureID ( ) ; GL . glBindTexture ( target , textureID ) ; GL . glTexParameteri ( target , SGL . GL_TEXTURE_MIN_FILTE...
Reload a given texture blob
38,306
public Image getSprite ( String name ) { Section section = ( Section ) sections . get ( name ) ; if ( section == null ) { throw new RuntimeException ( "Unknown sprite from packed sheet: " + name ) ; } return image . getSubImage ( section . x , section . y , section . width , section . height ) ; }
Get a single named sprite from the sheet
38,307
public SpriteSheet getSpriteSheet ( String name ) { Image image = getSprite ( name ) ; Section section = ( Section ) sections . get ( name ) ; return new SpriteSheet ( image , section . width / section . tilesx , section . height / section . tilesy ) ; }
Get a sprite sheet that has been packed into the greater image
38,308
private void loadDefinition ( String def , Color trans ) throws SlickException { BufferedReader reader = new BufferedReader ( new InputStreamReader ( ResourceLoader . getResourceAsStream ( def ) ) ) ; try { image = new Image ( basePath + reader . readLine ( ) , false , filter , trans ) ; while ( reader . ready ( ) ) { ...
Load the definition file and parse each of the sections
38,309
public void reset ( ) { while ( holes != null ) { holes = freePointBag ( holes ) ; } contour . clear ( ) ; holes = null ; }
Reset the internal state of the triangulator
38,310
private void addPoint ( Vector2f pt ) { if ( holes == null ) { Point p = getPoint ( pt ) ; contour . add ( p ) ; } else { Point p = getPoint ( pt ) ; holes . add ( p ) ; } }
Add a defined point to the current contour
38,311
private PointBag freePointBag ( PointBag pb ) { PointBag next = pb . next ; pb . clear ( ) ; pb . next = nextFreePointBag ; nextFreePointBag = pb ; return next ; }
Release a pooled bag
38,312
private Point getPoint ( Vector2f pt ) { Point p = nextFreePoint ; if ( p != null ) { nextFreePoint = p . next ; p . next = null ; p . prev = null ; p . pt = pt ; return p ; } return new Point ( pt ) ; }
Create or reuse a point
38,313
private void freePoints ( Point head ) { head . prev . next = nextFreePoint ; head . prev = null ; nextFreePoint = head ; }
Release all points
38,314
private void initStreams ( ) throws IOException { if ( audio != null ) { audio . close ( ) ; } OggInputStream audio ; if ( url != null ) { audio = new OggInputStream ( url . openStream ( ) ) ; } else { audio = new OggInputStream ( ResourceLoader . getResourceAsStream ( ref ) ) ; } this . audio = audio ; positionOffset ...
Initialise our connection to the underlying resource
38,315
public void play ( boolean loop ) throws IOException { this . loop = loop ; initStreams ( ) ; done = false ; AL10 . alSourceStop ( source ) ; removeBuffers ( ) ; startPlayback ( ) ; }
Start this stream playing
38,316
public boolean stream ( int bufferId ) { try { int count = audio . read ( buffer ) ; if ( count != - 1 ) { bufferData . clear ( ) ; bufferData . put ( buffer , 0 , count ) ; bufferData . flip ( ) ; int format = audio . getChannels ( ) > 1 ? AL10 . AL_FORMAT_STEREO16 : AL10 . AL_FORMAT_MONO16 ; try { AL10 . alBufferData...
Stream some data from the audio stream to the buffer indicates by the ID
38,317
public boolean setPosition ( float position ) { try { if ( getPosition ( ) > position ) { initStreams ( ) ; } float sampleRate = audio . getRate ( ) ; float sampleSize ; if ( audio . getChannels ( ) > 1 ) { sampleSize = 4 ; } else { sampleSize = 2 ; } while ( positionOffset < position ) { int count = audio . read ( buf...
Seeks to a position in the music .
38,318
private void startPlayback ( ) { AL10 . alSourcei ( source , AL10 . AL_LOOPING , AL10 . AL_FALSE ) ; AL10 . alSourcef ( source , AL10 . AL_PITCH , pitch ) ; remainingBufferCount = BUFFER_COUNT ; for ( int i = 0 ; i < BUFFER_COUNT ; i ++ ) { stream ( bufferNames . get ( i ) ) ; } AL10 . alSourceQueueBuffers ( source , b...
Starts the streaming .
38,319
public void reset ( ) { Iterator pools = particlesByEmitter . values ( ) . iterator ( ) ; while ( pools . hasNext ( ) ) { ParticlePool pool = ( ParticlePool ) pools . next ( ) ; pool . reset ( this ) ; } for ( int i = 0 ; i < emitters . size ( ) ; i ++ ) { ParticleEmitter emitter = ( ParticleEmitter ) emitters . get ( ...
Reset the state of the system
38,320
public void addEmitter ( ParticleEmitter emitter ) { emitters . add ( emitter ) ; ParticlePool pool = new ParticlePool ( this , maxParticlesPerEmitter ) ; particlesByEmitter . put ( emitter , pool ) ; }
Add a particle emitter to be used on this system
38,321
public void removeAllEmitters ( ) { for ( int i = 0 ; i < emitters . size ( ) ; i ++ ) { removeEmitter ( ( ParticleEmitter ) emitters . get ( i ) ) ; i -- ; } }
Remove all the emitters from the system
38,322
public void render ( float x , float y ) { if ( ( sprite == null ) && ( defaultImageName != null ) ) { loadSystemParticleImage ( ) ; } if ( ! visible ) { return ; } GL . glTranslatef ( x , y , 0 ) ; if ( blendingMode == BLEND_ADDITIVE ) { GL . glBlendFunc ( SGL . GL_SRC_ALPHA , SGL . GL_ONE ) ; } if ( usePoints ( ) ) {...
Render the particles in the system
38,323
private void loadSystemParticleImage ( ) { AccessController . doPrivileged ( new PrivilegedAction ( ) { public Object run ( ) { try { if ( mask != null ) { sprite = new Image ( defaultImageName , mask ) ; } else { sprite = new Image ( defaultImageName ) ; } } catch ( SlickException e ) { Log . error ( e ) ; defaultImag...
Load the system particle image as the extension permissions
38,324
public void update ( int delta ) { if ( ( sprite == null ) && ( defaultImageName != null ) ) { loadSystemParticleImage ( ) ; } removeMe . clear ( ) ; ArrayList emitters = new ArrayList ( this . emitters ) ; for ( int i = 0 ; i < emitters . size ( ) ; i ++ ) { ParticleEmitter emitter = ( ParticleEmitter ) emitters . get...
Update the system request the assigned emitters update the particles
38,325
public Particle getNewParticle ( ParticleEmitter emitter , float life ) { ParticlePool pool = ( ParticlePool ) particlesByEmitter . get ( emitter ) ; ArrayList available = pool . available ; if ( available . size ( ) > 0 ) { Particle p = ( Particle ) available . remove ( available . size ( ) - 1 ) ; p . init ( emitter ...
Get a new particle from the system . This should be used by emitters to request particles
38,326
public void release ( Particle particle ) { if ( particle != dummy ) { ParticlePool pool = ( ParticlePool ) particlesByEmitter . get ( particle . getEmitter ( ) ) ; pool . available . add ( particle ) ; } }
Release a particle back to the system once it has expired
38,327
public void releaseAll ( ParticleEmitter emitter ) { if ( ! particlesByEmitter . isEmpty ( ) ) { Iterator it = particlesByEmitter . values ( ) . iterator ( ) ; while ( it . hasNext ( ) ) { ParticlePool pool = ( ParticlePool ) it . next ( ) ; for ( int i = 0 ; i < pool . particles . length ; i ++ ) { if ( pool . particl...
Release all the particles owned by the specified emitter
38,328
public void moveAll ( ParticleEmitter emitter , float x , float y ) { ParticlePool pool = ( ParticlePool ) particlesByEmitter . get ( emitter ) ; for ( int i = 0 ; i < pool . particles . length ; i ++ ) { if ( pool . particles [ i ] . inUse ( ) ) { pool . particles [ i ] . move ( x , y ) ; } } }
Move all the particles owned by the specified emitter
38,329
public ParticleSystem duplicate ( ) throws SlickException { for ( int i = 0 ; i < emitters . size ( ) ; i ++ ) { if ( ! ( emitters . get ( i ) instanceof ConfigurableEmitter ) ) { throw new SlickException ( "Only systems contianing configurable emitters can be duplicated" ) ; } } ParticleSystem theCopy = null ; try { B...
Create a duplicate of this system . This would have been nicer as a different interface but may cause to much API change headache . Maybe next full version release it should be rethought .
38,330
public static void setRenderer ( int type ) { switch ( type ) { case IMMEDIATE_RENDERER : setRenderer ( new ImmediateModeOGLRenderer ( ) ) ; return ; case VERTEX_ARRAY_RENDERER : setRenderer ( new VAOGLRenderer ( ) ) ; return ; } throw new RuntimeException ( "Unknown renderer type: " + type ) ; }
Set the renderer to one of the known types
38,331
public static void setLineStripRenderer ( int type ) { switch ( type ) { case DEFAULT_LINE_STRIP_RENDERER : setLineStripRenderer ( new DefaultLineStripRenderer ( ) ) ; return ; case QUAD_BASED_LINE_STRIP_RENDERER : setLineStripRenderer ( new QuadBasedLineStripRenderer ( ) ) ; return ; } throw new RuntimeException ( "Un...
Set the line strip renderer to one of the known types
38,332
public void transform ( float source [ ] , int sourceOffset , float destination [ ] , int destOffset , int numberOfPoints ) { float result [ ] = source == destination ? new float [ numberOfPoints * 2 ] : destination ; for ( int i = 0 ; i < numberOfPoints * 2 ; i += 2 ) { for ( int j = 0 ; j < 6 ; j += 3 ) { result [ i ...
Transform the point pairs in the source array and store them in the destination array . All operations will be done before storing the results in the destination . This way the source and destination array can be the same without worry of overwriting information before it is transformed .
38,333
public Transform concatenate ( Transform tx ) { float [ ] mp = new float [ 9 ] ; float n00 = matrixPosition [ 0 ] * tx . matrixPosition [ 0 ] + matrixPosition [ 1 ] * tx . matrixPosition [ 3 ] ; float n01 = matrixPosition [ 0 ] * tx . matrixPosition [ 1 ] + matrixPosition [ 1 ] * tx . matrixPosition [ 4 ] ; float n02 =...
Update this Transform by concatenating the given Transform to this one .
38,334
public static Transform createRotateTransform ( float angle ) { return new Transform ( ( float ) FastTrig . cos ( angle ) , - ( float ) FastTrig . sin ( angle ) , 0 , ( float ) FastTrig . sin ( angle ) , ( float ) FastTrig . cos ( angle ) , 0 ) ; }
Create a new rotation Transform
38,335
public static Transform createRotateTransform ( float angle , float x , float y ) { Transform temp = Transform . createRotateTransform ( angle ) ; float sinAngle = temp . matrixPosition [ 3 ] ; float oneMinusCosAngle = 1.0f - temp . matrixPosition [ 4 ] ; temp . matrixPosition [ 2 ] = x * oneMinusCosAngle + y * sinAngl...
Create a new rotation Transform around the specified point
38,336
public Vector2f transform ( Vector2f pt ) { float [ ] in = new float [ ] { pt . x , pt . y } ; float [ ] out = new float [ 2 ] ; transform ( in , 0 , out , 0 , 1 ) ; return new Vector2f ( out [ 0 ] , out [ 1 ] ) ; }
Transform the vector2f based on the matrix defined in this transform
38,337
public List getUniqueCommands ( ) { List uniqueCommands = new ArrayList ( ) ; for ( Iterator it = commands . values ( ) . iterator ( ) ; it . hasNext ( ) ; ) { Command command = ( Command ) it . next ( ) ; if ( ! uniqueCommands . contains ( command ) ) { uniqueCommands . add ( command ) ; } } return uniqueCommands ; }
Get the list of commands that have been registered with the provider i . e . the commands that can be issued to the listeners
38,338
public void bindCommand ( Control control , Command command ) { commands . put ( control , command ) ; if ( commandState . get ( command ) == null ) { commandState . put ( command , new CommandState ( ) ) ; } }
Bind an command to a control .
38,339
public void clearCommand ( Command command ) { List controls = getControlsFor ( command ) ; for ( int i = 0 ; i < controls . size ( ) ; i ++ ) { unbindCommand ( ( Control ) controls . get ( i ) ) ; } }
Clear all the controls that have been configured for a given command
38,340
public void unbindCommand ( Control control ) { Command command = ( Command ) commands . remove ( control ) ; if ( command != null ) { if ( ! commands . keySet ( ) . contains ( command ) ) { commandState . remove ( command ) ; } } }
Unbinds the command associated with this control
38,341
protected void firePressed ( Command command ) { getState ( command ) . down = true ; getState ( command ) . pressed = true ; if ( ! isActive ( ) ) { return ; } for ( int i = 0 ; i < listeners . size ( ) ; i ++ ) { ( ( InputProviderListener ) listeners . get ( i ) ) . controlPressed ( command ) ; } }
Fire notification to any interested listeners that a control has been pressed indication an particular command
38,342
protected void fireReleased ( Command command ) { getState ( command ) . down = false ; if ( ! isActive ( ) ) { return ; } for ( int i = 0 ; i < listeners . size ( ) ; i ++ ) { ( ( InputProviderListener ) listeners . get ( i ) ) . controlReleased ( command ) ; } }
Fire notification to any interested listeners that a control has been released indication an particular command should be stopped
38,343
public void addStep ( Diagram diagram ) { if ( diagram . getFigureCount ( ) != figures . size ( ) ) { throw new RuntimeException ( "Mismatched diagrams, missing ids" ) ; } for ( int i = 0 ; i < diagram . getFigureCount ( ) ; i ++ ) { Figure figure = diagram . getFigure ( i ) ; String id = figure . getData ( ) . getMeta...
Add a subsquent step to the morphing
38,344
public void updateMorphTime ( float delta ) { for ( int i = 0 ; i < figures . size ( ) ; i ++ ) { Figure figure = ( Figure ) figures . get ( i ) ; MorphShape shape = ( MorphShape ) figure . getShape ( ) ; shape . updateMorphTime ( delta ) ; } }
Update the morph time index by the amount specified
38,345
public void setMorphTime ( float time ) { for ( int i = 0 ; i < figures . size ( ) ; i ++ ) { Figure figure = ( Figure ) figures . get ( i ) ; MorphShape shape = ( MorphShape ) figure . getShape ( ) ; shape . setMorphTime ( time ) ; } }
Set the time index for this morph . This is given in terms of diagrams so 0 . 5f would give you the position half way between the first and second diagrams .
38,346
private void build ( ) { if ( list == - 1 ) { list = GL . glGenLists ( 1 ) ; SlickCallable . enterSafeBlock ( ) ; GL . glNewList ( list , SGL . GL_COMPILE ) ; runnable . run ( ) ; GL . glEndList ( ) ; SlickCallable . leaveSafeBlock ( ) ; } else { throw new RuntimeException ( "Attempt to build the display list more than...
Build the display list
38,347
public void render ( ) { if ( list == - 1 ) { throw new RuntimeException ( "Attempt to render cached operations that have been destroyed" ) ; } SlickCallable . enterSafeBlock ( ) ; GL . glCallList ( list ) ; SlickCallable . leaveSafeBlock ( ) ; }
Render the cached operations . Note that this doesn t call the operations but rather calls the cached version
38,348
public static ImageWriter getWriterForFormat ( String format ) throws SlickException { ImageWriter writer = ( ImageWriter ) writers . get ( format ) ; if ( writer != null ) { return writer ; } writer = ( ImageWriter ) writers . get ( format . toLowerCase ( ) ) ; if ( writer != null ) { return writer ; } writer = ( Imag...
Get a Slick image writer for the given format
38,349
public double getNumber ( String nameOfField , double defaultValue ) { Double value = ( ( Double ) numericData . get ( nameOfField ) ) ; if ( value == null ) { return defaultValue ; } return value . doubleValue ( ) ; }
Get number stored at given location
38,350
public String getString ( String nameOfField , String defaultValue ) { String value = ( String ) stringData . get ( nameOfField ) ; if ( value == null ) { return defaultValue ; } return value ; }
Get the String at the given location
38,351
private boolean isWebstartAvailable ( ) { try { Class . forName ( "javax.jnlp.ServiceManager" ) ; ServiceManager . lookup ( "javax.jnlp.PersistenceService" ) ; Log . info ( "Webstart detected using Muffins" ) ; } catch ( Exception e ) { Log . info ( "Using Local File System" ) ; return false ; } return true ; }
Quick test to see if running through Java webstart
38,352
public void init ( ) { try { AL . create ( ) ; soundWorks = true ; } catch ( LWJGLException e ) { System . err . println ( "Failed to initialise LWJGL OpenAL" ) ; soundWorks = false ; return ; } if ( soundWorks ) { IntBuffer sources = BufferUtils . createIntBuffer ( 1 ) ; AL10 . alGenSources ( sources ) ; if ( AL10 . a...
Initialise OpenAL LWJGL styley
38,353
public void setup ( float pitch , float gain ) { AL10 . alSourcef ( source , AL10 . AL_PITCH , pitch ) ; AL10 . alSourcef ( source , AL10 . AL_GAIN , gain ) ; }
Setup the playback properties
38,354
public static Module loadModule ( InputStream in ) throws IOException { Module module ; DataInputStream din ; byte [ ] xm_header , s3m_header , mod_header , output_buffer ; int frames ; din = new DataInputStream ( in ) ; module = null ; xm_header = new byte [ 60 ] ; din . readFully ( xm_header ) ; if ( FastTracker2 . i...
Load a module using the IBXM
38,355
public void setImage ( BufferedImage image ) { this . image = image ; setPreferredSize ( new Dimension ( image . getWidth ( ) , image . getHeight ( ) ) ) ; setSize ( new Dimension ( image . getWidth ( ) , image . getHeight ( ) ) ) ; getParent ( ) . repaint ( 0 ) ; }
Set the image to be displayed
38,356
public static File [ ] listFiles ( final String ext ) { init ( ) ; return config . listFiles ( new FilenameFilter ( ) { public boolean accept ( File dir , String name ) { return name . endsWith ( ext ) ; } } ) ; }
List the files with a given extension in the configuration directory
38,357
public void setEnabledForced ( boolean e ) { enabled . setEnabled ( e ) ; minSpinner . setEnabled ( e ) ; maxSpinner . setEnabled ( e ) ; }
Force the state of this component
38,358
public void setMin ( int value ) { updateDisable = true ; minSpinner . setValue ( new Integer ( value ) ) ; updateDisable = false ; }
Set the minimum value
38,359
public void setMax ( int value ) { updateDisable = true ; maxSpinner . setValue ( new Integer ( value ) ) ; updateDisable = false ; }
Set the maximum value
38,360
void fireUpdated ( Object source ) { if ( updateDisable ) { return ; } if ( source == maxSpinner ) { if ( getMax ( ) < getMin ( ) ) { setMin ( getMax ( ) ) ; } } if ( source == minSpinner ) { if ( getMax ( ) < getMin ( ) ) { setMax ( getMin ( ) ) ; } } for ( int i = 0 ; i < listeners . size ( ) ; i ++ ) { ( ( InputPane...
Notify listeners a change has occured on this panel
38,361
public void setEnabledValue ( boolean e ) { if ( enablement ) { enabled . setSelected ( e ) ; } minSpinner . setEnabled ( enabled . isSelected ( ) || ! enablement ) ; maxSpinner . setEnabled ( enabled . isSelected ( ) || ! enablement ) ; }
Indicate if this panel should be enabled
38,362
public void setTileSetImage ( Image image ) { tiles = new SpriteSheet ( image , tileWidth , tileHeight , tileSpacing , tileMargin ) ; tilesAcross = tiles . getHorizontalCount ( ) ; tilesDown = tiles . getVerticalCount ( ) ; if ( tilesAcross <= 0 ) { tilesAcross = 1 ; } if ( tilesDown <= 0 ) { tilesDown = 1 ; } lastGID ...
Set the image to use for this sprite sheet image to use for this tileset
38,363
private void remeasure ( ) { forceLayout ( ) ; measure ( MeasureSpec . makeMeasureSpec ( getMeasuredWidth ( ) , MeasureSpec . EXACTLY ) , MeasureSpec . makeMeasureSpec ( getMeasuredHeight ( ) , MeasureSpec . EXACTLY ) ) ; requestLayout ( ) ; }
Convenience for calling own measure method .
38,364
public void setSplitterPosition ( int position ) { mSplitterPosition = clamp ( position , 0 , Integer . MAX_VALUE ) ; mSplitterPositionPercent = - 1 ; remeasure ( ) ; notifySplitterPositionChanged ( false ) ; }
Sets the current position of the splitter in pixels .
38,365
public void setSplitterPositionPercent ( float position ) { mSplitterPosition = Integer . MIN_VALUE ; mSplitterPositionPercent = clamp ( position , 0 , 1 ) ; remeasure ( ) ; notifySplitterPositionChanged ( false ) ; }
Sets the current position of the splitter as a percentage of the layout .
38,366
public void setPaneSizeMin ( int paneSizeMin ) { mPaneSizeMin = paneSizeMin ; if ( isMeasured ) { int newSplitterPosition = clamp ( mSplitterPosition , getMinSplitterPosition ( ) , getMaxSplitterPosition ( ) ) ; if ( newSplitterPosition != mSplitterPosition ) { setSplitterPosition ( newSplitterPosition ) ; } } }
Sets the minimum size of panes in pixels .
38,367
public boolean differs ( ClassInfo oldInfo , ClassInfo newInfo ) { if ( Tools . isClassAccessChange ( oldInfo . getAccess ( ) , newInfo . getAccess ( ) ) ) return true ; if ( oldInfo . getSupername ( ) == null ) { if ( newInfo . getSupername ( ) != null ) { return true ; } } else if ( ! oldInfo . getSupername ( ) . equ...
Check if there is a change between two versions of a class . Returns true if the access flags differ or if the superclass differs or if the implemented interfaces differ .
38,368
public boolean differs ( MethodInfo oldInfo , MethodInfo newInfo ) { if ( Tools . isMethodAccessChange ( oldInfo . getAccess ( ) , newInfo . getAccess ( ) ) ) return true ; if ( oldInfo . getExceptions ( ) == null || newInfo . getExceptions ( ) == null ) { if ( oldInfo . getExceptions ( ) != newInfo . getExceptions ( )...
Check if there is a change between two versions of a method . Returns true if the access flags differ or if the thrown exceptions differ .
38,369
public boolean differs ( FieldInfo oldInfo , FieldInfo newInfo ) { if ( Tools . isFieldAccessChange ( oldInfo . getAccess ( ) , newInfo . getAccess ( ) ) ) return true ; if ( oldInfo . getValue ( ) == null || newInfo . getValue ( ) == null ) { if ( oldInfo . getValue ( ) != newInfo . getValue ( ) ) return true ; } else...
Check if there is a change between two versions of a field . Returns true if the access flags differ or if the inital value of the field differs .
38,370
public ClassInfo getClassInfo ( ) { return new ClassInfo ( version , access , name , signature , supername , interfaces , methodMap , fieldMap ) ; }
The the classInfo this ClassInfoVisitor has built up about a class
38,371
public void visit ( int version , int access , String name , String signature , String supername , String [ ] interfaces ) { this . version = version ; this . access = access ; this . name = name ; this . signature = signature ; this . supername = supername ; this . interfaces = interfaces ; }
Receive notification of information about a class from ASM .
38,372
public synchronized ClassInfo loadClassInfo ( ClassReader reader ) throws IOException { infoVisitor . reset ( ) ; reader . accept ( infoVisitor , 0 ) ; return infoVisitor . getClassInfo ( ) ; }
Load classinfo given a ClassReader .
38,373
public void diff ( DiffHandler handler , DiffCriteria criteria ) throws DiffException { diff ( handler , criteria , oldVersion , newVersion , oldClassInfo , newClassInfo ) ; }
Perform a diff sending the output to the specified handler using the specified criteria to select diffs .
38,374
private static ClassInfo cloneDeprecated ( ClassInfo classInfo ) { return new ClassInfo ( classInfo . getVersion ( ) , classInfo . getAccess ( ) | Opcodes . ACC_DEPRECATED , classInfo . getName ( ) , classInfo . getSignature ( ) , classInfo . getSupername ( ) , classInfo . getInterfaces ( ) , classInfo . getMethodMap (...
Clones the class info but changes access setting deprecated flag .
38,375
private static MethodInfo cloneDeprecated ( MethodInfo methodInfo ) { return new MethodInfo ( methodInfo . getAccess ( ) | Opcodes . ACC_DEPRECATED , methodInfo . getName ( ) , methodInfo . getDesc ( ) , methodInfo . getSignature ( ) , methodInfo . getExceptions ( ) ) ; }
Clones the method but changes access setting deprecated flag .
38,376
private static FieldInfo cloneDeprecated ( FieldInfo fieldInfo ) { return new FieldInfo ( fieldInfo . getAccess ( ) | Opcodes . ACC_DEPRECATED , fieldInfo . getName ( ) , fieldInfo . getDesc ( ) , fieldInfo . getSignature ( ) , fieldInfo . getValue ( ) ) ; }
Clones the field info but changes access setting deprecated flag .
38,377
public void startDiff ( String oldJar , String newJar ) throws DiffException { Element tmp = doc . createElementNS ( XML_URI , "diff" ) ; tmp . setAttribute ( "old" , oldJar ) ; tmp . setAttribute ( "new" , newJar ) ; doc . appendChild ( tmp ) ; currentNode = tmp ; }
Start the diff . This writes out the start of a &lt ; diff&gt ; node .
38,378
public void contains ( ClassInfo info ) throws DiffException { Element tmp = doc . createElementNS ( XML_URI , "class" ) ; tmp . setAttribute ( "name" , info . getName ( ) ) ; currentNode . appendChild ( tmp ) ; }
Add a contained class .
38,379
public void startAdded ( ) throws DiffException { Element tmp = doc . createElementNS ( XML_URI , "added" ) ; currentNode . appendChild ( tmp ) ; currentNode = tmp ; }
Start the added section . This opens the &lt ; added&gt ; tag .
38,380
public void startClassChanged ( String internalName ) throws DiffException { Element tmp = doc . createElementNS ( XML_URI , "classchanged" ) ; tmp . setAttribute ( "name" , internalName ) ; currentNode . appendChild ( tmp ) ; currentNode = tmp ; }
Start a changed section for an individual class . This writes out an &lt ; classchanged&gt ; node with the real class name as the name attribute .
38,381
public void classChanged ( ClassInfo oldInfo , ClassInfo newInfo ) throws DiffException { Node currentNode = this . currentNode ; Element tmp = doc . createElementNS ( XML_URI , "classchange" ) ; Element from = doc . createElementNS ( XML_URI , "from" ) ; Element to = doc . createElementNS ( XML_URI , "to" ) ; tmp . ap...
Write out info aboout a changed class . This writes out a &lt ; classchange&gt ; node followed by a &lt ; from&gt ; node with the old information about the class followed by a &lt ; to&gt ; node with the new information about the class .
38,382
public void fieldChanged ( FieldInfo oldInfo , FieldInfo newInfo ) throws DiffException { Node currentNode = this . currentNode ; Element tmp = doc . createElementNS ( XML_URI , "fieldchange" ) ; Element from = doc . createElementNS ( XML_URI , "from" ) ; Element to = doc . createElementNS ( XML_URI , "to" ) ; tmp . ap...
Write out info aboout a changed field . This writes out a &lt ; fieldchange&gt ; node followed by a &lt ; from&gt ; node with the old information about the field followed by a &lt ; to&gt ; node with the new information about the field .
38,383
public void methodChanged ( MethodInfo oldInfo , MethodInfo newInfo ) throws DiffException { Node currentNode = this . currentNode ; Element tmp = doc . createElementNS ( XML_URI , "methodchange" ) ; Element from = doc . createElementNS ( XML_URI , "from" ) ; Element to = doc . createElementNS ( XML_URI , "to" ) ; tmp ...
Write out info aboout a changed method . This writes out a &lt ; methodchange&gt ; node followed by a &lt ; from&gt ; node with the old information about the method followed by a &lt ; to&gt ; node with the new information about the method .
38,384
public void endDiff ( ) throws DiffException { DOMSource source = new DOMSource ( doc ) ; try { transformer . transform ( source , result ) ; } catch ( TransformerException te ) { throw new DiffException ( te ) ; } }
End the diff . This closes the &lt ; diff&gt ; node .
38,385
protected void writeClassInfo ( ClassInfo info ) { Node currentNode = this . currentNode ; Element tmp = doc . createElementNS ( XML_URI , "class" ) ; currentNode . appendChild ( tmp ) ; this . currentNode = tmp ; addAccessFlags ( info ) ; if ( info . getName ( ) != null ) tmp . setAttribute ( "name" , info . getName (...
Write out information about a class . This writes out a &lt ; class&gt ; node which contains information about what interfaces are implemented each in a &lt ; implements&gt ; node .
38,386
protected void writeMethodInfo ( MethodInfo info ) { Node currentNode = this . currentNode ; Element tmp = doc . createElementNS ( XML_URI , "method" ) ; currentNode . appendChild ( tmp ) ; this . currentNode = tmp ; addAccessFlags ( info ) ; if ( info . getName ( ) != null ) tmp . setAttribute ( "name" , info . getNam...
Write out information about a method . This writes out a &lt ; method&gt ; node which contains information about the arguments the return type and the exceptions thrown by the method .
38,387
protected void writeFieldInfo ( FieldInfo info ) { Node currentNode = this . currentNode ; Element tmp = doc . createElementNS ( XML_URI , "field" ) ; currentNode . appendChild ( tmp ) ; this . currentNode = tmp ; addAccessFlags ( info ) ; if ( info . getName ( ) != null ) tmp . setAttribute ( "name" , info . getName (...
Write out information about a field . This writes out a &lt ; field&gt ; node with attributes describing the field .
38,388
protected void addAccessFlags ( AbstractInfo info ) { Element currentNode = ( Element ) this . currentNode ; currentNode . setAttribute ( "access" , info . getAccessType ( ) ) ; if ( info . isAbstract ( ) ) currentNode . setAttribute ( "abstract" , "yes" ) ; if ( info . isAnnotation ( ) ) currentNode . setAttribute ( "...
Add attributes describing some access flags . This adds the attributes to the attr field .
38,389
public static String encrypt ( final String aText , final String aSalt ) throws NullPointerException , IOException { Objects . requireNonNull ( aText , LOGGER . getI18n ( "Text to encrypt is null" ) ) ; Objects . requireNonNull ( aSalt , LOGGER . getI18n ( "Salt to encrypt with is null" ) ) ; try { final MessageDigest ...
Encrypts the supplied text using the supplied salt .
38,390
private MDCCloseable setLineNumber ( ) { final int lineNum = Thread . currentThread ( ) . getStackTrace ( ) [ 3 ] . getLineNumber ( ) ; return MDC . putCloseable ( LINE_NUM , Integer . toString ( lineNum ) ) ; }
Sets the line number .
38,391
private static Writer getWriter ( final File aFile ) throws FileNotFoundException { try { return new OutputStreamWriter ( new FileOutputStream ( aFile ) , StandardCharsets . UTF_8 . name ( ) ) ; } catch ( final java . io . UnsupportedEncodingException details ) { throw new UnsupportedEncodingException ( details , Stand...
Gets a writer that can write to the supplied file using the UTF - 8 charset .
38,392
public Stopwatch stop ( ) { if ( ! myTimerIsRunning ) { throw new IllegalStateException ( LOGGER . getI18n ( MessageCodes . UTIL_041 ) ) ; } myStop = System . currentTimeMillis ( ) ; myTimerIsRunning = false ; return this ; }
Stop the stopwatch .
38,393
public String getSeconds ( ) { if ( myTimerIsRunning ) { throw new IllegalStateException ( LOGGER . getI18n ( MessageCodes . UTIL_042 ) ) ; } final StringBuilder result = new StringBuilder ( ) ; final long timeGap = myStop - myStart ; return result . append ( timeGap / 1000 ) . append ( " secs, " ) . append ( timeGap %...
Express the reading on the stopwatch in seconds .
38,394
public String getMilliseconds ( ) { if ( myTimerIsRunning ) { throw new IllegalStateException ( LOGGER . getI18n ( MessageCodes . UTIL_042 ) ) ; } return new StringBuilder ( ) . append ( myStop - myStart ) . append ( " msecs" ) . toString ( ) ; }
Express the reading on the stopwatch in milliseconds .
38,395
public static void load ( final String aNativeLibrary ) throws IOException { final String libFileName = getPlatformLibraryName ( aNativeLibrary ) ; final File tmpDir = new File ( System . getProperty ( "java.io.tmpdir" ) ) ; final File libFile = new File ( tmpDir , libFileName ) ; if ( ! libFile . exists ( ) || libFile...
Loads a native library from the classpath .
38,396
public static Architecture getArchitecture ( ) { if ( Architecture . UNKNOWN == myArchitecture ) { final Processor processor = getProcessor ( ) ; if ( Processor . UNKNOWN != processor ) { final String name = System . getProperty ( OS_NAME ) . toLowerCase ( Locale . US ) ; if ( name . indexOf ( "nix" ) >= 0 || name . in...
Gets the architecture of the machine running the JVM .
38,397
public static String getPlatformLibraryName ( final String aLibraryName ) { String libName = null ; switch ( getArchitecture ( ) ) { case LINUX_32 : case LINUX_64 : case LINUX_ARM : libName = LIB_PREFIX + aLibraryName + ".so" ; break ; case WINDOWS_32 : case WINDOWS_64 : libName = aLibraryName + ".dll" ; break ; case O...
Gets the library name for the current platform .
38,398
public static String trimTo ( final String aString , final String aDefault ) { if ( aString == null ) { return aDefault ; } final String trimmed = aString . trim ( ) ; return trimmed . length ( ) == 0 ? aDefault : trimmed ; }
Trims a string ; if there is nothing left after the trimming returns whatever the default value passed in is .
38,399
public static String padStart ( final String aString , final String aPadding , final int aRepeatCount ) { if ( aRepeatCount != 0 ) { final StringBuilder buffer = new StringBuilder ( ) ; for ( int index = 0 ; index < aRepeatCount ; index ++ ) { buffer . append ( aPadding ) ; } return buffer . append ( aString ) . toStri...
Pads the beginning of a supplied string with the repetition of a supplied value .