/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/variable.vala

  • Committer: Gustav Hartvigsson
  • Date: 2021-11-16 12:44:52 UTC
  • Revision ID: gustav.hartvigsson@gmail.com-20211116124452-g9245bvzwcyy9wk9
Added licencing information.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
using Vee;
 
1
using Utils;
2
2
namespace VQDR.Expression {
3
3
  /**
4
4
   * Represents a variable.
8
8
    public FastNumber max_val;
9
9
    public FastNumber current_val;
10
10
    
11
 
    public Variable (int32 min = 0, int32 max = 0, uint32 current = 0) {
 
11
    public Variable (int min = 0, int max = 0, int current = 0) {
12
12
      this.max_val.number = max;
13
13
      this.min_val.number = min;
14
14
      this.current_val.number = current;
21
21
      this.current_val.copy (other.current_val);
22
22
    }
23
23
    
24
 
    public int64 compare (Variable other) {
 
24
    public long compare (Variable other) {
25
25
      if (! this.current_val.equals (other.current_val)) {
26
26
        return this.current_val.compare (other.current_val);
27
27
      } else if (! this.max_val.equals (other.max_val)) {
30
30
        return this.min_val.compare (other.min_val);
31
31
      }
32
32
      return 0;
 
33
      
33
34
    }
34
35
    
35
36
    /**
38
39
     * This is the same as @c compare. It is an alias to the same C function.
39
40
     */
40
41
    [CCode (cname = "vqdr_expression_variable_equals")]
41
 
    public static extern int32 static_compare (Variable a, Variable b);
 
42
    public static extern int static_compare (Variable a, Variable b);
42
43
    
43
44
    /**
44
45
     * Is this instance equal to the other?
47
48
      return !(bool) this.compare (other);
48
49
    }
49
50
    
50
 
    public bool equals_values (int32 min, int32 max, int32 current) {
 
51
    public bool equals_values (int min, int max, int current) {
51
52
      return (this.current_val.number == current) &&
52
53
             (this.max_val.number == max) &&
53
54
             (this.min_val.number == min);