Пример #1
0
ComposedRule::ComposedRule(const ComposedRule &other, const Subgraph &rule,
                           int depth)
    : m_baseRule(other.m_baseRule)
    , m_attachedRules(other.m_attachedRules)
    , m_openAttachmentPoints(other.m_openAttachmentPoints)
    , m_depth(depth)
    , m_size(other.m_size+rule.GetSize())
    , m_nodeCount(other.m_nodeCount+rule.GetNodeCount()-1)
{
    m_attachedRules.push_back(&rule);
    m_openAttachmentPoints.pop();
}
Пример #2
0
ComposedRule::ComposedRule(const Subgraph &baseRule)
    : m_baseRule(baseRule)
    , m_depth(baseRule.GetDepth())
    , m_size(baseRule.GetSize())
    , m_nodeCount(baseRule.GetNodeCount())
{
    const std::set<const Node *> &leaves = baseRule.GetLeaves();
    for (std::set<const Node *>::const_iterator p = leaves.begin();
            p != leaves.end(); ++p) {
        if ((*p)->GetType() == TREE) {
            m_openAttachmentPoints.push(*p);
        }
    }
}