| /** |
| * <copyright> |
| * </copyright> |
| * |
| * $Id$ |
| */ |
| package org.eclipse.stem.populationmodels.standard.impl; |
| |
| import java.io.IOException; |
| import java.util.ArrayList; |
| import java.util.Collection; |
| import java.util.HashMap; |
| import java.util.HashSet; |
| import java.util.Iterator; |
| import java.util.List; |
| import java.util.Map; |
| import java.util.Set; |
| |
| import org.eclipse.emf.common.notify.Notification; |
| import org.eclipse.emf.common.util.EList; |
| |
| import org.eclipse.emf.ecore.EClass; |
| import org.eclipse.emf.ecore.EStructuralFeature; |
| |
| import org.eclipse.emf.ecore.impl.ENotificationImpl; |
| import org.eclipse.emf.edit.provider.IItemPropertyDescriptor; |
| import org.eclipse.emf.edit.provider.IItemPropertySource; |
| import org.eclipse.emf.edit.ui.provider.PropertySource; |
| |
| import org.eclipse.stem.analysis.LogInitializationException; |
| import org.eclipse.stem.analysis.util.CSVScenarioStreamer; |
| import org.eclipse.stem.analysis.util.CSVscenarioLoader; |
| import org.eclipse.stem.core.Utility; |
| import org.eclipse.stem.core.common.Identifiable; |
| import org.eclipse.stem.core.graph.DynamicLabel; |
| import org.eclipse.stem.core.graph.Exchange; |
| import org.eclipse.stem.core.graph.ExchangePool; |
| import org.eclipse.stem.core.graph.ExchangeType; |
| import org.eclipse.stem.core.graph.Graph; |
| import org.eclipse.stem.core.graph.GraphFactory; |
| import org.eclipse.stem.core.graph.LabelValue; |
| import org.eclipse.stem.core.graph.NodeLabel; |
| import org.eclipse.stem.core.model.Decorator; |
| import org.eclipse.stem.core.model.ModelFactory; |
| import org.eclipse.stem.core.model.STEMTime; |
| import org.eclipse.stem.core.scenario.ScenarioInitializationException; |
| import org.eclipse.stem.definitions.adapters.relativevalue.RelativeValueProvider; |
| import org.eclipse.stem.definitions.adapters.relativevalue.RelativeValueProviderAdapter; |
| import org.eclipse.stem.definitions.adapters.relativevalue.RelativeValueProviderAdapterFactory; |
| import org.eclipse.stem.definitions.labels.PopulationLabel; |
| import org.eclipse.stem.populationmodels.Activator; |
| import org.eclipse.stem.populationmodels.standard.ExternalDataSourcePopulationModel; |
| import org.eclipse.stem.populationmodels.standard.PopulationModel; |
| import org.eclipse.stem.populationmodels.standard.PopulationModelLabel; |
| import org.eclipse.stem.populationmodels.standard.PopulationModelLabelValue; |
| import org.eclipse.stem.populationmodels.standard.StandardFactory; |
| import org.eclipse.stem.populationmodels.standard.StandardPackage; |
| import org.eclipse.stem.populationmodels.standard.StandardPopulationModelLabel; |
| import org.eclipse.stem.populationmodels.standard.StandardPopulationModelLabelValue; |
| import org.eclipse.stem.populationmodels.standard.provider.StandardItemProviderAdapterFactory; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * An implementation of the model object '<em><b>External Datasource Population Model</b></em>'. |
| * <!-- end-user-doc --> |
| * <p> |
| * The following features are implemented: |
| * <ul> |
| * <li>{@link org.eclipse.stem.populationmodels.standard.impl.ExternalDataSourcePopulationModelImpl#getDataPath <em>Data Path</em>}</li> |
| * </ul> |
| * </p> |
| * |
| * @generated |
| */ |
| public class ExternalDataSourcePopulationModelImpl extends PopulationModelImpl implements ExternalDataSourcePopulationModel { |
| |
| |
| protected Set<String> BIRTH_KEY_SET = new HashSet<String>(); |
| protected Set<String> DEATHS_KEY_SET = new HashSet<String>(); |
| protected Set<String> COUNT_KEY_SET = new HashSet<String>(); |
| |
| public static String labelBirths = null ; |
| public static String labelDeaths = null ; |
| public static String labelCount = null ; |
| |
| // When we know the population model that generated the data (stored in the runparameters file), |
| // the descriptors of the properties are stored here, mapped by the population id |
| |
| protected Map<String, List<IItemPropertyDescriptor>> propertyDescriptors; |
| |
| |
| // We need this to determine when a simulation is restarted so we |
| // can reset the file line counter. Also needed to keep track of the line number in the file |
| private STEMTime firstSTEMTime = null; |
| |
| // Used to detect when the user has restarted a simulation. |
| private STEMTime previousTime = null; |
| |
| // The streamer |
| |
| CSVScenarioStreamer streamer; |
| |
| private int fileLineCounter = 0; |
| |
| private String populationType; |
| |
| private Decorator populationModel; |
| |
| /** |
| * This prefix precedes the node id and must be removed in the |
| * filterFilename method to auto-generate the output file name. |
| */ |
| public static final String LOCATIONID_PREFIX = "/node/geo/region/"; |
| |
| |
| /** |
| * The default value of the '{@link #getDataPath() <em>Data Path</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getDataPath() |
| * @generated |
| * @ordered |
| */ |
| protected static final String DATA_PATH_EDEFAULT = null; |
| |
| /** |
| * The cached value of the '{@link #getDataPath() <em>Data Path</em>}' attribute. |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @see #getDataPath() |
| * @generated |
| * @ordered |
| */ |
| protected String dataPath = DATA_PATH_EDEFAULT; |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated NOT |
| */ |
| public ExternalDataSourcePopulationModelImpl() { |
| super(); |
| } |
| |
| |
| /** |
| * Override this method to return static population labels with identifiers found in logged files |
| * |
| * @param populationIdentifier |
| * the population being labeled Only used if not found in logged files |
| * @param graph |
| * the graph to search |
| * @return the PopulationLabel instances of the graph that match the |
| * identifier. |
| */ |
| @Override |
| protected Collection<PopulationLabel> getPopulationLabels( |
| final String populationIdentifier, final Graph graph) { |
| final List<PopulationLabel> retValue = new ArrayList<PopulationLabel>(); |
| |
| // If already done nothing will happen here |
| setupStreaming(); |
| |
| // Iterate through all of the population labels in the graph |
| EList<NodeLabel> labels = graph.getNodeLabelsByTypeURI( |
| PopulationLabel.URI_TYPE_POPULATION_LABEL); |
| for (NodeLabel pl:labels) { |
| if(getTargetISOKey() != null && !getTargetISOKey().trim().equals("") && pl.getNode() != null && //$NON-NLS-1$ |
| !isContained(pl.getNode(), getTargetISOKey()) && |
| !pl.getNode().getURI().lastSegment().equals("ZZZ")) //$NON-NLS-1$ |
| continue; |
| |
| final PopulationLabel populationLabel = (PopulationLabel) pl; |
| |
| List<String>pops = this.streamer.getPopulationIdentifiers(); |
| |
| // Is this label for the population we're looking for? |
| if(pops == null) { |
| if (populationLabel.getPopulationIdentifier().equals( |
| populationIdentifier)) { |
| // Yes |
| // If there is a problem with the "node uri" of the population |
| // label then it would not have been associated with a node |
| // instance in the graph at this point. This is a problem for |
| // disease models that are trying to label the node (there isn't |
| // one!). So filter out those mistakes here. |
| |
| // Does the population label have an associated node? |
| if (populationLabel.getNode() != null) |
| retValue.add(populationLabel); |
| |
| } // if the population we're looking for |
| } else for(String p:pops) |
| if (populationLabel.getPopulationIdentifier().equals(p)) { |
| if (populationLabel.getNode() != null) { |
| // Yes |
| retValue.add(populationLabel); |
| } // if the population label has a node |
| |
| } // for each population label |
| } // For each label |
| return retValue; |
| } // getPopulationLabels |
| |
| /** |
| * Need to override this to set the initial value to the first row in the log file |
| * @generated NOT |
| */ |
| |
| public void resetLabels() throws ScenarioInitializationException { |
| setEnabled(ENABLED_EDEFAULT); |
| setGraphDecorated(GRAPH_DECORATED_EDEFAULT); |
| |
| try { |
| if(streamer != null) |
| streamer.close(); |
| } catch(IOException ioe) { |
| throw new ScenarioInitializationException("IOException closing streamer", this, ioe); |
| } |
| streamer = null; |
| setupStreaming(); |
| |
| for (final Iterator<DynamicLabel> labelIter = getLabelsToUpdate() |
| .iterator(); labelIter.hasNext();) { |
| final StandardPopulationModelLabel popLabel = (StandardPopulationModelLabel) labelIter.next(); |
| final StandardPopulationModelLabelValue deltaState = (StandardPopulationModelLabelValue)popLabel.getDeltaValue(); |
| importPopulationData(deltaState, popLabel, null, 0); // last params not used |
| while(deltaState.getArrivals().size()>0) ExchangePool.POOL.release(deltaState.getArrivals().remove(0)); |
| while(deltaState.getDepartures().size()>0) ExchangePool.POOL.release(deltaState.getDepartures().remove(0)); |
| ((StandardPopulationModelLabelValue)((StandardPopulationModelLabel)popLabel).getCurrentValue()).add(deltaState); |
| |
| } |
| } // resetLabels |
| |
| |
| /** |
| * get the constants which identify the disease label state variables |
| * @param diseaseLabel |
| */ |
| private void setPropertyLabels() { |
| StandardItemProviderAdapterFactory itemProviderFactory = new StandardItemProviderAdapterFactory(); |
| if(populationModel == null) { |
| // We do not know the disease model and hence the label values needed |
| StandardPopulationModelLabelValue popLabelValue = (StandardPopulationModelLabelValue) StandardFactory.eINSTANCE.createStandardPopulationModelLabel().getCurrentValue(); |
| IItemPropertySource propertySource = (IItemPropertySource) itemProviderFactory.adapt(popLabelValue, PropertySource.class); |
| List<IItemPropertyDescriptor> properties = propertySource.getPropertyDescriptors(null); |
| |
| IItemPropertyDescriptor propertyBirths = properties.get(StandardPackage.STANDARD_POPULATION_MODEL_LABEL_VALUE__BIRTHS); |
| IItemPropertyDescriptor propertyDeaths = properties.get(StandardPackage.STANDARD_POPULATION_MODEL_LABEL_VALUE__DEATHS); |
| IItemPropertyDescriptor propertyCount = properties.get(StandardPackage.STANDARD_POPULATION_MODEL_LABEL_VALUE__COUNT); |
| |
| labelBirths = propertyBirths.getDisplayName(propertyBirths); |
| labelDeaths = propertyDeaths.getDisplayName(propertyDeaths); |
| labelCount = propertyCount.getDisplayName(propertyCount); |
| } else { |
| PopulationModel pm = (PopulationModel)populationModel; |
| for(String popId:streamer.getPopulationIdentifiers()) { |
| |
| PopulationModelLabel spml = pm.createPopulationModelLabel(popId); |
| |
| final RelativeValueProviderAdapter rvp = (RelativeValueProviderAdapter) RelativeValueProviderAdapterFactory.INSTANCE |
| .adapt(spml, RelativeValueProvider.class); |
| rvp.setTarget(spml); |
| |
| List<IItemPropertyDescriptor> properties = rvp.getProperties(); |
| |
| // IItemPropertySource propertySource = (IItemPropertySource) itemProviderFactory.adapt(dmlv, PropertySource.class); |
| // List<IItemPropertyDescriptor> properties = propertySource.getPropertyDescriptors(null); |
| if(propertyDescriptors == null) propertyDescriptors = new HashMap<String, List<IItemPropertyDescriptor>>(); |
| propertyDescriptors.put(popId, properties); |
| } |
| } |
| }// setPropertyLabels |
| |
| |
| public synchronized void calculateDelta(STEMTime time,double t, long timeDelta, |
| EList<DynamicLabel> labels) { |
| |
| |
| if(firstSTEMTime == null || time.getTime().equals(firstSTEMTime.getTime())) |
| fileLineCounter = 1; |
| else |
| fileLineCounter = (int)((time.getTime().getTime() - firstSTEMTime.getTime().getTime()) / timeDelta)+1; |
| |
| if(firstSTEMTime == null) firstSTEMTime = time; |
| |
| if(previousTime != null && time.getTime().before(previousTime.getTime())) |
| try { |
| restartStreaming(); |
| } catch(IOException ioe) { |
| Activator.logError("IOException closing streaming files", ioe); |
| } |
| |
| if(previousTime == null) previousTime = ModelFactory.eINSTANCE.createSTEMTime(); |
| previousTime.setTime(time.getTime()); |
| |
| for (final DynamicLabel dynLabel : labels) { |
| final StandardPopulationModelLabel popLabel = (StandardPopulationModelLabel) dynLabel; |
| assert popLabel.getIdentifier().equals(getPopulationIdentifier()); |
| final StandardPopulationModelLabelValue deltaState = (StandardPopulationModelLabelValue)popLabel.getDeltaValue(); |
| |
| importPopulationData(deltaState, popLabel, time, timeDelta); |
| |
| // Check that the counts match the births and deaths reported. |
| |
| double births = deltaState.getBirths(); |
| double deaths = deltaState.getDeaths(); |
| double newCount = deltaState.getCount(); |
| double currentCount = ((StandardPopulationModelLabelValue)(popLabel.getCurrentValue())).getCount(); |
| |
| if(currentCount + births - deaths != newCount) { |
| double diff = newCount - (currentCount+births-deaths); |
| if(diff > 0) |
| births = births + diff; |
| else |
| deaths = deaths + diff; |
| } |
| |
| Exchange birthExchange = (Exchange) ExchangePool.POOL.get(); |
| Exchange deathExchange = (Exchange) ExchangePool.POOL.get(); |
| |
| birthExchange.setType(ExchangeType.BIRTHS_AND_DEATHS); |
| birthExchange.setCount(births); |
| deathExchange.setType(ExchangeType.BIRTHS_AND_DEATHS); |
| deathExchange.setCount(deaths); |
| while(deltaState.getArrivals().size()>0) ExchangePool.POOL.release(deltaState.getArrivals().remove(0)); |
| while(deltaState.getDepartures().size()>0) ExchangePool.POOL.release(deltaState.getDepartures().remove(0)); |
| deltaState.getArrivals().add(birthExchange); |
| deltaState.getDepartures().add(deathExchange); |
| } // for |
| } |
| |
| |
| /** |
| * |
| * This method reads the next state data from the external dataFile |
| * |
| * @param deltaState |
| * @param diseaseLabel |
| * @param time |
| * @param timeDelta |
| * @return |
| */ |
| public StandardPopulationModelLabelValue importPopulationData( |
| final StandardPopulationModelLabelValue deltaState, |
| final StandardPopulationModelLabel popLabel, |
| final STEMTime time, |
| final long timeDelta) { |
| |
| try { |
| |
| // Will only be set up first time called |
| setupStreaming(); |
| |
| // |
| if(labelCount==null && propertyDescriptors == null) |
| setPropertyLabels(); |
| |
| Identifiable ident = popLabel.getIdentifiable(); |
| String fileName = ident.getURI().toString(); |
| int last = fileName.lastIndexOf(LOCATIONID_PREFIX); |
| last += LOCATIONID_PREFIX.length(); |
| String location = fileName.substring(last,fileName.length()); |
| |
| int adminLevel = Utility.keyLevel(location); |
| String population = popLabel.getPopulationIdentifier(); |
| |
| StandardPopulationModelLabelValue currentValue = (StandardPopulationModelLabelValue)popLabel.getCurrentValue(); |
| // String id = ident.getURI().toString(); |
| // int strt = id.indexOf(URI_PREFIX_PATTERN); |
| // if(strt>=0) { |
| // id = id.substring(strt+URI_PREFIX_PATTERN.length(),id.length()); |
| // } |
| |
| // if((dataInstance!=null)&&(dataInstance.instance.containsKey(id))) { |
| |
| //if(dataInstance!=null) { |
| // compute the changes |
| if(adminLevel > -1) { |
| // First, if we do not know the various compartments etc used for the disease |
| // assume it's an SI, SIR or SEIR |
| if(streamer.getDecorator() == null) { |
| double deltaCount = 0.0; |
| double deltaBirths = 0.0; |
| double deltaDeaths = 0.0; |
| |
| // Population is not known so use the unknown key |
| population = CSVscenarioLoader.UNKNOWN_POP_IDENTIFIER_KEY; |
| |
| List<Double>data = null; |
| if(populationType.equals(IMPORT_TYPE_STANDARD_POPULATION)) { |
| if(streamer.getCurrentRow(population, adminLevel, labelCount) < fileLineCounter) |
| data = streamer.streamRow(population, adminLevel, labelCount); |
| else data = streamer.getLastFetchedRow(population, adminLevel, labelCount); |
| |
| int pos = streamer.getDataPosition(population, adminLevel, location); |
| |
| if(data != null && pos >=0) { |
| double d = data.get(pos); |
| deltaCount = d - currentValue.getCount(); |
| } |
| |
| if(streamer.getCurrentRow(population, adminLevel, labelBirths) < fileLineCounter) |
| data = streamer.streamRow(population, adminLevel, labelBirths); |
| else data = streamer.getLastFetchedRow(population, adminLevel, labelBirths); |
| |
| if(data != null && pos >=0) { |
| double d = data.get(pos); |
| deltaBirths = d - currentValue.getBirths(); |
| } |
| |
| if(streamer.getCurrentRow(population, adminLevel, labelDeaths) < fileLineCounter) |
| data = streamer.streamRow(population, adminLevel, labelDeaths); |
| else data = streamer.getLastFetchedRow(population, adminLevel, labelDeaths); |
| |
| if(data != null && pos >=0) { |
| double d = data.get(pos); |
| deltaBirths = d - currentValue.getDeaths(); |
| } |
| } |
| |
| if (populationType.equals(IMPORT_TYPE_STANDARD_POPULATION)) { |
| ((StandardPopulationModelLabelValue)deltaState).setCount(deltaCount); |
| ((StandardPopulationModelLabelValue)deltaState).setBirths(deltaBirths); |
| ((StandardPopulationModelLabelValue)deltaState).setDeaths(deltaDeaths); |
| return new StandardPopulationModelLabelValueImpl(); |
| } else { |
| throw new UnsupportedOperationException("ExternalDataSource Invalid Type "+populationType+" must be Standard Population Model"); |
| } |
| } else { |
| List<Double>data = null; |
| // We have the property descriptors for the label value we need to set. |
| for(IItemPropertyDescriptor propDesc:propertyDescriptors.get(population)) { |
| // This is the name used in the CSV files |
| String dispName = propDesc.getDisplayName(propDesc); |
| |
| if(!streamer.containsState(population, adminLevel, dispName)) |
| continue; // Skip properties that are missing in the log files (Display Warning?) |
| |
| int pos = streamer.getDataPosition(population, adminLevel, location); |
| |
| if(streamer.getCurrentRow(population, adminLevel, dispName) < fileLineCounter) |
| data = streamer.streamRow(population, adminLevel, dispName); |
| else |
| data = streamer.getLastFetchedRow(population, adminLevel, dispName); |
| if(data != null && pos >= 0) { |
| double d = data.get(pos); |
| EStructuralFeature feature = (EStructuralFeature)propDesc.getFeature(null); |
| double currentVal = (Double)currentValue.eGet(feature); |
| if(!feature.isDerived() && feature.isChangeable()) |
| deltaState.eSet(feature, d - currentVal); |
| } |
| } |
| } |
| }// admin level > -1 |
| |
| } catch(IOException ioe) { |
| Activator.logError("Exception streaming data", ioe); |
| } |
| return null; |
| } |
| |
| /** |
| * |
| */ |
| private synchronized void setupStreaming() { |
| if(streamer == null) { |
| try { |
| streamer = new CSVScenarioStreamer(this.dataPath); |
| this.populationModel = streamer.getDecorator(); |
| if(this.populationModel == null) { |
| streamer.prepareForStreaming(CSVscenarioLoader.UNKNOWN_POP_IDENTIFIER_KEY, -1); |
| |
| // Set the disease type here since we don't need that |
| // input from the end-user any longer |
| this.populationType = streamer.getType(CSVscenarioLoader.UNKNOWN_POP_IDENTIFIER_KEY).name(); |
| } else { |
| for(String pop:streamer.getPopulationIdentifiers()) |
| streamer.prepareForStreaming(pop, -1); |
| } |
| } catch(LogInitializationException sie) { |
| Activator.logError("Error reading scenario files", sie); |
| } catch(IOException ioe) { |
| Activator.logError("IOExceptopn reading scenario files", ioe); |
| } |
| } |
| } |
| |
| private synchronized void restartStreaming() throws IOException{ |
| streamer.close(); |
| streamer = null; |
| } |
| |
| public void doModelSpecificAdjustments(LabelValue label) { |
| |
| } |
| |
| public boolean isDeterministic() { |
| return true; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| protected EClass eStaticClass() { |
| return StandardPackage.Literals.EXTERNAL_DATA_SOURCE_POPULATION_MODEL; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public String getDataPath() { |
| return dataPath; |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| public void setDataPath(String newDataPath) { |
| String oldDataPath = dataPath; |
| dataPath = newDataPath; |
| if (eNotificationRequired()) |
| eNotify(new ENotificationImpl(this, Notification.SET, StandardPackage.EXTERNAL_DATA_SOURCE_POPULATION_MODEL__DATA_PATH, oldDataPath, dataPath)); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public Object eGet(int featureID, boolean resolve, boolean coreType) { |
| switch (featureID) { |
| case StandardPackage.EXTERNAL_DATA_SOURCE_POPULATION_MODEL__DATA_PATH: |
| return getDataPath(); |
| } |
| return super.eGet(featureID, resolve, coreType); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eSet(int featureID, Object newValue) { |
| switch (featureID) { |
| case StandardPackage.EXTERNAL_DATA_SOURCE_POPULATION_MODEL__DATA_PATH: |
| setDataPath((String)newValue); |
| return; |
| } |
| super.eSet(featureID, newValue); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public void eUnset(int featureID) { |
| switch (featureID) { |
| case StandardPackage.EXTERNAL_DATA_SOURCE_POPULATION_MODEL__DATA_PATH: |
| setDataPath(DATA_PATH_EDEFAULT); |
| return; |
| } |
| super.eUnset(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public boolean eIsSet(int featureID) { |
| switch (featureID) { |
| case StandardPackage.EXTERNAL_DATA_SOURCE_POPULATION_MODEL__DATA_PATH: |
| return DATA_PATH_EDEFAULT == null ? dataPath != null : !DATA_PATH_EDEFAULT.equals(dataPath); |
| } |
| return super.eIsSet(featureID); |
| } |
| |
| /** |
| * <!-- begin-user-doc --> |
| * <!-- end-user-doc --> |
| * @generated |
| */ |
| @Override |
| public String toString() { |
| if (eIsProxy()) return super.toString(); |
| |
| StringBuffer result = new StringBuffer(super.toString()); |
| result.append(" (dataPath: "); |
| result.append(dataPath); |
| result.append(')'); |
| return result.toString(); |
| } |
| |
| |
| @Override |
| public PopulationModelLabel createPopulationModelLabel(String populationIdentifier) { |
| PopulationModelLabel retValue = null; |
| if(streamer.getDecorator() == null) { |
| if (populationType==IMPORT_TYPE_STANDARD_POPULATION) retValue = StandardFactory.eINSTANCE.createStandardPopulationModelLabel(); |
| else retValue = StandardFactory.eINSTANCE.createStandardPopulationModelLabel(); |
| } else { |
| // We know the actual disease model used, call its methods to create the label |
| retValue = ((PopulationModel)streamer.getDecorator()).createPopulationModelLabel(populationIdentifier); |
| } |
| retValue.setTypeURI(PopulationModelLabel.URI_TYPE_DYNAMIC_POPULATION_LABEL); |
| return retValue; |
| } |
| |
| |
| @Override |
| public PopulationModelLabelValue createPopulationModelLabelValue(String populationIdentifier) { |
| PopulationModelLabelValue retValue = null; |
| if(streamer.getDecorator() == null) { |
| if (populationType==IMPORT_TYPE_STANDARD_POPULATION) retValue = StandardFactory.eINSTANCE.createStandardPopulationModelLabelValue(); |
| else retValue = StandardFactory.eINSTANCE.createStandardPopulationModelLabelValue(); |
| } else { |
| // We know the actual disease model used, call its methods to create the label |
| retValue = ((PopulationModel)streamer.getDecorator()).createPopulationModelLabelValue(populationIdentifier); |
| } |
| return retValue; |
| } |
| |
| } //ExternalDatasourcePopulationModelImpl |