package uk.ac.ebi.quickgo.ff.loader;

import uk.ac.ebi.quickgo.ff.files.ontology.OntologySourceFiles;

import java.util.Optional;

/**
 * Class whose responsibility is to retrieve information from
 * ontology source files and construct a new instance of type
 * {@code T}.
 *
 * Created 10/12/15
 * @author Edd
 */
public abstract class SourceInfoLoader<S extends OntologySourceFiles, T> {
    protected final S sourceFiles;

    public SourceInfoLoader(S sourceFiles) {
        this.sourceFiles = sourceFiles;
    }

    protected abstract T newInstance();
    public abstract T load() throws Exception;

    private T instance;

    protected T getInstance() {
        if (this.instance == null) {
            return this.instance = newInstance();
        } else {
            return this.instance;
        }
    }
}

@@ -100,36 +100,8 @@
 s;%0A%0A
-import java.util.Optional;%0A%0A
 /**%0A
@@ -389,16 +389,40 @@
 ceFiles;
+%0A    private T instance;
 %0A%0A    pu
@@ -511,48 +511,8 @@
  %7D%0A%0A
-    protected abstract T newInstance();%0A
     
@@ -561,32 +561,48 @@
 %0A%0A    pr
-ivate T i
+otected abstract T newI
 nstance
+()
 ;%0A%0A    p

Reformat code.