All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.hfg.bio.seq.format.feature.SeqFeatureImpl Maven / Gradle / Ivy

There is a newer version: 20240423
Show newest version
package com.hfg.bio.seq.format.feature;

import java.util.ArrayList;
import java.util.List;

import com.hfg.util.collection.CollectionUtil;

//------------------------------------------------------------------------------
/**
 Basic implementation of SeqFeature interface.
 
@author J. Alex Taylor, hairyfatguy.com
*/ //------------------------------------------------------------------------------ // com.hfg Library // // This library 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 2.1 of the License, or (at your option) any later version. // // This library 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 library; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // // J. Alex Taylor, President, Founder, CEO, COO, CFO, OOPS hairyfatguy.com // [email protected] //------------------------------------------------------------------------------ public abstract class SeqFeatureImpl implements SeqFeature { private FeatureKey mName; private SeqFeatureLocation mLocation; private List mQualifiers; //########################################################################### // CONSTRUCTORS //########################################################################### //--------------------------------------------------------------------------- public SeqFeatureImpl(FeatureKey inName, SeqFeatureLocation inLocation) { mName = inName; mLocation = inLocation; } //########################################################################### // PUBLIC METHODS //########################################################################### //--------------------------------------------------------------------------- @Override public String toString() { return name().name(); } //--------------------------------------------------------------------------- @Override public FeatureKey name() { return mName; } //--------------------------------------------------------------------------- public SeqFeatureLocation getLocation() { return mLocation; } //--------------------------------------------------------------------------- public SeqFeature addQualifier(FeatureQualifier inValue) { if (null == mQualifiers) { mQualifiers = new ArrayList(25); } mQualifiers.add(inValue); return this; } //--------------------------------------------------------------------------- public List getQualifiers() { return mQualifiers; } //--------------------------------------------------------------------------- public List getQualifiers(String inQualifierName) { List qualifiers = null; if (CollectionUtil.hasValues(mQualifiers)) { for (FeatureQualifier qualifier : mQualifiers) { if (qualifier.name().equals(inQualifierName)) { if (null == qualifiers) { qualifiers = new ArrayList(25); } qualifiers.add(qualifier); } } } return qualifiers; } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy