This website houses notes from my studies at the University of Liverpool. If you see any errors or issues, please do open an issue on this site's GitHub.
An object represents a specific, identifiable part of the world-model: It incorporates (passive) attributes. Variables. It has (active) behaviours, services. Methods. Objects interact by sending messages. Calling methods. Here is an example of three objects: Here is an interaction between Russ, the ATM near the guild and his account: graph...
Complex numbers as $2\times 2$ Matrices For the complex number $z=a+ib$: \[\mathbf M_z=\begin{pmatrix}a & -b \\ b & a\end{pmatrix}\] The following operations will then apply: Addition and Multiplication As normal. Conjugate $\mathbf M_{\bar z}=\mathbf M_z^\top$ - This is the transpose of $\mathbf M_z$. Modulus $\vert z\vert=\text{det }\mathbf M_z$ Argand Diagram...
Complex numbers revolve around the imaginary number $i$. It follows the following identities: \[\begin{aligned} \sqrt{-1}&=i\\ i^2&=-1\\ (-i)^2&=(-1)^2\times i^2\\&=-1 \end{aligned}\] In general, complex numbers are written in the form: \[z=a+ib\] $a$ is called the real part of $z$: $\text{Re}(z)$ $b$ is called the imaginary part of $z$: $\text{Im}(z)$ The numbers $a+ib$...
A recursive subroutine is one that may call itself to perform some subsidiary task. If a subroutine is calling itself then it makes a new stack frame for each recursion. Recursion may also appear in the form of mutual recursion. Factorial Example factorial(1) = 1 factorial(n) = n * factorial(n...
Local Variables Consider a subroutines that contains variable declarations: int sub1 (int n) { int x; float y; char z; ... } The variables x, y, and z are local variables : They only exist while the subroutine is active. Then the subroutines exist, the local variables disappear. Stack Frames...
This calls the subroutines from the C libraries to provide I/O functions. External Subroutines In order to call external subroutines from assembly the parameters need to be pushed to the stack. printf This function prints to the standards output. It expects its parameters to be on the stack. It expect...
Javadoc automatically creates docs from javadoc comments in your code. Javadoc comments are multi-line comments that start with /**, instead of /*. You can write HTML, text and tags in them. Generating Javadocs Generating javadocs is done with the javadoc command: $ javadoc -d ./docs source.java This will make a...
Stacks The following are the operations on stacks: Push - Insert element tot he location 1 beyond top. Pop - Delete element from the top. The stack has one pointer that points to the top-most data in the stack. Push Increment top by 1 and save the data to S[top]....
Arrays - Alow random access to data. Queues - FIFO Stack - LIFO Queues There are two operations on a queue: Enqueue - Insert element to the tail. Dequeue - Delete element from the head. The head points to the first element and the tail points to the location where...
The simplest kind of subroutine performs an identical function each time it is called and required no further information. There are two main forms of parameters: Value parameters Reference parameters Value Parameters In this case the additional information will be some static value. If your function uses a value then...