From: gmungoc Date: Wed, 21 Dec 2016 16:00:29 +0000 (+0000) Subject: JAL-2360 simplified code to create a new colour scheme X-Git-Tag: Release_2_10_3b1~357^2~33 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=3391b85e3b7f09378e913dc1bb48ab3ca70c5f1a;p=jalview.git JAL-2360 simplified code to create a new colour scheme --- diff --git a/test/jalview/schemes/ColourSchemesTest.java b/test/jalview/schemes/ColourSchemesTest.java index e44ed71..f7f0a0c 100644 --- a/test/jalview/schemes/ColourSchemesTest.java +++ b/test/jalview/schemes/ColourSchemesTest.java @@ -33,46 +33,52 @@ public class ColourSchemesTest */ class Stripy extends ResidueColourScheme { + private ColourSchemeI odd; + + private ColourSchemeI even; + + private Stripy() + { + } + + /** + * constructor given colours for odd and even columns + * + * @param odd + * @param even + */ + private Stripy(ColourSchemeI cs1, ColourSchemeI cs2) + { + odd = cs1; + even = cs2; + } + @Override public ColourSchemeI getInstance(AnnotatedCollectionI sg, Map hiddenRepSequences) { - final ColourSchemeI odd = ColourSchemes.getInstance() + final ColourSchemeI cs1 = ColourSchemes.getInstance() .getColourScheme(JalviewColourScheme.Taylor.toString(), (AnnotatedCollectionI) null); - final ColourSchemeI even = ColourSchemes.getInstance() + final ColourSchemeI cs2 = ColourSchemes.getInstance() .getColourScheme(JalviewColourScheme.Zappo.toString(), (AnnotatedCollectionI) null); - return new ResidueColourScheme() { - @Override - public Color findColour(char c, int j, SequenceI seq) - { - if (j % 2 == 1) - { - return odd.findColour(c, j, seq); - } - else - { - return even.findColour(c, j, seq); - } - } - - @Override - public ColourSchemeI getInstance(AnnotatedCollectionI ac, - Map hrs) - { - return null; - } + return new Stripy(cs1, cs2); + } - @Override - public String getSchemeName() - { - return Stripy.this.getSchemeName(); - } - - }; + @Override + public Color findColour(char c, int j, SequenceI seq) + { + if (j % 2 == 1) + { + return odd.findColour(c, j, seq); + } + else + { + return even.findColour(c, j, seq); + } } - + @Override public String getSchemeName() { @@ -87,11 +93,11 @@ public class ColourSchemesTest { ColourSchemeI delegate; - public MyClustal() + private MyClustal() { } - public MyClustal(ColourSchemeI scheme) + private MyClustal(ColourSchemeI scheme) { delegate = scheme; }