public <T extends HasField> boolean has(T hf) { return has(hf.getField()); }
public void setFromSTObject(STObject so) { if (so.has(AccountID.Account)) Account = so.get(AccountID.Account); if (so.has(Amount.Balance)) Balance = so.get(Amount.Balance); if (so.has(UInt32.Sequence)) Sequence = so.get(UInt32.Sequence); if (so.has(UInt32.OwnerCount)) OwnerCount = so.get(UInt32.OwnerCount); if (so.has(UInt32.Flags)) Flags = so.get(UInt32.Flags); if (so.has(Hash256.PreviousTxnID)) PreviousTxnID = so.get(Hash256.PreviousTxnID); if (so.has(UInt32.PreviousTxnLgrSeq)) PreviousTxnLgrSeq = so.get(UInt32.PreviousTxnLgrSeq); notifyUpdate(); }
public Map<AccountID, STObject> modifiedRoots() { HashMap<AccountID, STObject> accounts = null; if (meta.has(Field.AffectedNodes)) { accounts = new HashMap<AccountID, STObject>(); STArray affected = meta.get(STArray.AffectedNodes); for (STObject node : affected) { if (node.has(Field.ModifiedNode)) { node = node.get(STObject.ModifiedNode); if (STObject.ledgerEntryType(node) == LedgerEntryType.AccountRoot) { STObject finalFields = node.get(STObject.FinalFields); AccountID key; if (finalFields != null) { key = finalFields.get(AccountID.Account); accounts.put(key, node); } } } } } return accounts; }
public void checkFormat() { Format fmt = getFormat(); EnumMap<Field, Format.Requirement> requirements = fmt.requirements(); for (Field field : this) { if (!requirements.containsKey(field)) { throw new FormatException(fmt.name() + " doesn't have field: " + field); } } for (Field field : requirements.keySet()) { Format.Requirement req = requirements.get(field); if (!has(field)) { if (req == Format.Requirement.REQUIRED) { throw new FormatException(fmt.name() + " requires " + field + " of type " + field.getType()); } } else { SerializedType type = get(field); if (type.type() != field.getType()) { if (!(field.getType() == Type.Hash160 && type.type() == Type.AccountID)) { throw new FormatException(type.toString() + " is not " + field.getType()); } } } } }
break; case DirectoryNode: if (source.has(Field.Owner)) { constructed = new DirectoryNode(); } else {
public AccountID createdAccount() { AccountID destination = null; Hash256 destinationIndex = null; if (transactionType() == TransactionType.Payment && meta.has(Field.AffectedNodes)) { STArray affected = meta.get(STArray.AffectedNodes); for (STObject node : affected) { if (node.has(STObject.CreatedNode)) { STObject created = node.get(STObject.CreatedNode); if (STObject.ledgerEntryType(created) == LedgerEntryType.AccountRoot) { if (destination == null) { destination = txn.get(AccountID.Destination); destinationIndex = Index.accountRoot(destination); } if (destinationIndex.equals(created.get(Hash256.LedgerIndex))) { return destination; } } } } } return null; }
Field.FinalFields; if (!wrapped.has(finalFields)) { STObject source = new STObject(wrapped.getFields()); source.put(Hash256.index, wrapped.get(Hash256.LedgerIndex)); if (layerPrevious && wrapped.has(Field.PreviousFields)) { STObject previous = wrapped.get(STObject.PreviousFields); STObject changed = new STObject();