// Path: api/src/main/java/com/torchmind/candle/api/IDocumentNode.java
// public interface IDocumentNode extends IObjectNode {
//         String NAME = "###ROOT###";
// 
//         /**
//          * {@inheritDoc}
//          */
//         @Nonnull
//         @Override
//         default IDocumentNode document () {
//                 return this;
//         }
// 
//         /**
//          * {@inheritDoc}
//          */
//         @Override
//         default boolean isDocumentRoot () {
//                 return true;
//         }
// 
//         /**
//          * {@inheritDoc}
//          */
//         @Nonnull
//         @Override
//         default INamedNode name (@Nullable String name) {
//                 throw new UnsupportedOperationException ("Cannot alter node name of root document node");
//         }
// 
//         /**
//          * {@inheritDoc}
//          */
//         @Nonnull
//         @Override
//         default String name () {
//                 return NAME;
//         }
// 
//         /**
//          * {@inheritDoc}
//          */
//         @Nonnull
//         @Override
//         default NodeType type () {
//                 return NodeType.DOCUMENT;
//         }
// }
// 
// Path: api/src/main/java/com/torchmind/candle/api/INode.java
// public interface INode {
// 
//         /**
//          * Retrieves the parent document node.
//          *
//          * @return The node.
//          */
//         @Nonnull
//         IDocumentNode document ();
// 
//         /**
//          * Ensures that a node consists of a certain type.
//          *
//          * @param type The type.
//          * @return The node.
//          *
//          * @throws java.lang.IllegalStateException when the node type differs.
//          */
//         @Nonnull
//         INode ensureType (@Nonnull NodeType type) throws IllegalStateException;
// 
//         /**
//          * Retrieves the node type.
//          *
//          * @return The type.
//          */
//         @Nonnull
//         NodeType type ();
// }
// 
// Path: api/src/main/java/com/torchmind/candle/api/NodeType.java
// public enum NodeType {
//         /**
//          * Represents a Single-Line or Multi-Line comment.
//          * Nodes that identify themselves as comment nodes implement {@link com.torchmind.candle.api.ICommentNode}.
//          */
//         COMMENT,
// 
//         /**
//          * Represents an inclusion.
//          * <strong>Note:</strong> There are no definitions for this node type yet as this type has not been fully documented
//          * in the Candle specification yet.
//          */
//         INCLUDE,
// 
//         /**
//          * Represents a document.
//          * Nodes that identify themselves as document nodes implement {@link com.torchmind.candle.api.IDocumentNode}.
//          */
//         DOCUMENT,
// 
//         /**
//          * Represents an object.
//          * Nodes that identify themselves as object nodes implement {@link com.torchmind.candle.api.IObjectNode}.
//          */
//         OBJECT,
// 
//         /**
//          * Represents a property.
//          * Nodes that identify themselves as property nodes implement {@link com.torchmind.candle.api.IPropertyNode}.
//          */
//         PROPERTY
// }


import com.torchmind.candle.api.IDocumentNode;
import com.torchmind.candle.api.INode;
import com.torchmind.candle.api.NodeType;
import javax.annotation.Nonnull;
/*
 * Copyright 2015 Johannes Donath <johannesd@torchmind.com>
 * and other copyright owners as documented in the project's IP log.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * 	http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.torchmind.candle.node;



/**
 * Provides an abstract utility implementation of {@link com.torchmind.candle.api.INode}.
 *
 * @author Johannes Donath
 */
public abstract class AbstractNode implements INode {
        private IDocumentNode documentNode;

        protected AbstractNode () { }

        public AbstractNode (@Nonnull IDocumentNode documentNode) {
                super ();

                this.documentNode = documentNode;
        }

        /**
         * {@inheritDoc}
         */
        @Nonnull
        @Override
        public IDocumentNode document () {
                return this.documentNode;
        }

        /**
         * {@inheritDoc}
         */
        @Nonnull
        @Override
// Path: api/src/main/java/com/torchmind/candle/api/IDocumentNode.java
// public interface IDocumentNode extends IObjectNode {
//         String NAME = "###ROOT###";
// 
//         /**
//          * {@inheritDoc}
//          */
//         @Nonnull
//         @Override
//         default IDocumentNode document () {
//                 return this;
//         }
// 
//         /**
//          * {@inheritDoc}
//          */
//         @Override
//         default boolean isDocumentRoot () {
//                 return true;
//         }
// 
//         /**
//          * {@inheritDoc}
//          */
//         @Nonnull
//         @Override
//         default INamedNode name (@Nullable String name) {
//                 throw new UnsupportedOperationException ("Cannot alter node name of root document node");
//         }
// 
//         /**
//          * {@inheritDoc}
//          */
//         @Nonnull
//         @Override
//         default String name () {
//                 return NAME;
//         }
// 
//         /**
//          * {@inheritDoc}
//          */
//         @Nonnull
//         @Override
//         default NodeType type () {
//                 return NodeType.DOCUMENT;
//         }
// }
// 
// Path: api/src/main/java/com/torchmind/candle/api/INode.java
// public interface INode {
// 
//         /**
//          * Retrieves the parent document node.
//          *
//          * @return The node.
//          */
//         @Nonnull
//         IDocumentNode document ();
// 
//         /**
//          * Ensures that a node consists of a certain type.
//          *
//          * @param type The type.
//          * @return The node.
//          *
//          * @throws java.lang.IllegalStateException when the node type differs.
//          */
//         @Nonnull
//         INode ensureType (@Nonnull NodeType type) throws IllegalStateException;
// 
//         /**
//          * Retrieves the node type.
//          *
//          * @return The type.
//          */
//         @Nonnull
//         NodeType type ();
// }
// 
// Path: api/src/main/java/com/torchmind/candle/api/NodeType.java
// public enum NodeType {
//         /**
//          * Represents a Single-Line or Multi-Line comment.
//          * Nodes that identify themselves as comment nodes implement {@link com.torchmind.candle.api.ICommentNode}.
//          */
//         COMMENT,
// 
//         /**
//          * Represents an inclusion.
//          * <strong>Note:</strong> There are no definitions for this node type yet as this type has not been fully documented
//          * in the Candle specification yet.
//          */
//         INCLUDE,
// 
//         /**
//          * Represents a document.
//          * Nodes that identify themselves as document nodes implement {@link com.torchmind.candle.api.IDocumentNode}.
//          */
//         DOCUMENT,
// 
//         /**
//          * Represents an object.
//          * Nodes that identify themselves as object nodes implement {@link com.torchmind.candle.api.IObjectNode}.
//          */
//         OBJECT,
// 
//         /**
//          * Represents a property.
//          * Nodes that identify themselves as property nodes implement {@link com.torchmind.candle.api.IPropertyNode}.
//          */
//         PROPERTY
// }


// Path: core/src/main/java/com/torchmind/candle/node/AbstractNode.java
import com.torchmind.candle.api.IDocumentNode;
import com.torchmind.candle.api.INode;
import com.torchmind.candle.api.NodeType;
import javax.annotation.Nonnull;

/*
 * Copyright 2015 Johannes Donath <johannesd@torchmind.com>
 * and other copyright owners as documented in the project's IP log.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * 	http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.torchmind.candle.node;



/**
 * Provides an abstract utility implementation of {@link com.torchmind.candle.api.INode}.
 *
 * @author Johannes Donath
 */
public abstract class AbstractNode implements INode {
        private IDocumentNode documentNode;

        protected AbstractNode () { }

        public AbstractNode (@Nonnull IDocumentNode documentNode) {
                super ();

                this.documentNode = documentNode;
        }

        /**
         * {@inheritDoc}
         */
        @Nonnull
        @Override
        public IDocumentNode document () {
                return this.documentNode;
        }

        /**
         * {@inheritDoc}
         */
        @Nonnull
        @Override
        public AbstractNode ensureType (@Nonnull NodeType type) throws IllegalStateException {