📄 stemdescription.java
字号:
/**
* @(#)StemDescription.java
*
* Stores the definitions of a stem, ie. which keys hash into it.
*
* @author Adrian Bright
*/
import java.util.*;
public class StemDescription
{
private Character stemID;
/* The keys which hash into this stem */
private ArrayList keys;
/**
* StemDescription Initialises the StemDescription.
* @param ID The identifier for the stem.
*/
public StemDescription(Character ID)
{
keys = new ArrayList();
stemID = ID;
}
/**
* getID Returns the ID of the stem.
* @return The ID for the stem.
*/
public Character getID()
{
return stemID;
}
/**
* addKey Adds a key to the stem.
* @param newKey The new key to be added.
*/
public void addKey(String newKey)
{
keys.add(newKey);
}
/**
* keyExists Identifies whether or not the specified key exists on this stem.
* @param keyToCheck The key which needs checking.
* @return Whether or not the key exists on this stem.
*/
public boolean keyExists(String keyToCheck)
{
if (keys.contains(keyToCheck))
return true;
else return false;
}
/**
* getKeys Returns a list of all the keys on this stem.
* @return A String containing all the keys on this stem.
*/
public String getKeys()
{
String keyList = new String();
for (int count = 0; count < keys.size() ; count++)
{
keyList += (String)keys.get(count);
if (count < (keys.size()-1))
{
keyList += ",";
}
}
return keyList;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -