Class IvmlIdentifierCheck

java.lang.Object
net.ssehub.easy.varModel.validation.IvmlIdentifierCheck

public class IvmlIdentifierCheck extends Object
Provides methods to identify correct IVML identifiers.
Author:
Holger Eichelberger
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private static final Set<String>
    Stores reserved keywords and operator names.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    private static final void
    hash(Field[] fields, boolean checkAnnotation)
    Hashes the names of all public constants in fields into RESERVED.
    private static boolean
    isLetter(char character)
    Returns whether the given character is a valid IVML identifier letter.
    static final boolean
    Returns whether the given name is reserved.
    static final boolean
    Returns whether the given name is a structural valid identifier.
    static final boolean
    Returns whether the given name is a structurally and semantically valid identifier in IVML.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • RESERVED

      private static final Set<String> RESERVED
      Stores reserved keywords and operator names.
  • Constructor Details

    • IvmlIdentifierCheck

      public IvmlIdentifierCheck()
  • Method Details

    • hash

      private static final void hash(Field[] fields, boolean checkAnnotation)
      Hashes the names of all public constants in fields into RESERVED.
      Parameters:
      fields - the fields to be hashed
      checkAnnotation - false each field will be added to RESERVED which marks them as reserved keyword, true only fields annotated with IVMLKeyWord will be added to RESERVED. This is useful for inherited keywords as not all of them are also reserved in IVML.
    • isValidIdentifier

      public static final boolean isValidIdentifier(String name)
      Returns whether the given name is a structurally and semantically valid identifier in IVML.
      Parameters:
      name - the identifier to test (may be null)
      Returns:
      true if name is a valid IVML identifier, false if identifier is null or not a valid IVML identifier
      See Also:
    • isStructuralValidIdentifier

      public static final boolean isStructuralValidIdentifier(String name)
      Returns whether the given name is a structural valid identifier.
      Parameters:
      name - the name to be checked
      Returns:
      true if name is a reserved name, false else
    • isLetter

      private static boolean isLetter(char character)
      Returns whether the given character is a valid IVML identifier letter.
      Parameters:
      character - the character to be checked
      Returns:
      true if it is a character, false else
    • isReservedName

      public static final boolean isReservedName(String name)
      Returns whether the given name is reserved.
      Parameters:
      name - the name to be checked
      Returns:
      true if name is a reserved name, false else