blob: 1ffe26d6d88a40ee03266111b1c74243bbf9036e [file] [log] [blame]
/*******************************************************************************
* Copyright (c) 2017 École Polytechnique de Montréal
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*******************************************************************************/
package org.eclipse.tracecompass.datastore.core.interval;
/**
* Generic interface for any serializable object (like a time range) that can be used in the
* generic history tree.
*
* @author Alexandre Montplaisir
* @author Geneviève Bastien
* @since 1.1
*/
public interface IHTInterval extends ISerializableObject {
/**
* The start position/time of the object.
*
* @return The start position
*/
long getStart();
/**
* The end position/time of the object
*
* @return The end position
*/
long getEnd();
/**
* Utility method to check if the current interval intersects a timestamp.
*
* @param timestamp
* The timestamp to check
* @return If it intersects or not
*/
default boolean intersects(long timestamp) {
return (getStart() <= timestamp && timestamp <= getEnd());
}
}