File tree Expand file tree Collapse file tree 3 files changed +27
-0
lines changed
src/main/java/network/aika Expand file tree Collapse file tree 3 files changed +27
-0
lines changed Original file line number Diff line number Diff line change 2222import network .aika .neuron .Neuron ;
2323
2424import java .io .DataInput ;
25+ import java .io .DataOutput ;
2526import java .io .IOException ;
2627import java .util .Set ;
2728import java .util .TreeSet ;
@@ -67,6 +68,24 @@ public String getLabel() {
6768 return null ;
6869 }
6970
71+ @ Override
72+ public void write (DataOutput out ) throws IOException {
73+ if (modelLabels != null ) {
74+ for (String modelLabel : modelLabels ) {
75+ out .writeBoolean (true );
76+ out .writeUTF (modelLabel );
77+ }
78+ }
79+ out .writeBoolean (false );
80+ }
81+
82+ @ Override
83+ public void readFields (DataInput in , Model m ) throws IOException {
84+ while (in .readBoolean ()) {
85+ getModelLabels ().add (in .readUTF ());
86+ }
87+ }
88+
7089 public static <P extends Provider > AbstractNode read (DataInput in , P p ) throws IOException {
7190 AbstractNode n ;
7291 if (in .readBoolean ()) {
Original file line number Diff line number Diff line change @@ -401,6 +401,8 @@ public int compareTo(Node n) {
401401
402402 @ Override
403403 public void write (DataOutput out ) throws IOException {
404+ super .write (out );
405+
404406 out .writeInt (level );
405407
406408 out .writeInt (numberOfNeuronRefs .get ());
@@ -428,6 +430,8 @@ public void write(DataOutput out) throws IOException {
428430
429431 @ Override
430432 public void readFields (DataInput in , Model m ) throws IOException {
433+ super .readFields (in , m );
434+
431435 level = in .readInt ();
432436
433437 numberOfNeuronRefs .set (in .readInt ());
Original file line number Diff line number Diff line change @@ -567,6 +567,8 @@ public int compareTo(INeuron n) {
567567 public void write (DataOutput out ) throws IOException {
568568 out .writeBoolean (true );
569569
570+ super .write (out );
571+
570572 out .writeBoolean (label != null );
571573 if (label != null ) {
572574 out .writeUTF (label );
@@ -631,6 +633,8 @@ public void write(DataOutput out) throws IOException {
631633
632634 @ Override
633635 public void readFields (DataInput in , Model m ) throws IOException {
636+ super .readFields (in , m );
637+
634638 if (in .readBoolean ()) {
635639 label = in .readUTF ();
636640 }
You can’t perform that action at this time.
0 commit comments