1
0
mirror of https://github.com/Rogiel/l2jserver2 synced 2025-12-08 08:23:11 +00:00

Written javadoc for many classes

Signed-off-by: Rogiel <rogiel@rogiel.com>
This commit is contained in:
2011-05-14 01:51:40 -03:00
parent 14b928cc3b
commit e9c6f1b027
85 changed files with 1205 additions and 26 deletions

View File

@@ -15,9 +15,20 @@ import com.l2jserver.model.world.WorldObject;
* the {@link WorldObject} type
*/
public abstract class ObjectID<T extends WorldObject> extends ID {
/**
* Creates a new instance
*
* @param id
* the raw id
*/
protected ObjectID(int id) {
super(id);
}
/**
* Returns the {@link WorldObject} associated with this {@link ID}
*
* @return the {@link WorldObject} if existent, <tt>null</tt> otherwise
*/
public abstract T getObject();
}

View File

@@ -7,12 +7,22 @@ import com.l2jserver.model.template.Template;
* defined in the template class.
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
*
*/
public abstract class TemplateID<T extends Template<?>> extends ID {
/**
* Creates a new instance
*
* @param id
* the raw id
*/
public TemplateID(int id) {
super(id);
}
/**
* Returns the {@link Template} associated with this {@link ID}
*
* @return the {@link Template} if existent, <tt>null</tt> otherwise
*/
public abstract T getTemplate();
}

View File

@@ -1,6 +1,7 @@
package com.l2jserver.model.id.factory;
import com.google.inject.AbstractModule;
import com.google.inject.Module;
import com.google.inject.Scopes;
import com.google.inject.assistedinject.FactoryModuleBuilder;
import com.l2jserver.model.id.object.allocator.BitSetIDAllocator;
@@ -13,6 +14,11 @@ import com.l2jserver.model.id.template.factory.CharacterTemplateIDFactory;
import com.l2jserver.model.id.template.factory.ItemTemplateIDFactory;
import com.l2jserver.model.id.template.factory.SkillTemplateIDFactory;
/**
* Google Guice {@link IDFactory} {@link Module}
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
public class IDFactoryModule extends AbstractModule {
@Override
protected void configure() {

View File

@@ -5,6 +5,13 @@ import com.google.inject.assistedinject.Assisted;
import com.l2jserver.model.id.ObjectID;
import com.l2jserver.model.world.capability.Actor;
/**
* An {@link ObjectID} instance representing an {@link Actor} object
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
* @param <T>
* the actor subclass
*/
public abstract class ActorID<T extends Actor> extends ObjectID<T> {
@Inject
public ActorID(@Assisted int id) {

View File

@@ -3,8 +3,14 @@ package com.l2jserver.model.id.object;
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.world.L2Character;
/**
* An {@link ObjectID} instance representing an {@link L2Character} object
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
public final class CharacterID extends ActorID<L2Character> {
/**
* Data Access Object (DAO) for characters

View File

@@ -5,6 +5,11 @@ import com.l2jserver.db.dao.ClanDAO;
import com.l2jserver.model.id.ObjectID;
import com.l2jserver.model.world.Clan;
/**
* An {@link ObjectID} instance representing an {@link Clan} object
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
public final class ClanID extends ObjectID<Clan> {
/**
* Data Access Object (DAO) for clans

View File

@@ -6,6 +6,11 @@ import com.l2jserver.db.dao.ItemDAO;
import com.l2jserver.model.id.ObjectID;
import com.l2jserver.model.world.Item;
/**
* An {@link ObjectID} instance representing an {@link Item} object
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
public final class ItemID extends ObjectID<Item> {
/**
* Data Access Object (DAO) for items

View File

@@ -2,8 +2,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.world.Pet;
/**
* An {@link ObjectID} instance representing an {@link Pet} object
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
public final class PetID extends ActorID<Pet> {
/**
* Data Access Object (DAO) for pets

View File

@@ -10,7 +10,15 @@ import org.slf4j.LoggerFactory;
import com.l2jserver.util.PrimeFinder;
/**
* The {@link BitSet} id allocator allocates new IDs backed by an {@link BitSet}
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
public class BitSetIDAllocator implements IDAllocator {
/**
* The logger
*/
private static final Logger log = LoggerFactory
.getLogger(BitSetIDAllocator.class);
@@ -32,6 +40,9 @@ public class BitSetIDAllocator implements IDAllocator {
*/
private AtomicInteger nextId = new AtomicInteger();
/**
* Initializes this allocator
*/
public void init() {
ids = new BitSet(PrimeFinder.nextPrime(100000));
ids.clear();
@@ -108,6 +119,9 @@ public class BitSetIDAllocator implements IDAllocator {
}
}
/**
* Increases the {@link BitSet} capacity
*/
private void increaseBitSetCapacity() {
log.debug("Increasing BitSet capacity from {}", ids.size());
BitSet newBitSet = new BitSet(

View File

@@ -1,5 +1,10 @@
package com.l2jserver.model.id.object.allocator;
/**
* Exception thrown by an {@link IDAllocator}.
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
public class IDAllocatorException extends RuntimeException {
private static final long serialVersionUID = 111195059766878062L;

View File

@@ -13,8 +13,17 @@ import com.l2jserver.model.world.WorldObject;
* the return object type
*/
public class WorldObjectIterable<T extends WorldObject> implements Iterable<T> {
/**
* The {@link Iterator}
*/
private final Iterator<T> iterator;
/**
* Creates a new instance
*
* @param iterator
* the iterator
*/
public WorldObjectIterable(Iterator<T> iterator) {
this.iterator = iterator;
}

View File

@@ -17,12 +17,27 @@ import com.l2jserver.util.ArrayIterator;
* the object type
*/
public class WorldObjectIterator<T extends WorldObject> implements Iterator<T> {
/**
* The {@link ObjectID} iterator
*/
private final Iterator<? extends ObjectID<T>> ids;
/**
* Creates a new instance
*
* @param ids
* the {@link ObjectID} var-arg
*/
public WorldObjectIterator(ObjectID<T>... ids) {
this(new ArrayIterator<ObjectID<T>>(ids));
}
/**
* Creates a new instance
*
* @param ids
* the {@link ObjectID} iterator
*/
public WorldObjectIterator(Iterator<? extends ObjectID<T>> ids) {
this.ids = ids;
}

View File

@@ -6,7 +6,16 @@ import com.l2jserver.model.id.TemplateID;
import com.l2jserver.model.template.CharacterTemplate;
import com.l2jserver.service.game.template.TemplateService;
/**
* An {@link TemplateID} instance representing an {@link CharacterTemplate}
* object
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
public class CharacterTemplateID extends TemplateID<CharacterTemplate> {
/**
* The template service
*/
private final TemplateService templateService;
@Inject

View File

@@ -6,7 +6,16 @@ import com.l2jserver.model.id.TemplateID;
import com.l2jserver.model.template.ItemTemplate;
import com.l2jserver.service.game.template.TemplateService;
/**
* An {@link TemplateID} instance representing an {@link ItemTemplate}
* object
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
public class ItemTemplateID extends TemplateID<ItemTemplate> {
/**
* The template service
*/
private final TemplateService templateService;
@Inject

View File

@@ -6,7 +6,16 @@ import com.l2jserver.model.id.TemplateID;
import com.l2jserver.model.template.SkillTemplate;
import com.l2jserver.service.game.template.TemplateService;
/**
* An {@link TemplateID} instance representing an {@link SkillTemplate}
* object
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
public class SkillTemplateID extends TemplateID<SkillTemplate> {
/**
* The template service
*/
private final TemplateService templateService;
@Inject

View File

@@ -2,6 +2,11 @@ package com.l2jserver.model.id.template.factory;
import com.l2jserver.model.id.template.CharacterTemplateID;
/**
* Creates new {@link CharacterTemplateID} instances
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
public interface CharacterTemplateIDFactory extends
TemplateIDFactory<CharacterTemplateID> {
}

View File

@@ -2,6 +2,11 @@ package com.l2jserver.model.id.template.factory;
import com.l2jserver.model.id.template.ItemTemplateID;
/**
* Creates new {@link ItemTemplateID} instances
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
public interface ItemTemplateIDFactory extends
TemplateIDFactory<ItemTemplateID> {
}

View File

@@ -2,6 +2,11 @@ package com.l2jserver.model.id.template.factory;
import com.l2jserver.model.id.template.SkillTemplateID;
/**
* Creates new {@link SkillTemplateID} instances
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
public interface SkillTemplateIDFactory extends
TemplateIDFactory<SkillTemplateID> {
}

View File

@@ -3,6 +3,14 @@ package com.l2jserver.model.id.template.factory;
import com.l2jserver.model.id.TemplateID;
import com.l2jserver.model.id.factory.IDFactory;
/**
* Creates a new {@link TemplateID}
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
*
* @param <T>
* the subclass of {@link TemplateID} that will be createdF
*/
public interface TemplateIDFactory<T extends TemplateID<?>> extends
IDFactory<T> {
}

View File

@@ -2,11 +2,25 @@ package com.l2jserver.model.template;
import com.l2jserver.model.id.TemplateID;
/**
* An abstract {@link Template}
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
*
* @param <T>
* the type of object created by this template
*/
public abstract class AbstractTemplate<T> implements Template<T> {
/**
* The {@link TemplateID}F
*/
private final TemplateID<?> id;
public AbstractTemplate(TemplateID<?> id) {
super();
/**
* Creates a new instance
* @param id
*/
protected AbstractTemplate(TemplateID<?> id) {
this.id = id;
}

View File

@@ -3,7 +3,13 @@ package com.l2jserver.model.template;
import com.l2jserver.model.id.template.ItemTemplateID;
import com.l2jserver.model.template.capability.Defendable;
import com.l2jserver.model.template.capability.IncomingDamageIntercept;
import com.l2jserver.model.world.Item;
/**
* Template for Armor {@link Item}
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
public abstract class ArmorTemplate extends ItemTemplate implements Defendable,
IncomingDamageIntercept {
public ArmorTemplate(ItemTemplateID id) {

View File

@@ -10,6 +10,11 @@ import com.l2jserver.model.world.character.CharacterBaseAttributes;
import com.l2jserver.model.world.character.CharacterClass;
import com.l2jserver.util.Coordinate;
/**
* Template for {@link L2Character}
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
public abstract class CharacterTemplate extends AbstractTemplate<L2Character> {
/**
* The logger

View File

@@ -2,7 +2,13 @@ package com.l2jserver.model.template;
import com.l2jserver.model.id.template.ItemTemplateID;
import com.l2jserver.model.template.capability.Consumable;
import com.l2jserver.model.world.Item;
/**
* Template for consumable {@link Item}
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
public abstract class ConsumableTemplate extends ItemTemplate implements
Consumable {
public ConsumableTemplate(ItemTemplateID id) {

View File

@@ -6,6 +6,11 @@ import org.slf4j.LoggerFactory;
import com.l2jserver.model.id.template.ItemTemplateID;
import com.l2jserver.model.world.Item;
/**
* Template for an {@link Item}
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
public abstract class ItemTemplate extends AbstractTemplate<Item> {
/**
* The logger

View File

@@ -1,7 +1,13 @@
package com.l2jserver.model.template;
import com.l2jserver.model.id.template.ItemTemplateID;
import com.l2jserver.model.world.Item;
/**
* Template for Potion {@link Item}
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
public abstract class PotionTemplate extends ConsumableTemplate {
public PotionTemplate(ItemTemplateID id) {
super(id);

View File

@@ -4,6 +4,11 @@ import com.l2jserver.model.id.template.SkillTemplateID;
import com.l2jserver.model.template.capability.Castable;
import com.l2jserver.model.world.character.CharacterClass;
/**
* Template for skill
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
public abstract class SkillTemplate extends AbstractTemplate<Void> implements
Castable {
public SkillTemplate(SkillTemplateID id) {

View File

@@ -1,9 +1,30 @@
package com.l2jserver.model.template;
import com.l2jserver.model.id.TemplateID;
import com.l2jserver.model.world.WorldObject;
/**
* An template is like a base for an {@link WorldObject}. Normally, instead of
* manually creating the object this can be done through templates, that easy
* the need of setting the new objects parameters.
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
*
* @param <T>
* the {@link WorldObject} type
*/
public interface Template<T> {
/**
* Create a new {@link WorldObject}
*
* @return the created object
*/
T create();
/**
* Return this {@link TemplateID}
*
* @return the template id
*/
TemplateID<?> getID();
}

View File

@@ -2,7 +2,13 @@ package com.l2jserver.model.template;
import com.l2jserver.model.id.template.ItemTemplateID;
import com.l2jserver.model.template.capability.Attackable;
import com.l2jserver.model.world.Item;
/**
* Template for Weapon {@link Item}
*
* @author <a href="http://www.rogiel.com">Rogiel</a>
*/
public abstract class WeaponTemplate extends ItemTemplate implements Attackable {
public WeaponTemplate(ItemTemplateID id) {
super(id);

View File

@@ -23,7 +23,7 @@ public class CharacterBaseAttributes implements CharacterAttributes {
*/
private final int mentality;
/**
* The character dextry
* The character dexterity
*/
private final int dexterity;
/**
@@ -93,8 +93,8 @@ public class CharacterBaseAttributes implements CharacterAttributes {
* the concentration
* @param mentality
* the mentality
* @param dextry
* the dextry
* @param dexterity
* the dexterity
* @param witness
* the witness
* @param physicalAttack
@@ -151,6 +151,7 @@ public class CharacterBaseAttributes implements CharacterAttributes {
/**
* @return the intelligence
*/
@Override
public int getIntelligence() {
return intelligence;
}
@@ -158,6 +159,7 @@ public class CharacterBaseAttributes implements CharacterAttributes {
/**
* @return the strength
*/
@Override
public int getStrength() {
return strength;
}
@@ -165,6 +167,7 @@ public class CharacterBaseAttributes implements CharacterAttributes {
/**
* @return the concentration
*/
@Override
public int getConcentration() {
return concentration;
}
@@ -172,13 +175,15 @@ public class CharacterBaseAttributes implements CharacterAttributes {
/**
* @return the mentality
*/
@Override
public int getMentality() {
return mentality;
}
/**
* @return the dextry
* @return the dexterity
*/
@Override
public int getDexterity() {
return dexterity;
}
@@ -186,6 +191,7 @@ public class CharacterBaseAttributes implements CharacterAttributes {
/**
* @return the witness
*/
@Override
public int getWitness() {
return witness;
}
@@ -193,6 +199,7 @@ public class CharacterBaseAttributes implements CharacterAttributes {
/**
* @return the physicalAttack
*/
@Override
public int getPhysicalAttack() {
return physicalAttack;
}
@@ -200,6 +207,7 @@ public class CharacterBaseAttributes implements CharacterAttributes {
/**
* @return the magicalAttack
*/
@Override
public int getMagicalAttack() {
return magicalAttack;
}
@@ -207,6 +215,7 @@ public class CharacterBaseAttributes implements CharacterAttributes {
/**
* @return the physicalDefense
*/
@Override
public int getPhysicalDefense() {
return physicalDefense;
}
@@ -214,6 +223,7 @@ public class CharacterBaseAttributes implements CharacterAttributes {
/**
* @return the magicalDefense
*/
@Override
public int getMagicalDefense() {
return magicalDefense;
}
@@ -221,6 +231,7 @@ public class CharacterBaseAttributes implements CharacterAttributes {
/**
* @return the attackSpeed
*/
@Override
public int getAttackSpeed() {
return attackSpeed;
}
@@ -228,6 +239,7 @@ public class CharacterBaseAttributes implements CharacterAttributes {
/**
* @return the castSpeed
*/
@Override
public int getCastSpeed() {
return castSpeed;
}
@@ -235,6 +247,7 @@ public class CharacterBaseAttributes implements CharacterAttributes {
/**
* @return the accuracy
*/
@Override
public int getAccuracy() {
return accuracy;
}
@@ -242,6 +255,7 @@ public class CharacterBaseAttributes implements CharacterAttributes {
/**
* @return the criticalChance
*/
@Override
public int getCriticalChance() {
return criticalChance;
}
@@ -249,6 +263,7 @@ public class CharacterBaseAttributes implements CharacterAttributes {
/**
* @return the evasionChance
*/
@Override
public int getEvasionChance() {
return evasionChance;
}
@@ -256,6 +271,7 @@ public class CharacterBaseAttributes implements CharacterAttributes {
/**
* @return the moveSpeed
*/
@Override
public int getMoveSpeed() {
return moveSpeed;
}
@@ -263,6 +279,7 @@ public class CharacterBaseAttributes implements CharacterAttributes {
/**
* @return the maxWeigth
*/
@Override
public int getMaxWeigth() {
return maxWeigth;
}
@@ -270,6 +287,7 @@ public class CharacterBaseAttributes implements CharacterAttributes {
/**
* @return the craft
*/
@Override
public boolean canCraft() {
return craft;
}