コード例 #1
0
ファイル: ListedCond.java プロジェクト: e-ucm/eadventure
 @Override
 public String toString() {
   if (conditions.isEmpty()) {
     return "Empty list";
   } else {
     StringBuilder value = new StringBuilder("(");
     value.append(conditions.get(0));
     for (int i = 1; i < conditions.size(); i++) {
       value.append(" ").append(operator).append(" ").append(conditions.get(i));
     }
     return value.append(")").toString();
   }
 }
コード例 #2
0
ファイル: EngineNode.java プロジェクト: e-ucm/eadventure
  /**
   * Returns a descriptive string for a given object.
   *
   * @param o object to drive into.
   * @return
   */
  @SuppressWarnings("unchecked")
  private void appendDescription(
      EditorModel m, Object o, StringBuilder sb, int depth, int maxDepth) {
    if (maxDepth == depth) {
      return;
    }

    String indent = new String(new char[depth * 2]).replace('\0', ' ');

    if (o == null) {
      sb.append("(null)");
      return;
    }

    String id = "" + m.getEditorId(o);
    String cname = o.getClass().getSimpleName();
    if (o instanceof BasicElement) {
      sb.append(indent + cname + " (" + id + ")" + "\n");
      if (depth != maxDepth) {
        appendDependencies(this, m, sb);
      }
      appendParams(m, o, sb, depth, maxDepth);

    } else if (o instanceof EAdList) {
      EAdList target = (EAdList) o;
      sb.append(indent + cname + " (" + id + ")" + "\n");
      if (target.size() == 0) {
        sb.append(indent + "  (empty)\n");
      } else if (depth == maxDepth - 1) {
        sb.append(indent + "  (" + target.size() + " elements inside)\n");
      } else {
        for (int i = 0; i < target.size(); i++) {
          // visit all children-values of this list
          Object inner = target.get(i);
          if (inner != null) {
            appendDescription(m, inner, sb, depth + 1, maxDepth);
          }
        }
      }
    } else if (o instanceof EAdMap) {
      EAdMap<?> target = (EAdMap<?>) o;
      sb.append(indent + cname + " (" + id + ")" + "\n");
      int i = 0;
      if (target.size() == 0) {
        sb.append(indent + "  (empty)\n");
      } else if (depth == maxDepth - 1) {
        sb.append(indent + "  (" + target.size() + " elements inside)\n");
      } else {
        for (Map.Entry<?, ?> e : target.entrySet()) {
          if (e.getKey() != null) {
            appendDescription(m, e.getKey(), sb, depth + 1, maxDepth);
          }
          sb.append(indent + "  -m->\n");
          if (e.getValue() != null) {
            appendDescription(m, e.getValue(), sb, depth + 1, maxDepth);
          }
          i++;
        }
      }
    } else if (o instanceof EAdParam) {
      sb.append(indent + ((EAdParam) o).toStringData());
    } else if (o instanceof AssetDescriptor) {
      sb.append(indent + "asset" + " (" + id + "): " + ((AssetDescriptor) o).getId() + "\n");
      appendParams(m, o, sb, depth, maxDepth);
      if (depth != maxDepth) {
        appendDependencies(this, m, sb);
      }
    } else if (o instanceof Class) {
      sb.append(indent + ((Class<?>) o).getName() + "\n");
    } else {
      sb.append(indent + " (" + cname + "~" + o.toString() + ")\n");
    }
  }
コード例 #3
0
ファイル: ListedCond.java プロジェクト: e-ucm/eadventure
 public boolean removeCondition(Condition condition) {
   if (conditions.size() == 1) return false;
   else return (conditions.remove(condition));
 }
コード例 #4
0
ファイル: BezierShape.java プロジェクト: e-ucm/eadventure
 private void checkMoveTo() {
   if (points.size() == 0) {
     points.add(0);
     points.add(0);
   }
 }