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

io.ciera.tool.sql.architecture.interfaces.impl.MessageSetImpl Maven / Gradle / Ivy

package io.ciera.tool.sql.architecture.interfaces.impl;


import io.ciera.runtime.summit.classes.InstanceSet;
import io.ciera.runtime.summit.exceptions.XtumlException;
import io.ciera.tool.sql.architecture.interfaces.IfaceSet;
import io.ciera.tool.sql.architecture.interfaces.Message;
import io.ciera.tool.sql.architecture.interfaces.MessageSet;
import io.ciera.tool.sql.architecture.interfaces.PortMessageSet;
import io.ciera.tool.sql.architecture.interfaces.impl.IfaceSetImpl;
import io.ciera.tool.sql.architecture.interfaces.impl.PortMessageSetImpl;

import java.util.Arrays;
import java.util.Comparator;
import java.util.List;


public class MessageSetImpl extends InstanceSet implements MessageSet {

    public MessageSetImpl() {
    }

    public MessageSetImpl(Comparator comp) {
        super(comp);
    }

    // attributes
    @Override
    public void setName( String m_name ) throws XtumlException {
        for ( Message message : this ) message.setName( m_name );
    }
    @Override
    public void setIface_name( String ref_iface_name ) throws XtumlException {
        for ( Message message : this ) message.setIface_name( ref_iface_name );
    }
    @Override
    public void setId( int m_id ) throws XtumlException {
        for ( Message message : this ) message.setId( m_id );
    }
    @Override
    public void setIface_package( String ref_iface_package ) throws XtumlException {
        for ( Message message : this ) message.setIface_package( ref_iface_package );
    }
    @Override
    public void setTo_provider( boolean m_to_provider ) throws XtumlException {
        for ( Message message : this ) message.setTo_provider( m_to_provider );
    }


    // selections
    @Override
    public IfaceSet R419_defines_message_format_for_Iface() throws XtumlException {
        IfaceSet ifaceset = new IfaceSetImpl();
        for ( Message message : this ) ifaceset.add( message.R419_defines_message_format_for_Iface() );
        return ifaceset;
    }
    @Override
    public PortMessageSet R420_is_implemented_within_PortMessage() throws XtumlException {
        PortMessageSet portmessageset = new PortMessageSetImpl();
        for ( Message message : this ) portmessageset.addAll( message.R420_is_implemented_within_PortMessage() );
        return portmessageset;
    }


    @Override
    public Message nullElement() {
        return MessageImpl.EMPTY_MESSAGE;
    }

    @Override
    public MessageSet emptySet() {
      return new MessageSetImpl();
    }

    @Override
    public MessageSet emptySet(Comparator comp) {
      return new MessageSetImpl(comp);
    }

    @Override
    public List elements() {
        Message[] elements = toArray(new Message[0]);
        Arrays.sort(elements, (a, b) -> {
            try {
                return a.getName().compareTo(b.getName());
            } catch (XtumlException e) { return 0; }
        });
        return Arrays.asList(elements);
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy