model.MARK_II.util.Formatter Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of WalnutiQ Show documentation
Show all versions of WalnutiQ Show documentation
A Java based Neuron Modeling framework
The newest version!
package model.MARK_II.util;
import model.MARK_II.generalAlgorithm.ColumnPosition;
import java.util.Set;
/**
* @author Quinn Liu ([email protected])
* @version August 1, 2014
*/
public class Formatter {
/**
* @return Return the list of active column positions in the following
* format: ((0, 0), (1, 1), (2, 2), (2,0))
*/
public static String format(Set activeColumnPositions) {
String listOfActiveColumns = "(";
int numberOfActiveColumns = activeColumnPositions.size();
for (ColumnPosition columnPosition : activeColumnPositions) {
listOfActiveColumns += "(" + columnPosition.getRow() + ", " +
columnPosition.getColumn() + ")";
--numberOfActiveColumns;
if (numberOfActiveColumns == 0) {
// this is the last active column so don't print ", "
} else {
listOfActiveColumns += ", ";
}
}
listOfActiveColumns += ")";
return listOfActiveColumns;
}
}