1 / 6

Linear Recursive Structures(LRS)

Linear Recursive Structures(LRS). Based on paper by D.Nyguen. Recursive Definition. List is an Empty list Or a NonEmptyList with a head Object and a tail which is a List.

Download Presentation

Linear Recursive Structures(LRS)

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Linear Recursive Structures(LRS) Based on paper by D.Nyguen B.Ramamurthy

  2. Recursive Definition • List is an Empty list • Or a NonEmptyList with a head Object and a tail which is a List. • Empty list is typically represented by “null” giving rise to the famous NullPointerException. In this paper, EmptyList is represented by a NullObject (Pattern). B.Ramamurthy

  3. head head tail tail Object Object List List NonEmptyList List: head tail head tail List: Object Object List (can be empty) head tail head tail List: Object Object B.Ramamurthy

  4. State-pattern based approach Add an Object Remove An object Add an Object NonEmpty Empty Remove an Object singleton Represents all Possible nonEmpty states B.Ramamurthy

  5. List operations (add, remove) • List operations depend on the state of the list. • Define a class hierarchy for state and polymorphically delegate the operations to the different types of states. • Using State pattern: an abstract class specifies operations that are state dependent. A concrete class is defined for each discrete/functionally distinguishable state. B.Ramamurthy

  6. UML Class Diagram

More Related