// Path: achievements-server/src/main/java/org/jetbrains/buildserver/achievements/UserEvents.java
// public interface UserEvents {
//   void registerEvent(@NotNull String eventName);
// 
//   void registerEvent(@NotNull String eventName, @Nullable Object additionalData);
// 
//   long getLastEventTime(@NotNull String eventName);
// 
//   // most recent first
//   @NotNull
//   List<Long> getEventTimes(@NotNull String eventName);
// 
//   int getNumberOfEvents(@NotNull String eventName);
// 
//   float getEventsRate(@NotNull String eventName, int timeIntervalSeconds);
// }
// 
// Path: achievements-server/src/main/java/org/jetbrains/buildserver/achievements/UserEventsListener.java
// public interface UserEventsListener extends EventListener {
//   void userEventPublished(@NotNull User user, @NotNull String eventName, @Nullable Object additionalData);
// }
// 
// Path: achievements-server/src/main/java/org/jetbrains/buildserver/achievements/UserEventsRegistry.java
// public interface UserEventsRegistry {
//   @NotNull
//   UserEvents getUserEvents(@NotNull User user);
// 
//   void addListener(@NotNull UserEventsListener listener);
// 
//   void removeListener(@NotNull UserEventsListener listener);
// }


import jetbrains.buildServer.users.User;
import jetbrains.buildServer.util.EventDispatcher;
import jetbrains.buildServer.util.SystemTimeService;
import jetbrains.buildServer.util.TimeService;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.buildserver.achievements.UserEvents;
import org.jetbrains.buildserver.achievements.UserEventsListener;
import org.jetbrains.buildserver.achievements.UserEventsRegistry;
import java.util.HashMap;
import java.util.Map;
/*
 * Copyright 2000-2021 JetBrains s.r.o.
 *
 * Licensed under the Apache License, Version 2.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.jetbrains.buildserver.achievements.impl;



public class UserEventsRegistryImpl implements UserEventsRegistry {
  private final EventDispatcher<UserEventsListener> myEventDispatcher = EventDispatcher.create(UserEventsListener.class);
// Path: achievements-server/src/main/java/org/jetbrains/buildserver/achievements/UserEvents.java
// public interface UserEvents {
//   void registerEvent(@NotNull String eventName);
// 
//   void registerEvent(@NotNull String eventName, @Nullable Object additionalData);
// 
//   long getLastEventTime(@NotNull String eventName);
// 
//   // most recent first
//   @NotNull
//   List<Long> getEventTimes(@NotNull String eventName);
// 
//   int getNumberOfEvents(@NotNull String eventName);
// 
//   float getEventsRate(@NotNull String eventName, int timeIntervalSeconds);
// }
// 
// Path: achievements-server/src/main/java/org/jetbrains/buildserver/achievements/UserEventsListener.java
// public interface UserEventsListener extends EventListener {
//   void userEventPublished(@NotNull User user, @NotNull String eventName, @Nullable Object additionalData);
// }
// 
// Path: achievements-server/src/main/java/org/jetbrains/buildserver/achievements/UserEventsRegistry.java
// public interface UserEventsRegistry {
//   @NotNull
//   UserEvents getUserEvents(@NotNull User user);
// 
//   void addListener(@NotNull UserEventsListener listener);
// 
//   void removeListener(@NotNull UserEventsListener listener);
// }


// Path: achievements-server/src/main/java/org/jetbrains/buildserver/achievements/impl/UserEventsRegistryImpl.java
import jetbrains.buildServer.users.User;
import jetbrains.buildServer.util.EventDispatcher;
import jetbrains.buildServer.util.SystemTimeService;
import jetbrains.buildServer.util.TimeService;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.buildserver.achievements.UserEvents;
import org.jetbrains.buildserver.achievements.UserEventsListener;
import org.jetbrains.buildserver.achievements.UserEventsRegistry;
import java.util.HashMap;
import java.util.Map;

/*
 * Copyright 2000-2021 JetBrains s.r.o.
 *
 * Licensed under the Apache License, Version 2.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.jetbrains.buildserver.achievements.impl;



public class UserEventsRegistryImpl implements UserEventsRegistry {
  private final EventDispatcher<UserEventsListener> myEventDispatcher = EventDispatcher.create(UserEventsListener.class);
  private Map<Long, UserEvents> myUserEvents = new HashMap<Long, UserEvents>();