Class InMemoryRegistrar

java.lang.Object
gov.nasa.pds.tools.validate.InMemoryRegistrar
All Implemented Interfaces:
TargetRegistrar

public class InMemoryRegistrar
extends Object
implements TargetRegistrar
  • Constructor Details

    • InMemoryRegistrar

      public InMemoryRegistrar()
  • Method Details

    • getRoot

      public ValidationTarget getRoot()
      Description copied from interface: TargetRegistrar
      Gets the root location.
      Specified by:
      getRoot in interface TargetRegistrar
      Returns:
      the root location
    • addTarget

      public void addTarget​(String parentLocation, TargetType type, String location)
      Description copied from interface: TargetRegistrar
      Indicates that a target was discovered in the subtree being validated.
      Specified by:
      addTarget in interface TargetRegistrar
      Parameters:
      parentLocation - the parent target location, or null, if this is the root target
      type - the target type
      location - the target location
    • getChildTargets

      public Collection<ValidationTarget> getChildTargets​(ValidationTarget parent)
      Description copied from interface: TargetRegistrar
      Gets the locations of children of a given target.
      Specified by:
      getChildTargets in interface TargetRegistrar
      Parameters:
      parent - the parent target
      Returns:
      a collection of child targets
    • hasTarget

      public boolean hasTarget​(String targetLocation)
      Description copied from interface: TargetRegistrar
      Tests whether a target exists for a location.
      Specified by:
      hasTarget in interface TargetRegistrar
      Parameters:
      targetLocation - the target location
      Returns:
      true, if a target has been added for that location, false otherwise
    • getTargetCount

      public int getTargetCount​(TargetType type)
      Description copied from interface: TargetRegistrar
      Gets the number of targets encountered so far for a target type.
      Specified by:
      getTargetCount in interface TargetRegistrar
      Parameters:
      type - the target type
      Returns:
      the target count for the given type
    • setTargetIsLabel

      public void setTargetIsLabel​(String location, boolean isLabel)
      Description copied from interface: TargetRegistrar
      Indicates whether a target is a label.
      Specified by:
      setTargetIsLabel in interface TargetRegistrar
      Parameters:
      location - the target location
      isLabel - true, if the target is a label
    • getLabelCount

      public int getLabelCount()
      Description copied from interface: TargetRegistrar
      Gets the number of labels encountered so far.
      Specified by:
      getLabelCount in interface TargetRegistrar
      Returns:
      the label count
    • setTargetIdentifier

      public void setTargetIdentifier​(String location, Identifier identifier)
      Description copied from interface: TargetRegistrar
      Sets an identifier for uniquely identifying the target.
      Specified by:
      setTargetIdentifier in interface TargetRegistrar
      Parameters:
      location - the target location
      identifier - the target identifier
    • addTargetReference

      public void addTargetReference​(String referenceLocation, String targetLocation)
      Description copied from interface: TargetRegistrar
      Adds a reference from a label to a target.
      Specified by:
      addTargetReference in interface TargetRegistrar
      Parameters:
      referenceLocation - the label location
      targetLocation - the target location referred to in the label
    • isTargetReferenced

      public boolean isTargetReferenced​(String location)
      Description copied from interface: TargetRegistrar
      Tests whether a target was referenced.
      Specified by:
      isTargetReferenced in interface TargetRegistrar
      Parameters:
      location - the target location
      Returns:
      true, if the target was referenced
    • addIdentifierReference

      public void addIdentifierReference​(String referenceLocation, Identifier identifier)
      Description copied from interface: TargetRegistrar
      Adds a reference to a target identifier.
      Specified by:
      addIdentifierReference in interface TargetRegistrar
      Parameters:
      referenceLocation - the location of the reference
      identifier - the target identifier being referenced
    • isIdentifierReferenced

      public boolean isIdentifierReferenced​(Identifier identifier)
      Description copied from interface: TargetRegistrar
      Tests whether an identifier was referenced.
      Specified by:
      isIdentifierReferenced in interface TargetRegistrar
      Parameters:
      identifier - the identifier
      Returns:
      true, if the identifier was referenced
    • getTargetForIdentifier

      public String getTargetForIdentifier​(Identifier identifier)
      Description copied from interface: TargetRegistrar
      Gets the location where an identifier was defined.
      Specified by:
      getTargetForIdentifier in interface TargetRegistrar
      Parameters:
      identifier - the identifier
      Returns:
      the location where it was defined, or null if not defined
    • getIdentifierDefinitions

      public Map<Identifier,​String> getIdentifierDefinitions()
      Description copied from interface: TargetRegistrar
      Gets a mapping of identifiers to their locations.
      Specified by:
      getIdentifierDefinitions in interface TargetRegistrar
      Returns:
      a mapping of identifiers to the location where it was defined.
    • getUnreferencedTargets

      public Collection<String> getUnreferencedTargets()
      Description copied from interface: TargetRegistrar
      Gets a collection of target locations that are never referenced.
      Specified by:
      getUnreferencedTargets in interface TargetRegistrar
      Returns:
      a collection of unreferenced targets
    • getReferencedIdentifiers

      public Collection<Identifier> getReferencedIdentifiers()
      Description copied from interface: TargetRegistrar
      Gets a collection of referenced identifiers.
      Specified by:
      getReferencedIdentifiers in interface TargetRegistrar
      Returns:
      a collection of referenced identifiers.
    • getUnreferencedIdentifiers

      public Collection<Identifier> getUnreferencedIdentifiers()
      Description copied from interface: TargetRegistrar
      Gets a collection of identifiers that are defined but never referenced.
      Specified by:
      getUnreferencedIdentifiers in interface TargetRegistrar
      Returns:
      a collection of unreferenced identifiers
    • getDanglingReferences

      public Collection<IdentifierReference> getDanglingReferences()
      Description copied from interface: TargetRegistrar
      Gets a collection of identifiers that are referenced but not defined.
      Specified by:
      getDanglingReferences in interface TargetRegistrar
      Returns:
      a collection of dangling identifier references
    • getIdentifierReferenceLocation

      public String getIdentifierReferenceLocation​(Identifier id)
      Description copied from interface: TargetRegistrar
      Gets the location of where the given identifier is referenced.
      Specified by:
      getIdentifierReferenceLocation in interface TargetRegistrar
      Parameters:
      id - The identifier to find.
      Returns:
      The location where the given identifier is referenced.