Skip to content

Commit ec98d54

Browse files
add examples (#5)
1 parent b205c96 commit ec98d54

39 files changed

Lines changed: 541 additions & 2 deletions

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ CLAUDE.md
1515

1616
# Local scripts and example scratch
1717
scripts/
18-
assets/examples/
1918

2019
# Logs
2120
*.log

README.md

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,34 @@
1-
Webpage for liquidjava
1+
# liquid-java.github.io
2+
3+
Source for the [LiquidJava](https://github.com/liquid-java) project website, served via GitHub Pages from `main`.
4+
5+
## Local preview
6+
7+
No build step, no package manager. Open `index.html` directly, or serve the directory:
8+
9+
```sh
10+
python3 -m http.server 8000
11+
# then visit http://localhost:8000
12+
```
13+
14+
## Structure
15+
16+
- `index.html` — single-page site (markup, content, and inline JS for navbar + theme toggle).
17+
- `assets/css/style-starter.css` — vendored W3layouts template stylesheet plus LiquidJava overrides. Theme rules layered via `.light-theme` / `.dark-theme` on `<body>`.
18+
- `assets/js/jquery-3.3.1.min.js` — only JS dependency.
19+
- `assets/images/`, `assets/docs/`, `assets/extension/` — static assets (images, poster PDF, VSCode `.vsix`).
20+
21+
## Theme toggle
22+
23+
Dark/light mode is toggled by inline JS at the bottom of `index.html`. The selected theme is persisted in `localStorage` under the `theme` key and applied as a class on `<body>` before `DOMContentLoaded` to avoid a flash of unstyled content. When adding new sections, add explicit color rules for both themes in `style-starter.css`.
24+
25+
## Deploying
26+
27+
Push to `main`. GitHub Pages publishes the site automatically.
28+
29+
## Related repositories
30+
31+
- [`liquidjava`](https://github.com/liquid-java/liquidjava) — verifier, API, examples
32+
- [`liquidjava-docs`](https://github.com/liquid-java/liquidjava-docs) — documentation
33+
- [`liquidjava-tutorial`](https://github.com/liquid-java/liquidjava-tutorial) — tutorial
34+
- [`vscode-liquidjava`](https://github.com/liquid-java/vscode-liquidjava) — VSCode extension
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
// Path: aliveDone -> aliveNotDone -> aliveDone -> aliveNotDone -> aliveDone
2+
AbstractUndoableEdit edit = new AbstractUndoableEdit();
3+
edit.undo();
4+
edit.redo();
5+
edit.undo();
6+
edit.redo();
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
// Violation: redo() called twice in a row — second call is in state aliveDone.
2+
AbstractUndoableEdit edit = new AbstractUndoableEdit();
3+
edit.undo();
4+
edit.redo();
5+
edit.redo(); // INVALID: redo() requires aliveNotDone(edit),
6+
// but edit is in state aliveDone
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
@StateSet({"aliveDone", "aliveNotDone", "notAlive"})
2+
@ExternalRefinementsFor("javax.swing.undo.AbstractUndoableEdit")
3+
public interface AbstractUndoableEditRefinementsExpert {
4+
5+
@StateRefinement(to = "aliveDone(this)")
6+
void AbstractUndoableEdit();
7+
8+
@StateRefinement(from = "aliveNotDone(this)", to = "aliveDone(this)")
9+
void redo();
10+
11+
@StateRefinement(from = "aliveDone(this)", to = "aliveNotDone(this)")
12+
void undo();
13+
14+
@StateRefinement(from = "!notAlive(this)", to = "notAlive(this)")
15+
void die();
16+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
stateDiagram-v2
2+
[*] --> aliveDone : new AbstractUndoableEdit()
3+
aliveDone --> aliveNotDone : undo()
4+
aliveNotDone --> aliveDone : redo()
5+
aliveDone --> notAlive : die()
6+
aliveNotDone --> notAlive : die()
7+
notAlive --> [*]
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// Path: open -> open -> marked -> marked -> open -> open
2+
BufferedReader br = new BufferedReader(in);
3+
br.read();
4+
br.mark(42);
5+
br.read();
6+
br.reset();
7+
br.read();
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// Violation: reset() called twice — second call is in state `open`.
2+
BufferedReader br = new BufferedReader(in);
3+
br.mark(42);
4+
br.read();
5+
br.reset();
6+
br.reset(); // INVALID: reset() requires marked(br),
7+
// but br is in state open
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
@RefinementAlias("NonNegative(int v) { v >= 0 }")
2+
@RefinementAlias("Positive(int v) { v > 0 }")
3+
@StateSet({"open", "marked", "closed"})
4+
@ExternalRefinementsFor("java.io.BufferedReader")
5+
public interface BufferedReaderRefinementsExpert {
6+
7+
@StateRefinement(to = "open(this)")
8+
public void BufferedReader(Reader in);
9+
10+
@StateRefinement(to = "open(this)")
11+
public void BufferedReader(Reader in, @Refinement("Positive(_)") int sz);
12+
13+
@StateRefinement(from = "open(this)")
14+
@StateRefinement(from = "marked(this)")
15+
public int read();
16+
17+
@StateRefinement(from = "open(this)", to = "marked(this)")
18+
@StateRefinement(from = "marked(this)")
19+
public void mark(@Refinement("NonNegative(_)") int readAheadLimit);
20+
21+
@StateRefinement(from = "marked(this)", to = "open(this)")
22+
public void reset();
23+
24+
@StateRefinement(from = "!closed(this)", to = "closed(this)")
25+
public void close();
26+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
stateDiagram-v2
2+
[*] --> open : new BufferedReader(in)
3+
open --> open : read()
4+
marked --> marked : read()
5+
open --> marked : mark(n)
6+
marked --> marked : mark(n)
7+
marked --> open : reset()
8+
open --> closed : close()
9+
marked --> closed : close()
10+
closed --> [*]

0 commit comments

Comments
 (0)