From 86f9da1a4e94364d96e5bc2bee4230ccc87049b4 Mon Sep 17 00:00:00 2001 From: Arti Zirk Date: Fri, 25 Sep 2015 08:44:56 +0300 Subject: [PATCH] something --- .classpath | 6 + .project | 17 + .settings/org.eclipse.jdt.core.prefs | 11 + bin/lib/TextIO.class | Bin 0 -> 15004 bytes bin/praktikum2/Grupeerija.class | Bin 0 -> 1112 bytes bin/praktikum2/Korrutaja.class | Bin 0 -> 1067 bytes bin/praktikum2/NimePikkus.class | Bin 0 -> 1074 bytes bin/praktikum2/Tere.class | Bin 0 -> 1001 bytes bin/praktikum3/CumLaude.class | Bin 0 -> 1543 bytes bin/praktikum3/ParooliSisestus.class | Bin 0 -> 561 bytes bin/praktikum3/Tehisintellekt.class | Bin 0 -> 1173 bytes bin/praktikum4/numbrid0246.class | Bin 0 -> 737 bytes bin/praktikum4/numbrid110.class | Bin 0 -> 734 bytes bin/praktikum4/numbrid302734.class | Bin 0 -> 742 bytes bin/praktikum4/table1.class | Bin 0 -> 814 bytes bin/praktikum4/table2.class | Bin 0 -> 1037 bytes src/lib/TextIO.java | 1008 ++++++++++++++++++++++++++ src/praktikum2/Grupeerija.java | 21 + src/praktikum2/Korrutaja.java | 31 + src/praktikum2/NimePikkus.java | 13 + src/praktikum2/Tere.java | 13 + src/praktikum3/CumLaude.java | 38 + src/praktikum3/ParooliSisestus.java | 11 + src/praktikum3/Tehisintellekt.java | 40 + src/praktikum4/numbrid0246.java | 12 + src/praktikum4/numbrid110.java | 12 + src/praktikum4/numbrid302734.java | 12 + src/praktikum4/table1.java | 23 + src/praktikum4/table2.java | 30 + 29 files changed, 1298 insertions(+) create mode 100644 .classpath create mode 100644 .project create mode 100644 .settings/org.eclipse.jdt.core.prefs create mode 100644 bin/lib/TextIO.class create mode 100644 bin/praktikum2/Grupeerija.class create mode 100644 bin/praktikum2/Korrutaja.class create mode 100644 bin/praktikum2/NimePikkus.class create mode 100644 bin/praktikum2/Tere.class create mode 100644 bin/praktikum3/CumLaude.class create mode 100644 bin/praktikum3/ParooliSisestus.class create mode 100644 bin/praktikum3/Tehisintellekt.class create mode 100644 bin/praktikum4/numbrid0246.class create mode 100644 bin/praktikum4/numbrid110.class create mode 100644 bin/praktikum4/numbrid302734.class create mode 100644 bin/praktikum4/table1.class create mode 100644 bin/praktikum4/table2.class create mode 100644 src/lib/TextIO.java create mode 100644 src/praktikum2/Grupeerija.java create mode 100644 src/praktikum2/Korrutaja.java create mode 100644 src/praktikum2/NimePikkus.java create mode 100644 src/praktikum2/Tere.java create mode 100644 src/praktikum3/CumLaude.java create mode 100644 src/praktikum3/ParooliSisestus.java create mode 100644 src/praktikum3/Tehisintellekt.java create mode 100644 src/praktikum4/numbrid0246.java create mode 100644 src/praktikum4/numbrid110.java create mode 100644 src/praktikum4/numbrid302734.java create mode 100644 src/praktikum4/table1.java create mode 100644 src/praktikum4/table2.java diff --git a/.classpath b/.classpath new file mode 100644 index 0000000..fceb480 --- /dev/null +++ b/.classpath @@ -0,0 +1,6 @@ + + + + + + diff --git a/.project b/.project new file mode 100644 index 0000000..7228162 --- /dev/null +++ b/.project @@ -0,0 +1,17 @@ + + + Praktikumid + + + + + + org.eclipse.jdt.core.javabuilder + + + + + + org.eclipse.jdt.core.javanature + + diff --git a/.settings/org.eclipse.jdt.core.prefs b/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000..3a21537 --- /dev/null +++ b/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,11 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.8 diff --git a/bin/lib/TextIO.class b/bin/lib/TextIO.class new file mode 100644 index 0000000000000000000000000000000000000000..b051ac058ff78a3f43d6e44b2a4a83d395c559d4 GIT binary patch literal 15004 zcmb7L2Yggj_CDvmNoF#+H z#fI2oSAvEpF6!FXwytYgb&Kw-N zAKFVqZF;Ecg zr@V?w?W<;76N!W))#0`fgm4{D)Kg4-oP{x+wN7L~AlA_2M3@fJ`n1KGgB20H*;wJe z!aS|UU^oy(iFnzT`1=DK{N11%n8iLKC=GY88C@fkI z(^ZGpI9@7b8mR1a0FGWN#&Gd>3Urv!3AAXKGpLlxy;RoCZI*6|#+(+5`cp+J=qa5m z{ZvF_EE-GWn9`@YDh)177$~)E(Q-eHq6yM^B2#X%k!$Iq?e1%B3nJ1YtcX& zB+uqqG?)hYs2*-xcy!4rWkpr1Mwd-Fro>MRX|b0UF%43xrg(sBM~e=pB~0Fia7!!v zpQ+5%NX4ZaNJR(uPuvS+^ko(uLbi`!t3G(JApSB}GMrh0ZB8 zMcq^_suEd8S~QGoxjV|D0wt(Wksw3`=jzQ+%e{0maEbe+wA6k5bP}B^xNP#$W~Ktw zLg`x<3_5EA!I_b@Z7ohHmQdeIr^nqU#TRC^H3z|ZJ~|UfRtG|(Vs^OI3E9G{c7dO^ z(5doqjzzzqa}jcZR=i#Fqi%Je^hzI{2lNW;#&E<|kd*scwkQi>}hl=n#mk>vPla$$Qh6$cF!llzTErN=r6E6Ur{jHe69&;jY%!=p zMe&xrzr~_kX%kXi)QRcDwyZf8ga>b@+bp`B?vPha;SGymhj`)}5+%(eIH>dpd?zP%QbHMXx8!zcg^7 zTla`v{$SCYbS*}3Ha16NQ6IgHbiS+!t|k6e;G;hwtP1QvQ0Qipty`7b_Uy2|Dcojn zKwW0X!gj=I4F(z&0VRx*SLLU7>2F^8t4k*dPhX@Azc>&A`Tm{W zgA<9PqVQ{Mj5eZg%+c*A{&vA>BtmQ?0=@D92K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PwG0gcU`4Ht}#t|0Jc^5#n>D8{|hB&r0!Ly((3uv-uVPd^=%8zx?jp z?e=>Ym8gpOk`7}=t}(OI!0Gi~u?3E5_DaYt$0YaaInU83J^U0ECQ+(WC_M~Y<{IV}N?CbDUH@nHPiWsx9YEdGD~x1enR literal 0 HcmV?d00001 diff --git a/bin/praktikum2/Grupeerija.class b/bin/praktikum2/Grupeerija.class new file mode 100644 index 0000000000000000000000000000000000000000..01b52ea6eb25e06d9a5800261d26b9570c3573f5 GIT binary patch literal 1112 zcmZux-A)rh6#j;`Y`d-&S_^6mE-2W7QsqyifKd}jVg%$YgA-}%nj{r&g*F93^pq+oy{({^~%lTE)hU)*y1wh)eN za0O9@p$0$XMUz`bal6(K2Oh)VnzW?1!4Sz8b{V42?7C19K|(_egAB=vw8RU)RTIt* zubF}&Rk07axyv0Hyt~S%_d&W0qm>JbmndelvNS%XN z{p5P0rQs?v1kd&fZ6*wscJU=edK52ss}#p5Wv)tBxE|N3pB7z&&YiVo5~AAI2!Ka9)ohoO{f{ z(RB5u-E8_nl@JDj(ocSvLT{WLog9(9hnMEf9fKAk-OpZk+zi_3jP_|p46ID54hj1q z3EgMVY3PwW3kYiw#Z}vP4#cJmRx-JDw&!y}yO;p+Oy2}BKsQ=sIu&{qNiveLnQw@H z?wD0N12ZV#5}jJ;K=LxZ61ajSX@cNC0&deD|TFb3&V=o?9394c*;hH28w z60~Iu;VH>Yvc5tJ??~2=?zFNP!o__&AlSorjd?6kGn05ie~Sg;W*X~QqFaP=tx&E7 MM9Kb;ya%xI56P1ZJOBUy literal 0 HcmV?d00001 diff --git a/bin/praktikum2/Korrutaja.class b/bin/praktikum2/Korrutaja.class new file mode 100644 index 0000000000000000000000000000000000000000..5e042aeb2a1186ac976c122d4a4b49bbf8fe1191 GIT binary patch literal 1067 zcmZuw+foxj5IsWz8`k9(Zb~99sF;ATf_NhV1eB_jQLG9T%kpVL#xP;Co7(KA^lSVE zeF&D8et;ik*|Qr3Brh|4neIN_edg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mqyzxX literal 0 HcmV?d00001 diff --git a/bin/praktikum2/Tere.class b/bin/praktikum2/Tere.class new file mode 100644 index 0000000000000000000000000000000000000000..803968060afc8b4c28aac46e1b729131b72854fc GIT binary patch literal 1001 zcmZ`&T~8B16g>ki+b$~~1&Rpjpr|cER}eo7D3F*mHfjPPAwCW5qzvrNHrrVe-uyBC z0evV&6JLDO|75(=)({Z)VP@{!JLlYU@7f=vf~48zS>92s?#gv#a)KfR#cZR`jPdJ#sJ||m6mUka9_qdVn2`! zxoT7s!LEpvwR@K-bD&xbqty$vWr7Ta(hT{+`|26}wuzN)l#9DAMlt3fN4OntVpQO7 zi9qVQh&_yBf?=>BO+~ki&^6-E7m8h=bD?DmH0j|grbr7tAmT!$Sjl1<*B#896Tf}Z zGBWgV12-u+N+@`ui>V_29c5-HKPkepgIR{ji)n8rDyYjigWC*Kd(i?91&=6Wz7ZR> zzz?K3k^y(YamQBiE}<7L*UnM!P{cg-K{T7BnPG;q{wKJ{Sk7R9!Q(ywK|c;etO!&s*n=gZ{bsTJuoZRG-; z!E=VL_Ml6^1m) zPAJ^nj*_@0Unx73Sv%t;n;T|9J*7VZ=%W)2F|7_+KJAS5^!zC@pE_=rR_mrq4AScL z&K|CimBkQ->Bc_(fK&%`dDQu}`UNAYHuBT;wa>Wr4SX+m>lAY{ZQRS#|p}kpZj)MHtvYBB^eS0cS~3$(NMv@b! zMUi2+a`ON$E*01Aw&Jd33Euk4l6-NFYpEpnWLpVOY00M-F5KhOP7Lp3-o)Gif!ko> zSU{G++!dBDH%WqII^Ure_DTB`iF|=!rSJ;M{|O_Ciwx^;Wa7xG&`Rw(@->vASY+6E z3qWsGEwY;Eiv0;g=C-hQeBRol4w~bh5EV{iG#}0pcWuEds&2WqvS?CHA{WOJu8@Rb z6Is;e$s@WbQ;K4RVX>$jYErSi@>76Z%E-0pW&$2(lqVykvb)H@>^E4qGTORf_QD$#u>7J@0kSExHj%u~!3gM=rUp5O=VVCH3TX5^<|+j$=z%6l2Q zbSP^aAKm{26JhC}F%sPSaTAw+$53D{lNqozLbfF&$&M1g;Ngnl4Dp^Kp0mVs8KYPs z?=>WF7i0K}-mfy9-^B#J#tD3fNqkRD^8-%fA!RdimsEd57%A*Wm=H1 literal 0 HcmV?d00001 diff --git a/bin/praktikum3/ParooliSisestus.class b/bin/praktikum3/ParooliSisestus.class new file mode 100644 index 0000000000000000000000000000000000000000..c45c7a984a287137c64176c2c19c3f319af69239 GIT binary patch literal 561 zcmZ{hO;5r=5Qg6^U}>#_e5r^Zcmfahpos^J7ZXp7lGJeVwBQC8+Aisb2|r5@nt1RB z_@j(dFd-OBlbO!UzVAMretmy@0yxL94vnEc3Hdmd(&-4t zy&ex`TK_h)@so@g8qWU&9dh@%3>a#y2WLUz#-R*`op#T_7RowGOPuaBiiK~Xf+{hp zgpjLqu~c@KlriZA_d9uPGiXy~Vi$Wl>I~)C9m~foG_cR0Pg12vEY;R36hh_UkUprq zf|S8@RT2)wjZF7Z`LpTM^jb7Qxb$lPjoxUL6m_a>%8YXE>I76vAbQky(I3ljqeIHW$q5k(EnAA7EPQ~&?~ literal 0 HcmV?d00001 diff --git a/bin/praktikum3/Tehisintellekt.class b/bin/praktikum3/Tehisintellekt.class new file mode 100644 index 0000000000000000000000000000000000000000..34b0a0d1fce9e92f62d5395e1e1c55e231050070 GIT binary patch literal 1173 zcmZ`(T~8B16g|^+*<~r8wF0*23Vu-hsESsl6%)TAf?!fpAAB&=GM2I1Eorwz-}HCr zi-g2yO+;hV7vB6&8qaQPgoqEFow@g(JLjHzr$2su`3~SBu9=7kjITFk&DXVdeKz}0 zt?8EbeC4{T=9`EK3_X(@GV4mOnq4VBQx#vJr=UIU&kIDSGbMr8&Bm&-5k+qt26_Yr zm$avr+x4<)K9prw35+Z?D$*^&<@>M;K14xo$qfN%i4p=v`4~X=MSF)bBFe-4Ms9UP#OK0b6t>tV; zuict+Y>Xpi;*dZhymc=yjx;7H!+MbGsX$@+Uv9hUc67^U_9bEC2#%U?1Z-EA*@5T& z!b%*Im=dt6%6Gj5j}=hr1q;Vn${)VIqRM{=TR15&Q3}{QN;`gIO*;+Om5!&X(${*! zV~56(iDL$*1k8}SOJS4yaL<%1oMC;7&7F^BWg#mNFYRnqrBmx#&I=gDMp>8HAla<4 zi;3L@cl$$_YU#T2R4A)}SYVYQ@2+8Zx1UjKoRz`90bPq7Mt2YWMPF8G_vLzbitJ*e z-K?lPI+(M>-T^)vG!I8X`8e=EggZ_sSCgkKzk*+5<`b;)(L>v-4;UIb82yImHpU)(#^FL>IJV1hE%h2^`VHcN1^6^Xb%T zE*8xhsq`l7WGrXAL(fFcNE+4_l1XF8-o!uvI8DGiOazv<9n0C!(ib?-1=&Kf0r3)& zTuoB7_$+#H7&gbKpB*2-1rnb{0+;zJ3XHpsQQX29?s6y=aR|$de#}X%z(JjgwTXO= zDZIpqP>A_XvCK2eJBG2&zmH3lViHe~<1WI?_xQU+Sqiv~E8N9+%MD!R&cGZ|BQSqr VMhNQ{-<=SV(P5Jr^7KSd_ze*B36TH* literal 0 HcmV?d00001 diff --git a/bin/praktikum4/numbrid0246.class b/bin/praktikum4/numbrid0246.class new file mode 100644 index 0000000000000000000000000000000000000000..c4c186a6eabe7d3ae0f8c0cdddc22fd17f438061 GIT binary patch literal 737 zcmZuvO>fgc5PfSqabsMXCNz|WkCc8TMZyS0TpV#hLW&e9l2K6A(b>QXPqdXFNMI@4cPbpMSpn0MN!g8wNvdmhg#^lQe95Q5p^s zIePH0{m6#JP(I@q+?(=f>>Ulx#85F5J2H~$F@xD`^%<-u@klr@QF2j0kzuVTBk`PY zMDmgkrh=i;i-&yL=ZVyDc4(z$!nhUE>#37k>Vr}8eYB;!ox{WP{^-Gd&q{LVxE^gu$ zgMGoLsW^JArF2_4Em@iG;10HJG#ILLjAbqtcd&@Ilc9Jj^*YMACEwSAu?-pqy$HadKiVQ$ zn<9@qBVRcDf|ZZ+v_n>>K@C^Px{Ctxs}z-R6>D^&n`cyKkl!&oAF%Zai_@% literal 0 HcmV?d00001 diff --git a/bin/praktikum4/numbrid110.class b/bin/praktikum4/numbrid110.class new file mode 100644 index 0000000000000000000000000000000000000000..3cf5f1a7e02b3469909ad2ede889df971e4dc131 GIT binary patch literal 734 zcmZuvO>fgc5PcInabsMPCM1Q1kCe8M6bVzQH%DBMkRk<&WE6xrZIUJ3CblEjuHep3 zLE;PtKuGWd_#ylX1k5Iul1Lmp2;56GEY*LX|uu7_D}nU_OdQ(uRSegFFg^Qcs2QDZ|M4 zxfo0(q0)?G-IqnP=k`b}cjs)j7sGmxJ5b%9QKGDrHuFJ9CGdmx!^9kij-TV&YrP26` ztNv%)eDRK`QMTXz{iUG|Xy^(|wguK;@m>l%IeSi1UqE3W2b|BLi95KKwM`$-{pkdZ9W1 literal 0 HcmV?d00001 diff --git a/bin/praktikum4/numbrid302734.class b/bin/praktikum4/numbrid302734.class new file mode 100644 index 0000000000000000000000000000000000000000..b49e74623a46810ad1542ee47681a624125fb0bf GIT binary patch literal 742 zcmZ`%O>fgc5Pch`absMXCNz`;LQ^OtMZ$li6r%keiZDKoe?F#Pv z4bGh500;?w0KbGE!Pj$QsmTFZp4r)*dGGDa{`m9tJAf8$naBw2%tASd^d$CLjvsr2 zP>&Ap+`V_$GLaQ19LrPbOr<||jt0kS7zyM$+Sk#20i)6E3uGSzBW1xr-o_eo0-HVU ztH(rA;Zr%7DuH4z7|Lm1hB}GU&202ap9oZX|Ko2H+mqTCC^ug8&UCm@sQq!f+0SDO zB@@LJmF}C9NO?9cV4Dhqn1Z(##X4}Furgx3l3sfq7n!g>+O=>ARTC9~tuvCYAE~hl zZCu6`0rON&V|Da0k255 zD^8NuWaQ8b`n7}4SpP6TwrG=Mu;3i6y-1+nV3fysY;q?l4w#pr-z(HQ?@{@PLb06v z2IIL={em6$6Kc=iir>|De}5*(1`^~Vva~sV913lny9rBqfrRVWpXb(a12@UjV8oaF Ni*K*Yu*ookgMaf9q$>ab literal 0 HcmV?d00001 diff --git a/bin/praktikum4/table1.class b/bin/praktikum4/table1.class new file mode 100644 index 0000000000000000000000000000000000000000..03c8262c4f4adee0fc10ed2aff20d278cb7213f7 GIT binary patch literal 814 zcmZ{h+int36o&sjGccUm4j|MMN>vo9k=77zKyFN$7||N3c;SWF;E1~%GYqD9?Spt> z!nIy#(nKG?2k<3)17oWH2C8iuGs&#I{=E+0TKn6<{#O7c+^}H?#D|{j_^LDRm5RP> zcHK=ImVmP>U&~@w_S?nn=C0fF1%egTSAJE%%oiF0*4@DiHv$vk7y<|itkhKBeK_tl zU2jJh5=hhrE!k~IPicQ4TK+3F5=hogG%mAfPpZB^I{&Qp51{UQs^2ab8ezndw2?T5 zSD%c0w->`Hq=+^clQcC?R)gXrX8O!`Wv?8zAdp=TcxHxf-&g9V9qc9Oz zs{69lc_4?2MMmm_vDb39lwNgo{&qL@L|6ki!8ZmBp7=QY+w_XGf;O=J8KDoe>j?k) z8cc}tADaizF3}5P87owD@()G?XrDNC#j)?0)hV{j+tw6?Ov-wPM3L$Hq)$ literal 0 HcmV?d00001 diff --git a/bin/praktikum4/table2.class b/bin/praktikum4/table2.class new file mode 100644 index 0000000000000000000000000000000000000000..923e24463c9bbb9efa852772e963eb9953099f76 GIT binary patch literal 1037 zcmZuw+fEZv6kVq?FheQQ3#}*=3xc#Ll$)ru_Qk}cv4XJ#G$fj79qT|lCGAwf_+rAV zFFyKYl!Qm44{A*G1N;I1!VfS8T&EW}@3ZIU-nSnBW-+h9CE(kr80(I; zUMtPU9V1sXr!}Yo-ZkT?5ic5cA-d(yHkCncanW6J{Sjq)SY4Fw$@w4q&~ zJ7d}ALamfDD@!twfIm~t8^vX#VoAG6s?HOuDiFw=D4bx@l402bq3CMnP(aqHSau;1 zTke1l0S*3R^0Hf1$1Hi!gCM1qYg8I+1Y70!9Y#8gH;qz4$7!}p6=u2CewMwlz zA93Rh`ZS!Sq4MLTU%KIfa(F>)yO{()E>qXMq+aUC(@h^^xy@kK<(IB|*?Cr+}0YE%kx z%tysF2g!CeA6BjBd?AshvDGp*No)ypWgR2Ge%sh+zL+~(u2u5pO-sIMr&C{&2{|ha zf@--;fQw(;0-hSJI8hMW#=b!RSig4jl-FQDCr?kqf!IZ>1E(oy{(F%+P|~^>sZ2Ol@GEt1+ujT1bDWy8I4P-V}LCUvAIz)v&1CZOT$Y) zA6DUqLH`1G)klgmT;-h$*Zu)D@z%Nk literal 0 HcmV?d00001 diff --git a/src/lib/TextIO.java b/src/lib/TextIO.java new file mode 100644 index 0000000..81177fb --- /dev/null +++ b/src/lib/TextIO.java @@ -0,0 +1,1008 @@ +package lib; + +import java.io.*; +import java.util.IllegalFormatException; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import javax.swing.JFileChooser; +import javax.swing.JOptionPane; + +/** + * TextIO provides a set of static methods for reading and writing text. By default, it reads + * from standard input and writes to standard output, but it is possible to redirect the input + * and output to files or to other input and output streams. When the standard input and output + * streams are being used, the input methods will not produce an error; instead, the user is + * repeatedly prompted for input until a legal input is entered. (If standard input has been + * changed externally, as by file redirection on the command line, this is not a reasonable + * behavior; to handle this case, TextIO will give up after 10 consecutive illegal inputs and + * will throw an IllegalArgumentException.) For the most part, any other + * error will be translated into an IllegalArguementException. + *

For writing to standard output, the output methods in this class pretty much + * duplicate the functionality of System.out, and System.out can be used interchangeably with them. + *

This class does not use optimal Java programming practices. It is designed specifically to be easily + * usable even by a beginning programmer who has not yet learned about objects and exceptions. Therefore, + * everything is in a single source file that compiles into a single class file, all the methods are + * static methods, and none of the methods throw exceptions that would require try...catch statements. + * Also for this reason, all exceptions are converted into IllegalArgumentExceptions, even when this + * exception type doesn't really make sense. + *

This class requires Java 5.0 or higher. (A previous version of TextIO required only Java 1.1; + * this version should work with any source code that used the previous version, but it has some new + * features, including the type of formatted output that was introduced in Java 5 and the ability to + * use files and streams.) + */ +public class TextIO { + + /* Modified November 2007 to empty the TextIO input buffer when switching from one + * input source to another. This fixes a bug that allows input from the previous input + * source to be read after the new source has been selected. + */ + + /** + * The value returned by the peek() method when the input is at end-of-file. + * (The value of this constant is (char)0xFFFF.) + */ + public final static char EOF = (char)0xFFFF; + + /** + * The value returned by the peek() method when the input is at end-of-line. + * The value of this constant is the character '\n'. + */ + public final static char EOLN = '\n'; // The value returned by peek() when at end-of-line. + + + /** + * After this method is called, input will be read from standard input (as it + * is in the default state). If a file or stream was previously the input source, that file + * or stream is closed. + */ + public static void readStandardInput() { + if (readingStandardInput) + return; + try { + in.close(); + } + catch (Exception e) { + } + emptyBuffer(); // Added November 2007 + in = standardInput; + inputFileName = null; + readingStandardInput = true; + inputErrorCount = 0; + } + + /** + * After this method is called, input will be read from inputStream, provided it + * is non-null. If inputStream is null, then this method has the same effect + * as calling readStandardInput(); that is, future input will come from the + * standard input stream. + */ + public static void readStream(InputStream inputStream) { + if (inputStream == null) + readStandardInput(); + else + readStream(new InputStreamReader(inputStream)); + } + + /** + * After this method is called, input will be read from inputStream, provided it + * is non-null. If inputStream is null, then this method has the same effect + * as calling readStandardInput(); that is, future input will come from the + * standard input stream. + */ + public static void readStream(Reader inputStream) { + if (inputStream == null) + readStandardInput(); + else { + if ( inputStream instanceof BufferedReader) + in = (BufferedReader)inputStream; + else + in = new BufferedReader(inputStream); + emptyBuffer(); // Added November 2007 + inputFileName = null; + readingStandardInput = false; + inputErrorCount = 0; + } + } + + /** + * Opens a file with a specified name for input. If the file name is null, this has + * the same effect as calling readStandardInput(); that is, input will be read from standard + * input. If an + * error occurs while trying to open the file, an exception of type IllegalArgumentException + * is thrown, and the input source is not changed. If the file is opened + * successfully, then after this method is called, all of the input routines will read + * from the file, instead of from standard input. + */ + public static void readFile(String fileName) { + if (fileName == null) // Go back to reading standard input + readStandardInput(); + else { + BufferedReader newin; + try { + newin = new BufferedReader( new FileReader(fileName) ); + } + catch (Exception e) { + throw new IllegalArgumentException("Can't open file \"" + fileName + "\" for input.\n" + + "(Error :" + e + ")"); + } + if (! readingStandardInput) { // close current input stream + try { + in.close(); + } + catch (Exception e) { + } + } + emptyBuffer(); // Added November 2007 + in = newin; + readingStandardInput = false; + inputErrorCount = 0; + inputFileName = fileName; + } + } + + /** + * Puts a GUI file-selection dialog box on the screen in which the user can select + * an input file. If the user cancels the dialog instead of selecting a file, it is + * not considered an error, but the return value of the subroutine is false. + * If the user does select a file, but there is an error while trying to open the + * file, then an exception of type IllegalArgumentException is thrown. Finally, if + * the user selects a file and it is successfully opened, then the return value of the + * subroutine is true, and the input routines will read from the file, instead of + * from standard input. If the user cancels, or if any error occurs, then the + * previous input source is not changed. + *

NOTE: Calling this method starts a GUI user interface thread, which can continue + * to run even if the thread that runs the main program ends. If you use this method + * in a non-GUI program, it might be necessary to call System.exit(0) at the end of the main() + * routine to shut down the Java virtual machine completely. + */ + public static boolean readUserSelectedFile() { + if (fileDialog == null) + fileDialog = new JFileChooser(); + fileDialog.setDialogTitle("Select File for Input"); + int option = fileDialog.showOpenDialog(null); + if (option != JFileChooser.APPROVE_OPTION) + return false; + File selectedFile = fileDialog.getSelectedFile(); + BufferedReader newin; + try { + newin = new BufferedReader( new FileReader(selectedFile) ); + } + catch (Exception e) { + throw new IllegalArgumentException("Can't open file \"" + selectedFile.getName() + "\" for input.\n" + + "(Error :" + e + ")"); + } + if (!readingStandardInput) { // close current file + try { + in.close(); + } + catch (Exception e) { + } + } + emptyBuffer(); // Added November 2007 + in = newin; + inputFileName = selectedFile.getName(); + readingStandardInput = false; + inputErrorCount = 0; + return true; + } + + /** + * After this method is called, output will be written to standard output (as it + * is in the default state). If a file or stream was previously open for output, it + * will be closed. + */ + public static void writeStandardOutput() { + if (writingStandardOutput) + return; + try { + out.close(); + } + catch (Exception e) { + } + outputFileName = null; + outputErrorCount = 0; + out = standardOutput; + writingStandardOutput = true; + } + + + /** + * After this method is called, output will be sent to outputStream, provided it + * is non-null. If outputStream is null, then this method has the same effect + * as calling writeStandardOutput(); that is, future output will be sent to the + * standard output stream. + */ + public static void writeStream(OutputStream outputStream) { + if (outputStream == null) + writeStandardOutput(); + else + writeStream(new PrintWriter(outputStream)); + } + + /** + * After this method is called, output will be sent to outputStream, provided it + * is non-null. If outputStream is null, then this method has the same effect + * as calling writeStandardOutput(); that is, future output will be sent to the + * standard output stream. + */ + public static void writeStream(PrintWriter outputStream) { + if (outputStream == null) + writeStandardOutput(); + else { + out = outputStream; + outputFileName = null; + outputErrorCount = 0; + writingStandardOutput = false; + } + } + + + /** + * Opens a file with a specified name for output. If the file name is null, this has + * the same effect as calling writeStandardOutput(); that is, output will be sent to standard + * output. If an + * error occurs while trying to open the file, an exception of type IllegalArgumentException + * is thrown. If the file is opened successfully, then after this method is called, + * all of the output routines will write to the file, instead of to standard output. + * If an error occurs, the output destination is not changed. + *

NOTE: Calling this method starts a GUI user interface thread, which can continue + * to run even if the thread that runs the main program ends. If you use this method + * in a non-GUI program, it might be necessary to call System.exit(0) at the end of the main() + * routine to shut down the Java virtual machine completely. + */ + public static void writeFile(String fileName) { + if (fileName == null) // Go back to reading standard output + writeStandardOutput(); + else { + PrintWriter newout; + try { + newout = new PrintWriter(new FileWriter(fileName)); + } + catch (Exception e) { + throw new IllegalArgumentException("Can't open file \"" + fileName + "\" for output.\n" + + "(Error :" + e + ")"); + } + if (!writingStandardOutput) { + try { + out.close(); + } + catch (Exception e) { + } + } + out = newout; + writingStandardOutput = false; + outputFileName = fileName; + outputErrorCount = 0; + } + } + + /** + * Puts a GUI file-selection dialog box on the screen in which the user can select + * an output file. If the user cancels the dialog instead of selecting a file, it is + * not considered an error, but the return value of the subroutine is false. + * If the user does select a file, but there is an error while trying to open the + * file, then an exception of type IllegalArgumentException is thrown. Finally, if + * the user selects a file and it is successfully opened, then the return value of the + * subroutine is true, and the output routines will write to the file, instead of + * to standard output. If the user cancels, or if an error occurs, then the current + * output destination is not changed. + */ + public static boolean writeUserSelectedFile() { + if (fileDialog == null) + fileDialog = new JFileChooser(); + fileDialog.setDialogTitle("Select File for Output"); + File selectedFile; + while (true) { + int option = fileDialog.showSaveDialog(null); + if (option != JFileChooser.APPROVE_OPTION) + return false; // user canceled + selectedFile = fileDialog.getSelectedFile(); + if (selectedFile.exists()) { + int response = JOptionPane.showConfirmDialog(null, + "The file \"" + selectedFile.getName() + "\" already exists. Do you want to replace it?", + "Replace existing file?", + JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE); + if (response == JOptionPane.YES_OPTION) + break; + } + else { + break; + } + } + PrintWriter newout; + try { + newout = new PrintWriter(new FileWriter(selectedFile)); + } + catch (Exception e) { + throw new IllegalArgumentException("Can't open file \"" + selectedFile.getName() + "\" for output.\n" + + "(Error :" + e + ")"); + } + if (!writingStandardOutput) { + try { + out.close(); + } + catch (Exception e) { + } + } + out = newout; + writingStandardOutput = false; + outputFileName = selectedFile.getName(); + outputErrorCount = 0; + return true; + } + + + /** + * If TextIO is currently reading from a file, then the return value is the name of the file. + * If the class is reading from standard input or from a stream, then the return value is null. + */ + public static String getInputFileName() { + return inputFileName; + } + + + /** + * If TextIO is currently writing to a file, then the return value is the name of the file. + * If the class is writing to standard output or to a stream, then the return value is null. + */ + public static String getOutputFileName() { + return outputFileName; + } + + + // *************************** Output Methods ********************************* + + /** + * Write a single value to the current output destination, using the default format + * and no extra spaces. This method will handle any type of parameter, even one + * whose type is one of the primitive types. + */ + public static void put(Object x) { + out.print(x); + out.flush(); + if (out.checkError()) + outputError("Error while writing output."); + } + + /** + * Write a single value to the current output destination, using the default format + * and outputting at least minChars characters (with extra spaces added before the + * output value if necessary). This method will handle any type of parameter, even one + * whose type is one of the primitive types. + * @param x The value to be output, which can be of any type. + * @param minChars The minimum number of characters to use for the output. If x requires fewer + * then this number of characters, then extra spaces are added to the front of x to bring + * the total up to minChars. If minChars is less than or equal to zero, then x will be printed + * in the minimum number of spaces possible. + */ + public static void put(Object x, int minChars) { + if (minChars <= 0) + out.print(x); + else + out.printf("%" + minChars + "s", x); + out.flush(); + if (out.checkError()) + outputError("Error while writing output."); + } + + /** + * This is equivalent to put(x), followed by an end-of-line. + */ + public static void putln(Object x) { + out.println(x); + out.flush(); + if (out.checkError()) + outputError("Error while writing output."); + } + + /** + * This is equivalent to put(x,minChars), followed by an end-of-line. + */ + public static void putln(Object x, int minChars) { + put(x,minChars); + out.println(); + out.flush(); + if (out.checkError()) + outputError("Error while writing output."); + } + + /** + * Write an end-of-line character to the current output destination. + */ + public static void putln() { + out.println(); + out.flush(); + if (out.checkError()) + outputError("Error while writing output."); + } + + /** + * Writes formatted output values to the current output destination. This method has the + * same function as System.out.printf(); the details of formatted output are not discussed + * here. The first parameter is a string that describes the format of the output. There + * can be any number of additional parameters; these specify the values to be output and + * can be of any type. This method will throw an IllegalArgumentException if the + * format string is null or if the format string is illegal for the values that are being + * output. + */ + public static void putf(String format, Object... items) { + if (format == null) + throw new IllegalArgumentException("Null format string in TextIO.putf() method."); + try { + out.printf(format,items); + } + catch (IllegalFormatException e) { + throw new IllegalArgumentException("Illegal format string in TextIO.putf() method."); + } + out.flush(); + if (out.checkError()) + outputError("Error while writing output."); + } + + // *************************** Input Methods ********************************* + + /** + * Test whether the next character in the current input source is an end-of-line. Note that + * this method does NOT skip whitespace before testing for end-of-line -- if you want to do + * that, call skipBlanks() first. + */ + public static boolean eoln() { + return peek() == '\n'; + } + + /** + * Test whether the next character in the current input source is an end-of-file. Note that + * this method does NOT skip whitespace before testing for end-of-line -- if you want to do + * that, call skipBlanks() or skipWhitespace() first. + */ + public static boolean eof() { + return peek() == EOF; + } + + /** + * Reads the next character from the current input source. The character can be a whitespace + * character; compare this to the getChar() method, which skips over whitespace and returns the + * next non-whitespace character. An end-of-line is always returned as the character '\n', even + * when the actual end-of-line in the input source is something else, such as '\r' or "\r\n". + * This method will throw an IllegalArgumentException if the input is at end-of-file (which will + * not ordinarily happen if reading from standard input). + */ + public static char getAnyChar() { + return readChar(); + } + + /** + * Returns the next character in the current input source, without actually removing that + * character from the input. The character can be a whitespace character and can be the + * end-of-file character (specified by the constant TextIO.EOF).An end-of-line is always returned + * as the character '\n', even when the actual end-of-line in the input source is something else, + * such as '\r' or "\r\n". This method never causes an error. + */ + public static char peek() { + return lookChar(); + } + + /** + * Skips over any whitespace characters, except for end-of-lines. After this method is called, + * the next input character is either an end-of-line, an end-of-file, or a non-whitespace character. + * This method never causes an error. (Ordinarily, end-of-file is not possible when reading from + * standard input.) + */ + public static void skipBlanks() { + char ch=lookChar(); + while (ch != EOF && ch != '\n' && Character.isWhitespace(ch)) { + readChar(); + ch = lookChar(); + } + } + + /** + * Skips over any whitespace characters, including for end-of-lines. After this method is called, + * the next input character is either an end-of-file or a non-whitespace character. + * This method never causes an error. (Ordinarily, end-of-file is not possible when reading from + * standard input.) + */ + private static void skipWhitespace() { + char ch=lookChar(); + while (ch != EOF && Character.isWhitespace(ch)) { + readChar(); + if (ch == '\n' && readingStandardInput && writingStandardOutput) { + out.print("? "); + out.flush(); + } + ch = lookChar(); + } + } + + /** + * Skips whitespace characters and then reads a value of type byte from input, discarding the rest of + * the current line of input (including the next end-of-line character, if any). When using standard IO, + * this will not produce an error; the user will be prompted repeatedly for input until a legal value + * is input. In other cases, an IllegalArgumentException will be thrown if a legal value is not found. + */ + public static byte getlnByte() { + byte x=getByte(); + emptyBuffer(); + return x; + } + + /** + * Skips whitespace characters and then reads a value of type short from input, discarding the rest of + * the current line of input (including the next end-of-line character, if any). When using standard IO, + * this will not produce an error; the user will be prompted repeatedly for input until a legal value + * is input. In other cases, an IllegalArgumentException will be thrown if a legal value is not found. + */ + public static short getlnShort() { + short x=getShort(); + emptyBuffer(); + return x; + } + + /** + * Skips whitespace characters and then reads a value of type int from input, discarding the rest of + * the current line of input (including the next end-of-line character, if any). When using standard IO, + * this will not produce an error; the user will be prompted repeatedly for input until a legal value + * is input. In other cases, an IllegalArgumentException will be thrown if a legal value is not found. + */ + public static int getlnInt() { + int x=getInt(); + emptyBuffer(); + return x; + } + + /** + * Skips whitespace characters and then reads a value of type long from input, discarding the rest of + * the current line of input (including the next end-of-line character, if any). When using standard IO, + * this will not produce an error; the user will be prompted repeatedly for input until a legal value + * is input. In other cases, an IllegalArgumentException will be thrown if a legal value is not found. + */ + public static long getlnLong() { + long x=getLong(); + emptyBuffer(); + return x; + } + + /** + * Skips whitespace characters and then reads a value of type float from input, discarding the rest of + * the current line of input (including the next end-of-line character, if any). When using standard IO, + * this will not produce an error; the user will be prompted repeatedly for input until a legal value + * is input. In other cases, an IllegalArgumentException will be thrown if a legal value is not found. + */ + public static float getlnFloat() { + float x=getFloat(); + emptyBuffer(); + return x; + } + + /** + * Skips whitespace characters and then reads a value of type double from input, discarding the rest of + * the current line of input (including the next end-of-line character, if any). When using standard IO, + * this will not produce an error; the user will be prompted repeatedly for input until a legal value + * is input. In other cases, an IllegalArgumentException will be thrown if a legal value is not found. + */ + public static double getlnDouble() { + double x=getDouble(); + emptyBuffer(); + return x; + } + + /** + * Skips whitespace characters and then reads a value of type char from input, discarding the rest of + * the current line of input (including the next end-of-line character, if any). Note that the value + * that is returned will be a non-whitespace character; compare this with the getAnyChar() method. + * When using standard IO, this will not produce an error. In other cases, an error can occur if + * an end-of-file is encountered. + */ + public static char getlnChar() { + char x=getChar(); + emptyBuffer(); + return x; + } + + /** + * Skips whitespace characters and then reads a value of type boolean from input, discarding the rest of + * the current line of input (including the next end-of-line character, if any). When using standard IO, + * this will not produce an error; the user will be prompted repeatedly for input until a legal value + * is input. In other cases, an IllegalArgumentException will be thrown if a legal value is not found. + *

Legal inputs for a boolean input are: true, t, yes, y, 1, false, f, no, n, and 0; letters can be + * either upper case or lower case. One "word" of input is read, using the getWord() method, and it + * must be one of these; note that the "word" must be terminated by a whitespace character (or end-of-file). + */ + public static boolean getlnBoolean() { + boolean x=getBoolean(); + emptyBuffer(); + return x; + } + + /** + * Skips whitespace characters and then reads one "word" from input, discarding the rest of + * the current line of input (including the next end-of-line character, if any). A word is defined as + * a sequence of non-whitespace characters (not just letters!). When using standard IO, + * this will not produce an error. In other cases, an IllegalArgumentException will be thrown + * if an end-of-file is encountered. + */ + public static String getlnWord() { + String x=getWord(); + emptyBuffer(); + return x; + } + + /** + * This is identical to getln(). + */ + public static String getlnString() { + return getln(); + } + + /** + * Reads all the characters from the current input source, up to the next end-of-line. The end-of-line + * is read but is not included in the return value. Any other whitespace characters on the line are retained, + * even if they occur at the start of input. The return value will be an empty string if there are + * no characters before the end-of-line. When using standard IO, this will not produce an error. + * In other cases, an IllegalArgumentException will be thrown if an end-of-file is encountered. + */ + public static String getln() { + StringBuffer s = new StringBuffer(100); + char ch = readChar(); + while (ch != '\n') { + s.append(ch); + ch = readChar(); + } + return s.toString(); + } + + /** + * Skips whitespace characters and then reads a value of type byte from input. Any additional characters on + * the current line of input are retained, and will be read by the next input operation. When using standard IO, + * this will not produce an error; the user will be prompted repeatedly for input until a legal value + * is input. In other cases, an IllegalArgumentException will be thrown if a legal value is not found. + */ + public static byte getByte() { + return (byte)readInteger(-128L,127L); + } + + /** + * Skips whitespace characters and then reads a value of type short from input. Any additional characters on + * the current line of input are retained, and will be read by the next input operation. When using standard IO, + * this will not produce an error; the user will be prompted repeatedly for input until a legal value + * is input. In other cases, an IllegalArgumentException will be thrown if a legal value is not found. + */ + public static short getShort() { + return (short)readInteger(-32768L,32767L); + } + + /** + * Skips whitespace characters and then reads a value of type int from input. Any additional characters on + * the current line of input are retained, and will be read by the next input operation. When using standard IO, + * this will not produce an error; the user will be prompted repeatedly for input until a legal value + * is input. In other cases, an IllegalArgumentException will be thrown if a legal value is not found. + */ + public static int getInt() { + return (int)readInteger(Integer.MIN_VALUE, Integer.MAX_VALUE); + } + + /** + * Skips whitespace characters and then reads a value of type long from input. Any additional characters on + * the current line of input are retained, and will be read by the next input operation. When using standard IO, + * this will not produce an error; the user will be prompted repeatedly for input until a legal value + * is input. In other cases, an IllegalArgumentException will be thrown if a legal value is not found. + */ + public static long getLong() { + return readInteger(Long.MIN_VALUE, Long.MAX_VALUE); + } + + /** + * Skips whitespace characters and then reads a single non-whitespace character from input. Any additional characters on + * the current line of input are retained, and will be read by the next input operation. When using standard IO, + * this will not produce an error. In other cases, an IllegalArgumentException will be thrown if an end-of-file + * is encountered. + */ + public static char getChar() { + skipWhitespace(); + return readChar(); + } + + /** + * Skips whitespace characters and then reads a value of type float from input. Any additional characters on + * the current line of input are retained, and will be read by the next input operation. When using standard IO, + * this will not produce an error; the user will be prompted repeatedly for input until a legal value + * is input. In other cases, an IllegalArgumentException will be thrown if a legal value is not found. + */ + public static float getFloat() { + float x = 0.0F; + while (true) { + String str = readRealString(); + if (str == null) { + errorMessage("Floating point number not found.", + "Real number in the range " + (-Float.MAX_VALUE) + " to " + Float.MAX_VALUE); + } + else { + try { + x = Float.parseFloat(str); + } + catch (NumberFormatException e) { + errorMessage("Illegal floating point input, " + str + ".", + "Real number in the range " + (-Float.MAX_VALUE) + " to " + Float.MAX_VALUE); + continue; + } + if (Float.isInfinite(x)) { + errorMessage("Floating point input outside of legal range, " + str + ".", + "Real number in the range " + (-Float.MAX_VALUE) + " to " + Float.MAX_VALUE); + continue; + } + break; + } + } + inputErrorCount = 0; + return x; + } + + /** + * Skips whitespace characters and then reads a value of type double from input. Any additional characters on + * the current line of input are retained, and will be read by the next input operation. When using standard IO, + * this will not produce an error; the user will be prompted repeatedly for input until a legal value + * is input. In other cases, an IllegalArgumentException will be thrown if a legal value is not found. + */ + public static double getDouble() { + double x = 0.0; + while (true) { + String str = readRealString(); + if (str == null) { + errorMessage("Floating point number not found.", + "Real number in the range " + (-Double.MAX_VALUE) + " to " + Double.MAX_VALUE); + } + else { + try { + x = Double.parseDouble(str); + } + catch (NumberFormatException e) { + errorMessage("Illegal floating point input, " + str + ".", + "Real number in the range " + (-Double.MAX_VALUE) + " to " + Double.MAX_VALUE); + continue; + } + if (Double.isInfinite(x)) { + errorMessage("Floating point input outside of legal range, " + str + ".", + "Real number in the range " + (-Double.MAX_VALUE) + " to " + Double.MAX_VALUE); + continue; + } + break; + } + } + inputErrorCount = 0; + return x; + } + + /** + * Skips whitespace characters and then reads one "word" from input. Any additional characters on + * the current line of input are retained, and will be read by the next input operation. A word is defined as + * a sequence of non-whitespace characters (not just letters!). When using standard IO, + * this will not produce an error. In other cases, an IllegalArgumentException will be thrown + * if an end-of-file is encountered. + */ + public static String getWord() { + skipWhitespace(); + StringBuffer str = new StringBuffer(50); + char ch = lookChar(); + while (ch == EOF || !Character.isWhitespace(ch)) { + str.append(readChar()); + ch = lookChar(); + } + return str.toString(); + } + + /** + * Skips whitespace characters and then reads a value of type boolean from input. Any additional characters on + * the current line of input are retained, and will be read by the next input operation. When using standard IO, + * this will not produce an error; the user will be prompted repeatedly for input until a legal value + * is input. In other cases, an IllegalArgumentException will be thrown if a legal value is not found. + *

Legal inputs for a boolean input are: true, t, yes, y, 1, false, f, no, n, and 0; letters can be + * either upper case or lower case. One "word" of input is read, using the getWord() method, and it + * must be one of these; note that the "word" must be terminated by a whitespace character (or end-of-file). + */ + public static boolean getBoolean() { + boolean ans = false; + while (true) { + String s = getWord(); + if ( s.equalsIgnoreCase("true") || s.equalsIgnoreCase("t") || + s.equalsIgnoreCase("yes") || s.equalsIgnoreCase("y") || + s.equals("1") ) { + ans = true; + break; + } + else if ( s.equalsIgnoreCase("false") || s.equalsIgnoreCase("f") || + s.equalsIgnoreCase("no") || s.equalsIgnoreCase("n") || + s.equals("0") ) { + ans = false; + break; + } + else + errorMessage("Illegal boolean input value.", + "one of: true, false, t, f, yes, no, y, n, 0, or 1"); + } + inputErrorCount = 0; + return ans; + } + + // ***************** Everything beyond this point is private implementation detail ******************* + + private static String inputFileName; // Name of file that is the current input source, or null if the source is not a file. + private static String outputFileName; // Name of file that is the current output destination, or null if the destination is not a file. + + private static JFileChooser fileDialog; // Dialog used by readUserSelectedFile() and writeUserSelectedFile() + + private final static BufferedReader standardInput = new BufferedReader(new InputStreamReader(System.in)); // wraps standard input stream + private final static PrintWriter standardOutput = new PrintWriter(System.out); // wraps standard output stream + + private static BufferedReader in = standardInput; // Stream that data is read from; the current input source. + private static PrintWriter out = standardOutput; // Stream that data is written to; the current output destination. + + private static boolean readingStandardInput = true; + private static boolean writingStandardOutput = true; + + private static int inputErrorCount; // Number of consecutive errors on standard input; reset to 0 when a successful read occurs. + private static int outputErrorCount; // Number of errors on standard output since it was selected as the output destination. + + private static Matcher integerMatcher; // Used for reading integer numbers; created from the integer Regex Pattern. + private static Matcher floatMatcher; // Used for reading floating point numbers; created from the floatRegex Pattern. + private final static Pattern integerRegex = Pattern.compile("(\\+|-)?[0-9]+"); + private final static Pattern floatRegex = Pattern.compile("(\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))((e|E)(\\+|-)?[0-9]+)?"); + + private static String buffer = null; // One line read from input. + private static int pos = 0; // Position of next char in input line that has not yet been processed. + + private static String readRealString() { // read chars from input following syntax of real numbers + skipWhitespace(); + if (lookChar() == EOF) + return null; + if (floatMatcher == null) + floatMatcher = floatRegex.matcher(buffer); + floatMatcher.region(pos,buffer.length()); + if (floatMatcher.lookingAt()) { + String str = floatMatcher.group(); + pos = floatMatcher.end(); + return str; + } + else + return null; + } + + private static String readIntegerString() { // read chars from input following syntax of integers + skipWhitespace(); + if (lookChar() == EOF) + return null; + if (integerMatcher == null) + integerMatcher = integerRegex.matcher(buffer); + integerMatcher.region(pos,buffer.length()); + if (integerMatcher.lookingAt()) { + String str = integerMatcher.group(); + pos = integerMatcher.end(); + return str; + } + else + return null; + } + + private static long readInteger(long min, long max) { // read long integer, limited to specified range + long x=0; + while (true) { + String s = readIntegerString(); + if (s == null){ + errorMessage("Integer value not found in input.", + "Integer in the range " + min + " to " + max); + } + else { + String str = s.toString(); + try { + x = Long.parseLong(str); + } + catch (NumberFormatException e) { + errorMessage("Illegal integer input, " + str + ".", + "Integer in the range " + min + " to " + max); + continue; + } + if (x < min || x > max) { + errorMessage("Integer input outside of legal range, " + str + ".", + "Integer in the range " + min + " to " + max); + continue; + } + break; + } + } + inputErrorCount = 0; + return x; + } + + + private static void errorMessage(String message, String expecting) { // Report error on input. + if (readingStandardInput && writingStandardOutput) { + // inform user of error and force user to re-enter. + out.println(); + out.print(" *** Error in input: " + message + "\n"); + out.print(" *** Expecting: " + expecting + "\n"); + out.print(" *** Discarding Input: "); + if (lookChar() == '\n') + out.print("(end-of-line)\n\n"); + else { + while (lookChar() != '\n') // Discard and echo remaining chars on the current line of input. + out.print(readChar()); + out.print("\n\n"); + } + out.print("Please re-enter: "); + out.flush(); + readChar(); // discard the end-of-line character + inputErrorCount++; + if (inputErrorCount >= 10) + throw new IllegalArgumentException("Too many input consecutive input errors on standard input."); + } + else if (inputFileName != null) + throw new IllegalArgumentException("Error while reading from file \"" + inputFileName + "\":\n" + + message + "\nExpecting " + expecting); + else + throw new IllegalArgumentException("Error while reading from inptu stream:\n" + + message + "\nExpecting " + expecting); + } + + private static char lookChar() { // return next character from input + if (buffer == null || pos > buffer.length()) + fillBuffer(); + if (buffer == null) + return EOF; + else if (pos == buffer.length()) + return '\n'; + else + return buffer.charAt(pos); + } + + private static char readChar() { // return and discard next character from input + char ch = lookChar(); + if (buffer == null) { + if (readingStandardInput) + throw new IllegalArgumentException("Attempt to read past end-of-file in standard input???"); + else + throw new IllegalArgumentException("Attempt to read past end-of-file in file \"" + inputFileName + "\"."); + } + pos++; + return ch; + } + + private static void fillBuffer() { // Wait for user to type a line and press return, + try { + buffer = in.readLine(); + } + catch (Exception e) { + if (readingStandardInput) + throw new IllegalArgumentException("Error while reading standard input???"); + else if (inputFileName != null) + throw new IllegalArgumentException("Error while attempting to read from file \"" + inputFileName + "\"."); + else + throw new IllegalArgumentException("Errow while attempting to read form an input stream."); + } + pos = 0; + floatMatcher = null; + integerMatcher = null; + } + + private static void emptyBuffer() { // discard the rest of the current line of input + buffer = null; + } + + private static void outputError(String message) { // Report an error on output. + if (writingStandardOutput) { + System.err.println("Error occurred in TextIO while writing to standard output!!"); + outputErrorCount++; + if (outputErrorCount >= 10) { + outputErrorCount = 0; + throw new IllegalArgumentException("Too many errors while writing to standard output."); + } + } + else if (outputFileName != null){ + throw new IllegalArgumentException("Error occurred while writing to file \"" + + outputFileName+ "\":\n " + message); + } + else { + throw new IllegalArgumentException("Error occurred while writing to output stream:\n " + message); + } + } + +} // end of class TextIO diff --git a/src/praktikum2/Grupeerija.java b/src/praktikum2/Grupeerija.java new file mode 100644 index 0000000..fca3c18 --- /dev/null +++ b/src/praktikum2/Grupeerija.java @@ -0,0 +1,21 @@ +package praktikum2; + +public class Grupeerija { + + public static void main(String[] args) { + System.out.printf("Sisesta inimeste arv: "); + int inimeste_arv = lib.TextIO.getlnInt(); + + System.out.printf("Sisesta grupi suurus: "); + int grupi_suurus = lib.TextIO.getlnInt(); + + int gruppide_arv = inimeste_arv / grupi_suurus; + int inimeste_jääk = inimeste_arv % grupi_suurus; + + System.out.printf("Kui %d inimest jagada gruppidesse kus igas grupi on %d inimest\n", + inimeste_arv, grupi_suurus); + System.out.printf("Siis oleks kokku %d gruppi ja üle jääks %d inimest", + gruppide_arv, inimeste_jääk); + } + +} diff --git a/src/praktikum2/Korrutaja.java b/src/praktikum2/Korrutaja.java new file mode 100644 index 0000000..9e96a00 --- /dev/null +++ b/src/praktikum2/Korrutaja.java @@ -0,0 +1,31 @@ +package praktikum2; + +public class Korrutaja { + + public static void main(String[] args) { + System.out.printf("Sisesta esimene arv: "); + int arv1 = lib.TextIO.getlnInt(); + + System.out.printf("Sisesta teine arv: "); + int arv2 = lib.TextIO.getlnInt(); + + System.out.println("Arvude " + arv1 + " ja " + arv2 + " korrutis on " + arv1*arv2); + } +} + +// +// █████ ▒██▒ ██▒ ▒██ ▒██▒ +// █████ ▓██▓ ██▓ ▓██ ▓██▓ +// ██ ████ ▒██ ██▒ ████ +// ██ ████ ▒██ ██▒ ████ +// ██ ▒█▓▓█▒ ██ ░██ ▒█▓▓█▒ +// ██ ▓█▒▒█▓ ██▒▒██ ▓█▒▒█▓ +// ██ ██ ██ ██▒▒██ ██ ██ +// ██ ██████ ▒████▒ ██████ +// ██ ░██████░ ░████░ ░██████░ +//█▒ ▒██ ▒██ ██▒ ████ ▒██ ██▒ +//███████▓ ███ ███ ████ ███ ███ +//░█████▒ ██▒ ▒██ ▓██▓ ██▒ ▒██ +// + + \ No newline at end of file diff --git a/src/praktikum2/NimePikkus.java b/src/praktikum2/NimePikkus.java new file mode 100644 index 0000000..00f0c1b --- /dev/null +++ b/src/praktikum2/NimePikkus.java @@ -0,0 +1,13 @@ +package praktikum2; + +public class NimePikkus { + + public static void main(String[] args) { + System.out.println("Sisesta mingi nimi ja ma ütlen sulle selle pikkuse"); + System.out.printf("Sisesta nimi: "); + String nimi = lib.TextIO.getlnString(); + int nimePikkus = nimi.length(); + System.out.println("Sisestatud nime pikkus on " + nimePikkus); + } + +} diff --git a/src/praktikum2/Tere.java b/src/praktikum2/Tere.java new file mode 100644 index 0000000..1963284 --- /dev/null +++ b/src/praktikum2/Tere.java @@ -0,0 +1,13 @@ +package praktikum2; + +import java.util.Calendar; + +public class Tere { + + public static void main(String[] args) { + int synniaasta = 1995; + int vanus = Calendar.getInstance().get(Calendar.YEAR) - synniaasta; + System.out.println ("Yo, ma olen Arti, hetkel " + vanus + " aastat vana"); + System.out.println ("Kinga numbrit peast ei mäleta hetkel...."); + } +} diff --git a/src/praktikum3/CumLaude.java b/src/praktikum3/CumLaude.java new file mode 100644 index 0000000..939b153 --- /dev/null +++ b/src/praktikum3/CumLaude.java @@ -0,0 +1,38 @@ +package praktikum3; + +public class CumLaude { + + public static void main(String[] args) { + + // Küsime kasutaja käest hindeid ujukomaarvudena + System.out.printf("Sisesta keskmine hinne: "); + double keskminehinne = lib.TextIO.getlnDouble(); + System.out.printf("Sisesta lõputöö hinne: "); + double lõputööhinne = lib.TextIO.getlnDouble(); + + // Kasutajapoolt sisestatud numbrite reeglitele vastavuse kontroll + if (keskminehinne > 5.0) { + System.out.printf("Keskmine hinne ei tohi olla üle 5, teie seisestasite %.1f %n", keskminehinne); + return; // välju main funktsioonist ja lõpeta programmi töö + } else if (lõputööhinne >5.0) { + System.out.printf("Lõputöö hinne ei tohi olla üle 5, teie seisestasite %.1f %n", lõputööhinne); + return; + } else if (keskminehinne < 0.0) { + System.out.printf("Keskmine hinne ei tohi olla üle negatiivne, teie seisestasite %.1f %n", keskminehinne); + return; + } else if (lõputööhinne < 0.0) { + System.out.printf("Lõputöö hinne ei tohi olla üle negatiivne, teie seisestasite %.1f %n", lõputööhinne); + return; + } + + // Ülessanne ise + if ((keskminehinne >= 4.5) && (lõputööhinne == 5.0)) { + System.out.println("Palju õnne, saad Cum-Laude oma diplomile"); + } else { + System.out.println("Sina kahjuks oma hinnetega Cum-Laude-t enda diplomile"); + } + + + } + +} diff --git a/src/praktikum3/ParooliSisestus.java b/src/praktikum3/ParooliSisestus.java new file mode 100644 index 0000000..fcbb3d6 --- /dev/null +++ b/src/praktikum3/ParooliSisestus.java @@ -0,0 +1,11 @@ +package praktikum3; + +public class ParooliSisestus { + + public static void main(String[] args) { + System.out.println("yo"); + + } + + +} \ No newline at end of file diff --git a/src/praktikum3/Tehisintellekt.java b/src/praktikum3/Tehisintellekt.java new file mode 100644 index 0000000..32657ad --- /dev/null +++ b/src/praktikum3/Tehisintellekt.java @@ -0,0 +1,40 @@ +package praktikum3; + +public class Tehisintellekt { + + public static void main(String[] args) { + // Küsime kasutaja käest mõned vanused + System.out.printf("Sisesta üks vanus: "); + int esimenevanus = lib.TextIO.getlnInt(); + System.out.printf("Sisesta teine vanus: "); + int teinevanus = lib.TextIO.getlnInt(); + + // Sisendi valideerimine + if ((esimenevanus < 0) || (teinevanus < 0)) { + System.out.println("Vanus ei tohi olla negatiivne"); + return; + } + + // Teeme järgnevad vanusevahe testid lihtsamaks eemaldades endest mitme erineva vanuse vahe testimise + int esimenevanusevahe = esimenevanus-teinevanus; + int teinevanusevahe = teinevanus-esimenevanus; + int vanusevahe = 0; // vanusevahe mida me hakkame testima + + if (esimenevanus < teinevanus) { + vanusevahe = teinevanusevahe; + } else { + vanusevahe = esimenevanusevahe; + } + + + if ((vanusevahe > 5) && (vanusevahe < 10)) { + System.out.println("Krõbe"); + } else if (vanusevahe >= 10) { + System.out.println("Väga krõbe"); + } else { + System.out.println("Sobib"); + } + + } + +} diff --git a/src/praktikum4/numbrid0246.java b/src/praktikum4/numbrid0246.java new file mode 100644 index 0000000..6f984f9 --- /dev/null +++ b/src/praktikum4/numbrid0246.java @@ -0,0 +1,12 @@ +package praktikum4; + +public class numbrid0246 { + + public static void main(String[] args) { + for (int x = 0; x <= 10; x += 2) { + System.out.printf("%d ", x); + } + + } + +} diff --git a/src/praktikum4/numbrid110.java b/src/praktikum4/numbrid110.java new file mode 100644 index 0000000..fc415d0 --- /dev/null +++ b/src/praktikum4/numbrid110.java @@ -0,0 +1,12 @@ +package praktikum4; + +public class numbrid110 { + + public static void main(String[] args) { + for (int x = 1; x <= 10; x++) { + System.out.printf("%d ", x); + } + + } + +} diff --git a/src/praktikum4/numbrid302734.java b/src/praktikum4/numbrid302734.java new file mode 100644 index 0000000..a96c92f --- /dev/null +++ b/src/praktikum4/numbrid302734.java @@ -0,0 +1,12 @@ +package praktikum4; + +public class numbrid302734 { + + public static void main(String[] args) { + for (int x = 30; x > 0; x -=3) { + System.out.printf("%d ", x); + } + + } + +} diff --git a/src/praktikum4/table1.java b/src/praktikum4/table1.java new file mode 100644 index 0000000..260071c --- /dev/null +++ b/src/praktikum4/table1.java @@ -0,0 +1,23 @@ +package praktikum4; + +public class table1 { + + public static void main(String[] args) { + final int x_size = 7; // table size in x direction + final int y_size = 7; // table size in y direction + + // Create the table + for (int x = 0; x <= x_size; x++) { + for (int y = 0; y <= y_size; y++) { + if (x == y) { + System.out.printf("1 "); + } else { + System.out.printf("0 "); + } + + } + //we are at the end of the line, start a new one + System.out.printf("%n"); + } + } +} diff --git a/src/praktikum4/table2.java b/src/praktikum4/table2.java new file mode 100644 index 0000000..b5d0559 --- /dev/null +++ b/src/praktikum4/table2.java @@ -0,0 +1,30 @@ +package praktikum4; + +public class table2 { + + public static void main(String[] args) { + System.out.printf("Tabeli X suurus: "); + int x_size = lib.TextIO.getlnInt(); // table size in x direction + System.out.printf("Tabeli Y suurus: "); + int y_size = lib.TextIO.getlnInt(); // table size in y direction + + // Create the table + for (int x = 0; x <= x_size; x++) { + System.out.printf("--"); + } + System.out.printf("%n"); + for (int x = 0; x <= x_size; x++) { + System.out.printf("| "); + for (int y = 0; y <= y_size; y++) { + if (x == y) { + System.out.printf("1 "); + } else { + System.out.printf("0 "); + } + + } + //we are at the end of the line, start a new one + System.out.printf("%n"); + } + } +}