import java.awt.*;
public class PCL
 {
  dP[] va;
  static dP[] pads;
  static double hpw;
  Tu tu;
  int i=0;
  public PCL(Tu t,dP[] a)
   {
    tu=t;
    va=a;
   }
  public boolean c(dP dp) { return dP.dPac(va,dp); }
  public void draw()
   {
    int ei=va.length-1;
    hpw=tu.te.dhg("hpw");
    pads=tu.te.dPahg("pads");
    if(ei<1) return;
    if(dP.dPac(pads,va[0]))
     {
      tu.pd(false);
      tu.sp(va[0]);
      tu.shtw(va[1]);
      tu.fd(hpw);
      tu.pd(true);
     }
    else tu.sp(va[0]);
    for(i=1;i<ei;i++) tu.dto(va[i]);
    if(dP.dPac(pads,va[ei]))
     {
      double l=tu.gdto(va[ei]);
      tu.shtw(va[ei]);
      if(l-hpw > 0) tu.fd(l-hpw);
      else tu.sp(va[ei]);
     }
    else tu.dto(va[ei]);
   }
  public static PCL[] PCLardp(PCL[] a,dP dp)
   {
    for(int i=0;i<a.length;i++)
     {
      if(a[i].c(dp)) return PCLari(a,i);
     }
    return a;
   }
  public static PCL[] PCLari(PCL[] a,int i)
   {
    int nl=a.length-1;
    PCL[] b= new PCL[nl];
    for(int j=0;j<i;j++) b[j]=a[j];
    for(int j=i;j<nl;j++) b[j]=a[j+1];
    return b;
   }
 }
