Skip to content

Commit e06a702

Browse files
committed
Adding serializable interface to a few classes
1 parent 7a91037 commit e06a702

File tree

16 files changed

+79
-20
lines changed

16 files changed

+79
-20
lines changed

biojava-core/src/main/java/org/biojava/nbio/core/alignment/SimpleAlignedSequence.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
import org.biojava.nbio.core.sequence.location.template.Point;
3333
import org.biojava.nbio.core.sequence.template.*;
3434

35+
import java.io.Serializable;
3536
import java.util.ArrayList;
3637
import java.util.Arrays;
3738
import java.util.Iterator;
@@ -43,9 +44,12 @@
4344
* @author Mark Chapman
4445
* @param <C> each element of the {@link Sequence} is a {@link Compound} of type C
4546
*/
46-
public class SimpleAlignedSequence<S extends Sequence<C>, C extends Compound> implements AlignedSequence<S, C> {
47+
public class SimpleAlignedSequence<S extends Sequence<C>, C extends Compound> implements Serializable, AlignedSequence<S, C> {
4748

48-
private static final String gap = "-";
49+
50+
private static final long serialVersionUID = 1L;
51+
52+
private static final String gap = "-";
4953

5054
// always stored
5155
private AlignedSequence<S, C> prev;

biojava-core/src/main/java/org/biojava/nbio/core/alignment/SimpleProfile.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
import org.biojava.nbio.core.sequence.template.CompoundSet;
3939
import org.biojava.nbio.core.sequence.template.Sequence;
4040

41+
import java.io.Serializable;
4142
import java.util.*;
4243

4344

@@ -49,8 +50,11 @@
4950
* @param <S> each element of the alignment {@link Profile} is of type S
5051
* @param <C> each element of an {@link AlignedSequence} is a {@link Compound} of type C
5152
*/
52-
public class SimpleProfile<S extends Sequence<C>, C extends Compound> implements Profile<S, C> {
53+
public class SimpleProfile<S extends Sequence<C>, C extends Compound> implements Serializable, Profile<S, C> {
5354

55+
56+
private static final long serialVersionUID = 1L;
57+
5458
private List<AlignedSequence<S, C>> list;
5559
private List<S> originals;
5660
private int length;

biojava-core/src/main/java/org/biojava/nbio/core/alignment/SimpleProfilePair.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,10 @@
4343
public class SimpleProfilePair<S extends Sequence<C>, C extends Compound> extends SimpleProfile<S, C>
4444
implements ProfilePair<S, C> {
4545

46-
private Profile<S, C> query, target;
46+
47+
private static final long serialVersionUID = 1L;
48+
49+
private Profile<S, C> query, target;
4750

4851
/**
4952
* Creates a pair profile for the given profiles.

biojava-core/src/main/java/org/biojava/nbio/core/alignment/SimpleSequencePair.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,9 @@
4444
public class SimpleSequencePair<S extends Sequence<C>, C extends Compound> extends SimpleProfile<S, C>
4545
implements SequencePair<S, C> {
4646

47+
48+
private static final long serialVersionUID = 1L;
49+
4750
private int identicals = -1, similars = -1;
4851

4952
/**

biojava-core/src/main/java/org/biojava/nbio/core/sequence/location/SimplePoint.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121
*/
2222
package org.biojava.nbio.core.sequence.location;
2323

24+
import java.io.Serializable;
25+
2426
import org.biojava.nbio.core.sequence.location.template.Point;
2527
import org.biojava.nbio.core.util.Equals;
2628
import org.biojava.nbio.core.util.Hashcoder;
@@ -30,9 +32,12 @@
3032
*
3133
* @author ayates
3234
*/
33-
public class SimplePoint implements Point {
35+
public class SimplePoint implements Serializable, Point {
3436

35-
private int position;
37+
38+
private static final long serialVersionUID = 1L;
39+
40+
private int position;
3641
private boolean unknown;
3742
private boolean uncertain;
3843

biojava-core/src/main/java/org/biojava/nbio/core/sequence/location/template/AbstractLocation.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
import org.biojava.nbio.core.sequence.views.ReversedSequenceView;
3333
import org.biojava.nbio.core.util.Hashcoder;
3434

35+
import java.io.Serializable;
3536
import java.util.ArrayList;
3637
import java.util.Collections;
3738
import java.util.Iterator;
@@ -48,9 +49,11 @@
4849
* @author ayates
4950
* @author Paolo Pavan
5051
*/
51-
public abstract class AbstractLocation implements Location {
52+
public abstract class AbstractLocation implements Serializable, Location {
5253

53-
//TODO Need to have the Sequence lookup resolver here; see the next one as well
54+
private static final long serialVersionUID = 1L;
55+
56+
//TODO Need to have the Sequence lookup resolver here; see the next one as well
5457
//TODO Need a way of late binding of start/stop
5558

5659
private Point start;

biojava-structure/src/main/java/org/biojava/nbio/structure/SubstructureIdentifier.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
package org.biojava.nbio.structure;
2525

2626
import java.io.IOException;
27+
import java.io.Serializable;
2728
import java.util.ArrayList;
2829
import java.util.Arrays;
2930
import java.util.LinkedList;
@@ -67,7 +68,9 @@
6768
* @author dmyersturnbull
6869
* @author Spencer Bliven
6970
*/
70-
public class SubstructureIdentifier implements StructureIdentifier {
71+
public class SubstructureIdentifier implements Serializable, StructureIdentifier {
72+
73+
private static final long serialVersionUID = 1L;
7174

7275
private static final Logger logger = LoggerFactory.getLogger(SubstructureIdentifier.class);
7376

biojava-structure/src/main/java/org/biojava/nbio/structure/asa/GroupAsa.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222

2323
import org.biojava.nbio.structure.*;
2424

25+
import java.io.Serializable;
2526
import java.util.ArrayList;
2627
import java.util.HashMap;
2728
import java.util.List;
@@ -32,10 +33,12 @@
3233
*
3334
* @author duarte_j
3435
*
35-
*/
36-
public class GroupAsa {
36+
*/
37+
public class GroupAsa implements Serializable {
3738

3839

40+
private static final long serialVersionUID = 1L;
41+
3942
// ASA in extended tripeptide conformation (GLY-X-GLY)
4043
private static final HashMap<Character,Double> tripeptAsa = initTriPeptAsas();
4144

biojava-structure/src/main/java/org/biojava/nbio/structure/contact/AtomContact.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020
*/
2121
package org.biojava.nbio.structure.contact;
2222

23+
import java.io.Serializable;
24+
2325
import org.biojava.nbio.structure.Atom;
2426

2527
/**
@@ -28,8 +30,10 @@
2830
* @author duarte_j
2931
*
3032
*/
31-
public class AtomContact {
33+
public class AtomContact implements Serializable {
3234

35+
private static final long serialVersionUID = 1L;
36+
3337
private Pair<Atom> pair;
3438

3539
private double distance;

biojava-structure/src/main/java/org/biojava/nbio/structure/contact/AtomContactSet.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222

2323
import org.biojava.nbio.structure.Atom;
2424

25+
import java.io.Serializable;
2526
import java.util.*;
2627

2728

@@ -31,8 +32,11 @@
3132
* @author duarte_j
3233
*
3334
*/
34-
public class AtomContactSet implements Iterable<AtomContact> {
35+
public class AtomContactSet implements Serializable, Iterable<AtomContact> {
3536

37+
38+
private static final long serialVersionUID = 1L;
39+
3640
private HashMap<Pair<AtomIdentifier>, AtomContact> contacts;
3741
private double cutoff;
3842

0 commit comments

Comments
 (0)