Formatted all files to the same standard

This commit is contained in:
matthew
2014-10-08 13:42:12 +01:00
parent 53a2a8b150
commit 3da9ad5469
151 changed files with 952 additions and 870 deletions

View File

@@ -3,20 +3,20 @@ package com.iluwatar;
/**
*
* Star uses "mementos" to store and restore state.
*
*
*/
public class Star {
private StarType type;
private int ageYears;
private int massTons;
public Star(StarType startType, int startAge, int startMass) {
this.type = startType;
this.ageYears = startAge;
this.massTons = startMass;
}
public void timePasses() {
ageYears *= 2;
massTons *= 8;
@@ -41,7 +41,7 @@ public class Star {
break;
}
}
StarMemento getMemento() {
StarMementoInternal state = new StarMementoInternal();
@@ -49,20 +49,21 @@ public class Star {
state.setMassTons(massTons);
state.setType(type);
return state;
}
void setMemento(StarMemento memento) {
StarMementoInternal state = (StarMementoInternal) memento;
this.type = state.getType();
this.ageYears = state.getAgeYears();
this.massTons = state.getMassTons();
}
@Override
public String toString() {
return String.format("%s age: %d years mass: %d tons", type.toString(), ageYears, massTons);
return String.format("%s age: %d years mass: %d tons", type.toString(),
ageYears, massTons);
}
}