|
Java程式碼美化效果演示 |
|
|
|
|
|
SourceFormatX 使用強大的Java詞法解析引擎全面地分析您的程式碼並根據用戶自定義的Java語言程式碼風格重構和美化Java程式碼檔案,因此它能精細地根據不同的程式碼風格美化多種程式碼,甚至是下面這些極度混亂的程式碼:
|
Java程式碼美化範例:
範例1
|
範例2
|
範例3
|
範例4
這是一個非常極端的 Java 程式碼美化的範例,其目的是為了展示 SourceFormatX Java程式碼美化工具詞法解析引擎的威力。這份混亂的 Java 程式碼檔案在瞬間即被 SourceFormatX 美化和縮排成整潔且可讀性強的風格樣式。
package grace.cards;import com.objectspace.jgl.Stack;import
com.objectspace.jgl.algorithms.Shuffling;public class Deck{Stack cards=new
Stack();public Deck(){reset();}protected void reset(){for(int suit=Card.CLUB;
suit<=Card.SPADE;++suit){for(int num=0;num<13;++num){cards.push(new Card(num,
suit));}}Shuffling.randomShuffle(cards);}public Card[]deal(int numCards){Card[]
result=new Card[numCards];for(int i=0;i<numCards;++i){result[i]=(Card)cards.pop
();}return result;}public void shuffle(){reset();}}
package grace.cards;
import com.objectspace.jgl.Stack;
import com.objectspace.jgl.algorithms.Shuffling;
public class Deck
{
Stack cards = new Stack();
public Deck()
{
reset();
}
protected void reset()
{
for (int suit = Card.CLUB; suit <= Card.SPADE; ++suit)
{
for (int num = 0; num < 13; ++num)
{
cards.push(new Card(num, suit));
}
}
Shuffling.randomShuffle(cards);
}
public Card[] deal(int numCards)
{
Card[] result = new Card[numCards];
for (int i = 0; i < numCards; ++i)
{
result[i] = (Card)cards.pop();
}
return result;
}
public void shuffle()
{
reset();
}
}
範例1
|
範例2
|
範例3
|
範例4
|