This project is a java shell interpreting command written in reverse polish notation. You'll be able to find the command later in this tutorial.
In this section, you will be given all the command you can use.
- <integers> : create a stream of integers
- <revintegers> : create a reverse stream of integers
- <fibo> : create a stream following the fibonnaci sequence
- <random> : create a stream with randomly generated element
- <slice> : take a part of the stream
- <get> : get the ith element of the stream
- <sum> : do the sum of all the elements of the stream
- <product> : do the product of all the element of the stream
- <inter> : do the intersection between two streams
- <add> : add two numbers
- <sub> : sub two numbers
- <mul> : multiply two numbers
- <div> : divide two numbers
- <sort> : sort the stream
- <concat> : concatenate two streams
- <repeat> : repeat the stream a given amount of times
- <shuffle> : suffle a stream wether it is already unordered or not
- <average> : do the average between all the elements of the stream
- <len> : get the length of the stream
- <min> : get the minimum of the stream
- <max> : get the maximum of the stream
- <print> : print the stream
- /printvar [name_of_the_var]
- /printvars : print all the vars
- /printvars alpha : print all the vars in a alphabetical manner
- /quit : quit the shell
Here is/are examples of what you could write in the shell.
1 <integers> 0 10 <slice> <sum>
# This give you the sum of all elements ranging from 0 to 10
The project can be divided in two types of classes. On one side you have the data structures, on the other, you have the command. The variables are located in the "variables" directory. The commands are located in the "commands" directory.
All data structures are implementing the Variable interface. This interface has some sub interfaces such as VarStream which is meant to be used by stream-like data structure. All commands are extending the AbstractCommand class. The general behavior of a command is : create an empty ArrayList of args. Each time you encounter an arg you add it to the array and then you process the command to get the variable.
If you want to add a classes to the project, you should follow those steps:
- Add the data structure in the correct directory
- Add the command to the correct directory
- Add the line in the class CommandFactory
- Implement the logic in the console
If you have time, please consider trying to implement the following elements:
- ⬜ Save session (serialize hashmap via json)
- ⬜ Import session (deserialize file)