1
0
mirror of https://github.com/Rogiel/l2jserver2 synced 2025-12-06 07:32:46 +00:00

Javadoc fixes and fixes missing dependency ChatMessageIDProvider in

IDProviderModule

Signed-off-by: Rogiel <rogiel@rogiel.com>
This commit is contained in:
2011-07-30 21:36:45 -03:00
parent 9b25d29192
commit 17fb84faab
23 changed files with 102 additions and 19 deletions

View File

@@ -83,7 +83,6 @@ public interface Model<T extends ID<?>> {
* database exception will occur.
*/
INSERT,
/**
* Updates the object in the database.
* <p>

View File

@@ -18,10 +18,14 @@ package com.l2jserver.model.id;
import com.google.inject.Inject;
import com.google.inject.assistedinject.Assisted;
import com.l2jserver.model.id.provider.IDProvider;
/**
* Each account is identified by its {@link ID}. This {@link ID} is equal to the
* account username or login.
* <p>
* Please, do not directly instantiate this class, use an {@link IDProvider}
* instead.
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/

View File

@@ -18,9 +18,13 @@ package com.l2jserver.model.id;
import com.google.inject.Inject;
import com.google.inject.assistedinject.Assisted;
import com.l2jserver.model.id.provider.IDProvider;
/**
* Each {@link Castle} is identified by an {@link ID}.
* <p>
* Please, do not directly instantiate this class, use an {@link IDProvider}
* instead.
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/

View File

@@ -18,10 +18,14 @@ package com.l2jserver.model.id;
import com.google.inject.Inject;
import com.google.inject.assistedinject.Assisted;
import com.l2jserver.model.id.provider.IDProvider;
import com.l2jserver.model.server.ChatMessage;
/**
* Each {@link ChatMessage} log entry is identified by an {@link ID}.
* <p>
* Please, do not directly instantiate this class, use an {@link IDProvider}
* instead.
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/

View File

@@ -19,9 +19,13 @@ package com.l2jserver.model.id;
import com.google.inject.Inject;
import com.google.inject.assistedinject.Assisted;
import com.l2jserver.model.game.Fort;
import com.l2jserver.model.id.provider.IDProvider;
/**
* Each {@link Fort} is identified by an {@link ID}.
* <p>
* Please, do not directly instantiate this class, use an {@link IDProvider}
* instead.
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/

View File

@@ -21,9 +21,13 @@ import com.google.inject.assistedinject.Assisted;
import com.l2jserver.model.game.CharacterFriend;
import com.l2jserver.model.id.compound.AbstractCompoundID;
import com.l2jserver.model.id.object.CharacterID;
import com.l2jserver.model.id.provider.IDProvider;
/**
* Each {@link CharacterFriend} is identified by an {@link ID}.
* <p>
* Please, do not directly instantiate this class, use an {@link IDProvider}
* instead.
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/

View File

@@ -25,6 +25,9 @@ import com.l2jserver.model.world.WorldObject;
* an {@link IDProvider}. The {@link ObjectID} provides a facility
* {@link #getObject() method} that allows easily fetch this object from
* database without the need to directly use DAOs.
* <p>
* Please, do not directly instantiate this class, use an {@link IDProvider}
* instead.
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
*

View File

@@ -22,10 +22,14 @@ import com.l2jserver.model.game.Shortcut;
import com.l2jserver.model.id.compound.AbstractCompoundID;
import com.l2jserver.model.id.object.CharacterID;
import com.l2jserver.model.id.object.ItemID;
import com.l2jserver.model.id.provider.IDProvider;
import com.l2jserver.model.id.template.SkillTemplateID;
/**
* Each {@link Shortcut} is identified by an {@link ID}.
* <p>
* Please, do not directly instantiate this class, use an {@link IDProvider}
* instead.
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/

View File

@@ -21,10 +21,14 @@ import com.google.inject.assistedinject.Assisted;
import com.l2jserver.model.game.CharacterFriend;
import com.l2jserver.model.id.compound.AbstractCompoundID;
import com.l2jserver.model.id.object.ActorID;
import com.l2jserver.model.id.provider.IDProvider;
import com.l2jserver.model.id.template.SkillTemplateID;
/**
* Each {@link CharacterFriend} is identified by an {@link ID}.
* <p>
* Please, do not directly instantiate this class, use an {@link IDProvider}
* instead.
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/

View File

@@ -19,11 +19,15 @@ package com.l2jserver.model.id;
import java.lang.ref.Reference;
import java.lang.ref.SoftReference;
import com.l2jserver.model.id.provider.IDProvider;
import com.l2jserver.model.template.Template;
/**
* Templates IDs, different from {@link ObjectID}s, can be repeated and are
* defined in the template class.
* <p>
* Please, do not directly instantiate this class, use an {@link IDProvider}
* instead.
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/

View File

@@ -19,10 +19,14 @@ package com.l2jserver.model.id.object;
import com.google.inject.Inject;
import com.google.inject.assistedinject.Assisted;
import com.l2jserver.model.id.ObjectID;
import com.l2jserver.model.id.provider.IDProvider;
import com.l2jserver.model.world.Actor;
/**
* An {@link ObjectID} instance representing an {@link Actor} object
* <p>
* Please, do not directly instantiate this class, use an {@link IDProvider}
* instead.
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
* @param <T>

View File

@@ -20,10 +20,14 @@ import com.google.inject.Inject;
import com.google.inject.assistedinject.Assisted;
import com.l2jserver.db.dao.CharacterDAO;
import com.l2jserver.model.id.ObjectID;
import com.l2jserver.model.id.provider.IDProvider;
import com.l2jserver.model.world.L2Character;
/**
* An {@link ObjectID} instance representing an {@link L2Character} object
* <p>
* Please, do not directly instantiate this class, use an {@link IDProvider}
* instead.
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/

View File

@@ -20,10 +20,14 @@ import com.google.inject.Inject;
import com.google.inject.assistedinject.Assisted;
import com.l2jserver.db.dao.ClanDAO;
import com.l2jserver.model.id.ObjectID;
import com.l2jserver.model.id.provider.IDProvider;
import com.l2jserver.model.world.Clan;
/**
* An {@link ObjectID} instance representing an {@link Clan} object
* <p>
* Please, do not directly instantiate this class, use an {@link IDProvider}
* instead.
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/

View File

@@ -20,10 +20,14 @@ import com.google.inject.Inject;
import com.google.inject.assistedinject.Assisted;
import com.l2jserver.db.dao.ItemDAO;
import com.l2jserver.model.id.ObjectID;
import com.l2jserver.model.id.provider.IDProvider;
import com.l2jserver.model.world.Item;
/**
* An {@link ObjectID} instance representing an {@link Item} object
* <p>
* Please, do not directly instantiate this class, use an {@link IDProvider}
* instead.
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/

View File

@@ -19,6 +19,7 @@ package com.l2jserver.model.id.object;
import com.google.inject.Inject;
import com.google.inject.assistedinject.Assisted;
import com.l2jserver.model.id.ObjectID;
import com.l2jserver.model.id.provider.IDProvider;
import com.l2jserver.model.world.NPC;
import com.l2jserver.service.database.DataAccessObject;
import com.l2jserver.service.game.world.WorldService;
@@ -27,6 +28,9 @@ import com.l2jserver.service.game.world.WorldService;
* An {@link ObjectID} instance representing an {@link NPC} object. Since NPC
* instances are stores in run-time only, the search is performed in the
* {@link WorldService} instead of using a {@link DataAccessObject}.
* <p>
* Please, do not directly instantiate this class, use an {@link IDProvider}
* instead.
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/

View File

@@ -19,10 +19,14 @@ package com.l2jserver.model.id.object;
import com.google.inject.Inject;
import com.l2jserver.db.dao.PetDAO;
import com.l2jserver.model.id.ObjectID;
import com.l2jserver.model.id.provider.IDProvider;
import com.l2jserver.model.world.Pet;
/**
* An {@link ObjectID} instance representing an {@link Pet} object
* <p>
* Please, do not directly instantiate this class, use an {@link IDProvider}
* instead.
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/

View File

@@ -19,8 +19,17 @@ package com.l2jserver.model.id.provider;
import com.l2jserver.model.id.ID;
/**
* The ID factory is used to create instances of IDs. It will automatically make
* sure the ID is free before allocating it.
* ID objects should never be directly instantiated and an provider
* implementation must be used to create and generate them.
* <p>
*
* The ID provider is used to create instances of IDs. It will automatically
* make sure the ID is free before allocating it.
* <p>
* The provider will also make sure only a single instance for each raw ID
* exits, that is for any given ID instance for raw value <b>1</b> only a single
* object will be created and following calls will always return the same
* object.
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/

View File

@@ -70,6 +70,7 @@ public class IDProviderModule extends AbstractModule {
install(new FactoryModuleBuilder().build(AccountIDProvider.class));
install(new FactoryModuleBuilder().build(FortIDProvider.class));
install(new FactoryModuleBuilder().build(FriendIDProvider.class));
install(new FactoryModuleBuilder().build(ChatMessageIDProvider.class));
// TEMPLATE IDS
install(new FactoryModuleBuilder().build(ItemTemplateIDProvider.class));

View File

@@ -17,6 +17,7 @@
package com.l2jserver.service.game.clan;
import com.l2jserver.model.world.Clan;
import com.l2jserver.model.world.L2Character;
import com.l2jserver.service.Service;
/**
@@ -25,5 +26,7 @@ import com.l2jserver.service.Service;
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
public interface ClanService extends Service {
void join(Clan clan, L2Character character, L2Character inviter);
void leave(Clan clan, L2Character character);
}

View File

@@ -16,10 +16,11 @@
*/
package com.l2jserver.service.game.clan;
import com.l2jserver.model.game.Fort;
import com.l2jserver.service.Service;
/**
* This service manages Fort instances.
* This service manages {@link Fort} instances.
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/

View File

@@ -16,6 +16,8 @@
*/
package com.l2jserver.service.game.world.filter.impl;
import org.apache.commons.math.util.FastMath;
import com.google.common.base.Preconditions;
import com.l2jserver.model.world.PositionableObject;
import com.l2jserver.service.game.world.filter.WorldObjectFilter;
@@ -45,16 +47,30 @@ public class RangeFilter implements WorldObjectFilter<PositionableObject> {
*/
public RangeFilter(final PositionableObject object, final int range) {
Preconditions.checkNotNull(object, "object");
Preconditions.checkState(range >= 0, "range < 0");
Preconditions.checkState(range >= 0, "negative range");
this.object = object;
this.range = Math.pow(range, 2);
this.range = range;
}
@Override
public boolean accept(PositionableObject other) {
if (other == null)
return false;
return other.getPosition().getDistanceSquared(object.getPosition()) <= range;
final double dx = FastMath.abs(object.getPoint().getX()
- other.getPoint().getX());
final double dy = FastMath.abs(object.getPoint().getY()
- other.getPoint().getY());
final double dz = FastMath.abs(object.getPoint().getZ()
- other.getPoint().getZ());
if (dx > range)
return false;
if (dy > range)
return false;
if (dz > range)
return false;
return true;
}
}

View File

@@ -37,10 +37,6 @@ public class RangePointFilter implements WorldObjectFilter<PositionableObject> {
* The desired maximum distance of the object
*/
private final double range;
/**
* The <tt>range</tt> multiplied by two
*/
private final double doubleRange;
/**
* Creates a new instance
@@ -55,7 +51,6 @@ public class RangePointFilter implements WorldObjectFilter<PositionableObject> {
Preconditions.checkState(range >= 0, "range < 0");
this.point = point;
this.range = Math.pow(range, 2);
this.doubleRange = range * 2;
}
@Override
@@ -66,13 +61,13 @@ public class RangePointFilter implements WorldObjectFilter<PositionableObject> {
final double dy = FastMath.abs(point.getY() - other.getPoint().getY());
final double dz = FastMath.abs(point.getZ() - other.getPoint().getZ());
if (dx > doubleRange)
if (dx > range)
return false;
if (dy > doubleRange)
if (dy > range)
return false;
if (dz > doubleRange)
if (dz > range)
return false;
return ((dx * dx) + (dy * dy) + (dz * dz)) <= range;
return true;
}
}

View File

@@ -25,7 +25,7 @@ public class ClassUtils {
/**
* Return true if class a is either equivalent to class b, or if class a is
* a subclass of class b, i.e. if a either "extends" or "implements" b. Note
* tht either or both "Class" objects may represent interfaces.
* that either or both "Class" objects may represent interfaces.
*
* @param a
* class
@@ -35,7 +35,7 @@ public class ClassUtils {
*/
public static boolean isSubclass(Class<?> a, Class<?> b) {
// We rely on the fact that for any given java class or
// primtitive type there is a unqiue Class object, so
// primitive type there is a unique Class object, so
// we can use object equivalence in the comparisons.
if (a == b) {
return true;