com.buabook.kdb.Flips Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of java-kdb-communication Show documentation
Show all versions of java-kdb-communication Show documentation
Java library to publish data into and query data out of kdb+ processes (c) 2017 Sport Trades Ltd
The newest version!
package com.buabook.kdb;
import com.buabook.kdb.data.KdbTable;
import com.kx.c.Flip;
/**
* {@link Flip} and {@link KdbTable} Helpers
* (c) 2014 - 2015 Sport Trades Ltd
*
* @author Jas Rajasansir
* @version 1.0.2
* @since 15 Apr 2014
*/
public final class Flips {
/**
* Returns the row count of the specified table
* @param table The table to count the number of rows
* @return The row count
* @see Flips#getColumn(Flip, Integer)
*/
public static int getRowCount(Flip table) {
Object[] firstCol = getColumn(table, 0);
if(firstCol == null)
return 0;
return firstCol.length;
}
/**
* Returns the specified column from the data. This column value is indexed from 0
* @param table The table to get the column from
* @param column The index of the column to return
* @return The column
*/
public static Object[] getColumn(Flip table, Integer column) {
if(table == null || column == null)
return null;
if(table.y == null)
return null;
return (Object[]) table.y[column];
}
/** @return true
if the specified table is null
or has no data in it; false
otherwise */
public static boolean isNullOrEmpty(KdbTable table) {
return table == null || table.isEmpty();
}
/** @return true
if the specified table is null
or has no data in it; false
otherwise */
public static boolean isNullOrEmpty(Flip table) {
return table == null || getRowCount(table) == 0;
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy