@Test public void testMakeCanonical() { List<Split> splits = new ArrayList<>(); final int nbTaxa = 5; splits.add(new SpectreSplit(new SpectreSplitBlock(new int[]{1}), nbTaxa)); splits.add(new SpectreSplit(new SpectreSplitBlock(new int[]{2}), nbTaxa)); splits.add(new SpectreSplit(new SpectreSplitBlock(new int[]{3}), nbTaxa)); splits.add(new SpectreSplit(new SpectreSplitBlock(new int[]{4}), nbTaxa)); splits.add(new SpectreSplit(new SpectreSplitBlock(new int[]{5}), nbTaxa)); splits.add(new SpectreSplit(new SpectreSplitBlock(new int[]{1,5}), nbTaxa)); splits.add(new SpectreSplit(new SpectreSplitBlock(new int[]{2,4}), nbTaxa)); splits.add(new SpectreSplit(new SpectreSplitBlock(new int[]{1,2}), nbTaxa, 0.4)); splits.add(new SpectreSplit(new SpectreSplitBlock(new int[]{4,5,3}), nbTaxa, 1.2)); SplitSystem ss = new SpectreSplitSystem(nbTaxa, splits).makeCanonical(); assertNotNull(ss); assertFalse(ss.isCompatible()); assertFalse(ss.isCircular()); for(Split s : ss) { assertTrue(s.getASide().size() <= 2); } }
@Override public SplitSystem makeCanonical() { List<Split> splits = new ArrayList<>(); for(Split s : this) { splits.add(s.makeCanonical()); } Collections.sort(splits); return new SpectreSplitSystem(this.orderedTaxa, splits); }
SpectreSplitSystem extends ArrayList<Split> implements SplitSystem { @Override public SplitSystem makeCanonical() { List<Split> splits = new ArrayList<>(); for(Split s : this) { splits.add(s.makeCanonical()); } Collections.sort(splits); return new SpectreSplitSystem(this.orderedTaxa, splits); } }
SpectreSplitSystem extends ArrayList<Split> implements SplitSystem { @Override public SplitSystem makeCanonical() { List<Split> splits = new ArrayList<>(); for(Split s : this) { splits.add(s.makeCanonical()); } Collections.sort(splits); return new SpectreSplitSystem(this.orderedTaxa, splits); } SpectreSplitSystem(int nbTaxa, List<Split> splits);  SpectreSplitSystem(IdentifierList orderedTaxa);  SpectreSplitSystem(IdentifierList orderedTaxa, List<Split> splits);  SpectreSplitSystem(DistanceMatrix distanceMatrix);  SpectreSplitSystem(DistanceMatrix distanceMatrix, IdentifierList orderedTaxa);  SpectreSplitSystem(DistanceMatrix distanceMatrix, LeastSquaresCalculator calculator);  SpectreSplitSystem(DistanceMatrix distanceMatrix, IdentifierList circularOrdering, LeastSquaresCalculator calculator);  SpectreSplitSystem(DistanceMatrix distanceMatrix, IdentifierList circularOrdering, LeastSquaresCalculator calculator, List<Split> splits);  SpectreSplitSystem(SplitSystem splitSystem);  SpectreSplitSystem(SplitSystem unweightedSplitSystem, TreeSplitWeights treeWeights);  SpectreSplitSystem(PermutationSequence p_sequ);  SpectreSplitSystem(PermutationSequenceDraw p_sequ); }
SpectreSplitSystem extends ArrayList<Split> implements SplitSystem { @Override public SplitSystem makeCanonical() { List<Split> splits = new ArrayList<>(); for(Split s : this) { splits.add(s.makeCanonical()); } Collections.sort(splits); return new SpectreSplitSystem(this.orderedTaxa, splits); } SpectreSplitSystem(int nbTaxa, List<Split> splits);  SpectreSplitSystem(IdentifierList orderedTaxa);  SpectreSplitSystem(IdentifierList orderedTaxa, List<Split> splits);  SpectreSplitSystem(DistanceMatrix distanceMatrix);  SpectreSplitSystem(DistanceMatrix distanceMatrix, IdentifierList orderedTaxa);  SpectreSplitSystem(DistanceMatrix distanceMatrix, LeastSquaresCalculator calculator);  SpectreSplitSystem(DistanceMatrix distanceMatrix, IdentifierList circularOrdering, LeastSquaresCalculator calculator);  SpectreSplitSystem(DistanceMatrix distanceMatrix, IdentifierList circularOrdering, LeastSquaresCalculator calculator, List<Split> splits);  SpectreSplitSystem(SplitSystem splitSystem);  SpectreSplitSystem(SplitSystem unweightedSplitSystem, TreeSplitWeights treeWeights);  SpectreSplitSystem(PermutationSequence p_sequ);  SpectreSplitSystem(PermutationSequenceDraw p_sequ); Split get(Split s); Split set(int index, Split element); @Override boolean add(Split s); @Override void add(int index, Split s); @Override Split remove(int index); @Override boolean remove(Object o); @Override boolean equals(Object other); @Override int getNbTaxa(); @Override int getNbSplits(); @Override int getNbTrivialSplits(); @Override int getNbNonTrivialSplits(); @Override int getNbActiveWeightedSplits(); void setCircularOrdering(IdentifierList orderedTaxa); @Override IdentifierList getOrderedTaxa(); int getLastSplitIndex(); @Override Split removeLastSplit(); Split getLastSplit(); @Override boolean contains(Split split); @Override Split mergeSplits(int index1, int index2); @Override boolean isWeighted(); @Override double getWeightAt(int i); @Override SplitSystem filterByRelativeWeight(double percentThreshold); @Override SplitSystem filterByAbsoluteWeight(double minWeight); @Override void activateByWeight(double threshold); @Override SplitSystem makeCanonical(); @Override SplitSystem makeInducedOrdering(); @Override boolean isCircular(); @Override boolean isCompatible(); @Override boolean isCompatible(final int i, final int j); @Override Split.Compatible getCompatible(int i, int j); @Override boolean isFull(); @Override boolean isTaxonOnSameSide(int i, int j, int taxon); @Override boolean restrictionExists(int a, int b, int c, int d, int nr); @Override boolean[][] getAs2DBooleanArray(); @Override double[] getWeightsAsArray(); @Override void incTaxId(); @Override String toString(); }
SpectreSplitSystem extends ArrayList<Split> implements SplitSystem { @Override public SplitSystem makeCanonical() { List<Split> splits = new ArrayList<>(); for(Split s : this) { splits.add(s.makeCanonical()); } Collections.sort(splits); return new SpectreSplitSystem(this.orderedTaxa, splits); } SpectreSplitSystem(int nbTaxa, List<Split> splits);  SpectreSplitSystem(IdentifierList orderedTaxa);  SpectreSplitSystem(IdentifierList orderedTaxa, List<Split> splits);  SpectreSplitSystem(DistanceMatrix distanceMatrix);  SpectreSplitSystem(DistanceMatrix distanceMatrix, IdentifierList orderedTaxa);  SpectreSplitSystem(DistanceMatrix distanceMatrix, LeastSquaresCalculator calculator);  SpectreSplitSystem(DistanceMatrix distanceMatrix, IdentifierList circularOrdering, LeastSquaresCalculator calculator);  SpectreSplitSystem(DistanceMatrix distanceMatrix, IdentifierList circularOrdering, LeastSquaresCalculator calculator, List<Split> splits);  SpectreSplitSystem(SplitSystem splitSystem);  SpectreSplitSystem(SplitSystem unweightedSplitSystem, TreeSplitWeights treeWeights);  SpectreSplitSystem(PermutationSequence p_sequ);  SpectreSplitSystem(PermutationSequenceDraw p_sequ); Split get(Split s); Split set(int index, Split element); @Override boolean add(Split s); @Override void add(int index, Split s); @Override Split remove(int index); @Override boolean remove(Object o); @Override boolean equals(Object other); @Override int getNbTaxa(); @Override int getNbSplits(); @Override int getNbTrivialSplits(); @Override int getNbNonTrivialSplits(); @Override int getNbActiveWeightedSplits(); void setCircularOrdering(IdentifierList orderedTaxa); @Override IdentifierList getOrderedTaxa(); int getLastSplitIndex(); @Override Split removeLastSplit(); Split getLastSplit(); @Override boolean contains(Split split); @Override Split mergeSplits(int index1, int index2); @Override boolean isWeighted(); @Override double getWeightAt(int i); @Override SplitSystem filterByRelativeWeight(double percentThreshold); @Override SplitSystem filterByAbsoluteWeight(double minWeight); @Override void activateByWeight(double threshold); @Override SplitSystem makeCanonical(); @Override SplitSystem makeInducedOrdering(); @Override boolean isCircular(); @Override boolean isCompatible(); @Override boolean isCompatible(final int i, final int j); @Override Split.Compatible getCompatible(int i, int j); @Override boolean isFull(); @Override boolean isTaxonOnSameSide(int i, int j, int taxon); @Override boolean restrictionExists(int a, int b, int c, int d, int nr); @Override boolean[][] getAs2DBooleanArray(); @Override double[] getWeightsAsArray(); @Override void incTaxId(); @Override String toString();  }