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]); } }
public static bool IsComp(TypeGV typeGV) { if (typeGV == DefsGV.TypeGV.ValidateTypeGlyphSource) { return(true); } return(DefsGV.IsPureComp(typeGV)); }
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); }
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); } }
public static TypeGV[] GetTestsPreRequired(TypeGV typeGV) { if ((int)typeGV < 0) { return(null); } if (DefsGV.testsPreRequired == null) { DefsGV.InitTestsPreRequired(); } return(DefsGV.testsPreRequired[(int)typeGV]); }
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; }
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(); }
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); }
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); }
/* * 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); } }
// 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; } } } } }
public static TypeGV[] GetTestsDependent(TypeGV typeGV) { if ((int)typeGV < 0) { return(null); } if (DefsGV.testsPreRequired == null) { DefsGV.InitTestsPreRequired(); } int numTest = DefsGV.testsPreRequired.GetLength(0); bool[] isDependent = new bool[numTest]; int cntDependent = 0; for (int iTest = 0; iTest < numTest; iTest++) { isDependent[iTest] = false; TypeGV[] typesPre = DefsGV.testsPreRequired[iTest]; if (typesPre != null) { foreach (TypeGV typePre in typesPre) { if (typePre == typeGV) { isDependent[iTest] = true; cntDependent++; break; } } } } TypeGV[] testsDependent = new TypeGV[cntDependent]; cntDependent = 0; for (int iTest = 0; iTest < numTest; iTest++) { if (isDependent[iTest]) { testsDependent[cntDependent++] = (DefsGV.TypeGV)iTest; } } return(testsDependent); }
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); }
public static bool IsContentValidator(TypeGV typeGV) { return(DefsGV.IsTest(typeGV) && (!DefsGV.IsSourceValidator(typeGV)) && (!DefsGV.IsBindingValidator(typeGV))); }
/* * METHODS : ACCESS */ internal StatusGV StatusVal(DefsGV.TypeGV typeGV) { return this.statusGV[(int)typeGV]; }
/* * CONSTRUCTOR */ public DefsGV() { DefsGV.InitTestsPreRequired(); }
/* * 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); } } }
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); }
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; }
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); }
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) {} } } }
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) {} } } }
public static bool IsPureValidator(TypeGV typeGV) { return(!DefsGV.IsModifier(typeGV)); }
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); }
/* * 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; } }
internal void OnGV(int indGlyph, DefsGV.TypeGV typeGV, GErrList gerrlist) { Glyph glyph=this.gStore.GGet(indGlyph); if (glyph==null) { throw new ExceptionGlyph("FManager","OnGV",null); } glyph.StatusVal(typeGV).IsValid=true; bool areValidAll=true; for (int iTest=0; iTest<DefsGV.NumTest; iTest++) { if (!glyph.StatusVal((DefsGV.TypeGV)iTest).IsValid) { areValidAll=false; break; } } if (areValidAll) { this.indGM.Remove(indGlyph); } this.gerrPool.GErrListAdd(gerrlist); }
public StatusGV.TypeStatusRes StatusResGV(DefsGV.TypeGV typeGV) { StatusGV.TypeStatusRes statusCur=StatusGV.TypeStatusRes.NoErrors; foreach (GErr gerr in this.gerrs) { if (GErrSign.DICFunc_IsSignedBy(gerr, typeGV)) { if (gerr.TypeBasic==ValInfoBasic.ValInfoType.Error) { return StatusGV.TypeStatusRes.Errors; } else if (gerr.TypeBasic==ValInfoBasic.ValInfoType.Warning) { statusCur=StatusGV.TypeStatusRes.Warnings; } } } return statusCur; }
/* * 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); } }
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; */ }