Table of Contents

Class Command

Namespace
BOOSE
Assembly
BOOSE.dll

Abstract class for BOOSE commands. Can handle a parameter list or expression. This class will seperate the parameters or expression from the command and store in the "ParameterList". The Command's Compile() method is called by the parser and this is expected to set the Command's parameters. BOOSE implementation of commands makes definitions "sealed". Sealed classes cannot be inherited, so you can't use what's there to remove the restrictions, you will have to totally rewrite them.

public abstract class Command : ICommand
Inheritance
Command
Implements
Derived
Inherited Members

Constructors

Command()

designed to be used with ProgramFactory so should not call constructor

public Command()

Fields

IsDouble

protected bool IsDouble

Field Value

bool

parameterList

protected string parameterList

Field Value

string

parameters

protected string[] parameters

Field Value

string[]

paramsint

protected int[] paramsint

Field Value

int[]

program

protected StoredProgram program

Field Value

StoredProgram

Properties

Name

returns the name type of this command as a string.

public string Name { get; }

Property Value

string

ParameterList

public string ParameterList { get; }

Property Value

string

Parameters

public string[] Parameters { get; set; }

Property Value

string[]

Paramsint

public int[] Paramsint { get; set; }

Property Value

int[]

Program

public StoredProgram Program { get; set; }

Property Value

StoredProgram

Methods

CheckParameters(string[])

Derived commandas must provide a method to check that their parameters are ok and throw relevant exceptions if not.

public abstract void CheckParameters(string[] parameter)

Parameters

parameter string[]

Compile()

Called when Command added to the Program

public virtual void Compile()

Execute()

Generic Execute() checks a command's parameter list and converts any variables and expressions to literal values Should be called (base.Execute() from derived Command classes before the derived Command uses the parameters to do its job. Derived Command should check it has the correct number of parameters and throw a CommandException if not.

public virtual void Execute()

ProcessParameters(string)

Converts a string containing parameters to seperate parameters. Given a raw, single string parameter list, seperated by commas this splits into seperate strings and returns in the out Params.

public int ProcessParameters(string ParameterList)

Parameters

ParameterList string

Returns

int

Number of parameters

Set(StoredProgram, string)

Set a Command Object

public virtual void Set(StoredProgram Program, string Params)

Parameters

Program StoredProgram

Reference to valid StoredProgram

Params string

Original parameter list e.g. "num1,num2"

ToString()

returns name and parameter list as a string suitable for reparsing.

public override string ToString()

Returns

string