Beispiel #1
0
        //public IScop Get (string eher)
        //{
        //    var hers = new[] {eher};
        //    var c =(IScop) GetVariable(hers);
        //    if ( c != null ) return c;
        //}
        public Heritachy <Var> GetVariable(IList <string> hers)
        {
            HeritachyType vh;

            if (hers == null || hers.Count == 0)
            {
                return(null);
            }
            var var = GetVariable(hers[0]);

            if (var == null)
            {
                return(null);
            }
            var tmp  = vh = new HeritachyType(null, hers[0], var);
            var h    = new Heritachy <Var>(vh, null);
            var scop = var.Return;

            for (var i = 1; i < hers.Count; i++)
            {
                var t = scop.GetField(hers[i], SearcheMode.Flaten);
                if (t == null)
                {
                    return(null);
                }
                var.Push(t);
                scop = t.Return;
                tmp  = new HeritachyType(tmp, hers[i], new Var(t));
            }
            h.main = var;
            return(h);
        }
Beispiel #2
0
        public Heritachy <Class> GetClass(IList <string> hers)
        {
            HeritachyType tmp;

            if (hers == null || hers.Count == 0)
            {
                return(null);
            }
            if (hers.Count == 1)
            {
                return(new Heritachy <Class>(tmp = new HeritachyType(hers[0], GetClass(hers[0])), (Class)tmp.Scop));
            }
            var space = GetSpace(hers[0]);

            if (space == null)
            {
                return(null);
            }
            var h = new Heritachy <Class>(tmp = new HeritachyType(null, hers[0], space), null);

            for (var i = 1; i < hers.Count - 1; i++)
            {
                space = space.GetSpace(hers[i], SearcheMode.Flaten);
                if (space == null)
                {
                    return(null);
                }
                tmp = tmp.Add(hers[i], space);
            }
            var @class = space.GetClass(hers[hers.Count - 1], SearcheMode.Flaten);

            if (@class != null)
            {
                tmp.Add(hers[hers.Count - 1], @class);
            }
            else
            {
                return(null);
            }
            h.main = @class;
            return(h);
        }