我是java和新手的新手。我试图创建一个类型gridcell(值层单元格)的网格单元格(网格单元格)列表,但我不断收到错误“类型GridCell不是通用的;它不能用参数参数化”GridCell类型不是通用的;它不能用参数<GridCell>参数化。虽然创建一个列表
我该如何修复这个?
package tester;
import java.util.List;
import repast.simphony.context.Context;
import repast.simphony.engine.environment.RunEnvironment;
import repast.simphony.engine.schedule.ScheduledMethod;
import repast.simphony.parameter.Parameters;
//import repast.simphony.query.space.grid.GridCell;
import repast.simphony.query.space.grid.GridCellNgh;
import repast.simphony.space.grid.Grid;
import repast.simphony.space.grid.GridPoint;
import repast.simphony.valueLayer.AbstractGridFunction;
import repast.simphony.valueLayer.BufferedGridValueLayer;
import repast.simphony.valueLayer.BufferedGridValueLayer.Buffer;
import repast.simphony.valueLayer.GridCell;
import repast.simphony.valueLayer.MaxGridFunction;
import repast.simphony.valueLayer.MinGridFunction;
private void Move() {
// TODO Auto-generated method stub
BufferedGridValueLayer heat = (BufferedGridValueLayer) context.getValueLayer("Heat Layer");
Grid <Object> grid = (Grid <Object>) context.getProjection("Insulation Grid");
//Get the Grid Location of this insulation unit.
GridPoint pt = grid.getLocation(this);
//Use the GridCellNgh to retrieve the list of of Gridcells (grid) contianing Gridcells (valueLayergrid).
GridCellNgh <GridCell> nghCreator = new GridCellNgh <GridCell> (grid, pt, GridCell.class, 1, 1);
List <GridCell <GridCell>> gridCells = nghCreator.getNeighborhood(true);
}
这个例子是否需要所有的导入,是否可以修剪? –
@JamesK我只复制了一部分代码。还有其他代码需要导入才能工作。 – Tannay
请参阅http://stackoverflow.com/help/mcve –