com.thomsonreuters.ema.access.Vector Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of ema Show documentation
Show all versions of ema Show documentation
Enterprise Message API (EMA) Java Edition
///*|-----------------------------------------------------------------------------
// *| This source code is provided under the Apache 2.0 license --
// *| and is provided AS IS with no warranty or guarantee of fit for purpose. --
// *| See the project's LICENSE.md for details. --
// *| Copyright (C) 2019 Refinitiv. All rights reserved. --
///*|-----------------------------------------------------------------------------
package com.thomsonreuters.ema.access;
import java.util.Collection;
/**
* Vector is a homogeneous container of complex data type entries.
* Vector is a collection which provides iterator over the elements in this collection.
*
* Vector entries are identified by index.
*
* The following code snippet shows addition of entry and summaryData to Vector.
*
* Vector vector = EmaFactory.createVector();
* FieldList fl = EmaFactory.createFieldList();
* fl.add(EmaFactory.createFieldEntry().real(22, 34, OmmReal.MagnitudeType.EXPONENT_POS_1));
* vector.summaryData(fl);
* ByteBuffer permission = (ByteBuffer)ByteBuffer.wrap("PERMISSION DATA".getBytes());
* fl.clear();
* fl.add(EmaFactory.createFieldEntry().real(22, 34, OmmReal.MagnitudeType.EXPONENT_POS_1));
* vector.add(EmaFactory.createVectorEntry().fieldList(1, VectorEntry.VectorAction.DELETE, fl, permission));
* vector.add(EmaFactory.createVectorEntry().fieldList(1, VectorEntry.VectorAction.SET, fl, permission));
*
*
* The following code snippet shows extracting data from Vector and its content.
*
* void decode(Vector vector)
* {
* switch(vector.summaryData().dataType())
* {
* case DataTypes.FIELD_LIST:
* decode(vector.summaryData().fieldList());
* break;
* case DataTypes.NO_DATA:
* break;
* }
*
* for(VectorEntry vectorEntry : vector)
* {
* System.out.println(" DataType: " + DataType.asString(vectorEntry.loadType()) + " Value: ");
*
* switch(vectorEntry.loadType())
* {
* case DataTypes.FIELD_LIST:
* decode(vectorEntry.fieldList());
* break;
* case DataTypes.NO_DATA:
* break;
* }
* }
* }
*
*
* Objects of this class are intended to be short lived or rather transitional.
* This class is designed to efficiently perform setting and extracting of Vector and its content.
* Objects of this class are not cache-able.
*
* @see Data
* @see VectorEntry
* @see SummaryData
* @see ReqMsg
* @see RefreshMsg
* @see UpdateMsg
* @see StatusMsg
* @see GenericMsg
* @see PostMsg
* @see AckMsg
* @see ElementList
* @see Map
* @see Vector
* @see Series
* @see FilterList
* @see OmmOpaque
* @see OmmXml
* @see OmmAnsiPage
* @see OmmError
*/
public interface Vector extends ComplexType, Collection
{
/**
* Indicates presence of TotalCountHint.
*
* @return true if total count hint is set; false otherwise
*/
public boolean hasTotalCountHint();
/**
* Returns Sortable.
*
* @return true if sortable flag is set; false otherwise
*/
public boolean sortable();
/**
* Returns TotalCountHint.
*
* @throws OmmInvalidUsageException
* if {@link #hasTotalCountHint()} returns false
*
* @return total count hint
*/
public int totalCountHint();
/**
* Returns the contained summaryData Data based on the summaryData DataType.
*
* SummaryData contains no data if {@link SummaryData#dataType()} returns
* {@link com.thomsonreuters.ema.access.DataType.DataTypes#NO_DATA}
*
* @return {@link SummaryData}
*/
public SummaryData summaryData();
/**
* Clears the Vector.
* Invoking clear() method clears all the values and resets all the
* defaults.
*/
public void clear();
/**
* Specifies Sortable.
*
* @param sortable
* specifies if this object is sortable
*
* @return reference to this object
*/
public Vector sortable(boolean sortable);
/**
* Specifies TotalCountHint.
*
* @param totalCountHint
* specifies total count hint
*
* @return reference to this object
*/
public Vector totalCountHint(int totalCountHint);
/**
* Specifies the SummaryData OMM Data.
* Call to summaryData() must happen prior to calling the add() method
*
* @throws OmmInvalidUsageException
* if an error is detected (exception will specify the cause of
* the error)
*
* @param data
* specifies complex type as summaryData
* @return reference to this object
*/
public Vector summaryData(ComplexType data);
}