Hey,
before i start asking questions, let me explain what kind of
java project im doing and what im aiming for.
I wana write a Programm to visualize and calculate a pipe system.
1.The user should be able to create vertical pipes at will, that have different radii, a position in space (x, y, z) and a volumetric flow rate (how much
water flows through the pipe per second).
2. The user should then be able to connect those vertical pipes using a main connection, again setting a radius and secondly telling the connection which vertical pipes should be connected with each other. The main connection should be in a series, meaning if you use a connection to connect vertical pipe a with vertical pipe b, youre free to choose what vertical pipe the main connection goes to next, but it has to come from vertical pipe b.
3. The user sets the koordinates of the end of the main connection again any position in space.
4. If there are any unconnected vertical pipes, the user should be able to connect them to the main connection using side connections, beeing able to set the radii.
5. A few calculations should be done, for example summing up all the volumetric flow rates. Another example would be calculating the slope of all the connections (since two vertical pipes dont necessarily have the same lenths).
6. The input should be done using a GUI.
7. The pipesystem should be visualized.
Ive thought of having a class pipe, that has all the attributes a pipe can have and then some sub-classes for the vertical pipes, the main and side connections and the end of the pipe.
In another class called pipesystem i would have ArrayLists for each time of pipe.
The first big problem i encounter is when i try to connect the main connection, since within the array some sort of if () method has to be implemented (atleast i think so) that only allowes the user to place the main connection in a series.
The second thing i have no clue about is, how to use the Data from the ArrayLists for calculations. I know how to do a sum of an array list. However, in my programm i only need to sum up a certain value of an object from an arraylist if you know what i mean.
I would be pleased to get some help, since i havent found anything on the internet that uses values from objects in arraylists to do calculations.