Skip to content

Commit

Permalink
Conciseness pass 1 and CONTRIBUTING AEG blog link
Browse files Browse the repository at this point in the history
  • Loading branch information
RyanR712 committed Dec 20, 2023
1 parent 4d97410 commit 32eb312
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 89 deletions.
2 changes: 1 addition & 1 deletion .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

* [Development Tutorial in README](https://github.com/RAIRLab/Peirce-My-Heart#development)
* [Existential Graphs Website](https://homepages.hass.rpi.edu/heuveb/Research/EG/index.html)
* [James Oswald's Blog Post on AEGs](https://jamesoswald.dev/posts/alpha-existential-graphs/)
* [James Oswald's Blog Post on AEGs](https://jamesoswald.dev/posts/alpha-existential-graphs-1/)

## Feature Requests

Expand Down
1 change: 1 addition & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"buttonface",
"Deiterate",
"Deiterated",
"Deiterates",
"Deiteration",
"hasmousedown",
"Huda",
Expand Down
10 changes: 3 additions & 7 deletions src/ProofTools/ClearProofTool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@ let currentProofTree: AEGTree;
let legalNode: boolean;

/**
* Sets currentProofTree to the AEGTree of the current proof step.
* Then clears the canvas and highlights all nodes on it as the illegal color.
* Clears the canvas and highlights all nodes on it as the illegal color.
*/
export function clearProofMouseDown(): void {
currentProofTree = getCurrentProofTree();
Expand All @@ -29,9 +28,7 @@ export function clearProofMouseDown(): void {
}

/**
* Clears the proof's history buttons.
* Then clears the proof.
* Then redraws the proof.
* Clears the proofs history's buttons and redraws the proof.
*/
export function clearProofMouseUp(): void {
if (legalNode) {
Expand All @@ -42,8 +39,7 @@ export function clearProofMouseUp(): void {
}

/**
* Sets legality to false.
* Then redraws the proof.
* Redraws the proof.
*/
export function clearProofMouseOut(): void {
legalNode = false;
Expand Down
42 changes: 8 additions & 34 deletions src/ProofTools/DeiterationTool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@ let tempTree: AEGTree;

/**
* Sets currentPoint according to the coordinates given by the incoming MouseEvent.
* Then sets currentProofTree to the current proof tree.
* Then sets tempTree to a copy of currentProofTree.
* Then sets currentNode to the lowest node containing currentPoint.
* Then determines legality and highlights any effected nodes as the illegal color.
*
Expand All @@ -52,11 +50,9 @@ export function deiterationMouseDown(event: MouseEvent): void {
/**
* Sets currentPoint according to the coordinates given by the incoming MouseEvent.
*
* Then if currentNode is not null,
* Sets currentNode to the lowest node containing currentPoint,
* Redraws the proof, and
* Determines legality and highlights any effected nodes as the illegal color.
* Then follows the same control flow as deiterationMouseDown.
*
* @see deiterationMouseDown
* @param event Incoming MouseEvent.
*/
export function deiterationMouseMove(event: MouseEvent): void {
Expand All @@ -71,12 +67,9 @@ export function deiterationMouseMove(event: MouseEvent): void {
/**
* If legality is true,
* Sets currentPoint to the coordinates given by the incoming MouseEvent, and
* If currentNode is not null and can be deiterated,
* If currentNode can be deiterated,
* Removes currentPoint.
* Then pushes a "Deiteration" rule to the proof history.
*
* Then sets legality to false.
* Then redraws the proof.
* Then Deiterates currentNode and pushes a "Deiteration" rule to the proof history.
*
* @param event Incoming MouseEvent.
*/
Expand All @@ -99,12 +92,7 @@ export function deiterationMouseUp(event: MouseEvent): void {
}

/**
* If legality is true and currentNode is not null,
* Reinserts currentNode into tempTree.
*
* Then sets legality to false.
* Then sets currentNode to null.
* Then redraws the proof.
* Reinserts currentNode into tempTree if able and sets fields to defaults.
*/
export function deiterationMouseOut(): void {
if (legalNode && currentNode !== null) {
Expand All @@ -117,11 +105,7 @@ export function deiterationMouseOut(): void {

/**
* If currentNode is not null and can be deiterated,
* Sets legality to true, and
* If the lowest parent containing currentPoint is not null,
* Removes currentNode.
* Then redraws temp tree.
* Then highlights currentNode and any effected children as the illegal color, and
* Highlights currentNode and any effected children as the illegal color, and
* Inserts currentNode into tempTree.
*
* Otherwise sets legality to false.
Expand All @@ -148,18 +132,8 @@ function determineLegalityAndHighlightAsIllegal(): void {
/**
* Checks and returns if the incoming CutNode can be deiterated at the incoming level number.
*
* As long as the incoming CutNode has children,
* If a child of the incoming CutNode's currentNode are both Ellipses and currentNode is equal to that child,
* Returns true.
* Otherwise if a child of the incoming CutNode is an AtomNode and currentNode is an AtomNode with the same identifier,
* Returns true.
* Otherwise if a child of the incoming CutNode contains currentNode at a deeper level,
* Sets that child as the new parent to check.
*
* Then if no equality was found,
* Returns the result of canDeiterate between the new parent to check and its level.
*
* Otherwise returns false.
* If a CutNode or AtomNode equal to currentParent is found at a deeper cut level, then it is able
* to be deiterated.
*
* @param currentParent Incoming CutNode.
* @param level Incoming level number.
Expand Down
47 changes: 14 additions & 33 deletions src/ProofTools/IterationTool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,8 @@ let legalNode: boolean;
let currentProofTree: AEGTree;

/**
* Sets currentProofTree to the current proof tree.
* Then sets startingPoint according to the incoming MouseEvent.
* Then sets currentNode to the lowest node containing startingPoint.
* Then sets currentParent to the lowest parent containing startingPoint.
* Then sets legality to true if currentNode is not The Sheet of Assertion or null.
*
* Then if legality is true,
* Sets cursor style to copy.
* Sets startingPoint according to the incoming MouseEvent.
* Then sets all fields above accordingly.
*
* @param event Incoming MouseEvent.
*/
Expand All @@ -69,8 +63,8 @@ export function iterationMouseDown(event: MouseEvent): void {
* If legality is true,
* Redraws the proof,
* Alters currentNode according to the coordinates received by the incoming MouseEvent,
* Highlights currentNode and any of its children as the legal or illegal color based on its position's validity, and
* Changes cursor style according to the highlight color.
* Highlights currentNode and any of its children as the legal or illegal color based on
* their positions' validity.
*
* @param event Incoming MouseEvent.
*/
Expand All @@ -96,12 +90,9 @@ export function iterationMouseMove(event: MouseEvent): void {

/**
* If legality is true,
* Sets cursor style to default,
* Then if currentNode altered by the coordinates received from the incoming MouseEvent's position is legal,
* Inserts currentNode and any of its children, and
* Adds an Iteration step to the proof history.
* Then redraws the proof.
* Then sets legality to false.
* Alters currentNode according to the coordinates received by the incoming MouseEvent, and
* Iterates the
* altered currentNode to a deeper level in the Proof Mode AEGTree and redraws the proof.
*
* @param event Incoming MouseEvent.
*/
Expand All @@ -128,9 +119,7 @@ export function iterationMouseUp(event: MouseEvent): void {
}

/**
* Sets cursor style to default.
* Then sets legality to false.
* Then redraws the proof.
* Sets cursor style and all fields to default values.
*/
export function iterationMouseOut(): void {
changeCursorStyle("cursor: default");
Expand All @@ -141,13 +130,9 @@ export function iterationMouseOut(): void {
/**
* Checks and returns if the latter incoming Point can be legally iterated to the former incoming Point.
*
* If currentParent is not null, and
* currentParent contains the former current Point, and
* If currentNode is a CutNode and currentNode's children are valid, and
* currentNode altered by the latter incoming Point is not a parent, or
* currentNode is an AtomNode and currentNode altered by the latter incoming Point can be inserted into currentProofTree,
*
* Returns true.
* If currentNode altered by the former incoming Point can be inserted into the sheet, or
* currentNode is a CutNode that is not a parent of the altered CutNode,
* Then currentPoint can be legally iterated.
*
* @param moveDifference Latter incoming Point.
* @param currentPoint Former incoming Point.
Expand All @@ -169,14 +154,10 @@ function isLegal(moveDifference: Point, currentPoint: Point): boolean {
}

/**
* Checks and returns if the incoming altered Ellipse contains the incoming CutNode or any of the incoming CutNode's children.
* Checks and returns if the incoming Ellipse contains the incoming CutNode or any of the
* incoming CutNode's children.
*
* As long as the incoming CutNode has children,
* If the incoming altered Ellipse contains the incoming CutNode's child or that child is a parent,
* Returns false.
* Otherwise if the incoming altered Ellipse contains a child of the incoming CutNode that is an AtomNode,
* Returns false.
* Otherwise returns true.
* If the incoming Ellipse contains any of currentNode's children, currentEllipse is then a parent.
*
* @param currentNode Incoming CutNode.
* @param currentEllipse Incoming Ellipse.
Expand Down
16 changes: 4 additions & 12 deletions src/ProofTools/PasteInProof.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,7 @@ let currentTree: AEGTree;
let legalNode: boolean;

/**
* Sets currentTree to the current proof tree.
* Then sets currentGraph to the sheet in treeContext's selectForProof field.
* Then sets legality to true and cursor style to copy if currentGraph has children and currentTree is empty.
* Sets fields appropriately.
*/
export function pasteInProofMouseDown(): void {
currentTree = getCurrentProofTree();
Expand All @@ -40,9 +38,7 @@ export function pasteInProofMouseDown(): void {
}

/**
* Sets cursor style to default.
* Then sets legality to false.
* Then redraws the proof.
* Resets cursor style and redraws proof.
*/
export function pasteInProofMouseMove(): void {
changeCursorStyle("cursor: default");
Expand All @@ -51,9 +47,7 @@ export function pasteInProofMouseMove(): void {
}

/**
* Sets the cursor style to default, sets the proof's Sheet of Assertion to currentGraph, and creates an appropriate proof step if legality is true.
* Then sets legality to false.
* Then redraws the proof.
* Pushes a "Pasted" step to the proof history and redraws the proof.
*/
export function pasteInProofMouseUp(): void {
if (legalNode) {
Expand All @@ -66,9 +60,7 @@ export function pasteInProofMouseUp(): void {
}

/**
* Sets cursor style to default.
* Then sets legality to false.
* Then redraws the proof.
* Sets fields back to defaults.
*/
export function pasteInProofMouseOut(): void {
changeCursorStyle("cursor: default");
Expand Down
6 changes: 4 additions & 2 deletions src/ProofTools/ProofToolUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ import {TreeContext} from "../TreeContext";
*/

/**
* Copies and returns the AEGTree of the current proof step. Returns an empty AEGTree if no steps were taken.
* Copies and returns the AEGTree of the current proof step. Returns an empty AEGTree
* if no steps were taken.
*
* @returns AEGTree of the current proof step.
*/
Expand All @@ -26,7 +27,8 @@ export function getCurrentProofTree(): AEGTree {
}

/**
* Checks and returns if the incoming node can be inserted into the incoming AEGTree and the proof's copy of the incoming AEGTree.
* Checks and returns if the incoming node can be inserted into the incoming AEGTree and
* the proof's copy of the incoming AEGTree.
*
* @param currentNode Incoming node.
* @returns True if currentNode can be inserted into tree and the proof's copy of tree.
Expand Down

0 comments on commit 32eb312

Please sign in to comment.