A simple implementation for the Relation interface.
| 25 | * A simple implementation for the {@link Relation} interface. |
| 26 | */ |
| 27 | public class SimpleRelation implements Relation { |
| 28 | |
| 29 | private static final long serialVersionUID = 6866132107461267866L; |
| 30 | |
| 31 | protected String type; |
| 32 | |
| 33 | protected int[] members; |
| 34 | |
| 35 | protected int id; |
| 36 | |
| 37 | protected FeatureMap features; |
| 38 | |
| 39 | protected Object userData; |
| 40 | |
| 41 | /** |
| 42 | * You should never create instances of this class directly, you |
| 43 | * should create new relations via the appropriate methods of |
| 44 | * {@link RelationSet}. This method is only publicly available to |
| 45 | * support persistence. |
| 46 | */ |
| 47 | public SimpleRelation(int id, String type, int[] members) { |
| 48 | super(); |
| 49 | this.id = id; |
| 50 | this.type = type; |
| 51 | this.members = members; |
| 52 | features = Factory.newFeatureMap(); |
| 53 | } |
| 54 | |
| 55 | /* |
| 56 | * (non-Javadoc) |
| 57 | * |
| 58 | * @see gate.relations.Relation#getType() |
| 59 | */ |
| 60 | @Override |
| 61 | public String getType() { |
| 62 | return type; |
| 63 | } |
| 64 | |
| 65 | /* |
| 66 | * (non-Javadoc) |
| 67 | * |
| 68 | * @see gate.relations.Relation#getMembers() |
| 69 | */ |
| 70 | @Override |
| 71 | public int[] getMembers() { |
| 72 | return members; |
| 73 | } |
| 74 | |
| 75 | /* |
| 76 | * (non-Javadoc) |
| 77 | * |
| 78 | * @see java.lang.Object#toString() |
| 79 | */ |
| 80 | @Override |
| 81 | public String toString() { |
| 82 | StringBuilder str = new StringBuilder(); |
| 83 | str.append(id).append(": "); |
| 84 | String typeOut = |
nothing calls this directly
no outgoing calls
no test coverage detected