Package org.xcsp.parser.entries
Class ParsingEntry
- java.lang.Object
-
- org.xcsp.parser.entries.ParsingEntry
-
- Direct Known Subclasses:
ParsingEntry.CEntry
,ParsingEntry.OEntry
,ParsingEntry.VEntry
public abstract class ParsingEntry extends Object
The class root of any entry in variables, constraints and objectives. The basic attributes id, class and note are managed here.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ParsingEntry.CEntry
The root class of any element that is a (direct or indirect) entry in. static class
ParsingEntry.OEntry
The root class for representing objectives.static class
ParsingEntry.VEntry
The root class used for Var and Array objects.
-
Field Summary
Fields Modifier and Type Field Description Map<Types.TypeAtt,String>
attributes
The attributes that are associated with the element.Types.TypeClass[]
classes
The classes associated with the entry.Set<Types.TypeFlag>
flags
The flags associated with the entry.String
id
The id (unique identifier) of the entry.String
note
The note (short comment) associated with the entry.
-
Constructor Summary
Constructors Modifier Constructor Description protected
ParsingEntry()
protected
ParsingEntry(String id)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
copyAttributesOf(Element elt)
Collect the XMl attributes of the specified element into a map (using an enum type for keys, and String for values).boolean
getAttributeValue(Types.TypeAtt att, boolean defaultValue)
Returns the Boolean value of the specified attribute, if it exists, the specified default value otherwise.int
getAttributeValue(Types.TypeAtt att, int defaultValue)
Returns the int value of the specified attribute, if it exists, the specified default value otherwise.<T extends Enum<T>>
TgetAttributeValue(Types.TypeAtt att, Class<T> clazz, T defaultValue)
Returns the value of the specified attribute, if it exists, the specified default value otherwise.
-
-
-
Field Detail
-
id
public String id
The id (unique identifier) of the entry.
-
classes
public Types.TypeClass[] classes
The classes associated with the entry.
-
note
public String note
The note (short comment) associated with the entry.
-
attributes
public final Map<Types.TypeAtt,String> attributes
The attributes that are associated with the element. Useful for storing all attributes by a simple copy. It is mainly used when dealing with special parameters of constraints (startIndex, circular, ...).
-
flags
public final Set<Types.TypeFlag> flags
The flags associated with the entry. Currently, used only for table constraints.
-
-
Constructor Detail
-
ParsingEntry
protected ParsingEntry()
-
ParsingEntry
protected ParsingEntry(String id)
-
-
Method Detail
-
getAttributeValue
public final boolean getAttributeValue(Types.TypeAtt att, boolean defaultValue)
Returns the Boolean value of the specified attribute, if it exists, the specified default value otherwise.
-
getAttributeValue
public final int getAttributeValue(Types.TypeAtt att, int defaultValue)
Returns the int value of the specified attribute, if it exists, the specified default value otherwise.
-
getAttributeValue
public final <T extends Enum<T>> T getAttributeValue(Types.TypeAtt att, Class<T> clazz, T defaultValue)
Returns the value of the specified attribute, if it exists, the specified default value otherwise.
-
copyAttributesOf
public void copyAttributesOf(Element elt)
Collect the XMl attributes of the specified element into a map (using an enum type for keys, and String for values).
-
-