Class EzrClassInstance
- Namespace
- EzrSquared.Runtime.Types.Executables
- Assembly
- ezrSquared-lib.dll
The "instance of a class" type object?
public class EzrClassInstance : EzrObject, IEzrMutableObject, IMutable<IEzrMutableObject>, IEzrObject
- Inheritance
-
objectEzrClassInstance
- Implements
- Inherited Members
Constructors
EzrClassInstance(EzrClass, Reference[], Reference[], bool, Context, Node, bool, Interpreter, RuntimeResult, Context, Position, Position)
Creates a new instance of the class class
.
public EzrClassInstance(EzrClass @class, Reference[] parentReferences, Reference[] arguments, bool ignoreExtraArguments, Context context, Node body, bool readOnly, Interpreter interpreter, RuntimeResult result, Context parentContext, Position startPosition, Position endPosition)
Parameters
class
EzrClassThe parent class of the current object.
parentReferences
Reference[]The references to the class instance's parents.
arguments
Reference[]The arguments for the creation of the object.
ignoreExtraArguments
boolShould the arguments checker ignore extra arguments?
context
ContextThe internal context of the object.
body
NodeThe source code body of the object.
readOnly
boolIs the object read-only?
interpreter
InterpreterThe interpreter for executing parts of the object.
result
RuntimeResultRuntime result for carrying any errors.
parentContext
ContextThe parent context.
startPosition
PositionThe starting position of the object.
endPosition
PositionThe ending position of the object.
EzrClassInstance(EzrClass, Reference[], bool, Interpreter, Context, Context, Position, Position)
Creates a new instance of the class class
.
public EzrClassInstance(EzrClass @class, Reference[] parentReferences, bool readOnly, Interpreter interpreter, Context context, Context parentContext, Position startPosition, Position endPosition)
Parameters
class
EzrClassThe parent class of the current object.
parentReferences
Reference[]The references to the class instance's parents.
readOnly
boolIs the object read-only?
interpreter
InterpreterThe interpreter for executing parts of the object.
context
ContextThe internal context of the object.
parentContext
ContextThe parent context.
startPosition
PositionThe starting position of the object.
endPosition
PositionThe ending position of the object.
Fields
AdditionFunction
Special function name for 'this + other' operation.
public const string AdditionFunction = "addition"
Field Value
- string
AffirmationFunction
Special function name for '+this' operation.
public const string AffirmationFunction = "affirmation"
Field Value
- string
BitwiseAndFunction
Special function name for 'this & other' operation.
public const string BitwiseAndFunction = "bitwise_and"
Field Value
- string
BitwiseLeftShiftunction
Special function name for 'this << other' operation.
public const string BitwiseLeftShiftunction = "bitwise_left_shift"
Field Value
- string
BitwiseNegationFunction
Special function name for '~this' operation.
public const string BitwiseNegationFunction = "bitwise_negation"
Field Value
- string
BitwiseOrFunction
Special function name for 'this | other' operation.
public const string BitwiseOrFunction = "bitwise_or"
Field Value
- string
BitwiseRightShiftFunction
Special function name for 'this >> other' operation.
public const string BitwiseRightShiftFunction = "bitwise_right_shift"
Field Value
- string
BitwiseXOrFunction
Special function name for 'this \ other' operation.
public const string BitwiseXOrFunction = "bitwise_xor"
Field Value
- string
CalledFunction
Special function name for 'this(arguments)' operation.
public const string CalledFunction = "call_received"
Field Value
- string
Class
The parent class of the class instance.
public readonly EzrClass Class
Field Value
ContainsFunction
Special function name for 'other in this' operation.
public const string ContainsFunction = "contains"
Field Value
- string
DivisionFunction
Special function name for 'this / other' operation.
public const string DivisionFunction = "division"
Field Value
- string
DoesNotContainFunction
Special function name for 'other not in this' operation.
public const string DoesNotContainFunction = "does_not_contain"
Field Value
- string
EvaluateBooleanFunction
Special function name for evaluation of the 'this' into a boolean.
public const string EvaluateBooleanFunction = "evaluate_boolean"
Field Value
- string
GetHashCodeFunction
Special function name for hashing 'this'.
public const string GetHashCodeFunction = "get_hash_code"
Field Value
- string
InitializationFunction
Special function name for initializer (constructor).
public const string InitializationFunction = "initialize"
Field Value
- string
Interpreter
The interpreter for executing parts of the class instance.
public readonly Interpreter Interpreter
Field Value
InversionFunction
Special function name for 'invert this' operation.
public const string InversionFunction = "inversion"
Field Value
- string
IsEqualFunction
Special function name for 'this = other' operation.
public const string IsEqualFunction = "is_equal"
Field Value
- string
IsGreaterThanFunction
Special function name for 'this > other' operation.
public const string IsGreaterThanFunction = "is_greater_than"
Field Value
- string
IsGreaterThanOrEqualFunction
Special function name for 'this >= other' operation.
public const string IsGreaterThanOrEqualFunction = "is_greater_than_or_equal"
Field Value
- string
IsLessThanFunction
Special function name for 'this < other' operation.
public const string IsLessThanFunction = "is_less_than"
Field Value
- string
IsLessThanOrEqualFunction
Special function name for 'this <= other' operation.
public const string IsLessThanOrEqualFunction = "is_less_than_or_equal"
Field Value
- string
IsNotEqualFunction
Special function name for 'this ! other' operation.
public const string IsNotEqualFunction = "is_inequal"
Field Value
- string
ModuloFunction
Special function name for 'this % other' operation.
public const string ModuloFunction = "modulo"
Field Value
- string
MultiplicationFunction
Special function name for 'this * other' operation.
public const string MultiplicationFunction = "multiplication"
Field Value
- string
NegationFunction
Special function name for '-this' operation.
public const string NegationFunction = "negation"
Field Value
- string
ParentReferences
The references to the class instance's parents.
public readonly Reference[] ParentReferences
Field Value
PowerFunction
Special function name for 'this ^ other' operation.
public const string PowerFunction = "power"
Field Value
- string
StrictComparisonFunction
Special function name for strict equality checking of 'this' and 'other'.
public const string StrictComparisonFunction = "strict_equals"
Field Value
- string
SubtractionFunction
Special function name for 'this - other' operation.
public const string SubtractionFunction = "subtraction"
Field Value
- string
ToPureStringFunction
Special function name for the "pure" string representation of 'this'.
public const string ToPureStringFunction = "to_real_string"
Field Value
- string
ToStringFunction
Special function name for the string representation of 'this'.
public const string ToStringFunction = "to_string"
Field Value
- string
Methods
Addition(IEzrObject, RuntimeResult)
Performs the addition operation between the current object and another.
public override void Addition(IEzrObject other, RuntimeResult result)
Parameters
other
IEzrObjectThe other object in the operation.
result
RuntimeResultRuntime result for carrying the result and any errors.
Affirmation(RuntimeResult)
Affirms the current object.
public override void Affirmation(RuntimeResult result)
Parameters
result
RuntimeResultRuntime result for carrying the result and any errors.
BitwiseAnd(IEzrObject, RuntimeResult)
Performs the bit-wise AND operation between the current object and another.
public override void BitwiseAnd(IEzrObject other, RuntimeResult result)
Parameters
other
IEzrObjectThe other object in the operation.
result
RuntimeResultRuntime result for carrying the result and any errors.
BitwiseLeftShift(IEzrObject, RuntimeResult)
Performs the bit-wise left-shift operation between the current object and another.
public override void BitwiseLeftShift(IEzrObject other, RuntimeResult result)
Parameters
other
IEzrObjectThe other object in the operation.
result
RuntimeResultRuntime result for carrying the result and any errors.
BitwiseNegation(RuntimeResult)
Bit-wise negates the current object.
public override void BitwiseNegation(RuntimeResult result)
Parameters
result
RuntimeResultRuntime result for carrying the result and any errors.
BitwiseOr(IEzrObject, RuntimeResult)
Performs the bit-wise OR operation between the current object and another.
public override void BitwiseOr(IEzrObject other, RuntimeResult result)
Parameters
other
IEzrObjectThe other object in the operation.
result
RuntimeResultRuntime result for carrying the result and any errors.
BitwiseRightShift(IEzrObject, RuntimeResult)
Performs the bit-wise right-shift operation between the current object and another.
public override void BitwiseRightShift(IEzrObject other, RuntimeResult result)
Parameters
other
IEzrObjectThe other object in the operation.
result
RuntimeResultRuntime result for carrying the result and any errors.
BitwiseXOr(IEzrObject, RuntimeResult)
Performs the bit-wise X-OR operation between the current object and another.
public override void BitwiseXOr(IEzrObject other, RuntimeResult result)
Parameters
other
IEzrObjectThe other object in the operation.
result
RuntimeResultRuntime result for carrying the result and any errors.
ComparisonEqual(IEzrObject, RuntimeResult)
Compares the object to another, checks equality.
public override void ComparisonEqual(IEzrObject other, RuntimeResult result)
Parameters
other
IEzrObjectThe other object in the operation.
result
RuntimeResultRuntime result for carrying the result and any errors.
ComparisonGreaterThan(IEzrObject, RuntimeResult)
Compares the object to another, checks if the current object is greater than the other.
public override void ComparisonGreaterThan(IEzrObject other, RuntimeResult result)
Parameters
other
IEzrObjectThe other object in the operation.
result
RuntimeResultRuntime result for carrying the result and any errors.
ComparisonGreaterThanOrEqual(IEzrObject, RuntimeResult)
Compares the object to another, checks if the current object is greater than or equal to the other.
public override void ComparisonGreaterThanOrEqual(IEzrObject other, RuntimeResult result)
Parameters
other
IEzrObjectThe other object in the operation.
result
RuntimeResultRuntime result for carrying the result and any errors.
ComparisonLessThan(IEzrObject, RuntimeResult)
Compares the object to another, checks if the current object is less than the other.
public override void ComparisonLessThan(IEzrObject other, RuntimeResult result)
Parameters
other
IEzrObjectThe other object in the operation.
result
RuntimeResultRuntime result for carrying the result and any errors.
ComparisonLessThanOrEqual(IEzrObject, RuntimeResult)
Compares the object to another, checks if the current object is less than or equal to the other.
public override void ComparisonLessThanOrEqual(IEzrObject other, RuntimeResult result)
Parameters
other
IEzrObjectThe other object in the operation.
result
RuntimeResultRuntime result for carrying the result and any errors.
ComparisonNotEqual(IEzrObject, RuntimeResult)
Compares the object to another, checks unequality.
public override void ComparisonNotEqual(IEzrObject other, RuntimeResult result)
Parameters
other
IEzrObjectThe other object in the operation.
result
RuntimeResultRuntime result for carrying the result and any errors.
ComputeHashCode(RuntimeResult)
Evaluates the current object as its hash.
public override int ComputeHashCode(RuntimeResult result)
Parameters
result
RuntimeResultRuntime result for carrying any errors.
Returns
- int
The evaluated value.
DeepCopy(RuntimeResult)
Creates a deep copy of the IMutable<T>.
public IMutable<IEzrMutableObject>? DeepCopy(RuntimeResult result)
Parameters
result
RuntimeResultRuntime result for raising errors./
Returns
- IMutable<IEzrMutableObject>
The copy, or, null if failed.
Remarks
The deep copy here means that all IMutable<T> properties and fields in the object are also copied.
Division(IEzrObject, RuntimeResult)
Performs the division operation between the current object and another.
public override void Division(IEzrObject other, RuntimeResult result)
Parameters
other
IEzrObjectThe other object in the operation.
result
RuntimeResultRuntime result for carrying the result and any errors.
EvaluateBoolean(RuntimeResult)
Evaluates the current object as a boolean value.
public override bool EvaluateBoolean(RuntimeResult result)
Parameters
result
RuntimeResultRuntime result for carrying any errors.
Returns
- bool
The evaluated value.
Execute(Reference[], Interpreter, RuntimeResult)
Executes the current object, like a function.
public override void Execute(Reference[] arguments, Interpreter interpreter, RuntimeResult result)
Parameters
arguments
Reference[]The arguments of the execution.
interpreter
InterpreterThe interpreter to be used in execution.
result
RuntimeResultRuntime result for carrying the result and any errors.
GetFunction(string, int, out Reference)
Gets a function based on the name and number of parameters.
private bool GetFunction(string name, int parameters, out Reference functionReference)
Parameters
name
stringThe name of the function.
parameters
intThe number of parameters required for the function.
functionReference
ReferenceThe resulting reference to the function.
Returns
HasValueContained(IEzrObject, RuntimeResult)
Checks if the other object is contained in the current object.
public override void HasValueContained(IEzrObject other, RuntimeResult result)
Parameters
other
IEzrObjectThe other object in the operation.
result
RuntimeResultRuntime result for carrying the result and any errors.
Inversion(RuntimeResult)
Inverts the current object, like, for example, true to false.
public override void Inversion(RuntimeResult result)
Parameters
result
RuntimeResultRuntime result for carrying the result and any errors.
Modulo(IEzrObject, RuntimeResult)
Performs the modulo operation between the current object and another.
public override void Modulo(IEzrObject other, RuntimeResult result)
Parameters
other
IEzrObjectThe other object in the operation.
result
RuntimeResultRuntime result for carrying the result and any errors.
Multiplication(IEzrObject, RuntimeResult)
Performs the multiplication operation between the current object and another.
public override void Multiplication(IEzrObject other, RuntimeResult result)
Parameters
other
IEzrObjectThe other object in the operation.
result
RuntimeResultRuntime result for carrying the result and any errors.
Negation(RuntimeResult)
Negates the current object.
public override void Negation(RuntimeResult result)
Parameters
result
RuntimeResultRuntime result for carrying the result and any errors.
NotHasValueContained(IEzrObject, RuntimeResult)
Checks if the other object is NOT contained in the current object.
public override void NotHasValueContained(IEzrObject other, RuntimeResult result)
Parameters
other
IEzrObjectThe other object in the operation.
result
RuntimeResultRuntime result for carrying the result and any errors.
Power(IEzrObject, RuntimeResult)
Performs the power or exponent operation between the current object and another.
public override void Power(IEzrObject other, RuntimeResult result)
Parameters
other
IEzrObjectThe other object in the operation.
result
RuntimeResultRuntime result for carrying the result and any errors.
StrictEquals(IEzrObject, RuntimeResult)
Strictly compares the current object to another, taking into account inheritance.
public override bool StrictEquals(IEzrObject other, RuntimeResult result)
Parameters
other
IEzrObjectThe other object in the operation.
result
RuntimeResultRuntime result for carrying any errors.
Returns
- bool
Subtraction(IEzrObject, RuntimeResult)
Performs the subtraction operation between the current object and another.
public override void Subtraction(IEzrObject other, RuntimeResult result)
Parameters
other
IEzrObjectThe other object in the operation.
result
RuntimeResultRuntime result for carrying the result and any errors.
ToPureString(RuntimeResult)
Evaluates the current object as a string value.
public override string ToPureString(RuntimeResult result)
Parameters
result
RuntimeResultRuntime result for carrying any errors.
Returns
- string
The evaluated value.
Remarks
This is used to show the 'real' string representation of the object. Like, for example, ToString(RuntimeResult) will
return "example" when called on an EzrString object with value "example", but this function will return example (without quotes).
ToString(RuntimeResult)
Evaluates the current object as a string value.
public override string ToString(RuntimeResult result)
Parameters
result
RuntimeResultRuntime result for carrying any errors.
Returns
- string
The evaluated value.