using System; using System.Collections.Generic; using hwo.bitworks.identity; namespace hwo.bitworks { public class MultipleBitsSource { static Dictionary> knownSources = new Dictionary>(); static protected void register(MultipleBitsSource s){ Type t = s.GetType(); if (!knownSources.ContainsKey(t)){ knownSources.Add(t,new List()); } knownSources[t].Add(s); } protected LogicBase[] sources; public MultipleBitsSource() { register(this); this.sources = null; } public MultipleBitsSource(LogicBase[] sources) { this.sources = sources; } public virtual int getBits(){ return sources.Length; } public virtual bool bitValue(int bit){ throw new NotImplementedException(String.Format("Class {0} doesn't implement needed method 'bool bitValue(int bit)'",this.GetType().FullName)); } public LogicBase getLogicalBase(int bit){ return new BIT(this,bit); } public LogicBase[] getLogicalBases(){ return getLogicalBases(0,getBits()); } public LogicBase[] getLogicalBases(int start,int len){ LogicBase[] lb = new LogicBase[len]; for (int n=0;n