@Test
  public void test() {
    EolElement eolElement = AST2EolElementProducer.parseAST("var a = new Sequence(Integer);");

    assertEquals(eolElement.getClass(), EolProgramImpl.class);

    EolProgram program = (EolProgram) eolElement;

    assertEquals(
        program.getBlock().getStatements().get(0).getClass(), AssignmentStatementImpl.class);

    AssignmentStatement assignmentStatement =
        (AssignmentStatement) program.getBlock().getStatements().get(0);

    assertEquals(assignmentStatement.getLhs().getClass(), VariableDeclarationExpressionImpl.class);
    VariableDeclarationExpression variableDeclarationExpression =
        (VariableDeclarationExpression) assignmentStatement.getLhs();
    assertEquals(variableDeclarationExpression.getName().getName(), "a");

    assertEquals(assignmentStatement.getRhs().getClass(), NewExpressionImpl.class);
    NewExpression newExpression = (NewExpression) assignmentStatement.getRhs();

    assertEquals(newExpression.getResolvedType().getClass(), SequenceTypeImpl.class);
    SequenceType sequenceType = (SequenceType) newExpression.getResolvedType();
    assertEquals(sequenceType.getContentType().getClass(), IntegerTypeImpl.class);
  }
  public boolean isProperlyContained() {
    boolean result = false;
    for (EolElement de : createdEolElements) {
      EolElement trace = de;
      while (!(de instanceof EvlProgram) && trace.getContainer() != null) {
        trace = trace.getContainer();
      }

      if (trace.equals(this.fetchEvlProgram())) {
        result = true;
      } else {
        result = false;
        System.err.println("The domElement is: " + trace.getClass());
        break;
      }
    }
    return result;
  }
Пример #3
0
 @Override
 public boolean appliesTo(EolElement dom) {
   // TODO Auto-generated method stub
   return dom.getClass().equals(TypeImpl.class);
 }