new public static ModelTesterDiscrete GetInstance(string modelTesterNameAndArguments) { if (modelTesterNameAndArguments.StartsWith(ModelTesterDiscreteFisher.Name)) { return(ModelTesterDiscreteFisher.GetInstance()); } else if (modelTesterNameAndArguments.StartsWith(ModelTesterDiscreteConditional.Name)) { string leafDistnName = modelTesterNameAndArguments.Substring(ModelTesterDiscreteConditional.Name.Length); DistributionDiscreteBinary distn = DistributionDiscreteBinary.GetInstance(leafDistnName); return(ModelTesterDiscreteConditional.GetInstance(distn)); } else if (modelTesterNameAndArguments.StartsWith(ModelTesterDiscreteJoint.Name)) { string altDistnName = modelTesterNameAndArguments.Substring(ModelTesterDiscreteJoint.Name.Length); DistributionDiscreteBinary nullDistn = DistributionDiscreteBinary.GetInstance("Repulsion"); // leafDistn doesn't matter DistributionDiscreteJointBinary altDistn = DistributionDiscreteJointBinary.GetInstance(altDistnName); return(ModelTesterDiscreteJoint.GetInstance(nullDistn, altDistn)); } else { throw new ArgumentException(String.Format("{0} does not start with a valid ModelTesterDiscrete name.", modelTesterNameAndArguments)); } }
protected ModelTesterDiscreteFisher() : // need a distribution that can model a variable independently working it's way down the tree. base(DistributionDiscreteBinary.GetInstance("Escape"), DistributionDiscreteBinary.GetInstance("Escape")) { }