Skip to content

Commit

Permalink
gitignore
Browse files Browse the repository at this point in the history
  • Loading branch information
AdrianBalunan committed Mar 3, 2026
2 parents d391df4 + 6929afa commit 3d26e35
Show file tree
Hide file tree
Showing 5 changed files with 73 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Adrian
.vscode/
.idea/
.target/
.target/
Binary file added docs/Use_Case/Organization.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/Use_Case/user_case_user.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package ntnu.sytemutvikling.team6.models;

import java.util.*;

public class CharityRegistry{
private final List<Charity> charities;

public CharityRegistry(){
this.charities = new ArrayList<>();
}

public List<Charity> getAllCharities(){
return Collections.unmodifiableList(charities);
}

public Optional<Charity> findCharityById(UUID charityId){
if(charityId == null){
throw new IllegalArgumentException("CharityId can not be null.");
}
return charities.stream()
.filter(charity -> charityId.equals(charity.getId()))
.findFirst();
}

public void addCharity(Charity charity){
if(charity == null){
throw new IllegalArgumentException("Charity can not be null.");
}
charities.add(charity);
}

public boolean removeCharity(UUID charityId){
if(charityId == null){
throw new IllegalArgumentException("CharityId can not be null.");
}
return charities.removeIf(charity -> charityId.equals(charity.getId()));
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,39 @@
package ntnu.sytemutvikling.team6.models;

import java.util.*;

public class DonationRegistry {
private final List<Donation> donations;

public DonationRegistry(){
this.donations = new ArrayList<>();
}

public List<Donation> getAllDonations(){
return Collections.unmodifiableList(donations);
}

public Optional<Donation> findDonationById(UUID donationId){
if(donationId == null){
throw new IllegalArgumentException("DonationId can not be null.");
}
return donations.stream()
.filter(donations -> donationId.equals(donations.getId()))
.findFirst();
}

public void addDonation(Donation donation){
if(donation == null){
throw new IllegalArgumentException("Donation can not be null.");
}
donations.add(donation);
}

public boolean removeDonation(UUID donationId){
if(donationId == null){
throw new IllegalArgumentException("DonationId can not be null.");
}
return donations.removeIf(donation -> donationId.equals(donation.getId));
}

}

0 comments on commit 3d26e35

Please sign in to comment.