001/* 002 * jPOS Project [http://jpos.org] 003 * Copyright (C) 2000-2026 jPOS Software SRL 004 * 005 * This program is free software: you can redistribute it and/or modify 006 * it under the terms of the GNU Affero General Public License as 007 * published by the Free Software Foundation, either version 3 of the 008 * License, or (at your option) any later version. 009 * 010 * This program is distributed in the hope that it will be useful, 011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 013 * GNU Affero General Public License for more details. 014 * 015 * You should have received a copy of the GNU Affero General Public License 016 * along with this program. If not, see <http://www.gnu.org/licenses/>. 017 */ 018 019package org.jpos.iso; 020 021/** 022 * ISOFieldPackager Binary LLNUM 023 * 024 * @author apr@cs.com.uy 025 * @version $Id$ 026 * @see ISOComponent 027 */ 028public class IFB_LLNUM extends ISOStringFieldPackager { 029 /** Default constructor. */ 030 public IFB_LLNUM() { 031 super(NullPadder.INSTANCE, BCDInterpreter.RIGHT_PADDED, BcdPrefixer.LL); 032 } 033 /** 034 * Constructs a packager with the given length and description. 035 * @param len - field len 036 * @param description symbolic descrption 037 * @param isLeftPadded if true, apply padding 038 */ 039 public IFB_LLNUM(int len, String description, boolean isLeftPadded) { 040 super(len, description, NullPadder.INSTANCE, 041 isLeftPadded ? BCDInterpreter.LEFT_PADDED : BCDInterpreter.RIGHT_PADDED, 042 BcdPrefixer.LL); 043 checkLength(len, 99); 044 } 045 046 /** 047 * Constructs a packager with extended options. 048 * @param len field length 049 * @param description field description 050 * @param isLeftPadded if true, left-pad the value 051 * @param fPadded if true, use F-padded BCD encoding 052 */ 053 public IFB_LLNUM(int len, String description, boolean isLeftPadded, boolean fPadded) { 054 super(len, description, NullPadder.INSTANCE, 055 isLeftPadded ? BCDInterpreter.LEFT_PADDED : 056 fPadded ? BCDInterpreter.RIGHT_PADDED_F : BCDInterpreter.RIGHT_PADDED, 057 BcdPrefixer.LL); 058 checkLength(len, 99); 059 } 060 061 public void setLength(int len) 062 { 063 checkLength(len, 99); 064 super.setLength(len); 065 } 066 067 /** Must override ISOFieldPackager method to set the Interpreter correctly */ 068 public void setPad (boolean pad) 069 { 070 setInterpreter(pad ? BCDInterpreter.LEFT_PADDED : BCDInterpreter.RIGHT_PADDED); 071 this.pad = pad; 072 } 073} 074