Package org.cipres.treebase.domain.matrix

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


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

        if (states.length > 1) {
          // multiple states, use compound element:
          CompoundMatrixElement compoundElement = new CompoundMatrixElement();
          Set<DiscreteMatrixElement> elements = new HashSet<DiscreteMatrixElement>();

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

          for (int i = 0; i < states.length; i++) {
            int aState = states[i];
            String stateName = categoricalData.getStateName(colIndex, aState);

            DiscreteMatrixElement anElement = createElement(
              columnChar,
              stateName,
              i,
              matrix);
            anElement.setColumn(matrixColumn);
            elements.add(anElement);

            anElement.appendValue(compoundValues);

            if (i < states.length - 1) {
              compoundValues.append(' ');
            }
          }

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

          compoundElement.setElements(elements);
          element = compoundElement;

        } else {
          // single state, use single element:
          String stateName = categoricalData.getStateName(colIndex, states[0]);
View Full Code Here


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

        if (states.length > 1) {
          // multiple states, use compound element:
          CompoundMatrixElement compoundElement = new CompoundMatrixElement();
          Set<DiscreteMatrixElement> elements = new HashSet<DiscreteMatrixElement>();

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

          for (int i = 0; i < states.length; i++) {
            int aState = states[i];
            String stateName = categoricalData.getStateName(colIndex, aState);

            DiscreteMatrixElement anElement = createElement(
              columnChar,
              stateName,
              i,
              matrix);
            anElement.setColumn(matrixColumn);
            elements.add(anElement);

            anElement.appendValue(compoundValues);

            if (i < states.length - 1) {
              compoundValues.append(' ');
            }
          }

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

          compoundElement.setElements(elements);
          element = compoundElement;

        } else {
          // single state, use single element:
          String stateName = categoricalData.getStateName(colIndex, states[0]);
View Full Code Here

      MatrixElement element = null;

      if (numItems > 1) {

        CompoundMatrixElement compoundElement = new CompoundMatrixElement();
        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 = continuousData.getItem(j);
          double elementValue = anItem.getValue(colIndex, pRowIndex);

          ContinuousMatrixElement anElement = new ContinuousMatrixElement();
          anElement.setValue(elementValue);
          anElement.setColumn(matrixColumn);

          // This can be null, means the default definition 'AVG' is used.
          ItemDefinition definition = getItemDefMap().get(anItem);

          if (definition != null) {
            anElement.setDefinition(definition);
          }

          anElement.appendValue(compoundValues);

          if (j < numItems - 1) {
            compoundValues.append(' ');
          }
        }

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

        compoundElement.setElements(elements);
        element = compoundElement;

      } else {
        // single item definition, use single element:
        double elementValue = continuousData.getState(colIndex, pRowIndex, 0);
View Full Code Here

TOP

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

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.