public ConditionalBranchInstruction(BoolOperation boolOperation, [NotNull] IOperand lhs, [NotNull] IOperand rhs,
                                     [NotNull] IOperand target, bool likely = false)
 {
     Operation = boolOperation;
     Operands  = new[] { lhs, rhs, target };
     _likely   = likely;
 }
Exemple #2
0
    public bool OperateBool(string name, BoolOperation operation, bool attribute)
    {
        var variable = GameManager.instance.gameStatus.GetBoolVariable(name);

        switch (operation)
        {
        case BoolOperation.set:
            variable.value = attribute;
            break;

        case BoolOperation.inverse:
            variable.value = !variable.value;
            break;

        case BoolOperation.and:
            variable.value = variable.value && attribute;
            break;

        case BoolOperation.or:
            variable.value = variable.value || attribute;
            break;

        case BoolOperation.xor:
            variable.value = variable.value != attribute;
            break;

        default:
            Debug.LogWarning("Operation " + operation.ToString() + " Not Implemented yet.");
            break;
        }
        return(variable.value);
    }
Exemple #3
0
        private void MetaOperate(List <MutableObject> entry, BoolOperation operation)
        {
            switch (operation)
            {
            case BoolOperation.And:
                var total = true;
                foreach (var subEntry in Operand.GetEntries(entry))
                {
                    total = total && Operand.GetValue(subEntry);
                }
                foreach (var target in OutputTarget.GetEntries(entry))
                {
                    OutputTarget.SetValue(total, target);
                }
                break;

            case BoolOperation.Or:
                total = false;
                foreach (var subEntry in Operand.GetEntries(entry))
                {
                    total = total || Operand.GetValue(subEntry);
                }
                foreach (var target in OutputTarget.GetEntries(entry))
                {
                    OutputTarget.SetValue(total, target);
                }
                break;

            default:
                throw new Exception("Unknown operation type " + operation + "!");
            }
        }
Exemple #4
0
    public static void Main(string[] args)
    {
        bool[] input  = DebugTool.IntToBools(7);
        bool[] input2 = DebugTool.IntToBools(14);

        bool[] result = BoolOperation.Inc16(input);
        DebugTool.PrintBools(result);
    }
    public static void Main(string[] args)
    {
        bool[] input  = DebugTool.IntToBools16(1);
        bool[] input2 = DebugTool.IntToBools16(1);

        bool[] setValue = DebugTool.IntToBools8(01111100);

        bool[] result = BoolOperation.ALU(input, input2, setValue[7], setValue[6], setValue[5], setValue[4], setValue[3], setValue[2], out setValue[1], out setValue[0]);

        DebugTool.PrintBools(result);
    }
Exemple #6
0
 public MyBoolean(bool b)
 {
     Bool       = b;
     Calculator = BoolOperation.GetInstance();
 }
Exemple #7
0
 private void Push(BoolOperation boolOperation)
 {
     _stack.Push(boolOperation);
 }
Exemple #8
0
 public ConditionalCallInstruction(BoolOperation boolOperation, [NotNull] IOperand lhs, [NotNull] IOperand rhs,
                                   [NotNull] IOperand target) :
     base(boolOperation, lhs, rhs, target)
 {
 }
 protected NotEmptyMultiConverter(TResult trueValue, TResult falseValue, BoolOperation operation) : base(trueValue, falseValue, operation)
 {
 }
 public VisibilityMultiConverter(BoolOperation operation) : base(Visibility.Visible, Visibility.Collapsed, operation)
 {
 }
 public BoolMultiConverter(BoolOperation operation) : base(true, false, operation)
 {
 }
 protected BinaryConverter(TResult trueValue, TResult falseValue, BoolOperation operation)
 {
     True      = trueValue;
     False     = falseValue;
     Operation = operation;
 }
Exemple #13
0
            private IExpression ParseBoolTerm()
            {
                IExpression left = ParseExpression();

                while (true)
                {
                  if (m_pos >= m_text.Length) return left;

                  var c = m_text[m_pos];

                  if (c == '>' || c == '<' ||  c == '=')
                  {
                ++m_pos;
                IExpression right = ParseExpression();
                left = new BoolOperation(c, left, right);
                  }
                  else
                  {
                return left;
                  }
                }
            }