storeObjectArrayAddressRef.js 771 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. import { StoreObject } from './storeObject';
  2. export class StoreObjectArrayAddressRef extends StoreObject {
  3. constructor (address) {
  4. super(null, null, false);
  5. this.address = address;
  6. }
  7. get isRef () {
  8. return true;
  9. }
  10. get type () {
  11. return this.address.type;
  12. }
  13. get value () {
  14. return this.address.value;
  15. }
  16. get number () {
  17. if (this.value instanceof BigNumber) {
  18. return this.value.toNumber();
  19. } else {
  20. return null;
  21. }
  22. }
  23. getRefObj () {
  24. return this.address.refValue;
  25. }
  26. updateRef (stoObj) {
  27. const newArray = this.address.updateArrayObject(stoObj);
  28. this.address.store.updateStore(this.address.refID, newArray);
  29. }
  30. isCompatible (another) {
  31. return this.address.isCompatible(another);
  32. }
  33. }