ben böyle bir yöntem oluşturduyöntem aynı tip nesne döndüğünüzde parametre nesnesi de
public Node(HashSet<string> _id, double _weight, List<string> _diff, int _depth, HashSet<string> _prefix, int _support)
{
Id = _id;
Weight = _weight;
Diffset = _diff;
Depth = _depth;
Prefix = _prefix;
Support = _support;
Isleaf = false;
Weightsup = _support*_weight;
}
bir nesne Düğüm yarattı
Bu problemde bana yardımcı ve üç parametre iletin değiştirilir
public Node CreateTailNode(Node _a, Node _b, Double _minsup)
{
Node _child = new Node();
_child.Prefix = _a.Id;
_child.Id = _a.Id.AddRange(_b.Id);
_child.Depth = _a.Depth + 1;
_child.Diffset = _a.Diffset.Except(_b.Diffset).ToList();
_child.Weight = (_a.Weight + _b.Weight)/2;
_child.Support = _a.Support - _child.Diffset.Count;
_child.Weightsup = _child.Support*_child.Weight;
if (_child.Weightsup < _minsup)
{
_child.Isleaf = true;
}
else
{
_child.Isleaf = false;
}
return _child;
}
dönüş _child sonra ben Düğüm _a.Prefix da değişir olduğunu gerçekleştirmek ve aynı _child.Prefix geldi
Ben Düğüm _A değişimi öneki olmadan _child nasıl oluşturabilirim
_a ve _b referans türleridir. Bu yöntem çağrıldıktan sonra bu nesnelerdeki herhangi bir değişiklik var. "_a.Id.AddRange (_b.Id)" ifadesini gözden geçirin. –