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.List;

Author(s):
Yana Panchenko
 
 public class TokensLayerStored extends TextCorpusLayerStoredAbstract implements TokensLayer {
 
     public static final String XML_NAME = "tokens";
     @XmlElement(name = .)
     private List<TokenStoredtokens = new ArrayList<TokenStored>();
     private Boolean charOffsets;
 
     protected TokensLayerStored() {
     }
 
     protected TokensLayerStored(Boolean hasCharOffsets) {
         this. = hasCharOffsets;
     }
 
     protected TokensLayerStored(TextCorpusLayersConnector connector) {
         this. = connector;
     }
 
     protected void setLayersConnector(TextCorpusLayersConnector connector) {
         this. = connector;
         for (TokenStored token : ) {
             token.order = this...size();
             this...put(token.tokenIdtoken);
         }
         this.. = ;
     }
 
     @Override
     public Token getToken(int index) {
         Token token = .get(index);
         return token;
     }
 
     @Override
     public Token getToken(String tokenId) {
         Token token = ..get(tokenId);
         return token;
     }
 
     @Override
     public Token addToken(String tokenString) {
         int tokenCount = .size();
         String tokenId = . + tokenCount;
         return addToken(tokenStringnullnulltokenId);
     }
 
     @Override
     public Token addToken(String tokenStringString tokenId) {
         return addToken(tokenStringnullnulltokenId);
     }
 
     @Override
     public Token addToken(String tokenStringlong startlong end) {
         int tokenCount = .size();
         String tokenId = . + tokenCount;
         return addToken(tokenString, (Longstart, (LongendtokenId);
     }
 
    @Override
    public Token addToken(String tokenStringlong startlong endString tokenId) {
        return addToken(tokenString, (Longstart, (LongendtokenId);
    }
    private Token addToken(String tokenStringLong startLong endString tokenId) {
        TokenStored token = new TokenStored();
        token.tokenId = tokenId;
        token.tokenString = tokenString;
        if (start != null && end != null) {
            token.start = start;
            this. = true;
        }
        token.order = .size();
        ..put(token.tokenIdtoken);
        .add(token);
        return token;
    }
    @Override
    public boolean isEmpty() {
        return .isEmpty();
    }
    @Override
    public int size() {
        return .size();
    }
    @Override
    public boolean hasCharOffsets() {
        if ( == null) {
            return false;
        }
        return ;
    }
    protected void beforeMarshal(Marshaller m) {
        setFalseAttrToNull();
    }
    private void setFalseAttrToNull() {
        if (this. == .) {
            this. = null;
        }
    }
    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(" {");
        if (hasCharOffsets()) {
            sb.append(.).append(" ").append(Boolean.toString());
        }
        sb.append("}: ");
        sb.append(.toString());
        return sb.toString();
    }
New to GrepCode? Check out our FAQ X