Newer
Older
CosmosClient / app / src / test / java / com / example / cosmosclient / Container.java
package com.example.cosmosclient;

import com.fasterxml.jackson.annotation.JsonIgnore;

import java.util.ArrayList;

public class Container {
    private ArrayList<Component> components = new ArrayList<>();

    public ArrayList<Component> getComponents() {
        return components;
    }

    public void setComponents(ArrayList<Component> components) {
        this.components = components;
    }

    public void addComponent(Component c) {
        components.add(c);
    }

    public Component getComponent(int index) {
        return components.get(index);
    }

    public void removeComponent(int index) {
        components.remove(index);
    }

    @JsonIgnore
    public int getComponentsCount() {
        return components.size();
    }

    @Override
    public boolean equals(Object other) {
        if (!(other instanceof Container)) return false;
        return components.equals(((Container)other).components);
    }
}