Package org.cipres.treebase.dao.jdbc

Examples of org.cipres.treebase.dao.jdbc.DiscreteMatrixElementJDBC


      StringBuffer rowSymbols = symbolBufs.get(rowIndex);

      // convert the mesquite character state to treebase state:
      long statesLong = categoricalData.getState(pColIndex, rowIndex);

      DiscreteMatrixElementJDBC element = new DiscreteMatrixElementJDBC();
      if (categoricalData.isInapplicable(pColIndex, rowIndex)) {
        // gap:
        element.setGap((short) 1);
        // symbol = pGapSymbol;
        rowSymbols.append(pGapSymbol);
      } else if (!categoricalData.isUnassigned(pColIndex, rowIndex)) {
        // not missing :
        // element = new DiscreteMatrixElementJDBC();

        int[] states = CategoricalState.expand(statesLong);

        if (states.length > 1) {
          // multiple states, create a compound element.
          // The original single element "element" is still used as a place holder.
          CompoundElementJDBC compoundElement = new CompoundElementJDBC();

          addDiscreteStateIds(
            states,
            pColIndex,
            categoricalData,
            rowSymbols,
            stateSymbolToIdMap,
            compoundElement);

          compoundElement.setColIndex(pColIndex);
          compoundElement.setRowIndex(rowIndex);
          pMatrixJDBC.getCompoundElements().add(compoundElement);

        } else { // XXX: Can the number of states be 0?  If so, we need a guard condition here 20090121 MJD
          // single state, use single element:
          //String stateName = categoricalData.getStateName(pColIndex, states[0]);
          char aSymbol = categoricalData.getSymbol(states[0]);
          rowSymbols.append(aSymbol);

          findDiscreteStateId(
            stateSymbolToIdMap,
            aSymbol,
            pGapSymbol,
            pMissingSymbol,
            element);
        }

      } else {
        rowSymbols.append(pMissingSymbol);
      }

      element.setElementOrder(pColIndex);
      element.setMatrixRowID(rowIds[rowIndex]);
      element.setMatrixColID(pColId);
      pElements.add(element);
    }
  }
View Full Code Here


      columnJDBCs.add(aColumnJDBC);
      int rowIndex = 0;
      for ( OTU xmlOTU : xmlMatrix.getOTUs().getAllOTUs() ) {
        @SuppressWarnings("unused")
        MatrixCell<CharacterState> xmlCell = xmlMatrix.getCell(xmlOTU, xmlCharacter);
        DiscreteMatrixElementJDBC element = new DiscreteMatrixElementJDBC();
        //element.setValue(xmlCell.getValue()); // XXX nested stateset lookup song & dance here
        element.setElementOrder(colIndex);       
        element.setMatrixRowID(rowIds[rowIndex]);
        element.setMatrixColID(colIds[colIndex]);
        elements.add(element);
        rowIndex++;
      }     
      colIndex++;
    }
View Full Code Here

TOP

Related Classes of org.cipres.treebase.dao.jdbc.DiscreteMatrixElementJDBC

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.