/vqdr/trunk

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/vqdr/trunk

« back to all changes in this revision

Viewing changes to src/libvqdr/context.vala

  • Committer: Gustav Hartvigsson
  • Date: 2022-05-30 18:46:35 UTC
  • Revision ID: gustav.hartvigsson@gmail.com-20220530184635-d8k8pofyyifu017d
Woops.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
using Gee;
2
 
using Vee;
 
2
using Utils;
3
3
 
4
4
namespace VQDR.Expression {
5
 
  /**
6
 
   * This is just a glorified key-value store. It is only used to provide
7
 
   * a mapping between variable-names and a Variable instance.
8
 
   */
 
5
  
9
6
  public class Context : GLib.Object{
10
7
    private bool changed;
11
8
    private Gee.TreeMap<string, Variable?> values;
14
11
    construct {
15
12
      changed = false;
16
13
      values = new Gee.TreeMap<string, Variable?>
17
 
                              (Vee.str_cmp, null);
 
14
                              (Utils.str_cmp, null);
18
15
    }
19
16
    
20
17
    public Context () {
21
18
    }
22
19
    
23
20
    public void set_value (string name, 
24
 
                           int32 min_val,
25
 
                           int32 max_val,
26
 
                           int32 current_val) {
 
21
                           int min_val,
 
22
                           int max_val,
 
23
                           int current_val) {
27
24
      set_variable (name, Variable (min_val, max_val, current_val));
28
25
    }
29
26
    
30
27
    public Variable get_variable (string name) throws ArgError {
31
 
      throw_name (name);
32
 
      return values.@get (name.down ());
 
28
    throw_name (name);
 
29
    return values.@get (name.down ());
33
30
    }
34
 
 
 
31
    
35
32
    public void set_variable (string name, Variable? variable) {
36
33
      string new_name = name.down ();
37
34