Ejemplo n.º 1
0
void printHeader(const Alphabet& alphabet, const Weights& weights, Options::Mode mode) {
	cout <<
		"# " PROGRAM_NAME " " PROGRAM_VERSION "\n"
		"# Copyright 2006 Informatics for Mass Spectrometry group\n"
		"#                at Bielefeld University\n"
		"#\n"
		"# http://BiBiServ.TechFak.Uni-Bielefeld.DE/decomp/\n"
		"#\n"
		"# alphabet (character, weight):\n";
	for (Weights::size_type i = 0; i < weights.size(); ++i) {
		cout
			<< "#\t" << alphabet.getName(i) << "\t"
			<< weights[i] << '\n';
	}
	cout << "#\n# Problem to solve: ";
	switch (mode) {
		case Options::GETNUMBER:
			cout << "Get number of decompositions";
			break;
		case Options::FINDALL:
			cout << "Find all decompositions";
			break;
		case Options::FINDONE:
			cout << "Find one decomposition";
			break;
		case Options::ISDECOMPOSABLE:
			cout << "Is decomposable";
			break;
	}
	cout << "\n#\n";
}
Ejemplo n.º 2
0
/** Prints one decomposition to stdout */
void printDecomposition(const Alphabet& alphabet, const decomposition_t& decomposition)
{
	assert(alphabet.size() == decomposition.size());
	bool first = true;
	for (Alphabet::size_type i = 0; i < alphabet.size(); ++i) {
		if (decomposition[i] > 0) {
			if (!first) {
				cout << " ";
			} else {
				first = false;
			}
			cout << alphabet.getName(i) << decomposition[i];
		}
	}
}