コード例 #1
0
 public Function_Index getExtendedPolygonIterator() {
   final List l = new LinkedList();
   for (final Iterator it = this.lLTL.iterator(); it.hasNext(); ) {
     final int[] iA = (int[]) it.next();
     l.add(new int[] {iA[1], iA[0]});
   }
   return PolygonFiller.polygonIteratorWithLessThans(
       PolygonFiller.clipPolygons(
           Generators.iteratorGenerator(
               IterationTools.addToEnd(
                   PolygonFiller.cloneEdgeList(
                           PolygonFillerTest.convertOldEdgeListToNewEdgeList(this.lREL))
                       .iterator(),
                   new PolygonFiller.Node(this.width, this.height, this.height, 1))),
           Generators.iteratorGenerator(
               IterationTools.addToEnd(
                   PolygonFiller.cloneEdgeList(
                           PolygonFillerTest.convertOldEdgeListToNewEdgeList(this.rREL))
                       .iterator(),
                   new PolygonFiller.Node(this.width, this.height, this.height, 1))),
           this.width + 1,
           this.height + 1),
       Generators.iteratorGenerator(this.rLTL.iterator()),
       Generators.iteratorGenerator(l.iterator()),
       new int[1000]);
 }
コード例 #2
0
  protected void setup(final int minWidth) throws Exception {
    super.setUp();
    this.r = new Random();
    this.minMaxOffset = 1 + (int) (Math.random() * 5);
    this.height = 2 * this.minMaxOffset + (int) (Math.random() * 300);
    this.width = 2 * this.minMaxOffset + (int) (Math.random() * 300);
    this.stateNumber = 3;
    this.d1 = MatrixIteratorTest.getRandomSeq(this.width + 1, 4);
    this.d2 = MatrixIteratorTest.getRandomSeq(this.height + 1, 4);
    final Object[] oA =
        ForwardBackwardMatrixIterTest.getStateMachine_Float(
            ForwardBackwardMatrixIterTest.getD(this.d1),
            ForwardBackwardMatrixIterTest.getD(this.d2),
            "bp/pecan/asymmetric.hmm",
            1001);

    this.setCellsForwardsLL = (Cell.CellCalculator) oA[0];
    this.setCellsBackwardsLL = (Cell.CellCalculator) oA[1];
    this.setCellsForwardsL = (Cell.CellCalculator) oA[2];
    this.setCellsForwardsR = (Cell.CellCalculator) oA[3];
    this.setCellsBackwardsL = (Cell.CellCalculator) oA[4];
    this.setCellsBackwardsR = (Cell.CellCalculator) oA[5];

    final List[] poly =
        PolygonFillerTest.getRandomPolygon(this.width, this.height, this.minMaxOffset, minWidth);
    this.lREL = poly[0];
    this.rREL = poly[1];
    // lLTL =
    // MatrixIteratorTest.getRandomLTPoints(PolygonFillerTest.convertOldEdgeListToNewEdgeList(lREL));
    // rLTL =
    // MatrixIteratorTest.getRandomLTPoints(PolygonFillerTest.convertOldEdgeListToNewEdgeList(rREL));

    this.eT =
        PolygonFillerTest.convertNewEdgeListToOldEdgeList(
            (List)
                IterationTools.append(
                    PolygonFiller.combineEdgeLists(
                        PolygonFiller.cloneEdgeList(
                                PolygonFillerTest.convertOldEdgeListToNewEdgeList(this.lREL))
                            .iterator(),
                        PolygonFiller.cloneEdgeList(
                                PolygonFillerTest.convertOldEdgeListToNewEdgeList(this.rREL))
                            .iterator()),
                    new ArrayList()));

    int[][] matrix = new int[this.height][this.width];
    PolygonFillerTest.fillInMatrix(
        matrix,
        PolygonFillerTest.convertNewEdgeListToOldEdgeList(
            PolygonFiller.cloneEdgeList(
                PolygonFillerTest.convertOldEdgeListToNewEdgeList(this.eT))),
        1,
        0);
    matrix = (int[][]) Array.transpose2DMatrix().fn(matrix);

    this.lLTL = MatrixIteratorTest.getRandomLTPPointsL(matrix);
    this.rLTL = MatrixIteratorTest.getRandomLTPPointsR(matrix);

    this.mI = new MatrixIterator(this.stateNumber, 1000);
    this.polygonClipper =
        PolygonFiller.clipPolygons(
            Generators.iteratorGenerator(
                PolygonFiller.cloneEdgeList(
                        PolygonFillerTest.convertOldEdgeListToNewEdgeList(this.lREL))
                    .iterator()),
            Generators.iteratorGenerator(
                PolygonFiller.cloneEdgeList(
                        PolygonFillerTest.convertOldEdgeListToNewEdgeList(this.rREL))
                    .iterator()),
            this.width,
            this.height);
    this.startStates =
        new float[] {
          (float) Math.log(1.0 / 3), (float) Math.log(1.0 / 3), (float) Math.log(1.0 / 3)
        };
    this.endStates =
        new float[] {
          (float) Math.log(1.0 / 3), (float) Math.log(1.0 / 3), (float) Math.log(1.0 / 3)
        };
  }