/*
 * Copyright (c) 1999 Johnny C. Lam.
 * All rights reserved.
 *
 * Permission to use, copy, modify, distribute and sell this software
 * and its documentation for any purpose is hereby granted without fee,
 * provided that the above copyright notice appear in all copies and
 * that both that copyright notice and this permission notice appear
 * in supporting documentation.  The author makes no representations
 * about the suitability of this software for any purpose.  It is
 * provided "as is" without express or implied warranty.
 */

#include <iostream>
#include <fstream>

#include "types.h"
#include "haplotype.h"
#include "path.h"

int
main(int argc, char* argv[])
{
    Haplotype array[5];
    std::ifstream istr(argv[1]);
    
    for (int i = 0; i < 5; ++i)
	array[i].ReadDelimited(istr, Haplotype::DISEASED);
    
    std::cout << "Haplotypes:" << endl;
    for (int i = 0; i < 5; ++i)
	std::cout << "\t" << array[i] << endl;
    std::cout << "End Haplotypes." << endl;
    
    Path path(array[0]);
    
    for (int i = 1; i < 5; ++i)
	path.Add(Path::Edge(array[i], 1.0 * i));
    
    std::cout << path << endl;
    
    std::cout << "Source: " << path.From() << endl;
    std::cout << "Target: " << path.To() << endl;
    std::cout << "Path weight: " << path.Weight() << endl;
    
    std::cout << "Iterator test:" << endl;
    Path::const_iterator i = path.begin();
    if (i != path.end()) {
	std::cout << i->haplotype << endl;
	++i;
	while (i != path.end()) {
	    std::cout << "\t"
		      << "---(" << i->weight << ")---> "
		      << i->haplotype << endl;
	    ++i;
	}
    }
    std::cout << "End Iterator test." << endl;
    
    return 0;
}
