DayClustering { public static DayClustering create(int[] groups) { if (groups.length != 7) { return null; } if (!checkGroups(groups)) { return null; } return new DayClustering(groups); } DayClustering(final int[] groups); static DayClustering create(int[] groups); int getGroup(java.time.DayOfWeek dw); int getGroupsCount(); int getGroupCount(int idx); java.time.DayOfWeek[] group(int idx); int[] positions(int idx); int[][] allPositions(); boolean isInside(DayClustering dc); @Override String toString(); String toString(int i); int[] getGroupsDefinition(); static final DayClustering TD2; }
@Test public void testCreate() { assertTrue(DayClustering.create(new int[]{0,2,2,2,0,0,1})!= null); assertTrue(DayClustering.create(new int[]{0,2,2,2,0,0,0})== null); assertTrue(DayClustering.create(new int[]{0,2,2,2,2,2,1})!= null); assertTrue(DayClustering.create(new int[]{0,1,2,3,4,5,6})!= null); }