读重构,写点东西,自己记着。
动机: 原来单方面引用,现在需要双方面引用。
做法: 1.在被引用段添加一个变量,保存引用端指针。
2.确定关联性。--------------》多低多引用,无所谓 如果谓一对多,则拥有单一引用的控制者。一般谓多的一方。
3然后在被控端添加辅助函数4.让修改函数更新反向指针。
如:
class Order{
Customer c;
}
class Customer{
}
开始order引用customer,忽然说,用户可以有多个订单,即用户也可以引用订单:首先添加一变量保存指针:
class Customer{
Set orders
}
这里呢,customer拥有多个引用,order拥有单个引用,所以order谓控制端,在被控端加辅助函数:
class Customer{
Set orders;
void firendOrders(){
return oders;
}
}
现在要更新两边的引用:
class Order{
customer c;
set(Customer arg){
if(c!=null) c.firendOrders().remove(this);
c = arg;
if(c!=null)c.firendOrders().add(this);
}
}
class Customer{
Set Orders;
void add(order o){oders.add(o)}
}
写完了,第一次笔记,乱就乱点吧,慢慢成长。
分享到:
相关推荐
to generate unbalanced targets with good prefixes but bad suffixes, and thus performance suffers when dealing with long sequences. We propose a simple yet effective approach to overcome this ...
bidirectional rectifier or inverter used to convert dc power to ac power
标题中的"6090059dc.rar_bidirectional_bidirectional DC DC_bidirectional DC"似乎是一种标识符,可能指的是一个特定的研究项目或者论文编号,它与双向直流-直流(DC-DC)转换器有关。描述中提到的"bidirectional ...
双向DC-DC设计优化,建模控制,Bidirectional dc-dc converter, high power density, complementary gating control operation, averaged model, general-purposed power stage modeling, modeling and control, ...
-L, --listenport # port to recieve bidirectional tests back on -P, --parallel # number of parallel client threads to run -T, --ttl # time-to-live, for multicast (default 1) Miscellaneous: -h, --...
双树RRT(Bidirectional Rapidly-exploring Random Trees,简称Bi-RRT)是一种在配置空间中寻找机器人路径规划的有效算法。它扩展了单向RRT(RRT)算法,提高了搜索效率,尤其是在大规模和复杂环境下的路径规划问题...
simulink_bidirectional”指的是一个结合了降压(Buck)和升压(Boost)功能的双向直流-直流(DC-DC)变换器的Simulink模型。这种变换器在电力电子领域中有着广泛的应用,尤其是在能量存储系统、电动汽车充电以及可...
BERT(Bidirectional Encoder Representations from Transformers)是一种深度学习模型,专为语言理解而设计。该模型的创新之处在于其预训练机制,它能够从未标记的文本中学习到深度的双向表示。传统的语言模型往往...
A new bidirectional bridgeless isolated cuk converter is used to achieve power factor near to unity. when compared to conventional Converters Circuit efficiency is further improved.
在机器人路径规划领域,Bidirectional Rapidly-exploring Random Trees (Bi-RRT) 是一种高效且广泛应用的算法,尤其在解决复杂环境中的路径搜索问题时。Bi-RRT 算法是对传统 RRT(Rapidly-exploring Random Trees)...
医学专业词典21 Century Bidirectional Science And Technology Dictionary.ld2
标题"bidirectional RRT_路径规划_三维障碍_RRT_RRT算法_RRT三维_源码"中,关键词主要涉及到双向RRT(Bidirectional Rapidly-exploring Random Trees,简称Bi-RRT)算法,这是一种在路径规划领域广泛使用的随机搜索...
双向循环神经网络(Bidirectional Recurrent Neural Network,BRNN)是循环神经网络(Recurrent Neural Networks,RNNs)的非因果性(non-causal)泛化。它通过将序列的前向和后向信息结合起来,能够对当前时刻的...
Bidirectional or two-way charging allows your electric vehicle to receive and supply electrical current. In other words, an EV with bidirectional charging won't just turn the alternating current (AC) ...
双向RRT(Bidirectional Rapidly-exploring Random Trees,简称Bi-RRT)是一种在路径规划领域广泛应用的算法,尤其在机器人运动规划中占有重要地位。它是对经典RRT(Rapidly-exploring Random Trees)算法的一种扩展...
Bidirectional DC-DC converters are used in applications where bidirectional power flow may be required. In hybrid electric vehicles (HEVs) and electric vehicles (EVs),
bidirectional transformer
keras 官方例子,深度学习专用,机器学习专用,代码简单,
This document describes active tail extensions to the Bidirectional Forwarding Detection (BFD) protocol for multipoint networks.