@@ -0,0 +1,2501 @@
+/*******************************************************************************%0A * Mission Control Technologies, Copyright (c) 2009-2012, United States Government%0A * as represented by the Administrator of the National Aeronautics and Space %0A * Administration. All rights reserved.%0A *%0A * The MCT platform is licensed under the Apache License, Version 2.0 (the %0A * %22License%22); you may not use this file except in compliance with the License. %0A * You may obtain a copy of the License at %0A * http://www.apache.org/licenses/LICENSE-2.0.%0A *%0A * Unless required by applicable law or agreed to in writing, software %0A * distributed under the License is distributed on an %22AS IS%22 BASIS, WITHOUT %0A * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the %0A * License for the specific language governing permissions and limitations under %0A * the License.%0A *%0A * MCT includes source code licensed under additional open source licenses. See %0A * the MCT Open Source Licenses file included with this distribution or the About %0A * MCT Licenses dialog available at runtime from the MCT Help menu for additional %0A * information. %0A *******************************************************************************/%0Apackage gov.nasa.arc.mct.scenario.component;%0A%0Aimport java.util.Arrays;%0Aimport java.util.Collection;%0Aimport java.util.Collections;%0Aimport java.util.List;%0Aimport java.util.concurrent.atomic.AtomicReference;%0A%0Apublic class ActivityTypeComponent extends CostFunctionComponent %7B%0A%09private AtomicReference%3CActivityTypeModel%3E activityModel =%0A%09%09%09new AtomicReference%3CActivityTypeModel%3E(new ActivityTypeModel());%0A%09private List%3CCostFunctionCapability%3E internalCostFunctions = %0A%09%09%09Arrays.%3CCostFunctionCapability%3EasList(new ActivityTypeCost(false), new ActivityTypeCost(true));%0A%09%0A%09%0A%09%0A%09@Override%0A%09public List%3CCostFunctionCapability%3E getInternalCostFunctions() %7B%0A%09%09return internalCostFunctions;%0A%09%7D%0A%0A%0A%0A%09private class ActivityTypeCost implements CostFunctionCapability %7B%0A%09%09private boolean isComm;%0A%09%09%0A%09%09public ActivityTypeCost(boolean isComm) %7B%0A%09%09%09this.isComm = isComm;%0A%09%09%7D%0A%09%09%0A%09%09@Override%0A%09%09public String getName() %7B%0A%09%09%09return isComm ? %22Comms%22 : %22Power%22;%0A%09%09%7D%0A%0A%09%09@Override%0A%09%09public String getUnits() %7B%0A%09%09%09return isComm ? %22KB/s%22 : %22Watts%22;%0A%09%09%7D%0A%0A%09%09@Override%0A%09%09public double getValue(long time) %7B%0A%09%09%09ActivityTypeModel model = activityModel.get();%0A%09%09%09return isComm ? model.getComms() : model.getPower();%09%09%09%0A%09%09%7D%0A%0A%09%09@Override%0A%09%09public Collection%3CLong%3E getChangeTimes() %7B%0A%09%09%09return Collections.emptyList();%0A%09%09%7D%0A%09%09%0A%09%7D%0A%7D%0A

Define Activity Type component