input
stringlengths
10
828
output
stringlengths
5
107
public result suite for all types get current suite ctab item currently selected tab folder get selection return result suite for all types currently selected get data metric data id
gets the result metric suite associated with the currently selected tab
public int compare viewer viewer object e1 object e2 int return c 0 one type result cast left one type result e1 one type result cast right one type result e2 return c cast left get column column compare to cast right get column column return return c directions column
compares two objects from the table which are always casts
public void set focus viewer get control set focus tab folder set focus
passing the focus request to the viewers control
public void calculation completed final result suite for all types result suite metrics plugin get default geti log trace metrics plugin get default geti log trace 0 listener reports calculation completed we try to find our view view activator activate corresponding view imetrics plugin metric view id final metric view my view metric view get view if my view null didn t work metrics plugin get default geti log trace 0 listener reports no view available return my view tab folder get display sync exec new runnable public void run view singleton add new data result suite
this method is called when a calculation process has finished
public string get column int j if j 0 return the type get fully qualified name if j 1 return type classification string res string values get metric abbreviations get j 2 return res null res
returns the metric result at column j
public ijava element get handle return the type
returns a handle for the type in this result set
public void add result string metric abbreviation string value values put metric abbreviation value
this adds a result to the table
public string get result string metric abbreviation return string values get metric abbreviation may be null
returns a result from this result set
public int compare to object o string fq name the type get fully qualified name string fq name2 one type result o get type get fully qualified name return fq name compare to fq name2
this class implements comparable to enable the result sets to be sorted
public string get column header text int j if j 0 return name if j 1 return type else return string registered calcs get metric abbreviations get j 2
column headers name type then the metric abbreviations
public void set type itype type throws java model exception this the type type this type classification the type is class class interface
sets the type
public int get column header size int i if i 0 i 1 return 120 else return 50
sizes of the columns for display
public void set hierarchy itype hierarchy hierarchy this hierarchy hierarchy
sets the hierarchy
public list get list of result sets return result set list
returns one type results of all types in the suite
public itype hierarchy get hierarchy return hierarchy
returns the hierarchy
public itype get type return the type
returns the type
public int get column count return 2 registered calcs get number of metrics
returns the number of columns
public void load selection from disk if project null throw new illegal argument exception project must not be null storage new xmlpreference storage list list of metric abbreviations storage get selected list project set all selections to false set selection from list of abbreviations list of metric abbreviations
sets the metric selections to the values selected by the user last time
private void set selection from list of abbreviations list list of metric abbreviations iterate through the selected abbreviations for iterator i list of metric abbreviations iterator i has next string current abbr string i next iterate through the registered metrics and update the selected ones for iterator j metric selection list iterator j has next metric selection ms metric selection j next if ms get metric get abbreviation equals current abbr ms set selected true
selects the metrics in this package according to the abbreviations in the
public void save selection to disk if project null throw new illegal argument exception project must not be null list selected metric abbreviations new array list for iterator i metric selection list iterator i has next metric selection sel metric selection i next if sel is selected selected metric abbreviations add sel get metric get abbreviation storage set selected list project selected metric abbreviations if storage save preferences project message dialog open error null into j metric preference error could not save project preferences see log for details
permanently stores selected metrics only their abbreviations
public void set registered calculators registered metric package registered package this registered calcs registered package
sets the package of registered calculators and metrics
public list get list of selected metrics ijava project project if project null throw new illegal argument exception project must not be null return storage get selected list project
returns a list of selected metrics abbreviations only
public string get metric result itype type string abbreviation of metric for iterator i this result set list iterator i has next one type result otr one type result i next if otr get type get fully qualified name equals type get fully qualified name return otr get result abbreviation of metric return null
returns a specific metric result for a specified type
private void set all selections to false for iterator i metric selection list iterator i has next metric selection i next set selected false
erases all selections from the list
public list get list of metric package return metric selection list
returns a list of selected metrics
public boolean set selected string metric boolean found false for iterator i metric selection list iterator i has next metric selection s metric selection i next if s get metric get abbreviation equals metric found true s set selected true break return found
test method sets a metric to selected according to its abbreviation
public list get metric abbreviations return this sorted metric abbrs
returns a list of metric abbreviations
public int get number of metrics return this number of metrics
returns the number of metrics registered
public iterator iterator return this cals key set iterator
returns an iterator over the icalculators in this package
public list get metric abbreviations for calculator icalculator calculator list l list cals get calculator list m new array list for iterator i l iterator i has next m add imetric i next get abbreviation return m
returns a list of metric abbreviations to be calculated by a calculator
public void print trace information metrics plugin get default geti log trace 0 creating registered metrics package metrics plugin get default geti log trace 0 registered metric package contains for iterator i cals key set iterator i has next icalculator calc icalculator i next metrics plugin get default geti log trace 0 calculator calc get id calculating list l list cals get calc for iterator j l iterator j has next imetric m imetric j next metrics plugin get default geti log trace 0 metric m get abbreviation
prints some useful information about this package
private document load xmldocument ijava project project trys to load the preferences from a file file preference file new file project get project get location file separator pref file name if preference file exists try return builder parse preference file catch saxexception e metrics plugin get default geti log log error could not parse the metric file e catch ioexception e metrics plugin get default geti log log error could not read the metric file e if that fails an empty document is returned return create xmldocument
creates the project preferences from a file or if that does not exist
public ilog geti log if i log null i log new ilog this metrics org into j metrics trace tmetrics return i log
returns the logger for this plugin
private list get listeners if metric result listeners null metric result listeners into jutil compute listeners extension metric view result listener imetric result listener class return this metric result listeners
returns the list of imetric listeners
public metric calculator tree get metrics return metric calculator tree
returns the tree of calculators and metrics
public url get install url return get bundle get entry
returns the base url of this plugin
public int compare viewer viewer object e1 object e2 int return c 0 cast cast left cast e1 cast cast right cast e2 return c cast left get column column compare to cast right get column column return return c directions column
compares two objects from the table which are always casts
public void search completed final collection collection of casts cast analyzer plugin get default geti log trace calculation completed we try to find our view view activator activate corresponding view cast analyzer plugin cast view id final cast view my view cast view get view if my view null didn t work cast analyzer plugin get default geti log trace no view available return display get default sync exec new runnable public void run view singleton set data collection of casts
called upon finished calculation
private int calculate method overlap collection collection collection collection2 return intersection collection collection2
collections contain imethod bindings
public int intersection collection methods1 collection methods2 int how many 0 iterator a methods1 iterator while a has next if util contains method methods2 imethod binding a next how many return how many
returns the number of methods present in both collections
protected void set data collection collection of casts if viewer null viewer set input collection of casts set part name cast search collection of casts size collection of casts size 1 cast casts found export action set enabled collection of casts size 0 this casts collection of casts
sets the data a collection of casts
public void set compilation unit icompilation unit unit this unit unit
sets the compilation unit of this visitor
public collection get casts return this casts
returns the casts found by this visitor
public collection get current collection of casts return casts
returns the casts
public void add type itype binding type types add type
adds a type
public void add all method type combo combo types add all combo get types for iterator i combo get methods iterator i has next add method imethod binding i next
adds all types and methods from another method type combo
public void add methods list bindings for iterator i bindings iterator i has next add method imethod binding i next
adds all methods from a list of imethodbinding
public collection get methods return methods
returns the methods of this type
private string replace semicolon string string return string replace
replaces the semicolons in this string by for csv exporting
public int get cast type return cast type
returns the type of this cast one of equal down up side
public string get cast type string return cast types cast type
returns a textual representation of the type of this cast
public string get enclosing element class itype superior itype handle get ancestor ijava element type string cname superior null unknown type superior get fully qualified name return cname
returns the name of the class in which this cast takes place
public string get enclosing element method if handle null if handle get element name equals return static initializer if handle instanceof imethod imethod m imethod handle string buffer returns new string buffer returns append m get element name for int i 0 i m get number of parameters i try returns append m get parameter names i catch java model exception e returns append unknown if m get number of parameters 0 returns delete char at returns length 1 returns append return returns to string return unknown
returns the name of the method in which this cast takes place
public string get enclosing element package itype superior itype handle get ancestor ijava element type string cname superior null unknown type superior get package fragment get element name return cname
returns the name of the package in which this cast takes place
private method type combo get interfaces recursive itype binding bindings method type combo ifs of this type new method type combo for int i 0 i bindings length i itype binding bindings of next type bindings i get interfaces recurse method type combo ifs from above get interfaces recursive bindings of next type add current type above ifs of this type add type bindings i ifs of this type add methods filter out constructors and static methods bindings i get declared methods ifs of this type add all ifs from above return ifs of this type
grabs all interfaces of the current type recursively
public int get from size return this from size
returns the method count in the from type
public int get to size return this to size
returns the method count in the to type
private list get guilisteners if gui listeners null gui listeners into jutil compute listeners cast view extension listener id icast search listener class return this gui listeners
returns the list of gui listeners
public void inform listeners final collection results for iterator all get guilisteners iterator all has next final icast search listener each icast search listener all next cast analyzer plugin get default geti log trace invoking icast search listener each get class to string isafe runnable runnable new isafe runnable public void handle exception throwable exception public void run throws exception each search completed results platform run runnable
informs all liseners about a finished search
public ijava element get handle return handle
returns the next enclosing java element of this cast
public string get from type return from type qualified name
returns the qualified name of the from type
public string get to type return to type qualified name
returns the qualified name of the to type
private string get package string qualified type name if qualified type name last index of 1 return qualified type name substring 0 qualified type name last index of else return qualified type name
returns the package for this qualified type name
private string get unqualified name string qualified type name if qualified type name last index of 1 return qualified type name substring qualified type name last index of 1 else return qualified type name
returns the unqualified name for this qualified type name
public string get expression return whole expression string
returns the expression
public resource bundle get resource bundle try if resource bundle null resource bundle resource bundle get bundle org into j infer type multirefac multirefac plugin resources catch missing resource exception x resource bundle null return resource bundle
returns the plugins resource bundle
protected void run with runnable final itype type runnable with progress irunnable with progress op new irunnable with progress public void run iprogress monitor monitor throws interrupted exception hierarchy set set hierarchy builder build super type hierarchy type hierarchy view show hierarchy set progress monitor dialog dialog new progress monitor dialog get shell try dialog run true true op catch invocation target exception e message dialog open error null invocation target exception e get message catch interrupted exception e message dialog open error null interrupted exception e get message
creates a new runnable and progress monitor and executes it
public boolean contains declaration declaration element some invocation for iterator i internal iterator i has next declaration element de declaration element i next if de equals signature some invocation return true return false
checks according to signature
public deset signature intersection deset signature other deset signature tmp new deset signature for iterator i other de iterator i has next declaration element de declaration element i next if contains declaration de tmp add declaration de return tmp
returns the intersection based on signature of this and the other set
public boolean contains declaration declaration element element return internal contains element
checks according to key
public boolean equals object o if o instanceof type element type element other type element o if this binding null other binding null return true binding may be null java lang object if other binding get key null this binding get key null return into jutil get qualified name for all types of types other binding equals into jutil get qualified name for all types of types this binding else return other binding get key equals this binding get key else return false
normally elements are compared using their key
public string to string line wrapped if internal size 0 return no elements empty set string buffer result new string buffer first element iterator i internal iterator result append i next other elements while i has next declaration element d declaration element i next result append n d return result to string
returns a representative string of the members of the deset
public boolean equals object o if o instanceof composite declaration element composite declaration element other composite declaration element o if this overridden declaration elements size other overridden declaration elements size return overridden declaration elements contains declarations this overridden declaration elements return false
this method is crucial to the success of the mission
public declaration element get declaration element of binding ibinding binding for iterator i internal iterator i has next declaration element current de declaration element i next if current de has key binding get key return current de return null
return the declaration element which contains this binding
public boolean equals signature declaration element d if d instanceof single declaration element single declaration element e single declaration element d if e get binding instanceof ivariable binding return variable equals this e else if e get binding instanceof imethod binding return method equals this get binding e get binding return false
compares declaration elements according to their signature
public boolean equals object o if o instanceof single declaration element single declaration element other single declaration element o return other get binding get key equals this get binding get key return false
this method is crucial to the success of the mission
public resource bundle get resource bundle try if resource bundle null resource bundle resource bundle get bundle org into j infer type2 multirefac multirefac plugin resources catch missing resource exception x resource bundle null return resource bundle
returns the plugins resource bundle
public hierarchy set get new hierarchy set return hset
returns the newly calculated type hierarchy
public boolean is infer type2 executable return is it2 executable
returns whether the refactoring infer type2 is executable
public boolean start creates new wizard wizard new graphical infer type wizard set de project wizard init workbench get instance null instantiates the wizard container with the wizard and opens it wizard dialog dialog new wizard dialog shell wizard dialog create dialog set block on open true starts the code manipulation return dialog open wizard dialog ok
start the wizard
private void separate members deset key members for iterator i members de iterator i has next declaration element current de declaration element i next if current de get kind declaration element field fields add declaration current de else if current de get kind declaration element method methods add declaration current de
this method separates the members into fields and methods
public void schedule declaration element declaration element e ijava project proj throws java model exception code change exception if e instanceof single declaration element ilog log manipulation 2 handling single de handle declaration element single declaration element e proj else ilog log manipulation 2 handling composite de handle composite declaration element composite declaration element e proj
schedules a declaration element to be re declared
public void perform all changes throws java model exception malformed tree exception bad location exception for iterator iter cu change map values iterator iter has next cuchange current changes cuchange iter next current changes perform
this methods performs all the changes
private void handle composite declaration element composite declaration element de ijava project proj throws java model exception code change exception for iterator i de get declaration elements de iterator i has next handle declaration element single declaration element i next proj
perform actions on composites
public boolean visit method declaration node if de get kind declaration element method if de has key node resolve binding get key this node node return true
visiting method declarations
private cuchange get cuchange icompilation unit icu cuchange cu change cuchange cu change map get icu if cu change null cu change new cuchange icu return cu change
returns the corresponding cuchange object for the given compilation unit
public boolean visit variable declaration expression node if de get kind declaration element localvariable return extract fragments new variable declaration expression statement node return true
visiting loop variables
public boolean visit variable declaration statement node if de get kind declaration element localvariable return extract fragments new variable declaration expression statement node return true
visiting local variables excluding loop and catch clauses
public void add new dedeclaration declaration element de string new type of de new declarations put de new type of de
schedule a declaration element
public variable declaration fragment get fragment return fragment
returns the fragment
public void add type where position has to be changed type element new type type set add type new type
schedule a type element
public list get local types return i type list
returns the local types found
public void layout diagram diagram part diagram part to nodes map new hash map graph new directed graph check if there are any types at all if diagram get diagram get types size 0 copy information into graph add types as nodes to graph diagram add inheritance as edges to graph diagram lay out the graph new directed graph layout visit graph copy information from graph to diagram again copy from graph to diagram diagram
lay out the diagram using the directed graph layout
private void apply type part results type part type part node n node part to nodes map get type part umltype figure table figure umltype figure type part get figure transfer the bounds x y width height from the graph rectangle bounds new rectangle n x n y table figure get preferred size width table figure get preferred size height table figure set bounds bounds for int i 0 i type part get source connections size i inheritance part inheritance inheritance part type part get source connections get i apply inheritance part results inheritance
method apply type part results
public int hash code return supertype get fully qualified name hash code subtype get fully qualified name hash code
method hash code
public string to string return inheritance supertype get supertype subtype get subtype
method to string
public type set get types return all
returns the types
public type element get root return root
returns the root
public void set show fields boolean fields this show fields fields
indicates whether fields should be displayed
public boolean is show fields return show fields
true if fields should be displayed