From f87943409c8ae2e9f6ed81e7a1cfc5109c16f31a Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Sat, 10 Jul 2010 01:23:07 +0200 Subject: Split Term code to individual class sources --- src/Int.vala | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 src/Int.vala (limited to 'src/Int.vala') diff --git a/src/Int.vala b/src/Int.vala new file mode 100644 index 0000000..5df3857 --- /dev/null +++ b/src/Int.vala @@ -0,0 +1,33 @@ +namespace Eva { + public class Int : Object, Term { + public long value {get; construct;} + + public Int(long v) { + Object(value: v); + } + + public string to_string() { + return value.to_string(); + } + + protected bool do_match(Term o, Gee.Map vars, Gee.Map 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_long(value); + } + } +} -- cgit v1.2.3