diff --git a/src/bdsky/MultiSkyline.java b/src/bdsky/MultiSkyline.java index cf712ea..e8ab759 100644 --- a/src/bdsky/MultiSkyline.java +++ b/src/bdsky/MultiSkyline.java @@ -3,10 +3,7 @@ import beast.core.CalculationNode; import beast.core.Input; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.List; +import java.util.*; /** * A multiskyline made up of simple skylines. @@ -17,10 +14,14 @@ public class MultiSkyline extends CalculationNode implements Skyline { public Input> skylineInput = new Input<>("skyline", "the simple skylines making up this multiple skyline", new ArrayList<>()); public MultiSkyline(SimpleSkyline... skyline) { - try { - initByName("skyline", Arrays.asList(skyline)); - } catch (Exception e) { - throw new RuntimeException(e); + if (skyline.length > 0) { + try { + initByName("skyline", Arrays.asList(skyline)); + } catch (Exception e) { + throw new RuntimeException(e); + } + } else { + throw new IllegalArgumentException("The multiple skyline cannot be the empty list of simple skylines !"); } } diff --git a/src/test/bdsky/MultiSkylineTest.java b/src/test/bdsky/MultiSkylineTest.java index a4a74fa..2eac322 100644 --- a/src/test/bdsky/MultiSkylineTest.java +++ b/src/test/bdsky/MultiSkylineTest.java @@ -32,7 +32,7 @@ public void testGetValue() throws Exception { MultiSkyline multiSkyline = new MultiSkyline(simpleSkylines.toArray(new SimpleSkyline[0])); // multiSkyline.skylineInput.setValue(simpleSkylines,multiSkyline); - multiSkyline.initAndValidate(); +// multiSkyline.initAndValidate(); assertEquals(2, multiSkyline.getDimension());