package com.drew.metadata;


import java.util.ArrayList;

/**
 * Represents a subpath created by Photoshop:
 * <ul>
 *   <li>Closed Bezier knot, linked</li>
 *   <li>Closed Bezier knot, unlinked</li>
 *   <li>Open Bezier knot, linked</li>
 *   <li>Open Bezier knot, unlinked</li>
 * </ul>
 *
 * @author Payton Garland
 */
public class Subpath
{
    private ArrayList<Knot> knots;
    private String type;

    public Subpath()
    {
        this.knots = new ArrayList<Knot>();
        this.type = "";
    }

    public Subpath(String type)
    {
        this.knots = new ArrayList<Knot>();
        this.type = type;
    }

    /**
     * Insert a knot (set of 3 points) into the list
     */
    public void insert(Knot knot)
    {
        knots.add(knot);
    }

    /**
     * Gets size of knots list
     *
     * @return size of knots ArrayList
     */
    public int size()
    {
        return knots.size();
    }

    /**
     * Create a copy of this Subpath
     *
     * @return a new, duplicate Subpath
     */
    public Subpath copy()
    {
        Subpath copy = new Subpath(type);
        for (int i = 0; i < knots.size(); i++) {
            copy.insert(knots.get(i));
        }
        return copy;
    }

    @Override
    public String toString()
    {
        String description = type + "(" + knots.size() + " knots): ";
        for (int i = 0; i < knots.size(); i++) {
            description += knots.get(i).getType() + "[ ";
            description += "(" + knots.get(i).getPoint(0) + ", " + knots.get(i).getPoint(1) + ")(";
            description += "(" + knots.get(i).getPoint(2) + ", " + knots.get(i).getPoint(3) + ")(";
            description += "(" + knots.get(i).getPoint(4) + ", " + knots.get(i).getPoint(5) + ") ]";
            description += " ";
        }
        return description;
    }
}

@@ -366,16 +366,17 @@
 t%3CKnot%3E 
+_
 knots;%0A 
@@ -389,24 +389,25 @@
 vate String 
+_
 type;%0A%0A    p
@@ -428,37 +428,33 @@
 )%0A    %7B%0A        
-this.
+_
 knots = new Arra
@@ -472,29 +472,25 @@
 ();%0A        
-this.
+_
 type = %22%22;%0A 
@@ -541,21 +541,17 @@
         
-this.
+_
 knots = 
@@ -585,13 +585,9 @@
     
-this.
+_
 type
@@ -719,16 +719,17 @@
         
+_
 knots.ad
@@ -880,16 +880,17 @@
  return 
+_
 knots.si
@@ -1069,16 +1069,17 @@
 Subpath(
+_
 type);%0A 
@@ -1097,32 +1097,33 @@
 (int i = 0; i %3C 
+_
 knots.size(); i+
@@ -1151,16 +1151,17 @@
 .insert(
+_
 knots.ge
@@ -1283,16 +1283,17 @@
 ption = 
+_
 type + %22
@@ -1293,24 +1293,25 @@
 ype + %22(%22 + 
+_
 knots.size()
@@ -1354,16 +1354,17 @@
  0; i %3C 
+_
 knots.si
@@ -1403,16 +1403,17 @@
 tion += 
+_
 knots.ge
@@ -1460,32 +1460,33 @@
 iption += %22(%22 + 
+_
 knots.get(i).get
@@ -1495,32 +1495,33 @@
 int(0) + %22, %22 + 
+_
 knots.get(i).get
@@ -1562,32 +1562,33 @@
 iption += %22(%22 + 
+_
 knots.get(i).get
@@ -1597,32 +1597,33 @@
 int(2) + %22, %22 + 
+_
 knots.get(i).get
@@ -1668,24 +1668,25 @@
 on += %22(%22 + 
+_
 knots.get(i)
@@ -1707,16 +1707,17 @@
  %22, %22 + 
+_
 knots.ge

Rename fields