comparison dwtx/jface/text/templates/TemplateVariableType.d @ 162:1a5b8f8129df

...
author Frank Benoit <benoit@tionex.de>
date Mon, 08 Sep 2008 00:51:37 +0200
parents 3678e4f1a766
children
comparison
equal deleted inserted replaced
161:f8d52b926852 162:1a5b8f8129df
43 43
44 44
45 /** 45 /**
46 * Value object that represents the type of a template variable. A type is defined by its name and 46 * Value object that represents the type of a template variable. A type is defined by its name and
47 * may have parameters. 47 * may have parameters.
48 * 48 *
49 * @since 3.3 49 * @since 3.3
50 * @noinstantiate This class is not intended to be instantiated by clients. 50 * @noinstantiate This class is not intended to be instantiated by clients.
51 */ 51 */
52 public final class TemplateVariableType { 52 public final class TemplateVariableType {
53 53
62 62
63 this(String name, String[] params) { 63 this(String name, String[] params) {
64 Assert.isLegal(name !is null); 64 Assert.isLegal(name !is null);
65 Assert.isLegal(params !is null); 65 Assert.isLegal(params !is null);
66 fName= name; 66 fName= name;
67 fParams= Collections.unmodifiableList(new ArrayList(Arrays.asList(params))); 67 fParams= Collections.unmodifiableList(new ArrayList(Arrays.asList(stringcast(params))));
68 } 68 }
69 69
70 /** 70 /**
71 * Returns the type name of this variable type. 71 * Returns the type name of this variable type.
72 * 72 *
73 * @return the type name of this variable type 73 * @return the type name of this variable type
74 */ 74 */
75 public String getName() { 75 public String getName() {
76 return fName; 76 return fName;
77 } 77 }
78 78
79 /** 79 /**
80 * Returns the unmodifiable and possibly empty list of parameters (element type: {@link String}) 80 * Returns the unmodifiable and possibly empty list of parameters (element type: {@link String})
81 * 81 *
82 * @return the list of parameters 82 * @return the list of parameters
83 */ 83 */
84 public List getParams() { 84 public List getParams() {
85 return fParams; 85 return fParams;
86 } 86 }
87 87
88 /* 88 /*
89 * @see java.lang.Object#equals(java.lang.Object) 89 * @see java.lang.Object#equals(java.lang.Object)
90 */ 90 */
91 public bool equals(Object obj) { 91 public override int opEquals(Object obj) {
92 if ( cast(TemplateVariableType)obj ) { 92 if ( cast(TemplateVariableType)obj ) {
93 TemplateVariableType other= cast(TemplateVariableType) obj; 93 TemplateVariableType other= cast(TemplateVariableType) obj;
94 return other.fName.equals(fName) && other.fParams.equals(fParams); 94 return other.fName.equals(fName) && other.fParams.opEquals(cast(Object)fParams);
95 } 95 }
96 return false; 96 return false;
97 } 97 }
98 98
99 /* 99 /*
100 * @see java.lang.Object#hashCode() 100 * @see java.lang.Object#hashCode()
101 */ 101 */
102 public override hash_t toHash() { 102 public override hash_t toHash() {
103 alias .toHash toHash;
103 return fName.toHash() + fParams.toHash(); 104 return fName.toHash() + fParams.toHash();
104 } 105 }
105
106 /* 106 /*
107 * @see java.lang.Object#toString() 107 * @see java.lang.Object#toString()
108 * @since 3.3 108 * @since 3.3
109 */ 109 */
110 public override String toString() { 110 public override String toString() {
111 return fName + fParams.toString(); 111 return fName ~ (cast(Object)fParams).toString();
112 } 112 }
113 } 113 }