bitcoin-atm

bitcoin atm for pyc inc.

git clone https://9o.is/git/bitcoin-atm.git

errorlevel.js

(1470B)


      1 /*
      2   Ported to JavaScript by Lazar Laszlo 2011 
      3   
      4   lazarsoft@gmail.com, www.lazarsoft.info
      5   
      6 */
      7 
      8 /*
      9 *
     10 * Copyright 2007 ZXing authors
     11 *
     12 * Licensed under the Apache License, Version 2.0 (the "License");
     13 * you may not use this file except in compliance with the License.
     14 * You may obtain a copy of the License at
     15 *
     16 *      http://www.apache.org/licenses/LICENSE-2.0
     17 *
     18 * Unless required by applicable law or agreed to in writing, software
     19 * distributed under the License is distributed on an "AS IS" BASIS,
     20 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     21 * See the License for the specific language governing permissions and
     22 * limitations under the License.
     23 */
     24 
     25 
     26 function ErrorCorrectionLevel(ordinal,  bits, name)
     27 {
     28 	this.ordinal_Renamed_Field = ordinal;
     29 	this.bits = bits;
     30 	this.name = name;
     31 	this.__defineGetter__("Bits", function()
     32 	{
     33 		return this.bits;
     34 	});
     35 	this.__defineGetter__("Name", function()
     36 	{
     37 		return this.name;
     38 	});
     39 	this.ordinal=function()
     40 	{
     41 		return this.ordinal_Renamed_Field;
     42 	}
     43 }
     44 
     45 ErrorCorrectionLevel.forBits=function( bits)
     46 {
     47 	if (bits < 0 || bits >= FOR_BITS.length)
     48 	{
     49 		throw "ArgumentException";
     50 	}
     51 	return FOR_BITS[bits];
     52 }
     53 
     54 var L = new ErrorCorrectionLevel(0, 0x01, "L");
     55 var M = new ErrorCorrectionLevel(1, 0x00, "M");
     56 var Q = new ErrorCorrectionLevel(2, 0x03, "Q");
     57 var H = new ErrorCorrectionLevel(3, 0x02, "H");
     58 var FOR_BITS = new Array( M, L, H, Q);