-
Notifications
You must be signed in to change notification settings - Fork 80
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0b7726a
commit bb113ff
Showing
12 changed files
with
129 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
// | ||
// Copyright (c) 2016-2024 Deephaven Data Labs and Patent Pending | ||
// | ||
package io.deephaven.qst.table; | ||
|
||
import io.deephaven.annotations.NodeStyle; | ||
import org.immutables.value.Value.Check; | ||
import org.immutables.value.Value.Immutable; | ||
import org.immutables.value.Value.Parameter; | ||
|
||
@Immutable | ||
@NodeStyle | ||
public abstract class SliceTable extends TableBase implements SingleParentTable { | ||
|
||
public static SliceTable of(TableSpec parent, long firstPositionInclusive, long lastPositionExclusive) { | ||
return ImmutableSliceTable.of(parent, firstPositionInclusive, lastPositionExclusive); | ||
} | ||
|
||
@Parameter | ||
public abstract TableSpec parent(); | ||
|
||
@Parameter | ||
public abstract long firstPositionInclusive(); | ||
|
||
@Parameter | ||
public abstract long lastPositionExclusive(); | ||
|
||
@Override | ||
public final <T> T walk(Visitor<T> visitor) { | ||
return visitor.visit(this); | ||
} | ||
|
||
@Check | ||
final void checkPositions() { | ||
if (firstPositionInclusive() >= 0 && lastPositionExclusive() >= 0 | ||
&& lastPositionExclusive() < firstPositionInclusive()) { | ||
throw new IllegalArgumentException( | ||
String.format( | ||
"Cannot slice with a non-negative start position (%d) that is after a non-negative end position (%d).", | ||
firstPositionInclusive(), lastPositionExclusive())); | ||
} | ||
if (firstPositionInclusive() < 0 && lastPositionExclusive() < 0 | ||
&& lastPositionExclusive() < firstPositionInclusive()) { | ||
throw new IllegalArgumentException( | ||
String.format( | ||
"Cannot slice with a negative start position (%d) that is after a negative end position (%d).", | ||
firstPositionInclusive(), lastPositionExclusive())); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters