From: <bra...@us...> - 2007-07-19 23:33:08
|
Revision: 1843 http://archive-access.svn.sourceforge.net/archive-access/?rev=1843&view=rev Author: bradtofel Date: 2007-07-19 16:33:09 -0700 (Thu, 19 Jul 2007) Log Message: ----------- REMOVE: quite old and never was used in codebase Removed Paths: ------------- trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/query/PathQuerySearchResultPartition.java trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/query/PathQuerySearchResultPartitioner.java Deleted: trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/query/PathQuerySearchResultPartition.java =================================================================== --- trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/query/PathQuerySearchResultPartition.java 2007-07-19 23:30:47 UTC (rev 1842) +++ trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/query/PathQuerySearchResultPartition.java 2007-07-19 23:33:09 UTC (rev 1843) @@ -1,152 +0,0 @@ -/* PathQuerySearchResultPartition - * - * $Id$ - * - * Created on 4:10:12 PM Apr 16, 2007. - * - * Copyright (C) 2007 Internet Archive. - * - * This file is part of wayback-core. - * - * wayback-core is free software; you can redistribute it and/or modify - * it under the terms of the GNU Lesser Public License as published by - * the Free Software Foundation; either version 2.1 of the License, or - * any later version. - * - * wayback-core 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 Lesser Public License for more details. - * - * You should have received a copy of the GNU Lesser Public License - * along with wayback-core; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ -package org.archive.wayback.query; - -import java.util.Date; -import java.util.HashMap; - -import org.archive.wayback.ResultURIConverter; -import org.archive.wayback.WaybackConstants; -import org.archive.wayback.core.SearchResult; -import org.archive.wayback.core.Timestamp; - -/** - * UI Utility object for storing information about multiple captures of an URL. - * This object tracks the url in question, total number of captures of that URL, - * the first Date captured, the last Date captured, and the unique Digests for - * all captures. - * - * @author brad - * @version $Date$, $Revision$ - */ -public class PathQuerySearchResultPartition { - private SearchResult firstResult = null; - private int numResults; - private Date firstDate; - private Date lastDate; - private String url; - private HashMap<String,Object> digests; - private ResultURIConverter uriConverter = null; - /** - * Constructor - * @param result - * @param uriConverter - */ - public PathQuerySearchResultPartition(SearchResult result, - ResultURIConverter uriConverter) { - firstResult = result; - digests = new HashMap<String,Object>(); - digests.put(searchResultToDigest(result),null); - url = searchResultToCanonicalUrl(result); - numResults = 1; - firstDate = searchResultToDate(result); - lastDate = searchResultToDate(result); - this.uriConverter = uriConverter; - } - - /** - * @return String Url that will result in a query for the URL - * stored in this object - */ - public String queryUrl() { - return uriConverter.makeQueryURI(firstResult); - } - /** - * @return String Url that will replay the first captured stored in this - * object - */ - public String replayUrl() { - return uriConverter.makeReplayURI(firstResult); - } - - /** - * incorporate data from the argument SearchResult into the aggregate - * statistics held in this object - * @param result - */ - public void addSearchResult(SearchResult result) { - numResults++; - Date d = searchResultToDate(result); - String digest = result.get(WaybackConstants.RESULT_MD5_DIGEST); - if(d.getTime() < firstDate.getTime()) { - firstDate = d; - } - if(d.getTime() > lastDate.getTime()) { - lastDate = d; - } - digests.put(digest, null); - } - /** - * @param result - * @return true if the argument SearchResult is for the same url as this - * ResultPartition is storing - */ - public boolean sameUrl(SearchResult result) { - return url.equals(searchResultToCanonicalUrl(result)); - } - - /** - * @return the firstDate - */ - public Date getFirstDate() { - return firstDate; - } - /** - * @return the lastDate - */ - public Date getLastDate() { - return lastDate; - } - /** - * @return the numResults - */ - public int getNumResults() { - return numResults; - } - /** - * @return the url - */ - public String getUrl() { - return url; - } - /** - * @return the number of unique digests for this url - */ - public int getNumVersions() { - return digests.size(); - } - - private static String searchResultToCanonicalUrl(SearchResult result) { - return result.get(WaybackConstants.RESULT_URL_KEY); - } - private static String searchResultToDigest(SearchResult result) { - return result.get(WaybackConstants.RESULT_MD5_DIGEST); - } - private static Date searchResultToDate(SearchResult result) { - Timestamp t = new Timestamp(result.get( - WaybackConstants.RESULT_CAPTURE_DATE)); - return t.getDate(); - } -} Deleted: trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/query/PathQuerySearchResultPartitioner.java =================================================================== --- trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/query/PathQuerySearchResultPartitioner.java 2007-07-19 23:30:47 UTC (rev 1842) +++ trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/query/PathQuerySearchResultPartitioner.java 2007-07-19 23:33:09 UTC (rev 1843) @@ -1,95 +0,0 @@ -/* PathQuerySearchResultPartitioner - * - * $Id$ - * - * Created on 4:09:51 PM Apr 16, 2007. - * - * Copyright (C) 2007 Internet Archive. - * - * This file is part of wayback-core. - * - * wayback-core is free software; you can redistribute it and/or modify - * it under the terms of the GNU Lesser Public License as published by - * the Free Software Foundation; either version 2.1 of the License, or - * any later version. - * - * wayback-core 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 Lesser Public License for more details. - * - * You should have received a copy of the GNU Lesser Public License - * along with wayback-core; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ -package org.archive.wayback.query; - -import java.util.ArrayList; -import java.util.Iterator; - -import org.archive.wayback.ResultURIConverter; -import org.archive.wayback.core.SearchResult; -import org.archive.wayback.core.SearchResults; - -/** - * UI Utility object that transforms a SearchResults into a series of - * PathQuerySearchResultPartition objects, one object per URL in the - * SearchResults. This makes rendering of summary pages for a series of urls, - * with potentially multiple captures of each URL simpler. - * - * @author brad - * @version $Date$, $Revision$ - */ -public class PathQuerySearchResultPartitioner { - private ArrayList<PathQuerySearchResultPartition> partitions = null; - private int totalResultCount = 0; - /** - * Constructor - * @param results - * @param uriConverter - */ - public PathQuerySearchResultPartitioner(SearchResults results, - ResultURIConverter uriConverter) { - partitions = new ArrayList<PathQuerySearchResultPartition>(); - Iterator<SearchResult> itr = results.iterator(); - PathQuerySearchResultPartition current = null; - totalResultCount = 0; - while(itr.hasNext()) { - totalResultCount++; - SearchResult result = itr.next(); - if((current == null) || !current.sameUrl(result)) { - if(current != null) { - partitions.add(current); - } - current = new PathQuerySearchResultPartition(result, - uriConverter); - } else { - current.addSearchResult(result); - } - } - if(current != null) { - partitions.add(current); - } - } - - /** - * @return the total number of unique urls found in the SearchResults - */ - public int numUrls() { - return partitions.size(); - } - - /** - * @return the total number of captures for all urls in the SearchResults - */ - public int numResultsTotal() { - return totalResultCount; - } - - /** - * @return an Iterator of PathQuerySearchResultPartition objects - */ - public Iterator<PathQuerySearchResultPartition> iterator() { - return partitions.iterator(); - } -} This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |