Source code: com/port80/util/attr/IAttrTable.java
1 //
2 // Copyright(c) 2002, Chris Leung
3 //
4
5 package com.port80.util.attr;
6
7 import java.io.*;
8 import java.util.*;
9
10 /** Interface to access attribute table.
11 */
12 public interface IAttrTable {
13
14 ////////////////////////////////////////////////////////////////////////
15
16 IAttrRegistry getAttrRegistry();
17
18 /** Get attribute with given name. If attribute is not defined
19 * locally, get from the default table in the graph element
20 * factory.
21 */
22 Object getAttr(String name);
23 Object getAttrCached(String name);
24 String getAttrString(String name);
25 String getAttrAsString(String name);
26 //
27 boolean getAttrBool(String name);
28 int getAttrInt(String name);
29 long getAttrLong(String name);
30 float getAttrFloat(String name);
31 double getAttrDouble(String name);
32 //
33 boolean getAttrBool(String name, boolean def);
34 int getAttrInt(String name, int def);
35 long getAttrLong(String name, long def);
36 float getAttrFloat(String name, float def);
37 double getAttrDouble(String name, double def);
38
39 /**
40 * Set local attribute.
41 */
42 Object setAttr(String name, Object value);
43 Object setAttr(String name, boolean value);
44 Object setAttr(String name, int value);
45 Object setAttr(String name, long value);
46 Object setAttr(String name, float value);
47 Object setAttr(String name, double value);
48 Object setAttrFromString(String name, String value);
49
50 /** Remove a local attribute. @return attribute removed. */
51 Object removeAttr(String name);
52 /** Remove all unregistered local attributes. */
53 void removeUnregisteredAttrs();
54 /** Remove all local attributes. */
55 void clearAttrs();
56
57 /** Check if given attribute is defined locally. @return true if exists locally (include value==null). */
58 boolean hasAttr(String name);
59 /** All local attribute names (include value==null). */
60 Set attrKeySet();
61
62 ////////////////////////////////////////////////////////////////////////
63 }