<commit_before>package timeBench.data;


/**
 * Interval in the relational view. Following the <em>proxy tuple</em> pattern
 * [Heer & Agrawala, 2006] it provides an object oriented proxy for accessing a
 * row of the temporal elements table.
 * 
 * <p>
 * This class assumes that the underlying data tuple is an interval.
 * 
 * @author Rind
 */
public class Interval extends AnchoredTemporalElement {

    /**
     * relational temporal elements should only be created by the
     * {@link TemporalDataset}
     */
    protected Interval() {
    }

    // nothing to do here :-)

    // TODO special handling of children e.g. getBegin() : Instant in conjunction with spans
    
    public Instant getBegin() throws TemporalDataException {
    	if(this.getFirstChildPrimitive() instanceof Instant)
    		return (Instant)this.getFirstChildPrimitive();
    	else if(this.getChildCount() == 2 && this.getFirstChildPrimitive() instanceof Span && this.getLastChild() instanceof Instant) {
        	throw new RuntimeException("Not implemented");
    	} else
    		throw new TemporalDataException("Syntax error in temporal element of type interval");
    }
    
    public Instant getEnd() throws TemporalDataException {
    	if(this.getLastChild() instanceof Instant)
    		return (Instant)this.getLastChild();
    	else if(this.getChildCount() == 2 && this.getLastChild() instanceof Span && this.getFirstChildPrimitive() instanceof Instant) {
        	throw new RuntimeException("Not implemented");
    	} else
    		throw new TemporalDataException("Syntax error in temporal element of type interval");
    }
}<commit_msg>adapt because Temp.El. graph returns GenericTemporalElements<commit_after>package timeBench.data;


/**
 * Interval in the relational view. Following the <em>proxy tuple</em> pattern
 * [Heer & Agrawala, 2006] it provides an object oriented proxy for accessing a
 * row of the temporal elements table.
 * 
 * <p>
 * This class assumes that the underlying data tuple is an interval.
 * 
 * @author Rind
 */
public class Interval extends AnchoredTemporalElement {

    /**
     * relational temporal elements should only be created by the
     * {@link TemporalDataset}
     */
    protected Interval() {
    }

    // nothing to do here :-)

    // TODO special handling of children e.g. getBegin() : Instant in conjunction with spans
    
    public Instant getBegin() throws TemporalDataException {
    	if(this.getFirstChildPrimitive() instanceof Instant)
    		return (Instant)this.getFirstChildPrimitive();
    	else if(this.getChildCount() == 2 && this.getFirstChildPrimitive() instanceof Span && this.getLastChild() instanceof Instant) {
        	throw new RuntimeException("Not implemented yet");
    	} else
    		throw new TemporalDataException("Syntax error in temporal element of type interval");
    }
    
    public Instant getEnd() throws TemporalDataException {
        TemporalElement last = (TemporalElement) this.getLastChild();
        if (last != null) {
            last = last.asPrimitive();
            
            if(last instanceof Instant)
                return (Instant) last;
            else if(this.getChildCount() == 2 && last instanceof Span && this.getFirstChildPrimitive() instanceof Instant) {
                throw new RuntimeException("Not implemented yet");
            } else
                throw new TemporalDataException("Syntax error in temporal element of type interval");
            
        } else
            throw new TemporalDataException("Syntax error in temporal element of type interval");
        
    }
}
{'fraction_non_alphanumeric': 0.08770949720670392, 'fraction_numerical': 0.0033519553072625698, 'mean_word_length': 3.069318181818182, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, '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': '3496471', 'n_tokens_mistral': 964, 'n_tokens_neox': 905, 'n_words': 320}