remove the JsonWrapper class

Let's follow the Google Style Guide, in which private variables are
simply suffixed with "_". It's a sign, not a cop, but that's fine.
I'd rather keep things simple, and code review should suffice for
catching uses of a private variable outside the class.
This commit is contained in:
Scott Lamb
2020-02-22 21:13:52 -08:00
parent a26c3d1649
commit 3fa48ab0da
5 changed files with 28 additions and 115 deletions

View File

@@ -30,45 +30,44 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
import JsonWrapper from './JsonWrapper';
import Range90k from '../models/Range90k';
/**
* Class to encapsulate recording JSON data.
*/
export default class Recording extends JsonWrapper {
export default class Recording {
/**
* Accept JSON data to be encapsulated
*
* @param {object} recordingJson JSON for a recording
*/
constructor(recordingJson) {
super(recordingJson);
this.json_ = recordingJson;
}
/** @return {Number} */
get startId() {
return this.json.startId;
return this.json_.startId;
}
/** @return {Number} */
get endId() {
return this.json.endId;
return this.json_.endId;
}
/** @return {Number} */
get openId() {
return this.json.openId;
return this.json_.openId;
}
/** @return {Number} or undefined */
get firstUncommitted() {
return this.json.firstUncommitted;
return this.json_.firstUncommitted;
}
/** @return {Boolean} or undefined */
get growing() {
return this.json.growing;
return this.json_.growing;
}
/**
@@ -76,7 +75,7 @@ export default class Recording extends JsonWrapper {
* @return {Number} Time in units of 90k parts of a second
*/
get startTime90k() {
return this.json.startTime90k;
return this.json_.startTime90k;
}
/**
@@ -84,7 +83,7 @@ export default class Recording extends JsonWrapper {
* @return {Number} Time in units of 90k parts of a second
*/
get endTime90k() {
return this.json.endTime90k;
return this.json_.endTime90k;
}
/**
@@ -92,8 +91,7 @@ export default class Recording extends JsonWrapper {
* @return {Number} Time in units of 90k parts of a second
*/
get duration90k() {
const data = this.json;
return data.endTime90k - data.startTime90k;
return this.json_.endTime90k - this.json_.startTime90k;
}
/**
@@ -121,7 +119,7 @@ export default class Recording extends JsonWrapper {
* @return {Number} Total bytes used
*/
get sampleFileBytes() {
return this.json.sampleFileBytes;
return this.json_.sampleFileBytes;
}
/**
@@ -130,7 +128,7 @@ export default class Recording extends JsonWrapper {
* @return {Number} Total bytes used
*/
get frameCount() {
return this.json.videoSamples;
return this.json_.videoSamples;
}
/**
@@ -139,7 +137,7 @@ export default class Recording extends JsonWrapper {
* @return {String} Hash
*/
get videoSampleEntryHash() {
return this.json.videoSampleEntrySha1;
return this.json_.videoSampleEntrySha1;
}
/**
@@ -148,7 +146,7 @@ export default class Recording extends JsonWrapper {
* @return {Number} Width in pixels
*/
get videoSampleEntryWidth() {
return this.json.videoSampleEntryWidth;
return this.json_.videoSampleEntryWidth;
}
/**
@@ -157,6 +155,6 @@ export default class Recording extends JsonWrapper {
* @return {Number} Height in pixels
*/
get videoSampleEntryHeight() {
return this.json.videoSampleEntryHeight;
return this.json_.videoSampleEntryHeight;
}
}