Creates a new instance of the LogMetadata class which contains all the ledgers after (and including) the given address.

@param upToAddress The address to truncate to.
@return A new instance of the LogMetadata class.
425468
LogMetadata truncate(LedgerAddress upToAddress) {
        Preconditions.checkState(this.enabled, "Log is not enabled. Cannot perform any modifications on it.");

        // Exclude all those Ledgers that have a LedgerId less than the one we are given. An optimization to this would
        // involve trimming out the ledger which has a matching ledger id and the entry is is the last one, but that would
        // involve opening the Ledger in BookKeeper and inspecting it, which would take too long.
        val newLedgers = this.ledgers.stream().filter(lm -> lm.getLedgerId() >= upToAddress.getLedgerId()).collect(Collectors.toList());
        return new LogMetadata(this.epoch, this.enabled, Collections.unmodifiableList(newLedgers), upToAddress, this.updateVersion.get());
    }
1337133
public static com.liferay.commerce.model.CommerceAddress createCommerceAddress(
		long commerceAddressId) {
		return getService().createCommerceAddress(commerceAddressId);
	}
857679
public MACAddressSection toEUI(boolean extended) {
		MACAddressSegment[] segs = toEUISegments(extended);
		if(segs == null) {
			return null;
		}
		MACAddressCreator creator = getMACNetwork().getAddressCreator();
		return createSectionInternal(creator, segs, Math.max(0, addressSegmentIndex - 4) << 1, extended);
	}
1084526
public void addTo(final Address internetAddress) throws MessagingException
	{
		super.addRecipient(javax.mail.Message.RecipientType.TO, internetAddress);
	}
401709
private IPv6AddressPool doAllocate(final IPv6Network toAllocate, final IPv6AddressRange rangeToAllocateFrom)
    {
        assert freeRanges.contains(rangeToAllocateFrom);
        assert rangeToAllocateFrom.contains(toAllocate);

        final TreeSet<IPv6AddressRange> newFreeRanges = new TreeSet<IPv6AddressRange>(this.freeRanges);

        // remove range from free ranges
        newFreeRanges.remove(rangeToAllocateFrom);

        // from the range, remove the allocated subnet
        final List<IPv6AddressRange> newRanges = rangeToAllocateFrom.remove(toAllocate);

        // and add the resulting ranges as new free ranges
        newFreeRanges.addAll(newRanges);

        return new IPv6AddressPool(underlyingRange, allocationSubnetSize, newFreeRanges, toAllocate);
    }
803910
private static String formatAddress6(int[] hexRepresentation){
       if(hexRepresentation == null){
           throw new NullPointerException();
       }
       if(hexRepresentation.length != IPV6_LEN){
           throw new IllegalArgumentException();
       }
       StringBuilder stringBuilder = new StringBuilder();
       boolean inCompressedSection = false;
       for(int i = 0;i<hexRepresentation.length;i++){
           if(hexRepresentation[i] == -1){
               if(!inCompressedSection){
                   inCompressedSection = true;
                   if(i == 0){
                       stringBuilder.append("::");
                   } else {
                       stringBuilder.append(':');
                   }
               }
           } else {
               inCompressedSection = false;
               stringBuilder.append(Integer.toHexString(hexRepresentation[i]));
               if(i+1<hexRepresentation.length){
                   stringBuilder.append(":");
               }
           }
       }
       return stringBuilder.toString();
    }
1332585
public static Script createOutputScript(Address to) {
        if (to instanceof LegacyAddress) {
            ScriptType scriptType = to.getOutputScriptType();
            if (scriptType == ScriptType.P2PKH)
                return createP2PKHOutputScript(to.getHash());
            else if (scriptType == ScriptType.P2SH)
                return createP2SHOutputScript(to.getHash());
            else
                throw new IllegalStateException("Cannot handle " + scriptType);
        } else if (to instanceof SegwitAddress) {
            ScriptBuilder builder = new ScriptBuilder();
            // OP_0 <pubKeyHash|scriptHash>
            SegwitAddress toSegwit = (SegwitAddress) to;
            builder.smallNum(toSegwit.getWitnessVersion());
            builder.data(toSegwit.getWitnessProgram());
            return builder.build();
        } else {
            throw new IllegalStateException("Cannot handle " + to);
        }
    }
938790
@Override
    public AddressMessage makeAddressMessage(byte[] payloadBytes, int length) throws ProtocolException {
        return new AddressMessage(params, payloadBytes, this, length);
    }
998959
public static ModelNode getParentAddress(final ModelNode address) {
        if (address.getType() != ModelType.LIST) {
            throw new IllegalArgumentException("The address type must be a list.");
        }
        final ModelNode result = new ModelNode();
        final List<Property> addressParts = address.asPropertyList();
        if (addressParts.isEmpty()) {
            throw new IllegalArgumentException("The address is empty.");
        }
        for (int i = 0; i < addressParts.size() - 1; ++i) {
            final Property property = addressParts.get(i);
            result.add(property.getName(), property.getValue());
        }
        return result;
    }
712027
public Address add(Address address) {
        // if address is null or is the root address then there is nothing to append
        if (address == null || address.isRoot()) {
            return this;
        }

        // if we are the root address then the given address just is our new address,
        // otherwise, append all parts from "address" to us.
        if (isRoot()) {
            this.addressNode = address.addressNode.clone();
        } else {
            List<Property> parts = address.addressNode.asPropertyList();
            for (Property part : parts) {
                this.addressNode.add(part);
            }
        }

        return this;
    }
61959
public IPv6AddressRange extend(IPv6Address address)
    {
        if (address.compareTo(first) < 0)
            return fromFirstAndLast(address, last);
        else if (address.compareTo(last) > 0)
            return fromFirstAndLast(first, address);
        else
            return this;
    }
6545
public static ModelNode createUndefineAttributeOperation(PathAddress address, String name) {
        return createAttributeOperation(ModelDescriptionConstants.UNDEFINE_ATTRIBUTE_OPERATION, address, name);
    }
417429
@Override
    public Map<Integer, Long> createUpdatedMap() {
        if (storageFile == null) {
            //In-Memory Stats Storage
            db = DBMaker.memoryDB().make();
        } else {
            db = DBMaker.fileDB(storageFile).closeOnJvmShutdown().transactionEnable() //Default to Write Ahead Log - lower performance, but has crash protection
                            .make();
        }

        updated = db.hashMap("updated").keySerializer(Serializer.INTEGER).valueSerializer(Serializer.LONG)
                        .createOrOpen();
        return updated;
    }
143272
public R setAddress(String address) {
        mBodyMap.put(BoxUser.FIELD_ADDRESS, address);
        return (R) this;
    }
512188
private String createMailToLink(String to, String bcc, String cc,
            String subject, String body) {
        Validate.notNull(to, "You must define a to-address");
        final StringBuilder urlBuilder = new StringBuilder("mailto:");
        addEncodedValue(urlBuilder, "to", to);
        if (bcc != null || cc != null || subject != null || body != null) {
            urlBuilder.append('?');
        }
        addEncodedValue(urlBuilder, "bcc", bcc);
        addEncodedValue(urlBuilder, "cc", cc);
        addEncodedValue(urlBuilder, "subject", subject);
        if (body != null) {
            addEncodedValue(urlBuilder, "body", body.replace("$NL$", "\r\n"));
        }

        return urlBuilder.toString();
    }
366529
private Entry convertToEntries(String newAddress) {
        byte[] ba = null;

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
            Tr.entry(tc, "convertToEntries");
        }

        try {
            ba = newAddress.getBytes("ISO-8859-1");
        } catch (UnsupportedEncodingException x) {
            // should never happen, log a message and use default encoding
            if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
                Tr.event(tc, "ISO-8859-1 encoding not supported.  Exception: " + x);
            }
            ba = newAddress.getBytes();
        }
        int baLength = ba.length;
        int hashValue = 0;
        int hashLength = 0;
        int e31 = 1;

        Entry oEntry = new Entry();

        for (int i = 0; i < baLength; i++) {
            if (ba[i] == WILDCARD_VALUE) {
                boolean valid = true;

                // make sure it is the first entry, followed by a ".", or nothing
                if (i != 0) {
                    valid = false;
                }
                if (baLength >= 2) {
                    if (ba[1] != PERIOD_VALUE) {
                        valid = false;
                    }
                }

                if (valid) {
                    // if isolated, then store it, and continue to next word.
                    // Store as wildcard entry
                    oEntry.addEntry(0, 0);
                    // jump over next period to avoid processing this char again
                    i = 1;
                    // go back to start of for loop
                    continue;
                }
            }

            if (ba[i] != PERIOD_VALUE) {
                // continue calculating hashcode for this entry
                hashValue += e31 * ba[i];
                e31 = e31 * 31;
                hashLength++;
            }
            if ((ba[i] == PERIOD_VALUE) || (i == baLength - 1)) {
                // end of a "word", need to add if length is non-zero
                if (hashLength > 0) {
                    oEntry.addEntry(hashValue, hashLength);
                }
                // prepare to calculate next entry
                hashLength = 0;
                e31 = 1;
                hashValue = 0;
            }
        }

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
            Tr.exit(tc, "convertToEntries");
        }

        return oEntry;
    }
1279952
@Override
    public ExecutionGraphVertex createVertex(String address) {
        // create new vertex object
        ExecutionGraphVertex v = ExecutionGraph.createVertex(removeSymbol(address, '$'));

        // add vertex to actual graph
        this.graph.addVertex(v);

        // put new vertex to set of vertices with the same address, since they
        // all must have the same set of properties and values
        Set<ExecutionGraphVertex> vs = this.addressToVertices.getOrDefault(address, new HashSet<>());
        vs.add(v);
        if (vs.size() - 1 == 0) { this.addressToVertices.put(address, vs); }

        return v;
    }