Skip to content
This repository was archived by the owner on Jun 24, 2025. It is now read-only.

My old university homework which I made back in 2015. Found it on my old PC and decided to upload for the history

Notifications You must be signed in to change notification settings

Darkzarich/java-union-commands-parser-lab

Repository files navigation

University homework - Lab 1 - Union Algorithms

Description

My old university homework which I made back in 2015.

The task was to build a script that will parse a provided text file with a set of commands in a predefined format and execute them, as a data structure it should use linked list.

The file with commands should have name "Sets.command"

Commands.

The syntax of the commands is as follows:

Create a new set "abc"

new abc

Add a new element "5" to the set "abc"

add abc 5

Remove the element "5" from the set "abc"

del abc 5

Remove the set "abc"

del abc

Union of two sets "abc" and "def". If parameter res is provided then the result will be stored in the new set res Otherwise the result will be printed to the terminal.

union abc def [res]

Intersection of two sets "abc" and "def". If parameter res is provided then the result will be stored in the new set res Otherwise the result will be printed to the terminal.

intersec abc def [res]

Difference of two sets "abc" and "def". If parameter res is provided then the result will be stored in the new set res Otherwise the result will be printed to the terminal.

diff abc def [res]

Symmetric difference of two sets "abc" and "def". If parameter res is provided then the result will be stored in the new set res Otherwise the result will be printed to the terminal.

simmdiff abc def [res]

Show the content of the set "abc"

show abc

Show all the sets

showall

Check if the set "abc" has the element "5"

contains abc 5

Check if the set "abc" includes the set "def"

isin abc def

Check if the set "abc" exists

exist abc

Exit the program

exit

Example

new abc
add abc 5
add abc 10
add abc 15
show abc
del abc 10
show abc
union abc def res
show res
exit

About

My old university homework which I made back in 2015. Found it on my old PC and decided to upload for the history

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published