Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
wlfxb - a library for creating and processing of TCF data streams. Copyright (C) University of Tübingen. This file is part of wlfxb. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.
 
 package eu.clarin.weblicht.wlfxb.lx.xb;
 

Author(s):
Yana Panchenko
 
 @XmlType(propOrder = {
     "entriesLayer",
     "posTagsLayer",
     "frequenciesLayer",
     "cooccurrencesLayer",
     "synonymsLayer",
     "syllabificationsLayer"})
 public class LexiconStored implements Lexicon {
 
     public static final String XML_NAME = "Lexicon";
     public static final String XML_NAMESPACE = "http://www.dspin.de/data/lexicon";
     @XmlAttribute
     protected String lang;
     private LexiconLayersConnector connector;
 
     LexiconStored() {
          = new LexiconLayersConnector();
          = new LexiconLayerStoredAbstract[LexiconLayerTag.orderedLayerTags().size()];
     }
 
     public LexiconStored(String language) {
         this();
         this. = language;
     }
 
     public String getLanguage() {
         return ;
     }
 
     @Override
     public EntriesLayer createEntriesLayer(EntryType entryType) {
         return initializeLayer(EntriesLayerStored.classentryType);
     }
 
     @Override
     public PosTagsLayer createPosTagsLayer(String tagset) {
         return initializeLayer(PosTagsLayerStored.classtagset);
     }
 
     @Override
         return initializeLayer(FrequenciesLayerStored.classfreqType);
     }
     
     @Override
         return initializeLayer(CooccurrencesLayerStored.class);
     }
 
     @Override
     public SynonymsLayer createSynonymsLayer() {
         return initializeLayer(SynonymsLayerStored.class);
     }
     
     @Override
         return initializeLayer(SyllabificationsLayerStored.class);
     }
 
     @SuppressWarnings("unchecked")
     private <T extends LexiconLayerStoredAbstract> T initializeLayer(Class<T> layerClassObject... params) {
 
         Class<?>[] paramsClass = null;
        if (params != null) {
            paramsClass = new Class<?>[params.length];
            for (int i = 0; i < params.lengthi++) {
                paramsClass[i] = params[i].getClass();
            }
        }
        LexiconLayerTag layerTag = LexiconLayerTag.getFromClass(layerClass);
        try {
            Constructor<?> ct;
            T instance;
            if (params == null) {
                ct = layerClass.getDeclaredConstructor();
                instance = (T) ct.newInstance();
            } else {
                ct = layerClass.getDeclaredConstructor(paramsClass);
                instance = (T) ct.newInstance(params);
            }
            [layerTag.ordinal()] = instance;
            instance.setLayersConnector();
        } catch (Exception e) {
            //e.printStackTrace();
            Logger.getLogger(LexiconStored.class.getName()).log(.nulle);
        }
        return (T) [layerTag.ordinal()];
    }
    protected void setEntriesLayer(EntriesLayerStored layer) {
        [..ordinal()] = layer;
    }
    @Override
    }
    protected void setPosTagsLayer(PosTagsLayerStored layer) {
        [..ordinal()] = layer;
    }
    @Override
    }
    protected void setFrequenciesLayer(FrequenciesLayerStored layer) {
        [..ordinal()] = layer;
    }
    @Override
    }
    
    protected void setCooccurrencesLayer(CooccurrencesLayerStored layer) {
    }
    @Override
    }
    protected void setSynonymsLayer(SynonymsLayerStored layer) {
        [..ordinal()] = layer;
    }
    @Override
    }
    
    protected void setSyllabificationsLayer(SyllabificationsLayerStored layer) {
    }
    @Override
    }
    protected void afterUnmarshal(Unmarshaller uObject parent) {
        connectLayers();
    }
//		protected void beforeMarshal(Marshaller m) {
//			setEmptyLayersToNull();
//		}
//		
//
//		/**
//		 * 
//		 */
//		private void setEmptyLayersToNull() {
//			
//			for (int i = 0; i < this.layersInOrder.length; i++) {
//				if (layersInOrder[i] != null && layersInOrder[i].isEmpty()) {
//					layersInOrder[i] = null;
//				}
//			}
//		}
    protected void connectLayers() {
        for (int i = 0; i < this..lengthi++) {
            if ([i] != null) {
                [i].setLayersConnector();
            }
        }
    }
    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(":\n");
        for (LexiconLayer layer : this.) {
            if (layer != null) {
                sb.append(layer);
                sb.append("\n");
            }
        }
        return sb.toString();
    }
New to GrepCode? Check out our FAQ X