Last active
April 21, 2020 19:13
-
-
Save lucas1295santos/b8e84123902036dd0f3fe71ac50b7326 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package dominio; | |
public class Compartimento<T extends Number & Comparable<Number>> { | |
private final T capacidadeTotal; | |
private final T qntAtual; | |
Compartimento(T capacidadeTotal, T qntAtual) { | |
this.capacidadeTotal = capacidadeTotal; | |
this.qntAtual = qntAtual; | |
} | |
T getCapacidadeTotal() { | |
return capacidadeTotal; | |
} | |
T getQntAtual() { | |
return qntAtual; | |
} | |
protected void setQntAtual(T qntAtual) { | |
if (qntAtual <= capacidadeTotal && qntAtual >= 0) { | |
this.qntAtual = qntAtual; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment