Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

21
LINES

< > BotCompany Repo | #1002955 // LoadEnv (include)

JavaX fragment (include)

// Defaults to standard environment (current program directory)
// Subclass for any different environments!
static class LoadEnv {
  S loadStructure(S varName) {
    ret loadTextFile(getProgramFile(varName + ".structure"));
  }

  void saveStructure(S varName, S structure) {
    saveTextFile(getProgramFile(varName + ".structure"), structure);
  }

  void load(O o, S varName) {
    S s = loadStructure(varName);
    if (s != null)
      setOpt(o, varName, unstructure(s));
  }

  void save(O o, S varName) {
    saveStructure(varName, structure(getOpt(o, varName)));
  }
}

download  show line numbers  debug dex  old transpilations   

Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1002955
Snippet name: LoadEnv (include)
Eternal ID of this version: #1002955/1
Text MD5: e565a9cd49ede55683305065fa916162
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2016-04-10 22:11:31
Source code size: 594 bytes / 21 lines
Pitched / IR pitched: No / No
Views / Downloads: 729 / 1662
Referenced in: #1003033 - class F for function objects (include)
#1003872 - Integrating #759 in One Program
#1003874 - Backup of #759 Before Integration
#1004091 - 759 with new loadClasses (spike)
#1034167 - Standard Classes + Interfaces (LIVE, continuation of #1003674)
#3000382 - Answer for ferdie (>> t = 1, f = 0)