<commit_before>//Copyright 2015 <NAME>
//
//Licensed under the Apache License,Version2.0(the"License");
//you may not use this file except in compliance with the License.
//You may obtain a copy of the License at
//
//http://www.apache.org/licenses/LICENSE-2.0
//
//Unless required by applicable law or agreed to in writing,software
//distributed under the License is distributed on an"AS IS"BASIS,
//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,either express or implied.
//See the License for the specific language governing permissions and
//limitations under the License.
package org.freedesktop.wayland.server;

import org.freedesktop.wayland.server.jaccall.WaylandServerCore;
import org.freedesktop.wayland.util.ObjectCache;

public class EventSource {

    private final long pointer;

    private boolean valid;

    protected EventSource(final long pointer) {
        this.pointer = pointer;
        ObjectCache.store(this.pointer,
                          this);
    }

    public static EventSource create(final long pointer) {
        return new EventSource(pointer);
    }

    public int updateFileDescriptor(final int mask) {
        return WaylandServerCore.INSTANCE()
                                .wl_event_source_fd_update(this.pointer,
                                                           mask);
    }

    public int updateTimer(final int msDelay) {
        return WaylandServerCore.INSTANCE()
                                .wl_event_source_timer_update(this.pointer,
                                                              msDelay);
    }

    public void check() {
        WaylandServerCore.INSTANCE()
                         .wl_event_source_check(this.pointer);
    }

    @Override
    public int hashCode() {
        return new Long(this.pointer).hashCode();
    }

    @Override
    public boolean equals(final Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }

        final EventSource that = (EventSource) o;

        return this.pointer == that.pointer;

    }

    @Override
    protected void finalize() throws Throwable {
        remove();
        super.finalize();
    }

    public int remove() {
        if (this.valid) {
            this.valid = false;
            ObjectCache.remove(this.pointer);
            return WaylandServerCore.INSTANCE()
                                    .wl_event_source_remove(this.pointer);
        }
        return 0;
    }
}<commit_msg>dont track event source pojos as they don't have any java side state<commit_after>//Copyright 2015 <NAME>
//
//Licensed under the Apache License,Version2.0(the"License");
//you may not use this file except in compliance with the License.
//You may obtain a copy of the License at
//
//http://www.apache.org/licenses/LICENSE-2.0
//
//Unless required by applicable law or agreed to in writing,software
//distributed under the License is distributed on an"AS IS"BASIS,
//WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,either express or implied.
//See the License for the specific language governing permissions and
//limitations under the License.
package org.freedesktop.wayland.server;

import org.freedesktop.wayland.server.jaccall.WaylandServerCore;

public class EventSource {

    private final long pointer;

    protected EventSource(final long pointer) {
        this.pointer = pointer;
    }

    public static EventSource create(final long pointer) {
        return new EventSource(pointer);
    }

    public int updateFileDescriptor(final int mask) {
        return WaylandServerCore.INSTANCE()
                                .wl_event_source_fd_update(this.pointer,
                                                           mask);
    }

    public int updateTimer(final int msDelay) {
        return WaylandServerCore.INSTANCE()
                                .wl_event_source_timer_update(this.pointer,
                                                              msDelay);
    }

    public void check() {
        WaylandServerCore.INSTANCE()
                         .wl_event_source_check(this.pointer);
    }

    @Override
    public int hashCode() {
        return new Long(this.pointer).hashCode();
    }

    @Override
    public boolean equals(final Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }

        final EventSource that = (EventSource) o;

        return this.pointer == that.pointer;

    }

    public int remove() {
        return WaylandServerCore.INSTANCE()
                                .wl_event_source_remove(this.pointer);
    }
}
{'fraction_non_alphanumeric': 0.08479593994502009, 'fraction_numerical': 0.003594840346796363, 'mean_word_length': 1.9433727442439328, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 9, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '375666', 'n_tokens_mistral': 1232, 'n_tokens_neox': 1175, 'n_words': 356}