00001 /* 00002 Modular Psi - A graph tracker of the Parapsychologcal scientific development 00003 Copyright (C) 2005 Leonardo Stern 00004 00005 This program is free software; you can redistribute it and/or modify it under 00006 the terms of the Common Public License Version 1.0 or (at your option) any later version. 00007 00008 This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; 00009 without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 00010 See the Common Public License for more details. 00011 00012 You should have received a copy of the Common Public License along with this program; 00013 */ 00014 00015 00016 #include "node.hpp" 00017 #include "edge.hpp" 00018 #include "edgelist.hpp" 00019 00020 00021 00022 Node::Node ( QWidget *parent, const char* name, WFlags f ) 00023 : QWidget ( parent, name, f ) 00024 { 00025 init(); 00026 } 00027 00028 Node::~Node() 00029 { 00030 //NooP 00031 } 00032 00033 void Node::setPublicName(QString nome) 00034 { 00035 p_name = nome; 00036 setChanged(true); 00037 } 00038 00039 void Node::setDescription(QString descricao) 00040 { 00041 p_description = descricao; 00042 setChanged(true); 00043 } 00044 00045 void Node::setTrust(float confianca) 00046 { 00047 p_trust = confianca; 00048 setChanged(true); 00049 } 00050 00051 void Node::setChanged(bool alterado) 00052 { 00053 p_changed = alterado; 00054 } 00055 00056 void Node::init() 00057 { 00058 incoming = new EdgeList(); 00059 outgoing = new EdgeList(); 00060 } 00061 00062 Edge * Node::getNode(QString dest) 00063 { 00064 EdgeList::iterator it = outgoing->begin(); 00065 while ( (*it)->target()->name() != dest ) 00066 { 00067 it++; 00068 } 00069 return (*it); 00070 }