MCPcopy Create free account
hub / github.com/badvision/jace / add

Method add

src/main/java/jace/library/MediaCache.java:121–142  ·  view source on GitHub ↗
(MediaEntry e)

Source from the content-addressed store, hash-verified

119 }
120
121 public void add(MediaEntry e) {
122 e.isLocal = this.equals(LOCAL_LIBRARY);
123 // Randomize ID if it is not already set
124 // This is a combination of the string hash as well as a 8-bit sequence number
125 if (e.id == 0 || e.id == -1) {
126 e.id = e.name.hashCode();
127 e.id <<= 8;
128 while (mediaLookup.containsKey(e.id)) {
129 e.id++;
130 }
131 }
132 mediaLookup.put(e.id, e);
133 cacheEntry(nameLookup, e.name, e.id);
134 cacheEntry(categoryLookup, e.category, e.id);
135 if (e.favorite) {
136 favorites.add(e.id);
137 }
138 for (String s : e.keywords) {
139 cacheEntry(keywordLookup, s, e.id);
140 }
141 markDirty();
142 }
143
144 public void remove(MediaEntry e) {
145 mediaLookup.remove(e.id);

Callers 15

updateMethod · 0.95
readLibraryFromDiskMethod · 0.95
initializeMethod · 0.80
startDragEventMethod · 0.80
addIndicatorMethod · 0.80
displayNotificationMethod · 0.80
addIndicatorMethod · 0.80
startMethod · 0.80
getMediaFromFileMethod · 0.80
cleanupMethod · 0.80
cacheEntryMethod · 0.80
getCurrentFileMethod · 0.80

Calls 4

cacheEntryMethod · 0.95
markDirtyMethod · 0.95
hashCodeMethod · 0.80
equalsMethod · 0.45

Tested by

no test coverage detected