Beispiel #1
0
 protected override void InitNodes(TreeNode node)
 {
     _ParentNode = AddSectionNode(node, typeof(UField).Name);
     AddSimpleObjectNode(_ParentNode, Super, "SuperField", Super != null ? Super.GetImageName() : "");
     AddSimpleObjectNode(_ParentNode, NextField, "NextField", NextField != null ? NextField.GetImageName() : "");
     base.InitNodes(_ParentNode);
 }
        private void agregarTipoBomba()  // se crea private porque sera utilizada dentro de la clase
        {
            WriteTitle("Tipo de Bomba");
            WriteLine("1. Super");
            WriteLine("2. Regular");
            WriteLine("3. Diesel");
            WriteLine("0. Salir");
            WriteLine("Seleccione una opcion ==>");
            string respuesta = ReadLine();

            if (respuesta.Equals("1"))
            {
                Bomba super = new Super();
                AgregarElemento(super);
            }
            else if (respuesta.Equals("2"))
            {
                Bomba regular = new Regular();
                AgregarElemento(regular);
            }
            else if (respuesta.Equals("3"))
            {
                Bomba diesel = new Diesel();
                AgregarElemento(diesel);
            }
        }
Beispiel #3
0
        /// <summary>
        /// 新增
        /// </summary>
        /// <param name="su"></param>
        /// <returns></returns>
        public int FootAdd(Super su)
        {
            string sql = @"INSERT INTO scheduleinfo
            (
             count,
            hostteamid,
             awayteamid,
             competitiontime,
             competitionposition,
             score,
             entryperson,
             entrytime)
VALUES(
        @count,
        @hostteamid,
        @awayteamid,
        @competitiontime,
        @competitionposition,
        @score,
        @entryperson,
        @entrytime)";

            SqlParameter[] sqlps = new SqlParameter[8];
            sqlps[0] = new SqlParameter("@count", su.count);
            sqlps[1] = new SqlParameter("@hostteamid", su.hostteamid);
            sqlps[2] = new SqlParameter("@awayteamid", su.awayteamid);
            sqlps[3] = new SqlParameter("@competitiontime", su.competitiontime);
            sqlps[4] = new SqlParameter("@competitionposition", su.competitionposition);
            sqlps[5] = new SqlParameter("@score", su.score);
            sqlps[6] = new SqlParameter("@entryperson", su.entryperson);
            sqlps[7] = new SqlParameter("@entrytime", su.entrytime);

            return(DBHelper.ExcuteNonQuery(sql, sqlps));
        }
Beispiel #4
0
        private void agregarTipoBomba()
        {
            Clear();
            WriteTitle("Administracion de Bombas");
            WriteTitle("Tipo de Bomba");
            WriteLine("1. Super");
            WriteLine("2. Regular");
            WriteLine("3. Diesel");
            WriteLine("0. Salir");
            WriteLine("Seleccione una Opcion==>");
            string respuesta = ReadLine();

            if (respuesta.Equals("1"))
            {
                Bomba super = new Super();
                agregarElemento(super);
            }
            else if (respuesta.Equals("2"))
            {
                Bomba regular = new Regular();
                agregarElemento(regular);
            }
            else if (respuesta.Equals("3"))
            {
                Bomba diesel = new Diesel();
                agregarElemento(diesel);
            }
        }
        private void AgregarTipoBomba()
        {
            byte opcion = 0;

            WriteTitle("Tipo de Bomba");
            WriteLine("1. Súper");
            WriteLine("2. Regular");
            WriteLine("3. Diesel");
            WriteLine("0. Salir");
            WriteLine("Seleccione una opción ==> ");
            string respuesta = ReadLine();

            if (respuesta.Equals("1"))
            {
                Bomba super = new Super();
                AgregarElemento(super);
            }
            else if (respuesta.Equals("2"))
            {
                Bomba regular = new Regular();
                AgregarElemento(regular);
            }
            else if (respuesta.Equals("3"))
            {
                Bomba diesel = new Diesel();
                AgregarElemento(diesel);
            }
        }
Beispiel #6
0
        private BranchParseNode BuildNode(bool success)
        {
            StackFrame removedFrame = PopFrame();

            BranchParseNode result;

            if (success)
            {
                LastOperation = Operation.Build;
                result        = new BranchParseNode(removedFrame.Rule, removedFrame.InputIndex, removedFrame.Nodes);

                if (removedFrame.Rule is NamedRule named)
                {
                    Super.ReportSuccess(named, result.MatchedText);
                }
            }
            else
            {
                LastOperation = Operation.Cancel;
                result        = null;

                if (removedFrame.Rule is NamedRule named)
                {
                    Super.ReportFailure(named);
                }
            }

            return(result);
        }
Beispiel #7
0
        protected override void ProcessRecord()
        {
            ErrorRecord _error;

            try
            {
                WriteVerbose("Create object to process");

                Super _super = new Super()
                {
                    ServiceClient = Conn,
                    Entity        = Entity,
                    Path          = Path
                };

                IImport _import = new Import();
                _import.SetImport(_super);
                _import.ImportaData();
            }
            catch (System.Exception ex)
            {
                _error = new ErrorRecord(ex, "", ErrorCategory.OpenError, "");
                WriteError(_error);
            }
        }
    public static int test_0_super_cast()
    {
        Duper  d   = new Duper();
        Super  sup = d;
        Object o   = d;

        if (!(o is Super))
        {
            return(1);
        }
        try {
            d = (Duper)sup;
        } catch {
            return(2);
        }
        if (!(d is Object))
        {
            return(3);
        }
        try {
            d = (Duper)(object)sup;
        } catch {
            return(4);
        }
        return(0);
    }
Beispiel #9
0
     static void Main(string[] args)
     {
         var res = Sub.methodA();
         var res2 = Super.methodA();
         Console.WriteLine(res == res2);
         Console.ReadKey();
 }
        /// <summary>
        /// Returns the string representation of the statement.
        /// </summary>
        /// <returns>Returns the string representation of the statement.</returns>
        /// <param name="indentation">The number of indented characters.</param>
        /// <exception cref="ArgumentOutOfRangeException"><paramref name="indentation"/> is negative.</exception>
        public override string ToString(int indentation)
        {
            if (indentation < 0)
            {
                throw new ArgumentOutOfRangeException();
            }
            var ind = new string(' ', indentation);
            var sb  = new StringBuilder();

            sb.Append(ind).Append("class ").Append(Name);
            if (Super != null)
            {
                sb.Append(" extends ").Append(Super.ToString());
            }
            sb.Append("\n");
            if (Members != null)
            {
                sb.Append(ind).Append("{\n")
                .Append(Members.ToString(indentation + 4)).Append("\n")
                .Append(ind).Append("}");
            }
            else
            {
                sb.Append(ind).Append("{ }");
            }
            return(sb.ToString());
        }
    public static int test_0_null_cast()
    {
        object o = null;

        Super s = (Super)o;

        return(0);
    }
Beispiel #12
0
        public IEnumerable <Lexeme> Lex(string input)
        {
            var results = new List <Lexeme>();

            if (Grammar.Tokens.Any(pair => pair.Value.CompatibilityGuid != CompatibilityGuid))
            {
                throw new Exception();
            }

            Token[] @implicit = Grammar.ImplicitNames
                                .Select(GetToken)
                                .Where(t => t != null)
                                .ToArray();

            var prevIndex = 0;
            var index     = 0;

            while (index < input.Length)
            {
                foreach (Token token in @implicit)
                {
                    Match <Lexeme> match = token.Match(input, index);
                    if (match.Success)
                    {
                        Lexeme lexeme = match.Result;
                        index += lexeme.Length;
                        results.Add(lexeme);
                    }
                }

                foreach (KeyValuePair <string, Token> pair in Grammar.Tokens)
                {
                    var   name  = pair.Key;
                    Token token = pair.Value;

                    Super.ReportHypothesis(token, index);

                    Match <Lexeme> match = token.Match(input, index);
                    if (match.Success)
                    {
                        Lexeme lexeme = match.Result;
                        index += lexeme.Length;
                        results.Add(lexeme);
                        Super.ReportSuccess(token, lexeme.MatchedText);
                        break;
                    }
                }

                if (index == prevIndex)
                {
                    throw new Exception();
                }
                prevIndex = index;
            }

            return(results);
        }
Beispiel #13
0
        static void Main(string[] args)
        {
            Super Super = new Super();
            Super.Init(Encoding.Default.GetBytes("PrjTake"));
            Console.WriteLine(Super.Next());

            while (true)
                Console.Read();
        }
Beispiel #14
0
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = (Name != null ? Name.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (Super != null ? Super.GetHashCode() : 0);
         return(hashCode);
     }
 }
Beispiel #15
0
    private void loadNPCs()
    {
        for (int i = 0; i < 2; i++)
        {
            string npcDir;
            if (i == 0)
                npcDir = "Data\\NPCs\\Supers";
            else
                npcDir = "Data\\NPCs\\Henchmen";

            try
            {
                string[] directories = Directory.GetDirectories(npcDir);
                foreach (string dirPath in directories)
                {
                    string xmlPath = Directory.GetFiles(dirPath, "*.xml")[0];
                    XElement rootXML = XElement.Load(xmlPath);
                    NPC npc = null;
                    if (i == 0)
                        npc = new Super();
                    else
                        npc = new Henchman();
                    npc.name = rootXML.Element("name").Value;
                    npc.hp = getXElementAttrValueAsInt(rootXML, "hp");
                    npc.energy = getXElementAttrValueAsInt(rootXML, "energy");
                    npc.gold = getXElementAttrValueAsInt(rootXML, "gold");
                    npc.exp = getXElementAttrValueAsInt(rootXML, "exp");
                    string side = rootXML.Element("side").Value.ToLower();
                    if (side == "hero")
                        npc.side = NPC.Side.HERO;
                    else if (side == "villain")
                        npc.side = NPC.Side.VILLAIN;
                    else
                        npc.side = NPC.Side.NEUTRAL;
                    if (i == 0) // supers
                    {
                        Super super = (Super)npc;
                        foreach (XElement image in rootXML.Descendants("image"))
                            super.images.Add(image.Attribute("flag").Value, image.Value);
                        GlobalVariables.supers.Add(npc.name, super);
                    }
                    else // henchmen
                    {
                        Henchman henchman = (Henchman)npc;
                        henchman.images.Add(ImageFlag.POTRAIT.ToString(), rootXML.Element("image").Value);
                        GlobalVariables.henchmen.Add(npc.name, henchman);
                    }
                }
            }
            catch (Exception e)
            {
                Debug.Log(e);
            }

        }
    }
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = Element.GetHashCode();
         hashCode = (hashCode * 397) ^ (Super != null ? Super.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (First != null ? First.GetHashCode() : 0);
         return(hashCode);
     }
 }
Beispiel #17
0
        internal ClassMember SetItem(RuntimeContexts.RuntimeContext context, bool isStatic)
        {
            var         members = isStatic ? StaticMembers : InstanceMembers;
            ClassMember value;
            string      rename;
            string      idxget = ClassHelper.RenameIndexerGetter;
            string      idxset = ClassHelper.RenameIndexerSetter;
            var         cls    = context.Class as ClassObject;

            if (cls != null)
            {
                rename = ClassHelper.RenamePrivate(idxset, cls.Name);
                if (members.TryGetValue(rename, out value) && value is IndexerSetter)
                {
                    return(value);
                }
                rename = ClassHelper.RenamePrivate(idxget, cls.Name);
                if (members.TryGetValue(rename, out value) && value is IndexerGetter)
                {
                    return(ClassHelper.ThrowIndexerIsReadonly());
                }
            }
            {
                rename = idxset;
                if (members.TryGetValue(rename, out value) && value is IndexerSetter)
                {
                    return(value);
                }
                rename = idxget;
                if (members.TryGetValue(rename, out value) && value is IndexerGetter)
                {
                    return(ClassHelper.ThrowIndexerIsReadonly());
                }
            }
            if (cls == this || ClassHelper.IsExtendedFrom(this, cls) || ClassHelper.IsExtendedFrom(cls, this))
            {
                rename = ClassHelper.RenameProtected(idxset);
                if (members.TryGetValue(rename, out value) && value is IndexerSetter)
                {
                    return(value);
                }
                rename = ClassHelper.RenameProtected(idxget);
                if (members.TryGetValue(rename, out value) && value is IndexerGetter)
                {
                    return(ClassHelper.ThrowIndexerIsReadonly());
                }
            }
            if (Super != null)
            {
                return(Super.SetItem(context, isStatic));
            }
            return(ClassHelper.ThrowIndexerNotSupported());
        }
 public ActionResult Delete(int id, Super super)
 {
     try
     {
         _context.Supers.Remove(super);
         _context.SaveChanges();
         return(RedirectToAction(nameof(Index)));
     }
     catch
     {
         return(View());
     }
 }
 public ActionResult Create(Super super)
 {
     try
     {
         _context.Supers.Add(super);
         _context.SaveChanges();
         return(RedirectToAction(nameof(Index)));
     }
     catch
     {
         return(View());
     }
 }
    static void Main(string[] args)
    {
        Super.methodA();

        Sub.methodA();

        var s = new Sub();

        s.callSuper();
        s.callSub();

        Console.ReadLine();
    }
Beispiel #21
0
        public object VisitSuperExpr(Super expr)
        {
            if (_currentClass == ClassType.NONE)
            {
                _lox.Error(expr.Keyword, "Can't use 'super' outside of a class");
            }
            else if (_currentClass != ClassType.SUBCLASS)
            {
                _lox.Error(expr.Keyword, "Can't user 'super' in a class with no superclass");
            }

            ResolveLocal(expr, expr.Keyword);
            return(null);
        }
    public static int test_0_multi_array_cast()
    {
        Duper[,] d  = new Duper [1, 1];
        object[,] o = d;

        try {
            o [0, 0] = new Super();
            return(1);
        }
        catch (ArrayTypeMismatchException) {
        }

        return(0);
    }
Beispiel #23
0
        public object Visit(Super expr)
        {
            var distance = locals[expr];

            var superclass = (LoxClass)environment.GetAt(distance, "super");
            var obj        = (LoxInstance)environment.GetAt(distance - 1, "this");
            var method     = superclass.FindMethod(obj, expr.Method.Lexeme);

            if (method == null)
            {
                throw new RuntimeErrorException(expr.Method, $"Undefined property '{expr.Method.Lexeme}'.");
            }

            return(method);
        }
Beispiel #24
0
 public Object visitSuperExpr(Super expr)
 {
     if (currentClass == ClassType.NONE)
     {
         ErrorReport.error(expr.keyword,
                           "Can't use 'super' outside of a class.");
     }
     else if (currentClass != ClassType.SUBCLASS)
     {
         ErrorReport.error(expr.keyword,
                           "Can't use 'super' in a class with no superclass.");
     }
     resolveLocal(expr, expr.keyword);
     return(null);
 }
Beispiel #25
0
        private void PushFrame(StackFrame frame)
        {
            if (Stack.Any(f => f.Rule == frame.Rule && f.InputIndex == frame.InputIndex))
            {
                throw new Exception();
            }

            if (frame.Rule is NamedRule named)
            {
                Super.ReportHypothesis(named, Index);
            }

            Stack.Add(frame);
            head          = frame;
            LastOperation = Operation.Push;
        }
Beispiel #26
0
        //修改
        public int update(Super su)
        {
            string sql = @"update  scheduleinfo  set competitiontime=@competitiontime,competitionposition=@competitionposition,score=@score,entryperson=@entryperson
,hostteamid=@hostteamid,awayteamid=@awayteamid
   where count=@count";

            SqlParameter[] sqlps = new SqlParameter[7];
            sqlps[0] = new SqlParameter("@competitiontime", su.competitiontime.ToString());
            sqlps[1] = new SqlParameter("@competitionposition", su.competitionposition);
            sqlps[2] = new SqlParameter("@score", su.score);
            sqlps[3] = new SqlParameter("@entryperson", su.entryperson);
            sqlps[4] = new SqlParameter("@count", su.count);
            sqlps[5] = new SqlParameter("@hostteamid", su.hostteamid);
            sqlps[6] = new SqlParameter("@awayteamid", su.awayteamid);
            return(DBHelper.ExcuteNonQuery(sql, sqlps));
        }
Beispiel #27
0
        public bool OppositionSuperSlays(Mobile m)
        {
            for (int i = 0; i < Opposition.Length; i++)
            {
                if (Opposition[i].Super.Slays(m))
                {
                    return(true);
                }
            }

            if (Super.Name == SlayerName.Eodon && !Super.Slays(m))
            {
                return(true);
            }

            return(false);
        }
Beispiel #28
0
        public object VisitSuperExpr(Super expr)
        {
            int      distance   = Locals[expr];
            CoxClass superclass = (CoxClass)Environment.GetAt(distance, "super");

            // "this" is always one level nearer than "super"'s environment.
            CoxInstance receiver = (CoxInstance)Environment.GetAt(distance - 1, "this");

            CoxFunction method = superclass.FindMethod(receiver, expr.Method.Lexeme);

            if (method == null)
            {
                throw new RuntimeError(expr.Method, $"Undefined property '{expr.Method.Lexeme}'.");
            }

            return(method);
        }
Beispiel #29
0
        public override Match <IParseNode> Match(List <Lexeme> lexemes)
        {
            Super.ReportHypothesis(this, lexemes.FirstOrDefault()?.StartIndex);

            var match = Rule.Match(lexemes);

            if (match.Success)
            {
                Super.ReportSuccess(this, match.Result.MatchedText);
                return(new Match <IParseNode>(new BranchParseNode(this, match.Result.StartIndex, new[] { match.Result }), true));
            }
            else
            {
                Super.ReportFailure(this);
                return(new Match <IParseNode>(null, false));
            }
        }
Beispiel #30
0
        static void Main(string[] args)
        {
            var firstNameInput = StandardMessage.CaptureData("first name");
            var surnameInput   = StandardMessage.CaptureData("surname");

            var annualSalaryInput = StandardMessage.CaptureData("annual salary");

            var superRateInput = StandardMessage.CaptureData("super rate");

            var startDate = StandardMessage.CaptureData("payment start date");
            var endDate   = StandardMessage.CaptureData("payment end date");

            var bracket1 = TaxBracket.Generate(0M, 18200M, 0M, 0M);
            var bracket2 = TaxBracket.Generate(18201M, 37000M, 0M, 0.325M);
            var bracket3 = TaxBracket.Generate(37001M, 87000M, 3572M, 0.325M);
            var bracket4 = TaxBracket.Generate(87001M, 180000M, 19822M, 0.37M);
            var bracket5 = TaxBracket.Generate(180000M, Int32.MaxValue, 54232M, 0.45M);

            var taxTable = TaxTable.Build(bracket1, bracket2, bracket3, bracket4, bracket5);

            EmployeeDetails employeeDetails = EmployeeDetails.ConstructFullName(firstNameInput, surnameInput);

            PayPeriod payPeriod = PayPeriod.Generate(startDate, endDate);

            GrossIncome grossIncome = GrossIncome.Generate(annualSalaryInput, payPeriod);
            IncomeTax   incomeTax   = IncomeTax.Generate(taxTable, grossIncome, payPeriod);
            NetIncome   netIncome   = NetIncome.Generate(grossIncome, incomeTax);

            Super super = Super.Generate(superRateInput, grossIncome);

            var paySlip = PaySlip.Create(
                employeeDetails,
                payPeriod,
                grossIncome,
                incomeTax,
                netIncome,
                super
                );

            var payslipOutput = PayslipBuilder.Print(paySlip);

            Console.WriteLine(payslipOutput);
//
        }
Beispiel #31
0
        public MethodInfo GetMethodInfo()
        {
            if (mType == null)
            {
                mType = Type.GetType(TypeName) ??
                        AppDomain.CurrentDomain.GetAssemblies()
                        .SelectMany(a => a.GetTypes())
                        .First(t => t.AssemblyQualifiedName == TypeName);
                //mType = Type.GetType(TypeName, true);
            }
            if (mType == null)
            {
                return(null);
            }

            var methods = Super.CollectMethods(mType);

            return(methods.FirstOrDefault(i => i.Name == MethodName));
        }
Beispiel #32
0
        static void Main(string[] args)
        {
            Console.WriteLine("Welcome to Super Mart");

            /*char cash = 'P';
             * char debit = 'D';
             * char credit = 'C';
             * char goods = 'R';*/
            Console.WriteLine("Press P for Cash");
            Console.WriteLine("Press D for Debit");
            Console.WriteLine("Press C for Credit");
            Console.WriteLine("Press R for return goods");

            char _input = Convert.ToChar(Console.ReadLine());

            Super _mart = new Super();

            _mart.mart(_input);
        }
Beispiel #33
0
	public static int test_0_multi_array_cast () {
		Duper[,] d = new Duper [1, 1];
		object[,] o = d;

		try {
			o [0, 0] = new Super ();
			return 1;
		}
		catch (ArrayTypeMismatchException) {
		}

		return 0;
	}
Beispiel #34
0
        public void ProcessRequest(Super super)
        {
            HttpWebRequest request;

            LogManager.Debug("Preparing request " + super.RequestName);

            super.Prepare(out request);

            HttpWebResponse response;

            LogManager.Debug("Processing request " + super.RequestName);

            this.Send(request, out response, super.GetData());

            LogManager.Debug("Handling response " + super.RequestName);

            super.Handle(response);

            response.GetResponseStream().Close();

            LogManager.Debug("Finished " + super.RequestName);

            ShortWait();
        }
Beispiel #35
0
 public bool TryRequest(Super super)
 {
     try
     {
         this.ProcessRequest(super);
         return true;
     }
     catch
     {
         return false;
     }
 }
Beispiel #36
0
 static void doSuper(Super super)
 {
     super.add();
     super.set();
 }