Skip to content
This repository has been archived by the owner on Aug 9, 2024. It is now read-only.

Commit

Permalink
Tidy up blank spaces
Browse files Browse the repository at this point in the history
  • Loading branch information
Laifsyn committed Jun 13, 2024
1 parent e9da856 commit c97f84e
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 10 deletions.
5 changes: 4 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
{
"java.format.settings.url": "eclipse-formatter.xml",
"java.checkstyle.configuration": "${workspaceFolder}\\checkstyle.xml"
"editor.tokenColorCustomizations": {
"comments": "",
"textMateRules": []
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,26 +7,24 @@ public ColaCircular(int capacidad) {

@Override
public Result insertar(T elemento) {
if (this.isFull()) {
if (this.isFull())
return new Result.ColaLlena();
}

this.inner[cola] = elemento;
// `(9 + 1) % 10 => 0`

this.cola = (cola + 1) % capacidad;
this.longitud++;
return new Result.OK();
}

@Override
public Option<T> quitar() {
if (this.isEmpty()) {
if (this.isEmpty())
return new Option.None<>();
}

T elemento = this.inner[frente];
inner[frente] = null;

// `(9 + 1) % 10 => 0`
frente = (frente + 1) % capacidad;
longitud--;
return new Option.Some<>(elemento);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ public class ColaSimple<T> extends AbstractCola<T> {
* puede insertar o quitar son <b>`ColaSimple.capacidad`</b> elementos
* </p>
*
* @param capacidad int
* @param capacidad
* int
*/
public ColaSimple(int capacidad) {
super(capacidad);
Expand All @@ -30,6 +31,7 @@ public Result insertar(T elemento) {
return new Result.ColaLlena();

this.inner[cola] = elemento;

this.cola = (cola + 1) % capacidad;
this.longitud++;
return new Result.OK();
Expand All @@ -40,9 +42,9 @@ public Result insertar(T elemento) {
*/
@Override
public Option<T> quitar() {
if (this.isEmpty()) {
if (this.isEmpty())
return new Option.None<>();
}

T elemento = this.inner[frente];
frente = (frente + 1) % capacidad;
if (frente == cola)
Expand Down

0 comments on commit c97f84e

Please sign in to comment.