summaryrefslogtreecommitdiff
path: root/support/arara/source/src/main/kotlin/org/islandoftex/arara/ruleset/Rule.kt
diff options
context:
space:
mode:
Diffstat (limited to 'support/arara/source/src/main/kotlin/org/islandoftex/arara/ruleset/Rule.kt')
-rw-r--r--support/arara/source/src/main/kotlin/org/islandoftex/arara/ruleset/Rule.kt48
1 files changed, 48 insertions, 0 deletions
diff --git a/support/arara/source/src/main/kotlin/org/islandoftex/arara/ruleset/Rule.kt b/support/arara/source/src/main/kotlin/org/islandoftex/arara/ruleset/Rule.kt
new file mode 100644
index 0000000000..53ac2aa8b1
--- /dev/null
+++ b/support/arara/source/src/main/kotlin/org/islandoftex/arara/ruleset/Rule.kt
@@ -0,0 +1,48 @@
+// SPDX-License-Identifier: BSD-3-Clause
+package org.islandoftex.arara.ruleset
+
+import kotlinx.serialization.Serializable
+import org.islandoftex.arara.utils.CommonUtils
+
+/**
+ * Implements the rule model.
+ *
+ * @author Island of TeX
+ * @version 5.0
+ * @since 4.0
+ */
+@Serializable
+class Rule {
+ /**
+ * The rule identifier
+ */
+ var identifier: String = INVALID_RULE_IDENTIFIER
+ get() = CommonUtils.removeKeywordNotNull(field)
+
+ /**
+ * The rule name
+ */
+ var name: String = INVALID_RULE_NAME
+ get() = CommonUtils.removeKeywordNotNull(field)
+
+ /**
+ * The list of authors
+ */
+ var authors: List<String> = listOf()
+ get() = field.mapNotNull { CommonUtils.removeKeyword(it) }
+
+ /**
+ * The list of commands
+ */
+ var commands: List<RuleCommand> = listOf()
+
+ /**
+ * The list of arguments
+ */
+ var arguments: List<Argument> = listOf()
+
+ companion object {
+ const val INVALID_RULE_IDENTIFIER = "INVALID_RULE"
+ const val INVALID_RULE_NAME = "INVALID_RULE"
+ }
+}