Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [january-dev] immutable

Hi Matt,


Feel free to add a PR for a read-only dataset – maybe as a flag that data writes can check against and throw UnsupportedOperationExceptions (there’s a setDirty call which can be repurposed). Remember to propagate to new views. Note existing views will be able to modify them so perhaps you can only make copies modifiable.


Be able to set copy-on-write on datasets would be handy too…






From: january-dev-bounces@xxxxxxxxxxx [mailto:january-dev-bounces@xxxxxxxxxxx] On Behalf Of Matthew Gerring
Sent: 17 October 2017 12:14
To: january developer discussions <january-dev@xxxxxxxxxxx>
Subject: [january-dev] immutable




Is there a way to make Dataset immutable like when you call Collections.unmodifiableList(...)


I have some code which currently always does an arraycopy on the float[] before returning data from getters. If I replaced the float[] with FloatDataset which had been made immutable, I would not have to copy the data to retain encapsulation.





This e-mail and any attachments may contain confidential, copyright and or privileged material, and are for the use of the intended addressee only. If you are not the intended addressee or an authorised recipient of the addressee please notify us of receipt by returning the e-mail and do not use, copy, retain, distribute or disclose the information in or attached to the e-mail.
Any opinions expressed within this e-mail are those of the individual and not necessarily of Diamond Light Source Ltd.
Diamond Light Source Ltd. cannot guarantee that this e-mail or any attachments are free from viruses and we cannot accept liability for any damage which you may sustain as a result of software viruses which may be transmitted in or with the message.
Diamond Light Source Limited (company no. 4375679). Registered in England and Wales with its registered office at Diamond House, Harwell Science and Innovation Campus, Didcot, Oxfordshire, OX11 0DE, United Kingdom

Back to the top