Main Page | Namespace List | Class Hierarchy | Class List | Directories | File List | Class Members | File Members

DescentTree.h

Go to the documentation of this file.
00001 
00002 //
00003 // This file is part of the MADELINE 2 program 
00004 // written by Edward H. Trager, Ritu Khanna and Adrian Marrs
00005 // Copyright (c) 2005 by the
00006 // Regents of the University of Michigan.
00007 // All Rights Reserved.
00008 // 
00009 // The latest version of this program is available from:
00010 // 
00011 //   http://eyegene.ophthy.med.umich.edu/madeline/
00012 //   
00013 // Released under the GNU General Public License.
00014 // A copy of the GPL is included in the distribution
00015 // package of this software, or see:
00016 // 
00017 //   http://www.gnu.org/copyleft/
00018 //   
00019 // ... for licensing details.
00020 // 
00022 //
00023 // 2005.11.29.RK
00024 //
00025 
00026 //
00027 // DescentTree.h
00028 //
00029 #ifndef DescentTree_INCLUDED
00030 #define DescentTree_INCLUDED
00031 
00032 #include "Individual.h"
00033 #include "Width.h"
00034 #include <vector>
00035 #include <map>
00036 #include <iostream>
00037 
00039 
00041 class DescentTree
00042 {
00043 private:
00044         unsigned _order;
00045         unsigned _id;
00046         unsigned _externalConnections;
00047         bool _hasConsanguinity;
00048         Individual* _startIndividual;
00049         std::vector<Individual*> _foundingGroup;
00050         std::map<unsigned,unsigned> _connectionsWithDT;
00051         std::vector<Individual*> _externalConnectorPair; // list of individuals (and their spouses) who make external connections with other DTs. 
00052         Width _width;
00053         
00054 public:
00055         
00056         //
00057         // Constructors/Destructor:
00058         // 
00059         DescentTree(unsigned id){
00060                 _id = id;
00061                 _startIndividual = NULL;
00062                 _hasConsanguinity = false;
00063                 _externalConnections = 0;
00064         }
00065         DescentTree(unsigned id,std::vector<Individual*> foundingGroup) : _id(id),_startIndividual(NULL) { _foundingGroup = foundingGroup; _hasConsanguinity = false; }
00066         ~DescentTree();
00067         
00068         //
00069         // Setters:
00070         //
00071         void setConsanguinity() { _hasConsanguinity = true; }
00072         void setOrder(unsigned order) { _order = order; }
00073         void setStartIndividual(Individual* startIndividual){ _startIndividual = startIndividual; }
00074         void setLeftWidth(unsigned left) { _width.setLeft(left); }
00075         void setRightWidth(unsigned right) { _width.setRight(right);  }
00076         void setTotalWidth(unsigned total) { _width.setTotal(total); }
00077         void addIndividualToFoundingGroup(Individual* individual){ _foundingGroup.push_back(individual); }
00078         void setNumberOfExternalConnections(unsigned count) { _externalConnections = count; }
00079         
00080         //
00081         // Getters:
00082         //
00083         unsigned getNumberOfFoundingGroupIndividuals() const { return _foundingGroup.size(); }
00084         unsigned getId( void ){ return _id; }
00085         Individual* getStartIndividual(void);
00086         Individual* getFoundingGroupIndividual(unsigned i){ return _foundingGroup[i]; }
00087         unsigned getTotalWidth() { return _width.getTotal(); }
00088         unsigned getLeftWidth()  { return _width.getLeft(); }
00089         unsigned getRightWidth() { return _width.getRight(); }
00090         unsigned getNumberOfExternalConnections() { return _externalConnections; }
00091         Individual* getExternalConnector(unsigned index){ return _externalConnectorPair[index]; }
00092         unsigned getNumberOfConnectionsWithDT(unsigned dtId);
00093         bool hasConsanguinity(void) const { return _hasConsanguinity; }
00094         
00095         void addExternalConnectorPair(Individual* individual,Individual* spouse);
00096         void incrementConnectionsWithDT(unsigned dtId);
00097         void incrementNumberOfExternalConnections(){ _externalConnections++; }
00098         
00099         //
00100         // DEBUG:
00101         //
00102         void displayFoundingGroup(){
00103                 for(unsigned i=0;i<_foundingGroup.size();i++)
00104                         std::cout << "FG " << _foundingGroup[i]->getId() << std::endl;
00105         }
00106         
00107 };
00108 
00109 #endif

Generated on Fri Nov 18 16:24:39 2011 for MADELINE by  doxygen 1.4.4