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


Java StructTypeImpl类代码示例

本文整理汇总了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;
  }

}
 
开发者ID:ampool,项目名称:monarch,代码行数:24,代码来源:CumulativeNonDistinctResults.java

示例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;
  }
}
 
开发者ID:ampool,项目名称:monarch,代码行数:21,代码来源:CumulativeNonDistinctResults.java

示例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;
  }
}
 
开发者ID:ampool,项目名称:monarch,代码行数:21,代码来源:NWayMergeResults.java

示例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;
}
 
开发者ID:ampool,项目名称:monarch,代码行数:29,代码来源:QueryUtils.java

示例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;


}
 
开发者ID:ampool,项目名称:monarch,代码行数:27,代码来源:CompiledComparison.java

示例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);
}
 
开发者ID:ampool,项目名称:monarch,代码行数:23,代码来源:CompiledSelect.java

示例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;
}
 
开发者ID:ampool,项目名称:monarch,代码行数:20,代码来源:CompactRangeIndex.java

示例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;
}
 
开发者ID:ampool,项目名称:monarch,代码行数:17,代码来源:AbstractIndex.java

示例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;
  }
}
 
开发者ID:ampool,项目名称:monarch,代码行数:26,代码来源:CompiledGroupBySelect.java

示例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;
      }
    }
  }
}
 
开发者ID:ampool,项目名称:monarch,代码行数:18,代码来源:StructImpl.java

示例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());
}
 
开发者ID:ampool,项目名称:monarch,代码行数:20,代码来源:ResultsDataSerializabilityJUnitTest.java

示例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);
}
 
开发者ID:ampool,项目名称:monarch,代码行数:21,代码来源:NWayMergeResultsJUnitTest.java

示例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());
}
 
开发者ID:ampool,项目名称:monarch,代码行数:13,代码来源:StructBag.java

示例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
  }
}
 
开发者ID:ampool,项目名称:monarch,代码行数:29,代码来源:StructBag.java

示例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());
}
 
开发者ID:ampool,项目名称:monarch,代码行数:13,代码来源:StructBag.java


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