Mercurial Hosting > luan
view src/luan/impl/Pointer.java @ 1801:32e77b071e09 default tip
webserver logging
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Tue, 12 Mar 2024 09:28:39 -0600 |
parents | c922446f53aa |
children |
line wrap: on
line source
package luan.impl; import luan.LuanMutable; import luan.LuanException; public final class Pointer implements LuanMutable { private Object o; private boolean immutable = false; public Pointer() {} public Pointer(Object o) { this.o = o; } @Override public boolean isImmutable() { return immutable; } @Override public void makeImmutable() { if(immutable) return; immutable = true; LuanMutable.makeImmutable(o); } public Object get() { return o; } public void set(Object o) throws LuanException { if( immutable ) throw new LuanException("variable is immutable"); this.o = o; } }