CPD Results

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

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.java103
	}

        // Andres Navarro
        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(img, x, y, width, height, argb, offset, scanlength)).grabPixels();

FileLine
org/microemu/app/Headless.java23
org/microemu/app/util/AppletProducer.java251
				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(String name) {
						return MIDletBridge.getCurrentMIDlet().getClass().getResourceAsStream(name);
					}
				};