aboutsummaryrefslogtreecommitdiffstats
path: root/ide_common/src/com/android/ide/common
diff options
context:
space:
mode:
authorTor Norbye <tnorbye@google.com>2012-03-21 18:04:18 -0700
committerTor Norbye <tnorbye@google.com>2012-03-22 14:47:16 -0700
commit61684adfd7345f1a0df24bcf9176e6f528295bbb (patch)
tree2b08ae518b0a0150ec610a85679501626b611c62 /ide_common/src/com/android/ide/common
parent6b09013b6cb0fdcb48350a60bb3ed924ac9f562d (diff)
downloadsdk-61684adfd7345f1a0df24bcf9176e6f528295bbb.zip
sdk-61684adfd7345f1a0df24bcf9176e6f528295bbb.tar.gz
sdk-61684adfd7345f1a0df24bcf9176e6f528295bbb.tar.bz2
Change AttributeInfo.getFormats() to returning an EnumSet<Format>
This changeset changes the signature of AttributeInfo.getFormats() from returning a Format[] to returning an EnumSet<Format>. Furthermore, it defines a number of constants for the various common format sets such that they can be reused. Nearly all uses of the getFormats() method was really just trying to see "is format X among the formats", so using enumsets is more natural since it has a contains method. This also lets us replace some attribute init code which was building up a set from the array for this exact same purpose just reuse the format set directly. In the attribute parser, rather than computing the uppercase version of each format string ("dimension"=>"DIMENSION") and then doing a Format.valueOf("DIMENSION"), we now compute a map for all the format constants as lowercase to the corresponding format instance, and use that map when parsing the attrs.xml file. Note that there is a small semantic change from having an array of formats to using an enumset: The format specified an ordering. However, it does not look like any code depended on this, and it's also not clear that the ordering in attrs.xml is intentional. For example, it contains both "color|reference" and "reference|color", and in both cases the intent is that the attribute can specify an actual color or a reference to a color. Now with an enum set, the order used when traversing the formats will always be in their natural order, and for this purpose the REFERENCE type is moved to the end since it's the least specific. Change-Id: I1170cff48086f5cc13e4b70a35deea1f9979c883
Diffstat (limited to 'ide_common/src/com/android/ide/common')
0 files changed, 0 insertions, 0 deletions