1 package org.lcsim.lcio;
2
3 import hep.io.sio.SIOInputStream;
4 import hep.io.sio.SIOOutputStream;
5 import hep.io.sio.SIORef;
6
7 import java.io.IOException;
8 import org.lcsim.event.LCRelation;
9
10
11
12
13
14
15
16 class SIOLCRelation implements LCRelation
17 {
18 protected SIORef from;
19 protected SIORef to;
20 protected float weight;
21
22 protected SIOLCRelation() {
23 }
24
25
26
27 SIOLCRelation(SIOInputStream in, int flags, int version) throws IOException
28 {
29 from = in.readPntr();
30 to = in.readPntr();
31 if (LCIOUtil.bitTest(flags,LCIOConstants.LCREL_WEIGHTED)) weight = in.readFloat();
32 }
33
34
35
36 public Object getFrom() {
37 return from.getObject();
38 }
39
40
41 public Object getTo() {
42 return to.getObject();
43 }
44
45
46
47 public float getWeight() {
48 return weight;
49 }
50
51
52
53 public void setWeight(float weight) {
54 this.weight = weight;
55 }
56
57
58
59 static void write(LCRelation rel, SIOOutputStream out, int flags) throws IOException
60 {
61 out.writePntr( rel.getFrom() );
62 out.writePntr( rel.getTo() );
63 if (LCIOUtil.bitTest(flags,LCIOConstants.LCREL_WEIGHTED)) out.writeFloat( rel.getWeight() );
64 }
65 }