@@ -1457,6 +1457,325 @@ public final class UnitIlluminance : Dimension {
1457
1457
}
1458
1458
}
1459
1459
1460
+ public final class UnitInformationStorage : Dimension {
1461
+
1462
+ /*
1463
+ Base unit - bit
1464
+ */
1465
+
1466
+ private struct Symbol {
1467
+ static let bytes = " B "
1468
+ static let bits = " bit "
1469
+ static let nibbles = " nibble "
1470
+ static let yottabytes = " YB "
1471
+ static let zettabytes = " ZB "
1472
+ static let exabytes = " EB "
1473
+ static let petabytes = " PB "
1474
+ static let terabytes = " TB "
1475
+ static let gigabytes = " GB "
1476
+ static let megabytes = " MB "
1477
+ static let kilobytes = " kB "
1478
+
1479
+ static let yottabits = " Yb "
1480
+ static let zettabits = " Zb "
1481
+ static let exabits = " Eb "
1482
+ static let petabits = " Pb "
1483
+ static let terabits = " Tb "
1484
+ static let gigabits = " Gb "
1485
+ static let megabits = " Mb "
1486
+ static let kilobits = " kb "
1487
+
1488
+ static let yobibytes = " YiB "
1489
+ static let zebibytes = " ZiB "
1490
+ static let exbibytes = " EiB "
1491
+ static let pebibytes = " PiB "
1492
+ static let tebibytes = " TiB "
1493
+ static let gibibytes = " GiB "
1494
+ static let mebibytes = " MiB "
1495
+ static let kibibytes = " KiB "
1496
+
1497
+ static let yobibits = " Yib "
1498
+ static let zebibits = " Zib "
1499
+ static let exbibits = " Eib "
1500
+ static let pebibits = " Pib "
1501
+ static let tebibits = " Tib "
1502
+ static let gibibits = " Gib "
1503
+ static let mebibits = " Mib "
1504
+ static let kibibits = " Kib "
1505
+ }
1506
+
1507
+ private struct Coefficient {
1508
+ static let bytes = 8.0
1509
+ static let bits = 1.0
1510
+ static let nibbles = 4.0
1511
+ static let yottabytes = 8.0 * pow( 1000.0 , 8.0 )
1512
+ static let zettabytes = 8.0 * pow( 1000.0 , 7.0 )
1513
+ static let exabytes = 8.0 * pow( 1000.0 , 6.0 )
1514
+ static let petabytes = 8.0 * pow( 1000.0 , 5.0 )
1515
+ static let terabytes = 8.0 * pow( 1000.0 , 4.0 )
1516
+ static let gigabytes = 8.0 * pow( 1000.0 , 3.0 )
1517
+ static let megabytes = 8.0 * pow( 1000.0 , 2.0 )
1518
+ static let kilobytes = 8.0 * 1000
1519
+
1520
+ static let yottabits = pow ( 1000.0 , 8.0 )
1521
+ static let zettabits = pow ( 1000.0 , 7.0 )
1522
+ static let exabits = pow ( 1000.0 , 6.0 )
1523
+ static let petabits = pow ( 1000.0 , 5.0 )
1524
+ static let terabits = pow ( 1000.0 , 4.0 )
1525
+ static let gigabits = pow ( 1000.0 , 3.0 )
1526
+ static let megabits = pow ( 1000.0 , 2.0 )
1527
+ static let kilobits = 1000.0
1528
+
1529
+ static let yobibytes = 8 * pow( 1024.0 , 8.0 )
1530
+ static let zebibytes = 8 * pow( 1024.0 , 7.0 )
1531
+ static let exbibytes = 8 * pow( 1024.0 , 6.0 )
1532
+ static let pebibytes = 8 * pow( 1024.0 , 5.0 )
1533
+ static let tebibytes = 8 * pow( 1024.0 , 4.0 )
1534
+ static let gibibytes = 8 * pow( 1024.0 , 3.0 )
1535
+ static let mebibytes = 8 * pow( 1024.0 , 2.0 )
1536
+ static let kibibytes = 8 * 1024.0
1537
+
1538
+ static let yobibits = pow ( 1024.0 , 8.0 )
1539
+ static let zebibits = pow ( 1024.0 , 7.0 )
1540
+ static let exbibits = pow ( 1024.0 , 6.0 )
1541
+ static let pebibits = pow ( 1024.0 , 5.0 )
1542
+ static let tebibits = pow ( 1024.0 , 4.0 )
1543
+ static let gibibits = pow ( 1024.0 , 3.0 )
1544
+ static let mebibits = pow ( 1024.0 , 2.0 )
1545
+ static let kibibits = 1024.0
1546
+ }
1547
+
1548
+ private convenience init ( symbol: String , coefficient: Double ) {
1549
+ self . init ( symbol: symbol, converter: UnitConverterLinear ( coefficient: coefficient) )
1550
+ }
1551
+
1552
+ public class var bytes : UnitInformationStorage {
1553
+ get {
1554
+ return UnitInformationStorage ( symbol: Symbol . bytes, coefficient: Coefficient . bytes)
1555
+ }
1556
+ }
1557
+
1558
+ public class var bits : UnitInformationStorage {
1559
+ get {
1560
+ return UnitInformationStorage ( symbol: Symbol . bits, coefficient: Coefficient . bits)
1561
+ }
1562
+ }
1563
+
1564
+ public class var nibbles : UnitInformationStorage {
1565
+ get {
1566
+ return UnitInformationStorage ( symbol: Symbol . nibbles, coefficient: Coefficient . nibbles)
1567
+ }
1568
+ }
1569
+
1570
+ public class var yottabytes : UnitInformationStorage {
1571
+ get {
1572
+ return UnitInformationStorage ( symbol: Symbol . yottabytes, coefficient: Coefficient . yottabytes)
1573
+ }
1574
+ }
1575
+
1576
+ public class var zettabytes : UnitInformationStorage {
1577
+ get {
1578
+ return UnitInformationStorage ( symbol: Symbol . zettabytes, coefficient: Coefficient . zettabytes)
1579
+ }
1580
+ }
1581
+
1582
+ public class var exabytes : UnitInformationStorage {
1583
+ get {
1584
+ return UnitInformationStorage ( symbol: Symbol . exabytes, coefficient: Coefficient . exabytes)
1585
+ }
1586
+ }
1587
+
1588
+ public class var petabytes : UnitInformationStorage {
1589
+ get {
1590
+ return UnitInformationStorage ( symbol: Symbol . petabytes, coefficient: Coefficient . petabytes)
1591
+ }
1592
+ }
1593
+
1594
+ public class var terabytes : UnitInformationStorage {
1595
+ get {
1596
+ return UnitInformationStorage ( symbol: Symbol . terabytes, coefficient: Coefficient . terabytes)
1597
+ }
1598
+ }
1599
+
1600
+ public class var gigabytes : UnitInformationStorage {
1601
+ get {
1602
+ return UnitInformationStorage ( symbol: Symbol . gigabytes, coefficient: Coefficient . gigabytes)
1603
+ }
1604
+ }
1605
+
1606
+ public class var megabytes : UnitInformationStorage {
1607
+ get {
1608
+ return UnitInformationStorage ( symbol: Symbol . megabytes, coefficient: Coefficient . megabytes)
1609
+ }
1610
+ }
1611
+
1612
+ public class var kilobytes : UnitInformationStorage {
1613
+ get {
1614
+ return UnitInformationStorage ( symbol: Symbol . kilobytes, coefficient: Coefficient . kilobytes)
1615
+ }
1616
+ }
1617
+
1618
+ public class var yottabits : UnitInformationStorage {
1619
+ get {
1620
+ return UnitInformationStorage ( symbol: Symbol . yottabits, coefficient: Coefficient . yottabits)
1621
+ }
1622
+ }
1623
+
1624
+ public class var zettabits : UnitInformationStorage {
1625
+ get {
1626
+ return UnitInformationStorage ( symbol: Symbol . zettabits, coefficient: Coefficient . zettabits)
1627
+ }
1628
+ }
1629
+
1630
+ public class var exabits : UnitInformationStorage {
1631
+ get {
1632
+ return UnitInformationStorage ( symbol: Symbol . exabits, coefficient: Coefficient . exabits)
1633
+ }
1634
+ }
1635
+
1636
+ public class var petabits : UnitInformationStorage {
1637
+ get {
1638
+ return UnitInformationStorage ( symbol: Symbol . petabits, coefficient: Coefficient . petabits)
1639
+ }
1640
+ }
1641
+
1642
+ public class var terabits : UnitInformationStorage {
1643
+ get {
1644
+ return UnitInformationStorage ( symbol: Symbol . terabits, coefficient: Coefficient . terabits)
1645
+ }
1646
+ }
1647
+
1648
+ public class var gigabits : UnitInformationStorage {
1649
+ get {
1650
+ return UnitInformationStorage ( symbol: Symbol . gigabits, coefficient: Coefficient . gigabits)
1651
+ }
1652
+ }
1653
+
1654
+ public class var megabits : UnitInformationStorage {
1655
+ get {
1656
+ return UnitInformationStorage ( symbol: Symbol . megabits, coefficient: Coefficient . megabits)
1657
+ }
1658
+ }
1659
+
1660
+ public class var kilobits : UnitInformationStorage {
1661
+ get {
1662
+ return UnitInformationStorage ( symbol: Symbol . kilobits, coefficient: Coefficient . kilobits)
1663
+ }
1664
+ }
1665
+
1666
+ public class var yobibytes : UnitInformationStorage {
1667
+ get {
1668
+ return UnitInformationStorage ( symbol: Symbol . yobibytes, coefficient: Coefficient . yobibytes)
1669
+ }
1670
+ }
1671
+
1672
+ public class var zebibytes : UnitInformationStorage {
1673
+ get {
1674
+ return UnitInformationStorage ( symbol: Symbol . zebibytes, coefficient: Coefficient . zebibytes)
1675
+ }
1676
+ }
1677
+
1678
+ public class var exbibytes : UnitInformationStorage {
1679
+ get {
1680
+ return UnitInformationStorage ( symbol: Symbol . exbibytes, coefficient: Coefficient . exbibytes)
1681
+ }
1682
+ }
1683
+
1684
+ public class var pebibytes : UnitInformationStorage {
1685
+ get {
1686
+ return UnitInformationStorage ( symbol: Symbol . pebibytes, coefficient: Coefficient . pebibytes)
1687
+ }
1688
+ }
1689
+
1690
+ public class var tebibytes : UnitInformationStorage {
1691
+ get {
1692
+ return UnitInformationStorage ( symbol: Symbol . tebibytes, coefficient: Coefficient . tebibytes)
1693
+ }
1694
+ }
1695
+
1696
+ public class var gibibytes : UnitInformationStorage {
1697
+ get {
1698
+ return UnitInformationStorage ( symbol: Symbol . gibibytes, coefficient: Coefficient . gibibytes)
1699
+ }
1700
+ }
1701
+
1702
+ public class var mebibytes : UnitInformationStorage {
1703
+ get {
1704
+ return UnitInformationStorage ( symbol: Symbol . mebibytes, coefficient: Coefficient . mebibytes)
1705
+ }
1706
+ }
1707
+
1708
+ public class var kibibytes : UnitInformationStorage {
1709
+ get {
1710
+ return UnitInformationStorage ( symbol: Symbol . kibibytes, coefficient: Coefficient . kibibytes)
1711
+ }
1712
+ }
1713
+
1714
+ public class var yobibits : UnitInformationStorage {
1715
+ get {
1716
+ return UnitInformationStorage ( symbol: Symbol . yobibits, coefficient: Coefficient . yobibits)
1717
+ }
1718
+ }
1719
+
1720
+ public class var zebibits : UnitInformationStorage {
1721
+ get {
1722
+ return UnitInformationStorage ( symbol: Symbol . zebibits, coefficient: Coefficient . zebibits)
1723
+ }
1724
+ }
1725
+
1726
+ public class var exbibits : UnitInformationStorage {
1727
+ get {
1728
+ return UnitInformationStorage ( symbol: Symbol . exbibits, coefficient: Coefficient . exbibits)
1729
+ }
1730
+ }
1731
+
1732
+ public class var pebibits : UnitInformationStorage {
1733
+ get {
1734
+ return UnitInformationStorage ( symbol: Symbol . pebibits, coefficient: Coefficient . pebibits)
1735
+ }
1736
+ }
1737
+
1738
+ public class var tebibits : UnitInformationStorage {
1739
+ get {
1740
+ return UnitInformationStorage ( symbol: Symbol . tebibits, coefficient: Coefficient . tebibits)
1741
+ }
1742
+ }
1743
+
1744
+ public class var gibibits : UnitInformationStorage {
1745
+ get {
1746
+ return UnitInformationStorage ( symbol: Symbol . gibibits, coefficient: Coefficient . gibibits)
1747
+ }
1748
+ }
1749
+
1750
+ public class var mebibits : UnitInformationStorage {
1751
+ get {
1752
+ return UnitInformationStorage ( symbol: Symbol . mebibits, coefficient: Coefficient . mebibits)
1753
+ }
1754
+ }
1755
+
1756
+ public class var kibibits : UnitInformationStorage {
1757
+ get {
1758
+ return UnitInformationStorage ( symbol: Symbol . kibibits, coefficient: Coefficient . kibibits)
1759
+ }
1760
+ }
1761
+
1762
+ public override class func baseUnit( ) -> UnitInformationStorage {
1763
+ return . bits
1764
+ }
1765
+
1766
+ public override func isEqual( _ object: Any ? ) -> Bool {
1767
+ guard let other = object as? UnitInformationStorage else {
1768
+ return false
1769
+ }
1770
+
1771
+ if self === other {
1772
+ return true
1773
+ }
1774
+
1775
+ return super. isEqual ( object)
1776
+ }
1777
+ }
1778
+
1460
1779
public final class UnitMass : Dimension {
1461
1780
1462
1781
/*
0 commit comments