//------------------------------------------------------------------------- // FILE: MetricTool_B.cs // AUTH: JHF, 15.1.2004 // PURP: Compileable code *frame* that implements the (parts of the) design // of variant B. // COMP: csc /out:MetricTool.dll /target:library /nowarn:169 MetricTool_B.cs // NOTE: Ignore compiler warnings "The private field ... is never used" // (/nowarn:169) at this stage of the implementation. //------------------------------------------------------------------------- using System; //-- import Type using System.Collections; //-- import ArrayList, ICollection //------------------------------------------------------------------------- public enum ECalculationBase { eLOC1, eLOC2, eComment } //------------------------------------------------------------------------- public abstract class CCounter { //-- Public attributes: Counting public virtual int Sum { get { return 0; } set { } } public CVersion Version { get { return null; } set { } } //-- Public attributes: Configuring public CCompositeCounter Container { get { return null; } set { } } //-- Private instance data private CCompositeCounter _container = null; //-- Attention: _countainer circularly couples base- and subclass. } //-- CCounter //------------------------------------------------------------------------- public abstract class CCompositeCounter : CCounter { //-- Public methods: Counting public virtual float Average() { return 0.0F; } public virtual IDictionary SumPerElement() { return null; } //-- Public methods: Configuring public void Accept(Type element) { this._accepting = element; } public void Add(CCounter element) { return; } public void Del(CCounter element) { return; } public bool Contains(CCounter element) { return false; } public CCounter Elements(int at) { return null; } public ICollection Elements() { return null; } //-- Private instance data private Type _accepting = null; } //-- CCompositeCounter //------------------------------------------------------------------------- public abstract class CFileSystemElement : CCompositeCounter { } //-- CFileSystemElement //------------------------------------------------------------------------- public class CDirectory : CFileSystemElement { //-- Private instance data private CVersion _version = null; } //-- CDirectory //------------------------------------------------------------------------- public class CFile : CFileSystemElement { //-- Private instance data private CDeveloper _developer = null; } //-- CFile //------------------------------------------------------------------------- public class CClass : CCompositeCounter { //-- Private instance data private ArrayList _supers = null; //-- Only objects of class CClass ordered by the inheritance path. private ArrayList _subs = null; //-- Only objects of class CClass without a defined order. } //-- CClass //------------------------------------------------------------------------- public class CMethod : CCounter { //-- Public attributes: Counting public int Loc { get { return 0; } set { } } public ECalculationBase Base { get { return ECalculationBase.eLOC1; } set { } } } //-- CMethod //------------------------------------------------------------------------- public class CVersion { //-- Private instance data private CDirectory _toplevel = null; } //-- CVersion //------------------------------------------------------------------------- public class CDeveloper { //-- Private instance data private ArrayList _responsible = null; //-- Only objects of class CFile. } //-- CDeveloper //------------------------------------------------------------------------- //-- eof