summaryrefslogtreecommitdiffstats
path: root/src/Int.vala
diff options
context:
space:
mode:
Diffstat (limited to 'src/Int.vala')
-rw-r--r--src/Int.vala33
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);
+ }
+ }
+}