コード例 #1
0
  /**
   * Method to invoke when we encounter a block of text in the CSV file that is the contents of a
   * predicate variable.
   *
   * @param csvFile The csvFile we are currently parsing.
   * @param var The variable that we will be adding cells too.
   * @param arg The matrix template we are using when parsing individual matrix elements to put in
   *     the spreadsheet.
   * @return The next line in the file that is not part of the block of text in the CSV file.
   * @throws IOException If unable to read the file correctly.
   */
  private String parseMatrixVariable(
      final BufferedReader csvFile, final Variable var, final Argument arg) throws IOException {
    String line = csvFile.readLine();

    while ((line != null) && Character.isDigit(line.charAt(0))) {

      // Split the line into tokens using a comma delimiter.
      String[] tokens = line.split(",");

      Cell newCell = var.createCell();
      // Set the onset and offset from tokens in the line.
      newCell.setOnset(tokens[DATA_ONSET]);
      newCell.setOffset(tokens[DATA_OFFSET]);

      // Strip the brackets from the first and last argument.
      tokens[DATA_INDEX] = tokens[DATA_INDEX].substring(1, tokens[DATA_INDEX].length());

      int end = tokens.length - 1;
      tokens[end] = tokens[end].substring(0, tokens[end].length() - 1);
      parseFormalArgs(tokens, DATA_INDEX, var.getVariableType(), (MatrixValue) newCell.getValue());

      // Get the next line in the file for reading.
      line = csvFile.readLine();
    }

    return line;
  }
コード例 #2
0
ファイル: TextGrid.java プロジェクト: pepijnve/ditaa
 public boolean isBullet(Cell cell) {
   char c = get(cell);
   return (c == 'o' || c == '*')
       && isBlank(cell.getEast())
       && isBlank(cell.getWest())
       && Character.isLetterOrDigit(get(cell.getEast().getEast()));
 }
コード例 #3
0
ファイル: TextGrid.java プロジェクト: pepijnve/ditaa
  private CellSet seedFillOld(Cell seed, char newChar) {
    CellSet cellsFilled = new CellSet();
    char oldChar = get(seed);

    if (oldChar == newChar) return cellsFilled;
    if (isOutOfBounds(seed)) return cellsFilled;

    Stack<Cell> stack = new Stack<Cell>();

    stack.push(seed);

    while (!stack.isEmpty()) {
      Cell cell = stack.pop();

      set(cell, newChar);
      cellsFilled.add(cell);

      Cell nCell = cell.getNorth();
      Cell sCell = cell.getSouth();
      Cell eCell = cell.getEast();
      Cell wCell = cell.getWest();

      if (get(nCell) == oldChar) stack.push(nCell);
      if (get(sCell) == oldChar) stack.push(sCell);
      if (get(eCell) == oldChar) stack.push(eCell);
      if (get(wCell) == oldChar) stack.push(wCell);
    }

    return cellsFilled;
  }
コード例 #4
0
ファイル: TextGrid.java プロジェクト: pepijnve/ditaa
 public CellSet followCorner4(Cell cell, Cell blocked) {
   if (!isCorner4(cell)) return null;
   CellSet result = new CellSet();
   if (!cell.getNorth().equals(blocked)) result.add(cell.getNorth());
   if (!cell.getEast().equals(blocked)) result.add(cell.getEast());
   return result;
 }
コード例 #5
0
ファイル: TextGrid.java プロジェクト: pepijnve/ditaa
  public void replacePointMarkersOnLine() {
    int width = getWidth();
    int height = getHeight();
    for (int yi = 0; yi < height; yi++) {
      for (int xi = 0; xi < width; xi++) {
        char c = get(xi, yi);
        Cell cell = new Cell(xi, yi);
        if (StringUtils.isOneOf(c, pointMarkers) && isStarOnLine(cell)) {

          boolean isOnHorizontalLine = false;
          if (StringUtils.isOneOf(get(cell.getEast()), horizontalLines)) isOnHorizontalLine = true;
          if (StringUtils.isOneOf(get(cell.getWest()), horizontalLines)) isOnHorizontalLine = true;

          boolean isOnVerticalLine = false;
          if (StringUtils.isOneOf(get(cell.getNorth()), verticalLines)) isOnVerticalLine = true;
          if (StringUtils.isOneOf(get(cell.getSouth()), verticalLines)) isOnVerticalLine = true;

          if (isOnHorizontalLine && isOnVerticalLine) {
            set(xi, yi, '+');
            if (DEBUG) System.out.println("replaced marker on line '" + c + "' with +");
          } else if (isOnHorizontalLine) {
            set(xi, yi, '-');
            if (DEBUG) System.out.println("replaced marker on line '" + c + "' with -");
          } else if (isOnVerticalLine) {
            set(xi, yi, '|');
            if (DEBUG) System.out.println("replaced marker on line '" + c + "' with |");
          }
        }
      }
    }
  }
コード例 #6
0
ファイル: NaiveBayes.java プロジェクト: hamiltontj/NaiveBayes
  public static void generateTrainingDataFromFile(
      String
          fileLocation) // Requires that the original file had the metadata and requires that this
        // file is formated the same in first sheet
      {
    testDataLL = (LinkedList<String[]>) dataLL.clone();
    actualClassifications = (LinkedList<String>) classificationsLL.clone();

    FileInputStream file;
    try {
      file = new FileInputStream(new File(fileLocation));
      Workbook excelFile = new HSSFWorkbook(file);
      Sheet sheet1 = excelFile.getSheetAt(0); // Data sheet
      for (Row row : sheet1) {
        String data[] = new String[row.getPhysicalNumberOfCells() - 1];
        String classification = "";

        int offset =
            0; // Used so that we can declare an array of the size of the attributes without the
        // classification
        for (Cell cell : row) {
          int index = cell.getColumnIndex();
          if (classificationLocation != index) {
            data[index - offset] = cell.toString();
          } else {
            classification = cell.toString();
            offset++;
          }
        }

        // Even though data and classifications are not really used add it onto the end so it is
        // still complete for in the event they end up being used in a later version
        dataLL.add(data);
        classificationsLL.add(classification);

        trainingDataLL.add(data);
        knownClassifications.add(classification);

        // Check to see if we have seen that classification yet
        int occurrences = 0;
        for (int i = 0; i < classificationTypes.size() && occurrences == 0; i++) {
          if (classificationTypes.get(i).compareTo(classification) == 0) {
            occurrences = 1;
          }
        }
        if (occurrences == 0) {
          classificationTypes.add(classification);
        }
      }
      excelFile.close();
    } catch (FileNotFoundException e) {
      System.out.println("Error file not found");
      System.exit(0);
    } catch (IOException e) {
      System.out.println("Unable to read file, disk drive may be failing");
      e.printStackTrace();
      System.exit(0);
    }
  }
コード例 #7
0
 private Object getNumericCellValue(final Cell cell) {
   Object cellValue;
   if (DateUtil.isCellDateFormatted(cell)) {
     cellValue = new Date(cell.getDateCellValue().getTime());
   } else {
     cellValue = cell.getNumericCellValue();
   }
   return cellValue;
 }
コード例 #8
0
 private int firstEmptyCellPosition(final Row cells) {
   int columnCount = 0;
   for (Cell cell : cells) {
     if (cell.getCellType() == Cell.CELL_TYPE_BLANK) {
       break;
     }
     columnCount++;
   }
   return columnCount;
 }
コード例 #9
0
ファイル: TextGrid.java プロジェクト: pepijnve/ditaa
 public CellSet followCrossOnLine(Cell cell, Cell blocked) {
   CellSet result = new CellSet();
   if (isHorizontalCrossOnLine(cell)) {
     result.add(cell.getEast());
     result.add(cell.getWest());
   } else if (isVerticalCrossOnLine(cell)) {
     result.add(cell.getNorth());
     result.add(cell.getSouth());
   }
   if (result.contains(blocked)) result.remove(blocked);
   return result;
 }
コード例 #10
0
ファイル: TextGrid.java プロジェクト: pepijnve/ditaa
 public int otherStringsEndInTheSameColumn(Cell cell) {
   if (!isStringsEnd(cell)) return 0;
   int result = 0;
   int height = getHeight();
   for (int y = 0; y < height; y++) {
     Cell cCell = new Cell(cell.x, y);
     if (!cCell.equals(cell) && isStringsEnd(cCell)) {
       result++;
     }
   }
   return result;
 }
コード例 #11
0
ファイル: TextGrid.java プロジェクト: pepijnve/ditaa
 public void removeColorCodes() {
   for (CellColorPair o : findColorCodes()) {
     Cell cell = o.cell;
     set(cell, ' ');
     cell = cell.getEast();
     set(cell, ' ');
     cell = cell.getEast();
     set(cell, ' ');
     cell = cell.getEast();
     set(cell, ' ');
   }
 }
コード例 #12
0
  /** Test of evaluateAt method, of class ParameterisedGroup. */
  @Test
  public void testEvaluateAt() throws ParameterException {
    System.out.println("---  testEvaluateAt...");

    // SegmentLocation loc1 = new PostSynapticTerminalLocation(d2.getSegmentId(), 0.5f);

    assertEquals(0.5, pg1.evaluateAt(cell, d2, 0.5f), 0);
    assertEquals(15, pg2.evaluateAt(cell, d2, 0.5f), 0);

    //////// assertEquals(15, pg5.evaluateAt(cell, loc1), 0);

    // SegmentLocation loc2 = new PostSynapticTerminalLocation(d3.getSegmentId(), 0.5f);

    assertEquals(5d / 6d, pg1.evaluateAt(cell, d3, 0.5f), 1e-7);
    assertEquals(25, pg2.evaluateAt(cell, d3, 0.5f), 0);

    assertEquals(0.5, pg3.evaluateAt(cell, d3, 0.5f), 0);

    assertEquals(0, pg4.evaluateAt(cell, d3, 0), 0);
    assertEquals(5, pg4.evaluateAt(cell, d3, 0.5f), 0);

    SegmentLocation sl1 = new SegmentLocation(d3.getSegmentId(), 0.5f);

    assertEquals(
        25,
        pg5.evaluateAt(cell, cell.getSegmentWithId(sl1.getSegmentId()), sl1.getFractAlong()),
        0);

    assertEquals(30, pg5.evaluateAt(cell, d3, 1), 0);

    GenesisCompartmentalisation g = new GenesisCompartmentalisation();

    Cell gCell = g.getCompartmentalisation(cell);

    System.out.println(CellTopologyHelper.printDetails(cell, null));

    System.out.println(
        "Changed from morph: " + cell.getMorphSummary() + ", to morph: " + gCell.getMorphSummary());

    System.out.println("getSegmentMapper: " + g.getSegmentMapper());

    System.out.println(CellTopologyHelper.printDetails(gCell, null));

    SegmentLocation sl1_g = g.getSegmentMapper().mapSegmentLocation(sl1);

    System.out.println("Mapped: " + sl1 + " to " + sl1_g);

    assertEquals(
        25,
        pg5.evaluateAt(gCell, gCell.getSegmentWithId(sl1_g.getSegmentId()), sl1_g.getFractAlong()),
        0);
  }
コード例 #13
0
ファイル: TextGrid.java プロジェクト: pepijnve/ditaa
 public void replaceBullets() {
   int width = getWidth();
   int height = getHeight();
   for (int yi = 0; yi < height; yi++) {
     for (int xi = 0; xi < width; xi++) {
       Cell cell = new Cell(xi, yi);
       if (isBullet(cell)) {
         set(cell, ' ');
         set(cell.getEast(), '\u2022');
       }
     }
   }
 }
コード例 #14
0
ファイル: TextGrid.java プロジェクト: pepijnve/ditaa
 public CellSet followIntersection(Cell cell, Cell blocked) {
   if (!isIntersection(cell)) return null;
   CellSet result = new CellSet();
   Cell cN = cell.getNorth();
   Cell cS = cell.getSouth();
   Cell cE = cell.getEast();
   Cell cW = cell.getWest();
   if (hasEntryPoint(cN, 6)) result.add(cN);
   if (hasEntryPoint(cS, 2)) result.add(cS);
   if (hasEntryPoint(cE, 8)) result.add(cE);
   if (hasEntryPoint(cW, 4)) result.add(cW);
   if (result.contains(blocked)) result.remove(blocked);
   return result;
 }
コード例 #15
0
ファイル: Matrix.java プロジェクト: Abr3u/Spreadsheet
 public void copyIntervalToBuffer(Intervalo i, boolean delete) {
   int l = -1, c = -1;
   Cell aux;
   _cutBuffer.clear();
   for (Cell cel : i.getList()) {
     if (l == -1 || c == -1) {
       l = cel.getLinha() - 1;
       c = cel.getColuna() - 1;
     }
     aux = new Cell(cel.getLinha() - l, cel.getColuna() - c);
     aux.setConteudo(cel.getConteudo());
     _cutBuffer.add(aux);
     if (delete) removeCell(cel.getLinha(), cel.getColuna());
   }
 }
コード例 #16
0
ファイル: Table2.java プロジェクト: Traple/TableExtraction
  /**
   * This method is used for extraction of tables with lot of empty cells in it. It is required for
   * the successful extraction of most Matrix tables.
   */
  private void fillBlankCells() {
    // We say: cells get a line number. If a column does not contain a cell on a certain line, add a
    // whitespace.
    // Any cell that is not filled must be empty:
    for (Line line : data) {
      int lineNumber = line.getLineNumber();
      COLUMNLOOP:
      for (Column2 column : dataInColumns) {
        for (Cell cell : column.getCellObjects()) {
          if (cell.getLineNumber() == lineNumber) {
            break;
          }
          if (cell.getLineNumber() > line.getLineNumber()) { // the last cell?
            // Add a blank cell to this column.
            //                        System.out.println("Add line to :" + column + " in line: " +
            // line.getLineNumber());

            // <span class='ocrx_word' id='word_9' title="bbox 2175 514 2346 555">were</span>

            Tag t = Tag.valueOf("span");
            Attributes attributes = new Attributes();
            attributes.put("class", "ocrx_word");
            attributes.put("id", "word_ADDEDBYTEA");
            attributes.put(
                "title",
                "bbox "
                    + column.getAverageX1()
                    + " "
                    + (int) line.getAverageY1()
                    + " "
                    + column.getAverageX2()
                    + " "
                    + (int) line.getAverageY2());

            Element newElement = new Element(t, "localhost:8080", attributes);
            newElement.text(" ");
            ArrayList<Element> newCell = new ArrayList<Element>();
            newCell.add(newElement);
            //                        System.out.println("adding: " +newElement.text());
            column.addCell(newCell);
            break COLUMNLOOP;
          }
        }
      }
    }
  }
コード例 #17
0
ファイル: TextGrid.java プロジェクト: pepijnve/ditaa
 public CellSet followStub(Cell cell, Cell blocked) {
   if (!isStub(cell)) return null;
   CellSet result = new CellSet();
   if (isBoundary(cell.getEast())) result.add(cell.getEast());
   else if (isBoundary(cell.getWest())) result.add(cell.getWest());
   else if (isBoundary(cell.getNorth())) result.add(cell.getNorth());
   else if (isBoundary(cell.getSouth())) result.add(cell.getSouth());
   if (result.contains(blocked)) result.remove(blocked);
   return result;
 }
コード例 #18
0
ファイル: TextGrid.java プロジェクト: pepijnve/ditaa
 /**
  * Returns the neighbours of a line-cell that are boundaries (0 to 2 cells are returned)
  *
  * @return null if the cell is not a line
  */
 public CellSet followLine(Cell cell) {
   if (isHorizontalLine(cell)) {
     CellSet result = new CellSet();
     if (isBoundary(cell.getEast())) result.add(cell.getEast());
     if (isBoundary(cell.getWest())) result.add(cell.getWest());
     return result;
   } else if (isVerticalLine(cell)) {
     CellSet result = new CellSet();
     if (isBoundary(cell.getNorth())) result.add(cell.getNorth());
     if (isBoundary(cell.getSouth())) result.add(cell.getSouth());
     return result;
   }
   return null;
 }
コード例 #19
0
  /**
   * Method to invoke when we encounter a block of text in the CSV file that is the contents of a
   * variable.
   *
   * @param csvFile The csvFile we are currently parsing.
   * @param var The variable that we will be adding cells too.
   * @param The populator to use when converting the contents of the cell into a datavalue that can
   *     be inserted into the spreadsheet.
   * @return The next line in the file that is not part of the block of text in the CSV file.
   * @throws IOException If unable to read the file correctly.
   */
  private String parseEntries(
      final BufferedReader csvFile, final Variable var, final EntryPopulator populator)
      throws IOException {

    // Keep parsing lines and putting them in the newly formed nominal
    // variable until we get to a line indicating the end of file or a new
    // variable section.
    String line = csvFile.readLine();

    while ((line != null) && Character.isDigit(line.charAt(0))) {

      // Split the line into tokens using a comma delimiter.
      String[] tokens = line.split(",");

      // BugzID: 1075 - If the line ends with an escaped new line - add
      // the next line to the current text field.
      while ((line != null) && line.endsWith("\\") && !line.endsWith("\\\\")) {
        line = csvFile.readLine();

        String content = tokens[tokens.length - 1];
        content = content.substring(0, content.length() - 1);
        tokens[tokens.length - 1] = content + '\n' + line;
      }

      Cell newCell = var.createCell();

      // Set the onset and offset from tokens in the line.
      newCell.setOnset(tokens[DATA_ONSET]);
      newCell.setOffset(tokens[DATA_OFFSET]);
      populator.populate(tokens, newCell.getValue());

      // Get the next line in the file for reading.
      line = csvFile.readLine();
    }

    return line;
  }
コード例 #20
0
ファイル: TextGrid.java プロジェクト: pepijnve/ditaa
  /**
   * Locates and returns the '*' boundaries that we would encounter if we did a flood-fill at <code>
   * seed</code>.
   */
  public CellSet findBoundariesExpandingFrom(Cell seed) {
    CellSet boundaries = new CellSet();
    char oldChar = get(seed);

    if (isOutOfBounds(seed)) return boundaries;

    char newChar = 1; // TODO: kludge

    Stack<Cell> stack = new Stack<Cell>();

    stack.push(seed);

    while (!stack.isEmpty()) {
      Cell cell = stack.pop();

      set(cell, newChar);

      Cell nCell = cell.getNorth();
      Cell sCell = cell.getSouth();
      Cell eCell = cell.getEast();
      Cell wCell = cell.getWest();

      if (get(nCell) == oldChar) stack.push(nCell);
      else if (get(nCell) == '*') boundaries.add(nCell);

      if (get(sCell) == oldChar) stack.push(sCell);
      else if (get(sCell) == '*') boundaries.add(sCell);

      if (get(eCell) == oldChar) stack.push(eCell);
      else if (get(eCell) == '*') boundaries.add(eCell);

      if (get(wCell) == oldChar) stack.push(wCell);
      else if (get(wCell) == '*') boundaries.add(wCell);
    }

    return boundaries;
  }
コード例 #21
0
  protected org.zkoss.poi.ss.usermodel.Font getPoiFontFromRichText(
      Workbook book, Cell cell, RichTextString rstr, int run) {
    if (run < 0) return null; // ZSS-1138

    org.zkoss.poi.ss.usermodel.Font font =
        rstr instanceof HSSFRichTextString
            ? book.getFontAt(((HSSFRichTextString) rstr).getFontOfFormattingRun(run))
            : ((XSSFRichTextString) rstr).getFontOfFormattingRun((XSSFWorkbook) book, run);
    if (font == null) {
      CellStyle style = cell.getCellStyle();
      short fontIndex = style != null ? style.getFontIndex() : (short) 0;
      return book.getFontAt(fontIndex);
    }
    return font;
  }
コード例 #22
0
  private Object objectFrom(final HSSFWorkbook workbook, final Cell cell) {
    Object cellValue = null;

    if (cell.getCellType() == Cell.CELL_TYPE_STRING) {
      cellValue = cell.getRichStringCellValue().getString();
    } else if (cell.getCellType() == Cell.CELL_TYPE_NUMERIC) {
      cellValue = getNumericCellValue(cell);
    } else if (cell.getCellType() == Cell.CELL_TYPE_BOOLEAN) {
      cellValue = cell.getBooleanCellValue();
    } else if (cell.getCellType() == Cell.CELL_TYPE_FORMULA) {
      cellValue = evaluateCellFormula(workbook, cell);
    }

    return cellValue;
  }
コード例 #23
0
ファイル: Matrix.java プロジェクト: Abr3u/Spreadsheet
 public void pasteInterval(int[] cord) throws InvalidOperation {
   int colunamax, linhamax, i = 0;
   if (cord.length == 2) {
     cord[0]--;
     cord[1]--;
     for (Cell c : getCutBuffer()) {
       linhamax = cord[0] + c.getLinha();
       colunamax = cord[1] + c.getColuna();
       if (linhamax <= _linhas && colunamax <= _colunas) {
         pasteCell(getCell(cord[0] + c.getLinha(), cord[1] + c.getColuna()), i);
         i++;
       }
     }
   } else {
     if (_cutBuffer.size() == intervalLen(cord)) {
       Intervalo inter = new Intervalo(cord, this);
       for (Cell c : inter.getList()) {
         pasteCell(getCell(c.getLinha(), c.getColuna()), i);
         i++;
       }
     }
   }
 }
コード例 #24
0
ファイル: Excel.java プロジェクト: wixb50/ExcelToXml
 /**
  * 获得指定位置的值,返回object,可为数值,字符串,布尔类型,null类型
  *
  * @param column
  * @return
  */
 public Object getCellValueObject(int rowNum, int column) {
   // 定义返回的数组
   Object tempObject = null;
   row = sheet.getRow(rowNum);
   cell = row.getCell(column);
   // 判断值类型
   switch (cell.getCellType()) {
       // 字符串类型
     case Cell.CELL_TYPE_STRING:
       tempObject = cell.getRichStringCellValue().getString();
       // System.out.println(cell.getRichStringCellValue().getString());
       break;
       // 数值类型
     case Cell.CELL_TYPE_NUMERIC:
       if (DateUtil.isCellDateFormatted(cell)) {
         tempObject = cell.getDateCellValue();
         // System.out.println(cell.getDateCellValue());
       } else {
         tempObject = cell.getNumericCellValue();
         // System.out.println(cell.getNumericCellValue());
       }
       break;
       // 布尔类型
     case Cell.CELL_TYPE_BOOLEAN:
       tempObject = cell.getBooleanCellValue();
       // System.out.println(cell.getBooleanCellValue());
       break;
       // 数学公式类型
     case Cell.CELL_TYPE_FORMULA:
       tempObject = cell.getCellFormula();
       // System.out.println(cell.getCellFormula());
       break;
     default:
       System.out.println();
   }
   return tempObject;
 }
コード例 #25
0
ファイル: TextGrid.java プロジェクト: pepijnve/ditaa
 public boolean isSouthArrowhead(Cell cell) {
   return (get(cell) == 'v' || get(cell) == 'V') && isVerticalLine(cell.getNorth());
 }
コード例 #26
0
  @Before
  public void setUp() {
    System.out.println("---------------   setUp() ParameterisedGroupTest");

    cell = new OneSegment("Simple");

    d1 =
        cell.addDendriticSegment(
            1, "d1", new Point3f(10, 0, 0), cell.getFirstSomaSegment(), 1, "Sec1", false);
    d2 = cell.addDendriticSegment(2, "d2", new Point3f(20, 0, 0), d1, 1, "Sec2", false);
    d3 = cell.addDendriticSegment(7, "d3", new Point3f(20, 10, 0), d2, 1, "Sec3", false);

    d3.getSection().setStartRadius(3);

    d1.getSection().setNumberInternalDivisions(4);
    d2.getSection().setNumberInternalDivisions(3);
    d3.getSection().setNumberInternalDivisions(5);

    d3.getSection().addToGroup(tipSection);

    pg1 =
        new ParameterisedGroup(
            "ZeroToOne",
            Section.DENDRITIC_GROUP,
            Metric.PATH_LENGTH_FROM_ROOT,
            ProximalPref.MOST_PROX_AT_0,
            DistalPref.MOST_DIST_AT_1,
            "p1");

    pg2 =
        new ParameterisedGroup(
            "StartToEnd",
            Section.DENDRITIC_GROUP,
            Metric.PATH_LENGTH_FROM_ROOT,
            ProximalPref.NO_TRANSLATION,
            DistalPref.NO_NORMALISATION,
            "p2");

    pg3 =
        new ParameterisedGroup(
            "TipZeroToOne",
            tipSection,
            Metric.PATH_LENGTH_FROM_ROOT,
            ProximalPref.MOST_PROX_AT_0,
            DistalPref.MOST_DIST_AT_1,
            "p3");

    pg4 =
        new ParameterisedGroup(
            "TipToEnd",
            tipSection,
            Metric.PATH_LENGTH_FROM_ROOT,
            ProximalPref.MOST_PROX_AT_0,
            DistalPref.NO_NORMALISATION,
            "p4");

    pg5 =
        new ParameterisedGroup(
            "TipToEnd_PathFromRoot",
            tipSection,
            Metric.PATH_LENGTH_FROM_ROOT,
            ProximalPref.NO_TRANSLATION,
            DistalPref.NO_NORMALISATION,
            "p5");

    /*
    pg5 = new ParameterisedGroup("3DDistZeroToOne",
                               Section.ALL,
                               Metric.THREE_D_RADIAL_POSITION,
                               ProximalPref.MOST_PROX_AT_0,
                               DistalPref.MOST_DIST_AT_1);*/

  }
コード例 #27
0
ファイル: TextGrid.java プロジェクト: pepijnve/ditaa
 /** true if the cell is not blank but the next (east) is */
 public boolean isStringsEnd(Cell cell) {
   return (!isBlank(cell) && isBlank(cell.getEast()));
 }
コード例 #28
0
ファイル: TextGrid.java プロジェクト: pepijnve/ditaa
 /** true if the cell is not blank but the previous (west) is */
 public boolean isStringsStart(Cell cell) {
   return (!isBlank(cell) && isBlank(cell.getWest()));
 }
コード例 #29
0
ファイル: Project2Excel.java プロジェクト: hius74/projects
  private void saveExcelPoject(File file) throws IOException {
    Workbook wb = new XSSFWorkbook();
    Sheet sheet = wb.createSheet("timeplan");
    // Заголовок в 0 строке
    Row row = sheet.createRow(0);
    Cell cell = row.createCell(0);
    cell.setCellValue("Филиал");
    cell = row.createCell(1);
    cell.setCellValue("Город");
    Calendar cal = Calendar.getInstance();
    cal.set(2017, 0, 5); // Начальная дата проекта
    SimpleDateFormat sdf = new SimpleDateFormat("dd.MM.yy");
    for (int i = 0; i < 3 * 52; i++) { // Счетчик по неделям
      cell = row.createCell(i + 2);
      cell.setCellValue(sdf.format(cal.getTime()));
      cal.add(Calendar.WEEK_OF_YEAR, 1); // Следующая неделя
    }

    // sheet.setColumnWidth(0, 256);

    // Цвета ячеек
    CellStyle[] styles = new CellStyle[6];
    styles[0] = wb.createCellStyle();
    styles[0].setFillForegroundColor(HSSFColor.RED.index);
    styles[0].setFillPattern(FillPatternType.SOLID_FOREGROUND);
    styles[1] = wb.createCellStyle();
    styles[1].setFillForegroundColor(HSSFColor.GREEN.index);
    styles[1].setFillPattern(FillPatternType.SOLID_FOREGROUND);
    styles[2] = wb.createCellStyle();
    styles[2].setFillForegroundColor(HSSFColor.BLUE.index);
    styles[2].setFillPattern(FillPatternType.SOLID_FOREGROUND);
    styles[3] = wb.createCellStyle();
    styles[3].setFillForegroundColor(HSSFColor.ROSE.index);
    styles[3].setFillPattern(FillPatternType.SOLID_FOREGROUND);
    styles[4] = wb.createCellStyle();
    styles[4].setFillForegroundColor(HSSFColor.LIGHT_BLUE.index);
    styles[4].setFillPattern(FillPatternType.SOLID_FOREGROUND);
    styles[5] = wb.createCellStyle();
    styles[5].setFillForegroundColor(HSSFColor.LIGHT_GREEN.index);
    styles[5].setFillPattern(FillPatternType.SOLID_FOREGROUND);

    short rowIdx = 0;
    for (Region region : this.regions) {
      row = sheet.createRow(++rowIdx);
      cell = row.createCell(0);
      cell.setCellValue(region.filial);
      cell = row.createCell(1);
      cell.setCellValue(region.name);

      cal = Calendar.getInstance();
      cal.set(2017, 0, 5); // Начальная дата проекта
      for (int i = 0; i < 3 * 52; i++) { // Счетчик по неделям
        short color = region.getDateColorIndex(cal.getTime());
        if (color >= 0) {
          cell = row.createCell(i + 2);
          cell.setCellStyle(styles[color]);
        }

        cal.add(Calendar.WEEK_OF_YEAR, 1); // Следующая неделя
      }
    }

    try (FileOutputStream fileOut = new FileOutputStream(file)) {
      wb.write(fileOut);
    }
  }
コード例 #30
0
ファイル: TextGrid.java プロジェクト: pepijnve/ditaa
 /** true if cell is blank and the east and west cells are not (used to find gaps between words) */
 public boolean isBlankBetweenCharacters(Cell cell) {
   return (isBlank(cell) && !isBlank(cell.getEast()) && !isBlank(cell.getWest()));
 }