dcsimg
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Jun 2018
    Posts
    1

    Smile Question on converting a new method into a property

    Hi... I am relatively new to Java and object-oriented development. I've written the following Java / Groovy method which works correctly... I've been asked to convert this method into a property...

    Code:
        boolean sortedDescending(columnId) {
            def doubleFormat = NumberFormat.instance
            def originalList = txnTable.column(columnId).collect { it.text() }
            def descendingSortedList = originalList.sort(false) { it ? -doubleFormat.parse(it) : Double.POSITIVE_INFINITY }
            return (descendingSortedList == originalList)
        }
    Here is part of a class and my first incorrect attempt:

    Code:
    class TransactionTable extends Module {
    
        boolean sortedDescending
    
        void setSortedDescending(columnId) {
            def doubleFormat = NumberFormat.instance
            def originalList = txnTable.column(columnId).collect { it.text() }
            def descendingSortedList = originalList.sort(false) { it ? -doubleFormat.parse(it) : Double.POSITIVE_INFINITY }
            this.sortedDescending = (descendingSortedList == originalList)
        }
    If you have any tips on how I can convert the above method into a property that would be wonderful.
    All I really want to do is set sortedDescending to be true or false based on the comparison:
    descendingSortedList == originalList

    ... Rich

  2. #2
    Join Date
    Jun 1999
    Location
    Eastern Florida
    Posts
    3,787

    Re: Question on converting a new method into a property

    Norm

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width




On-Demand Webinars (sponsored)