From 220bbfd3765615ab806fb67d7f7ec3e64cc53c6f Mon Sep 17 00:00:00 2001 From: bjornregnell Date: Sun, 19 Jan 2025 18:05:45 +0100 Subject: [PATCH] update metamodel and quickref --- docs/concepts-GENERATED.csv | 6 +- docs/reqT-quickref-GENERATED.tex | 255 +++++++++++++++++++++-------- src/main/scala/02-meta-model.scala | 92 +++++++---- src/main/scala/05-LatexGen.scala | 11 +- src/main/scala/06-examples.scala | 11 +- 5 files changed, 257 insertions(+), 118 deletions(-) diff --git a/docs/concepts-GENERATED.csv b/docs/concepts-GENERATED.csv index ff0ad96..9922b95 100644 --- a/docs/concepts-GENERATED.csv +++ b/docs/concepts-GENERATED.csv @@ -6,10 +6,10 @@ Benefit Attr IntAttr A characterization of a good or helpful result or effect (e Breakpoint EntType QualityEnt A point of change, representing an important shift in the relation between quality and benefit. Capacity Attr IntAttr An amount that can be held or contained (e.g. by a resource). Class EntType DataEnt An extensible template for creating objects. A set of objects with certain attributes in common. A category. -Comment Attr StrAttr A note with a remark or a discussion on an entity. +Comment Attr StrAttr A note, remark or discussion. Component EntType DesignEnt A composable part of a system architecture. A reusable, interchangeable system unit or functionality. Configuration EntType VariabilityEnt A specific combination of variants. -Constraints Attr StrAttr Propositions that constrain a solution space or restrict possible attribute values. +Constraints Attr StrAttr Propositions that constrain a solution space or restrict attribute values. Cost Attr IntAttr An expenditure of something, such as time or effort, necessary if implementing an entity. Damage Attr IntAttr A characterization of the negative consequences if some entity (e.g. a risk) occurs. Data EntType DataEnt A data entity, type, class, or record stored or processed by a system. @@ -73,7 +73,7 @@ User EntType ContextEnt A human interacting with a system. Value Attr IntAttr Some general integer value. Variant EntType VariabilityEnt An object or system property that can be chosen from a set of options. VariationPoint EntType VariabilityEnt An opportunity of choice among variants. -Why Attr StrAttr A description of intention or rationale of an entity. +Why Attr StrAttr A description of intention or rationale. WorkPackage EntType GeneralEnt A coherent collection of (development) activities. binds RelType VariabilityRel Ties a value to an option. A configuration binds a variation point. deprecates RelType GeneralRel Makes outdated. An entity deprecates (supersedes) another entity. diff --git a/docs/reqT-quickref-GENERATED.tex b/docs/reqT-quickref-GENERATED.tex index 41bf0d5..3ff8ed8 100644 --- a/docs/reqT-quickref-GENERATED.tex +++ b/docs/reqT-quickref-GENERATED.tex @@ -13,15 +13,16 @@ \usepackage{fancyhdr} \pagestyle{fancy} -\chead{\url{https://github.com/reqT/reqT-lang/blob/main/docs/reqT-quickref-GENERATED.tex}} -\lhead{QuickRef reqT v4} +\chead{\url{https://reqT.github.io}} +\lhead{QuickRef reqT v4.3} \rhead{Compiled \today} \usepackage{hyperref} \hypersetup{colorlinks=true, linkcolor=blue, urlcolor=blue} \usepackage[usenames,dvipsnames,svgnames,table]{xcolor} \definecolor{entityColor}{RGB}{0,100,200} -\definecolor{attributeColor}{RGB}{0,100,50} +\definecolor{stringAttributeColor}{RGB}{180,100,40} +\definecolor{intAttributeColor}{RGB}{0,120,50} \definecolor{relationColor}{RGB}{160,0,30} \usepackage{listings} @@ -36,8 +37,10 @@ emphstyle=\bfseries\color{entityColor}, emph={[2]binds,deprecates,excludes,has,helps,hurts,impacts,implements,interactsWith,is,precedes,relatesTo,requires,verifies,Binds,Deprecates,Excludes,Has,Helps,Hurts,Impacts,Implements,InteractsWith,Is,Precedes,RelatesTo,Requires,Verifies}, emphstyle={[2]\bfseries\color{relationColor}}, - emph={[3]Benefit,Capacity,Comment,Constraints,Cost,Damage,Deprecated,Example,Expectation,Failure,Frequency,Gist,Input,Location,Max,Min,Order,Output,Prio,Probability,Profit,Spec,Text,Title,Value,Why}, - emphstyle={[3]\bfseries\color{attributeColor}}, + emph={[3]Comment,Constraints,Deprecated,Example,Expectation,Failure,Gist,Input,Location,Output,Spec,Text,Title,Why}, + emphstyle={[3]\bfseries\color{stringAttributeColor}}, + emph={[4]Benefit,Capacity,Cost,Damage,Frequency,Max,Min,Order,Prio,Probability,Profit,Value}, + emphstyle={[4]\bfseries\color{intAttributeColor}}, } \lstset{style=reqT} @@ -67,7 +70,7 @@ \begin{document} -\fontsize{9.1}{11}\selectfont +\fontsize{9.0}{10.5}\selectfont \begin{multicols*}{4} \raggedright @@ -79,6 +82,8 @@ \section*{What is reqT?} common requirements engineering concepts. + + \section*{reqT Markdown syntax} A reqT model in markdown syntax starts with \lstinline+*+ followed by an element and a colon and an optional relation followed by an indented list of sub-elements. @@ -89,18 +94,45 @@ \section*{reqT Markdown syntax} \end{lstlisting} +\section*{reqT Scala DSL constructors} +\lstinline+EntType+, \lstinline+StrAttrType+ and \lstinline+IntAttrType+ enums have apply-methods that construct \lstinline+Ent+, \lstinline+StrAttr+ and \lstinline+IntAttr+ instances respectively. Each instance of \lstinline+Ent+ has lower-case relation constructors (see \lstinline+enum relType+ on next page): +\begin{lstlisting} +Model( + Feature("helloWorld").has( + Spec("Show informal greeting."), + Prio(1))) + +\end{lstlisting} + + +\section*{reqT Scala case classes} +Each constructor instantiate the metamodel classes using nested Scala case class structures: +\begin{lstlisting} +Model( + Rel(Ent(Feature,"helloWorld"), + Has, Model( + StrAttr(Spec, + "Show informal greeting."), + IntAttr(Prio,1)))) + +\end{lstlisting} + + \section*{reqT Metamodel} -A model is a sequence of elements. -An element can be a node or a relation. -A node can be an entity or an attribute. -An entity has a type and an id. -An attribute has a type and a value. -An attribute can be a string attribute or an integer attribute. -A relation connects an entity to a sub-model via a relation type. +A \textbf{Model} is a sequence of \textbf{elements}. +An element can be a \textbf{node} or a \textbf{relation}. +A node can be an \textbf{entity} or an \textbf{attribute}. +An entity has a \textit{type} and an \textit{id}. +An attribute has a \texttt{type} and a \texttt{value}. +An attribute can be a \textbf{string attribute} or an \textbf{integer attribute}. +A relation connects an entity to a \textit{sub-model} via a relation type. + +\section*{reqT Metamodel class diagram} +Leafs are implemented as Scala \textbf{case classes}. \\Fields \texttt{t} are Scala \textbf{enum} types. -\noindent\hspace*{-2.1em}\includegraphics[width=8.2cm]{metamodel-Elem-GENERATED.pdf} +\noindent\hspace*{-3.1em}\vspace{-3em}\includegraphics[width=8.2cm,trim={0 0 0 3em},clip]{metamodel-Elem-GENERATED.pdf} \section*{\texttt{EntType}.values} \subsection*{\underline{\texttt{\textit{{\textcolor{gray}{EntGroup.}\textcolor{black}{GeneralEnt}}\textcolor{gray}{.types}}}}} @@ -216,40 +248,56 @@ \subsection*{\underline{\texttt{\textit{{\textcolor{gray}{EntGroup.}\textcolor{b -\section*{reqT Scala DSL constructors} -\lstinline+EntType+, \lstinline+StrAttrType+ and \lstinline+IntAttrType+ enums have apply-methods that construct \lstinline+Ent+, \lstinline+StrAttr+ and \lstinline+IntAttr+ instances respectively. Each instance of \lstinline+Ent+ has lower-case relation constructors (see \lstinline+enum relType+ on next page): -\begin{lstlisting} -Model( - Feature("helloWorld").has( - Spec("Show informal greeting."), - Prio(1))) +%\vfill\null\columnbreak -\end{lstlisting} +\section*{\texttt{RelType.values}} +\subsection*{\underline{\texttt{\textit{{\textcolor{gray}{RelGroup.}\textcolor{black}{GeneralRel}}\textcolor{gray}{.types}}}}} +\Concept{Deprecates}{Makes outdated. An entity deprecates (supersedes) another entity.} -\section*{reqT Scala case classes} -Each constructor instantiate the metamodel classes using nested Scala case class structures: -\begin{lstlisting} -Model( - Rel(Ent(Feature,"helloWorld"), - Has, Model( - StrAttr(Spec, - "Show informal greeting."), - IntAttr(Prio,1)))) +\Concept{Has}{Expresses containment, substructure, composition or aggregation. One entity contains another.} -\end{lstlisting} +\Concept{Impacts}{Some unspecific influence. A new feature impacts an existing component.} -\end{multicols*} -%\raggedcolumns -\begin{multicols*}{4} -\raggedright +\Concept{RelatesTo}{Some general, unspecific relation to another entity.} + + +\subsection*{\underline{\texttt{\textit{{\textcolor{gray}{RelGroup.}\textcolor{black}{ClassRel}}\textcolor{gray}{.types}}}}} +\Concept{Is}{One entity inherits properties of another entity. A specialization, extension or subtype relation. } + + +\subsection*{\underline{\texttt{\textit{{\textcolor{gray}{RelGroup.}\textcolor{black}{ContextRel}}\textcolor{gray}{.types}}}}} +\Concept{InteractsWith}{A communication relation. A user interacts with an interface.} -%\vfill\null\columnbreak +\subsection*{\underline{\texttt{\textit{{\textcolor{gray}{RelGroup.}\textcolor{black}{DependencyRel}}\textcolor{gray}{.types}}}}} +\Concept{Excludes}{Prevents an entity combination. One feature excludes another in a release.} + +\Concept{Implements}{Realisation of an entity, e.g. a component implements a feature.} + +\Concept{Precedes}{Temporal ordering. A feature precedes (should be implemented before) another feature.} + +\Concept{Requires}{A requested combination. One function requires that a another function is implemented.} + +\Concept{Verifies}{Gives evidence of correctness. A test verifies the implementation of a feature.} + + +\subsection*{\underline{\texttt{\textit{{\textcolor{gray}{RelGroup.}\textcolor{black}{GoalRel}}\textcolor{gray}{.types}}}}} +\Concept{Helps}{Positive influence. A goal supports the fulfillment of another goal.} + +\Concept{Hurts}{Negative influence. A goal hinders another goal.} + + +\subsection*{\underline{\texttt{\textit{{\textcolor{gray}{RelGroup.}\textcolor{black}{VariabilityRel}}\textcolor{gray}{.types}}}}} +\Concept{Binds}{Ties a value to an option. A configuration binds a variation point.} + + + +\vfill\null\columnbreak \section*{\texttt{StrAttrType.values}} -\Concept{Comment}{A note with a remark or a discussion on an entity.} +\Concept{Comment}{A note, remark or discussion.} -\Concept{Constraints}{Propositions that constrain a solution space or restrict possible attribute values.} +\Concept{Constraints}{Propositions that constrain a solution space or restrict attribute values.} \Concept{Deprecated}{A description of why an entity should be avoided, often because it is superseded by another entity, as indicated by a 'deprecates' relation.} @@ -273,9 +321,9 @@ \section*{\texttt{StrAttrType.values}} \Concept{Title}{A general or descriptive heading.} -\Concept{Why}{A description of intention or rationale of an entity.} +\Concept{Why}{A description of intention or rationale.} + -%\vfill\null\columnbreak \section*{\texttt{IntAttrType.values}} \Concept{Benefit}{A characterization of a good or helpful result or effect (e.g. of a feature).} @@ -302,48 +350,117 @@ \section*{\texttt{IntAttrType.values}} \Concept{Value}{Some general integer value.} -\section*{\texttt{RelType.values}} - -\subsection*{\underline{\texttt{\textit{{\textcolor{gray}{RelGroup.}\textcolor{black}{GeneralRel}}\textcolor{gray}{.types}}}}} -\Concept{Deprecates}{Makes outdated. An entity deprecates (supersedes) another entity.} - -\Concept{Has}{Expresses containment, substructure, composition or aggregation. One entity contains another.} - -\Concept{Impacts}{Some unspecific influence. A new feature impacts an existing component.} - -\Concept{RelatesTo}{Some general, unspecific relation to another entity.} +\section*{Examples} +\subsection*{examples.Lauesen.ContextDiagramSimple} +\begin{lstlisting} +* Section: context has + * Product: hotelApp interactsWith + * User: receptionist + * User: guest + * System: accounting + * System: telephony -\subsection*{\underline{\texttt{\textit{{\textcolor{gray}{RelGroup.}\textcolor{black}{ClassRel}}\textcolor{gray}{.types}}}}} -\Concept{Is}{One entity inherits properties of another entity. A specialization, extension or subtype relation. } - - -\subsection*{\underline{\texttt{\textit{{\textcolor{gray}{RelGroup.}\textcolor{black}{ContextRel}}\textcolor{gray}{.types}}}}} -\Concept{InteractsWith}{A communication relation. A user interacts with an interface.} - +\end{lstlisting} -\subsection*{\underline{\texttt{\textit{{\textcolor{gray}{RelGroup.}\textcolor{black}{DependencyRel}}\textcolor{gray}{.types}}}}} -\Concept{Excludes}{Prevents an entity combination. One feature excludes another in a release.} -\Concept{Implements}{Realisation of an entity, e.g. a component implements a feature.} +\subsection*{examples.Lauesen.DataRelations} +\begin{lstlisting} +* Class: Guest relatesTo + * Class: Stay + * Min: 1 +* Class: Stay relatesTo + * Class: RoomState + * Class: RoomService + * Min: 1 +* Class: RoomServiceType relatesTo + * Class: RoomService + * Min: 1 +* Class: Room relatesTo + * Class: RoomState + * Min: 1 -\Concept{Precedes}{Temporal ordering. A feature precedes (should be implemented before) another feature.} +\end{lstlisting} -\Concept{Requires}{A requested combination. One function requires that a another function is implemented.} -\Concept{Verifies}{Gives evidence of correctness. A test verifies the implementation of a feature.} +\subsection*{examples.Prioritization.DollarTest} +\begin{lstlisting} +* Stakeholder: a has + * Prio: 2 + * Req: r1 has Benefit: 5 + * Req: r2 has Benefit: 300 + * Req: r3 has Benefit: 8 + * Req: r4 has Benefit: 9 + * Req: r5 has Benefit: 100 + * Req: r6 has Benefit: 10 + * Req: r7 has Benefit: 20 +* Stakeholder: b has + * Prio: 4 + * Req: r1 has Benefit: 100 + * Req: r2 has Benefit: 7 + * Req: r3 has Benefit: 20 + * Req: r4 has Benefit: 80 + * Req: r5 has Benefit: 10 + * Req: r6 has Benefit: 90 + * Req: r7 has Benefit: 20 +\end{lstlisting} -\subsection*{\underline{\texttt{\textit{{\textcolor{gray}{RelGroup.}\textcolor{black}{GoalRel}}\textcolor{gray}{.types}}}}} -\Concept{Helps}{Positive influence. A goal supports the fulfillment of another goal.} -\Concept{Hurts}{Negative influence. A goal hinders another goal.} +\vfill\null\columnbreak +\subsection*{examples.Lauesen.DataEntities} +\begin{lstlisting} +* Class: RoomServiceType has + * Field: name + * Field: price +* Class: RoomService has + * Field: serviceDate + * Field: serviceCount +* Class: Room has + * Field: roomId + * Field: bedCount + * Field: roomType + * Field: price1 + * Field: price2 +* Class: RoomState has + * Field: date + * Field: personCount + * Field: state +\end{lstlisting} -\subsection*{\underline{\texttt{\textit{{\textcolor{gray}{RelGroup.}\textcolor{black}{VariabilityRel}}\textcolor{gray}{.types}}}}} -\Concept{Binds}{Ties a value to an option. A configuration binds a variation point.} + +\subsection*{examples.constraintProblems.\\releasePlanSimple} +\begin{lstlisting} +* Stakeholder: X has + * Prio: 1 + * Feature: 1 has Benefit: 4 + * Feature: 2 has Benefit: 2 + * Feature: 3 has Benefit: 1 +* Stakeholder: Y has + * Prio: 2 + * Feature: 1 has Benefit: 2 + * Feature: 2 has Benefit: 1 + * Feature: 3 has Benefit: 1 +* Release: A precedes Release: B +* Resource: dev has + * Feature: 1 has Cost: 10 + * Feature: 2 has Cost: 70 + * Feature: 3 has Cost: 40 + * Release: A has Capacity: 100 + * Release: B has Capacity: 100 +* Resource: test has + * Feature: 1 has Cost: 40 + * Feature: 2 has Cost: 10 + * Feature: 3 has Cost: 70 + * Release: A has Capacity: 100 + * Release: B has Capacity: 100 +* Feature: 3 precedes Feature: 1 +\end{lstlisting} + \end{multicols*} + \end{document} \ No newline at end of file diff --git a/src/main/scala/02-meta-model.scala b/src/main/scala/02-meta-model.scala index 090190f..7f526f9 100644 --- a/src/main/scala/02-meta-model.scala +++ b/src/main/scala/02-meta-model.scala @@ -84,8 +84,8 @@ object meta: lazy val entGroupTypesMap: Map[EntGroup, Set[EntType]] = entTypeGroupMap.toSeq.groupBy(_._2).map((x, xs) => x -> xs.map(_._1).toSet) lazy val strAttrConcepts = ArraySeq[(String,String)]( - "Comment" -> "A note with a remark or a discussion on an entity.", - "Constraints" -> "Propositions that constrain a solution space or restrict possible attribute values.", + "Comment" -> "A note, remark or discussion.", + "Constraints" -> "Propositions that constrain a solution space or restrict attribute values.", "Deprecated" -> "A description of why an entity should be avoided, often because it is superseded by another entity, as indicated by a 'deprecates' relation.", "Example" -> "A description that illustrates some entity by a typical instance.", "Expectation" -> "A required output of a test in order to be counted as passed.", @@ -97,7 +97,7 @@ object meta: "Output" -> "Data produced by an entity, e.g. a function or a test.", "Spec" -> "A definition of an entity. Short for specification", "Text" -> "An paragraph or general description.", - "Why" -> "A description of intention or rationale of an entity.", + "Why" -> "A description of intention or rationale.", ).sorted lazy val intAttrConcepts = ArraySeq[(String,String)]( @@ -410,6 +410,8 @@ object meta: |helps you structure requirements into semi-formal |natural-language models using |common requirements engineering concepts. + | + | |""".stripMargin val helloMarkdown = @@ -435,13 +437,13 @@ object meta: |""".stripMargin val metaModelDescription = - s"""|A model is a sequence of elements. - |An element can be a node or a relation. - |A node can be an entity or an attribute. - |An entity has a type and an id. - |An attribute has a type and a value. - |An attribute can be a string attribute or an integer attribute. - |A relation connects an entity to a sub-model via a relation type. + s"""|A \\textbf{Model} is a sequence of \\textbf{elements}. + |An element can be a \\textbf{node} or a \\textbf{relation}. + |A node can be an \\textbf{entity} or an \\textbf{attribute}. + |An entity has a \\textit{type} and an \\textit{id}. + |An attribute has a \\texttt{type} and a \\texttt{value}. + |An attribute can be a \\textbf{string attribute} or an \\textbf{integer attribute}. + |A relation connects an entity to a \\textit{sub-model} via a relation type. |""".stripMargin val fileName = "reqT-quickref-GENERATED" @@ -464,8 +466,8 @@ object meta: | |\\usepackage{fancyhdr} |\\pagestyle{fancy} - |\\chead{\\url{https://github.com/reqT/reqT-lang/blob/main/docs/$fileName.tex}} - |\\lhead{QuickRef reqT v4} + |\\chead{\\url{https://reqT.github.io}} + |\\lhead{QuickRef reqT v4.3} |\\rhead{Compiled \\today} | |\\usepackage{hyperref} @@ -510,7 +512,7 @@ object meta: val body = s"""| - |\\fontsize{9.1}{11}\\selectfont + |\\fontsize{9.0}{10.5}\\selectfont | |\\begin{multicols*}{4} |\\raggedright @@ -525,11 +527,22 @@ object meta: |$helloMarkdown |\\end{lstlisting} | + |\\section*{reqT Scala DSL constructors} + |${code{"EntType"}}, ${code("StrAttrType")} and ${code("IntAttrType")} enums have apply-methods that construct ${code{"Ent"}}, ${code("StrAttr")} and ${code("IntAttr")} instances respectively. Each instance of ${code{"Ent"}} has lower-case relation constructors (see ${code("enum relType")} on next page): + |${codeBlock(helloConstructors)} + | + |\\section*{reqT Scala case classes} + |Each constructor instantiate the metamodel classes using nested Scala case class structures: + |${codeBlock(helloClasses)} + | |\\section*{reqT Metamodel} | |$metaModelDescription | - |\\noindent\\hspace*{-2.1em}\\includegraphics[width=8.2cm]{metamodel-Elem-GENERATED.pdf} + |\\section*{reqT Metamodel class diagram} + |Leafs are implemented as Scala \\textbf{case classes}. \\\\Fields \\texttt{t} are Scala \\textbf{enum} types. + | + |\\noindent\\hspace*{-3.1em}\\vspace{-3em}\\includegraphics[width=8.2cm,trim={0 0 0 3em},clip]{metamodel-Elem-GENERATED.pdf} | |\\section*{\\texttt{EntType}.values} |${ @@ -541,27 +554,27 @@ object meta: subsections.mkString("\n") } | - |\\section*{reqT Scala DSL constructors} - |${code{"EntType"}}, ${code("StrAttrType")} and ${code("IntAttrType")} enums have apply-methods that construct ${code{"Ent"}}, ${code("StrAttr")} and ${code("IntAttr")} instances respectively. Each instance of ${code{"Ent"}} has lower-case relation constructors (see ${code("enum relType")} on next page): - |${codeBlock(helloConstructors)} + |%\\vfill\\null\\columnbreak | - |\\section*{reqT Scala case classes} - |Each constructor instantiate the metamodel classes using nested Scala case class structures: - |${codeBlock(helloClasses)} - |\\end{multicols*} - |%\\raggedcolumns - |\\begin{multicols*}{4} - |\\raggedright + |\\section*{\\texttt{RelType.values}} | - |%\\vfill\\null\\columnbreak + |${ + val subsections = for rg <- RelGroup.values yield + val head = s"\\subsection*{\\underline{\\texttt{\\textit{{\\textcolor{gray}{RelGroup.}\\textcolor{black}{$rg}}\\textcolor{gray}{.types}}}}}" + val rs = relGroupTypesMap(rg).toSeq.map(_.toString).sorted + val xs = rs.map(r => conceptDef(r, conceptMap(r.deCapitalize).descr)) + head + xs.mkString("\n", "\n", "\n") + subsections.mkString("\n") + } | + |\\vfill\\null\\columnbreak |\\section*{\\texttt{StrAttrType.values}} |${ val xs = for (s, c) <- strAttrConcepts yield conceptDef(s, conceptMap(s).descr) xs.mkString("\n") } - |%\\vfill\\null\\columnbreak + | |\\section*{\\texttt{IntAttrType.values}} |${ val xs = for (s, c) <- intAttrConcepts yield @@ -569,17 +582,26 @@ object meta: xs.mkString("\n") } | - |\\section*{\\texttt{RelType.values}} + |\\section*{Examples} | - |${ - val subsections = for rg <- RelGroup.values yield - val head = s"\\subsection*{\\underline{\\texttt{\\textit{{\\textcolor{gray}{RelGroup.}\\textcolor{black}{$rg}}\\textcolor{gray}{.types}}}}}" - val rs = relGroupTypesMap(rg).toSeq.map(_.toString).sorted - val xs = rs.map(r => conceptDef(r, conceptMap(r.deCapitalize).descr)) - head + xs.mkString("\n", "\n", "\n") - subsections.mkString("\n") - } + |\\subsection*{examples.Lauesen.ContextDiagramSimple} + |${codeBlock(examples.Lauesen.ContextDiagramSimple.toMarkdown)} + | + |\\subsection*{examples.Lauesen.DataRelations} + |${codeBlock(examples.Lauesen.DataRelations.toMarkdown)} + | + |\\subsection*{examples.Prioritization.DollarTest} + |${codeBlock(examples.Prioritization.DollarTest.toMarkdown)} + | + |\\vfill\\null\\columnbreak + |\\subsection*{examples.Lauesen.DataEntities} + |${codeBlock(examples.Lauesen.DataEntities.elems.collect{case rel@Rel(e,r,m) if e.id.startsWith("R") => rel}.toModel.toMarkdown)} + | + |\\subsection*{examples.constraintProblems.\\\\releasePlanSimple} + |${codeBlock(examples.constraintProblems.releasePlanSimple.toMarkdown)} + | |\\end{multicols*} + | |""".stripMargin val toLatex = preamble + body + ending diff --git a/src/main/scala/05-LatexGen.scala b/src/main/scala/05-LatexGen.scala index c4c4c60..ddb0257 100644 --- a/src/main/scala/05-LatexGen.scala +++ b/src/main/scala/05-LatexGen.scala @@ -3,12 +3,13 @@ package reqt object LatexGen: def defineColors: String = s"""|\\definecolor{entityColor}{RGB}{0,100,200} - |\\definecolor{attributeColor}{RGB}{0,100,50} + |\\definecolor{stringAttributeColor}{RGB}{180,100,40} + |\\definecolor{intAttributeColor}{RGB}{0,120,50} |\\definecolor{relationColor}{RGB}{160,0,30} |""".stripMargin def lstDefineStyle: String = - import meta.{entityNames, relationNames, attributeNames} + import meta.{entityNames, relationNames, strAttrNames, intAttrNames} s"""|\\lstdefinestyle{reqT}{ | %belowcaptionskip=1\\baselineskip, | breaklines=true, @@ -20,7 +21,9 @@ object LatexGen: | emphstyle=\\bfseries\\color{entityColor}, | emph={[2]${(relationNames ++ relationNames.map(_.capitalize)).mkString{","}}}, | emphstyle={[2]\\bfseries\\color{relationColor}}, - | emph={[3]${attributeNames.mkString{","}}}, - | emphstyle={[3]\\bfseries\\color{attributeColor}}, + | emph={[3]${strAttrNames.mkString{","}}}, + | emphstyle={[3]\\bfseries\\color{stringAttributeColor}}, + | emph={[4]${intAttrNames.mkString{","}}}, + | emphstyle={[4]\\bfseries\\color{intAttributeColor}}, |} |""".stripMargin diff --git a/src/main/scala/06-examples.scala b/src/main/scala/06-examples.scala index 365abc3..e5ad656 100644 --- a/src/main/scala/06-examples.scala +++ b/src/main/scala/06-examples.scala @@ -16,7 +16,7 @@ val menu: Map[String, Model] = Map( "Prioritization: 100$ test" -> Prioritization.DollarTest, "Release Plan, simple" -> constraintProblems.releasePlanSimple, "QUPER Model: StartupQuality" -> QualityModel.StartupQuality, - "Variability Model: Color" -> VariabilityModel.AppearanceVariation, + "Variability Model: Color" -> VariabilityModel.Appearance, ) object constraintProblems: @@ -82,7 +82,6 @@ object Lauesen: ) val ContextDiagramSimple = Model( - Title("Context Diagram, simple"), Section("context").has( Product("hotelApp").interactsWith( User("receptionist"), @@ -123,7 +122,6 @@ object Lauesen: ) val DataRelations = Model( - Title("Data Relations"), Class("Guest").relatesTo( Class("Stay"), Min(1), @@ -180,9 +178,8 @@ object Lauesen: ) val StateMachine = Model( - Title("State Machine"), + Title("Room State Model"), Section("roomState").has( - Title("Room State Model"), State("free").has( Event("book").precedes( State("booked"), @@ -254,7 +251,7 @@ object Lauesen: Feature("deepTopStuff") has (Feature("Gurka") has Spec("hejsan")), Section("context") has ( Text("This section describes the context of the system."), - Image("context-diagram.svg"), + Image("ctxImg") has Location("context-diagram.png"), Product("hotelApp") implements ( Interface("receptionUI") has User("receptionist"), Interface("guestUI") has User("guest"), @@ -354,7 +351,7 @@ object QualityModel: ) object VariabilityModel: - val AppearanceVariation = Model( + val Appearance = Model( Component("appearance") has ( VariationPoint("color") has ( Min(0), Max(2),