Skip to content

Commit

Permalink
Move the export logic of networks to DirectObservation
Browse files Browse the repository at this point in the history
  • Loading branch information
inigo-cobian committed Jan 30, 2024
1 parent b47b531 commit 1f103f0
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -254,4 +254,15 @@ public String dump() {
// return configurationCache;
// }

@Override
public boolean is(Class< ? > cls) {
Class< ? > clazz = getOriginatingPattern().getClass();
return cls.isAssignableFrom(clazz);
}

@Override
@SuppressWarnings("unchecked")
public <T> T as(Class< ? > cls) {
return (T) getOriginatingPattern();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -247,13 +247,7 @@ public void setGenerator(Activity generator) {
*/
@Override
public boolean is(Class<?> cls) {
if (this instanceof DirectObservation) {
Class< ? > clazz = ((DirectObservation) this).getOriginatingPattern().getClass();
if (cls.isAssignableFrom(clazz)) {
return true;
}
}
return false;
return peers.get(cls) != null;
}

/**
Expand All @@ -263,9 +257,6 @@ public boolean is(Class<?> cls) {
@SuppressWarnings("unchecked")
@Override
public <T> T as(Class<?> cls) {
if (this instanceof DirectObservation) {
return (T) ((DirectObservation)this).getOriginatingPattern();
}
return (T) peers.get(cls);
}

Expand Down

0 comments on commit 1f103f0

Please sign in to comment.