Equals() public method

public Equals ( int obj ) : bool
obj int
return bool
Example #1
0
    static int Equals(IntPtr L)
    {
        try
        {
            int count = LuaDLL.lua_gettop(L);

            if (count == 2 && TypeChecker.CheckTypes <int>(L, 2))
            {
                System.Int32 obj  = (System.Int32)ToLua.CheckObject(L, 1, typeof(System.Int32));
                int          arg0 = (int)LuaDLL.lua_tonumber(L, 2);
                bool         o    = obj.Equals(arg0);
                LuaDLL.lua_pushboolean(L, o);
                ToLua.SetBack(L, 1, obj);
                return(1);
            }
            else if (count == 2 && TypeChecker.CheckTypes <object>(L, 2))
            {
                System.Int32 obj  = (System.Int32)ToLua.CheckObject(L, 1, typeof(System.Int32));
                object       arg0 = ToLua.ToVarObject(L, 2);
                bool         o    = obj.Equals(arg0);
                LuaDLL.lua_pushboolean(L, o);
                ToLua.SetBack(L, 1, obj);
                return(1);
            }
            else
            {
                return(LuaDLL.luaL_throw(L, "invalid arguments to method: System.Int32.Equals"));
            }
        }
        catch (Exception e)
        {
            return(LuaDLL.toluaL_exception(L, e));
        }
    }
        /// <summary>Returns true if <code>o</code> is equal to this. </summary>
        public override bool Equals(System.Object o)
        {
            if (!(o is MultiPhraseQuery))
            {
                return(false);
            }
            MultiPhraseQuery other = (MultiPhraseQuery)o;

            if (this.GetBoost() == other.GetBoost() && this.slop == other.slop)
            {
                System.Collections.IEnumerator iter1 = this.termArrays.GetEnumerator();
                System.Collections.IEnumerator iter2 = other.termArrays.GetEnumerator();
                while (iter1.MoveNext() && iter2.MoveNext())
                {
                    Term item1 = (Term)iter1.Current;
                    Term item2 = (Term)iter2.Current;
                    if (!item1.Equals(item2))
                    {
                        return(false);
                    }
                }
                iter1 = this.positions.GetEnumerator();
                iter2 = other.positions.GetEnumerator();
                while (iter1.MoveNext() && iter2.MoveNext())
                {
                    System.Int32 item1 = (System.Int32)iter1.Current;
                    System.Int32 item2 = (System.Int32)iter2.Current;
                    if (!item1.Equals(item2))
                    {
                        return(false);
                    }
                }
            }
            return(true);
        }
Example #3
0
        static StackObject* Equals_3(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            StackObject* ptr_of_this_method;
            StackObject* __ret = ILIntepreter.Minus(__esp, 2);
            ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
            System.Int32 obj = ptr_of_this_method->Value;
            ptr_of_this_method = ILIntepreter.Minus(__esp, 2);
            System.Int32 instance_of_this_method = GetInstance(__domain, ptr_of_this_method, __mStack);

            var result_of_this_method = instance_of_this_method.Equals(obj);

            __ret->ObjectType = ObjectTypes.Integer;
            __ret->Value = result_of_this_method ? 1 : 0;
            return __ret + 1;
        }
Example #4
0
        /// <summary>
        /// Returns the actual string representation for the specified lexical state ID.
        /// </summary>
        /// <param name="id">The lexical state ID to examine.</param>
        /// <returns>The actual string representation for the specified lexical state ID.</returns>
        public override String GetDescription(Int32 id)
        {
            var fields = typeof (JsonLexicalStateId).GetFields((BindingFlags.Public | BindingFlags.Static));
            for (var index = 0; (index < fields.Length); index = (index + 1))
            {
                var field = fields[index];
                if (id.Equals(field.GetValue(null)))
                {
                    var customAttributes = field.GetCustomAttributes(typeof (DescriptionAttribute), false);
                    if (((customAttributes != null) && (customAttributes.Length > 0)))
                        return ((DescriptionAttribute) (customAttributes[0])).Description;
                      
                    return field.Name;
                }
            }

            return null;
        }
Example #5
0
        static StackObject *Equals_1(ILIntepreter __intp, StackObject *__esp, IList <object> __mStack, CLRMethod __method, bool isNewObj)
        {
            CSHotFix.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            StackObject *ptr_of_this_method;
            StackObject *__ret = ILIntepreter.Minus(__esp, 2);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
            System.Object obj = (System.Object) typeof(System.Object).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
            __intp.Free(ptr_of_this_method);
            ptr_of_this_method = ILIntepreter.Minus(__esp, 2);
            System.Int32 instance_of_this_method = GetInstance(__domain, ptr_of_this_method, __mStack);

            var result_of_this_method = instance_of_this_method.Equals(obj);

            __ret->ObjectType = ObjectTypes.Integer;
            __ret->Value      = result_of_this_method ? 1 : 0;
            return(__ret + 1);
        }
        /// <summary>
        /// I have had to write this method because I could not get the DataView.Find to work (with dates?)
        /// </summary>
        /// <param name="ADataView">The DataView to search</param>
        /// <param name="FromCurrency"></param>
        /// <param name="ToCurrency"></param>
        /// <param name="EffectiveDate"></param>
        /// <param name="EffectiveTime"></param>
        /// <returns>The integer row index, or -1 if not found</returns>
        private Int32 FindRowInDataView(DataView ADataView, String FromCurrency, String ToCurrency, DateTime EffectiveDate, Int32 EffectiveTime)
        {
            for (int n = 0; n < ADataView.Count; n++)
            {
                object[] itemArray = ADataView[n].Row.ItemArray;

                if (FromCurrency.Equals(itemArray[ADailyExchangeRateTable.ColumnFromCurrencyCodeId])
                    && ToCurrency.Equals(itemArray[ADailyExchangeRateTable.ColumnToCurrencyCodeId])
                    && EffectiveDate.Equals(itemArray[ADailyExchangeRateTable.ColumnDateEffectiveFromId])
                    && EffectiveTime.Equals(itemArray[ADailyExchangeRateTable.ColumnTimeEffectiveFromId]))
                {
                    return n;
                }
            }

            return -1;
        }
Example #7
0
 public bool Equals(WaypointData other)
 {
     return(Left.Equals(other.Left) && Right.Equals(other.Right) && Up.Equals(other.Up) && Down.Equals(other.Down) && Occupied.Equals(other.Occupied) && StepsToEnd.Equals(other.StepsToEnd));
 }
Example #8
0
 public bool Equals(AgentData other)
 {
     return(Timeline.Equals(other.Timeline) && Safe.Equals(other.Safe) && HasWeapon.Equals(other.HasWeapon));
 }
Example #9
0
 public bool Equals(GameData other)
 {
     return(MoveCount.Equals(other.MoveCount) && Score.Equals(other.Score) && GoalType.Equals(other.GoalType) && GoalCount.Equals(other.GoalCount));
 }
        /// <summary>
        /// Copies a Project in the database
        /// </summary>
        /// <param name="projectVersionId"></param>
        /// <returns>ProjectVersionID</returns>
        public RtpSummary CopyProject(string plan, Int32 cycleId, Int32 projectVersionId)
        {
            CycleAmendment cycle = GetCurrentCycle(GetYearId(plan, Enums.TimePeriodType.PlanYear));

            RtpSummary result = null;
            using (SqlCommand command = new SqlCommand("[RTP].[CopyProject]") { CommandType = CommandType.StoredProcedure })
            {
                command.Parameters.AddWithValue("@CurrentProjectVersionId", projectVersionId);
                if(!String.IsNullOrEmpty(plan))
                    command.Parameters.AddWithValue("@TimePeriod", plan);
                if(!cycleId.Equals(default(Int32)) )
                    command.Parameters.AddWithValue("@CycleId", cycleId);

                using (IDataReader rdr = this.ExecuteReader(command))
                {
                    if (rdr.Read())
                    {
                        result = new RtpSummary()
                        {
                            SponsorAgency = rdr["Sponsor"].ToString()
                            ,
                            TIPId = rdr["TIPID"].ToString()
                            ,
                            RtpId = rdr["RtpYear"].ToString()
                            ,
                            RtpYear = rdr["RtpYear"] != DBNull.Value ? rdr["RtpYear"].ToString() : "NULL IN DATABASE"
                            ,
                            Title = rdr["ProjectName"] != DBNull.Value ? rdr["ProjectName"].ToString() : "NULL IN DATABASE"
                            ,
                            ProjectVersionId = (int)rdr["RTPProjectVersionID"]
                            ,
                            AmendmentStatus = rdr["AmendmentStatus"] != DBNull.Value ? rdr["AmendmentStatus"].ToString() : ""
                            ,
                            ImprovementType = rdr["ImprovementType"] != DBNull.Value ? rdr["ImprovementType"].ToString() : ""
                            ,
                            ProjectType = rdr["ProjectType"] != DBNull.Value ? rdr["ProjectType"].ToString() : ""
                            ,
                            PlanType = rdr["PlanType"].ToString()
                            ,
                            ProjectName = rdr["ProjectName"] != DBNull.Value ? rdr["ProjectName"].ToString() : ""
                            ,
                            // Set ToUpper to ensure results found. No case sensitive required.
                            COGID = rdr["COGID"] != DBNull.Value ? rdr["COGID"].ToString().ToUpper() : ""
                            ,
                            VersionStatus = rdr["ProjectVersionStatus"] != DBNull.Value ? rdr["ProjectVersionStatus"].ToString() : ""
                        };
                    }
                }
            }
            return result;
        }
        public ActionResult DeleteAmendment(Int32 projectVersionId, Int32 previousProjectVersionId, string year)
        {
            ProjectAmendments amendment = new ProjectAmendments()
            {
                LocationMapPath = _config.LocationMapPath,
                ProjectVersionId = projectVersionId
            };

            IDeleteStrategy strategy = new DeleteStrategy(this._projectRepository, amendment).PickStrategy();
            int returnId = strategy.Delete();
            previousProjectVersionId = returnId != 0 ? returnId : previousProjectVersionId;

            if (!previousProjectVersionId.Equals(default(int)))
            {
                return RedirectToAction("Details", new { controller = "Project", id = previousProjectVersionId, message = "Amendment deleted successfully." });
            }
            else
                return RedirectToAction("ProjectList", new { controller = "Tip", tipYear = year });
        }
Example #12
0
 public bool Equals(CharacterData other)
 {
     return(Waypoint.Equals(other.Waypoint) && ID.Equals(other.ID));
 }
Example #13
0
 public bool Equals(BlockerData other)
 {
     return(Life.Equals(other.Life));
 }
Example #14
0
 public bool Equals(CoordinateData other)
 {
     return(X.Equals(other.X) && Y.Equals(other.Y));
 }
Example #15
0
        public static UnitId GetUnitIdFromLogicalId(UnitId structureBuildFrom, Int32 logicalId, Int32 maximumTime, Int32 mineralCost, Int32 vespineCost, int supply)
        {
            if (logicalId.Equals(0))
                return UnitId.NbXelNagaTower;

            if (!logicalId.Equals(-1))
            {

                var strStuff = Convert.ToString(logicalId, 16);
                strStuff = "1" + strStuff.Substring(1);

                var inumber = int.Parse(strStuff, NumberStyles.HexNumber);

                logicalId = inumber;
            }

            #region Terran

            #region CC - Orbital - PF

            if (structureBuildFrom.Equals(UnitId.TbCcGround))
            {
                //E.G. Upgrade to Lair/ Hive
                if (logicalId == -1)
                {
                    if (mineralCost == 150 && vespineCost == 0)
                        return UnitId.TupUpgradeToOrbital;

                    if (mineralCost == 150 && vespineCost == 150)
                        return UnitId.TupUpgradeToPlanetary;
                }

                return UnitId.TuScv;
            }

            if (structureBuildFrom.Equals(UnitId.TbPlanetary))
                return UnitId.TuScv;

            if (structureBuildFrom.Equals(UnitId.TbOrbitalGround))
                return UnitId.TuScv;

            #endregion

            #region Barracks

            if (structureBuildFrom.Equals(UnitId.TbBarracksGround))
            {
                /* Database for the units from the Barracks
                 * Unit         |   Time    |   Min |   Ves |   Sup
                 * -------------|-----------|-------|-------|-------
                 * Marine       |1638400    |   50  |   0   |   1
                 * Reaper       |2949120    |   50  |   50  |   1
                 * Marauder     |1966080    |   100 |   25  |   2
                 * Ghost        |2621440    |   200 |   100 |   2
                 * */

                switch (maximumTime)
                {
                    case 1638400:
                        return UnitId.TuMarine;

                    case 2949120:
                        return UnitId.TuReaper;

                    case 2621440:
                        return UnitId.TuGhost;

                    case 1966080:
                        return UnitId.TuMarauder;
                }
            }

            #endregion

            #region Factory

            else if (structureBuildFrom.Equals(UnitId.TbFactoryGround))
            {
                /* Database for the units from the Barracks
                * Unit         |   Time    |   Min |   Ves |   Sup
                * -------------|-----------|-------|-------|-------
                * Hellion      |1966080    |   100 |   0   |   2
                * Hellbat      |1966080    |   100 |   0   |   2
                * Mine         |2621440    |   75  |   25  |   2
                * Siege Tank   |2949120    |   150 |   125 |   3
                * Thor         |3932160    |   300 |   200 |   6
                * */

                if (logicalId.Equals(65541))
                    return UnitId.TuHellion;

                if (logicalId.Equals(65542))
                    return UnitId.TuHellbat;

                switch (maximumTime)
                {
                    case 3932160:
                        return UnitId.TuThor;

                    case 2621440:
                        return UnitId.TuWidowMine;

                    case 2949120:
                        return UnitId.TuSiegetank;
                }
            }

            #endregion

            #region Starport

            else if (structureBuildFrom.Equals(UnitId.TbStarportGround))
            {
                /* Database for the units from the Barracks
                * Unit         |   Time    |   Min |   Ves |   Sup
                * -------------|-----------|-------|-------|-------
                * Viking       |2752512    |   150 |   75  |   2
                * Medivac      |2752512    |   100 |   100 |   2
                * Raven        |3932160    |   100 |   200 |   2
                * Banshee      |3932160    |   150 |   100 |   3
                * Battlecruiser|5898240    |   400 |   300 |   6
                * */

                if (mineralCost.Equals(150) &&
                    vespineCost.Equals(75))
                    return UnitId.TuVikingAir;

                if (mineralCost.Equals(100) &&
                    vespineCost.Equals(100))
                    return UnitId.TuMedivac;

                if (mineralCost.Equals(100) &&
                    vespineCost.Equals(200))
                    return UnitId.TuRaven;

                if (mineralCost.Equals(150) &&
                    vespineCost.Equals(100))
                    return UnitId.TuBanshee;

                if (mineralCost.Equals(400) &&
                    vespineCost.Equals(300))
                    return UnitId.TuBattlecruiser;
            }

            #endregion

            /* - Upgrades - */

            #region Engineering Bay

            if (structureBuildFrom.Equals(UnitId.TbEbay))
            {
                if (logicalId.Equals(0x10002))
                    return UnitId.TupInfantryWeapon1;

                if (logicalId.Equals(0x10003))
                    return UnitId.TupInfantryWeapon2;

                if (logicalId.Equals(0x10004))
                    return UnitId.TupInfantryWeapon3;

                if (logicalId.Equals(0x10006))
                    return UnitId.TupInfantryArmor1;

                if (logicalId.Equals(0x10007))
                    return UnitId.TupInfantryArmor2;

                if (logicalId.Equals(0x10008))
                    return UnitId.TupInfantryArmor3;

                if (mineralCost.Equals(100) &&
                    vespineCost.Equals(100) &&
                    maximumTime.Equals(5242880))
                    return UnitId.TupHighSecAutoTracking;

                if (mineralCost.Equals(100) &&
                    vespineCost.Equals(100) &&
                    maximumTime.Equals(7208960))
                    return UnitId.TupNeosteelFrame;

                if (mineralCost.Equals(150) &&
                    vespineCost.Equals(150) &&
                    maximumTime.Equals(9175040))
                    return UnitId.TupStructureArmor;
            }

            #endregion

            #region GhostAcademy

            else if (structureBuildFrom.Equals(UnitId.TbGhostacademy))
            {
                if (mineralCost.Equals(150))
                    return UnitId.TupPersonalCloak;

                if (mineralCost.Equals(100))
                {
                    if (logicalId.Equals(0x10000))
                        return UnitId.TuNuke;

                    return UnitId.TupMoebiusReactor;
                }

            }

            #endregion

            #region FusionCore

            else if (structureBuildFrom.Equals(UnitId.TbFusioncore))
            {
                if (maximumTime.Equals(3932160))
                    return UnitId.TupWeaponRefit;

                if (maximumTime.Equals(5242880))
                    return UnitId.TupBehemothReactor;
            }

            #endregion

            #region Armory

            else if (structureBuildFrom.Equals(UnitId.TbArmory))
            {
                if (mineralCost.Equals(100) &&
                    vespineCost.Equals(100) &&
                    maximumTime.Equals(10485760) &&
                    logicalId.Equals(65536))
                    return UnitId.TupVehicleWeapon1;

                if (mineralCost.Equals(175) &&
                    vespineCost.Equals(175) &&
                    maximumTime.Equals(12451840) &&
                    logicalId.Equals(65537))
                    return UnitId.TupVehicleWeapon2;

                if (mineralCost.Equals(250) &&
                    vespineCost.Equals(250) &&
                    maximumTime.Equals(14417920) &&
                    logicalId.Equals(65538))
                    return UnitId.TupVehicleWeapon3;

                if (mineralCost.Equals(100) &&
                    vespineCost.Equals(100) &&
                    maximumTime.Equals(10485760) &&
                    logicalId.Equals(65547))
                    return UnitId.TupShipWeapon1;

                if (mineralCost.Equals(175) &&
                    vespineCost.Equals(175) &&
                    maximumTime.Equals(12451840) &&
                    logicalId.Equals(65548))
                    return UnitId.TupShipWeapon2;

                if (mineralCost.Equals(250) &&
                    vespineCost.Equals(250) &&
                    maximumTime.Equals(14417920) &&
                    logicalId.Equals(65549))
                    return UnitId.TupShipWeapon3;

                if (mineralCost.Equals(100) &&
                    vespineCost.Equals(100) &&
                    maximumTime.Equals(10485760) &&
                    logicalId.Equals(65539))
                    return UnitId.TupVehicleShipPlanting1;

                if (mineralCost.Equals(175) &&
                    vespineCost.Equals(175) &&
                    maximumTime.Equals(12451840) &&
                    logicalId.Equals(65540))
                    return UnitId.TupVehicleShipPlanting2;

                if (mineralCost.Equals(250) &&
                    vespineCost.Equals(250) &&
                    maximumTime.Equals(14417920) &&
                    logicalId.Equals(65541))
                    return UnitId.TupVehicleShipPlanting3;
            }

            #endregion

            #region Techlab Barracks

            else if (structureBuildFrom.Equals(UnitId.TbTechlabRax))
            {
                if (maximumTime.Equals(11141120))
                    return UnitId.TupStim;

                if (maximumTime.Equals(7208960))
                    return UnitId.TupCombatShields;

                if (maximumTime.Equals(3932160))
                    return UnitId.TupConcussiveShells;
            }

            #endregion

            #region Techlab Factory

            else if (structureBuildFrom.Equals(UnitId.TbTechlabFactory))
            {
                if (logicalId.Equals(65537))
                    return UnitId.TupBlueFlame;

                if (logicalId.Equals(65539))
                    return UnitId.TupTransformatorServos;

                if (logicalId.Equals(65540))
                    return UnitId.TupDrillingClaws;
            }

            #endregion

            #region Techlab Starport

            else if (structureBuildFrom.Equals(UnitId.TbTechlabStarport))
            {
                if (logicalId.Equals(65536))
                    return UnitId.TupCloakingField;

                if (logicalId.Equals(65539))
                    return UnitId.TupCorvidReactor;

                if (logicalId.Equals(65543))
                    return UnitId.TupDurableMeterials;

                if (logicalId.Equals(65538))
                    return UnitId.TupCaduceusReactor;
            }

            #endregion

            #endregion

            #region Protoss

            if (structureBuildFrom.Equals(UnitId.PuMothershipCore))
            {
                //E.G. Upgrade to Lair/ Hive
                if (logicalId == -1)
                {
                    if (mineralCost == 300 && vespineCost == 300)
                        return UnitId.PupUpgradeToMothership;
                }
            }

            #region Units

            #region Nexus

            if (structureBuildFrom.Equals(UnitId.PbNexus))
            {
                switch (maximumTime)
                {
                    case 1114112:
                        return UnitId.PuProbe;

                    case 1966080:
                        return UnitId.PuMothershipCore;
                }
            }

            #endregion

            #region Gateway

            if (structureBuildFrom.Equals(UnitId.PbGateway))
            {
                /* Database for the units from the Gateway
                * Unit         |   Time    |   Min |   Ves |   Sup
                * -------------|-----------|-------|-------|-------
                * Zealot       |2490368    |   100 |   0   |   2
                * Stalker      |2752512    |   125 |   50  |   2
                * Sentry       |2424832    |   50  |   100 |   2
                * HT           |3604480    |   50  |   150 |   2
                * DT           |3604480    |   125 |   125 |   2
                * */
                if (mineralCost.Equals(100))
                    return UnitId.PuZealot;

                if (mineralCost.Equals(125) &&
                    vespineCost.Equals(50))
                    return UnitId.PuStalker;

                if (mineralCost.Equals(50) &&
                    vespineCost.Equals(100))
                    return UnitId.PuSentry;

                if (mineralCost.Equals(50) &&
                    vespineCost.Equals(150))
                    return UnitId.PuHightemplar;

                if (mineralCost.Equals(125) &&
                    vespineCost.Equals(125))
                    return UnitId.PuDarktemplar;
            }

            #endregion

            #region Stargate

            else if (structureBuildFrom.Equals(UnitId.PbStargate))
            {
                /* Database for the units from the Gateway
                * Unit         |   Time    |   Min |   Ves |   Sup
                * -------------|-----------|-------|-------|-------
                * Phoenix      |2293760    |   150 |   100 |   2
                * Oracle       |3276800    |   150 |   150 |   3
                * Void Ray     |3932160    |   250 |   150 |   4
                * Tempest      |3932160    |   300 |   200 |   4
                * Carrier      |7864320    |   350 |   250 |   6
                * */

                if (mineralCost.Equals(150) &&
                    vespineCost.Equals(100))
                    return UnitId.PuPhoenix;

                if (mineralCost.Equals(150) &&
                    vespineCost.Equals(150))
                    return UnitId.PuOracle;

                if (mineralCost.Equals(250) &&
                    vespineCost.Equals(150))
                    return UnitId.PuVoidray;

                if (mineralCost.Equals(300) &&
                    vespineCost.Equals(200))
                    return UnitId.PuTempest;

                if (mineralCost.Equals(350) &&
                    vespineCost.Equals(250))
                    return UnitId.PuCarrier;
            }

            #endregion

            #region Robotics

            if (structureBuildFrom.Equals(UnitId.PbRoboticsbay))
            {
                /* Database for the units from the Gateway
                * Unit         |   Time    |   Min |   Ves |   Sup
                * -------------|-----------|-------|-------|-------
                * Observer     |1966080    |   25  |   75  |   1
                * Warp Prism   |3276800    |   200 |   0   |   2
                * Colossus     |4915200    |   300 |   200 |   6
                * Immortal     |3604480    |   250 |   100 |   4
                * */

                if (mineralCost.Equals(25))
                    return UnitId.PuObserver;

                if (mineralCost.Equals(200))
                    return UnitId.PuWarpprismTransport;

                if (mineralCost.Equals(300))
                    return UnitId.PuColossus;

                if (mineralCost.Equals(250))
                    return UnitId.PuImmortal;
            }

            #endregion

            #endregion

            #region Upgrades

            #region Forge

            if (structureBuildFrom.Equals(UnitId.PbForge))
            {
                if (logicalId.Equals(0x10000))
                    return UnitId.PupGroundW1;

                if (logicalId.Equals(0x10001))
                    return UnitId.PupGroundW2;

                if (logicalId.Equals(0x10002))
                    return UnitId.PupGroundW3;

                if (logicalId.Equals(0x10003))
                    return UnitId.PupGroundA1;

                if (logicalId.Equals(0x10004))
                    return UnitId.PupGroundA2;

                if (logicalId.Equals(0x10005))
                    return UnitId.PupGroundA3;

                if (logicalId.Equals(0x10006))
                    return UnitId.PupS1;

                if (logicalId.Equals(0x10007))
                    return UnitId.PupS2;

                if (logicalId.Equals(0x10008))
                    return UnitId.PupS3;
            }

            #endregion

            #region CyberCore

            if (structureBuildFrom.Equals(UnitId.PbCybercore))
            {
                if (logicalId.Equals(0x10000))
                    return UnitId.PupAirW1;

                if (logicalId.Equals(0x10001))
                    return UnitId.PupAirW2;

                if (logicalId.Equals(0x10002))
                    return UnitId.PupAirW3;

                if (logicalId.Equals(0x10003))
                    return UnitId.PupAirA1;

                if (logicalId.Equals(0x10004))
                    return UnitId.PupAirA2;

                if (logicalId.Equals(0x10005))
                    return UnitId.PupAirA3;

                if (logicalId.Equals(0x10006))
                    return UnitId.PupWarpGate;
            }

            #endregion

            #region Robotics Support Bay

            if (structureBuildFrom.Equals(UnitId.PbRoboticssupportbay))
            {
                if (logicalId.Equals(0x10001))
                    return UnitId.PupGraviticBooster;

                if (logicalId.Equals(0x10002))
                    return UnitId.PupGraviticDrive;

                if (logicalId.Equals(0x10005))
                    return UnitId.PupExtendedThermalLance;
            }

            #endregion

            #region Twilight Council

            if (structureBuildFrom.Equals(UnitId.PbTwilightcouncil))
            {
                if (logicalId.Equals(0x10000))
                    return UnitId.PupCharge;

                if (logicalId.Equals(0x10001))
                    return UnitId.PupBlink;
            }

            #endregion

            #region Fleet Beacon

            if (structureBuildFrom.Equals(UnitId.PbFleetbeacon))
            {
                if (logicalId.Equals(0x10000))
                    return UnitId.PupGravitonCatapult;

                if (logicalId.Equals(0x10002))
                    return UnitId.PupAnionPulseCrystals;
            }

            #endregion

            #region Templar Archives

            if (structureBuildFrom.Equals(UnitId.PbTemplararchives))
            {
                if (logicalId.Equals(0x10004))
                    return UnitId.PupStorm;
            }

            #endregion

            #endregion

            #endregion

            #region Zerg

            if (structureBuildFrom.Equals(UnitId.ZbHatchery) ||
                structureBuildFrom.Equals(UnitId.ZbLiar) ||
                structureBuildFrom.Equals(UnitId.ZbHive))
            {
                if (logicalId.Equals(0x10001))
                    return UnitId.ZupPneumatizedCarapace;

                if (logicalId.Equals(0x10002))
                    return UnitId.ZupVentralSacs;

                if (logicalId.Equals(0x10003))
                    return UnitId.ZupBurrow;

                //E.G. Upgrade to Lair/ Hive
                if (logicalId == -1)
                {
                    if (mineralCost == 150 && vespineCost == 100)
                        return UnitId.ZupUpgradeToLair;

                    if (mineralCost == 200 && vespineCost == 150)
                        return UnitId.ZupUpgradeToHive;
                }

                return UnitId.ZuQueen;
            }

            if (structureBuildFrom.Equals(UnitId.ZbSpire))
            {
                //E.G. Upgrade to Lair/ Hive
                if (logicalId == -1)
                {
                    if (mineralCost == 100 && vespineCost == 150)
                        return UnitId.ZupUpgradeToGreaterSpire;
                }
            }

            #region Units

            if (structureBuildFrom.Equals(UnitId.ZuBanelingCocoon))
            {
                if (maximumTime.Equals(1310720))
                    return UnitId.ZuBaneling;
            }

            if (structureBuildFrom.Equals(UnitId.ZuBroodlordCocoon))
            {
                //E.G. Upgrade to Lair/ Hive
                if (logicalId == -1)
                {
                    if (mineralCost == 150 && vespineCost == 150)
                        return UnitId.ZupUpgradeToBroodlord;
                }
            }

            if (structureBuildFrom.Equals(UnitId.ZuOverseerCocoon))
            {
                //E.G. Upgrade to Lair/ Hive
                if (logicalId == -1)
                {
                    if (mineralCost == 50 && vespineCost == 50)
                        return UnitId.ZupUpgradeToOverseer;
                }
            }

            /* For the eggs, we have to cchack using other values..
             Player 2 has the Type waay different. */
            if (structureBuildFrom.Equals(UnitId.ZuEgg))
            {
                /* Database for the units from the egg
                 * Unit         |   Time    |   Min |   Ves |   Sup
                 * -------------|-----------|-------|-------|-------
                 * Drone        |1114112    |   50  |   0   |   1
                 * Zergling     |1572864    |   50  |   0   |   1
                 * Overlord     |1638400    |   100 |   0   |   -
                 * Roach        |1769472    |   75  |   25  |   2
                 * Hydralisk    |2162688    |   100 |   50  |   2
                 * Mutalsik     |2162688    |   100 |   100 |   2
                 * Corruptor    |2621440    |   150 |   100 |   3
                 * Infestor     |3276800    |   100 |   150 |   2
                 * Swarm Host   |2621440    |   200 |   100 |   3
                 * Viper        |2621440    |   100 |   200 |   3
                 * Ultralisk    |3604480    |   300 |   200 |   6
                 * */

                if (maximumTime.Equals(1114112))
                    return UnitId.ZuDrone;

                if (maximumTime.Equals(1572864))
                    return UnitId.ZuZergling;

                if (maximumTime.Equals(1638400))
                    return UnitId.ZuOverlord;

                if (maximumTime.Equals(1769472))
                    return UnitId.ZuRoach;

                if (maximumTime.Equals(2162688))
                {
                    if (vespineCost.Equals(50))
                        return UnitId.ZuHydralisk;

                    return UnitId.ZuMutalisk;
                }

                if (maximumTime.Equals(2621440))
                {
                    if (mineralCost.Equals(150))
                        return UnitId.ZuCorruptor;

                    if (mineralCost.Equals(100) &&
                        vespineCost == 200 &&
                        supply == 4)
                        return UnitId.ZuSwarmHost;

                    if (mineralCost.Equals(100) &&
                        vespineCost == 200 &&
                        supply == 3)
                        return UnitId.ZuViper;
                }

                if (maximumTime.Equals(3276800))
                    return UnitId.ZuInfestor;

                if (maximumTime.Equals(3604480))
                    return UnitId.ZuUltra;

            }

            #endregion

            #region Upgrades

            #region Evolution Chamber

            if (structureBuildFrom.Equals(UnitId.ZbEvolutionChamber))
            {
                if (logicalId.Equals(0x10000))
                    return UnitId.ZupGroundM1;

                if (logicalId.Equals(0x10001))
                    return UnitId.ZupGroundM2;

                if (logicalId.Equals(0x10002))
                    return UnitId.ZupGroundM3;

                if (logicalId.Equals(0x10003))
                    return UnitId.ZupGroundA1;

                if (logicalId.Equals(0x10004))
                    return UnitId.ZupGroundA2;

                if (logicalId.Equals(0x10005))
                    return UnitId.ZupGroundA3;

                if (logicalId.Equals(0x10006))
                    return UnitId.ZupGroundW1;

                if (logicalId.Equals(0x10007))
                    return UnitId.ZupGroundW2;

                if (logicalId.Equals(0x10008))
                    return UnitId.ZupGroundW3;
            }

            #endregion

            #region Spire/ Greater Spire

            if (structureBuildFrom.Equals(UnitId.ZbSpire) ||
                structureBuildFrom.Equals(UnitId.ZbGreaterspire))
            {
                if (logicalId.Equals(0x10000))
                    return UnitId.ZupAirW1;

                if (logicalId.Equals(0x10001))
                    return UnitId.ZupAirW2;

                if (logicalId.Equals(0x10002))
                    return UnitId.ZupAirW3;

                if (logicalId.Equals(0x10003))
                    return UnitId.ZupAirA1;

                if (logicalId.Equals(0x10004))
                    return UnitId.ZupAirA2;

                if (logicalId.Equals(0x10005))
                    return UnitId.ZupAirA3;
            }

            #endregion

            #region Hydra Den

            if (structureBuildFrom.Equals(UnitId.ZbHydraDen))
            {
                if (logicalId.Equals(0x10002))
                    return UnitId.ZupGroovedSpines;

                if (logicalId.Equals(0x10003))
                    return UnitId.ZupMuscularAugments;
            }

            #endregion

            #region Roach Warran

            if (structureBuildFrom.Equals(UnitId.ZbRoachWarren))
            {
                if (logicalId.Equals(0x10001))
                    return UnitId.ZupGlialReconstruction;

                if (logicalId.Equals(0x10002))
                    return UnitId.ZupTunnelingClaws;
            }

            #endregion

            #region Infestation Pit

            if (structureBuildFrom.Equals(UnitId.ZbInfestationPit))
            {
                if (logicalId.Equals(0x10002))
                    return UnitId.ZupPathoglenGlands;

                if (logicalId.Equals(0x10003))
                    return UnitId.ZupNeutralParasite;

                if (logicalId.Equals(0x10004))
                    return UnitId.ZupEnduringLocusts;

                if (logicalId.Equals(0x10005))
                    return UnitId.ZupFlyingLocust;
            }

            #endregion

            #region Spawning Pool

            if (structureBuildFrom.Equals(UnitId.ZbSpawningPool))
            {
                if (logicalId.Equals(0x10000))
                    return UnitId.ZupAdrenalGlands;

                if (logicalId.Equals(0x10001))
                    return UnitId.ZupMetabolicBoost;
            }

            #endregion

            #region Baneling Nest

            if (structureBuildFrom.Equals(UnitId.ZbBanelingNest))
            {
                if (logicalId.Equals(0x10000))
                    return UnitId.ZupCentrifugalHooks;
            }

            #endregion

            #region Ultra Cavern

            if (structureBuildFrom.Equals(UnitId.ZbUltraCavern))
            {
                if (logicalId.Equals(0x10002))
                    return UnitId.ZupChitinousPlating;
            }

            #endregion

            #endregion

            /* Missing: Broodlord Cocoon and Overseer Cocoon - Cant be found.. */
            #endregion

            return UnitId.None;
        }
Example #16
0
        /// <summary>
        /// Returns the string-based key for the specified AST node ID.
        /// </summary>
        /// <param name="id">The AST node ID to examine.</param>
        /// <returns>The string-based key for the specified AST node ID.</returns>
        public override String GetKey(Int32 id)
        {
            var fields = typeof (JsonAstNodeId).GetFields((BindingFlags.Public | BindingFlags.Static));
            for (var index = 0; (index < fields.Length); index = (index + 1))
            {
                var field = fields[index];
                if (id.Equals(field.GetValue(null)))
                    return field.Name;
            }

            return null;
        }
        public ActionResult DeleteAmendment(Int32 projectVersionId, Int32 previousProjectVersionId)
        {
            //throw new NotImplementedException();
            CycleAmendment amendment = new CycleAmendment()
            {
                //LocationMapPath = _config.LocationMapPath,
                ProjectVersionId = projectVersionId
            };

            IDeleteStrategy strategy = new DeleteStrategy(this._rtpProjectRepository, amendment).PickStrategy();
            int returnId = strategy.Delete();
            previousProjectVersionId = !returnId.Equals(default(int)) ? returnId : previousProjectVersionId;

            if (!previousProjectVersionId.Equals(default(int)))
            {
                return RedirectToAction("Details", new { controller = "RtpProject", id = previousProjectVersionId });
            }

            string returnUrl = HttpContext.Request.UrlReferrer.PathAndQuery ?? String.Empty;

            if (!String.IsNullOrEmpty(returnUrl))
            {
                return Redirect(returnUrl);
            }
            return RedirectToAction("Index", new { controller = "Rtp", year = String.Empty });
        }
Example #18
0
 /// <summary>
 /// Given the properties of an operator, gets its return type
 /// </summary>
 public static Int32 GetReturnType(String opName, Int32 lType, Int32 rType, Int32 precedance)
 {
     foreach (var op in Operators)
     {
         if (op.Name.Equals(opName) && precedance.Equals(op.Precedance) &&
             CheckTypesAreEqual(op.LType, lType) && CheckTypesAreEqual(op.RType, rType))
             return op.RetType;
     }
     return -1;
 }