Creates a new cp measurement unit with the primary key. Does not add the cp measurement unit to the database.

@param CPMeasurementUnitId the primary key for the new cp measurement unit
@return the new cp measurement unit
432899
public static com.liferay.commerce.product.model.CPMeasurementUnit createCPMeasurementUnit(
		long CPMeasurementUnitId) {
		return getService().createCPMeasurementUnit(CPMeasurementUnitId);
	}
915285
@POST
    @Consumes(MediaType.APPLICATION_JSON)
    @Produces(MediaType.APPLICATION_JSON)
    @RequiresPermissions(I18nPermissions.KEY_WRITE)
    public Response createKey(KeyRepresentation keyRepresentation) throws URISyntaxException {
        WebAssertions.assertNotNull(keyRepresentation, THE_KEY_SHOULD_NOT_BE_NULL);
        WebAssertions.assertNotBlank(keyRepresentation.getName(), THE_KEY_SHOULD_CONTAINS_A_NAME);
        WebAssertions.assertNotBlank(keyRepresentation.getDefaultLocale(), THE_KEY_SHOULD_CONTAINS_A_LOCALE);

        assertKeyDoNotAlreadyExists(keyRepresentation);

        Key key = factory.createKey(keyRepresentation.getName());
        key.setComment(keyRepresentation.getComment());
        addDefaultTranslation(keyRepresentation, key);
        keyRepository.add(key);

        return Response.created(new URI(uriInfo.getRequestUri() + "/" + key.getId()))
                .entity(keyFinder.findKeyWithName(key.getId())).build();
    }
631132
public void addDenseUnit(CLIQUEUnit unit) {
    int numdim = unit.dimensionality();
    for(int i = 0; i < numdim; i++) {
      BitsUtil.setI(getDimensions(), unit.getDimension(i));
    }

    denseUnits.add(unit);
    coverage += unit.numberOfFeatureVectors();
  }
897376
@Indexable(type = IndexableType.REINDEX)
	@Override
	public CPDAvailabilityEstimate addCPDAvailabilityEstimate(
		CPDAvailabilityEstimate cpdAvailabilityEstimate) {
		cpdAvailabilityEstimate.setNew(true);

		return cpdAvailabilityEstimatePersistence.update(cpdAvailabilityEstimate);
	}
1020830
@Override
	@Transactional(enabled = false)
	public CPFriendlyURLEntry createCPFriendlyURLEntry(
		long CPFriendlyURLEntryId) {
		return cpFriendlyURLEntryPersistence.create(CPFriendlyURLEntryId);
	}
648616
@Override
	public CPMeasurementUnit create(long CPMeasurementUnitId) {
		CPMeasurementUnit cpMeasurementUnit = new CPMeasurementUnitImpl();

		cpMeasurementUnit.setNew(true);
		cpMeasurementUnit.setPrimaryKey(CPMeasurementUnitId);

		String uuid = PortalUUIDUtil.generate();

		cpMeasurementUnit.setUuid(uuid);

		cpMeasurementUnit.setCompanyId(companyProvider.getCompanyId());

		return cpMeasurementUnit;
	}
1290186
@Override
	public com.liferay.commerce.product.model.CPMeasurementUnit addCPMeasurementUnit(
		com.liferay.commerce.product.model.CPMeasurementUnit cpMeasurementUnit) {
		return _cpMeasurementUnitLocalService.addCPMeasurementUnit(cpMeasurementUnit);
	}
285255
def _copy_unidimensional_measurement(
      self, phase, name, measurement, mfg_event):
    """"""
    mfg_measurement = mfg_event.measurement.add()

    # Copy basic measurement fields.
    mfg_measurement.name = name
    if measurement.docstring:
      mfg_measurement.description = measurement.docstring
    mfg_measurement.parameter_tag.append(phase.name)
    if (measurement.units and
        measurement.units.code in test_runs_converter.UOM_CODE_MAP):
      mfg_measurement.unit_code = (
          test_runs_converter.UOM_CODE_MAP[measurement.units.code])

    # Copy failed measurements as failure_codes. This happens early to include
    # unset measurements.
    if (measurement.outcome != measurements.Outcome.PASS and
        phase.outcome != htf_test_record.PhaseOutcome.SKIP):
      failure_code = mfg_event.failure_codes.add()
      failure_code.code = name
      failure_code.details = '\n'.join(str(v) for v in measurement.validators)

    # Copy measurement value.
    measured_value = measurement.measured_value
    status_str = MEASUREMENT_OUTCOME_TO_TEST_RUN_STATUS_NAME[
        measurement.outcome]
    mfg_measurement.status = test_runs_pb2.Status.Value(status_str)
    if not measured_value.is_value_set:
      return
    value = measured_value.value

    if isinstance(value, numbers.Number):
      mfg_measurement.numeric_value = float(value)
    elif isinstance(value, bytes):
      # text_value expects unicode or ascii-compatible strings, so we must
      # 'decode' it, even if it's actually just garbage bytestring data.
      mfg_measurement.text_value = unicode(value, errors='replace')
    elif isinstance(value, unicode):
      # Don't waste time and potential errors decoding unicode.
      mfg_measurement.text_value = value
    else:
      # Coercing to string.
      mfg_measurement.text_value = str(value)

    # Copy measurement validators.
    for validator in measurement.validators:
      if isinstance(validator, validators.RangeValidatorBase):
        if validator.minimum is not None:
          mfg_measurement.numeric_minimum = float(validator.minimum)
        if validator.maximum is not None:
          mfg_measurement.numeric_maximum = float(validator.maximum)
      elif isinstance(validator, validators.RegexMatcher):
        mfg_measurement.expected_text = validator.regex
      else:
        mfg_measurement.description += '\nValidator: ' + str(validator)
808899
@Override
	public com.liferay.commerce.product.model.CPSpecificationOption createCPSpecificationOption(
		long CPSpecificationOptionId) {
		return _cpSpecificationOptionLocalService.createCPSpecificationOption(CPSpecificationOptionId);
	}
889384
protected void addUnit(final IAnnotationUnit unit) {
		int raterIdx = unit.getRaterIdx();
		if (raterIdx >= units.size()) {
			for (int i = units.size(); i < raterIdx; i++) {
                units.add(null);
            }
			units.add(unit);
		}
        else {
            units.set(raterIdx, unit);
        }

		if (unit.getCategory() != null) {
            nonNullCount++;
        }
	}
245622
public CoalesceUnit getUpdatedCoalesceUnit(final InputColumn<?>[] newInputColumns) {
        if (Arrays.equals(_inputColumns, newInputColumns)) {
            return this;
        } else {
            return new CoalesceUnit(newInputColumns);
        }
    }
863885
def put(self, deviceId, measurementId):
        
        record = self.measurements.get(deviceId)
        if record is not None:
            measurement = record.get(measurementId)
            if measurement is not None:
                if len([x.name for x in measurement.statuses if x.name is 'COMPLETE' or x.name is 'FAILED']) > 0:
                    logger.info('Overwriting existing completed measurement ' + x.name)
                    measurement = None
            if measurement is None:
                logger.info('Initiating measurement ' + measurementId)
                measurement = ScheduledMeasurement(measurementId, self.recordingDevices.get(deviceId))
                body = request.get_json()
                duration_ = body['duration']
                def _cleanup():
                    logger.info('Removing ' + measurementId + ' from ' + deviceId)
                    record.pop(measurementId)
                measurement.schedule(duration_, at=body.get('at'), delay=body.get('delay'), callback=_cleanup)
                # a quick hack to enable the measurement to be cleaned up by the ScheduledMeasurement
                record[measurementId] = measurement
                return measurement, 200
            else:
                return measurement, 400
        else:
            return 'unknown device ' + deviceId, 400
1291322
@Override
	public void removeByUuid(String uuid) {
		for (CPMeasurementUnit cpMeasurementUnit : findByUuid(uuid,
				QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) {
			remove(cpMeasurementUnit);
		}
	}
1060230
@Override
    protected Measurement[] getModelMeasurementsImpl() {
        Measurement[] measurements = new Measurement[this.maxStoredCount];

        for (int m = 0; m < this.maxMemberCount; m++) {
            measurements[m] = new Measurement("Member weight " + (m + 1), -1);
        }

        for (int s = this.maxMemberCount; s < this.maxStoredCount; s++) {
            measurements[s] = new Measurement("Stored member weight " + (s + 1), -1);
        }

        if (this.storedWeights != null) {
            int storeSize = this.storedWeights.length;

            for (int i = 0; i < storeSize; i++) {
                if (i < this.ensemble.length) {
                    measurements[i] = new Measurement("Member weight " + (i + 1), this.storedWeights[storeSize - i - 1][0]);
                } else {
                    measurements[i] = new Measurement("Stored member weight " + (i + 1), this.storedWeights[storeSize - i - 1][0]);
                }
            }
        }
        return measurements;
    }
572523
public static com.liferay.commerce.model.CPDefinitionInventory createCPDefinitionInventory(
		long CPDefinitionInventoryId) {
		return getService().createCPDefinitionInventory(CPDefinitionInventoryId);
	}
738902
public com.google.api.ads.adwords.axis.v201809.cm.ConstantOperandUnit getUnit() {
        return unit;
    }
1250031
public String getUnit() {
    if (Measure_Type.featOkTst && ((Measure_Type)jcasType).casFeat_unit == null)
      jcasType.jcas.throwFeatMissing("unit", "ch.epfl.bbp.uima.types.Measure");
    return jcasType.ll_cas.ll_getStringValue(addr, ((Measure_Type)jcasType).casFeatCode_unit);}