The following document contains the results of PMD's CPD 3.9.
| File | Line |
|---|---|
| javax/microedition/lcdui/game/Sprite.java | 522 |
| javax/microedition/lcdui/game/Sprite.java | 719 |
switch(t.transform) {
case TRANS_NONE:
sX = t.getX() + cX;
sY = t.getY() + cY;
sW = cW;
sH = cH;
break;
case TRANS_MIRROR_ROT180:
sX = t.getX() + cX;
sY = t.getY() + (t.getHeight() - cY - 1) - cH;
sW = cW;
sH = cH;
break;
case TRANS_MIRROR:
sX = t.getX() + (t.getWidth() - cX - 1) - cW;
sY = t.getY() + cY;
sW = cW;
sH = cH;
break;
case TRANS_ROT180:
sX = t.getX() + (t.getWidth() - cX - 1) - cW;
sY = t.getY() + (t.getHeight() - cY - 1) - cH;
sW = cW;
sH = cH;
break;
case TRANS_MIRROR_ROT270:
sX = t.getX() + cY;
sY = t.getY() + cX;
sW = cH;
sH = cW;
break;
case TRANS_ROT90:
sX = t.getX() + (t.getHeight() - cY) - cH; | |
| File | Line |
|---|---|
| javax/microedition/lcdui/game/Sprite.java | 567 |
| javax/microedition/lcdui/game/Sprite.java | 764 |
sY = t.getY() + (t.getWidth() - cX) - cW;
sW = cH;
sH = cW;
break;
default: // cant really happen, but the return keeps the
// compiler happy (otherwise it'll report variable
// may not be initialized)
return false;
}
if (o != t) {
tX = sX;
tY = sY;
tW = sW;
tH = sH;
if (o instanceof Sprite) {
// two sprites first round
// another = true;
t = (Sprite) o;
} else if (o instanceof TiledLayer) {
another = false;
TiledLayer layer = (TiledLayer) o;
oX = layer.getX();
oY = layer.getY();
oW = layer.getWidth();
oH = layer.getHeight();
} else { // o instanceof lcdui.Image
another = false;
Image img = (Image) o;
oW = img.getWidth();
oH = img.getHeight();
}
} else {
another = false;
// two sprites
// second round
oX = sX;
oY = sY;
oW = sW;
oH = sH;
}
}
// if there is no intersection
// we know there is no collision
if (tX > oX && tX >= oX + oW)
return false;
else if (tX < oX && tX + tW <= oX)
return false;
else if (tY > oY && tY >= oY + oH)
return false;
else if (tY < oY && tY + tH <= oY)
return false; | |
| File | Line |
|---|---|
| javax/microedition/lcdui/ImageItem.java | 120 |
| javax/microedition/lcdui/StringItem.java | 79 |
return getHeight();
}
int traverse(int gameKeyCode, int top, int bottom, boolean action) {
Font f = Font.getDefaultFont();
if (gameKeyCode == Canvas.UP) {
if (top > 0) {
if ((top % f.getHeight()) == 0) {
return -f.getHeight();
} else {
return -(top % f.getHeight());
}
} else {
return Item.OUTOFITEM;
}
}
if (gameKeyCode == Canvas.DOWN) {
if (bottom < getHeight()) {
if (getHeight() - bottom < f.getHeight()) {
return getHeight() - bottom;
} else {
return f.getHeight();
}
} else {
return Item.OUTOFITEM;
}
}
return 0;
}
} | |
| File | Line |
|---|---|
| javax/microedition/lcdui/game/Sprite.java | 628 |
| javax/microedition/lcdui/game/Sprite.java | 820 |
int rX, rY, rW, rH;
if (oX > tX) {
rX = oX;
rW = ((oX + oW < tX + tW)? oX + oW : tX + tW) - rX ;
} else {
rX = tX;
rW = ((tX + tW < oX + oW)? tX + tW : oX + oW) - rX;
}
if (oY > tY) {
rY = oY;
rH = ((oY + oH < tY + tH)? oY + oH : tY + tH) - rY ;
} else {
rY = tY;
rH = ((tY + tH < oY + oH)? tY + tH : oY + oH) - rY;
} | |
| File | Line |
|---|---|
| javax/microedition/lcdui/game/Sprite.java | 647 |
| javax/microedition/lcdui/game/Sprite.java | 944 |
int lW = layer.getCellWidth();
int lH = layer.getCellHeight();
int minC = (rX - oX) / lW;
int minR = (rY - oY) / lH;
int maxC = (rX - oX + rW - 1) / lW;
int maxR = (rY - oY + rH - 1) / lH;
// travel across all cells in the collision
// rectangle
for (int row = minR; row <= maxR; row++) {
for (int col = minC; col <= maxC; col++) {
int cell = layer.getCell(col, row);
// if cell is animated get current
// associated static tile
if (cell < 0)
cell = layer.getAnimatedTile(cell); | |
| File | Line |
|---|---|
| javax/microedition/lcdui/Form.java | 292 |
| javax/microedition/lcdui/Form.java | 371 |
height = getHeightToItem(testItemIndex);
traverse =
items[testItemIndex].traverse(
gameKeyCode,
top - height,
bottom - height,
false);
} else {
testItemIndex = focusItemIndex;
height = getHeightToItem(testItemIndex);
traverse =
items[testItemIndex].traverse(
gameKeyCode,
top - height,
bottom - height,
true);
}
if (traverse != Item.OUTOFITEM) {
if (focusItemIndex == -1
&& items[testItemIndex].isFocusable()) {
items[testItemIndex].setFocus(true);
focusItemIndex = testItemIndex;
}
return traverse;
} else {
if (testItemIndex < numOfItems - 1) { | |
| File | Line |
|---|---|
| javax/microedition/media/MidiAudioPlayer.java | 109 |
| javax/microedition/media/SampledAudioPlayer.java | 131 |
return clip.getMicrosecondPosition();
return 0;
}
public int getState() {
// TODO Auto-generated method stub
return 0;
}
public void prefetch() throws MediaException {
// TODO Auto-generated method stub
}
public void realize() throws MediaException {
// TODO Auto-generated method stub
}
public void removePlayerListener(PlayerListener playerListener)
{
if( vListeners == null )
return;
for( Iterator it = vListeners.iterator (); it.hasNext (); )
{
PlayerListener listener = (PlayerListener) it.next ();
if( listener == playerListener )
{
vListeners.remove( listener );
break;
}
}
}
public void setLoopCount(int count) { | |
| File | Line |
|---|---|
| javax/microedition/lcdui/game/Sprite.java | 189 |
| javax/microedition/lcdui/game/Sprite.java | 444 |
switch(currentTransform) {
case TRANS_NONE:
curRefX = refX;
curRefY = refY;
break;
case TRANS_MIRROR_ROT180:
curRefX = width - refX;
curRefY = height - refY;
break;
case TRANS_MIRROR:
curRefX = width - refX;
curRefY = refY;
break;
case TRANS_ROT180:
curRefX = refX;
curRefY = height - refY;
break;
case TRANS_MIRROR_ROT270:
curRefX = height - refY;
curRefY = refX;
break;
case TRANS_ROT90:
curRefX = height - refY;
curRefY = width - refX;
break;
case TRANS_ROT270:
curRefX = refY;
curRefY = refX;
break;
case TRANS_MIRROR_ROT90:
curRefX = refY;
curRefY = width - refX;
break;
default: // cant really happen, but the return keeps the
// compiler happy (otherwise it'll report variable
// may not be initialized)
return;
} | |