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.tc.xb;
 
 import java.util.*;

Author(s):
Yana Panchenko
 
 public abstract class LexicalSemanticsLayerStored extends TextCorpusLayerStoredAbstract implements LexicalSemanticsLayer {
 
 //   @XmlAttribute(name = CommonAttributes.SOURCE)
 //    protected String source;
     @XmlElement(name = .)
     protected List<OrthformStoredorthforms = new ArrayList<OrthformStored>();
     protected TextCorpusLayersConnector connector;
 
     protected LexicalSemanticsLayerStored() {
     }
 
 //    protected LexicalSemanticsLayerStored(String source) {
 //        this.source = source;
 //    }
 
     protected LexicalSemanticsLayerStored(TextCorpusLayersConnector connector) {
         this. = connector;
     }
 
     @Override
     public boolean isEmpty() {
         return .isEmpty();
     }
 
 //    @Override
 //    public String getSource() {
 //        return source;
 //    }
 
     @Override
     public int size() {
         return .size();
     }
 
     @Override
     public Orthform getOrthform(int index) {
         return .get(index);
     }
 
     @Override
     public Lemma[] getLemmas(Orthform orthform) {
         if (orthform instanceof OrthformStored) {
             OrthformStored orth = (OrthformStoredorthform;
             Lemma[] lemmas = new Lemma[orth.lemmaRefs.length];
             for (int i = 0; i < orth.lemmaRefs.lengthi++) {
                 lemmas[i] = this...get((orth).[i]);
             }
             return lemmas;
         } else {
             throw new UnsupportedOperationException(WlfUtilities.layersErrorMessage(Orthform.classLexicalSemanticsLayerStored.class));
         }
     }
 
     @Override
     public Orthform addOrthform(String orthformValuesLemma lemma) {
         LemmaStored lem = null;
         if (lemma instanceof LemmaStored) {
            lem = (LemmaStoredlemma;
        } else {
            throw new UnsupportedOperationException(WlfUtilities.layersErrorMessage(Lemma.classLemmasLayerStored.class));
        }
        if (!this..containsKey(orthformValues)) {
            OrthformStored orthform = new OrthformStored();
            orthform.values = orthformValues;
            this..put(orthformValuesorthform);
            .add(orthform);
        }
        OrthformStored orthform = this..get(orthformValues);
        addLemma(orthformlem);
        return orthform;
    }
    @Override
    public Orthform addOrthform(String[] orthformValuesLemma lemma) {
        String values = Arrays.toString(orthformValues);
        return addOrthform(values.substring(1, values.length() - 1), lemma);
    }
    private void addLemma(OrthformStored orthformLemmaStored lemma) {
        if (orthform.lemmaRefs == null) {
            orthform.lemmaRefs = new String[]{lemma.lemmaId};
        } else {
            orthform.lemmaRefs = Arrays.copyOf(orthform.lemmaRefsorthform.lemmaRefs.length + 1);
            orthform.lemmaRefs[orthform.lemmaRefs.length - 1] = lemma.lemmaId;
        }
    }
    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
//        sb.append("{");
//        sb.append(source);
//        sb.append("}");
        sb.append(" : ");
        sb.append(.toString());
        return sb.toString();
    }
New to GrepCode? Check out our FAQ X