001 /* 002 * Created on Jun 25, 2005 @author paulk 003 */ 004 package toolbus.atom.note; 005 006 import toolbus.TBTermFactory; 007 import toolbus.atom.Atom; 008 import toolbus.atom.Ref; 009 import toolbus.exceptions.ToolBusException; 010 import toolbus.parsercup.PositionInformation; 011 import toolbus.process.ProcessExpression; 012 import toolbus.process.ProcessInstance; 013 import aterm.ATerm; 014 015 public class RecNote extends Atom{ 016 public final ATerm notePattern; 017 018 public RecNote(ATerm msgpat, TBTermFactory tbfactory, PositionInformation posInfo){ 019 super(tbfactory, posInfo); 020 this.notePattern = msgpat; 021 setAtomArgs(new Ref[]{new Ref(msgpat)}); 022 } 023 024 public ProcessExpression copy(){ 025 Atom a = new RecNote(notePattern, tbfactory, getPosInfo()); 026 a.copyAtomAttributes(this); 027 return a; 028 } 029 030 public boolean execute() throws ToolBusException{ 031 ProcessInstance pi = getProcess(); 032 if(!pi.hasNotes()) return false; 033 if(isEnabled() && pi.getNoteFromQueue(notePattern, getEnv())) return true; 034 035 return false; 036 } 037 }