View Javadoc
1   package com.github.celldynamics.quimp.filesystem.versions;
2   
3   import com.github.celldynamics.quimp.QuimpException;
4   import com.github.celldynamics.quimp.QuimpVersion;
5   import com.github.celldynamics.quimp.Serializer;
6   import com.github.celldynamics.quimp.filesystem.IQuimpSerialize;
7   
8   /**
9    * Converts QCONF files saved in versions lower than 17.02.02.
10   * 
11   * <p>Replaces version tag from String[3] to {@link QuimpVersion} - current version of QuimP.
12   * 
13   * @author p.baniukiewicz
14   * @param <T> Type of serialised class
15   * @see com.github.celldynamics.quimp.QParamsQconf#readParams()
16   *
17   */
18  public class Converter170202<T extends IQuimpSerialize> implements IQconfOlderConverter<T> {
19  
20    /**
21     * Version below the {@link #upgradeFromOld(Serializer)} will be executed.
22     */
23    public final Double trigger = new Double(17.0205);
24    private QuimpVersion version;
25  
26    /**
27     * @param version new version format. The old version will be replaced with this one
28     */
29    public Converter170202(QuimpVersion version) {
30      this.version = version;
31    }
32  
33    @Override
34    public void upgradeFromOld(Serializer<T> localref) throws QuimpException {
35      if (localref.timeStamp == null) {
36        localref.timeStamp = version;
37      }
38    }
39  
40    @Override
41    public Double executeForLowerThan() {
42      return trigger;
43    }
44  
45  }