input
stringlengths 10
828
| output
stringlengths 5
107
|
|---|---|
public type set get sub types of type type element type type set subtypes new type set if root get all super types contains type subtypes add type type for iterator iter all types type iterator iter has next type element current type type element iter next if current type get all super types contains type subtypes add type current type subtypes remove type type return subtypes
|
returns all subtypes of the given type in the hierarchy
|
public iterator type iterator return internal iterator
|
returns an iterator
|
public collection to collection return internal
|
returns this set as a collection
|
public list get as list return new array list internal
|
returns this set as a list
|
public boolean remove type type element type return internal remove type
|
removes a type
|
public boolean contains declarations deset key elements return internal contains all elements internal
|
checks if this set contains the given set
|
public type element find type element for binding itype binding binding for iterator i type iterator i has next type element te type element i next if te get binding null te get binding get key equals binding get key return te return null
|
returns the type element for a binding if it exists
|
public void remove declarations deset key elements internal remove all elements internal
|
removes declarations from this set
|
public boolean contains itype binding binding return find type element for binding binding null
|
checks whether a type element with this binding exists in this set
|
public iterator de iterator return internal iterator
|
returns an iterator
|
public boolean is empty return internal is empty
|
true if empty
|
public string to string string buffer result new string buffer for iterator i internal iterator i has next type element d type element i next result append d if result length 0 result delete char at result length 1 return result to string
|
method to string
|
public boolean contains type once string string int count 0 for iterator i internal iterator i has next type element e type element i next if e get fully qualified name equals string count if count 1 return true return false
|
returns true if the type set contains the given type once
|
public type element get type element string string for iterator i internal iterator i has next type element e type element i next if e get fully qualified name equals string return e return null
|
return the type element inside the type set with the given
|
public boolean contains type element el return internal contains el
|
checks whether the element is part of this collection
|
public type get type if node instanceof variable declaration expression return variable declaration expression node get type if node instanceof variable declaration statement return variable declaration statement node get type return null
|
returns the type
|
public list fragments if node instanceof variable declaration expression return variable declaration expression node fragments if node instanceof variable declaration statement return variable declaration statement node fragments return null
|
returns the fragments
|
public boolean contains declaration string name return get declaration with simple name name null
|
checks whether the declaration with the given simple name
|
public astnode get astnode return node
|
returns the node itself
|
public string to string if node null string x node to string length 2 node to string substring 0 node to string length 2 node to string return variable declaration expression x else return variable declaration expression node is null
|
method to string
|
public boolean contains declaration once string name int count 0 for iterator i internal iterator i has next declaration element e declaration element i next if e contains declaration once name count if count 1 return true return false
|
checks whether the declaration with the given simple name
|
public declaration element get declaration with simple name string name for iterator i internal iterator i has next declaration element e declaration element i next if e contains declaration once name return e return null
|
returns all the declaration elements with the given simple name
|
private itext selection get text selection iselection selection throws internal calculation exception if selection null selection instanceof itext selection throw new internal calculation exception infer type problems while resolving text selection return itext selection selection
|
this method returns the corresponding itext selection of a given iselection if possible
|
private single declaration element get selected declaration element itext selection text icompilation unit icu throws internal calculation exception xxx hier gibts ne neue methode icu get element at oder so compilation unit cu util itypes parse compilation unit icu true compilation unit visitor vis new compilation unit visitor text cu accept vis if vis get declaration element null throw new internal calculation exception infer type not a valid selection n you must select a reference field parameter local variable or method where it is declared return vis get declaration element
|
this method determines the selected declaration element
|
public single declaration element get declaration element return declaration element
|
returns the declaration element
|
public boolean visit method declaration node if declaration element null return true if node null return true simple name name node get name if is selected name declaration element new single declaration element node resolve binding node get start position return true int index 0 list parameters node parameters for iterator i parameters iterator i has next determine binding single variable declaration i next get name index node resolve binding index return true
|
visit a method declaration
|
public boolean visit variable declaration fragment node if declaration element null return true if node null return true determine binding node get name return true
|
visit fields and local variables here also for variables in for loops
|
private string transform name string simple name string buffer name new string buffer simple name replace all if name length 1 return character to upper case name char at 0 name substring 1 else return name to string
|
this method transforms the declaration elements simple name to a valid
|
protected void sort into bins declaration element declaration element if declaration element get transitive invocations null return for iterator i declaration element get transitive invocations de iterator i has next declaration element current invoc declaration element i next check methods if current invoc get kind declaration element method int modifier current invoc get modifiers check for static method if modifier is static modifier static methods add declaration current invoc check for nonpublic method if modifier is public modifier nonpublic methods add declaration current invoc check fields if current invoc get kind declaration element field fields add declaration current invoc
|
this methods evaluates the transitive invocations of the declaration element
|
private boolean is new loop deset key new loop for iterator iter loops set iterator iter has next deset key current loop deset key iter next if current loop equals new loop return false return true
|
this method checks whether the new loop already exists
|
protected void create assignment induced inferred types declaration element de declaration element parent de deset key visited des check case parent de de if visited des contains declaration de return visited des add declaration de if de get out assignments null return for iterator i de get out assignments de iterator i has next create assignment induced inferred types declaration element i next de visited des
|
this method determines all occuring cases of typing which have to be used
|
private type element get equal existing type deset signature methods type element existing type null for iterator iter hset get all types type iterator iter has next type element current type type element iter next if current type get all members equals methods if existing type null existing type get all super types contains current type existing type current type return existing type
|
this methods checks whether an equal type still exists
|
private void remove super type from type type element super type type element type ilog log ilog log steps 2 remove supertype super type get fully qualified name from type get fully qualified name type remove declared supertype super type refactoring changes structure true
|
this method removes a supertype from another type
|
private void define new declared type declaration element de type element new declared type if de get declared type get qualified name equals new declared type get fully qualified name return de set new declared type new declared type ilog log ilog log steps 2 setting new type for de get complete information ilog log ilog log steps 3 now de get new declared type get fully qualified name ilog log ilog log steps 3 bef de get declared type get qualified name refactoring changes structure true
|
this method defines the new declared type of the given declaration element
|
public void set type name generator type name generator name generator this name generator name generator
|
sets the type name generator
|
public void set up throws exception super set up demo project new test project infer type2 plugin get default get bundle get entry
|
method set up
|
public void inform listener final assignments lattice container lattice container log trace agbuilder inform listener iterator listener iterator listeners iterator while listener iterator has next final iassignments lattice view listener current listener iassignments lattice view listener listener iterator next log trace agbuilder invoking assignments lattice view listener current listener get class to string isafe runnable runnable new isafe runnable public void handle exception throwable exception public void run throws exception aalattice lattice aalattice lattice container get lattices get 0 current listener calculation completed lattice container platform run runnable
|
p informs all listeners about a finished search
|
public void add access set listener iassignments lattice view listener listener listeners add listener
|
adds a new assignments lattice view listener to the plug in
|
public void remove access set listener iassignments lattice view listener listener listeners remove listener
|
removes an assignments lattice view listener from the plug in
|
public int compare viewer viewer object e1 object e2 int return c 0 switch column case 0 break case 1 return c aadeclaration element e1 get representative string compare to aadeclaration element e2 get representative string break case 2 return c aadeclaration element e1 get type compare to aadeclaration element e2 get type break return return c directions column
|
compares two objects from the table which are always taacess sets
|
public void change selection int currentselection display actions protocol is checked protocol display actions in assignments is checked in assignments out assignments first change ui information switch currentselection case protocol this menu selection protocol this text column set text header protocol this set title title protocol break case in assignments this menu selection in assignments this text column set text header in assignments this set title title in assignments break case out assignments this menu selection out assignments this text column set text header out assignments this set title title out assignments break update domain data
|
displays another part of the information of a access set lattice
|
private void update domain data if current de null switch menu selection case protocol viewer set input current de get protocol break case in assignments viewer set input current de get in assignments break case out assignments viewer set input current de get out assignments break else viewer set input new array list
|
called by the listener method changes the underlying data
|
protected void set data aalattice lattice viewer set input lattice get aadeclaration elements this current declaration elements lattice get aadeclaration elements this viewer set selection null true sends notifications to info view clear info view get view site get page remove selection listener myself iselection new selection new structured selection new aalattice impl selection changed event event new selection changed event selection provider new selection selection provider set selection new selection selection provider fire selection changed event selection provider set selection null get view site get page add selection listener myself
|
updates the tabular view with a completely new assignments lattice
|
public int compare viewer viewer object e1 object e2 int return c 0 switch column case 0 break case 1 return c new integer aalattice e1 size compare to new integer aalattice e2 size break case 2 return c aalattice e1 get representative string compare to aalattice e2 get representative string break return return c directions column
|
compares two objects from the table which are always taacess sets
|
protected void set data assignments lattice container lattice container viewer set input lattice container get lattices this current lattices lattice container get lattices this viewer set selection null true sends notifications to info view clear info view get view site get page remove selection listener myself iselection new selection new structured selection new assignments lattice container selection changed event event new selection changed event selection provider new selection selection provider set selection new selection selection provider fire selection changed event selection provider set selection null get view site get page add selection listener myself
|
updates the tabular view with a completely new assignments lattice
|
private boolean check prerequesites ifield field if field is binary message dialog open error get shell binary field cannot parse binary fields return false todo check also declared type return true
|
checks whether assignments graph of field can be build
|
private boolean check prerequesites imethod method if method is binary message dialog open error get shell binary method cannot parse binary methods return false todo check also return type return true
|
checks whether assignments graph of method can be build
|
private boolean check prerequesites itype type if type is binary message dialog open error get shell binary type cannot parse binary types return false return true
|
checks whether assignments graphs of type can be build
|
public deset key updated des throws java model exception deset key declaration elements updated new deset key for iterator i declaration elements de iterator i has next single declaration element single de single declaration element i next declaration elements updated add declaration update de single de return declaration elements updated
|
this method updates the set of single declaration elements
|
private boolean is valid type itype binding declared type return valid types contains declared type declared type get qualified name equals java lang object
|
checks if the given type is a valid one
|
public string get dename return to string
|
returns the name of the declaration element
|
public string get detype name return this de type name
|
returns the full qualified name of the declared type of the declaration element
|
public int get kind return this kind
|
returns the kind of the declaration element
|
public int get modifiers return this modifier
|
returns the modifiers of the declaration element
|
public int get transitive invocation size return this number of trans invocs
|
return the size of the transitive invocations of the declaration element
|
public int get number of non public methods return this number of non public methods
|
returns the number of non public methods inside the transitive invocations
|
public int get number of static methods return this number of static methods
|
returns the number of static methods inside the transitive invocations
|
public int get number of fields return this number of fields
|
returns the number of fields inside the transitive invocations
|
public int get assignments graph size return this assignments graph size
|
return the size of the transitive out assignments of the declaration element
|
public int get number of loops in the assignments graph return this number of loops in the assignments graph
|
returns the number of different loops inside the assignments graph
|
public void evaluation completed final collection collection of casts we try to find our view view activator activate corresponding view evaluation plugin evaluation view id final evaluation view my view evaluation view get view if my view null didn t work ilog log 0 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
|
protected void set data collection collection of evaluations if viewer null viewer set input collection of evaluations set part name infer type evaluation collection of evaluations size collection of evaluations size 1 de des evaluated this evaluations collection of evaluations export action set enabled evaluations size 0
|
sets the data a collection of evaluations
|
public collection get current collection of evaluations return evaluations
|
returns the casts
|
public int compare viewer viewer object o1 object o2 int return c 0 deinformation module e1 deinformation module o1 deinformation module e2 deinformation module o2 return c e1 get column column compare to e2 get column column return return c directions column
|
compares two objects from the table which are always evaluations
|
public int get number of out assignments return number of out assignments
|
returns the number of out assignments in the assignments graph
|
public int get number of introduced types if is infer type2 executable return 1 number of case4 return 0
|
returns the number of types which have to be introduced when perfoming
|
public boolean is something strange return get number of case5 0 get number of un handled assignments 0 has conflicting invocations
|
returns whether there is something strange in this evaluation
|
private void store deinfos declaration element declaration element module kind declaration element get kind module modifier declaration element get modifiers module de name declaration element get beautified name module de type name declaration element get fully qualified name of type module de declaring types declaration element get declaring classes to string module number of trans invocs declaration element get transitive invocations size module hash code declaration element hash code
|
this method stores the relevant information about the declaration element
|
private void determine assignments graph size declaration element declaration element deset key transitive out assignments new deset key fill transitive out assignments declaration element transitive out assignments module assignments graph size transitive out assignments size
|
this methods determines the size of the assignments graph
|
private void fill transitive out assignments declaration element de deset key transitive out assignments module number of out assignments if transitive out assignments contains declaration de return transitive out assignments add declaration de if de get out assignments null return for iterator iter de get out assignments de iterator iter has next fill transitive out assignments declaration element iter next transitive out assignments
|
this method fills the transitive out assignments set recursively
|
private void create type hierarchy declaration element declaration element array use element type for type hierarchy itype binding root itype binding declaration element get declared type if root itype binding is array root itype binding root itype binding get element type hset hierarchy builder build super type hierarchy root itype binding
|
this methods creates the hierarchy set of the declared type of the
|
private void log into file string invoc type declaration element de deset signature conflicting invocs if ilog is log writer valid ilog write into log file 0 ilog write into log file 0 invoc type declaration element ilog write into log file 1 de conflicting invocs ilog write into log file 1 conflicting invocations ilog write into log file 2 conflicting invocs to string ilog write into log file 0 ilog write into log file 0
|
this methods logs some interesting information of conflicting invocations into
|
private void log into file string case type declaration element a declaration element b if ilog is log writer valid ilog write into log file 0 ilog write into log file 0 case type source ilog write into log file 0 source ilog write into log file 1 a target ilog write into log file 0 target ilog write into log file 1 b ilog write into log file 0 ilog write into log file 0
|
this methods logs some interesting information of the assignment
|
public collection get information modules return all information modules
|
returns the calculated evaluations
|
private list get eval listeners if this eval listeners null this eval listeners compute listeners evaluation view extension listener id ievaluation listener class return this eval listeners
|
returns the list of evaluation listeners
|
public void inform listeners final collection results for iterator all get eval listeners iterator all has next final ievaluation listener each ievaluation listener all next isafe runnable runnable new isafe runnable public void handle exception throwable exception public void run throws exception each evaluation completed results platform run runnable
|
informs all liseners about a finished evaluation
|
protected void set data collection collection of evaluations if viewer null viewer set input collection of evaluations set part name infer type 2 evaluation collection of evaluations size collection of evaluations size 1 de des evaluated this evaluations collection of evaluations export action set enabled evaluations size 0
|
sets the data a collection of evaluations
|
private void create type hierarchy declaration element declaration element itype binding root itype binding declaration element get declared type hset hierarchy builder build super type hierarchy root itype binding
|
this methods creates the hierarchy set of the declared type of the
|
private void open in editor string fq name try find type only works for top level types here this is not a problem as we just created a top level type and are trying to find it itype created type type get java project find type fq name into jutil open in editor created type catch java model exception e simple infer type plugin get default geti log log error there was a problem accessing the java model e
|
opens the previously created type in editor
|
private void add entries composite composite add name input composite add separator composite add creation type entry composite add separator composite add member list composite
|
adds the several parts to the main composite
|
private void add name input composite composite package label label package label new label composite swt none package text new text composite swt single swt left swt border package browse button new button composite swt none package browse button add selection listener this create package standard widgets package label package text package browse button name label label name label new label composite swt none name text new text composite swt single swt left swt border create standard class name widgets name label name text true
|
creates the name and package area
|
private void add member list composite composite description label label description label new label composite swt none grid data gd new grid data gd horizontal span 3 description label set layout data gd description label set text member list title members table table table create member table composite gd new grid data gd horizontal span 2 gd vertical span 3 gd grab excess horizontal space true gd horizontal alignment grid data fill gd height hint 150 table set layout data gd button list create button list composite
|
creates the members list area
|
private int get modifier code declaration element de int modifier de get modifiers sort public default protected private if modifier is public modifier return 0 if modifier is protected modifier return 2 if modifier is private modifier return 3 return 1
|
returns an own defined modifier code for a better comparison
|
private void validate input try string util validate package name package text get text string util validate java type name name text get text check for existence get fqname of type to be created try test for warnings check for selected invocations string util validate package name length for zero package text get text string util validate java type name according to spec name text get text input correct catch validation exception e show warning e get message catch validation exception e input erroneous e get message
|
checks the current input
|
private void check for selected invocations throws validation exception for iterator i invocations item list iterator i has next table item current table item table item i next if tableitem isn t checked if current table item get checked and tableitem is no field member and the interface creation is chosen if field table item list contains current table item is interface creation chosen continue then throw warning message throw new validation exception you did not select all the members necessary for the inferred type
|
checks if all invocations are still selected
|
private void input correct set error message null set message null set description page discription no input error true set page complete can be finished
|
settings if input is correct
|
protected boolean check prerequesites declaration element de if de get declared type is from source message dialog open error get shell binary type declared type of selected declaration element is binary n please select a declaration element declared by a project type return false return true
|
checks whether it is possible to work with selected declaration element
|
public deset key get invocations return invocations
|
returns the determined transitive invocations
|
public deset key get members of root type return members of root type
|
returns the members of the type of selected declaration element
|
public void start throws java model exception determine return type of declaration element this is the originally selected declaration element s declared type has been found before so nothing can go wrong here itype type binding util find primary secondary or inner itypes declaration element get declared type get qualified name java project creates new wizard infer type wizard wizard new infer type wizard invocations members type wizard init workbench null instantiates the wizard container with the wizard and opens it wizard dialog dialog new wizard dialog shell wizard dialog create dialog open
|
start the wizard
|
public deset key get selected members deset key result set new deset key for interfaces are only the methods relevant list table items in focus is interface creation chosen method table item list table item list for iterator i table items in focus iterator i has next table item current table item table item i next if current table item get checked result set add declaration declaration element current table item get data return result set
|
returns the selected members
|
protected void init calculator itype the type iprogress monitor monitor java project the type get java project project scope search engine create java search scope new ijava project java project this monitor monitor
|
initializes the calculator for run ascalculation
|
protected void init calculator ijava project java project iprogress monitor monitor this java project java project project scope search engine create java search scope new ijava project java project this monitor monitor
|
initializes the calculator for calculate invocations on element
|
public ilog geti log if i log null i log new ilog this type access calculat org into j type access calculators trace as finder return i log
|
returns the logger for this plugin
|
private boolean nodas acd bcd selected list metrics to calculate return metrics to calculate contains nodas metrics to calculate contains acd metrics to calculate contains bcd
|
tests whether one of the three metrics acd bcd or nodas are selected
|
public boolean is abstract if is new type element return true if is interface return true if binding null return false return modifier is abstract binding get modifiers
|
true if this type is an abstract class or an interface
|
private void determine transitive out assignments declaration element de deset key out assignments if visited des contains declaration de return visited des add declaration de if de get out assignments null return out assignments add declarations de get out assignments for iterator iter de get out assignments de iterator iter has next determine transitive out assignments declaration element iter next out assignments
|
this method determines recursively the transitive out assignments for the given
|
public string get return type if return type null return return type else return get fully qualified name of type
|
if this de represents a method declaration this method will return the
|
public int get array dimensions of type return get declared type get dimensions
|
if this is a method or a variable this method will return
|
public string get beautified name string name unknown if binding instanceof ivariable binding name binding get name if binding instanceof imethod binding name get representative string of method imethod binding binding if binding instanceof itype binding name array creation of type binding get name if name ends with for int i 0 i get array dimensions of type i name return name
|
returns a beaufified name of this element
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.