Skip to content
Snippets Groups Projects
User.java 1.98 KiB
Newer Older
package project;

import java.util.ArrayList;

import exceptions.UsernameEmailEmptyException;

public class User {

	static int idCounter;
	public static ArrayList<User> users = new ArrayList<User>();
	private ArrayList<Item> myItem = new ArrayList<Item>();
	private int id;
	private String username, email, password;
	public User() {

		this.id = idCounter++;
		users.add(this);

	public static User getInstance() {

		User u = new User();
		return u;
/*
	public static boolean login(String username, String email, String password) {
		if (username.equals("") && email.equals("")) {
			throw new UsernameEmailEmptyException();
		} else {

			if (password.equals("")) {

				System.err.println("Error: you should provide an username or a password");

			} else if (username.equals("")) {

				if (email.matches("\\S+@\\S+\\.\\w+")) {

				} else {

					System.err.println("Error: email not in the right format");

				}

			} else {

			}
	public ArrayList<Auction> retrieveSubscribedAuction() {
		// TODO Auto-generated method stub
		return null;
	}

	public boolean becomeSeller(String ssn) {
		// TODO Auto-generated method stub
		return false;
	}

	public boolean searchItem(String title, Category category) {
		// TODO Auto-generated method stub
		return false;
	}

	public boolean searchAuction(String startTime, String endTime, double price, double bidIncrement, String title,
			Category category) {
		// TODO Auto-generated method stub
		return false;
	}

	public boolean addItem(int itemId) {
		if (myItem.contains(Item.getItem(itemId))) {

			return myItem.add(Item.getItem(itemId));

		}

		return false;

	}

	public void setId(int i) {

		this.id = i;

	}

	public int getId() {
		// TODO Auto-generated method stub
		return id;
	}

	public void setUsername(String usernameInput) {

		this.username = usernameInput;
	}

	public void setEmail(String emailInput) {

		this.email = emailInput;

	}

	public void setPassword(String passwordInput) {

		this.password = passwordInput;
	}