input
stringlengths
10
828
output
stringlengths
5
107
public void component changed component c fire event circuit event action change c
notifies all listeners in the circuit that a component has
public location get other end location loc return loc equals e0 e1 e0
get the opposite end of the wire than the one given
public void components changed collection c fire event circuit event action change c
notifies all listeners in the circuit that several components have
public boolean shares end wire other return this e0 equals other e0 this e1 equals other e0 this e0 equals other e1 this e1 equals other e1
check if this wire shares an end point with the given wire
public boolean overlaps wire other return overlaps other e0 other e1
check if a wire overlaps this wire
private boolean overlaps location q0 location q1 if is x equal int x0 q0 get x return x0 q1 get x x0 e0 get x e1 get y q0 get y e0 get y q1 get y else int y0 q0 get y return y0 q1 get y y0 e0 get y e1 get x q0 get x e0 get x q1 get x
check if the line between two locations overlaps any part of this wire
public void draw handles component draw context context context draw handle e0 context draw handle e1
draw the handles of the wire one for each end point
public component create component location loc attribute set attrs return new subcircuit loc this attrs
create a component in this circuit
public bounds get offset bounds attribute set attrs return pins get offset bounds attrs
gets the bounds of a circuit pins object
public attribute set create attribute set return new circuit attributes this
creates and returns a new circuit attributes object
public object get feature object key attribute set attrs if key facing attribute key return std attr facing return super get feature key attrs
get a certain attribute from an attribute set
static public void switch to width graphics g int width if g instanceof graphics2 d graphics2 d g2 graphics2 d g g2 set stroke new basic stroke float width
set the stroke width of a graphics object
public list get libraries return collections empty list
get a list of sub libraries in this library
public list get elements return list util join immutable lists get tools get libraries
get the sub libraries and tools contained in the library
public tool get tool string name iterator it get tools iterator while it has next object o it next if o instanceof tool tool o get name equals name return tool o return null
searches for a tool object with the given name in the library
public boolean contains from source tool query for iterator it get tools iterator it has next object obj it next if obj instanceof tool tool tool tool obj if tool shares source query return true return false
checks if the given tool shares a source with any tools in the
public int index of component factory query int index 0 for iterator it get tools iterator it has next index object obj it next if obj instanceof add tool add tool tool add tool obj if tool get factory query return index return 1
searches for a tool in the given library and returns the index of
public boolean contains component factory query return index of query 0
checks if a tool object is contained in the library
public library get library string name iterator it get libraries iterator while it has next object o it next if o instanceof library library o get name equals name return library o return null
searches for a sub library with the given name in the library
public void do it project proj first do it proj second do it proj
performs the first code action code and the second code action code
public void undo project proj second undo proj first undo proj
performs the undo action for both code action code objects
public action append action other return new union action this other
appends the code action code other to the current code action code
public void set frame frame value if frame value return frame old value frame frame value projects window created this old value value
sets the code frame code for the project
public options frame get options frame boolean create if options frame null options frame get logisim file file if create options frame new options frame this else options frame null return options frame
returns the code options frame code for the project
public log frame get log frame boolean create if log frame null if create log frame new log frame this return log frame
returns the code log frame code associated with the project
public action get last action if undo log size 0 return null else return action data undo log get last action
returns the last code action code
public jfile chooser create chooser if file null return new jfile chooser loader loader file get loader return loader null new jfile chooser loader create chooser
returns a new code jfile chooser code
public void add project listener project listener what project listeners add what
adds a code project listener code to the class
public void remove project listener project listener what project listeners remove what
removes a code project listener code from the class
public void add library listener library listener value file listeners add value if file null file add library listener value
adds a code library listener code to the class
public void remove library listener library listener value file listeners remove value if file null file remove library listener value
removes a code library listener code from the class
private void fire event int action object old object data fire event new project event action this old data
fires an event by first creating a new code project event code
private void fire event int action object data fire event new project event action this data
fires an event by first creating a new code project event code
private void fire event project event event for iterator it project listeners iterator it has next project listener what project listener it next what project changed event
fires an event
public boolean is startup screen return startup screen
we track whether this project is the empty project opened
public boolean confirm close string title return frame confirm close title
confirms that the project was meant to be closed
public void set startup screen boolean value startup screen value
sets the variable indicating that this is the startup screen
public void set current circuit circuit circuit circuit state circ state circuit state state map get circuit if circ state null circ state new circuit state this circuit set circuit state circ state
sets the current code circuit code
public void set tool tool value if tool value return tool old tool if old null old deselect frame get canvas if selection is empty if value null selection drop all else if get options get mouse mappings contains select tool selection clear startup screen false tool value if tool null tool select frame get canvas fire event project event action set tool old tool
sets a new code tool code
public void undo action if undo log null undo log size 0 action data data action data undo log remove last set circuit state data circuit state action action data action if action is modification undo mods action undo this file set dirty is file dirty fire event repaint
undoes the last code action code
public void repaint canvas for actions that ought not be logged i e those that change nothing except perhaps the current values within the circuit fire event repaint
repaints the canvas
public void update kwantu super class final kwantu class super class if kwantu super class super class no change return if kwantu super class null remove existing superclass kwantu super class remove kwantu subclass name kwantu super class null if super class null add new superclass kwantu super class super class super class put kwantu subclass this
update the super class and the subclass list in synch
public string get next page name return next page name
move to this page when the button is invoked
public string get next page context xpath return next page context xpath
move to this context for the next page
public boolean is submit return submit
is the button a submit button that sends the form data with it
protected type descriptor determine type context throws kwantu invalid xpath exception return get parent get type descriptor
determine the type context of this component for the evaluation of its
public kwantu business object model add kwantu dependencies final kwantu dependency dependencies for kwantu dependency dep dependencies dep set owning kwantu business object model this get kwantu dependencies add dep return this
utility method for creating test data
public kwantu business object model add kwantu relationships final string arg sets for string arg set arg sets add kwantu relationship arg set 0 arg set 1 arg set 2 arg set 3 arg set 4 arg set 5 return this
utility method for creating test data
public kwantu business object model add superclasses final string arg sets for string arg set arg sets add superclass arg set 0 arg set 1 return this
utility method for creating test data
public boolean can add key final k key return find item key null
override this to impose special conditions on adding to the set
public boolean has key final t item final k key return get key item equals key
override this if the key does not implement an equals method
public kwantu class add kwantu methods final kwantu method methods for kwantu method method methods method set owning kwantu class this get declared kwantu methods add method return this
utility method for testing
public void deserialize from xml final reader reader throws ioexception xstream xstream new xstream new dom driver alias config xstream xstream from xml reader this
initialize the current instance from serialized data
private void init annotation configuration conf new annotation configuration conf set property hibernate connection url jdbc hsqldb mem m2testdatabase counter m2 hibernate util add annotated classes conf session factory conf build session factory
initialize the databse
private void re init session session get session factory open session session begin transaction session create sqlquery set referential integrity false execute update for class c m2 hibernate util mapped classes session create query delete c get name execute update session create sqlquery set referential integrity true execute update session get transaction commit session close
re initialize the database by deleting all records
protected annotation configuration instantiate annotation configuration return new annotation configuration
override this method if you want to provide your own or a configured
public kwantu method create kwantu method final string signature final string body final long table id kwantu method new method create kwantu method signature body new method set table id table id return new method
we have this method primarily for not losing the table id when composing
public kwantu class add kwantu imports kwantu import imports for kwantu import imp imports add kwantu import imp return this
utility method for generating test data
public boolean is amany to many link if get kwantu attributes size 0 return false if get kwantu methods size 0 return false if get kwantu relationships size 2 return false boolean is owned false boolean is not owned false for kwantu relationship rel get kwantu relationships if rel get inverse kwantu relationship get cardinality kwantu relationship cardinality many return false if rel get inverse kwantu relationship is owner is owned true else is not owned true is one relationship owning and the other not if is owned is not owned return false return true
if this class
private string drop rightmost step string s string t trim s int i t last index of if i 0 return else return t substring 0 i
remove the rightmost component of an expath
private boolean is super class owned if kwantu super class null return false if get owning kwantu relationship get inverse kwantu relationship get relationship to kwantu class equals this return false return true
determine if the super class of this kwantu class is owned
public object get method context log info getting method context return get object get context object
if the xpath refers to a method rather than an attribute we cannot
public boolean matches object o try return string util is empty value property utils get property o attribute to string contains value catch illegal access exception ex throw new kwantu fault exception ex get message ex catch invocation target exception ex throw new kwantu fault exception ex get message ex catch no such method exception ex throw new kwantu fault exception ex get message ex
currently we simply match if the value of the restriction is contained
protected string get application name return null
override this method to supply an existing applications name
protected string get application id return null
override this method to supply an existing applications id
public void test model list throws ioexception document exception document doc get document new url context models assert not null doc assert true doc has content assert false doc select nodes models model is empty assert false doc select nodes models model name library is empty
test for the kwantu model list resource
public object get from context string xpath object parent context return controller get from context xpath parent context
use jxpath to access attributes and more traverse references by reflection
protected void initialize hibernate session factory annotation configuration configuration new annotation configuration configure hibernate configuration db session factory configuration build session factory
call this from the sub class probably in the constructor after having
protected void load component map kwantu ui components new hash map for kwantu panel p get ui panels load component p
create a hashmap of all ui components
private void load component kwantu component component if component instanceof kwantu page log info loading page kwantu page component get name if component instanceof composite for kwantu component c composite component get children load component c kwantu ui components put component get identity id component
traverse tree of components adding each one
public void invoke object context string method path list method arg method args hash map string object arg vals log info invoking method path on context num args method args size list args resolve args context method path method args arg vals invoke context method path args to array true
call the kwantu method with the given arguments
private string substitute xpaths object context string s return xpath util substitute xpaths s context get root rendering context
parse string replacing xpath expressions enclosed in with the values they
private void cache result class result type object result hash map string object result map hash map string object get root rendering context get return value if result map null result map new hash map string object get root rendering context put return value result map result map clear if result null todo change this to use the declared return type of the method rather than the type of the result that way it won t change if a sub type is returned result map put result type get simple name result
store the possible return value of the method invocation
public object get from context string xpath object parent context return xpath util get from context xpath parent context get root rendering context
use jxpath to access attributes and more traverse references by reflection
public object get value kwantu field f object parent context log info field path f get path parent context parent context object context object parent context null get root rendering context parent context object value get from context f get path context object log info value value return value
use jxpath to retrieve a value from an arbitrary object graph
public boolean get false return false
used to initialize owner in relationship add above
public kwantu component ui get root panel kwantu component component if component get parent null return component else return ui get root panel component get parent
the return type of this method is kwantu component even though we know
public void create initial layout ipage layout layout string editor area layout get editor area add fast views layout add view shortcuts layout add perspective shortcuts layout final ifolder layout create folder layout create folder de eiswind mango folder left ipage layout left 0 25f editor area create folder add view search view id iplaceholder folder layout l layout create placeholder folder de eiswind mango folder bottom ipage layout bottom 0 75f editor area l add placeholder user group view id
creates the initial layout for a page
public boolean perform drop object data category target category get current target if target null target category get viewer get input category to drop category data tree viewer viewer tree viewer get viewer cannot drop a gadget onto itself or a child for int i 0 i to drop length i if to drop i equals target target has parent to drop i return false for int i 0 i to drop length i to drop i set parent target target get children add to drop i viewer add target to drop i viewer reveal to drop i return true
method declared on viewer drop adapter
public boolean validate drop object target int op transfer data type return category transfer get instance is supported type type
method declared on viewer drop adapter
protected control guess control iobservable value if value instanceof iswtobservable widget w iswtobservable value get widget if w instanceof control return control w if value instanceof iviewer observable value if iviewer observable value value get viewer null return iviewer observable value value get viewer get control if value instanceof iviewer observable list return iviewer observable list value get viewer get control if value instanceof table observable return table observable value get widget return null
if this observable is bound to a control it will be returned
public void open final display display display get default create model create contents shell open shell layout while shell is disposed if display read and dispatch display sleep
open the window
public void create initial layout ipage layout layout string editor area layout get editor area add fast views layout add view shortcuts layout add perspective shortcuts layout layout add view user view id ipage layout left 1f editor area layout set editor area visible false
creates the initial layout for a page
public void create initial layout ipage layout layout string editor area layout get editor area layout set editor area visible false add fast views layout add view shortcuts layout add perspective shortcuts layout layout add view value list view id ipage layout left 1f editor area
creates the initial layout for a page
public void init value list service service activator get default get service cache get value list service long user id activator get default get user id model service find all value lists user id onix mapping service find onix mapping for value user id onix code lists service find all onix code lists user id onix code list mappings service find onix list mapping for value lists user id
loads the list in background
private void initialize tool bar itool bar manager toolbar manager get view site get action bars get tool bar manager toolbar manager add create item action toolbar manager add open document action toolbar manager add delete document action
initialize the toolbar
public image set image image image if source image null source image is disposed source image dispose source image null source image image show original fit480x640 return source image
reload image from a file
public image data get image data return screen image get image data
get the image data
private void initialize tool bar itool bar manager toolbar manager get view site get action bars get tool bar manager toolbar manager add add user action toolbar manager add delete user action
initialize the toolbar
private void initialize tool bar itool bar manager toolbar manager get view site get action bars get tool bar manager toolbar manager add remove action
initialize the toolbar
public catalogue preview page form editor editor super editor catalogue preview page messages get string catalogue preview page preview non nls 1 non nls 2
create the form page
public void init person parameter search parameter parameter attributes parameter get attribute m binding context init data bindings void dirty listener impl void dirty listener new void dirty listener impl attribute dialog attribute dlg new attribute dialog platform ui get workbench get active workbench window get shell void dirty listener new table edit decorator attribute attributes section attribute table viewer attribute dlg attribute class void dirty listener
this is extra code that designer doesnt like so bad
public void add binding binding binding add validation status provider binding bindings add binding
adds the given binding to this data binding context
public object convert object element return converter null element converter convert element
when an element is added to the destination converts the element from the
public void dispose if context null context remove binding this context null if dispose listener null if target null target remove dispose listener dispose listener if model null model remove dispose listener dispose listener dispose listener null target null model null super dispose
disposes of this binding
public iobservable get target return target
returns the target observable
public iobservable get model return model
returns the model observable
public update set strategy set converter iconverter converter this converter converter return this
sets the converter to be invoked when converting added elements from the
protected istatus do add iobservable set observable set object element try observable set add element catch exception ex return validation status error binding messages get string value binding error while setting value non nls 1 ex return status ok status
adds the given element at the given index to the given observable list
protected istatus do remove iobservable set observable set object element try observable set remove element catch exception ex return validation status error binding messages get string value binding error while setting value non nls 1 ex return status ok status
removes the element at the given index from the given observable list