コード例 #1
0
        protected void Add(Particle particle)
        {
            IInteractStrong strong = particle as IInteractStrong;

            if (strong == null)
            {
                throw new Exception("INVALID HADRONIC STRUCTURE!");
            }

            bottomness  += strong.Bottomness;
            topness     += strong.Topness;
            strangeness += strong.Strangeness;
            charmness   += strong.Charmness;
            isospinZ    += strong.IsospinZ;
            hypercharge += strong.Hypercharge;

            IInteractElectromagnetic eCharged = particle as IInteractElectromagnetic;

            if (eCharged != null)
            {
                electricCharge += eCharged.ElectricCharge;
            }

            this.constituents.Add(particle);
        }
コード例 #2
0
        protected bool Colorless()
        {
            int red   = 0;
            int green = 0;
            int blue  = 0;

            int count = constituents.Count;

            for (int i = 0; i < count; i++)
            {
                IInteractStrong particle = constituents[i] as IInteractStrong;

                ColorCharge charge = particle.Color.Charge;
                switch (charge)
                {
                case ColorCharge.RED:
                    red++; break;

                case ColorCharge.GREEN:
                    green++; break;

                case ColorCharge.BLUE:
                    blue++; break;

                case ColorCharge.ANTIRED:
                    red--; break;

                case ColorCharge.ANTIGREEN:
                    green--; break;

                case ColorCharge.ANTIBLUE:
                    blue--; break;

                default:
                    break;
                }
            }
            return((red == green && green == blue) ? true : false);
        }
コード例 #3
0
ファイル: Quark.cs プロジェクト: carlhuth/GenXSource
        public AntiQuark(T particle) : base(particle)
        {
            IInteractStrong quark = particle as IInteractStrong;

            switch (quark.Color.Charge)
            {
            case ColorCharge.RED:
                color = (AntiColor)(ColorFactory.GetColourFactory().GetColour(ColorCharge.ANTIRED));
                break;

            case ColorCharge.GREEN:
                color = (AntiColor)(ColorFactory.GetColourFactory().GetColour(ColorCharge.ANTIGREEN));
                break;

            case ColorCharge.BLUE:
                color = (AntiColor)(ColorFactory.GetColourFactory().GetColour(ColorCharge.ANTIBLUE));
                break;

            default:
                color = (AntiColor)(ColorFactory.GetColourFactory().GetColour(ColorCharge.ANTIRED));
                break;
            }
        }