• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java BibTeXDatabase类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.jbibtex.BibTeXDatabase的典型用法代码示例。如果您正苦于以下问题:Java BibTeXDatabase类的具体用法?Java BibTeXDatabase怎么用?Java BibTeXDatabase使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



BibTeXDatabase类属于org.jbibtex包,在下文中一共展示了BibTeXDatabase类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: main

import org.jbibtex.BibTeXDatabase; //导入依赖的package包/类
/**
 * Helper tool to convert bibtex to {@link Reference} annotations. Reads
 * from stdin, writes to stdout.
 * 
 * @param args
 *            not used
 * @throws IOException
 * @throws ParseException
 */
public static void main(String[] args) throws IOException, ParseException {
	System.out.println("Enter bibtex record(s), followed by ctrl-d: ");

	final Reader reader = new InputStreamReader(System.in);

	final BibTeXParser parser = new BibTeXParser();
	final BibTeXDatabase database = parser.parse(reader);

	System.out.println();

	for (final BibTeXEntry entry : database.getEntries().values()) {
		final Reference r = MockReference.makeReference(entry);
		System.out.println(StandardFormatters.REFERENCE_ANNOTATION.format(r));
	}
}
 
开发者ID:openimaj,项目名称:openimaj,代码行数:25,代码来源:BibtexToReference.java


示例2: loadDatabase

import org.jbibtex.BibTeXDatabase; //导入依赖的package包/类
/**
 * <p>Loads a BibTeX database from a stream.</p>
 * <p>This method does not close the given stream. The caller is
 * responsible for closing it.</p>
 * @param is the input stream to read from
 * @return the BibTeX database
 * @throws IOException if the database could not be read
 * @throws ParseException if the database is invalid
 */
public BibTeXDatabase loadDatabase(InputStream is) throws IOException, ParseException {
	Reader reader = new InputStreamReader(is, "UTF-8");
	BibTeXParser parser = new BibTeXParser() {
		@Override
		public void checkStringResolution(Key key, BibTeXString string) {
			if (string == null) {
				//ignore
			}
		}
	};
	try {
		return parser.parse(reader);
	} catch (TokenMgrException err) {
		throw new ParseException("Could not parse BibTeX library: " +
				err.getMessage());
	}
}
 
开发者ID:michel-kraemer,项目名称:citeproc-java,代码行数:27,代码来源:BibTeXConverter.java


示例3: singleEntryWithDateRange

import org.jbibtex.BibTeXDatabase; //导入依赖的package包/类
/**
 * Tests if a bibliography entry with a date range can be converted
 * @throws Exception if something goes wrong
 */
@Test
public void singleEntryWithDateRange() throws Exception {
	BibTeXDatabase db = loadUnixDatabase();
	
	BibTeXEntry e = db.resolveEntry(new Key("Lycklama:1978:UTSb"));
	
	BibTeXConverter conv = new BibTeXConverter();
	CSLItemData cid = conv.toItemData(e);
	assertEquals("Lycklama:1978:UTSb", cid.getId());
	assertEquals(CSLType.ARTICLE_JOURNAL, cid.getType());
	assertEquals(1, cid.getAuthor().length);
	assertEquals("Lycklama", cid.getAuthor()[0].getFamily());
	assertEquals("H.", cid.getAuthor()[0].getGiven());
	assertEquals("The Bell System Technical Journal", cid.getCollectionTitle());
	assertEquals("The Bell System Technical Journal", cid.getContainerTitle());
	assertEquals("57", cid.getVolume());
	assertEquals("6", cid.getIssue());
	assertEquals("6", cid.getNumber());
	assertEquals("15", cid.getNumberOfPages());
	assertEquals("2087-2101", cid.getPage());
	assertEquals("2087", cid.getPageFirst());
	assertEquals("UNIX Time-Sharing System: UNIX on a Microprocessor", cid.getTitle());
	assertArrayEquals(new int[][] { new int[] { 1978, 7 }, new int[] { 1978, 8 } }, cid.getIssued().getDateParts());
}
 
开发者ID:michel-kraemer,项目名称:citeproc-java,代码行数:29,代码来源:BibTeXConverterTest.java


示例4: allEntries

import org.jbibtex.BibTeXDatabase; //导入依赖的package包/类
/**
 * Tests if a while bibliography database can be converted. Loads the
 * database and then checks a sample item.
 * @throws Exception if something goes wrong
 */
@Test
public void allEntries() throws Exception {
	BibTeXDatabase db = loadUnixDatabase();
	BibTeXConverter conv = new BibTeXConverter();
	Map<String, CSLItemData> cids = conv.toItemData(db);
	
	CSLItemData cid = cids.get("Ritchie:1974:UTS");
	assertEquals("Ritchie:1974:UTS", cid.getId());
	assertEquals(CSLType.ARTICLE_JOURNAL, cid.getType());
	assertEquals(2, cid.getAuthor().length);
	assertEquals("Ritchie", cid.getAuthor()[0].getFamily());
	assertEquals("Dennis W.", cid.getAuthor()[0].getGiven());
	assertEquals("Thompson", cid.getAuthor()[1].getFamily());
	assertEquals("Ken", cid.getAuthor()[1].getGiven());
	assertEquals("Communications of the Association for Computing Machinery", cid.getCollectionTitle());
	assertEquals("Communications of the Association for Computing Machinery", cid.getContainerTitle());
	assertEquals("17", cid.getVolume());
	assertEquals("7", cid.getIssue());
	assertEquals("7", cid.getNumber());
	assertEquals("11", cid.getNumberOfPages());
	assertEquals("365-375", cid.getPage());
	assertEquals("365", cid.getPageFirst());
	assertEquals("The UNIX Time-Sharing System", cid.getTitle());
	assertArrayEquals(new int[][] { new int[] { 1974, 7 } }, cid.getIssued().getDateParts());
}
 
开发者ID:michel-kraemer,项目名称:citeproc-java,代码行数:31,代码来源:BibTeXConverterTest.java


示例5: writeBibTeXEntries

import org.jbibtex.BibTeXDatabase; //导入依赖的package包/类
public static void writeBibTeXEntries(List<BibTeXEntry> entries, File file) {
	final BibTeXDatabase database = new BibTeXDatabase();
	for (BibTeXEntry entry : entries) {
		database.addObject(entry);
	}
	writeBibTeXDatabase(database, file);
}
 
开发者ID:limstepf,项目名称:pdfdbscrap,代码行数:8,代码来源:Main.java


示例6: ColorMapExplorer

import org.jbibtex.BibTeXDatabase; //导入依赖的package包/类
/**
 * @param colorMaps a list of colormaps
 * @param database the BibTeX database
 */
public ColorMapExplorer(List<KnownColormap> colorMaps, BibTeXDatabase database)
{
	super("ColorMap Explorer - " + GitVersion.getVersion());

	Preconditions.checkArgument(!colorMaps.isEmpty());

	ConfigPanel configPane = new ConfigPanel(colorMaps, database);

	OverviewPanel overviewPanel = new OverviewPanel(colorMaps);
	DecomposedViewPanel viewPanel = new DecomposedViewPanel();
	PointsExampleViewPanel pointsExampleView = new PointsExampleViewPanel();
	OverlayExampleViewPanel overlayExampleView = new OverlayExampleViewPanel();
	AnalysisPanel analysisPanel = new AnalysisPanel();
	JndViewPanel jndViewPanel = new JndViewPanel();
	ColormapPlotterPanel plotterPanel = new ColormapPlotterPanel();
	CompareView comparePanel = new CompareView(colorMaps);
	ExportView exportView = new ExportView();

	JTabbedPane tabPane = new JTabbedPane();
	tabPane.add("Overview", overviewPanel);
	tabPane.add("Comparative View", comparePanel);
	tabPane.add("Decomposed Colormap", viewPanel);
	tabPane.add("3D View", plotterPanel);
	tabPane.add("Color Sampling View", jndViewPanel);
	tabPane.add("Analysis View", analysisPanel);
	tabPane.add("Points Example View", pointsExampleView);
	tabPane.add("Overlay Example View", overlayExampleView);
	tabPane.add("Export", exportView);

	JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, configPane, tabPane);
	splitPane.setDividerLocation(250);

	// Provide minimum sizes for the two components in the split pane
	Dimension minimumSize = new Dimension(50, 50);
	configPane.setMinimumSize(minimumSize);
	tabPane.setMinimumSize(minimumSize);

	getContentPane().add(splitPane);
}
 
开发者ID:igd-iva,项目名称:colormap-explorer,代码行数:44,代码来源:ColorMapExplorer.java


示例7: toItemData

import org.jbibtex.BibTeXDatabase; //导入依赖的package包/类
/**
 * Converts the given database to a map of CSL citation items
 * @param db the database
 * @return a map consisting of citation keys and citation items
 */
public Map<String, CSLItemData> toItemData(BibTeXDatabase db) {
	Map<String, CSLItemData> result = new HashMap<>();
	for (Map.Entry<Key, BibTeXEntry> e : db.getEntries().entrySet()) {
		result.put(e.getKey().getValue(), toItemData(e.getValue()));
	}
	return result;
}
 
开发者ID:michel-kraemer,项目名称:citeproc-java,代码行数:13,代码来源:BibTeXConverter.java


示例8: issue34

import org.jbibtex.BibTeXDatabase; //导入依赖的package包/类
/**
 * Test if an invalid month can be handled correctly (i.e. if it will be ignored)
 * @throws Exception if something goes wrong
 */
@Test
public void issue34() throws Exception {
	String entry = "@inproceedings{ICIP99inv," +
			"author = \"M.G. Strintzis and I. Kompatsiaris\"," +
			"title = \"{3D Model-Based Segmentation of Videoconference Image Sequences}\"," +
			"booktitle = \"IEEE International Conference on Image Processing (ICIP)\"," +
			"address = \"Kobe, Japan\"," +
			"month = \"October 25-28\"," +
			"year = \"1999\"," +
			"note = {invited paper}," +
			"pages = \"\"," +
	"}";
	ByteArrayInputStream bais = new ByteArrayInputStream(
			entry.getBytes(StandardCharsets.UTF_8));
	
	BibTeXDatabase db = new BibTeXConverter().loadDatabase(bais);
	BibTeXItemDataProvider sys = new BibTeXItemDataProvider();
	sys.addDatabase(db);
	
	CSL citeproc = new CSL(sys, "ieee");
	citeproc.setOutputFormat("text");
	sys.registerCitationItems(citeproc);
	
	Bibliography bibl = citeproc.makeBibliography();
	for (String e : bibl.getEntries()) {
		assertEquals("[1]M. G. Strintzis and I. Kompatsiaris, "
				+ "\u201c3D Model-Based Segmentation of Videoconference "
				+ "Image Sequences,\u201d in IEEE International Conference "
				+ "on Image Processing (ICIP), Kobe, Japan, 1999.", e.trim());
	}
}
 
开发者ID:michel-kraemer,项目名称:citeproc-java,代码行数:36,代码来源:BibTeXItemDataProviderTest.java


示例9: loadUnixDatabase

import org.jbibtex.BibTeXDatabase; //导入依赖的package包/类
/**
 * Loads the <code>unix.bib</code> database from the classpath
 * @return the database
 * @throws IOException if the database could not be loaded
 * @throws ParseException if the database is invalid
 */
protected static BibTeXDatabase loadUnixDatabase() throws IOException, ParseException {
	BibTeXDatabase db;
	try (InputStream is = AbstractBibTeXTest.class.getResourceAsStream("/unix.bib.gz")) {
		GZIPInputStream gis = new GZIPInputStream(is);
		db = new BibTeXConverter().loadDatabase(gis);
	}
	return db;
}
 
开发者ID:michel-kraemer,项目名称:citeproc-java,代码行数:15,代码来源:AbstractBibTeXTest.java


示例10: singleEntry

import org.jbibtex.BibTeXDatabase; //导入依赖的package包/类
/**
 * Tests if a single bibliography entry can be converted
 * @throws Exception if something goes wrong
 */
@Test
public void singleEntry() throws Exception {
	BibTeXDatabase db = loadUnixDatabase();
	
	BibTeXEntry e = db.resolveEntry(new Key("Ritchie:1974:UTS"));
	
	BibTeXConverter conv = new BibTeXConverter();
	CSLItemData cid = conv.toItemData(e);
	assertEquals("Ritchie:1974:UTS", cid.getId());
	assertEquals(CSLType.ARTICLE_JOURNAL, cid.getType());
	assertEquals(2, cid.getAuthor().length);
	assertEquals("Ritchie", cid.getAuthor()[0].getFamily());
	assertEquals("Dennis W.", cid.getAuthor()[0].getGiven());
	assertEquals("Thompson", cid.getAuthor()[1].getFamily());
	assertEquals("Ken", cid.getAuthor()[1].getGiven());
	assertEquals("Communications of the Association for Computing Machinery", cid.getCollectionTitle());
	assertEquals("Communications of the Association for Computing Machinery", cid.getContainerTitle());
	assertEquals("17", cid.getVolume());
	assertEquals("7", cid.getIssue());
	assertEquals("7", cid.getNumber());
	assertEquals("11", cid.getNumberOfPages());
	assertEquals("365-375", cid.getPage());
	assertEquals("365", cid.getPageFirst());
	assertEquals("The UNIX Time-Sharing System", cid.getTitle());
	assertArrayEquals(new int[][] { new int[] { 1974, 7 } }, cid.getIssued().getDateParts());
}
 
开发者ID:michel-kraemer,项目名称:citeproc-java,代码行数:31,代码来源:BibTeXConverterTest.java


示例11: ConfigPanel

import org.jbibtex.BibTeXDatabase; //导入依赖的package包/类
/**
 * @param colorMaps the (sorted) list of all available color maps
 * @param database the BibTeX database
 */
public ConfigPanel(Collection<KnownColormap> colorMaps, final BibTeXDatabase database)
{
	setLayout(new BorderLayout(10, 10));
	setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));

	this.database = database;

	// store the dialog permanently so it remembers the LRU folder
	this.fileDialog = FileDialogs.createOpenImageDialog();

	// filter out duplicates
	colormaps.addAll(colorMaps);
	KnownColormap[] cmArray = colormaps.toArray(new KnownColormap[colormaps.size()]);

	mapsCombo = new JComboBox<KnownColormap>(cmArray);

	final JButton importButton = new JButton("Import colormap from image", loadIconImage("/icons/icon.png"));
	importButton.addActionListener(new ActionListener()
	{
		@Override
		public void actionPerformed(ActionEvent event)
		{
			JRootPane parent = ConfigPanel.this.getRootPane();
			importImage(parent);
		}
	});

	final JPanel cmPanel = new JPanel(new BorderLayout(5, 5));
	cmPanel.add(mapsCombo, BorderLayout.NORTH);
	cmPanel.add(importButton, BorderLayout.CENTER);

	JPanel cmInfoPanel = new JPanel(new BorderLayout(5, 5));
	descLabel = new JLabel();
	descLabel.setBorder(BorderFactory.createTitledBorder("Description"));
	refsLabel = new JLabel();
	refsLabel.setBorder(BorderFactory.createTitledBorder("References"));

	cmInfoPanel.add(descLabel, BorderLayout.NORTH);
	cmInfoPanel.add(refsLabel, BorderLayout.SOUTH);

	cmPanel.add(cmInfoPanel, BorderLayout.SOUTH);

	add(cmPanel, BorderLayout.NORTH);

	JPanel centerPanel = new JPanel(new BorderLayout());

	tileInfoPanel = new JPanel(new GridLayout(0, 2, 5, 5));
	tileInfoPanel.setBorder(BorderFactory.createTitledBorder("Tile Info"));
	tileInfoPanel.setVisible(false);
	centerPanel.add(tileInfoPanel, BorderLayout.NORTH);
	add(centerPanel, BorderLayout.CENTER);

	mapsCombo.addActionListener(new ActionListener()
	{
		@Override
		public void actionPerformed(ActionEvent e)
		{
			KnownColormap colormap = (KnownColormap) mapsCombo.getSelectedItem();
			MyEventBus.getInstance().post(new ColormapSelectionEvent(colormap));
			updateSelection(colormap);
		}

	});
	mapsCombo.setSelectedIndex(0);

	MyEventBus.getInstance().register(this);
}
 
开发者ID:igd-iva,项目名称:colormap-explorer,代码行数:72,代码来源:ConfigPanel.java


示例12: addDatabase

import org.jbibtex.BibTeXDatabase; //导入依赖的package包/类
/**
 * Adds the given database
 * @param db the database to add
 */
public void addDatabase(BibTeXDatabase db) {
	items.putAll(new BibTeXConverter().toItemData(db));
}
 
开发者ID:michel-kraemer,项目名称:citeproc-java,代码行数:8,代码来源:BibTeXItemDataProvider.java



注:本文中的org.jbibtex.BibTeXDatabase类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java Impression类代码示例发布时间:2022-05-23
下一篇:
Java ParticleAnalyzer类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap