visitor

How do you separate visitors to two intro pages to compare amt of registration per visitor?

Hi. I am making a site that depend on users to register to be able to play my online game. If they don't login they only get to see the intro page. If the user login to the site I will save this information to the cookie so next time they visit they will be sent directly to the login.php. If the user don't have this information in the c...

Java object graph visitor library

Do you know a good java object graph visitor library? I want to visit an object and its sub components and perform some actions when some conditions are matched. Example usage: on a huge domain object graph, reset each id to null on a huge domain object graph, replace each Set with a TreeSet instance containing the same elements. ...

question about virtual methods in java

Put simply: I want the following code to print "sub": Element e = new SubElement(); print(e); ... private static void print(Element e) { System.out.println("e"); } private static void print(SubElement e) { System.out.println("sub"); } and i dont want to change print(Element e). so nothing like private static void print(El...

C++ template metaprogramming to create a boost::variant from a shared_ptr and a boost::static_visitor

As a personal exercise, I want to implement the visitor pattern using shared_ptr. I am familiar with Robert Martin's acyclic visitor paper but find the intrusive nature of the virtual accept() and necessary creation of an {X}Visitor class for each {X} class unpleasant. I like the boost::static_visitor class as it encapsulates all the l...

Do I need a visitor for my component ?

I'm trying to do a small and simple GUI in C++ (with SDL). I'm experimenting with the Composite pattern to have a flexible solution. I've got a Widget class, with Component objects : for instance, there is a PaintingComponent ; if I want to draw a box, I'll use a PaintingBoxComponent, that inherits from the PaintingComponent. The ide...

Generic visitor pattern in java

Is the following java implementation of the visitor pattern using generics, general enough to be useful? (I suppose it is). Could it be improved in some way? It's important to be easily call-able using anonymous classes. Thanks. (Example of use): Vector<Number> numbers = new Vector<Number>(); numbers.add(new Double(1.2)); ...