From d5ad24811ddc784932dd653723e4b3a6fcc0714f Mon Sep 17 00:00:00 2001 From: Ryan Hope Date: Fri, 11 Apr 2008 13:54:37 -0400 Subject: [PATCH] jhdsf --- project1/Location.class | Bin 1839 -> 0 bytes project1/Location.java | 5 +- project1/Puzzle.class | Bin 5100 -> 0 bytes project1/Puzzle.java | 5 +- project1/PuzzleFileFormatException.class | Bin 405 -> 0 bytes project1/RCS/Location.java,v | 116 +++++++++++++++++++++++----- project1/{Puzzle.java => RCS/Puzzle.java,v} | 68 +++++++++++++--- project1/RCS/WordSearch.java,v | 56 ++++++++++++-- project1/WordSearch.class | Bin 2744 -> 0 bytes project1/WordSearch.java | 5 +- 10 files changed, 217 insertions(+), 38 deletions(-) delete mode 100644 project1/Location.class delete mode 100644 project1/Puzzle.class delete mode 100644 project1/PuzzleFileFormatException.class copy project1/{Puzzle.java => RCS/Puzzle.java,v} (90%) delete mode 100644 project1/WordSearch.class diff --git a/project1/Location.class b/project1/Location.class deleted file mode 100644 index b336f1230fdf0060c5351865718102ce556f3276..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcwPel00001 literal 1839 zcwT*!%Wo4`6vn?BkK@+_;usT1LJ5JUV+UfwBP}IP3xPnug{nc32x2iwMq!Zgz<5Ho zz^=QlfIb#c*Il$y2~v?*vfz(GeCN(!8)wpy#`oNN&-u>poO{RbKm7L=z!Yw#(4&y9 zd8>BddW{qeh5q~YW4ltf8|#&uEBBq%K*8Ab{56GvT6=3T@ZHAxdG0lT@-`LJf|zq& zor9xS3`fs;XWWJx%qk?T(h^tayfr6_1o};w=*xhzCUQuNwa-L0wDz0Ggw_EQDWnzl z*4&13W8=Y!W<(LyS`-muFRuFBe>@_6|%KYH4!moE%1@-xpgO43~WEpgd`$$ zuGzU}Sf4xU8d@%Tmf_yz#+r7|G&}5YJ@jd|?R4OU-C}`OX=e{pm{1t(UcR{D*4G?A zjS~tzcdRVRs7T9BDip1qBBdqqIA!8A&amnB!-r0TM>fK8b~s1U=hK+x!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O{_@?9*~bq+{vBIMOgLlj-Cd!lz4| zy_%3yOszT2*OYUGJQF~ergTzigp!FF3}q%_3{sr8y&gJr2y1Cv73b@i64J?C2?JHI z8}I~?2&?y`<)rK#vz(N@<2XSl9bEsE6>K+?sKtVsYKNVdN?D0)1RvN48j}!g@wsjP z88(N_K-?9B>ysHAqjkrr^#rA-=wmM)VCpYmg)3wYT!GK>kUU3QPcY@rBr#}I3>p=K zM#Z2}F=$i_>J@|Cib0KHa8fb&&}Pt-#9*t>#WG}PHxt1nA-L`?5r!s1I7{AXccKW6Q_#dpU~nBMP@!U#*t&ypxb6{V=6 z6jhX>ic(Zj>Qt0E6s1;0=~+c-j!mg6iPB?tq;#)pN&jR_zo5~-q%rRj)3504uZih5 z#Pl9Nu71l}@;kncf6v$IA6QfW$OG^vy7Mlp>z|V_btz0;3R9QD)TJ43sy zC`_jmrVJaCnS`nN_I2f+<BQY0(!ENh$tO-| za0n0FA{DyuVuqN4`C=*-ifLFPrlUxtW2KnI?^+)}U^DoEIU7Mf+bQP#-%gz1tMECS z(mQ-cYPi9h==y3=V}U4k+K7r>7LGoLgm-$3h*p&6D7uV8Ie7%2zgT0DmN)Glb<;NT$B}=P*D;73xI`{A zk%u&qj|{N{nW6xT#8NC5%dkQeqJ(XkSdNW?muIm8m29g;F?NcTs1>WQmu<6HjeVj7 zEus`{Y!8SvFvVJapO)bu+oNI~o)GJCOl-hOwx`5KJTJ=eg4l$!Y|o3$xF9NUQEb5# zwga@`Ds34SyOKhCLxuJRU(oWp?cys*204YH8ngl`zkI%JU$-;pW8%6!mzVj(b=!{@ OtxKp3?L~{lrT+nEo9|Ho diff --git a/project1/Puzzle.java b/project1/Puzzle.java index 296d83c..394d2d4 100644 --- a/project1/Puzzle.java +++ b/project1/Puzzle.java @@ -2,10 +2,13 @@ * Puzzle.java * * Version: - * $Id: Puzzle.java,v 1.1 2008/03/31 03:59:18 rmh3093 Exp rmh3093 $ + * $Id: Puzzle.java,v 1.2 2008/04/11 17:53:32 rmh3093 Exp rmh3093 $ * * Revisions: * $Log: Puzzle.java,v $ + * Revision 1.2 2008/04/11 17:53:32 rmh3093 + * finding words works + * * Revision 1.1 2008/03/31 03:59:18 rmh3093 * Initial revision * diff --git a/project1/PuzzleFileFormatException.class b/project1/PuzzleFileFormatException.class deleted file mode 100644 index e24987be7256fc235427c571787e08c4666e30d4..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcwPel00001 literal 405 zcwTi-O-lnY6r8kc({5LHZLM0r^|V!R5xiBrhy|fYq0)O=LrK|>60=hKuk@he!5`p{ z65m$DdN2b!rt40s|SfF3a7Ng=Q5|)UaB1Z*yhc94H$Q?Z+ dZ@t2LoZYkuE3gQ63HMMY9~TGIDU+6i^97*kTCo5C diff --git a/project1/RCS/Location.java,v b/project1/RCS/Location.java,v index 464534e..59d812b 100644 --- a/project1/RCS/Location.java,v +++ b/project1/RCS/Location.java,v @@ -1,11 +1,16 @@ -head 1.1; +head 1.2; access; symbols; locks - rmh3093:1.1; strict; + rmh3093:1.2; strict; comment @# @; +1.2 +date 2008.04.11.17.53.12; author rmh3093; state Exp; +branches; +next 1.1; + 1.1 date 2008.03.31.03.58.55; author rmh3093; state Exp; branches; @@ -17,19 +22,22 @@ desc @ -1.1 +1.2 log -@Initial revision +@finding words works @ text @/* * Location.java * * Version: - * $Id$ + * $Id: Location.java,v 1.1 2008/03/31 03:58:55 rmh3093 Exp rmh3093 $ * * Revisions: - * $Log$ + * $Log: Location.java,v $ + * Revision 1.1 2008/03/31 03:58:55 rmh3093 + * Initial revision + * */ /** @@ -43,11 +51,17 @@ text */ public class Location { + String word; + int sRow; //the row of the first character + int sCol; //the column of the first character + int eRow; //the row of the last character + int eCol; //the column of the last character + /** * Create a location of [(0,0) (0,0)] */ public Location() { - + sRow = sCol = eRow = eCol = 0; } /** @@ -59,7 +73,10 @@ public class Location { * @@param eCol the column of the last character */ public Location(int sRow, int sCol, int eRow, int eCol) { - + this.sRow = sRow; + this.sCol = sCol; + this.eRow = eRow; + this.eCol = eCol; } /** @@ -69,7 +86,7 @@ public class Location { * @@return */ public int getStartRow() { - return -1; + return sRow; } /** @@ -79,7 +96,7 @@ public class Location { * @@param sRow row containing the first letter of the word */ public void setStartRow(int sRow) { - + this.sRow = sRow; } /** @@ -89,7 +106,7 @@ public class Location { * @@return */ public int getStartCol() { - return -1; + return sCol; } /** @@ -98,7 +115,7 @@ public class Location { * @@param sCol column containing the first letter of the word */ public void setStartCol(int sCol) { - + this.sCol = sCol; } /** @@ -108,7 +125,7 @@ public class Location { * @@return */ public int getEndRow() { - return -1; + return eRow; } /** @@ -118,7 +135,7 @@ public class Location { * @@param eRow row containing the last letter of the word */ public void setEndRow(int eRow) { - + this.eRow = eRow; } /** @@ -128,7 +145,7 @@ public class Location { * @@return */ public int getEndCol() { - return -1; + return eCol; } /** @@ -138,7 +155,7 @@ public class Location { * @@param eCol column containing the last letter of the word */ public void setEndCol(int eCol) { - + this.eCol = eCol; } /** @@ -146,7 +163,7 @@ public class Location { * following format: [(startRow,startCol) (endRow,endCol)] */ public String toString() { - return null; + return "[(" + sRow + "," + sCol + ") (" + eRow + "," + eCol + ")]"; } /** @@ -159,8 +176,71 @@ public class Location { * @@return */ public boolean equals(Location other) { - return false; + boolean ret = false; + if (other != null) { + if (this.eCol == other.getEndCol()) { + if (this.eRow == other.getEndRow()) { + if (this.sCol == other.getStartCol()) { + if (this.sRow == other.getStartRow()) { + ret = true; + } + } + } + } + } + return ret; } } @ + + +1.1 +log +@Initial revision +@ +text +@d5 1 +a5 1 + * $Id$ +d8 4 +a11 1 + * $Log$ +d25 6 +d35 1 +a35 1 + +d47 4 +a50 1 + +d60 1 +a60 1 + return -1; +d70 1 +a70 1 + +d80 1 +a80 1 + return -1; +d89 1 +a89 1 + +d99 1 +a99 1 + return -1; +d109 1 +a109 1 + +d119 1 +a119 1 + return -1; +d129 1 +a129 1 + +d137 1 +a137 1 + return null; +d150 13 +a162 1 + return false; +@ diff --git a/project1/Puzzle.java b/project1/RCS/Puzzle.java,v similarity index 90% copy from project1/Puzzle.java copy to project1/RCS/Puzzle.java,v index 296d83c..0e77249 100644 --- a/project1/Puzzle.java +++ b/project1/RCS/Puzzle.java,v @@ -1,4 +1,33 @@ -/* +head 1.2; +access; +symbols; +locks + rmh3093:1.2; strict; +comment @# @; + + +1.2 +date 2008.04.11.17.53.32; author rmh3093; state Exp; +branches; +next 1.1; + +1.1 +date 2008.03.31.03.59.18; author rmh3093; state Exp; +branches; +next ; + + +desc +@initial commit +@ + + +1.2 +log +@finding words works +@ +text +@/* * Puzzle.java * * Version: @@ -21,7 +50,7 @@ import java.util.Scanner; /** * This class represents word search puzzles. * - * @author rmh3093 + * @@author rmh3093 */ public class Puzzle { @@ -31,7 +60,7 @@ public class Puzzle { * Load a puzzle from a puzzle file. If any errors occur during the * processing of the puzzle file, the appropriate exceptions will be thrown. * - * @param puzzleFile the name of the file containing the puzzle to load. + * @@param puzzleFile the name of the file containing the puzzle to load. */ public Puzzle(String puzzleFile) throws PuzzleFileFormatException, IOException, FileNotFoundException { @@ -44,10 +73,10 @@ public class Puzzle { * the puzzle file, the puzzle will be set to null and the appropriate * exception will be thrown. * - * @param puzzleFile - * @throws java.io.FileNotFoundException - * @throws java.io.IOException - * @throws PuzzleFileFormatException + * @@param puzzleFile + * @@throws java.io.FileNotFoundException + * @@throws java.io.IOException + * @@throws PuzzleFileFormatException */ public void setPuzzle(String puzzleFile) throws FileNotFoundException, IOException, PuzzleFileFormatException { @@ -291,8 +320,8 @@ public class Puzzle { * string was found will be returned. If the string is not found in the * puzzle, null will be returned. * - * @param word the string containing the word to search for. - * @return the location of the word if found and null otherwise. + * @@param word the string containing the word to search for. + * @@return the location of the word if found and null otherwise. */ public Location find(String word) { char[] target = word.toCharArray(); @@ -339,3 +368,24 @@ public class Puzzle { } } +@ + + +1.1 +log +@Initial revision +@ +text +@d5 1 +a5 1 + * $Id$ +d8 4 +a11 1 + * $Log$ +d107 180 +d298 41 +a338 1 + return new Location(); +a340 1 + +@ diff --git a/project1/RCS/WordSearch.java,v b/project1/RCS/WordSearch.java,v index a2e3522..42ab3cf 100644 --- a/project1/RCS/WordSearch.java,v +++ b/project1/RCS/WordSearch.java,v @@ -1,11 +1,16 @@ -head 1.1; +head 1.2; access; symbols; locks - rmh3093:1.1; strict; + rmh3093:1.2; strict; comment @# @; +1.2 +date 2008.04.11.17.53.47; author rmh3093; state Exp; +branches; +next 1.1; + 1.1 date 2008.03.31.03.59.36; author rmh3093; state Exp; branches; @@ -17,19 +22,22 @@ desc @ -1.1 +1.2 log -@Initial revision +@finding words works @ text @/* * WordSearch.java * * Version: - * $Id$ + * $Id: WordSearch.java,v 1.1 2008/03/31 03:59:36 rmh3093 Exp rmh3093 $ * * Revisions: - * $Log$ + * $Log: WordSearch.java,v $ + * Revision 1.1 2008/03/31 03:59:36 rmh3093 + * Initial revision + * */ @@ -62,6 +70,17 @@ public class WordSearch { System.out.println(theWords[i]); } } + + private static void findWords() { + int wordCount = theWords.length; + Location location; + for (int i=0; it=2xZ z@2A#I$C*0(EY1X`Ozm&&O#he8^e?FW&L$WTm`;Yh=iYlB-}%nDhrj;)^$~z(+*RRI z5IpH5qG8iWL`GHk6|5UGE*gz7!yaku8yYhsu7U!0)a*}9O~p(F0X-wNQsl81Cl!>Q z(Q{^DH(}W$R9Mqy*_PX`Ag`u&K!Ly0iJC#=;Ta7D2r4MjE!*r(jSrcL5|>EWNn zvti4QJ^}lJhJ36Eq6T#;YDrXvQw{al!F)wmLG?=Rbs@;L9J^ITgM#%>YjmWnSkz1e z(S%(pnwRq6X=r#6FENdaMl5Ca4HL}bIGK_&&a%)!>_m$cE)>A4Oe!P?do;A7jR_d> zxGA7_t_XS+l=Rt-{VMiJTV?ao@ESU#x15YBD_gS)n*CIZWzEPjplqUeo|ReTy!RD5%JkN-Vpa#JJ%uy6$6> zE_NM6FIwbtOhXvQNs~EAKuPaGoDP7!QjzQFJ)uyS$3hsG!*MnR2aI zV^}n#yr*zRYH^mgHTvS1>_E9ar{TQEqis&Q^2~xT5K%F-;Lann$9ByTGoc|0dD?L! zku-axZC7mV9&yb68I@GjQ6t$)-*Psl;ex#9{7B46ngNU}*t#Sy%VxJ((U3fhP>d9W zhCOZzP$CL;%+ngia)l z5tDq0K`6(d$Cho3liC|pZ-`IH=x7PxL)lHlf*dIyYv@8qCfH3GRJWe0;ljHf5X;Xr zeD2lD8)ahirPu_;&(|7CGSasio);~@kr-ji`bPU@gCEyu&Rh;#bQk zU>%CN1|^fM@eo7!xK_`g^igYG+cb)2P{vK=t~4rdC`#qVdyoIgc`c_GU^~Ax^ihj4 zu2me*Mc$o{=M{|k9Cs@BTPZP3;VT>OCu&GihcfZ@PGipuwsEtG@wV&re_%V~&tvDH zcQ%K{S-f2GN*cTC)7Z-;jZOjPQ#KLUpE+RF3{ zqazEjoUjkzAc1kxdQg3|WV3KR3*Gnj^07#JoG`q zTXKR(>oN#uaq{