Newer
Older
Architecture / src / main / java / proto / BasePush.java
yoichiro on 4 Jul 2019 846 bytes pull-pull
package proto;

import java.util.ArrayList;

public class BasePush {
	class Customer {
		Company off;
		String add;

		public Customer(Company off) {
			this.off = off;
			off.employees.add(this);
		}

		public Company getOff() {
			return off;
		}

		public void setOff(Company off) {
			this.off = off;
			update();
		}

		public String getAdd() {
			return add;
		}

		public void setAdd(String add) {
			this.add = add;
		}
		
		private void update() {
			this.add = off.getAdd();
		}
	}

	class Company {
		String add;
		ArrayList<Customer> employees = new ArrayList<>();

		public String getAdd() {
			return add;
		}

		public void setAdd(String add) {
			this.add = add;
			update();
		}

		private void update() {
			for (Customer c : employees) {
				c.setAdd(add);
			}
		}
	}
}