Search Results

Search found 1 results on 1 pages for 'user1826663'.

Page 1/1 | 1 

  • Scala: recursive search avoiding cycles

    - by user1826663
    How can I write a recursive search that I avoid cycles. My class is this: class Component(var name: String, var number: Int, var subComponent: Set[Component]) Now I need a way to check whether a component is contained within its subcomponent or between subcomponent of its subcomponent and so on.Avoiding possible cycles caused by other Component. My method of recursive search must have the following signature, where subC is the Set [component] of comp. def content (comp: Component, subC: Set[Component]) : Boolean = { } Thanks for the help.

    Read the article

1