-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #22 from einaskoi/einar/portfolio
add initial portfolio implementation
- Loading branch information
Showing
1 changed file
with
46 additions
and
0 deletions.
There are no files selected for viewing
46 changes: 46 additions & 0 deletions
46
src/main/java/edu/ntnu/idi/idatt2003/gruppe42/Model/Portfolio.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,50 @@ | ||
| package edu.ntnu.idi.idatt2003.gruppe42.Model; | ||
|
|
||
| import java.util.ArrayList; | ||
| import java.util.List; | ||
|
|
||
| /** | ||
| * Portfolio represents a collection of {@link Share} objects owned by a {@link Player}. | ||
| * The class includes methods for adding, removing and getting shares from the portfolio. | ||
| */ | ||
| public class Portfolio { | ||
| private List<Share> shares; | ||
|
|
||
| /** | ||
| * The constructor of the {@link Portfolio} class. | ||
| */ | ||
| public Portfolio() { | ||
| this.shares = new ArrayList<>(); | ||
| } | ||
|
|
||
| /** | ||
| * Method for adding a share to a portfolio. | ||
| * @param share represents the share to be added to the portfolio. | ||
| * @return true or false based on if the operation was successful or not. | ||
| */ | ||
| public boolean addShare(Share share) { | ||
| return true; | ||
| } | ||
|
|
||
| /** | ||
| * Method for removing a share to a portfolio. | ||
| * @param share represents the share to be removed from the portfolio. | ||
| * @return true or false based on if the operation was successful or not. | ||
| */ | ||
| public boolean removeShare(Share share) { | ||
| return false; | ||
| } | ||
|
|
||
| public List<Share> getShares() { | ||
| return this.shares; | ||
| } | ||
|
|
||
| /** | ||
| * Method for checking if a portfolio contains a given share. | ||
| * @param share represents the share to be checked. | ||
| * @return true or false based on if the share was found or not. | ||
| */ | ||
| public boolean contains(Share share) { | ||
| return true; | ||
| } | ||
| } |