using System; namespace Substrate.Nbt { /// /// A concrete representing a scaler-type . /// public sealed class SchemaNodeScaler : SchemaNode { private TagType _type; /// /// Gets the scaler that this node represents. /// public TagType Type { get { return _type; } } /// /// Constructs a new representing a named and of type . /// /// The name of the corresponding . /// The type of the corresponding , restricted to scaler types. public SchemaNodeScaler (string name, TagType type) : base(name) { _type = type; } /// /// Constructs a new with additional options. /// /// The name of the corresponding . /// The type of the corresponding , restricted to scaler types. /// One or more option flags modifying the processing of this node. public SchemaNodeScaler (string name, TagType type, SchemaOptions options) : base(name, options) { _type = type; } /// /// Constructs a default according to the this node represents. /// /// A with a sensible default value. public override TagNode BuildDefaultTree () { switch (_type) { case TagType.TAG_STRING: return new TagNodeString(); case TagType.TAG_BYTE: return new TagNodeByte(); case TagType.TAG_SHORT: return new TagNodeShort(); case TagType.TAG_INT: return new TagNodeInt(); case TagType.TAG_LONG: return new TagNodeLong(); case TagType.TAG_FLOAT: return new TagNodeFloat(); case TagType.TAG_DOUBLE: return new TagNodeDouble(); } return null; } } }