//========================================== // A Class for holding Entry info class EntryClass implements Comparable { String Topic, Category; ArrayList Locations; ArrayList Stacks; boolean archiveResults; boolean title; // Sorting override @Override public int compareTo(EntryClass other) { if (!this.Topic.equalsIgnoreCase(other.Topic)) { return this.Topic.compareTo(other.Topic); } else if (!this.Topic.equalsIgnoreCase(other.Topic)) { return this.Topic.compareTo(other.Topic); } else { return(0); } } // Hashcode generation override // TK DOUBLE-CHECK THIS HASHCODE FUNCTION WITH A CS PROFESSIONAL @Override public int hashCode() { int h = 11; char val[] = this.Topic.toCharArray(); for (int i=0; i(); Stacks = new ArrayList(); } EntryClass(boolean passTitle, String passTopic) { title = passTitle; Topic = passTopic; Locations = new ArrayList(); Stacks = new ArrayList(); } } //=================================================== // Creates the full entries array, passes back to main. EntryClass[] makeEntriesArray() { // HashSet for entry classes HashSet fullEntryHashSet = new HashSet(); // 1 --------------------------------------------- // Loops through the rows for (TableRow row : table.rows()) { // TOPICS // Creates an array by splitting at the comma // loops through the array, adds topic to HashSet String[] rowTopicsArray = (row.getString("Stack Topics")).split(", "); if (rowTopicsArray.length > 0) { for (int i=0; i 1) { String[] rowTitlesArray = (row.getString("Titles")).split(", "); if (rowTitlesArray.length > 0) { for (int i=0; i Replacing ^"); String splitSearchString = searchString.split("\\^")[0]; println(" > splitSearchString: " + splitSearchString); searchString = splitSearchString; println(" > searchString: " + searchString); } String urlString = "https://archive.org/details/prelinger_library?and%5B%5D="; urlString += (searchString).replace(" ", "+"); urlString += "&sin="; // get the HTML from Archive.org GetRequest get = new GetRequest(urlString); get.send(); // Split the results and look for "No Results..." string String[] htmlSplit = get.getContent().split("\n"); /*--------------------------------------- //DEBUG: This prints out the full HTML file. //for (int j=0; j") != -1) { archiveHTMLIndex = j; break; } } // If you see the magic words, no results were returned. if (htmlSplit[archiveHTMLIndex].indexOf("No results matched your criteria.") != -1) { archiveResults = false; } // Set the entry object fea[i].archiveResults = archiveResults; // Sets the string for output String resultString = fea[i].Topic + "," + fea[i].archiveResults; resultPairs[i] = resultString; println("RESULT: " + fea[i].archiveResults); } } saveStrings("ArchiveOrgResults-12.csv", resultPairs); return(fea); } //====================================================== boolean archiveSearchStringOK(String s) { // returns F if the string has problematic chars. boolean searchOK = ((s.indexOf("[") == -1) && (s.indexOf("]") == -1) && (s.indexOf("(") == -1) && (s.indexOf(")") == -1) && (s.indexOf("\"") == -1) && (s.indexOf("\"") == -1) && (s.indexOf("!") == -1)); return(searchOK); } //====================================================== void saveDebugTextFile(EntryClass[] fea) { String[] checkStringArray = new String[fea.length]; for (int i=0; i