Skip to content

Commit

Permalink
simplify.
Browse files Browse the repository at this point in the history
  • Loading branch information
portlek committed Sep 30, 2024
1 parent acb2605 commit a27a5a3
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 15 deletions.
5 changes: 1 addition & 4 deletions common/src/main/java/net/infumia/frame/context/Context.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,10 @@
import net.infumia.frame.typedkey.TypedKeyStorage;
import org.jetbrains.annotations.NotNull;

public interface Context {
public interface Context extends StateFactory {
@NotNull
Frame manager();

@NotNull
TypedKeyStorage instances();

@NotNull
StateFactory stateFactory();
}
12 changes: 2 additions & 10 deletions core/src/main/java/net/infumia/frame/context/ContextImpl.java
Original file line number Diff line number Diff line change
@@ -1,28 +1,26 @@
package net.infumia.frame.context;

import net.infumia.frame.Frame;
import net.infumia.frame.state.StateFactory;
import net.infumia.frame.state.StateFactoryImpl;
import net.infumia.frame.state.StateRegistry;
import net.infumia.frame.typedkey.TypedKeyStorage;
import org.jetbrains.annotations.NotNull;

public class ContextImpl implements ContextRich {
public class ContextImpl extends StateFactoryImpl implements ContextRich {

private final Frame manager;
private final TypedKeyStorage instances;
private final StateRegistry stateRegistry;
private final StateFactory stateFactory;

public ContextImpl(
@NotNull final Frame manager,
@NotNull final TypedKeyStorage instances,
@NotNull final StateRegistry stateRegistry
) {
super(stateRegistry);
this.manager = manager;
this.instances = instances;
this.stateRegistry = stateRegistry;
this.stateFactory = new StateFactoryImpl(stateRegistry);
}

public ContextImpl(@NotNull final Context context) {
Expand All @@ -41,12 +39,6 @@ public TypedKeyStorage instances() {
return this.instances;
}

@NotNull
@Override
public StateFactory stateFactory() {
return this.stateFactory;
}

@NotNull
@Override
public StateRegistry stateRegistry() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

public final class StateFactoryImpl implements StateFactory {
public class StateFactoryImpl implements StateFactory {

private static final AtomicLong COUNTER = new AtomicLong();

Expand Down

0 comments on commit a27a5a3

Please sign in to comment.