Skip to content
This repository was archived by the owner on Apr 21, 2025. It is now read-only.

Commit 899a60e

Browse files
committed
fix: docstring spelling and unused variable
1 parent af329e7 commit 899a60e

File tree

8 files changed

+49
-46
lines changed

8 files changed

+49
-46
lines changed

src/hva/app/App.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
public class App {
77

88
public static void main(String[] args) {
9-
try (var ui = Dialog.UI) {
9+
final var ui = Dialog.UI;
10+
try (ui) {
1011
var manager = new hva.core.HotelManager();
1112
String datafile = System.getProperty("import");
1213
if (datafile != null) {

src/hva/app/vaccine/DoRegisterVaccine.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ protected final void execute() throws CommandException {
2525
var id = stringField("id");
2626
var name = stringField("name");
2727
var species = stringField("species");
28-
/* Split The Species string into an array of species ids
28+
/* Split the species string into an array of species ids
2929
ignoring leading and trailing spaces*/
3030
String[] speciesArray = species.split("\\s*,\\s*");
3131
try {

src/hva/core/Animal.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public class Animal extends NamedEntity {
2323
*
2424
* @param id the animal's unique identifier
2525
* @param name the animal's name
26-
* @param species The Species the animal belongs to
26+
* @param species the species the animal belongs to
2727
* @param habitat the habitat the animal is in
2828
*/
2929
Animal(String id, String name, Species species, Habitat habitat) {
@@ -41,9 +41,9 @@ the class Habitat holds.*/
4141
}
4242

4343
/**
44-
* Gets The Species the animal belongs to.
44+
* Gets the species the animal belongs to.
4545
*
46-
* @return The Species object the animal belongs to
46+
* @return the Species object the animal belongs to
4747
*/
4848
Species species() {
4949
return _species;
@@ -60,7 +60,7 @@ Habitat habitat() {
6060

6161
/**
6262
* Changes the animal to a different habitat.
63-
* If the animal already is in the destination habitat it doesnt
63+
* If the animal already is in the destination habitat it doesn't
6464
* change anything.
6565
*
6666
* @param newHabitat the new habitat to move the animal to

src/hva/core/CaseInsensitiveHashMap.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44
import java.util.HashMap;
55

66
/**
7-
* Custom HasMap override that trets all the ids strings as case insensitive
8-
* it doesnt distingues between lower and upper case, it makes all the ids
9-
* lower case before calling the super methods provided by the HashMap class.
7+
* Custom HashMap override that treats all the id strings as case insensitive
8+
* it does so by forcing all ids to be lowercase before calling the super
9+
* methods provided by the HashMap class.
1010
*/
1111
public class CaseInsensitiveHashMap<T extends NamedEntity>
1212
extends HashMap<String, T> {
@@ -15,23 +15,23 @@ public class CaseInsensitiveHashMap<T extends NamedEntity>
1515
private static final long serialVersionUID = 202410250009L;
1616

1717
/**
18-
* Puts the object in the map with the key in lower case.
18+
* Puts the object in the map given a key.
1919
*/
2020
@Override
2121
public T put(String key, T value) {
2222
return super.put(key.toLowerCase(), value);
2323
}
2424

2525
/**
26-
* Gets the object from the map with the key in lower case.
26+
* Gets the object from the map given a key.
2727
*/
2828
@Override
2929
public T get(Object key) {
3030
return super.get(((String)key).toLowerCase());
3131
}
3232

3333
/**
34-
* Checks if the map contains the key in lower case.
34+
* Checks if the map contains the key given a key.
3535
*/
3636
@Override
3737
public boolean containsKey(Object key) {
@@ -44,7 +44,7 @@ public T putIfAbsent(String key, T value) {
4444
}
4545

4646
/**
47-
* Removes the object from the map with the key in lower case.
47+
* Removes the object from the map given a key.
4848
*/
4949
@Override
5050
public T remove(Object key) {

src/hva/core/Habitat.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -195,18 +195,18 @@ Tree identifyTree(String id) {
195195
* Gets the influence of the habitat on a species.
196196
* Used to calculate an animal's satisfaction.
197197
*
198-
* @param species The Species to get the influence of the habitat on
198+
* @param species the species to get the influence of the habitat on
199199
* @return the influence of the habitat on the species
200200
*/
201201
Influence identifyInfluence(Species species) {
202-
// Returns NEU if The Species isn't in the map, indicating neutral influence.
202+
// Returns NEU if the species isn't in the map, indicating neutral influence.
203203
return _influences.getOrDefault(species, Influence.NEU);
204204
}
205205

206206
/**
207207
* Changes the influence value a habitat has on a given species.
208208
*
209-
* @param species The Species influenced (POS, NEG, NEU) by the habitat
209+
* @param species the species influenced (POS, NEG, NEU) by the habitat
210210
* @param newInfluence the new influence value the habitat has on the
211211
* species
212212
*/
@@ -305,7 +305,7 @@ Collection<Tree> listTrees() {
305305
/**
306306
* Counts the number of animals of a given species in a habitat.
307307
*
308-
* @param species The Species to count the number of animals of
308+
* @param species the species to count the number of animals of
309309
* @return the total number of animals of the given species in the habitat
310310
*/
311311
int getNumAnimalsSameSpecies(Species species) {

src/hva/core/HealthStatus.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,10 @@ public String toString() {
3939

4040
/**
4141
* Determines the health status of an animal based on the damage incurred
42-
* by the vaccine and wether The Species is correct.
42+
* by the vaccine and whether the species is correct.
4343
*
4444
* @param damage the damage suffered by the animal as the result of a vaccine
45-
* @param correctSpecies a boolean indicating whether The Species is correct
45+
* @param correctSpecies a boolean indicating whether the species is correct
4646
* @return the effect on an animal's health as a result of the vaccine
4747
* @throws InvalidDamageValueException if the damage is invalid
4848
* (if the damage is less than 0)

src/hva/core/Hotel.java

Lines changed: 27 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -200,9 +200,9 @@ public Animal identifyAnimal(String idAnimal)
200200
/**
201201
* Identifies a species by its id.
202202
*
203-
* @param idSpecies the id of The Species to identify
204-
* @return The Species object with the given id
205-
* @throws UnknownSpeciesIdException if The Species with the given id
203+
* @param idSpecies the id of the species to identify
204+
* @return the Species object with the given id
205+
* @throws UnknownSpeciesIdException if the species with the given id
206206
* is not found
207207
*/
208208
public Species identifySpecies(String idSpecies)
@@ -232,7 +232,7 @@ public Employee identifyEmployee(String idEmployee)
232232
*
233233
* @param idVet the id of the veterinarian to identify
234234
* @return the veterinarian object with the given id
235-
* @throws UnknownVeterinarianIdException
235+
* @throws UnknownEmployeeIdException
236236
* if the veterinarian with the given id is not found
237237
*/
238238
public Veterinarian identifyVet(String idVet)
@@ -286,7 +286,7 @@ public Habitat registerHabitat(String id, String name, int area)
286286
* @throws UnknownHabitatIdException if the habitat with the given id
287287
* is not found
288288
* @throws DuplicateAnimalIdException if the id is already used
289-
* @throws UnknownSpeciesIdException if The Species with the given id
289+
* @throws UnknownSpeciesIdException if the species with the given id
290290
* is not found
291291
*/
292292
public void registerAnimal(String idAnimal, String name, String idSpecies,
@@ -309,7 +309,7 @@ private boolean animalAlreadyExists(String idAnimal) {
309309
* Checks if a species already exists in the hotel.
310310
*
311311
* @param idSpecies the species' id to check
312-
* @return true if The Species already exists, false otherwise
312+
* @return true if the species already exists, false otherwise
313313
*/
314314
public boolean speciesAlreadyExists(String idSpecies) {
315315
return _species.containsKey(idSpecies);
@@ -329,7 +329,7 @@ public void registerSpecies(String id, String name)
329329
throw new DuplicateSpeciesIdException(id);
330330
if (_speciesByName.containsKey(name))
331331
throw new DuplicateSpeciesNameException(name);
332-
// Only adds The Species if both the id and the name are unique
332+
// Only adds the species if both the id and the name are unique
333333
Species newSpecies = new Species(id, name);
334334
_species.put(id, newSpecies);
335335
_speciesByName.put(name, newSpecies);
@@ -372,7 +372,7 @@ public void registerEmployee(String id, String name, String type)
372372
* @param idVaccine the vaccine's unique identifier
373373
* @param name the vaccine's name
374374
* @param speciesIds the species' ids that the vaccine is suitable for
375-
* @throws UnknownSpeciesIdException if The Species with the given id
375+
* @throws UnknownSpeciesIdException if the species with the given id
376376
* is not found
377377
* @throws DuplicateVaccineIdException if a vaccine with the same id
378378
* already exists
@@ -404,7 +404,7 @@ public boolean addVaccinationRecord(String idVaccine, String idVet,
404404
Animal animal = identifyAnimal(idAnimal);
405405
_vaccinationRecords.add(vet.vaccinate(identifyVaccine(idVaccine), animal));
406406
notifyHotelObservers();
407-
return vaccine.isSpeciesApropriated(animal.species());
407+
return vaccine.isSpeciesAppropriate(animal.species());
408408
}
409409

410410
/**
@@ -427,29 +427,31 @@ public String idSpeciesAnimal(String idAnimal) {
427427
* Adds a responsibility to an employee.
428428
*
429429
* @param idEmployee the employee's unique identifier
430-
* @param idReponsibility the responsibility's unique identifier
431-
* @throws UnknownIdException if the employee with the given id is not found
430+
* @param idResponsibility the responsibility's unique identifier
431+
* @throws UnknownEmployeeIdException if the employee with the given id is
432+
* not found
432433
* @throws UnknownResponsibilityException if responsibility with the given id
433434
* is not found
434435
*/
435-
public void addResponsibility(String idEmployee, String idReponsibility)
436+
public void addResponsibility(String idEmployee, String idResponsibility)
436437
throws UnknownEmployeeIdException, UnknownResponsibilityIdException {
437-
identifyEmployee(idEmployee).addResponsibility(idReponsibility);
438+
identifyEmployee(idEmployee).addResponsibility(idResponsibility);
438439
notifyHotelObservers();
439440
}
440441

441442
/**
442443
* Removes a responsibility of an employee.
443444
*
444445
* @param idEmployee the employee's unique identifier
445-
* @param idReponsibility the responsibility's unique identifier
446+
* @param idResponsibility the responsibility's unique identifier
446447
* @throws UnknownIdException if the employee with the given id is not found
447448
* @throws UnknownResponsibilityException if responsibility with the given id
448449
* is not found
449450
*/
450-
public void removeResponsibility(String idEmployee, String idReponsibility)
451-
throws EmployeeNotResponsibleException, UnknownEmployeeIdException, UnknownResponsibilityIdException {
452-
identifyEmployee(idEmployee).removeResponsibility(idReponsibility);
451+
public void removeResponsibility(String idEmployee, String idResponsibility)
452+
throws EmployeeNotResponsibleException, UnknownEmployeeIdException,
453+
UnknownResponsibilityIdException {
454+
identifyEmployee(idEmployee).removeResponsibility(idResponsibility);
453455
notifyHotelObservers();
454456
}
455457

@@ -494,11 +496,11 @@ public void changeHabitatArea(String id, int area)
494496
* Change the influence that a habitat has over a species
495497
*
496498
* @param idHabitat the habitat to add the influence
497-
* @param idSpecies The Species it will affected
499+
* @param idSpecies the species it will affected
498500
* @param influence the new influence the habitat will have over the
499501
* species in question
500-
* @throws UnknownHabitatIdException if the habitat doesnt exist in the hotel
501-
* @throws UnknownSpeciesIdException if The Species doesnt exist
502+
* @throws UnknownHabitatIdException if the habitat doesn't exist in the hotel
503+
* @throws UnknownSpeciesIdException if the species doesn't exist
502504
*/
503505
public void changeHabitatInfluence(String idHabitat, String idSpecies,
504506
String influence) throws UnknownHabitatIdException,
@@ -513,7 +515,7 @@ public void changeHabitatInfluence(String idHabitat, String idSpecies,
513515
*
514516
* @param idAnimal the animal to transfer to another habitat
515517
* @param idHabitat the destination habitat
516-
* @throws UnknownAnimalIdException if the animal doesnt exist in any of
518+
* @throws UnknownAnimalIdException if the animal doesn't exist in any of
517519
* the habitats in the hotel
518520
* @throws UnknownHabitatIdException if the destination habitat doesnt exist
519521
* in the hotel
@@ -577,7 +579,7 @@ public Collection<Tree> listAllTreesHabitat(String idHabitat)
577579
*
578580
* @param idHabitat the habitat to list all animals from
579581
* @return an unmodifiableCollection of all animals from the habitat
580-
* @throws UnknownHabitatIdException if the habitat doesnt exist in this
582+
* @throws UnknownHabitatIdException if the habitat doesn't exist in this
581583
* hotel
582584
*/
583585
public Collection<Animal> listAnimalsInHabitat(String idHabitat)
@@ -610,8 +612,8 @@ public Collection<VaccinationRecord> listVaccinationRecords() {
610612
* Lists all vaccination records of vaccines given to a given
611613
* animal in a string containing information about each record.
612614
*
613-
* @param animal the animal to list the vaccination records of
614-
* @return an unmodifiable List containing the VaccinationRecord objects
615+
* @param id the id of the animal to list the vaccination records of
616+
* @return an unmodifiable List containing the VaccinationRecord objects
615617
* of a specific animal
616618
*/
617619
public Collection<VaccinationRecord> listAnimalVaccinationHistory(String id)
@@ -626,7 +628,7 @@ public Collection<VaccinationRecord> listAnimalVaccinationHistory(String id)
626628
* Lists all vaccination records of vaccines administered by a given vet
627629
* in a string containing information about each record.
628630
*
629-
* @param vet the veterinarian to list the vaccination records of
631+
* @param id the id of the veterinarian to list the vaccination records of
630632
* @return an unmodifiable List containing the VaccinationRecord object
631633
* of all vaccination records of vaccines administered by the given vet
632634
*/

src/hva/core/Vaccine.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class Vaccine extends NamedEntity {
2222
*
2323
* @param id the vaccine's unique identifier
2424
* @param name the vaccine's name
25-
* @param appropiateSpecies a list of The Species the vaccine is suitable for
25+
* @param appropiateSpecies a list of the species the vaccine is suitable for
2626
*/
2727
Vaccine(String id, String name, List<Species> appropiateSpecies) {
2828
super(id, name);
@@ -36,7 +36,7 @@ int numApplications() {
3636
return _numApplications;
3737
}
3838

39-
boolean isSpeciesApropriated(Species species) {
39+
boolean isSpeciesAppropriate(Species species) {
4040
return _appropiateSpecies.contains(species);
4141
}
4242

0 commit comments

Comments
 (0)