in yoko-core/src/main/java/org/apache/yoko/orb/CORBA/TypeCode.java [130:295]
private boolean equivalentRec(org.omg.CORBA.TypeCode t,
java.util.Vector history, java.util.Vector otherHistory) {
TypeCode tc = null;
try {
tc = (TypeCode) t;
} catch (ClassCastException ex) {
tc = _OB_convertForeignTypeCode(t);
}
if (recId_ != null) {
if (recType_ == null)
throw new org.omg.CORBA.BAD_TYPECODE(
org.apache.yoko.orb.OB.MinorCodes
.describeBadTypecode(org.apache.yoko.orb.OB.MinorCodes.MinorIncompleteTypeCode),
org.apache.yoko.orb.OB.MinorCodes.MinorIncompleteTypeCode,
org.omg.CORBA.CompletionStatus.COMPLETED_NO);
return recType_.equivalentRecHelper(t, history, otherHistory);
}
if (tc.recId_ != null) {
if (tc.recType_ == null)
throw new org.omg.CORBA.BAD_PARAM(
org.apache.yoko.orb.OB.MinorCodes
.describeBadParam(org.apache.yoko.orb.OB.MinorCodes.MinorIncompleteTypeCodeParameter),
org.apache.yoko.orb.OB.MinorCodes.MinorIncompleteTypeCodeParameter,
org.omg.CORBA.CompletionStatus.COMPLETED_NO);
return equivalentRecHelper(tc.recType_, history, otherHistory);
}
TypeCode tc1 = _OB_getOrigType();
TypeCode tc2 = tc._OB_getOrigType();
if (tc1.kind_ != tc2.kind_)
return false;
if (tc1.kind_ == org.omg.CORBA.TCKind.tk_objref
|| tc1.kind_ == org.omg.CORBA.TCKind.tk_struct
|| tc1.kind_ == org.omg.CORBA.TCKind.tk_union
|| tc1.kind_ == org.omg.CORBA.TCKind.tk_enum
|| tc1.kind_ == org.omg.CORBA.TCKind.tk_alias
|| tc1.kind_ == org.omg.CORBA.TCKind.tk_value
|| tc1.kind_ == org.omg.CORBA.TCKind.tk_value_box
|| tc1.kind_ == org.omg.CORBA.TCKind.tk_native
|| tc1.kind_ == org.omg.CORBA.TCKind.tk_abstract_interface
|| tc1.kind_ == org.omg.CORBA.TCKind.tk_except
|| tc1.kind_ == org.omg.CORBA_2_4.TCKind.tk_local_interface) {
if (!tc1.id_.equals("") && !tc2.id_.equals("")) {
if (tc1.id_.equals(tc2.id_))
return true;
else
return false;
}
}
// names_ and memberNames_ must be ignored
if (tc1.kind_ == org.omg.CORBA.TCKind.tk_struct
|| tc1.kind_ == org.omg.CORBA.TCKind.tk_union
|| tc1.kind_ == org.omg.CORBA.TCKind.tk_value
|| tc1.kind_ == org.omg.CORBA.TCKind.tk_except) {
if (tc1.memberTypes_.length != tc2.memberTypes_.length)
return false;
for (int i = 0; i < tc1.memberTypes_.length; i++) {
if (!(tc1.memberTypes_[i].equivalentRecHelper(
tc2.memberTypes_[i], history, otherHistory)))
return false;
}
}
if (tc1.kind_ == org.omg.CORBA.TCKind.tk_union) {
if (tc1.labels_.length != tc2.labels_.length)
return false;
for (int i = 0; i < tc1.labels_.length; i++) {
org.omg.CORBA.TypeCode ltc1 = tc1.labels_[i]._OB_type();
org.omg.CORBA.TypeCode ltc2 = tc2.labels_[i]._OB_type();
//
// Don't use equivalentRecHelper here
//
if (!ltc1.equivalent(ltc2))
return false;
java.lang.Object v1 = tc1.labels_[i].value();
java.lang.Object v2 = tc2.labels_[i].value();
ltc1 = _OB_getOrigType(ltc1);
switch (ltc1.kind().value()) {
case org.omg.CORBA.TCKind._tk_short:
case org.omg.CORBA.TCKind._tk_ushort:
case org.omg.CORBA.TCKind._tk_long:
case org.omg.CORBA.TCKind._tk_ulong:
case org.omg.CORBA.TCKind._tk_enum:
case org.omg.CORBA.TCKind._tk_longlong:
case org.omg.CORBA.TCKind._tk_ulonglong:
case org.omg.CORBA.TCKind._tk_char:
case org.omg.CORBA.TCKind._tk_boolean:
if (!v1.equals(v2))
return false;
break;
case org.omg.CORBA.TCKind._tk_octet:
break;
default:
org.apache.yoko.orb.OB.Assert._OB_assert("unsupported type in tk_union");
break;
}
}
//
// Don't use equivalentRecHelper here
//
if (!tc1.discriminatorType_.equivalent(tc2.discriminatorType_))
return false;
}
if (tc1.kind_ == org.omg.CORBA.TCKind.tk_string
|| tc1.kind_ == org.omg.CORBA.TCKind.tk_wstring
|| tc1.kind_ == org.omg.CORBA.TCKind.tk_sequence
|| tc1.kind_ == org.omg.CORBA.TCKind.tk_array) {
if (tc1.length_ != tc2.length_)
return false;
}
if (tc1.kind_ == org.omg.CORBA.TCKind.tk_sequence
|| tc1.kind_ == org.omg.CORBA.TCKind.tk_array
|| tc1.kind_ == org.omg.CORBA.TCKind.tk_value_box
|| tc1.kind_ == org.omg.CORBA.TCKind.tk_alias) {
if (!(tc1.contentType_.equivalentRecHelper(tc2.contentType_,
history, otherHistory)))
return false;
}
if (tc1.kind_ == org.omg.CORBA.TCKind.tk_fixed) {
if (tc1.fixedDigits_ != tc2.fixedDigits_
|| tc1.fixedScale_ != tc2.fixedScale_)
return false;
}
if (tc1.kind_ == org.omg.CORBA.TCKind.tk_value) {
if (tc1.memberVisibility_.length != tc2.memberVisibility_.length)
return false;
for (int i = 0; i < tc1.memberVisibility_.length; i++)
if (tc1.memberVisibility_[i] != tc2.memberVisibility_[i])
return false;
if (tc1.typeModifier_ != tc2.typeModifier_)
return false;
if (tc1.concreteBaseType_ != null || tc2.concreteBaseType_ != null) {
if (!(tc1.concreteBaseType_ != null && tc2.concreteBaseType_ != null))
return false;
//
// Don't use equivalentRecHelper here
//
if (!(tc1.concreteBaseType_.equivalent(tc2.concreteBaseType_)))
return false;
}
}
return true;
}