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.
|
String |
getIdentifierReferenceLocation(Identifier id)
Gets the location of where the given identifier is referenced.
|
int |
getLabelCount()
Gets the number of labels encountered so far.
|
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.
|
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()
TargetRegistrargetRoot in interface TargetRegistrarpublic void addTarget(String parentLocation, TargetType type, String location)
TargetRegistraraddTarget in interface TargetRegistrarparentLocation - the parent target location, or null, if this is the root targettype - the target typelocation - the target locationpublic Collection<ValidationTarget> getChildTargets(ValidationTarget parent)
TargetRegistrargetChildTargets in interface TargetRegistrarparent - the parent targetpublic boolean hasTarget(String targetLocation)
TargetRegistrarhasTarget in interface TargetRegistrartargetLocation - the target locationpublic int getTargetCount(TargetType type)
TargetRegistrargetTargetCount in interface TargetRegistrartype - the target typepublic void setTargetIsLabel(String location, boolean isLabel)
TargetRegistrarsetTargetIsLabel in interface TargetRegistrarlocation - the target locationisLabel - true, if the target is a labelpublic int getLabelCount()
TargetRegistrargetLabelCount in interface TargetRegistrarpublic void setTargetIdentifier(String location, Identifier identifier)
TargetRegistrarsetTargetIdentifier in interface TargetRegistrarlocation - the target locationidentifier - the target identifierpublic void addTargetReference(String referenceLocation, String targetLocation)
TargetRegistraraddTargetReference in interface TargetRegistrarreferenceLocation - the label locationtargetLocation - the target location referred to in the labelpublic boolean isTargetReferenced(String location)
TargetRegistrarisTargetReferenced in interface TargetRegistrarlocation - the target locationpublic void addIdentifierReference(String referenceLocation, Identifier identifier)
TargetRegistraraddIdentifierReference in interface TargetRegistrarreferenceLocation - the location of the referenceidentifier - the target identifier being referencedpublic boolean isIdentifierReferenced(Identifier identifier)
TargetRegistrarisIdentifierReferenced in interface TargetRegistraridentifier - the identifierpublic String getTargetForIdentifier(Identifier identifier)
TargetRegistrargetTargetForIdentifier in interface TargetRegistraridentifier - the identifierpublic Map<Identifier,String> getIdentifierDefinitions()
TargetRegistrargetIdentifierDefinitions in interface TargetRegistrarpublic Collection<String> getUnreferencedTargets()
TargetRegistrargetUnreferencedTargets in interface TargetRegistrarpublic Collection<Identifier> getReferencedIdentifiers()
TargetRegistrargetReferencedIdentifiers in interface TargetRegistrarpublic Collection<Identifier> getUnreferencedIdentifiers()
TargetRegistrargetUnreferencedIdentifiers in interface TargetRegistrarpublic Collection<IdentifierReference> getDanglingReferences()
TargetRegistrargetDanglingReferences in interface TargetRegistrarpublic String getIdentifierReferenceLocation(Identifier id)
TargetRegistrargetIdentifierReferenceLocation in interface TargetRegistrarid - The identifier to find.Copyright © 2020. All rights reserved.