/// <summary> /// Creates a new binary operation with a pair of operands. /// </summary> /// <param name="Rules">The set of rules that govern the application of this operation</param> /// <param name="Operand1">The first (or "left") operand</param> /// <param name="Operand2">The second (or "right") operand</param> /// <param name="IsCommutative">Whether this operation is commutative</param> /// <param name="IsAnticommutative">Whether this operation is anticommutative</param> /// <param name="IsIdempotent">Whether this operation is idempotent</param> /// <param name="IsAssociative">Whether this operation is associative</param> public BinaryOperation(RuleSet Rules, Expression Operand1, Expression Operand2, bool IsCommutative, bool IsAnticommutative, bool IsIdempotent, bool IsAssociative) : base(Rules, 2, IsIdempotent) { this.Operands[0] = Operand1; this.Operands[1] = Operand2; this.IsCommutative = IsCommutative; this.IsAnticommutative = IsAnticommutative; this.IsAssociative = IsAssociative; }
/// <summary> /// Creates a new unary operation with a particular operand. /// </summary> /// <param name="Rules">The set of rules that govern the application of this operation</param> /// <param name="Operand">The operand of this operation</param> /// <param name="IsIdempotent">Whether this unary operation is idempotent (see MathOperation class or Wikipedia on idempotence)</param> public UnaryOperation(RuleSet Rules, Expression Operand, bool IsIdempotent) : base(Rules, 1, IsIdempotent) { this.Operands[0] = Operand; }
/// <summary> /// Creates a new trinary operation /// </summary> /// <param name="Rules">The set of rules that govern the application of this operation</param> /// <param name="IsIdempotent">Whether this mathematical operation is idempotent</param> public TrinaryOperation(RuleSet Rules, bool IsIdempotent) : base(Rules, 3, IsIdempotent) { }
/// <summary> /// Creates a new elementary operation with a pair of operands. /// </summary> /// <param name="Rules">The set of rules that govern the application of this operation</param> /// <param name="Operand1">The first (or "left") operand</param> /// <param name="Operand2">The second (or "right") operand</param> /// <param name="IsCommutative">Whether this operation is commutative</param> /// <param name="IsAnticommutative">Whether this operation is anticommutative</param> /// <param name="IsAssociative">Whether this operation is associative</param> public ElementaryOperation(RuleSet Rules, Expression Operand1, Expression Operand2, bool IsCommutative, bool IsAnticommutative, bool IsAssociative) : base(Rules, Operand1, Operand2, IsCommutative, IsAnticommutative, false, IsAssociative) { }
/// <summary> /// Creates a new mathematical operation of a particular number of possible operands. /// </summary> /// <param name="Rules">The set of rules that govern the application of this operation</param> /// <param name="Arity">The number of operands this operation contains</param> /// <param name="IsIdempotent">Whether this mathematical operation is idempotent</param> public Operation(RuleSet Rules, int Arity, bool IsIdempotent) : base(Arity) { if (Arity < 0) throw new Exceptions.SimplexMathException("Trying to create a new mathematical operation with an arity less than zero? You must be mad!"); this.IsIdempotent = IsIdempotent; this.Rules = Rules; }
/// <summary> /// Creates a new arithmetic operation with a pair of operands. /// </summary> /// <param name="Rules">The set of rules that govern the application of this operation</param> /// <param name="Operand1">The first (or "left") operand</param> /// <param name="Operand2">The second (or "right") operand</param> /// <param name="IsCommutative">Whether this operation is commutative</param> /// <param name="IsAnticommutative">Whether this operation is anticommutative</param> /// <param name="IsAssociative">Whether this operation is associative</param> public ArithmeticOperation(RuleSet Rules, Expression Operand1, Expression Operand2, bool IsCommutative, bool IsAnticommutative, bool IsAssociative) : base(Rules, Operand1, Operand2, IsCommutative, IsAnticommutative, IsAssociative) { }