On Tue, 31 Jan 2006, Clive D. W. Feather wrote:
In article . com,
writes
It seems incredible that the platform edge doors couldn't be programmed
for a 6 or 7 coach train and have some sort of detection system.
We could have had them. Was it worth paying the extra for a
once-in-a-lifetime event?
Depends how much it would have cost. Here, i'll do it for free:
int trainLength = train.getNumberOfCars() ;
if ((trainLength 6) || (trainLength 7))
{
throw new MalformedTrainException(train, "bad number of cars") ;
}
for (int i = 0 ; i trainLength ; ++i)
{
// assumes this is a headstop, if that's what it's called
// tailstop is not much more complicated
platform.edgeDoor((2 * i)).open() ; // the front one
platform.edgeDoor(((2 * i) + 1)).open() ; // the back one
}
That ought to be tested before it goes into production use, though.
tom
--
Who would you help in a fight, Peter van der Linden or Bill Gates?