示例#1
0
            public override AbstractFieldDeclaration addField <R> ([email protected] type, string name)
            {
                switch (name)
                {
                case "arr":
                    return(new f0(([email protected])type, this));

                case "f":
                    return(new f1(([email protected])type, this));

                case "l":
                    return(new f2(([email protected])type, this));

                case "s":
                    return(new f3(([email protected])type, this));

                case "someset":
                    return(new f4(([email protected])type, this));

                case "varr":
                    return(new f5(([email protected])type, this));

                default:
                    return(base.addField <R>(type, name));
                }
            }
示例#2
0
            public f1([email protected] type, P1 owner) : base(type, "f", owner)
            {
                if (type.TypeID != 5)
                {
                    throw new SkillException("Expected field type annotation in Test.f but found " + type);
                }

                // TODO insert known restrictions?
            }
示例#3
0
            public f1([email protected] type, P0 owner) : base(type, "boolean", owner)
            {
                if (type.TypeID != 6)
                {
                    throw new SkillException("Expected field type bool in Boolean.boolean but found " + type);
                }

                // TODO insert known restrictions?
            }
示例#4
0
            public f5([email protected] type, P0 owner) : base(type, "varr", owner)
            {
                if (false)//TODO type check!)
                {
                    throw new SkillException("Expected field type v64[] in Container.varr but found " + type);
                }

                // TODO insert known restrictions?
            }
示例#5
0
            public f4([email protected] type, P0 owner) : base(type, "someset", owner)
            {
                if (false)//TODO type check!)
                {
                    throw new SkillException("Expected field type set<somethingelse> in Container.someSet but found " + type);
                }

                // TODO insert known restrictions?
            }
示例#6
0
            public f1([email protected] type, P0 owner) : base(type, "edges", owner)
            {
                if (false)//TODO type check!)
                {
                    throw new SkillException("Expected field type set<node> in Node.edges but found " + type);
                }

                // TODO insert known restrictions?
            }
示例#7
0
            public f3([email protected] type, P3 owner) : base(type, "c", owner)
            {
                if (!((AbstractStoragePool)(de.ust.skill.common.csharp.api.FieldType)type).Name.Equals("c"))
                {
                    throw new SkillException("Expected field type c in C.c but found " + type);
                }

                // TODO insert known restrictions?
            }
示例#8
0
            public f1([email protected] type, P0 owner) : base(type, "next", owner)
            {
                if (!((AbstractStoragePool)(de.ust.skill.common.csharp.api.FieldType)type).Name.Equals("testenum"))
                {
                    throw new SkillException("Expected field type testenum in TestEnum.next but found " + type);
                }

                // TODO insert known restrictions?
            }
示例#9
0
            public f0([email protected] type, P1 owner) : base(type, "ref", owner)
            {
                if (false)//TODO type check!)
                {
                    throw new SkillException("Expected field type map<string,l,string> in T.ref but found " + type);
                }

                // TODO insert known restrictions?
            }
示例#10
0
            public f0([email protected] type, P1 owner) : base(type, "name", owner)
            {
                if (type.TypeID != 14)
                {
                    throw new SkillException("Expected field type string in System.name but found " + type);
                }

                // TODO insert known restrictions?
            }
示例#11
0
            public f1([email protected] type, P1 owner) : base(type, "version", owner)
            {
                if (type.TypeID != 12)
                {
                    throw new SkillException("Expected field type f32 in System.version but found " + type);
                }

                // TODO insert known restrictions?
            }
示例#12
0
            public f3([email protected] type, P0 owner) : base(type, "two", owner)
            {
                if (type.TypeID != 13)
                {
                    throw new SkillException("Expected field type f64 in DoubleTest.two but found " + type);
                }

                // TODO insert known restrictions?
            }
示例#13
0
            public f0([email protected] type, P0 owner) : base(type, "number", owner)
            {
                if (type.TypeID != 10)
                {
                    throw new SkillException("Expected field type i64 in Number.number but found " + type);
                }

                // TODO insert known restrictions?
            }
示例#14
0
            public f9([email protected] type, P1 owner) : base(type, "zero", owner)
            {
                if (type.TypeID != 12)
                {
                    throw new SkillException("Expected field type f32 in FloatTest.zero but found " + type);
                }

                // TODO insert known restrictions?
            }
示例#15
0
            public f1([email protected] type, P0 owner) : base(type, "three", owner)
            {
                if (type.TypeID != 14)
                {
                    throw new SkillException("Expected field type string in Unicode.three but found " + type);
                }

                // TODO insert known restrictions?
            }
示例#16
0
            public f4([email protected] type, P0 owner) : base(type, "e", owner)
            {
                if (type.TypeID != 4)
                {
                    throw new SkillException("Expected field type v64 in Constant.e but found " + type);
                }

                // TODO insert known restrictions?
            }
示例#17
0
            public override AbstractFieldDeclaration addField <R> ([email protected] type, string name)
            {
                switch (name)
                {
                case "number":
                    return(new f0(([email protected])type, this));

                default:
                    return(base.addField <R>(type, name));
                }
            }
示例#18
0
            public override AbstractFieldDeclaration addField <R> ([email protected] type, string name)
            {
                switch (name)
                {
                case "d":
                    throw new SkillException(String.Format(
                                                 "The file contains a field declaration %s.%s, but there is an auto field of similar name!",
                                                 this.Name, name));

                default:
                    return(base.addField <R>(type, name));
                }
            }
示例#19
0
            public override AbstractFieldDeclaration addField <R> ([email protected] type, string name)
            {
                switch (name)
                {
                case "minuszero":
                    return(new f5(([email protected])type, this));

                case "nan":
                    return(new f6(([email protected])type, this));

                case "pi":
                    return(new f7(([email protected])type, this));

                case "two":
                    return(new f8(([email protected])type, this));

                case "zero":
                    return(new f9(([email protected])type, this));

                default:
                    return(base.addField <R>(type, name));
                }
            }
示例#20
0
 public f0([email protected] type, P0 owner) : base(type, "name", 0, owner)
 {
     // TODO insert known restrictions?
 }
示例#21
0
        /**
         * unchecked, because the insane amount of casts is necessary to reflect the
         * implicit value based type system
         */
        private static T value <T>(SkillFile sf, [email protected] type)
        {
            if (type is IGeneralAccess)
            {
                // get a random object
                IEnumerator @is = ((IGeneralAccess)type).GetEnumerator();
                for (int i = new Random().Next(reflectiveInitSize) % 200; i != 0; i--)
                {
                    @is.MoveNext();
                }
                return((T)@is.Current);
            }

            switch (type.TypeID)
            {
            case 5:
                // random type
                IEnumerator ts = sf.allTypes().GetEnumerator();
                ts.MoveNext();
                IAccess t = (IAccess)ts.Current;
                for (int i = new Random().Next(200); i != 0 && ts.MoveNext(); i--)
                {
                    t = (IAccess)ts.Current;
                }

                // random object
                IEnumerator @is = t.GetEnumerator();
                for (int i = new Random().Next(Math.Min(200, reflectiveInitSize)); i != 0; i--)
                {
                    @is.MoveNext();
                }
                @is.MoveNext();
                return((T)@is.Current);

            case 6:
                return((T)(object)(Boolean)(new Random().Next(1) != 0));

            case 7:
                return((T)(object)(SByte) new Random().Next(reflectiveInitSize));

            case 8:
                return((T)(object)(Int16) new Random().Next(reflectiveInitSize));

            case 9:
                return((T)(object)(Int32) new Random().Next(reflectiveInitSize));

            case 10:
            case 11:
                return((T)(object)(Int64)(new Random().Next() % reflectiveInitSize));

            case 12:
                return((T)(object)(Single) new Random().NextDouble());

            case 13:
                return((T)(object)(Double) new Random().NextDouble());

            case 14:
                return((T)(object)"☢☢☢");

            case 15:
            {
                IConstantLengthArray cla  = (IConstantLengthArray)type;
                ArrayList            rval = new ArrayList(cla.GetLength());
                for (int i = cla.GetLength(); i != 0; i--)
                {
                    rval.Add(value <object>(sf, cla.GetGroundType()));
                }
                return((T)(object)rval);
            }

            case 17:
            {
                ISingleArgumentType cla = (ISingleArgumentType)type;
                int       length        = (int)Math.Sqrt(reflectiveInitSize);
                ArrayList rval          = new ArrayList(length);
                while (0 != length--)
                {
                    rval.Add(value <object>(sf, cla.GetGroundType()));
                }
                return((T)(object)rval);
            }

            case 18:
            {
                ISingleArgumentType cla = (ISingleArgumentType)type;
                int           length    = (int)Math.Sqrt(reflectiveInitSize);
                List <Object> rval      = new List <Object>();
                while (0 != length--)
                {
                    rval.Add(value <object>(sf, cla.GetGroundType()));
                }
                return((T)(object)rval);
            }

            case 19:
            {
                ISingleArgumentType cla = (ISingleArgumentType)type;
                int length            = (int)Math.Sqrt(reflectiveInitSize);
                HashSet <Object> rval = new HashSet <Object>();
                while (0 != length--)
                {
                    rval.Add(value <object>(sf, cla.GetGroundType()));
                }
                return((T)(object)rval);
            }

            case 20:
                return((T)(object)new Dictionary <Object, Object>());

            default:
                throw new Exception();
            }
        }
示例#22
0
 public f9([email protected] type, P4 owner) : base(type, "somereference", -5, owner)
 {
     // TODO insert known restrictions?
 }
示例#23
0
 public f7([email protected] type, P4 owner) : base(type, "someintegersinalist", -3, owner)
 {
     // TODO insert known restrictions?
 }
示例#24
0
 public f6([email protected] type, P4 owner) : base(type, "seen", -2, owner)
 {
     // TODO insert known restrictions?
 }