Mercurial Hosting > luan
view src/luan/impl/Pointer.java @ 1562:b89212fd04b5
remove table.luan
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Sun, 08 Nov 2020 16:50:59 -0700 |
parents | e1a13e707bf3 |
children | c922446f53aa |
line wrap: on
line source
package luan.impl; import luan.LuanCloneable; import luan.LuanCloner; import luan.LuanImmutabler; import luan.LuanException; public final class Pointer implements LuanCloneable { private Object o; private boolean immutable = false; public Pointer() {} public Pointer(Object o) { this.o = o; } @Override public Pointer shallowClone() { return new Pointer(); } @Override public void deepenClone(LuanCloneable clone,LuanCloner cloner) { ((Pointer)clone).o = cloner.get(o); } @Override public void makeImmutable(LuanImmutabler immutabler) throws LuanException { immutabler.makeImmutable(o); immutable = true; } public Object get() { return o; } public void set(Object o) throws LuanException { if( immutable ) throw new LuanException("variable is immutable"); this.o = o; } }