Package javax.help
Class TryMap
java.lang.Object
javax.help.TryMap
- All Implemented Interfaces:
Serializable
,Map
A Map that can combine a number of other Maps in an
efficient manner.
Currently this is a brute-force implementation.
- See Also:
-
Nested Class Summary
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds a map to a "filter" Map.Gets an enumeration of all the IDs in a Map.getClosestID
(URL url) Determines the ID that is "closest" to this URL (with a given anchor).getIDFromURL
(URL url) Determines the ID for this URL.Gets the the IDs related to this URL.getMaps()
Enumerates all the Maps in this TryMap.getURLFromID
(Map.ID id) Gets the URL that corresponds to a given ID in the Map.boolean
Determines if the URL corresponds to an ID in the Map.boolean
Determines if the ID is valid (known to in the project file).boolean
Removes a Map from this "filter" Map.
-
Constructor Details
-
TryMap
public TryMap()Creates an empty Map. This is useful for filtering and to add/remove to/from it.
-
-
Method Details
-
add
Adds a map to a "filter" Map. Adding a composed map to another is equivalent to adding the entire Map individually.- Parameters:
map
- The new Map to add. If Map is null it is not added.
-
remove
Removes a Map from this "filter" Map.- Parameters:
map
- The Map to add.- Returns:
- Whether the Map is already present. If the Map is null or was not previously added, returns "false".
-
getMaps
Enumerates all the Maps in this TryMap.- Returns:
- An enumeration of the Maps added.
-
isValidID
Determines if the ID is valid (known to in the project file). -
getAllIDs
Gets an enumeration of all the IDs in a Map. -
getURLFromID
Gets the URL that corresponds to a given ID in the Map.- Specified by:
getURLFromID
in interfaceMap
- Parameters:
id
- The ID for which to get the URL. If id is null it is treated as an unresolved ID and returns null.- Returns:
- URL The matching URL. Null if this Map cannot resolve the ID.
- Throws:
MalformedURLException
- if the URL specification found is malformed
-
isID
Determines if the URL corresponds to an ID in the Map. -
getIDFromURL
Determines the ID for this URL.- Specified by:
getIDFromURL
in interfaceMap
- Parameters:
url
- The URL to get the ID for.- Returns:
- The ID (Map.ID), or null if URL is not an ID
-
getClosestID
Determines the ID that is "closest" to this URL (with a given anchor).- Specified by:
getClosestID
in interfaceMap
- Parameters:
url
- A URL- Returns:
- The closest ID in this map to the given URL
-
getIDs
Gets the the IDs related to this URL.
-