亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? table.java

?? Short Message Peer to Peer
?? JAVA
字號:
/*
 * Copyright (c) 1996-2001
 * Logica Mobile Networks Limited
 * All rights reserved.
 *
 * This software is distributed under Logica Open Source License Version 1.0
 * ("Licence Agreement"). You shall use it and distribute only in accordance
 * with the terms of the License Agreement.
 *
 */
package org.smpp.smscsim.util;

import java.util.List;
import java.util.LinkedList;
import java.util.ListIterator;

import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.FileNotFoundException;
import java.io.InputStream;
import java.io.IOException;
import java.io.OutputStream;

/**
 * Represents table of <code>Record</code>s. Users can add,
 * search, replace and remove records as well as read table from
 * file and write it to a file. Different records in the table can have
 * different attributes, however if the search for record with certain
 * value of given attribute is required, then the attribute must be present
 * in all the records. Single attribute search is supported, i.e. if
 * the key is naturally represented by more than one attribute,
 * there must be an attribute which contains bothe the attributes in some way.
 * <p>
 * The table can be read and written from and to input and output stream using
 * an implementation of <code>TableParser</code> class.
 *
 * @author Logica Mobile Networks SMPP Open Source Team
 * @version $Revision: 1.2 $
 * @see Record
 * @see Attribute
 * @see TableParser
 * @see BasicTableParser
 */
public class Table {
	/**
	 * Holds all records currently present in the table.
	 */
	private List records;

	/**
	 * The name (path) of the file to load the records from.
	 * Re-user in <code>reload</code> function.
	 * @see #read(String)
	 * @see #reload()
	 */
	private String fileName;

	/**
	 * Constructs an empty table.
	 */
	public Table() {
		fileName = null;
		records = new LinkedList();
	}

	/**
	 * Constructs a table by reading it from the disk file.
	 * For parsin of the table data read from the file uses parser
	 * returned by method <code>getParser</code>.
	 * @see #getParser()
	 * @see TableParser
	 * @see BasicTableParser
	 */
	public Table(String fileName) throws FileNotFoundException, IOException {
		this.fileName = fileName;
		read(fileName);
	}

	/**
	 * Adds one record to the table. No checking on duplicates is
	 * performed as the name of the key attribute is not provided.
	 * @param record the record to add
	 */
	public synchronized void add(Record record) {
		records.add(record);
	}

	/**
	 * Adds one record to the table. The checking on duplicates is
	 * performed; if a record with the same key is already present in the
	 * table, it's replaced with this record. Order of the records isn't
	 * ensured.
	 * @param record the record to add
	 * @param key the key attribute for checking the uniquenes
	 * @see #replace(Record,Attribute)
	 */
	public synchronized void add(Record record, Attribute key) {
		replace(record, key);
	}

	/**
	 * Replaces a record with the given attribute with the provided record.
	 * If no record with the same attribute is present in the table,
	 * the provided record is added to the table.
	 * @param record the record which replaces the existing record
	 * @param oldKey the key attribute for finding the record in the table
	 */
	public synchronized void replace(Record record, Attribute oldKey) {
		Record old = find(oldKey);
		if (old != null) {
			remove(oldKey);
		}
		add(record);
	}

	/**
	 * Returns a record whose one of the attributes matches to
	 * the provided attribute. If none found, returns null.
	 * @param key the attribute used for matching
	 * @return the found record
	 */
	public synchronized Record find(Attribute key) {
		if (key != null) {
			return find(key.getName(), key.getValue());
		} else {
			return null;
		}
	}

	/**
	 * Returns record which contains an attribute with the same name
	 * as provided equal to the value as provided. If none found, returns null.
	 * The comparison of the value is case sensitive.
	 * @param name the name of attribute to check
	 * @param value the required value of the attribute
	 * @return the found record
	 */
	public synchronized Record find(String name, String value) {
		Record current;
		String currKeyValue;
		ListIterator iter = records.listIterator(0);
		while (iter.hasNext()) {
			current = (Record) iter.next();
			currKeyValue = current.getValue(name);
			if ((currKeyValue != null) && (currKeyValue.equals(value))) {
				return current;
			}
		}
		return null;
	}

	/**
	 * Removes a record whose one attribute matches to the given attribute.
	 * Nothing will happen if none is found.
	 * @param key the attribute used for matching
	 */
	public synchronized void remove(Attribute key) {
		remove(key.getName(), key.getValue());
	}

	/**
	 * Removes a record whose attribute with the same key as provided
	 * is equal to the provided value. Nothing will happen if none is found.
	 * @param key the name of the key attribute
	 * @param value the required value of the key attribute
	 */
	public synchronized void remove(String key, String value) {
		Record toRemove = find(key, value);
		if (toRemove != null) {
			records.remove(toRemove);
		}
	}

	/**
	 * Returns count of records currently present in the table.
	 * @return the count of the records
	 * @see #get(int)
	 */
	public int count() {
		return records.size();
	}

	/**
	 * Returns a record on the given position. Useful for listing of all
	 * records from the table. Records are numbered from <code>0</code>
	 * to <code>count()-1</code>.
	 * @param i the index of the record to return
	 * @return the record on the given position
	 * @see #count()
	 */
	public Record get(int i) {
		return (Record) records.get(i);
	}

	/**
	 * Loads the table from the disk file. For parsing the file
	 * uses <code>TableParser</code> implementation returned by
	 * <code>getParser</code>.
	 * @param fileName the name of the file with the table data
	 * @see #read(InputStream)
	 * @see #write(String)
	 * @see #getParser()
	 * @see BasicTableParser
	 * @see TableParser
	 */
	public synchronized void read(String fileName) throws FileNotFoundException, IOException {
		FileInputStream is = new FileInputStream(fileName);
		records = new LinkedList(); // clear current list of records
		read(is);
		is.close();
	}

	/**
	 * Loads the table from the input stream. For parsing the file
	 * uses <code>TableParser</code> implementation returned by
	 * <code>getParser</code>.
	 * @param is the input stream with the data
	 * @see #write(OutputStream)
	 * @see #getParser()
	 * @see BasicTableParser
	 * @see TableParser
	 */
	public synchronized void read(InputStream is) throws IOException {
		TableParser parser = getParser();
		parser.parse(is);
	}

	/**
	 * Re-reads the table from disk file as set up by constructor.
	 * @see #Table(String)
	 * @see #read(String)
	 */
	public synchronized void reload() throws IOException {
		read(fileName);
	}
	/**
	 * Writes table data to the disk file. For composing the data
	 * uses <code>TableParser</code> implementation returned by
	 * <code>getParser</code>. The contents of the file is deleted
	 * before writing.
	 * @param fileName the name of file to write the data to
	 * @see #write(OutputStream)
	 * @see #read(String)
	 * @see #getParser()
	 * @see BasicTableParser
	 * @see TableParser
	 */
	public synchronized void write(String fileName) throws FileNotFoundException, IOException {
		FileOutputStream os = new FileOutputStream(fileName);
		write(os);
		os.close();
	}

	/**
	 * Writes table data to the oputput stream. For composing the data
	 * uses <code>TableParser</code> implementation returned by
	 * <code>getParser</code>.
	 * @param os the output stream to write the data to
	 * @see #write(String)
	 * @see #read(InputStream)
	 * @see #getParser()
	 * @see BasicTableParser
	 * @see TableParser
	 */
	public synchronized void write(OutputStream os) throws IOException {
		TableParser parser = getParser();
		parser.compose(os);
	}

	/**
	 * Returns parser to use for parsing and composing table data form
	 * and to input and output stream. By default returns instance
	 * of <code>BasicTableParser</code>. If necessary, another implemantation
	 * of <code>TableParser</code> can be created and used.
	 * @return the parser to use for reading and writting of the table data
	 * @see TableParser
	 * @see BasicTableParser
	 */
	public TableParser getParser() {
		return new BasicTableParser(this);
	}
}
/*
 * $Log: Table.java,v $
 * Revision 1.2  2006/03/09 16:24:15  sverkera
 * Removed compiler and javadoc warnings
 *
 * Revision 1.1  2003/07/23 00:28:39  sverkera
 * Imported
 *
 */

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
成人午夜伦理影院| 美日韩一级片在线观看| eeuss影院一区二区三区| 国产欧美一区二区精品性色超碰| 国产激情一区二区三区四区| 国产欧美日韩三级| 91社区在线播放| 午夜精品福利视频网站| 91精品国产欧美一区二区18 | 日韩电影一区二区三区| 6080亚洲精品一区二区| 一本大道久久a久久综合| 亚洲一区二三区| 日韩欧美在线网站| 福利电影一区二区| 亚洲欧美日韩中文播放| 欧美揉bbbbb揉bbbbb| 蜜桃视频第一区免费观看| 国产亚洲成年网址在线观看| 成人黄色免费短视频| 亚洲国产另类av| 久久影院电视剧免费观看| 不卡的av电影| 午夜伊人狠狠久久| 久久亚洲精品小早川怜子| 91美女福利视频| 极品尤物av久久免费看| 亚洲视频一二三区| 日韩欧美电影在线| 成人美女在线视频| 免费成人深夜小野草| 中文字幕巨乱亚洲| 欧美一区二区三区啪啪| 成人黄色一级视频| 日本不卡在线视频| 亚洲女子a中天字幕| 精品国产制服丝袜高跟| 26uuu亚洲综合色欧美| 色婷婷激情久久| 美女视频一区二区| 亚洲一区二区三区国产| 亚洲国产激情av| 日韩午夜av一区| 欧美色爱综合网| thepron国产精品| 激情偷乱视频一区二区三区| 一二三四社区欧美黄| 国产午夜精品福利| 日韩精品一区二区三区四区视频| 91久色porny | 亚洲欧美日韩一区二区| 欧美成人精品1314www| 精品视频全国免费看| 成人黄色小视频| 国产一区二区三区免费播放| 亚洲h动漫在线| 一区二区三区欧美日| 国产亚洲欧美日韩日本| 91精品国产综合久久久久久久| 国产亚洲一区二区三区| 日韩三级中文字幕| 91.com在线观看| 欧洲亚洲精品在线| 色婷婷亚洲精品| 一本大道综合伊人精品热热| 不卡的电视剧免费网站有什么| 国产一区三区三区| 精品亚洲成a人在线观看| 日本午夜一区二区| 日本va欧美va精品发布| 香蕉成人啪国产精品视频综合网| 一区二区三区中文在线| 亚洲天堂免费看| 亚洲欧美日韩小说| 亚洲精品久久嫩草网站秘色| 国产精品久久久久久亚洲伦| 中文成人av在线| 中文字幕一区二区在线观看| 亚洲欧洲99久久| 亚洲精品综合在线| 亚洲免费观看高清完整版在线观看| 欧美激情一区二区在线| 麻豆久久久久久久| 久久国产精品一区二区| 久久激情综合网| 国产成人综合亚洲网站| 国产黄色成人av| jlzzjlzz欧美大全| 色天天综合色天天久久| 91国模大尺度私拍在线视频| 欧美色区777第一页| 欧美一区日本一区韩国一区| 精品国产一区二区三区久久久蜜月 | 欧洲精品在线观看| 欧美区在线观看| 精品久久一区二区| 国产女同性恋一区二区| ...av二区三区久久精品| 一区二区国产盗摄色噜噜| 亚洲风情在线资源站| 免费精品视频在线| 成人精品gif动图一区| 精品国产乱码久久久久久闺蜜| 2023国产精品| 中文字幕亚洲欧美在线不卡| 亚洲国产欧美日韩另类综合| 美女爽到高潮91| 99久久婷婷国产综合精品电影 | a在线欧美一区| 欧美日韩一区久久| 26uuu久久天堂性欧美| 国产精品美女一区二区在线观看| 亚洲一区二区三区中文字幕在线| 日韩国产欧美一区二区三区| 国产乱妇无码大片在线观看| 91国产丝袜在线播放| www亚洲一区| 亚洲综合色成人| 精品午夜久久福利影院| 日本黄色一区二区| 久久久久久久久久看片| 亚洲成人免费影院| av一区二区久久| 精品黑人一区二区三区久久| 国产毛片一区二区| 欧美视频日韩视频在线观看| 久久蜜臀精品av| 午夜欧美一区二区三区在线播放| 国产剧情一区二区| 欧美丰满少妇xxxbbb| 国产精品久久一卡二卡| 免费在线观看不卡| 欧美最猛性xxxxx直播| 国产欧美日韩另类一区| 日本欧美一区二区三区乱码 | 日本高清视频一区二区| www国产精品av| 日韩精品国产欧美| 99re热这里只有精品视频| 精品国产91久久久久久久妲己| 一区二区三区四区亚洲| 国产激情一区二区三区| 日韩你懂的电影在线观看| 亚洲精品久久久蜜桃| 国产 欧美在线| 久久一夜天堂av一区二区三区 | 亚洲三级小视频| 国产乱码精品一品二品| 亚洲视频你懂的| av毛片久久久久**hd| 久久精品视频免费观看| 久久国产精品免费| 制服丝袜亚洲播放| 偷拍日韩校园综合在线| 欧美三区免费完整视频在线观看| 综合欧美亚洲日本| 成人免费高清在线观看| 亚洲精品一区二区三区香蕉| 看国产成人h片视频| 日韩一区二区在线看片| 偷偷要91色婷婷| 7777精品伊人久久久大香线蕉 | 99久久99久久精品国产片果冻| 久久伊人中文字幕| 国产一区二区三区免费看| 久久综合色婷婷| 国产一区三区三区| 久久久久久97三级| 国产成人精品免费在线| 日本一区二区综合亚洲| 国产91综合一区在线观看| 国产精品无码永久免费888| 国产aⅴ综合色| 激情综合一区二区三区| 精品国一区二区三区| 国产精品一区2区| 国产精品蜜臀在线观看| 色系网站成人免费| 亚洲国产综合人成综合网站| 欧美日韩免费在线视频| 日本伊人精品一区二区三区观看方式| 欧美一区二区三区小说| 韩国一区二区三区| 国产精品区一区二区三区| 99精品国产99久久久久久白柏| 一区二区三区**美女毛片| 欧美日韩一区二区不卡| 天天色图综合网| 久久婷婷一区二区三区| a级高清视频欧美日韩| 亚洲一区二区三区在线看| 欧美一区午夜视频在线观看| 精品一区二区久久久| 国产精品日韩精品欧美在线| 91丨porny丨在线| 五月婷婷另类国产| 久久免费的精品国产v∧| 99久久亚洲一区二区三区青草| 亚洲成av人影院| 久久―日本道色综合久久|