~ubuntu-branches/ubuntu/lucid/structure-synth/lucid

« back to all changes in this revision

Viewing changes to StructureSynth/Model/CustomRule.h

  • Committer: Bazaar Package Importer
  • Author(s): Miriam Ruiz
  • Date: 2009-04-13 13:28:45 UTC
  • Revision ID: james.westby@ubuntu.com-20090413132845-d7d42t4llxjxq0ez
Tags: upstream-0.9
ImportĀ upstreamĀ versionĀ 0.9

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#pragma once
 
2
 
 
3
#include "Rule.h"
 
4
#include "Action.h"
 
5
 
 
6
namespace StructureSynth {
 
7
        namespace Model {       
 
8
 
 
9
                /// A custom rule is a user defined rule.
 
10
                /// It consist of a number of actions, 
 
11
                /// and a weight that is used if the rule definition is ambiguous (see 'AmbiguousRule').
 
12
                class CustomRule : public Rule {
 
13
                public:
 
14
                        CustomRule(QString name);
 
15
                        virtual ~CustomRule();
 
16
 
 
17
                        virtual void apply(Builder* builder) const;
 
18
 
 
19
                        /// Returns a list over rules that this rule references.
 
20
                        virtual QList<RuleRef*> getRuleRefs() const;
 
21
 
 
22
                        void appendAction(Action a) { actions.append(a); }
 
23
 
 
24
                        double getWeight() const { return weight; }
 
25
                        void setWeight(double w) { weight = w; }
 
26
 
 
27
                        void setRetirementRule(QString ruleName) { retirementRule = new RuleRef(ruleName); };
 
28
 
 
29
                private:
 
30
                        QList<Action> actions;
 
31
                        double weight;
 
32
                        RuleRef* retirementRule;
 
33
                };
 
34
 
 
35
        }
 
36
}
 
37