| /******************************************************************************* |
| * Copyright (c) 2009,2010 IBM Corporation and others. |
| * All rights reserved. This program and the accompanying materials |
| * are made available under the terms of the Eclipse Public License v1.0 |
| * which accompanies this distribution, and is available at |
| * http://www.eclipse.org/legal/epl-v10.html |
| * |
| * Contributors: |
| * IBM Corporation - initial API and implementation |
| *******************************************************************************/ |
| package org.eclipse.stem.diseasemodels.multipopulation.provider; |
| |
| import org.eclipse.emf.common.notify.Adapter; |
| import org.eclipse.emf.common.util.EList; |
| import org.eclipse.stem.core.common.StringValueList; |
| import org.eclipse.stem.definitions.adapters.population.PopulationEnumerator; |
| import org.eclipse.stem.definitions.adapters.population.PopulationEnumeratorAdapter; |
| import org.eclipse.stem.diseasemodels.multipopulation.MultiPopulationSIDiseaseModel; |
| |
| public class MultipopulationPopulationEnumeratorAdapter extends |
| PopulationEnumeratorAdapter implements Adapter { |
| |
| @Override |
| public String[] getPopulationIdentifiers() { |
| MultiPopulationSIDiseaseModel dm = (MultiPopulationSIDiseaseModel)getTarget(); |
| |
| StringValueList list = dm.getPopulationGroups(); |
| EList<org.eclipse.stem.core.common.StringValue> vals = list.getValues(); |
| String [] res = new String[vals.size()]; |
| for(int i=0;i<vals.size();++i) |
| res[i] = vals.get(i).getValue(); |
| return res; |
| } |
| |
| /** |
| * isAdapterForType. True if type is a population enumerator |
| * @param type the type. |
| * @return <code>false</code> |
| */ |
| public boolean isAdapterForType(Object type) |
| { |
| if(type.equals(PopulationEnumerator.class)) |
| return true; |
| return false; |
| } |
| } |