improve readability

master
melvin 2011-06-17 14:53:48 +08:00
parent 4b82e7e489
commit 055e2a7b80
2 changed files with 6 additions and 18 deletions

View File

@ -10,37 +10,31 @@ public class MagicPermanentTrigger implements Comparable<MagicPermanentTrigger>
private final MagicTrigger trigger;
public MagicPermanentTrigger(final long id,final MagicPermanent permanent,final MagicTrigger trigger) {
this.id=id;
this.permanent=permanent;
this.trigger=trigger;
}
public MagicPermanentTrigger(final MagicCopyMap copyMap,final MagicPermanentTrigger source) {
id=source.id;
permanent=copyMap.copy(source.permanent);
trigger=source.trigger;
}
public long getId() {
return id;
}
public MagicPermanent getPermanent() {
return permanent;
}
public MagicTrigger getTrigger() {
return trigger;
}
@Override
public int compareTo(final MagicPermanentTrigger permanentTrigger) {
final int priorityDif=trigger.getPriority()-permanentTrigger.trigger.getPriority();
if (priorityDif<0) {
return -1;
@ -56,4 +50,4 @@ public class MagicPermanentTrigger implements Comparable<MagicPermanentTrigger>
return 0;
}
}
}
}

View File

@ -7,28 +7,22 @@ public class MagicPermanentTriggerList extends ArrayList<MagicPermanentTrigger>
private static final long serialVersionUID = 1L;
public MagicPermanentTriggerList() {
}
public MagicPermanentTriggerList() {}
public MagicPermanentTriggerList(final MagicPermanentTriggerList triggerList) {
super(triggerList);
}
public MagicPermanentTriggerList(final MagicPermanentTriggerMap triggerMap,final MagicPermanentTriggerList triggerList) {
for (MagicPermanentTrigger permanentTrigger : triggerList) {
final long id=permanentTrigger.getId();
final Set<MagicPermanentTrigger> triggersSet=triggerMap.get(permanentTrigger.getTrigger().getType());
final long id = permanentTrigger.getId();
final Set<MagicPermanentTrigger> triggersSet = triggerMap.get(permanentTrigger.getTrigger().getType());
for (final MagicPermanentTrigger otherPermanentTrigger : triggersSet) {
if (otherPermanentTrigger.getId()==id) {
if (otherPermanentTrigger.getId() == id) {
add(otherPermanentTrigger);
break;
}
}
}
}
}
}