input
stringlengths
10
828
output
stringlengths
5
107
public void ancestor added ancestor event event if get inference algorithm instanceof junction tree algorithm junction tree algorithm junction tree algorithm junction tree algorithm get inference algorithm try junction tree algorithm clear virtual nodes get mediator get screen change to pnedition pane catch exception t t print stack trace todo use resources try joption pane show message dialog junction tree option panel this could not clear virtual nodes t get message catch throwable t2 t2 print stack trace
this is called when the card layout sets the edit mode pane visible
public float get value int index return data pt data index
it returns the value of a cell identified by an index
public void set name string name node name changed event event new node name changed event this name name this name name this name changed event
set the nodes name
public void set mediator inetwork mediator mediator if this get mediator null this get clear virtual nodes ancestor listener null remove listener from old module this get mediator get screen get net window edition remove ancestor listener this get clear virtual nodes ancestor listener super set mediator mediator if this get mediator null this get clear virtual nodes ancestor listener null update listener and add listener to new module this get mediator get screen get net window edition add ancestor listener this get clear virtual nodes ancestor listener
besides changing the mediator it adds an ancestor listener so that
public ancestor listener get clear virtual nodes ancestor listener return clear virtual nodes ancestor listener
this ancestor listener is going to be added to
public float get value int coordinate return data pt data get linear coord coordinate
it returns a value in this table from a vector of coordinates
public void set clear virtual nodes ancestor listener ancestor listener clear virtual nodes ancestor listener this clear virtual nodes ancestor listener clear virtual nodes ancestor listener
this ancestor listener is going to be added to
public boolean is id for int i 0 i node list size i if node list get i get type node decision node type node list get i get type node utility node type return true return false
returns true if this network is a influence diagram
public void move variable without move data int initial position int destination position node node to move variable list remove initial position variable list add destination position node to move
move a variable of position
public void set children array list node children this children children
sets a new list of children
public void set parents array list node parents this parents parents
sets a new list of parents
public boolean is bn for int i 0 i node list size i if node list get i get type node probabilistic node type return false return true
returns true if this network has only discrete probabilistic nodes i
public ilikelihood extractor get likelihood evidence likelihood extractor return likelihood evidence likelihood extractor
this is the last likelihood extractor used by
public float operate float arg1 float arg2 return arg1 arg2 arg1 arg2
returns the value which is grater
public void set explanation description string text this explanation description text
modifies the description of the explanation of the node
public int get linear coord int multidimensional coord compute factors int coord linear 0 int size variaveis variable list size for int v 0 v size variaveis v coord linear multidimensional coord v factors pt v return coord linear
get the linear coordinate from the multidimensional one
protected void compute factors if modified return modified false int size variaveis variable list size if factors pt null factors pt length size variaveis factors pt new int size variaveis factors pt 0 1 node aux no for int i 1 i size variaveis i aux no variable list get i 1 factors pt i factors pt i 1 aux no get states size
calculate the factors necessary to transform the linear coordinate into a multidimensional
public string get explanation description return explanation description
obtains the description of the explanation of the node
public void atualizatamanhoinfoestados int i states size infoestados new int i nao precisa pois o array eh criado sempre com o valor 0 for int j 0 j i j infoestados j 0
used within dalgo2
public int get linear coord marginal int multidimensional coord compute factors marginal int coord linear 0 int size variaveis variable list size for int v 0 v size variaveis v coord linear multidimensional coord v factors pt v return coord linear
get the linear coordinate from the multidimensional one
public boolean has state string state for int i 0 i states size i if states get i equals state return true return false
verifies if the node has a given state
protected void compute factors marginal if modified return modified false int size variaveis variable list size if factors pt null factors pt length size variaveis factors pt new int size variaveis factors pt 0 1 node aux no for int i 1 i size variaveis i aux no variable list get i 1 factors pt i factors pt i 1 aux no get states size
calculate the factors necessary to transform the linear coordinate into a multidimensional
public void append state string state update tables states add state
inserts a state with the specified name at the end of the list
public void remove last state if states size 1 update tables states remove states size 1
deletes the nodes last inserted state i
protected void verify potential tables graph graph throws exception if graph instanceof probabilistic network probabilistic network net probabilistic network graph probabilistic table aux tab pot int c node aux no probabilistic node aux vp int size nos net get node count for c 0 c size nos c aux no net get nodes get c if aux no get type node probabilistic node type aux vp probabilistic node aux no aux tab pot probabilistic table aux vp get probability function aux tab pot verify consistency
this method is used in
public void remove state at int index states remove index this atualizatamanhoinfoestados
used within dalgo2
public void set state at string state int index states set index state
replaces a state at given position to the specified position
public int get states size return states size
it returns the nodes quantity of states
public jtable get table return pn edition pane get table
returns the cpt code jtable code
public string get state at int index return string states get index
returns the state of the position given by code index code
public jtext field get txt description if pn edition pane null return null return pn edition pane get txt description
returns the code jtext field code that has the nodes description
public void make adjacents adjacents add all parents adjacents add all children
builds the list of adjacent nodes
public jtext field get txt name if pn edition pane null return null return pn edition pane get txt name
returns the code jtext field code that has the nodes name
public void clear adjacents adjacents clear
clears the list of adjacent nodes
public void set sum operation isum operation sum operation this sum operation sum operation
this is the operation performed in
public void set adjacents array list node adjacents this adjacents new array list node adjacents
sets the adjacents
public isum operation get sum operation return sum operation
this is the operation performed in
protected void update recursive float marginal list int c int linear int index int state if c this variable list size this data pt data linear marginal list state return if index c for int i this variable list get c get states size 1 i 0 i update recursive marginal list c 1 linear i this factors pt c index i else for int i this variable list get c get states size 1 i 0 i update recursive marginal list c 1 linear i this factors pt c index state
recursively accesses the cells of the cpt and updates its values using
public void update evidences float marginal list int index this compute factors this update recursive marginal list 0 0 index 0
given a node identified by an index updates its values
public float normalize float n 0 float valor int size dados this table size for int c 0 c size dados c n this get value c if math abs n 1 0 0 001 for int c 0 c size dados c valor this get value c if n 0 0 throw new illegal state exception resource get string inconsistency underflow exception valor n this set value c valor return n
default implementation of normalization
private node weight list node nodes node v node aux node double p node no min null double pmin double max value for int i nodes size 1 i 0 i aux node nodes get i p math log aux node get states size for int j aux node get adjacents size 1 j 0 j v aux node get adjacents get j p math log v get states size if p pmin pmin p no min aux node assert no min null return no min
method used inside
protected boolean is needing more arc node node probabilistic network net if node get adjacents size 2 return false for int i node get adjacents size 1 i 0 i node aux no1 node get adjacents get i for int j i 1 j 0 j node aux no2 node get adjacents get j if aux no2 get adjacents contains aux no1 return true return false
this method is used inside
protected void verify potential tables throws exception probabilistic table aux tab pot int c node aux no probabilistic node aux vp int size nos node list size for c 0 c size nos c aux no node list get c if aux no get type node probabilistic node type aux vp probabilistic node aux no aux tab pot probabilistic table aux vp get probability function aux tab pot verify consistency
sub method of
protected void verify consistency graph net if this get verify consistency command list null for ijunction tree command command this get verify consistency command list command do action this net
checks the consistency of junction tree and network
protected void verify utility throws exception node aux int size nos node list size for int i 0 i size nos i aux node node list get i if aux get type node utility node type aux get children size 0 throw new exception resource get string variable name aux resource get string has child name
sub method of
protected void verify utility graph graph throws exception if graph instanceof probabilistic network probabilistic network net probabilistic network graph node aux int size nos net get node count for int i 0 i size nos i aux node net get nodes get i if aux get type node utility node type aux get children size 0 throw new exception resource get string variable name aux resource get string has child name
template method for
public void reset nodes copy copia nos array list node node list clone
reset the copy of the nodes
public boolean is create log return create log
gets the create log
public void set add node button jbutton add node button this add node button add node button
button to add condition in condicional soft evidence
public jbutton get add node button return add node button
button to add condition in condicional soft evidence
public void set remove node button jbutton remove node button this remove node button remove node button
button to remove condition in condicional soft evidence
public void update evidences throws exception int size nos this get nodes copy size for int c 0 c size nos c tree variable node tree variable copia nos get c node update evidences try junction tree consistency catch exception e try initialize catch exception e2 added this catch because if an exception is thrown at initialize the exception e will be lost e2 print stack trace throw e update marginais reset likelihoods
calls the junction tree method in order to update evidences
public jbutton get remove node button return remove node button
button to remove condition in condicional soft evidence
public void initialize throws exception reset evidences junction tree init beliefs if first initialization update marginais copy marginal first initialization false else restore marginais
initialize the believes of a junction tree
public void set first initialization boolean first initialization this first initialization first initialization
sets the first initialization
public void set last probabilistic table probabilistic table last probabilistic table this last probabilistic table last probabilistic table
this is the last dummy table created in
public probabilistic table get last probabilistic table return last probabilistic table
this is the last dummy table created in
public inference algorithm option panel get option panel return option panel
this is the option panel related to this algorithm
public void set option panel inference algorithm option panel option panel this option panel option panel
this is the option panel related to this algorithm
protected jpanel build main panel graph graph inode node to add likelihood jtable table jpanel panel new jpanel jlabel label new jlabel node to add likelihood to string panel add label panel add table jscroll pane jsp new jscroll pane table panel add jsp panel set maximum size new dimension 100 100 return panel
builds the center panel of the dialog in
protected jtable build main table graph graph inode node to add likelihood dummy table to display to user probabilistic table dummy table this build table for likelihood evidence input graph node to add likelihood return new guipotential table dummy table make table
generates the main jtable which will display the states and likelihoods and
protected probabilistic table build table for likelihood evidence input graph graph inode node to add likelihood probabilistic table ret new probabilistic table ret add variable node to add likelihood for int i 0 i ret table size i ret set value i 1 return ret
this method is used in
public void set number format number format nuber format this number format nuber format
format used by the input dialog created in
public ijunction tree get junction tree return get net get junction tree
extract the junction tree from network
protected boolean user says revert toolkit get default toolkit beep ftf select all object options edit revert int answer joption pane show option dialog swing utilities get window ancestor ftf the value must be a number n you can either continue editing or revert to the last valid value invalid text entered joption pane yes no option joption pane error message null options options 1 if answer 1 revert ftf set value ftf get value return true return false
lets the user know that the text they entered is bad
public void show table string title jdialog diag new jdialog diag get content pane add new jscroll pane make table diag set default close operation jdialog dispose on close diag set title title diag pack diag set visible true
show the potential table
public void set menu jpopup menu menu this drop down menu menu
sets the popup menu to show when the arrow is clicked
public abstract button get main button return main button
returns the main left hand side button
public jbutton get drop down button return drop down button
gets the drop down button with the arrow
public jpopup menu get menu return drop down menu
gets the drop down menu
public void action performed action event e if this drop down menu null return if drop down menu is visible point p this get location on screen drop down menu set location int p get x int p get y this get height drop down menu set visible true else drop down menu set visible false
action listener for the arrow button shows hides the popup menu
public void add action listener action listener al this main button add action listener al this add action listener al
adds a action listener to this button actually to the left hand side
public boolean accept file f we will always allow directories if f is directory return true check for valid extension string name f get name to lower case for int i extensions length 1 i 0 i if name ends with extensions i return true return false
verify if the file has one of the valid extensions
private jpanel get jcontent pane1 if painel principal null painel principal new jpanel painel principal set layout new border layout painel principal set border border factory create line border color black painel principal add get title pane border layout north painel principal add get picture panel border layout center painel principal add get loading pane border layout south return painel principal
this method initializes j content pane1
public void add abstract button main button this set main button main button this update ui
adds a button to this split button
public void add jmenu item menu item this get menu add menu item this update ui
adds a menu item to this split button
public void add abstract button main button jmenu item menu item this set main button main button this get menu add menu item this update ui
adds a button and a menu item to this split button
public void remove jmenu item menu item this get menu remove menu item super remove menu item
removes a menu item from split button
protected void preview print text final jtext area texto final jdialog dialog this set cursor new cursor cursor wait cursor thread t new thread new runnable public void run print text it new print text texto new page format print previewer pp new print previewer it 0 jdialog dlg new jdialog dialog resource get string preview log tool tip dlg get content pane add pp dlg set size 640 480 dlg set visible true t start this set cursor new cursor cursor default cursor
preview the log printing
public void set action graph action action inode class data transfer object dto this set node data transfer object dto this set action action
this is equivalent to
public void print text final jtext area text area thread t new thread new runnable public void run print text it new print text text area new page format print monitor pm new print monitor it try pm perform print true catch printer exception pe joption pane show message dialog text area dialog this get owner resource get string print exception pe get message t start
print the log contained in the given code jtext area code
public void set sorted decision nodes list inode ordered decision nodes this sorted decision nodes ordered decision nodes
this method is used in
public void expand tree for int i 0 i get row count i expand row i for int i 0 i expanded nodes length i expanded nodes i true
expand all nodes of the tree
public void reset tree expanded nodes null
reset the evidence tree to its default
public jtext area get text area if this text area null this text area new jtext area return this text area
this is the main text area
public string get text content return this get text area get text
this is equivalent to
public jinternal frame get selected window return desktop get selected frame
returns the selected window
public void set number format locale local nf number format get instance local
modify the numbers format
public void set text content string text content this get text area set text text content
this is equivalent to
public void set markov arc list edge markov arc this markov arc markov arc
this is the edges of a moralized bayesian network
public ilikelihood evidence dialog builder get likelihood evidence dialog builder return likelihood evidence dialog builder
this object is used by
public boolean evaluate if this is known value return false if entities have the same name they are equals if this get current evaluation get name equals ignore case this get value get name return true return false
evaluates this leaf boolean value and returns it
public void drag gesture recognized drag gesture event event default mutable tree node selected node default mutable tree node get last selected path component if selected node null node node get node information selected node if node null string selection text new string selection node get name as the name suggests starts the dragging drag source start drag event drag source default move drop text this
a drag gesture has been initiated
public string get virtual node prefix return virtual node prefix
this is going to be a prefix for names of virtual nodes
public void drag drop end drag source drop event event if event get drop success default tree model get model remove node from parent default mutable tree node get last selected path component
this message goes to drag source listener informing it that the dragging
public void set virtual node prefix string virtual node prefix this virtual node prefix virtual node prefix
this is going to be a prefix for names of virtual nodes
public inode class data transfer object get node data transfer object return node class data transfer object
this object is used by graph pane in order to temporally store all
private boolean is already loaded inference algorithm option panel option panel if this get algorithm to option map contains value option panel if the panel instance itself was loaded return true return true perform class equivalency to determine if an algorithm with same class was already loaded for inference algorithm option panel loaded panels this get algorithm to option map values if loaded panels get class equals option panel get class a panel using same class was loaded return true this panel was never loaded return false
tells us if the option panel is already loaded as plugin
protected core plugin node manager get plugin node manager return plugin node manager
this object manages plugin loaded nodes
private inference algorithm option panel get selected algorithm option panel if this get algorithm to option map null return null for jradio button menu item option this get algorithm to option map key set if option is selected return this get algorithm to option map get option return null
obtains the currently selected by j option radio button panel for algorithm options