Skip to content

Commit

Permalink
First pass of GraphConfig class
Browse files Browse the repository at this point in the history
  • Loading branch information
james-strauss-uwa committed Jul 4, 2024
1 parent 946ae38 commit 1701834
Showing 1 changed file with 45 additions and 0 deletions.
45 changes: 45 additions & 0 deletions src/GraphConfig.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
export class GraphConfigField {
private value: string;
}

export class GraphConfigNode {
private fields: Map<string, GraphConfigField>;

constructor(){
this.fields = new Map();
}

addField = (id: string) => {
if (this.fields.has(id)){
return;
}

this.fields.set(id, new GraphConfigField());
}
}

export class GraphConfig {
private nodes: Map<string, GraphConfigNode>;

constructor(){
this.nodes = new Map();
}

addNode = (id:string) => {
if (this.nodes.has(id)){
return;
}

this.nodes.set(id, new GraphConfigNode());
}

addValue = (nodeId: string, fieldId: string, value: string) => {
this.addNode(nodeId);

const node: GraphConfigNode = this.nodes.get(nodeId);

node.addField(fieldId);

const field = node.fields.get(fieldId);

Check failure on line 43 in src/GraphConfig.ts

View workflow job for this annotation

GitHub Actions / Run Simple Test

Property 'fields' is private and only accessible within class 'GraphConfigNode'.
}
}

0 comments on commit 1701834

Please sign in to comment.