Skip to content

Commit 366bbd5

Browse files
committed
Comments on pull request addressed. Used curly braces for all if/else. Removed some comments.
1 parent 01b2a7e commit 366bbd5

File tree

2 files changed

+15
-14
lines changed

2 files changed

+15
-14
lines changed

ui/src/main/java/edu/wpi/grip/ui/pipeline/PipelineView.java

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -154,9 +154,6 @@ private OutputSocketView findOutputSocketView(OutputSocket socket) {
154154
}
155155

156156
/**
157-
* This function is public because it is used by {@link edu.wpi.grip.ui.preview.PreviewsView#onSocketPreviewChanged}
158-
* to order the list of previews.
159-
*
160157
* @return The {@link SourceView} that corresponds with the given source
161158
*/
162159
public SourceView findSourceView(Source source) {
@@ -170,9 +167,6 @@ public SourceView findSourceView(Source source) {
170167
}
171168

172169
/**
173-
* This function is public because it is used by {@link edu.wpi.grip.ui.preview.PreviewsView#onSocketPreviewChanged}
174-
* to order the list of previews.
175-
*
176170
* @return The {@link StepView} that corresponds with the given step
177171
*/
178172
public StepView findStepView(Step step) {

ui/src/main/java/edu/wpi/grip/ui/preview/PreviewsView.java

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -79,10 +79,15 @@ public synchronized void onPreviewOrderChanged(StepMovedEvent event) {
7979
for (OutputSocket<?> i : socketsMovedArray) {
8080
if (this.previewedSockets.indexOf(i) != -1) {//If this socket is previewed
8181
previewedMovedSockets.push(i);
82-
if (rightmostIndex < this.previewedSockets.indexOf(i))
82+
83+
if (rightmostIndex < this.previewedSockets.indexOf(i)){
8384
rightmostIndex = this.previewedSockets.indexOf(i);
84-
if (leftmostIndex > this.previewedSockets.indexOf(i))
85+
}
86+
87+
if (leftmostIndex > this.previewedSockets.indexOf(i)) {
8588
leftmostIndex = this.previewedSockets.indexOf(i);
89+
}
90+
8691
}
8792
}
8893

@@ -93,10 +98,11 @@ public synchronized void onPreviewOrderChanged(StepMovedEvent event) {
9398

9499
int newLocation = 0;//This will hold the new index in the list of previewed sockets for this socket
95100

96-
if (distanceMoved < 0) //If the step moved left....
101+
if (distanceMoved < 0) { //If the step moved left....
97102
newLocation = leftmostIndex + distanceMoved; //Calculate the new index from the leftmost previewed socket of this step
98-
else //The step must have moved right....
103+
}else { //The step must have moved right....
99104
newLocation = rightmostIndex + distanceMoved;//So calculate the new index from the rightmost previewed socket of this step
105+
}
100106

101107
if (newLocation < numberOfSourcePreviews) {//If the new calculated index would put it in the midst of source previews
102108
newLocation = numberOfSourcePreviews;//Make the index the location of the first non-source preview
@@ -112,10 +118,11 @@ public synchronized void onPreviewOrderChanged(StepMovedEvent event) {
112118
((nextSocketInDirection.getStep().isPresent())
113119
&& (nextSocketInDirection.getStep().get() == this.previewedSockets.get(newLocation).getStep().get()))) { //While we haven't reached the beginning of the list of previews, the socket at this location is a socket from a step, and it is the SAME step as the step of the socket at the new location...
114120
count++;
115-
if ((newLocation - count) > 0)//If we haven't reached the beginning of the list of open previews...
121+
if ((newLocation - count) > 0) {//If we haven't reached the beginning of the list of open previews...
116122
nextSocketInDirection = this.previewedSockets.get(newLocation - count);//Grab the next previewed socket to examine in the direction we are moving
117-
else
123+
} else {
118124
zeroReached = true;//Mark that we've reached the beginning of the list of previews so we know to stop looking for more
125+
}
119126
}
120127
newLocation = newLocation - (count - 1);//Since the first compare of the while loop will always be true, we subract one from the count when we use it to adjust newLocation
121128

@@ -132,9 +139,9 @@ public synchronized void onPreviewOrderChanged(StepMovedEvent event) {
132139
this.previewedSockets.remove(oldIndex);
133140
this.eventBus.unregister(this.previewBox.getChildren().remove(oldIndex));
134141

135-
if (newLocation > this.previewedSockets.size())//If the new index is now too big for the list of previews
142+
if (newLocation > this.previewedSockets.size()) {//If the new index is now too big for the list of previews
136143
newLocation = this.previewedSockets.size();//Make it so it will be added to the end of the list of previews
137-
144+
}
138145
this.previewedSockets.add(newLocation, current);//...add it to the correct location in the list of previews open
139146
this.previewBox.getChildren().add(newLocation, SocketPreviewViewFactory.createPreviewView(this.eventBus, current));//...and display it in the correct location in the list of previews open
140147
}

0 commit comments

Comments
 (0)