/// <summary> /// Initialises a new Content Model Group. /// </summary> /// <param name="parent">The parent model group.</param> public Group( Group parent ) { Parent = parent; _members = new ArrayList(); _groupType = GroupType.None; Occurrence = Occurrence.Required; }
/// <summary> /// Adds a new child model group to the end of the group's members. /// </summary> /// <param name="g">The model group to add.</param> public void AddGroup( Group g ) { _members.Add( g ); }
/// <summary> /// Initialises a new instance of the <see cref="ContentModel"/> class. /// </summary> public ContentModel() { _model = new Group( null ); }
/// <summary> /// Finishes processing of a nested model group. /// </summary> /// <returns>The current depth of the group nesting, or -1 if there are no more groups to pop.</returns> public int PopGroup() { if( CurrentDepth == 0 ) return -1; CurrentDepth--; _model.Parent.AddGroup( _model ); _model = _model.Parent; return CurrentDepth; }
/// <summary> /// Begins processing of a nested model group. /// </summary> public void PushGroup() { _model = new Group( _model ); CurrentDepth++; }