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).

1  
// can also be used to document progress in a project on one machine
2  
concept G22TravelLogEntry {
3  
  settable S computerID;
4  
  settable S computerDescription;
5  
  settable Timestamp timestamp;
6  
  settable S gazelleCompilationDate;
7  
  settable S projectID;
8  
  settable File projectDir;
9  
  settable long projectSize;
10  
  settable int fileCount;
11  
  settable int conceptCount;
12  
  settable long conceptIDCounter;
13  
  settable Timestamp lastConceptChange;
14  
  settable Timestamp lastFileChange;
15  
  
16  
  // It will be nice to always put something in here
17  
  // (Why was this entry made?)
18  
  settable S action;
19  
  
20  
  // these are optional
21  
  settable S importedFromURL;
22  
  settable File importedFromFile;
23  
  settable S backedUpToURL;
24  
  settable File backedUpToFile;
25  
  settable S comment;
26  
  
27  
  static selfType create(G22Utils g22utils) {
28  
    var cc = g22utils.concepts();
29  
    
30  
    ret new selfType()
31  
      .computerID(main computerID())
32  
      .timestamp(tsNow())
33  
      .gazelleCompilationDate(g22utils.compilationDate())
34  
      .projectID(g22utils.projectID())
35  
      .projectDir(g22utils.projectDir())
36  
      .conceptCount(countConcepts(cc))
37  
      .conceptIDCounter(cc.idCounter)
38  
      .lastConceptChange(main lastConceptChange(cc));
39  
  }
40  
  
41  
  selfType scanProject(G22Utils g22utils) {
42  
    L<File> files = findAllFiles_noDirs(g22utils.projectDir());
43  
44  
    ret
45  
      lastFileChange(toTimestamp(max(map modificationTime(files))))
46  
      .projectSize(longSum fileSize(files))
47  
      .fileCount(l(files));
48  
  }
49  
  
50  
  sbool shouldCreateEntry(G22Utils g22utils) {
51  
    var entries = list(g22utils.concepts(), G22TravelLogEntry);
52  
    if (empty(entries)) true;
53  
    var last = highestByField(entries, "timestamp");
54  
    if (!eq(last.computerID(), main computerID()))
55  
      true;
56  
    false;
57  
  };
58  
}

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: 202 / 367
Version history: 20 change(s)
Referenced in: [show references]