Skip to content

Commit

Permalink
Support for Function.evaluateFast is dropped
Browse files Browse the repository at this point in the history
For the same reason as for Pushable.pushFast
  • Loading branch information
sylvainhalle committed Apr 26, 2023
1 parent b673bab commit d4caaee
Show file tree
Hide file tree
Showing 6 changed files with 4 additions and 155 deletions.
71 changes: 0 additions & 71 deletions Core/src/ca/uqac/lif/cep/FutureDone.java

This file was deleted.

29 changes: 2 additions & 27 deletions Core/src/ca/uqac/lif/cep/Pushable.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@
*/
package ca.uqac.lif.cep;

import java.util.concurrent.Future;

/**
* Gives events to some of a processor's input. Interface {@link Pushable} is
* the opposite of {@link Pullable}: rather than querying events form a
Expand All @@ -35,8 +33,8 @@
public interface Pushable
{
/**
* Pushes an event into one of the processor's input trace. Contrarily to
* {@link #pushFast(Object)}, this method <em>must</em> return only when the
* Pushes an event into one of the processor's input trace. This
* method <em>must</em> return only when the
* push operation is completely done.
*
* @param o
Expand All @@ -48,22 +46,6 @@ public interface Pushable
*/
public Pushable push(Object o);

/**
* Pushes an event into one of the processor's input trace, but does not wait
* for the push operation to terminate. In other words, this is a non-blocking
* call to {@code push()} that returns control to the caller immediately.
* In order to resynchronize the caller with the result of the push operation,
* one must use the {@code Future} object that the method returns.
*
* @param o
* The event. Although you can technically push {@code null}, the
* behaviour in this case is undefined. It <em>may</em> be
* interpreted as if you are passing no event.
* @return A {@link Future} object that can be used to wait until the call to
* {@code pushFast} is finished.
*/
//public Future<Pushable> pushFast(Object o);

/**
* Notifies the pushable that there is no more event to be pushed, i.e. the
* trace of events has ended at this point.
Expand Down Expand Up @@ -178,11 +160,4 @@ public int getPosition()
return m_position;
}
}

/**
* A dummy {@link Future} object that will be returned on all calls to
* {@link Pushable#pushFast(Object)}.
*/
public static final FutureDone<Pushable> NULL_FUTURE = new FutureDone<Pushable>(
new PushNotSupported(null, 0));
}
8 changes: 0 additions & 8 deletions Core/src/ca/uqac/lif/cep/functions/ApplyFunctionPartial.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.concurrent.Future;

/**
* Evaluates a function on each event front in a <em>lazy</em> manner.
Expand Down Expand Up @@ -178,13 +177,6 @@ public Pushable push(Object o)
return this;
}

//@Override
public Future<Pushable> pushFast(Object o)
{
push(o);
return Pushable.NULL_FUTURE;
}

@Override
public void notifyEndOfTrace() throws PushableException
{
Expand Down
24 changes: 1 addition & 23 deletions Core/src/ca/uqac/lif/cep/functions/Function.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
BeepBeep, an event stream processor
Copyright (C) 2008-2019 Sylvain Hallé
Copyright (C) 2008-2023 Sylvain Hallé
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
Expand All @@ -25,12 +25,9 @@
import ca.uqac.lif.azrael.Readable;
import ca.uqac.lif.cep.Context;
import ca.uqac.lif.cep.EventTracker;
import ca.uqac.lif.cep.FutureDone;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Future;

/**
* Represents a stateless <i>m</i>-to-<i>n</i> function.
Expand Down Expand Up @@ -204,25 +201,6 @@ public abstract class Function implements DuplicableFunction, Printable, Readabl
*/
/*@ pure @*/ public abstract Class<?> getOutputTypeFor(int index);

/**
* Utility method that delegates the call to evaluate()
*
* @param inputs
* Input arguments
* @param outputs
* Output values
* @param context
* Context object
* @param service The service responsible for assigning threads
* @return A {@link Future} object for this function call
*/
/*@ pure @*/ public Future<Object[]> evaluateFast(Object[] inputs, Object[] outputs,
Context context, ExecutorService service)
{
evaluate(inputs, outputs, context);
return new FutureDone<Object[]>(outputs);
}

@Override
/*@ pure non_null @*/ public final Function duplicate()
{
Expand Down
11 changes: 0 additions & 11 deletions CoreTest/src/ca/uqac/lif/cep/SynchronousProcessorTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -81,17 +81,6 @@ public void testPullSoftException1()
assertTrue(got_exception);
}

@Test(expected=PushableException.class)
public void testPushFastException1()
{
ThrowException te = new ThrowException();
Passthrough pt = new Passthrough();
Connector.connect(te, pt);
BlackHole bh = new BlackHole();
Connector.connect(pt, bh);
te.getPushableInput().push(0);
}

@Test
public void testSamePullable()
{
Expand Down
16 changes: 1 addition & 15 deletions CoreTest/src/ca/uqac/lif/cep/functions/FunctionsTest.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
BeepBeep, an event stream processor
Copyright (C) 2008-2017 Sylvain Hallé
Copyright (C) 2008-2023 Sylvain Hallé
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
Expand Down Expand Up @@ -297,12 +297,6 @@ public void testEquals()
assertEquals(false, (Boolean) evaluate(Equals.instance, s1, s2));
}

@Test
public void testEvaluateFast()
{
assertEquals(evaluateFast(Booleans.and, true, false), evaluate(Booleans.and, true, false));
}

@Test
public void testCumulative1()
{
Expand Down Expand Up @@ -372,14 +366,6 @@ public static Object evaluate(Function f, Object ... inputs)
return out[0];
}

public static Object evaluateFast(Function f, Object ... inputs)
{
Object[] ins = inputs;
Object[] out = new Object[1];
f.evaluateFast(ins, out, null, null);
return out[0];
}

public static class ExceptionFunction extends UnaryFunction<Number,Number>
{
public ExceptionFunction()
Expand Down

0 comments on commit d4caaee

Please sign in to comment.