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

58
LINES

< > BotCompany Repo | #1035431 // G22TravelLogEntry - allows seeing the history of a project as it moved between computers

JavaX fragment (include) [tags: use-pretranspiled]

Uses 2164K of libraries. Click here for Pure Java version (52900L/278K).

// can also be used to document progress in a project on one machine
concept G22TravelLogEntry {
  settable S computerID;
  settable S computerDescription;
  settable Timestamp timestamp;
  settable S gazelleCompilationDate;
  settable S projectID;
  settable File projectDir;
  settable long projectSize;
  settable int fileCount;
  settable int conceptCount;
  settable long conceptIDCounter;
  settable Timestamp lastConceptChange;
  settable Timestamp lastFileChange;
  
  // It will be nice to always put something in here
  // (Why was this entry made?)
  settable S action;
  
  // these are optional
  settable S importedFromURL;
  settable File importedFromFile;
  settable S backedUpToURL;
  settable File backedUpToFile;
  settable S comment;
  
  static selfType create(G22Utils g22utils) {
    var cc = g22utils.concepts();
    
    ret new selfType()
      .computerID(main computerID())
      .timestamp(tsNow())
      .gazelleCompilationDate(g22utils.compilationDate())
      .projectID(g22utils.projectID())
      .projectDir(g22utils.projectDir())
      .conceptCount(countConcepts(cc))
      .conceptIDCounter(cc.idCounter)
      .lastConceptChange(main lastConceptChange(cc));
  }
  
  selfType scanProject(G22Utils g22utils) {
    L<File> files = findAllFiles_noDirs(g22utils.projectDir());

    ret
      lastFileChange(toTimestamp(max(map modificationTime(files))))
      .projectSize(longSum fileSize(files))
      .fileCount(l(files));
  }
  
  sbool shouldCreateEntry(G22Utils g22utils) {
    var entries = list(g22utils.concepts(), G22TravelLogEntry);
    if (empty(entries)) true;
    var last = highestByField(entries, "timestamp");
    if (!eq(last.computerID(), main computerID()))
      true;
    false;
  };
}

download  show line numbers  debug dex  old transpilations   

Travelled to 3 computer(s): ekrmjmnbrukm, mowyntqkapby, mqqgnosmbjvj

No comments. add comment

Snippet ID: #1035431
Snippet name: G22TravelLogEntry - allows seeing the history of a project as it moved between computers
Eternal ID of this version: #1035431/21
Text MD5: f5d4c70c973416a77f50d7ab208fc4b5
Transpilation MD5: 8b942811aef845bbc53220616cab8571
Author: stefan
Category: javax
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2022-05-09 01:09:47
Source code size: 1799 bytes / 58 lines
Pitched / IR pitched: No / No
Views / Downloads: 109 / 228
Version history: 20 change(s)
Referenced in: [show references]