📄 corpustype.java
字号:
/* * File: CorpusType.java * Project: MPI Linguistic Application * Date: 02 May 2007 * * Copyright (C) 2001-2007 Max Planck Institute for Psycholinguistics * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *//* This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */package mpi.search.content.model;import java.util.ArrayList;import java.util.Arrays;import java.util.HashMap;import java.util.Iterator;import java.util.List;import java.util.Locale;/** * This interface describes Corpus-specific Types and Relations of tiers and possible * units of distance between them. Both Tiers and Units are stored in Arrays of * FieldTypes, witch contain a full name and a mnemonic, resp. * * @author Hennie Brugman, Alexander Klassmann * @version 02-April-2002 */public abstract class CorpusType { /** Holds value of property DOCUMENT ME! */ protected final HashMap unitMnemonics = new HashMap(); /** Holds value of property DOCUMENT ME! */ protected String frameTitle; /** Holds value of property DOCUMENT ME! */ public String coarserUnit1 = null; /** Holds value of property DOCUMENT ME! */ public String coarserUnit2 = null; /** Holds value of property DOCUMENT ME! */ public String coarserUnit3 = null; /** Holds value of property DOCUMENT ME! */ public String standardUnit = null; /** Holds value of property DOCUMENT ME! */ protected String[] tierNames; /** * Returns a fixed, hard-wired list of Tier-Types. * * @return DOCUMENT ME! */ public String[] getTierNames() { return tierNames; } /** * DOCUMENT ME! * * @return DOCUMENT ME! */ abstract public String[] getIndexTierNames(); /** * Returns a mnemonic (used by the perl/python script) for a unit * * @param unit DOCUMENT ME! * * @return DOCUMENT ME! */ public String getUnitMnemonic(String unit) { return unitMnemonics.containsKey(unit) ? (String) unitMnemonics.get(unit) : null; } /** * DOCUMENT ME! * * @return DOCUMENT ME! */ abstract public boolean allowsSearchOverMultipleTiers(); /** * DOCUMENT ME! * * @param mnemonic * * @return String */ public String getUnitFromMnemonic(String mnemonic) { for (Iterator iter = unitMnemonics.keySet().iterator(); iter.hasNext();) { String key = (String) iter.next(); if (((String) unitMnemonics.get(key)).equals(mnemonic)) { return key; } } return null; } /** * DOCUMENT ME! * * @param tierName * * @return unabbreviatedTierName */ public String getUnabbreviatedTierName(String tierName) { return Arrays.asList(tierNames).contains(tierName) ? tierName : null; } /** * Returns a title for the Search-Frame * * @return DOCUMENT ME! */ public String getFrameTitle() { return frameTitle; } /** * Returns, if exists, a list of closed vocabulary corresponding to a tier; Otherwise * null. * * @param tierName DOCUMENT ME! * * @return DOCUMENT ME! */ abstract public List getClosedVoc(String tierName); /** * Returns true if there is a "closed vocabular" for this fieldType * * @param tierName DOCUMENT ME! * * @return DOCUMENT ME! */ abstract public boolean isClosedVoc(String tierName); /** * Returns a true if a "Closed Vocabulary" should be editable (thus not really * closed). * * @param closedVoc DOCUMENT ME! * * @return DOCUMENT ME! */ abstract public boolean isClosedVocEditable(List closedVoc); /** * Returns the default Locale of a Field Type * * @param tierName DOCUMENT ME! * * @return DOCUMENT ME! */ abstract public Locale getDefaultLocale(String tierName); /** * returns all tiers with the same root tier as the specified tier * * @param tierName DOCUMENT ME! * * @return array of tier Names */ abstract public String[] getRelatedTiers(String tierName); /** * Returns the possible units, which fieldType1 and fieldType2 both can be measured * with * * @param tierName1 DOCUMENT ME! * @param tierName2 DOCUMENT ME! * * @return DOCUMENT ME! */ public String[] getPossibleUnitsFor(String tierName1, String tierName2) { ArrayList list = new ArrayList(); if (standardUnit != null) { list.add(standardUnit); } if (coarserUnit1 != null) { list.add(coarserUnit1); } if (coarserUnit2 != null) { list.add(coarserUnit2); } if (coarserUnit3 != null) { list.add(coarserUnit3); } return (String[]) list.toArray(new String[0]); } /** * Some tiers might be obligatory case sensitive (pho) * * @param tierName DOCUMENT ME! * * @return boolean */ abstract public boolean strictCaseSensitive(String tierName); /** * Returns the default unit * * @return String */ public String getDefaultUnit() { return standardUnit; } /** * DOCUMENT ME! * * @return DOCUMENT ME! */ abstract public boolean hasAttributes(); /** * DOCUMENT ME! * * @param tierName DOCUMENT ME! * * @return DOCUMENT ME! */ abstract public String[] getAttributeNames(String tierName); /** * DOCUMENT ME! * * @param attributeName DOCUMENT ME! * * @return DOCUMENT ME! */ abstract public String getToolTipTextForAttribute(String attributeName); /** * DOCUMENT ME! * * @return DOCUMENT ME! */ abstract public boolean allowsQuantifierNO(); /** * DOCUMENT ME! * * @return DOCUMENT ME! */ abstract public boolean allowsTemporalConstraints(); /** * DOCUMENT ME! * * @param tierName DOCUMENT ME! * @param attributeName DOCUMENT ME! * * @return DOCUMENT ME! */ abstract public Object getPossibleAttributeValues(String tierName, String attributeName); /** * DOCUMENT ME! * * @return DOCUMENT ME! */ abstract public Class getInputMethodClass();}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -