當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。