21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
22 * or visit www.oracle.com if you need additional information or have any |
22 * or visit www.oracle.com if you need additional information or have any |
23 * questions. |
23 * questions. |
24 */ |
24 */ |
25 /* |
25 /* |
26 * Copyright (C) 2004-2011 |
26 * Copyright (C) 2004-2012 |
27 * |
27 * |
28 * Permission is hereby granted, free of charge, to any person obtaining a copy |
28 * Permission is hereby granted, free of charge, to any person obtaining a copy |
29 * of this software and associated documentation files (the "Software"), to deal |
29 * of this software and associated documentation files (the "Software"), to deal |
30 * in the Software without restriction, including without limitation the rights |
30 * in the Software without restriction, including without limitation the rights |
31 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
31 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
63 E extends ParsedElementAnnotation, |
63 E extends ParsedElementAnnotation, |
64 L extends Location, |
64 L extends Location, |
65 A extends Annotations<E,L,CL>, |
65 A extends Annotations<E,L,CL>, |
66 CL extends CommentList<L>> implements NameClassBuilder<NameClass,E,L,A,CL> { |
66 CL extends CommentList<L>> implements NameClassBuilder<NameClass,E,L,A,CL> { |
67 |
67 |
|
68 @Override |
68 public NameClass makeChoice(List<NameClass> nameClasses, L loc, A anno) { |
69 public NameClass makeChoice(List<NameClass> nameClasses, L loc, A anno) { |
69 NameClass result = nameClasses.get(0); |
70 NameClass result = nameClasses.get(0); |
70 for (int i = 1; i < nameClasses.size(); i++) |
71 for (int i = 1; i < nameClasses.size(); i++) { |
71 result = new ChoiceNameClass(result, nameClasses.get(i)); |
72 result = new ChoiceNameClass(result, nameClasses.get(i)); |
72 return result; |
73 } |
|
74 return result; |
73 } |
75 } |
74 |
76 |
|
77 @Override |
75 public NameClass makeName(String ns, String localName, String prefix, L loc, A anno) { |
78 public NameClass makeName(String ns, String localName, String prefix, L loc, A anno) { |
76 return new SimpleNameClass(ns, localName); |
79 if (prefix == null) { |
|
80 return new SimpleNameClass(ns, localName); |
|
81 } else { |
|
82 return new SimpleNameClass(ns, localName, prefix); |
|
83 } |
77 } |
84 } |
78 |
85 |
|
86 @Override |
79 public NameClass makeNsName(String ns, L loc, A anno) { |
87 public NameClass makeNsName(String ns, L loc, A anno) { |
80 return new NsNameClass(ns); |
88 return new NsNameClass(ns); |
81 } |
89 } |
82 |
90 |
83 public NameClass makeNsName(String ns, NameClass except, L loc, A anno) { |
91 public NameClass makeNsName(String ns, NameClass except, L loc, A anno) { |