CPD Results

The following document contains the results of PMD's CPD 4.2.5.

Duplications

FileLine
org/microemu/device/j2se/J2SESystemFont.java52
org/microemu/device/j2se/J2SETrueTypeFont.java57
		this.style = style.toLowerCase();
		this.size = size;
		this.antialiasing = antialiasing;

		this.initialized = false;
	}

	public void setAntialiasing(boolean antialiasing) {
		if (this.antialiasing != antialiasing) {
			this.antialiasing = antialiasing;
			initialized = false;
		}
	}

	public int charWidth(char ch) {
		checkInitialized();

		return fontMetrics.charWidth(ch);
	}

	public int charsWidth(char[] ch, int offset, int length) {
		checkInitialized();

		return fontMetrics.charsWidth(ch, offset, length);
	}

	public int getBaselinePosition() {
		checkInitialized();

		return fontMetrics.getAscent();
	}

	public int getHeight() {
		checkInitialized();

		return fontMetrics.getHeight();
	}

	public int stringWidth(String str) {
		checkInitialized();

		return fontMetrics.stringWidth(str);
	}

	public Font getFont() {
		checkInitialized();

		return fontMetrics.getFont();
	}

	private synchronized void checkInitialized() {
		if (!initialized) {
			int awtStyle = 0;
			if (style.indexOf("plain") != -1) {
				awtStyle |= Font.PLAIN;
			}
			if (style.indexOf("bold") != -1) {
				awtStyle |= Font.BOLD;
			}
			if (style.indexOf("italic") != -1) {
				awtStyle |= Font.ITALIC;
			}
			if (style.indexOf("underlined") != -1) {
				// TODO underlined style not implemented
			}
			if (antialiasing) {
				graphics.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
			} else {
				graphics.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_OFF);
			}
FileLine
org/microemu/device/j2se/J2SEImmutableImage.java129
org/microemu/device/j2se/J2SEMutableImage.java102
	}

    public void getRGB(int []argb, int offset, int scanlength,
            int x, int y, int width, int height) {

        if (width <= 0 || height <= 0)
            return;
        if (x < 0 || y < 0 || x + width > getWidth() || y + height > getHeight())
            throw new IllegalArgumentException("Specified area exceeds bounds of image");
        if ((scanlength < 0? -scanlength:scanlength) < width)
            throw new IllegalArgumentException("abs value of scanlength is less than width");
        if (argb == null)
            throw new NullPointerException("null rgbData");
        if (offset < 0 || offset + width > argb.length)
            throw new ArrayIndexOutOfBoundsException();
        if (scanlength < 0) {
            if (offset + scanlength*(height-1) < 0)
                throw new ArrayIndexOutOfBoundsException();
        } else {
            if (offset + scanlength*(height-1) + width > argb.length)
                throw new ArrayIndexOutOfBoundsException();
        }

        try {
            (new PixelGrabber(graphicsSurface.getImage(), x, y, width, height, argb, offset, scanlength)).grabPixels();
FileLine
org/microemu/app/Headless.java49
org/microemu/app/util/AppletProducer.java252
				EmulatorContext context = new EmulatorContext() 
				{
					private DisplayComponent displayComponent = new NoUiDisplayComponent();

					private InputMethod inputMethod = new J2SEInputMethod();

					private DeviceDisplay deviceDisplay = new J2SEDeviceDisplay(this);

					private FontManager fontManager = new J2SEFontManager();

					public DisplayComponent getDisplayComponent() {
						return displayComponent;
					}

					public InputMethod getDeviceInputMethod() {
						return inputMethod;
					}

					public DeviceDisplay getDeviceDisplay() {
						return deviceDisplay;
					}

					public FontManager getDeviceFontManager() {
						return fontManager;
					}

					public InputStream getResourceAsStream(Class origClass, String name) {
                        return MIDletBridge.getCurrentMIDlet().getClass().getResourceAsStream(name);
					}
					
					public boolean platformRequest(final String URL) {
						new Thread(new Runnable() {
							public void run() {
								Message.info("MIDlet requests that the device handle the following URL: " + URL);
							}
						}).start();

						return false;
					}
				};