001/*
002 * Copyright (c) 2006-2011 Nuxeo SA (http://nuxeo.com/) and others.
003 *
004 * All rights reserved. This program and the accompanying materials
005 * are made available under the terms of the Eclipse Public License v1.0
006 * which accompanies this distribution, and is available at
007 * http://www.eclipse.org/legal/epl-v10.html
008 *
009 * Contributors:
010 *     Nuxeo - initial API and implementation
011 *
012 * $Id$
013 */
014
015package org.nuxeo.ecm.core.query.sql.model;
016
017import java.util.ArrayList;
018
019/**
020 * @author <a href="mailto:bs@nuxeo.com">Bogdan Stefanescu</a>
021 */
022public class OperandList extends ArrayList<Operand> implements Operand {
023
024    private static final long serialVersionUID = -4527766076726382014L;
025
026    @Override
027    public void accept(IVisitor visitor) {
028        visitor.visitOperandList(this);
029    }
030
031    @Override
032    public String toString() {
033        StringBuilder buf = new StringBuilder();
034        if (isEmpty()) {
035            return "";
036        }
037        buf.append(get(0).toString());
038        for (int i = 1, size = size(); i < size; i++) {
039            buf.append(", ").append(get(i).toString());
040        }
041        return buf.toString();
042    }
043
044}