網路上找到的方法:
但是我是了還是不行,囧。我自己的解決方法很簡單,順序是這樣:
(1) 除了有checksum error的檔案之外,先commit所有其他的檔案
(2) 把無法commit上去的檔案先複製一份到別的資料夾
(3) 刪除有問題的檔案
(4) 重新把剛剛複製到別的資料夾的檔案copy過來,重新commit,這樣就解決了
打完收工!
軟體開發。程式設計。Web2.0。網路。科技。筆記。軟體
Define a family of algorithms, encapsulate each one, and make them interchangeable. [The] Strategy [pattern] lets the algorithm vary independently from clients that use it.
public abstract class Character {
public abstract void fight();
public abstract void action();
public abstract void char();
}
public class King extends Character {
@Override
public void action() {
System.out.println("King walk");
}
@Override
public void chat() {
System.out.println("King chat");
}
@Override
public void fight() {
System.out.println("King fight by hand");
}
}
public class Queen extends Character {
@Override
public void action() {
System.out.println("Queen walk");
}
@Override
public void chat() {
System.out.println("Queen chat");
}
@Override
public void fight() {
System.out.println("Queen fight by hand");
}
public class Knight extends Character {
@Override
public void action() {
System.out.println("Knight walk");
}
@Override
public void chat() {
System.out.println("Knight chat");
}
@Override
public void fight() {
System.out.println("Knight fight by hand");
}
public abstract void fightBySword();
public abstract void fightByKnife();
public abstract void fightByAxe();
時間 時間種類 顯示訊息
public class SingletonTest extends Thread {
String threadName = "";
public SingletonTest(String name) {
threadName = name;
}
public void run() {
for(int i=0 ; i<10 ; i++) {
try {
Thread.sleep((int)500);
Singleton instance1 = Singleton.getInstance();
System.out.println(threadName + " ==> " + instance1.hashCode());
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
public static void main(String [] a) {
Thread t1 = new SingletonTest("thread-1");
Thread t2 = new SingletonTest("thread-2");
t1.start();
t2.start();
}
}
public class Singleton {
private static Singleton instance;
private Singleton () { }
public static Synchronized Singleton getInstance() {
if(instance==null)
instance = new Singleton();
return instance;
}
}
public class Singleton {
private volatile static Singleton instance;
private Singleton () { }
public static Singleton getInstance() {
if(instance==null) {
Synchronized(Singleton.class) {
instance = new Singleton();
}
}
return instance;
}
}