using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using CLab.Exceptions;
namespace CLab
{
///
/// The CP object contains the internal data representation, parsed from the input XML file
///
public class CP
{
private List types = new List();
private List variables = new List();
private List rules = new List();
private String description;
private String author;
private String date;
///
/// Constructor
///
/// Path to the XML file to parse input from
public CP(String XmlFilename)
{
ClabXmlParser parser = new ClabXmlParser();
parser.ParseURL(XmlFilename, this);
}
///
/// Optional header information in the XML file.
/// Description of the XML data (optional metadata)
///
public String Description
{
get { return description; }
set { description = value; }
}
///
/// Optional header information in the XML file.
/// Author of the XML data (optional metadata)
///
public String Author
{
get {return author; }
set {author = value; }
}
///
/// Optional header information in the XML file.
/// Timestamp of the XML data (optional metadata)
///
public String Date
{
get { return date; }
set { date = value; }
}
/// List of type objects in the internal data representation
public List Types
{
get { return types; }
}
/// List of variable objects in the internal data representation
public List Variables
{
get { return variables; }
}
/// List of rule (expression) objects in the internal data representation
public List Rules
{
get { return rules; }
}
///
/// Adds a type object to the internal data representation
///
/// The type object to add
public void AddType(Type newType)
{
types.Add(newType);
}
///
/// Adds a variable object to the internal data representation
///
/// The variable object to add
public void AddVariable(Variable newVariable)
{
variables.Add(newVariable);
}
///
/// Adds a rule (expression) object to the internal data representation
///
/// The rule to add
public void AddRule(Expression newRule)
{
rules.Add(newRule);
}
}
}