2 * Allocation.cpp - TaskJuggler
4 * Copyright (c) 2001, 2002 by Chris Schlaeger <cs@suse.de>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of version 2 of the GNU General Public License as
8 * published by the Free Software Foundation.
13 #include "ResourceList.h"
14 #include "Allocation.h"
15 #include "ReportXML.h"
20 <!ELEMENT Allocation (Load, Persistent)>
21 <!ELEMENT Load (#PCDATA)>
22 <!ELEMENT Persistent (#PCDATA)>
23 <!ATTLIST Allocation ResourceID CDATA #REQUIRED>
28 Allocation::Allocation( Resource *r) :
29 load(100), persistent(FALSE), lockedResource(0)
32 selectionMode = order;
35 /* Creation of the XML Reprsentation of the Allocation */
36 QDomElement Allocation::xmlElement( QDomDocument& doc )
38 QDomElement elem = doc.createElement( "Allocation" );
39 elem.appendChild(ReportXML::createXMLElem( doc, "Load", QString::number(getLoad()) ));
40 elem.appendChild(ReportXML::createXMLElem( doc, "Persistent", isPersistent() ? "Yes":"No" ));
41 elem.setAttribute( "ResourceID", candidates.first()->getId());
43 /* candidates are missing TODO */
49 Allocation::setSelectionMode(const QString& smt)
51 if (smt == KW("order"))
52 selectionMode = order;
53 else if (smt == KW("minloaded"))
54 selectionMode = minLoaded;
55 else if (smt == KW("maxloaded"))
56 selectionMode = maxLoaded;
57 else if (smt == KW("random"))
58 selectionMode = random;