/**
  * allocate closed part value pointable
  *
  * @param type
  * @return the pointable object
  */
 public IVisitablePointable allocateFieldValue(IAType type) {
   if (type == null) return flatValueAllocator.allocate(null);
   else if (type.getTypeTag().equals(ATypeTag.RECORD)) return recordValueAllocator.allocate(type);
   else if (type.getTypeTag().equals(ATypeTag.UNORDEREDLIST)
       || type.getTypeTag().equals(ATypeTag.ORDEREDLIST)) return listValueAllocator.allocate(type);
   else return flatValueAllocator.allocate(null);
 }
 /**
  * allocate open part value pointable
  *
  * @param typeTag
  * @return the pointable object
  */
 public IVisitablePointable allocateFieldValue(ATypeTag typeTag, byte[] b, int offset)
     throws AsterixException {
   if (typeTag == null) return flatValueAllocator.allocate(null);
   else if (typeTag.equals(ATypeTag.RECORD))
     return recordValueAllocator.allocate(DefaultOpenFieldType.NESTED_OPEN_RECORD_TYPE);
   else if (typeTag.equals(ATypeTag.UNORDEREDLIST)) {
     ATypeTag listItemType = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(b[offset]);
     if (listItemType == ATypeTag.ANY)
       return listValueAllocator.allocate(DefaultOpenFieldType.NESTED_OPEN_AUNORDERED_LIST_TYPE);
     else {
       if (listItemType.isDerivedType()) return allocateFieldValue(listItemType, b, offset + 1);
       else
         return listValueAllocator.allocate(
             unorederedListTypeAllocator.allocate(TypeTagUtil.getBuiltinTypeByTag(listItemType)));
     }
   } else if (typeTag.equals(ATypeTag.ORDEREDLIST)) {
     ATypeTag listItemType = EnumDeserializer.ATYPETAGDESERIALIZER.deserialize(b[offset]);
     if (listItemType == ATypeTag.ANY)
       return listValueAllocator.allocate(DefaultOpenFieldType.NESTED_OPEN_AORDERED_LIST_TYPE);
     else {
       if (listItemType.isDerivedType()) return allocateFieldValue(listItemType, b, offset + 1);
       else
         return listValueAllocator.allocate(
             orederedListTypeAllocator.allocate(TypeTagUtil.getBuiltinTypeByTag(listItemType)));
     }
   } else return flatValueAllocator.allocate(null);
 }
 public IVisitablePointable allocateEmpty() {
   return flatValueAllocator.allocate(null);
 }
 public void reset() {
   flatValueAllocator.reset();
   recordValueAllocator.reset();
   listValueAllocator.reset();
 }
 public IVisitablePointable allocateRecordValue(IAType type) {
   return recordValueAllocator.allocate(type);
 }
 public IVisitablePointable allocateListValue(IAType type) {
   return listValueAllocator.allocate(type);
 }