\caption{Activity Diagram for «conflictsWith» operation}
\label{fig:conflicts}
\end{figure}
\begin{question}
First, use a «double dispatch» mechanism to choose the correct implementation of the \code{conflictsWith()} operation.
\begin{inparaenum}[(A)]
\item Add the methods \code{conflictsWithSingleEvent()} and \code{conflictsWithRecurrentEvent()} to the \code{Event} class.
\item Implement the methods \code{SingleEvent::conflictsWith()} and \code{RecurrentEvent::conflictsWith()} and make them call the correct implementation methods.
\end{inparaenum}
\end{question}
\begin{solution}
\begin{enumerate}
\item In the implementation I use the \code{java.time} package. It uses date and time without considering time zones.
\item The code is still incomplete: the intersection method is still Work TODO.
\item I'm not a big fan of the double dispatch: it makes the superclass depend on subclasses (bad practice).
\end{enumerate}
\end{solution}
\begin{question}
Add a method named \code{occurrences()} to class \code{RecurrentEvent}.
This method must generate all occurrences of a recurrent event.
<guardxmi:type="uml:LiteralBoolean"xmi:id="_qM2IARxVEeiktqE5H6Adsg"name="Compare SIngle with Recurrent_To_Generate all Recurring Occurrences_guard"value="true"/>
<weightxmi:type="uml:LiteralInteger"xmi:id="_qM2IAhxVEeiktqE5H6Adsg"name="Compare SIngle with Recurrent_To_Generate all Recurring Occurrences_weight"/>
<guardxmi:type="uml:LiteralBoolean"xmi:id="_2BxHkRxVEeiktqE5H6Adsg"name="Generate all Recurring Occurrences_To_Check if Occurrences contain Single Event_guard"value="true"/>
<weightxmi:type="uml:LiteralInteger"xmi:id="_2BxuoBxVEeiktqE5H6Adsg"name="Generate all Recurring Occurrences_To_Check if Occurrences contain Single Event_weight"/>
<nodexmi:type="uml:OpaqueAction"xmi:id="_IAVbYBxVEeiktqE5H6Adsg"name="Compare Single Events"incoming="_QKv4EBxVEeiktqE5H6Adsg"outgoing="_TkjFcBxVEeiktqE5H6Adsg">
<nodexmi:type="uml:OpaqueAction"xmi:id="_cOZQIBxVEeiktqE5H6Adsg"name="Compare SIngle with Recurrent"incoming="_huy9oBxVEeiktqE5H6Adsg"outgoing="_qM2IABxVEeiktqE5H6Adsg">
<body>// TODO body of OpaqueAction2</body>
</node>
<nodexmi:type="uml:OpaqueAction"xmi:id="_leoFYBxVEeiktqE5H6Adsg"name="Generate all Recurring Occurrences"incoming="_qM2IABxVEeiktqE5H6Adsg"outgoing="_2BxHkBxVEeiktqE5H6Adsg">
<body>// TODO body of OpaqueAction3</body>
</node>
<nodexmi:type="uml:OpaqueAction"xmi:id="_vvKhEBxVEeiktqE5H6Adsg"name="Check if Occurrences contain Single Event"incoming="_2BxHkBxVEeiktqE5H6Adsg"outgoing="_2ufqsBxVEeiktqE5H6Adsg">
<nodexmi:type="uml:OpaqueAction"xmi:id="_Iu6jMBxWEeiktqE5H6Adsg"name="Compare two Recurrent Events"incoming="_Ne6HcBxWEeiktqE5H6Adsg"outgoing="_OkUQUBxWEeiktqE5H6Adsg">
<body>// TODO body of OpaqueAction5</body>
</node>
<nodexmi:type="uml:OpaqueAction"xmi:id="_QV14UBxWEeiktqE5H6Adsg"name="Generate all occurrences for event One"incoming="_ca_sQBxWEeiktqE5H6Adsg"outgoing="_gggwIBxWEeiktqE5H6Adsg">
<body>// TODO body of OpaqueAction6</body>
</node>
<nodexmi:type="uml:OpaqueAction"xmi:id="_WKCEgBxWEeiktqE5H6Adsg"name="Generate all occurrences for event Other"incoming="_dUBmABxWEeiktqE5H6Adsg"outgoing="_heai0BxWEeiktqE5H6Adsg">