本文整理了Java中org.ujmp.core.Matrix.setAsObject()
方法的一些代码示例,展示了Matrix.setAsObject()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Matrix.setAsObject()
方法的具体详情如下:
包路径:org.ujmp.core.Matrix
类名称:Matrix
方法名:setAsObject
暂无
代码示例来源:origin: ujmp/universal-java-matrix-package
public void setObject(Object o, long... coordinates) {
matrix.setAsObject(o, coordinates);
}
代码示例来源:origin: ujmp/universal-java-matrix-package
public synchronized void setObject(T value, long... c) {
matrix.setAsObject(value, c);
}
代码示例来源:origin: ujmp/universal-java-matrix-package
public void setObject(Object value, long coordinates) {
getSource().setAsObject(value, coordinates);
}
代码示例来源:origin: ujmp/universal-java-matrix-package
public final synchronized void setValueAt(final Object aValue, final long rowIndex, final long columnIndex) {
matrix.setAsObject(aValue, rowIndex, columnIndex);
fireValueChanged(rowIndex, columnIndex, aValue);
}
代码示例来源:origin: ujmp/universal-java-matrix-package
public void setObject(Object value, long... coordinates) {
if (selection[ROW] != null && selection[COLUMN] != null) {
getSource().setAsObject(value, selection[ROW][(int) coordinates[ROW]],
selection[COLUMN][(int) coordinates[COLUMN]]);
} else {
if (selection[ROW] == null) {
getSource().setAsObject(value, coordinates[ROW],
selection[COLUMN][(int) coordinates[COLUMN]]);
} else {
getSource().setAsObject(value, selection[ROW][(int) coordinates[ROW]],
coordinates[COLUMN]);
}
}
}
代码示例来源:origin: ujmp/universal-java-matrix-package
public void setObject(Object o, long row, long column) {
Matrix m = rows.get(row);
if (m == null) {
// TODO: there should be a faster implementation than this:
m = new DefaultSparseObjectMatrix((long) 1, getColumnCount());
rows.put(row, m);
}
m.setAsObject(o, 0, column);
}
代码示例来源:origin: ujmp/universal-java-matrix-package
public void setObject(Object o, long row, long column) {
Matrix m = columns.get(column);
if (m == null) {
m = new DefaultSparseObjectMatrix(getRowCount(), 1);
columns.put(column, m);
}
m.setAsObject(o, row, 0);
}
代码示例来源:origin: ujmp/universal-java-matrix-package
public synchronized void setObject(Object value, long... coordinates) {
inputBuffer.setAsObject(value, coordinates);
outputToDoBuffer.add(Coordinates.wrap(coordinates).clone());
}
代码示例来源:origin: ujmp/universal-java-matrix-package
public void run() {
while (true) {
try {
while (outputToDoBuffer != null && !outputToDoBuffer.isEmpty()) {
Coordinates c = outputToDoBuffer.first();
outputToDoBuffer.remove(c);
Object value = inputBuffer.getAsObject(c.getLongCoordinates());
original.setAsObject(value, c.getLongCoordinates());
}
Thread.sleep(100);
} catch (Exception e) {
e.printStackTrace();
throw new RuntimeException("error writing to matrix", e);
}
}
}
}
代码示例来源:origin: ujmp/universal-java-matrix-package
public void setObject(final Object value, final long... coordinates) {
runningId = ++runningId >= maxTmpCoordinates ? 0 : runningId;
getSource().setAsObject(value,
Coordinates.plus(tmpCoordinates[runningId], coordinates, min));
}
}
代码示例来源:origin: ujmp/universal-java-matrix-package
@Override
public void setObject(Object value, long... coordinates) {
long index = MathUtil.pos2IndexColumnMajor(newSize, coordinates);
long[] oldPos = MathUtil.index2PosColumnMajor(oldSize, index);
getSource().setAsObject(value, oldPos);
}
代码示例来源:origin: jdmp/java-data-mining-package
private Matrix getMatrix(PRow row) throws Exception {
ARow aRow = (ARow) row;
int columns = aRow.getAdditionalValues().size() + 1;
Matrix m = DenseObjectMatrix2D.Factory.zeros(1, columns);
m.setAsObject(getSingleValue(aRow.getExpression()), 0, 0);
int i = 1;
for (PCommaValue commaValue : aRow.getAdditionalValues()) {
PExpression expr = ((ACommaValue) commaValue).getExpression();
m.setAsObject(getSingleValue(expr), 0, i++);
}
return m;
}
代码示例来源:origin: jdmp/java-data-mining-package
private Matrix getMatrix(PColumn column) throws Exception {
AColumn aColumn = (AColumn) column;
int rows = aColumn.getAdditionalValues().size() + 1;
Matrix m = DenseObjectMatrix2D.Factory.zeros(rows, 1);
m.setAsObject(getSingleValue(aColumn.getExpression()), 0, 0);
int i = 1;
for (PSemicolonValue semicolonValue : aColumn.getAdditionalValues()) {
PExpression expr = ((ASemicolonValue) semicolonValue).getExpression();
m.setAsObject(getSingleValue(expr), i++, 0);
}
return m;
}
代码示例来源:origin: jdmp/java-data-mining-package
public void setObject(Object value, long row, long column) {
long rows = 0;
for (Matrix m : variable) {
rows += m.getRowCount();
if (rows > row) {
long r = row - rows + m.getRowCount();
if (column < m.getColumnCount()) {
m.setAsObject(value, r, column);
return;
} else {
return;
}
}
}
}
代码示例来源:origin: ujmp/universal-java-matrix-package
public void setObject(Object value, long... coordinates) {
getSource().setAsObject(value, Coordinates.modulo(coordinates, getSource().getSize()));
}
代码示例来源:origin: ujmp/universal-java-matrix-package
public final void setDimensionMetaData(int dimension, Object label, long... position) {
if (metaData == null) {
metaData = new DefaultMapMatrix<String, Object>(new TreeMap<String, Object>());
}
Matrix m = getMetaDataDimensionMatrix(dimension);
long old = position[dimension];
position[dimension] = 0;
if (!Coordinates.isSmallerThan(position, m.getSize())) {
long[] newSize = Coordinates.max(m.getSize(), Coordinates.plus(position, 1));
m.setSize(newSize);
}
m.setAsObject(label, position);
position[dimension] = old;
}
代码示例来源:origin: ujmp/universal-java-matrix-package
public static Matrix calcNew(ValueType valueType, Matrix source) {
Matrix ret = Matrix.Factory.zeros(valueType, source.getSize());
for (long[] c : source.availableCoordinates()) {
ret.setAsObject(source.getAsObject(c), c);
}
MapMatrix<String, Object> a = source.getMetaData();
if (a != null) {
ret.setMetaData(a.clone());
}
return ret;
}
代码示例来源:origin: ujmp/universal-java-matrix-package
public Matrix calcOrig() {
if (!Coordinates.equals(getSource().getSize(), getSize())) {
throw new RuntimeException(
"Cannot change Matrix size. Use calc(Ret.NEW) or calc(Ret.LINK) instead.");
}
for (long[] c : getSource().allCoordinates()) {
getSource().setAsObject(getObject(c), c);
}
getSource().fireValueChanged();
return getSource();
}
代码示例来源:origin: ujmp/universal-java-matrix-package
public Matrix calcOrig() {
if (!Coordinates.equals(getSource().getSize(), getSize())) {
throw new RuntimeException(
"Cannot change Matrix size. Use calc(Ret.NEW) or calc(Ret.LINK) instead.");
}
long[] newCoordinates = new long[position.length];
for (long[] c : newContent.allCoordinates()) {
Coordinates.plus(newCoordinates, position, c);
getSource().setAsObject(getObject(newCoordinates), newCoordinates);
}
getSource().fireValueChanged();
return getSource();
}
}
代码示例来源:origin: ujmp/universal-java-matrix-package
public final Matrix calcNew() {
// Matrix result = MatrixFactory.zeros(getSource().getValueType(),
// getSize());
Matrix result = Matrix.Factory.zeros(getValueType(), getSize());
for (long[] c : result.allCoordinates()) {
result.setAsObject(getObject(c), c);
}
if (getMetaData() != null) {
result.setMetaData(getMetaData().clone());
}
return result;
}
内容来源于网络,如有侵权,请联系作者删除!