@Test public void testParseString() { String siteswap_str_1 = "v1.0.0/86277.2.1.0"; String siteswap_str_1_substring = "86277.2.1.0"; Siteswap siteswap_1 = new Siteswap(siteswap_str_1); assertEquals("86277", siteswap_1.toAsyncString()); assertEquals(2, siteswap_1.getNumberOfJugglers()); assertEquals(1, siteswap_1.getNumberOfSynchronousHands()); assertEquals(0, siteswap_1.getSynchronousStartPosition()); assertEquals(siteswap_str_1_substring, siteswap_1.toParsableString()); String siteswap_str_2 = "c9ec99bc39ac99a.3.3.1"; Siteswap siteswap_2 = new Siteswap(siteswap_str_2); assertEquals("c9ec99bc39ac99a", siteswap_2.toAsyncString()); assertEquals(3, siteswap_2.getNumberOfJugglers()); assertEquals(3, siteswap_2.getNumberOfSynchronousHands()); assertEquals(1, siteswap_2.getSynchronousStartPosition()); assertEquals(siteswap_str_2, siteswap_2.toParsableString()); String siteswap_str_3 = "86277.2.1"; Siteswap siteswap_3 = new Siteswap(siteswap_str_3); assertEquals("86277", siteswap_3.toAsyncString()); assertEquals(2, siteswap_3.getNumberOfJugglers()); assertEquals(1, siteswap_3.getNumberOfSynchronousHands()); assertEquals(0, siteswap_3.getSynchronousStartPosition()); assertEquals(siteswap_str_1_substring, siteswap_3.toParsableString()); String siteswap_str_4 = "86277.2"; Siteswap siteswap_4 = new Siteswap(siteswap_str_4); assertEquals("86277", siteswap_4.toAsyncString()); assertEquals(2, siteswap_4.getNumberOfJugglers()); assertEquals(1, siteswap_4.getNumberOfSynchronousHands()); assertEquals(0, siteswap_4.getSynchronousStartPosition()); assertEquals(siteswap_str_1_substring, siteswap_4.toParsableString()); String siteswap_str_5 = "86277"; Siteswap siteswap_5 = new Siteswap(siteswap_str_5); assertEquals("86277", siteswap_5.toAsyncString()); assertEquals(2, siteswap_5.getNumberOfJugglers()); assertEquals(1, siteswap_5.getNumberOfSynchronousHands()); assertEquals(0, siteswap_5.getSynchronousStartPosition()); assertEquals(siteswap_str_1_substring, siteswap_5.toParsableString()); }
private byte[] parseString(String str) { byte[] siteswap = new byte[str.length()]; mInvalidCharacters = ""; mIsParsingError = false; for (int i = 0; i < str.length(); ++i) { siteswap[i] = (byte) charToInt(str.charAt(i)); if (siteswap[i] == INVALID) { mIsParsingError = true; mInvalidCharacters += str.charAt(i); } } return siteswap; }
Siteswap implements Comparable<Siteswap>, Iterable<Byte>, Serializable { private byte[] parseString(String str) { byte[] siteswap = new byte[str.length()]; mInvalidCharacters = ""; mIsParsingError = false; for (int i = 0; i < str.length(); ++i) { siteswap[i] = (byte) charToInt(str.charAt(i)); if (siteswap[i] == INVALID) { mIsParsingError = true; mInvalidCharacters += str.charAt(i); } } return siteswap; } }
Siteswap implements Comparable<Siteswap>, Iterable<Byte>, Serializable { private byte[] parseString(String str) { byte[] siteswap = new byte[str.length()]; mInvalidCharacters = ""; mIsParsingError = false; for (int i = 0; i < str.length(); ++i) { siteswap[i] = (byte) charToInt(str.charAt(i)); if (siteswap[i] == INVALID) { mIsParsingError = true; mInvalidCharacters += str.charAt(i); } } return siteswap; } Siteswap();  Siteswap(Siteswap s);  Siteswap(byte[] data, int numberOfJugglers);  Siteswap(String siteswap, int numberOfJugglers, String name);  Siteswap(String siteswap, int numberOfJugglers);  Siteswap(String siteswap);  Siteswap(byte[] data); }
Siteswap implements Comparable<Siteswap>, Iterable<Byte>, Serializable { private byte[] parseString(String str) { byte[] siteswap = new byte[str.length()]; mInvalidCharacters = ""; mIsParsingError = false; for (int i = 0; i < str.length(); ++i) { siteswap[i] = (byte) charToInt(str.charAt(i)); if (siteswap[i] == INVALID) { mIsParsingError = true; mInvalidCharacters += str.charAt(i); } } return siteswap; } Siteswap();  Siteswap(Siteswap s);  Siteswap(byte[] data, int numberOfJugglers);  Siteswap(String siteswap, int numberOfJugglers, String name);  Siteswap(String siteswap, int numberOfJugglers);  Siteswap(String siteswap);  Siteswap(byte[] data); byte at(int index); byte atSyncCorrected(int index); void set(int index, int value); int period_length(); int local_period_length(); int global_period_length(); int getNonMirroredPeriod(); int getNumberOfHands(); void swap(int index); int getMaxThrow(); int getNumberOfObjects(); int getNumberOfJugglers(); boolean setNumberOfSynchronousHands(int numberOfSynchronousHands); int getNumberOfSynchronousHands(); void setSynchronousStartPosition(int synchronousStartPosition); int getSynchronousStartPosition(); String getSiteswapName(); void setSiteswapName(String name); int getPartialSum(int startIndex, int stopIndex); boolean is_in_range(byte min, byte max); boolean isSynchronous(); int getSynchronousPosition(int position); int countFilterValue(NumberFilter.FilterValue siteswapValue); int countFilterValuePartitially(NumberFilter.FilterValue siteswapValue, int index); void rotateRight(int positions); void rotateLeft(int positions); void make_unique_representation(); boolean rotateGetinFree(); Siteswap calculateGetin(); Siteswap calculateGetout(); boolean isGetinFree(); int calculateMandatoreyGetinLength(); Siteswap calculateMandatoryGetin(); Siteswap calculateNonMandatoryGetins(); Siteswap[] calculateLocalGetins(); Siteswap[] calculateLocalGetouts(); ClubDistribution[] calculateGroundStateClubDistribution(); ClubDistribution[] calculateInitialClubDistribution(); boolean isMandatoryGetin(); boolean isGroundStateClubDistribution(); int measureSuitabilityForStartingPosition(); void rotateToBestStartingPosition(); @Override Iterator<Byte> iterator(); @Override int compareTo(Siteswap o); byte[] toArray(); Vector<Siteswap> toLocal(); String toDividedString(); Vector<String> toLocalString(); @Override boolean equals(Object obj); @Override String toString(); String toGlobalString(); String toAsyncString(); String toSyncStringLocalVsLocal(); String toSyncStringGlobalRepresentation(); static String getCurrentStringVersion(); boolean fromParsableString(String str); boolean parseVersionedString(String version, String siteswapStr); String toParsableString(); Siteswap toPattern(); Siteswap toInterface(); Siteswap toInterface(byte defaultValue); Siteswap toInterface(byte defaultValue, int interfaceLength, int length); boolean isValid(); static Siteswap mergeCompatible(Siteswap s1, Siteswap s2); static boolean isValid(Siteswap siteswap); String stringAt(int index); static String intToString(int value); static int stringToInt(String value); static char intToChar(int value); static int charToInt(char value); boolean isPatternSingleValue(byte patternValue, byte siteswapValue); boolean isPattern(Siteswap pattern); boolean isPattern(Siteswap pattern, int patternStartPosition); boolean rotateToInterface(Siteswap siteswapInterface); boolean isParsingError(); String getInvalidCharactersFromParsing(); static boolean isPass(int value, int numberOfJugglers); static boolean isSelf(int value, int numberOfJugglers); }
Siteswap implements Comparable<Siteswap>, Iterable<Byte>, Serializable { private byte[] parseString(String str) { byte[] siteswap = new byte[str.length()]; mInvalidCharacters = ""; mIsParsingError = false; for (int i = 0; i < str.length(); ++i) { siteswap[i] = (byte) charToInt(str.charAt(i)); if (siteswap[i] == INVALID) { mIsParsingError = true; mInvalidCharacters += str.charAt(i); } } return siteswap; } Siteswap();  Siteswap(Siteswap s);  Siteswap(byte[] data, int numberOfJugglers);  Siteswap(String siteswap, int numberOfJugglers, String name);  Siteswap(String siteswap, int numberOfJugglers);  Siteswap(String siteswap);  Siteswap(byte[] data); byte at(int index); byte atSyncCorrected(int index); void set(int index, int value); int period_length(); int local_period_length(); int global_period_length(); int getNonMirroredPeriod(); int getNumberOfHands(); void swap(int index); int getMaxThrow(); int getNumberOfObjects(); int getNumberOfJugglers(); boolean setNumberOfSynchronousHands(int numberOfSynchronousHands); int getNumberOfSynchronousHands(); void setSynchronousStartPosition(int synchronousStartPosition); int getSynchronousStartPosition(); String getSiteswapName(); void setSiteswapName(String name); int getPartialSum(int startIndex, int stopIndex); boolean is_in_range(byte min, byte max); boolean isSynchronous(); int getSynchronousPosition(int position); int countFilterValue(NumberFilter.FilterValue siteswapValue); int countFilterValuePartitially(NumberFilter.FilterValue siteswapValue, int index); void rotateRight(int positions); void rotateLeft(int positions); void make_unique_representation(); boolean rotateGetinFree(); Siteswap calculateGetin(); Siteswap calculateGetout(); boolean isGetinFree(); int calculateMandatoreyGetinLength(); Siteswap calculateMandatoryGetin(); Siteswap calculateNonMandatoryGetins(); Siteswap[] calculateLocalGetins(); Siteswap[] calculateLocalGetouts(); ClubDistribution[] calculateGroundStateClubDistribution(); ClubDistribution[] calculateInitialClubDistribution(); boolean isMandatoryGetin(); boolean isGroundStateClubDistribution(); int measureSuitabilityForStartingPosition(); void rotateToBestStartingPosition(); @Override Iterator<Byte> iterator(); @Override int compareTo(Siteswap o); byte[] toArray(); Vector<Siteswap> toLocal(); String toDividedString(); Vector<String> toLocalString(); @Override boolean equals(Object obj); @Override String toString(); String toGlobalString(); String toAsyncString(); String toSyncStringLocalVsLocal(); String toSyncStringGlobalRepresentation(); static String getCurrentStringVersion(); boolean fromParsableString(String str); boolean parseVersionedString(String version, String siteswapStr); String toParsableString(); Siteswap toPattern(); Siteswap toInterface(); Siteswap toInterface(byte defaultValue); Siteswap toInterface(byte defaultValue, int interfaceLength, int length); boolean isValid(); static Siteswap mergeCompatible(Siteswap s1, Siteswap s2); static boolean isValid(Siteswap siteswap); String stringAt(int index); static String intToString(int value); static int stringToInt(String value); static char intToChar(int value); static int charToInt(char value); boolean isPatternSingleValue(byte patternValue, byte siteswapValue); boolean isPattern(Siteswap pattern); boolean isPattern(Siteswap pattern, int patternStartPosition); boolean rotateToInterface(Siteswap siteswapInterface); boolean isParsingError(); String getInvalidCharactersFromParsing(); static boolean isPass(int value, int numberOfJugglers); static boolean isSelf(int value, int numberOfJugglers); static final byte SELF; static final byte PASS; static final byte DONT_CARE; static final byte FREE; static final byte INVALID; }