Skip to content

Commit

Permalink
merging dev to master
Browse files Browse the repository at this point in the history
  • Loading branch information
mguetlein committed Feb 20, 2015
2 parents f605428 + 99ea0b4 commit 318fe2f
Show file tree
Hide file tree
Showing 6 changed files with 170 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Expand Up @@ -6,3 +6,7 @@ toggle_submodule_symlink.sh
target
.classpath
.settings
<<<<<<< HEAD
=======
data
>>>>>>> dev
6 changes: 6 additions & 0 deletions pom.xml
Expand Up @@ -24,6 +24,12 @@
<manifest>
<mainClass>org.chesmapper.view.gui.LaunchCheSMapper</mainClass>
</manifest>
<<<<<<< HEAD
=======
<manifestEntries>
<Permissions>all-permissions</Permissions>
</manifestEntries>
>>>>>>> dev
</archive>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
Expand Down
75 changes: 75 additions & 0 deletions src/main/java/org/chesmapper/view/cluster/ClusteringValues.java
Expand Up @@ -45,13 +45,26 @@ void clear()
formattedSummarys.clear();
}

<<<<<<< HEAD
private synchronized void updateNormalizedNumericValues(final NumericProperty p)
=======
private synchronized Double[] updateNormalizedNumericSummary(final NumericProperty p)
>>>>>>> dev
{
Double d[] = new Double[clustering.getCompounds(true).size()];
int i = 0;
for (Compound m : clustering.getCompounds(true))
d[i++] = m.getDoubleValue(p);
summarys.put(p, DoubleArraySummary.create(d));
<<<<<<< HEAD
=======
return d;
}

private synchronized void updateNormalizedNumericValues(final NumericProperty p)
{
Double d[] = updateNormalizedNumericSummary(p);
>>>>>>> dev
Double valNorm[] = ArrayUtil.normalize(d, false);
Double valNormLog[] = ArrayUtil.normalizeLog(d, false);
specNumVals.put(p, ArrayUtil.toPrimitiveDoubleArray(ArrayUtil.removeNullValues(valNorm)));
Expand All @@ -65,7 +78,11 @@ private synchronized void updateNormalizedNumericValues(final NumericProperty p)
clusterVals.put(c, new ArrayList<Double>());
clusterValsLog.put(c, new ArrayList<Double>());
}
<<<<<<< HEAD
i = 0;
=======
int i = 0;
>>>>>>> dev
for (Compound m : clustering.getCompounds(true))
{
normalizedValues.put(m, p, valNorm[i]);
Expand Down Expand Up @@ -111,7 +128,11 @@ private synchronized double numericClusterSpec(CompoundGroupWithProperties c, Nu
{
if (!specificity.containsKeyPair(c, p))
{
<<<<<<< HEAD
if (!summarys.containsKey(p))
=======
if (!specNumVals.containsKey(p))
>>>>>>> dev
updateNormalizedNumericValues(p);
if (c.getNumCompounds() == 0)
specificity.put(c, p, CompoundPropertySpecificity.NO_SPEC_AVAILABLE);
Expand All @@ -129,7 +150,11 @@ private synchronized double numericCompoundSpec(Compound m, NumericProperty p)
{
if (!specificity.containsKeyPair(m, p))
{
<<<<<<< HEAD
if (!summarys.containsKey(p))
=======
if (!specNumVals.containsKey(p))
>>>>>>> dev
updateNormalizedNumericValues(p);
if (normalizedValues.get(m, p) == null)
specificity.put(m, p, CompoundPropertySpecificity.NO_SPEC_AVAILABLE);
Expand All @@ -146,7 +171,11 @@ private synchronized double numericCompoundSpec(Compound m, NumericProperty p)
HashMap<CompoundProperty, List<String>> specNomVals = new HashMap<CompoundProperty, List<String>>();
HashMap<CompoundProperty, long[]> specNomCounts = new HashMap<CompoundProperty, long[]>();

<<<<<<< HEAD
private synchronized void updateNormalizedNominalValues(final NominalProperty p)
=======
private synchronized CountedSet<String> updateNormalizedNominalSummary(final NominalProperty p)
>>>>>>> dev
{
String s[] = new String[clustering.getCompounds(true).size()];
int i = 0;
Expand All @@ -159,7 +188,16 @@ private synchronized void updateNormalizedNominalValues(final NominalProperty p)
fSet.rename(key, p.getFormattedValue(key));
fSet.setToBack(p.getFormattedNullValue());
formattedSummarys.put(p, fSet);
<<<<<<< HEAD

=======
return set;
}

private synchronized void updateNormalizedNominalValues(final NominalProperty p)
{
CountedSet<String> set = updateNormalizedNominalSummary(p);
>>>>>>> dev
specNomVals.put(p, set.values());
specNomCounts.put(p, CompoundPropertySpecificity.nominalCounts(specNomVals.get(p), set));
}
Expand All @@ -168,7 +206,11 @@ private synchronized double nominalClusterSpec(CompoundGroupWithProperties c, No
{
if (!specificity.containsKeyPair(c, p))
{
<<<<<<< HEAD
if (!summarys.containsKey(p))
=======
if (!specNomVals.containsKey(p))
>>>>>>> dev
updateNormalizedNominalValues(p);
if (c.getNumCompounds() == 0)
specificity.put(c, p, CompoundPropertySpecificity.NO_SPEC_AVAILABLE);
Expand All @@ -184,7 +226,11 @@ private synchronized double nominalCompoundSpec(Compound m, NominalProperty p)
{
if (!specificity.containsKeyPair(m, p))
{
<<<<<<< HEAD
if (!summarys.containsKey(p))
=======
if (!specNomVals.containsKey(p))
>>>>>>> dev
updateNormalizedNominalValues(p);
specificity.put(m, p, CompoundPropertySpecificity.nominalSpecificty(
CompoundPropertySpecificity.nominalCount(specNomVals.get(p), m.getStringValue(p)),
Expand All @@ -193,6 +239,17 @@ private synchronized double nominalCompoundSpec(Compound m, NominalProperty p)
return specificity.get(m, p);
}

<<<<<<< HEAD
=======
private void updateNormalizedSummary(CompoundProperty p)
{
if (p instanceof NumericProperty)
updateNormalizedNumericSummary((NumericProperty) p);
else
updateNormalizedNominalSummary((NominalProperty) p);
}

>>>>>>> dev
private void updateNormalizedValues(CompoundProperty p)
{
if (p instanceof NumericProperty)
Expand Down Expand Up @@ -228,7 +285,11 @@ public synchronized double getSpecificity(Compound m, CompoundProperty p)
public synchronized String getSummaryStringValue(CompoundProperty p, boolean html)
{
if (!summarys.containsKey(p))
<<<<<<< HEAD
updateNormalizedValues(p);
=======
updateNormalizedSummary(p);
>>>>>>> dev
if (p instanceof NominalProperty)
return formattedSummarys.get(p).toString(html);
else
Expand All @@ -237,9 +298,15 @@ public synchronized String getSummaryStringValue(CompoundProperty p, boolean htm

public synchronized void initFeatureNormalization()
{
<<<<<<< HEAD
@SuppressWarnings("unchecked")
List<CompoundProperty> props = ListUtil.concat(clustering.getProperties(), clustering.getFeatures());
TaskProvider.debug("Compute feature value statistics");
=======
TaskProvider.debug("Compute feature value statistics");
@SuppressWarnings("unchecked")
List<CompoundProperty> props = ListUtil.concat(clustering.getProperties(), clustering.getFeatures());
>>>>>>> dev
for (CompoundProperty p : props)
updateNormalizedValues(p);
}
Expand Down Expand Up @@ -270,15 +337,23 @@ public synchronized Double getNormalizedLogDoubleValue(CompoundPropertyOwner m,
public Double getDoubleValue(NumericProperty p)
{
if (!summarys.containsKey(p))
<<<<<<< HEAD
updateNormalizedValues(p);
=======
updateNormalizedSummary(p);
>>>>>>> dev
return ((DoubleArraySummary) summarys.get(p)).getMean();
}

@SuppressWarnings("unchecked")
public CountedSet<String> getNominalSummary(NominalProperty p)
{
if (!summarys.containsKey(p))
<<<<<<< HEAD
updateNormalizedValues(p);
=======
updateNormalizedSummary(p);
>>>>>>> dev
return (CountedSet<String>) summarys.get(p);
}
}
24 changes: 24 additions & 0 deletions src/main/java/org/chesmapper/view/gui/InfoPanel.java
Expand Up @@ -36,11 +36,18 @@
import org.chesmapper.view.cluster.Cluster;
import org.chesmapper.view.cluster.ClusterController;
import org.chesmapper.view.cluster.Clustering;
<<<<<<< HEAD
=======
import org.chesmapper.view.cluster.Clustering.SelectionListener;
>>>>>>> dev
import org.chesmapper.view.cluster.ClusteringImpl;
import org.chesmapper.view.cluster.Compound;
import org.chesmapper.view.cluster.CompoundSelection;
import org.chesmapper.view.cluster.SALIProperty;
<<<<<<< HEAD
import org.chesmapper.view.cluster.Clustering.SelectionListener;
=======
>>>>>>> dev
import org.chesmapper.view.gui.ViewControler.FeatureFilter;
import org.chesmapper.view.gui.ViewControler.Style;
import org.chesmapper.view.gui.swing.ComponentFactory;
Expand All @@ -50,10 +57,17 @@
import org.mg.javalib.gui.MultiImageIcon.Layout;
import org.mg.javalib.gui.MultiImageIcon.Orientation;
import org.mg.javalib.util.ImageLoader;
<<<<<<< HEAD
import org.mg.javalib.util.ListUtil;
import org.mg.javalib.util.SwingUtil;
import org.mg.javalib.util.ThreadUtil;
import org.mg.javalib.util.ImageLoader.Image;
=======
import org.mg.javalib.util.ImageLoader.Image;
import org.mg.javalib.util.ListUtil;
import org.mg.javalib.util.SwingUtil;
import org.mg.javalib.util.ThreadUtil;
>>>>>>> dev

public class InfoPanel extends JPanel
{
Expand Down Expand Up @@ -424,12 +438,22 @@ else if (column == 1 && table.getValueAt(row, 0) == FEATURES_ROW)
else if (column == 1 && table.getValueAt(row, 0) instanceof CompoundProperty)
{
c.setFont(c.getFont().deriveFont(Font.ITALIC));
<<<<<<< HEAD
if (isSelected == false)// && !(selected instanceof Clustering))
{
Color col = viewControler.getHighlightColor(selected,
(CompoundProperty) table.getValueAt(row, 0), true);
setForeground(col);
}
=======
if (!notPainting)
if (isSelected == false)// && !(selected instanceof Clustering))
{
Color col = viewControler.getHighlightColor(selected,
(CompoundProperty) table.getValueAt(row, 0), true);
setForeground(col);
}
>>>>>>> dev
}
return c;
};
Expand Down
19 changes: 19 additions & 0 deletions src/main/java/org/chesmapper/view/gui/MainPanel.java
Expand Up @@ -30,12 +30,19 @@
import org.chesmapper.map.dataInterface.CompoundProperty;
import org.chesmapper.map.dataInterface.CompoundPropertyOwner;
import org.chesmapper.map.dataInterface.CompoundPropertyUtil;
<<<<<<< HEAD
=======
import org.chesmapper.map.dataInterface.CompoundPropertyUtil.NominalColoring;
>>>>>>> dev
import org.chesmapper.map.dataInterface.FragmentProperty;
import org.chesmapper.map.dataInterface.NominalProperty;
import org.chesmapper.map.dataInterface.NumericProperty;
import org.chesmapper.map.dataInterface.SingleCompoundPropertyOwner;
import org.chesmapper.map.dataInterface.SubstructureSmartsType;
<<<<<<< HEAD
import org.chesmapper.map.dataInterface.CompoundPropertyUtil.NominalColoring;
=======
>>>>>>> dev
import org.chesmapper.map.gui.CheSMapperWizard;
import org.chesmapper.map.main.ScreenSetup;
import org.chesmapper.map.main.Settings;
Expand Down Expand Up @@ -1206,7 +1213,14 @@ public void init(ClusteringData clusteredDataset)
if (clustering.numClusters() > 0)
throw new IllegalStateException("only done once at the start");
clustering.newClustering(clusteredDataset);
<<<<<<< HEAD
clustering.initFeatureNormalization();
=======
if (clustering.isBigDataMode())
featureSortingEnabled = false;
if (featureSortingEnabled)
clustering.initFeatureNormalization();
>>>>>>> dev

clustering.getClusterActive().addListenerFirst(new PropertyChangeListener()
{
Expand Down Expand Up @@ -2804,7 +2818,12 @@ public void run()
d.setCheSMappingWarningOwner(taskDialog);
guiControler.unblockMessages();
clustering.newClustering(d);
<<<<<<< HEAD
clustering.initFeatureNormalization();
=======
if (featureSortingEnabled)
clustering.initFeatureNormalization();
>>>>>>> dev
task.finish();
}
TaskProvider.removeTask();
Expand Down
42 changes: 42 additions & 0 deletions src/main/java/org/chesmapper/view/gui/swing/ComponentFactory.java
Expand Up @@ -441,17 +441,30 @@ protected void configurePopup()
public static class FactoryTableCellRenderer extends DefaultTableCellRenderer
{
boolean halfTransparent;
<<<<<<< HEAD
=======
protected boolean notPainting = false;
>>>>>>> dev

public FactoryTableCellRenderer(boolean halfTransparent)
{
this.halfTransparent = halfTransparent;
}

<<<<<<< HEAD
=======
public void setNotPainting(boolean notPainting)
{
this.notPainting = notPainting;
}

>>>>>>> dev
@Override
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected,
boolean hasFocus, int row, int column)
{
super.getTableCellRendererComponent(table, value, isSelected, false, row, column);
<<<<<<< HEAD
if (isSelected)
{
setBackground(LIST_ACTIVE_BACKGROUND);
Expand All @@ -469,6 +482,26 @@ public Component getTableCellRendererComponent(JTable table, Object value, boole
setOpaque(false);
setForeground(FOREGROUND);
}
=======
if (!notPainting)
if (isSelected)
{
setBackground(LIST_ACTIVE_BACKGROUND);
setOpaque(true);
setForeground(LIST_SELECTION_FOREGROUND);
}
else
{
if (halfTransparent)
{
setBackground(new Color(BACKGROUND.getRed(), BACKGROUND.getGreen(), BACKGROUND.getBlue(), 100));
setOpaque(true);
}
else
setOpaque(false);
setForeground(FOREGROUND);
}
>>>>>>> dev
return this;
}
}
Expand Down Expand Up @@ -537,8 +570,17 @@ public static int packColumn(JTable table, int vColIndex, int margin, int max, b
for (int r = 0; r < table.getRowCount(); r++)
{
renderer = table.getCellRenderer(r, vColIndex);
<<<<<<< HEAD
comp = renderer.getTableCellRendererComponent(table, table.getValueAt(r, vColIndex), false, false, r,
vColIndex);
=======
if (renderer instanceof FactoryTableCellRenderer)
((FactoryTableCellRenderer) renderer).setNotPainting(true);
comp = renderer.getTableCellRendererComponent(table, table.getValueAt(r, vColIndex), false, false, r,
vColIndex);
if (renderer instanceof FactoryTableCellRenderer)
((FactoryTableCellRenderer) renderer).setNotPainting(false);
>>>>>>> dev
width = Math.max(width, comp.getPreferredSize().width);
}

Expand Down

0 comments on commit 318fe2f

Please sign in to comment.