public TissueLikeMembraneStructure(MembraneStructure membrane, Psystem psystem) { super(); if (psystem == null) throw new NullPointerException(); this.psystem = psystem; Iterator<? extends Membrane> it; cells = new HashMap<String, List<TissueLikeMembrane>>(); cellsById = new LinkedHashMap<Integer, TissueLikeMembrane>(); if (membrane instanceof CellLikeSkinMembrane) { CellLikeSkinMembrane clm = (CellLikeSkinMembrane) membrane; it = clm.getChildMembranes().iterator(); String environmentLabel = clm.getLabel(); environment = new TissueLikeEnvironment(environmentLabel, this); secureAdd(environment); } else if (membrane instanceof TissueLikeMembraneStructure) { TissueLikeMembraneStructure tls = (TissueLikeMembraneStructure) membrane; environment = new TissueLikeEnvironment(tls.getEnvironmentLabel(), this); environment.getMultiSet().addAll(tls.getEnvironment()); secureAdd(environment); it = membrane.getAllMembranes().iterator(); } else throw new IllegalArgumentException("The membrane structure must be tissue-like"); while (it.hasNext()) { Membrane m = it.next(); if (m.getLabel().equals(environment.getLabel())) { if (membrane instanceof CellLikeSkinMembrane) throw new IllegalArgumentException( "The environment label cannot be used as membrane label"); } else add(new TissueLikeMembrane(m, this)); } }
public String getEnvironmentLabel() { return environment.getLabel(); }
public InfiniteMultiSet<String> getEnvironment() { return (InfiniteMultiSet<String>) environment.getMultiSet(); }