List of usage examples for java.util TreeSet toArray
<T> T[] toArray(T[] a);
From source file:org.dasein.cloud.util.APITrace.java
static public String[] listAccounts(@Nonnull String provider, @Nonnull String cloud) { provider = provider.replaceAll(DELIMITER_REGEX, "_"); cloud = cloud.replaceAll(DELIMITER_REGEX, "_"); TreeSet<String> list = new TreeSet<String>(); synchronized (apiCount) { for (String call : apiCount.keySet()) { String[] parts = call.split(DELIMITER_REGEX); if (parts.length > 2 && parts[0].equals(provider) && parts[1].equals(cloud)) { list.add(parts[2]);/*from w w w. j a va 2 s .co m*/ } } } return list.toArray(new String[list.size()]); }
From source file:org.ebayopensource.turmeric.eclipse.typelibrary.ui.wst.ImportTypeFromTypeLibrary.java
/** * In-line the selected types to the target definition object. Updates the * type dependency XML file, then modifies the project dependency. If it is * single name space WSDL then the information about the type library and * name space are added to the WSDL as annotation. In addition to this we * add it to the type dependency file also. If it is a multiple name space * we only add it to the type dependency file. When in-lining types in the * WSDL the dependent types are also found out and in-lined to form a stand * alone WSDL.//from w w w . j a va2s .c o m * * @param definition the definition * @param selectedTypes the selected types * @param selectedFile the selected file * @throws Exception the exception */ public static void performInlineOperationsForWSDLEditor(Definition definition, LibraryType selectedTypes[], IFile selectedFile) throws Exception { WorkspaceUtil.refresh(selectedFile); IProject project = selectedFile.getProject(); if (definition == null || (definition instanceof Definition) == false) { showCommonErrorDialog(null); return; } TreeSet<LibraryType> librarySet = new TreeSet<LibraryType>(new LibraryTypeComparator()); // TreeSet<LibraryType> selectedTypesSet = new TreeSet<LibraryType>( // new LibraryTypeComparator()); // finding out all the dependent types for in-lining. SOATypeRegistry typeRegistry = SOAGlobalRegistryAdapter.getInstance().getGlobalRegistry(); for (LibraryType selectedType : selectedTypes) { librarySet.add(selectedType); // selectedTypesSet.add(selectedType); for (LibraryType libraryType : typeRegistry.getDependentParentTypeFiles(selectedType)) { librarySet.add(libraryType); } } XSDSchemaValidationUtil.validateType(project, librarySet.toArray(new LibraryType[0])); boolean typeFolding = SOAServiceUtil.getSOAIntfMetadata(SOAServiceUtil.getSOAEclipseMetadata(project)) .getTypeFolding(); final List<IStatus> statuses = new ArrayList<IStatus>(); for (LibraryType selectedType : librarySet) { IStatus result = WTPTypeLibUtil.inlineType(selectedType, definition, true, typeFolding); if (result.getSeverity() == IStatus.ERROR) { statuses.add(result); } else if (result.isOK() == false) { SOALogger.getLogger().debug(result.getMessage()); } } // Modify TypeDep.xml SynchronizeWsdlAndDepXML synch = new SynchronizeWsdlAndDepXML(project); synch.syncronizeWSDLandDepXml(definition); synch.synchronizeTypeDepandProjectDep(ProgressUtil.getDefaultMonitor(null)); TypeLibSynhcronizer.updateVersionEntryTypeDep(GlobalRepositorySystem.instanceOf() .getActiveRepositorySystem().getTypeRegistryBridge().getTypeDependencyWsdlTypeName(), librarySet, project); WorkspaceUtil.refresh(project); if (statuses.size() > 0) { IStatus results = EclipseMessageUtils.createErrorMultiStatusBasedOnChildrenSeverity(statuses, "Inline Type operation results"); UIUtil.showErrorDialog(UIUtil.getActiveShell(), "Inline Type Results", results); } else { IStatusLineManager lineManager = UIUtil.getStatusLineManager(); if (lineManager != null) { lineManager.setMessage(SOAMessages.OP_SUCCESS); } } }
From source file:org.polymap.biotop.model.importer.MdbImportPage.java
public void uploadFinished(UploadEvent ev) { UploadItem item = upload.getUploadItem(); try {/*from www . j a v a 2s . c om*/ log.info("Uploaded: " + item.getFileName() + ", path=" + item.getFilePath()); File uploadDir = Polymap.getWorkspacePath().toFile(); dbFile = new File(uploadDir, item.getFileName()); FileOutputStream out = new FileOutputStream(dbFile); StreamUtils.copyThenClose(item.getFileInputStream(), out); log.info("### copied to: " + dbFile); Database db = Database.open(dbFile); log.info("Tables: " + db.getTableNames()); TreeSet<String> sorted = new TreeSet<String>(db.getTableNames()); tablesList.setItems(sorted.toArray(new String[sorted.size()])); db.close(); } catch (IOException e) { PolymapWorkbench.handleError(DataPlugin.PLUGIN_ID, MdbImportPage.this, "Fehler beim Upload der Daten.", e); } checkFinish(); }
From source file:org.polymap.kaps.importer.MdbImportPage.java
public void uploadFinished(UploadEvent ev) { UploadItem item = upload.getUploadItem(); try {/*from ww w . ja va2 s .c o m*/ log.info("Uploaded: " + item.getFileName() + ", path=" + item.getFilePath()); File uploadDir = Polymap.getWorkspacePath().toFile(); dbFile = new File(uploadDir, item.getFileName()); FileOutputStream out = new FileOutputStream(dbFile); StreamUtils.copyThenClose(item.getFileInputStream(), out); log.info("### copied to: " + dbFile); Database db = Database.open(dbFile); log.info("Tables: " + db.getTableNames()); TreeSet<String> sorted = new TreeSet<String>(db.getTableNames()); tablesList.setItems(sorted.toArray(new String[sorted.size()])); db.close(); } catch (IOException e) { PolymapWorkbench.handleError(DataPlugin.PLUGIN_ID, MdbImportPage.this, "Fehler beim Upload der Daten.", e); } checkFinish(); }
From source file:com.atolcd.pentaho.di.trans.steps.gisgeoprocessing.GisGeoprocessing.java
private static LineString[] splitLineStringAtCoordinates(Coordinate[] splitCoordinates, LineString inputLineString, double distance) { List<LineString> lineStrings = new ArrayList<LineString>(); LengthIndexedLine lengthIndexedLine = new LengthIndexedLine(inputLineString); TreeSet<Double> indexesTree = new TreeSet<Double>(); indexesTree.add(lengthIndexedLine.getStartIndex()); indexesTree.add(lengthIndexedLine.getEndIndex()); for (Coordinate splitCoordinate : splitCoordinates) { if (geometryFactory.createPoint(splitCoordinate).distance(inputLineString) <= distance) { indexesTree.add(lengthIndexedLine.project(splitCoordinate)); }/*from w w w . java2s .co m*/ } Double[] indexes = indexesTree.toArray(new Double[indexesTree.size()]); for (int i = 0; i < indexes.length - 1; i++) { LineString splitedLineString = (LineString) lengthIndexedLine.extractLine(indexes[i], indexes[i + 1]); if (splitedLineString != null && !splitedLineString.isEmpty()) { lineStrings.add(splitedLineString); } } return lineStrings.toArray(new LineString[lineStrings.size()]); }
From source file:SaveImage.java
public String[] getFormats() { String[] formats = ImageIO.getWriterFormatNames(); TreeSet<String> formatSet = new TreeSet<String>(); for (String s : formats) { formatSet.add(s.toLowerCase());//from w ww . j a v a2 s . c om } return formatSet.toArray(new String[0]); }
From source file:hudson.graph.jfreechart.JFreeChartSupport.java
@Override public void setData(DataSet data) { TreeSet rowSet = new TreeSet(data.getRows()); TreeSet colSet = new TreeSet(data.getColumns()); Comparable[] _rows = (Comparable[]) rowSet.toArray(new Comparable[rowSet.size()]); Comparable[] _cols = (Comparable[]) colSet.toArray(new Comparable[colSet.size()]); // insert rows and columns in the right order for (Comparable r : _rows) { dataset.setValue(null, r, _cols[0]); }/*from w ww . j ava2s .c o m*/ for (Comparable c : _cols) { dataset.setValue(null, _rows[0], c); } for (int i = 0; i < data.getValues().size(); i++) { dataset.addValue((Number) data.getValues().get(i), (Comparable) data.getRows().get(i), (Comparable) data.getColumns().get(i)); } }
From source file:org.openanzo.glitter.query.SPARQLAlgebra.java
/** * Conjoins two solution sets.//from ww w . java 2 s. c om * * (A null list of solutions functions equivalently to a solution set with a single bindings-less solution. This is shorthand and is COMPLETELY different * from a solution set with zero solutions (which conjoins with any other solution set to the empty solution set).) * * * @param set1 * @param set2 * @return The conjunction of the two solution sets. */ static public SolutionSet join(SolutionSet set1, SolutionSet set2) { boolean isEnabled = RequestAnalysis.getAnalysisLogger().isDebugEnabled(); log.trace(LogUtils.GLITTER_MARKER, "join"); if (set1 == null) { if (isEnabled) RequestAnalysis.getAnalysisLogger().debug(LogUtils.GLITTER_MARKER, "[glitter_SPARQLAlgebra_identityJoin-RHS] {}", Integer.toString(set2.size())); return set2; } if (set2 == null) { if (isEnabled) RequestAnalysis.getAnalysisLogger().debug(LogUtils.GLITTER_MARKER, "[glitter_SPARQLAlgebra_identityJoin-LHS] {}", Integer.toString(set1.size())); return set1; } Comparator<Value> comparator = getComparator(set1, set2); if (set1.size() == 0 || set2.size() == 0) { if (isEnabled) RequestAnalysis.getAnalysisLogger().debug(LogUtils.GLITTER_MARKER, "[glitter_SPARQLAlgebra_nullJoin]"); return new SolutionList(); } PatternSolution sol1[] = set1.toArray(new PatternSolution[0]); PatternSolution sol2[] = set2.toArray(new PatternSolution[0]); if (sol1.length == 1 && sol1[0].size() == 0) { if (isEnabled) RequestAnalysis.getAnalysisLogger().debug(LogUtils.GLITTER_MARKER, "[glitter_SPARQLAlgebra_identityJoin-RHS] {}", Integer.toString(set2.size())); return set2; } else if (sol2.length == 1 && sol2[0].size() == 0) { if (isEnabled) RequestAnalysis.getAnalysisLogger().debug(LogUtils.GLITTER_MARKER, "[glitter_SPARQLAlgebra_identityJoin-LHS] {}", Integer.toString(set1.size())); return set1; } SolutionSet newSolutions = new CustomCompareSolutionSet.ComparableSolutionList(comparator); long start = 0; if (isEnabled) { RequestAnalysis.getAnalysisLogger().debug(LogUtils.GLITTER_MARKER, "[glitter_SPARQLAlgebra_startJoin] {}:{}", Integer.toString(set1.size()), Integer.toString(set2.size())); start = System.currentTimeMillis(); } TreeSet<Bindable> count = new TreeSet<Bindable>(); for (PatternSolution element : sol1) { for (Bindable bindable : element.getBoundDomain(true)) { count.add(bindable); } } TreeSet<Bindable> count2 = new TreeSet<Bindable>(); for (PatternSolution element : sol2) { for (Bindable bindable : element.getBoundDomain(true)) { count2.add(bindable); } } TreeSet<Bindable> matchSet = new TreeSet<Bindable>(); if (count.size() < count2.size()) { for (Bindable bindable : count) { if (count2.contains(bindable)) matchSet.add(bindable); } } else { for (Bindable bindable : count2) { if (count.contains(bindable)) { matchSet.add(bindable); } } } Bindable matchedBindables[] = matchSet.toArray(new Bindable[0]); if (isEnabled) { StringBuilder sb = new StringBuilder(); for (Bindable bindable : matchSet) { sb.append(bindable.toString()); sb.append(","); } RequestAnalysis.getAnalysisLogger().debug(LogUtils.GLITTER_MARKER, "[glitter_SPARQLAlgebra_matchingBindings] {}", sb.toString()); } long startSort = 0; if (isEnabled) { startSort = System.currentTimeMillis(); } Arrays.sort(sol1, 0, sol1.length, new PatternSolutionImpl.SetSolutionComparator(matchSet, comparator)); if (isEnabled) { RequestAnalysis.getAnalysisLogger().debug(LogUtils.GLITTER_MARKER, "[glitter_SPARQLAlgebra_leftSortTime] {}", Long.toString(System.currentTimeMillis() - startSort)); startSort = System.currentTimeMillis(); } Arrays.sort(sol2, 0, sol2.length, new PatternSolutionImpl.SetSolutionComparator(matchSet, comparator)); if (isEnabled) { RequestAnalysis.getAnalysisLogger().debug(LogUtils.GLITTER_MARKER, "[glitter_SPARQLAlgebra_rightSortTime] {}", Long.toString(System.currentTimeMillis() - startSort)); startSort = System.currentTimeMillis(); } //System.err.println("Joining:" + sol1.length + ":" + sol2.length); int j = 0; //long start = System.currentTimeMillis(); if (matchSet.size() > 0) { for (PatternSolution solution : sol1) { Bindable sol1Bindables[] = solution.getBoundDomainArray(); boolean done = false; for (int k = j; k < sol2.length && !done; k++) { if (sol1Bindables.length == 0) { newSolutions.add(sol2[k]); } else { boolean match = true; boolean cloned = false; PatternSolution solution2 = sol2[k]; boolean firstEmpty = true; Bindable bindables2[] = solution2.getBoundDomainArray(); int m = 0; if (bindables2.length > 0) { boolean breaker = false; for (Bindable element : matchedBindables) { firstEmpty = false; for (int mm = m; mm < bindables2.length && !breaker; mm++) { int comp1 = element.compareTo(bindables2[mm]); if (comp1 == 0) { Value term = solution.getBinding(element); Value term2 = solution2.getBinding(bindables2[mm]); //If term is null, this means that lh solution does not have a binding for a shared binding, so have to do slow conjoin if (term == null) { PatternSolution psNew = conjoin(solution, solution2); if (psNew != null) { newSolutions.add(psNew); } match = false; breaker = true; } else { int comp = comparator.compare(term, term2); if (comp > 0) { match = false; breaker = true; j = k; break; } else if (comp < 0) { match = false; done = true; breaker = true; break; } else { if (!cloned) { bindables2 = bindables2.clone(); cloned = true; } // conjunction.put(bindables2[mm], term); bindables2[mm] = null; m = mm + 1; break; } } } else if (comp1 > 0) { m = mm; } } if (breaker) break; } if (match) { if (firstEmpty) { newSolutions.add(solution2); } else { PatternSolutionImpl newSolution = new PatternSolutionImpl(solution); for (Bindable element : bindables2) { if (element != null) { newSolution.setBinding(element, solution2.getBinding(element)); } } newSolutions.add(new PatternSolutionImpl(newSolution)); } } } else { newSolutions.add(solution); } } } } } else { for (PatternSolution solution : sol1) { for (PatternSolution solution2 : sol2) { Bindable bindable[] = new Bindable[solution.getBoundDomainArray().length + solution2.getBoundDomainArray().length]; Value value[] = new Value[solution.getBoundDomainArray().length + solution2.getBoundDomainArray().length]; Bindable bs[] = solution.getBoundDomain(false); Value vs[] = solution.getBoundVariablesArray(false); System.arraycopy(bs, 0, bindable, 0, bs.length); System.arraycopy(vs, 0, value, 0, vs.length); int last = vs.length; bs = solution2.getBoundDomain(false); vs = solution2.getBoundVariablesArray(false); System.arraycopy(bs, 0, bindable, last, bs.length); System.arraycopy(vs, 0, value, last, vs.length); newSolutions.add(new PatternSolutionImpl(bindable, value)); } } } //System.err.println("Join:" + (System.currentTimeMillis() - start) + ":" + newSolutions.size()); if (isEnabled) { RequestAnalysis.getAnalysisLogger().debug(LogUtils.GLITTER_MARKER, "[glitter_SPARQLAlgebra_endJoin] {}:{}", Integer.toString(newSolutions.size()), Long.toString(System.currentTimeMillis() - start)); } return newSolutions; /* SolutionSet newSolutions2 = new SolutionList(); for (PatternSolution ps1 : set1) { for (PatternSolution ps2 : set2) { PatternSolution psNew = ps1.conjoin(ps2); if (psNew != null) newSolutions2.add(psNew); } } return newSolutions;*/ }
From source file:org.openanzo.glitter.query.SPARQLAlgebra.java
/** * Implements the SPARQL LeftJoin operator. (For the SPARQL <tt>OPTIONAL</tt> keyword.) * /*from w w w .j a v a 2s . co m*/ * @param set1 * The left-hand-side of the outer join. See the SPARQL spec. for precise semantics. * @param set2 * The right-hand-side of the outer join. * @param filters * Filters that are scoped to this left join. * @return The results of applying the LeftJoin operator. */ static public SolutionSet leftJoin(SolutionSet set1, SolutionSet set2, Set<Expression> filters) { Comparator<Value> comparator = getComparator(set1, set2); if (set1 == null) return filterSolutions(set2, filters); if (set2 == null) return filterSolutions(set1, filters); long start = 0; boolean isEnabled = RequestAnalysis.getAnalysisLogger().isDebugEnabled(); if (isEnabled) { RequestAnalysis.getAnalysisLogger().debug(LogUtils.GLITTER_MARKER, "[glitter_SPARQLAlgebra_startLeftJoin] {}:{}", Integer.toString(set1.size()), Integer.toString(set2.size())); start = System.currentTimeMillis(); } SolutionSet newSolutions = new CustomCompareSolutionSet.ComparableSolutionList(comparator); PatternSolution sol1[] = set1.toArray(new PatternSolution[0]); // count1 contains all the variables (& bnodes) in the first (required) // solution set. count2 contains all the bindables that appear in the // second. TreeSet<Bindable> count1 = new TreeSet<Bindable>(); for (PatternSolution element : sol1) { for (Bindable bindable : element.getBoundDomain(true)) { count1.add(bindable); } } PatternSolution sol2[] = set2.toArray(new PatternSolution[0]); TreeSet<Bindable> count2 = new TreeSet<Bindable>(); for (PatternSolution element : sol2) { for (Bindable bindable : element.getBoundDomain(true)) { count2.add(bindable); } } // populate matchSet with all the bindables that are in common // between the two solution sets. Order the Binding names in the matchSet TreeSet<Bindable> matchSet = new TreeSet<Bindable>(); if (count1.size() < count2.size()) { for (Bindable bindable : count1) { if (count2.contains(bindable)) matchSet.add(bindable); } } else { for (Bindable bindable : count2) { if (count1.contains(bindable)) { matchSet.add(bindable); } } } Bindable matchedBindables[] = matchSet.toArray(new Bindable[0]); //Matt:Sort the solutions in sol1+sol2 based on the ordered matchSet, ie //the matchSet is sorted alphabetically by the binding names, so sort the solutions in sol1 + sol2 //by a progressive alphabetical sort based on the ordered binding names, ie //if you have binding "A" and binding "B", the solutions would get ordered first by //and alphabetical sort of the Binding "A" values, and when the values of Binding "A" match, //alphabetical sort of Biding "B" values. // //Example: 2 Binding "A" and "B" // // row 1: A=adam B=zebra // row 2: A=charlie b=apple // row 3: A=adam B=david // row 4: A=zed B=arrow //Sort order would be // row 3: A=adam B=david //since adam is alphabetically lower than charlie and zed, and then david is lower than zebra // row 1: A=adam B=zebra // row 2: A=charlie b=apple //charlie is after adam, and before zed, apple isn't used in sort since there are no other values with a match on A // row 4: A=zed B=arrow //zed is after adam and charlie, arrow isn't used in sort since there are no other values with a match on A long startSort = 0; if (isEnabled) { startSort = System.currentTimeMillis(); } Arrays.sort(sol1, 0, sol1.length, new PatternSolutionImpl.SetSolutionComparator(matchSet, comparator)); if (isEnabled) { RequestAnalysis.getAnalysisLogger().debug(LogUtils.GLITTER_MARKER, "[glitter_SPARQLAlgebra_leftSortTime] {}", Long.toString(System.currentTimeMillis() - startSort)); startSort = System.currentTimeMillis(); } Arrays.sort(sol2, 0, sol2.length, new PatternSolutionImpl.SetSolutionComparator(matchSet, comparator)); if (isEnabled) { RequestAnalysis.getAnalysisLogger().debug(LogUtils.GLITTER_MARKER, "[glitter_SPARQLAlgebra_rightSortTime] {}", Long.toString(System.currentTimeMillis() - startSort)); startSort = System.currentTimeMillis(); } // j is our current starting position for iterating over the optional // solutions. we can skip optional solutions p..r if we know that all // of them are incompatible with required solutions // //Matt:You know they are incompatiable because the sort order of the 2 solution sets is the same int j = 0; //long start = System.currentTimeMillis(); for (PatternSolution solution1 : sol1) { Bindable sol1Bindables[] = solution1.getBoundDomainArray(); boolean oneMatch = false; boolean done = false; //Matt:Since the solutions in the 2 sets are in the same sort order, you know that if //you compare solution(k) from the right solution set with solution(i) from the left solution set and solution(k) is //lower in the sort order than solution(i), then all the remaining solutions in left solution set will also have a //higher sort order than solutions(0-k) in right solution set. for (int k = j; k < sol2.length && !done; k++) { if (sol1Bindables.length == 0) { // the empty solution is the unit / identity solution oneMatch = true; newSolutions.add(sol2[k]); } else { // match starts as false; if all the bindings in solution1 // match bindings in solution2 (i.e. solution1 is compatible // with solution2), then match==true. // // Lee: There seems to be a bug here if the intersection of // bindable1 and bindable2 is empty: in this case, solution1 does not get // extended by solution2, as it should be. Would this be fixed // by defaulting match to true? boolean match = true; boolean cloned = false; PatternSolution solution2 = sol2[k]; // Map<Bindable, Value> conjunction = new HashMap<Bindable, Value>(); Bindable bindables2[] = solution2.getBoundDomainArray(); // we traverse the bindables in these solutions in parallel // this counter is our current starting position in the optional bindables //Matt:Since the bindables in the 2 arrays are in the same sort order, you know that if //you compare bindable(m) from the right array with bindable(l) from the left array and bindable(m) is //lower in the sort order than bindable(l), then all the remaining bindable in left array will also have a //higher sort order than bindable(0-m) in right array. int m = 0; // breaker is true if solution1 and solution2 are not compatible; // once one non-compatible binding has been found, the rest of // the bindables in solution1 will be copied, but we won't bother // checking them against solution2. boolean breaker = false; if (bindables2.length > 0) { for (Bindable element : matchedBindables) { // put in the required solution, unmodified, regardless of whether // we've found any incompatibilities yet //conjunction.put(element, solution1.getBinding(element)); for (int mm = m; mm < bindables2.length && !breaker; mm++) { int comp1 = element.compareTo(bindables2[mm]); if (comp1 == 0) { // the same bindable is in both solutions, check // the value its bound to; note that solutions in each // solution set are ordered by comparing terms (bound // values) Value term1 = solution1.getBinding(element); //If term is null, this means that lh solution does not have a binding for a shared binding, so have to do slow conjoin if (term1 == null) { PatternSolution newSolution = conjoin(solution1, solution2); if (newSolution != null) { if (keepSolution(newSolution, filters)) { // oneMatch indicates that solution1 (from the left-hand side) // was compatible with at least one solution from the right-hand // solution set oneMatch = true; newSolutions.add(newSolution); } } match = false; breaker = true; } else { Value term2 = solution2.getBinding(bindables2[mm]); int comp = comparator.compare(term1, term2); if (comp > 0) { // See note above - since the left solution has // a higher value for this term, we can skip all // right-hand solutions before this one when we // start with the next left-hand solution. match = false; breaker = true; j = k; break; } else if (comp < 0) { match = false; breaker = true; done = true; break; } else { if (!cloned) { bindables2 = bindables2.clone(); cloned = true; } match = true; // conjunction.put(bindables2[mm], term); bindables2[mm] = null; m = mm + 1; break; } } } else if (comp1 > 0) { m = mm; } } } // match is true if all of the terms in common between solution1 // and solution2 are bound to the same value in both solutions if (match) { PatternSolutionImpl newSolution = new PatternSolutionImpl(solution1); // before we accept this conjoined solution, we need to make sure // it passes the filter for (Bindable element : bindables2) { // bindings that match those in solution1 were nulled out above // so if a binding is not null, it extends solution 1 and we copy // it into the conjunction if (element != null) { newSolution.setBinding(element, solution2.getBinding(element)); } } if (keepSolution(newSolution, filters)) { // oneMatch indicates that solution1 (from the left-hand side) // was compatible with at least one solution from the right-hand // solution set oneMatch = true; newSolutions.add(newSolution); } } } } } // if solution1 wasn't compatible with any solutions in the right-hand side, then we just // copy solution1 into our resultset untouched if (!oneMatch) { newSolutions.add(solution1); } } //System.err.println("LeftJoin:" + (System.currentTimeMillis() - start) + ":" + newSolutions.size()); if (isEnabled) { RequestAnalysis.getAnalysisLogger().debug(LogUtils.GLITTER_MARKER, "[glitter_SPARQLAlgebra_endLeftJoin] {}:{}", Integer.toString(newSolutions.size()), Long.toString(System.currentTimeMillis() - start)); } return newSolutions; /*if (set1 == null) return set2; if (set2 == null) return set1; SolutionSet newSolutions = new SolutionList(); for (PatternSolution ps1 : set1) { boolean extendedPs1 = false; for (PatternSolution ps2 : set2) { PatternSolution psNew = ps1.conjoin(ps2); if (psNew != null) { extendedPs1 = true; newSolutions.add(psNew); } } // for this to be a left outer join, we have to include the left-hand // pattern solution even if all of the right-hand solutions conflict // with it if (!extendedPs1) newSolutions.add(ps1); } return newSolutions; */ }
From source file:org.apache.hadoop.hbase.backup.impl.RestoreTablesClient.java
/** * Restore operation. Stage 2: resolved Backup Image dependency * @param backupManifestMap : tableName, Manifest * @param sTableArray The array of tables to be restored * @param tTableArray The array of mapping tables to restore to * @throws IOException exception/*from ww w. ja v a2 s.com*/ */ private void restore(HashMap<TableName, BackupManifest> backupManifestMap, TableName[] sTableArray, TableName[] tTableArray, boolean isOverwrite) throws IOException { TreeSet<BackupImage> restoreImageSet = new TreeSet<>(); for (int i = 0; i < sTableArray.length; i++) { TableName table = sTableArray[i]; BackupManifest manifest = backupManifestMap.get(table); // Get the image list of this backup for restore in time order from old // to new. List<BackupImage> list = new ArrayList<>(); list.add(manifest.getBackupImage()); TreeSet<BackupImage> set = new TreeSet<>(list); List<BackupImage> depList = manifest.getDependentListByTable(table); set.addAll(depList); BackupImage[] arr = new BackupImage[set.size()]; set.toArray(arr); restoreImages(arr, table, tTableArray[i], isOverwrite); restoreImageSet.addAll(list); if (restoreImageSet != null && !restoreImageSet.isEmpty()) { LOG.info("Restore includes the following image(s):"); for (BackupImage image : restoreImageSet) { LOG.info("Backup: " + image.getBackupId() + " " + HBackupFileSystem.getTableBackupDir(image.getRootDir(), image.getBackupId(), table)); } } } LOG.debug("restoreStage finished"); }