Artificial Intelligence
Artificial Intelligence
Information

ChainingResult.Count property


      Returns the number of results.


Namespace : ielib
Assembly : ielib.dll

public int Count { get; }

Property value

Type : System.int

The number of facts actually contained in the result.


Example : Display the result in a DataGridView control.


private void Run(InferenceEngine ie, DataGridView gv)
{
ChainingResult result = ie.Run();
DataGridViewRow row;
Fact f;

for (int i = 0; I < result.Count; i++)
{
      f = result[i];
      row = gv.Rows.Add();
      DisplayResult(f, row.Cells[1]);
}
}

private void DisplayResult(Fact f, DataGridViewCell cell)
{
      switch(f.Type)
      {
      case Fact.DataType.Bool :
      bool b = (bool)f.Value;
      cell.Value = b.ToString();
      break;
      case Fact.DataType.Real :
      double d = (double)f.Value;
      cell.Value = d.ToString() ;
      break;
      case Fact.DataType.Symbol :
      cell.Value = (string)f.Value;
      break;
      default: break;
      }
}