Skip to content

Commit

Permalink
Fix: Package Placement
Browse files Browse the repository at this point in the history
  • Loading branch information
AdrianBalunan committed Mar 5, 2026
1 parent e2161b7 commit 40c5bed
Show file tree
Hide file tree
Showing 13 changed files with 176 additions and 213 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package ntnu.sytemutvikling.team6;

public class Main {
public static void main(String[] args) {
System.out.println("Hello world!");
}
}
public static void main(String[] args) {
System.out.println("Hello world!");
}
}
Original file line number Diff line number Diff line change
@@ -1,81 +1,74 @@
package ntnu.sytemutvikling.team6.models;

import ntnu.sytemutvikling.team6.models.user.User;

import java.time.LocalDateTime;
import java.util.UUID;
import ntnu.sytemutvikling.team6.models.user.User;

public class Donation {
/* UUID for uniquely identifying each donation */
private UUID charityId;

/* Ammount of money donated */
private double amount;

/* Date and time of the donation */
private LocalDateTime date;

/* The charity that received the donation */
private Charity charity;

/* The user/donor that made the donation */
private User donor;

/**
* Is the donation made anonymously?
* This can be null if the donation was made anonymously.
*
*/
private boolean isAnonymous;

/**
* Constructor for creating a new donation.
* The charityId is generated automatically using UUID.
* If the donation is made anonymously, the isAnonymous parameter is set to true.
* @param amount
* @param date
* @param charity
* @param donor
*/
public Donation(double amount, LocalDateTime date, Charity charity, User donor) {
this.charityId = UUID.randomUUID();
this.amount = amount;
this.date = date;
this.charity = charity;
this.donor = donor;


// ASSUMES that this is the way to get the anonymous setting from the user's settings.
if (donor.getSettings().isAnonymous() == false) {
this.isAnonymous = true;
} else {
this.isAnonymous = false;

}
/* UUID for uniquely identifying each donation */
private UUID charityId;

/* Ammount of money donated */
private double amount;

/* Date and time of the donation */
private LocalDateTime date;

/* The charity that received the donation */
private Charity charity;

/* The user/donor that made the donation */
private User donor;

/** Is the donation made anonymously? This can be null if the donation was made anonymously. */
private boolean isAnonymous;

/**
* Constructor for creating a new donation. The charityId is generated automatically using UUID.
* If the donation is made anonymously, the isAnonymous parameter is set to true.
*
* @param amount
* @param date
* @param charity
* @param donor
*/
public Donation(double amount, LocalDateTime date, Charity charity, User donor) {
this.charityId = UUID.randomUUID();
this.amount = amount;
this.date = date;
this.charity = charity;
this.donor = donor;

// ASSUMES that this is the way to get the anonymous setting from the user's settings.
if (donor.getSettings().isAnonymous() == false) {
this.isAnonymous = true;
} else {
this.isAnonymous = false;
}
}

/* Getters for the donation's attributes */
public boolean isAnonymous() {
return isAnonymous;
}
/* Getters for the donation's attributes */
public boolean isAnonymous() {
return isAnonymous;
}

public UUID getCharityId() {
return charityId;
}
public UUID getCharityId() {
return charityId;
}

public double getAmount() {
return amount;
}
public double getAmount() {
return amount;
}

public LocalDateTime getDate() {
return date;
}
public LocalDateTime getDate() {
return date;
}

public Charity getCharity() {
return charity;
}
public Charity getCharity() {
return charity;
}

public User getDonor() {
return donor;
}
public User getDonor() {
return donor;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,37 +3,36 @@
import java.util.*;

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

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

public List<Donation> getAllDonations(){
return Collections.unmodifiableList(donations);
}
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()
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.getCharityId()))
.findFirst();
}
}

public void addDonation(Donation donation){
if(donation == null){
throw new IllegalArgumentException("Donation can not be null.");
}
donations.add(donation);
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.getCharityId()));
public boolean removeDonation(UUID donationId) {
if (donationId == null) {
throw new IllegalArgumentException("DonationId can not be null.");
}

return donations.removeIf(donation -> donationId.equals(donation.getCharityId()));
}
}
Original file line number Diff line number Diff line change
@@ -1,62 +1,62 @@
package ntnu.sytemutvikling.team6.models;

import ntnu.sytemutvikling.team6.models.user.User;

import java.time.LocalDateTime;
import java.util.UUID;
import ntnu.sytemutvikling.team6.models.user.User;

public class Feedback {
/* Feedback id */
private UUID feedbackId;

/**
* The author of the feedback
* If annonymous the presentation of the user will be "Anonymous".
*/
private User user;

/* The details of the feedback*/
private String comment;

/* The date and time when the feedback was given */
private LocalDateTime date;

/* Is the feedback given anonymously? */
private boolean isAnonymous;

/**
* Constructor for creating a new feedback.
*
* @param user The user who gives the feedback.
* @param comment The content of the feedback.
*/
public Feedback(User user, String comment) {
this.feedbackId = UUID.randomUUID();
this.user = user;
this.comment = comment;
this.date = LocalDateTime.now();

this.isAnonymous = user.getSettings().isAnonymous();
}

/**
* Getters for the feedback's attributes.
*
* @return The feedback's attributes.
*/
public UUID getFeedbackId() {
return feedbackId;
}
public String getComment() {
return comment;
}
public LocalDateTime getDate() {
return date;
}
public User getUser() {
return user;
}
public boolean isAnonymous() {
return isAnonymous;
}
/* Feedback id */
private UUID feedbackId;

/** The author of the feedback If annonymous the presentation of the user will be "Anonymous". */
private User user;

/* The details of the feedback*/
private String comment;

/* The date and time when the feedback was given */
private LocalDateTime date;

/* Is the feedback given anonymously? */
private boolean isAnonymous;

/**
* Constructor for creating a new feedback.
*
* @param user The user who gives the feedback.
* @param comment The content of the feedback.
*/
public Feedback(User user, String comment) {
this.feedbackId = UUID.randomUUID();
this.user = user;
this.comment = comment;
this.date = LocalDateTime.now();

this.isAnonymous = user.getSettings().isAnonymous();
}

/**
* Getters for the feedback's attributes.
*
* @return The feedback's attributes.
*/
public UUID getFeedbackId() {
return feedbackId;
}

public String getComment() {
return comment;
}

public LocalDateTime getDate() {
return date;
}

public User getUser() {
return user;
}

public boolean isAnonymous() {
return isAnonymous;
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
package ntnu.sytemutvikling.team6.models;

public class UserRegistry {


}
public class UserRegistry {}
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,15 @@
// Enhetstester mangler

/**
* Represents a user's inbox that contains messages.
* Provides methods to add, remove and get messages.
* Represents a user's inbox that contains messages. Provides methods to add, remove and get
* messages.
*
* @author Robin Strand Prestmo
* @author Robin Strand Prestmo
*/
public class Inbox {
private final List<Message> messages;

/**
* Creates an empty inbox with no messages.
*/
/** Creates an empty inbox with no messages. */
public Inbox() {
this.messages = new ArrayList<>();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@
*/
public enum Language {
ENGLISH
}
}
Loading

0 comments on commit 40c5bed

Please sign in to comment.