Removed references to a Variable's factory from Variable itself. They were used early on in debugging.

This commit is contained in:
Jeff Moser 2010-05-02 21:26:31 -04:00
parent 9bc97fa1c3
commit 6a47da245f
6 changed files with 4 additions and 10 deletions

@ -5,15 +5,11 @@ namespace Moserware.Skills.FactorGraphs
public class Variable<TValue>
{
private readonly string _Name;
private readonly VariableFactory<TValue> _ParentFactory;
private readonly TValue _Prior;
private int _ParentIndex;
public Variable(string name, VariableFactory<TValue> parentFactory, int parentIndex, TValue prior)
public Variable(string name, TValue prior)
{
_Name = "Variable[" + name + "]";
_ParentFactory = parentFactory;
_ParentIndex = parentIndex;
_Prior = prior;
ResetToPrior();
}
@ -34,7 +30,7 @@ namespace Moserware.Skills.FactorGraphs
public class DefaultVariable<TValue> : Variable<TValue>
{
public DefaultVariable()
: base("Default", null, 0, default(TValue))
: base("Default", default(TValue))
{
}
@ -48,7 +44,7 @@ namespace Moserware.Skills.FactorGraphs
public class KeyedVariable<TKey, TValue> : Variable<TValue>
{
public KeyedVariable(TKey key, string name, VariableFactory<TValue> parentFactory, int parentIndex, TValue prior)
: base(name, parentFactory, parentIndex, prior)
: base(name, prior)
{
Key = key;
}

@ -17,9 +17,7 @@ namespace Moserware.Skills.FactorGraphs
public Variable<TValue> CreateBasicVariable(string nameFormat, params object[] args)
{
var newVar = new Variable<TValue>(
String.Format(nameFormat, args),
this,
_CreatedVariables.Count,
String.Format(nameFormat, args),
_VariablePriorInitializer());
_CreatedVariables.Add(newVar);