<commit_before>package java.awt;

import java.awt.event.ActionEvent;
import java.awt.event.AdjustmentEvent;
import java.awt.event.ComponentEvent;
import java.awt.event.ContainerEvent;
import java.awt.event.FocusEvent;
import java.awt.event.ItemEvent;
import java.awt.event.KeyEvent;
import java.awt.event.MouseEvent;
import java.awt.event.TextEvent;
import java.awt.event.WindowEvent;
import java.util.EventObject;
import java.util.Stack;
import kaffe.util.Ptr;

/**
 *
 * Copyright (c) 1998
 *   Transvirtual Technologies Inc.  All rights reserved.
 *
 * See the file "license.terms" for information on usage and redistribution
 * of this file.
 *
 * @author P.C.Mehlitz
 */
public class AWTEvent
  extends EventObject
{
	protected int id;
	protected boolean consumed = false;
	protected AWTEvent next;
	final public static int COMPONENT_EVENT_MASK = 0x01;
	final public static int CONTAINER_EVENT_MASK = 0x02;
	final public static int FOCUS_EVENT_MASK = 0x04;
	final public static int KEY_EVENT_MASK = 0x08;
	final public static int MOUSE_EVENT_MASK = 0x10;
	final public static int MOUSE_MOTION_EVENT_MASK = 0x20;
	final public static int WINDOW_EVENT_MASK = 0x40;
	final public static int ACTION_EVENT_MASK = 0x80;
	final public static int ADJUSTMENT_EVENT_MASK = 0x100;
	final public static int ITEM_EVENT_MASK = 0x200;
	final public static int TEXT_EVENT_MASK = 0x400;
	final public static int RESERVED_ID_MAX = 1999;
	final static int DISABLED_MASK = 0x80000000;
	static Component keyTgt;
	static Window activeWindow;
	static Component mouseTgt;
	protected static int inputModifier;
	protected static boolean accelHint;
	protected static Component[] sources;
	static int nSources;
	protected static Object evtLock = new Object();
	protected static RootWindow root;
	protected static Component nativeSource;

static {
	sources = Toolkit.evtInit();
}

protected AWTEvent ( Object source, int id ) {
	super( source);
	
	this.id = id;
}

public void consume () {
	consumed = true;
}

protected void dispatch () {
	// standard processing of non-system events
	((Component)source).processEvent( this);
}

public int getID () {
	return id;
}

static int getID ( AWTEvent evt ) {
	return evt.id;
}

static Object getSource ( AWTEvent evt ) {
	return evt.source;
}

protected static Component getToplevel ( Component c ) {
	// Note that this will fail in case 'c' is already removeNotified (has no parent,
	// anymore). But returning 'null' would just shift the problem into the caller -
	// a dispatch() method - and that would slow down dispatching. Since it also would be
	// difficult to decide what to do (because of inconsistent global state), we prefer a
	// clean cut and rely on no events being dispatched on removeNotified Components
	while ( ! (c instanceof Window) ){
		c = c.parent;
	}

	return c;
}

protected Event initOldEvent ( Event e ) {
	// this is the generic version, to be resolved by the relevant subclasses
	return null;
}

protected boolean isConsumed () {
	return consumed;
}

protected boolean isLiveEventFor( Object src ) {
	return false;
}

protected boolean isObsoletePaint( Object src, int x, int y, int w, int h ) {
	return false;
}

public String paramString () {
	return "";
}

protected void recycle () {
	source = null;
	next = null;
}

static void registerSource ( Component c, Ptr nativeData ) {
	int idx = Toolkit.evtRegisterSource( nativeData);
	sources[idx] = c;

	if ( ++nSources	== 1 )
		Toolkit.startDispatch();
}

MouseEvent retarget ( Component target, int dx, int dy ) {
	return null;
}

protected static void sendEvent ( AWTEvent e, boolean sync ) {
    if ( sync )
      e.dispatch();
    else
      Toolkit.eventQueue.postEvent( e);
}

void setSource ( Object newSource ) {
	source = newSource;
}

public String toString () {
	return getClass().getName() + ':' + paramString() + ", source: " + source;
}

static void unregisterSource ( Component c, Ptr nativeData ) {
	int idx = Toolkit.evtUnregisterSource( nativeData);
	sources[idx] = null;

	if ( c == nativeSource ) // just a matter of safety (avoid temp garbage)
		nativeSource = null;

	if ( (--nSources	== 0) && Defaults.AutoStop ) {
		// give the SecurityManager a chance to step in before
		// closing down the Toolkit
		System.getSecurityManager().checkExit( 0);
		
		Toolkit.terminate();
		System.exit( 0); // not strictly required (if there are no persistent daemons)
	}
}
}
<commit_msg>Make setSource() public instead of package to fix compilation error. Not sure if this is the "right" fix.<commit_after>package java.awt;

import java.awt.event.ActionEvent;
import java.awt.event.AdjustmentEvent;
import java.awt.event.ComponentEvent;
import java.awt.event.ContainerEvent;
import java.awt.event.FocusEvent;
import java.awt.event.ItemEvent;
import java.awt.event.KeyEvent;
import java.awt.event.MouseEvent;
import java.awt.event.TextEvent;
import java.awt.event.WindowEvent;
import java.util.EventObject;
import java.util.Stack;
import kaffe.util.Ptr;

/**
 *
 * Copyright (c) 1998
 *   Transvirtual Technologies Inc.  All rights reserved.
 *
 * See the file "license.terms" for information on usage and redistribution
 * of this file.
 *
 * @author P.C.Mehlitz
 */
public class AWTEvent
  extends EventObject
{
	protected int id;
	protected boolean consumed = false;
	protected AWTEvent next;
	final public static int COMPONENT_EVENT_MASK = 0x01;
	final public static int CONTAINER_EVENT_MASK = 0x02;
	final public static int FOCUS_EVENT_MASK = 0x04;
	final public static int KEY_EVENT_MASK = 0x08;
	final public static int MOUSE_EVENT_MASK = 0x10;
	final public static int MOUSE_MOTION_EVENT_MASK = 0x20;
	final public static int WINDOW_EVENT_MASK = 0x40;
	final public static int ACTION_EVENT_MASK = 0x80;
	final public static int ADJUSTMENT_EVENT_MASK = 0x100;
	final public static int ITEM_EVENT_MASK = 0x200;
	final public static int TEXT_EVENT_MASK = 0x400;
	final public static int RESERVED_ID_MAX = 1999;
	final static int DISABLED_MASK = 0x80000000;
	static Component keyTgt;
	static Window activeWindow;
	static Component mouseTgt;
	protected static int inputModifier;
	protected static boolean accelHint;
	protected static Component[] sources;
	static int nSources;
	protected static Object evtLock = new Object();
	protected static RootWindow root;
	protected static Component nativeSource;

static {
	sources = Toolkit.evtInit();
}

protected AWTEvent ( Object source, int id ) {
	super( source);
	
	this.id = id;
}

public void consume () {
	consumed = true;
}

protected void dispatch () {
	// standard processing of non-system events
	((Component)source).processEvent( this);
}

public int getID () {
	return id;
}

static int getID ( AWTEvent evt ) {
	return evt.id;
}

static Object getSource ( AWTEvent evt ) {
	return evt.source;
}

protected static Component getToplevel ( Component c ) {
	// Note that this will fail in case 'c' is already removeNotified (has no parent,
	// anymore). But returning 'null' would just shift the problem into the caller -
	// a dispatch() method - and that would slow down dispatching. Since it also would be
	// difficult to decide what to do (because of inconsistent global state), we prefer a
	// clean cut and rely on no events being dispatched on removeNotified Components
	while ( ! (c instanceof Window) ){
		c = c.parent;
	}

	return c;
}

protected Event initOldEvent ( Event e ) {
	// this is the generic version, to be resolved by the relevant subclasses
	return null;
}

protected boolean isConsumed () {
	return consumed;
}

protected boolean isLiveEventFor( Object src ) {
	return false;
}

protected boolean isObsoletePaint( Object src, int x, int y, int w, int h ) {
	return false;
}

public String paramString () {
	return "";
}

protected void recycle () {
	source = null;
	next = null;
}

static void registerSource ( Component c, Ptr nativeData ) {
	int idx = Toolkit.evtRegisterSource( nativeData);
	sources[idx] = c;

	if ( ++nSources	== 1 )
		Toolkit.startDispatch();
}

MouseEvent retarget ( Component target, int dx, int dy ) {
	return null;
}

protected static void sendEvent ( AWTEvent e, boolean sync ) {
    if ( sync )
      e.dispatch();
    else
      Toolkit.eventQueue.postEvent( e);
}

public void setSource ( Object newSource ) {
	source = newSource;
}

public String toString () {
	return getClass().getName() + ':' + paramString() + ", source: " + source;
}

static void unregisterSource ( Component c, Ptr nativeData ) {
	int idx = Toolkit.evtUnregisterSource( nativeData);
	sources[idx] = null;

	if ( c == nativeSource ) // just a matter of safety (avoid temp garbage)
		nativeSource = null;

	if ( (--nSources	== 0) && Defaults.AutoStop ) {
		// give the SecurityManager a chance to step in before
		// closing down the Toolkit
		System.getSecurityManager().checkExit( 0);
		
		Toolkit.terminate();
		System.exit( 0); // not strictly required (if there are no persistent daemons)
	}
}
}

{'fraction_non_alphanumeric': 0.09061270376616076, 'fraction_numerical': 0.012816188870151771, 'mean_word_length': 4.109707064905227, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 2, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5437560', 'n_tokens_mistral': 2840, 'n_tokens_neox': 2721, 'n_words': 974}