All Downloads are FREE. Search and download functionalities are using the official Maven repository.

ets.phenopacket-schema.2.0.2.source-code.treatment.js Maven / Gradle / Ivy

// source: phenopackets/schema/v2/core/medical_action.proto
/**
 * @fileoverview
 * @enhanceable
 * @suppress {missingRequire} reports error on implicit type usages.
 * @suppress {messageConventions} JS Compiler reports an error if a variable or
 *     field starts with 'MSG_' and isn't a translatable message.
 * @public
 */
// GENERATED CODE -- DO NOT EDIT!
/* eslint-disable */
// @ts-nocheck

goog.provide('proto.org.phenopackets.schema.v2.core.Treatment');

goog.require('jspb.BinaryReader');
goog.require('jspb.BinaryWriter');
goog.require('jspb.Message');
goog.require('proto.org.phenopackets.schema.v2.core.DoseInterval');
goog.require('proto.org.phenopackets.schema.v2.core.OntologyClass');
goog.require('proto.org.phenopackets.schema.v2.core.Quantity');

goog.forwardDeclare('proto.org.phenopackets.schema.v2.core.DrugType');
/**
 * Generated by JsPbCodeGenerator.
 * @param {Array=} opt_data Optional initial data array, typically from a
 * server response, or constructed directly in Javascript. The array is used
 * in place and becomes part of the constructed object. It is not cloned.
 * If no data is provided, the constructed object will be empty, but still
 * valid.
 * @extends {jspb.Message}
 * @constructor
 */
proto.org.phenopackets.schema.v2.core.Treatment = function(opt_data) {
  jspb.Message.initialize(this, opt_data, 0, -1, proto.org.phenopackets.schema.v2.core.Treatment.repeatedFields_, null);
};
goog.inherits(proto.org.phenopackets.schema.v2.core.Treatment, jspb.Message);
if (goog.DEBUG && !COMPILED) {
  /**
   * @public
   * @override
   */
  proto.org.phenopackets.schema.v2.core.Treatment.displayName = 'proto.org.phenopackets.schema.v2.core.Treatment';
}

/**
 * List of repeated fields within this message type.
 * @private {!Array}
 * @const
 */
proto.org.phenopackets.schema.v2.core.Treatment.repeatedFields_ = [3];



if (jspb.Message.GENERATE_TO_OBJECT) {
/**
 * Creates an object representation of this proto.
 * Field names that are reserved in JavaScript and will be renamed to pb_name.
 * Optional fields that are not set will be set to undefined.
 * To access a reserved field use, foo.pb_, eg, foo.pb_default.
 * For the list of reserved names please see:
 *     net/proto2/compiler/js/internal/generator.cc#kKeyword.
 * @param {boolean=} opt_includeInstance Deprecated. whether to include the
 *     JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @return {!Object}
 */
proto.org.phenopackets.schema.v2.core.Treatment.prototype.toObject = function(opt_includeInstance) {
  return proto.org.phenopackets.schema.v2.core.Treatment.toObject(opt_includeInstance, this);
};


/**
 * Static version of the {@see toObject} method.
 * @param {boolean|undefined} includeInstance Deprecated. Whether to include
 *     the JSPB instance for transitional soy proto support:
 *     http://goto/soy-param-migration
 * @param {!proto.org.phenopackets.schema.v2.core.Treatment} msg The msg instance to transform.
 * @return {!Object}
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.org.phenopackets.schema.v2.core.Treatment.toObject = function(includeInstance, msg) {
  var f, obj = {
    agent: (f = msg.getAgent()) && proto.org.phenopackets.schema.v2.core.OntologyClass.toObject(includeInstance, f),
    routeOfAdministration: (f = msg.getRouteOfAdministration()) && proto.org.phenopackets.schema.v2.core.OntologyClass.toObject(includeInstance, f),
    doseIntervalsList: jspb.Message.toObjectList(msg.getDoseIntervalsList(),
    proto.org.phenopackets.schema.v2.core.DoseInterval.toObject, includeInstance),
    drugType: jspb.Message.getFieldWithDefault(msg, 4, 0),
    cumulativeDose: (f = msg.getCumulativeDose()) && proto.org.phenopackets.schema.v2.core.Quantity.toObject(includeInstance, f)
  };

  if (includeInstance) {
    obj.$jspbMessageInstance = msg;
  }
  return obj;
};
}


/**
 * Deserializes binary data (in protobuf wire format).
 * @param {jspb.ByteSource} bytes The bytes to deserialize.
 * @return {!proto.org.phenopackets.schema.v2.core.Treatment}
 */
proto.org.phenopackets.schema.v2.core.Treatment.deserializeBinary = function(bytes) {
  var reader = new jspb.BinaryReader(bytes);
  var msg = new proto.org.phenopackets.schema.v2.core.Treatment;
  return proto.org.phenopackets.schema.v2.core.Treatment.deserializeBinaryFromReader(msg, reader);
};


/**
 * Deserializes binary data (in protobuf wire format) from the
 * given reader into the given message object.
 * @param {!proto.org.phenopackets.schema.v2.core.Treatment} msg The message object to deserialize into.
 * @param {!jspb.BinaryReader} reader The BinaryReader to use.
 * @return {!proto.org.phenopackets.schema.v2.core.Treatment}
 */
proto.org.phenopackets.schema.v2.core.Treatment.deserializeBinaryFromReader = function(msg, reader) {
  while (reader.nextField()) {
    if (reader.isEndGroup()) {
      break;
    }
    var field = reader.getFieldNumber();
    switch (field) {
    case 1:
      var value = new proto.org.phenopackets.schema.v2.core.OntologyClass;
      reader.readMessage(value,proto.org.phenopackets.schema.v2.core.OntologyClass.deserializeBinaryFromReader);
      msg.setAgent(value);
      break;
    case 2:
      var value = new proto.org.phenopackets.schema.v2.core.OntologyClass;
      reader.readMessage(value,proto.org.phenopackets.schema.v2.core.OntologyClass.deserializeBinaryFromReader);
      msg.setRouteOfAdministration(value);
      break;
    case 3:
      var value = new proto.org.phenopackets.schema.v2.core.DoseInterval;
      reader.readMessage(value,proto.org.phenopackets.schema.v2.core.DoseInterval.deserializeBinaryFromReader);
      msg.addDoseIntervals(value);
      break;
    case 4:
      var value = /** @type {!proto.org.phenopackets.schema.v2.core.DrugType} */ (reader.readEnum());
      msg.setDrugType(value);
      break;
    case 5:
      var value = new proto.org.phenopackets.schema.v2.core.Quantity;
      reader.readMessage(value,proto.org.phenopackets.schema.v2.core.Quantity.deserializeBinaryFromReader);
      msg.setCumulativeDose(value);
      break;
    default:
      reader.skipField();
      break;
    }
  }
  return msg;
};


/**
 * Serializes the message to binary data (in protobuf wire format).
 * @return {!Uint8Array}
 */
proto.org.phenopackets.schema.v2.core.Treatment.prototype.serializeBinary = function() {
  var writer = new jspb.BinaryWriter();
  proto.org.phenopackets.schema.v2.core.Treatment.serializeBinaryToWriter(this, writer);
  return writer.getResultBuffer();
};


/**
 * Serializes the given message to binary data (in protobuf wire
 * format), writing to the given BinaryWriter.
 * @param {!proto.org.phenopackets.schema.v2.core.Treatment} message
 * @param {!jspb.BinaryWriter} writer
 * @suppress {unusedLocalVariables} f is only used for nested messages
 */
proto.org.phenopackets.schema.v2.core.Treatment.serializeBinaryToWriter = function(message, writer) {
  var f = undefined;
  f = message.getAgent();
  if (f != null) {
    writer.writeMessage(
      1,
      f,
      proto.org.phenopackets.schema.v2.core.OntologyClass.serializeBinaryToWriter
    );
  }
  f = message.getRouteOfAdministration();
  if (f != null) {
    writer.writeMessage(
      2,
      f,
      proto.org.phenopackets.schema.v2.core.OntologyClass.serializeBinaryToWriter
    );
  }
  f = message.getDoseIntervalsList();
  if (f.length > 0) {
    writer.writeRepeatedMessage(
      3,
      f,
      proto.org.phenopackets.schema.v2.core.DoseInterval.serializeBinaryToWriter
    );
  }
  f = message.getDrugType();
  if (f !== 0.0) {
    writer.writeEnum(
      4,
      f
    );
  }
  f = message.getCumulativeDose();
  if (f != null) {
    writer.writeMessage(
      5,
      f,
      proto.org.phenopackets.schema.v2.core.Quantity.serializeBinaryToWriter
    );
  }
};


/**
 * optional OntologyClass agent = 1;
 * @return {?proto.org.phenopackets.schema.v2.core.OntologyClass}
 */
proto.org.phenopackets.schema.v2.core.Treatment.prototype.getAgent = function() {
  return /** @type{?proto.org.phenopackets.schema.v2.core.OntologyClass} */ (
    jspb.Message.getWrapperField(this, proto.org.phenopackets.schema.v2.core.OntologyClass, 1));
};


/**
 * @param {?proto.org.phenopackets.schema.v2.core.OntologyClass|undefined} value
 * @return {!proto.org.phenopackets.schema.v2.core.Treatment} returns this
*/
proto.org.phenopackets.schema.v2.core.Treatment.prototype.setAgent = function(value) {
  return jspb.Message.setWrapperField(this, 1, value);
};


/**
 * Clears the message field making it undefined.
 * @return {!proto.org.phenopackets.schema.v2.core.Treatment} returns this
 */
proto.org.phenopackets.schema.v2.core.Treatment.prototype.clearAgent = function() {
  return this.setAgent(undefined);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.org.phenopackets.schema.v2.core.Treatment.prototype.hasAgent = function() {
  return jspb.Message.getField(this, 1) != null;
};


/**
 * optional OntologyClass route_of_administration = 2;
 * @return {?proto.org.phenopackets.schema.v2.core.OntologyClass}
 */
proto.org.phenopackets.schema.v2.core.Treatment.prototype.getRouteOfAdministration = function() {
  return /** @type{?proto.org.phenopackets.schema.v2.core.OntologyClass} */ (
    jspb.Message.getWrapperField(this, proto.org.phenopackets.schema.v2.core.OntologyClass, 2));
};


/**
 * @param {?proto.org.phenopackets.schema.v2.core.OntologyClass|undefined} value
 * @return {!proto.org.phenopackets.schema.v2.core.Treatment} returns this
*/
proto.org.phenopackets.schema.v2.core.Treatment.prototype.setRouteOfAdministration = function(value) {
  return jspb.Message.setWrapperField(this, 2, value);
};


/**
 * Clears the message field making it undefined.
 * @return {!proto.org.phenopackets.schema.v2.core.Treatment} returns this
 */
proto.org.phenopackets.schema.v2.core.Treatment.prototype.clearRouteOfAdministration = function() {
  return this.setRouteOfAdministration(undefined);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.org.phenopackets.schema.v2.core.Treatment.prototype.hasRouteOfAdministration = function() {
  return jspb.Message.getField(this, 2) != null;
};


/**
 * repeated DoseInterval dose_intervals = 3;
 * @return {!Array}
 */
proto.org.phenopackets.schema.v2.core.Treatment.prototype.getDoseIntervalsList = function() {
  return /** @type{!Array} */ (
    jspb.Message.getRepeatedWrapperField(this, proto.org.phenopackets.schema.v2.core.DoseInterval, 3));
};


/**
 * @param {!Array} value
 * @return {!proto.org.phenopackets.schema.v2.core.Treatment} returns this
*/
proto.org.phenopackets.schema.v2.core.Treatment.prototype.setDoseIntervalsList = function(value) {
  return jspb.Message.setRepeatedWrapperField(this, 3, value);
};


/**
 * @param {!proto.org.phenopackets.schema.v2.core.DoseInterval=} opt_value
 * @param {number=} opt_index
 * @return {!proto.org.phenopackets.schema.v2.core.DoseInterval}
 */
proto.org.phenopackets.schema.v2.core.Treatment.prototype.addDoseIntervals = function(opt_value, opt_index) {
  return jspb.Message.addToRepeatedWrapperField(this, 3, opt_value, proto.org.phenopackets.schema.v2.core.DoseInterval, opt_index);
};


/**
 * Clears the list making it empty but non-null.
 * @return {!proto.org.phenopackets.schema.v2.core.Treatment} returns this
 */
proto.org.phenopackets.schema.v2.core.Treatment.prototype.clearDoseIntervalsList = function() {
  return this.setDoseIntervalsList([]);
};


/**
 * optional DrugType drug_type = 4;
 * @return {!proto.org.phenopackets.schema.v2.core.DrugType}
 */
proto.org.phenopackets.schema.v2.core.Treatment.prototype.getDrugType = function() {
  return /** @type {!proto.org.phenopackets.schema.v2.core.DrugType} */ (jspb.Message.getFieldWithDefault(this, 4, 0));
};


/**
 * @param {!proto.org.phenopackets.schema.v2.core.DrugType} value
 * @return {!proto.org.phenopackets.schema.v2.core.Treatment} returns this
 */
proto.org.phenopackets.schema.v2.core.Treatment.prototype.setDrugType = function(value) {
  return jspb.Message.setProto3EnumField(this, 4, value);
};


/**
 * optional Quantity cumulative_dose = 5;
 * @return {?proto.org.phenopackets.schema.v2.core.Quantity}
 */
proto.org.phenopackets.schema.v2.core.Treatment.prototype.getCumulativeDose = function() {
  return /** @type{?proto.org.phenopackets.schema.v2.core.Quantity} */ (
    jspb.Message.getWrapperField(this, proto.org.phenopackets.schema.v2.core.Quantity, 5));
};


/**
 * @param {?proto.org.phenopackets.schema.v2.core.Quantity|undefined} value
 * @return {!proto.org.phenopackets.schema.v2.core.Treatment} returns this
*/
proto.org.phenopackets.schema.v2.core.Treatment.prototype.setCumulativeDose = function(value) {
  return jspb.Message.setWrapperField(this, 5, value);
};


/**
 * Clears the message field making it undefined.
 * @return {!proto.org.phenopackets.schema.v2.core.Treatment} returns this
 */
proto.org.phenopackets.schema.v2.core.Treatment.prototype.clearCumulativeDose = function() {
  return this.setCumulativeDose(undefined);
};


/**
 * Returns whether this field is set.
 * @return {boolean}
 */
proto.org.phenopackets.schema.v2.core.Treatment.prototype.hasCumulativeDose = function() {
  return jspb.Message.getField(this, 5) != null;
};






© 2015 - 2024 Weber Informatics LLC | Privacy Policy