/** * Returns a new (partial) match. This can be used e.g. to call the matcher with a partial match. * * <p>The returned match will be immutable. Use {@link #newEmptyMatch()} to obtain a mutable match * object. * * @param pRoute the fixed value of pattern parameter route, or null if not bound. * @param pSensor the fixed value of pattern parameter sensor, or null if not bound. * @param pSwitchPosition the fixed value of pattern parameter switchPosition, or null if not * bound. * @param pSw the fixed value of pattern parameter sw, or null if not bound. * @return the (partial) match object. */ public RouteSensorMatch newMatch( final Route pRoute, final Sensor pSensor, final SwitchPosition pSwitchPosition, final Switch pSw) { return RouteSensorMatch.newMatch(pRoute, pSensor, pSwitchPosition, pSw); }
@Override protected RouteSensorMatch arrayToMatchMutable(final Object[] match) { try { return RouteSensorMatch.newMutableMatch( (hu.bme.mit.trainbenchmark.ttc.railway.Route) match[POSITION_ROUTE], (hu.bme.mit.trainbenchmark.ttc.railway.Sensor) match[POSITION_SENSOR], (hu.bme.mit.trainbenchmark.ttc.railway.SwitchPosition) match[POSITION_SWITCHPOSITION], (hu.bme.mit.trainbenchmark.ttc.railway.Switch) match[POSITION_SW]); } catch (ClassCastException e) { LOGGER.error("Element(s) in array not properly typed!", e); return null; } }
@Override protected RouteSensorMatch tupleToMatch(final Tuple t) { try { return RouteSensorMatch.newMatch( (hu.bme.mit.trainbenchmark.ttc.railway.Route) t.get(POSITION_ROUTE), (hu.bme.mit.trainbenchmark.ttc.railway.Sensor) t.get(POSITION_SENSOR), (hu.bme.mit.trainbenchmark.ttc.railway.SwitchPosition) t.get(POSITION_SWITCHPOSITION), (hu.bme.mit.trainbenchmark.ttc.railway.Switch) t.get(POSITION_SW)); } catch (ClassCastException e) { LOGGER.error("Element(s) in tuple not properly typed!", e); return null; } }
/** * Retrieve the set of values that occur in matches for sw. * * @return the Set of all values, null if no parameter with the given name exists, empty set if * there are no matches */ public Set<Switch> getAllValuesOfsw(final RouteSensorMatch partialMatch) { return rawAccumulateAllValuesOfsw(partialMatch.toArray()); }
/** * Retrieve the set of values that occur in matches for route. * * @return the Set of all values, null if no parameter with the given name exists, empty set if * there are no matches */ public Set<Route> getAllValuesOfroute(final RouteSensorMatch partialMatch) { return rawAccumulateAllValuesOfroute(partialMatch.toArray()); }