Пример #1
0
  public void buildParentChildRelationShipReferenced() {
    int iPosition = 0;
    for (String[] strMainIn : lstTalendMainIn) {
      for (int i = 0; i < 2; i++) {
        boolean bFound = false;
        for (tPaloDimensionElements tParentDimensionElement : lstPaloDimensionElements) {
          if (tParentDimensionElement.getElementName() != null
              && tParentDimensionElement.getElementName().equals(strMainIn[i])) {
            bFound = true;
            break;
          }
        }
        if (!bFound) {
          int iLevel = getElementLevel(strMainIn[0], 0);

          double dFactor = 1;
          // Check for factor
          if (strMainIn.length == 3 && i == 1) {
            try {
              dFactor = Double.parseDouble(strMainIn[2]);
            } catch (Exception e) {
            }
          }
          tPaloDimensionElements tDimensionElement =
              new tPaloDimensionElements(iPosition, strMainIn[i], -1, iLevel, dFactor);
          lstPaloDimensionElements.add(tDimensionElement);
          iPosition++;
        }
      }
    }
    for (String[] strMainIn : lstTalendMainIn) {
      for (tPaloDimensionElements tParentDimensionElement : lstPaloDimensionElements) {
        if (tParentDimensionElement.getElementName() != null
            && tParentDimensionElement.getElementName().equals(strMainIn[0])) {
          tPaloDimensionElements actElem = getDimenionElement(strMainIn[1]);
          if (null != actElem) {
            actElem.setLevel(tParentDimensionElement.getLevel() + 1);
            actElem.setParentPosition(tParentDimensionElement.getPosition());
          }
          break;
        }
      }
    }
  }
Пример #2
0
 public int compare(tPaloDimensionElements o1, tPaloDimensionElements o2) {
   if (o1.getLevel() > o2.getLevel()) return 1;
   else return -1;
 }