-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathlink.ts
More file actions
29 lines (26 loc) · 744 Bytes
/
link.ts
File metadata and controls
29 lines (26 loc) · 744 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import Directory from "./directory";
import Node from "./node"
class Link extends Node {
private realNode: Node;
constructor(n: string, w: Node, p: Directory){
super(n,p);
this.realNode = w;
}
public getAbsoluteName() : string{
return super.getAbsoluteName() + "@";
}
public find(s: string) : Array<string> {
let result = new Array<string>();
if (this.name.indexOf(s) != -1){
result.push(this.getAbsoluteName());
}
let resultsViaLink = this.realNode.find(s);
let n = this.realNode.getAbsoluteName().length;
for (let r of resultsViaLink){
let name = super.getAbsoluteName() + "/" + r.substring(n);
result.push(name);
}
return result;
}
}
export default Link