Codota Logo
ReteNode
Code IndexAdd Codota to your IDE (free)

How to use
ReteNode
in
jadex.rules.rulesystem.rete.nodes

Best Java code snippets using jadex.rules.rulesystem.rete.nodes.ReteNode (Showing top 20 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
StringBuilder s =
  • Codota Iconnew StringBuilder()
  • Codota Iconnew StringBuilder(32)
  • Codota IconString str;new StringBuilder(str)
  • Smart code suggestions by Codota
}
origin: net.sourceforge.jadex/jadex-rules

/**
 *  Remove a rule from a rete network.
 *  @param root The root node.
 *  @param rule The rule to remove.
 */
public void removeRule(ReteNode root, IRule rule)
{
  // Find terminal node that is associated with the rule
  // and call node usage removal.
  TerminalNode tnode = root.getTerminalNode(rule);
  
  removeNodeUsage(tnode);
}
 
origin: net.sourceforge.jadex/jadex-rules

/**
 *  Create a new Rete pattern matcher functionality.
 */
public RetePatternMatcherFunctionality(IRulebase rulebase)
{
  this.rulebase = rulebase;
  this.node = new ReteNode();
  
  // Build existing rules of the rulebase.
  for(Iterator it=rulebase.getRules().iterator(); it.hasNext(); )
    node.addRule((IRule)it.next());
  
  node.setInited(true);
  rulebase.addRulebaseListener(this);
}
 
origin: net.sourceforge.jadex/jadex-rules

  /**
   *  Clone this object.
   *  @return A clone of this object.
   */
  public Object clone()
  {
    RetePatternMatcherFunctionality ret = null;
    
    try
    {    
      ret = (RetePatternMatcherFunctionality)super.clone();
      ret.rulebase = (IRulebase)rulebase.clone();
      ret.rulebase.addRulebaseListener(ret);
      ret.node = (ReteNode)node.clone();
    }
    catch(CloneNotSupportedException exception)
    {
      throw new RuntimeException("Cloning not supported: "+this);
    }
    
    return ret;
  }
}
origin: net.sourceforge.jadex/jadex-rules

if(getRelevantAttributes().contains(attr))
  Set    tns    = getTypeNodes(type);
    assert !check || checkConsistency(mem);
Set    ins    = getIndirectNodes(attr, state.getTypeModel());
if(ins!=null)
origin: net.sourceforge.jadex/jadex-rules

/**
 *  Add a new test node. 
 *  @param eva The constraint evaluator.
 *  @param context The build context.
 */
protected void addTestNode(IConstraintEvaluator eva, BuildContext context)
{
  INode node = new TestNode(context.getRootNode().getNextNodeId(), eva);
  connectLeft(context.getLastBetaNode(), node, context);
  context.setLastBetaNode(node);
}
 
origin: org.activecomponents.jadex/jadex-rules

  /**
   *  Tell the condition system about a
   *  new object in the state.
   *  @param object The new object.
   */
  public void addObject(Object id, OAVObjectType type, IOAVState state, ReteMemory mem, AbstractAgenda agenda)
  {
//        if(type.getName().equals("goal"))
//            System.out.println("Value added: "+id+" "+type);
//        System.out.println("Value added: "+id+" "+type);
    
    state.getProfiler().start(IProfiler.TYPE_NODE, this);
    state.getProfiler().start(IProfiler.TYPE_NODEEVENT, IProfiler.NODEEVENT_OBJECTADDED);
    
    Set    tns    = getTypeNodes(type);
    
    if(tns!=null)
    {
      for(Iterator it=tns.iterator(); it.hasNext(); )
        ((AlphaNode)it.next()).addObject(id, state, mem, agenda);
      
      assert !check || checkConsistency(mem);
    }
//        else
//            System.out.println("No typenode(s) available for: "+type);

    state.getProfiler().stop(IProfiler.TYPE_NODEEVENT, IProfiler.NODEEVENT_OBJECTADDED);
    state.getProfiler().stop(IProfiler.TYPE_NODE, this);
  }
     
origin: net.sourceforge.jadex/jadex-rules

/**
 *  Add a new type node.
 *  @param type The type node.
 *  @param context the build context.
 */
protected void addTypeNode(OAVObjectType type, BuildContext context)
{
  assert type!=null : "***" + context;
  // Create new type node, if necessary 
  INode node = context.getRootNode().getTypeNode(type);
  if(node==null)
  {
    node = new TypeNode(context.getRootNode().getNextNodeId(), type);
    connectRight(context.getRootNode(), node, context);
  }
  context.setLastAlphaNode(node);
}    
 
origin: net.sourceforge.jadex/jadex-rules

/**
 *  Add an initial fact node.
 *  @param context    The build context.
 */
protected void addInitialFactNode(BuildContext context)
{
  // Todo: multiple initial fact nodes without sharing ?
  InitialFactNode node    = context.getRootNode().getInitialFactNode();
  if(node==null)
  {
    node    = new InitialFactNode(context.getRootNode().getNextNodeId());
    connectRight(context.getRootNode(), node, context);
  }
  // Update the context.
  context.setLastBetaNode(node);
  context.setTupleCount(1);
}
 
origin: org.activecomponents.jadex/jadex-rules

/**
 *  Add a new terminal node.
 *  @param rule The rule.
 *  @param context The build context.
 */
protected void addTerminalNode(IRule rule, BuildContext context)
{
  // Create and connect the terminal node
  
  Map varinfos = context.getVarInfos();
  Map extractors = new HashMap();
  for(Iterator it=varinfos.keySet().iterator(); it.hasNext(); )
  {
    Variable var = (Variable)it.next();
    if(!var.isTemporary())
      extractors.put(var.getName(), getLeftVariableExtractor(context, var));
  }
  
  TerminalNode tnode = new TerminalNode(context.getRootNode().getNextNodeId(), rule, extractors);
  connectLeft(context.getLastBetaNode(), tnode, context);
  
  // Save the terminal node for later removal
  context.getRootNode().putTerminalNode(tnode);
}
 
origin: net.sourceforge.jadex/jadex-rules

/**
 *  Notification when a rule has been added.
 *  @param rule The added rule.
 */
public void ruleAdded(IRule rule)
{
  node.addRule(rule);
}
 
origin: net.sourceforge.jadex/jadex-rules

  /**
   *  Create a new build context.
   */
  public BuildContext(ReteNode root, IRule rule)// INode lastbnode, int tuplecnt)
  {
    this.root	= root==null? new ReteNode(): root;
    this.rule	= rule;
    this.lastanode	= null;
    this.lastbnode	= null;
    this.tuplecnt	= 0;
//        this.lastbnode    = lastbnode;//lastnode==null? root: lastnode;
//        this.tuplecnt    = tuplecnt;
    this.varinfos	= new HashMap();
    this.alpha	= false;	// Will only be temporarily activated when building object conditions
  }
   
origin: net.sourceforge.jadex/jadex-rules

/**
 *  Notification when an object has been added to the state.
 *  @param id The object id.
 *  @param type The object type.
 */
public void objectAdded(Object id, OAVObjectType type, boolean root)
{
  assert !running;
  running    = true;
  
  state.getProfiler().start(IProfiler.TYPE_OBJECT, type);
  state.getProfiler().start(IProfiler.TYPE_OBJECTEVENT, IProfiler.OBJECTEVENT_ADDED);
  node.addObject(id, type, state, retemem, agenda);
  state.getProfiler().stop(IProfiler.TYPE_OBJECTEVENT, IProfiler.OBJECTEVENT_ADDED);
  state.getProfiler().stop(IProfiler.TYPE_OBJECT, type);
    
  running    = false;
}
 
origin: net.sourceforge.jadex/jadex-rules

  /**
   *  Initialize the pattern matcher.
   *  Called before the agenda is accessed
   *  to perform any initialization, if necessary.
   */
  public void init()
  {
    // Initialize initial fact node, if any.
    if(node.getInitialFactNode()!=null)
      node.getInitialFactNode().init(state, retemem, agenda);
    
    // Add initial objects.
    for(Iterator objects=state.getDeepObjects(); objects.hasNext(); )
    {
      Object    object    = objects.next();
      objectAdded(object, state.getType(object), false);	// Hack!!! Should check if root?
    }

    state.addStateListener(this, true);
//        state.addStateListener(this, false);
  }
 
origin: org.activecomponents.jadex/jadex-rules

if(getRelevantAttributes().contains(attr))
  Set    tns    = getTypeNodes(type);
    assert !check || checkConsistency(mem);
Set    ins    = getIndirectNodes(attr, state.getTypeModel());
if(ins!=null)
origin: org.activecomponents.jadex/jadex-rules

/**
 *  Add a new test node. 
 *  @param eva The constraint evaluator.
 *  @param context The build context.
 */
protected void addTestNode(IConstraintEvaluator eva, BuildContext context)
{
  INode node = new TestNode(context.getRootNode().getNextNodeId(), eva);
  connectLeft(context.getLastBetaNode(), node, context);
  context.setLastBetaNode(node);
}
 
origin: net.sourceforge.jadex/jadex-rules

  /**
   *  Tell the condition system about a
   *  new object in the state.
   *  @param object The new object.
   */
  public void addObject(Object id, OAVObjectType type, IOAVState state, ReteMemory mem, AbstractAgenda agenda)
  {
//        if(type.getName().equals("goal"))
//            System.out.println("Value added: "+id+" "+type);
//        System.out.println("Value added: "+id+" "+type);
    
    state.getProfiler().start(IProfiler.TYPE_NODE, this);
    state.getProfiler().start(IProfiler.TYPE_NODEEVENT, IProfiler.NODEEVENT_OBJECTADDED);
    
    Set    tns    = getTypeNodes(type);
    
    if(tns!=null)
    {
      for(Iterator it=tns.iterator(); it.hasNext(); )
        ((AlphaNode)it.next()).addObject(id, state, mem, agenda);
      
      assert !check || checkConsistency(mem);
    }
//        else
//            System.out.println("No typenode(s) available for: "+type);

    state.getProfiler().stop(IProfiler.TYPE_NODEEVENT, IProfiler.NODEEVENT_OBJECTADDED);
    state.getProfiler().stop(IProfiler.TYPE_NODE, this);
  }
     
origin: org.activecomponents.jadex/jadex-rules

/**
 *  Add a new type node.
 *  @param type The type node.
 *  @param context the build context.
 */
protected void addTypeNode(OAVObjectType type, BuildContext context)
{
  assert type!=null : "***" + context;
  // Create new type node, if necessary 
  INode node = context.getRootNode().getTypeNode(type);
  if(node==null)
  {
    node = new TypeNode(context.getRootNode().getNextNodeId(), type);
    connectRight(context.getRootNode(), node, context);
  }
  context.setLastAlphaNode(node);
}    
 
origin: org.activecomponents.jadex/jadex-rules

/**
 *  Add an initial fact node.
 *  @param context    The build context.
 */
protected void addInitialFactNode(BuildContext context)
{
  // Todo: multiple initial fact nodes without sharing ?
  InitialFactNode node    = context.getRootNode().getInitialFactNode();
  if(node==null)
  {
    node    = new InitialFactNode(context.getRootNode().getNextNodeId());
    connectRight(context.getRootNode(), node, context);
  }
  // Update the context.
  context.setLastBetaNode(node);
  context.setTupleCount(1);
}
 
origin: net.sourceforge.jadex/jadex-rules

/**
 *  Add a new terminal node.
 *  @param rule The rule.
 *  @param context The build context.
 */
protected void addTerminalNode(IRule rule, BuildContext context)
{
  // Create and connect the terminal node
  
  Map varinfos = context.getVarInfos();
  Map extractors = new HashMap();
  for(Iterator it=varinfos.keySet().iterator(); it.hasNext(); )
  {
    Variable var = (Variable)it.next();
    if(!var.isTemporary())
      extractors.put(var.getName(), getLeftVariableExtractor(context, var));
  }
  
  TerminalNode tnode = new TerminalNode(context.getRootNode().getNextNodeId(), rule, extractors);
  connectLeft(context.getLastBetaNode(), tnode, context);
  
  // Save the terminal node for later removal
  context.getRootNode().putTerminalNode(tnode);
}
 
origin: org.activecomponents.jadex/jadex-rules

/**
 *  Notification when a rule has been added.
 *  @param rule The added rule.
 */
public void ruleAdded(IRule rule)
{
  node.addRule(rule);
}
 
jadex.rules.rulesystem.rete.nodesReteNode

Javadoc

ReteNode implementation of the IConditionSystem.

Most used methods

  • getTerminalNode
    Set the terminal node for a rule.
  • <init>
    Create a new rete system.
  • addObject
    Tell the condition system about a new object in the state.
  • addRule
    Add a rule to the network.
  • checkConsistency
    Check consistency of Rete network/memory. For debugging. Only performs some simple checks and does n
  • clone
  • getIndirectNodes
    Get the set of indirectly affected nodes for an attribute type.
  • getInitialFactNode
    Get the initial fact node (if any).
  • getNextNodeId
    Get the next nodecounter.
  • getRelevantAttributes
    Get the set of relevant attribute types.
  • getTypeNode
    Get the node for a type.
  • getTypeNodes
    Get the set of matching type nodes for a (sub)type.
  • getTypeNode,
  • getTypeNodes,
  • modifyObject,
  • putTerminalNode,
  • removeObject,
  • removeRule,
  • setInited,
  • getBuilder

Popular in Java

  • Start an intent from android
  • getSupportFragmentManager (FragmentActivity)
  • scheduleAtFixedRate (Timer)
    Schedules the specified task for repeated fixed-rate execution, beginning after the specified delay.
  • getSharedPreferences (Context)
  • Pointer (com.sun.jna)
    An abstraction for a native pointer data type. A Pointer instance represents, on the Java side, a na
  • Color (java.awt)
    The Color class is used encapsulate colors in the default sRGB color space or colors in arbitrary co
  • File (java.io)
    An "abstract" representation of a file system entity identified by a pathname. The pathname may be a
  • SecureRandom (java.security)
    This class generates cryptographically secure pseudo-random numbers. It is best to invoke SecureRand
  • Queue (java.util)
    A collection designed for holding elements prior to processing. Besides basic java.util.Collection o
  • Response (javax.ws.rs.core)
    Defines the contract between a returned instance and the runtime when an application needs to provid
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now