I want to implement a linkedList with Grails domain classes. The base class is the following:
class Node {
String text
Node predecessor
Node successor
public static remove(Node n) {
def node = Node.get(n)
node.delete()
}
}
A node can have 0 or 1 predecessor Node and 0 or 1 successor Nodes.
How do I implement the following operations such that they work with GORM?
- Node get(int index)
- void add(Node n)
- void add(Node n, int index)
- remove(int index)
- remove Node n)