proj_name stringclasses 131
values | relative_path stringlengths 30 228 | class_name stringlengths 1 68 | func_name stringlengths 1 48 | masked_class stringlengths 78 9.82k | func_body stringlengths 46 9.61k | len_input int64 29 2.01k | len_output int64 14 1.94k | total int64 55 2.05k | relevant_context stringlengths 0 38.4k |
|---|---|---|---|---|---|---|---|---|---|
jtablesaw_tablesaw | tablesaw/core/src/main/java/tech/tablesaw/columns/numbers/FloatColumnType.java | FloatColumnType | instance | class FloatColumnType extends AbstractColumnType {
public static final int BYTE_SIZE = 4;
/** Returns the default parser for {@link FloatColumn} */
public static final FloatParser DEFAULT_PARSER = new FloatParser(ColumnType.FLOAT);
private static FloatColumnType INSTANCE;
private FloatColumnType(int byteS... |
if (INSTANCE == null) {
INSTANCE = new FloatColumnType(BYTE_SIZE, "FLOAT", "float");
}
return INSTANCE;
| 326 | 48 | 374 | <methods>public int byteSize() ,public boolean equals(java.lang.Object) ,public java.lang.String getPrinterFriendlyName() ,public int hashCode() ,public java.lang.String name() ,public java.lang.String toString() <variables>private final non-sealed int byteSize,private final non-sealed java.lang.String name,private fin... |
jtablesaw_tablesaw | tablesaw/core/src/main/java/tech/tablesaw/columns/numbers/FloatParser.java | FloatParser | canParse | class FloatParser extends AbstractColumnParser<Float> {
public FloatParser(ColumnType columnType) {
super(columnType);
}
public FloatParser(FloatColumnType columnType, ReadOptions readOptions) {
super(columnType);
if (readOptions.missingValueIndicators().length > 0) {
missingValueStrings = Lis... |
if (isMissing(s)) {
return true;
}
try {
Float.parseFloat(AbstractColumnParser.remove(s, ','));
return true;
} catch (NumberFormatException e) {
// it's all part of the plan
return false;
}
| 235 | 78 | 313 | <methods>public void <init>(tech.tablesaw.api.ColumnType) ,public abstract boolean canParse(java.lang.String) ,public tech.tablesaw.api.ColumnType columnType() ,public boolean isMissing(java.lang.String) ,public abstract java.lang.Float parse(java.lang.String) ,public byte parseByte(java.lang.String) ,public double par... |
jtablesaw_tablesaw | tablesaw/core/src/main/java/tech/tablesaw/columns/numbers/IntColumnType.java | IntColumnType | instance | class IntColumnType extends AbstractColumnType {
/** The default parser for IntColumn */
public static final IntParser DEFAULT_PARSER = new IntParser(ColumnType.INTEGER);
private static final int BYTE_SIZE = 4;
private static IntColumnType INSTANCE;
private IntColumnType(int byteSize, String name, String ... |
if (INSTANCE == null) {
INSTANCE = new IntColumnType(BYTE_SIZE, "INTEGER", "Integer");
}
return INSTANCE;
| 312 | 47 | 359 | <methods>public int byteSize() ,public boolean equals(java.lang.Object) ,public java.lang.String getPrinterFriendlyName() ,public int hashCode() ,public java.lang.String name() ,public java.lang.String toString() <variables>private final non-sealed int byteSize,private final non-sealed java.lang.String name,private fin... |
jtablesaw_tablesaw | tablesaw/core/src/main/java/tech/tablesaw/columns/numbers/IntParser.java | IntParser | parseInt | class IntParser extends AbstractColumnParser<Integer> {
private final boolean ignoreZeroDecimal;
public IntParser(ColumnType columnType) {
super(columnType);
ignoreZeroDecimal = ReadOptions.DEFAULT_IGNORE_ZERO_DECIMAL;
}
public IntParser(IntColumnType columnType, ReadOptions readOptions) {
super(... |
if (isMissing(str)) {
return IntColumnType.missingValueIndicator();
}
String s = str;
if (ignoreZeroDecimal) {
s = StringUtils.removeZeroDecimal(s);
}
return Integer.parseInt(AbstractColumnParser.remove(s, ','));
| 370 | 82 | 452 | <methods>public void <init>(tech.tablesaw.api.ColumnType) ,public abstract boolean canParse(java.lang.String) ,public tech.tablesaw.api.ColumnType columnType() ,public boolean isMissing(java.lang.String) ,public abstract java.lang.Integer parse(java.lang.String) ,public byte parseByte(java.lang.String) ,public double p... |
jtablesaw_tablesaw | tablesaw/core/src/main/java/tech/tablesaw/columns/numbers/LongColumnType.java | LongColumnType | instance | class LongColumnType extends AbstractColumnType {
/** The default parser for LongColumn */
public static final LongParser DEFAULT_PARSER = new LongParser(ColumnType.LONG);
private static final int BYTE_SIZE = 8;
private static LongColumnType INSTANCE;
private LongColumnType(int byteSize, String name, Stri... |
if (INSTANCE == null) {
INSTANCE = new LongColumnType(BYTE_SIZE, "LONG", "Long");
}
return INSTANCE;
| 347 | 46 | 393 | <methods>public int byteSize() ,public boolean equals(java.lang.Object) ,public java.lang.String getPrinterFriendlyName() ,public int hashCode() ,public java.lang.String name() ,public java.lang.String toString() <variables>private final non-sealed int byteSize,private final non-sealed java.lang.String name,private fin... |
jtablesaw_tablesaw | tablesaw/core/src/main/java/tech/tablesaw/columns/numbers/LongParser.java | LongParser | parseLong | class LongParser extends AbstractColumnParser<Long> {
private final boolean ignoreZeroDecimal;
public LongParser(ColumnType columnType) {
super(columnType);
ignoreZeroDecimal = ReadOptions.DEFAULT_IGNORE_ZERO_DECIMAL;
}
public LongParser(LongColumnType columnType, ReadOptions readOptions) {
super... |
if (isMissing(str)) {
return LongColumnType.missingValueIndicator();
}
String s = str;
if (ignoreZeroDecimal) {
s = StringUtils.removeZeroDecimal(s);
}
return Long.parseLong(AbstractColumnParser.remove(s, ','));
| 370 | 82 | 452 | <methods>public void <init>(tech.tablesaw.api.ColumnType) ,public abstract boolean canParse(java.lang.String) ,public tech.tablesaw.api.ColumnType columnType() ,public boolean isMissing(java.lang.String) ,public abstract java.lang.Long parse(java.lang.String) ,public byte parseByte(java.lang.String) ,public double pars... |
jtablesaw_tablesaw | tablesaw/core/src/main/java/tech/tablesaw/columns/numbers/NumberColumnFormatter.java | NumberColumnFormatter | currency | class NumberColumnFormatter extends ColumnFormatter {
private final NumberFormat format;
private ColumnType columnType;
public static NumberColumnFormatter percent(int fractionalDigits) {
NumberFormat format = NumberFormat.getPercentInstance();
format.setGroupingUsed(false);
format.setMinimumFractio... |
NumberFormat format = NumberFormat.getCurrencyInstance(new Locale(language, country));
return new NumberColumnFormatter(format);
| 1,541 | 36 | 1,577 | <methods>public java.lang.String getMissingString() <variables>private final non-sealed java.lang.String missingString |
jtablesaw_tablesaw | tablesaw/core/src/main/java/tech/tablesaw/columns/numbers/NumberInterpolator.java | NumberInterpolator | linear | class NumberInterpolator<T extends Number> extends Interpolator<T> {
protected final NumericColumn<T> col;
/** Constructs an interpolator for the given column */
public NumberInterpolator(NumericColumn<T> col) {
super(col);
this.col = col;
}
/** Linearly interpolates missing values. */
public Dou... |
DoubleColumn result = col.asDoubleColumn();
int last = -1;
for (int i = 0; i < col.size(); i++) {
if (!col.isMissing(i)) {
if (last >= 0 && last != i - 1) {
for (int j = last + 1; j < i; j++) {
result.set(
j,
col.getDouble(last)
... | 115 | 163 | 278 | <methods>public void <init>(Column<T>) ,public Column<T> backfill() ,public Column<T> frontfill() <variables>protected final non-sealed Column<T> col |
jtablesaw_tablesaw | tablesaw/core/src/main/java/tech/tablesaw/columns/numbers/ShortColumnType.java | ShortColumnType | instance | class ShortColumnType extends AbstractColumnType {
public static final ShortParser DEFAULT_PARSER = new ShortParser(ShortColumnType.INSTANCE);
private static final int BYTE_SIZE = 2;
private static ShortColumnType INSTANCE;
private ShortColumnType(int byteSize, String name, String printerFriendlyName) {
... |
if (INSTANCE == null) {
INSTANCE = new ShortColumnType(BYTE_SIZE, "SHORT", "Short");
}
return INSTANCE;
| 238 | 46 | 284 | <methods>public int byteSize() ,public boolean equals(java.lang.Object) ,public java.lang.String getPrinterFriendlyName() ,public int hashCode() ,public java.lang.String name() ,public java.lang.String toString() <variables>private final non-sealed int byteSize,private final non-sealed java.lang.String name,private fin... |
jtablesaw_tablesaw | tablesaw/core/src/main/java/tech/tablesaw/columns/numbers/ShortParser.java | ShortParser | parseShort | class ShortParser extends AbstractColumnParser<Short> {
private final boolean ignoreZeroDecimal;
public ShortParser(ShortColumnType columnType) {
super(columnType);
ignoreZeroDecimal = ReadOptions.DEFAULT_IGNORE_ZERO_DECIMAL;
}
public ShortParser(ShortColumnType columnType, ReadOptions readOptions) {... |
if (isMissing(str)) {
return ShortColumnType.missingValueIndicator();
}
String s = str;
if (ignoreZeroDecimal) {
s = StringUtils.removeZeroDecimal(s);
}
return Short.parseShort(AbstractColumnParser.remove(s, ','));
| 371 | 82 | 453 | <methods>public void <init>(tech.tablesaw.api.ColumnType) ,public abstract boolean canParse(java.lang.String) ,public tech.tablesaw.api.ColumnType columnType() ,public boolean isMissing(java.lang.String) ,public abstract java.lang.Short parse(java.lang.String) ,public byte parseByte(java.lang.String) ,public double par... |
jtablesaw_tablesaw | tablesaw/core/src/main/java/tech/tablesaw/columns/numbers/Stats.java | Stats | getStats | class Stats {
private long n;
private double sum;
private double mean;
private double min;
private double max;
private double variance;
private double standardDeviation;
private double geometricMean;
private double quadraticMean;
private double secondMoment;
private double populationVariance;
p... |
Stats stats = new Stats("Column: " + values.name());
stats.min = summaryStatistics.getMin();
stats.max = summaryStatistics.getMax();
stats.n = summaryStatistics.getN();
stats.sum = summaryStatistics.getSum();
stats.variance = summaryStatistics.getVariance();
stats.populationVariance = summa... | 1,140 | 238 | 1,378 | <no_super_class> |
jtablesaw_tablesaw | tablesaw/core/src/main/java/tech/tablesaw/columns/numbers/fillers/DoubleRangeIterable.java | DoubleRangeIterable | intIterator | class DoubleRangeIterable implements Iterable<Double> {
private final double from, to, by;
private final boolean including;
private final int count;
private DoubleRangeIterable(
final double from,
final double to,
final boolean including,
final double by,
final int count) {
t... |
return new IntIterator() {
int next = (int) from;
int num = 0;
@Override
public boolean hasNext() {
return (count < 0 || num < count)
&& (Double.isNaN(to)
|| Math.abs(next - from) < Math.abs(to - from)
|| (including && next == to));
... | 506 | 143 | 649 | <no_super_class> |
jtablesaw_tablesaw | tablesaw/core/src/main/java/tech/tablesaw/columns/strings/StringColumnFormatter.java | StringColumnFormatter | toString | class StringColumnFormatter extends ColumnFormatter {
private final Function<String, String> formatter;
public StringColumnFormatter() {
super("");
this.formatter = null;
}
public StringColumnFormatter(Function<String, String> formatFunction) {
super("");
this.formatter = formatFunction;
}
... |
return "StringColumnFormatter{"
+ "format="
+ formatter
+ ", missingString='"
+ getMissingString()
+ '\''
+ '}';
| 233 | 50 | 283 | <methods>public java.lang.String getMissingString() <variables>private final non-sealed java.lang.String missingString |
jtablesaw_tablesaw | tablesaw/core/src/main/java/tech/tablesaw/columns/strings/StringColumnType.java | StringColumnType | instance | class StringColumnType extends AbstractColumnType {
public static final int BYTE_SIZE = 4;
public static final StringParser DEFAULT_PARSER = new StringParser(ColumnType.STRING);
private static StringColumnType INSTANCE;
private StringColumnType(int byteSize, String name, String printerFriendlyName) {
sup... |
if (INSTANCE == null) {
INSTANCE = new StringColumnType(BYTE_SIZE, "STRING", "String");
}
return INSTANCE;
| 232 | 45 | 277 | <methods>public int byteSize() ,public boolean equals(java.lang.Object) ,public java.lang.String getPrinterFriendlyName() ,public int hashCode() ,public java.lang.String name() ,public java.lang.String toString() <variables>private final non-sealed int byteSize,private final non-sealed java.lang.String name,private fin... |
jtablesaw_tablesaw | tablesaw/core/src/main/java/tech/tablesaw/columns/temporal/fillers/TemporalRangeIterable.java | TemporalRangeIterable | iterator | class TemporalRangeIterable<T extends Temporal> implements Iterable<T> {
private final T from, to;
private final long by;
private final TemporalUnit byUnit;
private final boolean including;
private final int count;
private TemporalRangeIterable(
final T from,
final T to,
final boolean in... |
return new Iterator<T>() {
T next = from;
int num = 0;
@Override
public boolean hasNext() {
return (count < 0 || num < count)
&& (to == null || next.until(to, byUnit) > 0 || (including && next.equals(to)));
}
@Override
@SuppressWarnings("unchecked")... | 409 | 171 | 580 | <no_super_class> |
jtablesaw_tablesaw | tablesaw/core/src/main/java/tech/tablesaw/columns/times/TimeColumnFormatter.java | TimeColumnFormatter | format | class TimeColumnFormatter extends TemporalColumnFormatter {
public TimeColumnFormatter(DateTimeFormatter format) {
super(format);
}
public TimeColumnFormatter() {
super();
}
public TimeColumnFormatter(DateTimeFormatter format, String missingValueString) {
super(format, missingValueString);
}
... |
DateTimeFormatter format = getFormat();
if (value == TimeColumnType.missingValueIndicator()) {
return getMissingString();
}
if (format == null) {
return toShortTimeString(value);
}
LocalTime time = asLocalTime(value);
if (time == null) {
return "";
}
return format.... | 177 | 100 | 277 | <methods>public java.time.format.DateTimeFormatter getFormat() <variables>private final non-sealed java.time.format.DateTimeFormatter format |
jtablesaw_tablesaw | tablesaw/core/src/main/java/tech/tablesaw/columns/times/TimeColumnType.java | TimeColumnType | instance | class TimeColumnType extends AbstractColumnType {
public static final int BYTE_SIZE = 4;
public static final TimeParser DEFAULT_PARSER = new TimeParser(ColumnType.LOCAL_TIME);
private static TimeColumnType INSTANCE;
private TimeColumnType(int byteSize, String name, String printerFriendlyName) {
super(by... |
if (INSTANCE == null) {
INSTANCE = new TimeColumnType(BYTE_SIZE, "LOCAL_TIME", "Time");
}
return INSTANCE;
| 244 | 48 | 292 | <methods>public int byteSize() ,public boolean equals(java.lang.Object) ,public java.lang.String getPrinterFriendlyName() ,public int hashCode() ,public java.lang.String name() ,public java.lang.String toString() <variables>private final non-sealed int byteSize,private final non-sealed java.lang.String name,private fin... |
jtablesaw_tablesaw | tablesaw/core/src/main/java/tech/tablesaw/columns/times/TimeParser.java | TimeParser | canParse | class TimeParser extends AbstractColumnParser<LocalTime> {
private static final DateTimeFormatter timef1 = DateTimeFormatter.ofPattern("HH:mm:ss.SSS");
private static final DateTimeFormatter timef2 = DateTimeParser.caseInsensitiveFormatter("hh:mm:ss a");
private static final DateTimeFormatter timef3 = DateTimePa... |
if (isMissing(s)) {
return true;
}
try {
LocalTime.parse(s, formatter.withLocale(locale));
return true;
} catch (DateTimeParseException e) {
// it's all part of the plan
return false;
}
| 843 | 78 | 921 | <methods>public void <init>(tech.tablesaw.api.ColumnType) ,public abstract boolean canParse(java.lang.String) ,public tech.tablesaw.api.ColumnType columnType() ,public boolean isMissing(java.lang.String) ,public abstract java.time.LocalTime parse(java.lang.String) ,public byte parseByte(java.lang.String) ,public double... |
jtablesaw_tablesaw | tablesaw/core/src/main/java/tech/tablesaw/conversion/TableConverter.java | TableConverter | floatMatrix | class TableConverter {
private final Relation table;
public TableConverter(Relation table) {
this.table = table;
}
public double[][] doubleMatrix() {
return doubleMatrix(table.numericColumns());
}
public double[][] doubleMatrix(int... columnIndicies) {
return doubleMatrix(table.numericColumn... |
Preconditions.checkArgument(!numberColumns.isEmpty());
int obs = numberColumns.get(0).size();
float[][] allVals = new float[obs][numberColumns.size()];
for (int r = 0; r < obs; r++) {
for (int c = 0; c < numberColumns.size(); c++) {
allVals[r][c] = (float) numberColumns.get(c).getDouble(... | 665 | 127 | 792 | <no_super_class> |
jtablesaw_tablesaw | tablesaw/core/src/main/java/tech/tablesaw/conversion/smile/SmileConverter.java | SmileConverter | toDataFrame | class SmileConverter {
private final Relation table;
public SmileConverter(Relation table) {
this.table = table;
}
public DataFrame toDataFrame() {
StructType schema =
DataTypes.struct(
table.columns().stream()
.map(col -> new StructField(col.name(), toSmileType(co... |
List<Tuple> rows = new ArrayList<>();
int colCount = table.columnCount();
for (int rowIndex = 0; rowIndex < table.rowCount(); rowIndex++) {
Object[] row = new Object[colCount];
for (int colIndex = 0; colIndex < colCount; colIndex++) {
Column<?> col = table.column(colIndex);
if (... | 483 | 213 | 696 | <no_super_class> |
jtablesaw_tablesaw | tablesaw/core/src/main/java/tech/tablesaw/filtering/And.java | And | apply | class And implements Function<Table, Selection> {
private Function<Table, Selection>[] arguments;
@SafeVarargs
public And(Function<Table, Selection>... arguments) {
Preconditions.checkNotNull(arguments, "The arguments to And must be non-null");
Preconditions.checkArgument(
arguments.length > 0, ... |
Selection result = arguments[0].apply(table);
for (int i = 1; i < arguments.length; i++) {
result.and(arguments[i].apply(table));
}
return result;
| 143 | 58 | 201 | <no_super_class> |
jtablesaw_tablesaw | tablesaw/core/src/main/java/tech/tablesaw/filtering/Or.java | Or | apply | class Or implements Function<Table, Selection> {
private Function<Table, Selection>[] arguments;
@SafeVarargs
public Or(Function<Table, Selection>... arguments) {
Preconditions.checkNotNull(arguments, "The arguments to Or must be non-null");
Preconditions.checkArgument(
arguments.length > 0, "Th... |
Selection result = arguments[0].apply(table);
for (int i = 1; i < arguments.length; i++) {
result.or(arguments[i].apply(table));
}
return result;
| 143 | 58 | 201 | <no_super_class> |
jtablesaw_tablesaw | tablesaw/core/src/main/java/tech/tablesaw/index/ByteIndex.java | ByteIndex | greaterThan | class ByteIndex implements Index {
private final Byte2ObjectAVLTreeMap<IntArrayList> index;
/** Constructs an index for the given column */
public ByteIndex(BooleanColumn column) {
Preconditions.checkArgument(
column.type().equals(ColumnType.BOOLEAN), "Byte indexing only allowed on BOOLEAN columns")... |
Selection selection = new BitmapBackedSelection();
Byte2ObjectSortedMap<IntArrayList> tail = index.tailMap((byte) (value + 1));
for (IntArrayList keys : tail.values()) {
addAllToSelection(keys, selection);
}
return selection;
| 842 | 74 | 916 | <no_super_class> |
jtablesaw_tablesaw | tablesaw/core/src/main/java/tech/tablesaw/index/DoubleIndex.java | DoubleIndex | atLeast | class DoubleIndex implements Index {
private final Double2ObjectAVLTreeMap<IntArrayList> index;
/** Constructs an index for the given column */
public DoubleIndex(DoubleColumn column) {
int sizeEstimate = Integer.min(1_000_000, column.size() / 100);
Double2ObjectOpenHashMap<IntArrayList> tempMap = new D... |
Selection selection = new BitmapBackedSelection();
Double2ObjectSortedMap<IntArrayList> tail = index.tailMap(value);
for (IntArrayList keys : tail.values()) {
addAllToSelection(keys, selection);
}
return selection;
| 807 | 69 | 876 | <no_super_class> |
jtablesaw_tablesaw | tablesaw/core/src/main/java/tech/tablesaw/index/FloatIndex.java | FloatIndex | greaterThan | class FloatIndex implements Index {
private final Float2ObjectAVLTreeMap<IntArrayList> index;
/** Constructs an index for the given column */
public FloatIndex(FloatColumn column) {
int sizeEstimate = Integer.min(1_000_000, column.size() / 100);
Float2ObjectOpenHashMap<IntArrayList> tempMap = new Float2... |
Selection selection = new BitmapBackedSelection();
Float2ObjectSortedMap<IntArrayList> tail = index.tailMap(value + 0.000001f);
for (IntArrayList keys : tail.values()) {
addAllToSelection(keys, selection);
}
return selection;
| 808 | 80 | 888 | <no_super_class> |
jtablesaw_tablesaw | tablesaw/core/src/main/java/tech/tablesaw/index/IntIndex.java | IntIndex | atMost | class IntIndex implements Index {
private final Int2ObjectAVLTreeMap<IntArrayList> index;
/** Constructs an index for the given column */
public IntIndex(DateColumn column) {
int sizeEstimate = Integer.min(1_000_000, column.size() / 100);
Int2ObjectOpenHashMap<IntArrayList> tempMap = new Int2ObjectOpenH... |
Selection selection = new BitmapBackedSelection();
Int2ObjectSortedMap<IntArrayList> head =
index.headMap(value + 1); // we add 1 to get values equal to the arg
for (IntArrayList keys : head.values()) {
addAllToSelection(keys, selection);
}
return selection;
| 1,796 | 85 | 1,881 | <no_super_class> |
jtablesaw_tablesaw | tablesaw/core/src/main/java/tech/tablesaw/index/LongIndex.java | LongIndex | get | class LongIndex implements Index {
private final Long2ObjectAVLTreeMap<IntArrayList> index;
/** Constructs an index for the given column */
public LongIndex(TemporalColumn<?> column) {
int sizeEstimate = Integer.min(1_000_000, column.size() / 100);
Long2ObjectOpenHashMap<IntArrayList> tempMap = new Long... |
Selection selection = new BitmapBackedSelection();
IntArrayList list = index.get(value);
if (list != null) {
addAllToSelection(list, selection);
}
return selection;
| 1,569 | 57 | 1,626 | <no_super_class> |
jtablesaw_tablesaw | tablesaw/core/src/main/java/tech/tablesaw/index/ShortIndex.java | ShortIndex | lessThan | class ShortIndex implements Index {
private final Short2ObjectAVLTreeMap<IntArrayList> index;
/** Constructs an index for the given column */
public ShortIndex(ShortColumn column) {
Preconditions.checkArgument(
column.type().equals(ShortColumnType.instance()),
"Short indexing only allowed on... |
Selection selection = new BitmapBackedSelection();
Short2ObjectSortedMap<IntArrayList> head =
index.headMap(value); // we add 1 to get values equal to the arg
for (IntArrayList keys : head.values()) {
addAllToSelection(keys, selection);
}
return selection;
| 833 | 83 | 916 | <no_super_class> |
jtablesaw_tablesaw | tablesaw/core/src/main/java/tech/tablesaw/index/StringIndex.java | StringIndex | get | class StringIndex implements Index {
private final Map<String, IntArrayList> index;
/** Creates an index on the given AbstractStringColumn */
public StringIndex(StringColumn column) {
int sizeEstimate = Integer.min(1_000_000, column.size() / 100);
Map<String, IntArrayList> tempMap = new HashMap<>(sizeEs... |
Selection selection = new BitmapBackedSelection();
IntArrayList list = index.get(value);
if (list != null) {
addAllToSelection(list, selection);
}
return selection;
| 354 | 57 | 411 | <no_super_class> |
jtablesaw_tablesaw | tablesaw/core/src/main/java/tech/tablesaw/interpolation/Interpolator.java | Interpolator | frontfill | class Interpolator<T> {
/** The column being interpolated */
protected final Column<T> col;
/** Constructs an object for performing interpolation on the given column */
public Interpolator(Column<T> column) {
this.col = column;
}
/** Fills missing values with the next non-missing value */
public Co... |
Column<T> result = col.copy();
T lastVal = null;
for (int i = 0; i < col.size(); i++) {
if (col.isMissing(i)) {
if (lastVal != null) {
result.set(i, lastVal);
}
} else {
lastVal = col.get(i);
}
}
return result;
| 251 | 106 | 357 | <no_super_class> |
jtablesaw_tablesaw | tablesaw/core/src/main/java/tech/tablesaw/io/AddCellToColumnException.java | AddCellToColumnException | dumpRow | class AddCellToColumnException extends RuntimeException {
private static final long serialVersionUID = 1L;
/** The index of the column that threw the Exception */
private final int columnIndex;
/** The number of the row that caused the exception to be thrown */
private final long rowNumber;
/** The colu... |
for (int i = 0; i < columnNames.size(); i++) {
out.print("Column ");
out.print(i);
out.print(" ");
out.print(columnNames.get(columnIndex));
out.print(" : ");
try {
out.println(line[i]);
} catch (ArrayIndexOutOfBoundsException aioobe) {
out.println("Unable t... | 561 | 124 | 685 | <methods>public void <init>() ,public void <init>(java.lang.String) ,public void <init>(java.lang.Throwable) ,public void <init>(java.lang.String, java.lang.Throwable) <variables>static final long serialVersionUID |
jtablesaw_tablesaw | tablesaw/core/src/main/java/tech/tablesaw/io/DataFrameReader.java | DataFrameReader | string | class DataFrameReader {
private final ReaderRegistry registry;
public DataFrameReader(ReaderRegistry registry) {
this.registry = registry;
}
/**
* Reads the given URL into a table using default options Uses appropriate converter based on
* mime-type Use {@link #usingOptions(ReadOptions) usingOption... |
Optional<DataReader<?>> reader = registry.getReaderForExtension(fileExtension);
if (!reader.isPresent()) {
throw new IllegalArgumentException("No reader registered for extension " + fileExtension);
}
return reader.get().read(Source.fromString(s));
| 1,540 | 70 | 1,610 | <no_super_class> |
jtablesaw_tablesaw | tablesaw/core/src/main/java/tech/tablesaw/io/DataFrameWriter.java | DataFrameWriter | toFile | class DataFrameWriter {
private final WriterRegistry registry;
private final Table table;
public DataFrameWriter(WriterRegistry registry, Table table) {
this.registry = registry;
this.table = table;
}
public void toFile(String file) {
toFile(new File(file));
}
public void toFile(File file)... |
String extension = null;
try {
extension = Files.getFileExtension(file.getCanonicalPath());
} catch (IOException e) {
throw new RuntimeIOException(e);
}
DataWriter<?> dataWriter = registry.getWriterForExtension(extension);
dataWriter.write(table, new Destination(file));
| 560 | 86 | 646 | <no_super_class> |
jtablesaw_tablesaw | tablesaw/core/src/main/java/tech/tablesaw/io/Destination.java | Destination | createWriter | class Destination {
protected final OutputStream stream;
protected final Writer writer;
public Destination(File file) {
try {
this.stream = new FileOutputStream(file);
} catch (FileNotFoundException e) {
throw new RuntimeIOException(e);
}
this.writer = null;
}
public Destination... |
if (writer != null) {
return writer;
} else {
assert stream != null;
return new OutputStreamWriter(stream);
}
| 201 | 44 | 245 | <no_super_class> |
jtablesaw_tablesaw | tablesaw/core/src/main/java/tech/tablesaw/io/ReadOptions.java | Builder | columnTypesToDetect | class Builder {
protected final Source source;
protected String tableName = "";
protected List<ColumnType> columnTypesToDetect = DEFAULT_TYPES;
protected boolean sample = true;
protected String dateFormat;
protected DateTimeFormatter dateFormatter;
protected String timeFormat;
protected... |
// Types need to be in certain order as more general types like string come last
// Otherwise everything will be parsed as a string
List<ColumnType> orderedTypes = new ArrayList<>();
for (ColumnType t : EXTENDED_TYPES) {
if (columnTypesToDetect.contains(t)) {
orderedTypes.add(... | 1,688 | 113 | 1,801 | <no_super_class> |
jtablesaw_tablesaw | tablesaw/core/src/main/java/tech/tablesaw/io/ReaderRegistry.java | ReaderRegistry | getReaderForOptions | class ReaderRegistry {
private final Map<String, DataReader<?>> optionTypesRegistry = new HashMap<>();
private final Map<String, DataReader<?>> extensionsRegistry = new HashMap<>();
private final Map<String, DataReader<?>> mimeTypesRegistry = new HashMap<>();
public void registerOptions(Class<? extends Read... |
String clazz = options.getClass().getCanonicalName();
DataReader<T> reader = (DataReader<T>) optionTypesRegistry.get(clazz);
if (reader == null) {
throw new IllegalArgumentException("No reader registered for class " + clazz);
}
return reader;
| 329 | 78 | 407 | <no_super_class> |
jtablesaw_tablesaw | tablesaw/core/src/main/java/tech/tablesaw/io/Source.java | Source | getCharSet | class Source {
// we always have one of these (file, reader, or inputStream)
protected final File file;
protected final Reader reader;
protected final InputStream inputStream;
protected final Charset charset;
public Source(File file) {
this(file, getCharSet(file));
}
public Source(File file, Char... |
CharsetDetector detector = new CharsetDetector();
detector.setText(buffer);
CharsetMatch match = detector.detect();
if (match == null || match.getConfidence() < 60) {
return Charset.defaultCharset();
}
return Charset.forName(match.getName());
| 1,071 | 82 | 1,153 | <no_super_class> |
jtablesaw_tablesaw | tablesaw/core/src/main/java/tech/tablesaw/io/TableBuildingUtils.java | TableBuildingUtils | build | class TableBuildingUtils {
public static Table build(
List<String> columnNames, List<String[]> dataRows, ReadOptions options) {<FILL_FUNCTION_BODY>}
} |
Table table = Table.create(options.tableName());
if (dataRows.isEmpty()) {
return table;
}
ColumnTypeDetector detector = new ColumnTypeDetector(options.columnTypesToDetect());
Iterator<String[]> iterator = dataRows.iterator();
ColumnType[] types = detector.detectColumnTypes(iterator, op... | 50 | 323 | 373 | <no_super_class> |
jtablesaw_tablesaw | tablesaw/core/src/main/java/tech/tablesaw/io/csv/CsvReader.java | CsvReader | detectColumnTypes | class CsvReader extends FileReader implements DataReader<CsvReadOptions> {
private static final CsvReader INSTANCE = new CsvReader();
static {
register(Table.defaultReaderRegistry);
}
public static void register(ReaderRegistry registry) {
registry.registerExtension("csv", INSTANCE);
registry.regi... |
boolean header = options.header();
CsvParser parser = csvParser(options);
try {
String[] columnNames = null;
if (header) {
parser.beginParsing(reader);
columnNames = getColumnNames(options, options.columnTypeReadOptions(), parser);
}
return getColumnTypes(reader, op... | 1,558 | 133 | 1,691 | <methods>public non-sealed void <init>() ,public java.lang.String[] getColumnNames(tech.tablesaw.io.ReadOptions, tech.tablesaw.io.ReadOptions.ColumnTypeReadOptions, AbstractParser<?>) ,public tech.tablesaw.api.ColumnType[] getColumnTypes(java.io.Reader, tech.tablesaw.io.ReadOptions, int, AbstractParser<?>, java.lang.St... |
jtablesaw_tablesaw | tablesaw/core/src/main/java/tech/tablesaw/io/csv/CsvWriter.java | CsvWriter | writeHeader | class CsvWriter implements DataWriter<CsvWriteOptions> {
private static final CsvWriter INSTANCE = new CsvWriter();
private static final String nullValue = "";
static {
register(Table.defaultWriterRegistry);
}
public static void register(WriterRegistry registry) {
registry.registerExtension("csv", ... |
if (options.header()) {
String[] header = new String[table.columnCount()];
for (int c = 0; c < table.columnCount(); c++) {
String name = table.column(c).name();
header[c] = options.columnNameMap().getOrDefault(name, name);
}
csvWriter.writeHeaders(header);
}
| 1,009 | 98 | 1,107 | <no_super_class> |
jtablesaw_tablesaw | tablesaw/core/src/main/java/tech/tablesaw/io/fixed/FixedWidthReader.java | FixedWidthReader | getReaderAndColumnTypes | class FixedWidthReader extends FileReader implements DataReader<FixedWidthReadOptions> {
private static final FixedWidthReader INSTANCE = new FixedWidthReader();
static {
register(Table.defaultReaderRegistry);
}
public static void register(ReaderRegistry registry) {
registry.registerOptions(FixedWidt... |
ReadOptions.ColumnTypeReadOptions columnTypeReadOptions = options.columnTypeReadOptions();
byte[] bytesCache = null;
boolean hasColumnNames =
options.columnSpecs() != null
&& options.columnSpecs().getFieldNames() != null
&& options.columnSpecs().getFieldNames().length > 0;
... | 1,412 | 317 | 1,729 | <methods>public non-sealed void <init>() ,public java.lang.String[] getColumnNames(tech.tablesaw.io.ReadOptions, tech.tablesaw.io.ReadOptions.ColumnTypeReadOptions, AbstractParser<?>) ,public tech.tablesaw.api.ColumnType[] getColumnTypes(java.io.Reader, tech.tablesaw.io.ReadOptions, int, AbstractParser<?>, java.lang.St... |
jtablesaw_tablesaw | tablesaw/core/src/main/java/tech/tablesaw/io/fixed/FixedWidthWriter.java | FixedWidthWriter | write | class FixedWidthWriter implements DataWriter<FixedWidthWriteOptions> {
private static final FixedWidthWriter INSTANCE = new FixedWidthWriter();
static {
register(Table.defaultWriterRegistry);
}
public static void register(WriterRegistry registry) {
registry.registerOptions(FixedWidthWriteOptions.clas... |
FixedWidthWriterSettings settings = fixedWidthWriterSettings(options);
settings.setFormat(fixedWidthFormat(options));
com.univocity.parsers.fixed.FixedWidthWriter fixedWidthWriter = null;
// Creates a writer with the above settings;
try {
Writer writer = options.destination().createWriter();... | 1,036 | 335 | 1,371 | <no_super_class> |
jtablesaw_tablesaw | tablesaw/core/src/main/java/tech/tablesaw/io/jdbc/SqlResultSetReader.java | SqlResultSetReader | getColumnType | class SqlResultSetReader {
// Maps from supported SQL types to their Tablesaw equivalents'
private static final Map<Integer, ColumnType> SQL_TYPE_TO_TABLESAW_TYPE = initializeMap();
private static Map<Integer, ColumnType> initializeMap() {
return new HashMap<>(
new ImmutableMap.Builder<Integer, Colu... |
ColumnType type = SQL_TYPE_TO_TABLESAW_TYPE.get(columnType);
// Try to improve on the initial type assigned to 'type' to minimize size/space of type needed.
// For all generic numeric columns inspect closer, checking the precision and
// scale to more accurately determine the appropriate java type to u... | 1,264 | 552 | 1,816 | <no_super_class> |
jtablesaw_tablesaw | tablesaw/core/src/main/java/tech/tablesaw/io/string/DataFramePrinter.java | DataFramePrinter | print | class DataFramePrinter {
private static final String TOO_SHORT_COLUMN_MARKER = "?";
private final int maxRows;
private final OutputStream stream;
/**
* Constructor
*
* @param maxRows the max rows to print
* @param stream the print stream to write to
*/
public DataFramePrinter(int maxRows, Ou... |
try {
final String[] headers = getHeaderTokens(frame);
final String[][] data = getDataTokens(frame);
final int[] widths = getWidths(headers, data);
final String dataTemplate = getDataTemplate(widths);
final String headerTemplate = getHeaderTemplate(widths, headers);
final int to... | 1,646 | 388 | 2,034 | <no_super_class> |
jtablesaw_tablesaw | tablesaw/core/src/main/java/tech/tablesaw/joining/ColumnIndexPair.java | ColumnIndexPair | toString | class ColumnIndexPair {
final ColumnType type;
final int left;
final int right;
public ColumnIndexPair(ColumnType type, int left, int right) {
this.type = type;
this.left = left;
this.right = right;
}
@Override
public String toString() {<FILL_FUNCTION_BODY>}
} |
final StringBuilder sb = new StringBuilder("ColumnIndexPair{");
sb.append("type=").append(type);
sb.append(", left=").append(left);
sb.append(", right=").append(right);
sb.append('}');
return sb.toString();
| 98 | 75 | 173 | <no_super_class> |
jtablesaw_tablesaw | tablesaw/core/src/main/java/tech/tablesaw/joining/RowComparatorChain.java | RowComparatorChain | equals | class RowComparatorChain implements Comparator<Row> {
private final List<Comparator<Row>> comparatorChain;
private BitSet orderingBits;
private boolean isLocked;
/** Constructs a comparator chain with the argument as the first node in the chain */
public RowComparatorChain(Comparator<Row> comparator) {
... |
if (this == object) {
return true;
} else if (null == object) {
return false;
} else if (!object.getClass().equals(this.getClass())) {
return false;
} else {
label48:
{
label32:
{
RowComparatorChain chain = (RowComparatorChain) object;
i... | 811 | 261 | 1,072 | <no_super_class> |
jtablesaw_tablesaw | tablesaw/core/src/main/java/tech/tablesaw/joining/SortKey.java | SortKey | comparator | class SortKey implements Iterable<ColumnIndexPair> {
/** Describes how the tables are to be sorted */
private final ArrayList<ColumnIndexPair> sortOrder = new ArrayList<>();
private SortKey(ColumnIndexPair pair) {
next(pair);
}
/**
* Returns a new SortKey defining the first sort (for the first join ... |
if (pair.type.equals(ColumnType.INTEGER)) {
return (r11, r21) -> {
int b1 = r11.getInt(pair.left);
int b2 = r21.getInt(pair.right);
return Integer.compare(b1, b2);
};
} else if (pair.type.equals(ColumnType.LOCAL_DATE)) {
return (r11, r21) -> {
int b1 = r11.getP... | 727 | 892 | 1,619 | <no_super_class> |
jtablesaw_tablesaw | tablesaw/core/src/main/java/tech/tablesaw/selection/BitmapBackedSelection.java | BitmapBackedSelection | selectNRowsAtRandom | class BitmapBackedSelection implements Selection {
private static final Random random = new Random();
private final RoaringBitmap bitmap;
/**
* Returns a selection initialized from 0 to the given size, which cane be used for queries that
* exclude certain items, by first selecting the items to exclude, th... |
Selection selection = new BitmapBackedSelection();
if (n > max) {
throw new IllegalArgumentException(
"Illegal arguments: N (" + n + ") greater than Max (" + max + ")");
}
int[] rows = new int[n];
if (n == max) {
for (int k = 0; k < n; ++k) {
selection.add(k);
}... | 1,755 | 271 | 2,026 | <no_super_class> |
jtablesaw_tablesaw | tablesaw/core/src/main/java/tech/tablesaw/sorting/Sort.java | Sort | getOrder | class Sort implements Iterable<Map.Entry<String, Sort.Order>> {
private final LinkedHashMap<String, Order> sortOrder = new LinkedHashMap<>();
/**
* Constructs a Sort specifying the order (ascending or descending) to apply to the column with
* the given name
*/
public Sort(String columnName, Order order... |
switch (prefix) {
case "+":
return Optional.of(Order.ASCEND);
case "-":
return Optional.of(Order.DESCEND);
default:
return Optional.empty();
}
| 1,103 | 61 | 1,164 | <no_super_class> |
jtablesaw_tablesaw | tablesaw/core/src/main/java/tech/tablesaw/sorting/SortUtils.java | SortUtils | getChain | class SortUtils {
private SortUtils() {}
/** Returns a comparator chain for sorting according to the given key */
public static IntComparatorChain getChain(Table table, Sort key) {<FILL_FUNCTION_BODY>}
/**
* Returns a comparator for the column matching the specified name
*
* @param column The column... |
Iterator<Map.Entry<String, Sort.Order>> entries = key.iterator();
Map.Entry<String, Sort.Order> sort = entries.next();
Column<?> column = table.column(sort.getKey());
IntComparator comparator = rowComparator(column, sort.getValue());
IntComparatorChain chain = new IntComparatorChain(comparator);
... | 344 | 154 | 498 | <no_super_class> |
jtablesaw_tablesaw | tablesaw/core/src/main/java/tech/tablesaw/sorting/comparators/IntComparatorChain.java | IntComparatorChain | checkChainIntegrity | class IntComparatorChain implements IntComparator, Serializable {
private static final long serialVersionUID = 1L;
private final List<IntComparator> comparatorChain;
private BitSet orderingBits;
private boolean isLocked;
/** Constructs a comparator chain with the argument as the first node in the chain */
... |
if (this.comparatorChain.isEmpty()) {
throw new UnsupportedOperationException(
"ComparatorChains must contain at least one Comparator");
}
| 1,077 | 46 | 1,123 | <no_super_class> |
jtablesaw_tablesaw | tablesaw/core/src/main/java/tech/tablesaw/table/RollingColumn.java | RollingColumn | calc | class RollingColumn {
/** The column providing the data for the rolling calculation */
protected final Column<?> column;
/** The size of the rolling window */
protected final int window;
/**
* Constructs a rolling column based on calculations on a sliding window of {@code window} rows of
* data from ... |
// TODO: the subset operation copies the array. creating a view would likely be more efficient
Column<?> result = function.returnType().create(generateNewColumnName(function));
for (int i = 0; i < window - 1; i++) {
result.appendMissing();
}
for (int origColIndex = 0; origColIndex < column.si... | 280 | 228 | 508 | <no_super_class> |
jtablesaw_tablesaw | tablesaw/core/src/main/java/tech/tablesaw/table/SelectionTableSliceGroup.java | SelectionTableSliceGroup | splitOnSelection | class SelectionTableSliceGroup extends TableSliceGroup {
/**
* Creates a TableSliceGroup where each slice contains {@code step} number of rows from the
* backing table
*
* @param original The original backing table that provides the data for the new slice group
* @param subTableNameTemplate The prefix... |
for (int i = 0; i < selections.size(); i++) {
TableSlice view = new TableSlice(getSourceTable(), selections.get(i));
String name = nameTemplate + ": " + i + 1;
view.setName(name);
getSlices().add(view);
}
| 348 | 85 | 433 | <methods>public transient tech.tablesaw.api.Table aggregate(java.lang.String, AggregateFunction<?,?>[]) ,public tech.tablesaw.api.Table aggregate(ListMultimap<java.lang.String,AggregateFunction<?,?>>) ,public static java.lang.String aggregateColumnName(java.lang.String, java.lang.String) ,public List<tech.tablesaw.api.... |
jtablesaw_tablesaw | tablesaw/core/src/main/java/tech/tablesaw/table/StandardTableSliceGroup.java | StandardTableSliceGroup | splitOn | class StandardTableSliceGroup extends TableSliceGroup {
/**
* Constructs a TableSliceGroup made by subdividing the original table by the given columns. A
* group subdividing on the two columns "Name" and "Place" will have a slice for every combination
* of name and place in the table
*/
private Standar... |
Map<ByteArray, Selection> selectionMap = new LinkedHashMap<>();
Map<ByteArray, String> sliceNameMap = new HashMap<>();
List<Column<?>> splitColumns = getSourceTable().columns(splitColumnNames);
if (containsTextColumn(splitColumns)) {
for (int i = 0; i < getSourceTable().rowCount(); i++) {
... | 692 | 663 | 1,355 | <methods>public transient tech.tablesaw.api.Table aggregate(java.lang.String, AggregateFunction<?,?>[]) ,public tech.tablesaw.api.Table aggregate(ListMultimap<java.lang.String,AggregateFunction<?,?>>) ,public static java.lang.String aggregateColumnName(java.lang.String, java.lang.String) ,public List<tech.tablesaw.api.... |
jtablesaw_tablesaw | tablesaw/core/src/main/java/tech/tablesaw/table/TableSliceGroup.java | TableSliceGroup | splitGroupingColumn | class TableSliceGroup implements Iterable<TableSlice> {
/**
* A string that is used internally as a delimiter in creating a column name from all the grouping
* columns
*/
protected static final String SPLIT_STRING = "~~~";
/**
* A function that splits the group column name back into the original col... |
if (splitColumnNames.length > 0) {
List<Column<?>> newColumns = new ArrayList<>();
List<Column<?>> columns = sourceTable.columns(splitColumnNames);
for (Column<?> column : columns) {
Column<?> newColumn = column.emptyCopy();
newColumns.add(newColumn);
}
// iterate thr... | 1,566 | 279 | 1,845 | <no_super_class> |
jtablesaw_tablesaw | tablesaw/core/src/main/java/tech/tablesaw/util/DoubleArrays.java | DoubleArrays | toN | class DoubleArrays {
/** Returns a double[] initialized with the values from 0 to n-1, inclusive; */
public static double[] toN(int n) {<FILL_FUNCTION_BODY>}
public static double[][] to2dArray(NumericColumn<?>... columns) {
Preconditions.checkArgument(columns.length >= 1);
int obs = columns[0].size();
... |
double[] result = new double[n];
for (int i = 0; i < n; i++) {
result[i] = i;
}
return result;
| 650 | 48 | 698 | <no_super_class> |
jtablesaw_tablesaw | tablesaw/docs-src/src/main/java/tech/tablesaw/docs/Main.java | Main | main | class Main {
public static void main(String[] args) throws IOException, InterruptedException {<FILL_FUNCTION_BODY>}
} |
List<DocsSourceFile> docsClasses =
Arrays.asList(
// Register new docs classes here.
new Tutorial(),
new GettingStarted(),
// userguide
new CrossTabs());
for (DocsSourceFile docsClass : docsClasses) {
docsClass.run();
}
| 37 | 91 | 128 | <no_super_class> |
jtablesaw_tablesaw | tablesaw/docs-src/src/main/java/tech/tablesaw/docs/OutputWriter.java | OutputWriter | write | class OutputWriter {
private final Class<?> clazz;
public OutputWriter(Class<?> clazz) {
this.clazz = clazz;
try {
emptyFile();
} catch (IOException e) {
throw new RuntimeException(e.getMessage(), e);
}
}
/**
* Write the output of arbitrary java code to a file so it can be used ... |
List<String> lines = new ArrayList<>();
lines.add("// @@ " + tag);
lines.addAll(Arrays.asList(object.toString().split(java.lang.System.lineSeparator())));
lines.add("// @@ " + tag);
lines.add(java.lang.System.lineSeparator());
Files.write(getPath(), lines, UTF_8, APPEND);
| 451 | 107 | 558 | <no_super_class> |
jtablesaw_tablesaw | tablesaw/docs-src/src/main/java/tech/tablesaw/docs/Tutorial.java | Tutorial | run | class Tutorial implements DocsSourceFile {
public static final OutputWriter outputWriter = new OutputWriter(Tutorial.class);
public void run() throws IOException {<FILL_FUNCTION_BODY>}
} |
// @@ table_read
Table tornadoes = Table.read().csv("../data/tornadoes_1950-2014.csv");
// @@ table_read
outputWriter.write(
// @@ table_columns
tornadoes.columnNames()
// @@ table_columns
,
"table_columns");
outputWriter.write(
// @@ table_shape
... | 56 | 1,350 | 1,406 | <no_super_class> |
jtablesaw_tablesaw | tablesaw/docs-src/src/main/java/tech/tablesaw/docs/userguide/CrossTabs.java | CrossTabs | run | class CrossTabs implements DocsSourceFile {
public static final OutputWriter outputWriter = new OutputWriter(CrossTabs.class);
@Override
public void run() throws IOException {<FILL_FUNCTION_BODY>}
} |
// @@ intro_block
// preparation: load the data, and add a string column to hold the months in the date col
Table table = Table.read().csv("../data/bush.csv");
StringColumn month = table.dateColumn("date").month();
month.setName("month");
table.addColumns(month);
// perform the crossTab o... | 60 | 670 | 730 | <no_super_class> |
jtablesaw_tablesaw | tablesaw/html/src/main/java/tech/tablesaw/io/html/HtmlReader.java | HtmlReader | read | class HtmlReader implements DataReader<HtmlReadOptions> {
private static final HtmlReader INSTANCE = new HtmlReader();
static {
register(Table.defaultReaderRegistry);
}
public static void register(ReaderRegistry registry) {
registry.registerExtension("html", INSTANCE);
registry.registerMimeType("... |
Document doc;
InputStream inputStream = options.source().inputStream();
try {
if (inputStream != null) {
// Reader must support mark, so can't use InputStreamReader
// Parse the InputStream directly
doc = Jsoup.parse(inputStream, null, "");
} else {
doc = Parser.... | 177 | 603 | 780 | <no_super_class> |
jtablesaw_tablesaw | tablesaw/html/src/main/java/tech/tablesaw/io/html/HtmlWriter.java | HtmlWriter | write | class HtmlWriter implements DataWriter<HtmlWriteOptions> {
private static final HtmlWriter INSTANCE = new HtmlWriter();
static {
register(Table.defaultWriterRegistry);
}
public static void register(WriterRegistry registry) {
registry.registerExtension("html", INSTANCE);
registry.registerOptions(H... |
ElementCreator elements = options.elementCreator();
Element html = elements.create("table");
html.appendChild(header(table.columns(), elements));
Element tbody = elements.create("tbody");
html.appendChild(tbody);
for (int row = 0; row < table.rowCount(); row++) {
tbody.appendChild(row(ro... | 451 | 153 | 604 | <no_super_class> |
jtablesaw_tablesaw | tablesaw/json/src/main/java/tech/tablesaw/io/json/JsonReader.java | JsonReader | read | class JsonReader implements DataReader<JsonReadOptions> {
private static final JsonReader INSTANCE = new JsonReader();
private static final ObjectMapper mapper = new ObjectMapper();
static {
register(Table.defaultReaderRegistry);
}
public static void register(ReaderRegistry registry) {
registry.reg... |
JsonNode jsonObj = null;
try {
jsonObj = mapper.readTree(options.source().createReader(null));
} catch (IOException e) {
throw new RuntimeIOException(e);
}
if (options.path() != null) {
jsonObj = jsonObj.at(options.path());
}
if (!jsonObj.isArray()) {
throw new Illeg... | 984 | 217 | 1,201 | <no_super_class> |
jtablesaw_tablesaw | tablesaw/json/src/main/java/tech/tablesaw/io/json/JsonWriter.java | JsonWriter | write | class JsonWriter implements DataWriter<JsonWriteOptions> {
private static final JsonWriter INSTANCE = new JsonWriter();
private static final ObjectMapper mapper =
new ObjectMapper().registerModule(new JavaTimeModule());
static {
register(Table.defaultWriterRegistry);
}
public static void register... |
ArrayNode output = mapper.createArrayNode();
if (options.asObjects()) {
for (int r = 0; r < table.rowCount(); r++) {
ObjectNode row = mapper.createObjectNode();
for (int c = 0; c < table.columnCount(); c++) {
row.set(table.column(c).name(), mapper.convertValue(table.get(r, c), J... | 185 | 367 | 552 | <no_super_class> |
jtablesaw_tablesaw | tablesaw/jsplot/src/main/java/tech/tablesaw/plotly/Plot.java | Plot | show | class Plot {
protected static final String DEFAULT_DIV_NAME = "target";
protected static final String DEFAULT_OUTPUT_FILE = "output.html";
protected static final String DEFAULT_OUTPUT_FILE_NAME = "output";
protected static final String DEFAULT_OUTPUT_FOLDER = "testoutput";
public static void show(Figure fig... |
Page page = Page.pageBuilder(figure, divName).build();
String output = page.asJavascript();
try {
try (Writer writer =
new OutputStreamWriter(new FileOutputStream(outputFile), StandardCharsets.UTF_8)) {
writer.write(output);
}
new Browser().browse(outputFile);
} cat... | 606 | 113 | 719 | <no_super_class> |
jtablesaw_tablesaw | tablesaw/jsplot/src/main/java/tech/tablesaw/plotly/Utils.java | Utils | dataAsString | class Utils {
private Utils() {}
public static String dataAsString(double[] data) {
return Arrays.toString(data);
}
/** @return un-escaped quote of argument */
public static String quote(String string) {
return "'" + string + "'";
}
/**
* Escapes string for Javascript, assuming but without ... |
StringBuilder builder = new StringBuilder("[");
for (double[] row : data) {
builder.append("[");
for (double value : row) {
builder.append(value);
builder.append(",");
}
builder.append("],");
}
builder.append("]");
return builder.toString();
| 335 | 90 | 425 | <no_super_class> |
jtablesaw_tablesaw | tablesaw/jsplot/src/main/java/tech/tablesaw/plotly/api/AreaPlot.java | AreaPlot | create | class AreaPlot {
public static Figure create(
String title, Table table, String xCol, String yCol, String groupCol) {<FILL_FUNCTION_BODY>}
public static Figure create(String title, Table table, String xCol, String yCol) {
Layout layout = Layout.builder(title, xCol, yCol).build();
ScatterTrace trace ... |
TableSliceGroup tables = table.splitOn(table.categoricalColumn(groupCol));
Layout layout = Layout.builder(title, xCol, yCol).showLegend(true).build();
ScatterTrace[] traces = new ScatterTrace[tables.size()];
for (int i = 0; i < tables.size(); i++) {
List<Table> tableList = tables.asTableList();... | 173 | 222 | 395 | <no_super_class> |
jtablesaw_tablesaw | tablesaw/jsplot/src/main/java/tech/tablesaw/plotly/api/BarPlot.java | BarPlot | create | class BarPlot {
protected static final int HEIGHT = 700;
protected static final int WIDTH = 900;
protected static Figure create(
Orientation orientation,
String title,
Table table,
String groupColName,
String numberColName) {
Layout layout = standardLayout(title).build();
... |
Layout layout = standardLayout(title).barMode(barMode).showLegend(true).build();
Trace[] traces = new Trace[numberColNames.length];
for (int i = 0; i < numberColNames.length; i++) {
String name = numberColNames[i];
BarTrace trace =
BarTrace.builder(table.categoricalColumn(groupColNa... | 254 | 162 | 416 | <no_super_class> |
jtablesaw_tablesaw | tablesaw/jsplot/src/main/java/tech/tablesaw/plotly/api/BoxPlot.java | BoxPlot | create | class BoxPlot {
private static final int HEIGHT = 600;
private static final int WIDTH = 800;
public static Figure create(
String title, Table table, String groupingColumn, String numericColumn) {<FILL_FUNCTION_BODY>}
} |
Layout layout = Layout.builder().title(title).height(HEIGHT).width(WIDTH).build();
BoxTrace trace =
BoxTrace.builder(table.categoricalColumn(groupingColumn), table.nCol(numericColumn))
.build();
return new Figure(layout, trace);
| 73 | 79 | 152 | <no_super_class> |
jtablesaw_tablesaw | tablesaw/jsplot/src/main/java/tech/tablesaw/plotly/api/BubblePlot.java | BubblePlot | create | class BubblePlot {
public static Figure create(
String title, Table table, String xCol, String yCol, String sizeColumn, String groupCol) {<FILL_FUNCTION_BODY>}
/**
* create a bubble plot using more options including color/sizeMode/opacity
*
* @param title plot title
* @param xColumn non-nullable... |
TableSliceGroup tables = table.splitOn(table.categoricalColumn(groupCol));
Layout layout = Layout.builder(title, xCol, yCol).showLegend(true).build();
ScatterTrace[] traces = new ScatterTrace[tables.size()];
for (int i = 0; i < tables.size(); i++) {
List<Table> tableList = tables.asTableList();... | 726 | 248 | 974 | <no_super_class> |
jtablesaw_tablesaw | tablesaw/jsplot/src/main/java/tech/tablesaw/plotly/api/CandlestickPlot.java | CandlestickPlot | create | class CandlestickPlot {
private static final String PLOT_TYPE = "candlestick";
/** Returns Figure containing candlestick time series plot with a default layout */
public static Figure create(
String title,
Table table,
String xCol,
String openCol,
String highCol,
String lowCo... |
return PricePlot.create(title, table, xCol, openCol, highCol, lowCol, closeCol, PLOT_TYPE);
| 106 | 36 | 142 | <no_super_class> |
jtablesaw_tablesaw | tablesaw/jsplot/src/main/java/tech/tablesaw/plotly/api/ContourPlot.java | ContourPlot | create | class ContourPlot {
private ContourPlot() {
}
public static Figure create(String title, Table table, String categoryCol1, String categoryCol2) {<FILL_FUNCTION_BODY>}
} |
Layout layout = Layout.builder(title).build();
Table counts = table.xTabCounts(categoryCol1, categoryCol2);
counts = counts.dropRows(counts.rowCount() - 1);
List<Column<?>> columns = counts.columns();
columns.remove(counts.columnCount() - 1);
Column<?> yColumn = columns.remove(0);
double[]... | 59 | 185 | 244 | <no_super_class> |
jtablesaw_tablesaw | tablesaw/jsplot/src/main/java/tech/tablesaw/plotly/api/Heatmap.java | Heatmap | create | class Heatmap {
private Heatmap() {}
public static Figure create(String title, Table table, String categoryCol1, String categoryCol2) {<FILL_FUNCTION_BODY>}
} |
Layout layout = Layout.builder(title).build();
Table counts = table.xTabCounts(categoryCol1, categoryCol2);
counts = counts.dropRows(counts.rowCount() - 1);
List<Column<?>> columns = counts.columns();
columns.remove(counts.columnCount() - 1);
Column<?> yColumn = columns.remove(0);
double[]... | 52 | 185 | 237 | <no_super_class> |
jtablesaw_tablesaw | tablesaw/jsplot/src/main/java/tech/tablesaw/plotly/api/Histogram2D.java | Histogram2D | create | class Histogram2D {
public static Figure create(String title, Table table, String xCol, String yCol) {<FILL_FUNCTION_BODY>}
} |
Histogram2DTrace trace =
Histogram2DTrace.builder(table.numberColumn(xCol), table.numberColumn(yCol)).build();
return new Figure(Layout.builder(title, xCol, yCol).build(), trace);
| 44 | 63 | 107 | <no_super_class> |
jtablesaw_tablesaw | tablesaw/jsplot/src/main/java/tech/tablesaw/plotly/api/LinePlot.java | LinePlot | create | class LinePlot {
public static Figure create(
String title, Table table, String xCol, String yCol, String groupCol) {<FILL_FUNCTION_BODY>}
public static Figure create(String title, Table table, String xCol, String yCol) {
Layout layout = Layout.builder(title, xCol, yCol).build();
ScatterTrace trace ... |
TableSliceGroup tables = table.splitOn(table.categoricalColumn(groupCol));
Layout layout = Layout.builder(title, xCol, yCol).showLegend(true).build();
ScatterTrace[] traces = new ScatterTrace[tables.size()];
for (int i = 0; i < tables.size(); i++) {
List<Table> tableList = tables.asTableList()... | 252 | 205 | 457 | <no_super_class> |
jtablesaw_tablesaw | tablesaw/jsplot/src/main/java/tech/tablesaw/plotly/api/OHLCPlot.java | OHLCPlot | create | class OHLCPlot {
private static final String PLOT_TYPE = "ohlc";
/** Returns Figure containing Open-High-Low-Close time series plot with a default layout */
public static Figure create(
String title,
Table table,
String xCol,
String openCol,
String highCol,
String lowCol,
... |
return PricePlot.create(title, table, xCol, openCol, highCol, lowCol, closeCol, PLOT_TYPE);
| 107 | 36 | 143 | <no_super_class> |
jtablesaw_tablesaw | tablesaw/jsplot/src/main/java/tech/tablesaw/plotly/api/PiePlot.java | PiePlot | create | class PiePlot {
public static Figure create(
String title, Table table, String groupColName, String numberColName) {<FILL_FUNCTION_BODY>}
} |
Layout layout = Layout.builder(title).build();
PieTrace trace =
PieTrace.builder(table.column(groupColName), table.numberColumn(numberColName))
.showLegend(true)
.build();
return new Figure(layout, trace);
| 48 | 76 | 124 | <no_super_class> |
jtablesaw_tablesaw | tablesaw/jsplot/src/main/java/tech/tablesaw/plotly/api/PricePlot.java | PricePlot | create | class PricePlot {
public static Figure create(
String title,
Table table,
String xCol,
String openCol,
String highCol,
String lowCol,
String closeCol,
String plotType) {<FILL_FUNCTION_BODY>}
} |
Layout layout = Layout.builder(title, xCol).build();
Column<?> x = table.column(xCol);
NumericColumn<?> open = table.numberColumn(openCol);
NumericColumn<?> high = table.numberColumn(highCol);
NumericColumn<?> low = table.numberColumn(lowCol);
NumericColumn<?> close = table.numberColumn(closeCo... | 75 | 362 | 437 | <no_super_class> |
jtablesaw_tablesaw | tablesaw/jsplot/src/main/java/tech/tablesaw/plotly/api/QQPlot.java | QQPlot | interpolate | class QQPlot {
/**
* Returns a figure containing a QQ Plot describing the differences between the distribution of
* values in the columns of interest
*
* @param title A title for the plot
* @param table The table containing the columns of interest
* @param columnName1 The name of the first numeric ... |
double[] interpolatedData = new double[size];
for (int i = 0; i < size; i++) {
double value = ((i + .5) / (double) size) * 100;
interpolatedData[i] = StatUtils.percentile(source, value);
}
return interpolatedData;
| 908 | 85 | 993 | <no_super_class> |
jtablesaw_tablesaw | tablesaw/jsplot/src/main/java/tech/tablesaw/plotly/api/QuantilePlot.java | QuantilePlot | create | class QuantilePlot {
/**
* Returns a figure containing a Quantile Plot describing the distribution of values in the column
* of interest
*
* @param title A title for the plot
* @param table The table containing the column of interest
* @param columnName The name of the numeric column containing the... |
NumericColumn<?> xCol = table.nCol(columnName);
double[] x = new double[xCol.size()];
for (int i = 0; i < x.length; i++) {
x[i] = i / (float) x.length;
}
NumericColumn<?> copy = xCol.copy();
copy.sortAscending();
ScatterTrace trace = ScatterTrace.builder(x, copy.asDoubleArray()).... | 126 | 156 | 282 | <no_super_class> |
jtablesaw_tablesaw | tablesaw/jsplot/src/main/java/tech/tablesaw/plotly/api/Scatter3DPlot.java | Scatter3DPlot | create | class Scatter3DPlot {
private static final int HEIGHT = 800;
private static final int WIDTH = 1000;
public static Figure create(
String title, Table table, String xCol, String yCol, String zCol, String groupCol) {
TableSliceGroup tables = table.splitOn(table.categoricalColumn(groupCol));
Layout ... |
TableSliceGroup tables = table.splitOn(table.categoricalColumn(groupCol));
Layout layout = standardLayout(title, xCol, yCol, zCol, false);
Scatter3DTrace[] traces = new Scatter3DTrace[tables.size()];
for (int i = 0; i < tables.size(); i++) {
List<Table> tableList = tables.asTableList();
... | 610 | 267 | 877 | <no_super_class> |
jtablesaw_tablesaw | tablesaw/jsplot/src/main/java/tech/tablesaw/plotly/api/ScatterPlot.java | ScatterPlot | create | class ScatterPlot {
private static final double OPACITY = .75;
public static Figure create(
String title, Table table, String xCol, String yCol, String groupCol) {
TableSliceGroup tables = table.splitOn(table.categoricalColumn(groupCol));
Layout layout = Layout.builder(title, xCol, yCol).showLegen... |
Layout layout = Layout.builder(title, xCol, yCol).build();
ScatterTrace trace =
ScatterTrace.builder(table.numberColumn(xCol), table.numberColumn(yCol)).build();
return new Figure(layout, trace);
| 396 | 67 | 463 | <no_super_class> |
jtablesaw_tablesaw | tablesaw/jsplot/src/main/java/tech/tablesaw/plotly/api/TimeSeriesPlot.java | TimeSeriesPlot | create | class TimeSeriesPlot {
public static Figure create(
String title, Table table, String dateColX, String yCol, String groupCol) {
TableSliceGroup tables = table.splitOn(table.categoricalColumn(groupCol));
Layout layout = Layout.builder(title, dateColX, yCol).build();
ScatterTrace[] traces = new Sc... |
Layout layout = Layout.builder(title, xTitle, yTitle).build();
ScatterTrace trace = ScatterTrace.builder(xCol, yCol).mode(ScatterTrace.Mode.LINE).build();
return new Figure(layout, trace);
| 850 | 65 | 915 | <no_super_class> |
jtablesaw_tablesaw | tablesaw/jsplot/src/main/java/tech/tablesaw/plotly/api/TukeyMeanDifferencePlot.java | TukeyMeanDifferencePlot | interpolate | class TukeyMeanDifferencePlot {
/**
* Returns a figure containing a Tukey Mean-Difference Plot describing the differences between the
* data in two columns of interest
*
* @param title A title for the plot
* @param measure The measure being compared on the plot (e.g "inches" or "height in inches"
*... |
double[] interpolatedData = new double[size];
for (int i = 0; i < size; i++) {
double value = ((i + .5) / (double) size) * 100;
interpolatedData[i] = StatUtils.percentile(source, value);
}
return interpolatedData;
| 1,046 | 85 | 1,131 | <no_super_class> |
jtablesaw_tablesaw | tablesaw/jsplot/src/main/java/tech/tablesaw/plotly/api/ViolinPlot.java | ViolinPlot | create | class ViolinPlot {
private static final int HEIGHT = 600;
private static final int WIDTH = 800;
public static Figure create(
String title, Table table, String groupingColumn, String numericColumn, boolean showBoxPlot, boolean showMeanLine) {<FILL_FUNCTION_BODY>}
} |
Layout layout = Layout.builder().title(title).height(HEIGHT).width(WIDTH).build();
ViolinTrace trace =
ViolinTrace.builder(table.categoricalColumn(groupingColumn), table.nCol(numericColumn))
.boxPlot(showBoxPlot)
.meanLine(showMeanLine)
... | 87 | 105 | 192 | <no_super_class> |
jtablesaw_tablesaw | tablesaw/jsplot/src/main/java/tech/tablesaw/plotly/components/ColorBar.java | ColorBarBuilder | y | class ColorBarBuilder {
private ThicknessMode thicknessMode = DEFAULT_THICKNESS_MODE;
private double thickness = DEFAULT_THICKNESS; // (number greater than or equal to 0)
private LenMode lenMode = DEFAULT_LEN_MODE;
private double len = DEFAULT_LEN;
private double x = DEFAULT_X;
private int... |
Preconditions.checkArgument(y >= -2 && y <= 3);
this.y = y;
return this;
| 1,362 | 33 | 1,395 | <methods>public non-sealed void <init>() ,public java.lang.String asJSON() ,public abstract java.lang.String asJavascript() ,public java.lang.String toString() <variables>private final PebbleEngine engine,protected static final ObjectMapper mapper |
jtablesaw_tablesaw | tablesaw/jsplot/src/main/java/tech/tablesaw/plotly/components/Component.java | Component | asJSON | class Component {
protected static final ObjectMapper mapper = new ObjectMapper();
static {
mapper.enable(SerializationFeature.INDENT_OUTPUT);
mapper.setSerializationInclusion(Include.NON_NULL);
mapper.enable(SerializationFeature.ORDER_MAP_ENTRIES_BY_KEYS);
}
private final PebbleEngine engine = T... |
StringWriter w = new StringWriter();
try {
mapper.writeValue(w, getJSONContext());
} catch (IOException ioe) {
throw new UncheckedIOException(ioe);
}
return w.toString();
| 349 | 63 | 412 | <no_super_class> |
jtablesaw_tablesaw | tablesaw/jsplot/src/main/java/tech/tablesaw/plotly/components/Config.java | Config | getContext | class Config extends Component {
private final Boolean displayModeBar;
private final Boolean responsive;
private final Boolean displayLogo;
private Config(Builder builder) {
this.displayModeBar = builder.displayModeBar;
this.responsive = builder.responsive;
this.displayLogo = builder.displayLogo;
... |
Map<String, Object> context = new HashMap<>();
context.put("displayModeBar", displayModeBar);
context.put("responsive", responsive);
context.put("displaylogo", displayLogo);
return context;
| 345 | 60 | 405 | <methods>public non-sealed void <init>() ,public java.lang.String asJSON() ,public abstract java.lang.String asJavascript() ,public java.lang.String toString() <variables>private final PebbleEngine engine,protected static final ObjectMapper mapper |
jtablesaw_tablesaw | tablesaw/jsplot/src/main/java/tech/tablesaw/plotly/components/Domain.java | Domain | getContext | class Domain extends Component {
private final Integer row;
private final Integer column;
private final double[] x;
private final double[] y;
private Domain(DomainBuilder builder) {
this.x = builder.x;
this.y = builder.y;
this.row = builder.row;
this.column = builder.column;
}
@Override... |
Map<String, Object> context = new HashMap<>();
context.put("column", column);
context.put("row", row);
context.put("x", x);
context.put("y", y);
return context;
| 378 | 63 | 441 | <methods>public non-sealed void <init>() ,public java.lang.String asJSON() ,public abstract java.lang.String asJavascript() ,public java.lang.String toString() <variables>private final PebbleEngine engine,protected static final ObjectMapper mapper |
jtablesaw_tablesaw | tablesaw/jsplot/src/main/java/tech/tablesaw/plotly/components/Figure.java | Figure | buildContext | class Figure {
private Trace[] data;
private Layout layout;
private Config config;
private EventHandler[] eventHandlers;
private final Map<String, Object> context = new HashMap<>();
private final PebbleEngine engine = TemplateUtils.getNewEngine();
public Figure(FigureBuilder builder) {
this.data =... |
String targetName = "target_" + divName;
context.put("divName", divName);
context.put("targetName", targetName);
StringBuilder builder = new StringBuilder();
if (layout != null) {
builder.append(layout.asJavascript());
}
if (config != null) {
builder.append(config.asJavascrip... | 1,301 | 242 | 1,543 | <no_super_class> |
jtablesaw_tablesaw | tablesaw/jsplot/src/main/java/tech/tablesaw/plotly/components/Font.java | FontBuilder | equals | class FontBuilder {
private Family fontFamily = Family.OPEN_SANS;
private int size = 12; // number greater than or equal to 1
private String color = "#444";
private FontBuilder() {}
public FontBuilder size(int size) {
Preconditions.checkArgument(size >= 1);
this.size = size;
r... |
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Font font = (Font) o;
return size == font.size && fontFamily == font.fontFamily && Objects.equals(color, font.color);
| 205 | 73 | 278 | <methods>public non-sealed void <init>() ,public java.lang.String asJSON() ,public abstract java.lang.String asJavascript() ,public java.lang.String toString() <variables>private final PebbleEngine engine,protected static final ObjectMapper mapper |
jtablesaw_tablesaw | tablesaw/jsplot/src/main/java/tech/tablesaw/plotly/components/Gradient.java | Gradient | getContext | class Gradient extends Component {
/** Defines the gradient type */
public enum Type {
RADIAL("radial"),
HORIZONTAL("horizontal"),
VERTICAL("vertical"),
NONE("none");
private final String value;
Type(String value) {
this.value = value;
}
@JsonValue
@Override
public ... |
Map<String, Object> context = new HashMap<>();
context.put("type", type);
if (color != null && color.length > 0) {
if (color.length > 1) {
context.put("color", color);
} else {
context.put("color", color[0]);
}
}
return context;
| 450 | 94 | 544 | <methods>public non-sealed void <init>() ,public java.lang.String asJSON() ,public abstract java.lang.String asJavascript() ,public java.lang.String toString() <variables>private final PebbleEngine engine,protected static final ObjectMapper mapper |
jtablesaw_tablesaw | tablesaw/jsplot/src/main/java/tech/tablesaw/plotly/components/HoverLabel.java | HoverLabel | getJSONContext | class HoverLabel extends Component {
/** Sets the background color of all hover labels on graph */
private final String bgColor;
/** Sets the border color of all hover labels on graph. */
private final String borderColor;
/** Sets the default hover label font used by all traces on the graph. */
private f... |
Map<String, Object> context = new HashMap<>();
context.put("bgcolor", bgColor);
context.put("bordercolor", borderColor);
context.put("namelength", nameLength);
context.put("font", font.getJSONContext());
return context;
| 738 | 74 | 812 | <methods>public non-sealed void <init>() ,public java.lang.String asJSON() ,public abstract java.lang.String asJavascript() ,public java.lang.String toString() <variables>private final PebbleEngine engine,protected static final ObjectMapper mapper |
jtablesaw_tablesaw | tablesaw/jsplot/src/main/java/tech/tablesaw/plotly/components/Line.java | LineBuilder | width | class LineBuilder {
private String color;
private double width = 2;
private double smoothing = 1;
private Shape shape = Shape.LINEAR;
private Dash dash = Dash.SOLID;
private boolean simplify = true;
/** Sets the line color */
public LineBuilder color(String color) {
this.color = c... |
Preconditions.checkArgument(width >= 0, "Line width must be >= 0.");
this.width = width;
return this;
| 416 | 36 | 452 | <methods>public non-sealed void <init>() ,public java.lang.String asJSON() ,public abstract java.lang.String asJavascript() ,public java.lang.String toString() <variables>private final PebbleEngine engine,protected static final ObjectMapper mapper |
jtablesaw_tablesaw | tablesaw/jsplot/src/main/java/tech/tablesaw/plotly/components/Margin.java | Margin | getContext | class Margin extends Component {
/** The left margin, in px */
private final int left;
/** The right margin, in px */
private final int right;
/** The top margin, in px */
private final int top;
/** The bottom margin, in px */
private final int bottom;
/** The amount of padding between the plotti... |
Map<String, Object> context = new HashMap<>();
context.put("t", top);
context.put("b", bottom);
context.put("r", right);
context.put("l", left);
context.put("pad", pad);
context.put("autoexpand", autoExpand);
return context;
| 658 | 86 | 744 | <methods>public non-sealed void <init>() ,public java.lang.String asJSON() ,public abstract java.lang.String asJavascript() ,public java.lang.String toString() <variables>private final PebbleEngine engine,protected static final ObjectMapper mapper |
jtablesaw_tablesaw | tablesaw/jsplot/src/main/java/tech/tablesaw/plotly/components/Marker.java | MarkerBuilder | size | class MarkerBuilder {
private double[] size = {6};
// Note, a marker can have a color, or color array, but not both
private String[] color;
private double[] colorArray;
private Gradient gradient;
private Palette colorScalePalette;
private boolean cAuto = DEFAULT_C_AUTO;
private double... |
String errorMessage = "All sizes in size array must be greater than 0.";
for (double d : size) {
Preconditions.checkArgument(d > 0, errorMessage);
}
this.size = size;
return this;
| 1,624 | 64 | 1,688 | <methods>public non-sealed void <init>() ,public java.lang.String asJSON() ,public abstract java.lang.String asJavascript() ,public java.lang.String toString() <variables>private final PebbleEngine engine,protected static final ObjectMapper mapper |
jtablesaw_tablesaw | tablesaw/jsplot/src/main/java/tech/tablesaw/plotly/components/Page.java | Page | getContext | class Page extends Component {
private final Figure figure;
private final String divName;
private final String plotlyJsLocation;
private Page(PageBuilder builder) {
this.figure = builder.figure;
this.divName = builder.divName;
this.plotlyJsLocation = builder.plotlyJsLocation;
}
@Override
p... |
Map<String, Object> context = new HashMap<>();
context.put("figureScript", figure.asJavascript(divName));
context.put("targetDiv", figure.divString(divName));
context.put("figureTitle", figure.getLayout() != null ? figure.getLayout().getTitle() : null);
context.put("plotlyJsLocation", plotlyJsLocat... | 317 | 106 | 423 | <methods>public non-sealed void <init>() ,public java.lang.String asJSON() ,public abstract java.lang.String asJavascript() ,public java.lang.String toString() <variables>private final PebbleEngine engine,protected static final ObjectMapper mapper |
jtablesaw_tablesaw | tablesaw/jsplot/src/main/java/tech/tablesaw/plotly/components/TemplateUtils.java | TemplateUtils | getNewEngine | class TemplateUtils {
private TemplateUtils() {}
private static Collection<String> templateLocations = new ArrayList<>();
public static void setTemplateLocations(String... locations) {
templateLocations = Arrays.asList(locations);
}
public static PebbleEngine getNewEngine() {<FILL_FUNCTION_BODY>}
} |
PebbleEngine engine;
try {
Loader<?> loader = new ClasspathLoader();
if (templateLocations != null && !templateLocations.isEmpty()) {
List<Loader<?>> loaders = new ArrayList<>();
for (String templateLocation : templateLocations) {
FileLoader fileLoader = new FileLoader();
... | 92 | 203 | 295 | <no_super_class> |
jtablesaw_tablesaw | tablesaw/jsplot/src/main/java/tech/tablesaw/plotly/components/change/Change.java | Change | getJSONContext | class Change extends Component {
// private static final ChangeLine DEFAULT_CHANGE_LINE = new LineBuilder().build();
private final ChangeLine changeLine;
private final String fillColor;
@Override
public String asJavascript() {
return asJSON();
}
Change(ChangeBuilder builder) {
this.changeLine ... |
Map<String, Object> context = new HashMap<>();
if (changeLine != null) context.put("line", changeLine.getJSONContext());
if (fillColor != null) context.put("fillcolor", fillColor);
return context;
| 257 | 66 | 323 | <methods>public non-sealed void <init>() ,public java.lang.String asJSON() ,public abstract java.lang.String asJavascript() ,public java.lang.String toString() <variables>private final PebbleEngine engine,protected static final ObjectMapper mapper |
jtablesaw_tablesaw | tablesaw/jsplot/src/main/java/tech/tablesaw/plotly/components/change/ChangeLine.java | ChangeLine | getJSONContext | class ChangeLine extends Component {
private static final int DEFAULT_WIDTH = 2;
private static final String DEFAULT_COLOR = "#3D9970";
private final String color;
private final int width;
private ChangeLine(LineBuilder lineBuilder) {
color = lineBuilder.color;
width = lineBuilder.width;
}
@Ov... |
Map<String, Object> context = new HashMap<>();
if (!color.equals(DEFAULT_COLOR)) context.put("color", color);
if (width != DEFAULT_WIDTH) context.put("width", width);
return context;
| 374 | 63 | 437 | <methods>public non-sealed void <init>() ,public java.lang.String asJSON() ,public abstract java.lang.String asJavascript() ,public java.lang.String toString() <variables>private final PebbleEngine engine,protected static final ObjectMapper mapper |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.