From: <tea...@us...> - 2007-07-30 17:25:22
|
Revision: 443 http://cishell.svn.sourceforge.net/cishell/?rev=443&view=rev Author: teakettle22 Date: 2007-07-30 10:25:19 -0700 (Mon, 30 Jul 2007) Log Message: ----------- getTestGraph(String), getTestGraphs() Modified Paths: -------------- trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/converter/graph/ConverterGraph.java trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/converter/graph/ConverterPath.java Modified: trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/converter/graph/ConverterGraph.java =================================================================== --- trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/converter/graph/ConverterGraph.java 2007-07-30 17:12:48 UTC (rev 442) +++ trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/converter/graph/ConverterGraph.java 2007-07-30 17:25:19 UTC (rev 443) @@ -201,10 +201,23 @@ return str.toString(); } - public ArrayList getCompareGraph(String s){ - return (ArrayList)this.fileExtensionCompareConverters.get(s); + public ArrayList getTestGraph(String s){ + return (ArrayList)this.fileExtensionTestConverters.get(s); } + public ArrayList getTestGraphs(){ + String[] fileExtensions = (String[])this.fileExtensionTestConverters.keySet().toArray(); + ArrayList graphs = new ArrayList(); + for(int i = 0; i < fileExtensions.length; i++){ + graphs.add(getTestGraph(fileExtensions[i])); + } + return graphs; + } + + public ConverterPath getCompareGraph(String s){ + return (ConverterPath)this.fileExtensionCompareConverters.get(s); + } + public ArrayList getCompareGraphs(){ String[] fileExtensions = (String[])this.fileExtensionCompareConverters.keySet().toArray(); ArrayList graphs = new ArrayList(); @@ -213,5 +226,4 @@ } return graphs; } - } \ No newline at end of file Modified: trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/converter/graph/ConverterPath.java =================================================================== --- trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/converter/graph/ConverterPath.java 2007-07-30 17:12:48 UTC (rev 442) +++ trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/converter/graph/ConverterPath.java 2007-07-30 17:25:19 UTC (rev 443) @@ -56,6 +56,10 @@ return this.path; } + public ServiceReference[] pathAsArray(){ + return (ServiceReference[])this.path.toArray(); + } + public String toString(){ String val = this.in_data +" -->\n"; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mwl...@us...> - 2007-08-01 17:06:31
|
Revision: 451 http://cishell.svn.sourceforge.net/cishell/?rev=451&view=rev Author: mwlinnem Date: 2007-08-01 09:57:10 -0700 (Wed, 01 Aug 2007) Log Message: ----------- Fixed .toArray calls to work correctly. Modified Paths: -------------- trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/converter/graph/ConverterGraph.java trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/converter/graph/ConverterPath.java Modified: trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/converter/graph/ConverterGraph.java =================================================================== --- trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/converter/graph/ConverterGraph.java 2007-08-01 16:47:06 UTC (rev 450) +++ trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/converter/graph/ConverterGraph.java 2007-08-01 16:57:10 UTC (rev 451) @@ -211,16 +211,17 @@ } public ConverterPath[] getTestPath(String s){ - return (ConverterPath[])((ArrayList)this.fileExtensionTestConverters.get(s)).toArray(); + return (ConverterPath[])((ArrayList)this.fileExtensionTestConverters.get(s)).toArray(new ConverterPath[0]); } public ConverterPath[][] getTestPaths(){ - String[] fileExtensions = (String[])this.fileExtensionTestConverters.keySet().toArray(); + String[] fileExtensions = (String[])this.fileExtensionTestConverters.keySet().toArray(new String[0]); ArrayList graphs = new ArrayList(); for(int i = 0; i < fileExtensions.length; i++){ graphs.add(getTestPath(fileExtensions[i])); } - return (ConverterPath[][])graphs.toArray(); + //this line may be busted + return (ConverterPath[][])graphs.toArray(new ConverterPath[0][]); } public ConverterPath getComparePath(String s){ @@ -228,12 +229,12 @@ } public ConverterPath[] getComparePaths(){ - String[] fileExtensions = (String[])this.fileExtensionCompareConverters.keySet().toArray(); + String[] fileExtensions = (String[])this.fileExtensionCompareConverters.keySet().toArray(new String[0]); ArrayList graphs = new ArrayList(); for(int i = 0; i < fileExtensions.length; i++){ graphs.add(getComparePath(fileExtensions[i])); } - return (ConverterPath[])graphs.toArray(); + return (ConverterPath[])graphs.toArray(new ConverterPath[0]); } public File asNWB(){ Modified: trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/converter/graph/ConverterPath.java =================================================================== --- trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/converter/graph/ConverterPath.java 2007-08-01 16:47:06 UTC (rev 450) +++ trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/converter/graph/ConverterPath.java 2007-08-01 16:57:10 UTC (rev 451) @@ -56,8 +56,8 @@ return this.path; } - public ServiceReference[] pathAsArray(){ - return (ServiceReference[])this.path.toArray(); + public ServiceReference[] getPathAsArray(){ + return (ServiceReference[])this.path.toArray(new ServiceReference[0]); } public String toString(){ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mwl...@us...> - 2007-08-06 20:38:10
|
Revision: 464 http://cishell.svn.sourceforge.net/cishell/?rev=464&view=rev Author: mwlinnem Date: 2007-08-06 13:37:40 -0700 (Mon, 06 Aug 2007) Log Message: ----------- Fixed typo. Modified Paths: -------------- trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/converter/graph/ConverterGraph.java trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/converter/graph/ConverterPath.java Modified: trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/converter/graph/ConverterGraph.java =================================================================== --- trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/converter/graph/ConverterGraph.java 2007-08-06 20:17:28 UTC (rev 463) +++ trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/converter/graph/ConverterGraph.java 2007-08-06 20:37:40 UTC (rev 464) @@ -76,7 +76,7 @@ } while(!refs.isEmpty()){ ConverterPath p = new ConverterPath(path); - p.addAlgoritm((ServiceReference)refs.get(0)); + p.addAlgorithm((ServiceReference)refs.get(0)); refs.remove(0); createPaths((ArrayList)this.inDataToAlgorithm.get(p.getOutData()), p, p.getOutData()); Modified: trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/converter/graph/ConverterPath.java =================================================================== --- trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/converter/graph/ConverterPath.java 2007-08-06 20:17:28 UTC (rev 463) +++ trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/converter/graph/ConverterPath.java 2007-08-06 20:37:40 UTC (rev 464) @@ -30,7 +30,7 @@ this.out_data = s; } - public boolean addAlgoritm(ServiceReference sr){ + public boolean addAlgorithm(ServiceReference sr){ boolean val = true; if(path.contains(sr)){ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mwl...@us...> - 2007-08-09 19:13:35
|
Revision: 465 http://cishell.svn.sourceforge.net/cishell/?rev=465&view=rev Author: mwlinnem Date: 2007-08-09 12:13:21 -0700 (Thu, 09 Aug 2007) Log Message: ----------- Added a bunch of extra functionality used in the main part of the Converter Tester. Modified Paths: -------------- trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/converter/graph/ConverterGraph.java trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/converter/graph/ConverterPath.java Modified: trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/converter/graph/ConverterGraph.java =================================================================== --- trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/converter/graph/ConverterGraph.java 2007-08-06 20:37:40 UTC (rev 464) +++ trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/converter/graph/ConverterGraph.java 2007-08-09 19:13:21 UTC (rev 465) @@ -10,6 +10,7 @@ import java.util.TreeSet; import java.util.concurrent.ConcurrentHashMap; +import org.osgi.framework.BundleContext; import org.osgi.framework.ServiceReference; public class ConverterGraph { @@ -18,10 +19,12 @@ Map fileExtensionTestConverters; Map fileExtensionCompareConverters; ServiceReference[] converters; + BundleContext bContext; private static final String testOutData = "prefuse.data.Graph"; - public ConverterGraph(ServiceReference[] converters){ + public ConverterGraph(ServiceReference[] converters, BundleContext bContext){ this.converters = converters; + this.bContext = bContext; inDataToAlgorithm = new HashMap();//<String, ArrayList<ServiceReference>>(); fileExtensionTestConverters = new ConcurrentHashMap();//<String, ArrayList<ConverterPath>>(); fileExtensionCompareConverters = new ConcurrentHashMap();//<String, ConverterPath>(); @@ -55,7 +58,7 @@ if(s.startsWith("file-ext")){ - ConverterPath test = new ConverterPath(); + ConverterPath test = new ConverterPath(this.bContext); test.setInData(s); @@ -75,7 +78,7 @@ return path; } while(!refs.isEmpty()){ - ConverterPath p = new ConverterPath(path); + ConverterPath p = new ConverterPath(path, this.bContext); p.addAlgorithm((ServiceReference)refs.get(0)); refs.remove(0); createPaths((ArrayList)this.inDataToAlgorithm.get(p.getOutData()), p, p.getOutData()); @@ -100,14 +103,14 @@ if(this.fileExtensionCompareConverters.get(key) == null){ - this.fileExtensionCompareConverters.put(key, new ConverterPath(cp)); + this.fileExtensionCompareConverters.put(key, new ConverterPath(cp, this.bContext)); } else { ConverterPath tempPath = (ConverterPath)this.fileExtensionCompareConverters.get(key); int pathSize = tempPath.getPath().size(); if(pathSize > cp.getPath().size()){ - this.fileExtensionCompareConverters.put(key, new ConverterPath(cp)); + this.fileExtensionCompareConverters.put(key, new ConverterPath(cp, this.bContext)); } } } Modified: trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/converter/graph/ConverterPath.java =================================================================== --- trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/converter/graph/ConverterPath.java 2007-08-06 20:37:40 UTC (rev 464) +++ trunk/testing/org.cishell.testing.convertertester.core.new/src/org/cishell/testing/convertertester/core/converter/graph/ConverterPath.java 2007-08-09 19:13:21 UTC (rev 465) @@ -3,18 +3,28 @@ import java.util.ArrayList; import java.util.List; +import org.cishell.framework.algorithm.AlgorithmFactory; +import org.cishell.framework.algorithm.AlgorithmProperty; +import org.osgi.framework.BundleContext; import org.osgi.framework.ServiceReference; -public class ConverterPath { - String in_data; - String out_data = null; - ArrayList path; +public class ConverterPath implements AlgorithmProperty { + private String in_data; + private String out_data = null; + private ArrayList path; + private BundleContext bContext; - public ConverterPath(){ + boolean algPathCached = false; + ArrayList algPath; + + public ConverterPath(BundleContext bContext){ + this.bContext = bContext; path = new ArrayList(); } - public ConverterPath(ConverterPath p){ + public ConverterPath(ConverterPath p, BundleContext bContext) { + this.bContext = bContext; + in_data = p.getInData(); out_data = p.getOutData(); @@ -23,14 +33,17 @@ } public void setInData(String s){ + this.in_data = s; } public void setOutData(String s){ + this.out_data = s; } public boolean addAlgorithm(ServiceReference sr){ + boolean val = true; if(path.contains(sr)){ @@ -39,28 +52,53 @@ return false; } + path.add(sr); + invalidateAlgPath(); this.setOutData(sr.getProperty("out_data").toString()); return val; } public String getInData(){ + return this.in_data; } public String getOutData(){ + return this.out_data; } public List getPath(){ + return this.path; } + public ServiceReference getRef(int index) { + + return (ServiceReference) this.path.get(index); + } + + public AlgorithmFactory getAlg(int index) { + + if (! algPathCached) cacheAlgPath(); + return (AlgorithmFactory) this.algPath.get(index); + } + public ServiceReference[] getPathAsArray(){ + return (ServiceReference[])this.path.toArray(new ServiceReference[0]); } + public AlgorithmFactory[] getPathAsAlgorithms(){ + + if (! algPathCached) cacheAlgPath(); + + return (AlgorithmFactory[]) this.algPath.toArray(new AlgorithmFactory[0]); + } + public String toString(){ + String val = this.in_data +" -->\n"; for(int i = 0; i < this.path.size(); i++){ @@ -70,5 +108,70 @@ val += "--> " + this.out_data + "\n"; return val; } + + public boolean isLossy() { + String lossiness = LOSSLESS; + for (int i = 0; i < this.path.size(); i++) { + ServiceReference sr = (ServiceReference) this.path.get(i); + + if (LOSSY.equals(sr.getProperty(CONVERSION))) { + lossiness = LOSSY; + } + } + + boolean result = lossiness.equals(LOSSY); + return result; + } + + public boolean preservesIDs() { + + //TODO: Determine this somehow. + return false; + } + + + public ConverterPath appendNonMutating(ConverterPath otherPath) { + + List thisConvPath = this.path; + List otherConvPath = otherPath.getPath(); + + List thisConvPathCopy = new ArrayList(thisConvPath); + thisConvPathCopy.addAll(otherConvPath); + ConverterPath combinedPath = new ConverterPath(this.bContext); + + List combinedConvPath = thisConvPathCopy; + for (int ii = 0; ii < combinedConvPath.size(); ii++) { + ServiceReference sr = (ServiceReference) combinedConvPath.get(ii); + + combinedPath.addAlgorithm(sr); + } + + return combinedPath; + } + + public int size() { + + return this.path.size(); + } + + + private void cacheAlgPath() { + this.algPath = new ArrayList(); + + for (int i = 0; i < this.path.size(); i++){ + ServiceReference sr = (ServiceReference)this.path.get(i); + + AlgorithmFactory alg = (AlgorithmFactory) this.bContext.getService(sr); + this.algPath.add(alg); + } + + this.algPathCached = true; + } + + private void invalidateAlgPath() { + + this.algPathCached = false; + } + } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |