public class ProfileManager
extends java.lang.Object
Constructor and Description |
---|
ProfileManager(int maxProfiles)
Creates a profile manager, specifying the maximum amount of profiles the user can hold.
|
Modifier and Type | Method and Description |
---|---|
void |
deleteAllProfiles()
Deletes all profiles from the hard drive, if they exist.
|
void |
deleteProfile(int profileId)
Deletes a profile with the given ID from the hard drive.
|
Profile |
getCurrentProfile()
Returns the current profile being used by the user.
|
int |
getMaxProfiles()
Gets the maximum amount of profiles the user can have.
|
Profile |
getProfile(int profileId)
Gets the profile with the given id, ranging from 0 to MAX_PROFILES-1.
|
Profile |
getProfile(int profileId,
boolean createNew)
Gets the profile with the given id, ranging from 0 to MAX_PROFILES-1.
|
void |
loadProfiles()
Loads the profiles existing in the hard drive and populates the profiles:Profile[] array.
|
void |
saveCurrentProfile()
Saves the current profile to the hard drive as a JSON file.
|
void |
saveProfile(Profile profile)
Saves the profile to the hard drive.
|
public ProfileManager(int maxProfiles)
public void loadProfiles()
public Profile getCurrentProfile()
public Profile getProfile(int profileId)
public Profile getProfile(int profileId, boolean createNew)
profileId
- The id of the profile, ranging from 0 to ProfileManager.MAX_PROFILES-1.createNew
- If true, a new profile will be created if it doesn't exist on the hard drive.public void saveProfile(Profile profile)
public void saveCurrentProfile()
public void deleteProfile(int profileId)
public void deleteAllProfiles()
public int getMaxProfiles()