📄 properties.java
字号:
package graph;
import java.util.LinkedList;
import java.util.Hashtable;
import java.util.ListIterator;
import java.util.Iterator;
import java.awt.Color;
import java.io.Serializable;
public class Properties implements Serializable
{
private Hashtable allInformation;
private String name;
private Color color;
public Properties(String label)
{
setName(label);
allInformation = new Hashtable();
setColor(Color.red);
}
public String toString()
{
if (getName() != null)
{
return getName();
}
else
{
return new String("edge");
}
}
public String getName()
{
return name;
}
public void setName(String newName)
{
name = newName;
}
public Color getColor()
{
return color;
}
public void setColor(Color newColor)
{
color = newColor;
}
// Add Information
private void addInformationType(String type)
{
allInformation.put(type, new LinkedList());
}
private void removeInformationType(String type)
{
allInformation.remove(type);
}
public void addInformation(String type, Object o)
{
if (allInformation.get(type)==null)
{
addInformationType(type);
}
((LinkedList)allInformation.get(type)).add(o);
}
public void removeInformation(String type, Object o)
{
if (allInformation.get(type)==null)
{}
else
{
((LinkedList)allInformation.get(type)).remove(o);
if (((LinkedList)allInformation.get(type)).size()==0)
{
removeInformationType(type);
}
}
}
public ListIterator getInformation(String type)
{
if (allInformation.containsKey(type))
{
return ((LinkedList)allInformation.get(type)).listIterator();
}
else
{
return null;
}
}
public LinkedList getListInformation(String type)
{
if (allInformation.containsKey(type))
{
return ((LinkedList)allInformation.get(type));
}
else
{
return null;
}
}
public Iterator getInformationTypes()
{
return allInformation.keySet().iterator();
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -