- getIP(), getJunior(), getSenior(), getPrincipal(); 
- setIP(), setJunior(), setSenior(), setPrincipal(), setLastSeen(long rd); 
- isPeerOK(), isOnline(String type);
next try to remove hello.class java.util.ConcurrentModificationException:null ;)

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@948 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
borg-0300 19 years ago
parent e642a5d8b7
commit cdbaf637fb

@ -130,7 +130,7 @@ public class yacySeed {
this.available = 0; this.available = 0;
} }
public yacySeed(String hash) { public yacySeed(String hash) {
dna = new HashMap(); dna = new HashMap();
// settings that can only be computed by originating peer: // settings that can only be computed by originating peer:
@ -174,11 +174,22 @@ public class yacySeed {
available = 0; available = 0;
} }
public String getIP() { return get(IP, ""); }
public String getJunior() { return get(PEERTYPE, PEERTYPE_JUNIOR); }
public String getSenior() { return get(PEERTYPE, PEERTYPE_SENIOR); }
public String getPrincipal() { return get(PEERTYPE, PEERTYPE_PRINCIPAL); }
public String get(String key, String dflt) { public String get(String key, String dflt) {
final Object o = dna.get(key); final Object o = dna.get(key);
if (o == null) { return dflt; } else { return (String) o; } if (o == null) { return dflt; } else { return (String) o; }
} }
public void setIP(String ip) { put(IP, ip); }
public void setJunior() { put(PEERTYPE, PEERTYPE_JUNIOR); }
public void setSenior() { put(PEERTYPE, PEERTYPE_SENIOR); }
public void setPrincipal() { put(PEERTYPE, PEERTYPE_PRINCIPAL); }
public void setLastSeen(long rd) { put(LASTSEEN, yacyCore.shortFormatter.format(new Date(System.currentTimeMillis() + serverDate.UTCDiff() - rd))); }
public void put(String key, String value) { public void put(String key, String value) {
dna.put(key, value); dna.put(key, value);
} }
@ -342,6 +353,9 @@ public class yacySeed {
public boolean isOnline() { public boolean isOnline() {
return (isSenior() || isPrincipal()); return (isSenior() || isPrincipal());
} }
public boolean isOnline(String type) {
return (type.equals(PEERTYPE_SENIOR) || type.equals(PEERTYPE_PRINCIPAL));
}
public String encodeLex(long c, int length) { public String encodeLex(long c, int length) {
if (length < 0) { length = 0; } if (length < 0) { length = 0; }
@ -491,10 +505,14 @@ public class yacySeed {
return genSeedStr('b', key); return genSeedStr('b', key);
} }
public String genSeedStr(char method, String key) { synchronized public String genSeedStr(char method, String key) {
return crypt.simpleEncode(toString(), key, method); return crypt.simpleEncode(toString(), key, method);
} }
public boolean isPeerOK() {
return (this.hash != null && isProper() == null);
}
public String isProper() { public String isProper() {
// checks if everything is ok with that seed // checks if everything is ok with that seed
if (this.hash == null) { return "hash is null"; } if (this.hash == null) { return "hash is null"; }

Loading…
Cancel
Save