PageRenderTime 31ms CodeModel.GetById 19ms app.highlight 7ms RepoModel.GetById 1ms app.codeStats 0ms

/interpreter/tags/reactive-pattern-matching/src/edu/vub/at/objects/ATMessage.java

http://ambienttalk.googlecode.com/
Java | 102 lines | 12 code | 9 blank | 81 comment | 0 complexity | 4eff56701ddb693830a1258d313920be MD5 | raw file
  1/**
  2 * AmbientTalk/2 Project
  3 * ATMessageCreation.java created on 31-jul-2006 at 11:57:29
  4 * (c) Programming Technology Lab, 2006 - 2007
  5 * Authors: Tom Van Cutsem & Stijn Mostinckx
  6 * 
  7 * Permission is hereby granted, free of charge, to any person
  8 * obtaining a copy of this software and associated documentation
  9 * files (the "Software"), to deal in the Software without
 10 * restriction, including without limitation the rights to use,
 11 * copy, modify, merge, publish, distribute, sublicense, and/or
 12 * sell copies of the Software, and to permit persons to whom the
 13 * Software is furnished to do so, subject to the following
 14 * conditions:
 15 *
 16 * The above copyright notice and this permission notice shall be
 17 * included in all copies or substantial portions of the Software.
 18 *
 19 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
 20 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
 21 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
 22 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
 23 * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
 24 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
 25 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
 26 * OTHER DEALINGS IN THE SOFTWARE.
 27 */
 28package edu.vub.at.objects;
 29
 30import edu.vub.at.exceptions.InterpreterException;
 31import edu.vub.at.objects.grammar.ATMessageCreation;
 32import edu.vub.at.objects.grammar.ATSymbol;
 33
 34/**
 35 * ATMessage represents a first-class AmbientTalk asynchronous message.
 36 * <p>
 37 * Asynchronous messages may be created explicitly using the <tt><-m(args)</tt> syntax, or implicitly during an
 38 * asynchronous message send of the form <tt>o<-m(args)</tt>.
 39 * 
 40 * This interface has not to be confused with the {@link ATMessageCreation} interface in the grammar subpackage.
 41 * That interface represents an abstract grammar object representing the syntax tree of message creation.
 42 * This interface is the interface to the actual runtime message object.
 43 * 
 44 * @author tvcutsem
 45 */
 46public interface ATMessage extends ATObject {
 47	
 48	/**
 49	 * Returns the selector of message.
 50	 * <p>
 51	 * Messages always have a selector, a symbol denoting the field or method that needs to be sought for.
 52	 * 
 53	 * @return an {@link ATSymbol} denoting the selector
 54	 */
 55	public ATSymbol base_selector() throws InterpreterException;
 56	
 57	/**
 58	 * Returns the arguments passed to the invocation, if any.
 59	 * <p>
 60	 * Messages may optionally have a table of arguments.
 61	 * 
 62	 * @return an {@link ATTable} containing the arguments passed to the invocation.
 63	 * 
 64	 */
 65	public ATTable base_arguments() throws InterpreterException;
 66	
 67	/**
 68	 * Assigns the arguments passed of a first class method. 
 69	 * 
 70	 * @param arguments a table containing the arguments to be assigned.
 71	 * @return nil
 72	 */
 73	public ATNil base_arguments__opeql_(ATTable arguments) throws InterpreterException;
 74	
 75	/**
 76	 * Turns the receiver message into a unary closure that, when applied to a receiver
 77	 * object, sends the message to the receiver object, where the sender used is the
 78	 * object passed to from.
 79	 * 
 80	 * @param sender the object designating the sender of any message sent via the closure
 81	 * @return a unary closure that accepts a receiver object and sends the message to the receiver
 82	 */
 83	public ATClosure base_from(ATObject sender) throws InterpreterException;
 84	
 85	/**
 86	 * Sends this message to a particular receiver object. The way in which the message
 87	 * send will be performed (synchronous or asynchronous) depends on the kind of message.
 88	 * 
 89	 * @param receiver the object receiving the message denoted by this ATMessage.
 90	 * @param sender the object sending the message denoted by this ATMessage.
 91	 * @return the {@link ATObject} representing the value of the method invocation or message send.
 92	 * @throws InterpreterException if the method is not found or an error occurs while processing the method.
 93	 */
 94	public ATObject base_sendTo(ATObject receiver, ATObject sender) throws InterpreterException;
 95	
 96	/**
 97	 * Primitive implementation of {@link #base_sendTo(ATObject, ATObject)}.
 98	 * @param self the AmbientTalk object to which 'sendTo' was originally sent
 99	 */
100	public ATObject prim_sendTo(ATMessage self, ATObject receiver, ATObject sender) throws InterpreterException;
101	
102}