This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import java.util.concurrent.TimeUnit; | |
| import java.util.concurrent.locks.AbstractQueuedSynchronizer; | |
| public class AmendableCountDownLatch { | |
| private static final class Sync extends AbstractQueuedSynchronizer { | |
| private static final long serialVersionUID = 4982264981922014374L; | |
| Sync(int count) { | |
| setState(count); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class ApproxTrig { | |
| /** | |
| * Approximates sine of angle with an error of less than ~1.569E-4 (0.0001569) | |
| * | |
| * @param angle - an angle in radians | |
| * @return approximate sine of angle | |
| */ | |
| public static double sin(double angle) { | |
| angle %= Math.PI * 2.0; |