|
| 1 | +/******************************************************************************* |
| 2 | +* Copyright (c) 2021 ARM Ltd. and others |
| 3 | +* All rights reserved. This program and the accompanying materials |
| 4 | +* are made available under the terms of the Eclipse Public License v1.0 |
| 5 | +* which accompanies this distribution, and is available at |
| 6 | +* http://www.eclipse.org/legal/epl-v10.html |
| 7 | +* |
| 8 | +* Contributors: |
| 9 | +* ARM Ltd and ARM Germany GmbH - Initial API and implementation |
| 10 | +*******************************************************************************/ |
| 11 | + |
| 12 | +package com.arm.cmsis.pack.rte.dependencies; |
| 13 | + |
| 14 | +import java.util.Collection; |
| 15 | +import java.util.Map; |
| 16 | + |
| 17 | +import com.arm.cmsis.pack.enums.EEvaluationResult; |
| 18 | +import com.arm.cmsis.pack.rte.components.IRteComponent; |
| 19 | +import com.arm.cmsis.pack.rte.components.IRteComponentItem; |
| 20 | + |
| 21 | +/** |
| 22 | + * Class to wrap a dependency with multiple choice |
| 23 | + */ |
| 24 | +public class RteDependencyWrapper extends RteDependency { |
| 25 | + |
| 26 | + protected IRteDependency fOriginalDependency; |
| 27 | + |
| 28 | + // list of component items that stop the search |
| 29 | + protected Map<IRteComponentItem, IRteDependencyItem> fStopItems = null; |
| 30 | + |
| 31 | + public RteDependencyWrapper(IRteDependency dep) { |
| 32 | + super(dep.getCpItem(), dep.getFlags()); |
| 33 | + fOriginalDependency = dep; |
| 34 | + setEvaluationResult(dep.getEvaluationResult()); |
| 35 | + } |
| 36 | + |
| 37 | + @Override |
| 38 | + public IRteComponentItem getComponentItem() { |
| 39 | + return fOriginalDependency.getComponentItem(); |
| 40 | + } |
| 41 | + |
| 42 | + @Override |
| 43 | + public Collection<IRteComponent> getComponents() { |
| 44 | + return fOriginalDependency.getComponents(); |
| 45 | + } |
| 46 | + |
| 47 | + @Override |
| 48 | + public EEvaluationResult getEvaluationResult(IRteComponent component) { |
| 49 | + return fOriginalDependency.getEvaluationResult(component); |
| 50 | + } |
| 51 | + |
| 52 | + @Override |
| 53 | + public IRteComponent getBestMatch() { |
| 54 | + return null; // multiple choice |
| 55 | + } |
| 56 | + |
| 57 | + @Override |
| 58 | + public void addComponent(IRteComponent component, EEvaluationResult result) { |
| 59 | + fOriginalDependency.addComponent(component, result); |
| 60 | + } |
| 61 | + |
| 62 | + @Override |
| 63 | + public void addStopItem(IRteComponentItem item, EEvaluationResult result) { |
| 64 | + fOriginalDependency.addStopItem(item, result); |
| 65 | + } |
| 66 | + |
| 67 | + @Override |
| 68 | + public Collection<? extends IRteDependencyItem> getChildren() { |
| 69 | + return fOriginalDependency.getChildren(); |
| 70 | + } |
| 71 | +} |
0 commit comments