Class PerceptionIterableSet<H extends Headway>
- java.lang.Object
-
- org.opentrafficsim.road.gtu.lane.perception.PerceptionIterableSet<H>
-
- Type Parameters:
H
- headway type
- All Implemented Interfaces:
Iterable<H>
,PerceptionIterable<H>
public class PerceptionIterableSet<H extends Headway> extends Object implements PerceptionIterable<H>
Simple implementation ofPerceptionIterable
which wraps a set. Constructors are available for an empty set, a single-valued set, or a sorted set.Copyright (c) 2013-2020 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
BSD-style license. See OpenTrafficSim License.- Version:
- $Revision$, $LastChangedDate$, by $Author$, initial version 26 feb. 2018
- Author:
- Alexander Verbraeck, Peter Knoppers, Wouter Schakel
-
-
Constructor Summary
Constructors Constructor Description PerceptionIterableSet()
Creates an empty iterable.PerceptionIterableSet(H headway)
Creates a single-value iterable.PerceptionIterableSet(SortedSet<H> headways)
Creates an iterable from a sorted set.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description H
first()
Returns the first element.boolean
isEmpty()
Returns whether this iterable is empty.Iterator<H>
iterator()
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
-
-
-
Constructor Detail
-
PerceptionIterableSet
public PerceptionIterableSet()
Creates an empty iterable.
-
PerceptionIterableSet
public PerceptionIterableSet(H headway)
Creates a single-value iterable.- Parameters:
headway
- H; headway
-
-
Method Detail
-
first
public H first()
Returns the first element.- Specified by:
first
in interfacePerceptionIterable<H extends Headway>
- Returns:
- H; first element
-
isEmpty
public boolean isEmpty()
Returns whether this iterable is empty.- Specified by:
isEmpty
in interfacePerceptionIterable<H extends Headway>
- Returns:
- whether this iterable is empty
-
-