Instantiates a Union from Memory

@param srcMem Memory object containing a serialized union
@return A ReservoirLongsUnion created from the provided Memory
195153
public static ReservoirLongsUnion heapify(final Memory srcMem) {
    Family.RESERVOIR_UNION.checkFamilyID(srcMem.getByte(FAMILY_BYTE));

    final int numPreLongs = extractPreLongs(srcMem);
    final int serVer = extractSerVer(srcMem);
    final boolean isEmpty = (extractFlags(srcMem) & EMPTY_FLAG_MASK) != 0;
    int maxK = extractMaxK(srcMem);

    final boolean preLongsEqMin = (numPreLongs == Family.RESERVOIR_UNION.getMinPreLongs());
    final boolean preLongsEqMax = (numPreLongs == Family.RESERVOIR_UNION.getMaxPreLongs());

    if (!preLongsEqMin & !preLongsEqMax) {
      throw new SketchesArgumentException("Possible corruption: Non-empty union with only "
          + Family.RESERVOIR_UNION.getMinPreLongs() + "preLongs");
    }

    if (serVer != SER_VER) {
      if (serVer == 1) {
        final short encMaxK = extractEncodedReservoirSize(srcMem);
        maxK = ReservoirSize.decodeValue(encMaxK);
      } else {
        throw new SketchesArgumentException(
                "Possible Corruption: Ser Ver must be " + SER_VER + ": " + serVer);
      }
    }

    final ReservoirLongsUnion rlu = new ReservoirLongsUnion(maxK);

    if (!isEmpty) {
      final int preLongBytes = numPreLongs << 3;
      final Memory sketchMem =
          srcMem.region(preLongBytes, srcMem.getCapacity() - preLongBytes);
      rlu.update(sketchMem);
    }

    return rlu;
  }
966732
public static Pair<Grouper<RowBasedKey>, Accumulator<AggregateResult, Row>> createGrouperAccumulatorPair(
      final GroupByQuery query,
      final boolean isInputRaw,
      final Map<String, ValueType> rawInputRowSignature,
      final GroupByQueryConfig config,
      final Supplier<ByteBuffer> bufferSupplier,
      final LimitedTemporaryStorage temporaryStorage,
      final ObjectMapper spillMapper,
      final AggregatorFactory[] aggregatorFactories,
      final int mergeBufferSize
  )
  {
    return createGrouperAccumulatorPair(
        query,
        isInputRaw,
        rawInputRowSignature,
        config,
        bufferSupplier,
        null,
        SINGLE_THREAD_CONCURRENCY_HINT,
        temporaryStorage,
        spillMapper,
        aggregatorFactories,
        null,
        UNKNOWN_THREAD_PRIORITY,
        false,
        UNKNOWN_TIMEOUT,
        mergeBufferSize
    );
  }
1320283
public static CallStackElement create(CallStackElement parent, String signature, long startTimestamp) {
		CallStackElement cse;
		if (useObjectPooling) {
			cse = objectPool.poll();
			if (cse == null) {
				cse = new CallStackElement();
			}
		} else {
			cse = new CallStackElement();
		}

		cse.executionTime = startTimestamp;
		cse.signature = signature;
		if (parent != null) {
			cse.parent = parent;
			parent.children.add(cse);
		}
		return cse;
	}
1245406
@SuppressWarnings("unchecked")
	public T create(Map<String, Object> data)
	{
		Object[] args = new Object[arguments.length];
		for(int i=0, n=args.length; i<n; i++)
		{
			args[i] = arguments[i].getValue(data);
		}

		try
		{
			return (T) raw.newInstance(args);
		}
		catch(IllegalArgumentException e)
		{
			throw new SerializationException("Unable to create; " + e.getMessage(), e);
		}
		catch(InstantiationException e)
		{
			throw new SerializationException("Unable to create; " + e.getMessage(), e);
		}
		catch(IllegalAccessException e)
		{
			throw new SerializationException("Unable to create; " + e.getMessage(), e);
		}
		catch(InvocationTargetException e)
		{
			throw new SerializationException("Unable to create; " + e.getCause().getMessage(), e.getCause());
		}
	}
249535
@XmlElementDecl(namespace = "http://www.w3.org/1998/Math/MathML", name = "union")
    public JAXBElement<UnionType> createUnion(UnionType value) {
        return new JAXBElement<UnionType>(_Union_QNAME, UnionType.class, null, value);
    }
206659
private LocalVariableDefinition buildUnion(MethodDefinition read, Map<Short, LocalVariableDefinition> unionData)
    {
        // construct the instance and store it in the instance local variable
        LocalVariableDefinition instance = constructUnionInstance(read);

        // switch (fieldId)
        read.loadVariable("fieldId");

        List<CaseStatement> cases = new ArrayList<>();
        for (ThriftFieldMetadata field : metadata.getFields(THRIFT_FIELD)) {
            cases.add(caseStatement(field.getId(), field.getName() + "-inject-field"));
        }
        read.switchStatement("inject-default", cases);

        for (ThriftFieldMetadata field : metadata.getFields(THRIFT_FIELD)) {
            // case field.id:
            read.visitLabel(field.getName() + "-inject-field");

            injectField(read, field, instance, unionData.get(field.getId()));

            if (field.getMethodInjection().isPresent()) {
                injectMethod(read, field.getMethodInjection().get(), instance, unionData);
            }

            read.gotoLabel("inject-default");
        }

        // default case
        read.visitLabel("inject-default");

        // find the @ThriftUnionId field
        ThriftFieldMetadata idField = getOnlyElement(metadata.getFields(THRIFT_UNION_ID));

        injectIdField(read, idField, instance, unionData);

        // invoke factory method if present
        invokeFactoryMethod(read, unionData, instance);

        return instance;
    }
17361
public static <K, V> LinkedHashMultimap<K, V> create() {
    return new LinkedHashMultimap<K, V>(DEFAULT_KEY_CAPACITY, DEFAULT_VALUE_SET_CAPACITY);
  }
66176
public static DeserializeResult<DoubleSummary> fromMemory(final Memory mem) {
    return new DeserializeResult<>(new DoubleSummary(mem.getDouble(VALUE_DOUBLE),
        Mode.values()[mem.getByte(MODE_BYTE)]), SERIALIZED_SIZE_BYTES);
  }
450322
@SuppressWarnings("rawtypes")
  @Override
  public EntityManagerFactory createContainerEntityManagerFactory(
      PersistenceUnitInfo info, Map properties) {
    EntityManagerFactory factory = wrappedPersistenceProvider.createContainerEntityManagerFactory(info, properties);
    return factory;
  }
1207591
public static String generateMemoryCacheEntryKey(String imageUri, int width, int height) {
		return new StringBuilder(imageUri).append(URI_DIMENTION_SEPARATOR).append(width).append(WIDTH_HEIGHT_SEPARATOR).append(height).toString();
	}
185071
public static <V> LongObjectHashMap<V> createPrimitiveLongKeyMap(int initialCapacity, float loadFactor) {
		return new LongObjectHashMap<V>(initialCapacity, loadFactor);
	}
957389
static byte[] compactMemoryToByteArray(final Memory srcMem, final int preLongs,
      final int curCount) {
    final int outBytes = (curCount + preLongs) << 3;
    final byte[] byteArrOut = new byte[outBytes];
    srcMem.getByteArray(0, byteArrOut, 0, outBytes); //copies the whole thing
    return byteArrOut;
  }
376925
protected static ControlCreateStream createDurableCreateStream(
    MessageProcessor MP,
    ConsumerDispatcherState subState,
    long reqID,
    SIBUuid8 dme) 
  {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.entry(tc, "createDurableCreateStream", new Object[] {MP, subState, new Long(reqID), dme});
    
    ControlCreateStream msg = null;
         
    try
    {

      // Create and initialize the message
      msg = MessageProcessor.getControlMessageFactory().createNewControlCreateStream();
      initializeControlMessage(MP.getMessagingEngineUuid(), msg, dme);
      
      // Parameterize for CreateStream
      msg.setRequestID(reqID);
      msg.setDurableSubName(subState.getSubscriberID());
      msg.setGuaranteedTargetDestinationDefinitionUUID(subState.getTopicSpaceUuid());
      
      SelectionCriteria criteria = subState.getSelectionCriteria();
      //check for null values for MFP - defect 251989
      //the discriminator
      if(criteria==null || criteria.getDiscriminator()==null)
      {
        msg.setDurableDiscriminator(null); 
      } 
      else
      {
        msg.setDurableDiscriminator(criteria.getDiscriminator()); 
      } 
      //the selector
      if(criteria==null || criteria.getSelectorString()==null)
      {
        msg.setDurableSelector(null); 
      } 
      else
      {
        msg.setDurableSelector(subState.getSelectionCriteria().getSelectorString());
      } 
      //the selector domain
      if(criteria==null || criteria.getSelectorDomain()==null)
      {
        msg.setDurableSelectorDomain(SelectorDomain.SIMESSAGE.toInt());
      }  
      else
      {
        msg.setDurableSelectorDomain(criteria.getSelectorDomain().toInt());
      }
      
      //defect 259036
      msg.setCloned(subState.isCloned());
      msg.setNoLocal(subState.isNoLocal());
            
      msg.setSecurityUserid(subState.getUser());
      // Set the flag that signals whether this is
      // the privileged SIBServerSubject.
      msg.setSecurityUseridSentBySystem(subState.isSIBServerSubject());
    }
    catch (Exception e)
    {
      FFDCFilter.processException(e,
        "com.ibm.ws.sib.processor.impl.DurableInputHandler.createDurableCreateStream",
        "1:372:1.52.1.1",
        DurableInputHandler.class);
      SibTr.exception(tc, e);
    }

    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.exit(tc, "createDurableCreateStream", msg);
      
    return msg;
  }
289318
public static Object malloc(int elems, long bytes, int type, Object orig, int from ) {
    return malloc(elems,bytes,type,orig,from,false);
  }
1079714
public static SeekableSource inMemorySeekableSourceFrom(InputStream stream) throws IOException {
        requireNonNull(stream);
        return new ByteArraySeekableSource(IOUtils.toByteArray(stream));
    }
753761
public static MemoryCache createMemoryCache(Context context, int memoryCacheSize) {
		if (memoryCacheSize == 0) {
			ActivityManager am = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
			int memoryClass = am.getMemoryClass();
			if (hasHoneycomb() && isLargeHeap(context)) {
				memoryClass = getLargeMemoryClass(am);
			}
			memoryCacheSize = 1024 * 1024 * memoryClass / 8;
		}
		return new LruMemoryCache(memoryCacheSize);
	}
314635
public static LongsColumn create(ColumnarLongs column, ImmutableBitmap nullValueBitmap)
  {
    if (nullValueBitmap.isEmpty()) {
      return new LongsColumn(column);
    } else {
      return new LongsColumnWithNulls(column, nullValueBitmap);
    }
  }