From: maroni Date: Mon, 2 Apr 2012 18:01:24 +0000 (-0300) Subject: Implementação dos registros de Log de eventos! X-Git-Url: http://200.18.67.61/gitweb/?a=commitdiff_plain;h=a67d61f518f8411372903d8ffe2e23a08800d792;p=simdecs2.git Implementação dos registros de Log de eventos! --- diff --git a/src/java/org/ufcspa/simdecs/test/Teste.java b/src/java/org/ufcspa/simdecs/test/Teste.java index 06428db..e454cc4 100644 --- a/src/java/org/ufcspa/simdecs/test/Teste.java +++ b/src/java/org/ufcspa/simdecs/test/Teste.java @@ -4,24 +4,53 @@ */ package org.ufcspa.simdecs.test; +import java.io.File; +import unbbayes.io.xmlbif.version6.XMLBIFIO; +import unbbayes.prs.bn.JunctionTreeAlgorithm; +import unbbayes.prs.bn.ProbabilisticNetwork; +import unbbayes.prs.bn.ProbabilisticNode; + /** * * @author maroni */ public class Teste { - private static long getIdFromUID(String pUID, String prefixo) { - String id = pUID.replaceAll(prefixo, ""); - id = id.substring(0, id.indexOf(":")); - return Long.parseLong(id); - } + public static void main(String[] args) { + final String caminhoRede = "/Users/maroni/NetBeansProjects/SimDeCS/web/redes/influencia.xml"; + ProbabilisticNetwork rede; - private static long getIdPacienteFromUID(String pUID) { - String id = pUID.substring(pUID.indexOf(":paciente-") + ":paciente-".length()); - return Long.parseLong(id); - } + try { + // required to run unbbayes gui classes on server + System.setProperty("java.awt.headless", "false"); + rede = new ProbabilisticNetwork(null); + XMLBIFIO.loadXML(new File(caminhoRede), rede); + JunctionTreeAlgorithm jt = new JunctionTreeAlgorithm(); + jt.setNet(rede); + jt.run(); - public static void main(String[] args) { - System.out.println(getIdFromUID("sintoma-np-12:paciente-1", "sintoma-np-")); - System.out.println(getIdPacienteFromUID("sintoma-np-12:paciente-15")); + + for (int j = 0; j < rede.getNodeCount(); j++) { + if (!(rede.getNodeAt(j) instanceof ProbabilisticNode)) { + System.out.println(rede.getNodeAt(j).getClass()); + continue; + } + + ProbabilisticNode nodoAtual = (ProbabilisticNode) rede.getNodeAt(j); + System.out.println(nodoAtual.getName()); + + // Verificando a tabela de probabilidades do nodo + for (int pb = 0; pb < nodoAtual.getStatesSize(); pb++) { + System.out.println(nodoAtual.getStateAt(pb)+":"+nodoAtual.getMarginalAt(pb)); + } + System.out.println(""); + } + + + } catch (Exception e) { + e.printStackTrace(); + System.exit(1); + } + + } } diff --git a/web/login.xhtml b/web/login.xhtml index 9f31a9e..8a34894 100644 --- a/web/login.xhtml +++ b/web/login.xhtml @@ -35,7 +35,7 @@ Acesso ao Simulador

- + diff --git a/web/redes/influencia.xml b/web/redes/influencia.xml new file mode 100644 index 0000000..31017ce --- /dev/null +++ b/web/redes/influencia.xml @@ -0,0 +1,89 @@ + + + + 1.0 + influencia + UnBBayes + + + 40 + 0 + 0 + 0 + 0 + 0 + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1.0 + 0.0 + 0.0 + 0.0 + 0.0 + 0.0 + 0.0 + 1.0 + 0.0 + 1.0 + 1.0 + 0.0 + + + + + + 0.5 + 0.5 + + + + + + 0.5 + 0.5 + + + + + \ No newline at end of file diff --git a/web/simulador/endereco.txt b/web/simulador/endereco.txt index 831425f..fbeea0d 100755 --- a/web/simulador/endereco.txt +++ b/web/simulador/endereco.txt @@ -1 +1 @@ -http://200.18.67.61/simdecs2/ +http://localhost:8080/SimDeCS/ \ No newline at end of file