X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fviewmodel%2Fseqfeatures%2FFeatureRendererModel.java;h=fdd40e4b158518d8d05a8054a7c75971cebec157;hb=9876fdccf311378e690c1f9e18db52675d427b89;hp=a53004d6aab18f6378f44e801aacbc45d46c0d68;hpb=1f491c8c9e66b3accb8bb9eae78c7d9caa63c1ac;p=jalview.git
diff --git a/src/jalview/viewmodel/seqfeatures/FeatureRendererModel.java b/src/jalview/viewmodel/seqfeatures/FeatureRendererModel.java
index a53004d..fdd40e4 100644
--- a/src/jalview/viewmodel/seqfeatures/FeatureRendererModel.java
+++ b/src/jalview/viewmodel/seqfeatures/FeatureRendererModel.java
@@ -1,3 +1,23 @@
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9)
+ * Copyright (C) 2015 The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see .
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
package jalview.viewmodel.seqfeatures;
import jalview.api.AlignViewportI;
@@ -14,13 +34,11 @@ import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
import java.util.ArrayList;
import java.util.Arrays;
-import java.util.Enumeration;
import java.util.Hashtable;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
-import java.util.Vector;
import java.util.concurrent.ConcurrentHashMap;
public abstract class FeatureRendererModel implements
@@ -121,8 +139,7 @@ public abstract class FeatureRendererModel implements
}
if (!fdi.isRegistered(featureType))
{
- pushFeatureType(Arrays.asList(new String[]
- { featureType }));
+ pushFeatureType(Arrays.asList(new String[] { featureType }));
}
fdi.setVisible(featureType);
}
@@ -165,7 +182,7 @@ public abstract class FeatureRendererModel implements
types.toArray(neworder);
if (renderOrder != null)
{
- System.arraycopy(neworder,0,neworder,renderOrder.length,ts);
+ System.arraycopy(neworder, 0, neworder, renderOrder.length, ts);
System.arraycopy(renderOrder, 0, neworder, 0, renderOrder.length);
}
renderOrder = neworder;
@@ -188,8 +205,7 @@ public abstract class FeatureRendererModel implements
protected final byte[] normaliseScore(SequenceFeature sequenceFeature)
{
float[] mm = ((float[][]) minmax.get(sequenceFeature.type))[0];
- final byte[] r = new byte[]
- { 0, (byte) 255 };
+ final byte[] r = new byte[] { 0, (byte) 255 };
if (mm != null)
{
if (r[0] != 0 || mm[0] < 0.0)
@@ -248,11 +264,12 @@ public abstract class FeatureRendererModel implements
{
ArrayList tmp = new ArrayList();
SequenceFeature[] features = sequence.getSequenceFeatures();
+
if (features != null)
{
for (int i = 0; i < features.length; i++)
{
- if (av.areFeaturesDisplayed()
+ if (!av.areFeaturesDisplayed()
|| !av.getFeaturesDisplayed().isVisible(
features[i].getType()))
{
@@ -262,9 +279,11 @@ public abstract class FeatureRendererModel implements
if (features[i].featureGroup != null
&& featureGroups != null
&& featureGroups.containsKey(features[i].featureGroup)
- && !((Boolean) featureGroups.get(features[i].featureGroup))
+ && !featureGroups.get(features[i].featureGroup)
.booleanValue())
+ {
continue;
+ }
if ((features[i].getBegin() <= res)
&& (features[i].getEnd() >= res))
@@ -322,9 +341,7 @@ public abstract class FeatureRendererModel implements
for (int i = 0; i < alignment.getHeight(); i++)
{
SequenceI asq = alignment.getSequenceAt(i);
- SequenceI dasq = asq.getDatasetSequence();
- SequenceFeature[] features = dasq != null ? dasq
- .getSequenceFeatures() : asq.getSequenceFeatures();
+ SequenceFeature[] features = asq.getSequenceFeatures();
if (features == null)
{
@@ -345,7 +362,7 @@ public abstract class FeatureRendererModel implements
groupDisplayed = Boolean.valueOf(newMadeVisible);
featureGroups.put(fgrp, groupDisplayed);
}
- if (!((Boolean) groupDisplayed).booleanValue())
+ if (!groupDisplayed.booleanValue())
{
index++;
continue;
@@ -370,20 +387,19 @@ public abstract class FeatureRendererModel implements
{
allfeatures.add(features[index].getType());
}
- if (features[index].score != Float.NaN)
+ if (!Float.isNaN(features[index].score))
{
int nonpos = features[index].getBegin() >= 1 ? 0 : 1;
float[][] mm = (float[][]) minmax.get(features[index].getType());
if (mm == null)
{
- mm = new float[][]
- { null, null };
+ mm = new float[][] { null, null };
minmax.put(features[index].getType(), mm);
}
if (mm[nonpos] == null)
{
- mm[nonpos] = new float[]
- { features[index].score, features[index].score };
+ mm[nonpos] = new float[] { features[index].score,
+ features[index].score };
}
else
@@ -434,8 +450,7 @@ public abstract class FeatureRendererModel implements
{
if (initOrders)
{
- setOrder(oldRender[j], (1 - (1 + (float) j)
- / (float) oldRender.length));
+ setOrder(oldRender[j], (1 - (1 + (float) j) / oldRender.length));
}
if (allfeatures.contains(oldRender[j]))
{
@@ -666,9 +681,9 @@ public abstract class FeatureRendererModel implements
}
@Override
- public Map getFeatureColours()
+ public Map getFeatureColours()
{
- return new ConcurrentHashMap<>(featureColours);
+ return new ConcurrentHashMap(featureColours);
}
/**
@@ -771,8 +786,7 @@ public abstract class FeatureRendererModel implements
{
if (renderOrder == null)
{
- return Arrays.asList(new String[]
- {});
+ return Arrays.asList(new String[] {});
}
return Arrays.asList(renderOrder);
}
@@ -799,7 +813,7 @@ public abstract class FeatureRendererModel implements
}
if (featureGroups.containsKey(group))
{
- return ((Boolean) featureGroups.get(group)).booleanValue();
+ return featureGroups.get(group).booleanValue();
}
if (newGroupsVisible)
{
@@ -825,7 +839,7 @@ public abstract class FeatureRendererModel implements
for (Object grp : featureGroups.keySet())
{
- Boolean state = (Boolean) featureGroups.get(grp);
+ Boolean state = featureGroups.get(grp);
if (state.booleanValue() == visible)
{
gp.add(grp);
@@ -854,7 +868,7 @@ public abstract class FeatureRendererModel implements
featureGroups.put(gst, new Boolean(visible));
if (st != null)
{
- rdrw = rdrw || (visible != ((Boolean) st).booleanValue());
+ rdrw = rdrw || (visible != st.booleanValue());
}
}
if (rdrw)
@@ -900,7 +914,7 @@ public abstract class FeatureRendererModel implements
{
for (int i = 0; i < typ.length; i++)
{
- if (feature_disp.isVisible(typ[i]))
+ if (!feature_disp.isVisible(typ[i]))
{
typ[i] = null;
}