-
Notifications
You must be signed in to change notification settings - Fork 5
Style Guideline
Jose Jimenez edited this page Dec 12, 2019
·
23 revisions
/**
*
* Jose Jimenez
* Brandon Cramer
* Minh Pham
* Tony Guan
* Victor Chen
*
* University of California, San Diego
* IEEE Micromouse Team 2020
*
* File Name: <Name>
* Description: <Short Description>
*/Routine Headers will be in parallel with the Javadocs. Every header should have a short description of its role, a short description for all formal parameters, and what the function expects to return. An example is as follows:
/**
* Two pairs are equal if the content in the pair are equivalent order does
* not matter.
* @param o object of comparison.
* @return true if pairs have the same content.
*/
@Override
public boolean equals( Object o ) {
...
}Two space indentation. Four spaces to indicate a line continuation of the previous line.
Two space indentation:
The recommended max of characters on a line is 80.
/**
* Combines two vertices in the disjoint set into one set via union by rank.
* @param vertex_A Node in the maze.
* @param vertex_B Node in the maze.
* @return Nothing.
*/
private void union( MazeNode vertex_A, MazeNode vertex_B ) {
/* disjoint set representatives */
MazeNode a_set = find( vertex_A );
MazeNode b_set = find( vertex_B );
if( a_set == b_set ) {
/* no union needed - same set */
return;
}
if( a_set.rank > b_set.rank ) {
/* a rank is greater than rank of b */
b_set.parent = a_set;
}
else {
/* a_set is a smaller tree than b_set */
a_set.parent = b_set;
if( a_set.rank == b_set.rank ) {
/* union of trees of equal height */
b_set.rank = a_set.rank + 1;
}
}
}Welcome to the black box of every Micromouse