Class AccessRestrictions


  • public class AccessRestrictions
    extends java.lang.Object

    Class containing access restrictions for roads/arcs.

    This class maps transport modes to their restriction and provide interface based on EnumSet to query restrictions.

    To each transport is associated at most one restriction per road (no restriction corresponds to AccessRestrictions.AccessRestriction.UNKNOWN but a road can have different restrictions for different modes.

    • Constructor Detail

      • AccessRestrictions

        public AccessRestrictions()
        Create new AccessRestrictions instances with unknown restrictions.
    • Method Detail

      • isAllowedForAny

        public boolean isAllowedForAny​(AccessRestrictions.AccessMode mode,
                                       java.util.EnumSet<AccessRestrictions.AccessRestriction> restrictions)
        Check if the restriction associated with the given mode is one of the given restrictions.
        Parameters:
        mode - Mode for which to check the restrictions.
        restrictions - List of queried restrictions for the mode.
        Returns:
        true if the restriction of the given mode is one of the given restrictions.
      • isAllowedFor

        public boolean isAllowedFor​(AccessRestrictions.AccessMode mode,
                                    AccessRestrictions.AccessRestriction restriction)
        Check if the restriction for the given mode corresponds to the given restriction.
        Parameters:
        mode - Mode for which the restriction should be checked.
        restriction - Restriction to check against.
        Returns:
        true if the restriction of the given mode corresponds to the given restriction.
      • areAllAllowedForAny

        public boolean areAllAllowedForAny​(java.util.EnumSet<AccessRestrictions.AccessMode> modes,
                                           java.util.EnumSet<AccessRestrictions.AccessRestriction> restrictions)
        Check if the restriction associated to each given mode is one of the restrictions. The restriction may not be the same for all modes.
        Parameters:
        modes - Modes for which restrictions should be checked.
        restrictions - Set of wanted restrictions for the modes.
        Returns:
        true if all the given modes are allowed for any of the given restrictions.