Beacher.java

  1. package com.github.tamadalab.beacher;

  2. import java.util.List;
  3. import java.util.ArrayList;

  4. import java.nio.file.Path;
  5. import java.io.File;
  6. import java.io.FileNotFoundException;
  7. import java.io.IOException;

  8. public class Beacher extends BuildToolDef
  9. {
  10.     public List<BuildToolDef> mergeBuildTools(List<BuildToolDef> first, List<BuildToolDef> second)
  11.     {
  12.         List<BuildToolDef> result = new ArrayList<BuildToolDef>();
  13.         for (BuildToolDef item : first)
  14.         {
  15.             result.add(item);
  16.         }
  17.         for (BuildToolDef item : second)
  18.         {
  19.             result.add(item);
  20.         }

  21.         return result;
  22.     }

  23.     public List<BuildToolDef> construct(Path defs,Path append) throws FileNotFoundException,IOException
  24.     {
  25.         List<BuildToolDef> def = new ArrayList<BuildToolDef>();
  26.         if(defs!=null)
  27.         {
  28.             def = super.parse(defs);
  29.         }
  30.         else
  31.         {
  32.             def = super.parseFromAsset();
  33.         }

  34.         List<BuildToolDef> result = new ArrayList<BuildToolDef>();
  35.         if (append!=null)
  36.         {
  37.             List<BuildToolDef> additionalDefs = super.parse(append);
  38.             result = this.mergeBuildTools(def, additionalDefs);
  39.         }
  40.         else
  41.         {
  42.             result = def;
  43.         }

  44.         return result;
  45.     }
  46.    
  47. }