本文整理汇总了Java中org.apache.geode.cache.query.internal.types.StructTypeImpl类的典型用法代码示例。如果您正苦于以下问题:Java StructTypeImpl类的具体用法?Java StructTypeImpl怎么用?Java StructTypeImpl使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
StructTypeImpl类属于org.apache.geode.cache.query.internal.types包,在下文中一共展示了StructTypeImpl类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: next
import org.apache.geode.cache.query.internal.types.StructTypeImpl; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public E next() {
if (this.cachedHasNext == null) {
this.hasNext();
}
this.cachedHasNext = null;
Metadata metadata = collectionsMetdata.get(this.currentIterator);
E original = this.iterators[this.currentIterator].next();
Object e = PDXUtils.convertPDX(original, isStruct, metadata.getDomainObjectForPdx,
metadata.getDeserializedObject, metadata.localResults, objectChangedMarker, false);
if (isStruct) {
if (objectChangedMarker[0]) {
return (E) new StructImpl((StructTypeImpl) collectionType.getElementType(),
(Object[]) e);
} else {
return original;
}
} else {
return (E) e;
}
}
示例2: fromData
import org.apache.geode.cache.query.internal.types.StructTypeImpl; //导入依赖的package包/类
@Override
public void fromData(DataInput in) throws IOException, ClassNotFoundException {
ObjectType elementType = (ObjectType) DataSerializer.readObject(in);
this.collectionType = new CollectionTypeImpl(CumulativeNonDistinctResults.class, elementType);
boolean isStruct = elementType.isStructType();
long size = in.readLong();
this.data = new ArrayList<E>((int) size);
long numLeft = size;
while (numLeft > 0) {
if (isStruct) {
Object[] fields = DataSerializer.readObjectArray(in);
this.data.add((E) new StructImpl((StructTypeImpl) elementType, fields));
} else {
E element = DataSerializer.readObject(in);
this.data.add(element);
}
--numLeft;
}
}
示例3: fromData
import org.apache.geode.cache.query.internal.types.StructTypeImpl; //导入依赖的package包/类
@Override
public void fromData(DataInput in) throws IOException, ClassNotFoundException {
ObjectType elementType = (ObjectType) DataSerializer.readObject(in);
this.collectionType = new CollectionTypeImpl(NWayMergeResults.class, elementType);
boolean isStruct = elementType.isStructType();
this.isDistinct = DataSerializer.readPrimitiveBoolean(in);
long size = in.readLong();
this.data = new ArrayList<E>((int) size);
long numLeft = size;
while (numLeft > 0) {
if (isStruct) {
Object[] fields = DataSerializer.readObjectArray(in);
this.data.add((E) new StructImpl((StructTypeImpl) elementType, fields));
} else {
E element = DataSerializer.readObject(in);
this.data.add(element);
}
--numLeft;
}
}
示例4: createStructTypeForRuntimeIterators
import org.apache.geode.cache.query.internal.types.StructTypeImpl; //导入依赖的package包/类
/**
* Asif : This function creates a StructType using Internal IDs of the iterators as the field
* names for the StructType. It should be invoked iff the iterators size is greater than 1
*
* @param runTimeIterators List of RuntimeIterator objects
* @return StructType object
*
*/
public static StructType createStructTypeForRuntimeIterators(List runTimeIterators) {
Support.Assert(runTimeIterators.size() > 1,
"The number of Iterators passed should be greater than 1 to create a structSet");
int len = runTimeIterators.size();
String fieldNames[] = new String[len];
String[] indexAlternativeFieldNames = new String[len];
ObjectType fieldTypes[] = new ObjectType[len];
// Asif : use an Iterator as the chances are that we will be sending
// LinkedList rather than ArrayList
Iterator itr = runTimeIterators.iterator();
int i = 0;
while (itr.hasNext()) {
RuntimeIterator iter = (RuntimeIterator) itr.next();
fieldNames[i] = iter.getInternalId();
indexAlternativeFieldNames[i] = iter.getIndexInternalID();
fieldTypes[i++] = iter.getElementType();
}
StructTypeImpl type = new StructTypeImpl(fieldNames, indexAlternativeFieldNames, fieldTypes);
return type;
}
示例5: isConditioningNeededForIndex
import org.apache.geode.cache.query.internal.types.StructTypeImpl; //导入依赖的package包/类
public boolean isConditioningNeededForIndex(RuntimeIterator independentIter,
ExecutionContext context, boolean completeExpnsNeeded)
throws AmbiguousNameException, TypeMismatchException, NameResolutionException {
IndexConditioningHelper ich = null;
IndexInfo[] idxInfo = getIndexInfo(context);
int indexFieldsSize = -1;
boolean conditioningNeeded = true;
if (idxInfo == null || idxInfo.length > 1) {
return conditioningNeeded;
}
// assert idxInfo.length == 1;
ObjectType indexRsltType = idxInfo[0]._index.getResultSetType();
if (indexRsltType instanceof StructType) {
indexFieldsSize = ((StructTypeImpl) indexRsltType).getFieldNames().length;
} else {
indexFieldsSize = 1;
}
if (independentIter != null && indexFieldsSize == 1) {
ich = new IndexConditioningHelper(idxInfo[0], context, indexFieldsSize, completeExpnsNeeded,
null, independentIter);
}
return ich == null || ich.shufflingNeeded;
}
示例6: createStructTypeForNullProjection
import org.apache.geode.cache.query.internal.types.StructTypeImpl; //导入依赖的package包/类
/**
* Asif: This function should be used to create a StructType for those queries which have * as
* projection attribute (implying null projection attribute) & multiple from clauses
*
*/
private StructTypeImpl createStructTypeForNullProjection(List currentIterators,
ExecutionContext context) {
int len = currentIterators.size();
String fieldNames[] = new String[len];
ObjectType fieldTypes[] = new ObjectType[len];
String fldName = null;
for (int i = 0; i < len; i++) {
RuntimeIterator iter = (RuntimeIterator) currentIterators.get(i);
// fieldNames[i] = iter.getName();
if ((fldName = iter.getName()) == null) {
fldName = generateProjectionName(iter, context);
}
fieldNames[i] = fldName;
fieldTypes[i] = iter.getElementType();
}
return new StructTypeImpl(fieldNames, fieldTypes);
}
示例7: createIndexResultSetType
import org.apache.geode.cache.query.internal.types.StructTypeImpl; //导入依赖的package包/类
private ObjectType createIndexResultSetType() {
List currentIterators = this.initContext.getCurrentIterators();
int len = currentIterators.size();
ObjectType type = null;
// String fieldNames[] = new String[len];
ObjectType fieldTypes[] = new ObjectType[len];
int start = this.isFirstItrOnEntry ? 0 : 1;
for (; start < len; start++) {
RuntimeIterator iter = (RuntimeIterator) currentIterators.get(start);
// fieldNames[start] = iter.getInternalId();
fieldTypes[start] = iter.getElementType();
}
if (!this.isFirstItrOnEntry) {
// fieldNames[0] = "iter1";
fieldTypes[0] = addnlProjType;
}
type = (len == 1) ? fieldTypes[0] : new StructTypeImpl(this.canonicalIterNames, fieldTypes);
return type;
}
示例8: verifyAndGetPdxDomainObject
import org.apache.geode.cache.query.internal.types.StructTypeImpl; //导入依赖的package包/类
private Object verifyAndGetPdxDomainObject(Object value) {
if (value instanceof StructImpl) {
// Doing hasPdx check first, since its cheaper.
if (((StructImpl) value).isHasPdx() && !((GemFireCacheImpl) this.region.getCache())
.getPdxReadSerializedByAnyGemFireServices()) {
// Set the pdx values for the struct object.
StructImpl v = (StructImpl) value;
Object[] fieldValues = v.getPdxFieldValues();
return new StructImpl((StructTypeImpl) v.getStructType(), fieldValues);
}
} else if (value instanceof PdxInstance && !((GemFireCacheImpl) this.region.getCache())
.getPdxReadSerializedByAnyGemFireServices()) {
return ((PdxInstance) value).getObject();
}
return value;
}
示例9: createNewElementType
import org.apache.geode.cache.query.internal.types.StructTypeImpl; //导入依赖的package包/类
private ObjectType createNewElementType(ObjectType elementType, boolean isStruct) {
if (isStruct) {
StructType oldType = (StructType) elementType;
if (this.aggregateFunctions.length > 0) {
ObjectType[] oldFieldTypes = oldType.getFieldTypes();
ObjectType[] newFieldTypes = new ObjectType[oldFieldTypes.length];
int i = 0;
int aggFuncIndex = 0;
for (ObjectType oldFieldType : oldFieldTypes) {
if (this.aggregateColsPos.get(i)) {
newFieldTypes[i] = this.aggregateFunctions[aggFuncIndex++].getObjectType();
} else {
newFieldTypes[i] = oldFieldType;
}
++i;
}
return new StructTypeImpl(oldType.getFieldNames(), newFieldTypes);
} else {
return oldType;
}
} else {
return this.aggregateFunctions.length > 0 ? this.aggregateFunctions[0].getObjectType()
: elementType;
}
}
示例10: StructImpl
import org.apache.geode.cache.query.internal.types.StructTypeImpl; //导入依赖的package包/类
/** Creates a new instance of StructImpl */
public StructImpl(StructTypeImpl type, Object[] values) {
if (type == null) {
throw new IllegalArgumentException(
LocalizedStrings.StructImpl_TYPE_MUST_NOT_BE_NULL.toLocalizedString());
}
this.type = type;
this.values = values;
if (this.values != null) {
for (Object o : values) {
if (o instanceof PdxInstance || o instanceof PdxString) {
this.hasPdx = true;
break;
}
}
}
}
示例11: testImplementsDataSerializable
import org.apache.geode.cache.query.internal.types.StructTypeImpl; //导入依赖的package包/类
@Test
public void testImplementsDataSerializable() throws Exception {
Class[] classes = new Class[] {SortedResultSet.class, ResultsCollectionWrapper.class,
ResultsSet.class, SortedStructSet.class, StructImpl.class, StructSet.class, Undefined.class,
// QRegion.class, // QRegions remain unserializable
CollectionTypeImpl.class, MapTypeImpl.class, ObjectTypeImpl.class, StructTypeImpl.class,};
List list = new ArrayList();
for (int i = 0; i < classes.length; i++) {
Class nextClass = classes[i];
if (!DataSerializable.class.isAssignableFrom(nextClass)) {
if (!DataSerializableFixedID.class.isAssignableFrom(nextClass)) {
list.add(nextClass.getName());
}
}
}
assertTrue(list + " are not DataSerializable", list.isEmpty());
}
示例12: createStructFieldMergedResult
import org.apache.geode.cache.query.internal.types.StructTypeImpl; //导入依赖的package包/类
private NWayMergeResults<Struct> createStructFieldMergedResult(
Collection<? extends Collection<Struct>> sortedResults, boolean isDistinct, int limit,
StructTypeImpl structType) throws Exception {
CompiledSortCriterion csc1 = new CompiledSortCriterion(false,
CompiledSortCriterion.ProjectionField.getProjectionField());
CompiledSortCriterion csc2 =
new CompiledSortCriterion(true, CompiledSortCriterion.ProjectionField.getProjectionField());
Method method = CompiledSortCriterion.class
.getDeclaredMethod("substituteExpressionWithProjectionField", Integer.TYPE);
method.setAccessible(true);
method.invoke(csc1, 0);
method.invoke(csc2, 1);
List<CompiledSortCriterion> orderByAttribs = new ArrayList<CompiledSortCriterion>();
orderByAttribs.add(csc1);
orderByAttribs.add(csc2);
ExecutionContext context = new ExecutionContext(null, null);
return new NWayMergeResults<Struct>(sortedResults, false, -1, orderByAttribs, context,
structType);
}
示例13: contains
import org.apache.geode.cache.query.internal.types.StructTypeImpl; //导入依赖的package包/类
/** Does this set contain specified struct? */
@Override
public boolean contains(Object obj) {
if (!(obj instanceof Struct)) {
return false;
}
Struct s = (Struct) obj;
if (!this.elementType.equals(StructTypeImpl.typeFromStruct(s))) {
return false;
}
return containsFieldValues(s.getFieldValues());
}
示例14: occurrences
import org.apache.geode.cache.query.internal.types.StructTypeImpl; //导入依赖的package包/类
@Override
public int occurrences(Object element) {
if (!(element instanceof Struct)) {
return 0;
}
Struct s = (Struct) element;
if (!this.elementType.equals(StructTypeImpl.typeFromStruct(s))) {
return 0;
}
if (this.hasLimitIterator) {
int count = 0;
boolean encounteredObject = false;
Object[] fields = s.getFieldValues();
for (Iterator itr = this.fieldValuesIterator(); itr.hasNext();) {
Object[] structFields = (Object[]) itr.next();
if (Arrays.equals(fields, structFields)) {
count++;
encounteredObject = true;
} else if (encounteredObject) {
// Asif: No possibility of its occurence again
break;
}
}
return count;
} else {
return this.map.get(s.getFieldValues()); // returns 0 if not found
}
}
示例15: remove
import org.apache.geode.cache.query.internal.types.StructTypeImpl; //导入依赖的package包/类
/** Remove the specified Struct */
@Override
public boolean remove(Object o) {
if (!(o instanceof Struct)) {
return false;
}
Struct s = (Struct) o;
if (!this.elementType.equals(StructTypeImpl.typeFromStruct(s))) {
return false;
}
return removeFieldValues(s.getFieldValues());
}