code
stringlengths
11
173k
docstring
stringlengths
2
593k
func_name
stringlengths
2
189
language
stringclasses
1 value
repo
stringclasses
833 values
path
stringlengths
11
294
url
stringlengths
60
339
license
stringclasses
4 values
public static boolean hHasKey(String key, String item) { key = redisPrefix + key; return redisTemplate.opsForHash().hasKey(key, item); }
判断hash表中是否有该项的值 @param key 键 不能为null @param item 项 不能为null @return true 存在 false不存在 @author fzr
RedisUtil::hHasKey
java
PlayEdu/PlayEdu
playedu-api/playedu-common/src/main/java/xyz/playedu/common/util/RedisUtil.java
https://github.com/PlayEdu/PlayEdu/blob/master/playedu-api/playedu-common/src/main/java/xyz/playedu/common/util/RedisUtil.java
Apache-2.0
public static double hIncr(String key, String item, long by) { key = redisPrefix + key; return redisTemplate.opsForHash().increment(key, item, by); }
hash递增 如果不存在,就会创建一个并把新增后的值返回 @param key 键 @param item 项 @param by 要增加几(大于0) @return double @author fzr
RedisUtil::hIncr
java
PlayEdu/PlayEdu
playedu-api/playedu-common/src/main/java/xyz/playedu/common/util/RedisUtil.java
https://github.com/PlayEdu/PlayEdu/blob/master/playedu-api/playedu-common/src/main/java/xyz/playedu/common/util/RedisUtil.java
Apache-2.0
public static double hDecr(String key, String item, long by) { key = redisPrefix + key; return redisTemplate.opsForHash().increment(key, item, -by); }
hash递减 @param key 键 @param item 项 @param by 要减少记(小于0) @return double @author fzr
RedisUtil::hDecr
java
PlayEdu/PlayEdu
playedu-api/playedu-common/src/main/java/xyz/playedu/common/util/RedisUtil.java
https://github.com/PlayEdu/PlayEdu/blob/master/playedu-api/playedu-common/src/main/java/xyz/playedu/common/util/RedisUtil.java
Apache-2.0
public static Set<Object> sGet(String key) { key = redisPrefix + key; return redisTemplate.opsForSet().members(key); }
根据key获取Set中的所有值 @param key 键 @return Set @author fzr
RedisUtil::sGet
java
PlayEdu/PlayEdu
playedu-api/playedu-common/src/main/java/xyz/playedu/common/util/RedisUtil.java
https://github.com/PlayEdu/PlayEdu/blob/master/playedu-api/playedu-common/src/main/java/xyz/playedu/common/util/RedisUtil.java
Apache-2.0
public Boolean sHasKey(String key, Object value) { key = redisPrefix + key; return redisTemplate.opsForSet().isMember(key, value); }
根据value从一个set中查询,是否存在 @param key 键 @param value 值 @return true 存在 false不存在 @author fzr
RedisUtil::sHasKey
java
PlayEdu/PlayEdu
playedu-api/playedu-common/src/main/java/xyz/playedu/common/util/RedisUtil.java
https://github.com/PlayEdu/PlayEdu/blob/master/playedu-api/playedu-common/src/main/java/xyz/playedu/common/util/RedisUtil.java
Apache-2.0
public static Long sSet(String key, Object... values) { key = redisPrefix + key; return redisTemplate.opsForSet().add(key, values); }
将数据放入set缓存 @param key 键 @param values 值 可以是多个 @return 成功个数 @author fzr
RedisUtil::sSet
java
PlayEdu/PlayEdu
playedu-api/playedu-common/src/main/java/xyz/playedu/common/util/RedisUtil.java
https://github.com/PlayEdu/PlayEdu/blob/master/playedu-api/playedu-common/src/main/java/xyz/playedu/common/util/RedisUtil.java
Apache-2.0
public Long sSetAndTime(String key, long time, Object... values) { key = redisPrefix + key; return redisTemplate.opsForSet().add(key, values); }
将set数据放入缓存 @param key 键 @param time 时间(秒) @param values 值 可以是多个 @return 成功个数 @author fzr
RedisUtil::sSetAndTime
java
PlayEdu/PlayEdu
playedu-api/playedu-common/src/main/java/xyz/playedu/common/util/RedisUtil.java
https://github.com/PlayEdu/PlayEdu/blob/master/playedu-api/playedu-common/src/main/java/xyz/playedu/common/util/RedisUtil.java
Apache-2.0
public Long sGetSetSize(String key) { key = redisPrefix + key; return redisTemplate.opsForSet().size(key); }
获取set缓存的长度 @param key 键 @return Long @author fzr
RedisUtil::sGetSetSize
java
PlayEdu/PlayEdu
playedu-api/playedu-common/src/main/java/xyz/playedu/common/util/RedisUtil.java
https://github.com/PlayEdu/PlayEdu/blob/master/playedu-api/playedu-common/src/main/java/xyz/playedu/common/util/RedisUtil.java
Apache-2.0
public Long setRemove(String key, Object... values) { key = redisPrefix + key; return redisTemplate.opsForSet().remove(key, values); }
移除值为value的 @param key 键 @param values 值 可以是多个 @return 移除的个数 @author fzr
RedisUtil::setRemove
java
PlayEdu/PlayEdu
playedu-api/playedu-common/src/main/java/xyz/playedu/common/util/RedisUtil.java
https://github.com/PlayEdu/PlayEdu/blob/master/playedu-api/playedu-common/src/main/java/xyz/playedu/common/util/RedisUtil.java
Apache-2.0
public List<Object> lGet(String key, long start, long end) { key = redisPrefix + key; return redisTemplate.opsForList().range(key, start, end); }
获取list缓存的内容 @param key 键 @param start 开始 @param end 结束 0 到 -1代表所有值 @return List @author fzr
RedisUtil::lGet
java
PlayEdu/PlayEdu
playedu-api/playedu-common/src/main/java/xyz/playedu/common/util/RedisUtil.java
https://github.com/PlayEdu/PlayEdu/blob/master/playedu-api/playedu-common/src/main/java/xyz/playedu/common/util/RedisUtil.java
Apache-2.0
public Long lGetListSize(String key) { key = redisPrefix + key; return redisTemplate.opsForList().size(key); }
获取list缓存的长度 @param key 键 @return Long @author fzr
RedisUtil::lGetListSize
java
PlayEdu/PlayEdu
playedu-api/playedu-common/src/main/java/xyz/playedu/common/util/RedisUtil.java
https://github.com/PlayEdu/PlayEdu/blob/master/playedu-api/playedu-common/src/main/java/xyz/playedu/common/util/RedisUtil.java
Apache-2.0
public Object lGetIndex(String key, long index) { key = redisPrefix + key; return redisTemplate.opsForList().index(key, index); }
通过索引获取list中的值 @param key 键 @param index 索引 index>=0时,0 表头,1 第二个元素,依次类推;index<0时,-1,表尾,-2倒数第二个元素,依次类推 @return Object @author fzr
RedisUtil::lGetIndex
java
PlayEdu/PlayEdu
playedu-api/playedu-common/src/main/java/xyz/playedu/common/util/RedisUtil.java
https://github.com/PlayEdu/PlayEdu/blob/master/playedu-api/playedu-common/src/main/java/xyz/playedu/common/util/RedisUtil.java
Apache-2.0
public boolean lSet(String key, Object value) { key = redisPrefix + key; redisTemplate.opsForList().rightPush(key, value); return true; }
将list放入缓存 @param key 键 @param value 值 @return boolean @author fzr
RedisUtil::lSet
java
PlayEdu/PlayEdu
playedu-api/playedu-common/src/main/java/xyz/playedu/common/util/RedisUtil.java
https://github.com/PlayEdu/PlayEdu/blob/master/playedu-api/playedu-common/src/main/java/xyz/playedu/common/util/RedisUtil.java
Apache-2.0
public boolean lSet(String key, Object value, long second) { key = redisPrefix + key; redisTemplate.opsForList().rightPush(key, value); if (second > 0) expire(key, second); return true; }
将list放入缓存 @param key 键 @param value 值 @param second 时间(秒) @return boolean @author fzr
RedisUtil::lSet
java
PlayEdu/PlayEdu
playedu-api/playedu-common/src/main/java/xyz/playedu/common/util/RedisUtil.java
https://github.com/PlayEdu/PlayEdu/blob/master/playedu-api/playedu-common/src/main/java/xyz/playedu/common/util/RedisUtil.java
Apache-2.0
public boolean lSet(String key, List<Object> value, Long time) { key = redisPrefix + key; redisTemplate.opsForList().rightPushAll(key, value); if (time > 0) expire(key, time); return true; }
将list放入缓存 @param key 键 @param value 值 @param time 时间(秒) @return boolean @author fzr
RedisUtil::lSet
java
PlayEdu/PlayEdu
playedu-api/playedu-common/src/main/java/xyz/playedu/common/util/RedisUtil.java
https://github.com/PlayEdu/PlayEdu/blob/master/playedu-api/playedu-common/src/main/java/xyz/playedu/common/util/RedisUtil.java
Apache-2.0
public boolean lUpdateIndex(String key, Long index, Object value) { key = redisPrefix + key; redisTemplate.opsForList().set(key, index, value); return true; }
根据索引修改list中的某条数据 @param key 键 @param index 索引 @param value 值 @return boolean @author fzr
RedisUtil::lUpdateIndex
java
PlayEdu/PlayEdu
playedu-api/playedu-common/src/main/java/xyz/playedu/common/util/RedisUtil.java
https://github.com/PlayEdu/PlayEdu/blob/master/playedu-api/playedu-common/src/main/java/xyz/playedu/common/util/RedisUtil.java
Apache-2.0
public Long lRemove(String key, Long count, Object value) { key = redisPrefix + key; return redisTemplate.opsForList().remove(key, count, value); }
移除N个值为value @param key 键 @param count 移除多少个 @param value 值 @return 移除的个数 @author fzr
RedisUtil::lRemove
java
PlayEdu/PlayEdu
playedu-api/playedu-common/src/main/java/xyz/playedu/common/util/RedisUtil.java
https://github.com/PlayEdu/PlayEdu/blob/master/playedu-api/playedu-common/src/main/java/xyz/playedu/common/util/RedisUtil.java
Apache-2.0
public static String encode(byte[] binaryData) { if (binaryData == null) { return null; } int lengthDataBits = binaryData.length * EIGHT_BIT; if (lengthDataBits == 0) { return ""; } int fewerThan24bits = lengthDataBits % TWENTY_FOUR_BIT_GROUP; int numberTriplets = lengthDataBits / TWENTY_FOUR_BIT_GROUP; int numberQuartet = fewerThan24bits != 0 ? numberTriplets + 1 : numberTriplets; char[] encodedData; encodedData = new char[numberQuartet * 4]; byte k, l, b1, b2, b3; int encodedIndex = 0; int dataIndex = 0; for (int i = 0; i < numberTriplets; i++) { b1 = binaryData[dataIndex++]; b2 = binaryData[dataIndex++]; b3 = binaryData[dataIndex++]; k = (byte) (b1 & 0x03); l = (byte) (b2 & 0x0f); byte val1 = ((b1 & SIGN) == 0) ? (byte) (b1 >> 2) : (byte) ((b1) >> 2 ^ 0xc0); byte val2 = ((b2 & SIGN) == 0) ? (byte) (b2 >> 4) : (byte) ((b2) >> 4 ^ 0xf0); byte val3 = ((b3 & SIGN) == 0) ? (byte) (b3 >> 6) : (byte) ((b3) >> 6 ^ 0xfc); encodedData[encodedIndex++] = lookUpBase64Alphabet[val1]; encodedData[encodedIndex++] = lookUpBase64Alphabet[val2 | (k << 4)]; encodedData[encodedIndex++] = lookUpBase64Alphabet[(l << 2) | val3]; encodedData[encodedIndex++] = lookUpBase64Alphabet[b3 & 0x3f]; } if (fewerThan24bits == EIGHT_BIT) { b1 = binaryData[dataIndex]; k = (byte) (b1 & 0x03); byte val1 = ((b1 & SIGN) == 0) ? (byte) (b1 >> 2) : (byte) ((b1) >> 2 ^ 0xc0); encodedData[encodedIndex++] = lookUpBase64Alphabet[val1]; encodedData[encodedIndex++] = lookUpBase64Alphabet[k << 4]; encodedData[encodedIndex++] = PAD; encodedData[encodedIndex++] = PAD; } else if (fewerThan24bits == SIXTEEN_BIT) { b1 = binaryData[dataIndex]; b2 = binaryData[dataIndex + 1]; l = (byte) (b2 & 0x0f); k = (byte) (b1 & 0x03); byte val1 = ((b1 & SIGN) == 0) ? (byte) (b1 >> 2) : (byte) ((b1) >> 2 ^ 0xc0); byte val2 = ((b2 & SIGN) == 0) ? (byte) (b2 >> 4) : (byte) ((b2) >> 4 ^ 0xf0); encodedData[encodedIndex++] = lookUpBase64Alphabet[val1]; encodedData[encodedIndex++] = lookUpBase64Alphabet[val2 | (k << 4)]; encodedData[encodedIndex++] = lookUpBase64Alphabet[l << 2]; encodedData[encodedIndex++] = PAD; } return new String(encodedData); }
转码 @param binaryData 未转码数据 @return 转码后数据串
Base64Util::encode
java
PlayEdu/PlayEdu
playedu-api/playedu-common/src/main/java/xyz/playedu/common/util/Base64Util.java
https://github.com/PlayEdu/PlayEdu/blob/master/playedu-api/playedu-common/src/main/java/xyz/playedu/common/util/Base64Util.java
Apache-2.0
public static byte[] decode(String encoded) { if (encoded == null) { return null; } char[] base64Data = encoded.toCharArray(); int len = removeWhiteSpace(base64Data); if (len % FOUR_BYTE != 0) { return null; } int numberQuadruple = (len / FOUR_BYTE); if (numberQuadruple == 0) { return new byte[0]; } byte[] decodedData; byte b1, b2, b3, b4; char d1, d2, d3, d4; int i = 0; int encodedIndex = 0; int dataIndex = 0; decodedData = new byte[(numberQuadruple) * 3]; for (; i < numberQuadruple - 1; i++) { if (!isData((d1 = base64Data[dataIndex++])) || !isData((d2 = base64Data[dataIndex++])) || !isData((d3 = base64Data[dataIndex++])) || !isData((d4 = base64Data[dataIndex++]))) { return null; } b1 = base64Alphabet[d1]; b2 = base64Alphabet[d2]; b3 = base64Alphabet[d3]; b4 = base64Alphabet[d4]; decodedData[encodedIndex++] = (byte) (b1 << 2 | b2 >> 4); decodedData[encodedIndex++] = (byte) (((b2 & 0xf) << 4) | ((b3 >> 2) & 0xf)); decodedData[encodedIndex++] = (byte) (b3 << 6 | b4); } if (!isData((d1 = base64Data[dataIndex++])) || !isData((d2 = base64Data[dataIndex++]))) { return null; } b1 = base64Alphabet[d1]; b2 = base64Alphabet[d2]; d3 = base64Data[dataIndex++]; d4 = base64Data[dataIndex++]; if (!isData((d3)) || !isData((d4))) { if (isPad(d3) && isPad(d4)) { if ((b2 & 0xf) != 0) { return null; } byte[] tmp = new byte[i * 3 + 1]; System.arraycopy(decodedData, 0, tmp, 0, i * 3); tmp[encodedIndex] = (byte) (b1 << 2 | b2 >> 4); return tmp; } else if (!isPad(d3) && isPad(d4)) { b3 = base64Alphabet[d3]; if ((b3 & 0x3) != 0) { return null; } byte[] tmp = new byte[i * 3 + 2]; System.arraycopy(decodedData, 0, tmp, 0, i * 3); tmp[encodedIndex++] = (byte) (b1 << 2 | b2 >> 4); tmp[encodedIndex] = (byte) (((b2 & 0xf) << 4) | ((b3 >> 2) & 0xf)); return tmp; } else { return null; } } else { b3 = base64Alphabet[d3]; b4 = base64Alphabet[d4]; decodedData[encodedIndex++] = (byte) (b1 << 2 | b2 >> 4); decodedData[encodedIndex++] = (byte) (((b2 & 0xf) << 4) | ((b3 >> 2) & 0xf)); decodedData[encodedIndex++] = (byte) (b4 | b3 << 6); } return decodedData; }
解码 @param encoded 已转码数据 @return 解码后数据
Base64Util::decode
java
PlayEdu/PlayEdu
playedu-api/playedu-common/src/main/java/xyz/playedu/common/util/Base64Util.java
https://github.com/PlayEdu/PlayEdu/blob/master/playedu-api/playedu-common/src/main/java/xyz/playedu/common/util/Base64Util.java
Apache-2.0
private static boolean isWhiteSpace(char octEct) { return (octEct == 0x20 || octEct == 0xd || octEct == 0xa || octEct == 0x9); }
是否空白 @param octEct 位 @return boolean
Base64Util::isWhiteSpace
java
PlayEdu/PlayEdu
playedu-api/playedu-common/src/main/java/xyz/playedu/common/util/Base64Util.java
https://github.com/PlayEdu/PlayEdu/blob/master/playedu-api/playedu-common/src/main/java/xyz/playedu/common/util/Base64Util.java
Apache-2.0
private static boolean isPad(char octEct) { return (octEct == PAD); }
是否填充 @param octEct 位 @return boolean
Base64Util::isPad
java
PlayEdu/PlayEdu
playedu-api/playedu-common/src/main/java/xyz/playedu/common/util/Base64Util.java
https://github.com/PlayEdu/PlayEdu/blob/master/playedu-api/playedu-common/src/main/java/xyz/playedu/common/util/Base64Util.java
Apache-2.0
private static Boolean isData(char octEct) { return (octEct < BASE_LENGTH && base64Alphabet[octEct] != -1); }
是否数据 @param octEct 位 @return Boolean
Base64Util::isData
java
PlayEdu/PlayEdu
playedu-api/playedu-common/src/main/java/xyz/playedu/common/util/Base64Util.java
https://github.com/PlayEdu/PlayEdu/blob/master/playedu-api/playedu-common/src/main/java/xyz/playedu/common/util/Base64Util.java
Apache-2.0
private static int removeWhiteSpace(char[] data) { if (data == null) { return 0; } int newSize = 0; int len = data.length; for (int i = 0; i < len; i++) { if (!isWhiteSpace(data[i])) { data[newSize++] = data[i]; } } return newSize; }
移除空白 @param data 数据 @return int
Base64Util::removeWhiteSpace
java
PlayEdu/PlayEdu
playedu-api/playedu-common/src/main/java/xyz/playedu/common/util/Base64Util.java
https://github.com/PlayEdu/PlayEdu/blob/master/playedu-api/playedu-common/src/main/java/xyz/playedu/common/util/Base64Util.java
Apache-2.0
public String getUuid() { return uuid; }
@TableName ldap_user @TableName(value = "ldap_user") public class LdapUser implements Serializable { /** @TableId(type = IdType.AUTO) private Integer id; /** 唯一特征值 private String uuid; /** 用户ID private Integer userId; /** cn private String cn; /** dn private String dn; /** ou private String ou; /** uid private String uid; /** 邮箱 private String email; /** private Date createdAt; /** private Date updatedAt; @TableField(exist = false) private static final long serialVersionUID = 1L; /** public Integer getId() { return id; } /** public void setId(Integer id) { this.id = id; } /** 唯一特征值
LdapUser::getUuid
java
PlayEdu/PlayEdu
playedu-api/playedu-common/src/main/java/xyz/playedu/common/domain/LdapUser.java
https://github.com/PlayEdu/PlayEdu/blob/master/playedu-api/playedu-common/src/main/java/xyz/playedu/common/domain/LdapUser.java
Apache-2.0
public String getCn() { return cn; }
@TableName ldap_user @TableName(value = "ldap_user") public class LdapUser implements Serializable { /** @TableId(type = IdType.AUTO) private Integer id; /** 唯一特征值 private String uuid; /** 用户ID private Integer userId; /** cn private String cn; /** dn private String dn; /** ou private String ou; /** uid private String uid; /** 邮箱 private String email; /** private Date createdAt; /** private Date updatedAt; @TableField(exist = false) private static final long serialVersionUID = 1L; /** public Integer getId() { return id; } /** public void setId(Integer id) { this.id = id; } /** 唯一特征值 public String getUuid() { return uuid; } /** 唯一特征值 public void setUuid(String uuid) { this.uuid = uuid; } /** 用户ID public Integer getUserId() { return userId; } /** 用户ID public void setUserId(Integer userId) { this.userId = userId; } /** cn
LdapUser::getCn
java
PlayEdu/PlayEdu
playedu-api/playedu-common/src/main/java/xyz/playedu/common/domain/LdapUser.java
https://github.com/PlayEdu/PlayEdu/blob/master/playedu-api/playedu-common/src/main/java/xyz/playedu/common/domain/LdapUser.java
Apache-2.0
public void setCn(String cn) { this.cn = cn; }
@TableName ldap_user @TableName(value = "ldap_user") public class LdapUser implements Serializable { /** @TableId(type = IdType.AUTO) private Integer id; /** 唯一特征值 private String uuid; /** 用户ID private Integer userId; /** cn private String cn; /** dn private String dn; /** ou private String ou; /** uid private String uid; /** 邮箱 private String email; /** private Date createdAt; /** private Date updatedAt; @TableField(exist = false) private static final long serialVersionUID = 1L; /** public Integer getId() { return id; } /** public void setId(Integer id) { this.id = id; } /** 唯一特征值 public String getUuid() { return uuid; } /** 唯一特征值 public void setUuid(String uuid) { this.uuid = uuid; } /** 用户ID public Integer getUserId() { return userId; } /** 用户ID public void setUserId(Integer userId) { this.userId = userId; } /** cn public String getCn() { return cn; } /** cn
LdapUser::setCn
java
PlayEdu/PlayEdu
playedu-api/playedu-common/src/main/java/xyz/playedu/common/domain/LdapUser.java
https://github.com/PlayEdu/PlayEdu/blob/master/playedu-api/playedu-common/src/main/java/xyz/playedu/common/domain/LdapUser.java
Apache-2.0
public String getDn() { return dn; }
@TableName ldap_user @TableName(value = "ldap_user") public class LdapUser implements Serializable { /** @TableId(type = IdType.AUTO) private Integer id; /** 唯一特征值 private String uuid; /** 用户ID private Integer userId; /** cn private String cn; /** dn private String dn; /** ou private String ou; /** uid private String uid; /** 邮箱 private String email; /** private Date createdAt; /** private Date updatedAt; @TableField(exist = false) private static final long serialVersionUID = 1L; /** public Integer getId() { return id; } /** public void setId(Integer id) { this.id = id; } /** 唯一特征值 public String getUuid() { return uuid; } /** 唯一特征值 public void setUuid(String uuid) { this.uuid = uuid; } /** 用户ID public Integer getUserId() { return userId; } /** 用户ID public void setUserId(Integer userId) { this.userId = userId; } /** cn public String getCn() { return cn; } /** cn public void setCn(String cn) { this.cn = cn; } /** dn
LdapUser::getDn
java
PlayEdu/PlayEdu
playedu-api/playedu-common/src/main/java/xyz/playedu/common/domain/LdapUser.java
https://github.com/PlayEdu/PlayEdu/blob/master/playedu-api/playedu-common/src/main/java/xyz/playedu/common/domain/LdapUser.java
Apache-2.0
public void setDn(String dn) { this.dn = dn; }
@TableName ldap_user @TableName(value = "ldap_user") public class LdapUser implements Serializable { /** @TableId(type = IdType.AUTO) private Integer id; /** 唯一特征值 private String uuid; /** 用户ID private Integer userId; /** cn private String cn; /** dn private String dn; /** ou private String ou; /** uid private String uid; /** 邮箱 private String email; /** private Date createdAt; /** private Date updatedAt; @TableField(exist = false) private static final long serialVersionUID = 1L; /** public Integer getId() { return id; } /** public void setId(Integer id) { this.id = id; } /** 唯一特征值 public String getUuid() { return uuid; } /** 唯一特征值 public void setUuid(String uuid) { this.uuid = uuid; } /** 用户ID public Integer getUserId() { return userId; } /** 用户ID public void setUserId(Integer userId) { this.userId = userId; } /** cn public String getCn() { return cn; } /** cn public void setCn(String cn) { this.cn = cn; } /** dn public String getDn() { return dn; } /** dn
LdapUser::setDn
java
PlayEdu/PlayEdu
playedu-api/playedu-common/src/main/java/xyz/playedu/common/domain/LdapUser.java
https://github.com/PlayEdu/PlayEdu/blob/master/playedu-api/playedu-common/src/main/java/xyz/playedu/common/domain/LdapUser.java
Apache-2.0
public String getOu() { return ou; }
@TableName ldap_user @TableName(value = "ldap_user") public class LdapUser implements Serializable { /** @TableId(type = IdType.AUTO) private Integer id; /** 唯一特征值 private String uuid; /** 用户ID private Integer userId; /** cn private String cn; /** dn private String dn; /** ou private String ou; /** uid private String uid; /** 邮箱 private String email; /** private Date createdAt; /** private Date updatedAt; @TableField(exist = false) private static final long serialVersionUID = 1L; /** public Integer getId() { return id; } /** public void setId(Integer id) { this.id = id; } /** 唯一特征值 public String getUuid() { return uuid; } /** 唯一特征值 public void setUuid(String uuid) { this.uuid = uuid; } /** 用户ID public Integer getUserId() { return userId; } /** 用户ID public void setUserId(Integer userId) { this.userId = userId; } /** cn public String getCn() { return cn; } /** cn public void setCn(String cn) { this.cn = cn; } /** dn public String getDn() { return dn; } /** dn public void setDn(String dn) { this.dn = dn; } /** ou
LdapUser::getOu
java
PlayEdu/PlayEdu
playedu-api/playedu-common/src/main/java/xyz/playedu/common/domain/LdapUser.java
https://github.com/PlayEdu/PlayEdu/blob/master/playedu-api/playedu-common/src/main/java/xyz/playedu/common/domain/LdapUser.java
Apache-2.0
public void setOu(String ou) { this.ou = ou; }
@TableName ldap_user @TableName(value = "ldap_user") public class LdapUser implements Serializable { /** @TableId(type = IdType.AUTO) private Integer id; /** 唯一特征值 private String uuid; /** 用户ID private Integer userId; /** cn private String cn; /** dn private String dn; /** ou private String ou; /** uid private String uid; /** 邮箱 private String email; /** private Date createdAt; /** private Date updatedAt; @TableField(exist = false) private static final long serialVersionUID = 1L; /** public Integer getId() { return id; } /** public void setId(Integer id) { this.id = id; } /** 唯一特征值 public String getUuid() { return uuid; } /** 唯一特征值 public void setUuid(String uuid) { this.uuid = uuid; } /** 用户ID public Integer getUserId() { return userId; } /** 用户ID public void setUserId(Integer userId) { this.userId = userId; } /** cn public String getCn() { return cn; } /** cn public void setCn(String cn) { this.cn = cn; } /** dn public String getDn() { return dn; } /** dn public void setDn(String dn) { this.dn = dn; } /** ou public String getOu() { return ou; } /** ou
LdapUser::setOu
java
PlayEdu/PlayEdu
playedu-api/playedu-common/src/main/java/xyz/playedu/common/domain/LdapUser.java
https://github.com/PlayEdu/PlayEdu/blob/master/playedu-api/playedu-common/src/main/java/xyz/playedu/common/domain/LdapUser.java
Apache-2.0
public Date getCreatedAt() { return createdAt; }
@TableName ldap_user @TableName(value = "ldap_user") public class LdapUser implements Serializable { /** @TableId(type = IdType.AUTO) private Integer id; /** 唯一特征值 private String uuid; /** 用户ID private Integer userId; /** cn private String cn; /** dn private String dn; /** ou private String ou; /** uid private String uid; /** 邮箱 private String email; /** private Date createdAt; /** private Date updatedAt; @TableField(exist = false) private static final long serialVersionUID = 1L; /** public Integer getId() { return id; } /** public void setId(Integer id) { this.id = id; } /** 唯一特征值 public String getUuid() { return uuid; } /** 唯一特征值 public void setUuid(String uuid) { this.uuid = uuid; } /** 用户ID public Integer getUserId() { return userId; } /** 用户ID public void setUserId(Integer userId) { this.userId = userId; } /** cn public String getCn() { return cn; } /** cn public void setCn(String cn) { this.cn = cn; } /** dn public String getDn() { return dn; } /** dn public void setDn(String dn) { this.dn = dn; } /** ou public String getOu() { return ou; } /** ou public void setOu(String ou) { this.ou = ou; } /** uid public String getUid() { return uid; } /** uid public void setUid(String uid) { this.uid = uid; } /** 邮箱 public String getEmail() { return email; } /** 邮箱 public void setEmail(String email) { this.email = email; } /**
LdapUser::getCreatedAt
java
PlayEdu/PlayEdu
playedu-api/playedu-common/src/main/java/xyz/playedu/common/domain/LdapUser.java
https://github.com/PlayEdu/PlayEdu/blob/master/playedu-api/playedu-common/src/main/java/xyz/playedu/common/domain/LdapUser.java
Apache-2.0
public void setCreatedAt(Date createdAt) { this.createdAt = createdAt; }
@TableName ldap_user @TableName(value = "ldap_user") public class LdapUser implements Serializable { /** @TableId(type = IdType.AUTO) private Integer id; /** 唯一特征值 private String uuid; /** 用户ID private Integer userId; /** cn private String cn; /** dn private String dn; /** ou private String ou; /** uid private String uid; /** 邮箱 private String email; /** private Date createdAt; /** private Date updatedAt; @TableField(exist = false) private static final long serialVersionUID = 1L; /** public Integer getId() { return id; } /** public void setId(Integer id) { this.id = id; } /** 唯一特征值 public String getUuid() { return uuid; } /** 唯一特征值 public void setUuid(String uuid) { this.uuid = uuid; } /** 用户ID public Integer getUserId() { return userId; } /** 用户ID public void setUserId(Integer userId) { this.userId = userId; } /** cn public String getCn() { return cn; } /** cn public void setCn(String cn) { this.cn = cn; } /** dn public String getDn() { return dn; } /** dn public void setDn(String dn) { this.dn = dn; } /** ou public String getOu() { return ou; } /** ou public void setOu(String ou) { this.ou = ou; } /** uid public String getUid() { return uid; } /** uid public void setUid(String uid) { this.uid = uid; } /** 邮箱 public String getEmail() { return email; } /** 邮箱 public void setEmail(String email) { this.email = email; } /** public Date getCreatedAt() { return createdAt; } /**
LdapUser::setCreatedAt
java
PlayEdu/PlayEdu
playedu-api/playedu-common/src/main/java/xyz/playedu/common/domain/LdapUser.java
https://github.com/PlayEdu/PlayEdu/blob/master/playedu-api/playedu-common/src/main/java/xyz/playedu/common/domain/LdapUser.java
Apache-2.0
public Date getUpdatedAt() { return updatedAt; }
@TableName ldap_user @TableName(value = "ldap_user") public class LdapUser implements Serializable { /** @TableId(type = IdType.AUTO) private Integer id; /** 唯一特征值 private String uuid; /** 用户ID private Integer userId; /** cn private String cn; /** dn private String dn; /** ou private String ou; /** uid private String uid; /** 邮箱 private String email; /** private Date createdAt; /** private Date updatedAt; @TableField(exist = false) private static final long serialVersionUID = 1L; /** public Integer getId() { return id; } /** public void setId(Integer id) { this.id = id; } /** 唯一特征值 public String getUuid() { return uuid; } /** 唯一特征值 public void setUuid(String uuid) { this.uuid = uuid; } /** 用户ID public Integer getUserId() { return userId; } /** 用户ID public void setUserId(Integer userId) { this.userId = userId; } /** cn public String getCn() { return cn; } /** cn public void setCn(String cn) { this.cn = cn; } /** dn public String getDn() { return dn; } /** dn public void setDn(String dn) { this.dn = dn; } /** ou public String getOu() { return ou; } /** ou public void setOu(String ou) { this.ou = ou; } /** uid public String getUid() { return uid; } /** uid public void setUid(String uid) { this.uid = uid; } /** 邮箱 public String getEmail() { return email; } /** 邮箱 public void setEmail(String email) { this.email = email; } /** public Date getCreatedAt() { return createdAt; } /** public void setCreatedAt(Date createdAt) { this.createdAt = createdAt; } /**
LdapUser::getUpdatedAt
java
PlayEdu/PlayEdu
playedu-api/playedu-common/src/main/java/xyz/playedu/common/domain/LdapUser.java
https://github.com/PlayEdu/PlayEdu/blob/master/playedu-api/playedu-common/src/main/java/xyz/playedu/common/domain/LdapUser.java
Apache-2.0
public void setUpdatedAt(Date updatedAt) { this.updatedAt = updatedAt; }
@TableName ldap_user @TableName(value = "ldap_user") public class LdapUser implements Serializable { /** @TableId(type = IdType.AUTO) private Integer id; /** 唯一特征值 private String uuid; /** 用户ID private Integer userId; /** cn private String cn; /** dn private String dn; /** ou private String ou; /** uid private String uid; /** 邮箱 private String email; /** private Date createdAt; /** private Date updatedAt; @TableField(exist = false) private static final long serialVersionUID = 1L; /** public Integer getId() { return id; } /** public void setId(Integer id) { this.id = id; } /** 唯一特征值 public String getUuid() { return uuid; } /** 唯一特征值 public void setUuid(String uuid) { this.uuid = uuid; } /** 用户ID public Integer getUserId() { return userId; } /** 用户ID public void setUserId(Integer userId) { this.userId = userId; } /** cn public String getCn() { return cn; } /** cn public void setCn(String cn) { this.cn = cn; } /** dn public String getDn() { return dn; } /** dn public void setDn(String dn) { this.dn = dn; } /** ou public String getOu() { return ou; } /** ou public void setOu(String ou) { this.ou = ou; } /** uid public String getUid() { return uid; } /** uid public void setUid(String uid) { this.uid = uid; } /** 邮箱 public String getEmail() { return email; } /** 邮箱 public void setEmail(String email) { this.email = email; } /** public Date getCreatedAt() { return createdAt; } /** public void setCreatedAt(Date createdAt) { this.createdAt = createdAt; } /** public Date getUpdatedAt() { return updatedAt; } /**
LdapUser::setUpdatedAt
java
PlayEdu/PlayEdu
playedu-api/playedu-common/src/main/java/xyz/playedu/common/domain/LdapUser.java
https://github.com/PlayEdu/PlayEdu/blob/master/playedu-api/playedu-common/src/main/java/xyz/playedu/common/domain/LdapUser.java
Apache-2.0
public Integer getDepartmentId() { return departmentId; }
/* Copyright (C) 2023 杭州白书科技有限公司 Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. package xyz.playedu.common.domain; import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import com.fasterxml.jackson.annotation.JsonProperty; import java.io.Serializable; import java.util.Date; @TableName(value = "ldap_department") public class LdapDepartment implements Serializable { /** @TableId(type = IdType.AUTO) private Integer id; /** 唯一特征值 private String uuid; /** 部门ID @JsonProperty("department_id") private Integer departmentId; /** dn private String dn; /** @JsonProperty("created_at") private Date createdAt; /** @JsonProperty("updated_at") private Date updatedAt; @TableField(exist = false) private static final long serialVersionUID = 1L; /** public Integer getId() { return id; } /** public void setId(Integer id) { this.id = id; } /** 唯一特征值 public String getUuid() { return uuid; } /** 唯一特征值 public void setUuid(String uuid) { this.uuid = uuid; } /** 部门ID
LdapDepartment::getDepartmentId
java
PlayEdu/PlayEdu
playedu-api/playedu-common/src/main/java/xyz/playedu/common/domain/LdapDepartment.java
https://github.com/PlayEdu/PlayEdu/blob/master/playedu-api/playedu-common/src/main/java/xyz/playedu/common/domain/LdapDepartment.java
Apache-2.0
public void setDepartmentId(Integer departmentId) { this.departmentId = departmentId; }
/* Copyright (C) 2023 杭州白书科技有限公司 Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. package xyz.playedu.common.domain; import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableField; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import com.fasterxml.jackson.annotation.JsonProperty; import java.io.Serializable; import java.util.Date; @TableName(value = "ldap_department") public class LdapDepartment implements Serializable { /** @TableId(type = IdType.AUTO) private Integer id; /** 唯一特征值 private String uuid; /** 部门ID @JsonProperty("department_id") private Integer departmentId; /** dn private String dn; /** @JsonProperty("created_at") private Date createdAt; /** @JsonProperty("updated_at") private Date updatedAt; @TableField(exist = false) private static final long serialVersionUID = 1L; /** public Integer getId() { return id; } /** public void setId(Integer id) { this.id = id; } /** 唯一特征值 public String getUuid() { return uuid; } /** 唯一特征值 public void setUuid(String uuid) { this.uuid = uuid; } /** 部门ID public Integer getDepartmentId() { return departmentId; } /** 部门ID
LdapDepartment::setDepartmentId
java
PlayEdu/PlayEdu
playedu-api/playedu-common/src/main/java/xyz/playedu/common/domain/LdapDepartment.java
https://github.com/PlayEdu/PlayEdu/blob/master/playedu-api/playedu-common/src/main/java/xyz/playedu/common/domain/LdapDepartment.java
Apache-2.0
public int getCurrentItemFake() { return super.getCurrentItem(); }
Get the currently selected page.
UltraViewPagerView::getCurrentItemFake
java
alibaba/UltraViewPager
ultraviewpager/src/main/java/com/tmall/ultraviewpager/UltraViewPagerView.java
https://github.com/alibaba/UltraViewPager/blob/master/ultraviewpager/src/main/java/com/tmall/ultraviewpager/UltraViewPagerView.java
MIT
protected InetSocketAddress getRewrittenDestination() { int destIp = id.getDestinationIp(); int port = id.getDestinationPort(); return new InetSocketAddress(getRewrittenAddress(destIp), port); }
Get destination, rewritten to {@code localhost} if it was {@code 10.0.2.2}. @return Destination to connect to.
AbstractConnection::getRewrittenDestination
java
Genymobile/gnirehtet
relay-java/src/main/java/com/genymobile/gnirehtet/relay/AbstractConnection.java
https://github.com/Genymobile/gnirehtet/blob/master/relay-java/src/main/java/com/genymobile/gnirehtet/relay/AbstractConnection.java
Apache-2.0
private void optimize() { if (isEmpty()) { head = 0; tail = 0; } }
To avoid unnecessary copies, StreamBuffer writes at most until the "end" of the circular buffer, which is suboptimal (it could have written more data if they have been contiguous). <p> In order to minimize the occurrence of this event, reset the head and tail to 0 when the buffer is empty (no copy is involved). <p> This is especially useful when the StreamBuffer is used to read/write one packet at a time, so the "end" of the buffer is guaranteed to never be reached.
StreamBuffer::optimize
java
Genymobile/gnirehtet
relay-java/src/main/java/com/genymobile/gnirehtet/relay/StreamBuffer.java
https://github.com/Genymobile/gnirehtet/blob/master/relay-java/src/main/java/com/genymobile/gnirehtet/relay/StreamBuffer.java
Apache-2.0
public static int readVersion(ByteBuffer buffer) { if (buffer.limit() == 0) { // buffer is empty return -1; } // version is stored in the 4 first bits byte versionAndIHL = buffer.get(0); return (versionAndIHL & 0xf0) >> 4; }
Read the packet IP version, assuming that an IP packets is stored at absolute position 0. @param buffer the buffer @return the IP version, or {@code -1} if not available
Protocol::readVersion
java
Genymobile/gnirehtet
relay-java/src/main/java/com/genymobile/gnirehtet/relay/IPv4Header.java
https://github.com/Genymobile/gnirehtet/blob/master/relay-java/src/main/java/com/genymobile/gnirehtet/relay/IPv4Header.java
Apache-2.0
public static int readLength(ByteBuffer buffer) { if (buffer.limit() < 4) { // buffer does not even contains the length field return -1; } // packet length is 16 bits starting at offset 2 return Short.toUnsignedInt(buffer.getShort(2)); }
Read the packet length, assuming thatan IP packet is stored at absolute position 0. @param buffer the buffer @return the packet length, or {@code -1} if not available
Protocol::readLength
java
Genymobile/gnirehtet
relay-java/src/main/java/com/genymobile/gnirehtet/relay/IPv4Header.java
https://github.com/Genymobile/gnirehtet/blob/master/relay-java/src/main/java/com/genymobile/gnirehtet/relay/IPv4Header.java
Apache-2.0
private void wakeUpReadWorkaround() { // network actions may not be called from the main thread EXECUTOR_SERVICE.execute(new Runnable() { @Override public void run() { try { DatagramSocket socket = new DatagramSocket(); InetAddress dummyAddr = InetAddress.getByAddress(DUMMY_ADDRESS); DatagramPacket packet = new DatagramPacket(new byte[0], 0, dummyAddr, DUMMY_PORT); socket.send(packet); } catch (IOException e) { // ignore } } }); }
Neither vpnInterface.close() nor vpnInputStream.close() wake up a blocking vpnInputStream.read(). <p> Therefore, we need to make Android send a packet to the VPN interface (here by sending a UDP packet), so that any blocking read will be woken up. <p> Since the tunnel is closed at this point, it will never reach the network.
getSimpleName::wakeUpReadWorkaround
java
Genymobile/gnirehtet
app/src/main/java/com/genymobile/gnirehtet/Forwarder.java
https://github.com/Genymobile/gnirehtet/blob/master/app/src/main/java/com/genymobile/gnirehtet/Forwarder.java
Apache-2.0
public synchronized void invalidateTunnel(Tunnel tunnelToInvalidate) { if (tunnel == tunnelToInvalidate || tunnelToInvalidate == null) { invalidateTunnel(); } }
Call {@link #invalidateTunnel()} only if {@code tunnelToInvalidate} is the current tunnel (or is {@code null}). @param tunnelToInvalidate the tunnel to invalidate
RelayTunnelProvider::invalidateTunnel
java
Genymobile/gnirehtet
app/src/main/java/com/genymobile/gnirehtet/RelayTunnelProvider.java
https://github.com/Genymobile/gnirehtet/blob/master/app/src/main/java/com/genymobile/gnirehtet/RelayTunnelProvider.java
Apache-2.0
private static void readClientId(InputStream inputStream) throws IOException { Log.d(TAG, "Requesting client id"); int clientId = new DataInputStream(inputStream).readInt(); Log.d(TAG, "Connected to the relay server as #" + Binary.unsigned(clientId)); }
The relay server is accessible through an "adb reverse" port redirection. <p> If the port redirection is enabled but the relay server is not started, then the call to channel.connect() will succeed, but the first read() will return -1. <p> As a consequence, the connection state of the relay server would be invalid temporarily (we would switch to CONNECTED state then switch back to DISCONNECTED). <p> To avoid this problem, we must actually read from the server, so that an error occurs immediately if the relay server is not accessible. <p> Therefore, the relay server immediately sends the client id: consume it and log it. @param inputStream the input stream to receive data from the relay server @throws IOException if an I/O error occurs
getSimpleName::readClientId
java
Genymobile/gnirehtet
app/src/main/java/com/genymobile/gnirehtet/RelayTunnel.java
https://github.com/Genymobile/gnirehtet/blob/master/app/src/main/java/com/genymobile/gnirehtet/RelayTunnel.java
Apache-2.0
public static ValidationResult isValidFile(@NonNull File f) { ValidationResult vr = isValidFile(f, "File", false); if (vr != null) return vr; return ValidationResult.builder() .valid(true) .formatType("File") .path(getPath(f)) .build(); }
Validate whether the specified file is a valid file (must exist and be non-empty) @param f File to check @return Result of validation
Nd4jCommonValidator::isValidFile
java
deeplearning4j/deeplearning4j
nd4j/nd4j-common/src/main/java/org/nd4j/common/validation/Nd4jCommonValidator.java
https://github.com/deeplearning4j/deeplearning4j/blob/master/nd4j/nd4j-common/src/main/java/org/nd4j/common/validation/Nd4jCommonValidator.java
Apache-2.0
public static ValidationResult isValidFile(@NonNull File f, String formatType, boolean allowEmpty) { String path; try { path = f.getAbsolutePath(); //Very occasionally: getAbsolutePath not possible (files in JARs etc) } catch (Throwable t) { path = f.getPath(); } if (f.exists() && !f.isFile()) { return ValidationResult.builder() .valid(false) .formatType(formatType) .path(path) .issues(Collections.singletonList(f.isDirectory() ? "Specified path is a directory" : "Specified path is not a file")) .build(); } if (!f.exists() || !f.isFile()) { return ValidationResult.builder() .valid(false) .formatType(formatType) .path(path) .issues(Collections.singletonList("File does not exist")) .build(); } if (!allowEmpty && f.length() <= 0) { return ValidationResult.builder() .valid(false) .formatType(formatType) .path(path) .issues(Collections.singletonList("File is empty (length 0)")) .build(); } return null; //OK }
Validate whether the specified file is a valid file @param f File to check @param formatType Name of the file format to include in validation results @param allowEmpty If true: allow empty files to pass. False: empty files will fail validation @return Result of validation
Nd4jCommonValidator::isValidFile
java
deeplearning4j/deeplearning4j
nd4j/nd4j-common/src/main/java/org/nd4j/common/validation/Nd4jCommonValidator.java
https://github.com/deeplearning4j/deeplearning4j/blob/master/nd4j/nd4j-common/src/main/java/org/nd4j/common/validation/Nd4jCommonValidator.java
Apache-2.0
public static ValidationResult isValidJson(@NonNull File f, Charset charset) { ValidationResult vr = isValidFile(f, "JSON", false); if (vr != null) return vr; String content; try { content = FileUtils.readFileToString(f, charset); } catch (IOException e) { return ValidationResult.builder() .valid(false) .formatType("JSON") .path(getPath(f)) .issues(Collections.singletonList("Unable to read file (IOException)")) .exception(e) .build(); } return isValidJson(content, f); }
Validate whether the specified file is a valid JSON file. Note that this does not match the JSON content against a specific schema @param f File to check @param charset Character set for file @return Result of validation
Nd4jCommonValidator::isValidJson
java
deeplearning4j/deeplearning4j
nd4j/nd4j-common/src/main/java/org/nd4j/common/validation/Nd4jCommonValidator.java
https://github.com/deeplearning4j/deeplearning4j/blob/master/nd4j/nd4j-common/src/main/java/org/nd4j/common/validation/Nd4jCommonValidator.java
Apache-2.0
public static ValidationResult isValidJSON(String s) { return isValidJson(s, null); }
Validate whether the specified String is valid JSON. Note that this does not match the JSON content against a specific schema @param s JSON String to check @return Result of validation
Nd4jCommonValidator::isValidJSON
java
deeplearning4j/deeplearning4j
nd4j/nd4j-common/src/main/java/org/nd4j/common/validation/Nd4jCommonValidator.java
https://github.com/deeplearning4j/deeplearning4j/blob/master/nd4j/nd4j-common/src/main/java/org/nd4j/common/validation/Nd4jCommonValidator.java
Apache-2.0
public String getTitleLine( int mtLv, int title_I ) { // String info = ""; // if ( title_I < 0 ) return "?"; if ( title_I > 5 ) return "?"; // info = ""; info += BTools.getMtLvESS( mtLv ); info += BTools.getMtLvISS(); info += "|"; // InfoValues i_IV; // String i_ValuesS = ""; // int i_VSLen = -1; // String i_TitleS = ""; // for ( int i = 0; i < ivL.size(); i ++ ) { // i_IV = ivL.get( i ); // i_ValuesS = i_IV.getValues(); // i_VSLen = i_ValuesS.length(); // i_TitleS = ( title_I < i_IV.titleA.length )? i_IV.titleA[ title_I ] : ""; // i_TitleS = i_TitleS + BTools.getSpaces( i_VSLen ); // info += i_TitleS.substring( 0, i_VSLen - 1 ); // info += "|"; } // return info; }
Returns titles line as string appointed by title index (0..5).<br> Columns are separated with char '|'.<br> If title index is < 0 returns "?".<br> If title index is > 5 returns "?".<br> @param mtLv - method level @param title_I - title index @return titles line as string
InfoLine::getTitleLine
java
deeplearning4j/deeplearning4j
nd4j/nd4j-common/src/main/java/org/nd4j/common/tools/InfoLine.java
https://github.com/deeplearning4j/deeplearning4j/blob/master/nd4j/nd4j-common/src/main/java/org/nd4j/common/tools/InfoLine.java
Apache-2.0
public String getValuesLine( int mtLv ) { // String info = ""; // info += BTools.getMtLvESS( mtLv ); info += BTools.getMtLvISS(); info += "|"; // InfoValues i_IV; // for ( int i = 0; i < ivL.size(); i ++ ) { // i_IV = ivL.get( i ); // info += i_IV.getValues(); } // return info; }
Returns values line as string.<br> Columns are separated with char '|'.<br> @param mtLv - method level @return values line as string
InfoLine::getValuesLine
java
deeplearning4j/deeplearning4j
nd4j/nd4j-common/src/main/java/org/nd4j/common/tools/InfoLine.java
https://github.com/deeplearning4j/deeplearning4j/blob/master/nd4j/nd4j-common/src/main/java/org/nd4j/common/tools/InfoLine.java
Apache-2.0
public void initValues( int mtLv, String superiorModuleCode, PrintStream out, PrintStream err ) { // mtLv ++; // moduleCode = superiorModuleCode + "." + baseModuleCode; // this.out = out; this.err = err; // }
<b>initValues</b><br> public void initValues( int mtLv, String superiorModuleCode,<br> PrintStream out, PrintStream err )<br> Initialize values for console - not file.<br> @param mtLv - method level @param superiorModuleCode - superior module code @param out - console standard output @param err - console error output (not used)
SIS::initValues
java
deeplearning4j/deeplearning4j
nd4j/nd4j-common/src/main/java/org/nd4j/common/tools/SIS.java
https://github.com/deeplearning4j/deeplearning4j/blob/master/nd4j/nd4j-common/src/main/java/org/nd4j/common/tools/SIS.java
Apache-2.0
public void initValues( int mtLv, String superiorModuleCode, PrintStream out, PrintStream err, String fileDrcS, String base_FileCode, String spc_FileCode, boolean ShowBriefInfo, boolean ShowFullInfo ) { // mtLv ++; // moduleCode = superiorModuleCode + "." + baseModuleCode; // String methodName = moduleCode + "." + "initValues"; // this.out = out; this.err = err; // if ( ShowBriefInfo || ShowFullInfo ) { out.format( "" ); out.format( BTools.getMtLvESS( mtLv ) ); out.format( methodName + ": " ); out.format( "fileDrcS: " + fileDrcS + "; " ); out.format( "base_FileCode: " + base_FileCode + "; " ); out.format( "spc_FileCode: " + spc_FileCode + "; " ); // out.format( "STm: %s; ", Tools.getSDatePM( System.currentTimeMillis(), "HH:mm:ss" ) + "; " ); out.format( "%s", BTools.getSLcDtTm() ); out.format( "%n" ); } // initFile( mtLv, fileDrcS, base_FileCode, spc_FileCode, ShowBriefInfo, ShowFullInfo ); // }
<b>initValues</b><br> public void initValues( int mtLv, String superiorModuleCode,<br> PrintStream out, PrintStream err, String fileDrcS,<br> String base_FileCode, String spc_FileCode,<br> boolean ShowBriefInfo, boolean ShowFullInfo )<br> Initialize values for console and file.<br> fullFileName =<br> "Z" +<br> TimeS + "_" +<br> base_FileCode + "_" +<br> spc_FileCode +<br> ".txt";<br> TimeS (time string) format: "yyyyMMdd'_'HHmmss.SSS"<br> @param mtLv - method level @param superiorModuleCode - superior module code @param out - console standard output @param err - console error output (not used) @param fileDrcS - file directory as string @param base_FileCode - base part of file code @param spc_FileCode - specifying part of file code @param ShowBriefInfo - show brief informations @param ShowFullInfo - show full informations
SIS::initValues
java
deeplearning4j/deeplearning4j
nd4j/nd4j-common/src/main/java/org/nd4j/common/tools/SIS.java
https://github.com/deeplearning4j/deeplearning4j/blob/master/nd4j/nd4j-common/src/main/java/org/nd4j/common/tools/SIS.java
Apache-2.0
public String getfullFileName() { // return fullFileName; }
<b>getfullFileName</b><br> public String getfullFileName()<br> Returns full file name<br> @return full file name
SIS::getfullFileName
java
deeplearning4j/deeplearning4j
nd4j/nd4j-common/src/main/java/org/nd4j/common/tools/SIS.java
https://github.com/deeplearning4j/deeplearning4j/blob/master/nd4j/nd4j-common/src/main/java/org/nd4j/common/tools/SIS.java
Apache-2.0
public void info( String oinfo ) { // String methodName = moduleCode + "." + "info"; // out.format( "%s%n", oinfo ); // charsCount += oinfo.length(); // String FOInfo = getFullInfoString( oinfo ); // if ( !isFileOpen( methodName ) ) return; // outFile( FOInfo ); // flushFile(); // }
<b>info</b><br> public void info( String oinfo )<br> This method is input for informations.<br> Informations are showed in console and saved in file.<br> @param oinfo - information
SIS::info
java
deeplearning4j/deeplearning4j
nd4j/nd4j-common/src/main/java/org/nd4j/common/tools/SIS.java
https://github.com/deeplearning4j/deeplearning4j/blob/master/nd4j/nd4j-common/src/main/java/org/nd4j/common/tools/SIS.java
Apache-2.0
public long getcharsCount() { // return charsCount; }
<b>getcharsCount</b><br> public long getcharsCount()<br> Returns chars count counted from SIS creating.<br> @return chars count
SIS::getcharsCount
java
deeplearning4j/deeplearning4j
nd4j/nd4j-common/src/main/java/org/nd4j/common/tools/SIS.java
https://github.com/deeplearning4j/deeplearning4j/blob/master/nd4j/nd4j-common/src/main/java/org/nd4j/common/tools/SIS.java
Apache-2.0
public void onStop( int mtLv ) { // mtLv ++; // String oinfo = ""; // String methodName = moduleCode + "." + "onStop"; // oinfo = ""; oinfo += BTools.getMtLvESS( mtLv ); oinfo += methodName + ": "; oinfo += BTools.getSLcDtTm(); info( oinfo ); // closeFile(); // }
<b>onStop</b><br> public void onStop( int mtLv )<br> This method should be called at the end of program.<br> Close file.<br> @param mtLv - method level
SIS::onStop
java
deeplearning4j/deeplearning4j
nd4j/nd4j-common/src/main/java/org/nd4j/common/tools/SIS.java
https://github.com/deeplearning4j/deeplearning4j/blob/master/nd4j/nd4j-common/src/main/java/org/nd4j/common/tools/SIS.java
Apache-2.0
public String getValues() { // String info = ""; // for ( int i = 0; i < vsL.size(); i ++ ) { // info += vsL.get( i ) + "|"; } // return info; }
Returns values.<br> This method use class InfoLine.<br> This method is not intended for external use.<br> @return
InfoValues::getValues
java
deeplearning4j/deeplearning4j
nd4j/nd4j-common/src/main/java/org/nd4j/common/tools/InfoValues.java
https://github.com/deeplearning4j/deeplearning4j/blob/master/nd4j/nd4j-common/src/main/java/org/nd4j/common/tools/InfoValues.java
Apache-2.0
public String parseString(String name) { String property = getProperties().getProperty(name); if (property == null) { throw new NullPointerException(); } return property; }
Parse property. @param name property name @return property
PropertyParser::parseString
java
deeplearning4j/deeplearning4j
nd4j/nd4j-common/src/main/java/org/nd4j/common/tools/PropertyParser.java
https://github.com/deeplearning4j/deeplearning4j/blob/master/nd4j/nd4j-common/src/main/java/org/nd4j/common/tools/PropertyParser.java
Apache-2.0
public String toString(String name) { return toString(name, ""); }
Get property. The method returns the default value if the property is not parsed. @param name property name @return property
PropertyParser::toString
java
deeplearning4j/deeplearning4j
nd4j/nd4j-common/src/main/java/org/nd4j/common/tools/PropertyParser.java
https://github.com/deeplearning4j/deeplearning4j/blob/master/nd4j/nd4j-common/src/main/java/org/nd4j/common/tools/PropertyParser.java
Apache-2.0
public String toString(String name, String defaultValue) { String property = getProperties().getProperty(name); return property != null ? property : defaultValue; }
Get property. The method returns the default value if the property is not parsed. @param name property name @param defaultValue default value @return property
PropertyParser::toString
java
deeplearning4j/deeplearning4j
nd4j/nd4j-common/src/main/java/org/nd4j/common/tools/PropertyParser.java
https://github.com/deeplearning4j/deeplearning4j/blob/master/nd4j/nd4j-common/src/main/java/org/nd4j/common/tools/PropertyParser.java
Apache-2.0
public static String getMtLvESS( int mtLv ) { // MtLvESS = Method Level External Shift String // if ( mtLv < 0 ) return "?"; // String Result = ""; // // String LvS = ". "; String LvS = "."; // for ( int K = 1; K <= mtLv; K ++ ) { // Result = Result + LvS; } // return Result; }
<b>getMtLvESS</b><br> public static String getMtLvESS( int mtLv )<br> Returns string. String length create indentation(shift) of other text.<br> Indentation depends on method level - great method level, great indentation.<br> Main method has method level 0.<br> Other called method has method level 1, 2,...N.<br> @param mtLv - method level @return method level external shift string
BTools::getMtLvESS
java
deeplearning4j/deeplearning4j
nd4j/nd4j-common/src/main/java/org/nd4j/common/tools/BTools.java
https://github.com/deeplearning4j/deeplearning4j/blob/master/nd4j/nd4j-common/src/main/java/org/nd4j/common/tools/BTools.java
Apache-2.0
public static String getMtLvISS() { // MtLvISS = Method Level Intern Shift String // // String Result = ".."; // String Result = "~"; String Result = " "; // return Result; }
<b>getMtLvISS</b><br> public static String getMtLvISS()<br> Returns string. String create indentation(shift)<br> internal text to start text of method.<br> @return method level internal shift string
BTools::getMtLvISS
java
deeplearning4j/deeplearning4j
nd4j/nd4j-common/src/main/java/org/nd4j/common/tools/BTools.java
https://github.com/deeplearning4j/deeplearning4j/blob/master/nd4j/nd4j-common/src/main/java/org/nd4j/common/tools/BTools.java
Apache-2.0
public static String getSpaces( int SpacesCount ) { // if ( SpacesCount < 0 ) return "?"; // String Info = ""; // for ( int K = 1; K <= SpacesCount; K ++ ) { Info += " "; } // // return Info; }
<b>getSpaces</b><br> public static String getSpaces( int SpacesCount )<br> Returns asked count of spaces.<br> If count of spaces is < 0 returns '?'. @param SpacesCount = spaces count @return spaces
BTools::getSpaces
java
deeplearning4j/deeplearning4j
nd4j/nd4j-common/src/main/java/org/nd4j/common/tools/BTools.java
https://github.com/deeplearning4j/deeplearning4j/blob/master/nd4j/nd4j-common/src/main/java/org/nd4j/common/tools/BTools.java
Apache-2.0
public static String getSBln( boolean... blnA ) { // String Info = ""; // if ( blnA == null ) return "?"; if ( blnA.length == 0 ) return "?"; // for ( int K = 0; K < blnA.length; K ++ ) { // Info += ( blnA[ K ] )? "T" : "F"; } // return Info; }
<b>getSBln</b><br> public static String getSBln( boolean... blnA )<br> Returns boolean(s) converted to char (true = 'T'; false = 'F')<br> If blnA.length is > 1 returns chars without separator.<br> If blnA is '{ true, false, true }' returns 'TFT'.<br> If blnA is null returns '?'.<br> If blnA.length is 0 returns '?'.<br> @param blnA @return boolean(s) as string
BTools::getSBln
java
deeplearning4j/deeplearning4j
nd4j/nd4j-common/src/main/java/org/nd4j/common/tools/BTools.java
https://github.com/deeplearning4j/deeplearning4j/blob/master/nd4j/nd4j-common/src/main/java/org/nd4j/common/tools/BTools.java
Apache-2.0
public static String getSDbl( double Value, int DecPrec ) { // String Result = ""; // if ( Double.isNaN( Value ) ) return "NaN"; // if ( DecPrec < 0 ) DecPrec = 0; // String DFS = "###,###,##0"; // if ( DecPrec > 0 ) { int idx = 0; DFS += "."; while ( idx < DecPrec ) { DFS = DFS + "0"; idx ++; if ( idx > 100 ) break; } } // // Locale locale = new Locale("en", "UK"); // DecimalFormatSymbols DcmFrmSmb = new DecimalFormatSymbols( Locale.getDefault()); DcmFrmSmb.setDecimalSeparator('.'); DcmFrmSmb.setGroupingSeparator(' '); // DecimalFormat DcmFrm; // DcmFrm = new DecimalFormat( DFS, DcmFrmSmb ); // // DcmFrm.setGroupingSize( 3 ); // Result = DcmFrm.format( Value ); // return Result; }
<b>getSDbl</b><br> public static String getSDbl( double Value, int DecPrec )<br> Returns double converted to string.<br> If Value is Double.NaN returns "NaN".<br> If DecPrec is < 0 is DecPrec set 0.<br> @param Value - value @param DecPrec - decimal precision @return double as string
BTools::getSDbl
java
deeplearning4j/deeplearning4j
nd4j/nd4j-common/src/main/java/org/nd4j/common/tools/BTools.java
https://github.com/deeplearning4j/deeplearning4j/blob/master/nd4j/nd4j-common/src/main/java/org/nd4j/common/tools/BTools.java
Apache-2.0
public static String getSDbl( double Value, int DecPrec, boolean ShowPlusSign ) { // String PlusSign = ""; // if ( ShowPlusSign && Value > 0 ) PlusSign = "+"; if ( ShowPlusSign && Value == 0 ) PlusSign = " "; // return PlusSign + getSDbl( Value, DecPrec ); }
<b>getSDbl</b><br> public static String getSDbl( double Value, int DecPrec, boolean ShowPlusSign )<br> Returns double converted to string.<br> If Value is Double.NaN returns "NaN".<br> If DecPrec is < 0 is DecPrec set 0.<br> If ShowPlusSign is true:<br> - If Value is > 0 sign is '+'.<br> - If Value is 0 sign is ' '.<br> @param Value - value @param DecPrec - decimal precision @param ShowPlusSign - show plus sign @return double as string
BTools::getSDbl
java
deeplearning4j/deeplearning4j
nd4j/nd4j-common/src/main/java/org/nd4j/common/tools/BTools.java
https://github.com/deeplearning4j/deeplearning4j/blob/master/nd4j/nd4j-common/src/main/java/org/nd4j/common/tools/BTools.java
Apache-2.0
public static String getSDbl( double Value, int DecPrec, boolean ShowPlusSign, int StringLength ) { // String Info = ""; // String SDbl = getSDbl( Value, DecPrec, ShowPlusSign ); // if ( SDbl.length() >= StringLength ) return SDbl; // // String SpacesS = " "; String SpacesS = getSpaces( StringLength ); // Info = SpacesS.substring( 0, StringLength - SDbl.length() ) + SDbl; // return Info; }
<b>getSDbl</b><br> public static String getSDbl( double Value, int DecPrec, boolean ShowPlusSign, int StringLength )<br> Returns double converted to string.<br> If Value is Double.NaN returns "NaN".<br> If DecPrec is < 0 is DecPrec set 0.<br> If ShowPlusSign is true:<br> - If Value is > 0 sign is '+'.<br> - If Value is 0 sign is ' '.<br> If StringLength is > base double string length<br> before base double string adds relevant spaces.<br> If StringLength is <= base double string length<br> returns base double string.<br> @param Value - value @param DecPrec - decimal precision @param ShowPlusSign - show plus sign @param StringLength - string length @return double as string
BTools::getSDbl
java
deeplearning4j/deeplearning4j
nd4j/nd4j-common/src/main/java/org/nd4j/common/tools/BTools.java
https://github.com/deeplearning4j/deeplearning4j/blob/master/nd4j/nd4j-common/src/main/java/org/nd4j/common/tools/BTools.java
Apache-2.0
public static String getSInt( int Value, int CharsCount ) { // return getSInt( Value, CharsCount, ' ' ); }
<b>getSInt</b><br> public static String getSInt( int Value, int CharsCount )<br> Returns int converted to string.<br> If CharsCount > base int string length<br> before base int string adds relevant spaces.<br> If CharsCount <= base int string length<br> returns base int string.<br> @param Value - value @param CharsCount - chars count @return int as string
BTools::getSInt
java
deeplearning4j/deeplearning4j
nd4j/nd4j-common/src/main/java/org/nd4j/common/tools/BTools.java
https://github.com/deeplearning4j/deeplearning4j/blob/master/nd4j/nd4j-common/src/main/java/org/nd4j/common/tools/BTools.java
Apache-2.0
public static String getSInt( int Value, int CharsCount, char LeadingChar ) { // String Result = ""; // if ( CharsCount <= 0 ) { return getSInt( Value ); } // String FormatS = ""; if ( LeadingChar == '0' ) { FormatS = "%" + LeadingChar + Integer.toString( CharsCount ) + "d"; } else { FormatS = "%" + Integer.toString( CharsCount ) + "d"; } // Result = String.format( FormatS, Value ); // return Result; }
<b>getSInt</b><br> public static String getSInt( int Value, int CharsCount, char LeadingChar )<br> Returns int converted to string.<br> If CharsCount > base int string length<br> before base int string adds relevant leading chars.<br> If CharsCount <= base int string length<br> returns base int string.<br> @param Value - value @param CharsCount - chars count @param LeadingChar - leading char @return int as string
BTools::getSInt
java
deeplearning4j/deeplearning4j
nd4j/nd4j-common/src/main/java/org/nd4j/common/tools/BTools.java
https://github.com/deeplearning4j/deeplearning4j/blob/master/nd4j/nd4j-common/src/main/java/org/nd4j/common/tools/BTools.java
Apache-2.0
public static String getSInt( int Value ) { // String Result = ""; // Result = String.format( "%d", Value ); // return Result; }
<b>getSInt</b><br> public static String getSInt( int Value )<br> Returns int converted to string.<br> @param Value @return int as string
BTools::getSInt
java
deeplearning4j/deeplearning4j
nd4j/nd4j-common/src/main/java/org/nd4j/common/tools/BTools.java
https://github.com/deeplearning4j/deeplearning4j/blob/master/nd4j/nd4j-common/src/main/java/org/nd4j/common/tools/BTools.java
Apache-2.0
public static int getIndexCharsCount( int MaxIndex ) { // int CharsCount = 1; // if ( MaxIndex <= 0 ) return 1; // CharsCount = (int)Math.log10( MaxIndex ) + 1; // return CharsCount; }
<b>getIndexCharsCount</b><br> public static int getIndexCharsCount( int MaxIndex )<br> Returns chars count for max value of index.<br> Example: Max value of index is 150 and chars count is 3.<br> It is important for statement of indexed values.<br> Index columns can have the same width for all rouws.<br> @param MaxIndex - max value of index @return chars count for max value of index
BTools::getIndexCharsCount
java
deeplearning4j/deeplearning4j
nd4j/nd4j-common/src/main/java/org/nd4j/common/tools/BTools.java
https://github.com/deeplearning4j/deeplearning4j/blob/master/nd4j/nd4j-common/src/main/java/org/nd4j/common/tools/BTools.java
Apache-2.0
public static String getSLcDtTm() { // return getSLcDtTm( "mm:ss.SSS" ); }
<b>getSLcDtTm</b><br> public static String getSLcDtTm()<br> Returns local datetime as string.<br> Datetime format is "mm:ss.SSS".<br> @return local datetime as string
BTools::getSLcDtTm
java
deeplearning4j/deeplearning4j
nd4j/nd4j-common/src/main/java/org/nd4j/common/tools/BTools.java
https://github.com/deeplearning4j/deeplearning4j/blob/master/nd4j/nd4j-common/src/main/java/org/nd4j/common/tools/BTools.java
Apache-2.0
public static String getSLcDtTm( String FormatS ) { // String Result = "?"; // LocalDateTime LDT = LocalDateTime.now(); // Result = "LDTm: " + LDT.format( DateTimeFormatter.ofPattern( FormatS ) ); // return Result; }
<b>getSLcDtTm</b><br> public static String getSLcDtTm( String FormatS )<br> Returns local datetime as string.<br> Datetime format is param.<br> @param FormatS datetime format @return local datetime as string
BTools::getSLcDtTm
java
deeplearning4j/deeplearning4j
nd4j/nd4j-common/src/main/java/org/nd4j/common/tools/BTools.java
https://github.com/deeplearning4j/deeplearning4j/blob/master/nd4j/nd4j-common/src/main/java/org/nd4j/common/tools/BTools.java
Apache-2.0
public static <T> Optional<T> empty(){ return (Optional<T>)EMPTY; }
Returns an empty Optional instance. No value is present for this Optional.
Optional::empty
java
deeplearning4j/deeplearning4j
nd4j/nd4j-common/src/main/java/org/nd4j/common/primitives/Optional.java
https://github.com/deeplearning4j/deeplearning4j/blob/master/nd4j/nd4j-common/src/main/java/org/nd4j/common/primitives/Optional.java
Apache-2.0
public static <T> Optional<T> of(@NonNull T value){ return new Optional<>(value); }
Returns an Optional with the specified present non-null value. @param value the value to be present, which must be non-null @return an Optional with the value present
Optional::of
java
deeplearning4j/deeplearning4j
nd4j/nd4j-common/src/main/java/org/nd4j/common/primitives/Optional.java
https://github.com/deeplearning4j/deeplearning4j/blob/master/nd4j/nd4j-common/src/main/java/org/nd4j/common/primitives/Optional.java
Apache-2.0
public static <T> Optional<T> ofNullable(T value){ if(value == null){ return empty(); } return new Optional<>(value); }
Returns an Optional describing the specified value, if non-null, otherwise returns an empty Optional. @param value the possibly-null value to describe @return an Optional with a present value if the specified value is non-null, otherwise an empty Optional
Optional::ofNullable
java
deeplearning4j/deeplearning4j
nd4j/nd4j-common/src/main/java/org/nd4j/common/primitives/Optional.java
https://github.com/deeplearning4j/deeplearning4j/blob/master/nd4j/nd4j-common/src/main/java/org/nd4j/common/primitives/Optional.java
Apache-2.0
public T get(){ if (!isPresent()) { throw new NoSuchElementException("Optional is empty"); } return value; }
If a value is present in this Optional, returns the value, otherwise throws NoSuchElementException. @return the non-null value held by this Optional @throws NoSuchElementException - if there is no value present
Optional::get
java
deeplearning4j/deeplearning4j
nd4j/nd4j-common/src/main/java/org/nd4j/common/primitives/Optional.java
https://github.com/deeplearning4j/deeplearning4j/blob/master/nd4j/nd4j-common/src/main/java/org/nd4j/common/primitives/Optional.java
Apache-2.0
public boolean isPresent(){ return value != null; }
Return true if there is a value present, otherwise false. @return true if there is a value present, otherwise false
Optional::isPresent
java
deeplearning4j/deeplearning4j
nd4j/nd4j-common/src/main/java/org/nd4j/common/primitives/Optional.java
https://github.com/deeplearning4j/deeplearning4j/blob/master/nd4j/nd4j-common/src/main/java/org/nd4j/common/primitives/Optional.java
Apache-2.0
public T orElse(T other){ if(isPresent()){ return get(); } return other; }
Return the value if present, otherwise return other. @param other the value to be returned if there is no value present, may be null @return
Optional::orElse
java
deeplearning4j/deeplearning4j
nd4j/nd4j-common/src/main/java/org/nd4j/common/primitives/Optional.java
https://github.com/deeplearning4j/deeplearning4j/blob/master/nd4j/nd4j-common/src/main/java/org/nd4j/common/primitives/Optional.java
Apache-2.0
public boolean isEmpty() { return maps.isEmpty(); }
This method checks if this CounterMap has any values stored @return
CounterMap::isEmpty
java
deeplearning4j/deeplearning4j
nd4j/nd4j-common/src/main/java/org/nd4j/common/primitives/CounterMap.java
https://github.com/deeplearning4j/deeplearning4j/blob/master/nd4j/nd4j-common/src/main/java/org/nd4j/common/primitives/CounterMap.java
Apache-2.0
public boolean isEmpty(F element){ if (isEmpty()) return true; Counter<S> m = maps.get(element); if (m == null) return true; else return m.isEmpty(); }
This method checks if this CounterMap has any values stored for a given first element @param element @return
CounterMap::isEmpty
java
deeplearning4j/deeplearning4j
nd4j/nd4j-common/src/main/java/org/nd4j/common/primitives/CounterMap.java
https://github.com/deeplearning4j/deeplearning4j/blob/master/nd4j/nd4j-common/src/main/java/org/nd4j/common/primitives/CounterMap.java
Apache-2.0
public void incrementAll(CounterMap<F, S> other) { for (Map.Entry<F, Counter<S>> entry : other.maps.entrySet()) { F key = entry.getKey(); Counter<S> innerCounter = entry.getValue(); for (Map.Entry<S, AtomicDouble> innerEntry : innerCounter.entrySet()) { S value = innerEntry.getKey(); incrementCount(key, value, innerEntry.getValue().get()); } } }
This method will increment values of this counter, by counts of other counter @param other
CounterMap::incrementAll
java
deeplearning4j/deeplearning4j
nd4j/nd4j-common/src/main/java/org/nd4j/common/primitives/CounterMap.java
https://github.com/deeplearning4j/deeplearning4j/blob/master/nd4j/nd4j-common/src/main/java/org/nd4j/common/primitives/CounterMap.java
Apache-2.0
public void incrementCount(F first, S second, double inc) { Counter<S> counter = maps.get(first); if (counter == null) { counter = new Counter<S>(); maps.put(first, counter); } counter.incrementCount(second, inc); }
This method will increment counts for a given first/second pair @param first @param second @param inc
CounterMap::incrementCount
java
deeplearning4j/deeplearning4j
nd4j/nd4j-common/src/main/java/org/nd4j/common/primitives/CounterMap.java
https://github.com/deeplearning4j/deeplearning4j/blob/master/nd4j/nd4j-common/src/main/java/org/nd4j/common/primitives/CounterMap.java
Apache-2.0
public double getCount(F first, S second) { Counter<S> counter = maps.get(first); if (counter == null) return 0.0; return counter.getCount(second); }
This method returns counts for a given first/second pair @param first @param second @return
CounterMap::getCount
java
deeplearning4j/deeplearning4j
nd4j/nd4j-common/src/main/java/org/nd4j/common/primitives/CounterMap.java
https://github.com/deeplearning4j/deeplearning4j/blob/master/nd4j/nd4j-common/src/main/java/org/nd4j/common/primitives/CounterMap.java
Apache-2.0
public double setCount(F first, S second, double value) { Counter<S> counter = maps.get(first); if (counter == null) { counter = new Counter<S>(); maps.put(first, counter); } return counter.setCount(second, value); }
This method allows you to set counter value for a given first/second pair @param first @param second @param value @return
CounterMap::setCount
java
deeplearning4j/deeplearning4j
nd4j/nd4j-common/src/main/java/org/nd4j/common/primitives/CounterMap.java
https://github.com/deeplearning4j/deeplearning4j/blob/master/nd4j/nd4j-common/src/main/java/org/nd4j/common/primitives/CounterMap.java
Apache-2.0
public Pair<F, S> argMax() { Double maxCount = -Double.MAX_VALUE; Pair<F, S> maxKey = null; for (Map.Entry<F, Counter<S>> entry : maps.entrySet()) { Counter<S> counter = entry.getValue(); S localMax = counter.argMax(); if (counter.getCount(localMax) > maxCount || maxKey == null) { maxKey = new Pair<F, S>(entry.getKey(), localMax); maxCount = counter.getCount(localMax); } } return maxKey; }
This method returns pair of elements with a max value @return
CounterMap::argMax
java
deeplearning4j/deeplearning4j
nd4j/nd4j-common/src/main/java/org/nd4j/common/primitives/CounterMap.java
https://github.com/deeplearning4j/deeplearning4j/blob/master/nd4j/nd4j-common/src/main/java/org/nd4j/common/primitives/CounterMap.java
Apache-2.0
public void clear() { maps.clear(); }
This method purges all counters
CounterMap::clear
java
deeplearning4j/deeplearning4j
nd4j/nd4j-common/src/main/java/org/nd4j/common/primitives/CounterMap.java
https://github.com/deeplearning4j/deeplearning4j/blob/master/nd4j/nd4j-common/src/main/java/org/nd4j/common/primitives/CounterMap.java
Apache-2.0
public void clear(F element) { Counter<S> s = maps.get(element); if (s != null) s.clear(); }
This method purges counter for a given first element @param element
CounterMap::clear
java
deeplearning4j/deeplearning4j
nd4j/nd4j-common/src/main/java/org/nd4j/common/primitives/CounterMap.java
https://github.com/deeplearning4j/deeplearning4j/blob/master/nd4j/nd4j-common/src/main/java/org/nd4j/common/primitives/CounterMap.java
Apache-2.0
public Set<F> keySet() { return maps.keySet(); }
This method returns Set of all first elements @return
CounterMap::keySet
java
deeplearning4j/deeplearning4j
nd4j/nd4j-common/src/main/java/org/nd4j/common/primitives/CounterMap.java
https://github.com/deeplearning4j/deeplearning4j/blob/master/nd4j/nd4j-common/src/main/java/org/nd4j/common/primitives/CounterMap.java
Apache-2.0
public Counter<S> getCounter(F first) { return maps.get(first); }
This method returns counter for a given first element @param first @return
CounterMap::getCounter
java
deeplearning4j/deeplearning4j
nd4j/nd4j-common/src/main/java/org/nd4j/common/primitives/CounterMap.java
https://github.com/deeplearning4j/deeplearning4j/blob/master/nd4j/nd4j-common/src/main/java/org/nd4j/common/primitives/CounterMap.java
Apache-2.0
public Iterator<Pair<F, S>> getIterator() { return new Iterator<Pair<F, S>>() { Iterator<F> outerIt; Iterator<S> innerIt; F curKey; { outerIt = keySet().iterator(); } private boolean hasInside() { if (innerIt == null || !innerIt.hasNext()) { if (!outerIt.hasNext()) { return false; } curKey = outerIt.next(); innerIt = getCounter(curKey).keySet().iterator(); } return true; } public boolean hasNext() { return hasInside(); } public Pair<F, S> next() { hasInside(); if (curKey == null) throw new RuntimeException("Outer element can't be null"); return Pair.makePair(curKey, innerIt.next()); } public void remove() { // } }; }
This method returns Iterator of all first/second pairs stored in this counter @return
CounterMap::getIterator
java
deeplearning4j/deeplearning4j
nd4j/nd4j-common/src/main/java/org/nd4j/common/primitives/CounterMap.java
https://github.com/deeplearning4j/deeplearning4j/blob/master/nd4j/nd4j-common/src/main/java/org/nd4j/common/primitives/CounterMap.java
Apache-2.0
public int size() { return maps.size(); }
This method returns number of First elements in this CounterMap @return
CounterMap::size
java
deeplearning4j/deeplearning4j
nd4j/nd4j-common/src/main/java/org/nd4j/common/primitives/CounterMap.java
https://github.com/deeplearning4j/deeplearning4j/blob/master/nd4j/nd4j-common/src/main/java/org/nd4j/common/primitives/CounterMap.java
Apache-2.0
public int totalSize() { int size = 0; for (F first: keySet()) { size += getCounter(first).size(); } return size; }
This method returns total number of elements in this CounterMap @return
CounterMap::totalSize
java
deeplearning4j/deeplearning4j
nd4j/nd4j-common/src/main/java/org/nd4j/common/primitives/CounterMap.java
https://github.com/deeplearning4j/deeplearning4j/blob/master/nd4j/nd4j-common/src/main/java/org/nd4j/common/primitives/CounterMap.java
Apache-2.0
public void incrementAll(Collection<T> elements, double inc) { for (T element: elements) { incrementCount(element, inc); } }
This method will increment all elements in collection @param elements @param inc
Counter::incrementAll
java
deeplearning4j/deeplearning4j
nd4j/nd4j-common/src/main/java/org/nd4j/common/primitives/Counter.java
https://github.com/deeplearning4j/deeplearning4j/blob/master/nd4j/nd4j-common/src/main/java/org/nd4j/common/primitives/Counter.java
Apache-2.0
public <T2 extends T> void incrementAll(Counter<T2> other) { for (T2 element: other.keySet()) { double cnt = other.getCount(element); incrementCount(element, cnt); } }
This method will increment counts of this counter by counts from other counter @param other
Counter::incrementAll
java
deeplearning4j/deeplearning4j
nd4j/nd4j-common/src/main/java/org/nd4j/common/primitives/Counter.java
https://github.com/deeplearning4j/deeplearning4j/blob/master/nd4j/nd4j-common/src/main/java/org/nd4j/common/primitives/Counter.java
Apache-2.0
public double getProbability(T element) { if (totalCount() <= 0.0) throw new IllegalStateException("Can't calculate probability with empty counter"); return getCount(element) / totalCount(); }
This method returns probability of given element @param element @return
Counter::getProbability
java
deeplearning4j/deeplearning4j
nd4j/nd4j-common/src/main/java/org/nd4j/common/primitives/Counter.java
https://github.com/deeplearning4j/deeplearning4j/blob/master/nd4j/nd4j-common/src/main/java/org/nd4j/common/primitives/Counter.java
Apache-2.0
public double setCount(T element, double count) { AtomicDouble t = map.get(element); if (t != null) { double val = t.getAndSet(count); dirty.set(true); return val; } else { map.put(element, new AtomicDouble(count)); totalCount.addAndGet(count); return 0; } }
This method sets new counter value for given element @param element element to be updated @param count new counter value @return previous value
Counter::setCount
java
deeplearning4j/deeplearning4j
nd4j/nd4j-common/src/main/java/org/nd4j/common/primitives/Counter.java
https://github.com/deeplearning4j/deeplearning4j/blob/master/nd4j/nd4j-common/src/main/java/org/nd4j/common/primitives/Counter.java
Apache-2.0
public Set<T> keySet() { return map.keySet(); }
This method returns Set of elements used in this counter @return
Counter::keySet
java
deeplearning4j/deeplearning4j
nd4j/nd4j-common/src/main/java/org/nd4j/common/primitives/Counter.java
https://github.com/deeplearning4j/deeplearning4j/blob/master/nd4j/nd4j-common/src/main/java/org/nd4j/common/primitives/Counter.java
Apache-2.0
public boolean isEmpty() { return map.size() == 0; }
This method returns TRUE if counter has no elements, FALSE otherwise @return
Counter::isEmpty
java
deeplearning4j/deeplearning4j
nd4j/nd4j-common/src/main/java/org/nd4j/common/primitives/Counter.java
https://github.com/deeplearning4j/deeplearning4j/blob/master/nd4j/nd4j-common/src/main/java/org/nd4j/common/primitives/Counter.java
Apache-2.0
public Set<Map.Entry<T, AtomicDouble>> entrySet() { return map.entrySet(); }
This method returns Set<Entry> of this counter @return
Counter::entrySet
java
deeplearning4j/deeplearning4j
nd4j/nd4j-common/src/main/java/org/nd4j/common/primitives/Counter.java
https://github.com/deeplearning4j/deeplearning4j/blob/master/nd4j/nd4j-common/src/main/java/org/nd4j/common/primitives/Counter.java
Apache-2.0