![]() |
|||
AffixList.javaGo to the documentation of this file.00001 /* 00002 * AffixList.java 00003 * 00004 * Copyright (C) 2003 Alain MENSEGUEN 00005 * www.net2map.org 00006 * 00007 * This program is free software; you can redistribute it and/or 00008 * modify it under the terms of the GNU General Public License 00009 * as published by the Free Software Foundation; either version 2 00010 * of the License, or (at your option) any later version. 00011 * 00012 * This program is distributed in the hope that it will be useful, 00013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 * GNU Lesser General Public License for more details. 00016 * 00017 * You should have received a copy of the GNU General Public License 00018 * along with this program; if not, write to the Free Software 00019 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 00020 */ 00021 package org.net2map.pov.server; 00022 00023 import java.util.*; 00024 import java.sql.*; 00025 00029 class AffixList extends java.lang.Object 00030 { 00034 public AffixList(ParameterSet params) 00035 { 00036 pParameters = params; 00037 } 00038 00039 private LinkedList colAffixes; 00040 private ParameterSet pParameters; 00041 00045 public LinkedList getAffixes() 00046 { 00047 return colAffixes; 00048 } 00049 00054 public Affix getAffix( int n ) 00055 { 00056 return ( Affix )colAffixes.get( n ); 00057 } 00058 00062 public long count() 00063 { 00064 return colAffixes.size(); 00065 } 00066 00070 public void load( DatabaseConnection con ) 00071 { 00072 colAffixes = new LinkedList(); 00073 String query; 00074 int i = 0; 00075 00076 if ( pParameters.getIspellMode() == "db" ) 00077 { 00078 Statement res; 00079 query = "SELECT flag,lang,mask,find,repl FROM affix WHERE type='s'"; 00080 if( pParameters.DEBUG > 1 ) 00081 { 00082 System.out.println( "load_affix(): " + query ); 00083 } 00084 00085 try 00086 { 00087 res = con.execute( query ); 00088 while ( res.getResultSet().next() ) 00089 { 00090 Affix aTmp = new Affix(); 00091 aTmp.setFlag( res.getResultSet().getString(0).trim() ); 00092 aTmp.setLang( res.getResultSet().getString(1).trim() ); 00093 aTmp.setRegexp( res.getResultSet().getString(2).trim() ); 00094 aTmp.setAdd( res.getResultSet().getString(3).trim() ); 00095 aTmp.setSub( res.getResultSet().getString(4).trim() ); 00096 colAffixes.add(i, aTmp); 00097 i++; 00098 } 00099 res.close(); 00100 } 00101 catch(Exception e) 00102 { 00103 System.out.println("Query error: " + query + "\n" + e.getMessage()); 00104 } 00105 } 00106 } 00107 } |
|||
|
Accueil | Téléchargement | Manuel
| Doc. technique | Sources CVS |
Faq | Nous contacter
©2003 - All Rights Reserved |
|||