/[classpath]/classpath/gnu/CORBA/DynAn/gnuDynEnum.java
ViewVC logotype

Diff of /classpath/gnu/CORBA/DynAn/gnuDynEnum.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.1.2.1 by gnu_andrew, Tue Aug 16 16:22:36 2005 UTC revision 1.1.2.2 by gnu_andrew, Sat Sep 10 15:31:35 2005 UTC
# Line 51  import org.omg.DynamicAny.DynAnyPackage. Line 51  import org.omg.DynamicAny.DynAnyPackage.
51  import org.omg.DynamicAny.DynAnyPackage.TypeMismatch;  import org.omg.DynamicAny.DynAnyPackage.TypeMismatch;
52  import org.omg.DynamicAny.DynEnum;  import org.omg.DynamicAny.DynEnum;
53    
54  import java.io.*;  import java.io.IOException;
55    
56  import java.util.Arrays;  import java.util.Arrays;
57    
# Line 60  import java.util.Arrays; Line 60  import java.util.Arrays;
60   *   *
61   * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)   * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)
62   */   */
63  public class gnuDynEnum  public class gnuDynEnum extends anyUndivideable implements DynEnum
   extends anyUndivideable  
   implements DynEnum  
64  {  {
65    /**    /**
66     * Use serialVersionUID for interoperability.     * Use serialVersionUID for interoperability.
# Line 85  public class gnuDynEnum Line 83  public class gnuDynEnum
83     * Create a new dyn enum from the given typecode.     * Create a new dyn enum from the given typecode.
84     */     */
85    public gnuDynEnum(TypeCode oType, TypeCode aType, gnuDynAnyFactory aFactory,    public gnuDynEnum(TypeCode oType, TypeCode aType, gnuDynAnyFactory aFactory,
86                      ORB anOrb      ORB anOrb
87                     )    )
88    {    {
89      super(oType, aType, aFactory, anOrb);      super(oType, aType, aFactory, anOrb);
90      try      try
# Line 117  public class gnuDynEnum Line 115  public class gnuDynEnum
115     * Assign the Enum from the passed value. The passed DynAny must hold the     * Assign the Enum from the passed value. The passed DynAny must hold the
116     * enumeration of exactly the same final_type.     * enumeration of exactly the same final_type.
117     */     */
118    public void assign(DynAny from)    public void assign(DynAny from) throws TypeMismatch
               throws TypeMismatch  
119    {    {
120      checkType(official_type, from.type());      checkType(official_type, from.type());
121      if (!(from instanceof DynEnum))      if (!(from instanceof DynEnum))
# Line 154  public class gnuDynEnum Line 151  public class gnuDynEnum
151        {        {
152          gnuDynEnum oe = (gnuDynEnum) other;          gnuDynEnum oe = (gnuDynEnum) other;
153          return current == oe.current &&          return current == oe.current &&
154                 (oe.values == values || Arrays.equals(values, oe.values));          (oe.values == values || Arrays.equals(values, oe.values));
155        }        }
156      else if (other instanceof DynEnum)      else if (other instanceof DynEnum)
157        {        {
# Line 168  public class gnuDynEnum Line 165  public class gnuDynEnum
165    /**    /**
166     * Set value from any that must contain enumeration.     * Set value from any that must contain enumeration.
167     */     */
168    public void from_any(Any an_any)    public void from_any(Any an_any) throws TypeMismatch, InvalidValue
                 throws TypeMismatch, InvalidValue  
169    {    {
170      checkType(official_type, an_any.type());      checkType(official_type, an_any.type());
171      try      try
# Line 207  public class gnuDynEnum Line 203  public class gnuDynEnum
203    /**    /**
204     * Set the value of this enumeration as string.     * Set the value of this enumeration as string.
205     */     */
206    public void set_as_string(String value)    public void set_as_string(String value) throws InvalidValue
                      throws InvalidValue  
207    {    {
208      for (int i = 0; i < values.length; i++)      for (int i = 0; i < values.length; i++)
209        {        {
# Line 225  public class gnuDynEnum Line 220  public class gnuDynEnum
220    /**    /**
221     * Set the value of this enumeration as int.     * Set the value of this enumeration as int.
222     */     */
223    public void set_as_ulong(int value)    public void set_as_ulong(int value) throws InvalidValue
                     throws InvalidValue  
224    {    {
225      if (value < 0 || value >= values.length)      if (value < 0 || value >= values.length)
226        throw new InvalidValue(value + " not in [0.." + values.length);        throw new InvalidValue(value + " not in [0.." + values.length);

Legend:
Removed from v.1.1.2.1  
changed lines
  Added in v.1.1.2.2

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26