new Short( pieceInShort( player==0 ? node.location.x : width - 1 - node.location.x, player==0 ? node.location.y : height - 1 - node.location.y, node.pieceColor, node.piece.preDefinedIndex() ) )
protected short pieceInShort(int x, int y, int player, int piece){ return (short)( (x + 8) << 11 | (y + 8) << 6 | player << 4 | piece ); }//end pieceInShort()
|
这段写法非常耗费内存,看似简单,实际执行了很长的语句。
? :的使用我觉得除了炫耀自己对java的癖好外,没有任何好处。