コード例 #1
0
  public void PrintAttribute(PrintNode row, AttributePath attributePath, ParserAdapter scda)
      throws Exception {
    ClassDef myClass = this.getClassDef(scda);
    if (attributePath.levelsOfIndirection() <= 0) {
      if (attributePath.attribute.equals("*")) {
        for (int j = 0; j < myClass.attributes.size(); j++) {
          Attribute currentAttribute = (Attribute) myClass.getAttribute(j);
          if (currentAttribute.getClass() == DVA.class) {
            Object dvaValue = dvaValues.get(currentAttribute.name);
            PrintCell cell = new PrintCell();
            cell.setOutput(String.format("%s", dvaValue));
            row.addCell(cell);
          }
        }
        if (myClass.getClass() == SubclassDef.class) {
          for (int i = 0; i < ((SubclassDef) myClass).numberOfSuperClasses(); i++) {
            String parentClass = (String) ((SubclassDef) myClass).getSuperClass(i);
            Integer parentUid = (Integer) this.parents.get(parentClass);
            WDBObject parent = scda.getObject(parentClass, parentUid);
            parent.PrintAttribute(row, attributePath, scda);
          }
        }
      } else {
        Attribute currentAttribute = (Attribute) myClass.getAttribute(attributePath.attribute);
        Object dvaValue = getDvaValue(attributePath.attribute, scda);
        PrintCell cell = new PrintCell();
        cell.setOutput(String.format("%s", dvaValue));
        row.addCell(cell);
      }
    } else {
      String evaName = attributePath.getIndirection(attributePath.levelsOfIndirection() - 1);
      WDBObject[] objects = this.getEvaObjects(evaName, scda);
      ArrayList<PrintNode> branch = row.getBranch(evaName);

      if (objects != null && objects.length > 0) {
        if (branch == null) {
          branch = row.newBranch(evaName, objects.length);
        }
        attributePath.removeIndirection(attributePath.levelsOfIndirection() - 1);
        for (int i = 0; i < objects.length; i++) {
          objects[i].PrintAttribute(branch.get(i), attributePath, scda);
        }
        attributePath.addIndirection(evaName);
      } else {
        if (branch == null) {
          branch = row.newBranch(evaName, 1);
          myClass.padAttribute(branch.get(0), attributePath, scda);
        }
      }

      row.updateBranchCols(evaName);
    }
  }