public class InMemoryRegistrar extends java.lang.Object implements TargetRegistrar
Constructor and Description |
---|
InMemoryRegistrar() |
Modifier and Type | Method and Description |
---|---|
void |
addIdentifierReference(java.lang.String referenceLocation,
Identifier identifier)
Adds a reference to a target identifier.
|
void |
addTarget(java.lang.String parentLocation,
TargetType type,
java.lang.String location)
Indicates that a target was discovered in the subtree
being validated.
|
void |
addTargetReference(java.lang.String referenceLocation,
java.lang.String targetLocation)
Adds a reference from a label to a target.
|
java.util.Collection<ValidationTarget> |
getChildTargets(ValidationTarget parent)
Gets the locations of children of a given target.
|
java.util.Collection<IdentifierReference> |
getDanglingReferences()
Gets a collection of identifiers that are referenced but not defined.
|
java.util.Map<Identifier,java.lang.String> |
getIdentifierDefinitions()
Gets a mapping of identifiers to their locations.
|
java.lang.String |
getIdentifierReferenceLocation(Identifier id)
Gets the location of where the given identifier is referenced.
|
int |
getLabelCount()
Gets the number of labels encountered so far.
|
java.util.Collection<Identifier> |
getReferencedIdentifiers()
Gets a collection of referenced identifiers.
|
ValidationTarget |
getRoot()
Gets the root location.
|
int |
getTargetCount(TargetType type)
Gets the number of targets encountered so far for a target type.
|
java.lang.String |
getTargetForIdentifier(Identifier identifier)
Gets the location where an identifier was defined.
|
java.util.Collection<Identifier> |
getUnreferencedIdentifiers()
Gets a collection of identifiers that are defined but never
referenced.
|
java.util.Collection<java.lang.String> |
getUnreferencedTargets()
Gets a collection of target locations that are never referenced.
|
boolean |
hasTarget(java.lang.String targetLocation)
Tests whether a target exists for a location.
|
boolean |
isIdentifierReferenced(Identifier identifier)
Tests whether an identifier was referenced.
|
boolean |
isTargetReferenced(java.lang.String location)
Tests whether a target was referenced.
|
void |
setTargetIdentifier(java.lang.String location,
Identifier identifier)
Sets an identifier for uniquely identifying the target.
|
void |
setTargetIsLabel(java.lang.String location,
boolean isLabel)
Indicates whether a target is a label.
|
public ValidationTarget getRoot()
TargetRegistrar
getRoot
in interface TargetRegistrar
public void addTarget(java.lang.String parentLocation, TargetType type, java.lang.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 java.util.Collection<ValidationTarget> getChildTargets(ValidationTarget parent)
TargetRegistrar
getChildTargets
in interface TargetRegistrar
parent
- the parent targetpublic boolean hasTarget(java.lang.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(java.lang.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(java.lang.String location, Identifier identifier)
TargetRegistrar
setTargetIdentifier
in interface TargetRegistrar
location
- the target locationidentifier
- the target identifierpublic void addTargetReference(java.lang.String referenceLocation, java.lang.String targetLocation)
TargetRegistrar
addTargetReference
in interface TargetRegistrar
referenceLocation
- the label locationtargetLocation
- the target location referred to in the labelpublic boolean isTargetReferenced(java.lang.String location)
TargetRegistrar
isTargetReferenced
in interface TargetRegistrar
location
- the target locationpublic void addIdentifierReference(java.lang.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 java.lang.String getTargetForIdentifier(Identifier identifier)
TargetRegistrar
getTargetForIdentifier
in interface TargetRegistrar
identifier
- the identifierpublic java.util.Map<Identifier,java.lang.String> getIdentifierDefinitions()
TargetRegistrar
getIdentifierDefinitions
in interface TargetRegistrar
public java.util.Collection<java.lang.String> getUnreferencedTargets()
TargetRegistrar
getUnreferencedTargets
in interface TargetRegistrar
public java.util.Collection<Identifier> getReferencedIdentifiers()
TargetRegistrar
getReferencedIdentifiers
in interface TargetRegistrar
public java.util.Collection<Identifier> getUnreferencedIdentifiers()
TargetRegistrar
getUnreferencedIdentifiers
in interface TargetRegistrar
public java.util.Collection<IdentifierReference> getDanglingReferences()
TargetRegistrar
getDanglingReferences
in interface TargetRegistrar
public java.lang.String getIdentifierReferenceLocation(Identifier id)
TargetRegistrar
getIdentifierReferenceLocation
in interface TargetRegistrar
id
- The identifier to find.Copyright © 2010-2018 Planetary Data System. All Rights Reserved.