edu.stanford.protege.widgetmap.shared.node.Node Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of widgetmap Show documentation
Show all versions of widgetmap Show documentation
widgetmap is a GWT library that provides a treemap-like nesting for Widget
package edu.stanford.protege.widgetmap.shared.node;
import com.google.gwt.user.client.rpc.IsSerializable;
import javax.annotation.Nullable;
import java.util.Optional;
import java.util.Set;
import static com.google.common.base.Preconditions.checkNotNull;
/**
* Author: Matthew Horridge
* Stanford University
* Bio-Medical Informatics Research Group
* Date: 05/12/2013
*/
public abstract class Node implements IsSerializable {
@Nullable
private ParentNode parent = null;
protected Node() {
}
public abstract O accept(NodeVisitor visitor);
public abstract Node duplicate();
public abstract Set getTerminalNodes();
public abstract boolean isIsometricWith(Node otherNode);
public abstract boolean equalsIgnoreWeights(Node other);
public abstract boolean isParentNode();
public abstract Node minimise();
/**
* Gets the parent of this node.
*
* @return The optional parent of this node. Not {@code null}. If this node does not have any parent then
* {@link com.google.common.base.Optional#absent()} is returned.
*/
public Optional getParent() {
return Optional.ofNullable(parent);
}
/**
* Should only be called by {@link edu.stanford.protege.widgetmap.shared.node.ParentNode} objects to set themselves
* as the parent of this {@link Node}.
*
* @param parent The parent. Not {@code null}.
* @throws java.lang.NullPointerException is {@code parent} is {@code null}.
*/
protected void setParent(Optional parent) {
this.parent = checkNotNull(parent).orElse(null);
}
/**
* Removes this node from its parent node.
*/
public void removeFromParent() {
if (parent != null) {
parent.removeChild(this);
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy