Class IvmlIdentifierCheck
- java.lang.Object
-
- net.ssehub.easy.varModel.validation.IvmlIdentifierCheck
-
public class IvmlIdentifierCheck extends java.lang.ObjectProvides methods to identify correct IVML identifiers.- Author:
- Holger Eichelberger
-
-
Field Summary
Fields Modifier and Type Field Description private static java.util.Set<java.lang.String>RESERVEDStores reserved keywords and operator names.
-
Constructor Summary
Constructors Constructor Description IvmlIdentifierCheck()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description private static voidhash(java.lang.reflect.Field[] fields, boolean checkAnnotation)Hashes the names of all public constants infieldsintoRESERVED.private static booleanisLetter(char character)Returns whether the given character is a valid IVML identifier letter.static booleanisReservedName(java.lang.String name)Returns whether the givennameis reserved.static booleanisStructuralValidIdentifier(java.lang.String name)Returns whether the givennameis a structural valid identifier.static booleanisValidIdentifier(java.lang.String name)Returns whether the givennameis a structurally and semantically valid identifier in IVML.
-
-
-
Method Detail
-
hash
private static final void hash(java.lang.reflect.Field[] fields, boolean checkAnnotation)Hashes the names of all public constants infieldsintoRESERVED.- Parameters:
fields- the fields to be hashedcheckAnnotation- false each field will be added toRESERVEDwhich marks them as reserved keyword, true only fields annotated withIVMLKeyWordwill be added toRESERVED. This is useful for inherited keywords as not all of them are also reserved in IVML.
-
isValidIdentifier
public static final boolean isValidIdentifier(java.lang.String name)
Returns whether the givennameis a structurally and semantically valid identifier in IVML.- Parameters:
name- the identifier to test (may be null)- Returns:
trueifnameis a valid IVML identifier,falseifidentifieris null or not a valid IVML identifier- See Also:
isReservedName(String),isStructuralValidIdentifier(String)
-
isStructuralValidIdentifier
public static final boolean isStructuralValidIdentifier(java.lang.String name)
Returns whether the givennameis a structural valid identifier.- Parameters:
name- the name to be checked- Returns:
trueifnameis a reserved name,falseelse
-
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:
trueif it is a character,falseelse
-
isReservedName
public static final boolean isReservedName(java.lang.String name)
Returns whether the givennameis reserved.- Parameters:
name- the name to be checked- Returns:
trueifnameis a reserved name,falseelse
-
-