Example #1
0
        static public void Parse(GErr gerr,
                                 out DefsGV.TypeGV typeGV, out int[] indsGlyph)
        {
            typeGV    = DefsGV.TypeGV.Invalid;
            indsGlyph = null;
            string strSign = gerr.SignCreator;

            if (strSign == null)
            {
                throw new ExceptionGlyph("GErrSign", "Parse", null);
            }
            string[] strs = strSign.Split('_');
            if (strs.Length < 1)
            {
                throw new ExceptionGlyph("GErrSign", "Parse", null);
            }
            typeGV = (DefsGV.TypeGV)Enum.Parse(typeof(DefsGV.TypeGV), strs[0]);
            if ((strs.Length) > 1)
            {
                indsGlyph = new int[strs.Length - 1];
            }
            for (int iInd = 1; iInd < strs.Length; iInd++)
            {
                indsGlyph[iInd] = Int32.Parse(strs[iInd]);
            }
        }
Example #2
0
 private bool NeedsActionForValidate(DefsGV.TypeGV typeGV)
 {
     if (DefsGV.IsSourceValidator(typeGV))
     {
         return(this.statusGV[(int)typeGV].StatusExec ==
                StatusGV.TypeStatusExec.NeverExec);
     }
     return(!this.statusGV[(int)typeGV].IsValid);
 }
Example #3
0
 static public void Sign(GErrList gerrlist, DefsGV.TypeGV typeGV, params int[] indsGlyph)
 {
     if (gerrlist == null)
     {
         throw new ExceptionGlyph("GErrSign", "Sign", "Null argument");
     }
     foreach (GErr gerr in gerrlist)
     {
         Sign(gerr, typeGV, indsGlyph);
     }
 }
Example #4
0
        public static TypeGM From(DefsGV.TypeGV typeGV)
        {
            string strTypeGV = Enum.GetName(typeof(DefsGV.TypeGV), typeGV);
            object obj;

            try
            {
                obj = Enum.Parse(typeof(DefsGM.TypeGM), strTypeGV);
            }
            catch
            {
                return(DefsGM.TypeGM.Invalid);
            }
            return((DefsGM.TypeGM)obj);
        }
Example #5
0
 private bool CanBeExec(DefsGV.TypeGV typeGV)
 {
     DefsGV.TypeGV[] typesPreRequired = DefsGV.GetTestsPreRequired(typeGV);
     if (typesPreRequired != null)
     {
         foreach (DefsGV.TypeGV typePreRequired in typesPreRequired)
         {
             if (!this.CanExecDepend(typePreRequired))
             {
                 return(false);
             }
         }
     }
     return(true);
 }
Example #6
0
        static public void Sign(GErr gerr, DefsGV.TypeGV typeGV, params int[] indsGlyph)
        {
            if (gerr == null)
            {
                throw new ExceptionGlyph("GErrSign", "Sign", "NullArgument");
            }
            StringBuilder sb = new StringBuilder("");

            sb.Append(Enum.GetName(typeof(DefsGV.TypeGV), typeGV));
            sb.Append("_");
            foreach (int indGlyph in indsGlyph)
            {
                sb.Append(indGlyph + "_");
            }
            gerr.SignCreator = sb.ToString();
        }
Example #7
0
        /*
         *        METHODS : CALLS
         */

        private bool CanExecDepend(DefsGV.TypeGV typePreRequired)
        {
            if ((this.typeGlyph != GConsts.TypeGlyph.Simple) &&
                (this.typeGlyph != GConsts.TypeGlyph.Composite))
            {
                throw new ExceptionGlyph("Glyph", "CanExecDepend", null);
            }
            if ((this.typeGlyph == GConsts.TypeGlyph.Composite) &&
                (DefsGV.IsPureSimp(typePreRequired)))
            {
                return(true);
            }

            if (this.statusGV[(int)typePreRequired].StatusExec !=
                StatusGV.TypeStatusExec.Completed)
            {
                return(false);
            }

            switch (typePreRequired)
            {
            case DefsGV.TypeGV.ValidateTypeGlyphSource:
                return(this.typeGlyph != GConsts.TypeGlyph.Undef);

            case DefsGV.TypeGV.ValidateSimpSource:
                return((this.bbox != null) && (this.outl != null));

            case DefsGV.TypeGV.ValidateCompSource:
                return((this.bbox != null) && (this.comp != null));

            case DefsGV.TypeGV.ValidateCompBind:
                if (!this.statusGV[(int)typePreRequired].IsValid)
                {
                    return(false);
                }
                return((this.bbox != null) && (this.comp != null) && (this.outl != null));

            default:
                if (!this.statusGV[(int)typePreRequired].IsValid)
                {
                    return(false);
                }
                return(true);
            }
        }
Example #8
0
        /*
         *        METHODS: clear
         */

        internal void ClearByGV(int indGlyph, DefsGV.TypeGV typeGV)
        {
            GErrList gerrlist = this.gerrlists[indGlyph] as GErrList;

            if (gerrlist == null)
            {
                return;
            }
            for (int poz = gerrlist.Length - 1; poz >= 0; poz--)
            {
                GErr gerr = gerrlist[poz];
                if (GErrSign.DICFunc_IsSignedBy(gerr, typeGV) &&
                    GErrSign.DICFunc_IsSignedBy(gerr, indGlyph))
                {
                    this.DIAFunc_DeleteFromPool(gerr);
                }
            }
        }
Example #9
0
        static public bool DICFunc_IsSignedBy(ValInfoBasic info, DefsGV.TypeGV typeGV)
        {
            GErr gerr = info as GErr;

            if (gerr == null)
            {
                throw new ExceptionGlyph("GErrSign", "DICFunc_IsSignedBy", null);
            }
            string strSign = gerr.SignCreator;

            if (strSign == null)
            {
                throw new ExceptionGlyph("GErrSign", "DICFunc_IsSignedBy", null);
            }
            string strTypeGV = Enum.GetName(typeof(DefsGV.TypeGV), typeGV);

            return(strSign.StartsWith(strTypeGV));
        }
Example #10
0
 // indexer
 override public bool this [object flag]
 {
     get
     {
         if (!Enum.IsDefined(typeof(DefsGV.TypeGV), flag))
         {
             throw new ExceptionGlyph("FlagsGV", "indexer(get)", null);
         }
         return((bool)this.vals[(int)flag]);
     }
     set
     {
         if (!Enum.IsDefined(typeof(DefsGV.TypeGV), flag))
         {
             throw new ExceptionGlyph("FlagsGV", "indexer(set)", null);
         }
         DefsGV.TypeGV typeGV = (DefsGV.TypeGV)flag;
         if (value == true)
         {
             this.vals[(int)typeGV] = true;
             DefsGV.TypeGV[] typesPreRequired = DefsGV.GetTestsPreRequired(typeGV);
             if (typesPreRequired != null)
             {
                 foreach (DefsGV.TypeGV typePreRequired in typesPreRequired)
                 {
                     this.vals[(int)typePreRequired] = true;
                 }
             }
         }
         else
         {
             this.vals[(int)typeGV] = false;
             DefsGV.TypeGV[] typesDependent = DefsGV.GetTestsDependent(typeGV);
             if (typesDependent != null)
             {
                 foreach (DefsGV.TypeGV typeDependent in typesDependent)
                 {
                     this.vals[(int)typeDependent] = false;
                 }
             }
         }
     }
 }
Example #11
0
        private bool NeedsActionForReset(DefsGV.TypeGV typeGV)
        {
            if (DefsGV.IsPureValidator(typeGV))
            {
                return(false);
            }
            if ((typeGV == DefsGV.TypeGV.ValidateSimpSource) &&
                (this.typeGlyph == GConsts.TypeGlyph.Composite))
            {
                return(false);
            }
            if ((typeGV == DefsGV.TypeGV.ValidateCompSource) &&
                (this.typeGlyph == GConsts.TypeGlyph.Simple))
            {
                return(false);
            }
            int ind = (int)typeGV;

            return(!this.statusGV[(int)typeGV].IsValid);
        }
Example #12
0
 public GErrValidation(int indGlyph, 
     GConsts.TypeGlyph typeGlyph,
     DefsGV.TypeGV typeGV,
     StatusGV.TypeStatusExec statusExec,
     Exception exception) :
     base(indGlyph,typeGlyph,exception)
 {
     this.typeGV=typeGV;
     this.statusExec=statusExec;
     switch (statusExec)
     {
         case StatusGV.TypeStatusExec.Aborted:
             base.m_Type=ValInfoBasic.ValInfoType.AppError;
             base.Name="GERR_VAL_ABORTED";
             base.Severity=GErr.TypeGErrSeverity.High;
             break;
         case StatusGV.TypeStatusExec.UnableToExec:
             base.m_Type=ValInfoBasic.ValInfoType.AppError;
             base.Name="GERR_VAL_UNABLE_TO_PERFORM_TEST";
             base.Severity=GErr.TypeGErrSeverity.Low;
             break;
         default:        // should not occur
             break;
     }
     GErrSign.Sign(this,this.typeGV,this.indexGlyphOwner);
 }
Example #13
0
        private void CleanUpOnNonCompletedGV(DefsGV.TypeGV typeGV)
        {
            /*
             *        TRY/CATCH function
             */
            switch (typeGV)
            {
            case DefsGV.TypeGV.ValidateTypeGlyphSource:
                this.typeGlyph = GConsts.TypeGlyph.Undef;
                break;

            case DefsGV.TypeGV.ValidateSimpSource:
                if (this.bbox != null)
                {
                    this.bbox = null;
                }
                if (this.outl != null)
                {
                    try
                    {
                        this.outl.ClearDestroy();
                    }
                    catch (System.Exception)
                    {
                    }
                    this.outl = null;
                }
                break;

            case DefsGV.TypeGV.ValidateCompSource:
                if (this.bbox != null)
                {
                    this.bbox = null;
                }
                if (this.comp != null)
                {
                    try
                    {
                        this.comp.ClearDestroy();
                    }
                    catch (System.Exception)
                    {
                    }
                    this.comp = null;
                }
                break;

            case DefsGV.TypeGV.ValidateCompBind:
                if (this.outl != null)
                {
                    try
                    {
                        this.outl.ClearDestroy();
                    }
                    catch (System.Exception)
                    {
                    }
                    this.outl = null;
                }
                break;
            }

            /*
             * private int index;
             * private GConsts.TypeGlyph typeGlyph;
             * BoxD        bbox;
             * Outline        outl;
             * Composite    comp;
             * private FManager        fm;
             * private StatusGV[]        statusGV;
             */
        }
Example #14
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) {}
                }
            }
        }
Example #15
0
        /*
         *        METHODS : ACCESS
         */

        internal StatusGV StatusVal(DefsGV.TypeGV typeGV)
        {
            return(this.statusGV[(int)typeGV]);
        }