All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.opendaylight.protocol.bgp.flowspec.handlers.AbstractNumericByteOperandParser Maven / Gradle / Ivy

There is a newer version: 0.22.6
Show newest version
/*
 * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
 *
 * This program and the accompanying materials are made available under the
 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
 * and is available at http://www.eclipse.org/legal/epl-v10.html
 */
package org.opendaylight.protocol.bgp.flowspec.handlers;

import java.util.List;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.NumericOperand;

/**
 * Common parent class for numeric byte operands.
 *
 * @param  numeric operand type
 */
abstract class AbstractNumericByteOperandParser extends AbstractNumericOperandParser {

    @Override
    public final  String toString(final List list) {
        final StringBuilder buffer = new StringBuilder();
        boolean isFirst = true;
        for (final T item : list) {
            buffer.append(super.toString(getOp(item), isFirst));
            buffer.append(getValue(item));
            buffer.append(' ');
            if (isFirst) {
                isFirst = false;
            }
        }
        return buffer.toString();
    }

    abstract  V getValue(T item);

    abstract  NumericOperand getOp(T item);
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy