diff options
Diffstat (limited to 'src/UInt.vala')
-rw-r--r-- | src/UInt.vala | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/src/UInt.vala b/src/UInt.vala new file mode 100644 index 0000000..a7ea4f8 --- /dev/null +++ b/src/UInt.vala @@ -0,0 +1,34 @@ +namespace Eva { + public class UInt : Object, Term { + public ulong value {get; construct;} + + public UInt(ulong v) { + Object(value: v); + } + + public string to_string() { + return value.to_string(); + } + + protected bool do_match(Term o, Gee.Map<string, Term> vars, Gee.Map<string, string> aliases) { + if(o is Var) { + return o.do_match(this, vars, aliases); + } + + if(o is Int) { + return value == (o as Int).value; + } + else if(o is UInt) { + return value == (o as UInt).value; + } + else { + return false; + } + } + + + public void encode(Erl.Buffer buffer) { + buffer.encode_ulong(value); + } + } +} |