Różnice

Różnice między wybraną wersją a wersją aktualną.

Odnośnik do tego porównania

pl:miw:miw08_rbs_ml:showednode [2017/07/17 10:08]
pl:miw:miw08_rbs_ml:showednode [2019/06/27 15:50] (aktualna)
Linia 1: Linia 1:
 +<​code=java>​
 +package MachineLearning;​
  
 +
 +import java.util.*;​
 +
 + /**
 + * Klasa służy do pokazania sobie jak jest drzewo zbudowane
 + * @author Angello
 + *
 + */
 + public class ShowedNode
 + {
 + public String TestName;
 + public Integer[] P;
 + HashMap<​Integer,​ ShowedNode>​ m_nodes = new HashMap<​Integer,​ ShowedNode>​();​
 + public Integer Category;
 + private static Integer counter = 0;
 +
 + /**
 + * Dodaje kolejny węzeł lub liść poniżej aktualnego węzła
 + * @param key
 + * @param node
 + */
 + public void addNode(Integer key, ShowedNode node)
 + {
 + m_nodes.put(key,​ node);
 + }
 +
 + /**
 + * Zapisuje do pliku jak zbudować drzewo w programie graphviz
 + * @param sw
 + * @return
 + */
 + public String getGraphvizName(WriteFile sw)
 + {
 + String nodeName;
 + String tempChildName;​
 +
 + if (m_nodes.size() == 0) // Tylko liść
 + {
 + nodeName = (++counter).toString();​
 + sw.writeLine( nodeName + " [label=\""​ + Thermostat.values()[(this.Category)].toString() + "​\",​ shape = record];"​); ​
 + }
 + else
 + {
 + nodeName = (++counter).toString();​
 + sw.writeLine( nodeName + " [label=\""​ + this.TestName + "​\",​ shape = ellipse];"​); ​
 + for (Integer key : m_nodes.keySet()) //​ Dla wszystkich wyników testu
 + {
 + tempChildName = m_nodes.get(key).getGraphvizName(sw);​ //​ Wywołanie dla potomnych
 + tempChildName = tempChildName + "";​
 + sw.writeLine(nodeName + " -> " + tempChildName + "[ label = " + key + " ];"​);​ //​ bieżący node -> nazwa którą dostałem
 + }
 + }
 +
 + return nodeName;
 + }
 + }
 +
 +
 +</​code>​
pl/miw/miw08_rbs_ml/showednode.txt · ostatnio zmienione: 2019/06/27 15:50 (edycja zewnętrzna)
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0