當前位置: 首頁>>代碼示例>>Java>>正文


Java Struct.getFieldValues方法代碼示例

本文整理匯總了Java中org.apache.geode.cache.query.Struct.getFieldValues方法的典型用法代碼示例。如果您正苦於以下問題:Java Struct.getFieldValues方法的具體用法?Java Struct.getFieldValues怎麽用?Java Struct.getFieldValues使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.apache.geode.cache.query.Struct的用法示例。


在下文中一共展示了Struct.getFieldValues方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: occurrences

import org.apache.geode.cache.query.Struct; //導入方法依賴的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

示例2: occurrences

import org.apache.geode.cache.query.Struct; //導入方法依賴的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.mapGet(s.getFieldValues()); // returns 0 if not found
  }
}
 
開發者ID:ampool,項目名稱:monarch,代碼行數:29,代碼來源:SortedStructBag.java

示例3: next

import org.apache.geode.cache.query.Struct; //導入方法依賴的package包/類
@Override
public Object next() {
  Object object = iterator.next();
  if (object instanceof Struct) {
    Struct struct = (Struct) object;
    Object[] values = struct.getFieldValues();
    Object[] newValues = new Object[values.length];
    for (int i = 0; i < values.length; i++) {
      if (values[i] instanceof PdxInstance) {
        newValues[i] = ((PdxInstance) values[i]).getObject();
      } else if (values[i] instanceof PdxString) {
        newValues[i] = ((PdxString) values[i]).toString();
      } else if (copyOnRead) {
        // due to bug #50650 When query results are fed back through the query engine
        // we could end up copying a java object but due to serialization
        // end up getting a pdx value. So extract the actual value if needed
        newValues[i] = extractPdxIfNeeded(CopyHelper.copy(values[i]));
      } else {
        newValues[i] = values[i];
      }
    }
    return new StructImpl((StructTypeImpl) struct.getStructType(), newValues);
  } else {
    if (object instanceof PdxInstance) {
      object = ((PdxInstance) object).getObject();
    } else if (object instanceof PdxString) {
      object = ((PdxString) object).toString();
    } else if (copyOnRead) {
      // due to bug #50650 When query results are fed back through the query engine
      // we could end up copying a java object but due to serialization
      // end up getting a pdx value. So extract the actual value if needed
      object = extractPdxIfNeeded(CopyHelper.copy(object));
    }
    return object;
  }
}
 
開發者ID:ampool,項目名稱:monarch,代碼行數:37,代碼來源:ResultsCollectionPdxDeserializerWrapper.java

示例4: setIndexFieldValuesInRespectiveIterators

import org.apache.geode.cache.query.Struct; //導入方法依賴的package包/類
private static boolean setIndexFieldValuesInRespectiveIterators(Object value,
    RuntimeIterator[] indexFieldToItrsMapping, IndexCutDownExpansionHelper icdeh) {
  Object[] checkFields = null;
  boolean select = true;
  int len = indexFieldToItrsMapping.length;
  RuntimeIterator rItr = null;
  if (len == 1) {
    // Asif : this means we have a ResultSet
    Support.Assert(!icdeh.cutDownNeeded,
        "If the index fields to iter mapping is of of size 1 then cut down cannot occur");
    indexFieldToItrsMapping[0].setCurrent(value);
  } else {
    Struct struct = (Struct) value;
    Object fieldValues[] = struct.getFieldValues();
    int size = fieldValues.length;
    if (icdeh.cutDownNeeded)
      checkFields = new Object[icdeh.checkSize];
    // Object values[] = new Object[numItersInResultSet];
    int j = 0;
    for (int i = 0; i < size; i++) {
      rItr = indexFieldToItrsMapping[i];
      if (rItr != null) {
        rItr.setCurrent(fieldValues[i]);
        if (icdeh.cutDownNeeded) {
          checkFields[j++] = fieldValues[i];
        }
      }
    }
    if (icdeh.cutDownNeeded) {
      Object temp = null;
      if (icdeh.checkSize == 1) {
        temp = checkFields[0];
      } else {
        temp = new StructImpl((StructTypeImpl) icdeh.checkType, checkFields);
      }
      if (icdeh.checkSet.contains(temp)) {
        select = false;
      } else {
        icdeh.checkSet.add(temp);
      }
    }
  }
  return select;
}
 
開發者ID:ampool,項目名稱:monarch,代碼行數:45,代碼來源:QueryUtils.java

示例5: copyStruct

import org.apache.geode.cache.query.Struct; //導入方法依賴的package包/類
private Object[] copyStruct(Struct struct) {
  Object[] prevValues = struct.getFieldValues();
  Object[] newRow = new Object[prevValues.length];
  System.arraycopy(prevValues, 0, newRow, 0, prevValues.length);
  return newRow;
}
 
開發者ID:ampool,項目名稱:monarch,代碼行數:7,代碼來源:CompiledGroupBySelect.java


注:本文中的org.apache.geode.cache.query.Struct.getFieldValues方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。