Skip to content

Commit

Permalink
Eliminate SetRequestState
Browse files Browse the repository at this point in the history
References #8
  • Loading branch information
andreashuber-lawo committed Jan 6, 2016
1 parent 60859a4 commit e45bf10
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 20 deletions.
11 changes: 6 additions & 5 deletions Lawo.EmberPlusSharp/Model/Element.cs
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,12 @@ internal bool HasChanges
}
}

internal virtual RequestState RequestState
{
get { return RequestState.Complete; }
set { } // Intentionally empty
}

internal void SetContext(Context context)
{
this.parent = context.Parent;
Expand Down Expand Up @@ -193,11 +199,6 @@ internal void SetConsumerValue<T>(ref T field, T newValue, [CallerMemberName] st
}
}

internal virtual void SetRequestState(bool isEmpty, ref RequestState newRequestState)
{
newRequestState = RequestState.Complete;
}

internal abstract RequestState ReadContents(EmberReader reader, ElementType actualType);

/// <summary>Recursively reads the children of an element as they appear in the message payload and returns
Expand Down
18 changes: 4 additions & 14 deletions Lawo.EmberPlusSharp/Model/ElementWithSchemas.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,10 @@ internal ElementWithSchemas(RequestState onlineRequestState)
}

/// <summary>Gets or sets the request state.</summary>
/// <remarks>This property (along with its backing fields) has nothing to do with schemas. However, it so
/// happens that all subclasses (parameters, nodes and matrices) need this member. If this fact ever changes, it
/// probably makes sense to move this member to its own base class (named e.g. RequestedElement).</remarks>
internal RequestState RequestState
/// <remarks>This implementation has nothing to do with schemas. However, it so happens that this member has the
/// same behavior for all subclasses (parameters, nodes and matrices). If this fact ever changes, it probably
/// makes sense to move this member to its own base class (named e.g. RequestedElement).</remarks>
internal override RequestState RequestState
{
get
{
Expand All @@ -85,16 +85,6 @@ internal RequestState RequestState
}
}

internal sealed override void SetRequestState(bool isEmpty, ref RequestState newRequestState)
{
if (isEmpty)
{
base.SetRequestState(isEmpty, ref newRequestState);
}

this.RequestState = newRequestState;
}

internal override RequestState UpdateRequestState(bool throwForMissingRequiredChildren)
{
if (!this.IsOnline || (this.RequestState.Equals(RequestState.Complete) &&
Expand Down
7 changes: 6 additions & 1 deletion Lawo.EmberPlusSharp/Model/NodeBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,12 @@ private void ReadChild(EmberReader reader, ElementType actualType, int number)

if (child != null)
{
child.SetRequestState(isEmpty, ref childRequestState);
if (isEmpty)
{
childRequestState = RequestState.Complete;
}

child.RequestState = childRequestState;
}

this.RequestState =
Expand Down

0 comments on commit e45bf10

Please sign in to comment.