From: "Enrico Weigelt, metux IT consult" <enrico.weig...@gr13.net>

---
 src/net/sf/freecol/common/model/Effect.java        |  4 ++--
 src/net/sf/freecol/common/model/Feature.java       | 23 +++++++---------------
 .../common/model/FreeColSpecObjectType.java        | 13 ++----------
 src/net/sf/freecol/common/model/Modifier.java      |  2 +-
 src/net/sf/freecol/common/model/Scoped.java        | 14 +++----------
 5 files changed, 15 insertions(+), 41 deletions(-)

diff --git a/src/net/sf/freecol/common/model/Effect.java 
b/src/net/sf/freecol/common/model/Effect.java
index 7bef985a94c..ce4e765032e 100644
--- a/src/net/sf/freecol/common/model/Effect.java
+++ b/src/net/sf/freecol/common/model/Effect.java
@@ -85,7 +85,7 @@ public class Effect extends FreeColSpecObjectType {
         setId(template.getId());
         setSpecification(template.getSpecification());
         this.probability = template.probability;
-        setScopes(template.getScopeList());
+        setScopes(template.getScopes());
         addFeatures(template);
     }
 
@@ -141,7 +141,7 @@ public class Effect extends FreeColSpecObjectType {
         StringBuilder sb = new StringBuilder(32);
         sb.append('[').append(getId())
             .append(" probability=").append(probability).append('%');
-        for (Scope scope : getScopeList()) sb.append(' ').append(scope);
+        for (Scope scope : getScopes()) sb.append(' ').append(scope);
         sb.append(']');
         return sb.toString();
     }
diff --git a/src/net/sf/freecol/common/model/Feature.java 
b/src/net/sf/freecol/common/model/Feature.java
index e6db8b432b6..b16441dc280 100644
--- a/src/net/sf/freecol/common/model/Feature.java
+++ b/src/net/sf/freecol/common/model/Feature.java
@@ -22,7 +22,6 @@ package net.sf.freecol.common.model;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
-import java.util.stream.Stream;
 
 import javax.xml.stream.XMLStreamException;
 
@@ -90,7 +89,7 @@ public abstract class Feature extends FreeColSpecObject
         this.lastTurn = other.lastTurn;
         this.duration = other.duration;
         this.temporary = other.temporary;
-        setScopes(other.getScopeList());
+        setScopes(other.getScopes());
     }
 
     /**
@@ -274,17 +273,9 @@ public abstract class Feature extends FreeColSpecObject
     /**
      * {@inheritDoc}
      */
-    public final List<Scope> getScopeList() {
+    public final List<Scope> getScopes() {
         return (this.scopes == null) ? Collections.<Scope>emptyList()
-            : new ArrayList<>(this.scopes);
-    }
-
-    /**
-     * {@inheritDoc}
-     */
-    public final Stream<Scope> getScopes() {
-        return (this.scopes == null) ? Stream.<Scope>empty()
-            : getScopeList().stream();
+            : this.scopes;
     }
 
     /**
@@ -356,7 +347,7 @@ public abstract class Feature extends FreeColSpecObject
     protected void writeChildren(FreeColXMLWriter xw) throws 
XMLStreamException {
         super.writeChildren(xw);
 
-        for (Scope scope : getScopeList()) scope.toXML(xw);
+        for (Scope scope : getScopes()) scope.toXML(xw);
     }
 
     /**
@@ -445,8 +436,8 @@ public abstract class Feature extends FreeColSpecObject
             } else if (lastTurn.getNumber() != feature.lastTurn.getNumber()) {
                 return false;
             }
-            List<Scope> tScopes = getScopeList();
-            List<Scope> fScopes = feature.getScopeList();
+            List<Scope> tScopes = getScopes();
+            List<Scope> fScopes = feature.getScopes();
             if (tScopes.size() != fScopes.size()
                 // Not very efficient, but we do not expect many scopes
                 || any(this.scopes, s -> !feature.scopes.contains(s))
@@ -470,7 +461,7 @@ public abstract class Feature extends FreeColSpecObject
         hash += 31 * ((temporary) ? 1 : 0);
         // FIXME: is this safe?  It is an easy way to ignore
         // the order of scope elements.
-        hash += sum(getScopeList(), s -> Utils.hashCode(s));
+        hash += sum(getScopes(), s -> Utils.hashCode(s));
         return hash;
     }
 }
diff --git a/src/net/sf/freecol/common/model/FreeColSpecObjectType.java 
b/src/net/sf/freecol/common/model/FreeColSpecObjectType.java
index 6ef06babaed..2b0725d73e1 100644
--- a/src/net/sf/freecol/common/model/FreeColSpecObjectType.java
+++ b/src/net/sf/freecol/common/model/FreeColSpecObjectType.java
@@ -22,7 +22,6 @@ package net.sf.freecol.common.model;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
-import java.util.stream.Stream;
 
 import javax.xml.stream.XMLStreamException;
 
@@ -183,7 +182,7 @@ public abstract class FreeColSpecObjectType extends 
FreeColSpecObject
     /**
      * {@inheritDoc}
      */
-    public final List<Scope> getScopeList() {
+    public final List<Scope> getScopes() {
         return (this.scopes == null) ? Collections.<Scope>emptyList()
             : this.scopes;
     }
@@ -191,14 +190,6 @@ public abstract class FreeColSpecObjectType extends 
FreeColSpecObject
     /**
      * {@inheritDoc}
      */
-    public final Stream<Scope> getScopes() {
-        return (this.scopes == null) ? Stream.<Scope>empty()
-            : this.scopes.stream();
-    }
-
-    /**
-     * {@inheritDoc}
-     */
     public final void setScopes(List<Scope> scopes) {
         this.scopes = scopes;
     }
@@ -260,7 +251,7 @@ public abstract class FreeColSpecObjectType extends 
FreeColSpecObject
 
         for (Modifier modifier : getSortedModifiers()) modifier.toXML(xw);
 
-        for (Scope scope : getScopeList()) scope.toXML(xw);
+        for (Scope scope : getScopes()) scope.toXML(xw);
     }
 
     /**
diff --git a/src/net/sf/freecol/common/model/Modifier.java 
b/src/net/sf/freecol/common/model/Modifier.java
index 345e5b8386c..14bcf8eea27 100644
--- a/src/net/sf/freecol/common/model/Modifier.java
+++ b/src/net/sf/freecol/common/model/Modifier.java
@@ -653,7 +653,7 @@ public class Modifier extends Feature {
         if (modifierIndex >= DEFAULT_MODIFIER_INDEX) {
             sb.append(" index=").append(modifierIndex);
         }
-        List<Scope> scopes = getScopeList();
+        List<Scope> scopes = getScopes();
         if (!scopes.isEmpty()) {
             sb.append(" [");
             for (Scope s : scopes) sb.append(' ').append(s);
diff --git a/src/net/sf/freecol/common/model/Scoped.java 
b/src/net/sf/freecol/common/model/Scoped.java
index 163dab2d196..edc72983454 100644
--- a/src/net/sf/freecol/common/model/Scoped.java
+++ b/src/net/sf/freecol/common/model/Scoped.java
@@ -20,7 +20,6 @@
 package net.sf.freecol.common.model;
 
 import java.util.List;
-import java.util.stream.Stream;
 
 import static net.sf.freecol.common.util.CollectionUtils.*;
 
@@ -31,18 +30,11 @@ import static net.sf.freecol.common.util.CollectionUtils.*;
 public interface Scoped {
 
     /**
-     * Get the scopes applicable to this effect.
-     *
-     * @return A list of {@code Scope}s.
-     */
-    public List<Scope> getScopeList();
-
-    /**
      * Get the scopes applicable to this effect as a stream.
      *
-     * @return A stream of {@code Scope}s.
+     * @return A {@code} list of {@code Scope}s.
      */
-    public Stream<Scope> getScopes();
+    public List<Scope> getScopes();
 
     /**
      * Set the scopes for this object.
@@ -65,7 +57,7 @@ public interface Scoped {
      * @return True if this effect applies.
      */
     default boolean appliesTo(FreeColObject object) {
-        List<Scope> scopes = getScopeList();
+        List<Scope> scopes = getScopes();
         return (scopes == null || scopes.isEmpty()) ? true
             : any(scopes, s -> s.appliesTo(object));
     }
-- 
2.11.0.rc0.7.gbe5a750


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Freecol-developers mailing list
Freecol-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/freecol-developers

Reply via email to