mirror of
https://github.com/Rogiel/l2jserver2
synced 2025-12-06 07:32:46 +00:00
Adds missing orientdb assembly descriptor
This commit is contained in:
@@ -217,6 +217,10 @@ public abstract class AbstractOrientDatabaseService extends AbstractService
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// database.getStorage().addUser();
|
||||||
|
database.getLevel1Cache().setEnable(false);
|
||||||
|
database.getLevel2Cache().setEnable(false);
|
||||||
|
|
||||||
database.close();
|
database.close();
|
||||||
|
|
||||||
// check if automatic schema update is enabled
|
// check if automatic schema update is enabled
|
||||||
@@ -349,7 +353,6 @@ public abstract class AbstractOrientDatabaseService extends AbstractService
|
|||||||
final ODatabaseDocumentTx database = ODatabaseDocumentPool.global()
|
final ODatabaseDocumentTx database = ODatabaseDocumentPool.global()
|
||||||
.acquire(config.getUrl(), config.getUsername(),
|
.acquire(config.getUrl(), config.getUsername(),
|
||||||
config.getPassword());
|
config.getPassword());
|
||||||
|
|
||||||
log.info("Updating {} schema definition", table);
|
log.info("Updating {} schema definition", table);
|
||||||
|
|
||||||
boolean newSchema = false;
|
boolean newSchema = false;
|
||||||
@@ -490,7 +493,6 @@ public abstract class AbstractOrientDatabaseService extends AbstractService
|
|||||||
extends AbstractQuery<Integer> {
|
extends AbstractQuery<Integer> {
|
||||||
private final InsertMapper<O, RI, I, E> mapper;
|
private final InsertMapper<O, RI, I, E> mapper;
|
||||||
private final Iterator<O> iterator;
|
private final Iterator<O> iterator;
|
||||||
@SuppressWarnings("unused")
|
|
||||||
private final Path<RI> primaryKey;
|
private final Path<RI> primaryKey;
|
||||||
|
|
||||||
protected final E e;
|
protected final E e;
|
||||||
@@ -559,6 +561,7 @@ public abstract class AbstractOrientDatabaseService extends AbstractService
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
public final Integer query(ODatabaseDocumentTx database,
|
public final Integer query(ODatabaseDocumentTx database,
|
||||||
DatabaseService service) {
|
DatabaseService service) {
|
||||||
int rows = 0;
|
int rows = 0;
|
||||||
@@ -569,8 +572,14 @@ public abstract class AbstractOrientDatabaseService extends AbstractService
|
|||||||
|
|
||||||
mapper.insert(e, object, row);
|
mapper.insert(e, object, row);
|
||||||
|
|
||||||
// TODO generate unique id
|
|
||||||
row.getDocument().save();
|
row.getDocument().save();
|
||||||
|
if (primaryKey != null && object instanceof Model) {
|
||||||
|
final Long rawID = row.getDocument().getIdentity()
|
||||||
|
.getClusterPosition();
|
||||||
|
final ID<? super RI> id = mapper.getPrimaryKeyMapper()
|
||||||
|
.createID((RI) rawID);
|
||||||
|
((Model<ID<? super RI>>) object).setID(id);
|
||||||
|
}
|
||||||
rows++;
|
rows++;
|
||||||
|
|
||||||
updateDesire(object, ObjectDesire.INSERT);
|
updateDesire(object, ObjectDesire.INSERT);
|
||||||
|
|||||||
@@ -116,7 +116,7 @@ public class QPathUtils {
|
|||||||
return false;
|
return false;
|
||||||
final ColumnNullable nullable = field
|
final ColumnNullable nullable = field
|
||||||
.getAnnotation(ColumnNullable.class);
|
.getAnnotation(ColumnNullable.class);
|
||||||
if (nullable == null) {
|
if (nullable != null) {
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -21,6 +21,7 @@
|
|||||||
<configuration>
|
<configuration>
|
||||||
<descriptors>
|
<descriptors>
|
||||||
<descriptor>src/main/assembly/distribution-mysql5-bin.xml</descriptor>
|
<descriptor>src/main/assembly/distribution-mysql5-bin.xml</descriptor>
|
||||||
|
<descriptor>src/main/assembly/distribution-orientdb-bin.xml</descriptor>
|
||||||
<descriptor>src/main/assembly/distribution-h2-bin.xml</descriptor>
|
<descriptor>src/main/assembly/distribution-h2-bin.xml</descriptor>
|
||||||
<descriptor>src/main/assembly/distribution-derby-bin.xml</descriptor>
|
<descriptor>src/main/assembly/distribution-derby-bin.xml</descriptor>
|
||||||
<descriptor>src/main/assembly/distribution-src.xml</descriptor>
|
<descriptor>src/main/assembly/distribution-src.xml</descriptor>
|
||||||
|
|||||||
@@ -18,8 +18,7 @@
|
|||||||
<exclude>.gitignore</exclude>
|
<exclude>.gitignore</exclude>
|
||||||
<exclude>data/cache/**</exclude>
|
<exclude>data/cache/**</exclude>
|
||||||
<exclude>data/pathing.db</exclude>
|
<exclude>data/pathing.db</exclude>
|
||||||
<exclude>data/database/h2/**</exclude>
|
<exclude>data/database/**</exclude>
|
||||||
<exclude>data/database/orientdb/**</exclude>
|
|
||||||
</excludes>
|
</excludes>
|
||||||
</fileSet>
|
</fileSet>
|
||||||
<fileSet>
|
<fileSet>
|
||||||
@@ -44,6 +43,7 @@
|
|||||||
<excludes>
|
<excludes>
|
||||||
<exclude>mysql:*</exclude>
|
<exclude>mysql:*</exclude>
|
||||||
<exclude>com.h2database:*</exclude>
|
<exclude>com.h2database:*</exclude>
|
||||||
|
<exclude>com.orientechnologies:*</exclude>
|
||||||
</excludes>
|
</excludes>
|
||||||
</dependencySet>
|
</dependencySet>
|
||||||
</dependencySets>
|
</dependencySets>
|
||||||
|
|||||||
@@ -18,8 +18,7 @@
|
|||||||
<exclude>.gitignore</exclude>
|
<exclude>.gitignore</exclude>
|
||||||
<exclude>data/cache/**</exclude>
|
<exclude>data/cache/**</exclude>
|
||||||
<exclude>data/pathing.db</exclude>
|
<exclude>data/pathing.db</exclude>
|
||||||
<exclude>data/database/derby/**</exclude>
|
<exclude>data/database/**</exclude>
|
||||||
<exclude>data/database/orientdb/**</exclude>
|
|
||||||
</excludes>
|
</excludes>
|
||||||
</fileSet>
|
</fileSet>
|
||||||
<fileSet>
|
<fileSet>
|
||||||
@@ -44,6 +43,7 @@
|
|||||||
<excludes>
|
<excludes>
|
||||||
<exclude>mysql:*</exclude>
|
<exclude>mysql:*</exclude>
|
||||||
<exclude>org.apache.derby:*</exclude>
|
<exclude>org.apache.derby:*</exclude>
|
||||||
|
<exclude>com.orientechnologies:*</exclude>
|
||||||
</excludes>
|
</excludes>
|
||||||
</dependencySet>
|
</dependencySet>
|
||||||
</dependencySets>
|
</dependencySets>
|
||||||
|
|||||||
@@ -43,6 +43,7 @@
|
|||||||
<excludes>
|
<excludes>
|
||||||
<exclude>com.h2database:*</exclude>
|
<exclude>com.h2database:*</exclude>
|
||||||
<exclude>org.apache.derby:*</exclude>
|
<exclude>org.apache.derby:*</exclude>
|
||||||
|
<exclude>com.orientechnologies:*</exclude>
|
||||||
</excludes>
|
</excludes>
|
||||||
</dependencySet>
|
</dependencySet>
|
||||||
</dependencySets>
|
</dependencySets>
|
||||||
|
|||||||
@@ -0,0 +1,50 @@
|
|||||||
|
<assembly
|
||||||
|
xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.0 http://maven.apache.org/xsd/assembly-1.1.0.xsd">
|
||||||
|
<id>orientdb-bin</id>
|
||||||
|
<formats>
|
||||||
|
<format>zip</format>
|
||||||
|
</formats>
|
||||||
|
<baseDirectory></baseDirectory>
|
||||||
|
<fileSets>
|
||||||
|
<fileSet>
|
||||||
|
<directory>${project.basedir}</directory>
|
||||||
|
<outputDirectory>/</outputDirectory>
|
||||||
|
<includes>
|
||||||
|
<include>data/**</include>
|
||||||
|
</includes>
|
||||||
|
<excludes>
|
||||||
|
<exclude>.gitignore</exclude>
|
||||||
|
<exclude>data/cache/**</exclude>
|
||||||
|
<exclude>data/pathing.db</exclude>
|
||||||
|
<exclude>data/database/**</exclude>
|
||||||
|
</excludes>
|
||||||
|
</fileSet>
|
||||||
|
<fileSet>
|
||||||
|
<directory>${project.basedir}/distribution/global</directory>
|
||||||
|
<outputDirectory>/</outputDirectory>
|
||||||
|
</fileSet>
|
||||||
|
</fileSets>
|
||||||
|
<files>
|
||||||
|
<file>
|
||||||
|
<source>${project.build.directory}/${project.artifactId}-${project.version}.jar</source>
|
||||||
|
<outputDirectory>/</outputDirectory>
|
||||||
|
<destName>l2jserver2.jar</destName>
|
||||||
|
<fileMode>0755</fileMode>
|
||||||
|
</file>
|
||||||
|
</files>
|
||||||
|
<dependencySets>
|
||||||
|
<dependencySet>
|
||||||
|
<outputDirectory>/libs</outputDirectory>
|
||||||
|
<useProjectArtifact>true</useProjectArtifact>
|
||||||
|
<unpack>false</unpack>
|
||||||
|
<scope>runtime</scope>
|
||||||
|
<excludes>
|
||||||
|
<exclude>mysql:*</exclude>
|
||||||
|
<exclude>com.h2database:*</exclude>
|
||||||
|
<exclude>org.apache.derby:*</exclude>
|
||||||
|
</excludes>
|
||||||
|
</dependencySet>
|
||||||
|
</dependencySets>
|
||||||
|
</assembly>
|
||||||
@@ -16,7 +16,7 @@
|
|||||||
*/
|
*/
|
||||||
package com.l2jserver.model.template;
|
package com.l2jserver.model.template;
|
||||||
|
|
||||||
import java.util.Collections;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import javax.xml.bind.annotation.XmlAccessType;
|
import javax.xml.bind.annotation.XmlAccessType;
|
||||||
@@ -33,7 +33,6 @@ import com.l2jserver.model.id.object.ActorID;
|
|||||||
import com.l2jserver.model.id.template.SkillTemplateID;
|
import com.l2jserver.model.id.template.SkillTemplateID;
|
||||||
import com.l2jserver.model.template.effect.EffectTemplate;
|
import com.l2jserver.model.template.effect.EffectTemplate;
|
||||||
import com.l2jserver.model.template.effect.TeleportEffectTemplate;
|
import com.l2jserver.model.template.effect.TeleportEffectTemplate;
|
||||||
import com.l2jserver.util.factory.CollectionFactory;
|
|
||||||
import com.l2jserver.util.jaxb.SkillTemplateIDAdapter;
|
import com.l2jserver.util.jaxb.SkillTemplateIDAdapter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -61,7 +60,7 @@ public class SkillTemplate extends AbstractTemplate {
|
|||||||
protected int maximumLevel = 1;
|
protected int maximumLevel = 1;
|
||||||
|
|
||||||
@XmlElements({ @XmlElement(name = "teleport", type = TeleportEffectTemplate.class) })
|
@XmlElements({ @XmlElement(name = "teleport", type = TeleportEffectTemplate.class) })
|
||||||
protected List<EffectTemplate> effects = CollectionFactory.newList();
|
protected EffectTemplate[] effects;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new {@link Skill}
|
* Create a new {@link Skill}
|
||||||
@@ -127,7 +126,7 @@ public class SkillTemplate extends AbstractTemplate {
|
|||||||
* @return the effects
|
* @return the effects
|
||||||
*/
|
*/
|
||||||
public List<EffectTemplate> getEffects() {
|
public List<EffectTemplate> getEffects() {
|
||||||
return Collections.unmodifiableList(effects);
|
return Arrays.asList(effects);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -207,7 +207,7 @@ public class NPCStats extends ActorStats<NPCCalculatorContext> {
|
|||||||
/**
|
/**
|
||||||
* The NPC calculator
|
* The NPC calculator
|
||||||
*/
|
*/
|
||||||
private static final NPCCalculator calculator = new NPCCalculator();
|
private final NPCCalculator calculator = new NPCCalculator();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new {@link NPCStats} and adds default calculators
|
* Creates a new {@link NPCStats} and adds default calculators
|
||||||
|
|||||||
@@ -87,17 +87,17 @@ public class ChatMessageMapper extends
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void insert(QLogChat e, ChatMessage onject, WritableDatabaseRow row) {
|
public void insert(QLogChat e, ChatMessage object, WritableDatabaseRow row) {
|
||||||
row.set(e.type, onject.getType())
|
row.set(e.type, object.getType())
|
||||||
.set(e.sender, onject.getSender().getID())
|
.set(e.sender, object.getSender().getID())
|
||||||
.set(e.date, onject.getDate())
|
.set(e.date, object.getDate())
|
||||||
.set(e.message, onject.getMessage());
|
.set(e.message, object.getMessage());
|
||||||
switch (onject.getType()) {
|
switch (object.getType()) {
|
||||||
case SHOUT:
|
case SHOUT:
|
||||||
row.set(e.channelId, onject.getTarget().getID());
|
row.set(e.channelId, object.getTarget().getID());
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
row.set(e.channelId, onject.getChannelID());
|
row.set(e.channelId, object.getChannelID());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,13 +17,12 @@
|
|||||||
package com.l2jserver.util.calculator;
|
package com.l2jserver.util.calculator;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.Collections;
|
import java.util.Arrays;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
import java.util.EnumMap;
|
import java.util.EnumMap;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
|
|
||||||
import com.l2jserver.util.factory.CollectionFactory;
|
import org.apache.commons.lang3.ArrayUtils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An calculator is used to compute data and outputs its result. Note also, that
|
* An calculator is used to compute data and outputs its result. Note also, that
|
||||||
@@ -41,7 +40,7 @@ public class ComplexCalculator<T extends CalculatorContext, V extends Enum<V>>
|
|||||||
/**
|
/**
|
||||||
* List of operations in this calculator
|
* List of operations in this calculator
|
||||||
*/
|
*/
|
||||||
private EnumMap<V, List<Function<T, V>>> functions;
|
private EnumMap<V, Function<T, V>[]> functions;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a new empty calculator. Functions can be add using
|
* Creates a new empty calculator. Functions can be add using
|
||||||
@@ -52,7 +51,7 @@ public class ComplexCalculator<T extends CalculatorContext, V extends Enum<V>>
|
|||||||
*/
|
*/
|
||||||
public ComplexCalculator(Class<V> type) {
|
public ComplexCalculator(Class<V> type) {
|
||||||
super(0x00, null);
|
super(0x00, null);
|
||||||
functions = new EnumMap<V, List<Function<T, V>>>(type);
|
functions = new EnumMap<V, Function<T, V>[]>(type);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -84,7 +83,7 @@ public class ComplexCalculator<T extends CalculatorContext, V extends Enum<V>>
|
|||||||
@SafeVarargs
|
@SafeVarargs
|
||||||
public ComplexCalculator(V value, Function<T, V>... functions) {
|
public ComplexCalculator(V value, Function<T, V>... functions) {
|
||||||
super(0x00, value);
|
super(0x00, value);
|
||||||
this.functions = new EnumMap<V, List<Function<T, V>>>(
|
this.functions = new EnumMap<V, Function<T, V>[]>(
|
||||||
value.getDeclaringClass());
|
value.getDeclaringClass());
|
||||||
add(functions);
|
add(functions);
|
||||||
}
|
}
|
||||||
@@ -103,10 +102,13 @@ public class ComplexCalculator<T extends CalculatorContext, V extends Enum<V>>
|
|||||||
this(type);
|
this(type);
|
||||||
add(functions);
|
add(functions);
|
||||||
for (final Function<T, V> func : functions) {
|
for (final Function<T, V> func : functions) {
|
||||||
getList(func.type()).add(func);
|
Function<T, V>[] funcs = getList(func.type());
|
||||||
|
funcs = Arrays.copyOf(funcs, funcs.length + 1);
|
||||||
|
funcs[funcs.length - 1] = func;
|
||||||
|
setList(func.type(), funcs);
|
||||||
}
|
}
|
||||||
for (final List<Function<T, V>> funcs : this.functions.values()) {
|
for (final Function<T, V>[] funcs : this.functions.values()) {
|
||||||
Collections.sort(funcs, FunctionOrderComparator.SHARED_INSTANCE);
|
Arrays.sort(funcs, FunctionOrderComparator.SHARED_INSTANCE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -120,10 +122,11 @@ public class ComplexCalculator<T extends CalculatorContext, V extends Enum<V>>
|
|||||||
* the operation
|
* the operation
|
||||||
*/
|
*/
|
||||||
public void add(Function<T, V> function) {
|
public void add(Function<T, V> function) {
|
||||||
getList(function.type()).add(function);
|
Function<T, V>[] funcs = getList(function.type());
|
||||||
for (final List<Function<T, V>> funcs : functions.values()) {
|
funcs = Arrays.copyOf(funcs, funcs.length + 1);
|
||||||
Collections.sort(funcs, FunctionOrderComparator.SHARED_INSTANCE);
|
funcs[funcs.length - 1] = function;
|
||||||
}
|
setList(function.type(), funcs);
|
||||||
|
Arrays.sort(funcs, FunctionOrderComparator.SHARED_INSTANCE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -138,7 +141,10 @@ public class ComplexCalculator<T extends CalculatorContext, V extends Enum<V>>
|
|||||||
@SafeVarargs
|
@SafeVarargs
|
||||||
public final void add(Function<T, V>... functions) {
|
public final void add(Function<T, V>... functions) {
|
||||||
for (final Function<T, V> func : functions) {
|
for (final Function<T, V> func : functions) {
|
||||||
getList(func.type()).add(func);
|
Function<T, V>[] funcs = getList(func.type());
|
||||||
|
funcs = Arrays.copyOf(funcs, funcs.length + 1);
|
||||||
|
funcs[funcs.length - 1] = func;
|
||||||
|
setList(func.type(), funcs);
|
||||||
}
|
}
|
||||||
sort();
|
sort();
|
||||||
}
|
}
|
||||||
@@ -155,7 +161,10 @@ public class ComplexCalculator<T extends CalculatorContext, V extends Enum<V>>
|
|||||||
@SafeVarargs
|
@SafeVarargs
|
||||||
public final void addNoSort(Function<T, V>... functions) {
|
public final void addNoSort(Function<T, V>... functions) {
|
||||||
for (final Function<T, V> func : functions) {
|
for (final Function<T, V> func : functions) {
|
||||||
getList(func.type()).add(func);
|
Function<T, V>[] funcs = getList(func.type());
|
||||||
|
funcs = Arrays.copyOf(funcs, funcs.length + 1);
|
||||||
|
funcs[funcs.length - 1] = func;
|
||||||
|
setList(func.type(), funcs);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -166,15 +175,22 @@ public class ComplexCalculator<T extends CalculatorContext, V extends Enum<V>>
|
|||||||
* the operation
|
* the operation
|
||||||
*/
|
*/
|
||||||
public void remove(Function<T, V> function) {
|
public void remove(Function<T, V> function) {
|
||||||
getList(function.type()).remove(function);
|
Function<T, V>[] funcs = getList(function.type());
|
||||||
|
int index = Arrays.binarySearch(funcs, function);
|
||||||
|
if (index >= 0) {
|
||||||
|
funcs = ArrayUtils.remove(funcs, index);
|
||||||
|
}
|
||||||
|
setList(function.type(), funcs);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Removes all functions from <code>type</code>
|
* Removes all functions from <code>type</code>
|
||||||
* @param type the type
|
*
|
||||||
|
* @param type
|
||||||
|
* the type
|
||||||
*/
|
*/
|
||||||
public void remove(V type) {
|
public void remove(V type) {
|
||||||
getList(type).clear();
|
setList(type, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -199,7 +215,7 @@ public class ComplexCalculator<T extends CalculatorContext, V extends Enum<V>>
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (calculator instanceof ComplexCalculator) {
|
} else if (calculator instanceof ComplexCalculator) {
|
||||||
for (final Entry<V, List<Function<T, V>>> e : ((ComplexCalculator<T, V>) calculator).functions
|
for (final Entry<V, Function<T, V>[]> e : ((ComplexCalculator<T, V>) calculator).functions
|
||||||
.entrySet()) {
|
.entrySet()) {
|
||||||
for (final Function<T, V> function : e.getValue()) {
|
for (final Function<T, V> function : e.getValue()) {
|
||||||
if (function instanceof Calculator) {
|
if (function instanceof Calculator) {
|
||||||
@@ -233,7 +249,7 @@ public class ComplexCalculator<T extends CalculatorContext, V extends Enum<V>>
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (calculator instanceof ComplexCalculator) {
|
} else if (calculator instanceof ComplexCalculator) {
|
||||||
for (final Entry<V, List<Function<T, V>>> e : ((ComplexCalculator<T, V>) calculator).functions
|
for (final Entry<V, Function<T, V>[]> e : ((ComplexCalculator<T, V>) calculator).functions
|
||||||
.entrySet()) {
|
.entrySet()) {
|
||||||
for (final Function<T, V> function : e.getValue()) {
|
for (final Function<T, V> function : e.getValue()) {
|
||||||
if (function instanceof Calculator) {
|
if (function instanceof Calculator) {
|
||||||
@@ -248,8 +264,8 @@ public class ComplexCalculator<T extends CalculatorContext, V extends Enum<V>>
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void sort() {
|
public void sort() {
|
||||||
for (final List<Function<T, V>> funcs : functions.values()) {
|
for (final Function<T, V>[] funcs : functions.values()) {
|
||||||
Collections.sort(funcs, FunctionOrderComparator.SHARED_INSTANCE);
|
Arrays.sort(funcs, FunctionOrderComparator.SHARED_INSTANCE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -275,15 +291,20 @@ public class ComplexCalculator<T extends CalculatorContext, V extends Enum<V>>
|
|||||||
return calculate(v, ctx, 0);
|
return calculate(v, ctx, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<Function<T, V>> getList(V value) {
|
@SuppressWarnings("unchecked")
|
||||||
List<Function<T, V>> list = functions.get(value);
|
private Function<T, V>[] getList(V value) {
|
||||||
|
Function<T, V>[] list = functions.get(value);
|
||||||
if (list == null) {
|
if (list == null) {
|
||||||
list = CollectionFactory.newList();
|
list = new Function[0];
|
||||||
functions.put(value, list);
|
functions.put(value, list);
|
||||||
}
|
}
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void setList(V value, Function<T, V>[] func) {
|
||||||
|
functions.put(value, func);
|
||||||
|
}
|
||||||
|
|
||||||
public static class FunctionOrderComparator implements
|
public static class FunctionOrderComparator implements
|
||||||
Comparator<Function<?, ?>>, Serializable {
|
Comparator<Function<?, ?>>, Serializable {
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|||||||
@@ -54,6 +54,7 @@ public class MySQL5CharacterDAOTest {
|
|||||||
injector.getInstance(ServiceManager.class).start(WorldService.class);
|
injector.getInstance(ServiceManager.class).start(WorldService.class);
|
||||||
|
|
||||||
final CharacterDAO dao = injector.getInstance(CharacterDAO.class);
|
final CharacterDAO dao = injector.getInstance(CharacterDAO.class);
|
||||||
|
|
||||||
final L2Character char1 = dao.select(injector.getInstance(
|
final L2Character char1 = dao.select(injector.getInstance(
|
||||||
CharacterIDProvider.class).resolveID(268437456));
|
CharacterIDProvider.class).resolveID(268437456));
|
||||||
final L2Character char2 = dao.select(injector.getInstance(
|
final L2Character char2 = dao.select(injector.getInstance(
|
||||||
|
|||||||
Reference in New Issue
Block a user