diff --git a/.settings/org.eclipse.jdt.ui.prefs b/.settings/org.eclipse.jdt.ui.prefs index 5d68cd694a41cdcbab3ecadfd7da8de46c0ade3e..703085d08cf40277c40d5abe5ae1238077e851c3 100644 --- a/.settings/org.eclipse.jdt.ui.prefs +++ b/.settings/org.eclipse.jdt.ui.prefs @@ -5,13 +5,13 @@ cleanup.add_missing_deprecated_annotations=true cleanup.add_missing_methods=false cleanup.add_missing_nls_tags=false cleanup.add_missing_override_annotations=true -cleanup.add_missing_override_annotations_interface_methods=true +cleanup.add_missing_override_annotations_interface_methods=false cleanup.add_serial_version_id=true cleanup.always_use_blocks=true cleanup.always_use_parentheses_in_expressions=true -cleanup.always_use_this_for_non_static_field_access=false -cleanup.always_use_this_for_non_static_method_access=false -cleanup.convert_functional_interfaces=true +cleanup.always_use_this_for_non_static_field_access=true +cleanup.always_use_this_for_non_static_method_access=true +cleanup.convert_functional_interfaces=false cleanup.convert_to_enhanced_for_loop=true cleanup.correct_indentation=true cleanup.format_source_code=true @@ -51,15 +51,15 @@ cleanup.use_blocks_only_for_return_and_throw=false cleanup.use_lambda=true cleanup.use_parentheses_in_expressions=true cleanup.use_this_for_non_static_field_access=true -cleanup.use_this_for_non_static_field_access_only_if_necessary=true +cleanup.use_this_for_non_static_field_access_only_if_necessary=false cleanup.use_this_for_non_static_method_access=true -cleanup.use_this_for_non_static_method_access_only_if_necessary=true +cleanup.use_this_for_non_static_method_access_only_if_necessary=false cleanup.use_type_arguments=false cleanup_profile=_TeeTime - Clean Up cleanup_settings_version=2 eclipse.preferences.version=1 editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true -formatter_profile=_TeeTime - Profile +formatter_profile=_TeeTime - Formatter formatter_settings_version=12 org.eclipse.jdt.ui.ignorelowercasenames=true org.eclipse.jdt.ui.importorder=java;javax;junit;org;com;kieker;kieker.test; diff --git a/src/main/java/teetime/framework/AbstractPort.java b/src/main/java/teetime/framework/AbstractPort.java index 46ec6c7c04adbe4c60df04444ed5cb824667c785..80ec742bf8cc1e5764fe49e5cf97a13e7b01e90c 100644 --- a/src/main/java/teetime/framework/AbstractPort.java +++ b/src/main/java/teetime/framework/AbstractPort.java @@ -26,7 +26,12 @@ public abstract class AbstractPort<T> { * <i>Used to validate the connection between two ports at runtime.</i> * </p> */ - protected Class<T> type; + protected final Class<T> type; + + public AbstractPort(final Class<T> type) { + super(); + this.type = type; + } public IPipe getPipe() { return this.pipe; @@ -39,8 +44,4 @@ public abstract class AbstractPort<T> { public Class<T> getType() { return this.type; } - - public void setType(final Class<T> type) { - this.type = type; - } } diff --git a/src/main/java/teetime/framework/AbstractStage.java b/src/main/java/teetime/framework/AbstractStage.java index 3050aa603aa772384d8d0165c419f9b9f3b3432e..3c0086dc4edfa3a72ec1d9117462ba08de9e0120 100644 --- a/src/main/java/teetime/framework/AbstractStage.java +++ b/src/main/java/teetime/framework/AbstractStage.java @@ -126,10 +126,23 @@ public abstract class AbstractStage extends Stage { * Creates and adds an InputPort to the stage * * @return Newly added InputPort + * */ + // * @deprecated Since 1.1. Use {@link #createInputPort(Class)} instead. + @SuppressWarnings("unchecked") + // @Deprecated protected <T> InputPort<T> createInputPort() { - final InputPort<T> inputPort = new InputPort<T>(this); - // inputPort.setType(portType); + return (InputPort<T>) createInputPort(null); + } + + /** + * Creates and adds an InputPort to the stage + * + * @param type + * @return Newly added InputPort + */ + protected <T> InputPort<T> createInputPort(final Class<T> type) { + final InputPort<T> inputPort = new InputPort<T>(type, this); inputPorts = addElementToArray(inputPort, inputPorts); return inputPort; } @@ -138,10 +151,23 @@ public abstract class AbstractStage extends Stage { * Creates and adds an OutputPort to the stage * * @return Newly added OutputPort + * */ + // * @deprecated Since 1.1. Use {@link #createOutputPort(Class)} instead. + @SuppressWarnings("unchecked") + // @Deprecated protected <T> OutputPort<T> createOutputPort() { - final OutputPort<T> outputPort = new OutputPort<T>(); - // outputPort.setType(portType); + return (OutputPort<T>) createOutputPort(null); + } + + /** + * Creates and adds an OutputPort to the stage + * + * @param type + * @return Newly added OutputPort + */ + protected <T> OutputPort<T> createOutputPort(final Class<T> type) { + final OutputPort<T> outputPort = new OutputPort<T>(type); outputPorts = addElementToArray(outputPort, outputPorts); return outputPort; } diff --git a/src/main/java/teetime/framework/InputPort.java b/src/main/java/teetime/framework/InputPort.java index d95f6ec11e6bc7ef7b491fc14a083f784b25e5b6..6c22a44d36c7284f68d6e3cea904ea614c4f48ac 100644 --- a/src/main/java/teetime/framework/InputPort.java +++ b/src/main/java/teetime/framework/InputPort.java @@ -19,8 +19,8 @@ public final class InputPort<T> extends AbstractPort<T> { private final Stage owningStage; - InputPort(final Stage owningStage) { - super(); + InputPort(final Class<T> type, final Stage owningStage) { + super(type); this.owningStage = owningStage; } diff --git a/src/main/java/teetime/framework/OutputPort.java b/src/main/java/teetime/framework/OutputPort.java index b05152795f7f3f3f0f64892b383770df1b640a1e..c1385d4c1e105902bf3f7550d3fa5d84deb99795 100644 --- a/src/main/java/teetime/framework/OutputPort.java +++ b/src/main/java/teetime/framework/OutputPort.java @@ -29,8 +29,8 @@ import teetime.framework.signal.TerminatingSignal; */ public final class OutputPort<T> extends AbstractPort<T> { - OutputPort() { - super(); + OutputPort(final Class<T> type) { + super(type); } /** diff --git a/src/main/java/teetime/framework/exceptionHandling/StageException.java b/src/main/java/teetime/framework/exceptionHandling/StageException.java index 1101fbe5e9145def9fd3f288e5da065e68e8802b..5bd0f0a78e8dcf1e318c503fffc685b56846fa5b 100644 --- a/src/main/java/teetime/framework/exceptionHandling/StageException.java +++ b/src/main/java/teetime/framework/exceptionHandling/StageException.java @@ -18,8 +18,8 @@ package teetime.framework.exceptionHandling; import teetime.framework.Stage; /** - * Represents an Exception, which is thrown by stages in case of they throw exceptions. - * To get the original exception, which was thrown, call {@link #getCause()}. {@link #getThrowingStage()} returns the stage, which has thrown the original exception. + * Represents an Exception, which is thrown by stages in case of theyimport teetime.framework.Stage; + original exception, which was thrown, call {@link #getCause()}. {@link #getThrowingStage()} returns the stage, which has thrown the original exception. * * @since 1.1 */ diff --git a/src/main/java/teetime/stage/PortTypeConfiguration.java b/src/main/java/teetime/stage/PortTypeConfiguration.java deleted file mode 100644 index 2890a2cb880f762b378684871aeab71cd50fd0cd..0000000000000000000000000000000000000000 --- a/src/main/java/teetime/stage/PortTypeConfiguration.java +++ /dev/null @@ -1,34 +0,0 @@ -/** - * Copyright (C) 2015 Christian Wulf, Nelson Tavares de Sousa (http://teetime.sourceforge.net) - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package teetime.stage; - -import teetime.util.TimestampObject; - -public class PortTypeConfiguration { - - public static <T> void setPortTypes(final ObjectProducer<T> stage, final Class<T> clazz) { - stage.getOutputPort().setType(clazz); - } - - public static <T> void setPortTypes(final CollectorSink<T> stage, final Class<T> clazz) { - stage.getInputPort().setType(clazz); - } - - public static <T> void setPortTypes(final StartTimestampFilter stage) { - stage.getInputPort().setType(TimestampObject.class); - stage.getOutputPort().setType(TimestampObject.class); - } -} diff --git a/teetime-eclipse-formatter.xml b/teetime-eclipse-formatter.xml index 3ae3882ebfe02777204ec3ebbf015f220880b8bd..bc66cd1c4a84c660be6f5b2f2e0c9d3e3fd6b9c4 100644 --- a/teetime-eclipse-formatter.xml +++ b/teetime-eclipse-formatter.xml @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8" standalone="no"?> <profiles version="12"> -<profile kind="CodeFormatterProfile" name="TeeTime - Profile" version="12"> +<profile kind="CodeFormatterProfile" name="TeeTime - Formatter" version="12"> <setting id="org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags" value="insert"/> <setting id="org.eclipse.jdt.core.formatter.disabling_tag" value="@formatter:off"/> <setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation" value="insert"/>