Back to project page sodf.
The source code is released under:
Copyright (c) 2013 Lorenz Lehmann Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Sof...
If you think the Android project sodf listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package lal.sodf.framework.ontology; // w w w .j a v a 2 s .c o m import java.util.List; /** * An interface that has to be implemented by all nodes * @author Lorenz Lehmann * */ public abstract class Node { /** The key to uniquely identify the node on this level of the hirachy */ protected String key; /** The direct parent of this node */ protected Node parent; /** Create a new node with a specific key */ public Node(String _key){ setKey(_key); } /** Create a new node with a specific key as a child of a parent node*/ public Node(KeyNode _parent, String _key){ setParent(_parent); setKey(_key); //tell the parent to include this node as a child if (_parent == null) return; //but not for root nodes _parent.addChild(this); } /** Set the key of this node */ public void setKey(String _key){ this.key = _key; } /** Get the key of this node */ public String getKey(){ return key; } /** Set the parent of this node */ public void setParent(Node _parent){ parent = _parent; } /** Get the parent of this node */ public Node getParent(){ return parent; } /** * Get a child KeyNode with the provided key * @return The KeyNode or null if the found node is a KeyValueNode or does not exist */ public KeyNode getKeyNodeChild(String key) {return null;} /** * Get a child KeyValueNode with the provided key * @return The KeyValueNode or null if the found node is a KeyNode or does not exist */ public KeyValueNode getKeyValueNodeChild(String key) {return null;} /** * Get all children of this node, which are KeyNodes * @return The KeyNodes or an empty Node if this Node has no KeyNodes as children */ public List<KeyNode> getKeyNodeChildren() {return null;} /* (non-Javadoc) * @see java.lang.Object#toString() */ @Override public String toString() { return "Node [key=" + key + "]"; } }