/**
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements. See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership. The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License. You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied. See the License for the
 * specific language governing permissions and limitations
 * under the License.
 */

package org.apache.cxf.tools.corba.common.idltypes;

import java.io.PrintWriter;

public final class IdlAnonSequence extends IdlSequenceBase {
    
    private IdlAnonSequence(IdlScopeBase parent, IdlType elem, int bound) {
        super(parent, "", elem, bound);
    }
    
    public static IdlAnonSequence create(IdlScopeBase parent, IdlType elem) {
        return new IdlAnonSequence(parent, elem, 0);
    }


    public static IdlAnonSequence create(IdlScopeBase parent, IdlType elem, int bound) {
        return new IdlAnonSequence(parent, elem, bound);
    }


    public String fullName() {
        return seqName(elemType().fullName());
    }


    public String fullName(IdlScopedName rel) {
        return seqName(elemType().fullName(rel));
    }


    public void write(PrintWriter pw) {
        // intentionally empty
    }    

    private String seqName(String name) {
        StringBuffer str = new StringBuffer();
        str.append("sequence<" + name);

        int bnd = bound();

        if (bnd != 0) {
            str.append(", " + bnd);
        }

        str.append("> ");

        return str.toString();
    }
}
