<commit_before>package gov.nasa.arc.mct.scenario.component;

import gov.nasa.arc.mct.components.AbstractComponent;

import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.TreeSet;

public class TimelineComponent extends CostFunctionComponent {
	
	public String getDisplay(){
		return this.getDisplayName();
	}

	private Set<AbstractComponent> modifiedObjects = new HashSet<AbstractComponent>();
	public void addToModifiedObjects(AbstractComponent ac) {
		modifiedObjects.add(ac);
	}
	@Override
	public Set<AbstractComponent> getAllModifiedObjects() {
		return modifiedObjects;
	}
	
	@Override
	public void notifiedSaveAllSuccessful() {
		modifiedObjects.clear();
	}
}<commit_msg>Support DurationCapability in Timeline view<commit_after>package gov.nasa.arc.mct.scenario.component;

import gov.nasa.arc.mct.components.AbstractComponent;

import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.TreeSet;

public class TimelineComponent extends CostFunctionComponent implements DurationCapability {
	
	public String getDisplay(){
		return this.getDisplayName();
	}

	private Set<AbstractComponent> modifiedObjects = new HashSet<AbstractComponent>();
	
	@Override
	protected <T> T handleGetCapability(Class<T> capability) {
		if (capability.isAssignableFrom(getClass())) {
			return capability.cast(this);
		}
		return super.handleGetCapability(capability);
	}
	
	public void addToModifiedObjects(AbstractComponent ac) {
		modifiedObjects.add(ac);
	}
	@Override
	public Set<AbstractComponent> getAllModifiedObjects() {
		return modifiedObjects;
	}
	
	@Override
	public void notifiedSaveAllSuccessful() {
		modifiedObjects.clear();
	}
	
	@Override
	public long getStart() {		
		return 0;
	}
	@Override
	public long getEnd() {
		// The end of a Timeline is the end of its last activity
		long end = 0;
		for (AbstractComponent child : getComponents()) {
			DurationCapability dc = child.getCapability(DurationCapability.class);
			if (dc != null) {
				long childEnd = dc.getEnd();
				if (childEnd > end) {
					end = childEnd;
				}
			}
		}
		return end;
	}
	@Override
	public void setStart(long start) {
		// TODO Auto-generated method stub
		
	}
	@Override
	public void setEnd(long end) {
		// TODO Auto-generated method stub
		
	}
}
{'fraction_non_alphanumeric': 0.10091743119266056, 'fraction_numerical': 0.0007977662544874351, 'mean_word_length': 4.752293577981652, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 12, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3144207', 'n_tokens_mistral': 822, 'n_tokens_neox': 756, 'n_words': 183}