我如何在Java中(只是建议)分割形状的ArrayList到分区/名单 [英] How can i split an ArrayList of Shapes into partitions/lists in Java (Just advice)

查看:190
本文介绍了我如何在Java中(只是建议)分割形状的ArrayList到分区/名单的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我只是想要一个建议或我怎么能做到这一点的建议。我一直在思考了好几个小时,现在并不能找到一个解决方案。

I just want an advice or suggestions of how i can do it. i've been thinking about it for hours now and can't find a solution.

我的目标是这个ER图转换为表格。

My aim is to convert this ER Diagram to tables.

所以我有一个矩形(实体)链接到一个椭圆(属性)。我已经上的形状,其中该线路将检索被链接到它的物体的碰撞制定。见下图:

So i have a Rectangle(Entity) that is linked to an ellipse(Attribute). I've already worked out on the collisions of the shapes where the line will retrieve the object that is linked to it. See the picture below:

,结果将是当上述图绘制如下:

the result will be as follows when the above diagram is drawn:

线(1)碰撞与长方形索引(0)的

LINE(1) COLLIDES WITH ELLIPSE OF INDEX(2)

我的形状被存储在形状的ArrayList,什么想实现的是:

My Shapes are being stored in an ArrayList of shapes and what am trying to achieve is :

1 - 我希望能够进入里面的形状文本。文字(如学生),我也将在以后需要它时,我想使ER图在表的转换。我已经使用形状的一个数组列表,是有可能的指针添加到形状的这个数组列表中各项指标,指出该指数(0)(这是一个矩形)被命名为学生? (见下图)

1- I want to be able to enter text inside the shapes. That text(e.g "Student") i will also need it later on when i want to make the conversion of ER Diagram to tables. I'm already using an Array List of Shapes, is it possible to add pointers to each index of this Array List of Shapes, stating that this index(0) (which is a rectangle) is named "Student"? (See picture below)

应该在哪里文本存储,这样我以后可以检索文本学生使用矩形的具体指标。如果我的做法是不好的,我会的我怎么能做到这一点AP preciate其他建议。我可以使用分区?

Where should the text be stored so that i can later on retrieve the text "Student" using a specific index of that rectangle. If my approach is not good, i will appreciate other suggestions of how i can do it. Can i use partitions?

咨询!

请帮家伙?

推荐答案

要做到这一点是创建你的形状和文字属性的新对象,并覆盖equals方法最简单的方法。所以,你可能能够检索的形状和形状内的文本。

The easiest way to do it is to create a new object with your shape and text attribute, and override the equals method. So you could be able to retrieve the shape and the text inside the shape.

您也可以管理第二个数组列表与你的文字,与匹配的索引,如形状0在0文本列表中的文本属性,但我不推荐它,因为它是很容易建立新问题

You can also manage a second arraylist with your text, with matching index, like the shape in 0 have the text attribute in your text list in 0, but i do not recommand it, because it is really easy to create new issues.

这篇关于我如何在Java中(只是建议)分割形状的ArrayList到分区/名单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆