1 /*** 2 * Java DAB EPG API - Serialize/Deserialize To/From POJOs to XML/Binary as per 3 * ETSI specifications TS 102 818 (XML Specification for DAB EPG) and TS 102 4 * 371 (Transportation and Binary Encoding Specification for EPG). 5 * 6 * Copyright (C) 2007 GCap Media PLC 7 * 8 * This library is free software; you can redistribute it and/or 9 * modify it under the terms of the GNU Lesser General Public 10 * License as published by the Free Software Foundation; either 11 * version 2.1 of the License, or (at your option) any later version. 12 * 13 * This library is distributed in the hope that it will be useful, 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 * Lesser General Public License for more details. 17 * 18 * You should have received a copy of the GNU Lesser General Public 19 * License along with this library; if not, write to the Free Software 20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 21 */ 22 package com.gcapmedia.dab.epg; 23 24 /*** 25 * An identifier for a programme, programme event or programme group. 26 * Unlike a full Content Reference ID (CRID) this is designed to be 27 * more appropriate for limited bandwidth data channels and for basic 28 * EPG receivers. 29 * The short CRID (sCRID) is a 24bit unsigned integer, expressed as a 30 * decimal value, with a range of 0 to 16,777,215 inclusive. The 31 * following rules should be applied whenever short CRIDs are used in 32 * an EPG service: 33 * 34 * <ul> 35 * <li>The sCRID shall only be unique within a single EPG service, 36 * therefore a receiver must process it in some way on decoding 37 * to ensure that it is globally unique.</li> 38 * <li>The sCRID must not be reused within that EPG service for a 39 * minimum of six months</li> 40 * </ul> 41 * 42 * NOTE: An EPG Service is defined as EPG data for one or more services 43 * broadcast in a single EPG data channel. 44 */ 45 public class ShortCrid { 46 47 /*** 48 * CRID authority 49 */ 50 private int shortCrid; 51 52 /*** 53 * Create a new short CRID 54 */ 55 public ShortCrid(int shortCrid) { 56 if(shortCrid < 0 || shortCrid > 1<<24) { 57 throw new IllegalArgumentException("Short CRID must be between 0 to 16,777,215 inclusive"); 58 } 59 this.shortCrid = shortCrid; 60 } 61 62 /*** 63 * @return Returns the formatted CRID 64 */ 65 public int getShortCrid() { 66 return shortCrid; 67 } 68 69 /*** 70 * @see java.lang.Object#equals(java.lang.Object) 71 */ 72 @Override 73 public boolean equals(Object obj) { 74 if(!(obj instanceof ShortCrid)) { 75 return false; 76 } 77 ShortCrid that = (ShortCrid)obj; 78 return this.shortCrid == that.shortCrid; 79 } 80 81 /*** 82 * @see java.lang.Object#toString() 83 */ 84 public String toString() { 85 return getShortCrid() + ""; 86 } 87 88 }