function W3Button1Click(Self, Sender$8) {
var valor = {vsData:[]};
valor.vsData = [1,2,3,4,5,6].slice();
WriteLn(valor);
TMyValueSet$Exclude(valor,5);
WriteLn(valor);
TMyValueSet$Include(valor,9);
WriteLn(valor);
if (TMyValueSet$Contains(valor,9)) {
WriteLn("SMS exist");
}
}
/// TMyValueSet = record
function Copy$TMyValueSet(s,d) {
d.vsData=s.vsData;
return d;
}
function Clone$TMyValueSet($) {
return {
vsData:$.vsData
}
}
/// function TMyValueSet.Contains(var Self: TMyValueSet; const aSetValue: Integer) : Boolean
function TMyValueSet$Contains(Self$7, aSetValue) {
var Result = false;
Result = false;
if (Self$7.vsData.length>0) {
Result = Self$7.vsData.indexOf(aSetValue,0)>=0;
}
return Result
}
/// procedure TMyValueSet.Include(var Self: TMyValueSet; const aSetValue: Integer)
function TMyValueSet$Include(Self$8, aSetValue$1) {
if (!TMyValueSet$Contains(Self$8,aSetValue$1)) {
Self$8.vsData.push(aSetValue$1);
}
}
/// procedure TMyValueSet.Exclude(var Self: TMyValueSet; const aSetValue: Integer)
function TMyValueSet$Exclude(Self$9, aSetValue$2) {
var mIndex$3 = 0;
mIndex$3 = Self$9.vsData.indexOf(aSetValue$2,0);
if (mIndex$3>=0) {
Self$9.vsData.splice(mIndex$3,1)
;
}
}
|