@Test public void testDedupSorted() { int[] a1 = {1, 1, 2, 2, 3, 3}; int[] a2 = {1, 2, 3}; assertTrue(Arrays.equals(JFactory.dedupSorted(a1), a2)); assertEquals(JFactory.dedupSorted(a2), a2); int[] a3 = {}; assertEquals(JFactory.dedupSorted(a3), a3); int[] a4 = {1}; assertEquals(JFactory.dedupSorted(a4), a4); }
static int[] dedupSorted(int[] values) { if (values.length < 2) { return values; } int i = 0; int j = 1; while (j < values.length) { if (values[i] != values[j]) { values[++i] = values[j++]; } else { j++; } } int dedupLen = i + 1; if (dedupLen < values.length) { return Arrays.copyOf(values, dedupLen); } else { return values; } }
JFactory extends BDDFactory { static int[] dedupSorted(int[] values) { if (values.length < 2) { return values; } int i = 0; int j = 1; while (j < values.length) { if (values[i] != values[j]) { values[++i] = values[j++]; } else { j++; } } int dedupLen = i + 1; if (dedupLen < values.length) { return Arrays.copyOf(values, dedupLen); } else { return values; } } }
JFactory extends BDDFactory { static int[] dedupSorted(int[] values) { if (values.length < 2) { return values; } int i = 0; int j = 1; while (j < values.length) { if (values[i] != values[j]) { values[++i] = values[j++]; } else { j++; } } int dedupLen = i + 1; if (dedupLen < values.length) { return Arrays.copyOf(values, dedupLen); } else { return values; } } private  JFactory(); }
JFactory extends BDDFactory { static int[] dedupSorted(int[] values) { if (values.length < 2) { return values; } int i = 0; int j = 1; while (j < values.length) { if (values[i] != values[j]) { values[++i] = values[j++]; } else { j++; } } int dedupLen = i + 1; if (dedupLen < values.length) { return Arrays.copyOf(values, dedupLen); } else { return values; } } private  JFactory(); @Override String getVersion(); static BDDFactory init(int nodenum, int cachesize); @Override BDD zero(); @Override BDD one(); @Override BDD orAll(BDD... bddOperands); @Override BDD orAll(Collection<BDD> bddOperands); @Override int setNodeTableSize(int size); @Override int setCacheSize(int newcachesize); @Override boolean isInitialized(); @Override void done(); @Override void setError(int code); @Override void clearError(); @Override int setMaxNodeNum(int size); @Override double setMinFreeNodes(double x); @Override int setMaxIncrease(int x); @Override double setIncreaseFactor(double x); @Override int setCacheRatio(int r); @Override int varNum(); @Override int setVarNum(int num); @Override int duplicateVar(int var); @Override BDD ithVar(int var); @Override BDD nithVar(int var); @Override void printAll(); @Override void printTable(BDD b); @Override int level2Var(int level); @Override int var2Level(int var); @Override void setVarOrder(int[] neworder); @Override int nodeCount(Collection<BDD> r); @Override int getNodeTableSize(); @Override int getNodeNum(); @Override int getCacheSize(); @Override void printStat(); @Override BDDPairing makePair(); }
JFactory extends BDDFactory { static int[] dedupSorted(int[] values) { if (values.length < 2) { return values; } int i = 0; int j = 1; while (j < values.length) { if (values[i] != values[j]) { values[++i] = values[j++]; } else { j++; } } int dedupLen = i + 1; if (dedupLen < values.length) { return Arrays.copyOf(values, dedupLen); } else { return values; } } private  JFactory(); @Override String getVersion(); static BDDFactory init(int nodenum, int cachesize); @Override BDD zero(); @Override BDD one(); @Override BDD orAll(BDD... bddOperands); @Override BDD orAll(Collection<BDD> bddOperands); @Override int setNodeTableSize(int size); @Override int setCacheSize(int newcachesize); @Override boolean isInitialized(); @Override void done(); @Override void setError(int code); @Override void clearError(); @Override int setMaxNodeNum(int size); @Override double setMinFreeNodes(double x); @Override int setMaxIncrease(int x); @Override double setIncreaseFactor(double x); @Override int setCacheRatio(int r); @Override int varNum(); @Override int setVarNum(int num); @Override int duplicateVar(int var); @Override BDD ithVar(int var); @Override BDD nithVar(int var); @Override void printAll(); @Override void printTable(BDD b); @Override int level2Var(int level); @Override int var2Level(int var); @Override void setVarOrder(int[] neworder); @Override int nodeCount(Collection<BDD> r); @Override int getNodeTableSize(); @Override int getNodeNum(); @Override int getCacheSize(); @Override void printStat(); @Override BDDPairing makePair();  }