UNPKG

@eagleoutice/flowr

Version:

Static Dataflow Analyzer and Program Slicer for the R Programming Language

70 lines 2.72 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.DataFrameDomain = void 0; const positive_interval_domain_1 = require("../domains/positive-interval-domain"); const product_domain_1 = require("../domains/product-domain"); const set_range_domain_1 = require("../domains/set-range-domain"); /** * The data frame abstract domain as product domain of a column names domain, column count domain, and row count domain. */ class DataFrameDomain extends product_domain_1.ProductDomain { constructor(value) { super(DataFrameDomain.refine({ colnames: value.colnames.create(value.colnames.value), cols: value.cols.create(value.cols.value), rows: value.rows.create(value.rows.value) })); } create(value) { return new DataFrameDomain(value); } /** * The current abstract value of the column names domain. */ get colnames() { return this.value.colnames; } /** * The current abstract value of the column count domain. */ get cols() { return this.value.cols; } /** * The current abstract value of the row count domain. */ get rows() { return this.value.rows; } static bottom(maxColNames) { return new DataFrameDomain({ colnames: set_range_domain_1.SetRangeDomain.bottom(maxColNames), cols: positive_interval_domain_1.PosIntervalDomain.bottom(), rows: positive_interval_domain_1.PosIntervalDomain.bottom() }); } static top(maxColNames) { return new DataFrameDomain({ colnames: set_range_domain_1.SetRangeDomain.top(maxColNames), cols: positive_interval_domain_1.PosIntervalDomain.top(), rows: positive_interval_domain_1.PosIntervalDomain.top() }); } static refine(value) { if (value.colnames.isValue() && value.cols.isValue()) { if (value.colnames.value.min.size >= value.cols.value[1]) { value.colnames = value.colnames.meet({ min: new Set(), range: value.colnames.value.min }); } if (value.colnames.isValue()) { const minColNames = value.colnames.value.min.size; const maxColNames = value.colnames.isFinite() ? value.colnames.value.min.size + value.colnames.value.range.size : Infinity; if (minColNames > value.cols.value[0] || maxColNames < value.cols.value[1]) { value.cols = value.cols.meet([minColNames, maxColNames]); } } } return value; } } exports.DataFrameDomain = DataFrameDomain; //# sourceMappingURL=dataframe-domain.js.map