예제 #1
0
void Library::accept(Visitor &visitor)
{
  visitor.visit(*this);
}
예제 #2
0
파일: BinaryOp.cpp 프로젝트: prozum/sppl
void Sub::accept(Visitor &V) { V.visit(*this); }
예제 #3
0
파일: BinaryOp.cpp 프로젝트: prozum/sppl
void Div::accept(Visitor &v) { v.visit(*this); }
예제 #4
0
파일: BinaryOp.cpp 프로젝트: prozum/sppl
void GreaterEq::accept(Visitor &V) { V.visit(*this); }
예제 #5
0
파일: BinaryOp.cpp 프로젝트: prozum/sppl
void Concat::accept(Visitor &V) { V.visit(*this); }
예제 #6
0
파일: ast.cpp 프로젝트: toneill818/calc-hw1
		void accept(Visitor &v){
			v.visit(this);
			return;
		}
예제 #7
0
파일: BinaryOp.cpp 프로젝트: prozum/sppl
void NotEqual::accept(Visitor &V) { V.visit(*this); }
예제 #8
0
파일: ModelAST.cpp 프로젝트: raulmonti/FIG
void Model::accept(Visitor& visit) {
    //my_type == Model
    using my_type = std::remove_pointer<decltype(this)>::type;
    const auto &_this = static_pointer_cast<my_type>(shared_from_this());
    visit.visit(_this);
}
예제 #9
0
파일: ModelAST.cpp 프로젝트: raulmonti/FIG
void ModuleBody::accept(Visitor& visit) {
    using my_type = std::remove_pointer<decltype(this)>::type;
    visit.visit(static_pointer_cast<my_type>(shared_from_this()));
}
예제 #10
0
 void            apply_to( Visitor& V ) const
 {
     V.set_parameter( rtti::type_id<unique_id>(), m_value );
 }
예제 #11
0
        typename property_traits<CoreMap>::value_type
        core_numbers_impl(Graph& g, CoreMap c, PositionMap pos, Visitor vis)
        {
            typedef typename graph_traits<Graph>::vertices_size_type size_type;
            typedef typename graph_traits<Graph>::degree_size_type degree_type;
            typedef typename graph_traits<Graph>::vertex_descriptor vertex;
            typename graph_traits<Graph>::vertex_iterator vi,vi_end;

            // store the vertex core numbers
            typename property_traits<CoreMap>::value_type v_cn = 0;

            // compute the maximum degree (degrees are in the coremap)
            typename graph_traits<Graph>::degree_size_type max_deg = 0;
            for (boost::tie(vi,vi_end) = vertices(g); vi!=vi_end; ++vi) {
                max_deg = (std::max<typename graph_traits<Graph>::degree_size_type>)(max_deg, get(c,*vi));
            }

            // store the vertices in bins by their degree
            // allocate two extra locations to ease boundary cases
            std::vector<size_type> bin(max_deg+2);
            for (boost::tie(vi,vi_end) = vertices(g); vi!=vi_end; ++vi) {
                ++bin[get(c,*vi)];
            }

            // this loop sets bin[d] to the starting position of vertices
            // with degree d in the vert array for the bucket sort
            size_type cur_pos = 0;
            for (degree_type cur_deg = 0; cur_deg < max_deg+2; ++cur_deg) {
                degree_type tmp = bin[cur_deg];
                bin[cur_deg] = cur_pos;
                cur_pos += tmp;
            }

            // perform the bucket sort with pos and vert so that
            // pos[0] is the vertex of smallest degree
            std::vector<vertex> vert(num_vertices(g));
            for (boost::tie(vi,vi_end) = vertices(g); vi!=vi_end; ++vi) {
                vertex v=*vi;
                size_type p=bin[get(c,v)];
                put(pos,v,p);
                vert[p]=v;
                ++bin[get(c,v)];
            }
            // we ``abused'' bin while placing the vertices, now,
            // we need to restore it
            std::copy(boost::make_reverse_iterator(bin.end()-2),
                boost::make_reverse_iterator(bin.begin()),
                boost::make_reverse_iterator(bin.end()-1));
            // now simulate removing the vertices
            for (size_type i=0; i < num_vertices(g); ++i) {
                vertex v = vert[i];
                vis.examine_vertex(v,g);
                v_cn = get(c,v);
                typename graph_traits<Graph>::out_edge_iterator oi,oi_end;
                for (boost::tie(oi,oi_end) = out_edges(v,g); oi!=oi_end; ++oi) {
                    vis.examine_edge(*oi,g);
                    vertex u = target(*oi,g);
                    // if c[u] > c[v], then u is still in the graph,
                    if (get(c,u) > v_cn) {
                        degree_type deg_u = get(c,u);
                        degree_type pos_u = get(pos,u);
                        // w is the first vertex with the same degree as u
                        // (this is the resort operation!)
                        degree_type pos_w = bin[deg_u];
                        vertex w = vert[pos_w];
                        if (u!=v) {
                            // swap u and w
                            put(pos,u,pos_w);
                            put(pos,w,pos_u);
                            vert[pos_w] = u;
                            vert[pos_u] = w;
                        }
                        // now, the vertices array is sorted assuming
                        // we perform the following step
                        // start the set of vertices with degree of u
                        // one into the future (this now points at vertex
                        // w which we swapped with u).
                        ++bin[deg_u];
                        // we are removing v from the graph, so u's degree
                        // decreases
                        put(c,u,get(c,u)-1);
                    }
                }
                vis.finish_vertex(v,g);
            }
            return v_cn;
        }
예제 #12
0
void
madara::expression::VariableDecrementNode::accept (Visitor &visitor) const
{
  visitor.visit (*this);
}
예제 #13
0
void CriteriaItem::accept(Visitor& visitor)
{
    visitor.visit(*this);
}
예제 #14
0
파일: ast.hpp 프로젝트: Jenny-fa/lingo
 void accept(Visitor& v) const { return v.visit(this); }
예제 #15
0
void
Composite_Add_Node<T>::accept (Visitor& v)
{
  // You fill in here.
  v.visit(*this);
}
예제 #16
0
파일: ModelAST.cpp 프로젝트: raulmonti/FIG
void Decl::accept(Visitor& visit) {
    visit.visit(static_pointer_cast<Decl>(shared_from_this()));
}
예제 #17
0
bool
DynamicPersistenceTrails<D,CT,OT,E,Cmp,CCmp>::
transpose(iterator i, const DimensionFunctor& dimension, Visitor visitor)
{
#if LOGGING
    typename Traits::OutputMap outmap(order());
#endif

    Count(cTransposition);
    typedef                 typename Element::Trail::iterator           TrailIterator;

    visitor.transpose(i);
    
    iterator i_prev = i++;

    if (dimension(i_prev) != dimension(i))
    {
        swap(i_prev, i);
        rLog(rlTranspositions, "Different dimension");
        Count(cTranspositionDiffDim);
        return false;
    }
    
    bool si = i_prev->sign(), sii = i->sign();
    if (si && sii)
    {
        rLog(rlTranspositions, "Trail prev: %s", i_prev->trail.tostring(outmap).c_str());

        // Case 1
        if (trail_remove_if_contains(i_prev, index(i)))
            rLog(rlTranspositions, "Case 1, U[i,i+1] = 1");

        iterator k = iterator_to(i_prev->pair);
        iterator l = iterator_to(i->pair);
        
        // rLog(rlTranspositions, "(i_prev, k), (i, l): (%s, %s), (%s, %s)", 
        //                         outmap(i_prev).c_str(), outmap(k).c_str(),
        //                         outmap(i).c_str(),      outmap(l).c_str());

        // Explicit treatment of unpaired simplex
        if (l == i)
        {
            swap(i_prev, i);
            rLog(rlTranspositions, "Case 1.2 --- unpaired");
            rLog(rlTranspositions, "%s", outmap(i_prev).c_str());
            Count(cTranspositionCase12);
            return false;
        } else if (k == i_prev)
        {
            if (!(l->cycle.contains(index(i_prev))))
            {
                // Case 1.2
                swap(i_prev, i);
                rLog(rlTranspositions, "Case 1.2 --- unpaired");
                rLog(rlTranspositions, outmap(i_prev).c_str());
                Count(cTranspositionCase12);
                return false;
            } else
            {
                // Case 1.2 --- special version (plain swap, but pairing switches)
                swap(i_prev, i);
                pairing_switch(i_prev, i);
                visitor.switched(i, Case12);
                rLog(rlTranspositions, "Case 1.2 --- unpaired (pairing switch)");
                rLog(rlTranspositions, outmap(i_prev).c_str());
                Count(cTranspositionCase12s);
                return true;
            }
        }
        
        rLog(rlTranspositions, "l cycle: %s", l->cycle.tostring(outmap).c_str());
        if (!(l->cycle.contains(index(i_prev))))
        {
            // Case 1.2
            rLog(rlTranspositions, "k is in l: %d", (bool) l->trail.contains(index(k)));       // if true, a special update would be needed to maintain lazy decomposition
            swap(i_prev, i);
            rLog(rlTranspositions, "Case 1.2");
            Count(cTranspositionCase12);
            return false;
        } else
        {
            // Case 1.1
            if (std::not2(order_comparison())(index(k),index(l)))
            {
                // Case 1.1.1
                swap(i_prev, i);
                cycle_add(l, k->cycle);               // Add column k to l
                trail_add(k, l->trail);               // Add row l to k
                rLog(rlTranspositions, "Case 1.1.1");
                Count(cTranspositionCase111);
                return false;
            } else
            {
                // Case 1.1.2
                swap(i_prev, i);
                cycle_add(k, l->cycle);               // Add column l to k
                trail_add(l, k->trail);               // Add row k to l
                pairing_switch(i_prev, i);
                visitor.switched(i, Case112);
                rLog(rlTranspositions, "Case 1.1.2");
                Count(cTranspositionCase112);
                return true;
            }
        }
    } else if (!si && !sii)
    {
        // Case 2
        if (!(i_prev->trail.contains(index(i))))
        {
            // Case 2.2
            swap(i_prev, i);
            rLog(rlTranspositions, "Case 2.2");
            Count(cTranspositionCase22);
            return false;
        } else
        {
            // Case 2.1
            iterator low_i =    iterator_to(i_prev->pair);
            iterator low_ii =   iterator_to(i->pair);
            trail_add(i_prev, i->trail);                   // Add row i to i_prev
            cycle_add(i, i_prev->cycle);                   // Add column i_prev to i
            swap(i_prev, i);    
            if (std::not2(order_comparison())(index(low_ii), index(low_i)))
            {
                // Case 2.1.2
                cycle_add(i_prev, i->cycle);               // Add column i to i_prev (after transposition)
                trail_add(i, i_prev->trail);               // Add row i to i_prev
                pairing_switch(i_prev, i);
                visitor.switched(i, Case212);
                rLog(rlTranspositions, "Case 2.1.2");
                Count(cTranspositionCase212);
                return true;
            } 
            
            // Case 2.1.1
            rLog(rlTranspositions, "Case 2.1.1");
            Count(cTranspositionCase211);
            return false;
        }
    } else if (!si && sii)
    {
        // Case 3
        if (!(i_prev->trail.contains(index(i))))
        {
            // Case 3.2
            swap(i_prev, i);
            rLog(rlTranspositions, "Case 3.2");
            Count(cTranspositionCase32);
            return false;
        } else
        {
            // Case 3.1
            trail_add(i_prev, i->trail);                   // Add row i to i_prev
            cycle_add(i, i_prev->cycle);                   // Add column i_prev to i
            swap(i_prev, i);
            cycle_add(i_prev, i->cycle);                   // Add column i_prev to i (after transposition)
            trail_add(i, i_prev->trail);                   // Add row i to i_prev
            pairing_switch(i_prev, i);
            visitor.switched(i, Case31);
            rLog(rlTranspositions, "Case 3.1");
            Count(cTranspositionCase31);
            return true;
        }
    } else if (si && !sii)
    {
        // Case 4
        if (trail_remove_if_contains(i_prev, index(i)))
            rLog(rlTranspositions, "Case 4, U[i,i+1] = 1");
        swap(i_prev, i);
        rLog(rlTranspositions, "Case 4");
        Count(cTranspositionCase4);
        return false;
    }
    
    return false; // to avoid compiler complaints; we should never reach this point
}
예제 #18
0
파일: ModelAST.cpp 프로젝트: raulmonti/FIG
void Effect::accept(Visitor& visit) {
    visit.visit(static_pointer_cast<Effect>(shared_from_this()));
}
예제 #19
0
파일: BinaryOp.cpp 프로젝트: prozum/sppl
void Or::accept(Visitor &V) { V.visit(*this); }
예제 #20
0
파일: ModelAST.cpp 프로젝트: raulmonti/FIG
void Location::accept(Visitor& visit) {
    visit.visit(static_pointer_cast<Location>(shared_from_this()));
}
예제 #21
0
파일: BinaryOp.cpp 프로젝트: prozum/sppl
void LesserEq::accept(Visitor &V) { V.visit(*this); }
예제 #22
0
파일: ModelAST.cpp 프로젝트: raulmonti/FIG
void ModelAST::accept(Visitor &visit) {
    visit.visit(shared_from_this());
}
예제 #23
0
파일: BinaryOp.cpp 프로젝트: prozum/sppl
void ProducerConsumer::accept(Visitor &V) { V.visit(*this); }
예제 #24
0
파일: ModelAST.cpp 프로젝트: raulmonti/FIG
//BConst
void BConst::accept(Visitor& visit) {
    visit.visit(static_pointer_cast<BConst>(shared_from_this()));
}
예제 #25
0
파일: BinaryOp.cpp 프로젝트: prozum/sppl
void Add::accept(Visitor &V) { V.visit(*this); }
예제 #26
0
파일: ModelAST.cpp 프로젝트: raulmonti/FIG
//OpExp
void OpExp::accept(Visitor& visit) {
    visit.visit(static_pointer_cast<OpExp>(shared_from_this()));
}
예제 #27
0
파일: BinaryOp.cpp 프로젝트: prozum/sppl
void Mul::accept(Visitor &V) { V.visit(*this); }
예제 #28
0
void BlockAST::accept(Visitor &visitor) {
	visitor.visit(this);
}
예제 #29
0
파일: ast_req.hpp 프로젝트: jbcoe/banjo
 void accept(Visitor& v) const { v.visit(*this); }
예제 #30
0
	virtual void accept( Visitor& visitor ) { visitor.visit( mImpl ); }