public class InMemoryRegistrar extends Object implements TargetRegistrar
Constructor and Description |
---|
InMemoryRegistrar() |
Modifier and Type | Method and Description |
---|---|
void |
addIdentifierReference(String referenceLocation,
Identifier identifier)
Adds a reference to a target identifier.
|
void |
addTarget(String parentLocation,
TargetType type,
String location)
Indicates that a target was discovered in the subtree
being validated.
|
void |
addTargetReference(String referenceLocation,
String targetLocation)
Adds a reference from a label to a target.
|
Collection<ValidationTarget> |
getChildTargets(ValidationTarget parent)
Gets the locations of children of a given target.
|
Collection<IdentifierReference> |
getDanglingReferences()
Gets a collection of identifiers that are referenced but not defined.
|
Map<Identifier,String> |
getIdentifierDefinitions()
Gets a mapping of identifiers to their locations.
|
int |
getLabelCount()
Gets the number of labels encountered so far.
|
ValidationTarget |
getRoot()
Gets the root location.
|
int |
getTargetCount(TargetType type)
Gets the number of targets encountered so far for a target type.
|
String |
getTargetForIdentifier(Identifier identifier)
Gets the location where an identifier was defined.
|
Collection<Identifier> |
getUnreferencedIdentifiers()
Gets a collection of identifiers that are defined but never
referenced.
|
Collection<String> |
getUnreferencedTargets()
Gets a collection of target locations that are never referenced.
|
boolean |
hasTarget(String targetLocation)
Tests whether a target exists for a location.
|
boolean |
isIdentifierReferenced(Identifier identifier)
Tests whether an identifier was referenced.
|
boolean |
isTargetReferenced(String location)
Tests whether a target was referenced.
|
void |
setTargetIdentifier(String location,
Identifier identifier)
Sets an identifier for uniquely identifying the target.
|
void |
setTargetIsLabel(String location,
boolean isLabel)
Indicates whether a target is a label.
|
public ValidationTarget getRoot()
TargetRegistrar
getRoot
in interface TargetRegistrar
public void addTarget(String parentLocation, TargetType type, String location)
TargetRegistrar
addTarget
in interface TargetRegistrar
parentLocation
- the parent target location, or null, if this is the root targettype
- the target typelocation
- the target locationpublic Collection<ValidationTarget> getChildTargets(ValidationTarget parent)
TargetRegistrar
getChildTargets
in interface TargetRegistrar
parent
- the parent targetpublic boolean hasTarget(String targetLocation)
TargetRegistrar
hasTarget
in interface TargetRegistrar
targetLocation
- the target locationpublic int getTargetCount(TargetType type)
TargetRegistrar
getTargetCount
in interface TargetRegistrar
type
- the target typepublic void setTargetIsLabel(String location, boolean isLabel)
TargetRegistrar
setTargetIsLabel
in interface TargetRegistrar
location
- the target locationisLabel
- true, if the target is a labelpublic int getLabelCount()
TargetRegistrar
getLabelCount
in interface TargetRegistrar
public void setTargetIdentifier(String location, Identifier identifier)
TargetRegistrar
setTargetIdentifier
in interface TargetRegistrar
location
- the target locationidentifier
- the target identifierpublic void addTargetReference(String referenceLocation, String targetLocation)
TargetRegistrar
addTargetReference
in interface TargetRegistrar
referenceLocation
- the label locationtargetLocation
- the target location referred to in the labelpublic boolean isTargetReferenced(String location)
TargetRegistrar
isTargetReferenced
in interface TargetRegistrar
location
- the target locationpublic void addIdentifierReference(String referenceLocation, Identifier identifier)
TargetRegistrar
addIdentifierReference
in interface TargetRegistrar
referenceLocation
- the location of the referenceidentifier
- the target identifier being referencedpublic boolean isIdentifierReferenced(Identifier identifier)
TargetRegistrar
isIdentifierReferenced
in interface TargetRegistrar
identifier
- the identifierpublic String getTargetForIdentifier(Identifier identifier)
TargetRegistrar
getTargetForIdentifier
in interface TargetRegistrar
identifier
- the identifierpublic Map<Identifier,String> getIdentifierDefinitions()
TargetRegistrar
getIdentifierDefinitions
in interface TargetRegistrar
public Collection<String> getUnreferencedTargets()
TargetRegistrar
getUnreferencedTargets
in interface TargetRegistrar
public Collection<Identifier> getUnreferencedIdentifiers()
TargetRegistrar
getUnreferencedIdentifiers
in interface TargetRegistrar
public Collection<IdentifierReference> getDanglingReferences()
TargetRegistrar
getDanglingReferences
in interface TargetRegistrar
Copyright © 2010–2017 Planetary Data System. All rights reserved.