Skip to content

Commit

Permalink
Update data object models; clean up team report generation code
Browse files Browse the repository at this point in the history
  • Loading branch information
spencerng committed Feb 15, 2019
1 parent ef9e8b2 commit 9cadd7e
Show file tree
Hide file tree
Showing 9 changed files with 220 additions and 156 deletions.
17 changes: 17 additions & 0 deletions .idea/artifacts/release.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions .idea/libraries/TBA_APIv3_Java_Library.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,9 @@ public void fixInaccuraciesTBA() {
"Climbing");
}

if (actualAutoRun != entry.getAutonomous().isReachHabLine()) {
if (actualAutoRun != entry.getAutonomous().isCrossHabLine()) {
inaccuracies += "auto run, ";
entry.getAutonomous().setReachHabLine(actualAutoRun);
entry.getAutonomous().setCrossHabLine(actualAutoRun);
}


Expand Down
55 changes: 29 additions & 26 deletions src/main/java/org/usfirst/frc/team25/scouting/data/TeamReport.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
import java.util.HashMap;

import static org.usfirst.frc.team25.scouting.data.Statistics.average;
import static org.usfirst.frc.team25.scouting.data.Statistics.sum;

/**
* Object model containing individual reports of teams in events and methods to process data
Expand All @@ -22,11 +21,13 @@ public class TeamReport {

private final transient ArrayList<ScoutEntry> entries;
private final int teamNum;
private String teamName = "", frequentRobotCommentStr, allComments;
private String teamName, frequentRobotCommentStr, allComments;

public TeamReport(int teamNum) {
this.teamNum = teamNum;
entries = new ArrayList<>();
teamName = "";
frequentRobotCommentStr = "";

}

Expand All @@ -43,42 +44,43 @@ public String getQuickStatus() {
statusString += " - " + getTeamName();
}

statusString += "\n\nAutonomous:\n";
statusString += "\n\nSandstorm:";


ArrayList<Object> autoList = SortersFilters.filterDataObject(entries, Autonomous.class);

statusString += "\nAvg. cargo ship cargo: " + Statistics.round(average(autoList, "cargoShipCargo"), 2);
statusString += "\nAvg. cargo ship hatches: " + Statistics.round(average(autoList, "cargoShipHatches"), 2);
statusString += "\nAvg. rocket cargo: " + Statistics.round(average(autoList, "rocketCargo"), 2);
statusString += "\nAvg. rocket hatches: " + Statistics.round(average(autoList, "rocketHatches"),2);
statusString += "\nAvg. cargo dropped: " + Statistics.round(average(autoList, "cargoDropped"), 2);
statusString += "\nAvg. hatches dropped: " + Statistics.round(average(autoList, "hatchesDropped"), 2);

statusString += "\n\nTele-Op:\n";
String[] autoMetricNames = new String[]{"cargoShipHatches", "rocketHatches", "cargoShipCargo", "rocketCargo",
"hatchesDropped", "cargoDropped"};

for (String metric : autoMetricNames) {
statusString += "\nAvg. " + StringProcessing.convertCamelToSentenceCase(metric) + ": " + Statistics.round(average(autoList, metric), 2);
}


statusString += "\n\nTele-Op:";

ArrayList<Object> teleList = SortersFilters.filterDataObject(entries, TeleOp.class);

statusString += "\nAvg. cargo ship cargo: " + Statistics.round(average(teleList, "cargoShipCargo"),2);
statusString += "\nAvg. cargo ship hatches: " + Statistics.round(average(teleList, "cargoShipHatches"),2);
statusString += "\nAvg. rocket level 1 cargo: " + Statistics.round(average(teleList, "rocketLevelOneCargo"),2);
statusString += "\nAvg. rocket level 2 cargo: " + Statistics.round(average(teleList, "rocketLevelTwoCargo"),2);
statusString += "\nAvg. rocket level 3 cargo: " + Statistics.round(average(teleList, "rocketLevelThreeCargo"),2);
statusString += "\nAvg. rocket level 1 hatches: " + Statistics.round(average(teleList, "rocketLevelOneHatches"),2);
statusString += "\nAvg. rocket level 2 hatches: " + Statistics.round(average(teleList, "rocketLevelTwoHatches"),2);
statusString += "\nAvg. rocket level 3 hatches: " + Statistics.round(average(teleList, "rocketLevelThreeHatches"),2);
statusString += "\nAvg. cargo dropped: " + Statistics.round(average(teleList, "cargoDropped"),2);
statusString += "\nAvg. hatches dropped: " + Statistics.round(average(teleList, "hatchesDropped"),2);

statusString += "\n\nEndgame:\n";

ArrayList<Object> postList = SortersFilters.filterDataObject(entries,PostMatch.class);
String[] teleMetricNames = new String[]{"cargoShipHatches", "rocketLevelOneHatches", "rocketLevelTwoHatches",
"rocketLevelThreeHatches", "cargoShipCargo", "rocketLevelOneCargo", "rocketLevelTwoCargo",
"rocketLevelThreeCargo", "hatchesDropped", "cargoDropped"};


for (String metric : teleMetricNames) {
statusString += "\nAvg. " + StringProcessing.convertCamelToSentenceCase(metric) + ": " + Statistics.round(average(teleList, metric), 2);
}


statusString += "\n\nEndgame:\n";

statusString += "\n Avg. total points: ";
ArrayList<Object> postList = SortersFilters.filterDataObject(entries, PostMatch.class);

statusString += "\n\nOverall:\n";
statusString += "\n\nOverall:";
statusString += "\nAvg. calculated total point contribution: ";

statusString += "\n Common Quick Comments: " + "\n" + frequentRobotCommentStr;
statusString += "\n\nCommon quick comments:\n" + frequentRobotCommentStr;


return statusString;
Expand Down Expand Up @@ -130,6 +132,7 @@ public void findFrequentComments() {
}

for (String comment : frequentRobotComment) {
System.out.println(comment);
frequentRobotCommentStr += StringProcessing.removeCommasBreaks(comment) + " \n";
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,32 @@
*/
public class Autonomous {

private int rocketCargo;
private int rocketHatches;

private boolean crossHabLine;

private int cargoShipHatches;
private int rocketHatches;

private int cargoShipCargo;
private int rocketCargo;

private boolean frontCargoShipHatchCapable;
private boolean sideCargoShipHatchCapable;

private int hatchesDropped;
private int cargoDropped;
private boolean reachHabLine;
private boolean opponentCargoShipLineFoul;
private boolean sideCargoShipHatchCapable;
private boolean frontCargoShipHatchCapable;

private boolean hatchesDroppedCargoShip;
private boolean hatchesDroppedRocket;
private boolean cargoDroppedCargoShip;
private boolean cargoDroppedRocket;
private boolean hatchesDroppedRocket;
private boolean hatchesDroppedCargoShip;

private boolean opponentCargoShipLineFoul;


public Autonomous(int rocketCargo, int rocketHatches, int cargoShipHatches,
int cargoShipCargo, int hatchesDropped, int cargoDropped,
boolean reachHabLine, boolean opponentCargoShipLineFoul,
boolean crossHabLine, boolean opponentCargoShipLineFoul,
boolean sideCargoShipHatchCapable, boolean frontCargoShipHatchCapable,
boolean cargoDroppedCargoShip, boolean cargoDroppedRocket,
boolean hatchesDroppedRocket, boolean hatchesDroppedCargoShip) {
Expand All @@ -33,7 +41,7 @@ public Autonomous(int rocketCargo, int rocketHatches, int cargoShipHatches,
this.cargoShipCargo = cargoShipCargo;
this.hatchesDropped = hatchesDropped;
this.cargoDropped = cargoDropped;
this.reachHabLine = reachHabLine;
this.crossHabLine = crossHabLine;
this.opponentCargoShipLineFoul = opponentCargoShipLineFoul;
this.sideCargoShipHatchCapable = sideCargoShipHatchCapable;
this.frontCargoShipHatchCapable = frontCargoShipHatchCapable;
Expand All @@ -43,40 +51,44 @@ public Autonomous(int rocketCargo, int rocketHatches, int cargoShipHatches,
this.hatchesDroppedCargoShip = hatchesDroppedCargoShip;
}

public void setRocketCargo(int rocketCargo) {
this.rocketCargo = rocketCargo;
public int getRocketCargo() {
return rocketCargo;
}

public void setRocketHatches(int rocketHatches) {
this.rocketHatches = rocketHatches;
public int getRocketHatches() {
return rocketHatches;
}

public void setCargoShipHatches(int cargoShipHatches) {
this.cargoShipHatches = cargoShipHatches;
public int getCargoShipHatches() {
return cargoShipHatches;
}

public void setHatchesDropped(int hatchesDropped) {
this.hatchesDropped = hatchesDropped;
public int getCargoShipCargo() {
return cargoShipCargo;
}

public void setCargoDropped(int cargoDropped) {
this.cargoDropped = cargoDropped;
public int getHatchesDropped() {
return hatchesDropped;
}

public void setReachHabLine(boolean reachHabLine) {
this.reachHabLine = reachHabLine;
public int getCargoDropped() {
return cargoDropped;
}

public void setOpponentCargoShipLineFoul(boolean opponentCargoShipLineFoul) {
this.opponentCargoShipLineFoul = opponentCargoShipLineFoul;
public boolean isCrossHabLine() {
return crossHabLine;
}

public void setCargoShipCargo(int cargoShipCargo) {
this.cargoShipCargo = cargoShipCargo;
public boolean isOpponentCargoShipLineFoul() {
return opponentCargoShipLineFoul;
}

public void setFrontCargoShipHatchCapable(boolean frontCargoShipHatchCapable) {
this.frontCargoShipHatchCapable = frontCargoShipHatchCapable;
public void setCrossHabLine(boolean crossHabLine) {
this.crossHabLine = crossHabLine;
}

public boolean isFrontCargoShipHatchCapable() {
return frontCargoShipHatchCapable;
}

public boolean isSideCargoShipHatchCapable() {
Expand All @@ -87,71 +99,68 @@ public void setSideCargoShipHatchCapable(boolean sideCargoShipHatchCapable) {
this.sideCargoShipHatchCapable = sideCargoShipHatchCapable;
}

public boolean isCargoDroppedCargoShip() {
return cargoDroppedCargoShip;
public boolean isHatchesDroppedRocket() {
return hatchesDroppedRocket;
}

public void setCargoDroppedCargoShip(boolean cargoDroppedCargoShip) {
this.cargoDroppedCargoShip = cargoDroppedCargoShip;
public boolean isHatchesDroppedCargoShip() {
return hatchesDroppedCargoShip;
}

public int getRocketCargo() {
return rocketCargo;
public boolean isCargoDroppedCargoShip() {
return cargoDroppedCargoShip;
}

public int getRocketHatches() {
return rocketHatches;
public void setCargoDroppedCargoShip(boolean cargoDroppedCargoShip) {
this.cargoDroppedCargoShip = cargoDroppedCargoShip;
}

public int getCargoShipHatches() {
return cargoShipHatches;
public boolean isCargoDroppedRocket() {
return cargoDroppedRocket;
}

public int getCargoShipCargo() {
return cargoShipCargo;
public void setCargoDroppedRocket(boolean cargoDroppedRocket) {
this.cargoDroppedRocket = cargoDroppedRocket;
}

public int getHatchesDropped() {
return hatchesDropped;
public void setCargoShipHatches(int cargoShipHatches) {
this.cargoShipHatches = cargoShipHatches;
}

public int getCargoDropped() {
return cargoDropped;
public void setRocketHatches(int rocketHatches) {
this.rocketHatches = rocketHatches;
}

public boolean isReachHabLine() {
return reachHabLine;
public void setCargoShipCargo(int cargoShipCargo) {
this.cargoShipCargo = cargoShipCargo;
}

public boolean isOpponentCargoShipLineFoul() {
return opponentCargoShipLineFoul;
public void setRocketCargo(int rocketCargo) {
this.rocketCargo = rocketCargo;
}

public boolean isCargoDroppedRocket() {
return cargoDroppedRocket;
public void setFrontCargoShipHatchCapable(boolean frontCargoShipHatchCapable) {
this.frontCargoShipHatchCapable = frontCargoShipHatchCapable;
}

public boolean isFrontCargoShipHatchCapable() {
return frontCargoShipHatchCapable;
public void setHatchesDroppedCargoShip(boolean hatchesDroppedCargoShip) {
this.hatchesDroppedCargoShip = hatchesDroppedCargoShip;
}

public void setCargoDroppedRocket(boolean cargoDroppedRocket) {
this.cargoDroppedRocket = cargoDroppedRocket;
public void setHatchesDropped(int hatchesDropped) {
this.hatchesDropped = hatchesDropped;
}

public boolean isHatchesDroppedRocket() {
return hatchesDroppedRocket;
public void setCargoDropped(int cargoDropped) {
this.cargoDropped = cargoDropped;
}

public void setHatchesDroppedRocket(boolean hatchesDroppedRocket) {
this.hatchesDroppedRocket = hatchesDroppedRocket;
}

public boolean isHatchesDroppedCargoShip() {
return hatchesDroppedCargoShip;
public void setOpponentCargoShipLineFoul(boolean opponentCargoShipLineFoul) {
this.opponentCargoShipLineFoul = opponentCargoShipLineFoul;
}

public void setHatchesDroppedCargoShip(boolean hatchesDroppedCargoShip) {
this.hatchesDroppedCargoShip = hatchesDroppedCargoShip;
}
}
Loading

0 comments on commit 9cadd7e

Please sign in to comment.