Java Programming Advance Two Projects
META-INF/MANIFEST.MF
Manifest-Version: 1.0 Application-Name: Search Engine Model Soln - wpollock Permissions: all-permissions Created-By: 1.7.0_51 (Oracle Corporation) Main-Class: com.wpollock.searchengine.Main Codebase: * Name: com/wpollock/searchengine/SearchType.class SHA-256-Digest: pi6ScsG3PDtumQ7TS+BWuREbP08fMtaauFds5yjNfeM= Name: com/wpollock/searchengine/MaintenanceWindow$3.class SHA-256-Digest: d51ZqvfGWPliDzQpRDmKNgW2K4oVByb/HitPlCAvtCI= Name: com/wpollock/searchengine/MaintenanceWindow$1.class SHA-256-Digest: ZkC4OJQpAHKXTGNPpNOlKHh2a3IjtVKcnwb5/6znDgo= Name: com/wpollock/searchengine/Main$2.class SHA-256-Digest: KCO27jNeVfz26tROUQ34tWufeqFUZrhCpn7g8i/4Dh0= Name: com/wpollock/searchengine/Main.class SHA-256-Digest: HO8JF+HsjoxClP+mz3kyfkXgYas3WEe+hlTusLKhaJk= Name: com/wpollock/searchengine/MaintenanceWindow$4.class SHA-256-Digest: FjBYyVOob12A83o8Ehu1ppTj0n14y2WePcHo7evPB30= Name: MagnifyingGlass.jpg SHA-256-Digest: Y20F0LAhpeN001Nl8GOwR8jEJlB1Q4Gjq92jADRed2k= Name: com/wpollock/searchengine/MaintenanceWindow$2.class SHA-256-Digest: /MLCNBEKd2XDoHB/CgjfpEV1i4G/Q8DV+cyNySbGXqM= Name: com/wpollock/searchengine/MaintenanceWindow$3$1.class SHA-256-Digest: ff6dtzmty+yavl0+5cMBBu+FRpAe6f9zs8pUwpF1WYE= Name: com/wpollock/searchengine/MaintenanceWindow.class SHA-256-Digest: ls3lxASqL6ENER1Dj0hz4YxX29AwIsIQ1FEi/qm2ayQ= Name: com/wpollock/searchengine/FileStatus.class SHA-256-Digest: uiE50TqbpvqRmZ1mPTkpRTRCYmiKSd+xtnrS4YzNArA= Name: com/wpollock/searchengine/MagnifyingGlass.jpg SHA-256-Digest: Y20F0LAhpeN001Nl8GOwR8jEJlB1Q4Gjq92jADRed2k= Name: com/wpollock/searchengine/Main$4.class SHA-256-Digest: 6gRzfR0fBnKh77j5kvo+q9OqTS5vceaLgZp7JHKeB4c= Name: com/wpollock/searchengine/Main$6.class SHA-256-Digest: anEtOmNgppZ2vnSRTQ6dR/4cPswJdDU5mnet+v5nPUw= Name: com/wpollock/searchengine/FileFormat.txt SHA-256-Digest: G//7nWQRHBijyli/5GQX0NIe9wBd508zFj1cHqNN2tY= Name: com/wpollock/searchengine/FileItem.class SHA-256-Digest: mpIKGArY6MB6jMvx41UApxzeUN0v+xhgPKmYg7BejbI= Name: com/wpollock/searchengine/Main$7.class SHA-256-Digest: Bubier2ciga4my1ZoifMiQR569zfSe9T2/mjCAEA6BI= Name: com/wpollock/searchengine/MaintenanceWindow$2$1.class SHA-256-Digest: iE7Epo0XY8Qz3oBUAcAqRaJ3F7MeHhEOSkSaev/67JY= Name: com/wpollock/searchengine/DocPos.class SHA-256-Digest: W+KnPCgVe7gw+jWFcJLQ9cDJ5pY37lG7/TrCHoBSKgs= Name: com/wpollock/searchengine/Main$1.class SHA-256-Digest: gQvOWtrTQSbJO3vU40milgZecBwWaE294tJZutDsomk= Name: com/wpollock/searchengine/Main$5.class SHA-256-Digest: HWCBcQJIJM5+HEyY/cZgj6Bt2p9RANZnLHnZ7PbkRT8= Name: com/wpollock/searchengine/IndexUtils.class SHA-256-Digest: GtmjFzi0EtlrzCw8EeWXYdmVjI31iMuYjyY57b1ey48= Name: com/wpollock/searchengine/Main$3.class SHA-256-Digest: hUcEAekUCvfJmRJECi66YOXHQ39tUO5q568Z+dfd3gU= Name: com/wpollock/searchengine/SearchEngineTest.class SHA-256-Digest: n6lsfR1JuCY5oAb9yvb0EkkAMIEFz+xp/9HF2DeCqfA= Name: com/wpollock/searchengine/FileListModel.class SHA-256-Digest: d1DRXLSbAjktMyyYrk5d1DsvbkFbWIiHXaq9JaxAEVw= Name: FileFormat.txt SHA-256-Digest: G//7nWQRHBijyli/5GQX0NIe9wBd508zFj1cHqNN2tY=
META-INF/MYKEY.SF
Signature-Version: 1.0 SHA-256-Digest-Manifest-Main-Attributes: g6Y1rwlnqQ+7WXuMhjawYKoVAc2zk LX8snGFJdSdrXg= SHA-256-Digest-Manifest: MV3j8M0c5yxx+lA+N81FAhhjMKqZ2Q2fw/zlmzroUOE= Created-By: 1.7.0_51 (Oracle Corporation) Name: com/wpollock/searchengine/SearchType.class SHA-256-Digest: /+zW5lrQru8+UyMNR6KW8+Xv8XFhmV8Vb19BmU/NEY0= Name: com/wpollock/searchengine/MaintenanceWindow$3.class SHA-256-Digest: uEFSt4tt/oFoS/iBzEPCuytosf1R4y+fBlpLJSBil4M= Name: com/wpollock/searchengine/MaintenanceWindow$1.class SHA-256-Digest: jYdPXkiSE6sIF2ztYAkshBGD8sPHs7b11byKlSK2CQQ= Name: com/wpollock/searchengine/Main$2.class SHA-256-Digest: go0al94J0ZoSGchM44wFItoAq4NgLtot7+IHAE399lU= Name: com/wpollock/searchengine/Main.class SHA-256-Digest: VL0t/N4Qj8phSEIZVxpu/Uc8OP3XedNWfR/M9pjU5Sw= Name: com/wpollock/searchengine/MaintenanceWindow$4.class SHA-256-Digest: WMiPCFdOQ+PKZTQLiratcFMG0faOulwlUp9WrvdQq+s= Name: MagnifyingGlass.jpg SHA-256-Digest: 6mUhluEcfHUvQFqbyUcG0Fhlpp2Qg6hFaLtBlP8VgIM= Name: com/wpollock/searchengine/MaintenanceWindow$2.class SHA-256-Digest: 2VRqnarCMe36NtkYy/bfHOZhBaEpD2+JAiKZPBbrBjc= Name: com/wpollock/searchengine/MaintenanceWindow$3$1.class SHA-256-Digest: YQjdQaYU2PiWiHfW2d+sZoKmMlXzl9hABb/r+n9nfls= Name: com/wpollock/searchengine/MaintenanceWindow.class SHA-256-Digest: XMk8MD+xnk/CQlfAx8e/w9xcl6l6IpBTEoQPfe40Sok= Name: com/wpollock/searchengine/Main$4.class SHA-256-Digest: UifKD7Xfkc8zr6HX/dctC1m3QBmPrR7qDaLkfDTCsQw= Name: com/wpollock/searchengine/FileStatus.class SHA-256-Digest: GRjOBL7w38BSWozQxdmdIHXm09igzIjz8Qg3tvXFmw4= Name: com/wpollock/searchengine/MagnifyingGlass.jpg SHA-256-Digest: LXkmHmlvfqrfA9LiGhD6WpumGJ1d6lDGbd+Rqe5PKI0= Name: com/wpollock/searchengine/FileItem.class SHA-256-Digest: ReP8GlQFe39jBXZnyG9uBGofo0I2IgKuqLmI4nhAOU4= Name: com/wpollock/searchengine/FileFormat.txt SHA-256-Digest: wcwl1ZOJP6oYTngJMcpNCXiMTk/XZwEXdN77OLiFyDM= Name: com/wpollock/searchengine/Main$6.class SHA-256-Digest: OkZ5Cri4Q1yWT+yNYj/9BmcCCrDlV1UZJ87Mj9d/AFU= Name: com/wpollock/searchengine/Main$7.class SHA-256-Digest: M1m20XO7wuatBXllCsCRdWvk+oc8Zus3accDzQY9D2A= Name: com/wpollock/searchengine/MaintenanceWindow$2$1.class SHA-256-Digest: gzzoYjljHYoZ7NvIuDUpOmBfqntVGvoO+J8IEtPKkSg= Name: com/wpollock/searchengine/DocPos.class SHA-256-Digest: qqCDlpTU1p5UjnoTDBixklRURjGr6B55Eb1YaVxVwt8= Name: com/wpollock/searchengine/Main$1.class SHA-256-Digest: +DnSRV/Mqm1ipsiFPK0novoNYUcHxRSt+WTd0r9a3c0= Name: com/wpollock/searchengine/Main$5.class SHA-256-Digest: R0XhzRd2Thr9U6JPpAVEqFjH7REM3PkkvkSqjQ87Jag= Name: com/wpollock/searchengine/Main$3.class SHA-256-Digest: H6TLVFf+0KxSDmPZBFpRM0Kq6JeHgieTJtED4pyJfO0= Name: com/wpollock/searchengine/IndexUtils.class SHA-256-Digest: S6qubESP7OBqPfj4oii+VxSkXpdXgJI0/DnLDYj+QMw= Name: com/wpollock/searchengine/SearchEngineTest.class SHA-256-Digest: anhnQi0019+G9dPrDfl5aMsxFjeZ1lhvsbh8kgKxGo0= Name: com/wpollock/searchengine/FileListModel.class SHA-256-Digest: 6mGjXNGAndnJ9tBhkXvRRxaf/G/69JGPVS5qJGQwtEc= Name: FileFormat.txt SHA-256-Digest: RSDfcmMVSGyWtKlOdZ5qK/efPp9wgvyEoCi2BN+lLx8=
META-INF/MYKEY.DSA
com/wpollock/searchengine/DocPos.class
package com.wpollock.searchengine; public synchronized class DocPos implements Comparable { final long docID; final int pos; public void DocPos(long, int); public int compareTo(DocPos); public int hashCode(); public boolean equals(Object); public String toString(); }
com/wpollock/searchengine/FileFormat.txt
Index File Format Version 1.0 The file SrchNgn.dat (Search Engine Data) will be text with long lines, in UTF-8 encoding, and DOS end of line markers (<CR><NL>). The first part of the file will list the files used to generate the index, one per line. A blank line then separates the file list from the index data. The first line of the file will start with the text: SearchData 1.0 which indicates the version of the file format, in case it changes someday. The next line contains the next Unique file ID to use (an unsigned integer). This should initially be zero. For example: 0 After these two initial version lines, each file is listed, one per line, in this format: <ID> <TAB> <pathname of file> <TAB> <time of last modification> where "<ID>" is the unique document ID, <pathname of file> is a string for the absolute pathname on the local system of the file (note, filenames can't contain TAB characters), and "<time of last modification>" is an unsigned integer (a long) representing a standard timestamp (milliseconds since the epoch, 00:00:00 GMT, January 1, 1970). An example might be: 1 C:\Temp\file.txt 1329170774139 After the blank line that marks the end of the list of files, the inverted index data runs to the end of the file. There is one line for each word, with the first field the word and the remaining fields the pairs of numbers that represent the document ID and position within the document. The pair of numbers is separated with a comma. Fields are separated with white-space. Leading or trailing white space is ignored. For example: apple 0,12 3,0, 3,19, 3,1262, 12,0 (JSON might be a better choice for version 2.)
com/wpollock/searchengine/FileItem.class
package com.wpollock.searchengine; synchronized class FileItem implements Comparable { public final long fileID; public final String fileName; public long modificationTime; public void FileItem(long, String, long); public int hashCode(); public boolean equals(Object); public String toString(); public int compareTo(FileItem); }
com/wpollock/searchengine/FileListModel.class
package com.wpollock.searchengine; synchronized class FileListModel extends javax.swing.table.AbstractTableModel { private static final long serialVersionUID = 1; private String[] columnNames; private static FileListModel model; static java.util.List fileList; static void <clinit>(); void FileListModel(); public static FileListModel getModel(); public String getFileName(long); java.util.Set getSelectedFiles(); public long addFile(String); public void removeFile(long); public Long getDocID(String); public boolean contains(String); public java.util.Set getAllDocIDs(); void updateFileModTime(long); void saveIndexToFile(); public int getColumnCount(); public int getRowCount(); public String getColumnName(int); public Object getValueAt(int, int); public Class getColumnClass(int); public boolean isCellEditable(int, int); }
com/wpollock/searchengine/FileStatus.class
package com.wpollock.searchengine; final synchronized enum FileStatus { public static final FileStatus OKAY; public static final FileStatus MISSING; public static final FileStatus NEEDS_UPDATE; private String displayText; static void <clinit>(); private void FileStatus(String, int, String); public String toString(); public static FileStatus[] values(); public static FileStatus valueOf(String); }
com/wpollock/searchengine/IndexUtils.class
package com.wpollock.searchengine; synchronized class IndexUtils { static java.util.Map invertedIndex; static void <clinit>(); void IndexUtils(); static void doAndSearch(String, javax.swing.JTextPane); static void doOrSearch(String, javax.swing.JTextPane); static void doPhraseSearch(String, javax.swing.JTextPane); static void addFileToIndex(); static void removeSelectedFilesFromIndex(); static void removeDocData(long); static void addDocData(long); static void updateIndex(); static void initializeIndexFromFile(); }
com/wpollock/searchengine/MagnifyingGlass.jpg
com/wpollock/searchengine/Main$1.class
package com.wpollock.searchengine; synchronized class Main$1 implements javax.swing.event.DocumentListener { void Main$1(Main); public void insertUpdate(javax.swing.event.DocumentEvent); public void removeUpdate(javax.swing.event.DocumentEvent); public void changedUpdate(javax.swing.event.DocumentEvent); }
com/wpollock/searchengine/Main$2.class
package com.wpollock.searchengine; synchronized class Main$2 implements java.awt.event.ActionListener { void Main$2(Main); public void actionPerformed(java.awt.event.ActionEvent); }
com/wpollock/searchengine/Main$3.class
package com.wpollock.searchengine; synchronized class Main$3 implements java.awt.event.ActionListener { void Main$3(Main); public void actionPerformed(java.awt.event.ActionEvent); }
com/wpollock/searchengine/Main$4.class
package com.wpollock.searchengine; synchronized class Main$4 implements java.awt.event.ActionListener { void Main$4(Main); public void actionPerformed(java.awt.event.ActionEvent); }
com/wpollock/searchengine/Main$5.class
package com.wpollock.searchengine; synchronized class Main$5 implements java.awt.event.ActionListener { void Main$5(Main); public void actionPerformed(java.awt.event.ActionEvent); }
com/wpollock/searchengine/Main$6.class
package com.wpollock.searchengine; synchronized class Main$6 implements java.awt.event.ActionListener { void Main$6(Main); public void actionPerformed(java.awt.event.ActionEvent); }
com/wpollock/searchengine/Main$7.class
package com.wpollock.searchengine; synchronized class Main$7 implements java.awt.event.ActionListener { void Main$7(Main); public void actionPerformed(java.awt.event.ActionEvent); }
com/wpollock/searchengine/Main.class
package com.wpollock.searchengine; public synchronized class Main extends javax.swing.JFrame implements java.awt.event.ComponentListener { private static final long serialVersionUID = 1; static final String DEFAULT_FILE_NAME = SrchNgn.txt; static final String VERSION = 1.1; static String indexFileName; static java.util.prefs.Preferences prefs; static long nextID; static javax.swing.ImageIcon appIcon; static final javax.swing.JLabel numItemsIndexed; private final javax.swing.JButton searchBtn; private final javax.swing.JButton aboutBtn; private SearchType selectedSearch; private javax.swing.JTextField searchTerms; private javax.swing.JTextPane results; static javax.swing.JFrame maintenanceWindow; static final String INDEX_FILE_NAME = index_file; static final String MAIN_X = Xpos; static final String MAIN_Y = Ypos; static final String MAIN_HEIGHT = height; static final String MAIN_WIDTH = width; static final String MAINT_X = maintXpos; static final String MAINT_Y = maintYpos; static final String MAINT_HEIGHT = maintHeight; static final String MAINT_WIDTH = maintWidth; static final String FILE_HEADER = SearchData 1.0; static final String FILE_ENCODING = UTF8; static final String LAST_DIRECTORY = LastvisitedDir; static void <clinit>(); public static void main(String[]); public void Main(); private void updateSearchBtn(); public void componentMoved(java.awt.event.ComponentEvent); public void componentResized(java.awt.event.ComponentEvent); public void componentShown(java.awt.event.ComponentEvent); public void componentHidden(java.awt.event.ComponentEvent); void updatePrefs(); void positionWindow(); }
com/wpollock/searchengine/MaintenanceWindow$1.class
package com.wpollock.searchengine; synchronized class MaintenanceWindow$1 implements java.awt.event.ActionListener { void MaintenanceWindow$1(MaintenanceWindow, java.util.prefs.Preferences, Main); public void actionPerformed(java.awt.event.ActionEvent); }
com/wpollock/searchengine/MaintenanceWindow$2$1.class
package com.wpollock.searchengine; synchronized class MaintenanceWindow$2$1 implements Runnable { void MaintenanceWindow$2$1(MaintenanceWindow$2); public void run(); }
com/wpollock/searchengine/MaintenanceWindow$2.class
package com.wpollock.searchengine; synchronized class MaintenanceWindow$2 implements java.awt.event.ActionListener { void MaintenanceWindow$2(MaintenanceWindow); public void actionPerformed(java.awt.event.ActionEvent); }
com/wpollock/searchengine/MaintenanceWindow$3$1.class
package com.wpollock.searchengine; synchronized class MaintenanceWindow$3$1 implements Runnable { void MaintenanceWindow$3$1(MaintenanceWindow$3); public void run(); }
com/wpollock/searchengine/MaintenanceWindow$3.class
package com.wpollock.searchengine; synchronized class MaintenanceWindow$3 implements java.awt.event.ActionListener { void MaintenanceWindow$3(MaintenanceWindow); public void actionPerformed(java.awt.event.ActionEvent); }
com/wpollock/searchengine/MaintenanceWindow$4.class
package com.wpollock.searchengine; synchronized class MaintenanceWindow$4 implements java.awt.event.ActionListener { void MaintenanceWindow$4(MaintenanceWindow); public void actionPerformed(java.awt.event.ActionEvent); }
com/wpollock/searchengine/MaintenanceWindow.class
package com.wpollock.searchengine; synchronized class MaintenanceWindow extends javax.swing.JFrame { private static final long serialVersionUID = 1; static final javax.swing.JLabel numItemsIndexed; static javax.swing.JTable fileTable; static void <clinit>(); public void MaintenanceWindow(Main, java.util.prefs.Preferences); void positionMaintWindow(); }
com/wpollock/searchengine/SearchEngineTest.class
package com.wpollock.searchengine; public synchronized class SearchEngineTest { public void SearchEngineTest(); public void testLoadConfigFile(); public void testReadConfigFile(); public void testGenerateConfigFile(); public final void testDocPosConstructor(); public final void testDocPosCompareTo(); public final void testDocPosEquals(); }
com/wpollock/searchengine/SearchType.class
package com.wpollock.searchengine; final synchronized enum SearchType { public static final SearchType AND; public static final SearchType OR; public static final SearchType PHRASE; static void <clinit>(); private void SearchType(String, int); public static SearchType[] values(); public static SearchType valueOf(String); }
FileFormat.txt
Index File Format Version 1.0 The file SrchNgn.dat (Search Engine Data) will be text with long lines, in UTF-8 encoding, and DOS end of line markers (<CR><NL>). The first part of the file will list the files used to generate the index, one per line. A blank line then separates the file list from the index data. The first line of the file will start with the text: SearchData 1.0 which indicates the version of the file format, in case it changes someday. The next line contains the next Unique file ID to use (an unsigned integer). This should initially be zero. For example: 0 After these two initial version lines, each file is listed, one per line, in this format: <ID> <TAB> <pathname of file> <TAB> <time of last modification> where "<ID>" is the unique document ID, <pathname of file> is a string for the absolute pathname on the local system of the file (note, filenames can't contain TAB characters), and "<time of last modification>" is an unsigned integer (a long) representing a standard timestamp (milliseconds since the epoch, 00:00:00 GMT, January 1, 1970). An example might be: 1 C:\Temp\file.txt 1329170774139 After the blank line that marks the end of the list of files, the inverted index data runs to the end of the file. There is one line for each word, with the first field the word and the remaining fields the pairs of numbers that represent the document ID and position within the document. The pair of numbers is separated with a comma. Fields are separated with white-space. Leading or trailing white space is ignored. For example: apple 0,12 3,0, 3,19, 3,1262, 12,0 (JSON might be a better choice for version 2.)