org.ujmp.core.Matrix.setContent()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(6.2k)|赞(0)|评价(0)|浏览(128)

本文整理了Java中org.ujmp.core.Matrix.setContent()方法的一些代码示例,展示了Matrix.setContent()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Matrix.setContent()方法的具体详情如下:
包路径:org.ujmp.core.Matrix
类名称:Matrix
方法名:setContent

Matrix.setContent介绍

暂无

代码示例

代码示例来源:origin: ujmp/universal-java-matrix-package

public Matrix asDenseCSV(char columnSeparator, char enclosingCharacter) throws IOException {
  char[] buffer = new char[65536];
  StringBuilder sb = new StringBuilder();
  int length = -1;
  while ((length = getReader().read(buffer)) != -1) {
    sb.append(buffer, 0, length);
  }
  Matrix m = new DenseCSVStringMatrix2D(columnSeparator, enclosingCharacter, sb.toString()
      .getBytes());
  if (getTargetMatrix() != null) {
    getTargetMatrix().setContent(Ret.ORIG, m, 0, 0);
    return getTargetMatrix();
  } else {
    return m;
  }
}

代码示例来源:origin: ujmp/universal-java-matrix-package

public Matrix asDenseCSV(char columnSeparator, char enclosingCharacter) throws IOException {
  Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
  Transferable clipData = clipboard.getContents(null);
  String s;
  try {
    s = (String) (clipData.getTransferData(DataFlavor.stringFlavor));
  } catch (UnsupportedFlavorException e) {
    throw new IOException(e);
  }
  Matrix m = new DenseCSVStringMatrix2D(columnSeparator, enclosingCharacter, s.getBytes());
  if (getTargetMatrix() != null) {
    getTargetMatrix().setContent(Ret.ORIG, m, 0, 0);
    return getTargetMatrix();
  } else {
    return m;
  }
}

代码示例来源:origin: ujmp/universal-java-matrix-package

public Matrix asDenseCSV(char columnSeparator, char enclosingCharacter) throws IOException {
  // TODO: not optimal
  byte[] buffer = new byte[65536];
  ByteArrayOutputStream bos = new ByteArrayOutputStream();
  int length = -1;
  while ((length = getStream().read(buffer)) != -1) {
    bos.write(buffer, 0, length);
  }
  Matrix m = new DenseCSVStringMatrix2D(columnSeparator, enclosingCharacter,
      bos.toByteArray());
  if (getTargetMatrix() != null) {
    getTargetMatrix().setContent(Ret.ORIG, m, 0, 0);
    return getTargetMatrix();
  } else {
    return m;
  }
}

代码示例来源:origin: ujmp/universal-java-matrix-package

public Matrix asDenseCSV(char columnSeparator, char enclosingCharacter) throws IOException {
  Matrix m = new DenseCSVStringMatrix2D(columnSeparator, enclosingCharacter, getString()
      .getBytes());
  if (getTargetMatrix() != null) {
    getTargetMatrix().setContent(Ret.ORIG, m, 0, 0);
    return getTargetMatrix();
  } else {
    return m;
  }
}

代码示例来源:origin: ujmp/universal-java-matrix-package

public Object call() {
    MatrixGUIObject m = getMatrixObject();
    try {
      Matrix copy = Matrix.Factory.importFrom().clipboard().asDenseCSV();
      m.getMatrix().setContent(Ret.ORIG, copy, 0, 0);
    } catch (Exception e) {
      e.printStackTrace();
    }
    return null;
  }
}

代码示例来源:origin: ujmp/universal-java-matrix-package

public Matrix asPNG() throws IOException {
  Matrix tmp = new ImageMatrix(getFile());
  if (getTargetMatrix() == null) {
    return tmp;
  } else {
    getTargetMatrix().setContent(Ret.ORIG, tmp, 0, 0);
    return getTargetMatrix();
  }
}

代码示例来源:origin: ujmp/universal-java-matrix-package

public Matrix asDenseCSV(char columnSeparator, char enclosingCharacter) throws IOException {
  Matrix m = new DenseCSVStringMatrix2D(columnSeparator, enclosingCharacter, getFile());
  if (getTargetMatrix() != null) {
    getTargetMatrix().setContent(Ret.ORIG, m, 0, 0);
    return getTargetMatrix();
  } else {
    return m;
  }
}

代码示例来源:origin: ujmp/universal-java-matrix-package

public Matrix asGIF() throws IOException {
  Matrix tmp = new ImageMatrix(getFile());
  if (getTargetMatrix() == null) {
    return tmp;
  } else {
    getTargetMatrix().setContent(Ret.ORIG, tmp, 0, 0);
    return getTargetMatrix();
  }
}

代码示例来源:origin: ujmp/universal-java-matrix-package

public Matrix asTIFF() throws IOException {
  Matrix tmp = new ImageMatrix(getFile());
  if (getTargetMatrix() == null) {
    return tmp;
  } else {
    getTargetMatrix().setContent(Ret.ORIG, tmp, 0, 0);
    return getTargetMatrix();
  }
}

代码示例来源:origin: ujmp/universal-java-matrix-package

public Matrix asBMP() throws IOException {
  Matrix tmp = new ImageMatrix(getFile());
  if (getTargetMatrix() == null) {
    return tmp;
  } else {
    getTargetMatrix().setContent(Ret.ORIG, tmp, 0, 0);
    return getTargetMatrix();
  }
}

代码示例来源:origin: ujmp/universal-java-matrix-package

public Matrix asJPG() throws IOException {
  Matrix tmp = new ImageMatrix(getFile());
  if (getTargetMatrix() == null) {
    return tmp;
  } else {
    getTargetMatrix().setContent(Ret.ORIG, tmp, 0, 0);
    return getTargetMatrix();
  }
}

代码示例来源:origin: ujmp/universal-java-matrix-package

public Matrix asDenseCSV(char columnSeparator, char enclosingCharacter) throws IOException {
  Matrix tmp = new DenseCSVStringMatrix2D(getFile());
  if (getTargetMatrix() == null) {
    return tmp;
  } else {
    getTargetMatrix().setContent(Ret.ORIG, tmp, 0, 0);
    return getTargetMatrix();
  }
}

代码示例来源:origin: ujmp/universal-java-matrix-package

public Matrix asDenseCSV(char columnSeparator, char enclosingCharacter) throws IOException {
  Matrix m = new DenseCSVStringMatrix2D(columnSeparator, enclosingCharacter, getByteArray());
  if (getTargetMatrix() != null) {
    getTargetMatrix().setContent(Ret.ORIG, m, 0, 0);
    return getTargetMatrix();
  } else {
    return m;
  }
}

代码示例来源:origin: ujmp/universal-java-matrix-package

private Matrix getMatrix(Class<? extends Matrix> mclass, Matrix m) {
  try {
    Constructor<? extends Matrix> con = mclass.getConstructor(long.class, long.class);
    Matrix result = con.newInstance(m.getRowCount(), m.getColumnCount());
    result.setContent(Ret.ORIG, m, 0, 0);
    return result;
  } catch (Exception e) {
  }
  try {
    Constructor<? extends Matrix> con = mclass.getConstructor(int.class, int.class);
    Matrix result = con.newInstance((int) m.getRowCount(), (int) m.getColumnCount());
    result.setContent(Ret.ORIG, m, 0, 0);
    return result;
  } catch (Exception e) {
  }
  try {
    Constructor<? extends Matrix> con = mclass.getConstructor(long[].class);
    Matrix result = con.newInstance(new long[] { m.getRowCount(), m.getColumnCount() });
    result.setContent(Ret.ORIG, m, 0, 0);
    return result;
  } catch (Exception e) {
  }
  throw new RuntimeException("cannot create matrix class by reflection: " + mclass);
}

代码示例来源:origin: ujmp/universal-java-matrix-package

public Matrix asDenseCSV(char columnSeparator, char enclosingCharacter) throws IOException {
  byte[] bytes = HttpUtil.getBytesFromUrl(getURL());
  Matrix m = new DenseCSVStringMatrix2D(columnSeparator, enclosingCharacter, bytes);
  if (getTargetMatrix() != null) {
    getTargetMatrix().setContent(Ret.ORIG, m, 0, 0);
    return getTargetMatrix();
  } else {
    return m;
  }
}

代码示例来源:origin: jdmp/java-data-mining-package

@Override
protected Matrix putIntoMap(String key, Object value) {
  Matrix mv;
  if (value instanceof Matrix) {
    mv = (Matrix) value;
  } else {
    mv = Matrix.Factory.linkToValue(value);
  }
  Matrix m = dataSet.getMatrix(key);
  if (m == null || m.isEmpty()) {
    m = Matrix.Factory.zeros(dataSet.size(), mv.getColumnCount());
    dataSet.setMatrix(key, m);
  }
  m.setContent(Ret.ORIG, mv, index, 0);
  return null;
}

相关文章

Matrix类方法