当前位置: 首页>>代码示例>>Java>>正文


Java AxesMetadata.getAxes方法代码示例

本文整理汇总了Java中org.eclipse.january.metadata.AxesMetadata.getAxes方法的典型用法代码示例。如果您正苦于以下问题:Java AxesMetadata.getAxes方法的具体用法?Java AxesMetadata.getAxes怎么用?Java AxesMetadata.getAxes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.eclipse.january.metadata.AxesMetadata的用法示例。


在下文中一共展示了AxesMetadata.getAxes方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getIndexValues

import org.eclipse.january.metadata.AxesMetadata; //导入方法依赖的package包/类
@Override
public DoubleDataset getIndexValues()
{
  DoubleDataset res;

  if (isIndexed())
  {
    final AxesMetadata am = dataset.getFirstMetadata(AxesMetadata.class);

    DoubleDataset dd = (DoubleDataset) am.getAxes()[0];
    res = dd;
  }
  else
  {
    throw new IllegalArgumentException("Dataset isn't indexed");
  }

  return res;
}
 
开发者ID:debrief,项目名称:limpet,代码行数:20,代码来源:Document.java

示例2: testAddQuantityTemporalInterpSample

import org.eclipse.january.metadata.AxesMetadata; //导入方法依赖的package包/类
public void testAddQuantityTemporalInterpSample() throws MetadataException
{
  StoreGroup data = new SampleData().getData(20);
  final List<IStoreItem> selection = new ArrayList<IStoreItem>();
  selection.add(data.get(SampleData.SPEED_ONE));
  selection.add(data.get(SampleData.SPEED_TWO));
  selection.add(data.get(SampleData.SPEED_IRREGULAR2));

  final StoreGroup store = new StoreGroup("data store");
  final Collection<ICommand> commands =
      new AddQuantityOperation().actionsFor(selection, store, context);
  final ICommand firstC = commands.iterator().next();
  assertNotNull("found command", firstC);
  firstC.execute();
  NumberDocument output = (NumberDocument) firstC.getOutputs().get(0);
  
  output = (NumberDocument) data.get(output.getName());
  
  assertNotNull("found output", output);
  
  final int dataLen = output.size();
  assertEquals("17 items", 17, dataLen);
  
  DoubleDataset ds = (DoubleDataset) output.getDataset();
  List<AxesMetadata> ameta = ds.getMetadata(AxesMetadata.class);
  assertNotNull("found metadata");
  assertEquals("one set", 1, ameta.size());
  AxesMetadata am = ameta.get(0);
  ILazyDataset[] axes = am.getAxes();
  assertEquals("one axis", 1, axes.length);
  DoubleDataset thisD = (DoubleDataset) axes[0];
  assertEquals("correct length of data", dataLen, thisD.getSize());
  DoubleDataset indexValues = output.getIndexValues();
  assertEquals("same length", dataLen, indexValues.getData().length - indexValues.getOffset());
}
 
开发者ID:debrief,项目名称:limpet,代码行数:36,代码来源:TestArithmeticCollections.java

示例3: locationsFor

import org.eclipse.january.metadata.AxesMetadata; //导入方法依赖的package包/类
final protected LocationDocument locationsFor(final LocationDocument track1,
    final Document<?> times, final TimePeriod period)
{
  // ok, get the time values
  final AxesMetadata axis =
      times.getDataset().getFirstMetadata(AxesMetadata.class);
  final DoubleDataset ds = (DoubleDataset) axis.getAxes()[0];

  final double[] data = ds.getData();
  return locationsFor(track1, data, period);
}
 
开发者ID:debrief,项目名称:limpet,代码行数:12,代码来源:AbstractCommand.java

示例4: numbersFor

import org.eclipse.january.metadata.AxesMetadata; //导入方法依赖的package包/类
final protected NumberDocument numbersFor(final NumberDocument document,
    final Document<?> times, final TimePeriod period)
{
  // ok, get the time values
  final AxesMetadata axis =
      times.getDataset().getFirstMetadata(AxesMetadata.class);
  final DoubleDataset ds = (DoubleDataset) axis.getAxes()[0];
  final double[] data = ds.getData();
  return numbersFor(document, data, period);
}
 
开发者ID:debrief,项目名称:limpet,代码行数:11,代码来源:AbstractCommand.java

示例5: interpolateValue

import org.eclipse.january.metadata.AxesMetadata; //导入方法依赖的package包/类
public Double interpolateValue(final double i, final InterpMethod linear)
{
  Double res = null;

  // do we have axes?
  final AxesMetadata index = dataset.getFirstMetadata(AxesMetadata.class);
  final Dataset indexData = (Dataset) index.getAxes()[0];

  // check the target index is within the range
  final double lowerIndex = indexData.getDouble(0);
  final int indexSize = indexData.getSize();
  final double upperVal = indexData.getDouble(indexSize - 1);
  if (i >= lowerIndex && i <= upperVal)
  {
    // ok, in range
    final DoubleDataset ds = (DoubleDataset) dataset;
    final DoubleDataset indexes =
        (DoubleDataset) DatasetFactory.createFromObject(new Double[]
        {i});

    // perform the interpolation
    final Dataset dOut = Maths.interpolate(indexData, ds, indexes, 0, 0);

    // get the single matching value out
    res = dOut.getDouble(0);
  }

  return res;
}
 
开发者ID:debrief,项目名称:limpet,代码行数:30,代码来源:NumberDocument.java

示例6: toListing1D

import org.eclipse.january.metadata.AxesMetadata; //导入方法依赖的package包/类
private void toListing1D(final StringBuffer res, final DoubleDataset dataset,
    final AxesMetadata axesMetadata)
{
  final DoubleDataset axisDataset;
  if (axesMetadata != null && axesMetadata.getAxes().length > 0)
  {
    DoubleDataset doubleAxis = (DoubleDataset) axesMetadata.getAxes()[0];
    axisDataset = doubleAxis != null ? doubleAxis : null;
  }
  else
  {
    axisDataset = null;
  }

  final IndexIterator iterator = dataset.getIterator();

  res.append(dataset.getName() + ":\n");
  while (iterator.hasNext())
  {
    final String indexVal;
    if (axisDataset != null)
    {
      indexVal = "" + axisDataset.getElementDoubleAbs(iterator.index);
    }
    else
    {
      indexVal = "N/A";
    }

    res.append(indexVal + " : " + dataset.getElementDoubleAbs(iterator.index));
    res.append(";");
  }
  res.append("\n");
}
 
开发者ID:debrief,项目名称:limpet,代码行数:35,代码来源:NumberDocument.java

示例7: toListing

import org.eclipse.january.metadata.AxesMetadata; //导入方法依赖的package包/类
public String toListing()
{
  StringBuffer res = new StringBuffer();

  ObjectDataset dataset = (ObjectDataset) this.getDataset();
  final AxesMetadata axesMetadata =
      dataset.getFirstMetadata(AxesMetadata.class);
  final IndexIterator iterator = dataset.getIterator();

  final DoubleDataset axisDataset;
  if (axesMetadata != null && axesMetadata.getAxes().length > 0)
  {
    DoubleDataset doubleAxis = (DoubleDataset) axesMetadata.getAxes()[0];
    axisDataset = doubleAxis != null ? doubleAxis : null;
  }
  else
  {
    axisDataset = null;
  }

  res.append(dataset.getName() + ":\n");
  while (iterator.hasNext())
  {
    final String indexVal;
    if (axisDataset != null)
    {
      indexVal = "" + axisDataset.getElementDoubleAbs(iterator.index);
    }
    else
    {
      indexVal = "N/A";
    }

    res.append(indexVal + " : " + dataset.get(iterator.index));
    res.append(";");
  }
  res.append("\n");

  return res.toString();
}
 
开发者ID:debrief,项目名称:limpet,代码行数:41,代码来源:LocationDocument.java

示例8: getFirstAxes

import org.eclipse.january.metadata.AxesMetadata; //导入方法依赖的package包/类
/**
 * Convenience method to get first set of axes from the Datasets metadata, can return null
 * @param slice
 * @return axes
 */
public static ILazyDataset[] getFirstAxes(IDataset slice) {

	AxesMetadata am = slice.getFirstMetadata(AxesMetadata.class);
	if (am == null)
		return null;

	return am.getAxes();
}
 
开发者ID:eclipse,项目名称:dawnsci,代码行数:14,代码来源:AbstractOperationBase.java

示例9: printIndexedDataset

import org.eclipse.january.metadata.AxesMetadata; //导入方法依赖的package包/类
private static void printIndexedDataset(Dataset dataset)
{
	final AxesMetadata axesMetadata =
			dataset.getFirstMetadata(AxesMetadata.class);
	final IndexIterator iterator = dataset.getIterator();
	IndexIterator axisIterator = null;

	final DoubleDataset axisDataset;
	if (axesMetadata != null && axesMetadata.getAxes().length > 0)
	{
		DoubleDataset doubleAxis = null;
		try
		{
			ILazyDataset rawAxis = axesMetadata.getAxes()[0];
			Dataset axis = DatasetUtils.sliceAndConvertLazyDataset(rawAxis);
			doubleAxis = DatasetUtils.cast(DoubleDataset.class, axis);
			axisIterator = doubleAxis.getIterator();
		}
		catch (DatasetException e)
		{
			e.printStackTrace();
		}
		axisDataset = doubleAxis != null ? doubleAxis : null;
	}
	else
	{
		axisDataset = null;
	}

	System.out.println(dataset.getName() + ":");
	while (iterator.hasNext()
			&& (axisIterator == null || axisIterator.hasNext()))
	{
		final String indexVal;
		if (axisDataset != null)
		{
			indexVal =
					"" + axisDataset.getElementDoubleAbs(axisIterator.index) + " : ";
		}
		else
		{
			indexVal = "";
		}

		System.out.print(indexVal + dataset.getElementDoubleAbs(iterator.index));
		System.out.print(", ");
	}
	System.out.println();
}
 
开发者ID:eclipse,项目名称:january,代码行数:50,代码来源:AxesMetadataExample.java

示例10: convert

import org.eclipse.january.metadata.AxesMetadata; //导入方法依赖的package包/类
public static HContainer convert(final DoubleDataset dataset)
{
  final HContainer res = new HContainer();

  // ok, start by changing the table columns to the correct size
  // sort out the axes
  List<AxesMetadata> amList;
  try
  {
    amList = dataset.getMetadata(AxesMetadata.class);
    final AxesMetadata am = amList.get(0);
    final ILazyDataset[] axes = am.getAxes();
    if (axes.length != 2)
    {
      return null;
    }
    final DoubleDataset aOne = (DoubleDataset) axes[0];
    final DoubleDataset aTwo = (DoubleDataset) axes[1];

    final double[] aIndices = aOne.getData();
    res.rowTitles = aIndices;
    final double[] bIndices = aTwo.getData();
    res.colTitles = bIndices;

    res.values = new double[aIndices.length][bIndices.length];
    for (int i = 0; i < aIndices.length; i++)
    {
      for (int j = 0; j < bIndices.length; j++)
      {
        res.values[i][j] = dataset.get(i, j);
      }
    }

  }
  catch (final MetadataException e)
  {
    // TODO Auto-generated catch block
    e.printStackTrace();
  }

  return res;
}
 
开发者ID:debrief,项目名称:limpet,代码行数:43,代码来源:Helper2D.java

示例11: toListing

import org.eclipse.january.metadata.AxesMetadata; //导入方法依赖的package包/类
@Override
public String toListing()
{
  StringBuffer res = new StringBuffer();
  
  StringDataset dataset = (StringDataset) this.getDataset();
  final AxesMetadata axesMetadata =
      dataset.getFirstMetadata(AxesMetadata.class);
  final IndexIterator iterator = dataset.getIterator();

  final DoubleDataset axisDataset;
  if (axesMetadata != null && axesMetadata.getAxes().length > 0)
  {
    DoubleDataset doubleAxis = (DoubleDataset) axesMetadata.getAxes()[0];
    axisDataset = doubleAxis != null ? doubleAxis : null;
  }
  else
  {
    axisDataset = null;
  }

  res.append(dataset.getName() + ":\n");
  while (iterator.hasNext())
  {
    final String indexVal;
    if (axisDataset != null)
    {
      indexVal = "" + axisDataset.getString(iterator.index);
    }
    else
    {
      indexVal = "N/A";
    }

    res.append(indexVal + " : "
        + dataset.getString(iterator.index));
    res.append(";");
  }
  res.append("\n");
  
  return res.toString();
}
 
开发者ID:debrief,项目名称:limpet,代码行数:43,代码来源:StringDocument.java

示例12: getAxesAsIDatasetArray

import org.eclipse.january.metadata.AxesMetadata; //导入方法依赖的package包/类
public static IDataset[] getAxesAsIDatasetArray(ILazyDataset data) {
	IDataset[] out = new IDataset[data.getRank()];
	
	AxesMetadata md = data.getFirstMetadata(AxesMetadata.class);
	
	if (md == null) return out;
	
	ILazyDataset[] axes = md.getAxes();
	
	if (axes == null) return out;
	
	for (int i = 0 ; i < axes.length; i++) {
		try {
			out[i] = axes[i] == null ? null : axes[i].getSlice();
		} catch (Exception e) {
			logger.error("Could not slice axes",e);
		}
		
	}
	
	return out;
}
 
开发者ID:eclipse,项目名称:dawnsci,代码行数:23,代码来源:MetadataPlotUtils.java


注:本文中的org.eclipse.january.metadata.AxesMetadata.getAxes方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。