bitworks/hwo.bitworks/LogicBase.cs

35 lines
764 B
C#
Raw Normal View History

2017-06-14 11:25:16 +02:00
using System;
using System.Collections.Generic;
2017-06-14 15:06:37 +02:00
using hwo.bitworks.identity;
2017-06-14 11:25:16 +02:00
namespace hwo.bitworks
{
2017-06-14 15:06:37 +02:00
public abstract class LogicBase
2017-06-14 11:25:16 +02:00
{
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));
}
2017-06-14 15:06:37 +02:00
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;
}
2017-06-14 11:25:16 +02:00
}
}