git://source.jalview.org
/
jalview.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
JAL-2416 order score models by order of addition rather than name
[jalview.git]
/
src
/
jalview
/
datamodel
/
SequenceGroup.java
diff --git
a/src/jalview/datamodel/SequenceGroup.java
b/src/jalview/datamodel/SequenceGroup.java
index
8218ba7
..
4f9d530
100755
(executable)
--- a/
src/jalview/datamodel/SequenceGroup.java
+++ b/
src/jalview/datamodel/SequenceGroup.java
@@
-22,8
+22,8
@@
package jalview.datamodel;
import jalview.analysis.AAFrequency;
import jalview.analysis.Conservation;
import jalview.analysis.AAFrequency;
import jalview.analysis.Conservation;
-import jalview.schemes.CollectionColourScheme;
-import jalview.schemes.CollectionColourSchemeI;
+import jalview.renderer.ResidueShader;
+import jalview.renderer.ResidueShaderI;
import jalview.schemes.ColourSchemeI;
import java.awt.Color;
import jalview.schemes.ColourSchemeI;
import java.awt.Color;
@@
-71,7
+71,7
@@
public class SequenceGroup implements AnnotatedCollectionI
/**
* Colourscheme applied to group if any
*/
/**
* Colourscheme applied to group if any
*/
- public CollectionColourSchemeI cs;
+ public ResidueShaderI cs;
// start column (base 0)
int startRes = 0;
// start column (base 0)
int startRes = 0;
@@
-118,7
+118,7
@@
public class SequenceGroup implements AnnotatedCollectionI
public SequenceGroup()
{
groupName = "JGroup:" + this.hashCode();
public SequenceGroup()
{
groupName = "JGroup:" + this.hashCode();
- cs = new CollectionColourScheme();
+ cs = new ResidueShader();
}
/**
}
/**
@@
-145,7
+145,7
@@
public class SequenceGroup implements AnnotatedCollectionI
this.displayBoxes = displayBoxes;
this.displayText = displayText;
this.colourText = colourText;
this.displayBoxes = displayBoxes;
this.displayText = displayText;
this.colourText = colourText;
- this.cs = new CollectionColourScheme(scheme);
+ this.cs = new ResidueShader(scheme);
startRes = start;
endRes = end;
recalcConservation();
startRes = start;
endRes = end;
recalcConservation();
@@
-1347,13
+1347,25
@@
public class SequenceGroup implements AnnotatedCollectionI
private AnnotatedCollectionI context;
/**
private AnnotatedCollectionI context;
/**
- * set the alignment or group context for this group
+ * Sets the alignment or group context for this group
*
*
- * @param context
+ * @param ctx
+ * @throws IllegalArgumentException
+ * if setting the context would result in a circular reference chain
*/
*/
- public void setContext(AnnotatedCollectionI context)
+ public void setContext(AnnotatedCollectionI ctx)
{
{
- this.context = context;
+ AnnotatedCollectionI ref = ctx;
+ while (ref != null)
+ {
+ if (ref == this)
+ {
+ throw new IllegalArgumentException(
+ "Circular reference in SequenceGroup.context");
+ }
+ ref = ref.getContext();
+ }
+ this.context = ctx;
}
/*
}
/*
@@
-1371,12
+1383,12
@@
public class SequenceGroup implements AnnotatedCollectionI
{
if (cs == null)
{
{
if (cs == null)
{
- cs = new CollectionColourScheme();
+ cs = new ResidueShader();
}
cs.setColourScheme(scheme);
}
}
cs.setColourScheme(scheme);
}
- public void setGroupColourScheme(CollectionColourSchemeI scheme)
+ public void setGroupColourScheme(ResidueShaderI scheme)
{
cs = scheme;
}
{
cs = scheme;
}
@@
-1386,7
+1398,7
@@
public class SequenceGroup implements AnnotatedCollectionI
return cs == null ? null : cs.getColourScheme();
}
return cs == null ? null : cs.getColourScheme();
}
- public CollectionColourSchemeI getGroupColourScheme()
+ public ResidueShaderI getGroupColourScheme()
{
return cs;
}
{
return cs;
}
@@
-1394,9
+1406,8
@@
public class SequenceGroup implements AnnotatedCollectionI
@Override
public boolean isNucleotide()
{
@Override
public boolean isNucleotide()
{
- if (context != null && context instanceof AlignmentI)
- {
- return ((AlignmentI) context).isNucleotide();
+ if (context != null) {
+ return context.isNucleotide();
}
return false;
}
}
return false;
}