Skip to content

Commit

Permalink
Added a mechanism to insert a delay between single calls to an annota…
Browse files Browse the repository at this point in the history
…tor.
  • Loading branch information
MichaelRoeder committed Nov 17, 2022
1 parent b277873 commit 2c328a8
Show file tree
Hide file tree
Showing 6 changed files with 1,176 additions and 547 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,22 @@
public interface AnnotatorConfiguration extends AdapterConfiguration {

/**
* Returns the annotator or null if the annotator can't be used for the
* given {@link ExperimentType}.
* Returns the annotator or null if the annotator can't be used for the given
* {@link ExperimentType}.
*
* @param type
* @return
* @throws GerbilException
* if an error occurs while loading the annotator
* @throws GerbilException if an error occurs while loading the annotator
*/
public Annotator getAnnotator(ExperimentType type) throws GerbilException;

/**
* Returns the delay that should be inserted between two consecutive calls to an
* annotator.
*
* @return the delay that should be inserted between two consecutive calls
*/
public default long getDelay() {
return 0;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,14 @@
* Contains all information needed to load an annotator for a specific
* experiment type.
*
* @author Michael Röder (roeder@informatik.uni-leipzig.de)
* @author Michael Röder (michael.roeder@uni-paderborn.de)
*
*/
public class AnnotatorConfigurationImpl extends AbstractAdapterConfiguration implements AnnotatorConfiguration {

protected Constructor<? extends Annotator> constructor;
protected Object constructorArgs[];
protected long delay = 0;

public AnnotatorConfigurationImpl(String annotatorName, boolean couldBeCached,
Constructor<? extends Annotator> constructor, Object constructorArgs[],
Expand Down Expand Up @@ -64,6 +65,20 @@ protected Annotator loadAnnotator() throws Exception {
return instance;
}

/**
* @return the delay
*/
public long getDelay() {
return delay;
}

/**
* @param delay the delay to set
*/
public void setDelay(long delay) {
this.delay = delay;
}

@Override
public String toString() {
StringBuilder builder = new StringBuilder();
Expand Down
Loading

0 comments on commit 2c328a8

Please sign in to comment.