本文整理汇总了Java中org.eclipse.january.dataset.IDataset.set方法的典型用法代码示例。如果您正苦于以下问题:Java IDataset.set方法的具体用法?Java IDataset.set怎么用?Java IDataset.set使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.january.dataset.IDataset
的用法示例。
在下文中一共展示了IDataset.set方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: calculateJuliaSet
import org.eclipse.january.dataset.IDataset; //导入方法依赖的package包/类
/**
* Fill a Julia set around the origin for the value C = a + bi
*/
private IDataset calculateJuliaSet(final double a, final double b, int columns, int rows) {
final double xStart = -model.getMaxRealCoordinate();
final double xStop = model.getMaxRealCoordinate();
final double yStart = -model.getMaxImaginaryCoordinate();
final double yStop = model.getMaxImaginaryCoordinate();
final double yStep = (yStop - yStart) / (rows - 1);
double y;
IDataset juliaSet = DatasetFactory.zeros(rows,columns);
for (int yIndex = 0; yIndex < rows; yIndex++) {
y = yStart + yIndex * yStep;
IDataset line = calculateJuliaSetLine(a, b, y, xStart, xStop, columns);
for (int x = 0; x < line.getSize(); x++) {
juliaSet.set(line.getObject(x), yIndex, x);
}
}
return juliaSet;
}
示例2: calculateJuliaSet
import org.eclipse.january.dataset.IDataset; //导入方法依赖的package包/类
/**
* Fill a Julia set around the origin for the value C = a + bi
*/
private IDataset calculateJuliaSet(final double a, final double b, int columns, int rows) {
final double xStart = -model.getMaxx();
final double xStop = model.getMaxx();
final double yStart = -model.getMaxy();
final double yStop = model.getMaxy();
final double yStep = (yStop - yStart) / (rows - 1);
double y;
IDataset juliaSet = DatasetFactory.zeros(DoubleDataset.class, 1, 1, rows, columns);
for (int yIndex = 0; yIndex < rows; yIndex++) {
y = yStart + yIndex * yStep;
IDataset line = calculateJuliaSetLine(a, b, y, xStart, xStop, columns);
for (int x = 0; x < line.getSize(); x++) {
juliaSet.set(line.getObject(x), 0, 0, yIndex, x);
}
}
return juliaSet;
}
示例3: logicalAnd
import org.eclipse.january.dataset.IDataset; //导入方法依赖的package包/类
/**element-by-element AND operator
* a & b logical_and(a,b)
*/
@Test
public void logicalAnd() {
// Equivalent tech
BooleanDataset bs = Comparisons.logicalAnd(a, b);
System.out.println("Result of a && b "+bs);
// Or more useful (?)
final IDataset booleans = DatasetFactory.zeros(BooleanDataset.class, 3, 3);
booleans.set(true, 0,0);
booleans.set(true, 1,1);
booleans.set(true, 1,2);
final IDataset and = Maths.multiply(a, booleans);
System.out.println("Keeping some values using a boolean mask "+and);
}
示例4: calculateJuliaSetLine
import org.eclipse.january.dataset.IDataset; //导入方法依赖的package包/类
/**
* Fill a Julia set line between xStart and xStop at the given y value, for the value C = a + bi
*/
private IDataset calculateJuliaSetLine(final double a, final double b, final double y, final double xStart, final double xStop, final int numPoints) {
final double xStep = (xStop - xStart) / (numPoints - 1);
double x;
IDataset juliaSetLine = DatasetFactory.zeros(numPoints);
for (int xIndex = 0; xIndex < numPoints; xIndex++) {
x = xStart + xIndex * xStep;
juliaSetLine.set(julia(x, y, a, b), xIndex);
}
return juliaSetLine;
}
示例5: calculateJuliaSetLine
import org.eclipse.january.dataset.IDataset; //导入方法依赖的package包/类
/**
* Fill a Julia set line between xStart and xStop at the given y value, for the value C = a + bi
*/
private IDataset calculateJuliaSetLine(final double a, final double b, final double y, final double xStart, final double xStop, final int numPoints) {
final double xStep = (xStop - xStart) / (numPoints - 1);
double x;
IDataset juliaSetLine = DatasetFactory.zeros(DoubleDataset.class, numPoints);
for (int xIndex = 0; xIndex < numPoints; xIndex++) {
x = xStart + xIndex * xStep;
juliaSetLine.set(julia(x, y, a, b), xIndex);
}
return juliaSetLine;
}
示例6: createExampleContent
import org.eclipse.january.dataset.IDataset; //导入方法依赖的package包/类
@Override
protected void createExampleContent(Composite parent) {
// We create a basic plot
system.createPlotPart(parent, "Vector Example", getViewSite().getActionBars(), PlotType.IMAGE, this);
Dataset vectors = DatasetFactory.zeros(new int[]{20, 20, 2}, Dataset.FLOAT32);
for (int x = 0; x < 20; x++) {
for (int y = 0; y < 20; y++) {
vectors.set(x*100, x, y, 0); // This gets normalized later
vectors.set(2*Math.PI*((double)x/(20d)), x, y, 1);
}
}
final IDataset xAxis = DatasetFactory.zeros(new int[]{20}, Dataset.FLOAT32);
final IDataset yAxis = DatasetFactory.zeros(new int[]{20}, Dataset.FLOAT32);
for (int i = 0; i < 20; i++) {
xAxis.set(i*5, i);
yAxis.set(i*5, i);
}
final IVectorTrace vector = system.createVectorTrace("vector1");
vector.setData(vectors, Arrays.asList(xAxis, yAxis));
vector.setArrowColor(200, 0, 0);
vector.setArrowConfiguration(ArrowConfiguration.TO_CENTER_WITH_CIRCLE);
vector.setCircleColor(0,200,0);
//vector.setVectorNormalizationType(VectorNormalizationType.LOGARITHMIC);
system.addTrace(vector);
}