コード例 #1
0
    public override Operator toExplicit()
    {
        if (m_domain == null || m_domain.Count == 0)
        {
            return null;
        }

        BinaryOperator bo = new OperatorOr();
        bool first = true;

        foreach (Atom a in m_domain)
        {
            Operator o = m_operand.evaluate(m_quantifiedVariable, a);

            if (m_domain.Count == 1)
            {
                return o;
            }

            if (first)
            {
                first = false;
                bo.setLeftOperand(o);

                continue;
            }

            if (bo.getRightOperand() == null)
            {
                bo.setRightOperand(o);
            }

            else
            {
                BinaryOperator newbo = new OperatorOr();

                newbo.setLeftOperand(bo);
                newbo.setRightOperand(o);
                bo = newbo;
            }
        }

        return bo;
    }
コード例 #2
0
    public HashSet<GeneratorNode> spawn(OperatorOr op)
    {
        HashSet<GeneratorNode> spawnedSet, outSet = new HashSet<GeneratorNode>();

        // Do for left operand
        GeneratorNode wn = new GeneratorNode(this);
        Operator o2 = op.getLeftOperand();

        wn.addToGamma(o2);
        spawnedSet = wn.spawn();

        foreach (GeneratorNode gn in spawnedSet)
        {
            outSet.Add(gn);
        }

        // Do for right operand
        wn = new GeneratorNode(this);
        o2 = op.getRightOperand();
        wn.addToGamma(o2);
        spawnedSet = wn.spawn();

        if (spawnedSet != null)
        {
            foreach (GeneratorNode gn in spawnedSet)
            {
                outSet.Add(gn);
            }
        }

        return outSet;
    }