Skip to content

Commit

Permalink
Fix issues caused by not using subystem in getFullName
Browse files Browse the repository at this point in the history
  • Loading branch information
sciencewhiz committed Feb 10, 2018
1 parent 2c55c89 commit d61e43b
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ dependencies {
compile 'org.apache.velocity:velocity:1.7'
compile 'org.yaml:snakeyaml:1.10'
compile 'com.github.jgraph:jgraphx:v3.3.1.1'
compileOnly 'org.projectlombok:lombok:1.16.18'
compile 'org.projectlombok:lombok:1.16.18'
testCompile 'junit:junit:4.11'
}

Expand Down
Binary file modified build/libs/RobotBuilder-all.jar
Binary file not shown.
10 changes: 5 additions & 5 deletions src/main/java/robotbuilder/data/RobotComponent.java
Original file line number Diff line number Diff line change
Expand Up @@ -131,9 +131,9 @@ public String getName() {

public final void setName(String name) {
if (model.getName() != null) {
robot.removeName(getFullName());
robot.removeName(getName());
model.setName(name);
robot.addName(getFullName());
robot.addName(getName());
} else {
model.setName(name);
}
Expand Down Expand Up @@ -238,7 +238,7 @@ public String getFullName() {
if (getBase().getType().equals("Subsystem")) {
return getName();
} else {
return /*getSubsystem() + */getName();
return getSubsystem() + getName();
}
}

Expand All @@ -249,7 +249,7 @@ public Vector<String> getChildrenOfTypeNames(String type) {
Vector<String> names = new Vector<>();
children.forEach(child -> {
if (type.equals(((RobotComponent) child).getBase().getType())) {
names.add(((RobotComponent) child).getFullName());
names.add(((RobotComponent) child).getName());
}
names.addAll(((RobotComponent) child).getChildrenOfTypeNames(type));
});
Expand All @@ -263,7 +263,7 @@ public Vector<String> getChildrenOfComponentNames(String componentName) {
Vector<String> names = new Vector<>();
children.forEach(child -> {
if (componentName.equals(((RobotComponent) child).getBase().getName())) {
names.add(((RobotComponent) child).getFullName());
names.add(((RobotComponent) child).getName());
}
names.addAll(((RobotComponent) child).getChildrenOfComponentNames(componentName));
});
Expand Down
12 changes: 6 additions & 6 deletions src/main/java/robotbuilder/exporters/GenericExporter.java
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ private Context getContext(RobotComponent comp) {
Context context = new VelocityContext(rootContext);
final Map<String, String> instructions = componentInstructions.get(comp.getBase().getName());
context.put("ClassName", instructions.get("ClassName"));
context.put("Name", comp.getFullName());
context.put("Name", comp.getName());
context.put("Short_Name", comp.getName());
if (!comp.getSubsystem().isEmpty()) {
context.put("Subsystem", comp.getSubsystem().substring(0, comp.getSubsystem().length() - 1));
Expand Down Expand Up @@ -319,7 +319,7 @@ public Map<String, String> filterComponents(final String moduleFilter, final Str
}
ports.keySet().stream()
.filter(key -> module.equals(modules.get(key)))
.forEach(key -> mapping.put(ports.get(key), component.getSubsystem() + delimiter + component.getFullName() + " " + key));
.forEach(key -> mapping.put(ports.get(key), component.getSubsystem() + delimiter + component.getName() + " " + key));
});
return mapping;
}
Expand All @@ -336,13 +336,13 @@ public Map<String, String> filterComponents(final String propertyName, RobotComp
// show speed controller type
if (propertyName.equals("Channel (PWM)") && component.getBaseType().equals("Speed Controller")) {
String type1 = component.getProperty("Type").getValue().toString();
mapping.put(component.getProperty(property).getValue().toString(), component.getSubsystem() + delimiter + component.getFullName() + delimiter2 + type1);
mapping.put(component.getProperty(property).getValue().toString(), component.getSubsystem() + delimiter + component.getName() + delimiter2 + type1);
} else if (propertyName.equals("Channel (PWM)") && component.getBaseType().equals("Servo")) {
mapping.put(component.getProperty(property).getValue().toString(), component.getSubsystem() + delimiter + component.getFullName() + delimiter2 + "Servo");
mapping.put(component.getProperty(property).getValue().toString(), component.getSubsystem() + delimiter + component.getName() + delimiter2 + "Servo");
} else if (propertyName.equals("Channel (PWM)") && component.getBaseType().equals("Nidec Brushless")) {
mapping.put(component.getProperty(property).getValue().toString(), component.getSubsystem() + delimiter + component.getFullName() + delimiter2 + "Nidec Brushless");
mapping.put(component.getProperty(property).getValue().toString(), component.getSubsystem() + delimiter + component.getName() + delimiter2 + "Nidec Brushless");
} else {
mapping.put(component.getProperty(property).getValue().toString(), component.getSubsystem() + delimiter + component.getFullName());
mapping.put(component.getProperty(property).getValue().toString(), component.getSubsystem() + delimiter + component.getName());
}
}
}
Expand Down

0 comments on commit d61e43b

Please sign in to comment.