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) Yana Panchenko. 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 MorphologySegmentStored implements MorphologySegment {
 
     public static final String XML_NAME = "segment";
     @XmlAttribute(name = .)
     protected String type;
     protected String function;
     protected String category;
     protected Integer start;
     protected Integer end;
     // temporary to hold unmarshalled objects before I can transfer them to fs or value
     private List<Objectcontent = new ArrayList<Object>();
     protected String value;
 
     @XmlMixed
     @XmlElementRefs({
         @XmlElementRef(name = ., type = MorphologySegmentStored.class),})
     protected List<ObjectgetContent() {
         List<ObjectcontentToMarshal = new ArrayList<Object>();
         if ( != null) {
             contentToMarshal.addAll();
         } else if ( != null) {
             contentToMarshal.add();
         } else {
             return null;
         }
         return contentToMarshal;
     }
 
     void setContent(List<Objectcontent) {
         this. = content;
     }
 
     protected void afterUnmarshal(Unmarshaller uObject parent) {
         for (Object obj : ) {
             if (obj instanceof String) {
                 String v = ((Stringobj).trim();
                 if ( == null && v.length() > 0) {
                      = v;
                     return;
                 }
             } else if (obj instanceof MorphologySegmentStored) {
                 if ( == null) {
                      = new ArrayList<MorphologySegmentStored>();
                 }
                 .add((MorphologySegmentStoredobj);
             }
         }
     }
 
     @Override
     public String getCategory() {
         return ;
     }
 
     @Override
     public String getType() {
        return ;
    }
    @Override
    public String getFunction() {
        return ;
    }
    @Override
    public boolean hasCharoffsets() {
        return ( != null &&  != null);
    }
    @Override
    public Integer getStart() {
        return ;
    }
    @Override
    public Integer getEnd() {
        return ;
    }
    @Override
    public boolean isTerminal() {
        return ( == null || .isEmpty());
    }
    @Override
    public String getValue() {
        return ;
    }
    @Override
    public MorphologySegment[] getSubsegments() {
        if ( == null) {
            return null;
        }
        return .toArray(new MorphologySegment[.size()]);
    }
    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        if ( != null) {
            sb.append();
            sb.append(" ");
        }
        if ( != null) {
            sb.append();
            sb.append(" ");
        }
        if ( != null) {
            sb.append();
            sb.append(" ");
        }
        if (hasCharoffsets()) {
            sb.append();
            sb.append(" ");
            sb.append();
            sb.append(" ");
        }
        if (isTerminal()) {
            sb.append();
        } else if ( != null && !.isEmpty()) {
            sb.append(.toString());
        }
        return sb.toString();
    }
New to GrepCode? Check out our FAQ X