Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
runtime-core: Implement pluggable terminators etc.
- Loading branch information
Showing
85 changed files
with
3,176 additions
and
471 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
...e-parent/runtime-core/src/main/java/com/speedment/runtime/core/component/sql/Metrics.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,44 @@ | |||
/* | |||
* To change this license header, choose License Headers in Project Properties. | |||
* To change this template file, choose Tools | Templates | |||
* and open the template in the editor. | |||
*/ | |||
package com.speedment.runtime.core.component.sql; | |||
|
|||
import com.speedment.runtime.core.internal.component.sql.MetricsImpl; | |||
|
|||
/** | |||
* | |||
*/ | |||
public interface Metrics { | |||
|
|||
/** | |||
* Returns the number of pipeline reductions an optimizer was able to do. If | |||
* an optimizer cannot optimize the pipeline at all, then {@code 0} should | |||
* be returned. | |||
* | |||
* @return The number of pipeline reductions an optimizer was able to do | |||
*/ | |||
int getPipelineReductions(); | |||
|
|||
/** | |||
* Creates and returns a new Metrics. | |||
* | |||
* @param pipelineReductions number of pipeline reductions that were made | |||
* @return a new Metrics | |||
*/ | |||
static Metrics of(int pipelineReductions) { | |||
return new MetricsImpl(pipelineReductions); | |||
} | |||
|
|||
/** | |||
* Returns an empty metrics. This can be used by optimizers that are unable | |||
* to optimize the current stream. | |||
* | |||
* @return Returns an empty metrics | |||
*/ | |||
static Metrics empty() { | |||
return MetricsImpl.EMPTY; | |||
} | |||
|
|||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 0 additions & 57 deletions
57
...com/speedment/runtime/core/component/sql/override/ReferenceStreamTerminatorOverrides.java
This file was deleted.
Oops, something went wrong.
17 changes: 17 additions & 0 deletions
17
.../java/com/speedment/runtime/core/component/sql/override/SqlStreamTerminatorComponent.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,17 @@ | |||
package com.speedment.runtime.core.component.sql.override; | |||
|
|||
import com.speedment.runtime.core.component.sql.override.doubles.DoubleSqlStreamTerminatorOverride; | |||
import com.speedment.runtime.core.component.sql.override.ints.IntSqlStreamTerminatorOverride; | |||
import com.speedment.runtime.core.component.sql.override.longs.LongSqlStreamTerminatorOverride; | |||
import com.speedment.runtime.core.component.sql.override.reference.ReferenceSqlStreamTerminatorOverride; | |||
|
|||
/** | |||
* | |||
* @author Per Minborg | |||
*/ | |||
public interface SqlStreamTerminatorComponent extends | |||
DoubleSqlStreamTerminatorOverride, | |||
IntSqlStreamTerminatorOverride, | |||
LongSqlStreamTerminatorOverride, | |||
ReferenceSqlStreamTerminatorOverride { | |||
} |
7 changes: 7 additions & 0 deletions
7
...time-core/src/main/java/com/speedment/runtime/core/component/sql/override/Terminator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,7 @@ | |||
package com.speedment.runtime.core.component.sql.override; | |||
|
|||
/** | |||
* | |||
* @author Per Minborg | |||
*/ | |||
public interface Terminator {} |
27 changes: 27 additions & 0 deletions
27
...java/com/speedment/runtime/core/component/sql/override/doubles/DoubleCountTerminator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,27 @@ | |||
package com.speedment.runtime.core.component.sql.override.doubles; | |||
|
|||
import com.speedment.runtime.core.component.sql.SqlStreamOptimizerInfo; | |||
import static com.speedment.runtime.core.internal.component.sql.override.def.doubles.DefaultDoubleCountTerminator.DEFAULT; | |||
import com.speedment.runtime.core.internal.manager.sql.SqlStreamTerminator; | |||
import com.speedment.runtime.core.internal.stream.builder.pipeline.DoublePipeline; | |||
|
|||
/** | |||
* | |||
* @author Per Minborg | |||
* @param <ENTITY> the original stream entity source type | |||
*/ | |||
@FunctionalInterface | |||
public interface DoubleCountTerminator<ENTITY> extends DoubleTerminator { | |||
|
|||
<T> long apply( | |||
SqlStreamOptimizerInfo<ENTITY> info, | |||
SqlStreamTerminator<ENTITY> sqlStreamTerminator, | |||
DoublePipeline pipeline | |||
); | |||
|
|||
@SuppressWarnings("unchecked") | |||
static <ENTITY> DoubleCountTerminator<ENTITY> defaultTerminator() { | |||
return (DoubleCountTerminator<ENTITY>) DEFAULT; | |||
} | |||
|
|||
} |
32 changes: 32 additions & 0 deletions
32
...edment/runtime/core/component/sql/override/doubles/DoubleSqlStreamTerminatorOverride.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,32 @@ | |||
/** | |||
* | |||
* Copyright (c) 2006-2017, Speedment, Inc. All Rights Reserved. | |||
* | |||
* 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 com.speedment.runtime.core.component.sql.override.doubles; | |||
|
|||
/** | |||
* | |||
* @author Per Minborg | |||
*/ | |||
public interface DoubleSqlStreamTerminatorOverride { | |||
|
|||
// ForEachTerminator<ENTITY> getForEachHandler(); | |||
// | |||
// void setForEachHandler(ForEachTerminator<ENTITY> forEach); | |||
<ENTITY> DoubleCountTerminator<ENTITY> getDoubleCountTerminator(); | |||
|
|||
<ENTITY> void setDoubleCountTerminator(DoubleCountTerminator<ENTITY> count); | |||
|
|||
} |
10 changes: 10 additions & 0 deletions
10
...main/java/com/speedment/runtime/core/component/sql/override/doubles/DoubleTerminator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,10 @@ | |||
package com.speedment.runtime.core.component.sql.override.doubles; | |||
|
|||
import com.speedment.runtime.core.component.sql.override.ints.*; | |||
import com.speedment.runtime.core.component.sql.override.Terminator; | |||
|
|||
/** | |||
* | |||
* @author Per Minborg | |||
*/ | |||
public interface DoubleTerminator extends Terminator {} |
27 changes: 27 additions & 0 deletions
27
.../main/java/com/speedment/runtime/core/component/sql/override/ints/IntCountTerminator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,27 @@ | |||
package com.speedment.runtime.core.component.sql.override.ints; | |||
|
|||
import com.speedment.runtime.core.component.sql.SqlStreamOptimizerInfo; | |||
import static com.speedment.runtime.core.internal.component.sql.override.def.ints.DefaultIntCountTerminator.DEFAULT; | |||
import com.speedment.runtime.core.internal.manager.sql.SqlStreamTerminator; | |||
import com.speedment.runtime.core.internal.stream.builder.pipeline.IntPipeline; | |||
|
|||
/** | |||
* | |||
* @author Per Minborg | |||
* @param <ENTITY> the original stream entity source type | |||
*/ | |||
@FunctionalInterface | |||
public interface IntCountTerminator<ENTITY> extends IntTerminator { | |||
|
|||
<T> long apply( | |||
SqlStreamOptimizerInfo<ENTITY> info, | |||
SqlStreamTerminator<ENTITY> sqlStreamTerminator, | |||
IntPipeline pipeline | |||
); | |||
|
|||
@SuppressWarnings("unchecked") | |||
static <ENTITY> IntCountTerminator<ENTITY> defaultTerminator() { | |||
return (IntCountTerminator<ENTITY>) DEFAULT; | |||
} | |||
|
|||
} |
32 changes: 32 additions & 0 deletions
32
...om/speedment/runtime/core/component/sql/override/ints/IntSqlStreamTerminatorOverride.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,32 @@ | |||
/** | |||
* | |||
* Copyright (c) 2006-2017, Speedment, Inc. All Rights Reserved. | |||
* | |||
* 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 com.speedment.runtime.core.component.sql.override.ints; | |||
|
|||
/** | |||
* | |||
* @author Per Minborg | |||
*/ | |||
public interface IntSqlStreamTerminatorOverride { | |||
|
|||
// ForEachTerminator<ENTITY> getForEachHandler(); | |||
// | |||
// void setForEachHandler(ForEachTerminator<ENTITY> forEach); | |||
<ENTITY> IntCountTerminator<ENTITY> getIntCountTerminator(); | |||
|
|||
<ENTITY> void setIntCountTerminator(IntCountTerminator<ENTITY> count); | |||
|
|||
} |
9 changes: 9 additions & 0 deletions
9
...e/src/main/java/com/speedment/runtime/core/component/sql/override/ints/IntTerminator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,9 @@ | |||
package com.speedment.runtime.core.component.sql.override.ints; | |||
|
|||
import com.speedment.runtime.core.component.sql.override.Terminator; | |||
|
|||
/** | |||
* | |||
* @author Per Minborg | |||
*/ | |||
public interface IntTerminator extends Terminator {} |
27 changes: 27 additions & 0 deletions
27
...ain/java/com/speedment/runtime/core/component/sql/override/longs/LongCountTerminator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,27 @@ | |||
package com.speedment.runtime.core.component.sql.override.longs; | |||
|
|||
import com.speedment.runtime.core.component.sql.SqlStreamOptimizerInfo; | |||
import static com.speedment.runtime.core.internal.component.sql.override.def.longs.DefaultLongCountTerminator.DEFAULT; | |||
import com.speedment.runtime.core.internal.manager.sql.SqlStreamTerminator; | |||
import com.speedment.runtime.core.internal.stream.builder.pipeline.LongPipeline; | |||
|
|||
/** | |||
* | |||
* @author Per Minborg | |||
* @param <ENTITY> the original stream entity source type | |||
*/ | |||
@FunctionalInterface | |||
public interface LongCountTerminator<ENTITY> extends LongTerminator { | |||
|
|||
<T> long apply( | |||
SqlStreamOptimizerInfo<ENTITY> info, | |||
SqlStreamTerminator<ENTITY> sqlStreamTerminator, | |||
LongPipeline pipeline | |||
); | |||
|
|||
@SuppressWarnings("unchecked") | |||
static <ENTITY> LongCountTerminator<ENTITY> defaultTerminator() { | |||
return (LongCountTerminator<ENTITY>) DEFAULT; | |||
} | |||
|
|||
} |
32 changes: 32 additions & 0 deletions
32
.../speedment/runtime/core/component/sql/override/longs/LongSqlStreamTerminatorOverride.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,32 @@ | |||
/** | |||
* | |||
* Copyright (c) 2006-2017, Speedment, Inc. All Rights Reserved. | |||
* | |||
* 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 com.speedment.runtime.core.component.sql.override.longs; | |||
|
|||
/** | |||
* | |||
* @author Per Minborg | |||
*/ | |||
public interface LongSqlStreamTerminatorOverride { | |||
|
|||
// ForEachTerminator<ENTITY> getForEachHandler(); | |||
// | |||
// void setForEachHandler(ForEachTerminator<ENTITY> forEach); | |||
<ENTITY> LongCountTerminator<ENTITY> getLongCountTerminator(); | |||
|
|||
<ENTITY> void setLongCountTerminator(LongCountTerminator<ENTITY> count); | |||
|
|||
} |
9 changes: 9 additions & 0 deletions
9
...src/main/java/com/speedment/runtime/core/component/sql/override/longs/LongTerminator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,9 @@ | |||
package com.speedment.runtime.core.component.sql.override.longs; | |||
|
|||
import com.speedment.runtime.core.component.sql.override.Terminator; | |||
|
|||
/** | |||
* | |||
* @author Per Minborg | |||
*/ | |||
public interface LongTerminator extends Terminator {} |
Oops, something went wrong.