Package org.cipres.treebase.domain.matrix

Examples of org.cipres.treebase.domain.matrix.ColumnRange


    ColumnRangeConvertHelper columnRangeHelper = new ColumnRangeConvertHelper();

    // boolean found = false;
    // int lastWritten = -1;
    ColumnRange aRange = null; // new ColumnRange();

    for (int i = 0; i < listArray.length; i++) {
      if (listArray[i] == obj) {
        // found = true;
        if (continuing == 0) {
          // discountinue
          aRange = new ColumnRange();
          aRange.setStartColIndex(i - 1 + offset);
          // s += " " + (i + offset);
          // lastWritten = i;
          continuing = 1;
        } else if (continuing == 1) {
          // s += " - ";
          // continue
          // continuing = 2;
        }
      } else if (aRange != null) {
        // found the last index:
        aRange.setEndColIndex(i - 2 + offset);
        columnRangeHelper.getColRanges().add(aRange);
        aRange = null;
        continuing = 0;

        // if (lastWritten != i - 1) {
        // aRange.setEndColIndex(i - 1 + offset);
        //
        // // s += " " + (i-1 + offset);
        // lastWritten = i - 1;
        // } else {
        // lastWritten = -1;
        // }
        // continuing = 0;
      }
    }

    if (aRange != null) {
      aRange.setEndColIndex(listArray.length - 2 + offset);
      columnRangeHelper.getColRanges().add(aRange);
      aRange = null;
    }

    if (LOGGER.isDebugEnabled()) {
View Full Code Here


    ColumnRangeConvertHelper aHelper = new ColumnRangeConvertHelper();

    if (pBitsSpecsSet != null) {

      ColumnRange range = null;

      int continuing = 0;
      for (int ic = 0; ic < pNumChar; ic++) {
        if (pBitsSpecsSet.isSelected(ic)) {
          if (continuing == 0) {
            // discontinue
            range = new ColumnRange();
            range.setStartColIndex(CharacterStates.toExternal(ic) - 1);

            continuing = 1;
          } else if (continuing == 1) {
            // continue..
          }
        } else if (range != null) {
          // found the last index:
          range.setEndColIndex(CharacterStates.toExternal(ic - 1) - 1);
          aHelper.getColRanges().add(range);
          range = null;
          continuing = 0;
        }
      }

      if (range != null) {
        range.setEndColIndex(CharacterStates.toExternal(pNumChar - 1) - 1);
        aHelper.getColRanges().add(range);
      }
    }
    return aHelper;
  }
View Full Code Here

          ColumnRangeConvertHelper aHelper = new ColumnRangeConvertHelper();
          aHelper.setNumber(aNumber);

          int startIndex = CharacterStates.toExternal(iw);
          ColumnRange range = new ColumnRange();
          range.setStartColIndex(startIndex - 1);

          for (int ic = iw + 1; ic < pNumChar; ic = ic + 1) {
            pNumSpecsSet.placeValue(ic, secondNumber);
            if (secondNumber.equals(aNumber)) {
              if (continuing == 0) {
                // discontinue
                range = new ColumnRange();
                range.setStartColIndex(ic);

                continuing = 1;
              } else if (continuing == 1) {
                // continuing
              }
            } else if (range != null) {
              // found the last index:
              range.setEndColIndex(ic - 1);
              aHelper.getColRanges().add(range);
              range = null;
              continuing = 0;
            }
          }

          if (range != null) {
            range.setEndColIndex(pNumChar - 1);
            aHelper.getColRanges().add(range);
          }

          colRangeHelpers.add(aHelper);
View Full Code Here

        }

        someValues = false;

        int lastWritten = -1;
        ColumnRange range = null;
        for (int ic = 0; ic < pNumChar; ic++) {
         
          //for noncoding ranges, the interval is 3, need add 2:
          if (continuing > 0 && iw > 0 && ic < pNumChar -2) {
            ic = ic +2;
          }
         
          if (codonPossSet.equals(ic, posIndex)
            || (codonPossSet.getInt(ic) == MesquiteInteger.unassigned && (iw == unassignedPosition))) {
           
            if (continuing == 0) {
              lastWritten = ic;

              range = new ColumnRange();
              range.setStartColIndex(ic);
              if (interval > 1) {
                range.setRepeatInterval(interval);
              }
              aHelper.getColRanges().add(range);

              continuing = 1;
              someValues = true;
            } else if (continuing == 1) {
              continuing = 2;
              someValues = true;
            }
          } else if (continuing > 0) {
            if (lastWritten != ic - 1) {
              range.setEndColIndex(ic - 1);

              lastWritten = ic - 1;
              someValues = true;
            } else {
              // start index and end index should be the same:
              range.setEndColIndex(ic - 1);

              lastWritten = -1;
            }
            continuing = 0;
          }

        }

        if (continuing > 0) {
          range.setEndColIndex(pNumChar - 1);

          someValues = true;
        }

        // the column ranges are not null:
View Full Code Here

TOP

Related Classes of org.cipres.treebase.domain.matrix.ColumnRange

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.