Search in sources :

Example 31 with Size2D

use of org.jfree.ui.Size2D in project SIMVA-SoS by SESoS.

the class PaintScaleLegend method arrange.

/**
 * Arranges the contents of the block, within the given constraints, and
 * returns the block size.
 *
 * @param g2  the graphics device.
 * @param constraint  the constraint (<code>null</code> not permitted).
 *
 * @return The block size (in Java2D units, never <code>null</code>).
 */
@Override
public Size2D arrange(Graphics2D g2, RectangleConstraint constraint) {
    RectangleConstraint cc = toContentConstraint(constraint);
    LengthConstraintType w = cc.getWidthConstraintType();
    LengthConstraintType h = cc.getHeightConstraintType();
    Size2D contentSize = null;
    if (w == LengthConstraintType.NONE) {
        if (h == LengthConstraintType.NONE) {
            contentSize = new Size2D(getWidth(), getHeight());
        } else if (h == LengthConstraintType.RANGE) {
            throw new RuntimeException("Not yet implemented.");
        } else if (h == LengthConstraintType.FIXED) {
            throw new RuntimeException("Not yet implemented.");
        }
    } else if (w == LengthConstraintType.RANGE) {
        if (h == LengthConstraintType.NONE) {
            throw new RuntimeException("Not yet implemented.");
        } else if (h == LengthConstraintType.RANGE) {
            contentSize = arrangeRR(g2, cc.getWidthRange(), cc.getHeightRange());
        } else if (h == LengthConstraintType.FIXED) {
            throw new RuntimeException("Not yet implemented.");
        }
    } else if (w == LengthConstraintType.FIXED) {
        if (h == LengthConstraintType.NONE) {
            throw new RuntimeException("Not yet implemented.");
        } else if (h == LengthConstraintType.RANGE) {
            throw new RuntimeException("Not yet implemented.");
        } else if (h == LengthConstraintType.FIXED) {
            throw new RuntimeException("Not yet implemented.");
        }
    }
    // suppress compiler warning
    assert contentSize != null;
    return new Size2D(calculateTotalWidth(contentSize.getWidth()), calculateTotalHeight(contentSize.getHeight()));
}
Also used : Size2D(org.jfree.ui.Size2D) LengthConstraintType(org.jfree.chart.block.LengthConstraintType) RectangleConstraint(org.jfree.chart.block.RectangleConstraint)

Example 32 with Size2D

use of org.jfree.ui.Size2D in project SIMVA-SoS by SESoS.

the class TextTitle method arrangeRN.

/**
 * Arranges the content for this title assuming a range constraint for the
 * width and no bounds on the height, and returns the required size.  This
 * will reflect the fact that a text title positioned on the left or right
 * of a chart will be rotated by 90 degrees.
 *
 * @param g2  the graphics target.
 * @param widthRange  the range for the width.
 *
 * @return The content size.
 *
 * @since 1.0.9
 */
protected Size2D arrangeRN(Graphics2D g2, Range widthRange) {
    Size2D s = arrangeNN(g2);
    if (widthRange.contains(s.getWidth())) {
        return s;
    }
    double ww = widthRange.constrain(s.getWidth());
    return arrangeFN(g2, ww);
}
Also used : Size2D(org.jfree.ui.Size2D)

Example 33 with Size2D

use of org.jfree.ui.Size2D in project SIMVA-SoS by SESoS.

the class TextTitle method arrangeRR.

/**
 * Returns the content size for the title.  This will reflect the fact that
 * a text title positioned on the left or right of a chart will be rotated
 * 90 degrees.
 *
 * @param g2  the graphics device.
 * @param widthRange  the width range.
 * @param heightRange  the height range.
 *
 * @return The content size.
 */
protected Size2D arrangeRR(Graphics2D g2, Range widthRange, Range heightRange) {
    RectangleEdge position = getPosition();
    if (position == RectangleEdge.TOP || position == RectangleEdge.BOTTOM) {
        float maxWidth = (float) widthRange.getUpperBound();
        g2.setFont(this.font);
        this.content = TextUtilities.createTextBlock(this.text, this.font, this.paint, maxWidth, this.maximumLinesToDisplay, new G2TextMeasurer(g2));
        this.content.setLineAlignment(this.textAlignment);
        Size2D contentSize = this.content.calculateDimensions(g2);
        if (this.expandToFitSpace) {
            return new Size2D(maxWidth, contentSize.getHeight());
        } else {
            return contentSize;
        }
    } else if (position == RectangleEdge.LEFT || position == RectangleEdge.RIGHT) {
        float maxWidth = (float) heightRange.getUpperBound();
        g2.setFont(this.font);
        this.content = TextUtilities.createTextBlock(this.text, this.font, this.paint, maxWidth, this.maximumLinesToDisplay, new G2TextMeasurer(g2));
        this.content.setLineAlignment(this.textAlignment);
        Size2D contentSize = this.content.calculateDimensions(g2);
        // transpose the dimensions, because the title is rotated
        if (this.expandToFitSpace) {
            return new Size2D(contentSize.getHeight(), maxWidth);
        } else {
            return new Size2D(contentSize.height, contentSize.width);
        }
    } else {
        throw new RuntimeException("Unrecognised exception.");
    }
}
Also used : Size2D(org.jfree.ui.Size2D) G2TextMeasurer(org.jfree.text.G2TextMeasurer) RectangleEdge(org.jfree.ui.RectangleEdge)

Example 34 with Size2D

use of org.jfree.ui.Size2D in project SIMVA-SoS by SESoS.

the class BorderArrangementTest method testSizing.

/**
 * Run some checks on sizing.
 */
@Test
public void testSizing() {
    BlockContainer container = new BlockContainer(new BorderArrangement());
    BufferedImage image = new BufferedImage(200, 100, BufferedImage.TYPE_INT_RGB);
    Graphics2D g2 = image.createGraphics();
    // TBLRC
    // 00000 - no items
    Size2D size = container.arrange(g2);
    assertEquals(0.0, size.width, EPSILON);
    assertEquals(0.0, size.height, EPSILON);
    // TBLRC
    // 00001 - center item only
    container.add(new EmptyBlock(123.4, 567.8));
    size = container.arrange(g2);
    assertEquals(123.4, size.width, EPSILON);
    assertEquals(567.8, size.height, EPSILON);
    // TBLRC
    // 00010 - right item only
    container.clear();
    container.add(new EmptyBlock(12.3, 45.6), RectangleEdge.RIGHT);
    size = container.arrange(g2);
    assertEquals(12.3, size.width, EPSILON);
    assertEquals(45.6, size.height, EPSILON);
    // TBLRC
    // 00011 - right and center items
    container.clear();
    container.add(new EmptyBlock(10.0, 20.0));
    container.add(new EmptyBlock(12.3, 45.6), RectangleEdge.RIGHT);
    size = container.arrange(g2);
    assertEquals(22.3, size.width, EPSILON);
    assertEquals(45.6, size.height, EPSILON);
    // try case where right item is shorter than center item
    container.clear();
    Block rb = new EmptyBlock(12.3, 15.6);
    container.add(new EmptyBlock(10.0, 20.0));
    container.add(rb, RectangleEdge.RIGHT);
    size = container.arrange(g2);
    assertEquals(22.3, size.width, EPSILON);
    assertEquals(20.0, size.height, EPSILON);
    assertEquals(20.0, rb.getBounds().getHeight(), EPSILON);
    // TBLRC
    // 00100 - left item only
    container.clear();
    container.add(new EmptyBlock(12.3, 45.6), RectangleEdge.LEFT);
    size = container.arrange(g2);
    assertEquals(12.3, size.width, EPSILON);
    assertEquals(45.6, size.height, EPSILON);
    // TBLRC
    // 00101 - left and center items
    container.clear();
    container.add(new EmptyBlock(10.0, 20.0));
    container.add(new EmptyBlock(12.3, 45.6), RectangleEdge.LEFT);
    size = container.arrange(g2);
    assertEquals(22.3, size.width, EPSILON);
    assertEquals(45.6, size.height, EPSILON);
    // try case where left item is shorter than center item
    container.clear();
    Block lb = new EmptyBlock(12.3, 15.6);
    container.add(new EmptyBlock(10.0, 20.0));
    container.add(lb, RectangleEdge.LEFT);
    size = container.arrange(g2);
    assertEquals(22.3, size.width, EPSILON);
    assertEquals(20.0, size.height, EPSILON);
    assertEquals(20.0, lb.getBounds().getHeight(), EPSILON);
    // TBLRC
    // 00110 - left and right items
    container.clear();
    container.add(new EmptyBlock(10.0, 20.0), RectangleEdge.RIGHT);
    container.add(new EmptyBlock(12.3, 45.6), RectangleEdge.LEFT);
    size = container.arrange(g2);
    assertEquals(22.3, size.width, EPSILON);
    assertEquals(45.6, size.height, EPSILON);
    // TBLRC
    // 00111 - left, right and center items
    container.clear();
    container.add(new EmptyBlock(10.0, 20.0));
    container.add(new EmptyBlock(12.3, 45.6), RectangleEdge.LEFT);
    container.add(new EmptyBlock(5.4, 3.2), RectangleEdge.RIGHT);
    size = container.arrange(g2);
    assertEquals(27.7, size.width, EPSILON);
    assertEquals(45.6, size.height, EPSILON);
    // TBLRC
    // 01000 - bottom item only
    container.clear();
    container.add(new EmptyBlock(12.3, 45.6), RectangleEdge.BOTTOM);
    size = container.arrange(g2);
    assertEquals(12.3, size.width, EPSILON);
    assertEquals(45.6, size.height, EPSILON);
    // TBLRC
    // 01001 - bottom and center only
    container.clear();
    container.add(new EmptyBlock(10.0, 20.0));
    container.add(new EmptyBlock(12.3, 45.6), RectangleEdge.BOTTOM);
    size = container.arrange(g2);
    assertEquals(12.3, size.width, EPSILON);
    assertEquals(65.6, size.height, EPSILON);
    // TBLRC
    // 01010 - bottom and right only
    container.clear();
    container.add(new EmptyBlock(10.0, 20.0), RectangleEdge.RIGHT);
    container.add(new EmptyBlock(12.3, 45.6), RectangleEdge.BOTTOM);
    size = container.arrange(g2);
    assertEquals(12.3, size.width, EPSILON);
    assertEquals(65.6, size.height, EPSILON);
    // TBLRC
    // 01011 - bottom, right and center
    container.clear();
    container.add(new EmptyBlock(21.0, 12.3));
    container.add(new EmptyBlock(10.0, 20.0), RectangleEdge.RIGHT);
    container.add(new EmptyBlock(12.3, 45.6), RectangleEdge.BOTTOM);
    size = container.arrange(g2);
    assertEquals(31.0, size.width, EPSILON);
    assertEquals(65.6, size.height, EPSILON);
    // TBLRC
    // 01100
    container.clear();
    container.add(new EmptyBlock(10.0, 20.0), RectangleEdge.LEFT);
    container.add(new EmptyBlock(12.3, 45.6), RectangleEdge.BOTTOM);
    size = container.arrange(g2);
    assertEquals(12.3, size.width, EPSILON);
    assertEquals(65.6, size.height, EPSILON);
    // TBLRC
    // 01101 - bottom, left and center
    container.clear();
    container.add(new EmptyBlock(21.0, 12.3));
    container.add(new EmptyBlock(10.0, 20.0), RectangleEdge.LEFT);
    container.add(new EmptyBlock(12.3, 45.6), RectangleEdge.BOTTOM);
    size = container.arrange(g2);
    assertEquals(31.0, size.width, EPSILON);
    assertEquals(65.6, size.height, EPSILON);
    // TBLRC
    // 01110 - bottom. left and right
    container.clear();
    container.add(new EmptyBlock(21.0, 12.3), RectangleEdge.RIGHT);
    container.add(new EmptyBlock(10.0, 20.0), RectangleEdge.LEFT);
    container.add(new EmptyBlock(12.3, 45.6), RectangleEdge.BOTTOM);
    size = container.arrange(g2);
    assertEquals(31.0, size.width, EPSILON);
    assertEquals(65.6, size.height, EPSILON);
    // TBLRC
    // 01111
    container.clear();
    container.add(new EmptyBlock(3.0, 4.0), RectangleEdge.BOTTOM);
    container.add(new EmptyBlock(5.0, 6.0), RectangleEdge.LEFT);
    container.add(new EmptyBlock(7.0, 8.0), RectangleEdge.RIGHT);
    container.add(new EmptyBlock(9.0, 10.0));
    size = container.arrange(g2);
    assertEquals(21.0, size.width, EPSILON);
    assertEquals(14.0, size.height, EPSILON);
    // TBLRC
    // 10000 - top item only
    container.clear();
    container.add(new EmptyBlock(12.3, 45.6), RectangleEdge.TOP);
    size = container.arrange(g2);
    assertEquals(12.3, size.width, EPSILON);
    assertEquals(45.6, size.height, EPSILON);
    // TBLRC
    // 10001 - top and center only
    container.clear();
    container.add(new EmptyBlock(10.0, 20.0));
    container.add(new EmptyBlock(12.3, 45.6), RectangleEdge.TOP);
    size = container.arrange(g2);
    assertEquals(12.3, size.width, EPSILON);
    assertEquals(65.6, size.height, EPSILON);
    // TBLRC
    // 10010 - right and top only
    container.clear();
    container.add(new EmptyBlock(10.0, 20.0), RectangleEdge.RIGHT);
    container.add(new EmptyBlock(12.3, 45.6), RectangleEdge.TOP);
    size = container.arrange(g2);
    assertEquals(12.3, size.width, EPSILON);
    assertEquals(65.6, size.height, EPSILON);
    // TBLRC
    // 10011 - top, right and center
    container.clear();
    container.add(new EmptyBlock(21.0, 12.3));
    container.add(new EmptyBlock(10.0, 20.0), RectangleEdge.TOP);
    container.add(new EmptyBlock(12.3, 45.6), RectangleEdge.RIGHT);
    size = container.arrange(g2);
    assertEquals(33.3, size.width, EPSILON);
    assertEquals(65.6, size.height, EPSILON);
    // TBLRC
    // 10100 - top and left only
    container.clear();
    container.add(new EmptyBlock(10.0, 20.0), RectangleEdge.LEFT);
    container.add(new EmptyBlock(12.3, 45.6), RectangleEdge.TOP);
    size = container.arrange(g2);
    assertEquals(12.3, size.width, EPSILON);
    assertEquals(65.6, size.height, EPSILON);
    // TBLRC
    // 10101 - top, left and center
    container.clear();
    container.add(new EmptyBlock(21.0, 12.3));
    container.add(new EmptyBlock(10.0, 20.0), RectangleEdge.TOP);
    container.add(new EmptyBlock(12.3, 45.6), RectangleEdge.LEFT);
    size = container.arrange(g2);
    assertEquals(33.3, size.width, EPSILON);
    assertEquals(65.6, size.height, EPSILON);
    // TBLRC
    // 10110 - top, left and right
    container.clear();
    container.add(new EmptyBlock(21.0, 12.3), RectangleEdge.RIGHT);
    container.add(new EmptyBlock(10.0, 20.0), RectangleEdge.TOP);
    container.add(new EmptyBlock(12.3, 45.6), RectangleEdge.LEFT);
    size = container.arrange(g2);
    assertEquals(33.3, size.width, EPSILON);
    assertEquals(65.6, size.height, EPSILON);
    // TBLRC
    // 10111
    container.clear();
    container.add(new EmptyBlock(1.0, 2.0), RectangleEdge.TOP);
    container.add(new EmptyBlock(5.0, 6.0), RectangleEdge.LEFT);
    container.add(new EmptyBlock(7.0, 8.0), RectangleEdge.RIGHT);
    container.add(new EmptyBlock(9.0, 10.0));
    size = container.arrange(g2);
    assertEquals(21.0, size.width, EPSILON);
    assertEquals(12.0, size.height, EPSILON);
    // TBLRC
    // 11000 - top and bottom only
    container.clear();
    container.add(new EmptyBlock(10.0, 20.0), RectangleEdge.TOP);
    container.add(new EmptyBlock(12.3, 45.6), RectangleEdge.BOTTOM);
    size = container.arrange(g2);
    assertEquals(12.3, size.width, EPSILON);
    assertEquals(65.6, size.height, EPSILON);
    // TBLRC
    // 11001
    container.clear();
    container.add(new EmptyBlock(21.0, 12.3));
    container.add(new EmptyBlock(10.0, 20.0), RectangleEdge.TOP);
    container.add(new EmptyBlock(12.3, 45.6), RectangleEdge.BOTTOM);
    size = container.arrange(g2);
    assertEquals(21.0, size.width, EPSILON);
    assertEquals(77.9, size.height, EPSILON);
    // TBLRC
    // 11010 - top, bottom and right
    container.clear();
    container.add(new EmptyBlock(21.0, 12.3), RectangleEdge.RIGHT);
    container.add(new EmptyBlock(10.0, 20.0), RectangleEdge.TOP);
    container.add(new EmptyBlock(12.3, 45.6), RectangleEdge.BOTTOM);
    size = container.arrange(g2);
    assertEquals(21.0, size.width, EPSILON);
    assertEquals(77.9, size.height, EPSILON);
    // TBLRC
    // 11011
    container.clear();
    container.add(new EmptyBlock(1.0, 2.0), RectangleEdge.TOP);
    container.add(new EmptyBlock(3.0, 4.0), RectangleEdge.BOTTOM);
    container.add(new EmptyBlock(7.0, 8.0), RectangleEdge.RIGHT);
    container.add(new EmptyBlock(9.0, 10.0));
    size = container.arrange(g2);
    assertEquals(16.0, size.width, EPSILON);
    assertEquals(16.0, size.height, EPSILON);
    // TBLRC
    // 11100
    container.clear();
    container.add(new EmptyBlock(21.0, 12.3), RectangleEdge.LEFT);
    container.add(new EmptyBlock(10.0, 20.0), RectangleEdge.TOP);
    container.add(new EmptyBlock(12.3, 45.6), RectangleEdge.BOTTOM);
    size = container.arrange(g2);
    assertEquals(21.0, size.width, EPSILON);
    assertEquals(77.9, size.height, EPSILON);
    // TBLRC
    // 11101
    container.clear();
    container.add(new EmptyBlock(1.0, 2.0), RectangleEdge.TOP);
    container.add(new EmptyBlock(3.0, 4.0), RectangleEdge.BOTTOM);
    container.add(new EmptyBlock(5.0, 6.0), RectangleEdge.LEFT);
    container.add(new EmptyBlock(9.0, 10.0));
    size = container.arrange(g2);
    assertEquals(14.0, size.width, EPSILON);
    assertEquals(16.0, size.height, EPSILON);
    // TBLRC
    // 11110
    container.clear();
    container.add(new EmptyBlock(1.0, 2.0), RectangleEdge.TOP);
    container.add(new EmptyBlock(3.0, 4.0), RectangleEdge.BOTTOM);
    container.add(new EmptyBlock(5.0, 6.0), RectangleEdge.LEFT);
    container.add(new EmptyBlock(7.0, 8.0), RectangleEdge.RIGHT);
    size = container.arrange(g2);
    assertEquals(12.0, size.width, EPSILON);
    assertEquals(14.0, size.height, EPSILON);
    // TBLRC
    // 11111 - all
    container.clear();
    container.add(new EmptyBlock(1.0, 2.0), RectangleEdge.TOP);
    container.add(new EmptyBlock(3.0, 4.0), RectangleEdge.BOTTOM);
    container.add(new EmptyBlock(5.0, 6.0), RectangleEdge.LEFT);
    container.add(new EmptyBlock(7.0, 8.0), RectangleEdge.RIGHT);
    container.add(new EmptyBlock(9.0, 10.0));
    size = container.arrange(g2);
    assertEquals(21.0, size.width, EPSILON);
    assertEquals(16.0, size.height, EPSILON);
}
Also used : Size2D(org.jfree.ui.Size2D) BufferedImage(java.awt.image.BufferedImage) Graphics2D(java.awt.Graphics2D) Test(org.junit.Test)

Example 35 with Size2D

use of org.jfree.ui.Size2D in project SIMVA-SoS by SESoS.

the class RectangleConstraintTest method testCalculateConstrainedSize.

/**
 * Run some checks on the constrained size calculation.
 */
@Test
public void testCalculateConstrainedSize() {
    Size2D s;
    // NONE / NONE
    RectangleConstraint c1 = RectangleConstraint.NONE;
    s = c1.calculateConstrainedSize(new Size2D(1.2, 3.4));
    assertEquals(s.width, 1.2, EPSILON);
    assertEquals(s.height, 3.4, EPSILON);
    // NONE / RANGE
    RectangleConstraint c2 = new RectangleConstraint(0.0, new Range(0.0, 0.0), LengthConstraintType.NONE, 0.0, new Range(2.0, 3.0), LengthConstraintType.RANGE);
    s = c2.calculateConstrainedSize(new Size2D(1.2, 3.4));
    assertEquals(s.width, 1.2, EPSILON);
    assertEquals(s.height, 3.0, EPSILON);
    // NONE / FIXED
    RectangleConstraint c3 = new RectangleConstraint(0.0, null, LengthConstraintType.NONE, 9.9, null, LengthConstraintType.FIXED);
    s = c3.calculateConstrainedSize(new Size2D(1.2, 3.4));
    assertEquals(s.width, 1.2, EPSILON);
    assertEquals(s.height, 9.9, EPSILON);
    // RANGE / NONE
    RectangleConstraint c4 = new RectangleConstraint(0.0, new Range(2.0, 3.0), LengthConstraintType.RANGE, 0.0, new Range(0.0, 0.0), LengthConstraintType.NONE);
    s = c4.calculateConstrainedSize(new Size2D(1.2, 3.4));
    assertEquals(s.width, 2.0, EPSILON);
    assertEquals(s.height, 3.4, EPSILON);
    // RANGE / RANGE
    RectangleConstraint c5 = new RectangleConstraint(0.0, new Range(2.0, 3.0), LengthConstraintType.RANGE, 0.0, new Range(2.0, 3.0), LengthConstraintType.RANGE);
    s = c5.calculateConstrainedSize(new Size2D(1.2, 3.4));
    assertEquals(s.width, 2.0, EPSILON);
    assertEquals(s.height, 3.0, EPSILON);
    // RANGE / FIXED
    RectangleConstraint c6 = new RectangleConstraint(0.0, null, LengthConstraintType.NONE, 9.9, null, LengthConstraintType.FIXED);
    s = c6.calculateConstrainedSize(new Size2D(1.2, 3.4));
    assertEquals(s.width, 1.2, EPSILON);
    assertEquals(s.height, 9.9, EPSILON);
    // FIXED / NONE
    RectangleConstraint c7 = RectangleConstraint.NONE;
    s = c7.calculateConstrainedSize(new Size2D(1.2, 3.4));
    assertEquals(s.width, 1.2, EPSILON);
    assertEquals(s.height, 3.4, EPSILON);
    // FIXED / RANGE
    RectangleConstraint c8 = new RectangleConstraint(0.0, new Range(0.0, 0.0), LengthConstraintType.NONE, 0.0, new Range(2.0, 3.0), LengthConstraintType.RANGE);
    s = c8.calculateConstrainedSize(new Size2D(1.2, 3.4));
    assertEquals(s.width, 1.2, EPSILON);
    assertEquals(s.height, 3.0, EPSILON);
    // FIXED / FIXED
    RectangleConstraint c9 = new RectangleConstraint(0.0, null, LengthConstraintType.NONE, 9.9, null, LengthConstraintType.FIXED);
    s = c9.calculateConstrainedSize(new Size2D(1.2, 3.4));
    assertEquals(s.width, 1.2, EPSILON);
    assertEquals(s.height, 9.9, EPSILON);
}
Also used : Size2D(org.jfree.ui.Size2D) Range(org.jfree.data.Range) Test(org.junit.Test)

Aggregations

Size2D (org.jfree.ui.Size2D)62 Test (org.junit.Test)19 Rectangle2D (java.awt.geom.Rectangle2D)18 Range (org.jfree.data.Range)14 List (java.util.List)10 RectangleConstraint (org.jfree.chart.block.RectangleConstraint)8 RectangleEdge (org.jfree.ui.RectangleEdge)5 Graphics2D (java.awt.Graphics2D)4 BufferedImage (java.awt.image.BufferedImage)4 ArrayList (java.util.ArrayList)4 LengthConstraintType (org.jfree.chart.block.LengthConstraintType)4 RectangleInsets (org.jfree.ui.RectangleInsets)4 FontMetrics (java.awt.FontMetrics)3 Shape (java.awt.Shape)3 Point2D (java.awt.geom.Point2D)2 BlockParams (org.jfree.chart.block.BlockParams)2 EntityBlockResult (org.jfree.chart.block.EntityBlockResult)2 G2TextMeasurer (org.jfree.text.G2TextMeasurer)2 Arc2D (java.awt.geom.Arc2D)1 Iterator (java.util.Iterator)1