小编Sno*_*ama的帖子

Java,这是一个Deep副本吗?

我似乎无法通过阅读任何类似的问题得到一个明确的精确答案,我正在尝试使用复制构造函数深入克隆Java中的对象这是一个深层副本:

public class Tile{
    Image sprite = null;
    int x = 0;
    int y = 0;
    public Tile(Image setImage, int sX, int sY){
         this.sprite = setImage;
         this.x = sX;
         this.y = sY;
    }
    public Tile(Tile copyTile){
         this.sprite = copyTile.sprite;
         this.x = copyTile.x;
         this.y = copyTile.y;
    }
    public void setNewLocation(int sX, int sY){
         this.x = sX;
         this.y = sY;
    }
}
Run Code Online (Sandbox Code Playgroud)

然后,当我创建我的瓷砖地图时,我可以做这样的事情

List<Tile> tileList = new List<Tile>();
Tile masterGrassTile = new Tile(grassImage, 0,0);
tileList.set(0,new Tile(masterGrassTile));
tileList.set(1,new Tile(masterGrassTile));
tileList.get(0).setNewLocation(0,32);
tileList.get(1).setNewLocation(0,64);
Run Code Online (Sandbox Code Playgroud)

如果我要在各自的位置渲染两块瓷砖那会有用吗?或者是赋值tileList.get(1).setNewLocation(0,64); 影响像引用,所有这些都与上次分配的位置相同.

java deep-copy

7
推荐指数
2
解决办法
1228
查看次数

Laravel 5:运行php artisan migration,触发cron调度程序中的函数

所以我有一个名为iCron的界面

namespace App\Console\CronScripts;

interface iCron{
    public static function run($args);
}
Run Code Online (Sandbox Code Playgroud)

我也有一个使用这个的类叫做UpdateStuff

class UpdateStuff implements iCron{

    public static function run($args = NULL){
        //I do api calls here to update my records
        echo "Begin Updating Stuff";
    }
}
Run Code Online (Sandbox Code Playgroud)

所以在内核中,我有:

use App\Console\CronScripts\UpdateStuff;

class Kernel extends ConsoleKernel{
    protected $commands = [];

    protected function schedule(Schedule $schedule){
        $schedule->call(UpdateStuff::run(NULL))->dailyAt('23:00');
    }
}
Run Code Online (Sandbox Code Playgroud)

如我所说,我想每天晚上11点调用UpdateStuff的运行功能。但是问题是,每次使用时都会调用run函数:

php artisan migrate
Run Code Online (Sandbox Code Playgroud)

任何人都知道为什么会这样吗?

提前致谢!

编辑:所以我发现它在哪里调用调度功能,

 vendor\laravel\framework\src\Illuminate\Foundation\Console\Kernel.php
Run Code Online (Sandbox Code Playgroud)

这将调用defineConsoleSchedule()函数,该函数依次运行$ this-> schedule($ schedule);。然后由于某种原因,即使不是11 PM,UpdateStuff::run($ args)仍在执行

php cron laravel

5
推荐指数
1
解决办法
536
查看次数

Wavefront obj文件,Faces有3个纹理坐标

我从blender导出一个.obj加载到一个C++程序我正在编写一切都很好但是我想知道在解析面部时我注意到面部数据中第三个点上有一个未使用的纹理坐标.

  f 1/1 2/2 3/3
//f 1/s 2/t 3/? Its vt3 that is the coordinate in question
Run Code Online (Sandbox Code Playgroud)

这是用来做什么的?我应该保留它吗?

opengl 3d wavefront

1
推荐指数
1
解决办法
3107
查看次数

标签 统计

3d ×1

cron ×1

deep-copy ×1

java ×1

laravel ×1

opengl ×1

php ×1

wavefront ×1