public class TrafficLight extends Object implements BooleanSignal
| 构造器和说明 |
|---|
TrafficLight()
green light is off on default
|
TrafficLight(boolean isGreen) |
public TrafficLight()
public TrafficLight(boolean isGreen)
isGreen - green light is onpublic void setRed()
setRed 在接口中 BooleanSignalpublic void setGreen()
throws InterruptedException
setGreen 在接口中 BooleanSignalInterruptedExceptionpublic void waitGreen()
throws InterruptedException
waitGreen 在接口中 BooleanSignalInterruptedException - if any thread interrupted the current thread before or while
the current thread was waiting for a notification. The
interrupted status of the current thread is cleared
when this exception is thrown.public boolean isGreen()
isGreen 在接口中 BooleanSignalCopyright © 2017. All rights reserved.