You can subscribe to this list here.
2002 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(132) |
Jul
(50) |
Aug
(172) |
Sep
(87) |
Oct
|
Nov
(1) |
Dec
|
---|---|---|---|---|---|---|---|---|---|---|---|---|
2003 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(39) |
Oct
(2) |
Nov
|
Dec
|
2004 |
Jan
(47) |
Feb
|
Mar
(11) |
Apr
|
May
|
Jun
|
Jul
|
Aug
(2) |
Sep
|
Oct
(9) |
Nov
|
Dec
|
2005 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(2) |
Oct
|
Nov
|
Dec
|
From: Egon W. <eg...@us...> - 2002-06-08 20:43:17
|
Update of /cvsroot/woc/woc/source/wocjava In directory usw-pr-cvs1:/tmp/cvs-serv22120 Modified Files: .cvsignore Log Message: Removed files not involved in compiling source. Index: .cvsignore =================================================================== RCS file: /cvsroot/woc/woc/source/wocjava/.cvsignore,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** .cvsignore 8 Jun 2002 20:38:36 -0000 1.2 --- .cvsignore 8 Jun 2002 20:43:15 -0000 1.3 *************** *** 1,2 **** - woclist.xml build --- 1 ---- |
From: Egon W. <eg...@us...> - 2002-06-08 20:40:14
|
Update of /cvsroot/woc/woc/bin/wml2html In directory usw-pr-cvs1:/tmp/cvs-serv21541/wml2html Log Message: Directory /cvsroot/woc/woc/bin/wml2html added to the repository |
From: Egon W. <eg...@us...> - 2002-06-08 20:38:39
|
Update of /cvsroot/woc/woc/source/wocjava In directory usw-pr-cvs1:/tmp/cvs-serv21169 Modified Files: .cvsignore Makefile Log Message: Fixed path. Ignore build dir. Index: .cvsignore =================================================================== RCS file: /cvsroot/woc/woc/source/wocjava/.cvsignore,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** .cvsignore 8 Jun 2002 20:12:42 -0000 1.1 --- .cvsignore 8 Jun 2002 20:38:36 -0000 1.2 *************** *** 1 **** --- 1,2 ---- woclist.xml + build Index: Makefile =================================================================== RCS file: /cvsroot/woc/woc/source/wocjava/Makefile,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -r1.3 -r1.4 *** Makefile 8 Jun 2002 20:33:26 -0000 1.3 --- Makefile 8 Jun 2002 20:38:36 -0000 1.4 *************** *** 10,13 **** --- 10,14 ---- classes: + mkdir -p build ${JAVAC} -classpath ${JARS} -d build -O `find source/com -name "*.java"` *************** *** 16,18 **** jar: classes ! cd build; ${JAR} cvf ../../lib/java/wocjava.jar com/* --- 17,19 ---- jar: classes ! cd build; ${JAR} cvf ../../../lib/java/wocjava.jar com/* |
From: Egon W. <eg...@us...> - 2002-06-08 20:35:30
|
Update of /cvsroot/woc/woc/lib/java In directory usw-pr-cvs1:/tmp/cvs-serv20634 Added Files: wocutil.jar Log Message: Added binary only (source got lost some time ago) utility classes. --- NEW FILE: wocutil.jar --- PK ß(wv{ß;mkq®bÜíÝÓÖÊÉ JÓa#IïJ/·++ÃÐožÉ}áÆrÇ;V%"ð@ç¡ë¦4Ý9¤P§E6E6[«1õ%&i¤2i~YR,ÇT|ÍÒ¡i¬&Ú)ÀÔ ×¦2µ!¬K1¬c~iþ2lý; ¬Ì¿âÒ u²rÄ $*ÜJOòÎøì>5É? 9 ßPKËÕØU UP;ÝT 44Î@aìWZ 6öîÈ lƼ<¹(½UúÌ+²)-f¡9÷Á¬¢Ü0ØÒ8±ðÙA驱o+¿zãÝYfÁXùïhå iÉmä¯7B>ùů2&Ì{7Äׯ¡Ê¡òPK¡¨UY¶ ;q Fw⨣x¤<ìRn=?ñE[Iª2Õc Hþ!T#Úq¢^ÈPlhÂïÇÝĺBïh¾gáAðRð@$dÈÛmE?;õã'qtìu½3I ÎÄzH5Ð/ûÝ$:-ñJ¡¤&ÓëÊØÛ}ý§uóaâ¯Ï%ZtË´ú=ãJ¿A¶¤Íϲd0UÉÑu_u 0ôô(Òþ e1¨`c î!Æâ¦q¸«à)î(bkãfЯ`Ïùlw¨/)ÐêÚP·Ô¡ë±;«ë£p© _ Bñó1ÎÚ¥ÈH¨]ÝÐRöèÂ[CçÛq«Ú1ÝÔíqOÜJk qËÌÙªi/©C¾{r6! OF¥t+6Gel*¦©Ô¢©Ú@SVJ5Ô¬®®eËMi Ý êþEmÇ×Ô4». hôZ5ÑÌ´@MʰrHY1mÝ2·c±Ê<úÍj¦=¥äµéõÞíåcÎI§Ä\ XÌXvÂrÌtEfsOÎV;ØïìÚª¿Ó±¯s¶Fé^3 c¸-ÇP2YmK·\q6/»E\Êp_x¨5íÊ˪¦°9C¥JYö+=gLë×¶X£s§×Ùqà:#] Vt3@ÊÅ_9Y.þ²:YÒt7HKKW ü[äE)ÏEº;ÜÇ ð1êVòPÑþÏÝðÿnZÐg@º[¥"]¤é°àLÁ9$ZÃy´ÎãæÏ!Éy~ÒWþöB Àªp c ìÿTg)»Hj&c¸á÷ès¦G¬.1C.zÏJÈ£ñç)¼Å¹É÷~ã+ÖÚ=L»i¦RÇ>y^ÏØ>¾=ô9 D| GhZß²Ú\²®ïþ|ºö¦¶¼Î/hãúM®<|Ñ#4áò:öáYyPz/DÑUh´S?vé).`¤ðªGÿPKs3¢· çe3æ\Ò ò!ó,.¸Y,øn¢ÌbÞ@¸ KqÑÀ >5°%ß±ù=nøÓ,|d`± Óf± Kñ|¡*0/ÔZ?Y%×ò¥eÕr¼F9® $òª*¤a9L¨\¾fûÛ%Ùð½Òo帥%¹í9<ß[ß|(mU~îZpÿ¾l_G¥Þ¯¾Á*^¸|J 5o»ç¨+Éùè¨ø[R`¤â{meyjÍr²õlÙTy¼Çíø¥[D¬^ZÛT4;hj¾m¹kV˱6]IÙÛ«õb\ö-è³+òºÛrThÏ1 â sOyÜw¤ Z^>ìJlP;V³)½-:جÖU%0d»~*åþßI¸dSoYøGDZCªã6é´WoVï é9êjÑLÆú¡j}oû¼ûæ×÷Ó«Ð-[É@æõ L^ûAìã¶Dt¥×Phå~ÀchrEê¢-Uïò)å÷yÂY ¤CÝkrxß|AË£G Äp_x¢7F:M1zd_#ktô°YìâÿS»àßuúÕ裷ÁGɤÌ.Æßþ+$xæñ=JÁO8OFqÝ,vpØNõ0£üÖ#ÌñÆI/ÿÂuy øÂs6¹Æº8ñ$&røùÕ?»K/pô%׳±.3$f;íàÇvÃÁYºi¯Îå¨ÎªÂuf{ä¼O¹YäCè>Ù¿§½?åÿ].Ìñ¿WóõÆýÏ¿aê)Òffú13:ÉÝZ¿x¯a<ì E}¶\XȼDz=3ÝÅHÇE¦?÷jXý«ÿ |
From: Egon W. <eg...@us...> - 2002-06-08 20:33:28
|
Update of /cvsroot/woc/woc/source/wocjava In directory usw-pr-cvs1:/tmp/cvs-serv20341 Modified Files: Makefile Log Message: Use JAVA_HOME variable. Index: Makefile =================================================================== RCS file: /cvsroot/woc/woc/source/wocjava/Makefile,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** Makefile 8 Jun 2002 20:29:56 -0000 1.2 --- Makefile 8 Jun 2002 20:33:26 -0000 1.3 *************** *** 1,5 **** ! JAVAC=/usr/lib/j2sdk1.3/bin/javac ! JAR=/usr/lib/j2sdk1.3/bin/jar ! JAVA=/usr/lib/j2sdk1.3/bin/java JARS=`ls -1 ../../lib/java/*.jar | perl -ne "s/\n|\r/:/g; print;"` --- 1,5 ---- ! JAVAC=${JAVA_HOME}/bin/javac ! JAR=${JAVA_HOME}/bin/jar ! JAVA=${JAVA_HOME}/java JARS=`ls -1 ../../lib/java/*.jar | perl -ne "s/\n|\r/:/g; print;"` |
From: Egon W. <eg...@us...> - 2002-06-08 20:29:58
|
Update of /cvsroot/woc/woc/source/wocjava In directory usw-pr-cvs1:/tmp/cvs-serv19674/source/wocjava Modified Files: Makefile Log Message: Adapted some paths. Index: Makefile =================================================================== RCS file: /cvsroot/woc/woc/source/wocjava/Makefile,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** Makefile 8 Jun 2002 20:12:42 -0000 1.1 --- Makefile 8 Jun 2002 20:29:56 -0000 1.2 *************** *** 3,7 **** JAVA=/usr/lib/j2sdk1.3/bin/java ! JARS="jars/dadml.jar:jars/jgl.jar:jars/xt2.jar:jars/xalan.jar:jars/xerces.jar:jars/wocjava.jar:jars/wocutil.jar:build" OPTIONS=-R /home/egonw/data/Projects/Woc/wocjava/repository_def.xml --- 3,7 ---- JAVA=/usr/lib/j2sdk1.3/bin/java ! JARS=`ls -1 ../../lib/java/*.jar | perl -ne "s/\n|\r/:/g; print;"` OPTIONS=-R /home/egonw/data/Projects/Woc/wocjava/repository_def.xml *************** *** 16,28 **** jar: classes ! cd build; ${JAR} cvf ../jars/wocjava.jar com/* ! ! items: ! ${JAVA} -cp ${JARS} com.egonw.woc.tools.MaakLosseItems ${OPTIONS} ! ! woord: ! ${JAVA} -cp ${JARS} com.egonw.woc.tools.Woord ${OPTIONS} ! ! groups: ! ${JAVA} -cp ${JARS} com.egonw.woc.tools.GroupFiles ${OPTIONS} ! --- 16,18 ---- jar: classes ! cd build; ${JAR} cvf ../../lib/java/wocjava.jar com/* |
Update of /cvsroot/woc/woc/source/wocjava/source/com/egonw/woc/predicate In directory usw-pr-cvs1:/tmp/cvs-serv19480/predicate Added Files: HasBrutoFormule.java HasEnglishWord.java HasField.java HasGermanWord.java HasItem.java HasURL.java IsAfkorting.java IsChemical.java IsCode.java IsGroup.java IsName.java IsSource.java LessBrutoFormule.java LessCasNumber.java LessEnglishWord.java LessFWord.java LessGermanWord.java LessWocWord.java SortsAsLetter.java StartsWith.java Log Message: Added java source files. --- NEW FILE: HasBrutoFormule.java --- package com.egonw.woc.predicate; import com.objectspace.jgl.*; import com.egonw.woc.*; public final class HasBrutoFormule implements UnaryPredicate { public boolean execute( Object object ) { return ((Item)object).contains(Item.BRUTO); } } --- NEW FILE: HasEnglishWord.java --- package com.egonw.woc.predicate; import com.objectspace.jgl.*; import com.egonw.woc.*; public final class HasEnglishWord implements UnaryPredicate { public boolean execute( Object object ) { return ((Item)object).contains(Item.ENGLISH); } } --- NEW FILE: HasField.java --- package com.egonw.woc.predicate; import com.objectspace.jgl.*; import com.egonw.woc.*; public final class HasField implements BinaryPredicate { public boolean execute( Object first, Object second ) { if (!(first instanceof Item) || !(second instanceof Integer)) { return false; } else { return ((Item)first).contains( ((Integer)second).intValue() ); } } } --- NEW FILE: HasGermanWord.java --- package com.egonw.woc.predicate; import com.objectspace.jgl.*; import com.egonw.woc.*; public final class HasGermanWord implements UnaryPredicate { public boolean execute( Object object ) { return ((Item)object).contains(XItem.XGERMAN); } } --- NEW FILE: HasItem.java --- package com.egonw.woc.predicate; import com.objectspace.jgl.*; import com.egonw.woc.*; /** * HasItem is a binary predicate that * returns true if the first operand (an Item) has * the name of the second operand */ public final class HasItem implements BinaryPredicate { /** * Return true if the first operand is greater than the second operand. * @param first The first operand. necessary. * @param second The second operand. necessary. * @return first.get(Item.NAME).equals(second) */ public boolean execute( Object first, Object second ) { boolean result = false; if (first instanceof Item && second instanceof String) result = ((String)((Item)first).get(Item.NAME)).equals(second); return result; } } --- NEW FILE: HasURL.java --- package com.egonw.woc.predicate; import com.objectspace.jgl.*; import com.egonw.woc.*; public final class HasURL implements UnaryPredicate { public boolean execute( Object object ) { return ((Item)object).contains(Item.URL); } } --- NEW FILE: IsAfkorting.java --- package com.egonw.woc.predicate; import com.objectspace.jgl.*; import com.egonw.woc.*; public final class IsAfkorting implements UnaryPredicate { public boolean execute( Object object ) { boolean result = false; if (((Item)object).contains(XItem.XTYPE)) { XTYPE xt = (XTYPE)((Item)object).get(XItem.XTYPE); result = xt.isType(XTYPE.ABBREV); }; return result; } } --- NEW FILE: IsChemical.java --- package com.egonw.woc.predicate; import com.objectspace.jgl.*; import com.egonw.woc.*; public final class IsChemical implements UnaryPredicate { public boolean execute( Object object ) { boolean result = false; if (((Item)object).contains(XItem.XTYPE)) { XTYPE xt = (XTYPE)((Item)object).get(XItem.XTYPE); result = (((Item)object).contains(Item.CHEMICAL) || ((Item)object).contains(Item.CASNR) || xt.isType(XTYPE.CHEMICAL) || xt.isType(XTYPE.POLYMER) || xt.isType(XTYPE.MIXTURE)); } else { result = (((Item)object).contains(Item.CHEMICAL) || ((Item)object).contains(Item.CASNR)); } return result; } } --- NEW FILE: IsCode.java --- package com.egonw.woc.predicate; import java.util.Vector; import com.objectspace.jgl.*; import com.egonw.woc.*; public final class IsCode implements BinaryPredicate { public boolean execute( Object first, Object second ) { return ((String)((Item)first).get(XItem.XCODE)).toLowerCase().equals(((String)second).toLowerCase()); } } --- NEW FILE: IsGroup.java --- package com.egonw.woc.predicate; import java.util.Vector; import com.objectspace.jgl.*; import com.egonw.woc.*; /** * Checks wether this Item belongs to a group. */ public final class IsGroup implements BinaryPredicate { /** * Return true if the Group field of * the item first contains the value of the second operand. * @param first The first operand. Must be off class Item. * @param second The second operand. Must be a string. * @return */ public boolean execute( Object first, Object second ) { if (((Item)first).contains(Item.GROUP)) { return ((Vector)((Item)first).get(Item.GROUP)).contains(second); } else { return false; } } } --- NEW FILE: IsName.java --- package com.egonw.woc.predicate; import java.util.Vector; import com.objectspace.jgl.*; import com.egonw.woc.*; /** * Checks wether this Item belongs to a group. */ public final class IsName implements BinaryPredicate { /** * Return true if the Name field of * the item first contains the value of the second operand. * @param first The item to be checked. * @param second The name that the item should have. * @return */ public boolean execute( Object first, Object second ) { return ((String)((Item)first).get(Item.NAME)).toLowerCase().equals(((String)second).toLowerCase()); } } --- NEW FILE: IsSource.java --- package com.egonw.woc.predicate; import java.util.*; import com.objectspace.jgl.*; import com.egonw.woc.*; /** * Checks wether this Item belongs to a group. */ public final class IsSource implements BinaryPredicate { /** */ public boolean execute( Object first, Object second ) { boolean result = false; result = ((String)((Item)first).get(Item.NAME)).toLowerCase().equals(second); //if (((Item)first).contains(Item.VERVOEGINGEN)) { // Enumeration vvn = ((Vector)((Item)first).get(Item.VERVOEGINGEN)).elements(); // while (vvn.hasMoreElements()) // result = (result || ((String)vvn.nextElement()).toLowerCase().equals(second)); //} return result; } } --- NEW FILE: LessBrutoFormule.java --- package com.egonw.woc.predicate; import com.objectspace.jgl.*; import com.egonw.woc.*; public final class LessBrutoFormule implements BinaryPredicate { private String pakSymbool(String s) { StringBuffer sb = new StringBuffer(); if (s.length() >= 2) { char c = s.charAt(0); if (Character.isLetter(c) && Character.isUpperCase(c)) { sb.append(c); c = s.charAt(1); if (Character.isLetter(c) && Character.isLowerCase(c)) sb.append(c); } } else if (s.length() >= 1) { char c= s.charAt(0); if (Character.isLetter(c) && Character.isUpperCase(c)) { sb.append(c); } } return sb.toString(); } private String pakAantal(String s) { StringBuffer sb = new StringBuffer(); for (int i = 0; i < s.length(); i++) { char c = s.charAt(i); if (Character.isDigit(c)) { sb.append(c); } else { i = s.length(); } } return sb.toString(); } private String stripSymbool(String s) { int start = 0; if (s.length() >= 2) { char c = s.charAt(0); if (Character.isLetter(c) && Character.isUpperCase(c)) { start = 1; c = s.charAt(1); if (Character.isLetter(c) && Character.isLowerCase(c)) start = 2; } } else if (s.length() >= 1) { char c= s.charAt(0); if (Character.isLetter(c) && Character.isUpperCase(c)) { start = 1; } } String result = ""; if (s.length() > start) result = new String(s.substring(start)); return result; } private String stripAantal(String s) { while ((s.length() > 0) && (Character.isDigit(s.charAt(0)))) { if (s.length() > 1) { s = new String(s.substring(1)); } else { s = new String(); }; } return s; } public boolean execute( Object first, Object second ) { boolean result = false; if ( !((Item)first).contains(Item.BRUTO) ) { result = true; } else if ( !((Item)second).contains(Item.BRUTO) ) { result = false; } else { String eerste = ((Bruto)((Item)first).get(Item.BRUTO)).toString(); String tweede = ((Bruto)((Item)second).get(Item.BRUTO)).toString(); String tekenE = new String(); String tekenT = new String(); String digitE = new String(); String digitT = new String(); boolean succes = false; while (!succes) { tekenE = new String(pakSymbool(eerste)); tekenT = new String(pakSymbool(tweede)); eerste = new String(stripSymbool(eerste)); tweede = new String(stripSymbool(tweede)); digitE = new String(pakAantal(eerste)); digitT = new String(pakAantal(tweede)); eerste = new String(stripAantal(eerste)); tweede = new String(stripAantal(tweede)); if (tekenE.equals(tekenT)) { if (digitE.equals(digitT)) { if (tekenE.length() == 0) succes = true; } else { if (digitE.length() == digitT.length()) { result = (digitE.compareTo(digitT) < 0); } else { result = (digitE.length() < digitT.length()); } succes = true; } } else { succes = true; result = (tekenE.compareTo(tekenT) < 0); } } } return result; } } --- NEW FILE: LessCasNumber.java --- package com.egonw.woc.predicate; import java.util.*; import com.objectspace.jgl.*; import com.egonw.woc.*; public final class LessCasNumber implements BinaryPredicate { public boolean execute( Object first, Object second ) { boolean result = false; if (((Item)first).contains(Item.CASNR)) { if (((Item)second).contains(Item.CASNR)) { // assume altijd drie tokens StringTokenizer st1 = new StringTokenizer((String)((Item)first).get(Item.CASNR), "-"); StringTokenizer st2 = new StringTokenizer((String)((Item)second).get(Item.CASNR), "-"); int i = Integer.parseInt(st1.nextToken()); int j = Integer.parseInt(st2.nextToken()); if ( i == j ) { if ( Integer.parseInt(st1.nextToken()) <= Integer.parseInt(st2.nextToken()) ) { result = true; } else { result = false; } } else if ( i < j ) { result = true; } else { result = false; } } else { result = false; } } else { result = true; } return result; } } --- NEW FILE: LessEnglishWord.java --- package com.egonw.woc.predicate; import com.objectspace.jgl.*; import com.egonw.woc.*; public final class LessEnglishWord implements BinaryPredicate { public boolean execute( Object first, Object second ) { try { return ( strip((String)((Item)first).get(Item.ENGLISH))).compareTo( strip((String)((Item)second).get(Item.ENGLISH))) < 0; } catch (NullPointerException e) { if (((Item)first).contains(Item.ENGLISH)) { return false; } else { return true; } } } private String strip(String s) { StringBuffer sb = new StringBuffer(); int i = 0; while ((i <= s.length() -1) && (!Character.isLetter(s.charAt(i)))) i++; while (i <= s.length() -1) { sb.append(s.charAt(i)); i++; } return sb.toString(); } } --- NEW FILE: LessFWord.java --- package com.egonw.woc.predicate; import com.objectspace.jgl.*; import com.egonw.woc.*; public final class LessFWord implements BinaryPredicate { public boolean execute( Object first, Object second ) { try { return strip(((FWord)first).getFWord()).compareTo( strip(((FWord)second).getFWord())) < 0; } catch (NullPointerException e) { return false; } } private String strip(String s) { StringBuffer sb = new StringBuffer(); int i = 0; while ((i <= s.length() -1) && (!Character.isLetter(s.charAt(i)))) i++; while (i <= s.length() -1) { sb.append(s.charAt(i)); i++; } return sb.toString(); } } --- NEW FILE: LessGermanWord.java --- package com.egonw.woc.predicate; import com.objectspace.jgl.*; import com.egonw.woc.*; public final class LessGermanWord implements BinaryPredicate { public boolean execute( Object first, Object second ) { try { return ( strip((String)((Item)first).get(XItem.XGERMAN))).compareTo( strip((String)((Item)second).get(XItem.XGERMAN))) < 0; } catch (NullPointerException e) { if (((Item)first).contains(XItem.XGERMAN)) { return false; } else { return true; } } } private String strip(String s) { StringBuffer sb = new StringBuffer(); int i = 0; while ((i <= s.length() -1) && (!Character.isLetter(s.charAt(i)))) i++; while (i <= s.length() -1) { sb.append(s.charAt(i)); i++; } return sb.toString(); } } --- NEW FILE: LessWocWord.java --- package com.egonw.woc.predicate; import com.objectspace.jgl.*; import com.egonw.woc.*; /** * Sorts items by strings. * * @author Egon Willighagen * @version 1.1, 2/7/98 * * 2/7/98: placed in com.egonw.woc * 24/2/98: Now skips the first non-characters for sorting * */ public final class LessWocWord implements BinaryPredicate { public boolean execute( Object first, Object second ) { return strip(first.toString().toLowerCase()).compareTo( strip(second.toString().toLowerCase()) ) < 0; } private String strip(String s) { StringBuffer sb = new StringBuffer(); int i = 0; while ((i <= s.length() -1) && (!Character.isLetter(s.charAt(i)))) i++; while (i <= s.length() -1) { sb.append(s.charAt(i)); i++; } return sb.toString(); } } --- NEW FILE: SortsAsLetter.java --- package com.egonw.woc.predicate; import com.objectspace.jgl.*; import com.egonw.woc.*; import com.egonw.woc.util.*; /** * StartsWith is a binary predicate that * returns true if the first operand as a string * starts with the second operand as a string. */ public final class SortsAsLetter implements BinaryPredicate { /** * Return true if the first operand is greater than the second operand. * @param first The first operand. necessary. * @param second The second operand. necessary. * @return first.toString().startsWith( second.toString() */ public boolean execute( Object first, Object second ) { return Convert.stripTillFirstLetter(first.toString()).startsWith( second.toString() ); } } --- NEW FILE: StartsWith.java --- package com.egonw.woc.predicate; import com.objectspace.jgl.*; import com.egonw.woc.*; /** * StartsWith is a binary predicate that * returns true if the first operand as a string * starts with the second operand as a string. */ public final class StartsWith implements BinaryPredicate { /** * Return true if the first operand is greater than the second operand. * @param first The first operand. necessary. * @param second The second operand. necessary. * @return first.toString().startsWith( second.toString() */ public boolean execute( Object first, Object second ) { return first.toString().startsWith( second.toString() ); } } |
From: Egon W. <eg...@us...> - 2002-06-08 20:29:07
|
Update of /cvsroot/woc/woc/source/wocjava/source/com/egonw/woc/exception In directory usw-pr-cvs1:/tmp/cvs-serv19480/exception Added Files: BadCommentNotification.java BadItemNotification.java DuplicateItemNotification.java EmptyItemNotification.java IncompleteItemNotification.java UnknownFieldNotification.java WocException.java WocFatalError.java WocNotification.java Log Message: Added java source files. --- NEW FILE: BadCommentNotification.java --- package com.egonw.woc.exception; import com.egonw.woc.*; /** * Signals that an error occured during the reading of a Woc-format file. * * @author Egon Willighagen * @version 1.0, 1/7/98 */ public class BadCommentNotification extends BadItemNotification { public BadCommentNotification(Item i) { super(i); } } --- NEW FILE: BadItemNotification.java --- package com.egonw.woc.exception; import com.egonw.woc.*; /** * Signals that an error occured during the reading of a Woc-format file. * * @author Egon Willighagen * @version 1.0, 1/7/98 */ public class BadItemNotification extends WocNotification { public BadItemNotification(Item i) { super(i); } } --- NEW FILE: DuplicateItemNotification.java --- package com.egonw.woc.exception; import com.egonw.util.*; import com.egonw.woc.*; /** * Signals an non-terminal error. * * @author Egon Willighagen * @version 1.0, 1/7/98 */ public class DuplicateItemNotification extends WocNotification { /** * Constructs a <code>DuplicateItemException</code>. */ public DuplicateItemNotification(Item i) { super(i); } } --- NEW FILE: EmptyItemNotification.java --- package com.egonw.woc.exception; import com.egonw.woc.*; /** * Signals an non-terminal error. * * @author Egon Willighagen * @version 1.0, 1/7/98 */ public class EmptyItemNotification extends WocNotification { /** * Constructs a <code>EmptyItemException</code>. */ public EmptyItemNotification(Item i) { super(i); } } --- NEW FILE: IncompleteItemNotification.java --- package com.egonw.woc.exception; import com.egonw.util.*; import com.egonw.woc.*; /** * Signals an non-terminal error. * * @author Egon Willighagen * @version 1.0, 1/7/98 */ public class IncompleteItemNotification extends WocNotification { /** * Constructs a <code>IncompleteItemException</code>. */ public IncompleteItemNotification(Item i) { super(i); } } --- NEW FILE: UnknownFieldNotification.java --- package com.egonw.woc.exception; import com.egonw.woc.*; /** * Signals that an error occured during the reading of a Woc-format file. * * @author Egon Willighagen * @version 1.0, 1/7/98 */ public class UnknownFieldNotification extends BadItemNotification { public UnknownFieldNotification(Item i) { super(i); } } --- NEW FILE: WocException.java --- package com.egonw.woc.exception; import java.lang.Exception; /** * Signals an non-terminal error. * * @author Egon Willighagen * @version 1.0, 1/7/98 */ public class WocException extends Exception { /** * Constructs a <code>WocException</code> with no detail message. */ public WocException() { super(); } /** * Constructs a <code>WocException</code> with a detail message. */ public WocException(String s) { super(s); } } --- NEW FILE: WocFatalError.java --- package com.egonw.woc.exception; import com.egonw.util.*; /** * Signals an non-terminal error. * * @author Egon Willighagen * @version 1.0, 1/7/98 */ public class WocFatalError extends WocException { /** * Constructs a <code>WocFatalError</code> with no detail message. */ public WocFatalError() { super(); } /** * Constructs a <code>WocFatalError</code> with a detail message. */ public WocFatalError(String s) { super(); } } --- NEW FILE: WocNotification.java --- package com.egonw.woc.exception; import com.egonw.util.*; import com.egonw.woc.*; /** * Signals an non-terminal error. * * @author Egon Willighagen * @version 1.0, 1/7/98 */ public class WocNotification extends WocException { private Item i; /** * Constructs a <code>WocException</code> with no detail message. */ public WocNotification(Item i) { super(); this.i = i; } /** * Returns the item. */ public String toString() { return (String)i.get(Item.NAME); } } |
From: Egon W. <eg...@us...> - 2002-06-08 20:29:07
|
Update of /cvsroot/woc/woc/source/wocjava/source/com/egonw/woc/tools In directory usw-pr-cvs1:/tmp/cvs-serv19480/tools Added Files: GroupFiles.java MaakLosseItems.java SimpleAddItem.java Woord.java Log Message: Added java source files. --- NEW FILE: GroupFiles.java --- package com.egonw.woc.tools; import com.objectspace.jgl.*; import com.objectspace.jgl.algorithms.*; import com.objectspace.jgl.predicates.*; import java.io.*; import java.util.*; import com.egonw.woc.*; import com.egonw.woc.files.*; import com.egonw.woc.util.*; import com.egonw.woc.predicate.*; import com.egonw.woc.exception.*; class GroupFiles { private static String title = "WOC.GroupFiles"; private static String version = "1.3"; private static String date = "2002-01-27"; private static Path repository; public static void main(String[] args) { String reposdeffile = "file:///vol/www/woc/bin/repository_def.xml"; String repos = "woc"; System.out.println(title + " v." + version + " (" + date + ")"); int length = args.length; if (length > 0) { System.out.println("Parsing arguments..."); for (int i = 0; i < length; i++) { if (args[i].equals("-r") && ((i+1) < length)) { repository = new Path(args[i+1]); System.out.println(" repository: " + args[i+1]); } else if ("-R".equals(args[i]) && ((i+1) < length)) { reposdeffile = args[i+1]; System.out.println(" reposdeffile: " + args[i+1]); i++; } else { System.out.println("Unknown option: " + args[i]); System.exit(1); } } } // setting default repository String url = "file://" + reposdeffile; repository = new Path("woc", url); WocEngine we = new WocEngine(repository); we.setWoordTable(new WoordTable()); try { we.setWocReportFile(new WocReportFile("WMLreport.txt")); } catch (IOException e) { System.out.println(e); } String readfile = "woclist.xml"; System.out.println("Reading " + readfile + "..."); WocListReadFile rf = new WocListReadFile(repository, readfile); we.setReadFile((FileReadAble)rf); we.read(); System.out.println("Expanding items..."); we.setConvertAble(new Expander()); we.convert(); System.out.println("Adding group items..."); we.setConvertAble(new GroupAdder()); we.convert(); System.out.println("Marking up items..."); we.setConvertAble(new Markup()); //we.convert(); System.out.print("Writing data..."); Enumeration groepen = GroupAdder.extractGroups( we.getWT() ); while (groepen.hasMoreElements()) { String groep = (String)groepen.nextElement(); UnaryPredicate predicate = new BindSecondPredicate( new IsGroup(), new String(groep) ); we.setFilterPredicate(predicate); try { ItemWriteFile iwf = new ItemWriteFile(repository, repository.getPhysicalRoot() + repository.getGroupFileSubDir() + Convert.GROUPLikeToANCHORLike(groep) + ".html"); we.setWriteFile((FileWriteAble)iwf); we.write(); iwf.close(); } catch (IOException e) { System.out.println(e); } } } } --- NEW FILE: MaakLosseItems.java --- package com.egonw.woc.tools; import com.objectspace.jgl.*; import com.objectspace.jgl.algorithms.*; import com.objectspace.jgl.predicates.*; import java.io.*; import java.util.*; import com.egonw.woc.*; import com.egonw.woc.util.*; import com.egonw.woc.files.*; import com.egonw.woc.predicate.*; import com.egonw.woc.exception.*; import org.openscience.dadml.*; import org.openscience.dadml.filereaders.*; import org.openscience.dadml.tools.*; class MaakLosseItems { private static final String pClass = "org.apache.xerces.parsers.SAXParser"; private static String title = "WOC.MaakLosseItems"; private static String version = "1.5.0"; private static String date = "2002-01-27"; private static Path repository; public static void main(String[] args) { String reposdeffile = "file:///vol/www/woc/bin/repository_def.xml"; String repos = "woc"; System.out.println(title + " v." + version + " (" + date + ")"); int length = args.length; if (length > 0) { System.out.println("Parsing arguments..."); for (int i = 0; i < length; i++) { if ("-r".equals(args[i]) && ((i+1) < length)) { repos = args[i+1]; System.out.println(" repository: " + args[i+1]); i++; } else if ("-R".equals(args[i]) && ((i+1) < length)) { reposdeffile = args[i+1]; System.out.println(" reposdeffile: " + args[i+1]); i++; } else { System.out.println("Unknown option: " + args[i]); System.exit(1); } } } // setting default repository String url = "file://" + reposdeffile; repository = new Path("woc", url); WocEngine we = new WocEngine(repository); we.setWoordTable(new WoordTable()); try { we.setWocReportFile(new WocReportFile("WMLreport.txt")); } catch (IOException e) { System.out.println(e); } String readfile = "woclist.xml"; System.out.println("Reading " + readfile + "..."); WocListReadFile rf = new WocListReadFile(repository, readfile); we.setReadFile((FileReadAble)rf); we.read(); System.out.println("Downloading DADML database definitions..."); DBDEFLIST dbdeflist = new DBDEFLIST(); DBLIST dblist = new DBLIST(); String superXML = "http://www.sci.kun.nl/woc/super.xml"; try { // System.err.println("Downloading: " + superXML); dblist = DBLISTFileReader.read(superXML, pClass); } catch (Exception supererror) { System.err.println(supererror.toString()); return; } Enumeration dbases = dblist.databases(); while (dbases.hasMoreElements()) { DATABASE db = (DATABASE)dbases.nextElement(); String dburl = db.getURL()+db.getDefinition(); DBDEF dbdef = new DBDEF(); try { // System.err.println("Downloading: " + dburl); dbdef = DBDEFFileReader.read(dburl, pClass); dbdeflist.addDBDEF(dbdef); } catch (Exception deferror) { System.err.println(deferror.toString()); return; } } //System.out.println("Expanding items..."); //we.setConvertAble(new Expander()); //we.convert(); //we.setConvertAble(new TopicExpander()); //we.convert(); System.out.println("Adding group items..."); we.setConvertAble(new GroupAdder()); we.convert(); //System.out.println("Marking up items..."); //we.setConvertAble(new Markup()); //we.convert(); System.out.println("Writing data..."); Enumeration values = we.getWTElements(); while (values.hasMoreElements()) { Item i = (Item)values.nextElement(); we.setFilterPredicate( new BindSecondPredicate( new IsName(), (String)i.get(Item.NAME) ) ); try { System.out.println(" " + (String)i.get(Item.NAME) + " -> " + (String)i.get(XItem.XFILENAME)); ItemWriteFile iwf = new ItemWriteFile(repository, repository.getPhysicalRoot() + repository.getItemFileSubDir() + (String)i.get(XItem.XFILENAME) + ".shtml", ItemFile.LONG, dbdeflist); we.setWriteFile((FileWriteAble)iwf); we.write(); iwf.close(); } catch (IOException e) { System.out.println(e); }; }; } } --- NEW FILE: SimpleAddItem.java --- package com.egonw.woc.tools; import com.objectspace.jgl.*; import com.objectspace.jgl.algorithms.*; import com.objectspace.jgl.predicates.*; import java.io.*; import java.util.*; import com.egonw.woc.*; import com.egonw.woc.files.*; import com.egonw.woc.util.*; import com.egonw.woc.predicate.*; import com.egonw.woc.exception.*; import org.openscience.dadml.*; import org.openscience.dadml.filereaders.*; import org.openscience.dadml.tools.*; class SimpleAddItem { private static final String pClass = "org.apache.xerces.parsers.SAXParser"; private static String title = "WOC.SimpleAddItem"; private static String version = "1.4"; private static String date = "23-02-2001"; private static Path repository; private static String module = ""; public static void main(String[] args) { System.out.println(title + " v." + version + " (" + date + ")"); int length = args.length; if (length > 0) { String f = ""; if (length > 1) { System.out.println("Parsing arguments..."); for (int i = 0; i < length; i++) { if (args[i].equals("-r") && ((i+1) < length)) { i++; repository = new Path(args[i]); System.out.println(" repository: " + args[i]); } else if (args[i].equals("-m") && ((i+1) < length)) { i++; module = args[i]; System.out.println(" module: " + args[i]); } } // file is considered the last argument f = args[length-1]; } else { f = args[0]; } // setting default repository if (repository == null) { repository = new Path("woc"); } WocEngine we = new WocEngine(repository); we.setWoordTable(new WoordTable()); try { we.setWocReportFile(new WocReportFile("WMLreport.txt")); } catch (IOException e) { System.out.println(e); } System.out.println("Reading data..."); if (!(f.endsWith(".xml"))) { f = f + ".xml"; } WMLReadFile rf = new WMLReadFile(repository, f); we.setReadFile((FileReadAble)rf); we.read(); System.out.println("Downloading DADML database definitions..."); DBDEFLIST dbdeflist = new DBDEFLIST(); DBLIST dblist = new DBLIST(); String superXML = "http://www.sci.kun.nl/woc/super.xml"; try { System.err.println("Downloading: " + superXML); dblist = DBLISTFileReader.read(superXML, pClass); } catch (Exception supererror) { System.err.println(supererror.toString()); return; } Enumeration dbases = dblist.databases(); while (dbases.hasMoreElements()) { DATABASE db = (DATABASE)dbases.nextElement(); String dburl = db.getURL()+db.getDefinition(); DBDEF dbdef = new DBDEF(); try { System.err.println("Downloading: " + dburl); dbdef = DBDEFFileReader.read(dburl, pClass); dbdeflist.addDBDEF(dbdef); } catch (Exception deferror) { System.err.println(deferror.toString()); return; } } System.out.println("Expanding item..."); we.setConvertAble(new Expander()); we.convert(); // System.out.println("Marking up items..."); // if (module.length() > 0) { // try { // Class c = Woord.class.getClassLoader().loadClass("com.egonw.woc.util." + module); // we.setConvertAble((ConvertAble)c.newInstance()); // we.convert(); // } catch (ClassCastException e) { // System.out.println("Object " + module + " is not a module!"); // } catch (ClassNotFoundException e) { // System.out.println("Module " + module + " not found!"); // } catch (Exception e) { // System.out.println("Error: " + e); // } // } System.out.print("Writing data..."); Enumeration values = we.getWTElements(); while (values.hasMoreElements()) { Item i = (Item)values.nextElement(); System.out.println("Processing: " +(String)i.get(Item.NAME)); we.setFilterPredicate( new BindSecondPredicate( new IsName(), (String)i.get(Item.NAME) ) ); try { String filename =repository.getPhysicalRoot() + repository.getItemFileSubDir() + (String)i.get(Item.ANCHOR) + ".shtml"; System.out.println("Filename: " + filename); ItemWriteFile iwf = new ItemWriteFile(repository, filename, ItemFile.LONG, dbdeflist); we.setWriteFile((FileWriteAble)iwf); we.write(); iwf.close(); } catch (IOException e) { System.out.println(e); }; }; System.out.println(); } else { System.out.println("syntax: java SimpleAddItem [-r repository] <item.xml>"); } } } --- NEW FILE: Woord.java --- package com.egonw.woc.tools; import com.objectspace.jgl.*; import com.objectspace.jgl.algorithms.*; import com.objectspace.jgl.predicates.*; import java.io.*; import java.util.*; import com.egonw.woc.*; import com.egonw.woc.files.*; import com.egonw.woc.util.*; import com.egonw.woc.predicate.*; import com.egonw.woc.exception.*; class Woord { private static String title = "WOC.Woord"; private static String version = "1.5.0"; private static String date = "2002-01-27"; private static String path = "woc"; private static Path repository; private static String module = ""; public static void main(String[] args) { String reposdeffile = "file:///vol/www/woc/bin/repository_def.xml"; String repos = "woc"; System.out.println(title + " v." + version + " (" + date + ")"); int length = args.length; if (length > 0) { System.out.println("Parsing arguments..."); for (int i = 0; i < length; i++) { if (args[i].equals("-r") && ((i+1) < length)) { i++; path = args[i]; System.out.println(" repository: " + args[i]); } else if ("-R".equals(args[i]) && ((i+1) < length)) { reposdeffile = args[i+1]; System.out.println(" reposdeffile: " + args[i+1]); i++; } else { System.out.println("Unknown option: " + args[i]); System.exit(1); } } } // setting default repository String url = "file://" + reposdeffile; repository = new Path("woc", url); WocEngine we = new WocEngine(repository); we.setWoordTable(new WoordTable()); try { we.setWocReportFile(new WocReportFile("WMLreport.txt")); } catch (IOException e) { System.out.println(e); } String readfile = "woclist.xml"; System.out.println("Reading " + readfile + "..."); WocListReadFile rf = new WocListReadFile(repository, readfile); we.setReadFile((FileReadAble)rf); we.read(); System.out.println("Expanding items..."); we.setConvertAble(new Expander()); we.convert(); we.setConvertAble(new TopicExpander()); we.convert(); System.out.println("Adding group items..."); we.setConvertAble(new GroupAdder()); we.convert(); System.out.println("Marking up items..."); if (module.length() > 0) { try { Class c = Woord.class.getClassLoader().loadClass(module); we.setConvertAble((ConvertAble)c.newInstance()); we.convert(); } catch (ClassCastException e) { System.out.println("Object " + module + " is not a module!"); } catch (ClassNotFoundException e) { System.out.println("Module " + module + " not found!"); } catch (Exception e) { System.out.println("Error: " + e); } } System.out.print("Writing data..."); for (int i=97;i<=122;i++) { we.setFilterPredicate( new BindSecondPredicate( new SortsAsLetter(), new Character((char)i) ) ); try { we.setWriteFile((FileWriteAble)(new ShortLetterFile(repository, (char)i, 10))); } catch (IOException e) { System.out.println(e); }; we.write(); System.out.print("."); }; } } |
From: Egon W. <eg...@us...> - 2002-06-08 20:29:07
|
Update of /cvsroot/woc/woc/source/wocjava/source/com/egonw/woc/util In directory usw-pr-cvs1:/tmp/cvs-serv19480/util Added Files: Convert.java ConvertAble.java Enumerator.java Expander.java GroupAdder.java ItemInfo.java IupacExtender.java Markup.java Memo.java MergeItems.java Path.java RepositoryDefHandler.java TopicExpander.java Log Message: Added java source files. --- NEW FILE: Convert.java --- package com.egonw.woc.util; public class Convert { public static String charInString(String s, char one, char two) { StringBuffer result = new StringBuffer(); for (int i = 0; i < s.length(); i++) { if (s.charAt(i) == one) { result.append(two); } else { result.append(one); } } return result.toString(); } public static String firstLetterUpperCase(String s) { StringBuffer result = new StringBuffer(); if (s.length() > 0) { if (Character.isLetter(s.charAt(0))) { String firstLetter = new String((new Character(s.charAt(0))).toString()); result.append(firstLetter.toUpperCase()); } else result.append(s.charAt(0)); for (int i = 1; i < s.length(); i++) result.append(s.charAt(i)); } return result.toString(); } public static String firstUpperCase(String s) { StringBuffer result = new StringBuffer(); s = new String(s.toLowerCase().trim()); result.append(getTillFirstLetter(s)); result.append(firstLetterUpperCase(stripTillFirstLetter(s))); return result.toString(); } public static String NAMELikeToANCHORLike(String s) { StringBuffer result = new StringBuffer(); char c; s = s.toLowerCase().trim(); for (int i=0; i < s.length(); i++) { c = s.charAt(i); if ( (int)c >= 97 && (int)c <= 122 ) { result.append(c); } else if ( (c == '1') || (c == '2') || (c == '3') || (c == '4') || (c == '5') || (c == '6') || (c == '7') || (c == '8') || (c == '9') || (c == '0') ) { result.append(c); } else if ( c == ' ' ) { result.append('_'); } else if ( c == '-' ) { result.append(c); } else {}; } return result.toString(); } public static String GROUPLikeToANCHORLike(String s) { return NAMELikeToANCHORLike(s); } public static String GROUPLikeToNAMELike(String s) { //ofwel: maak van alle _ een spatie StringBuffer result = new StringBuffer(); char c; for (int i=0; i < s.length(); i++) { c = s.charAt(i); if ( c == '_' ) { result.append(' '); } else { result.append(c); }; } return result.toString(); } public static String getTillFirstLetter(String s) { StringBuffer sb = new StringBuffer(); int i = 0; while ((i<s.length()) && (!Character.isLetter(s.charAt(i)))) { sb.append(s.charAt(i)); i++; } return sb.toString(); } public static String stripTillFirstLetter(String s) { StringBuffer sb = new StringBuffer(); int i = 0; while ((i<s.length()) && (!Character.isLetter(s.charAt(i)))) i++; while (i < s.length()) { sb.append(s.charAt(i)); i++; } return sb.toString(); } } --- NEW FILE: ConvertAble.java --- package com.egonw.woc.util; import com.egonw.util.*; import com.egonw.woc.*; import com.egonw.woc.exception.*; public interface ConvertAble { void set(WoordTable wt); void set(ReportFile rf); WoordTable convert(); String getName(); } --- NEW FILE: Enumerator.java --- package com.egonw.woc.util; import java.util.Vector; import java.util.Enumeration; import com.egonw.util.*; import com.egonw.woc.*; import com.egonw.woc.files.*; import com.egonw.woc.exception.*; import com.egonw.woc.wml.*; public final class Enumerator implements ConvertAble { private WoordTable wt; private ReportFile rf; public Enumerator() {}; public String getName() { return "Enumerator"; } public void set(WoordTable wt) { this.wt = wt; } public void set(ReportFile rf) { if (rf instanceof WocReportFile) this.rf = rf; } public WoordTable convert() { WoordTable result = new WoordTable(); if (wt != null) { Item i; char letter = ' '; int j = 1; Enumeration values = wt.elements(); while ( values.hasMoreElements() ) { i = (Item)values.nextElement(); if (letter != ((String)i.get(Item.NAME)).toLowerCase().charAt(0)) { letter = ((String)i.get(Item.NAME)).toLowerCase().charAt(0); j = 1; } else { j++; } i.add(Item.NUMBER, i); try { result.add(i); } catch (WocNotification wn) { if (this.rf != null) { ((WocReportFile)rf).reportWocNotification(wn); } } } } return result; } } --- NEW FILE: Expander.java --- package com.egonw.woc.util; import java.util.Vector; import java.util.Enumeration; import com.egonw.util.*; import com.egonw.woc.*; import com.egonw.woc.files.*; import com.egonw.woc.wml.*; import com.egonw.woc.exception.*; public final class Expander implements ConvertAble { private WoordTable wt; private ReportFile rf; public Expander() {}; public String getName() { return "Expander"; } public void set(WoordTable wt) { this.wt = wt; } public void set(ReportFile rf) { if (rf instanceof WocReportFile) this.rf = rf; } public WoordTable convert() { WoordTable result = new WoordTable(); if (wt != null) { try { result.add(wt); } catch (WocNotification wn) {}; Item i; XItem j; Enumeration values = wt.elements(); while ( values.hasMoreElements() ) { i = (Item)values.nextElement(); /** expand IUPACNAME */ if (i.contains(Item.IUPACNAME)) { j = new XItem(); j.add(XItem.XFILENAME, i.get(XItem.XFILENAME)); j.add(Item.NAME, (String)i.get(Item.IUPACNAME)); if (i.contains(Item.CHEMICAL)) { j.add(Item.CHEMICAL, new String()); } Vector zie = new Vector(); zie.addElement((String)i.get(Item.NAME)); j.add(Item.ZIE, zie); j.add(XItem.XSEEONLY, Boolean.TRUE); try { result.add(j); } catch (WocNotification wn) { if (this.rf != null) { ((WocReportFile)rf).reportWocNotification(wn); } } } /** expand TRIVIALNAMEs */ if (i.contains(Item.TRIVIALNAME)) { Vector trivnames = (Vector)i.get(Item.TRIVIALNAME); Enumeration values_two = trivnames.elements(); while (values_two.hasMoreElements()) { String trivialName = (String)values_two.nextElement(); j = new XItem(); j.add(XItem.XFILENAME, i.get(XItem.XFILENAME)); j.add(Item.NAME, trivialName); /** nieuwe vector met over te nemen (otn) triviale namen **/ Enumeration otn_values = trivnames.elements(); Vector newTrivials = new Vector(); while (otn_values.hasMoreElements()) { String waarde = (String)otn_values.nextElement(); if (!waarde.equals(trivialName) && (waarde.length() != 0)) newTrivials.addElement(waarde); } if (newTrivials.size() > 0 ) j.add(Item.TRIVIALNAME, newTrivials); if (i.contains(Item.IUPACNAME)) j.add(Item.IUPACNAME, (String)i.get(Item.IUPACNAME)); Vector zie = new Vector(); zie.addElement((String)i.get(Item.NAME)); j.add(Item.ZIE, zie); j.add(XItem.XSEEONLY, Boolean.TRUE); try { result.add(j); } catch (WocNotification wn) { if (this.rf != null) { ((WocReportFile)rf).reportWocNotification(wn); } } } } /** expand ABBREVs */ if (i.contains(XItem.XAFKORT)) { Vector trivnames = (Vector)i.get(XItem.XAFKORT); Enumeration values_two = trivnames.elements(); while (values_two.hasMoreElements()) { Object o = values_two.nextElement(); if (o instanceof String) { System.out.println(i.get(Item.NAME) + " -> AFK: " + o); } else { XNODE trivialName = (XNODE)o; j = new XItem(); j.add(XItem.XFILENAME, i.get(XItem.XFILENAME)); j.add(Item.NAME, (String)trivialName.getCDATA()); XTYPE xt = new XTYPE(); xt.setType(XTYPE.ABBREV); j.add(XItem.XTYPE, xt); Memo m = new Memo(); Vector zie = new Vector(); zie.addElement((String)i.get(Item.NAME)); j.add(Item.ZIE, zie); m.add("Afkorting van " + (String)i.get(Item.NAME) + "."); Vector comments = new Vector(); comments.add(m); j.add(Item.COMMENT, comments); try { result.add(j); } catch (WocNotification wn) { if (this.rf != null) { ((WocReportFile)rf).reportWocNotification(wn); } } } } } } } return result; } } --- NEW FILE: GroupAdder.java --- package com.egonw.woc.util; import com.objectspace.jgl.*; import com.objectspace.jgl.algorithms.*; import com.objectspace.jgl.predicates.*; import java.util.Vector; import java.util.Enumeration; import com.egonw.util.*; import com.egonw.woc.*; import com.egonw.woc.files.*; import com.egonw.woc.predicate.*; import com.egonw.woc.exception.*; public final class GroupAdder implements ConvertAble { private WoordTable wt; private ReportFile rf; public GroupAdder() {}; public String getName() { return "Group Adder"; } public void set(WoordTable wt) { this.wt = wt; } public void set(ReportFile rf) { if (rf instanceof WocReportFile) this.rf = rf; } public WoordTable convert() { WoordTable result = wt; if (this.wt != null) { Enumeration groepen = extractGroups(wt); while (groepen.hasMoreElements()) { String groep = (String)groepen.nextElement(); try { result.add(convertGroupItems( returnGroupItems(wt, groep), groep) ); } catch (WocNotification wn) { if (this.rf != null) { ((WocReportFile)rf).reportWocNotification(wn); } } } } return result; } public static Enumeration extractGroups(WoordTable wt) { // bepaal alle groepen in de WOC Enumeration values = wt.elements(); OrderedSet groepen = new OrderedSet( new LessString() ); while ( values.hasMoreElements() ) { Item i = (Item)values.nextElement(); if (i.contains(Item.GROUP)) { Enumeration groups = ((Vector)i.get(Item.GROUP)).elements(); while (groups.hasMoreElements()) { String value = (String)groepen.add(groups.nextElement()); } } } return groepen.elements(); } public static WoordTable returnGroupItems(WoordTable wt, String group) { // bepaal alle item die binnen een groep horen WoordTable result = new WoordTable(); try { UnaryPredicate predicate = new BindSecondPredicate( new IsGroup(), new String(group) ); result.add((Container)Filtering.select(wt, predicate )); } catch (WocNotification wn) { System.out.println("Unreported WocNotification"); } finally { return result; } } public static Item convertGroupItems(WoordTable wt, String group) { // maak een nieuwe groep van alle item group = Convert.GROUPLikeToNAMELike(group); XItem result = new XItem(); result.add(XItem.XFILENAME, group); result.add(Item.NAME, group); result.add(XItem.XGROUP, new String("yes")); StringBuffer comment = new StringBuffer(); Enumeration values = wt.elements(); while ( values.hasMoreElements() ) { Item i = (Item)values.nextElement(); comment.append(i.get(Item.NAME)); if (values.hasMoreElements()) comment.append(", "); } Vector commentlist = new Vector(); Memo m = new Memo(); m.add("<P>Voorbeelden van " + group + " zijn: "); m.add(comment.toString()); m.add("</P>"); commentlist.addElement( m ); result.add(Item.COMMENT,commentlist); return result; } } --- NEW FILE: ItemInfo.java --- package com.egonw.woc.util; import java.util.*; import com.egonw.woc.*; import com.egonw.woc.wml.*; public class ItemInfo { public static Vector listKeywords(Item i) { /* returns a Vector of Strings */ Vector v = new Vector(); if (i.contains(XItem.XNAME)) { Enumeration names = ((Vector)i.get(XItem.XNAME)).elements(); while (names.hasMoreElements()) { Enumeration langs = ((XNAME)names.nextElement()).elements(); while (langs.hasMoreElements()) { v.addElement(((XLANG)langs.nextElement()).getValue()); } } } return v; } public static boolean containsLongInfo(Item i) { return (containsModels(i) || i.contains(Item.VERVOEGINGEN) || i.contains(Item.LIDWOORD) || i.contains(Item.CASNR) || i.contains(XItem.XGROUP) || i.contains(XItem.XGERMAN) || i.contains(Item.ENGLISH)); } public static boolean containsModels(Item i) { return (i.contains(Item.MOL) || i.contains(Item.PDB) || i.contains(Item.XYZFILE)); } public static boolean containsFysicalProps(Item i) { return (i.contains(Item.MASS) || i.contains(Item.RHO) || i.contains(Item.BOILINGPOINT) || i.contains(Item.MELTINGPOINT) || i.contains(Item.DIPOOL)); } public static boolean hasMoreThanOneComment(Item i) { boolean result = false; if (i.contains(Item.COMMENT)) { result = ( ((Vector)i.get(Item.COMMENT)).size() > 1 ); } return result; } public static boolean hasMoreThanOneVoorbeeld(Item i) { boolean result = false; if (i.contains(Item.VOORBEELD)) { result = ( ((Vector)i.get(Item.VOORBEELD)).size() > 1 ); } return result; } } --- NEW FILE: IupacExtender.java --- package com.egonw.woc.util; import com.objectspace.jgl.*; import com.objectspace.jgl.predicates.*; import com.objectspace.jgl.algorithms.*; import java.util.*; import java.io.Serializable; import com.egonw.util.*; import com.egonw.woc.*; import com.egonw.woc.predicate.*; import com.egonw.woc.exception.*; import com.egonw.woc.files.*; public final class IupacExtender implements ConvertAble { private WoordTable wt; private ReportFile rf; public IupacExtender () {}; public String getName() { return "IupacExtend"; } public void set(WoordTable wt) { this.wt = wt; } public void set(ReportFile rf) { if (rf instanceof WocReportFile) this.rf = rf; } public WoordTable convert() { WoordTable result = new WoordTable(); if (wt != null) { Enumeration v = wt.elements(); while ( v.hasMoreElements() ) { Item item = (Item)v.nextElement(); try { result.add(extendIupacNamespace(item)); } catch (WocNotification wn) { System.out.println("Error encountered in item : " + item.toString()); } } } return result; } private Item extendIupacNamespace(Item i) { if (i.contains(Item.COMMENT)) { Vector result = new Vector(); Enumeration comments = ((Vector)i.get(Item.COMMENT)).elements(); while ( comments.hasMoreElements() ) { result.addElement(this.comment((Memo)comments.nextElement(), (String)i.get(Item.NAME))); } i.add(Item.COMMENT, result); } if (i.contains(Item.VOORBEELD)) { Vector result = new Vector(); Enumeration comments = ((Vector)i.get(Item.VOORBEELD)).elements(); while ( comments.hasMoreElements() ) { result.addElement(this.comment((Memo)comments.nextElement(), (String)i.get(Item.NAME))); } i.add(Item.COMMENT, result); } return i; } private Memo comment(Memo m, String name) { Memo r = new Memo(); Enumeration values = m.elements(); while ( values.hasMoreElements() ) { String regel = (String)values.nextElement(); if (regel.indexOf("<iupac:def>") != -1) { regel = replace(regel, "iupac:def", "i"); } if (regel.indexOf("</iupac:def>") != -1) { regel = replace(regel, "iupac:def", "i"); } if (regel.indexOf("<iupac:regel>") != -1) { regel = replace(regel, "iupac:regel", "a href=\"\""); } if (regel.indexOf("</iupac:regel>") != -1) { regel = replace(regel, "iupac:regel", "a"); } if (regel.indexOf("<iupac:term>") != -1) { regel = replace(regel, "iupac:term", "i><b"); } if (regel.indexOf("</iupac:term>") != -1) { regel = replace(regel, "iupac:term", "b></i"); } r.add(regel); } return r; } private String replace(String in, String old, String with) { StringBuffer sb = new StringBuffer(in); int index = in.indexOf(old); if (index != -1) { sb.replace(index, index + old.length(), with); } return sb.toString(); } } --- NEW FILE: Markup.java --- package com.egonw.woc.util; import com.objectspace.jgl.*; import com.objectspace.jgl.predicates.*; import com.objectspace.jgl.algorithms.*; import java.util.*; import java.io.Serializable; import com.egonw.util.*; import com.egonw.woc.*; import com.egonw.woc.predicate.*; import com.egonw.woc.exception.*; import com.egonw.woc.files.*; public final class Markup implements ConvertAble { private WoordTable wt; private ReportFile rf; public Markup () {}; public String getName() { return "MarkUp"; } public void set(WoordTable wt) { this.wt = wt; } public void set(ReportFile rf) { if (rf instanceof WocReportFile) this.rf = rf; } public WoordTable convert() { WoordTable result = new WoordTable(); if (wt != null) { Enumeration v = wt.elements(); while ( v.hasMoreElements() ) { try { result.add(this.commentsInItem((Item)v.nextElement())); } catch (WocNotification wn) { if (this.rf != null) { ((WocReportFile)rf).reportWocNotification(wn); } } } } return result; } public Item commentsInItem(Item i) { if (i.contains(Item.COMMENT)) { Vector result = new Vector(); Enumeration comments = ((Vector)i.get(Item.COMMENT)).elements(); while ( comments.hasMoreElements() ) { result.addElement(this.comment((Memo)comments.nextElement(), (String)i.get(Item.NAME))); } i.add(Item.COMMENT, result); } return i; } public Memo comment(Memo m, String name) { Memo r = new Memo(); Enumeration values = m.elements(); while ( values.hasMoreElements() ) { StringBuffer tot = new StringBuffer(); StringTokenizer st = new StringTokenizer( (String)values.nextElement(), "\n\t\r.,;:?!'` \"",true); while (st.hasMoreTokens()) { String token = st.nextToken(); UnaryPredicate up = new BindSecondPredicate( new IsSource(), token ); System.out.println(token); if (Finding.some((Container)this.wt, up)) { String anchor = Convert.NAMELikeToANCHORLike(token); tot.append("<a href=" + HtmlWriteFile.QUOT + "../letters/" + anchor.substring(0,1) + ".html#" + anchor + HtmlWriteFile.QUOT + ">" + token + "</a>"); } else { tot.append(token); } } r.add(tot.toString()); } return r; } } --- NEW FILE: Memo.java --- package com.egonw.woc.util; import java.util.Vector; public class Memo extends Vector{ public Memo() { super(5,3); } public void add(String s) { super.addElement(s); } public void empty() { super.removeAllElements(); } public int count() { return super.size(); } public String getLine(int i) { return (String)super.elementAt(i-1); } } --- NEW FILE: MergeItems.java --- package com.egonw.woc.util; import java.util.Vector; import java.util.Enumeration; import com.egonw.woc.*; import com.egonw.woc.files.*; import com.egonw.woc.exception.*; public final class MergeItems { public static Item comment(Item i, Item j) { Item result = i; return result; } } --- NEW FILE: Path.java --- package com.egonw.woc.util; import java.io.*; import java.util.*; import com.egonw.woc.exception.*; import org.xml.sax.*; import org.xml.sax.helpers.*; /** * Class that defines the path to certain files. * * @author Egon Willighagen * @version 1.1, 04/09/2000 */ public class Path { private Hashtable defs; private String name; public Path(String repository) { this(repository, "file:///vol/www/woc/bin/repository_def.xml"); } public Path(String repository, String url) { defs = new Hashtable(); name = repository; // parse the repository document try { String parserName = "org.apache.xerces.parsers.SAXParser"; XMLReader parser = (XMLReader)Class.forName(parserName).newInstance(); ContentHandler handler = new RepositoryDefHandler(repository); parser.setContentHandler(handler); parser.setFeature("http://xml.org/sax/features/validation", false); parser.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", false); parser.parse(url); if (((RepositoryDefHandler)handler).foundRepository()) { defs = ((RepositoryDefHandler)handler).returnDefs(); } else { throw new WocException("Repository (" + repository + ") not found!"); } } catch (Exception e) { System.err.println("Error: " + e); System.exit(1); } } public String getName() { return this.name; }; public String getPhysicalRoot() { return (String)defs.get("PhysicalRoot"); }; public String getDataSubDir() { return (String)defs.get("DataSubDir"); }; public String getWMLSubDir() { return (String)defs.get("WMLSubDir"); }; public String getHtmlRoot() { return (String)defs.get("HtmlRoot"); }; public String getCgiBinRoot() { return (String)defs.get("CgiBinRoot"); }; public String getLetterFileSubDir() { return (String)defs.get("LetterFileSubDir"); }; public String getItemFileSubDir() { return (String)defs.get("ItemFileSubDir"); }; public String getGroupFileSubDir() { return (String)defs.get("GroupFileSubDir"); }; public String getIndexFileSubDir() { return (String)defs.get("IndexFileSubDir"); }; public String getPictureSubDir() { return (String)defs.get("PictureSubDir"); }; public String getCSSSubDir() { return (String)defs.get("CSSSubDir"); }; public String getLocatieSubDir() { return (String)defs.get("LocatieSubDir"); }; public String getJavascriptSubDir() { return (String)defs.get("JavascriptSubDir"); }; public String getJavaSubDir() { return (String)defs.get("JavaSubDir"); }; public String getModelsSubDir() { return (String)defs.get("ModelsSubDir"); }; public String getDADMLSubDir() { return (String)defs.get("DADMLSubDir"); }; public String getMolSubDir() { return (String)defs.get("MolSubDir"); }; public String getPdbSubDir() { return (String)defs.get("PdbSubDir"); }; public String getXyzSubDir() { return (String)defs.get("XyzSubDir"); }; public String getCmlSubDir() { return (String)defs.get("CmlSubDir"); }; public String getPhysPropSubDir() { return (String)defs.get("PhysPropSubDir"); }; public String getGifSubDir() { return (String)defs.get("GifSubDir"); }; public String getBronnenFile() { return (String)defs.get("BronnenFile"); }; public String getDatabasesFile() { return (String)defs.get("DatabasesFile"); }; } --- NEW FILE: RepositoryDefHandler.java --- package com.egonw.woc.util; import java.util.*; import java.io.*; import org.openscience.dadml.*; import com.egonw.woc.*; import com.egonw.woc.exception.*; import com.egonw.woc.wml.*; import com.egonw.woc.util.*; import org.xml.sax.*; import org.xml.sax.helpers.*; public class RepositoryDefHandler extends DefaultHandler { private final int UNKNOWN = -1; private final int GENERAL = 1; private final int SPECIFIC = 2; private final int PATH = 3; private int CurrentElement; private boolean general; private String current_repository; private String wanted_repository; private String current_path_name; private String current_path; private Hashtable defs; private boolean found_repository; public RepositoryDefHandler (String repository) { this.wanted_repository = repository; this.defs = new Hashtable(); }; public boolean foundRepository() { return found_repository; } public Hashtable returnDefs() { return defs; } public void startDocument () { general = false; CurrentElement = UNKNOWN; current_repository = ""; found_repository = false; } public void endDocument () { } public void startElement (String URI, String name, String qname, Attributes atts) { setCurrentElement(name); switch (CurrentElement) { case GENERAL : general = true; break; case PATH : for (int i = 0; i < atts.getLength(); i++) { if (atts.getQName(i).equals("id")) { current_path_name = atts.getValue(i); } } break; case SPECIFIC : for (int i = 0; i < atts.getLength(); i++) { if (atts.getQName(i).equals("repository")) { current_repository = atts.getValue(i); if (current_repository.equals(wanted_repository)) { found_repository = true; } } } break; } } public void endElement(String URI, String name, String qname) { setCurrentElement(name); switch (CurrentElement) { case GENERAL : general = false; break; case PATH : if (current_repository.equals(wanted_repository) || general) { defs.put(current_path_name, current_path); // System.out.println("Added: " + current_path_name + " -> " + // current_path); } else { //System.out.println("Not added: " + current_path_name + " -> " + // current_path); } current_path_name = ""; current_path = ""; break; case SPECIFIC : current_repository = ""; break; } } public void characters (char ch[], int start, int length) { switch (CurrentElement) { case PATH : current_path = toString(ch, start, length).trim(); break; } } private void setCurrentElement(String name) { if (name.equals("general")) { CurrentElement = GENERAL; } else if (name.equals("specific")) { CurrentElement = SPECIFIC; } else if (name.equals("path")) { CurrentElement = PATH; } else { CurrentElement = UNKNOWN; }; } private String toString(char ch[], int start, int length) { StringBuffer x = new StringBuffer(); for (int i =0; i < length; i++) x.append(ch[start+i]); return x.toString(); } } --- NEW FILE: TopicExpander.java --- package com.egonw.woc.util; import java.util.Vector; import java.util.Enumeration; import com.egonw.util.*; import com.egonw.woc.*; import com.egonw.woc.files.*; import com.egonw.woc.wml.*; import com.egonw.woc.exception.*; public final class TopicExpander implements ConvertAble { private WoordTable wt; private ReportFile rf; public TopicExpander() {}; public String getName() { return "Topic Map Expander"; } public void set(WoordTable wt) { this.wt = wt; } public void set(ReportFile rf) { if (rf instanceof WocReportFile) this.rf = rf; } public WoordTable convert() { WoordTable result = new WoordTable(); if (wt != null) { try { result.add(wt); } catch (WocNotification wn) {}; Item i; XItem j; TopicMap tm; Enumeration values = wt.elements(); while ( values.hasMoreElements() ) { i = (Item)values.nextElement(); if (i.contains(XItem.XTOPICMAP)) { tm = (TopicMap)i.get(XItem.XTOPICMAP); Enumeration assocs = tm.getAssocs(); while (assocs.hasMoreElements()) { TMAssoc assoc = (TMAssoc)assocs.nextElement(); if (assoc.getName().equals("at-heeft-als-zuurrest")) { try { //System.out.println("Nieuwe zuurrest"); String zuurrest = (String)(assoc.getRLs()).nextElement(); //System.out.println(zuurrest); j = new XItem(); j.add(XItem.XFILENAME, i.get(XItem.XFILENAME)); j.add(Item.NAME, zuurrest); Vector commentlist = new Vector(); Memo m = new Memo(); m.add("Zuurrest van " + (String)i.get(Item.NAME) + "."); commentlist.addElement(m); j.add(Item.COMMENT, commentlist); Vector zie = new Vector(); zie.addElement((String)i.get(Item.NAME)); j.add(Item.ZIE, zie); try { result.add(j); } catch (WocException e) { // item is al aanwezig System.out.println("zuurrest van " +(String)i.get(Item.NAME)); } } catch (Exception e) { //System.out.println("oops... foutje"); }; } } } } } return result; } } |
From: Egon W. <eg...@us...> - 2002-06-08 20:29:07
|
Update of /cvsroot/woc/woc/source/wocjava/source/com/egonw/woc/wml In directory usw-pr-cvs1:/tmp/cvs-serv19480/wml Added Files: CMLHandler.java TMAssoc.java TopicMap.java XLANG.java XNAME.java XNODE.java Log Message: Added java source files. --- NEW FILE: CMLHandler.java --- package com.egonw.woc.wml; import java.util.*; import org.openscience.dadml.*; import com.egonw.woc.*; import com.egonw.woc.exception.*; import com.egonw.woc.wml.*; import com.egonw.woc.util.*; import org.xml.sax.*; import org.xml.sax.helpers.*; public class CMLHandler extends DefaultHandler { private final int UNKNOWN = -1; private final int ANY = -2; private final int STRING = -3; private final int FLOAT = -4; private final int MOLECULE = -5; private int CurrentElement; private String TITLE = ""; private String value = ""; XItem item; public CMLHandler () { item = new XItem(); }; public XItem updateItem (XItem i) { if (item.contains(Item.BRUTO)) i.add(Item.BRUTO, (Bruto)item.get(Item.BRUTO)); if (item.contains(Item.MASS)) i.add(Item.MASS, (String)item.get(Item.MASS)); if (item.contains(Item.BOILINGPOINT)) i.add(Item.BOILINGPOINT, (String)item.get(Item.BOILINGPOINT)); if (item.contains(Item.MELTINGPOINT)) i.add(Item.MELTINGPOINT, (String)item.get(Item.MELTINGPOINT)); if (item.contains(XItem.XFLASH)) i.add(XItem.XFLASH, (String)item.get(XItem.XFLASH)); if (item.contains(Item.RHO)) i.add(Item.RHO, (String)item.get(Item.RHO)); if (item.contains(Item.DIPOOL)) i.add(Item.DIPOOL, (String)item.get(Item.DIPOOL)); if (item.contains(XItem.XPKA)) i.add(XItem.XPKA, (String)item.get(XItem.XPKA)); if (item.contains(XItem.XPKB)) i.add(XItem.XPKB, (String)item.get(XItem.XPKB)); return i; } public void startDocument () { item = new XItem(); } public void endDocument () {} public void startElement (String name, AttributeList atts) { setCurrentElement(name); switch (CurrentElement) { case ANY : break; case FLOAT : for (int i = 0; i < atts.getLength(); i++) { if (atts.getName(i).equals("title")) TITLE = atts.getValue(i); } break; case STRING : for (int i = 0; i < atts.getLength(); i++) { if (atts.getName(i).equals("title")) TITLE = atts.getValue(i); } break; } } public void endElement (String name) { setCurrentElement(name); switch (CurrentElement) { case ANY : break; case STRING : if (TITLE.equals("Stoichiometry")) { item.add(Item.BRUTO, new Bruto(value)); } TITLE = ""; break; case FLOAT : if (TITLE.equals("Density")) { item.add(Item.DIPOOL, value); } else if (TITLE.equals("MeltingPoint")) { item.add(Item.MELTINGPOINT, value); } else if (TITLE.equals("BoilingPoint")) { item.add(Item.BOILINGPOINT, value); } else if (TITLE.equals("FlashPoint")) { item.add(XItem.XFLASH, value); } else if (TITLE.equals("Density")) { item.add(Item.RHO, value); } else if (TITLE.equals("pKa")) { item.add(XItem.XPKA, value); } else if (TITLE.equals("pKb")) { item.add(XItem.XPKB, value); } TITLE = ""; break; } } public void characters (char ch[], int start, int length) { switch (CurrentElement) { case ANY : break; case FLOAT : if (TITLE.length() > 0) value = toString(ch, start, length).trim(); break; case STRING : if (TITLE.length() > 0) value = toString(ch, start, length).trim(); break; } } private void setCurrentElement(String name) { if (name.equals("molecule")) { CurrentElement = MOLECULE; } else if (name.equals("float")) { CurrentElement = FLOAT; } else if (name.equals("string")) { CurrentElement = STRING; } else { CurrentElement = UNKNOWN; }; } private String toString(char ch[], int start, int length) { StringBuffer x = new StringBuffer(); for (int i =0; i < length; i++) x.append(ch[start+i]); return x.toString(); } } --- NEW FILE: TMAssoc.java --- package com.egonw.woc.wml; import java.util.*; public class TMAssoc { private Vector rls; private String name; public TMAssoc () { rls = new Vector(2,1); } public void setName(String name) { this.name = name; } public String getName() { return this.name; } public void addRL(String rl) { rls.addElement(rl); } public Enumeration getRLs() { return rls.elements(); } } --- NEW FILE: TopicMap.java --- package com.egonw.woc.wml; import java.util.*; public class TopicMap { private Vector assocs; private String currentAssoc; public TopicMap () { assocs = new Vector(3,1); } public void addAssocRL(TMAssoc assoc) { assocs.addElement(assoc); } public Enumeration getAssocs() { return assocs.elements(); } } --- NEW FILE: XLANG.java --- package com.egonw.woc.wml; import java.util.*; public class XLANG { private String id; private String lw; private String value; public XLANG() { id = ""; value = ""; } public String getID() { return this.id; } public void setID(String c) { this.id = c; } public String getLIDWOORD() { return this.lw; } public void setLIDWOORD(String c) { this.lw = c; } public String getValue() { return this.value; } public void setValue(String s) { this.value = s; } } --- NEW FILE: XNAME.java --- package com.egonw.woc.wml; import java.util.*; public class XNAME { private String klasse; private Vector langs; public XNAME() { klasse = ""; langs = new Vector(); } public String getCLASS() { return this.klasse; } public void setCLASS(String c) { this.klasse = c; } public void addLANG(XLANG l) { langs.addElement(l); } public Enumeration elements() { return langs.elements(); } public String getName(String lang) { String r = ""; Enumeration names = elements(); while (names.hasMoreElements()) { XLANG l = (XLANG)(names.nextElement()); if (l.getID().equals(lang)) { r = l.getValue(); } } return r; } } --- NEW FILE: XNODE.java --- package com.egonw.woc.wml; import java.util.*; public class XNODE { private String cdata; private Hashtable atts; public XNODE() { cdata = ""; atts = new Hashtable(); } public boolean containsATT(String s) { return atts.containsKey(s); } public String getATT(String s) { return (String)atts.get(s); } public void setATT(String s, String t) { atts.put(s,t); } public void setCDATA(String s) { cdata = s; } public String getCDATA() { return cdata; } public String toString() { return "XNODE(" + cdata + "): " + atts.toString(); } } |
From: Egon W. <eg...@us...> - 2002-06-08 20:29:07
|
Update of /cvsroot/woc/woc/source/wocjava/source/com/egonw/woc In directory usw-pr-cvs1:/tmp/cvs-serv19480 Added Files: Bruto.java FWord.java Formule.java Item.java Picture.java Raw.java Smile.java StoichFormule.java WocEngine.java WoordTable.java XItem.java XTYPE.java Log Message: Added java source files. --- NEW FILE: Bruto.java --- package com.egonw.woc; import java.lang.Character; public class Bruto extends Formule { public Bruto(String s) { super(s); } public String toString() { return super.value(); } public String toHTMLString() { StringBuffer resultaat = new StringBuffer(); boolean PrevCharIsDigit = false; //waarde moet geconverteerd worden for (int i=0; i < super.value().length(); i++) { Character c = new Character(super.value().charAt(i)); if (c.isLetter(c.charValue())) { if (PrevCharIsDigit) { resultaat.append("</font></sub>"); }; resultaat.append(c.charValue()); PrevCharIsDigit = false; }; if (c.isDigit(c.charValue())) { if (!PrevCharIsDigit) { resultaat.append("<sub><font size=-1>"); }; resultaat.append(c.charValue()); PrevCharIsDigit = true; }; if (c.charValue() == ')' || c.charValue() == '(') { if (PrevCharIsDigit) { resultaat.append("</font></sub>"); }; resultaat.append(c.charValue()); if (PrevCharIsDigit) { resultaat.append("<sub><font size=-1>"); }; } }; if (PrevCharIsDigit) { resultaat.append("</font></sub>"); }; return resultaat.toString(); } } --- NEW FILE: FWord.java --- package com.egonw.woc; import com.objectspace.jgl.*; import com.egonw.woc.util.*; public class FWord { private String lang; private String fword; private String dword; private String anchor; public FWord(String lang) { this.lang = lang; this.fword = new String(); this.dword = new String(); this.anchor = new String(); } public void setFWord(String s) { this.fword = s; } public void setDWord(String s) { this.dword = s; } public void setAnchor(String s) { this.anchor = s; } public String getFWord() { return this.fword; } public String getDWord() { return this.dword; } public String getAnchor() { return this.anchor; } public boolean equals(String s) { return fword.equals(s); } public int hashCode() { return (this.fword).hashCode(); } public String toString() { return this.fword; } } --- NEW FILE: Formule.java --- package com.egonw.woc; public class Formule { private String value; protected Formule() { value = new String(); } protected Formule(String s) { value = new String(s); } public final boolean isEmpty() { return (value.length() == 0); } public final String value() { return value; } } --- NEW FILE: Item.java --- package com.egonw.woc; import com.objectspace.jgl.*; import com.egonw.woc.util.*; /** * Class that defines a item and specifies the field information * for the Woc-file format. * * @author Egon Willighagen * @version 2.0, 1/7/98 */ public class Item { private Object data[]; private boolean isEmpty; public final static int ITEM = 0; public final static int ANCHOR = 1; public final static int NAME = 2; public final static int GROUP = 3; public final static int TRIVIALNAME = 4; public final static int EIGENNAME = 5; public final static int SUBITEM = 6; public final static int PICTUREFILE = 7; public final static int XYZFILE = 8; public final static int ENGLISH = 9; public final static int COMMENT = 10; public final static int FORMULA = 11; public final static int MASS = 12; public final static int BOILINGPOINT = 13; public final static int MELTINGPOINT = 14; public final static int ZIE = 15; public final static int VERGELIJK = 16; public final static int IUPACNAME = 17; public final static int MSDS = 18; public final static int SMILE = 19; public final static int LEVEN = 20; public final static int BRUTO = 21; public final static int DIPOOL = 22; public final static int CASNR = 23; public final static int RHO = 24; public final static int PDB = 25; public final static int REACTIE = 26; public final static int URL = 27; public final static int BRON = 28; public final static int MOL = 29; public final static int LIDWOORD = 30; public final static int VERVOEGINGEN = 31; public final static int FUNCTIE = 32; public final static int CHEMICAL = 33; public final static int VOORBEELD = 34; public final static int AFKORT = 35; public final static int PICTUREDIR = 36; public final static int NUMBER = 37; public final static int NUMBER_OF_TYPES = 38; public Item() { data = new Object[NUMBER_OF_TYPES]; for (int i=0; i<NUMBER_OF_TYPES; i++) { data[i] = null; } isEmpty = true; } public boolean isEmpty() { boolean rv = true; for (int i=0; i<NUMBER_OF_TYPES; i++) { if (data[i] != null) { rv = false; } } return rv; } public void add(int code, Object o) { isEmpty = false; if (code == ANCHOR) { } else if (code >= NUMBER_OF_TYPES) { } else { data[code] = o; } } public void remove(int code) { data[code] = null; } public Object get(int code) { if (code == ANCHOR) { return (Object)Convert.NAMELikeToANCHORLike((String)get(Item.NAME)); } else if (code >= NUMBER_OF_TYPES) { return null; } else { return data[code]; } } public boolean contains(int code) { if (code == ANCHOR) { return true; } else if (code >= NUMBER_OF_TYPES) { return false; } else { return (data[code] != null); } } public boolean equals(Item i) { return (((String)get(ANCHOR)).equals(i.get(ANCHOR))); } public int hashCode() { if (contains(NAME)) { return (int)get(NAME).hashCode(); } else { return 0; } } public String toString() { return Convert.NAMELikeToANCHORLike((String)get(NAME)); } public boolean result(UnaryPredicate up) { return up.execute(this); } } --- NEW FILE: Picture.java --- package com.egonw.woc; import com.egonw.woc.util.*; public class Picture { private String onderschrift; private String path; public Picture() { path = new String(); onderschrift = new String(); } public Picture(String dir) { path = dir; onderschrift = ""; } public Picture(String dir, String subtitle) { path = dir; onderschrift = subtitle; } public String path() { return path; } public String subtitle() { return onderschrift; } public boolean hasSubtitle() { return (onderschrift.length() != 0); } public void finalize() throws Throwable { super.finalize(); } } --- NEW FILE: Raw.java --- package com.egonw.woc; import java.lang.Character; public class Raw extends Formule { public Raw() { super(); } public Raw(String s) { super(s); } public String toString() { return super.value(); } public String toHTMLString() { StringBuffer resultaat = new StringBuffer(); if (bevatHTMLCode()) { //is al in HTML-formaat of bevat (veel) fouten return super.value(); } else { //waarde moet geconverteerd worden for (int i=0; i < super.value().length(); i++) { Character c = new Character(super.value().charAt(i)); if (c.isLetter(c.charValue())) { resultaat.append(c.charValue()); }; if (c.isDigit(c.charValue())) { resultaat.append("<sub>"); resultaat.append(c.charValue()); resultaat.append("</sub>"); }; if ((c.charValue() == '+') || (c.charValue() == '-')) { resultaat.append("<sup>"); resultaat.append(c.charValue()); resultaat.append("</sup>"); } if ((c.charValue() == '(') || (c.charValue() == ']') ) { resultaat.append(c.charValue()); } // else: er zit een fout teken in de Smile // deze routine zou dan een fout moeten geven! }; } return resultaat.toString(); } private boolean bevatHTMLCode() { return (super.value().indexOf("<sub>") != -1); } } --- NEW FILE: Smile.java --- package com.egonw.woc; import java.lang.*; public class Smile extends Formule { public Smile() { super(); } public Smile(String s) { super(s); } private String toHexString() { StringBuffer resultaat = new StringBuffer(); for (int i=0; i< super.value().length(); i++) { resultaat.append(Integer.toHexString((int)super.value().charAt(i))); } return resultaat.toString(); } public String toHTMLString() { StringBuffer resultaat = new StringBuffer(); resultaat.append("<IMG HEIGHT=64 WIDTH=96 ALIGN=MIDDLE SRC='http://www.ch.ic.ac.uk/daycgi/smi2gif-small?" + toHexString() + "'>"); return resultaat.toString(); } public String toString() { return super.value(); } } --- NEW FILE: StoichFormule.java --- package com.egonw.woc; import java.lang.Character; public class StoichFormule extends Formule { public StoichFormule(String s) { super(s); } public String toString() { return super.value(); } public String toHTMLString() { StringBuffer resultaat = new StringBuffer(); boolean PrevCharIsDigit = false; //waarde moet geconverteerd worden for (int i=0; i < super.value().length(); i++) { Character c = new Character(super.value().charAt(i)); if (c.isLetter(c.charValue())) { if ((c.charValue() != 'n') && (c.charValue() != 'm')) { if (PrevCharIsDigit) { resultaat.append("</font></sub>"); }; resultaat.append(c.charValue()); PrevCharIsDigit = false; } else { if (!PrevCharIsDigit) { resultaat.append("<sub><font size=-1>"); PrevCharIsDigit = true; }; resultaat.append(c.charValue()); } } else if (c.isDigit(c.charValue())) { if (!PrevCharIsDigit) { resultaat.append("<sub><font size=-1>"); }; resultaat.append(c.charValue()); PrevCharIsDigit = true; } else if ((c.charValue() == '+') || (c.charValue() == '-')) { resultaat.append(c.charValue()); PrevCharIsDigit = true; } }; if (PrevCharIsDigit) { resultaat.append("</font></sub>"); }; return resultaat.toString(); } } --- NEW FILE: WocEngine.java --- package com.egonw.woc; import com.objectspace.jgl.*; import com.objectspace.jgl.algorithms.*; import java.util.*; import java.io.*; import com.egonw.woc.*; import com.egonw.woc.files.*; import com.egonw.woc.util.*; import com.egonw.woc.predicate.*; import com.egonw.woc.exception.*; public class WocEngine { private WocReportFile wrf; private WoordTable wt; private FileReadAble wocrf; private FileWriteAble wocwf; private UnaryPredicate up; private BinaryPredicate sorter; private ConvertAble ca; private Path repository; public WocEngine(Path repository) { this.repository = repository; wrf = null; wt = null; wocrf = null; up = null; } public Enumeration getWTElements() { return wt.elements(); } public WoordTable getWT() { return wt; } public void setWocReportFile(WocReportFile wrf) { this.wrf = wrf; } public void setReadFile(FileReadAble wocrf) { this.wocrf = wocrf; } public void setWriteFile(FileWriteAble wocwf) { this.wocwf = wocwf; } public void setWoordTable(WoordTable wt) { this.wt = wt; } public void setFilterPredicate(UnaryPredicate up) { this.up = up; } public void setConvertAble(ConvertAble ca) { this.ca = ca; } public void setSortingPredicate(BinaryPredicate sorter) { this.sorter = sorter; } public void sort() { try { if (wt == null) { if (wrf != null) wrf.reportText("WocEngine: No WoordTable set."); } else if (sorter == null) { if (wrf != null) wrf.reportText("WocEngine: No SortingPredicate set."); } else { WoordTable sorted = new WoordTable( sorter ); if (wrf != null) wrf.addHeader("Sorting WoordTable: " + sorter); sorted.add(wt); wt = sorted; } } catch (WocException e) { if (e instanceof WocFatalError) { if (wrf != null) wrf.reportWocFatalError((WocFatalError)e); } else if (e instanceof WocNotification) { if (wrf != null) wrf.reportWocNotification((WocNotification)e); }; } catch (Exception e) { if (wrf != null) { if (e instanceof NullPointerException) { wrf.reportException(e); wrf.reportText("Possibly predicate does not sort null!!"); } else { wrf.reportException(e); } } } } public void read() { if (wt == null) { if (wrf != null) wrf.reportText("WocEngine: No WoordTable set."); } else if (wocrf == null) { if (wrf != null) wrf.reportText("WocEngine: No WocReadFile set."); } else { if (wrf != null) wrf.addHeader("Reading Items"); try { if (wocrf instanceof WocListReadFile) { wt = ((WocListReadFile)wocrf).read(); } else { Item item = wocrf.readItem(); while (!item.isEmpty()) { if (up == null) { wt.add(item); } else { if (up.execute(item)) wt.add(item); } item = wocrf.readItem(); }; }; } catch (WocException e) { if (e instanceof WocFatalError) { if (wrf != null) wrf.reportWocFatalError((WocFatalError)e); } else if (e instanceof WocNotification) { if (wrf != null) wrf.reportWocNotification((WocNotification)e); } else { System.out.println(e); } }; } } public void write() { try { if (wt == null) { if (wrf != null) wrf.reportText("WocEngine: No WoordTable set."); } else if (wocwf == null) { if (wrf != null) wrf.reportText("WocEngine: No WocWriteFile set."); } else { if (wrf != null) { wrf.addHeader("Writing Items"); if (up !=null) wrf.addHeader(((Object)up).toString()); } wocwf.start(); Enumeration values = wt.elements(); boolean first = true; Item last = null; while (values.hasMoreElements()) { Item i = (Item)values.nextElement(); if (up == null) { if (first) { wocwf.startItems(i); first = false; } wocwf.writeItem(i); last = i; } else { // mag hij door filter? if (up.execute(i)) { if (first) { wocwf.startItems(i); first = false; } wocwf.writeItem(i); last = i; } } } if (last != null) wocwf.endItems(last); wocwf.end(); } } catch (IOException e) { if (wrf != null) wrf.addHeader("Write Error"); } } public void convert() { if (wt == null) { if (wrf != null) wrf.reportText("WocEngine: No WoordTable set."); } else if (ca == null) { if (wrf != null) wrf.reportText("WocEngine: No ConvertAble set."); } else { if (wrf != null) { wrf.addHeader("Converting Items : " + ca.getName()); wrf.reportText(wt.size() + " items"); ca.set(wrf); } ca.set(wt); wt = ca.convert(); if (wrf != null) wrf.reportText(wt.size() + " items"); }; }; }; --- NEW FILE: WoordTable.java --- package com.egonw.woc; import com.objectspace.jgl.*; import com.objectspace.jgl.predicates.*; import com.objectspace.jgl.algorithms.*; import java.util.*; import java.io.Serializable; import com.egonw.woc.files.*; import com.egonw.woc.util.*; import com.egonw.woc.exception.*; import com.egonw.woc.predicate.*; public class WoordTable extends OrderedSet { public WoordTable() { this( new LessWocWord() ); } public WoordTable(Item i) { super( new LessWocWord() ); super.add(i); } public WoordTable(BinaryPredicate bp) { super( bp ); } public SList toSList() { SList s = new SList(); Item i; Enumeration values = super.elements(); while ( values.hasMoreElements() ) { i = (Item)values.nextElement(); s.add(i); } return s; } public void add(WoordTable wt) throws WocNotification { Item i; Enumeration values = wt.elements(); while ( values.hasMoreElements() ) { i = (Item)values.nextElement(); add(i); } } public void add(Container c) throws WocNotification { Item i; Enumeration values = c.elements(); while ( values.hasMoreElements() ) { i = (Item)values.nextElement(); add(i); } } public WoordTable merge(WoordTable wt) throws WocNotification { WoordTable tabel = new WoordTable(); Enumeration values = super.elements(); Item i; while ( values.hasMoreElements() ) { i = (Item)values.nextElement(); tabel.add(i); } values = wt.elements(); while ( values.hasMoreElements() ) { i = (Item)values.nextElement(); tabel.add(i); } return tabel; } public void add(Item i) throws WocNotification { if (i == null) { throw new EmptyItemNotification(i); } else if (!i.contains(Item.NAME)) { throw new IncompleteItemNotification(i); } else { UnaryPredicate predicate = new BindSecondPredicate( new HasItem(), (String)i.get(Item.NAME) ); Item value = (Item)Finding.detect(this, predicate); if (value != null) { // samenvoegen ? // bv. als tweede een groep is if (i.contains(XItem.XGROUP)) { // als de laatste een groep is value.add(XItem.XGROUP, new String()); } else if (i.contains(Item.COMMENT)) { Vector commentlist = (Vector)i.get(Item.COMMENT); if (value.contains(Item.COMMENT)) { Vector commentlist2 = (Vector)value.get(Item.COMMENT); Enumeration enum = commentlist.elements(); while (enum.hasMoreElements()) { commentlist2.addElement( (Memo)enum.nextElement() ); } value.add(Item.COMMENT, commentlist2); } else { value.add(Item.COMMENT, commentlist); } // zie lijst ook copieren... vanwege afkortingen... try { Vector zielist = (Vector)i.get(Item.ZIE); if (value.contains(Item.ZIE)) { Vector zielist2 = (Vector)value.get(Item.ZIE); Enumeration enum = zielist.elements(); while (enum.hasMoreElements()) { zielist2.addElement((String)enum.nextElement() ); } value.add(Item.ZIE, zielist2); } else { value.add(Item.ZIE, zielist); } } catch (Exception e) { System.err.println(e.toString()); e.printStackTrace(); } } else { // als er geen group bijzit throw new DuplicateItemNotification(i); } } else { super.add(i); } } } } --- NEW FILE: XItem.java --- package com.egonw.woc; import java.util.*; import com.objectspace.jgl.*; import com.egonw.woc.util.*; import com.egonw.woc.wml.*; public class XItem extends Item { private Object data[]; public final static int XNAME = 100; public final static int XMEDIA = 101; public final static int XINSERTS = 102; public final static int XREACTIE = 103; public final static int XFORMULA = 104; public final static int XGERMAN = 105; public final static int XAFKORT = 106; public final static int XGROUP = 107; public final static int XTYPE = 108; public final static int WOCNR = 109; public final static int XUNNR = 110; public final static int XENR = 111; public final static int XTOPICMAP = 112; public final static int XLATIN = 113; public final static int XNSC = 114; public final static int XFLASH = 115; public final static int XSEEONLY = 116; public final static int XMEERVOUD = 117; public final static int XPKA = 118; public final static int XPKB = 119; public final static int XFILENAME = 120; public final static int XCODE = 120; // thus degenerate with XFILENAME public final static int XDISCDATE = 121; public final static int XDISCPLACE = 122; public final static int XDISCPERSON = 123; public final static int XFRENCH = 124; public final static int XSPANISH = 125; public final static int XITALIAN = 126; public final static int XFRYSIAN = 127; public final static int NUMBER_OF_TYPES = 28; public XItem() { super(); this.data = new Object[NUMBER_OF_TYPES]; for (int i=0; i < NUMBER_OF_TYPES; i++) { this.data[i] = null; } } public boolean isEmpty() { boolean rv = true; for (int i=0; i < NUMBER_OF_TYPES; i++) { if (this.data[i] != null) { rv = false; } } return super.isEmpty() && rv; } public void add(int code, Object o) { if (code >= 100) { this.data[code-100] = o; } else { super.add(code, o); } } public void remove(int code) { if (code >= 100) { this.data[code-100] = null; } else { super.remove(code); } } public Object get(int code) { Object o = null; if (code >= 100) { switch (code) { case XItem.XITALIAN : if (contains(XItem.XNAME)) { Vector names = (Vector)get(XItem.XNAME); Enumeration e = names.elements(); StringBuffer sb = new StringBuffer(); while (e.hasMoreElements()) { XNAME xname = (XNAME)e.nextElement(); Enumeration langs = xname.elements(); while (langs.hasMoreElements()) { XLANG xl = (XLANG)langs.nextElement(); if (xl.getID().equals("IT")) sb.append(xl.getValue() + ", "); } } o = sb.toString().substring(0, sb.length() - 2); } break; case XItem.XFRYSIAN : if (contains(XItem.XNAME)) { Vector names = (Vector)get(XItem.XNAME); Enumeration e = names.elements(); StringBuffer sb = new StringBuffer(); while (e.hasMoreElements()) { XNAME xname = (XNAME)e.nextElement(); Enumeration langs = xname.elements(); while (langs.hasMoreElements()) { XLANG xl = (XLANG)langs.nextElement(); if (xl.getID().equals("FY")) sb.append(xl.getValue() + ", "); } } o = sb.toString().substring(0, sb.length() - 2); } break; case XItem.XFRENCH : if (contains(XItem.XNAME)) { Vector names = (Vector)get(XItem.XNAME); Enumeration e = names.elements(); StringBuffer sb = new StringBuffer(); while (e.hasMoreElements()) { XNAME xname = (XNAME)e.nextElement(); Enumeration langs = xname.elements(); while (langs.hasMoreElements()) { XLANG xl = (XLANG)langs.nextElement(); if (xl.getID().equals("FR")) sb.append(xl.getValue() + ", "); } } o = sb.toString().substring(0, sb.length() - 2); } break; case XItem.XSPANISH : if (contains(XItem.XNAME)) { Vector names = (Vector)get(XItem.XNAME); Enumeration e = names.elements(); StringBuffer sb = new StringBuffer(); while (e.hasMoreElements()) { XNAME xname = (XNAME)e.nextElement(); Enumeration langs = xname.elements(); while (langs.hasMoreElements()) { XLANG xl = (XLANG)langs.nextElement(); if (xl.getID().equals("SP")) sb.append(xl.getValue() + ", "); } } o = sb.toString().substring(0, sb.length() - 2); } break; case XItem.XGERMAN : if (contains(XItem.XNAME)) { Vector names = (Vector)get(XItem.XNAME); Enumeration e = names.elements(); StringBuffer sb = new StringBuffer(); while (e.hasMoreElements()) { XNAME xname = (XNAME)e.nextElement(); Enumeration langs = xname.elements(); while (langs.hasMoreElements()) { XLANG xl = (XLANG)langs.nextElement(); if (xl.getID().equals("DE")) sb.append(xl.getValue() + ", "); } } o = sb.toString().substring(0, sb.length() - 2); } break; case XItem.XLATIN : if (contains(XItem.XNAME)) { Vector names = (Vector)get(XItem.XNAME); Enumeration e = names.elements(); StringBuffer sb = new StringBuffer(); while (e.hasMoreElements()) { XNAME xname = (XNAME)e.nextElement(); Enumeration langs = xname.elements(); while (langs.hasMoreElements()) { XLANG xl = (XLANG)langs.nextElement(); if (xl.getID().equals("LATIN")) sb.append(xl.getValue() + ", "); } } o = sb.toString().substring(0, sb.length() - 2); } break; default: o = this.data[code-100]; break; } } else { switch (code) { case Item.ENGLISH : if (contains(XItem.XNAME)) { Vector names = (Vector)get(XItem.XNAME); Enumeration e = names.elements(); StringBuffer sb = new StringBuffer(); while (e.hasMoreElements()) { XNAME xname = (XNAME)e.nextElement(); Enumeration langs = xname.elements(); while (langs.hasMoreElements()) { XLANG xl = (XLANG)langs.nextElement(); if (xl.getID().equals("EN")) sb.append(xl.getValue() + ", "); } } o = sb.toString().substring(0, sb.length() - 2); } break; case Item.IUPACNAME : if (contains(XItem.XNAME)) { Vector names = (Vector)get(XItem.XNAME); Enumeration e = names.elements(); while (e.hasMoreElements()) { XNAME xname = (XNAME)e.nextElement(); if (xname.getCLASS().equals("IUPAC")) { Enumeration langs = xname.elements(); while (langs.hasMoreElements()) { XLANG xl = (XLANG)langs.nextElement(); if (xl.getID().equals("NL")) o = xl.getValue(); } } } } break; case Item.AFKORT : if (contains(XItem.XNAME)) { Vector names = (Vector)get(XItem.XNAME); Enumeration e = names.elements(); while (e.hasMoreElements()) { XNAME xname = (XNAME)e.nextElement(); if (xname.getCLASS().equals("ABBREV")) { Enumeration langs = xname.elements(); while (langs.hasMoreElements()) { XLANG xl = (XLANG)langs.nextElement(); if (xl.getID().equals("NL")) o = xl.getValue(); } } } } else if (super.contains(Item.AFKORT)) { o = super.get(Item.AFKORT); } break; case Item.TRIVIALNAME : Vector b = new Vector(); if (contains(XItem.XNAME)) { Vector names = (Vector)get(XItem.XNAME); Enumeration e = names.elements(); while (e.hasMoreElements()) { XNAME xname = (XNAME)e.nextElement(); if (xname.getCLASS().equals("TRIVIAL")) { Enumeration langs = xname.elements(); while (langs.hasMoreElements()) { XLANG xl = (XLANG)langs.nextElement(); if (xl.getID().equals("NL") && !xl.getValue().equals(get(Item.NAME))) b.addElement( xl.getValue() ); } } } } o = b; break; case Item.PDB : String s = ""; if (contains(XItem.XMEDIA)) { Vector v = (Vector)get(XItem.XMEDIA); Enumeration e = v.elements(); while (e.hasMoreElements()) { XNODE x = (XNODE)e.nextElement(); if (x.containsATT("MIME")) { if (x.getATT("MIME").equals("chemical/x-pdb")) s = x.getCDATA(); } } o = s; }; break; case Item.MOL : s = ""; if (contains(XItem.XMEDIA)) { Vector v = (Vector)get(XItem.XMEDIA); Enumeration e = v.elements(); while (e.hasMoreElements()) { XNODE x = (XNODE)e.nextElement(); if (x.containsATT("MIME")) { if (x.getATT("MIME").equals("chemical/x-mdl-molfile")) s = x.getCDATA(); } } o = s; }; break; case Item.PICTUREFILE : Picture p = new Picture(); if (contains(XItem.XMEDIA)) { Vector v = (Vector)get(XItem.XMEDIA); Enumeration e = v.elements(); while (e.hasMoreElements()) { XNODE x = (XNODE)e.nextElement(); if (x.containsATT("MIME")) { if (x.getATT("MIME").equals("image/gif") && (!x.containsATT("VIEW") || !x.getATT("VIEW").equals("TOP") ) ) { String file = x.getCDATA().trim(); if (x.containsATT("TITLE")) { p = new Picture(file, x.getATT("TITLE")); } else { p = new Picture(file); } } } } o = p; }; break; case Item.REACTIE : s = ""; if (contains(XItem.XMEDIA)) { Vector v = (Vector)get(XItem.XMEDIA); Enumeration e = v.elements(); while (e.hasMoreElements()) { XNODE x = (XNODE)e.nextElement(); if (x.containsATT("MIME") && x.containsATT("VIEW")) { if (x.getATT("MIME").equals("image/gif") && x.getATT("VIEW").equals("TOP")) { s = x.getCDATA().trim(); } } } o = s; }; break; default : o = super.get(code); break; } } return o; } public boolean contains(int code) { boolean b = false; if (code >= 100) { switch (code) { case XItem.XGERMAN : if (contains(XItem.XNAME)) { Vector names = (Vector)get(XItem.XNAME); Enumeration e = names.elements(); while (e.hasMoreElements()) { XNAME xname = (XNAME)e.nextElement(); Enumeration langs = xname.elements(); while (langs.hasMoreElements()) { XLANG xl = (XLANG)langs.nextElement(); if (xl.getID().equals("DE")) b = true; } } } break; case XItem.XLATIN : if (contains(XItem.XNAME)) { Vector names = (Vector)get(XItem.XNAME); Enumeration e = names.elements(); while (e.hasMoreElements()) { XNAME xname = (XNAME)e.nextElement(); Enumeration langs = xname.elements(); while (langs.hasMoreElements()) { XLANG xl = (XLANG)langs.nextElement(); if (xl.getID().equals("LATIN")) b = true; } } } break; default: b = (this.data[code-100] != null); break; } } else { switch (code) { case Item.ENGLISH : if (contains(XItem.XNAME)) { Vector names = (Vector)get(XItem.XNAME); Enumeration e = names.elements(); while (e.hasMoreElements()) { XNAME xname = (XNAME)e.nextElement(); Enumeration langs = xname.elements(); while (langs.hasMoreElements()) { XLANG xl = (XLANG)langs.nextElement(); if (xl.getID().equals("EN")) b = true; } } } break; case Item.TRIVIALNAME : if (contains(XItem.XNAME)) { Vector names = (Vector)get(XItem.XNAME); Enumeration e = names.elements(); while (e.hasMoreElements()) { XNAME xname = (XNAME)e.nextElement(); if (xname.getCLASS().equals("TRIVIAL")) { Enumeration langs = xname.elements(); while (langs.hasMoreElements()) { XLANG xl = (XLANG)langs.nextElement(); if (xl.getID().equals("NL") && !xl.getValue().equals(get(Item.NAME))) b = true; } } } } break; case Item.IUPACNAME : if (contains(XItem.XNAME)) { Vector names = (Vector)get(XItem.XNAME); Enumeration e = names.elements(); while (e.hasMoreElements()) { XNAME xname = (XNAME)e.nextElement(); if (xname.getCLASS().equals("IUPAC")) { Enumeration langs = xname.elements(); while (langs.hasMoreElements()) { XLANG xl = (XLANG)langs.nextElement(); if (xl.getID().equals("NL")) b = true; } } } } break; case Item.AFKORT : if (contains(XItem.XNAME)) { Vector names = (Vector)get(XItem.XNAME); Enumeration e = names.elements(); while (e.hasMoreElements()) { XNAME xname = (XNAME)e.nextElement(); if (xname.getCLASS().equals("ABBREV")) { Enumeration langs = xname.elements(); while (langs.hasMoreElements()) { XLANG xl = (XLANG)langs.nextElement(); if (xl.getID().equals("NL")) b = true; } } } } else { b = super.contains(Item.AFKORT); } break; case Item.PDB : if (contains(XItem.XMEDIA)) { Vector v = (Vector)get(XItem.XMEDIA); Enumeration e = v.elements(); while (e.hasMoreElements()) { XNODE x = (XNODE)e.nextElement(); if (x.containsATT("MIME")) { if (x.getATT("MIME").equals("chemical/x-pdb")) b = true; } } } break; case Item.MOL : if (contains(XItem.XMEDIA)) { Vector v = (Vector)get(XItem.XMEDIA); Enumeration e = v.elements(); while (e.hasMoreElements()) { XNODE x = (XNODE)e.nextElement(); if (x.containsATT("MIME")) { if (x.getATT("MIME").equals("chemical/x-mdl-molfile")) b = true; } } } break; case Item.PICTUREFILE : if (contains(XItem.XMEDIA)) { Vector v = (Vector)get(XItem.XMEDIA); Enumeration e = v.elements(); while (e.hasMoreElements()) { XNODE x = (XNODE)e.nextElement(); if (x.containsATT("MIME")) { if (x.getATT("MIME").equals("image/gif") && (!x.containsATT("VIEW") || !x.getATT("VIEW").equals("TOP") ) ) b = true; } } }; break; case Item.REACTIE : if (contains(XItem.XMEDIA)) { Vector v = (Vector)get(XItem.XMEDIA); Enumeration e = v.elements(); while (e.hasMoreElements()) { XNODE x = (XNODE)e.nextElement(); if (x.containsATT("MIME") && x.containsATT("VIEW")) { if (x.getATT("MIME").equals("image/gif") && x.getATT("VIEW").equals("TOP")) { b = true; } } } }; break; default : b = super.contains(code); break; } } return b; } } --- NEW FILE: XTYPE.java --- package com.egonw.woc; import java.util.*; import com.objectspace.jgl.*; import com.egonw.woc.util.*; import com.egonw.woc.wml.*; public class XTYPE { public final static int CHEMICAL = 1; public final static int ABBREV = 2; public final static int VERW = 4; public final static int REACTION = 8; public final static int IUPAC_RULE = 16; public final static int POLYMER = 32; public final static int MIXTURE = 64; public final static int GROUP = 128; private final static int TOTAL_TYPES = 3; private int value; public XTYPE() { value = 0; } public void setType(int type) { if (!isType(type)) { value += type; } } public boolean isType(int type) { boolean result = false; int foo = value; for (int i = TOTAL_TYPES ; i > 0; i--) { if (((foo - power(2,i-1)) >= 0)) { if ( power(2,i-1) == type ) result = true; foo -= power(2,i-1); } } return result; } private int power(int number, int power) { int result = 1; for (int i=1; i<=power; i++) { result = result * number; } return result; } } |
From: Egon W. <eg...@us...> - 2002-06-08 20:26:43
|
Update of /cvsroot/woc/woc/source/wocjava/source/com/egonw/woc/wml In directory usw-pr-cvs1:/tmp/cvs-serv19004/wml Log Message: Directory /cvsroot/woc/woc/source/wocjava/source/com/egonw/woc/wml added to the repository |
From: Egon W. <eg...@us...> - 2002-06-08 20:26:43
|
Update of /cvsroot/woc/woc/source/wocjava/source/com/egonw/woc/predicate In directory usw-pr-cvs1:/tmp/cvs-serv19004/predicate Log Message: Directory /cvsroot/woc/woc/source/wocjava/source/com/egonw/woc/predicate added to the repository |
From: Egon W. <eg...@us...> - 2002-06-08 20:26:43
|
Update of /cvsroot/woc/woc/source/wocjava/source/com/egonw/woc/util In directory usw-pr-cvs1:/tmp/cvs-serv19004/util Log Message: Directory /cvsroot/woc/woc/source/wocjava/source/com/egonw/woc/util added to the repository |
From: Egon W. <eg...@us...> - 2002-06-08 20:26:42
|
Update of /cvsroot/woc/woc/source/wocjava/source/com/egonw/woc/exception In directory usw-pr-cvs1:/tmp/cvs-serv19004/exception Log Message: Directory /cvsroot/woc/woc/source/wocjava/source/com/egonw/woc/exception added to the repository |
From: Egon W. <eg...@us...> - 2002-06-08 20:26:42
|
Update of /cvsroot/woc/woc/source/wocjava/source/com/egonw/woc/tools In directory usw-pr-cvs1:/tmp/cvs-serv19004/tools Log Message: Directory /cvsroot/woc/woc/source/wocjava/source/com/egonw/woc/tools added to the repository |
From: Egon W. <eg...@us...> - 2002-06-08 20:26:42
|
Update of /cvsroot/woc/woc/source/wocjava/source/com/egonw/woc/files In directory usw-pr-cvs1:/tmp/cvs-serv19004/files Log Message: Directory /cvsroot/woc/woc/source/wocjava/source/com/egonw/woc/files added to the repository |
From: Egon W. <eg...@us...> - 2002-06-08 20:13:06
|
Update of /cvsroot/woc/woc/lib/java In directory usw-pr-cvs1:/tmp/cvs-serv16419/java Log Message: Directory /cvsroot/woc/woc/lib/java added to the repository |
From: Egon W. <eg...@us...> - 2002-06-08 20:12:44
|
Update of /cvsroot/woc/woc/source/wocjava In directory usw-pr-cvs1:/tmp/cvs-serv16294 Added Files: .cvsignore Changelog Makefile repository_def.xml woclist.pl woclist.sh Log Message: Adding java source code for generating website. --- NEW FILE: .cvsignore --- woclist.xml --- NEW FILE: Changelog --- 2002-02-12 ---------- * spaanse, italiaanse, franse en friese vertalingen worden nu ook gegeven --- NEW FILE: Makefile --- JAVAC=/usr/lib/j2sdk1.3/bin/javac JAR=/usr/lib/j2sdk1.3/bin/jar JAVA=/usr/lib/j2sdk1.3/bin/java JARS="jars/dadml.jar:jars/jgl.jar:jars/xt2.jar:jars/xalan.jar:jars/xerces.jar:jars/wocjava.jar:jars/wocutil.jar:build" OPTIONS=-R /home/egonw/data/Projects/Woc/wocjava/repository_def.xml all: jar classes: ${JAVAC} -classpath ${JARS} -d build -O `find source/com -name "*.java"` clean: cd build; rm -fR * jar: classes cd build; ${JAR} cvf ../jars/wocjava.jar com/* items: ${JAVA} -cp ${JARS} com.egonw.woc.tools.MaakLosseItems ${OPTIONS} woord: ${JAVA} -cp ${JARS} com.egonw.woc.tools.Woord ${OPTIONS} groups: ${JAVA} -cp ${JARS} com.egonw.woc.tools.GroupFiles ${OPTIONS} --- NEW FILE: repository_def.xml --- <repositories> <!-- definitions of repositories consist mostly of directory names --> <general> <path id="PhysicalRoot">/home/egonw/data/Projects/Woc/</path> <!-- definition of DADML dirs --> <path id="DADMLSubDir">wocdata/dadml/</path> <path id="MolSubDir">mol/</path> <path id="PdbSubDir">pdb/</path> <path id="XyzSubDir">xyz/</path> <path id="CmlSubDir">cml/</path> <path id="PhysPropSubDir">fysisch/cml/</path> <path id="GifSubDir">gifgalary/</path> <!-- website --> <path id="HtmlRoot">http://www.sci.kun.nl/woc/</path> <path id="CgiBinRoot">http://www.sci.kun.nl/cgi-bin-woc/</path> <path id="JavaSubDir">java/</path> <!-- other --> <path id="BronnenFile">woc_bron.html</path> <path id="DatabasesFile">super.xml</path> </general> <specific repository="woc"> <!-- source --> <path id="DataSubDir">wocdata/</path> <path id="WMLSubDir">wml</path> <path id="PictureSubDir">wocdata/pictures/</path> <path id="ModelsSubDir">wocdata/compounds/</path> <!-- website --> <path id="LetterFileSubDir">gui/letters/</path> <path id="ItemFileSubDir">gui/items/</path> <path id="GroupFileSubDir">gui/groups/</path> <path id="IndexFileSubDir">gui/index/</path> <path id="CSSSubDir">gui/styles/</path> <path id="LocatieSubDir">gui/locatie/</path> <path id="JavascriptSubDir">gui/javascript/</path> </specific> <specific repository="iupac"> <!-- source --> <path id="DataSubDir">iupac/data/</path> <path id="WMLSubDir">iupac/data/wml</path> <path id="PictureSubDir">iupac/data/pictures/</path> <path id="ModelsSubDir">iupac/data/compounds/</path> <!-- website --> <path id="LetterFileSubDir">iupac/gui/letters/</path> <path id="ItemFileSubDir">iupac/gui/items/</path> <path id="GroupFileSubDir">iupac/gui/groups/</path> <path id="IndexFileSubDir">iupac/gui/index/</path> <path id="CSSSubDir">iupac/gui/styles/</path> <path id="LocatieSubDir">iupac/gui/locatie/</path> <path id="JavascriptSubDir">iupac/gui/javascript/</path> </specific> </repositories> --- NEW FILE: woclist.pl --- # hulp-script gebruikt door wocml.sh my $cmldir="/home/egonw/data/woc/dadml/fysisch/cml"; my $infile; my $outfile; if (@ARGV >= 2) { $infile = shift; $outfile = shift; } else { $infile = "woclist.tmp2.xml"; $outfile = "woclist.xml"; } open (INFILE, "$infile"); open (OUTFILE, ">$outfile"); #print eerste regel alvast $_ = <INFILE>; print OUTFILE; while (<INFILE>) { my $file; if (/ITEM.*?CODE=/i) { s/CODE/FILE/i; print OUTFILE; } elsif (/\<\?xml.*\?\>/i) { s/\<\?xml.*\?\>//i; print OUTFILE; } else { print OUTFILE; } } # zoals in Convert.java sub NAMELikeToANCHORLike { # heeft 1 parameter my $param = shift @_; $param =~ s/^\s*(.*?)\s*$/$1/ig; $param =~ s/\ /\_/g; $param =~ s/[,|.|<|>]//g; $param =~ tr/[A-Z]/[a-z]/; return $param; } --- NEW FILE: woclist.sh --- #! /bin/sh -e # The below three things should be customized dtddir="/home/egonw/data/Projects/Woc/dtd" name="woclist" wmldir="/home/egonw/data/Projects/Woc/wocdata/wml" ext=".xml" temp=".tmp" temp2=".tmp2" # cmldir is in perl-stukje gedefinieerd cat $wmldir/*.xml > $name$temp echo '<?xml version="1.0" encoding="ISO-8859-1"?>' > $name$temp2 echo '<!DOCTYPE '$name' SYSTEM "'$dtddir/$name'.dtd">' >> $name$temp2 echo '<'$name' xmlns:xsl="http://www.w3.org/1999/XSL/Transform"' >> $name$temp2 echo ' xmlns:import="http://www.sci.kun.nl/woc/import"' >> $name$temp2 echo ' xmlns:xlink="http://www.sci.kun.nl/woc/topicmap">' >> $name$temp2 awk "/\<ITEM/,/\<\/ITEM/{print}" $name$temp >> $name$temp2 echo '</'$name'>' >> $name$temp2 perl $name.pl $name$temp2 $name$ext rm $name$temp $name$temp2 # chgrp www-woc $name$ext chmod 664 $name$ext |
From: Egon W. <eg...@us...> - 2002-06-08 20:12:17
|
Update of /cvsroot/woc/woc/source/wocjava/source/com/egonw/util In directory usw-pr-cvs1:/tmp/cvs-serv16219/source/com/egonw/util Log Message: Directory /cvsroot/woc/woc/source/wocjava/source/com/egonw/util added to the repository |
From: Egon W. <eg...@us...> - 2002-06-08 20:12:17
|
Update of /cvsroot/woc/woc/source/wocjava/source/com/egonw/woc In directory usw-pr-cvs1:/tmp/cvs-serv16219/source/com/egonw/woc Log Message: Directory /cvsroot/woc/woc/source/wocjava/source/com/egonw/woc added to the repository |
From: Egon W. <eg...@us...> - 2002-06-08 20:11:59
|
Update of /cvsroot/woc/woc/source/wocjava/source/com/egonw In directory usw-pr-cvs1:/tmp/cvs-serv16125/source/com/egonw Log Message: Directory /cvsroot/woc/woc/source/wocjava/source/com/egonw added to the repository |
From: Egon W. <eg...@us...> - 2002-06-08 20:11:47
|
Update of /cvsroot/woc/woc/source/wocjava/source/com In directory usw-pr-cvs1:/tmp/cvs-serv16073/source/com Log Message: Directory /cvsroot/woc/woc/source/wocjava/source/com added to the repository |
From: Egon W. <eg...@us...> - 2002-06-08 20:07:32
|
Update of /cvsroot/woc/woc/source/wocjava/jars In directory usw-pr-cvs1:/tmp/cvs-serv15218/jars Log Message: Directory /cvsroot/woc/woc/source/wocjava/jars added to the repository |