Path: csiph.com!eternal-september.org!feeder.eternal-september.org!reader01.eternal-september.org!.POSTED!not-for-mail From: Eric Sosman Newsgroups: comp.lang.java.programmer Subject: Re: How bad i are my coding skills? Date: Mon, 30 Dec 2019 08:51:41 -0500 Organization: A noiseless patient Spider Lines: 29 Message-ID: References: <28133f49-0465-447d-9a34-062fb8c82ea1@googlegroups.com> <5d7de6a8-eb4a-462c-989a-1c27a714aa03@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Mon, 30 Dec 2019 13:51:43 -0000 (UTC) Injection-Info: reader02.eternal-september.org; posting-host="01d439dd50d5461ab5b730ec52342d0d"; logging-data="24947"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX18/RvYFvSbb1bnx9/WNqDCp" User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.3.1 Cancel-Lock: sha1:yn53UyztjlCboB1BDjrxgfFaknM= In-Reply-To: Content-Language: en-US Xref: csiph.com comp.lang.java.programmer:39245 On 12/30/2019 8:13 AM, chad altenburg wrote: > [...] Internally, the data has the format like > > [StartHour, StartMinute, StartAmOrPm, EndHour, EndMinute, EndAmOrPm] Unless there's some overriding reason to retain this complexity (that may be; I have only a vague notion of what your app does), I'd suggest simplifying this to two java.util.Date objects, or even to two long's (milliseconds since zero). Comparisons, arithmetic, adjustments, ... will all be easier if an Interval is described by a pair of data items than by a sextet. You can easily convert between the internal and external representations as needed, while simplifying a lot of the internal manipulations. > Now what happens say I want to add a flag to switch this data because I want to take the day off. Yes, I can clear the data. But I would still need an additional piece of data added to this format so when if I traverse of this list, the app knows to do whatever when it sees the "day off" flag. Again I'm not 100% clear on what you're trying to do, but it seems to me that the Interval should be mostly independent of its associated flags and statuses and things. Perhaps (only "perhaps") what you want is a Map or Map>, or maybe just List busy = ... List idle = ... List awol = ... ... -- esosman@comcast-dot-net.invalid Three hundred eighty-seven days to go.