/interpreter/tags/at_build150307/src/edu/vub/at/objects/coercion/ATConversions.java

http://ambienttalk.googlecode.com/ · Java · 136 lines · 88 code · 12 blank · 36 comment · 0 complexity · 18bc9fc95eca1680e9c547e86724d90b MD5 · raw file

  1. /**
  2. * AmbientTalk/2 Project
  3. * ATConversions.java created on Jul 23, 2006 at 2:20:16 PM
  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. */
  28. package edu.vub.at.objects.coercion;
  29. import edu.vub.at.actors.ATActorMirror;
  30. import edu.vub.at.actors.ATAsyncMessage;
  31. import edu.vub.at.actors.ATFarReference;
  32. import edu.vub.at.actors.natives.NATFarReference;
  33. import edu.vub.at.exceptions.InterpreterException;
  34. import edu.vub.at.exceptions.XTypeMismatch;
  35. import edu.vub.at.objects.ATBoolean;
  36. import edu.vub.at.objects.ATClosure;
  37. import edu.vub.at.objects.ATField;
  38. import edu.vub.at.objects.ATHandler;
  39. import edu.vub.at.objects.ATMessage;
  40. import edu.vub.at.objects.ATMethod;
  41. import edu.vub.at.objects.ATNumber;
  42. import edu.vub.at.objects.ATStripe;
  43. import edu.vub.at.objects.ATTable;
  44. import edu.vub.at.objects.grammar.ATAssignVariable;
  45. import edu.vub.at.objects.grammar.ATBegin;
  46. import edu.vub.at.objects.grammar.ATDefinition;
  47. import edu.vub.at.objects.grammar.ATExpression;
  48. import edu.vub.at.objects.grammar.ATMessageCreation;
  49. import edu.vub.at.objects.grammar.ATSplice;
  50. import edu.vub.at.objects.grammar.ATStatement;
  51. import edu.vub.at.objects.grammar.ATSymbol;
  52. import edu.vub.at.objects.grammar.ATUnquoteSplice;
  53. import edu.vub.at.objects.mirrors.NATMirage;
  54. import edu.vub.at.objects.natives.NATBoolean;
  55. import edu.vub.at.objects.natives.NATException;
  56. import edu.vub.at.objects.natives.NATFraction;
  57. import edu.vub.at.objects.natives.NATNumber;
  58. import edu.vub.at.objects.natives.NATNumeric;
  59. import edu.vub.at.objects.natives.NATObject;
  60. import edu.vub.at.objects.natives.NATTable;
  61. import edu.vub.at.objects.natives.NATText;
  62. import edu.vub.at.objects.symbiosis.JavaClass;
  63. import edu.vub.at.objects.symbiosis.JavaObject;
  64. /**
  65. * ATConversions is an interface defining all conversion methods between different
  66. * types of ambienttalk language elements. They are hidden from the language level
  67. * because they neither belong to base- nor meta-level.
  68. *
  69. * @author smostinc
  70. */
  71. public interface ATConversions {
  72. public boolean isClosure() throws InterpreterException;
  73. public boolean isSymbol() throws InterpreterException;
  74. public boolean isTable() throws InterpreterException;
  75. public boolean isBoolean() throws InterpreterException;
  76. public boolean isCallFrame() throws InterpreterException;
  77. public boolean isUnquoteSplice() throws InterpreterException;
  78. public boolean isVariableAssignment() throws InterpreterException;
  79. public boolean isSplice() throws InterpreterException;
  80. public boolean isMethod() throws InterpreterException;
  81. public boolean isMessageCreation() throws InterpreterException;
  82. public boolean isStripe() throws InterpreterException;
  83. public boolean isFarReference() throws InterpreterException;
  84. public ATClosure asClosure() throws InterpreterException;
  85. public ATSymbol asSymbol() throws InterpreterException;
  86. public ATTable asTable() throws InterpreterException;
  87. public ATBoolean asBoolean() throws InterpreterException;
  88. public ATNumber asNumber() throws InterpreterException;
  89. public ATMessage asMessage() throws InterpreterException;
  90. public ATField asField() throws InterpreterException;
  91. public ATMethod asMethod() throws InterpreterException;
  92. public ATHandler asHandler() throws InterpreterException;
  93. public ATStripe asStripe() throws InterpreterException;
  94. public ATFarReference asFarReference() throws InterpreterException;
  95. public ATAsyncMessage asAsyncMessage() throws InterpreterException;
  96. public ATActorMirror asActorMirror() throws InterpreterException;
  97. // Abstract Grammar Elements
  98. public ATStatement asStatement() throws InterpreterException;
  99. public ATDefinition asDefinition() throws InterpreterException;
  100. public ATExpression asExpression() throws InterpreterException;
  101. public ATBegin asBegin() throws InterpreterException;
  102. public ATMessageCreation asMessageCreation() throws InterpreterException;
  103. public ATUnquoteSplice asUnquoteSplice() throws InterpreterException;
  104. public ATAssignVariable asVariableAssignment() throws InterpreterException;
  105. public ATSplice asSplice() throws InterpreterException;
  106. // Native Value Elements
  107. public boolean isNativeBoolean();
  108. public boolean isNativeText();
  109. public boolean isAmbientTalkObject();
  110. public boolean isJavaObjectUnderSymbiosis();
  111. public boolean isNativeField();
  112. public NATObject asAmbientTalkObject() throws XTypeMismatch;
  113. public NATMirage asMirage() throws XTypeMismatch;
  114. public NATNumber asNativeNumber() throws XTypeMismatch;
  115. public NATFraction asNativeFraction() throws XTypeMismatch;
  116. public NATText asNativeText() throws XTypeMismatch;
  117. public NATTable asNativeTable() throws XTypeMismatch;
  118. public NATBoolean asNativeBoolean() throws XTypeMismatch;
  119. public NATNumeric asNativeNumeric() throws XTypeMismatch;
  120. public NATException asNativeException() throws XTypeMismatch;
  121. public NATFarReference asNativeFarReference() throws XTypeMismatch;
  122. public JavaObject asJavaObjectUnderSymbiosis() throws XTypeMismatch;
  123. public JavaClass asJavaClassUnderSymbiosis() throws XTypeMismatch;
  124. }