Exemple #1
0
 /**
  * Returns a string that can be read and executed by the USE shell achieving the same effect of
  * this command.
  */
 public String getUSEcmd() {
   MOperation op = fOpCall.operation();
   return "!openter "
       + fOpCall.target()
       + " "
       + op.name()
       + "("
       + StringUtil.fmtSeq(fOpCall.argExprs(), ",")
       + ")";
 }
Exemple #2
0
 public String toString() {
   String res = "";
   if (fAllHaveSameType) {
     Iterator it = fVarDecls.iterator();
     while (it.hasNext()) {
       VarDecl decl = (VarDecl) it.next();
       res += decl.name();
       if (it.hasNext()) res += ", ";
       else res += " : " + decl.type();
     }
   } else res = StringUtil.fmtSeq(fVarDecls.iterator(), ", ");
   return res;
 }
  @Override
  public String toString() {
    StringBuilder sb = new StringBuilder();

    sb.append(fAssociationClassName);
    if (fLinkObjectName != null) {
      sb.append(" ");
      sb.append(fLinkObjectName);
    }
    sb.append(" between (");

    StringUtil.fmtSeqWithSubSeq(sb, fParticipants, ",", qualifierValues, ",", "{", "}");

    sb.append(")");

    return sb.toString();
  }
  @Override
  protected MStatement generateStatement() throws CompilationFailedException {

    MAssociationClass associationClass =
        fContext.model().getAssociationClass(fAssociationClassName.toString());

    if (associationClass == null) {
      throw new CompilationFailedException(
          this,
          "Association class "
              + StringUtil.inQuotes(fAssociationClassName.toString())
              + " does not exist.");
    }

    List<MRValue> participants = generateAssociationParticipants(associationClass, fParticipants);

    List<List<MRValue>> qualifierRValues;
    if (this.qualifierValues == null || this.qualifierValues.isEmpty()) {
      qualifierRValues = Collections.emptyList();
    } else {
      qualifierRValues = new ArrayList<List<MRValue>>();

      for (List<ASTRValue> endQualifierValues : this.qualifierValues) {
        List<MRValue> endQualifierRValues;

        if (endQualifierValues == null || endQualifierValues.isEmpty()) {
          endQualifierRValues = Collections.emptyList();
        } else {
          endQualifierRValues = new ArrayList<MRValue>();

          for (ASTRValue value : endQualifierValues) {
            endQualifierRValues.add(this.generateRValue(value));
          }
        }
        qualifierRValues.add(endQualifierRValues);
      }
    }

    return new MNewLinkObjectStatement(
        associationClass,
        participants,
        qualifierRValues,
        (fLinkObjectName == null ? null : generateStringExpression(fLinkObjectName)));
  }
 public String toString() {
   return "(" + fOp + " " + StringUtil.fmtSeq(fArgs.iterator(), " ") + ")";
 }