diff options
author | Matthias Schiffer <mschiffer@universe-factory.net> | 2010-07-10 01:23:07 +0200 |
---|---|---|
committer | Matthias Schiffer <mschiffer@universe-factory.net> | 2010-07-10 01:23:07 +0200 |
commit | f87943409c8ae2e9f6ed81e7a1cfc5109c16f31a (patch) | |
tree | ded56a166ef4648061379bab6c65bc40e5d01f8d /src/Int.vala | |
parent | 2fc49125e73554d68b4ee8874b9f84725b6f2157 (diff) | |
download | eva-f87943409c8ae2e9f6ed81e7a1cfc5109c16f31a.tar eva-f87943409c8ae2e9f6ed81e7a1cfc5109c16f31a.zip |
Split Term code to individual class sources
Diffstat (limited to 'src/Int.vala')
-rw-r--r-- | src/Int.vala | 33 |
1 files changed, 33 insertions, 0 deletions
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<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_long(value); + } + } +} |