An Analysis on Barrier Coverage in Wireless Sensor Networks