这样设计:Station一对多Wire,然后wire一对多WireComponent,WireComponent一对一WireType。 原理:一个变电站对应多条输电线,每条输电线都对应对个导线组件,组件中属性有缆线类型,输电线位置,长度。 public class Station { private int id; private Set<Wire> wireSet = new HashSet<Wire>(0); } public class Wire { private int id; // 组成此线路所用缆线组件集合 private Set<WireComponent> wireSet = new HashSet<WireComponent>(0); } public class WireComponent { private WireType wireType; //具体缆线类型 private double length; //长度 private int local; //具体所处位置 } public class WireType { private int id; private String name; }
原理:一个变电站对应多条输电线,每条输电线都对应对个导线组件,组件中属性有缆线类型,输电线位置,长度。
public class Station {
private int id;
private Set<Wire> wireSet = new HashSet<Wire>(0);
}
public class Wire {
private int id;
// 组成此线路所用缆线组件集合
private Set<WireComponent> wireSet = new HashSet<WireComponent>(0);
}
public class WireComponent {
private WireType wireType; //具体缆线类型
private double length; //长度
private int local; //具体所处位置
}
public class WireType {
private int id;
private String name;
}