Skip to content
Snippets Groups Projects
Commit 2cbe2849 authored by Lilith Camplin's avatar Lilith Camplin :speech_balloon:
Browse files

DOCUMENTATION (I lost my mind)

parent c33f3cc7
No related branches found
No related tags found
No related merge requests found
Pipeline #23453 passed
......@@ -9,7 +9,8 @@ public class Dice {
/**
* The Number sides.
*/
int numberSides, /**
int numberSides,
/**
* The Value.
*/
value;
......
......@@ -11,7 +11,8 @@ public class DicePlayer {
/**
* The Total value.
*/
int totalValue, /**
int totalValue,
/**
* The Nb dice rolls.
*/
nbDiceRolls;
......
......@@ -8,7 +8,8 @@ public class TwoDicePlayerGame {
/**
* The Player 1.
*/
DicePlayer player1, /**
DicePlayer player1,
/**
* The Player 2.
*/
player2;
......
......@@ -3,7 +3,7 @@ package tp.tp05;
import java.util.ArrayList;
/**
* A class called Library used to store {@link Book}
* The type Library.
*/
public class Library {
private ArrayList<Book> catalog;
......@@ -16,9 +16,9 @@ public class Library {
}
/**
* Returns the Book based on the code in catalog.
* Gets book.
*
* @param code String
* @param code the code
* @return the book
*/
public Book getBook(String code) {
......@@ -33,23 +33,19 @@ public class Library {
}
/**
* Appends the specified Book to the end of the catalog.
* Add book boolean.
*
* @param book {@link Book}
* @return true if the method succeeded and false otherwise
* @param book the book
* @return the boolean
*/
public boolean addBook (Book book) {
return this.catalog.add(book);
}
/**
* Removes the first occurrence of the Book based on his code from
* the catalog, if it is present. If the catalog does not contain
* the Book with the code, it is unchanged. Returns true if this
* catalog contained the Book (or equivalently, if
* the catalog changed as a result of the call).
* Remove book boolean.
*
* @param code String
* @param code the code
* @return the boolean
*/
public boolean removeBook (String code) {
......@@ -57,38 +53,24 @@ public class Library {
}
/**
* Removes the first occurrence of the Book from the catalog, if
* it is present. If the catalog does not contain the Book with
* the code, it is unchanged. Returns true if this catalog
* contained the Book (or equivalently, ifthe catalog changed as
* a result of the call).
* Remove book boolean.
*
* @param book {@link Book}
* @param book the book
* @return the boolean
*/
public boolean removeBook (Book book) {
return this.catalog.remove(book);
}
/**
* Returns a string representation of the catalog. The string
* representation consists of a list of the collection's elements in the
* order they are returned by its iterator, enclosed in square brackets
* ({@code "[]"}). Adjacent elements are separated by the characters
* {@code ", "} (comma and space). Books are converted to strings as
* by {@link Book#toString()}.
*
* @return a string representation of the catalog
*/
@Override
public String toString() {
return catalog.toString();
}
/**
* Returns a string representation of the Books that are borrowed
* Borrowings string.
*
* @return The Books that are currently borrowed
* @return the string
*/
public String borrowings () {
String res = "";
......@@ -99,32 +81,30 @@ public class Library {
}
/**
* Makes a Book in the catalog borrowed by changing a value in
* the instance of a Book specified by its code
* Borrow boolean.
*
* @param code String
* @param borrower int
* @return true if the method succeeded and false otherwise
* @param code the code
* @param borrower the borrower
* @return the boolean
*/
public boolean borrow (String code, int borrower) {
return this.getBook(code).borrow(borrower);
}
/**
* Makes a Book in the catalog given back by resetting a value in
* the instance to default of a Book specified by its code
* Give back boolean.
*
* @param code String
* @return true if the method succeeded and false otherwise
* @param code the code
* @return the boolean
*/
public boolean giveBack (String code) {
return this.getBook(code).giveBack();
}
/**
* Returns the number size of the catalog while ignoring indexes
* Stock size int.
*
* @return The number of Books in catalog in case there are indexes that are null
* @return the int
*/
public int stockSize () {
int size = 0;
......@@ -135,10 +115,9 @@ public class Library {
}
/**
* Counts the number of books that are borrowed with the method
* {@link Book#isAvailable()}
* Borrowed book number int.
*
* @return The number of books that are borrowed
* @return the int
*/
public int borrowedBookNumber () {
int size = 0;
......
......@@ -3,10 +3,7 @@ package tp.tpQU_2;
import java.util.Objects;
/**
* A warrior card characterized by :
* A name of the individual represented on the card,
* a positive integer representing its strength,
* a positive integer representing its agility.
* The type Warrior card.
*/
public class WarriorCard {
private String name;
......@@ -14,11 +11,11 @@ public class WarriorCard {
private int agility;
/**
* Create an instance of WarriorCard
* Instantiates a new Warrior card.
*
* @param name A String representing its name
* @param s An int representing its strength
* @param ag An int representing its agility
* @param name the name
* @param s the s
* @param ag the ag
*/
public WarriorCard (String name, int s, int ag) {
this.name = name;
......@@ -26,12 +23,6 @@ public class WarriorCard {
this.agility = ag;
}
/**
* Determines if the WarriorCard placed in parameter is equivalent to the current one
* only based on the name represented on the card
* @param obj An Object which can be anything but preferably a WarriorCard
* @return true or false if the name of both WarriorCard are equals
*/
@Override
public boolean equals(Object obj) {
if (this == obj) return true;
......@@ -41,25 +32,21 @@ public class WarriorCard {
}
/**
* Compare the strength of two WarriorCard
* Compare strength int.
*
* @param other Another WarriorCard
* @return 0 if both warriors have equal strength, &#60; 0 if the strength of the current warrior is inferior to the one in parameter, &#62; 0 if the strength of the current warrior is superior the one in parameter.
* @param other the other
* @return the int
*/
public int compareStrength (WarriorCard other) {return this.strength - other.strength;}
/**
* Compare agility int.
*
* @param other Another WarriorCard
* @return 0 if both warriors have equal agility, &#60; 0 if the agility of the current warrior is inferior to the one in parameter, &#62; 0 if the agility of the current warrior is superior the one in parameter.
* @param other the other
* @return the int
*/
public int compareAgility (WarriorCard other) {return this.agility - other.agility;}
/**
* A method to have a String representing WarriorCard
* @return The textual representation of a WarriorCard in the following format : &#60;name&#62;[S=&#60;strength&#62;,A=&#60;agility&#62;].
*/
@Override
public String toString() {return this.name + "[S=" + this.strength + ",A=" + this.agility + "]";}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment