Removed stream usage from AbstractResidence.

This commit is contained in:
MobiusDevelopment
2023-01-08 15:10:27 +00:00
parent eb3f77bfcb
commit b9ab99c655
26 changed files with 312 additions and 104 deletions

View File

@@ -253,7 +253,15 @@ public abstract class AbstractResidence extends ListenersContainer implements IN
*/ */
public boolean hasFunction(ResidenceFunctionType type) public boolean hasFunction(ResidenceFunctionType type)
{ {
return _functions.values().stream().map(ResidenceFunction::getTemplate).anyMatch(func -> func.getType() == type); for (ResidenceFunction function : _functions.values())
{
final ResidenceFunctionTemplate template = function.getTemplate();
if ((template != null) && (template.getType() == type))
{
return true;
}
}
return false;
} }
/** /**
@@ -262,11 +270,11 @@ public abstract class AbstractResidence extends ListenersContainer implements IN
*/ */
public ResidenceFunction getFunction(ResidenceFunctionType type) public ResidenceFunction getFunction(ResidenceFunctionType type)
{ {
for (ResidenceFunction func : _functions.values()) for (ResidenceFunction function : _functions.values())
{ {
if (func.getType() == type) if (function.getType() == type)
{ {
return func; return function;
} }
} }
return null; return null;

View File

@@ -253,7 +253,15 @@ public abstract class AbstractResidence extends ListenersContainer implements IN
*/ */
public boolean hasFunction(ResidenceFunctionType type) public boolean hasFunction(ResidenceFunctionType type)
{ {
return _functions.values().stream().map(ResidenceFunction::getTemplate).anyMatch(func -> func.getType() == type); for (ResidenceFunction function : _functions.values())
{
final ResidenceFunctionTemplate template = function.getTemplate();
if ((template != null) && (template.getType() == type))
{
return true;
}
}
return false;
} }
/** /**
@@ -262,11 +270,11 @@ public abstract class AbstractResidence extends ListenersContainer implements IN
*/ */
public ResidenceFunction getFunction(ResidenceFunctionType type) public ResidenceFunction getFunction(ResidenceFunctionType type)
{ {
for (ResidenceFunction func : _functions.values()) for (ResidenceFunction function : _functions.values())
{ {
if (func.getType() == type) if (function.getType() == type)
{ {
return func; return function;
} }
} }
return null; return null;

View File

@@ -253,7 +253,15 @@ public abstract class AbstractResidence extends ListenersContainer implements IN
*/ */
public boolean hasFunction(ResidenceFunctionType type) public boolean hasFunction(ResidenceFunctionType type)
{ {
return _functions.values().stream().map(ResidenceFunction::getTemplate).anyMatch(func -> func.getType() == type); for (ResidenceFunction function : _functions.values())
{
final ResidenceFunctionTemplate template = function.getTemplate();
if ((template != null) && (template.getType() == type))
{
return true;
}
}
return false;
} }
/** /**
@@ -262,11 +270,11 @@ public abstract class AbstractResidence extends ListenersContainer implements IN
*/ */
public ResidenceFunction getFunction(ResidenceFunctionType type) public ResidenceFunction getFunction(ResidenceFunctionType type)
{ {
for (ResidenceFunction func : _functions.values()) for (ResidenceFunction function : _functions.values())
{ {
if (func.getType() == type) if (function.getType() == type)
{ {
return func; return function;
} }
} }
return null; return null;

View File

@@ -253,7 +253,15 @@ public abstract class AbstractResidence extends ListenersContainer implements IN
*/ */
public boolean hasFunction(ResidenceFunctionType type) public boolean hasFunction(ResidenceFunctionType type)
{ {
return _functions.values().stream().map(ResidenceFunction::getTemplate).anyMatch(func -> func.getType() == type); for (ResidenceFunction function : _functions.values())
{
final ResidenceFunctionTemplate template = function.getTemplate();
if ((template != null) && (template.getType() == type))
{
return true;
}
}
return false;
} }
/** /**
@@ -262,11 +270,11 @@ public abstract class AbstractResidence extends ListenersContainer implements IN
*/ */
public ResidenceFunction getFunction(ResidenceFunctionType type) public ResidenceFunction getFunction(ResidenceFunctionType type)
{ {
for (ResidenceFunction func : _functions.values()) for (ResidenceFunction function : _functions.values())
{ {
if (func.getType() == type) if (function.getType() == type)
{ {
return func; return function;
} }
} }
return null; return null;

View File

@@ -253,7 +253,15 @@ public abstract class AbstractResidence extends ListenersContainer implements IN
*/ */
public boolean hasFunction(ResidenceFunctionType type) public boolean hasFunction(ResidenceFunctionType type)
{ {
return _functions.values().stream().map(ResidenceFunction::getTemplate).anyMatch(func -> func.getType() == type); for (ResidenceFunction function : _functions.values())
{
final ResidenceFunctionTemplate template = function.getTemplate();
if ((template != null) && (template.getType() == type))
{
return true;
}
}
return false;
} }
/** /**
@@ -262,11 +270,11 @@ public abstract class AbstractResidence extends ListenersContainer implements IN
*/ */
public ResidenceFunction getFunction(ResidenceFunctionType type) public ResidenceFunction getFunction(ResidenceFunctionType type)
{ {
for (ResidenceFunction func : _functions.values()) for (ResidenceFunction function : _functions.values())
{ {
if (func.getType() == type) if (function.getType() == type)
{ {
return func; return function;
} }
} }
return null; return null;

View File

@@ -253,7 +253,15 @@ public abstract class AbstractResidence extends ListenersContainer implements IN
*/ */
public boolean hasFunction(ResidenceFunctionType type) public boolean hasFunction(ResidenceFunctionType type)
{ {
return _functions.values().stream().map(ResidenceFunction::getTemplate).anyMatch(func -> func.getType() == type); for (ResidenceFunction function : _functions.values())
{
final ResidenceFunctionTemplate template = function.getTemplate();
if ((template != null) && (template.getType() == type))
{
return true;
}
}
return false;
} }
/** /**
@@ -262,11 +270,11 @@ public abstract class AbstractResidence extends ListenersContainer implements IN
*/ */
public ResidenceFunction getFunction(ResidenceFunctionType type) public ResidenceFunction getFunction(ResidenceFunctionType type)
{ {
for (ResidenceFunction func : _functions.values()) for (ResidenceFunction function : _functions.values())
{ {
if (func.getType() == type) if (function.getType() == type)
{ {
return func; return function;
} }
} }
return null; return null;

View File

@@ -253,7 +253,15 @@ public abstract class AbstractResidence extends ListenersContainer implements IN
*/ */
public boolean hasFunction(ResidenceFunctionType type) public boolean hasFunction(ResidenceFunctionType type)
{ {
return _functions.values().stream().map(ResidenceFunction::getTemplate).anyMatch(func -> func.getType() == type); for (ResidenceFunction function : _functions.values())
{
final ResidenceFunctionTemplate template = function.getTemplate();
if ((template != null) && (template.getType() == type))
{
return true;
}
}
return false;
} }
/** /**
@@ -262,11 +270,11 @@ public abstract class AbstractResidence extends ListenersContainer implements IN
*/ */
public ResidenceFunction getFunction(ResidenceFunctionType type) public ResidenceFunction getFunction(ResidenceFunctionType type)
{ {
for (ResidenceFunction func : _functions.values()) for (ResidenceFunction function : _functions.values())
{ {
if (func.getType() == type) if (function.getType() == type)
{ {
return func; return function;
} }
} }
return null; return null;

View File

@@ -253,7 +253,15 @@ public abstract class AbstractResidence extends ListenersContainer implements IN
*/ */
public boolean hasFunction(ResidenceFunctionType type) public boolean hasFunction(ResidenceFunctionType type)
{ {
return _functions.values().stream().map(ResidenceFunction::getTemplate).anyMatch(func -> func.getType() == type); for (ResidenceFunction function : _functions.values())
{
final ResidenceFunctionTemplate template = function.getTemplate();
if ((template != null) && (template.getType() == type))
{
return true;
}
}
return false;
} }
/** /**
@@ -262,11 +270,11 @@ public abstract class AbstractResidence extends ListenersContainer implements IN
*/ */
public ResidenceFunction getFunction(ResidenceFunctionType type) public ResidenceFunction getFunction(ResidenceFunctionType type)
{ {
for (ResidenceFunction func : _functions.values()) for (ResidenceFunction function : _functions.values())
{ {
if (func.getType() == type) if (function.getType() == type)
{ {
return func; return function;
} }
} }
return null; return null;

View File

@@ -253,7 +253,15 @@ public abstract class AbstractResidence extends ListenersContainer implements IN
*/ */
public boolean hasFunction(ResidenceFunctionType type) public boolean hasFunction(ResidenceFunctionType type)
{ {
return _functions.values().stream().map(ResidenceFunction::getTemplate).anyMatch(func -> func.getType() == type); for (ResidenceFunction function : _functions.values())
{
final ResidenceFunctionTemplate template = function.getTemplate();
if ((template != null) && (template.getType() == type))
{
return true;
}
}
return false;
} }
/** /**
@@ -262,11 +270,11 @@ public abstract class AbstractResidence extends ListenersContainer implements IN
*/ */
public ResidenceFunction getFunction(ResidenceFunctionType type) public ResidenceFunction getFunction(ResidenceFunctionType type)
{ {
for (ResidenceFunction func : _functions.values()) for (ResidenceFunction function : _functions.values())
{ {
if (func.getType() == type) if (function.getType() == type)
{ {
return func; return function;
} }
} }
return null; return null;

View File

@@ -253,7 +253,15 @@ public abstract class AbstractResidence extends ListenersContainer implements IN
*/ */
public boolean hasFunction(ResidenceFunctionType type) public boolean hasFunction(ResidenceFunctionType type)
{ {
return _functions.values().stream().map(ResidenceFunction::getTemplate).anyMatch(func -> func.getType() == type); for (ResidenceFunction function : _functions.values())
{
final ResidenceFunctionTemplate template = function.getTemplate();
if ((template != null) && (template.getType() == type))
{
return true;
}
}
return false;
} }
/** /**
@@ -262,11 +270,11 @@ public abstract class AbstractResidence extends ListenersContainer implements IN
*/ */
public ResidenceFunction getFunction(ResidenceFunctionType type) public ResidenceFunction getFunction(ResidenceFunctionType type)
{ {
for (ResidenceFunction func : _functions.values()) for (ResidenceFunction function : _functions.values())
{ {
if (func.getType() == type) if (function.getType() == type)
{ {
return func; return function;
} }
} }
return null; return null;

View File

@@ -253,7 +253,15 @@ public abstract class AbstractResidence extends ListenersContainer implements IN
*/ */
public boolean hasFunction(ResidenceFunctionType type) public boolean hasFunction(ResidenceFunctionType type)
{ {
return _functions.values().stream().map(ResidenceFunction::getTemplate).anyMatch(func -> func.getType() == type); for (ResidenceFunction function : _functions.values())
{
final ResidenceFunctionTemplate template = function.getTemplate();
if ((template != null) && (template.getType() == type))
{
return true;
}
}
return false;
} }
/** /**
@@ -262,11 +270,11 @@ public abstract class AbstractResidence extends ListenersContainer implements IN
*/ */
public ResidenceFunction getFunction(ResidenceFunctionType type) public ResidenceFunction getFunction(ResidenceFunctionType type)
{ {
for (ResidenceFunction func : _functions.values()) for (ResidenceFunction function : _functions.values())
{ {
if (func.getType() == type) if (function.getType() == type)
{ {
return func; return function;
} }
} }
return null; return null;

View File

@@ -253,7 +253,15 @@ public abstract class AbstractResidence extends ListenersContainer implements IN
*/ */
public boolean hasFunction(ResidenceFunctionType type) public boolean hasFunction(ResidenceFunctionType type)
{ {
return _functions.values().stream().map(ResidenceFunction::getTemplate).anyMatch(func -> func.getType() == type); for (ResidenceFunction function : _functions.values())
{
final ResidenceFunctionTemplate template = function.getTemplate();
if ((template != null) && (template.getType() == type))
{
return true;
}
}
return false;
} }
/** /**
@@ -262,11 +270,11 @@ public abstract class AbstractResidence extends ListenersContainer implements IN
*/ */
public ResidenceFunction getFunction(ResidenceFunctionType type) public ResidenceFunction getFunction(ResidenceFunctionType type)
{ {
for (ResidenceFunction func : _functions.values()) for (ResidenceFunction function : _functions.values())
{ {
if (func.getType() == type) if (function.getType() == type)
{ {
return func; return function;
} }
} }
return null; return null;

View File

@@ -253,7 +253,15 @@ public abstract class AbstractResidence extends ListenersContainer implements IN
*/ */
public boolean hasFunction(ResidenceFunctionType type) public boolean hasFunction(ResidenceFunctionType type)
{ {
return _functions.values().stream().map(ResidenceFunction::getTemplate).anyMatch(func -> func.getType() == type); for (ResidenceFunction function : _functions.values())
{
final ResidenceFunctionTemplate template = function.getTemplate();
if ((template != null) && (template.getType() == type))
{
return true;
}
}
return false;
} }
/** /**
@@ -262,11 +270,11 @@ public abstract class AbstractResidence extends ListenersContainer implements IN
*/ */
public ResidenceFunction getFunction(ResidenceFunctionType type) public ResidenceFunction getFunction(ResidenceFunctionType type)
{ {
for (ResidenceFunction func : _functions.values()) for (ResidenceFunction function : _functions.values())
{ {
if (func.getType() == type) if (function.getType() == type)
{ {
return func; return function;
} }
} }
return null; return null;

View File

@@ -253,7 +253,15 @@ public abstract class AbstractResidence extends ListenersContainer implements IN
*/ */
public boolean hasFunction(ResidenceFunctionType type) public boolean hasFunction(ResidenceFunctionType type)
{ {
return _functions.values().stream().map(ResidenceFunction::getTemplate).anyMatch(func -> func.getType() == type); for (ResidenceFunction function : _functions.values())
{
final ResidenceFunctionTemplate template = function.getTemplate();
if ((template != null) && (template.getType() == type))
{
return true;
}
}
return false;
} }
/** /**
@@ -262,11 +270,11 @@ public abstract class AbstractResidence extends ListenersContainer implements IN
*/ */
public ResidenceFunction getFunction(ResidenceFunctionType type) public ResidenceFunction getFunction(ResidenceFunctionType type)
{ {
for (ResidenceFunction func : _functions.values()) for (ResidenceFunction function : _functions.values())
{ {
if (func.getType() == type) if (function.getType() == type)
{ {
return func; return function;
} }
} }
return null; return null;

View File

@@ -253,7 +253,15 @@ public abstract class AbstractResidence extends ListenersContainer implements IN
*/ */
public boolean hasFunction(ResidenceFunctionType type) public boolean hasFunction(ResidenceFunctionType type)
{ {
return _functions.values().stream().map(ResidenceFunction::getTemplate).anyMatch(func -> func.getType() == type); for (ResidenceFunction function : _functions.values())
{
final ResidenceFunctionTemplate template = function.getTemplate();
if ((template != null) && (template.getType() == type))
{
return true;
}
}
return false;
} }
/** /**
@@ -262,11 +270,11 @@ public abstract class AbstractResidence extends ListenersContainer implements IN
*/ */
public ResidenceFunction getFunction(ResidenceFunctionType type) public ResidenceFunction getFunction(ResidenceFunctionType type)
{ {
for (ResidenceFunction func : _functions.values()) for (ResidenceFunction function : _functions.values())
{ {
if (func.getType() == type) if (function.getType() == type)
{ {
return func; return function;
} }
} }
return null; return null;

View File

@@ -253,7 +253,15 @@ public abstract class AbstractResidence extends ListenersContainer implements IN
*/ */
public boolean hasFunction(ResidenceFunctionType type) public boolean hasFunction(ResidenceFunctionType type)
{ {
return _functions.values().stream().map(ResidenceFunction::getTemplate).anyMatch(func -> func.getType() == type); for (ResidenceFunction function : _functions.values())
{
final ResidenceFunctionTemplate template = function.getTemplate();
if ((template != null) && (template.getType() == type))
{
return true;
}
}
return false;
} }
/** /**
@@ -262,11 +270,11 @@ public abstract class AbstractResidence extends ListenersContainer implements IN
*/ */
public ResidenceFunction getFunction(ResidenceFunctionType type) public ResidenceFunction getFunction(ResidenceFunctionType type)
{ {
for (ResidenceFunction func : _functions.values()) for (ResidenceFunction function : _functions.values())
{ {
if (func.getType() == type) if (function.getType() == type)
{ {
return func; return function;
} }
} }
return null; return null;

View File

@@ -253,7 +253,15 @@ public abstract class AbstractResidence extends ListenersContainer implements IN
*/ */
public boolean hasFunction(ResidenceFunctionType type) public boolean hasFunction(ResidenceFunctionType type)
{ {
return _functions.values().stream().map(ResidenceFunction::getTemplate).anyMatch(func -> func.getType() == type); for (ResidenceFunction function : _functions.values())
{
final ResidenceFunctionTemplate template = function.getTemplate();
if ((template != null) && (template.getType() == type))
{
return true;
}
}
return false;
} }
/** /**
@@ -262,11 +270,11 @@ public abstract class AbstractResidence extends ListenersContainer implements IN
*/ */
public ResidenceFunction getFunction(ResidenceFunctionType type) public ResidenceFunction getFunction(ResidenceFunctionType type)
{ {
for (ResidenceFunction func : _functions.values()) for (ResidenceFunction function : _functions.values())
{ {
if (func.getType() == type) if (function.getType() == type)
{ {
return func; return function;
} }
} }
return null; return null;

View File

@@ -253,7 +253,15 @@ public abstract class AbstractResidence extends ListenersContainer implements IN
*/ */
public boolean hasFunction(ResidenceFunctionType type) public boolean hasFunction(ResidenceFunctionType type)
{ {
return _functions.values().stream().map(ResidenceFunction::getTemplate).anyMatch(func -> func.getType() == type); for (ResidenceFunction function : _functions.values())
{
final ResidenceFunctionTemplate template = function.getTemplate();
if ((template != null) && (template.getType() == type))
{
return true;
}
}
return false;
} }
/** /**
@@ -262,11 +270,11 @@ public abstract class AbstractResidence extends ListenersContainer implements IN
*/ */
public ResidenceFunction getFunction(ResidenceFunctionType type) public ResidenceFunction getFunction(ResidenceFunctionType type)
{ {
for (ResidenceFunction func : _functions.values()) for (ResidenceFunction function : _functions.values())
{ {
if (func.getType() == type) if (function.getType() == type)
{ {
return func; return function;
} }
} }
return null; return null;

View File

@@ -253,7 +253,15 @@ public abstract class AbstractResidence extends ListenersContainer implements IN
*/ */
public boolean hasFunction(ResidenceFunctionType type) public boolean hasFunction(ResidenceFunctionType type)
{ {
return _functions.values().stream().map(ResidenceFunction::getTemplate).anyMatch(func -> func.getType() == type); for (ResidenceFunction function : _functions.values())
{
final ResidenceFunctionTemplate template = function.getTemplate();
if ((template != null) && (template.getType() == type))
{
return true;
}
}
return false;
} }
/** /**
@@ -262,11 +270,11 @@ public abstract class AbstractResidence extends ListenersContainer implements IN
*/ */
public ResidenceFunction getFunction(ResidenceFunctionType type) public ResidenceFunction getFunction(ResidenceFunctionType type)
{ {
for (ResidenceFunction func : _functions.values()) for (ResidenceFunction function : _functions.values())
{ {
if (func.getType() == type) if (function.getType() == type)
{ {
return func; return function;
} }
} }
return null; return null;

View File

@@ -253,7 +253,15 @@ public abstract class AbstractResidence extends ListenersContainer implements IN
*/ */
public boolean hasFunction(ResidenceFunctionType type) public boolean hasFunction(ResidenceFunctionType type)
{ {
return _functions.values().stream().map(ResidenceFunction::getTemplate).anyMatch(func -> func.getType() == type); for (ResidenceFunction function : _functions.values())
{
final ResidenceFunctionTemplate template = function.getTemplate();
if ((template != null) && (template.getType() == type))
{
return true;
}
}
return false;
} }
/** /**
@@ -262,11 +270,11 @@ public abstract class AbstractResidence extends ListenersContainer implements IN
*/ */
public ResidenceFunction getFunction(ResidenceFunctionType type) public ResidenceFunction getFunction(ResidenceFunctionType type)
{ {
for (ResidenceFunction func : _functions.values()) for (ResidenceFunction function : _functions.values())
{ {
if (func.getType() == type) if (function.getType() == type)
{ {
return func; return function;
} }
} }
return null; return null;

View File

@@ -253,7 +253,15 @@ public abstract class AbstractResidence extends ListenersContainer implements IN
*/ */
public boolean hasFunction(ResidenceFunctionType type) public boolean hasFunction(ResidenceFunctionType type)
{ {
return _functions.values().stream().map(ResidenceFunction::getTemplate).anyMatch(func -> func.getType() == type); for (ResidenceFunction function : _functions.values())
{
final ResidenceFunctionTemplate template = function.getTemplate();
if ((template != null) && (template.getType() == type))
{
return true;
}
}
return false;
} }
/** /**
@@ -262,11 +270,11 @@ public abstract class AbstractResidence extends ListenersContainer implements IN
*/ */
public ResidenceFunction getFunction(ResidenceFunctionType type) public ResidenceFunction getFunction(ResidenceFunctionType type)
{ {
for (ResidenceFunction func : _functions.values()) for (ResidenceFunction function : _functions.values())
{ {
if (func.getType() == type) if (function.getType() == type)
{ {
return func; return function;
} }
} }
return null; return null;

View File

@@ -253,7 +253,15 @@ public abstract class AbstractResidence extends ListenersContainer implements IN
*/ */
public boolean hasFunction(ResidenceFunctionType type) public boolean hasFunction(ResidenceFunctionType type)
{ {
return _functions.values().stream().map(ResidenceFunction::getTemplate).anyMatch(func -> func.getType() == type); for (ResidenceFunction function : _functions.values())
{
final ResidenceFunctionTemplate template = function.getTemplate();
if ((template != null) && (template.getType() == type))
{
return true;
}
}
return false;
} }
/** /**
@@ -262,11 +270,11 @@ public abstract class AbstractResidence extends ListenersContainer implements IN
*/ */
public ResidenceFunction getFunction(ResidenceFunctionType type) public ResidenceFunction getFunction(ResidenceFunctionType type)
{ {
for (ResidenceFunction func : _functions.values()) for (ResidenceFunction function : _functions.values())
{ {
if (func.getType() == type) if (function.getType() == type)
{ {
return func; return function;
} }
} }
return null; return null;

View File

@@ -253,7 +253,15 @@ public abstract class AbstractResidence extends ListenersContainer implements IN
*/ */
public boolean hasFunction(ResidenceFunctionType type) public boolean hasFunction(ResidenceFunctionType type)
{ {
return _functions.values().stream().map(ResidenceFunction::getTemplate).anyMatch(func -> func.getType() == type); for (ResidenceFunction function : _functions.values())
{
final ResidenceFunctionTemplate template = function.getTemplate();
if ((template != null) && (template.getType() == type))
{
return true;
}
}
return false;
} }
/** /**
@@ -262,11 +270,11 @@ public abstract class AbstractResidence extends ListenersContainer implements IN
*/ */
public ResidenceFunction getFunction(ResidenceFunctionType type) public ResidenceFunction getFunction(ResidenceFunctionType type)
{ {
for (ResidenceFunction func : _functions.values()) for (ResidenceFunction function : _functions.values())
{ {
if (func.getType() == type) if (function.getType() == type)
{ {
return func; return function;
} }
} }
return null; return null;

View File

@@ -253,7 +253,15 @@ public abstract class AbstractResidence extends ListenersContainer implements IN
*/ */
public boolean hasFunction(ResidenceFunctionType type) public boolean hasFunction(ResidenceFunctionType type)
{ {
return _functions.values().stream().map(ResidenceFunction::getTemplate).anyMatch(func -> func.getType() == type); for (ResidenceFunction function : _functions.values())
{
final ResidenceFunctionTemplate template = function.getTemplate();
if ((template != null) && (template.getType() == type))
{
return true;
}
}
return false;
} }
/** /**
@@ -262,11 +270,11 @@ public abstract class AbstractResidence extends ListenersContainer implements IN
*/ */
public ResidenceFunction getFunction(ResidenceFunctionType type) public ResidenceFunction getFunction(ResidenceFunctionType type)
{ {
for (ResidenceFunction func : _functions.values()) for (ResidenceFunction function : _functions.values())
{ {
if (func.getType() == type) if (function.getType() == type)
{ {
return func; return function;
} }
} }
return null; return null;

View File

@@ -253,7 +253,15 @@ public abstract class AbstractResidence extends ListenersContainer implements IN
*/ */
public boolean hasFunction(ResidenceFunctionType type) public boolean hasFunction(ResidenceFunctionType type)
{ {
return _functions.values().stream().map(ResidenceFunction::getTemplate).anyMatch(func -> func.getType() == type); for (ResidenceFunction function : _functions.values())
{
final ResidenceFunctionTemplate template = function.getTemplate();
if ((template != null) && (template.getType() == type))
{
return true;
}
}
return false;
} }
/** /**
@@ -262,11 +270,11 @@ public abstract class AbstractResidence extends ListenersContainer implements IN
*/ */
public ResidenceFunction getFunction(ResidenceFunctionType type) public ResidenceFunction getFunction(ResidenceFunctionType type)
{ {
for (ResidenceFunction func : _functions.values()) for (ResidenceFunction function : _functions.values())
{ {
if (func.getType() == type) if (function.getType() == type)
{ {
return func; return function;
} }
} }
return null; return null;

View File

@@ -253,7 +253,15 @@ public abstract class AbstractResidence extends ListenersContainer implements IN
*/ */
public boolean hasFunction(ResidenceFunctionType type) public boolean hasFunction(ResidenceFunctionType type)
{ {
return _functions.values().stream().map(ResidenceFunction::getTemplate).anyMatch(func -> func.getType() == type); for (ResidenceFunction function : _functions.values())
{
final ResidenceFunctionTemplate template = function.getTemplate();
if ((template != null) && (template.getType() == type))
{
return true;
}
}
return false;
} }
/** /**
@@ -262,11 +270,11 @@ public abstract class AbstractResidence extends ListenersContainer implements IN
*/ */
public ResidenceFunction getFunction(ResidenceFunctionType type) public ResidenceFunction getFunction(ResidenceFunctionType type)
{ {
for (ResidenceFunction func : _functions.values()) for (ResidenceFunction function : _functions.values())
{ {
if (func.getType() == type) if (function.getType() == type)
{ {
return func; return function;
} }
} }
return null; return null;