import ResultPoint from './ResultPoint' ; import BarcodeFormat from './BarcodeFormat' ; import System from './util/System' ; import ResultMetadataType from './ResultMetadataType' ; author Sean Owen
  export default class Result { private resultMetadata : Map < ResultMetadataType , Object > ; public constructor ( private text , private rawBytes , private numBits = rawBytes == null ? 0 : 8 * rawBytes . length , private resultPoints , private format , private timestamp = System . currentTimeMillis ( ) ) { this . text = text ; this . rawBytes = rawBytes ; if ( undefined === numBits || null === numBits ) { this . numBits = ( rawBytes === null || rawBytes === undefined ) ? 0 : 8 * rawBytes . length ; } else { this . numBits = numBits ; } this . resultPoints = resultPoints ; this . format = format ; this . resultMetadata = null ; if ( undefined === timestamp || null === timestamp ) { this . timestamp = System . currentTimeMillis ( ) ; } else { this . timestamp = timestamp ; } } return public getText ( ) { return this . text ; } return public getRawBytes ( ) { return this . rawBytes ; } return how many bits of  {@link #getRawBytes()} are valid; typically 8 times its length
     *  since public getNumBits ( ) { return this . numBits ; } return public getResultPoints ( ) { return this . resultPoints ; } return { link public getBarcodeFormat ( ) { return this . format ; } return { link Map} mapping  ResultMetadataType keys to values. May be
     *   {@code null}. This contains optional metadata about what was detected about the barcode,
     *   like orientation.
      public getResultMetadata ( ) { return this . resultMetadata ; } public putMetadata ( type , value ) { if ( this . resultMetadata === null ) { this . resultMetadata = new Map < ResultMetadataType , Object > ( ) ; } this . resultMetadata . set ( type , value ) ; } public putAllMetadata ( metadata ) { if ( metadata !== null ) { if ( this . resultMetadata === null ) { this . resultMetadata = metadata ; } else { this . resultMetadata = new Map ( metadata ) ; } } } public addResultPoints ( newPoints ) { const oldPoints = this . resultPoints ; if ( oldPoints === null ) { this . resultPoints = newPoints ; } else if ( newPoints !== null && newPoints . length > 0 ) { const allPoints = new Array < ResultPoint > ( oldPoints . length + newPoints . length ) ; System . arraycopy ( oldPoints , 0 , allPoints , 0 , oldPoints . length ) ; System . arraycopy ( newPoints , 0 , allPoints , oldPoints . length , newPoints . length ) ; this . resultPoints = allPoints ; } } public getTimestamp ( ) { return this . timestamp ; } public toString ( ) { return this . text ; } }