Prototype: FileCatalog.upload requires nonempty name and nonnegative size; duplicate returns false preserving old size. get returns Long/null; zero-byte files valid.

Final: FileStorage starts at time 0, nonnegative quota and usage 0. Only advanceTo changes time, requiring monotonic nonnegative timestamps and expiring all exact-boundary entries. upload(name,size,ttl) validates nonempty name, size >=0, ttl null or >0 before capacity/duplicate checks; expiry is current time+ttl. copy(source,destination) validates nonempty destination first, fails unchanged for missing/existing/over-quota, and retains source absolute expiry. delete releases once. get returns immutable StoredFile or null. search(prefix,limit) returns fresh snapshots sorted size descending/name, negative limit raises, zero returns empty. Expired names may be reused.

The complete public API is in Exercise.java. All domain classes are public static nested classes of Exercise; construct them as new Exercise.ClassName(...). Do not implement a solution in the test runner. Each instance owns independent state. Unless explicitly allowed, null inputs are outside the domain. Failed operations leave state unchanged; validation happens before mutation.

Drag or use the arrow keys to resize. Home collapses the question; End collapses the editor. Enter or double-click resets the split.
Loading editor…
No results yet.

Complete the starter code, then run the checks.
Results and errors will appear here.

Java runs on this device with CheerpJ 4.3.