summaryrefslogtreecommitdiffstats
path: root/src/Ref.vala
diff options
context:
space:
mode:
Diffstat (limited to 'src/Ref.vala')
-rw-r--r--src/Ref.vala13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/Ref.vala b/src/Ref.vala
index b1fd4e9..17ae2cf 100644
--- a/src/Ref.vala
+++ b/src/Ref.vala
@@ -1,5 +1,5 @@
namespace Eva {
- public class Ref : Object, Term {
+ public class Ref : Object, Term, Gee.Comparable<Ref> {
public string node {get; construct;}
public int len {get; construct;}
public uint[] n {get; private set;}
@@ -22,6 +22,17 @@ namespace Eva {
return "#Ref";
}
+ public int compare_to(Ref o) {
+ for(int i = 0; i < len; ++i) {
+ if(n[i] < o.n[i])
+ return -1;
+ if(n[i] > o.n[i])
+ return 1;
+ }
+
+ return 0;
+ }
+
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);