PlaceType Enum Calculation

by Marko Keuschnig

HTML

<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.0-beta.14/angular.min.js"></script>
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
<script src="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>
<div ng-app>
    <div data-ng-controller="ListCtrl">
        <table class="table table-hover table-striped">
            <thead>
                <tr>
                    <th>Name</th>
                    <th>Id</th>
                </tr>
            </thead>
            <tbody>
                <tr ng-repeat="placeType in placeTypes">
                    <td>{{placeType.name}}</td>
                    <td>{{placeType.id}}</td>
                </tr>
            </tbody>
        </table>
    </div>
</div>

JavaScript

function ListCtrl($scope) {
    $scope.placeTypes = [{
        name: "Stc",
        id: (((1 << 8) + 1) << 8) + 0
    }, {
        name: "Ds",
        id: (((2 << 8) + 1) << 8) + 0
    }, {
        name: "Ltc1",
        id: (((3 << 8) + 1) << 8) + 0
    }, {
        name: "Ltc2m",
        id: (((3 << 8) + 2) << 8) + 1
    }, {
        name: "Ltc2f",
        id: (((3 << 8) + 2) << 8) + 2
    }, {
        name: "Ale1",
        id: (((4 << 8) + 1) << 8) + 0
    }, {
        name: "Ale2m",
        id: (((4 << 8) + 2) << 8) + 1
    }, {
        name: "Ale2f",
        id: (((4 << 8) + 2) << 8) + 2
    }, {
        name: "Lts1",
        id: (((5 << 8) + 1) << 8) + 0
    }, {
        name: "Lts2m",
        id: (((5 << 8) + 2) << 8) + 1
    }, {
        name: "Lts2f",
        id: (((5 << 8) + 2) << 8) + 2
    }];
}