如何在arraylist中安排这些对象

时间:2017-12-09 15:02:59

标签: java oop javafx

我已经获得了一项任务,可以创建一个在JavaFX中移动,旋转和碰撞的对象的竞技场。我的讲师指示我们对将出现在游戏中的所有对象使用List。所有对象都使用抽象方法从抽象类继承,用于计算位置和旋转等。 每个物体也可以有附件,例如“胡须”。检测其他物体并相应地转动机器人。

function loadData() {
var sheet = SpreadsheetApp.getActiveSheet();
var instanceUrl = 'jdbc:mysql://' + address;
var dbUrl = instanceUrl + '/' + db;
var conn = Jdbc.getConnection(dbUrl, user, userPwd);

var stmt = conn.createStatement();
stmt.setMaxRows(10);
var results = stmt.executeQuery('Select YEAR(dateCreated) as yearAdded,MONTH(dateCreated) as monthAdded, DAY(dateCreated) as dayAdded,sum(amount)/100 from stripeTransactions GROUP BY yearAdded ,monthAdded,dayAdded;');
var numCols = results.getMetaData().getColumnCount(); 
while (results.next()) {
  var rowArray = new Array();
   for (var col = 0; col < numCols; col++) {
    rowArray.push(results.getString(col+1));
  }
  sheet.appendRow(rowArray);
}

results.close();
stmt.close();
var stmt2 = conn.createStatement();
stmt2.setMaxRows(10);
var results2= stmt2.executeQuery('Select YEAR(dateAdded) as yearAdded,MONTH(dateAdded) as monthAdded, DAY(dateAdded) as dayAdded,sum(amount) from itunestransactions GROUP BY yearAdded ,monthAdded,dayAdded;');
var numCols2 = results2.getMetaData().getColumnCount();
 while (results2.next()) {
  var rowArray2 = new Array();
   for (var cal = numCols; cal < numCols2; cal++) {
    rowArray2.push(results2.getString(cal+1));
  }
 sheet.appendRow(rowArray2);
}

results2.close();
stmt2.close();
}

每个机器人都应该有一个&#39;附件的arraylist&#39;连接到机器人?

每个附件还需要知道它连接到哪个机器人。

这会引起问题吗?或者这会有效地创建对象和附件之间的双重链接?

或者所有对象都应该有自己的数组列表吗?

0 个答案:

没有答案