Package org.cipres.treebase.dao.jdbc

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


   
      // add elements for the column
      for (int rowIndex = 0; rowIndex < rowIds.length; rowIndex++) {
       
        // place holder:
        ContinuousMatrixElementJDBC element = new ContinuousMatrixElementJDBC();
       
        // the compound element to be added later:
        CompoundElementJDBC compoundElement = new CompoundElementJDBC();
       
        //Set<ContinuousMatrixElement> elements = new HashSet<ContinuousMatrixElement>();

        // pre calculate the compound values and cache it in compoundElement.
        StringBuilder compoundValues = new StringBuilder();
        compoundValues.append('(');

        for (int j = 0; j < numItems; j++) {
          Double2DArray anItem = getItemDefinitions()[j];
          double elementValue = anItem.getValue(pColIndex, rowIndex);

          compoundElement.getValues().add(elementValue);
         
          String itemName = getItemDefinitionNames()[j];

          // This can be null, means the default definition 'AVG' is used.
          Long itemDefId = pMatrixJDBC.getItemDefNameToIDMap().get(itemName);
          if (itemDefId == null) {
            itemDefId = -1L;
          }
          compoundElement.getItemDefinitionIDs().add(itemDefId);
         
   
          compoundValues.append(elementValue);
          if (j < numItems - 1) {
            compoundValues.append(' ');
          }
        }

        compoundValues.append(')');
        compoundElement.setCompoundValue(compoundValues.toString());

        compoundElement.setColIndex(pColIndex);
        compoundElement.setRowIndex(rowIndex);
        pMatrixJDBC.getCompoundElements().add(compoundElement);
       
        element.setElementOrder(pColIndex);
        element.setMatrixRowID(rowIds[rowIndex]);
        element.setMatrixColID(pColId);
       
        pElements.add(element);
      }
    } else {
      // single item definition, use single element:
     
      // add elements for the column
      for (int rowIndex = 0; rowIndex < rowIds.length; rowIndex++) {
       
        ContinuousMatrixElementJDBC element = new ContinuousMatrixElementJDBC();
       
        if (continuousData.isInapplicable(pColIndex, rowIndex)) {
          // gap:
          element.setGap((short)1);
        } else if (!continuousData.isUnassigned(pColIndex, rowIndex)) {

          double elementValue = continuousData.getState(pColIndex, rowIndex, 0);
          element.setValue(elementValue);         
        }
       
        element.setElementOrder(pColIndex);
        element.setMatrixRowID(rowIds[rowIndex]);
        element.setMatrixColID(pColId);
       
        pElements.add(element);
 
    }
     
View Full Code Here


      aColumnJDBC.setPhyloChar(tbChar);     
      columnJDBCs.add(aColumnJDBC);
      int rowIndex = 0;
      for ( OTU xmlOTU : xmlMatrix.getOTUs().getAllOTUs() ) {
        MatrixCell<Double> xmlCell = xmlMatrix.getCell(xmlOTU, xmlCharacter);
        ContinuousMatrixElementJDBC element = new ContinuousMatrixElementJDBC();
        element.setValue(xmlCell.getValue());
        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.ContinuousMatrixElementJDBC

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.