bitworks/hwo.bitworks/LogicBase.cs

35 lines
764 B
C#

using System;
using System.Collections.Generic;
using hwo.bitworks.identity;
namespace hwo.bitworks
{
public abstract class LogicBase
{
protected LogicBase[] sources;
public LogicBase(LogicBase[] sources)
{
this.sources = new LogicBase[sources.Length];
Array.Copy(sources,this.sources,sources.Length);
}
public virtual bool value(){
throw new NotImplementedException(String.Format("Class {0} doesn't implement needed method 'bool value()'",this.GetType().FullName));
}
public abstract BitIdentity identity();
public BitIdentity[] identities(LogicBase[] sources){
BitIdentity[] bids = new BitIdentity[sources.Length];
for (int n=0;n<sources.Length;n++){
bids[n] = sources[n].identity();
}
return bids;
}
}
}