X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=forester%2Fjava%2Fsrc%2Forg%2Fforester%2Fprotein%2FBasicDomain.java;h=171b0d07d2f44c3ce68830b3366e838d92115981;hb=8b7781ab4d35e87fc7b5f878a7445add4939fcc8;hp=0232b912370f4a21defffde13f1d56e2f1ed78ec;hpb=656be28debec520e0e35a8b311114398a40ea366;p=jalview.git diff --git a/forester/java/src/org/forester/protein/BasicDomain.java b/forester/java/src/org/forester/protein/BasicDomain.java index 0232b91..171b0d0 100644 --- a/forester/java/src/org/forester/protein/BasicDomain.java +++ b/forester/java/src/org/forester/protein/BasicDomain.java @@ -26,26 +26,25 @@ package org.forester.protein; -import org.forester.go.GoId; import org.forester.util.ForesterUtil; public class BasicDomain implements Domain { - final private DomainId _id; - final private int _from; - final private int _to; - final private short _number; - final private short _total_count; - final private double _per_sequence_evalue; - final private double _per_sequence_score; - final private double _per_domain_evalue; - final private double _per_domain_score; - - public BasicDomain( final String id_str ) { - if ( ForesterUtil.isEmpty( id_str ) ) { + final private String _id; + final private int _from; + final private int _to; + final private short _number; + final private short _total_count; + final private double _per_sequence_evalue; + final private double _per_sequence_score; + final private double _per_domain_evalue; + final private double _per_domain_score; + + public BasicDomain( final String id ) { + if ( ForesterUtil.isEmpty( id ) ) { throw new IllegalArgumentException( "attempt to create protein domain with null or empty id" ); } - _id = new DomainId( id_str ); + _id = id; _from = -1; _to = -1; _number = -1; @@ -56,17 +55,17 @@ public class BasicDomain implements Domain { _per_domain_score = -1; } - public BasicDomain( final String id_str, + public BasicDomain( final String id, final int from, final int to, final short number, final short total_count, final double per_sequence_evalue, final double per_sequence_score ) { - this( id_str, from, to, number, total_count, per_sequence_evalue, per_sequence_score, 0, 0 ); + this( id, from, to, number, total_count, per_sequence_evalue, per_sequence_score, 0, 0 ); } - public BasicDomain( final String id_str, + public BasicDomain( final String id, final int from, final int to, final short number, @@ -78,7 +77,7 @@ public class BasicDomain implements Domain { if ( ( from >= to ) || ( from < 0 ) ) { throw new IllegalArgumentException( "attempt to create protein domain from " + from + " to " + to ); } - if ( ForesterUtil.isEmpty( id_str ) ) { + if ( ForesterUtil.isEmpty( id ) ) { throw new IllegalArgumentException( "attempt to create protein domain with null or empty id" ); } if ( ( number > total_count ) || ( number < 0 ) ) { @@ -88,7 +87,7 @@ public class BasicDomain implements Domain { if ( ( per_sequence_evalue < 0.0 ) || ( per_domain_evalue < 0.0 ) ) { throw new IllegalArgumentException( "attempt to create protein domain with negative E-value" ); } - _id = new DomainId( id_str ); + _id = id; _from = from; _to = to; _number = number; @@ -99,11 +98,10 @@ public class BasicDomain implements Domain { _per_domain_score = per_domain_score; } - @Override - public void addGoId( final GoId go_id ) { - getDomainId().getGoIds().add( go_id ); - } - + // ^^ @Override + // ^^ public void addGoId( final GoId go_id ) { + // ^^ getDomainId().getGoIds().add( go_id ); + // ^^ } /** * Basic domains are compared/sorted based upon their identifiers (case * insensitive) and their numbers. @@ -144,7 +142,7 @@ public class BasicDomain implements Domain { } @Override - public DomainId getDomainId() { + public String getDomainId() { return _id; } @@ -153,21 +151,19 @@ public class BasicDomain implements Domain { return _from; } - @Override - public GoId getGoId( final int i ) { - return getDomainId().getGoIds().get( i ); - } - + // ^^ @Override + // ^^ public GoId getGoId( final int i ) { + // ^^ return getDomainId().getGoIds().get( i ); + // ^^ } @Override public short getNumber() { return _number; } - @Override - public int getNumberOfGoIds() { - return getDomainId().getGoIds().size(); - } - + // ^^ @Override + // ^^ public int getNumberOfGoIds() { + // ^^ return getDomainId().getGoIds().size(); + // ^^ } @Override public double getPerDomainEvalue() { return _per_domain_evalue; @@ -200,16 +196,16 @@ public class BasicDomain implements Domain { @Override public int hashCode() { - return getDomainId().getId().hashCode(); + return getDomainId().hashCode(); } @Override public String toString() { - return toStringBuffer().toString(); + return getDomainId(); } public StringBuffer toStringBuffer() { - return new StringBuffer( getDomainId().getId() ); + return new StringBuffer( getDomainId() ); } @Override