/** * Constructor. Creates a new node with the given name. * * @param name name of this logical node. */ public LogicalNode(final String name) { super(); this.name = requireNonNull(name); this.type = Type.byName(name); }
/** * Constructor. Creates a new node with the given type. * * @param type type of this logical node. * @param subNodes the Nodes to add directly as children. */ public LogicalNode(final Type type, final Collection<Node> subNodes) { super(); this.type = type; this.name = type.getName(); getChildren().addAll(subNodes); }
@SuppressWarnings("squid:S109") @Override public int hashCode() { final int prime = 31; int result = super.hashCode(); result = (prime * result) + ((name == null) ? 0 : name.hashCode()); result = (prime * result) + ((type == null) ? 0 : type.hashCode()); return result; } // CS:ON hashCode()
/** * Constructor. Creates a new node with the given type. * * @param type type of this logical node. */ public LogicalNode(final Type type) { super(); this.type = type; this.name = type.getName(); }