Exemplo n.º 1
0
        /*
         *        METHODS: UPDATES
         */
        internal void OnGM(int indGlyph, DefsGM.TypeGM typeGM, bool isCaller)
        {
            Glyph glyph = this.gStore.GGet(indGlyph);

            if ((isCaller) && (glyph == null))
            {
                throw new ExceptionGlyph("FManager", "OnGM", "Null argument");
            }
            ArrayList arrCompDep = this.grel.GetCompDep(indGlyph);

            if (arrCompDep != null)
            {
                foreach (int indCompDep in arrCompDep)
                {
                    this.OnGM(indCompDep, typeGM, false);
                }
            }

            /*
             *        IN ANY CASE
             */
            // clear self-errors on SourceValidator
            if (isCaller && DefsGM.IsSourceValidator(typeGM))
            {
                this.gerrPool.ClearByGV(indGlyph, DefsGV.From(typeGM));
            }

            //    INVALIDATION TABLE:
            //
            //                            Itself              Dependents
            //                       VSrc VBind VPure     VSrc VBind VPure
            //
            //    Validator SOURCE    No     Yes   Yes       No      Yes   Yes
            //
            //    Validator BINDING    No     No       Yes       No   Yes   Yes
            //
            //    MODIFIER PURE        Yes  Yes   Yes       Yes  Yes   Yes
            //                      |                     |
            //                        BUT: does not clear errors
            //                             VSrc clears its errors by itself

            if (DefsGM.IsSourceValidator(typeGM))
            {
                //    ValidateTypeGlyphSource
                //    ValidateSimpSource
                //    ValidateCompBind
                foreach (DefsGV.TypeGV typeGV in Enum.GetValues(typeof(DefsGV.TypeGV)))
                {
                    if (DefsGV.IsTest(typeGV))
                    {
                        // invalidate & clear errors
                        if (DefsGV.IsSourceValidator(typeGV))
                        {
                            continue;
                        }
                        glyph.StatusVal(typeGV).IsValid = false;
                        this.gerrPool.ClearByGV(indGlyph, typeGV);
                    }
                }
            }
            else if (typeGM == DefsGM.TypeGM.ValidateCompBind)
            {
                //    ValidateCompBind
                foreach (DefsGV.TypeGV typeGV in Enum.GetValues(typeof(DefsGV.TypeGV)))
                {
                    if (DefsGV.IsTest(typeGV))
                    {
                        if (DefsGV.IsSourceValidator(typeGV))
                        {
                            continue;
                        }
                        if (isCaller && (typeGV == DefsGV.TypeGV.ValidateCompBind))
                        {
                            continue;
                        }
                        glyph.StatusVal(typeGV).IsValid = false;
                        this.gerrPool.ClearByGV(indGlyph, typeGV);
                    }
                }
            }
            else
            {
                // Pure Modifier
                foreach (DefsGV.TypeGV typeGV in Enum.GetValues(typeof(DefsGV.TypeGV)))
                {
                    if (DefsGV.IsTest(typeGV))
                    {
                        glyph.StatusVal(typeGV).IsValid = false;
                        if (!DefsGV.IsSourceValidator(typeGV))
                        {
                            this.gerrPool.ClearByGV(indGlyph, typeGV);
                        }
                    }
                }
            }
            if (!this.indGM.Contains(indGlyph))
            {
                this.indGM.Add(indGlyph);
            }
        }
Exemplo n.º 2
0
        /*
         *        METHODS: UPDATES
         */
        internal void OnGM(int indGlyph, DefsGM.TypeGM typeGM, bool isCaller)
        {
            Glyph glyph=this.gStore.GGet(indGlyph);
            if ((isCaller)&&(glyph==null))
            {
                throw new ExceptionGlyph("FManager","OnGM","Null argument");
            }
            ArrayList arrCompDep=this.grel.GetCompDep(indGlyph);
            if (arrCompDep!=null)
            {
                foreach (int indCompDep in arrCompDep)
                {
                    this.OnGM(indCompDep, typeGM, false);
                }
            }
            /*
             *        IN ANY CASE
             */
            // clear self-errors on SourceValidator
            if (isCaller && DefsGM.IsSourceValidator(typeGM))
            {
                this.gerrPool.ClearByGV(indGlyph,DefsGV.From(typeGM));
            }

            //    INVALIDATION TABLE:
            //
            //                            Itself              Dependents
            //                       VSrc VBind VPure     VSrc VBind VPure
            //
            //    Validator SOURCE    No     Yes   Yes       No      Yes   Yes
            //
            //    Validator BINDING    No     No       Yes       No   Yes   Yes
            //        
            //    MODIFIER PURE        Yes  Yes   Yes       Yes  Yes   Yes
            //                      |                     |
            //                        BUT: does not clear errors
            //                             VSrc clears its errors by itself

            if (DefsGM.IsSourceValidator(typeGM))
            {
                //    ValidateTypeGlyphSource
                //    ValidateSimpSource
                //    ValidateCompBind
                foreach (DefsGV.TypeGV typeGV in Enum.GetValues(typeof(DefsGV.TypeGV)))
                {
                    if (DefsGV.IsTest(typeGV))
                    {
                        // invalidate & clear errors
                        if (DefsGV.IsSourceValidator(typeGV))
                            continue;
                        glyph.StatusVal(typeGV).IsValid=false;
                        this.gerrPool.ClearByGV(indGlyph,typeGV);    
                    }
                }
            }
            else if (typeGM==DefsGM.TypeGM.ValidateCompBind)
            {
                //    ValidateCompBind
                foreach (DefsGV.TypeGV typeGV in Enum.GetValues(typeof(DefsGV.TypeGV)))
                {
                    if (DefsGV.IsTest(typeGV))
                    {
                        if (DefsGV.IsSourceValidator(typeGV))
                            continue;
                        if (isCaller&&(typeGV==DefsGV.TypeGV.ValidateCompBind))
                            continue;
                        glyph.StatusVal(typeGV).IsValid=false;
                        this.gerrPool.ClearByGV(indGlyph,typeGV);
                    }
                }
            }
            else
            {
                // Pure Modifier
                foreach (DefsGV.TypeGV typeGV in Enum.GetValues(typeof(DefsGV.TypeGV)))
                {
                    if (DefsGV.IsTest(typeGV))
                    {
                        glyph.StatusVal(typeGV).IsValid=false;
                        if (!DefsGV.IsSourceValidator(typeGV))
                        {
                            this.gerrPool.ClearByGV(indGlyph,typeGV);
                        }
                    }
                }
            }
            if (!this.indGM.Contains(indGlyph))
                this.indGM.Add(indGlyph);    
        }
Exemplo n.º 3
0
 public static bool IsModifier(TypeGV typeGV)
 {
     return(DefsGM.From(typeGV) != DefsGM.TypeGM.Invalid);
 }
Exemplo n.º 4
0
        private void CallGV(DefsGV.TypeGV typeGV)
        {
            /*
             *        TRY/CATCH function
             */

            /*
             *        MEANING:    UNCONDITIONAL call of action
             */

            GErrList gerrlist = null;

            try
            {
                this.statusGV[(int)typeGV].StatusExec = StatusGV.TypeStatusExec.Aborted;
                this.statusGV[(int)typeGV].StatusRes  = StatusGV.TypeStatusRes.Undef;
                gerrlist = new GErrList();

                if (DefsGV.IsModifier(typeGV))
                {
                    this.fm.OnGM(this.index, DefsGM.From(typeGV), true);
                }

                // check that pre-required tests are performed
                if (!this.CanBeExec(typeGV))
                {
                    this.statusGV[(int)typeGV].StatusExec =
                        StatusGV.TypeStatusExec.UnableToExec;
                }

                // call Validate.. function
                System.Exception excValidation = null;
                if (this.statusGV[(int)typeGV].StatusExec !=
                    StatusGV.TypeStatusExec.UnableToExec)
                {
                    try
                    {
                        string     strTypeCV  = Enum.GetName(typeof(DefsGV.TypeGV), typeGV);
                        MethodInfo infoMethod = this.GetType().GetMethod(strTypeCV,
                                                                         System.Reflection.BindingFlags.Instance |
                                                                         System.Reflection.BindingFlags.NonPublic);
                        if (infoMethod != null)
                        {
                            object[] pars = { gerrlist };

                            // statusGV can be set to:
                            // Completed || UnableToExec || Aborted
                            try
                            {
                                this.statusGV[(int)typeGV].StatusExec = (StatusGV.TypeStatusExec)
                                                                        infoMethod.Invoke(this, pars);
                            }
                            catch (System.Reflection.TargetInvocationException TIException)
                            {
                                throw TIException.InnerException;
                            }

                            GErrSign.Sign(gerrlist, typeGV, this.index);
                        }
                        if (this.statusGV[(int)typeGV].StatusExec ==
                            StatusGV.TypeStatusExec.Completed)
                        {
                            this.statusGV[(int)typeGV].StatusRes =
                                gerrlist.StatusResGV(typeGV);
                        }
                    }
                    catch (System.Exception exc)
                    {
                        excValidation = exc;
                        this.statusGV[(int)typeGV].StatusExec =
                            StatusGV.TypeStatusExec.Aborted;
                    }
                }

                if (this.statusGV[(int)typeGV].StatusExec !=
                    StatusGV.TypeStatusExec.Completed)
                {
                    this.CleanUpOnNonCompletedGV(typeGV);
                    GErrValidation gerrVal = new GErrValidation(this.index,
                                                                this.typeGlyph,
                                                                typeGV,
                                                                this.statusGV[(int)typeGV].StatusExec,
                                                                excValidation);
                    gerrlist.Add(gerrVal);
                }

                GErrSign.Sign(gerrlist, typeGV, this.index);
                this.fm.OnGV(this.index, typeGV, gerrlist);
                gerrlist.ClearRelease();
            }

            catch (Exception excManagement) // exception thrown by the fm management structures
            {
                this.statusGV[(int)typeGV].StatusExec =
                    StatusGV.TypeStatusExec.Aborted;
                this.CleanUpOnNonCompletedGV(typeGV);    // T/C function
                GErrValidation gerrVal = new GErrValidation(this.index,
                                                            this.typeGlyph,
                                                            typeGV,
                                                            StatusGV.TypeStatusExec.Aborted,
                                                            excManagement);
                this.fm.ReportFailure(gerrVal);            // T/C function
                if (gerrlist != null)
                {
                    try { gerrlist.ClearRelease(); }
                    catch (Exception) {}
                }
            }
        }
Exemplo n.º 5
0
 public static TypeGV From(DefsGM.TypeGM typeGM)
 {
     string strTypeGM=Enum.GetName(typeof(DefsGM.TypeGM),typeGM);
     object obj;
     try
     {
         obj=Enum.Parse(typeof(DefsGV.TypeGV),strTypeGM);
     }
     catch
     {
         return DefsGV.TypeGV.Invalid;
     }
     return (DefsGV.TypeGV)obj;
 }
Exemplo n.º 6
0
        private void CallGM(DefsGM.TypeGM typeGM, params object[] pars)
        {
            /*
             *        MEANING: UNCONDITIONAL call of action
             */
            this.fm.OnGM(this.index,typeGM,true);

            string strTypeGM=Enum.GetName(typeof(DefsGM.TypeGM),typeGM);
            MethodInfo infoMethod=typeof(Glyph).GetMethod(strTypeGM);
            try
            {
                infoMethod.Invoke(this,pars);
            }
            catch(System.Reflection.TargetInvocationException TIException)
            {
                throw TIException.InnerException;
            }
        }