示例#1
0
文件: Hash.cs 项目: retahc/old-code
        public override bool Equals(object o)
        {
            if (this == o)
            {
                return(true);
            }
            if (o is RHash == false)
            {
                return(false);
            }
            RHash     ot = (RHash)o;
            Hashtable oh = ot.hash;

            if (hash.Count != oh.Count)
            {
                return(false);
            }
            lock (hash.SyncRoot)
            {
                foreach (DictionaryEntry ent in hash)
                {
                    if (oh.ContainsKey(ent.Key) == false)
                    {
                        return(false);
                    }
                    if (oh[ent.Key].Equals(ent.Value) == false)
                    {
                        return(false);
                    }
                }
            }
            return(true);
        }
示例#2
0
文件: Hash.cs 项目: retahc/old-code
        static internal object s_create(RBasic r, params object[] args)
        {
            RHash hash;

            if (args.Length == 1 && args[0] is RHash)
            {
                hash = new RHash(r.ruby, ((RHash)args[0]), (RMetaObject)r);
                return(hash);
            }
            if (args.Length % 2 != 0)
            {
                throw new eArgError("odd number args for Hash");
            }
            hash = new RHash(r.ruby, (RMetaObject)r);
            for (int i = 0; i < args.Length; i += 2)
            {
                hash[args[i]] = args[i + 1];
            }
            return(hash);
        }
示例#3
0
文件: Hash.cs 项目: emtees/old-code
 public RHash(NetRuby rb, RHash org, RMetaObject meta) :
     base(rb, meta)
 {
     hash = (Hashtable)org.hash.Clone();
     ifnone = null;
 }
示例#4
0
文件: Hash.cs 项目: emtees/old-code
 static internal object s_create(RBasic r, params object[] args)
 {
     RHash hash;
     if (args.Length == 1 && args[0] is RHash)
     {
         hash = new RHash(r.ruby, ((RHash)args[0]), (RMetaObject)r);
         return hash;
     }
     if (args.Length % 2 != 0)
     {
         throw new eArgError("odd number args for Hash");
     }
     hash = new RHash(r.ruby, (RMetaObject)r);
     for (int i = 0; i < args.Length; i += 2)
     {
         hash[args[i]] = args[i + 1];
     }
     return hash;
 }
示例#5
0
文件: Hash.cs 项目: emtees/old-code
 static internal object s_new(RBasic r, params object[] args)
 {
     RHash hash = new RHash(r.ruby, (RMetaObject)r);
     r.ruby.CallInit(hash, args);
     return hash;
 }
示例#6
0
文件: Hash.cs 项目: retahc/old-code
        static internal object aref(RBasic r, params object[] args)
        {
            RHash h = (RHash)r;

            return(h[args[0]]);
        }
示例#7
0
文件: Hash.cs 项目: retahc/old-code
 public RHash(NetRuby rb, RHash org, RMetaObject meta) :
     base(rb, meta)
 {
     hash   = (Hashtable)org.hash.Clone();
     ifnone = null;
 }