mindee
Version:
Mindee Client Library for Node.js
59 lines (58 loc) • 2.52 kB
JavaScript
;
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
};
var _EnergyBillV1EnergyConsumer_instances, _EnergyBillV1EnergyConsumer_printableValues;
Object.defineProperty(exports, "__esModule", { value: true });
exports.EnergyBillV1EnergyConsumer = void 0;
const geometry_1 = require("../../../geometry");
/**
* The entity that consumes the energy.
*/
class EnergyBillV1EnergyConsumer {
constructor({ prediction = {} }) {
_EnergyBillV1EnergyConsumer_instances.add(this);
/** Confidence score */
this.confidence = 0.0;
/**
* Contains the relative vertices coordinates (points) of a polygon containing
* the field in the document.
*/
this.polygon = new geometry_1.Polygon();
this.address = prediction["address"];
this.name = prediction["name"];
this.pageId = prediction["page_id"];
this.confidence = prediction["confidence"] ? prediction.confidence : 0.0;
if (prediction["polygon"]) {
this.polygon = prediction.polygon;
}
}
/**
* Default string representation.
*/
toString() {
const printable = __classPrivateFieldGet(this, _EnergyBillV1EnergyConsumer_instances, "m", _EnergyBillV1EnergyConsumer_printableValues).call(this);
return ("Address: " +
printable.address +
", Name: " +
printable.name);
}
/**
* Output in a format suitable for inclusion in a field list.
*/
toFieldList() {
const printable = __classPrivateFieldGet(this, _EnergyBillV1EnergyConsumer_instances, "m", _EnergyBillV1EnergyConsumer_printableValues).call(this);
return `
:Address: ${printable.address}
:Name: ${printable.name}`.trimEnd();
}
}
exports.EnergyBillV1EnergyConsumer = EnergyBillV1EnergyConsumer;
_EnergyBillV1EnergyConsumer_instances = new WeakSet(), _EnergyBillV1EnergyConsumer_printableValues = function _EnergyBillV1EnergyConsumer_printableValues() {
return {
address: this.address ?? "",
name: this.name ?? "",
};
};