Package javax.help
Class TryMap
- java.lang.Object
-
- javax.help.TryMap
-
- All Implemented Interfaces:
java.io.Serializable
,Map
public class TryMap extends java.lang.Object implements Map, java.io.Serializable
A Map that can combine a number of other Maps in an efficient manner. Currently this is a brute-force implementation.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description TryMap()
Creates an empty Map.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
add(Map map)
Adds a map to a "filter" Map.java.util.Enumeration
getAllIDs()
Gets an enumeration of all the IDs in a Map.Map.ID
getClosestID(java.net.URL url)
Determines the ID that is "closest" to this URL (with a given anchor).Map.ID
getIDFromURL(java.net.URL url)
Determines the ID for this URL.java.util.Enumeration
getIDs(java.net.URL url)
Gets the the IDs related to this URL.java.util.Enumeration
getMaps()
Enumerates all the Maps in this TryMap.java.net.URL
getURLFromID(Map.ID id)
Gets the URL that corresponds to a given ID in the Map.boolean
isID(java.net.URL url)
Determines if the URL corresponds to an ID in the Map.boolean
isValidID(java.lang.String id, HelpSet hs)
Determines if the ID is valid (known to in the project file).boolean
remove(Map map)
Removes a Map from this "filter" Map.
-
-
-
Method Detail
-
add
public void add(Map map)
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
public boolean remove(Map map)
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
public java.util.Enumeration getMaps()
Enumerates all the Maps in this TryMap.- Returns:
- An enumeration of the Maps added.
-
isValidID
public boolean isValidID(java.lang.String id, HelpSet hs)
Determines if the ID is valid (known to in the project file).
-
getAllIDs
public java.util.Enumeration getAllIDs()
Gets an enumeration of all the IDs in a Map.
-
getURLFromID
public java.net.URL getURLFromID(Map.ID id) throws java.net.MalformedURLException
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:
java.net.MalformedURLException
- if the URL specification found is malformed
-
isID
public boolean isID(java.net.URL url)
Determines if the URL corresponds to an ID in the Map.
-
getIDFromURL
public Map.ID getIDFromURL(java.net.URL url)
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
public Map.ID getClosestID(java.net.URL url)
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
-
-