/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/function/round_up_function_token.vala

  • Committer: Gustav Hartvigsson
  • Date: 2021-09-09 12:57:20 UTC
  • Revision ID: gustav.hartvigsson@gmail.com-20210909125720-x6t14nri2anelxp6
Added Round Up and Round Down function classes.
Added ronud up and round down operations to FastNumbers to facitilate this.

TODO: Write tests.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
using VQDR.Expression;
 
2
 
 
3
public class VQDR.Expression.RoundUpFunctionToken : FunctionToken {
 
4
  public RoundUpFunctionToken () {  base ();  }
 
5
  construct {
 
6
    mandatory_num_child = 1;
 
7
  }
 
8
  
 
9
  public override void evaluate_self (Context instance) throws GLib.Error {
 
10
    Token param = get_child (1);
 
11
    
 
12
    param.evaluate_self (instance);
 
13
    
 
14
    result_value = param.result_value.round_up ();
 
15
    result_max_value = param.result_max_value.round_up ();
 
16
    result_min_value = param.result_min_value.round_up ();
 
17
    
 
18
    result_string = CH_RUP_OP + param.result_string + CH_RUP_CL;
 
19
  }
 
20
  
 
21
}