Skip to content
Snippets Groups Projects
Commit 93cbbcc7 authored by W. Spencer Smith's avatar W. Spencer Smith
Browse files

Update of L10 for ADTs, initial modification of L11 for Generic MIS

parent 89df0456
No related branches found
No related tags found
No related merge requests found
No preview for this file type
......@@ -44,10 +44,10 @@
\begin{itemize}
\item Administrative details
\item File transfer on mills
%\item File transfer on mills
\item Implementation of a sequence abstract object
\item Specification of abstract data types
\item Example (similar to A2)
\item Example (similar to A2, 2017)
\bi
\item PointADT
\item LineADT
......@@ -522,7 +522,7 @@ None
~\newline
insideCircle: pointT $\times$ circleT $\rightarrow$ boolean
\noindent insideCircle($p, c$) $\equiv p.\mbox{dist}(c.\mbox{centre}) \leq c.\mbox{radius}$
\noindent insideCircle($p, c$) $\equiv$ \uncover<1>{\structure{?}}\uncover<2->{$p.\mbox{dist}(c.\mbox{centre}) \leq c.\mbox{radius}$}
\end{frame}
......@@ -541,7 +541,7 @@ circleADT\\
~\newline
\textbf{Exported Constants}\\
~\newline
max\_size = 20
MAX\_SIZE = 20
\end{frame}
......@@ -588,11 +588,11 @@ averageRadius & ~ & real & EMPTY\\
\textbf{State Variables}\\
~\newline
$s$: sequence of circleT\\
$s$: \uncover<1>{\structure{?}}\uncover<2->{sequence of circleT}\\
~\newline
\textbf {State Invariant}\\
~\newline
$| s | \leq \mbox{max\_size}$\\
$| s | \leq \mbox{MAX\_SIZE}$\\
~\newline
\textbf{Assumptions}\\
~\newline
......@@ -613,14 +613,14 @@ init() is called before any other access program.
\noindent pushBack($c$):
\begin{itemize}
\item transition: $s := s || <c>$
\item exception: $exc := (|s| = \mbox{max\_size} \Rightarrow \mbox{FULL})$
\item transition: \uncover<1>{\structure{?}}\uncover<2->{$s := s || <c>$}
\item exception: $exc := (|s| = \mbox{MAX\_SIZE} \Rightarrow \mbox{FULL})$
\end{itemize}
\noindent pushFront($c$):
\begin{itemize}
\item transition: $s := <c> || s $
\item exception: $exc := (|s| = \mbox{max\_size} \Rightarrow \mbox{FULL})$
\item exception: $exc := (|s| = \mbox{MAX\_SIZE} \Rightarrow \mbox{FULL})$
\end{itemize}
\end{frame}
......@@ -632,7 +632,7 @@ init() is called before any other access program.
\noindent popBack():
\begin{itemize}
\item transition: $s := s[0..|s| - 2]$
\item transition: \uncover<1>{\structure{?}}\uncover<2->{$s := s[0..|s| - 2]$}
\item exception: $exc := (|s| = 0 \Rightarrow \mbox{EMPTY})$
\end{itemize}
......@@ -667,11 +667,26 @@ init() is called before any other access program.
\item exception: none
\end{itemize}
\end{frame}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}
\frametitle{Access Routine Semantics Disjoint}
Disjoint returns true if none of the circles in the deque overlap.\\
~\\
\structure<1>{What access program tells you whether two circles overlap?}\\
~\\
\structure<2>{In words how would you express the predicate for disjoint?}\\
~\\
\noindent disjoint():
\begin{itemize}
\item output \\
$out := \forall(i, j:\mathbb{N} | i \in [0 .. |s| -1] \wedge j \in [0 .. |s| -1] \wedge i \neq j:\neg
s[i].\mbox{intersect}(s[j]))$
$out
:=\uncover<-3>{\structure{?}}\uncover<4->{\forall}(\uncover<-5>{\structure{?}}\uncover<6->{i,
j:\mathbb{N}} | \uncover<-6>{\structure{?}}\uncover<7->{i \in [0 .. |s| -1] \wedge j \in [0 .. |s| -1] \wedge i \neq
j}:\uncover<-4>{\structure{?}}\uncover<5->{\neg s[i].\mbox{intersect}(s[j])})$
\item exception: $exc := (|s| = 0 \Rightarrow \mbox{EMPTY})$
\end{itemize}
......@@ -680,17 +695,17 @@ s[i].\mbox{intersect}(s[j]))$
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}
\frametitle{Access Routine Semantics Continued}
\frametitle{Homework: Access Routine Semantics Continued}
\noindent totalArea():
\begin{itemize}
\item output $$out := ?$$
\item output \structure{$$out := ?$$}
\item exception: $exc := (|s| = 0 \Rightarrow \mbox{EMPTY})$
\end{itemize}
\noindent averageRadius():
\begin{itemize}
\item output $$out := ?$$
\item output \structure{$$out := ?$$}
\item exception: $exc := (|s| = 0 \Rightarrow \mbox{EMPTY})$
\end{itemize}
......
No preview for this file type
......@@ -162,6 +162,25 @@ TBD
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}
\frametitle{Homework Answer: Access Routine Semantics}
\noindent totalArea():
\begin{itemize}
\item output \structure{$$out := ?$$} %say in words, what symbol out front?
\item exception: $exc := (|s| = 0 \Rightarrow \mbox{EMPTY})$
\end{itemize}
\noindent averageRadius():
\begin{itemize}
\item output \structure{$$out := ?$$}
\item exception: $exc := (|s| = 0 \Rightarrow \mbox{EMPTY})$
\end{itemize}
\end{frame}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}
\frametitle{Uses for Abstract Objects}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment