[rules-users] Memory usage tied to rule report?
Edson Tirelli
tirelli at post.com
Thu Oct 7 12:48:42 EDT 2010
Hi Jared,
This was really a first attempt at getting something useful to look
inside the chest of a session and extract useful info. Feel free to
look at the classes and propose changes/provide patches. Once it
reaches a state we consider good enough, we can publish it in Drools
API.
Regarding use of "instanceof", I always prefer to use polymorphism
instead. So, define a method to do what you need in a super
class/interface and we implement it in all subclasses. Besides making
the code cleaner, this also makes sure that new nodes/classes created
in the future will not break or be absent in the report.
Edson
2010/10/7 Jared Davis <sunray at davisprogramming.com>:
>
> Edson,
>
> I'm using yEd for the graph viewer and tgf as the format for the graph. Here
> is the mvel template to produce the tgf file. I left the topten name the
> same for now. Did I miss any nodes or edges?
>
> @declare{"topten"}
> @code{
> buffer = new StringBuilder();
> for (ni : session.nodeInfos) {
> buffer.append( ni.id);
> buffer.append( " ");
> buffer.append( ni.node);
> buffer.append( "\r\n");
> }
> buffer.append( "#\r\n");
> for (node : session.nodeInfos) {
> for (child : node.sinkList) {
> buffer.append( node.id);
> buffer.append( " ");
> buffer.append( child.id);
> buffer.append( "\r\n");
> }
> }
> }
> @{buffer.toString()}
> @end{}
>
>
> I would like to change the toString representations for all of the classes
> used in the graph.
>
> I there a better structure than a bunch of instanceof tests? (Would they
> even work?)
>
> if (ni.node instanceof AlphaNode) {
> buffer.append("A: ");
> if (ni.node.constraint instanceof ...) {
>
> Thanks again for your help.
>
>
> --
> View this message in context: http://drools-java-rules-engine.46999.n3.nabble.com/Memory-usage-tied-to-rule-report-tp1434387p1649379.html
> Sent from the Drools - User mailing list archive at Nabble.com.
> _______________________________________________
> rules-users mailing list
> rules-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/rules-users
>
--
Edson Tirelli
JBoss Drools Core Development
JBoss by Red Hat @ www.jboss.com
More information about the rules-users
mailing list