id int32 0 165k | repo stringlengths 7 58 | path stringlengths 12 218 | func_name stringlengths 3 140 | original_string stringlengths 73 34.1k | language stringclasses 1 value | code stringlengths 73 34.1k | code_tokens list | docstring stringlengths 3 16k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 105 339 |
|---|---|---|---|---|---|---|---|---|---|---|---|
31,200 | jfinal/jfinal | src/main/java/com/jfinal/config/Constants.java | Constants.setRenderFactory | public void setRenderFactory(IRenderFactory renderFactory) {
if (renderFactory == null) {
throw new IllegalArgumentException("renderFactory can not be null.");
}
RenderManager.me().setRenderFactory(renderFactory);
} | java | public void setRenderFactory(IRenderFactory renderFactory) {
if (renderFactory == null) {
throw new IllegalArgumentException("renderFactory can not be null.");
}
RenderManager.me().setRenderFactory(renderFactory);
} | [
"public",
"void",
"setRenderFactory",
"(",
"IRenderFactory",
"renderFactory",
")",
"{",
"if",
"(",
"renderFactory",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"renderFactory can not be null.\"",
")",
";",
"}",
"RenderManager",
".",
"m... | Set the renderFactory | [
"Set",
"the",
"renderFactory"
] | fc07f0f5d56e85ccd3cfcdd587b56b8dd9c663e9 | https://github.com/jfinal/jfinal/blob/fc07f0f5d56e85ccd3cfcdd587b56b8dd9c663e9/src/main/java/com/jfinal/config/Constants.java#L96-L101 |
31,201 | jfinal/jfinal | src/main/java/com/jfinal/config/Constants.java | Constants.setUrlParaSeparator | public void setUrlParaSeparator(String urlParaSeparator) {
if (StrKit.isBlank(urlParaSeparator) || urlParaSeparator.contains("/")) {
throw new IllegalArgumentException("urlParaSepartor can not be blank and can not contains \"/\"");
}
this.urlParaSeparator = urlParaSeparator;
} | java | public void setUrlParaSeparator(String urlParaSeparator) {
if (StrKit.isBlank(urlParaSeparator) || urlParaSeparator.contains("/")) {
throw new IllegalArgumentException("urlParaSepartor can not be blank and can not contains \"/\"");
}
this.urlParaSeparator = urlParaSeparator;
} | [
"public",
"void",
"setUrlParaSeparator",
"(",
"String",
"urlParaSeparator",
")",
"{",
"if",
"(",
"StrKit",
".",
"isBlank",
"(",
"urlParaSeparator",
")",
"||",
"urlParaSeparator",
".",
"contains",
"(",
"\"/\"",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentExcep... | Set urlPara separator. The default value is "-"
@param urlParaSeparator the urlPara separator | [
"Set",
"urlPara",
"separator",
".",
"The",
"default",
"value",
"is",
"-"
] | fc07f0f5d56e85ccd3cfcdd587b56b8dd9c663e9 | https://github.com/jfinal/jfinal/blob/fc07f0f5d56e85ccd3cfcdd587b56b8dd9c663e9/src/main/java/com/jfinal/config/Constants.java#L228-L233 |
31,202 | jfinal/jfinal | src/main/java/com/jfinal/plugin/activerecord/Model.java | Model._getAttrNames | public String[] _getAttrNames() {
Set<String> attrNameSet = attrs.keySet();
return attrNameSet.toArray(new String[attrNameSet.size()]);
} | java | public String[] _getAttrNames() {
Set<String> attrNameSet = attrs.keySet();
return attrNameSet.toArray(new String[attrNameSet.size()]);
} | [
"public",
"String",
"[",
"]",
"_getAttrNames",
"(",
")",
"{",
"Set",
"<",
"String",
">",
"attrNameSet",
"=",
"attrs",
".",
"keySet",
"(",
")",
";",
"return",
"attrNameSet",
".",
"toArray",
"(",
"new",
"String",
"[",
"attrNameSet",
".",
"size",
"(",
")"... | Return attribute names of this model. | [
"Return",
"attribute",
"names",
"of",
"this",
"model",
"."
] | fc07f0f5d56e85ccd3cfcdd587b56b8dd9c663e9 | https://github.com/jfinal/jfinal/blob/fc07f0f5d56e85ccd3cfcdd587b56b8dd9c663e9/src/main/java/com/jfinal/plugin/activerecord/Model.java#L125-L128 |
31,203 | jfinal/jfinal | src/main/java/com/jfinal/plugin/activerecord/Model.java | Model._getAttrValues | public Object[] _getAttrValues() {
java.util.Collection<Object> attrValueCollection = attrs.values();
return attrValueCollection.toArray(new Object[attrValueCollection.size()]);
} | java | public Object[] _getAttrValues() {
java.util.Collection<Object> attrValueCollection = attrs.values();
return attrValueCollection.toArray(new Object[attrValueCollection.size()]);
} | [
"public",
"Object",
"[",
"]",
"_getAttrValues",
"(",
")",
"{",
"java",
".",
"util",
".",
"Collection",
"<",
"Object",
">",
"attrValueCollection",
"=",
"attrs",
".",
"values",
"(",
")",
";",
"return",
"attrValueCollection",
".",
"toArray",
"(",
"new",
"Obje... | Return attribute values of this model. | [
"Return",
"attribute",
"values",
"of",
"this",
"model",
"."
] | fc07f0f5d56e85ccd3cfcdd587b56b8dd9c663e9 | https://github.com/jfinal/jfinal/blob/fc07f0f5d56e85ccd3cfcdd587b56b8dd9c663e9/src/main/java/com/jfinal/plugin/activerecord/Model.java#L133-L136 |
31,204 | jfinal/jfinal | src/main/java/com/jfinal/plugin/activerecord/Model.java | Model._setAttrs | public M _setAttrs(Map<String, Object> attrs) {
for (Entry<String, Object> e : attrs.entrySet())
set(e.getKey(), e.getValue());
return (M)this;
}
/*
private Set<String> getModifyFlag() {
if (modifyFlag == null)
modifyFlag = getConfig().containerFactory.getModifyFlagSet(); // new HashSet<String>();
return modifyFlag;
}*/
protected Set<String> _getModifyFlag() {
if (modifyFlag == null) {
Config config = _getConfig();
if (config == null)
modifyFlag = DbKit.brokenConfig.containerFactory.getModifyFlagSet();
else
modifyFlag = config.containerFactory.getModifyFlagSet();
}
return modifyFlag;
}
protected Config _getConfig() {
if (configName != null)
return DbKit.getConfig(configName);
return DbKit.getConfig(_getUsefulClass());
}
/*
private Config getConfig() {
return DbKit.getConfig(getUsefulClass());
}*/
protected Table _getTable() {
return TableMapping.me().getTable(_getUsefulClass());
}
protected Class<? extends Model> _getUsefulClass() {
Class c = getClass();
// guice : Model$$EnhancerByGuice$$40471411
// cglib : com.demo.blog.Blog$$EnhancerByCGLIB$$69a17158
// return c.getName().indexOf("EnhancerByCGLIB") == -1 ? c : c.getSuperclass();
return c.getName().indexOf("$$EnhancerBy") == -1 ? c : c.getSuperclass();
}
/**
* Switching data source, dialect and all config by configName
*/
public M use(String configName) {
if (attrs == DaoContainerFactory.daoMap) {
throw new RuntimeException("dao 只允许调用查询方法");
}
this.configName = configName;
return (M)this;
}
/**
* Set attribute to model.
* @param attr the attribute name of the model
* @param value the value of the attribute
* @return this model
* @throws ActiveRecordException if the attribute is not exists of the model
*/
public M set(String attr, Object value) {
Table table = _getTable(); // table 为 null 时用于未启动 ActiveRecordPlugin 的场景
if (table != null && !table.hasColumnLabel(attr)) {
throw new ActiveRecordException("The attribute name does not exist: \"" + attr + "\"");
}
attrs.put(attr, value);
_getModifyFlag().add(attr); // Add modify flag, update() need this flag.
return (M)this;
}
// public static transient boolean checkPutKey = true;
/**
* Put key value pair to the model without check attribute name.
*/
public M put(String key, Object value) {
/*
if (checkPutKey) {
Table table = getTable(); // table 为 null 时用于未启动 ActiveRecordPlugin 的场景
if (table != null && table.hasColumnLabel(key)) {
throw new ActiveRecordException("The key can not be attribute name: \"" + key + "\", using set(String, Object) for attribute value");
}
}*/
attrs.put(key, value);
return (M)this;
} | java | public M _setAttrs(Map<String, Object> attrs) {
for (Entry<String, Object> e : attrs.entrySet())
set(e.getKey(), e.getValue());
return (M)this;
}
/*
private Set<String> getModifyFlag() {
if (modifyFlag == null)
modifyFlag = getConfig().containerFactory.getModifyFlagSet(); // new HashSet<String>();
return modifyFlag;
}*/
protected Set<String> _getModifyFlag() {
if (modifyFlag == null) {
Config config = _getConfig();
if (config == null)
modifyFlag = DbKit.brokenConfig.containerFactory.getModifyFlagSet();
else
modifyFlag = config.containerFactory.getModifyFlagSet();
}
return modifyFlag;
}
protected Config _getConfig() {
if (configName != null)
return DbKit.getConfig(configName);
return DbKit.getConfig(_getUsefulClass());
}
/*
private Config getConfig() {
return DbKit.getConfig(getUsefulClass());
}*/
protected Table _getTable() {
return TableMapping.me().getTable(_getUsefulClass());
}
protected Class<? extends Model> _getUsefulClass() {
Class c = getClass();
// guice : Model$$EnhancerByGuice$$40471411
// cglib : com.demo.blog.Blog$$EnhancerByCGLIB$$69a17158
// return c.getName().indexOf("EnhancerByCGLIB") == -1 ? c : c.getSuperclass();
return c.getName().indexOf("$$EnhancerBy") == -1 ? c : c.getSuperclass();
}
/**
* Switching data source, dialect and all config by configName
*/
public M use(String configName) {
if (attrs == DaoContainerFactory.daoMap) {
throw new RuntimeException("dao 只允许调用查询方法");
}
this.configName = configName;
return (M)this;
}
/**
* Set attribute to model.
* @param attr the attribute name of the model
* @param value the value of the attribute
* @return this model
* @throws ActiveRecordException if the attribute is not exists of the model
*/
public M set(String attr, Object value) {
Table table = _getTable(); // table 为 null 时用于未启动 ActiveRecordPlugin 的场景
if (table != null && !table.hasColumnLabel(attr)) {
throw new ActiveRecordException("The attribute name does not exist: \"" + attr + "\"");
}
attrs.put(attr, value);
_getModifyFlag().add(attr); // Add modify flag, update() need this flag.
return (M)this;
}
// public static transient boolean checkPutKey = true;
/**
* Put key value pair to the model without check attribute name.
*/
public M put(String key, Object value) {
/*
if (checkPutKey) {
Table table = getTable(); // table 为 null 时用于未启动 ActiveRecordPlugin 的场景
if (table != null && table.hasColumnLabel(key)) {
throw new ActiveRecordException("The key can not be attribute name: \"" + key + "\", using set(String, Object) for attribute value");
}
}*/
attrs.put(key, value);
return (M)this;
} | [
"public",
"M",
"_setAttrs",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"attrs",
")",
"{",
"for",
"(",
"Entry",
"<",
"String",
",",
"Object",
">",
"e",
":",
"attrs",
".",
"entrySet",
"(",
")",
")",
"set",
"(",
"e",
".",
"getKey",
"(",
")",
"... | Set attributes with Map.
@param attrs attributes of this model
@return this Model | [
"Set",
"attributes",
"with",
"Map",
"."
] | fc07f0f5d56e85ccd3cfcdd587b56b8dd9c663e9 | https://github.com/jfinal/jfinal/blob/fc07f0f5d56e85ccd3cfcdd587b56b8dd9c663e9/src/main/java/com/jfinal/plugin/activerecord/Model.java#L152-L243 |
31,205 | jfinal/jfinal | src/main/java/com/jfinal/plugin/activerecord/Model.java | Model.put | public M put(Map<String, Object> map) {
attrs.putAll(map);
return (M)this;
} | java | public M put(Map<String, Object> map) {
attrs.putAll(map);
return (M)this;
} | [
"public",
"M",
"put",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"map",
")",
"{",
"attrs",
".",
"putAll",
"(",
"map",
")",
";",
"return",
"(",
"M",
")",
"this",
";",
"}"
] | Put map to the model without check attribute name. | [
"Put",
"map",
"to",
"the",
"model",
"without",
"check",
"attribute",
"name",
"."
] | fc07f0f5d56e85ccd3cfcdd587b56b8dd9c663e9 | https://github.com/jfinal/jfinal/blob/fc07f0f5d56e85ccd3cfcdd587b56b8dd9c663e9/src/main/java/com/jfinal/plugin/activerecord/Model.java#L273-L276 |
31,206 | jfinal/jfinal | src/main/java/com/jfinal/plugin/activerecord/Model.java | Model.get | public <T> T get(String attr, Object defaultValue) {
Object result = attrs.get(attr);
return (T)(result != null ? result : defaultValue);
} | java | public <T> T get(String attr, Object defaultValue) {
Object result = attrs.get(attr);
return (T)(result != null ? result : defaultValue);
} | [
"public",
"<",
"T",
">",
"T",
"get",
"(",
"String",
"attr",
",",
"Object",
"defaultValue",
")",
"{",
"Object",
"result",
"=",
"attrs",
".",
"get",
"(",
"attr",
")",
";",
"return",
"(",
"T",
")",
"(",
"result",
"!=",
"null",
"?",
"result",
":",
"d... | Get attribute of any mysql type. Returns defaultValue if null. | [
"Get",
"attribute",
"of",
"any",
"mysql",
"type",
".",
"Returns",
"defaultValue",
"if",
"null",
"."
] | fc07f0f5d56e85ccd3cfcdd587b56b8dd9c663e9 | https://github.com/jfinal/jfinal/blob/fc07f0f5d56e85ccd3cfcdd587b56b8dd9c663e9/src/main/java/com/jfinal/plugin/activerecord/Model.java#L311-L314 |
31,207 | jfinal/jfinal | src/main/java/com/jfinal/plugin/activerecord/Model.java | Model.save | public boolean save() {
filter(FILTER_BY_SAVE);
Config config = _getConfig();
Table table = _getTable();
StringBuilder sql = new StringBuilder();
List<Object> paras = new ArrayList<Object>();
config.dialect.forModelSave(table, attrs, sql, paras);
// if (paras.size() == 0) return false; // The sql "insert into tableName() values()" works fine, so delete this line
// --------
Connection conn = null;
PreparedStatement pst = null;
int result = 0;
try {
conn = config.getConnection();
if (config.dialect.isOracle()) {
pst = conn.prepareStatement(sql.toString(), table.getPrimaryKey());
} else {
pst = conn.prepareStatement(sql.toString(), Statement.RETURN_GENERATED_KEYS);
}
config.dialect.fillStatement(pst, paras);
result = pst.executeUpdate();
config.dialect.getModelGeneratedKey(this, pst, table);
_getModifyFlag().clear();
return result >= 1;
} catch (Exception e) {
throw new ActiveRecordException(e);
} finally {
config.close(pst, conn);
}
} | java | public boolean save() {
filter(FILTER_BY_SAVE);
Config config = _getConfig();
Table table = _getTable();
StringBuilder sql = new StringBuilder();
List<Object> paras = new ArrayList<Object>();
config.dialect.forModelSave(table, attrs, sql, paras);
// if (paras.size() == 0) return false; // The sql "insert into tableName() values()" works fine, so delete this line
// --------
Connection conn = null;
PreparedStatement pst = null;
int result = 0;
try {
conn = config.getConnection();
if (config.dialect.isOracle()) {
pst = conn.prepareStatement(sql.toString(), table.getPrimaryKey());
} else {
pst = conn.prepareStatement(sql.toString(), Statement.RETURN_GENERATED_KEYS);
}
config.dialect.fillStatement(pst, paras);
result = pst.executeUpdate();
config.dialect.getModelGeneratedKey(this, pst, table);
_getModifyFlag().clear();
return result >= 1;
} catch (Exception e) {
throw new ActiveRecordException(e);
} finally {
config.close(pst, conn);
}
} | [
"public",
"boolean",
"save",
"(",
")",
"{",
"filter",
"(",
"FILTER_BY_SAVE",
")",
";",
"Config",
"config",
"=",
"_getConfig",
"(",
")",
";",
"Table",
"table",
"=",
"_getTable",
"(",
")",
";",
"StringBuilder",
"sql",
"=",
"new",
"StringBuilder",
"(",
")",... | Save model. | [
"Save",
"model",
"."
] | fc07f0f5d56e85ccd3cfcdd587b56b8dd9c663e9 | https://github.com/jfinal/jfinal/blob/fc07f0f5d56e85ccd3cfcdd587b56b8dd9c663e9/src/main/java/com/jfinal/plugin/activerecord/Model.java#L534-L566 |
31,208 | jfinal/jfinal | src/main/java/com/jfinal/plugin/activerecord/Model.java | Model.deleteByIds | public boolean deleteByIds(Object... idValues) {
Table table = _getTable();
if (idValues == null || idValues.length != table.getPrimaryKey().length)
throw new IllegalArgumentException("Primary key nubmer must equals id value number and can not be null");
return deleteById(table, idValues);
} | java | public boolean deleteByIds(Object... idValues) {
Table table = _getTable();
if (idValues == null || idValues.length != table.getPrimaryKey().length)
throw new IllegalArgumentException("Primary key nubmer must equals id value number and can not be null");
return deleteById(table, idValues);
} | [
"public",
"boolean",
"deleteByIds",
"(",
"Object",
"...",
"idValues",
")",
"{",
"Table",
"table",
"=",
"_getTable",
"(",
")",
";",
"if",
"(",
"idValues",
"==",
"null",
"||",
"idValues",
".",
"length",
"!=",
"table",
".",
"getPrimaryKey",
"(",
")",
".",
... | Delete model by composite id values.
@param idValues the composite id values of the model
@return true if delete succeed otherwise false | [
"Delete",
"model",
"by",
"composite",
"id",
"values",
"."
] | fc07f0f5d56e85ccd3cfcdd587b56b8dd9c663e9 | https://github.com/jfinal/jfinal/blob/fc07f0f5d56e85ccd3cfcdd587b56b8dd9c663e9/src/main/java/com/jfinal/plugin/activerecord/Model.java#L606-L612 |
31,209 | jfinal/jfinal | src/main/java/com/jfinal/plugin/activerecord/Model.java | Model.update | public boolean update() {
filter(FILTER_BY_UPDATE);
if (_getModifyFlag().isEmpty()) {
return false;
}
Table table = _getTable();
String[] pKeys = table.getPrimaryKey();
for (String pKey : pKeys) {
Object id = attrs.get(pKey);
if (id == null)
throw new ActiveRecordException("You can't update model without Primary Key, " + pKey + " can not be null.");
}
Config config = _getConfig();
StringBuilder sql = new StringBuilder();
List<Object> paras = new ArrayList<Object>();
config.dialect.forModelUpdate(table, attrs, _getModifyFlag(), sql, paras);
if (paras.size() <= 1) { // Needn't update
return false;
}
// --------
Connection conn = null;
try {
conn = config.getConnection();
int result = Db.update(config, conn, sql.toString(), paras.toArray());
if (result >= 1) {
_getModifyFlag().clear();
return true;
}
return false;
} catch (Exception e) {
throw new ActiveRecordException(e);
} finally {
config.close(conn);
}
} | java | public boolean update() {
filter(FILTER_BY_UPDATE);
if (_getModifyFlag().isEmpty()) {
return false;
}
Table table = _getTable();
String[] pKeys = table.getPrimaryKey();
for (String pKey : pKeys) {
Object id = attrs.get(pKey);
if (id == null)
throw new ActiveRecordException("You can't update model without Primary Key, " + pKey + " can not be null.");
}
Config config = _getConfig();
StringBuilder sql = new StringBuilder();
List<Object> paras = new ArrayList<Object>();
config.dialect.forModelUpdate(table, attrs, _getModifyFlag(), sql, paras);
if (paras.size() <= 1) { // Needn't update
return false;
}
// --------
Connection conn = null;
try {
conn = config.getConnection();
int result = Db.update(config, conn, sql.toString(), paras.toArray());
if (result >= 1) {
_getModifyFlag().clear();
return true;
}
return false;
} catch (Exception e) {
throw new ActiveRecordException(e);
} finally {
config.close(conn);
}
} | [
"public",
"boolean",
"update",
"(",
")",
"{",
"filter",
"(",
"FILTER_BY_UPDATE",
")",
";",
"if",
"(",
"_getModifyFlag",
"(",
")",
".",
"isEmpty",
"(",
")",
")",
"{",
"return",
"false",
";",
"}",
"Table",
"table",
"=",
"_getTable",
"(",
")",
";",
"Str... | Update model. | [
"Update",
"model",
"."
] | fc07f0f5d56e85ccd3cfcdd587b56b8dd9c663e9 | https://github.com/jfinal/jfinal/blob/fc07f0f5d56e85ccd3cfcdd587b56b8dd9c663e9/src/main/java/com/jfinal/plugin/activerecord/Model.java#L631-L670 |
31,210 | jfinal/jfinal | src/main/java/com/jfinal/plugin/activerecord/Model.java | Model.remove | public M remove(String attr) {
attrs.remove(attr);
_getModifyFlag().remove(attr);
return (M)this;
} | java | public M remove(String attr) {
attrs.remove(attr);
_getModifyFlag().remove(attr);
return (M)this;
} | [
"public",
"M",
"remove",
"(",
"String",
"attr",
")",
"{",
"attrs",
".",
"remove",
"(",
"attr",
")",
";",
"_getModifyFlag",
"(",
")",
".",
"remove",
"(",
"attr",
")",
";",
"return",
"(",
"M",
")",
"this",
";",
"}"
] | Remove attribute of this model.
@param attr the attribute name of the model
@return this model | [
"Remove",
"attribute",
"of",
"this",
"model",
"."
] | fc07f0f5d56e85ccd3cfcdd587b56b8dd9c663e9 | https://github.com/jfinal/jfinal/blob/fc07f0f5d56e85ccd3cfcdd587b56b8dd9c663e9/src/main/java/com/jfinal/plugin/activerecord/Model.java#L800-L804 |
31,211 | jfinal/jfinal | src/main/java/com/jfinal/plugin/activerecord/Model.java | Model.remove | public M remove(String... attrs) {
if (attrs != null)
for (String a : attrs) {
this.attrs.remove(a);
this._getModifyFlag().remove(a);
}
return (M)this;
} | java | public M remove(String... attrs) {
if (attrs != null)
for (String a : attrs) {
this.attrs.remove(a);
this._getModifyFlag().remove(a);
}
return (M)this;
} | [
"public",
"M",
"remove",
"(",
"String",
"...",
"attrs",
")",
"{",
"if",
"(",
"attrs",
"!=",
"null",
")",
"for",
"(",
"String",
"a",
":",
"attrs",
")",
"{",
"this",
".",
"attrs",
".",
"remove",
"(",
"a",
")",
";",
"this",
".",
"_getModifyFlag",
"(... | Remove attributes of this model.
@param attrs the attribute names of the model
@return this model | [
"Remove",
"attributes",
"of",
"this",
"model",
"."
] | fc07f0f5d56e85ccd3cfcdd587b56b8dd9c663e9 | https://github.com/jfinal/jfinal/blob/fc07f0f5d56e85ccd3cfcdd587b56b8dd9c663e9/src/main/java/com/jfinal/plugin/activerecord/Model.java#L811-L818 |
31,212 | jfinal/jfinal | src/main/java/com/jfinal/plugin/activerecord/Model.java | Model.removeNullValueAttrs | public M removeNullValueAttrs() {
for (Iterator<Entry<String, Object>> it = attrs.entrySet().iterator(); it.hasNext();) {
Entry<String, Object> e = it.next();
if (e.getValue() == null) {
it.remove();
_getModifyFlag().remove(e.getKey());
}
}
return (M)this;
} | java | public M removeNullValueAttrs() {
for (Iterator<Entry<String, Object>> it = attrs.entrySet().iterator(); it.hasNext();) {
Entry<String, Object> e = it.next();
if (e.getValue() == null) {
it.remove();
_getModifyFlag().remove(e.getKey());
}
}
return (M)this;
} | [
"public",
"M",
"removeNullValueAttrs",
"(",
")",
"{",
"for",
"(",
"Iterator",
"<",
"Entry",
"<",
"String",
",",
"Object",
">",
">",
"it",
"=",
"attrs",
".",
"entrySet",
"(",
")",
".",
"iterator",
"(",
")",
";",
"it",
".",
"hasNext",
"(",
")",
";",
... | Remove attributes if it is null.
@return this model | [
"Remove",
"attributes",
"if",
"it",
"is",
"null",
"."
] | fc07f0f5d56e85ccd3cfcdd587b56b8dd9c663e9 | https://github.com/jfinal/jfinal/blob/fc07f0f5d56e85ccd3cfcdd587b56b8dd9c663e9/src/main/java/com/jfinal/plugin/activerecord/Model.java#L824-L833 |
31,213 | jfinal/jfinal | src/main/java/com/jfinal/plugin/activerecord/Model.java | Model.keep | public M keep(String... attrs) {
if (attrs != null && attrs.length > 0) {
Config config = _getConfig();
if (config == null) { // 支持无数据库连接场景
config = DbKit.brokenConfig;
}
Map<String, Object> newAttrs = config.containerFactory.getAttrsMap(); // new HashMap<String, Object>(attrs.length);
Set<String> newModifyFlag = config.containerFactory.getModifyFlagSet(); // new HashSet<String>();
for (String a : attrs) {
if (this.attrs.containsKey(a)) // prevent put null value to the newColumns
newAttrs.put(a, this.attrs.get(a));
if (this._getModifyFlag().contains(a))
newModifyFlag.add(a);
}
this.attrs = newAttrs;
this.modifyFlag = newModifyFlag;
}
else {
this.attrs.clear();
this._getModifyFlag().clear();
}
return (M)this;
} | java | public M keep(String... attrs) {
if (attrs != null && attrs.length > 0) {
Config config = _getConfig();
if (config == null) { // 支持无数据库连接场景
config = DbKit.brokenConfig;
}
Map<String, Object> newAttrs = config.containerFactory.getAttrsMap(); // new HashMap<String, Object>(attrs.length);
Set<String> newModifyFlag = config.containerFactory.getModifyFlagSet(); // new HashSet<String>();
for (String a : attrs) {
if (this.attrs.containsKey(a)) // prevent put null value to the newColumns
newAttrs.put(a, this.attrs.get(a));
if (this._getModifyFlag().contains(a))
newModifyFlag.add(a);
}
this.attrs = newAttrs;
this.modifyFlag = newModifyFlag;
}
else {
this.attrs.clear();
this._getModifyFlag().clear();
}
return (M)this;
} | [
"public",
"M",
"keep",
"(",
"String",
"...",
"attrs",
")",
"{",
"if",
"(",
"attrs",
"!=",
"null",
"&&",
"attrs",
".",
"length",
">",
"0",
")",
"{",
"Config",
"config",
"=",
"_getConfig",
"(",
")",
";",
"if",
"(",
"config",
"==",
"null",
")",
"{",... | Keep attributes of this model and remove other attributes.
@param attrs the attribute names of the model
@return this model | [
"Keep",
"attributes",
"of",
"this",
"model",
"and",
"remove",
"other",
"attributes",
"."
] | fc07f0f5d56e85ccd3cfcdd587b56b8dd9c663e9 | https://github.com/jfinal/jfinal/blob/fc07f0f5d56e85ccd3cfcdd587b56b8dd9c663e9/src/main/java/com/jfinal/plugin/activerecord/Model.java#L840-L862 |
31,214 | jfinal/jfinal | src/main/java/com/jfinal/plugin/activerecord/Model.java | Model.keep | public M keep(String attr) {
if (attrs.containsKey(attr)) { // prevent put null value to the newColumns
Object keepIt = attrs.get(attr);
boolean keepFlag = _getModifyFlag().contains(attr);
attrs.clear();
_getModifyFlag().clear();
attrs.put(attr, keepIt);
if (keepFlag)
_getModifyFlag().add(attr);
}
else {
attrs.clear();
_getModifyFlag().clear();
}
return (M)this;
} | java | public M keep(String attr) {
if (attrs.containsKey(attr)) { // prevent put null value to the newColumns
Object keepIt = attrs.get(attr);
boolean keepFlag = _getModifyFlag().contains(attr);
attrs.clear();
_getModifyFlag().clear();
attrs.put(attr, keepIt);
if (keepFlag)
_getModifyFlag().add(attr);
}
else {
attrs.clear();
_getModifyFlag().clear();
}
return (M)this;
} | [
"public",
"M",
"keep",
"(",
"String",
"attr",
")",
"{",
"if",
"(",
"attrs",
".",
"containsKey",
"(",
"attr",
")",
")",
"{",
"// prevent put null value to the newColumns\r",
"Object",
"keepIt",
"=",
"attrs",
".",
"get",
"(",
"attr",
")",
";",
"boolean",
"ke... | Keep attribute of this model and remove other attributes.
@param attr the attribute name of the model
@return this model | [
"Keep",
"attribute",
"of",
"this",
"model",
"and",
"remove",
"other",
"attributes",
"."
] | fc07f0f5d56e85ccd3cfcdd587b56b8dd9c663e9 | https://github.com/jfinal/jfinal/blob/fc07f0f5d56e85ccd3cfcdd587b56b8dd9c663e9/src/main/java/com/jfinal/plugin/activerecord/Model.java#L869-L884 |
31,215 | jfinal/jfinal | src/main/java/com/jfinal/plugin/activerecord/Model.java | Model.findByCache | public List<M> findByCache(String cacheName, Object key, String sql, Object... paras) {
Config config = _getConfig();
ICache cache = config.getCache();
List<M> result = cache.get(cacheName, key);
if (result == null) {
result = find(config, sql, paras);
cache.put(cacheName, key, result);
}
return result;
} | java | public List<M> findByCache(String cacheName, Object key, String sql, Object... paras) {
Config config = _getConfig();
ICache cache = config.getCache();
List<M> result = cache.get(cacheName, key);
if (result == null) {
result = find(config, sql, paras);
cache.put(cacheName, key, result);
}
return result;
} | [
"public",
"List",
"<",
"M",
">",
"findByCache",
"(",
"String",
"cacheName",
",",
"Object",
"key",
",",
"String",
"sql",
",",
"Object",
"...",
"paras",
")",
"{",
"Config",
"config",
"=",
"_getConfig",
"(",
")",
";",
"ICache",
"cache",
"=",
"config",
"."... | Find model by cache.
@see #find(String, Object...)
@param cacheName the cache name
@param key the key used to get data from cache
@return the list of Model | [
"Find",
"model",
"by",
"cache",
"."
] | fc07f0f5d56e85ccd3cfcdd587b56b8dd9c663e9 | https://github.com/jfinal/jfinal/blob/fc07f0f5d56e85ccd3cfcdd587b56b8dd9c663e9/src/main/java/com/jfinal/plugin/activerecord/Model.java#L941-L950 |
31,216 | jfinal/jfinal | src/main/java/com/jfinal/plugin/activerecord/Model.java | Model.findFirstByCache | public M findFirstByCache(String cacheName, Object key, String sql, Object... paras) {
ICache cache = _getConfig().getCache();
M result = cache.get(cacheName, key);
if (result == null) {
result = findFirst(sql, paras);
cache.put(cacheName, key, result);
}
return result;
} | java | public M findFirstByCache(String cacheName, Object key, String sql, Object... paras) {
ICache cache = _getConfig().getCache();
M result = cache.get(cacheName, key);
if (result == null) {
result = findFirst(sql, paras);
cache.put(cacheName, key, result);
}
return result;
} | [
"public",
"M",
"findFirstByCache",
"(",
"String",
"cacheName",
",",
"Object",
"key",
",",
"String",
"sql",
",",
"Object",
"...",
"paras",
")",
"{",
"ICache",
"cache",
"=",
"_getConfig",
"(",
")",
".",
"getCache",
"(",
")",
";",
"M",
"result",
"=",
"cac... | Find first model by cache. I recommend add "limit 1" in your sql.
@see #findFirst(String, Object...)
@param cacheName the cache name
@param key the key used to get data from cache
@param sql an SQL statement that may contain one or more '?' IN parameter placeholders
@param paras the parameters of sql | [
"Find",
"first",
"model",
"by",
"cache",
".",
"I",
"recommend",
"add",
"limit",
"1",
"in",
"your",
"sql",
"."
] | fc07f0f5d56e85ccd3cfcdd587b56b8dd9c663e9 | https://github.com/jfinal/jfinal/blob/fc07f0f5d56e85ccd3cfcdd587b56b8dd9c663e9/src/main/java/com/jfinal/plugin/activerecord/Model.java#L967-L975 |
31,217 | jfinal/jfinal | src/main/java/com/jfinal/i18n/I18n.java | I18n.use | public static Res use(String baseName, String locale) {
String resKey = baseName + locale;
Res res = resMap.get(resKey);
if (res == null) {
res = new Res(baseName, locale);
resMap.put(resKey, res);
}
return res;
} | java | public static Res use(String baseName, String locale) {
String resKey = baseName + locale;
Res res = resMap.get(resKey);
if (res == null) {
res = new Res(baseName, locale);
resMap.put(resKey, res);
}
return res;
} | [
"public",
"static",
"Res",
"use",
"(",
"String",
"baseName",
",",
"String",
"locale",
")",
"{",
"String",
"resKey",
"=",
"baseName",
"+",
"locale",
";",
"Res",
"res",
"=",
"resMap",
".",
"get",
"(",
"resKey",
")",
";",
"if",
"(",
"res",
"==",
"null",... | Using the base name and locale to get the Res object, which is used to get i18n message value from the resource file.
@param baseName the base name to load Resource bundle
@param locale the locale string like this: "zh_CN" "en_US"
@return the Res object to get i18n message value | [
"Using",
"the",
"base",
"name",
"and",
"locale",
"to",
"get",
"the",
"Res",
"object",
"which",
"is",
"used",
"to",
"get",
"i18n",
"message",
"value",
"from",
"the",
"resource",
"file",
"."
] | fc07f0f5d56e85ccd3cfcdd587b56b8dd9c663e9 | https://github.com/jfinal/jfinal/blob/fc07f0f5d56e85ccd3cfcdd587b56b8dd9c663e9/src/main/java/com/jfinal/i18n/I18n.java#L69-L77 |
31,218 | jfinal/jfinal | src/main/java/com/jfinal/kit/HashKit.java | HashKit.generateSalt | public static String generateSalt(int saltLength) {
StringBuilder salt = new StringBuilder(saltLength);
for (int i=0; i<saltLength; i++) {
salt.append(CHAR_ARRAY[random.nextInt(CHAR_ARRAY.length)]);
}
return salt.toString();
} | java | public static String generateSalt(int saltLength) {
StringBuilder salt = new StringBuilder(saltLength);
for (int i=0; i<saltLength; i++) {
salt.append(CHAR_ARRAY[random.nextInt(CHAR_ARRAY.length)]);
}
return salt.toString();
} | [
"public",
"static",
"String",
"generateSalt",
"(",
"int",
"saltLength",
")",
"{",
"StringBuilder",
"salt",
"=",
"new",
"StringBuilder",
"(",
"saltLength",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"saltLength",
";",
"i",
"++",
")",
"{"... | md5 128bit 16bytes
sha1 160bit 20bytes
sha256 256bit 32bytes
sha384 384bit 48bytes
sha512 512bit 64bytes | [
"md5",
"128bit",
"16bytes",
"sha1",
"160bit",
"20bytes",
"sha256",
"256bit",
"32bytes",
"sha384",
"384bit",
"48bytes",
"sha512",
"512bit",
"64bytes"
] | fc07f0f5d56e85ccd3cfcdd587b56b8dd9c663e9 | https://github.com/jfinal/jfinal/blob/fc07f0f5d56e85ccd3cfcdd587b56b8dd9c663e9/src/main/java/com/jfinal/kit/HashKit.java#L86-L92 |
31,219 | daimajia/AndroidImageSlider | library/src/main/java/com/daimajia/slider/library/SliderLayout.java | SliderLayout.startAutoCycle | public void startAutoCycle(long delay,long duration,boolean autoRecover){
if(mCycleTimer != null) mCycleTimer.cancel();
if(mCycleTask != null) mCycleTask.cancel();
if(mResumingTask != null) mResumingTask.cancel();
if(mResumingTimer != null) mResumingTimer.cancel();
mSliderDuration = duration;
mCycleTimer = new Timer();
mAutoRecover = autoRecover;
mCycleTask = new TimerTask() {
@Override
public void run() {
mh.sendEmptyMessage(0);
}
};
mCycleTimer.schedule(mCycleTask,delay,mSliderDuration);
mCycling = true;
mAutoCycle = true;
} | java | public void startAutoCycle(long delay,long duration,boolean autoRecover){
if(mCycleTimer != null) mCycleTimer.cancel();
if(mCycleTask != null) mCycleTask.cancel();
if(mResumingTask != null) mResumingTask.cancel();
if(mResumingTimer != null) mResumingTimer.cancel();
mSliderDuration = duration;
mCycleTimer = new Timer();
mAutoRecover = autoRecover;
mCycleTask = new TimerTask() {
@Override
public void run() {
mh.sendEmptyMessage(0);
}
};
mCycleTimer.schedule(mCycleTask,delay,mSliderDuration);
mCycling = true;
mAutoCycle = true;
} | [
"public",
"void",
"startAutoCycle",
"(",
"long",
"delay",
",",
"long",
"duration",
",",
"boolean",
"autoRecover",
")",
"{",
"if",
"(",
"mCycleTimer",
"!=",
"null",
")",
"mCycleTimer",
".",
"cancel",
"(",
")",
";",
"if",
"(",
"mCycleTask",
"!=",
"null",
"... | start auto cycle.
@param delay delay time
@param duration animation duration time.
@param autoRecover if recover after user touches the slider. | [
"start",
"auto",
"cycle",
"."
] | e318cabdef668de985efdcc45ca304e2ac6f58b5 | https://github.com/daimajia/AndroidImageSlider/blob/e318cabdef668de985efdcc45ca304e2ac6f58b5/library/src/main/java/com/daimajia/slider/library/SliderLayout.java#L258-L275 |
31,220 | daimajia/AndroidImageSlider | library/src/main/java/com/daimajia/slider/library/SliderLayout.java | SliderLayout.pauseAutoCycle | private void pauseAutoCycle(){
if(mCycling){
mCycleTimer.cancel();
mCycleTask.cancel();
mCycling = false;
}else{
if(mResumingTimer != null && mResumingTask != null){
recoverCycle();
}
}
} | java | private void pauseAutoCycle(){
if(mCycling){
mCycleTimer.cancel();
mCycleTask.cancel();
mCycling = false;
}else{
if(mResumingTimer != null && mResumingTask != null){
recoverCycle();
}
}
} | [
"private",
"void",
"pauseAutoCycle",
"(",
")",
"{",
"if",
"(",
"mCycling",
")",
"{",
"mCycleTimer",
".",
"cancel",
"(",
")",
";",
"mCycleTask",
".",
"cancel",
"(",
")",
";",
"mCycling",
"=",
"false",
";",
"}",
"else",
"{",
"if",
"(",
"mResumingTimer",
... | pause auto cycle. | [
"pause",
"auto",
"cycle",
"."
] | e318cabdef668de985efdcc45ca304e2ac6f58b5 | https://github.com/daimajia/AndroidImageSlider/blob/e318cabdef668de985efdcc45ca304e2ac6f58b5/library/src/main/java/com/daimajia/slider/library/SliderLayout.java#L280-L290 |
31,221 | daimajia/AndroidImageSlider | library/src/main/java/com/daimajia/slider/library/SliderLayout.java | SliderLayout.stopAutoCycle | public void stopAutoCycle(){
if(mCycleTask!=null){
mCycleTask.cancel();
}
if(mCycleTimer!= null){
mCycleTimer.cancel();
}
if(mResumingTimer!= null){
mResumingTimer.cancel();
}
if(mResumingTask!=null){
mResumingTask.cancel();
}
mAutoCycle = false;
mCycling = false;
} | java | public void stopAutoCycle(){
if(mCycleTask!=null){
mCycleTask.cancel();
}
if(mCycleTimer!= null){
mCycleTimer.cancel();
}
if(mResumingTimer!= null){
mResumingTimer.cancel();
}
if(mResumingTask!=null){
mResumingTask.cancel();
}
mAutoCycle = false;
mCycling = false;
} | [
"public",
"void",
"stopAutoCycle",
"(",
")",
"{",
"if",
"(",
"mCycleTask",
"!=",
"null",
")",
"{",
"mCycleTask",
".",
"cancel",
"(",
")",
";",
"}",
"if",
"(",
"mCycleTimer",
"!=",
"null",
")",
"{",
"mCycleTimer",
".",
"cancel",
"(",
")",
";",
"}",
... | stop the auto circle | [
"stop",
"the",
"auto",
"circle"
] | e318cabdef668de985efdcc45ca304e2ac6f58b5 | https://github.com/daimajia/AndroidImageSlider/blob/e318cabdef668de985efdcc45ca304e2ac6f58b5/library/src/main/java/com/daimajia/slider/library/SliderLayout.java#L308-L323 |
31,222 | daimajia/AndroidImageSlider | library/src/main/java/com/daimajia/slider/library/SliderLayout.java | SliderLayout.recoverCycle | private void recoverCycle(){
if(!mAutoRecover || !mAutoCycle){
return;
}
if(!mCycling){
if(mResumingTask != null && mResumingTimer!= null){
mResumingTimer.cancel();
mResumingTask.cancel();
}
mResumingTimer = new Timer();
mResumingTask = new TimerTask() {
@Override
public void run() {
startAutoCycle();
}
};
mResumingTimer.schedule(mResumingTask, 6000);
}
} | java | private void recoverCycle(){
if(!mAutoRecover || !mAutoCycle){
return;
}
if(!mCycling){
if(mResumingTask != null && mResumingTimer!= null){
mResumingTimer.cancel();
mResumingTask.cancel();
}
mResumingTimer = new Timer();
mResumingTask = new TimerTask() {
@Override
public void run() {
startAutoCycle();
}
};
mResumingTimer.schedule(mResumingTask, 6000);
}
} | [
"private",
"void",
"recoverCycle",
"(",
")",
"{",
"if",
"(",
"!",
"mAutoRecover",
"||",
"!",
"mAutoCycle",
")",
"{",
"return",
";",
"}",
"if",
"(",
"!",
"mCycling",
")",
"{",
"if",
"(",
"mResumingTask",
"!=",
"null",
"&&",
"mResumingTimer",
"!=",
"null... | when paused cycle, this method can weak it up. | [
"when",
"paused",
"cycle",
"this",
"method",
"can",
"weak",
"it",
"up",
"."
] | e318cabdef668de985efdcc45ca304e2ac6f58b5 | https://github.com/daimajia/AndroidImageSlider/blob/e318cabdef668de985efdcc45ca304e2ac6f58b5/library/src/main/java/com/daimajia/slider/library/SliderLayout.java#L328-L347 |
31,223 | daimajia/AndroidImageSlider | library/src/main/java/com/daimajia/slider/library/SliderLayout.java | SliderLayout.setPagerTransformer | public void setPagerTransformer(boolean reverseDrawingOrder,BaseTransformer transformer){
mViewPagerTransformer = transformer;
mViewPagerTransformer.setCustomAnimationInterface(mCustomAnimation);
mViewPager.setPageTransformer(reverseDrawingOrder,mViewPagerTransformer);
} | java | public void setPagerTransformer(boolean reverseDrawingOrder,BaseTransformer transformer){
mViewPagerTransformer = transformer;
mViewPagerTransformer.setCustomAnimationInterface(mCustomAnimation);
mViewPager.setPageTransformer(reverseDrawingOrder,mViewPagerTransformer);
} | [
"public",
"void",
"setPagerTransformer",
"(",
"boolean",
"reverseDrawingOrder",
",",
"BaseTransformer",
"transformer",
")",
"{",
"mViewPagerTransformer",
"=",
"transformer",
";",
"mViewPagerTransformer",
".",
"setCustomAnimationInterface",
"(",
"mCustomAnimation",
")",
";",... | set ViewPager transformer.
@param reverseDrawingOrder
@param transformer | [
"set",
"ViewPager",
"transformer",
"."
] | e318cabdef668de985efdcc45ca304e2ac6f58b5 | https://github.com/daimajia/AndroidImageSlider/blob/e318cabdef668de985efdcc45ca304e2ac6f58b5/library/src/main/java/com/daimajia/slider/library/SliderLayout.java#L367-L371 |
31,224 | daimajia/AndroidImageSlider | library/src/main/java/com/daimajia/slider/library/SliderLayout.java | SliderLayout.setSliderTransformDuration | public void setSliderTransformDuration(int period,Interpolator interpolator){
try{
Field mScroller = ViewPagerEx.class.getDeclaredField("mScroller");
mScroller.setAccessible(true);
FixedSpeedScroller scroller = new FixedSpeedScroller(mViewPager.getContext(),interpolator, period);
mScroller.set(mViewPager,scroller);
}catch (Exception e){
}
} | java | public void setSliderTransformDuration(int period,Interpolator interpolator){
try{
Field mScroller = ViewPagerEx.class.getDeclaredField("mScroller");
mScroller.setAccessible(true);
FixedSpeedScroller scroller = new FixedSpeedScroller(mViewPager.getContext(),interpolator, period);
mScroller.set(mViewPager,scroller);
}catch (Exception e){
}
} | [
"public",
"void",
"setSliderTransformDuration",
"(",
"int",
"period",
",",
"Interpolator",
"interpolator",
")",
"{",
"try",
"{",
"Field",
"mScroller",
"=",
"ViewPagerEx",
".",
"class",
".",
"getDeclaredField",
"(",
"\"mScroller\"",
")",
";",
"mScroller",
".",
"s... | set the duration between two slider changes.
@param period
@param interpolator | [
"set",
"the",
"duration",
"between",
"two",
"slider",
"changes",
"."
] | e318cabdef668de985efdcc45ca304e2ac6f58b5 | https://github.com/daimajia/AndroidImageSlider/blob/e318cabdef668de985efdcc45ca304e2ac6f58b5/library/src/main/java/com/daimajia/slider/library/SliderLayout.java#L380-L389 |
31,225 | daimajia/AndroidImageSlider | library/src/main/java/com/daimajia/slider/library/SliderLayout.java | SliderLayout.setPresetTransformer | public void setPresetTransformer(int transformerId){
for(Transformer t : Transformer.values()){
if(t.ordinal() == transformerId){
setPresetTransformer(t);
break;
}
}
} | java | public void setPresetTransformer(int transformerId){
for(Transformer t : Transformer.values()){
if(t.ordinal() == transformerId){
setPresetTransformer(t);
break;
}
}
} | [
"public",
"void",
"setPresetTransformer",
"(",
"int",
"transformerId",
")",
"{",
"for",
"(",
"Transformer",
"t",
":",
"Transformer",
".",
"values",
"(",
")",
")",
"{",
"if",
"(",
"t",
".",
"ordinal",
"(",
")",
"==",
"transformerId",
")",
"{",
"setPresetT... | set a preset viewpager transformer by id.
@param transformerId | [
"set",
"a",
"preset",
"viewpager",
"transformer",
"by",
"id",
"."
] | e318cabdef668de985efdcc45ca304e2ac6f58b5 | https://github.com/daimajia/AndroidImageSlider/blob/e318cabdef668de985efdcc45ca304e2ac6f58b5/library/src/main/java/com/daimajia/slider/library/SliderLayout.java#L430-L437 |
31,226 | daimajia/AndroidImageSlider | library/src/main/java/com/daimajia/slider/library/SliderLayout.java | SliderLayout.setPresetTransformer | public void setPresetTransformer(String transformerName){
for(Transformer t : Transformer.values()){
if(t.equals(transformerName)){
setPresetTransformer(t);
return;
}
}
} | java | public void setPresetTransformer(String transformerName){
for(Transformer t : Transformer.values()){
if(t.equals(transformerName)){
setPresetTransformer(t);
return;
}
}
} | [
"public",
"void",
"setPresetTransformer",
"(",
"String",
"transformerName",
")",
"{",
"for",
"(",
"Transformer",
"t",
":",
"Transformer",
".",
"values",
"(",
")",
")",
"{",
"if",
"(",
"t",
".",
"equals",
"(",
"transformerName",
")",
")",
"{",
"setPresetTra... | set preset PagerTransformer via the name of transforemer.
@param transformerName | [
"set",
"preset",
"PagerTransformer",
"via",
"the",
"name",
"of",
"transforemer",
"."
] | e318cabdef668de985efdcc45ca304e2ac6f58b5 | https://github.com/daimajia/AndroidImageSlider/blob/e318cabdef668de985efdcc45ca304e2ac6f58b5/library/src/main/java/com/daimajia/slider/library/SliderLayout.java#L443-L450 |
31,227 | daimajia/AndroidImageSlider | library/src/main/java/com/daimajia/slider/library/SliderLayout.java | SliderLayout.getCurrentSlider | public BaseSliderView getCurrentSlider(){
if(getRealAdapter() == null)
throw new IllegalStateException("You did not set a slider adapter");
int count = getRealAdapter().getCount();
int realCount = mViewPager.getCurrentItem() % count;
return getRealAdapter().getSliderView(realCount);
} | java | public BaseSliderView getCurrentSlider(){
if(getRealAdapter() == null)
throw new IllegalStateException("You did not set a slider adapter");
int count = getRealAdapter().getCount();
int realCount = mViewPager.getCurrentItem() % count;
return getRealAdapter().getSliderView(realCount);
} | [
"public",
"BaseSliderView",
"getCurrentSlider",
"(",
")",
"{",
"if",
"(",
"getRealAdapter",
"(",
")",
"==",
"null",
")",
"throw",
"new",
"IllegalStateException",
"(",
"\"You did not set a slider adapter\"",
")",
";",
"int",
"count",
"=",
"getRealAdapter",
"(",
")"... | get current slider.
@return | [
"get",
"current",
"slider",
"."
] | e318cabdef668de985efdcc45ca304e2ac6f58b5 | https://github.com/daimajia/AndroidImageSlider/blob/e318cabdef668de985efdcc45ca304e2ac6f58b5/library/src/main/java/com/daimajia/slider/library/SliderLayout.java#L621-L629 |
31,228 | daimajia/AndroidImageSlider | library/src/main/java/com/daimajia/slider/library/SliderLayout.java | SliderLayout.setCurrentPosition | public void setCurrentPosition(int position, boolean smooth) {
if (getRealAdapter() == null)
throw new IllegalStateException("You did not set a slider adapter");
if(position >= getRealAdapter().getCount()){
throw new IllegalStateException("Item position is not exist");
}
int p = mViewPager.getCurrentItem() % getRealAdapter().getCount();
int n = (position - p) + mViewPager.getCurrentItem();
mViewPager.setCurrentItem(n, smooth);
} | java | public void setCurrentPosition(int position, boolean smooth) {
if (getRealAdapter() == null)
throw new IllegalStateException("You did not set a slider adapter");
if(position >= getRealAdapter().getCount()){
throw new IllegalStateException("Item position is not exist");
}
int p = mViewPager.getCurrentItem() % getRealAdapter().getCount();
int n = (position - p) + mViewPager.getCurrentItem();
mViewPager.setCurrentItem(n, smooth);
} | [
"public",
"void",
"setCurrentPosition",
"(",
"int",
"position",
",",
"boolean",
"smooth",
")",
"{",
"if",
"(",
"getRealAdapter",
"(",
")",
"==",
"null",
")",
"throw",
"new",
"IllegalStateException",
"(",
"\"You did not set a slider adapter\"",
")",
";",
"if",
"(... | set current slider
@param position | [
"set",
"current",
"slider"
] | e318cabdef668de985efdcc45ca304e2ac6f58b5 | https://github.com/daimajia/AndroidImageSlider/blob/e318cabdef668de985efdcc45ca304e2ac6f58b5/library/src/main/java/com/daimajia/slider/library/SliderLayout.java#L658-L667 |
31,229 | daimajia/AndroidImageSlider | library/src/main/java/com/daimajia/slider/library/SliderLayout.java | SliderLayout.movePrevPosition | public void movePrevPosition(boolean smooth) {
if (getRealAdapter() == null)
throw new IllegalStateException("You did not set a slider adapter");
mViewPager.setCurrentItem(mViewPager.getCurrentItem() - 1, smooth);
} | java | public void movePrevPosition(boolean smooth) {
if (getRealAdapter() == null)
throw new IllegalStateException("You did not set a slider adapter");
mViewPager.setCurrentItem(mViewPager.getCurrentItem() - 1, smooth);
} | [
"public",
"void",
"movePrevPosition",
"(",
"boolean",
"smooth",
")",
"{",
"if",
"(",
"getRealAdapter",
"(",
")",
"==",
"null",
")",
"throw",
"new",
"IllegalStateException",
"(",
"\"You did not set a slider adapter\"",
")",
";",
"mViewPager",
".",
"setCurrentItem",
... | move to prev slide. | [
"move",
"to",
"prev",
"slide",
"."
] | e318cabdef668de985efdcc45ca304e2ac6f58b5 | https://github.com/daimajia/AndroidImageSlider/blob/e318cabdef668de985efdcc45ca304e2ac6f58b5/library/src/main/java/com/daimajia/slider/library/SliderLayout.java#L676-L682 |
31,230 | daimajia/AndroidImageSlider | library/src/main/java/com/daimajia/slider/library/SliderLayout.java | SliderLayout.moveNextPosition | public void moveNextPosition(boolean smooth) {
if (getRealAdapter() == null)
throw new IllegalStateException("You did not set a slider adapter");
mViewPager.setCurrentItem(mViewPager.getCurrentItem() + 1, smooth);
} | java | public void moveNextPosition(boolean smooth) {
if (getRealAdapter() == null)
throw new IllegalStateException("You did not set a slider adapter");
mViewPager.setCurrentItem(mViewPager.getCurrentItem() + 1, smooth);
} | [
"public",
"void",
"moveNextPosition",
"(",
"boolean",
"smooth",
")",
"{",
"if",
"(",
"getRealAdapter",
"(",
")",
"==",
"null",
")",
"throw",
"new",
"IllegalStateException",
"(",
"\"You did not set a slider adapter\"",
")",
";",
"mViewPager",
".",
"setCurrentItem",
... | move to next slide. | [
"move",
"to",
"next",
"slide",
"."
] | e318cabdef668de985efdcc45ca304e2ac6f58b5 | https://github.com/daimajia/AndroidImageSlider/blob/e318cabdef668de985efdcc45ca304e2ac6f58b5/library/src/main/java/com/daimajia/slider/library/SliderLayout.java#L691-L697 |
31,231 | daimajia/AndroidImageSlider | library/src/main/java/com/daimajia/slider/library/Tricks/ViewPagerEx.java | ViewPagerEx.setOffscreenPageLimit | public void setOffscreenPageLimit(int limit) {
if (limit < DEFAULT_OFFSCREEN_PAGES) {
Log.w(TAG, "Requested offscreen page limit " + limit + " too small; defaulting to " +
DEFAULT_OFFSCREEN_PAGES);
limit = DEFAULT_OFFSCREEN_PAGES;
}
if (limit != mOffscreenPageLimit) {
mOffscreenPageLimit = limit;
populate();
}
} | java | public void setOffscreenPageLimit(int limit) {
if (limit < DEFAULT_OFFSCREEN_PAGES) {
Log.w(TAG, "Requested offscreen page limit " + limit + " too small; defaulting to " +
DEFAULT_OFFSCREEN_PAGES);
limit = DEFAULT_OFFSCREEN_PAGES;
}
if (limit != mOffscreenPageLimit) {
mOffscreenPageLimit = limit;
populate();
}
} | [
"public",
"void",
"setOffscreenPageLimit",
"(",
"int",
"limit",
")",
"{",
"if",
"(",
"limit",
"<",
"DEFAULT_OFFSCREEN_PAGES",
")",
"{",
"Log",
".",
"w",
"(",
"TAG",
",",
"\"Requested offscreen page limit \"",
"+",
"limit",
"+",
"\" too small; defaulting to \"",
"+... | Set the number of pages that should be retained to either side of the
current page in the view hierarchy in an idle state. Pages beyond this
limit will be recreated from the adapter when needed.
<p>This is offered as an optimization. If you know in advance the number
of pages you will need to support or have lazy-loading mechanisms in place
on your pages, tweaking this setting can have benefits in perceived smoothness
of paging animations and interaction. If you have a small number of pages (3-4)
that you can keep active all at once, less time will be spent in layout for
newly created view subtrees as the user pages back and forth.</p>
<p>You should keep this limit low, especially if your pages have complex layouts.
This setting defaults to 1.</p>
@param limit How many pages will be kept offscreen in an idle state. | [
"Set",
"the",
"number",
"of",
"pages",
"that",
"should",
"be",
"retained",
"to",
"either",
"side",
"of",
"the",
"current",
"page",
"in",
"the",
"view",
"hierarchy",
"in",
"an",
"idle",
"state",
".",
"Pages",
"beyond",
"this",
"limit",
"will",
"be",
"recr... | e318cabdef668de985efdcc45ca304e2ac6f58b5 | https://github.com/daimajia/AndroidImageSlider/blob/e318cabdef668de985efdcc45ca304e2ac6f58b5/library/src/main/java/com/daimajia/slider/library/Tricks/ViewPagerEx.java#L703-L713 |
31,232 | daimajia/AndroidImageSlider | library/src/main/java/com/daimajia/slider/library/Tricks/ViewPagerEx.java | ViewPagerEx.setPageMarginDrawable | public void setPageMarginDrawable(Drawable d) {
mMarginDrawable = d;
if (d != null) refreshDrawableState();
setWillNotDraw(d == null);
invalidate();
} | java | public void setPageMarginDrawable(Drawable d) {
mMarginDrawable = d;
if (d != null) refreshDrawableState();
setWillNotDraw(d == null);
invalidate();
} | [
"public",
"void",
"setPageMarginDrawable",
"(",
"Drawable",
"d",
")",
"{",
"mMarginDrawable",
"=",
"d",
";",
"if",
"(",
"d",
"!=",
"null",
")",
"refreshDrawableState",
"(",
")",
";",
"setWillNotDraw",
"(",
"d",
"==",
"null",
")",
";",
"invalidate",
"(",
... | Set a drawable that will be used to fill the margin between pages.
@param d Drawable to display between pages | [
"Set",
"a",
"drawable",
"that",
"will",
"be",
"used",
"to",
"fill",
"the",
"margin",
"between",
"pages",
"."
] | e318cabdef668de985efdcc45ca304e2ac6f58b5 | https://github.com/daimajia/AndroidImageSlider/blob/e318cabdef668de985efdcc45ca304e2ac6f58b5/library/src/main/java/com/daimajia/slider/library/Tricks/ViewPagerEx.java#L747-L752 |
31,233 | daimajia/AndroidImageSlider | library/src/main/java/com/daimajia/slider/library/Tricks/ViewPagerEx.java | ViewPagerEx.addTouchables | @Override
public void addTouchables(ArrayList<View> views) {
// Note that we don't call super.addTouchables(), which means that
// we don't call View.addTouchables(). This is okay because a ViewPager
// is itself not touchable.
for (int i = 0; i < getChildCount(); i++) {
final View child = getChildAt(i);
if (child.getVisibility() == VISIBLE) {
ItemInfo ii = infoForChild(child);
if (ii != null && ii.position == mCurItem) {
child.addTouchables(views);
}
}
}
} | java | @Override
public void addTouchables(ArrayList<View> views) {
// Note that we don't call super.addTouchables(), which means that
// we don't call View.addTouchables(). This is okay because a ViewPager
// is itself not touchable.
for (int i = 0; i < getChildCount(); i++) {
final View child = getChildAt(i);
if (child.getVisibility() == VISIBLE) {
ItemInfo ii = infoForChild(child);
if (ii != null && ii.position == mCurItem) {
child.addTouchables(views);
}
}
}
} | [
"@",
"Override",
"public",
"void",
"addTouchables",
"(",
"ArrayList",
"<",
"View",
">",
"views",
")",
"{",
"// Note that we don't call super.addTouchables(), which means that",
"// we don't call View.addTouchables(). This is okay because a ViewPager",
"// is itself not touchable.",
... | We only want the current page that is being shown to be touchable. | [
"We",
"only",
"want",
"the",
"current",
"page",
"that",
"is",
"being",
"shown",
"to",
"be",
"touchable",
"."
] | e318cabdef668de985efdcc45ca304e2ac6f58b5 | https://github.com/daimajia/AndroidImageSlider/blob/e318cabdef668de985efdcc45ca304e2ac6f58b5/library/src/main/java/com/daimajia/slider/library/Tricks/ViewPagerEx.java#L2686-L2700 |
31,234 | daimajia/AndroidImageSlider | library/src/main/java/com/daimajia/slider/library/SliderAdapter.java | SliderAdapter.onEnd | @Override
public void onEnd(boolean result, BaseSliderView target) {
if(target.isErrorDisappear() == false || result == true){
return;
}
for (BaseSliderView slider: mImageContents){
if(slider.equals(target)){
removeSlider(target);
break;
}
}
} | java | @Override
public void onEnd(boolean result, BaseSliderView target) {
if(target.isErrorDisappear() == false || result == true){
return;
}
for (BaseSliderView slider: mImageContents){
if(slider.equals(target)){
removeSlider(target);
break;
}
}
} | [
"@",
"Override",
"public",
"void",
"onEnd",
"(",
"boolean",
"result",
",",
"BaseSliderView",
"target",
")",
"{",
"if",
"(",
"target",
".",
"isErrorDisappear",
"(",
")",
"==",
"false",
"||",
"result",
"==",
"true",
")",
"{",
"return",
";",
"}",
"for",
"... | When image download error, then remove.
@param result
@param target | [
"When",
"image",
"download",
"error",
"then",
"remove",
"."
] | e318cabdef668de985efdcc45ca304e2ac6f58b5 | https://github.com/daimajia/AndroidImageSlider/blob/e318cabdef668de985efdcc45ca304e2ac6f58b5/library/src/main/java/com/daimajia/slider/library/SliderAdapter.java#L96-L107 |
31,235 | daimajia/AndroidImageSlider | library/src/main/java/com/daimajia/slider/library/Animations/DescriptionAnimation.java | DescriptionAnimation.onPrepareNextItemShowInScreen | @Override
public void onPrepareNextItemShowInScreen(View next) {
View descriptionLayout = next.findViewById(R.id.description_layout);
if(descriptionLayout!=null){
next.findViewById(R.id.description_layout).setVisibility(View.INVISIBLE);
}
} | java | @Override
public void onPrepareNextItemShowInScreen(View next) {
View descriptionLayout = next.findViewById(R.id.description_layout);
if(descriptionLayout!=null){
next.findViewById(R.id.description_layout).setVisibility(View.INVISIBLE);
}
} | [
"@",
"Override",
"public",
"void",
"onPrepareNextItemShowInScreen",
"(",
"View",
"next",
")",
"{",
"View",
"descriptionLayout",
"=",
"next",
".",
"findViewById",
"(",
"R",
".",
"id",
".",
"description_layout",
")",
";",
"if",
"(",
"descriptionLayout",
"!=",
"n... | When next item is coming to show, let's hide the description layout.
@param next | [
"When",
"next",
"item",
"is",
"coming",
"to",
"show",
"let",
"s",
"hide",
"the",
"description",
"layout",
"."
] | e318cabdef668de985efdcc45ca304e2ac6f58b5 | https://github.com/daimajia/AndroidImageSlider/blob/e318cabdef668de985efdcc45ca304e2ac6f58b5/library/src/main/java/com/daimajia/slider/library/Animations/DescriptionAnimation.java#L28-L34 |
31,236 | daimajia/AndroidImageSlider | library/src/main/java/com/daimajia/slider/library/Animations/DescriptionAnimation.java | DescriptionAnimation.onNextItemAppear | @Override
public void onNextItemAppear(View view) {
View descriptionLayout = view.findViewById(R.id.description_layout);
if(descriptionLayout!=null){
float layoutY = ViewHelper.getY(descriptionLayout);
view.findViewById(R.id.description_layout).setVisibility(View.VISIBLE);
ValueAnimator animator = ObjectAnimator.ofFloat(
descriptionLayout,"y",layoutY + descriptionLayout.getHeight(),
layoutY).setDuration(500);
animator.start();
}
} | java | @Override
public void onNextItemAppear(View view) {
View descriptionLayout = view.findViewById(R.id.description_layout);
if(descriptionLayout!=null){
float layoutY = ViewHelper.getY(descriptionLayout);
view.findViewById(R.id.description_layout).setVisibility(View.VISIBLE);
ValueAnimator animator = ObjectAnimator.ofFloat(
descriptionLayout,"y",layoutY + descriptionLayout.getHeight(),
layoutY).setDuration(500);
animator.start();
}
} | [
"@",
"Override",
"public",
"void",
"onNextItemAppear",
"(",
"View",
"view",
")",
"{",
"View",
"descriptionLayout",
"=",
"view",
".",
"findViewById",
"(",
"R",
".",
"id",
".",
"description_layout",
")",
";",
"if",
"(",
"descriptionLayout",
"!=",
"null",
")",
... | When next item show in ViewPagerEx, let's make an animation to show the
description layout.
@param view | [
"When",
"next",
"item",
"show",
"in",
"ViewPagerEx",
"let",
"s",
"make",
"an",
"animation",
"to",
"show",
"the",
"description",
"layout",
"."
] | e318cabdef668de985efdcc45ca304e2ac6f58b5 | https://github.com/daimajia/AndroidImageSlider/blob/e318cabdef668de985efdcc45ca304e2ac6f58b5/library/src/main/java/com/daimajia/slider/library/Animations/DescriptionAnimation.java#L47-L60 |
31,237 | daimajia/AndroidImageSlider | library/src/main/java/com/daimajia/slider/library/Indicators/PagerIndicator.java | PagerIndicator.setDefaultIndicatorShape | public void setDefaultIndicatorShape(Shape shape){
if(mUserSetSelectedIndicatorResId == 0){
if(shape == Shape.Oval){
mSelectedGradientDrawable.setShape(GradientDrawable.OVAL);
}else{
mSelectedGradientDrawable.setShape(GradientDrawable.RECTANGLE);
}
}
if(mUserSetUnSelectedIndicatorResId == 0){
if(shape == Shape.Oval){
mUnSelectedGradientDrawable.setShape(GradientDrawable.OVAL);
}else{
mUnSelectedGradientDrawable.setShape(GradientDrawable.RECTANGLE);
}
}
resetDrawable();
} | java | public void setDefaultIndicatorShape(Shape shape){
if(mUserSetSelectedIndicatorResId == 0){
if(shape == Shape.Oval){
mSelectedGradientDrawable.setShape(GradientDrawable.OVAL);
}else{
mSelectedGradientDrawable.setShape(GradientDrawable.RECTANGLE);
}
}
if(mUserSetUnSelectedIndicatorResId == 0){
if(shape == Shape.Oval){
mUnSelectedGradientDrawable.setShape(GradientDrawable.OVAL);
}else{
mUnSelectedGradientDrawable.setShape(GradientDrawable.RECTANGLE);
}
}
resetDrawable();
} | [
"public",
"void",
"setDefaultIndicatorShape",
"(",
"Shape",
"shape",
")",
"{",
"if",
"(",
"mUserSetSelectedIndicatorResId",
"==",
"0",
")",
"{",
"if",
"(",
"shape",
"==",
"Shape",
".",
"Oval",
")",
"{",
"mSelectedGradientDrawable",
".",
"setShape",
"(",
"Gradi... | if you are using the default indicator, this method will help you to set the shape of
indicator, there are two kind of shapes you can set, oval and rect.
@param shape | [
"if",
"you",
"are",
"using",
"the",
"default",
"indicator",
"this",
"method",
"will",
"help",
"you",
"to",
"set",
"the",
"shape",
"of",
"indicator",
"there",
"are",
"two",
"kind",
"of",
"shapes",
"you",
"can",
"set",
"oval",
"and",
"rect",
"."
] | e318cabdef668de985efdcc45ca304e2ac6f58b5 | https://github.com/daimajia/AndroidImageSlider/blob/e318cabdef668de985efdcc45ca304e2ac6f58b5/library/src/main/java/com/daimajia/slider/library/Indicators/PagerIndicator.java#L192-L208 |
31,238 | daimajia/AndroidImageSlider | library/src/main/java/com/daimajia/slider/library/Indicators/PagerIndicator.java | PagerIndicator.setIndicatorStyleResource | public void setIndicatorStyleResource(int selected, int unselected){
mUserSetSelectedIndicatorResId = selected;
mUserSetUnSelectedIndicatorResId = unselected;
if(selected == 0){
mSelectedDrawable = mSelectedLayerDrawable;
}else{
mSelectedDrawable = mContext.getResources().getDrawable(mUserSetSelectedIndicatorResId);
}
if(unselected == 0){
mUnselectedDrawable = mUnSelectedLayerDrawable;
}else{
mUnselectedDrawable = mContext.getResources().getDrawable(mUserSetUnSelectedIndicatorResId);
}
resetDrawable();
} | java | public void setIndicatorStyleResource(int selected, int unselected){
mUserSetSelectedIndicatorResId = selected;
mUserSetUnSelectedIndicatorResId = unselected;
if(selected == 0){
mSelectedDrawable = mSelectedLayerDrawable;
}else{
mSelectedDrawable = mContext.getResources().getDrawable(mUserSetSelectedIndicatorResId);
}
if(unselected == 0){
mUnselectedDrawable = mUnSelectedLayerDrawable;
}else{
mUnselectedDrawable = mContext.getResources().getDrawable(mUserSetUnSelectedIndicatorResId);
}
resetDrawable();
} | [
"public",
"void",
"setIndicatorStyleResource",
"(",
"int",
"selected",
",",
"int",
"unselected",
")",
"{",
"mUserSetSelectedIndicatorResId",
"=",
"selected",
";",
"mUserSetUnSelectedIndicatorResId",
"=",
"unselected",
";",
"if",
"(",
"selected",
"==",
"0",
")",
"{",... | Set Indicator style.
@param selected page selected drawable
@param unselected page unselected drawable | [
"Set",
"Indicator",
"style",
"."
] | e318cabdef668de985efdcc45ca304e2ac6f58b5 | https://github.com/daimajia/AndroidImageSlider/blob/e318cabdef668de985efdcc45ca304e2ac6f58b5/library/src/main/java/com/daimajia/slider/library/Indicators/PagerIndicator.java#L216-L231 |
31,239 | daimajia/AndroidImageSlider | library/src/main/java/com/daimajia/slider/library/Indicators/PagerIndicator.java | PagerIndicator.setDefaultIndicatorColor | public void setDefaultIndicatorColor(int selectedColor,int unselectedColor){
if(mUserSetSelectedIndicatorResId == 0){
mSelectedGradientDrawable.setColor(selectedColor);
}
if(mUserSetUnSelectedIndicatorResId == 0){
mUnSelectedGradientDrawable.setColor(unselectedColor);
}
resetDrawable();
} | java | public void setDefaultIndicatorColor(int selectedColor,int unselectedColor){
if(mUserSetSelectedIndicatorResId == 0){
mSelectedGradientDrawable.setColor(selectedColor);
}
if(mUserSetUnSelectedIndicatorResId == 0){
mUnSelectedGradientDrawable.setColor(unselectedColor);
}
resetDrawable();
} | [
"public",
"void",
"setDefaultIndicatorColor",
"(",
"int",
"selectedColor",
",",
"int",
"unselectedColor",
")",
"{",
"if",
"(",
"mUserSetSelectedIndicatorResId",
"==",
"0",
")",
"{",
"mSelectedGradientDrawable",
".",
"setColor",
"(",
"selectedColor",
")",
";",
"}",
... | if you are using the default indicator , this method will help you to set the selected status and
the unselected status color.
@param selectedColor
@param unselectedColor | [
"if",
"you",
"are",
"using",
"the",
"default",
"indicator",
"this",
"method",
"will",
"help",
"you",
"to",
"set",
"the",
"selected",
"status",
"and",
"the",
"unselected",
"status",
"color",
"."
] | e318cabdef668de985efdcc45ca304e2ac6f58b5 | https://github.com/daimajia/AndroidImageSlider/blob/e318cabdef668de985efdcc45ca304e2ac6f58b5/library/src/main/java/com/daimajia/slider/library/Indicators/PagerIndicator.java#L239-L247 |
31,240 | daimajia/AndroidImageSlider | library/src/main/java/com/daimajia/slider/library/Indicators/PagerIndicator.java | PagerIndicator.setIndicatorVisibility | public void setIndicatorVisibility(IndicatorVisibility visibility){
if(visibility == IndicatorVisibility.Visible){
setVisibility(View.VISIBLE);
}else{
setVisibility(View.INVISIBLE);
}
resetDrawable();
} | java | public void setIndicatorVisibility(IndicatorVisibility visibility){
if(visibility == IndicatorVisibility.Visible){
setVisibility(View.VISIBLE);
}else{
setVisibility(View.INVISIBLE);
}
resetDrawable();
} | [
"public",
"void",
"setIndicatorVisibility",
"(",
"IndicatorVisibility",
"visibility",
")",
"{",
"if",
"(",
"visibility",
"==",
"IndicatorVisibility",
".",
"Visible",
")",
"{",
"setVisibility",
"(",
"View",
".",
"VISIBLE",
")",
";",
"}",
"else",
"{",
"setVisibili... | set the visibility of indicator.
@param visibility | [
"set",
"the",
"visibility",
"of",
"indicator",
"."
] | e318cabdef668de985efdcc45ca304e2ac6f58b5 | https://github.com/daimajia/AndroidImageSlider/blob/e318cabdef668de985efdcc45ca304e2ac6f58b5/library/src/main/java/com/daimajia/slider/library/Indicators/PagerIndicator.java#L298-L305 |
31,241 | daimajia/AndroidImageSlider | library/src/main/java/com/daimajia/slider/library/Indicators/PagerIndicator.java | PagerIndicator.setViewPager | public void setViewPager(ViewPagerEx pager){
if(pager.getAdapter() == null){
throw new IllegalStateException("Viewpager does not have adapter instance");
}
mPager = pager;
mPager.addOnPageChangeListener(this);
((InfinitePagerAdapter)mPager.getAdapter()).getRealAdapter().registerDataSetObserver(dataChangeObserver);
} | java | public void setViewPager(ViewPagerEx pager){
if(pager.getAdapter() == null){
throw new IllegalStateException("Viewpager does not have adapter instance");
}
mPager = pager;
mPager.addOnPageChangeListener(this);
((InfinitePagerAdapter)mPager.getAdapter()).getRealAdapter().registerDataSetObserver(dataChangeObserver);
} | [
"public",
"void",
"setViewPager",
"(",
"ViewPagerEx",
"pager",
")",
"{",
"if",
"(",
"pager",
".",
"getAdapter",
"(",
")",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"Viewpager does not have adapter instance\"",
")",
";",
"}",
"mPager... | bind indicator with viewpagerEx.
@param pager | [
"bind",
"indicator",
"with",
"viewpagerEx",
"."
] | e318cabdef668de985efdcc45ca304e2ac6f58b5 | https://github.com/daimajia/AndroidImageSlider/blob/e318cabdef668de985efdcc45ca304e2ac6f58b5/library/src/main/java/com/daimajia/slider/library/Indicators/PagerIndicator.java#L326-L333 |
31,242 | daimajia/AndroidImageSlider | library/src/main/java/com/daimajia/slider/library/Indicators/PagerIndicator.java | PagerIndicator.redraw | public void redraw(){
mItemCount = getShouldDrawCount();
mPreviousSelectedIndicator = null;
for(View i:mIndicators){
removeView(i);
}
for(int i =0 ;i< mItemCount; i++){
ImageView indicator = new ImageView(mContext);
indicator.setImageDrawable(mUnselectedDrawable);
indicator.setPadding((int)mUnSelectedPadding_Left,
(int)mUnSelectedPadding_Top,
(int)mUnSelectedPadding_Right,
(int)mUnSelectedPadding_Bottom);
addView(indicator);
mIndicators.add(indicator);
}
setItemAsSelected(mPreviousSelectedPosition);
} | java | public void redraw(){
mItemCount = getShouldDrawCount();
mPreviousSelectedIndicator = null;
for(View i:mIndicators){
removeView(i);
}
for(int i =0 ;i< mItemCount; i++){
ImageView indicator = new ImageView(mContext);
indicator.setImageDrawable(mUnselectedDrawable);
indicator.setPadding((int)mUnSelectedPadding_Left,
(int)mUnSelectedPadding_Top,
(int)mUnSelectedPadding_Right,
(int)mUnSelectedPadding_Bottom);
addView(indicator);
mIndicators.add(indicator);
}
setItemAsSelected(mPreviousSelectedPosition);
} | [
"public",
"void",
"redraw",
"(",
")",
"{",
"mItemCount",
"=",
"getShouldDrawCount",
"(",
")",
";",
"mPreviousSelectedIndicator",
"=",
"null",
";",
"for",
"(",
"View",
"i",
":",
"mIndicators",
")",
"{",
"removeView",
"(",
"i",
")",
";",
"}",
"for",
"(",
... | redraw the indicators. | [
"redraw",
"the",
"indicators",
"."
] | e318cabdef668de985efdcc45ca304e2ac6f58b5 | https://github.com/daimajia/AndroidImageSlider/blob/e318cabdef668de985efdcc45ca304e2ac6f58b5/library/src/main/java/com/daimajia/slider/library/Indicators/PagerIndicator.java#L350-L369 |
31,243 | daimajia/AndroidImageSlider | library/src/main/java/com/daimajia/slider/library/Indicators/PagerIndicator.java | PagerIndicator.getShouldDrawCount | private int getShouldDrawCount(){
if(mPager.getAdapter() instanceof InfinitePagerAdapter){
return ((InfinitePagerAdapter)mPager.getAdapter()).getRealCount();
}else{
return mPager.getAdapter().getCount();
}
} | java | private int getShouldDrawCount(){
if(mPager.getAdapter() instanceof InfinitePagerAdapter){
return ((InfinitePagerAdapter)mPager.getAdapter()).getRealCount();
}else{
return mPager.getAdapter().getCount();
}
} | [
"private",
"int",
"getShouldDrawCount",
"(",
")",
"{",
"if",
"(",
"mPager",
".",
"getAdapter",
"(",
")",
"instanceof",
"InfinitePagerAdapter",
")",
"{",
"return",
"(",
"(",
"InfinitePagerAdapter",
")",
"mPager",
".",
"getAdapter",
"(",
")",
")",
".",
"getRea... | since we used a adapter wrapper, so we can't getCount directly from wrapper.
@return | [
"since",
"we",
"used",
"a",
"adapter",
"wrapper",
"so",
"we",
"can",
"t",
"getCount",
"directly",
"from",
"wrapper",
"."
] | e318cabdef668de985efdcc45ca304e2ac6f58b5 | https://github.com/daimajia/AndroidImageSlider/blob/e318cabdef668de985efdcc45ca304e2ac6f58b5/library/src/main/java/com/daimajia/slider/library/Indicators/PagerIndicator.java#L375-L381 |
31,244 | daimajia/AndroidImageSlider | library/src/main/java/com/daimajia/slider/library/SliderTypes/BaseSliderView.java | BaseSliderView.image | public BaseSliderView image(String url){
if(mFile != null || mRes != 0){
throw new IllegalStateException("Call multi image function," +
"you only have permission to call it once");
}
mUrl = url;
return this;
} | java | public BaseSliderView image(String url){
if(mFile != null || mRes != 0){
throw new IllegalStateException("Call multi image function," +
"you only have permission to call it once");
}
mUrl = url;
return this;
} | [
"public",
"BaseSliderView",
"image",
"(",
"String",
"url",
")",
"{",
"if",
"(",
"mFile",
"!=",
"null",
"||",
"mRes",
"!=",
"0",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"Call multi image function,\"",
"+",
"\"you only have permission to call it once... | set a url as a image that preparing to load
@param url
@return | [
"set",
"a",
"url",
"as",
"a",
"image",
"that",
"preparing",
"to",
"load"
] | e318cabdef668de985efdcc45ca304e2ac6f58b5 | https://github.com/daimajia/AndroidImageSlider/blob/e318cabdef668de985efdcc45ca304e2ac6f58b5/library/src/main/java/com/daimajia/slider/library/SliderTypes/BaseSliderView.java#L110-L117 |
31,245 | daimajia/AndroidImageSlider | library/src/main/java/com/daimajia/slider/library/SliderTypes/BaseSliderView.java | BaseSliderView.image | public BaseSliderView image(File file){
if(mUrl != null || mRes != 0){
throw new IllegalStateException("Call multi image function," +
"you only have permission to call it once");
}
mFile = file;
return this;
} | java | public BaseSliderView image(File file){
if(mUrl != null || mRes != 0){
throw new IllegalStateException("Call multi image function," +
"you only have permission to call it once");
}
mFile = file;
return this;
} | [
"public",
"BaseSliderView",
"image",
"(",
"File",
"file",
")",
"{",
"if",
"(",
"mUrl",
"!=",
"null",
"||",
"mRes",
"!=",
"0",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"Call multi image function,\"",
"+",
"\"you only have permission to call it once\"... | set a file as a image that will to load
@param file
@return | [
"set",
"a",
"file",
"as",
"a",
"image",
"that",
"will",
"to",
"load"
] | e318cabdef668de985efdcc45ca304e2ac6f58b5 | https://github.com/daimajia/AndroidImageSlider/blob/e318cabdef668de985efdcc45ca304e2ac6f58b5/library/src/main/java/com/daimajia/slider/library/SliderTypes/BaseSliderView.java#L124-L131 |
31,246 | goldmansachs/reladomo | reladomo/src/main/java/com/gs/fw/common/mithra/cache/PartialUniqueIndex.java | PartialUniqueIndex.remove | public Object remove(Object key)
{
Object underlying = this.underlyingObjectGetter.getUnderlyingObject(key);
return removeUsingUnderlying(underlying);
} | java | public Object remove(Object key)
{
Object underlying = this.underlyingObjectGetter.getUnderlyingObject(key);
return removeUsingUnderlying(underlying);
} | [
"public",
"Object",
"remove",
"(",
"Object",
"key",
")",
"{",
"Object",
"underlying",
"=",
"this",
".",
"underlyingObjectGetter",
".",
"getUnderlyingObject",
"(",
"key",
")",
";",
"return",
"removeUsingUnderlying",
"(",
"underlying",
")",
";",
"}"
] | Removes and returns the entry associated with the specified key
in the HashMap. Returns null if the HashMap contains no mapping
for this key. | [
"Removes",
"and",
"returns",
"the",
"entry",
"associated",
"with",
"the",
"specified",
"key",
"in",
"the",
"HashMap",
".",
"Returns",
"null",
"if",
"the",
"HashMap",
"contains",
"no",
"mapping",
"for",
"this",
"key",
"."
] | e9a069452eece7a6ef9551caf81a69d3d9a3d990 | https://github.com/goldmansachs/reladomo/blob/e9a069452eece7a6ef9551caf81a69d3d9a3d990/reladomo/src/main/java/com/gs/fw/common/mithra/cache/PartialUniqueIndex.java#L700-L704 |
31,247 | goldmansachs/reladomo | reladomo/src/main/java/com/gs/fw/common/mithra/util/HashUtil.java | HashUtil.hash | public static final int hash(double d, boolean isNull)
{
if (isNull) return NULL_HASH;
long longVal = Double.doubleToLongBits(d);
return (int)(longVal ^ (longVal >>> 32));
} | java | public static final int hash(double d, boolean isNull)
{
if (isNull) return NULL_HASH;
long longVal = Double.doubleToLongBits(d);
return (int)(longVal ^ (longVal >>> 32));
} | [
"public",
"static",
"final",
"int",
"hash",
"(",
"double",
"d",
",",
"boolean",
"isNull",
")",
"{",
"if",
"(",
"isNull",
")",
"return",
"NULL_HASH",
";",
"long",
"longVal",
"=",
"Double",
".",
"doubleToLongBits",
"(",
"d",
")",
";",
"return",
"(",
"int... | need to mix the value, but have to keep it compatible with Double.hashcode !! | [
"need",
"to",
"mix",
"the",
"value",
"but",
"have",
"to",
"keep",
"it",
"compatible",
"with",
"Double",
".",
"hashcode",
"!!"
] | e9a069452eece7a6ef9551caf81a69d3d9a3d990 | https://github.com/goldmansachs/reladomo/blob/e9a069452eece7a6ef9551caf81a69d3d9a3d990/reladomo/src/main/java/com/gs/fw/common/mithra/util/HashUtil.java#L45-L50 |
31,248 | goldmansachs/reladomo | reladomogen/src/main/java/com/gs/fw/common/mithra/generator/util/AutoShutdownThreadExecutor.java | AutoShutdownThreadExecutor.shutdown | public void shutdown()
{
while(true)
{
long cur = combinedState.get();
long newValue = cur | 0x8000000000000000L;
if (combinedState.compareAndSet(cur, newValue))
{
break;
}
}
} | java | public void shutdown()
{
while(true)
{
long cur = combinedState.get();
long newValue = cur | 0x8000000000000000L;
if (combinedState.compareAndSet(cur, newValue))
{
break;
}
}
} | [
"public",
"void",
"shutdown",
"(",
")",
"{",
"while",
"(",
"true",
")",
"{",
"long",
"cur",
"=",
"combinedState",
".",
"get",
"(",
")",
";",
"long",
"newValue",
"=",
"cur",
"|",
"0x8000000000000000",
"",
"L",
";",
"if",
"(",
"combinedState",
".",
"co... | Initiates an orderly shutdown in which previously submitted
tasks are executed, but no new tasks will be accepted.
Invocation has no additional effect if already shut down. | [
"Initiates",
"an",
"orderly",
"shutdown",
"in",
"which",
"previously",
"submitted",
"tasks",
"are",
"executed",
"but",
"no",
"new",
"tasks",
"will",
"be",
"accepted",
".",
"Invocation",
"has",
"no",
"additional",
"effect",
"if",
"already",
"shut",
"down",
"."
... | e9a069452eece7a6ef9551caf81a69d3d9a3d990 | https://github.com/goldmansachs/reladomo/blob/e9a069452eece7a6ef9551caf81a69d3d9a3d990/reladomogen/src/main/java/com/gs/fw/common/mithra/generator/util/AutoShutdownThreadExecutor.java#L87-L99 |
31,249 | goldmansachs/reladomo | reladomogen/src/main/java/com/gs/fw/common/mithra/generator/util/AutoShutdownThreadExecutor.java | AutoShutdownThreadExecutor.shutdownAndWaitUntilDone | public void shutdownAndWaitUntilDone()
{
shutdown();
while(true)
{
synchronized (endSignal)
{
try
{
if ((combinedState.get() & 0x7FFFFFFFFFFFFFFFL) == 0) break;
endSignal.wait(100);
}
catch (InterruptedException e)
{
// ignore
}
}
}
} | java | public void shutdownAndWaitUntilDone()
{
shutdown();
while(true)
{
synchronized (endSignal)
{
try
{
if ((combinedState.get() & 0x7FFFFFFFFFFFFFFFL) == 0) break;
endSignal.wait(100);
}
catch (InterruptedException e)
{
// ignore
}
}
}
} | [
"public",
"void",
"shutdownAndWaitUntilDone",
"(",
")",
"{",
"shutdown",
"(",
")",
";",
"while",
"(",
"true",
")",
"{",
"synchronized",
"(",
"endSignal",
")",
"{",
"try",
"{",
"if",
"(",
"(",
"combinedState",
".",
"get",
"(",
")",
"&",
"0x7FFFFFFFFFFFFFF... | Shuts down the executor and blocks until all tasks have completed execution | [
"Shuts",
"down",
"the",
"executor",
"and",
"blocks",
"until",
"all",
"tasks",
"have",
"completed",
"execution"
] | e9a069452eece7a6ef9551caf81a69d3d9a3d990 | https://github.com/goldmansachs/reladomo/blob/e9a069452eece7a6ef9551caf81a69d3d9a3d990/reladomogen/src/main/java/com/gs/fw/common/mithra/generator/util/AutoShutdownThreadExecutor.java#L116-L134 |
31,250 | goldmansachs/reladomo | reladomo/src/main/java/com/gs/fw/common/mithra/database/SyslogChecker.java | SyslogChecker.checkAndWaitForSyslogSynchronized | public synchronized void checkAndWaitForSyslogSynchronized(Object sourceAttribute, String schema, MithraDatabaseObject databaseObject)
{
long now = System.currentTimeMillis();
if (now > nextTimeToCheck)
{
this.checkAndWaitForSyslog(sourceAttribute, schema, databaseObject);
}
} | java | public synchronized void checkAndWaitForSyslogSynchronized(Object sourceAttribute, String schema, MithraDatabaseObject databaseObject)
{
long now = System.currentTimeMillis();
if (now > nextTimeToCheck)
{
this.checkAndWaitForSyslog(sourceAttribute, schema, databaseObject);
}
} | [
"public",
"synchronized",
"void",
"checkAndWaitForSyslogSynchronized",
"(",
"Object",
"sourceAttribute",
",",
"String",
"schema",
",",
"MithraDatabaseObject",
"databaseObject",
")",
"{",
"long",
"now",
"=",
"System",
".",
"currentTimeMillis",
"(",
")",
";",
"if",
"(... | synchronized so it does one check for all involved threads. | [
"synchronized",
"so",
"it",
"does",
"one",
"check",
"for",
"all",
"involved",
"threads",
"."
] | e9a069452eece7a6ef9551caf81a69d3d9a3d990 | https://github.com/goldmansachs/reladomo/blob/e9a069452eece7a6ef9551caf81a69d3d9a3d990/reladomo/src/main/java/com/gs/fw/common/mithra/database/SyslogChecker.java#L88-L95 |
31,251 | goldmansachs/reladomo | reladomoxa/src/main/java/com/gs/reladomo/jms/TopicResourcesWithTransactionXid.java | TopicResourcesWithTransactionXid.initializeTransactionXidRange | private ReladomoTxIdInterface initializeTransactionXidRange(String flowId, int xidId)
{
ReladomoTxIdInterface transactionXid = null;
MithraTransactionalList list = null;
try
{
DeserializationClassMetaData deserializationClassMetaData = new DeserializationClassMetaData(this.txIdFinder);
transactionXid = (ReladomoTxIdInterface) deserializationClassMetaData.constructObject(null, null);
transactionXid.setId(xidId);
transactionXid.setFlowId(flowId);
list = (MithraTransactionalList) this.txIdFinder.constructEmptyList();
list.add(transactionXid);
for (int i = xidId - 80; i < xidId; i++)
{
ReladomoTxIdInterface filler = (ReladomoTxIdInterface) deserializationClassMetaData.constructObject(null, null);
filler.setId(i);
filler.setFlowId(i+" Padding");
list.add(filler);
}
for (int i = xidId + 1; i < xidId + 80; i++)
{
ReladomoTxIdInterface filler = (ReladomoTxIdInterface) deserializationClassMetaData.constructObject(null, null);
filler.setId(i);
filler.setFlowId(i+ " Padding");
list.add(filler);
}
}
catch (DeserializationException e)
{
throw new RuntimeException("Could not construct transactionId class", e);
}
list.insertAll();
return transactionXid;
} | java | private ReladomoTxIdInterface initializeTransactionXidRange(String flowId, int xidId)
{
ReladomoTxIdInterface transactionXid = null;
MithraTransactionalList list = null;
try
{
DeserializationClassMetaData deserializationClassMetaData = new DeserializationClassMetaData(this.txIdFinder);
transactionXid = (ReladomoTxIdInterface) deserializationClassMetaData.constructObject(null, null);
transactionXid.setId(xidId);
transactionXid.setFlowId(flowId);
list = (MithraTransactionalList) this.txIdFinder.constructEmptyList();
list.add(transactionXid);
for (int i = xidId - 80; i < xidId; i++)
{
ReladomoTxIdInterface filler = (ReladomoTxIdInterface) deserializationClassMetaData.constructObject(null, null);
filler.setId(i);
filler.setFlowId(i+" Padding");
list.add(filler);
}
for (int i = xidId + 1; i < xidId + 80; i++)
{
ReladomoTxIdInterface filler = (ReladomoTxIdInterface) deserializationClassMetaData.constructObject(null, null);
filler.setId(i);
filler.setFlowId(i+ " Padding");
list.add(filler);
}
}
catch (DeserializationException e)
{
throw new RuntimeException("Could not construct transactionId class", e);
}
list.insertAll();
return transactionXid;
} | [
"private",
"ReladomoTxIdInterface",
"initializeTransactionXidRange",
"(",
"String",
"flowId",
",",
"int",
"xidId",
")",
"{",
"ReladomoTxIdInterface",
"transactionXid",
"=",
"null",
";",
"MithraTransactionalList",
"list",
"=",
"null",
";",
"try",
"{",
"DeserializationCla... | real records. | [
"real",
"records",
"."
] | e9a069452eece7a6ef9551caf81a69d3d9a3d990 | https://github.com/goldmansachs/reladomo/blob/e9a069452eece7a6ef9551caf81a69d3d9a3d990/reladomoxa/src/main/java/com/gs/reladomo/jms/TopicResourcesWithTransactionXid.java#L408-L441 |
31,252 | goldmansachs/reladomo | reladomo/src/main/java/com/gs/fw/common/mithra/finder/string/StringNotContainsOperation.java | StringNotContainsOperation.matchesWithoutDeleteCheck | protected boolean matchesWithoutDeleteCheck(Object o, Extractor extractor)
{
String s = ((StringExtractor) extractor).stringValueOf(o);
return s != null && s.indexOf(this.getParameter()) < 0;
} | java | protected boolean matchesWithoutDeleteCheck(Object o, Extractor extractor)
{
String s = ((StringExtractor) extractor).stringValueOf(o);
return s != null && s.indexOf(this.getParameter()) < 0;
} | [
"protected",
"boolean",
"matchesWithoutDeleteCheck",
"(",
"Object",
"o",
",",
"Extractor",
"extractor",
")",
"{",
"String",
"s",
"=",
"(",
"(",
"StringExtractor",
")",
"extractor",
")",
".",
"stringValueOf",
"(",
"o",
")",
";",
"return",
"s",
"!=",
"null",
... | null must not match anything, exactly as in SQL | [
"null",
"must",
"not",
"match",
"anything",
"exactly",
"as",
"in",
"SQL"
] | e9a069452eece7a6ef9551caf81a69d3d9a3d990 | https://github.com/goldmansachs/reladomo/blob/e9a069452eece7a6ef9551caf81a69d3d9a3d990/reladomo/src/main/java/com/gs/fw/common/mithra/finder/string/StringNotContainsOperation.java#L46-L50 |
31,253 | goldmansachs/reladomo | reladomo/src/main/java/com/gs/fw/common/mithra/notification/server/LinkedBlockingDeque.java | LinkedBlockingDeque.linkFirst | private boolean linkFirst(Node<E> node) {
// assert lock.isHeldByCurrentThread();
if (count >= capacity)
return false;
Node<E> f = first;
node.next = f;
first = node;
if (last == null)
last = node;
else
f.prev = node;
++count;
notEmpty.signal();
return true;
} | java | private boolean linkFirst(Node<E> node) {
// assert lock.isHeldByCurrentThread();
if (count >= capacity)
return false;
Node<E> f = first;
node.next = f;
first = node;
if (last == null)
last = node;
else
f.prev = node;
++count;
notEmpty.signal();
return true;
} | [
"private",
"boolean",
"linkFirst",
"(",
"Node",
"<",
"E",
">",
"node",
")",
"{",
"// assert lock.isHeldByCurrentThread();\r",
"if",
"(",
"count",
">=",
"capacity",
")",
"return",
"false",
";",
"Node",
"<",
"E",
">",
"f",
"=",
"first",
";",
"node",
".",
"... | Links node as first element, or returns false if full. | [
"Links",
"node",
"as",
"first",
"element",
"or",
"returns",
"false",
"if",
"full",
"."
] | e9a069452eece7a6ef9551caf81a69d3d9a3d990 | https://github.com/goldmansachs/reladomo/blob/e9a069452eece7a6ef9551caf81a69d3d9a3d990/reladomo/src/main/java/com/gs/fw/common/mithra/notification/server/LinkedBlockingDeque.java#L203-L217 |
31,254 | goldmansachs/reladomo | reladomo/src/main/java/com/gs/fw/common/mithra/notification/server/LinkedBlockingDeque.java | LinkedBlockingDeque.linkLast | private boolean linkLast(Node<E> node) {
// assert lock.isHeldByCurrentThread();
if (count >= capacity)
return false;
Node<E> l = last;
node.prev = l;
last = node;
if (first == null)
first = node;
else
l.next = node;
++count;
notEmpty.signal();
return true;
} | java | private boolean linkLast(Node<E> node) {
// assert lock.isHeldByCurrentThread();
if (count >= capacity)
return false;
Node<E> l = last;
node.prev = l;
last = node;
if (first == null)
first = node;
else
l.next = node;
++count;
notEmpty.signal();
return true;
} | [
"private",
"boolean",
"linkLast",
"(",
"Node",
"<",
"E",
">",
"node",
")",
"{",
"// assert lock.isHeldByCurrentThread();\r",
"if",
"(",
"count",
">=",
"capacity",
")",
"return",
"false",
";",
"Node",
"<",
"E",
">",
"l",
"=",
"last",
";",
"node",
".",
"pr... | Links node as last element, or returns false if full. | [
"Links",
"node",
"as",
"last",
"element",
"or",
"returns",
"false",
"if",
"full",
"."
] | e9a069452eece7a6ef9551caf81a69d3d9a3d990 | https://github.com/goldmansachs/reladomo/blob/e9a069452eece7a6ef9551caf81a69d3d9a3d990/reladomo/src/main/java/com/gs/fw/common/mithra/notification/server/LinkedBlockingDeque.java#L222-L236 |
31,255 | goldmansachs/reladomo | reladomo/src/main/java/com/gs/fw/common/mithra/notification/server/LinkedBlockingDeque.java | LinkedBlockingDeque.unlink | void unlink(Node<E> x) {
// assert lock.isHeldByCurrentThread();
Node<E> p = x.prev;
Node<E> n = x.next;
if (p == null) {
unlinkFirst();
} else if (n == null) {
unlinkLast();
} else {
p.next = n;
n.prev = p;
x.item = null;
// Don't mess with x's links. They may still be in use by
// an iterator.
--count;
notFull.signal();
}
} | java | void unlink(Node<E> x) {
// assert lock.isHeldByCurrentThread();
Node<E> p = x.prev;
Node<E> n = x.next;
if (p == null) {
unlinkFirst();
} else if (n == null) {
unlinkLast();
} else {
p.next = n;
n.prev = p;
x.item = null;
// Don't mess with x's links. They may still be in use by
// an iterator.
--count;
notFull.signal();
}
} | [
"void",
"unlink",
"(",
"Node",
"<",
"E",
">",
"x",
")",
"{",
"// assert lock.isHeldByCurrentThread();\r",
"Node",
"<",
"E",
">",
"p",
"=",
"x",
".",
"prev",
";",
"Node",
"<",
"E",
">",
"n",
"=",
"x",
".",
"next",
";",
"if",
"(",
"p",
"==",
"null"... | Unlinks x. | [
"Unlinks",
"x",
"."
] | e9a069452eece7a6ef9551caf81a69d3d9a3d990 | https://github.com/goldmansachs/reladomo/blob/e9a069452eece7a6ef9551caf81a69d3d9a3d990/reladomo/src/main/java/com/gs/fw/common/mithra/notification/server/LinkedBlockingDeque.java#L285-L302 |
31,256 | goldmansachs/reladomo | reladomo/src/main/java/com/gs/fw/common/mithra/transaction/TransactionLocalMap.java | TransactionLocalMap.getEntryAfterMiss | private Object getEntryAfterMiss(TransactionLocal key, int i, Entry e)
{
Entry[] tab = table;
int len = tab.length;
while (e != null)
{
if (e.key == key)
return e.value;
i = nextIndex(i, len);
e = tab[i];
}
return null;
} | java | private Object getEntryAfterMiss(TransactionLocal key, int i, Entry e)
{
Entry[] tab = table;
int len = tab.length;
while (e != null)
{
if (e.key == key)
return e.value;
i = nextIndex(i, len);
e = tab[i];
}
return null;
} | [
"private",
"Object",
"getEntryAfterMiss",
"(",
"TransactionLocal",
"key",
",",
"int",
"i",
",",
"Entry",
"e",
")",
"{",
"Entry",
"[",
"]",
"tab",
"=",
"table",
";",
"int",
"len",
"=",
"tab",
".",
"length",
";",
"while",
"(",
"e",
"!=",
"null",
")",
... | Version of getEntry method for use when key is not found in
its direct hash slot.
@param key the thread local object
@param i the table index for key's hash code
@param e the entry at table[i]
@return the entry associated with key, or null if no such | [
"Version",
"of",
"getEntry",
"method",
"for",
"use",
"when",
"key",
"is",
"not",
"found",
"in",
"its",
"direct",
"hash",
"slot",
"."
] | e9a069452eece7a6ef9551caf81a69d3d9a3d990 | https://github.com/goldmansachs/reladomo/blob/e9a069452eece7a6ef9551caf81a69d3d9a3d990/reladomo/src/main/java/com/gs/fw/common/mithra/transaction/TransactionLocalMap.java#L121-L134 |
31,257 | goldmansachs/reladomo | reladomo/src/main/java/com/gs/fw/common/mithra/transaction/TransactionLocalMap.java | TransactionLocalMap.put | public void put(TransactionLocal key, Object value)
{
// We don't use a fast path as with get() because it is at
// least as common to use set() to create new entries as
// it is to replace existing ones, in which case, a fast
// path would fail more often than not.
Entry[] tab = table;
int len = tab.length;
int i = key.hashCode & (len - 1);
for (Entry e = tab[i];
e != null;
e = tab[i = nextIndex(i, len)])
{
if (e.key == key)
{
e.value = value;
return;
}
}
tab[i] = new Entry(key, value);
int sz = ++size;
if (sz >= threshold)
rehash();
} | java | public void put(TransactionLocal key, Object value)
{
// We don't use a fast path as with get() because it is at
// least as common to use set() to create new entries as
// it is to replace existing ones, in which case, a fast
// path would fail more often than not.
Entry[] tab = table;
int len = tab.length;
int i = key.hashCode & (len - 1);
for (Entry e = tab[i];
e != null;
e = tab[i = nextIndex(i, len)])
{
if (e.key == key)
{
e.value = value;
return;
}
}
tab[i] = new Entry(key, value);
int sz = ++size;
if (sz >= threshold)
rehash();
} | [
"public",
"void",
"put",
"(",
"TransactionLocal",
"key",
",",
"Object",
"value",
")",
"{",
"// We don't use a fast path as with get() because it is at\r",
"// least as common to use set() to create new entries as\r",
"// it is to replace existing ones, in which case, a fast\r",
"// path ... | Set the value associated with key.
@param key the thread local object
@param value the value to be set | [
"Set",
"the",
"value",
"associated",
"with",
"key",
"."
] | e9a069452eece7a6ef9551caf81a69d3d9a3d990 | https://github.com/goldmansachs/reladomo/blob/e9a069452eece7a6ef9551caf81a69d3d9a3d990/reladomo/src/main/java/com/gs/fw/common/mithra/transaction/TransactionLocalMap.java#L142-L169 |
31,258 | goldmansachs/reladomo | reladomo/src/main/java/com/gs/fw/common/mithra/transaction/TransactionLocalMap.java | TransactionLocalMap.remove | public void remove(TransactionLocal key)
{
Entry[] tab = table;
int len = tab.length;
int i = key.hashCode & (len - 1);
for (Entry e = tab[i];
e != null;
e = tab[i = nextIndex(i, len)])
{
if (e.key == key)
{
expungeStaleEntry(i);
return;
}
}
} | java | public void remove(TransactionLocal key)
{
Entry[] tab = table;
int len = tab.length;
int i = key.hashCode & (len - 1);
for (Entry e = tab[i];
e != null;
e = tab[i = nextIndex(i, len)])
{
if (e.key == key)
{
expungeStaleEntry(i);
return;
}
}
} | [
"public",
"void",
"remove",
"(",
"TransactionLocal",
"key",
")",
"{",
"Entry",
"[",
"]",
"tab",
"=",
"table",
";",
"int",
"len",
"=",
"tab",
".",
"length",
";",
"int",
"i",
"=",
"key",
".",
"hashCode",
"&",
"(",
"len",
"-",
"1",
")",
";",
"for",
... | Remove the entry for key.
@param key to remove | [
"Remove",
"the",
"entry",
"for",
"key",
"."
] | e9a069452eece7a6ef9551caf81a69d3d9a3d990 | https://github.com/goldmansachs/reladomo/blob/e9a069452eece7a6ef9551caf81a69d3d9a3d990/reladomo/src/main/java/com/gs/fw/common/mithra/transaction/TransactionLocalMap.java#L175-L190 |
31,259 | goldmansachs/reladomo | reladomo/src/main/java/com/gs/fw/common/mithra/transaction/TransactionLocalMap.java | TransactionLocalMap.expungeStaleEntry | private int expungeStaleEntry(int staleSlot)
{
Entry[] tab = table;
int len = tab.length;
// expunge entry at staleSlot
tab[staleSlot].value = null;
tab[staleSlot] = null;
size--;
// Rehash until we encounter null
Entry e;
int i;
for (i = nextIndex(staleSlot, len);
(e = tab[i]) != null;
i = nextIndex(i, len))
{
int h = e.key.hashCode & (len - 1);
if (h != i)
{
tab[i] = null;
// Unlike Knuth 6.4 Algorithm R, we must scan until
// null because multiple entries could have been stale.
while (tab[h] != null)
h = nextIndex(h, len);
tab[h] = e;
}
}
return i;
} | java | private int expungeStaleEntry(int staleSlot)
{
Entry[] tab = table;
int len = tab.length;
// expunge entry at staleSlot
tab[staleSlot].value = null;
tab[staleSlot] = null;
size--;
// Rehash until we encounter null
Entry e;
int i;
for (i = nextIndex(staleSlot, len);
(e = tab[i]) != null;
i = nextIndex(i, len))
{
int h = e.key.hashCode & (len - 1);
if (h != i)
{
tab[i] = null;
// Unlike Knuth 6.4 Algorithm R, we must scan until
// null because multiple entries could have been stale.
while (tab[h] != null)
h = nextIndex(h, len);
tab[h] = e;
}
}
return i;
} | [
"private",
"int",
"expungeStaleEntry",
"(",
"int",
"staleSlot",
")",
"{",
"Entry",
"[",
"]",
"tab",
"=",
"table",
";",
"int",
"len",
"=",
"tab",
".",
"length",
";",
"// expunge entry at staleSlot\r",
"tab",
"[",
"staleSlot",
"]",
".",
"value",
"=",
"null",... | Expunge a stale entry by rehashing any possibly colliding entries
lying between staleSlot and the next null slot. This also expunges
any other stale entries encountered before the trailing null. See
Knuth, Section 6.4
@param staleSlot index of slot known to have null key
@return the index of the next null slot after staleSlot
(all between staleSlot and this slot will have been checked
for expunging). | [
"Expunge",
"a",
"stale",
"entry",
"by",
"rehashing",
"any",
"possibly",
"colliding",
"entries",
"lying",
"between",
"staleSlot",
"and",
"the",
"next",
"null",
"slot",
".",
"This",
"also",
"expunges",
"any",
"other",
"stale",
"entries",
"encountered",
"before",
... | e9a069452eece7a6ef9551caf81a69d3d9a3d990 | https://github.com/goldmansachs/reladomo/blob/e9a069452eece7a6ef9551caf81a69d3d9a3d990/reladomo/src/main/java/com/gs/fw/common/mithra/transaction/TransactionLocalMap.java#L203-L233 |
31,260 | goldmansachs/reladomo | reladomo/src/main/java/com/gs/fw/common/mithra/transaction/TransactionLocalMap.java | TransactionLocalMap.resize | private void resize()
{
Entry[] oldTab = table;
int oldLen = oldTab.length;
int newLen = oldLen * 2;
Entry[] newTab = new Entry[newLen];
int count = 0;
for (int j = 0; j < oldLen; ++j)
{
Entry e = oldTab[j];
if (e != null)
{
int h = e.key.hashCode & (newLen - 1);
while (newTab[h] != null)
h = nextIndex(h, newLen);
newTab[h] = e;
count++;
}
}
setThreshold(newLen);
size = count;
table = newTab;
} | java | private void resize()
{
Entry[] oldTab = table;
int oldLen = oldTab.length;
int newLen = oldLen * 2;
Entry[] newTab = new Entry[newLen];
int count = 0;
for (int j = 0; j < oldLen; ++j)
{
Entry e = oldTab[j];
if (e != null)
{
int h = e.key.hashCode & (newLen - 1);
while (newTab[h] != null)
h = nextIndex(h, newLen);
newTab[h] = e;
count++;
}
}
setThreshold(newLen);
size = count;
table = newTab;
} | [
"private",
"void",
"resize",
"(",
")",
"{",
"Entry",
"[",
"]",
"oldTab",
"=",
"table",
";",
"int",
"oldLen",
"=",
"oldTab",
".",
"length",
";",
"int",
"newLen",
"=",
"oldLen",
"*",
"2",
";",
"Entry",
"[",
"]",
"newTab",
"=",
"new",
"Entry",
"[",
... | Double the capacity of the table. | [
"Double",
"the",
"capacity",
"of",
"the",
"table",
"."
] | e9a069452eece7a6ef9551caf81a69d3d9a3d990 | https://github.com/goldmansachs/reladomo/blob/e9a069452eece7a6ef9551caf81a69d3d9a3d990/reladomo/src/main/java/com/gs/fw/common/mithra/transaction/TransactionLocalMap.java#L250-L274 |
31,261 | goldmansachs/reladomo | reladomo/src/main/java/com/gs/fw/common/mithra/portal/MithraTransactionalPortal.java | MithraTransactionalPortal.applyOperationAndCheck | private List applyOperationAndCheck(Operation op, MithraTransaction tx)
{
boolean oldEvaluationMode = tx.zIsInOperationEvaluationMode();
List resultList = null;
try
{
tx.zSetOperationEvaluationMode(true);
if (this.isPureHome() || (!this.isOperationPartiallyCached(op) && !this.txParticipationRequired(tx, op)))
{
resultList = this.resolveOperationOnCache(op);
}
else
{
resultList = op.applyOperationToPartialCache();
if (resultList == null && !this.isOperationPartiallyCached(op) && this.getTxParticipationMode(tx).mustParticipateInTxOnRead())
{
// attempt to find what we have in cache to trigger waiting for potential other transactions
List untrustworthyResult = op.applyOperationToFullCache();
checkTransactionParticipationAndWaitForOtherTransactions(untrustworthyResult, tx);
}
resultList = checkTransactionParticipationAndWaitForOtherTransactions(resultList, tx);
}
}
finally
{
tx.zSetOperationEvaluationMode(oldEvaluationMode);
}
if (this.isPureHome())
{
checkTransactionParticipationForPureObject(resultList, tx);
}
return resultList;
} | java | private List applyOperationAndCheck(Operation op, MithraTransaction tx)
{
boolean oldEvaluationMode = tx.zIsInOperationEvaluationMode();
List resultList = null;
try
{
tx.zSetOperationEvaluationMode(true);
if (this.isPureHome() || (!this.isOperationPartiallyCached(op) && !this.txParticipationRequired(tx, op)))
{
resultList = this.resolveOperationOnCache(op);
}
else
{
resultList = op.applyOperationToPartialCache();
if (resultList == null && !this.isOperationPartiallyCached(op) && this.getTxParticipationMode(tx).mustParticipateInTxOnRead())
{
// attempt to find what we have in cache to trigger waiting for potential other transactions
List untrustworthyResult = op.applyOperationToFullCache();
checkTransactionParticipationAndWaitForOtherTransactions(untrustworthyResult, tx);
}
resultList = checkTransactionParticipationAndWaitForOtherTransactions(resultList, tx);
}
}
finally
{
tx.zSetOperationEvaluationMode(oldEvaluationMode);
}
if (this.isPureHome())
{
checkTransactionParticipationForPureObject(resultList, tx);
}
return resultList;
} | [
"private",
"List",
"applyOperationAndCheck",
"(",
"Operation",
"op",
",",
"MithraTransaction",
"tx",
")",
"{",
"boolean",
"oldEvaluationMode",
"=",
"tx",
".",
"zIsInOperationEvaluationMode",
"(",
")",
";",
"List",
"resultList",
"=",
"null",
";",
"try",
"{",
"tx"... | the transaction is getting 100% correct data | [
"the",
"transaction",
"is",
"getting",
"100%",
"correct",
"data"
] | e9a069452eece7a6ef9551caf81a69d3d9a3d990 | https://github.com/goldmansachs/reladomo/blob/e9a069452eece7a6ef9551caf81a69d3d9a3d990/reladomo/src/main/java/com/gs/fw/common/mithra/portal/MithraTransactionalPortal.java#L257-L289 |
31,262 | goldmansachs/reladomo | reladomo/src/main/java/com/gs/fw/common/mithra/cacheloader/CacheIndexBasedFilter.java | CacheIndexBasedFilter.timestampToAsofAttributeRelationiship | private static boolean timestampToAsofAttributeRelationiship(Map.Entry<Attribute, Attribute> each)
{
return (each.getValue() != null && each.getValue().isAsOfAttribute()) && !each.getKey().isAsOfAttribute();
} | java | private static boolean timestampToAsofAttributeRelationiship(Map.Entry<Attribute, Attribute> each)
{
return (each.getValue() != null && each.getValue().isAsOfAttribute()) && !each.getKey().isAsOfAttribute();
} | [
"private",
"static",
"boolean",
"timestampToAsofAttributeRelationiship",
"(",
"Map",
".",
"Entry",
"<",
"Attribute",
",",
"Attribute",
">",
"each",
")",
"{",
"return",
"(",
"each",
".",
"getValue",
"(",
")",
"!=",
"null",
"&&",
"each",
".",
"getValue",
"(",
... | unsupported combination of businessDate timestamp -> businessDate asOf mapping. requires custom index | [
"unsupported",
"combination",
"of",
"businessDate",
"timestamp",
"-",
">",
"businessDate",
"asOf",
"mapping",
".",
"requires",
"custom",
"index"
] | e9a069452eece7a6ef9551caf81a69d3d9a3d990 | https://github.com/goldmansachs/reladomo/blob/e9a069452eece7a6ef9551caf81a69d3d9a3d990/reladomo/src/main/java/com/gs/fw/common/mithra/cacheloader/CacheIndexBasedFilter.java#L84-L87 |
31,263 | goldmansachs/reladomo | reladomo/src/main/java/com/gs/fw/common/mithra/MithraBusinessException.java | MithraBusinessException.ifRetriableWaitElseThrow | public int ifRetriableWaitElseThrow(String msg, int retriesLeft, Logger logger)
{
if (this.isRetriable() && --retriesLeft > 0)
{
logger.warn(msg+ " " + this.getMessage());
if (logger.isDebugEnabled())
{
logger.debug("find failed with retriable error. retrying.", this);
}
cleanupAndRecreateTempContexts();
this.waitBeforeRetrying();
}
else throw this;
return retriesLeft;
} | java | public int ifRetriableWaitElseThrow(String msg, int retriesLeft, Logger logger)
{
if (this.isRetriable() && --retriesLeft > 0)
{
logger.warn(msg+ " " + this.getMessage());
if (logger.isDebugEnabled())
{
logger.debug("find failed with retriable error. retrying.", this);
}
cleanupAndRecreateTempContexts();
this.waitBeforeRetrying();
}
else throw this;
return retriesLeft;
} | [
"public",
"int",
"ifRetriableWaitElseThrow",
"(",
"String",
"msg",
",",
"int",
"retriesLeft",
",",
"Logger",
"logger",
")",
"{",
"if",
"(",
"this",
".",
"isRetriable",
"(",
")",
"&&",
"--",
"retriesLeft",
">",
"0",
")",
"{",
"logger",
".",
"warn",
"(",
... | must not be called from within a transaction, unless the work is being done async in a non-tx thread. | [
"must",
"not",
"be",
"called",
"from",
"within",
"a",
"transaction",
"unless",
"the",
"work",
"is",
"being",
"done",
"async",
"in",
"a",
"non",
"-",
"tx",
"thread",
"."
] | e9a069452eece7a6ef9551caf81a69d3d9a3d990 | https://github.com/goldmansachs/reladomo/blob/e9a069452eece7a6ef9551caf81a69d3d9a3d990/reladomo/src/main/java/com/gs/fw/common/mithra/MithraBusinessException.java#L53-L67 |
31,264 | goldmansachs/reladomo | samples/reladomo-sample-simple/src/main/java/sample/util/H2ConnectionManager.java | H2ConnectionManager.prepareTables | public void prepareTables() throws Exception
{
Path ddlPath = Paths.get(ClassLoader.getSystemResource("sql").toURI());
try (Connection conn = xaConnectionManager.getConnection();)
{
Files.walk(ddlPath, 1)
.filter(path -> !Files.isDirectory(path)
&& (path.toString().endsWith("ddl")
|| path.toString().endsWith("idx")))
.forEach(path -> {
try
{
RunScript.execute(conn, Files.newBufferedReader(path));
}
catch (Exception e)
{
throw new RuntimeException("Exception at table initialization", e);
}
});
}
} | java | public void prepareTables() throws Exception
{
Path ddlPath = Paths.get(ClassLoader.getSystemResource("sql").toURI());
try (Connection conn = xaConnectionManager.getConnection();)
{
Files.walk(ddlPath, 1)
.filter(path -> !Files.isDirectory(path)
&& (path.toString().endsWith("ddl")
|| path.toString().endsWith("idx")))
.forEach(path -> {
try
{
RunScript.execute(conn, Files.newBufferedReader(path));
}
catch (Exception e)
{
throw new RuntimeException("Exception at table initialization", e);
}
});
}
} | [
"public",
"void",
"prepareTables",
"(",
")",
"throws",
"Exception",
"{",
"Path",
"ddlPath",
"=",
"Paths",
".",
"get",
"(",
"ClassLoader",
".",
"getSystemResource",
"(",
"\"sql\"",
")",
".",
"toURI",
"(",
")",
")",
";",
"try",
"(",
"Connection",
"conn",
"... | This is not typically done in production app. | [
"This",
"is",
"not",
"typically",
"done",
"in",
"production",
"app",
"."
] | e9a069452eece7a6ef9551caf81a69d3d9a3d990 | https://github.com/goldmansachs/reladomo/blob/e9a069452eece7a6ef9551caf81a69d3d9a3d990/samples/reladomo-sample-simple/src/main/java/sample/util/H2ConnectionManager.java#L103-L124 |
31,265 | goldmansachs/reladomo | reladomo/src/main/java/com/gs/fw/common/mithra/list/merge/MergeOptions.java | MergeOptions.doNotUpdate | public MergeOptions<E> doNotUpdate(Attribute... attributes)
{
if (this.doNotUpdate == null)
{
this.doNotUpdate = attributes;
}
else
{
List<Attribute> all = FastList.newListWith(this.doNotUpdate);
for(Attribute a: attributes) all.add(a);
this.doNotUpdate = new Attribute[all.size()];
all.toArray(this.doNotUpdate);
}
return this;
} | java | public MergeOptions<E> doNotUpdate(Attribute... attributes)
{
if (this.doNotUpdate == null)
{
this.doNotUpdate = attributes;
}
else
{
List<Attribute> all = FastList.newListWith(this.doNotUpdate);
for(Attribute a: attributes) all.add(a);
this.doNotUpdate = new Attribute[all.size()];
all.toArray(this.doNotUpdate);
}
return this;
} | [
"public",
"MergeOptions",
"<",
"E",
">",
"doNotUpdate",
"(",
"Attribute",
"...",
"attributes",
")",
"{",
"if",
"(",
"this",
".",
"doNotUpdate",
"==",
"null",
")",
"{",
"this",
".",
"doNotUpdate",
"=",
"attributes",
";",
"}",
"else",
"{",
"List",
"<",
"... | Do not update these attributes
@param attributes
@return | [
"Do",
"not",
"update",
"these",
"attributes"
] | e9a069452eece7a6ef9551caf81a69d3d9a3d990 | https://github.com/goldmansachs/reladomo/blob/e9a069452eece7a6ef9551caf81a69d3d9a3d990/reladomo/src/main/java/com/gs/fw/common/mithra/list/merge/MergeOptions.java#L111-L125 |
31,266 | goldmansachs/reladomo | reladomogen/src/main/java/com/gs/fw/common/mithra/generator/MithraObjectTypeWrapper.java | MithraObjectTypeWrapper.extractMithraInterfaces | private void extractMithraInterfaces(Map<String, MithraInterfaceType> mithraInterfaces, List<String> errors)
{
for (String mithraInterfaceType : this.getWrapped().getMithraInterfaces())
{
MithraInterfaceType mithraInterfaceObject = mithraInterfaces.get(mithraInterfaceType);
if (mithraInterfaceObject != null)
{
//boolean hasNoSuperClass = validateObjectHasNoSuperClass(errors);
boolean hasAllInterfaceAttributes = validateObjectHasAllMithraInterfaceAttributes(mithraInterfaceObject, errors);
boolean hasAllInterfaceRelationships = validateObjectHasAllMithraInterfaceRelationships(mithraInterfaceObject, mithraInterfaces, errors);
if (hasAllInterfaceAttributes && hasAllInterfaceRelationships)
{
this.mithraInterfaces.add(mithraInterfaceObject);
this.addToRequiredClasses(mithraInterfaceObject.getPackageName(), mithraInterfaceObject.getClassName());
this.addToRequiredClasses(mithraInterfaceObject.getPackageName(), mithraInterfaceObject.getClassName() + "Finder");
}
}
}
} | java | private void extractMithraInterfaces(Map<String, MithraInterfaceType> mithraInterfaces, List<String> errors)
{
for (String mithraInterfaceType : this.getWrapped().getMithraInterfaces())
{
MithraInterfaceType mithraInterfaceObject = mithraInterfaces.get(mithraInterfaceType);
if (mithraInterfaceObject != null)
{
//boolean hasNoSuperClass = validateObjectHasNoSuperClass(errors);
boolean hasAllInterfaceAttributes = validateObjectHasAllMithraInterfaceAttributes(mithraInterfaceObject, errors);
boolean hasAllInterfaceRelationships = validateObjectHasAllMithraInterfaceRelationships(mithraInterfaceObject, mithraInterfaces, errors);
if (hasAllInterfaceAttributes && hasAllInterfaceRelationships)
{
this.mithraInterfaces.add(mithraInterfaceObject);
this.addToRequiredClasses(mithraInterfaceObject.getPackageName(), mithraInterfaceObject.getClassName());
this.addToRequiredClasses(mithraInterfaceObject.getPackageName(), mithraInterfaceObject.getClassName() + "Finder");
}
}
}
} | [
"private",
"void",
"extractMithraInterfaces",
"(",
"Map",
"<",
"String",
",",
"MithraInterfaceType",
">",
"mithraInterfaces",
",",
"List",
"<",
"String",
">",
"errors",
")",
"{",
"for",
"(",
"String",
"mithraInterfaceType",
":",
"this",
".",
"getWrapped",
"(",
... | For each finder interface validate the | [
"For",
"each",
"finder",
"interface",
"validate",
"the"
] | e9a069452eece7a6ef9551caf81a69d3d9a3d990 | https://github.com/goldmansachs/reladomo/blob/e9a069452eece7a6ef9551caf81a69d3d9a3d990/reladomogen/src/main/java/com/gs/fw/common/mithra/generator/MithraObjectTypeWrapper.java#L1457-L1478 |
31,267 | goldmansachs/reladomo | reladomo/src/main/java/com/gs/fw/common/mithra/util/dbextractor/MithraObjectGraphExtractor.java | MithraObjectGraphExtractor.addRelationshipFilter | public void addRelationshipFilter(RelatedFinder relatedFinder, Operation filter)
{
Operation existing = this.filters.get(relatedFinder);
this.filters.put(relatedFinder, existing == null ? filter : existing.or(filter));
} | java | public void addRelationshipFilter(RelatedFinder relatedFinder, Operation filter)
{
Operation existing = this.filters.get(relatedFinder);
this.filters.put(relatedFinder, existing == null ? filter : existing.or(filter));
} | [
"public",
"void",
"addRelationshipFilter",
"(",
"RelatedFinder",
"relatedFinder",
",",
"Operation",
"filter",
")",
"{",
"Operation",
"existing",
"=",
"this",
".",
"filters",
".",
"get",
"(",
"relatedFinder",
")",
";",
"this",
".",
"filters",
".",
"put",
"(",
... | Add a filter to be applied to the result of a traversed relationship.
@param relatedFinder - the relationship to apply the filter to
@param filter - the filter to apply | [
"Add",
"a",
"filter",
"to",
"be",
"applied",
"to",
"the",
"result",
"of",
"a",
"traversed",
"relationship",
"."
] | e9a069452eece7a6ef9551caf81a69d3d9a3d990 | https://github.com/goldmansachs/reladomo/blob/e9a069452eece7a6ef9551caf81a69d3d9a3d990/reladomo/src/main/java/com/gs/fw/common/mithra/util/dbextractor/MithraObjectGraphExtractor.java#L117-L121 |
31,268 | goldmansachs/reladomo | reladomo/src/main/java/com/gs/fw/common/mithra/util/dbextractor/MithraObjectGraphExtractor.java | MithraObjectGraphExtractor.extract | public void extract()
{
ExecutorService executor = Executors.newFixedThreadPool(this.extractorConfig.getThreadPoolSize());
try
{
Map<Pair<RelatedFinder, Object>, List<MithraDataObject>> extract = extractData(executor);
writeToFiles(executor, extract);
}
finally
{
executor.shutdown();
try
{
executor.awaitTermination(extractorConfig.getTimeoutSeconds(), TimeUnit.SECONDS);
}
catch (InterruptedException e)
{
//
}
}
} | java | public void extract()
{
ExecutorService executor = Executors.newFixedThreadPool(this.extractorConfig.getThreadPoolSize());
try
{
Map<Pair<RelatedFinder, Object>, List<MithraDataObject>> extract = extractData(executor);
writeToFiles(executor, extract);
}
finally
{
executor.shutdown();
try
{
executor.awaitTermination(extractorConfig.getTimeoutSeconds(), TimeUnit.SECONDS);
}
catch (InterruptedException e)
{
//
}
}
} | [
"public",
"void",
"extract",
"(",
")",
"{",
"ExecutorService",
"executor",
"=",
"Executors",
".",
"newFixedThreadPool",
"(",
"this",
".",
"extractorConfig",
".",
"getThreadPoolSize",
"(",
")",
")",
";",
"try",
"{",
"Map",
"<",
"Pair",
"<",
"RelatedFinder",
"... | Extract data and related data from the root operations added and write extracted data to text files as defined
by OutputStrategy.
@see com.gs.fw.common.mithra.util.dbextractor.OutputStrategy | [
"Extract",
"data",
"and",
"related",
"data",
"from",
"the",
"root",
"operations",
"added",
"and",
"write",
"extracted",
"data",
"to",
"text",
"files",
"as",
"defined",
"by",
"OutputStrategy",
"."
] | e9a069452eece7a6ef9551caf81a69d3d9a3d990 | https://github.com/goldmansachs/reladomo/blob/e9a069452eece7a6ef9551caf81a69d3d9a3d990/reladomo/src/main/java/com/gs/fw/common/mithra/util/dbextractor/MithraObjectGraphExtractor.java#L156-L176 |
31,269 | goldmansachs/reladomo | reladomo/src/main/java/com/gs/fw/common/mithra/cache/TransactionalSemiUniqueDatedIndex.java | TransactionalSemiUniqueDatedIndex.getFromSemiUnique | public Object getFromSemiUnique(Object dataHolder, List extractors)
{
Object result = null;
TransactionLocalStorage txStorage = (TransactionLocalStorage) perTransactionStorage.get(MithraManagerProvider.getMithraManager().zGetCurrentTransactionWithNoCheck());
FullSemiUniqueDatedIndex perThreadAdded = this.getPerThreadAddedIndex(txStorage);
if (perThreadAdded != null)
{
result = perThreadAdded.getFromSemiUnique(dataHolder, extractors);
}
if (result != null)
{
int startIndex = this.semiUniqueExtractors.length;
int length = extractors.size() - startIndex;
boolean matchMoreThanOne = false;
for(int i=0;i<length;i++)
{
AsOfExtractor extractor = (AsOfExtractor) extractors.get(startIndex+i);
matchMoreThanOne = matchMoreThanOne || extractor.matchesMoreThanOne();
}
if (matchMoreThanOne)
{
Object mainIndexResult = this.mainIndex.getFromSemiUnique(dataHolder, extractors);
result = checkDeleted(result, txStorage, mainIndexResult);
}
}
else
{
result = this.mainIndex.getFromSemiUnique(dataHolder, extractors);
result = this.checkDeletedIndex(result, txStorage);
}
return result;
} | java | public Object getFromSemiUnique(Object dataHolder, List extractors)
{
Object result = null;
TransactionLocalStorage txStorage = (TransactionLocalStorage) perTransactionStorage.get(MithraManagerProvider.getMithraManager().zGetCurrentTransactionWithNoCheck());
FullSemiUniqueDatedIndex perThreadAdded = this.getPerThreadAddedIndex(txStorage);
if (perThreadAdded != null)
{
result = perThreadAdded.getFromSemiUnique(dataHolder, extractors);
}
if (result != null)
{
int startIndex = this.semiUniqueExtractors.length;
int length = extractors.size() - startIndex;
boolean matchMoreThanOne = false;
for(int i=0;i<length;i++)
{
AsOfExtractor extractor = (AsOfExtractor) extractors.get(startIndex+i);
matchMoreThanOne = matchMoreThanOne || extractor.matchesMoreThanOne();
}
if (matchMoreThanOne)
{
Object mainIndexResult = this.mainIndex.getFromSemiUnique(dataHolder, extractors);
result = checkDeleted(result, txStorage, mainIndexResult);
}
}
else
{
result = this.mainIndex.getFromSemiUnique(dataHolder, extractors);
result = this.checkDeletedIndex(result, txStorage);
}
return result;
} | [
"public",
"Object",
"getFromSemiUnique",
"(",
"Object",
"dataHolder",
",",
"List",
"extractors",
")",
"{",
"Object",
"result",
"=",
"null",
";",
"TransactionLocalStorage",
"txStorage",
"=",
"(",
"TransactionLocalStorage",
")",
"perTransactionStorage",
".",
"get",
"(... | new to differentiate | [
"new",
"to",
"differentiate"
] | e9a069452eece7a6ef9551caf81a69d3d9a3d990 | https://github.com/goldmansachs/reladomo/blob/e9a069452eece7a6ef9551caf81a69d3d9a3d990/reladomo/src/main/java/com/gs/fw/common/mithra/cache/TransactionalSemiUniqueDatedIndex.java#L597-L628 |
31,270 | goldmansachs/reladomo | reladomo/src/main/java/com/gs/fw/common/mithra/util/execute/Execute.java | Execute.execute | public int execute() throws IOException
{
Runtime runtime = Runtime.getRuntime();
int exitCode = -1;
TerminateProcessThread terminateProcess = null;
Process process = null;
try
{
// Execute the command
String[] command = (String[]) this.command.toArray(new String[this.command.size()]);
if (this.workingDirectory != null)
{
process = runtime.exec(command, null, this.workingDirectory);
}
else
{
process = runtime.exec(command);
}
// Start the stream handler
this.handler.setErrorStream(process.getErrorStream());
this.handler.setInputStream(process.getInputStream());
this.handler.setOutputStream(process.getOutputStream());
this.handler.start();
// Setup the thread to terminate the process if the JVM is shut down
if (this.terminateOnJvmExit)
{
terminateProcess = new TerminateProcessThread(process);
runtime.addShutdownHook(terminateProcess);
}
exitCode = process.waitFor();
}
catch (InterruptedException e)
{
process.destroy();
}
finally
{
// Stop the stream handler
this.handler.stop();
// Remove the terminate hook
if (terminateProcess != null)
{
runtime.removeShutdownHook(terminateProcess);
}
// Close off the streams
if (process != null)
{
closeStreams(process);
}
}
return exitCode;
} | java | public int execute() throws IOException
{
Runtime runtime = Runtime.getRuntime();
int exitCode = -1;
TerminateProcessThread terminateProcess = null;
Process process = null;
try
{
// Execute the command
String[] command = (String[]) this.command.toArray(new String[this.command.size()]);
if (this.workingDirectory != null)
{
process = runtime.exec(command, null, this.workingDirectory);
}
else
{
process = runtime.exec(command);
}
// Start the stream handler
this.handler.setErrorStream(process.getErrorStream());
this.handler.setInputStream(process.getInputStream());
this.handler.setOutputStream(process.getOutputStream());
this.handler.start();
// Setup the thread to terminate the process if the JVM is shut down
if (this.terminateOnJvmExit)
{
terminateProcess = new TerminateProcessThread(process);
runtime.addShutdownHook(terminateProcess);
}
exitCode = process.waitFor();
}
catch (InterruptedException e)
{
process.destroy();
}
finally
{
// Stop the stream handler
this.handler.stop();
// Remove the terminate hook
if (terminateProcess != null)
{
runtime.removeShutdownHook(terminateProcess);
}
// Close off the streams
if (process != null)
{
closeStreams(process);
}
}
return exitCode;
} | [
"public",
"int",
"execute",
"(",
")",
"throws",
"IOException",
"{",
"Runtime",
"runtime",
"=",
"Runtime",
".",
"getRuntime",
"(",
")",
";",
"int",
"exitCode",
"=",
"-",
"1",
";",
"TerminateProcessThread",
"terminateProcess",
"=",
"null",
";",
"Process",
"pro... | Executes the process.
@return The exit code of the process.
@throws IOException if there was a I/O problem whilst executing the process. | [
"Executes",
"the",
"process",
"."
] | e9a069452eece7a6ef9551caf81a69d3d9a3d990 | https://github.com/goldmansachs/reladomo/blob/e9a069452eece7a6ef9551caf81a69d3d9a3d990/reladomo/src/main/java/com/gs/fw/common/mithra/util/execute/Execute.java#L70-L131 |
31,271 | goldmansachs/reladomo | reladomo/src/main/java/com/gs/fw/common/mithra/cache/offheap/FastUnsafeOffHeapDataStorage.java | FastUnsafeOffHeapDataStorage.scanPagesToSend | protected long scanPagesToSend(long maxClientReplicatedPageVersion, FastUnsafeOffHeapIntList pagesToSend)
{
long maxPageVersion = 0;
boolean upgraded = false;
for(int i=0;i<this.pageVersionList.size();i++)
{
if (pageVersionList.get(i) == 0 && !upgraded)
{
boolean originalLockWasReleased = this.readWriteLock.upgradeToWriteLock();
this.currentPageVersion++;
if (originalLockWasReleased)
{
pagesToSend.clear();
for(int j=0;j<i;j++)
{
maxPageVersion = markAndAddPageIfRequired(maxClientReplicatedPageVersion, pagesToSend, maxPageVersion, j);
}
}
upgraded = true;
}
maxPageVersion = markAndAddPageIfRequired(maxClientReplicatedPageVersion, pagesToSend, maxPageVersion, i);
}
return maxPageVersion;
} | java | protected long scanPagesToSend(long maxClientReplicatedPageVersion, FastUnsafeOffHeapIntList pagesToSend)
{
long maxPageVersion = 0;
boolean upgraded = false;
for(int i=0;i<this.pageVersionList.size();i++)
{
if (pageVersionList.get(i) == 0 && !upgraded)
{
boolean originalLockWasReleased = this.readWriteLock.upgradeToWriteLock();
this.currentPageVersion++;
if (originalLockWasReleased)
{
pagesToSend.clear();
for(int j=0;j<i;j++)
{
maxPageVersion = markAndAddPageIfRequired(maxClientReplicatedPageVersion, pagesToSend, maxPageVersion, j);
}
}
upgraded = true;
}
maxPageVersion = markAndAddPageIfRequired(maxClientReplicatedPageVersion, pagesToSend, maxPageVersion, i);
}
return maxPageVersion;
} | [
"protected",
"long",
"scanPagesToSend",
"(",
"long",
"maxClientReplicatedPageVersion",
",",
"FastUnsafeOffHeapIntList",
"pagesToSend",
")",
"{",
"long",
"maxPageVersion",
"=",
"0",
";",
"boolean",
"upgraded",
"=",
"false",
";",
"for",
"(",
"int",
"i",
"=",
"0",
... | Method is protected for testing purposes only | [
"Method",
"is",
"protected",
"for",
"testing",
"purposes",
"only"
] | e9a069452eece7a6ef9551caf81a69d3d9a3d990 | https://github.com/goldmansachs/reladomo/blob/e9a069452eece7a6ef9551caf81a69d3d9a3d990/reladomo/src/main/java/com/gs/fw/common/mithra/cache/offheap/FastUnsafeOffHeapDataStorage.java#L1277-L1300 |
31,272 | goldmansachs/reladomo | reladomo/src/main/java/com/gs/fw/common/mithra/cache/LruQueryIndex.java | LruQueryIndex.expungeStaleEntries | private synchronized void expungeStaleEntries()
{
if (size == 0) return;
Object r;
while ((r = queue.poll()) != null)
{
Entry e = (Entry) r;
unlink(e);
int h = e.hash;
int i = indexFor(h, table.length);
Entry prev = table[i];
Entry p = prev;
while (p != null)
{
Entry next = p.next;
if (p == e)
{
if (prev == e)
table[i] = next;
else
prev.next = next;
e.next = null; // Help GC
size--;
break;
}
prev = p;
p = next;
}
}
} | java | private synchronized void expungeStaleEntries()
{
if (size == 0) return;
Object r;
while ((r = queue.poll()) != null)
{
Entry e = (Entry) r;
unlink(e);
int h = e.hash;
int i = indexFor(h, table.length);
Entry prev = table[i];
Entry p = prev;
while (p != null)
{
Entry next = p.next;
if (p == e)
{
if (prev == e)
table[i] = next;
else
prev.next = next;
e.next = null; // Help GC
size--;
break;
}
prev = p;
p = next;
}
}
} | [
"private",
"synchronized",
"void",
"expungeStaleEntries",
"(",
")",
"{",
"if",
"(",
"size",
"==",
"0",
")",
"return",
";",
"Object",
"r",
";",
"while",
"(",
"(",
"r",
"=",
"queue",
".",
"poll",
"(",
")",
")",
"!=",
"null",
")",
"{",
"Entry",
"e",
... | Expunge stale entries from the table. | [
"Expunge",
"stale",
"entries",
"from",
"the",
"table",
"."
] | e9a069452eece7a6ef9551caf81a69d3d9a3d990 | https://github.com/goldmansachs/reladomo/blob/e9a069452eece7a6ef9551caf81a69d3d9a3d990/reladomo/src/main/java/com/gs/fw/common/mithra/cache/LruQueryIndex.java#L126-L156 |
31,273 | goldmansachs/reladomo | reladomogenutil/src/main/java/com/gs/fw/common/mithra/generator/objectxmlgenerator/ForeignKey.java | ForeignKey.getReverseRelationshipName | public String getReverseRelationshipName()
{
String ret = "";
if (tableAB == null)
{
if (multipleRelationsBetweenTables) // foreignKey will be non-null since it applies only to one-to-X relation
{
ret = concatenateColumnNames(this);
ret = ret.substring(1) + "_"; // remove leading _ and add trailing _.
}
ret += StringUtility.firstLetterToLower(tableA.getClassName());
}
else
{
ForeignKey[] fks = tableAB.getForeignKeys().values().toArray(new ForeignKey[2]);
ret = ForeignKey.concatenateColumnNames(fks[0]).substring(1);
}
String multiplicity = getTableAMultiplicity();
if (!multiplicity.equals("one"))
ret = StringUtility.englishPluralize(ret);
return ret;
} | java | public String getReverseRelationshipName()
{
String ret = "";
if (tableAB == null)
{
if (multipleRelationsBetweenTables) // foreignKey will be non-null since it applies only to one-to-X relation
{
ret = concatenateColumnNames(this);
ret = ret.substring(1) + "_"; // remove leading _ and add trailing _.
}
ret += StringUtility.firstLetterToLower(tableA.getClassName());
}
else
{
ForeignKey[] fks = tableAB.getForeignKeys().values().toArray(new ForeignKey[2]);
ret = ForeignKey.concatenateColumnNames(fks[0]).substring(1);
}
String multiplicity = getTableAMultiplicity();
if (!multiplicity.equals("one"))
ret = StringUtility.englishPluralize(ret);
return ret;
} | [
"public",
"String",
"getReverseRelationshipName",
"(",
")",
"{",
"String",
"ret",
"=",
"\"\"",
";",
"if",
"(",
"tableAB",
"==",
"null",
")",
"{",
"if",
"(",
"multipleRelationsBetweenTables",
")",
"// foreignKey will be non-null since it applies only to one-to-X relation\r... | TableA as property name in TableB | [
"TableA",
"as",
"property",
"name",
"in",
"TableB"
] | e9a069452eece7a6ef9551caf81a69d3d9a3d990 | https://github.com/goldmansachs/reladomo/blob/e9a069452eece7a6ef9551caf81a69d3d9a3d990/reladomogenutil/src/main/java/com/gs/fw/common/mithra/generator/objectxmlgenerator/ForeignKey.java#L151-L174 |
31,274 | goldmansachs/reladomo | reladomogenutil/src/main/java/com/gs/fw/common/mithra/generator/objectxmlgenerator/ForeignKey.java | ForeignKey.getRelationshipName | public String getRelationshipName()
{
String ret;
if (tableAB == null /* && multipleRelationsBetweenTables */)
{
ret = concatenateColumnNames(this);
ret = ret.substring(1); // remove leading _.
}
else // Many-to-Many relationship
{
ForeignKey[] fks = tableAB.getForeignKeys().values().toArray(new ForeignKey[2]);
ret = ForeignKey.concatenateColumnNames(fks[1]).substring(1);
}
String multiplicity = getTableBMultiplicity();
if (!multiplicity.equals("one"))
ret = StringUtility.englishPluralize(ret);
return ret;
} | java | public String getRelationshipName()
{
String ret;
if (tableAB == null /* && multipleRelationsBetweenTables */)
{
ret = concatenateColumnNames(this);
ret = ret.substring(1); // remove leading _.
}
else // Many-to-Many relationship
{
ForeignKey[] fks = tableAB.getForeignKeys().values().toArray(new ForeignKey[2]);
ret = ForeignKey.concatenateColumnNames(fks[1]).substring(1);
}
String multiplicity = getTableBMultiplicity();
if (!multiplicity.equals("one"))
ret = StringUtility.englishPluralize(ret);
return ret;
} | [
"public",
"String",
"getRelationshipName",
"(",
")",
"{",
"String",
"ret",
";",
"if",
"(",
"tableAB",
"==",
"null",
"/* && multipleRelationsBetweenTables */",
")",
"{",
"ret",
"=",
"concatenateColumnNames",
"(",
"this",
")",
";",
"ret",
"=",
"ret",
".",
"subst... | TableB as property name in TableA | [
"TableB",
"as",
"property",
"name",
"in",
"TableA"
] | e9a069452eece7a6ef9551caf81a69d3d9a3d990 | https://github.com/goldmansachs/reladomo/blob/e9a069452eece7a6ef9551caf81a69d3d9a3d990/reladomogenutil/src/main/java/com/gs/fw/common/mithra/generator/objectxmlgenerator/ForeignKey.java#L177-L195 |
31,275 | goldmansachs/reladomo | reladomogenutil/src/main/java/com/gs/fw/common/mithra/generator/objectxmlgenerator/ForeignKey.java | ForeignKey.getTableAMultiplicity | public String getTableAMultiplicity()
{
String ret = "many";
List<ColumnInfo> tableAPKs = tableA.getPkList();
if (tableAPKs.size() == 0 || tableA.getTableName().equals(tableB.getTableName()))
{
return ret;
}
if (tableAB == null)
{
List<ColumnInfo> fkColumns = this.getColumns();
Set<ColumnInfo> columnSet = new HashSet<ColumnInfo>();
columnSet.addAll(fkColumns);
columnSet.removeAll(tableAPKs);
if (fkColumns.size() == tableAPKs.size() && columnSet.isEmpty())
{
ret = "one";
return ret;
}
}
for (ForeignKey tableBFK : tableB.getForeignKeys().values())
{
if (!tableBFK.getTableB().getTableName().equals(tableA.getTableName()))
continue;
List<ColumnInfo> tableBRefCols = tableBFK.getRefColumns();
Set<ColumnInfo> columns = new HashSet<ColumnInfo>();
columns.addAll(tableBRefCols);
columns.removeAll(tableAPKs);
if (columns.isEmpty())
{
ret = "one";
break;
}
}
return ret;
} | java | public String getTableAMultiplicity()
{
String ret = "many";
List<ColumnInfo> tableAPKs = tableA.getPkList();
if (tableAPKs.size() == 0 || tableA.getTableName().equals(tableB.getTableName()))
{
return ret;
}
if (tableAB == null)
{
List<ColumnInfo> fkColumns = this.getColumns();
Set<ColumnInfo> columnSet = new HashSet<ColumnInfo>();
columnSet.addAll(fkColumns);
columnSet.removeAll(tableAPKs);
if (fkColumns.size() == tableAPKs.size() && columnSet.isEmpty())
{
ret = "one";
return ret;
}
}
for (ForeignKey tableBFK : tableB.getForeignKeys().values())
{
if (!tableBFK.getTableB().getTableName().equals(tableA.getTableName()))
continue;
List<ColumnInfo> tableBRefCols = tableBFK.getRefColumns();
Set<ColumnInfo> columns = new HashSet<ColumnInfo>();
columns.addAll(tableBRefCols);
columns.removeAll(tableAPKs);
if (columns.isEmpty())
{
ret = "one";
break;
}
}
return ret;
} | [
"public",
"String",
"getTableAMultiplicity",
"(",
")",
"{",
"String",
"ret",
"=",
"\"many\"",
";",
"List",
"<",
"ColumnInfo",
">",
"tableAPKs",
"=",
"tableA",
".",
"getPkList",
"(",
")",
";",
"if",
"(",
"tableAPKs",
".",
"size",
"(",
")",
"==",
"0",
"|... | Otherwise, it is a 1-1 relationship. | [
"Otherwise",
"it",
"is",
"a",
"1",
"-",
"1",
"relationship",
"."
] | e9a069452eece7a6ef9551caf81a69d3d9a3d990 | https://github.com/goldmansachs/reladomo/blob/e9a069452eece7a6ef9551caf81a69d3d9a3d990/reladomogenutil/src/main/java/com/gs/fw/common/mithra/generator/objectxmlgenerator/ForeignKey.java#L199-L236 |
31,276 | goldmansachs/reladomo | reladomo/src/main/java/com/gs/fw/common/mithra/attribute/IntegerAttribute.java | IntegerAttribute.asSet | public MutableIntSet asSet(List<T> list, MutableIntSet setToAppend)
{
asSet(list, this, setToAppend);
return setToAppend;
} | java | public MutableIntSet asSet(List<T> list, MutableIntSet setToAppend)
{
asSet(list, this, setToAppend);
return setToAppend;
} | [
"public",
"MutableIntSet",
"asSet",
"(",
"List",
"<",
"T",
">",
"list",
",",
"MutableIntSet",
"setToAppend",
")",
"{",
"asSet",
"(",
"list",
",",
"this",
",",
"setToAppend",
")",
";",
"return",
"setToAppend",
";",
"}"
] | extracts the int values represented by this attribute from the list and adds them to the setToAppend.
If the int attribute is null, it's ignored.
@param list incoming list
@param setToAppend the set to append to | [
"extracts",
"the",
"int",
"values",
"represented",
"by",
"this",
"attribute",
"from",
"the",
"list",
"and",
"adds",
"them",
"to",
"the",
"setToAppend",
".",
"If",
"the",
"int",
"attribute",
"is",
"null",
"it",
"s",
"ignored",
"."
] | e9a069452eece7a6ef9551caf81a69d3d9a3d990 | https://github.com/goldmansachs/reladomo/blob/e9a069452eece7a6ef9551caf81a69d3d9a3d990/reladomo/src/main/java/com/gs/fw/common/mithra/attribute/IntegerAttribute.java#L135-L139 |
31,277 | goldmansachs/reladomo | reladomo/src/main/java/com/gs/fw/common/mithra/MithraManager.java | MithraManager.executeTransactionalCommandInSeparateThread | public <R> R executeTransactionalCommandInSeparateThread(final TransactionalCommand<R> command)
throws MithraBusinessException
{
return this.executeTransactionalCommandInSeparateThread(command, this.defaultTransactionStyle);
} | java | public <R> R executeTransactionalCommandInSeparateThread(final TransactionalCommand<R> command)
throws MithraBusinessException
{
return this.executeTransactionalCommandInSeparateThread(command, this.defaultTransactionStyle);
} | [
"public",
"<",
"R",
">",
"R",
"executeTransactionalCommandInSeparateThread",
"(",
"final",
"TransactionalCommand",
"<",
"R",
">",
"command",
")",
"throws",
"MithraBusinessException",
"{",
"return",
"this",
".",
"executeTransactionalCommandInSeparateThread",
"(",
"command"... | Use this method very carefully. It can easily lead to a deadlock.
executes the transactional command in a separate thread. Using a separate thread
creates a brand new transactional context and therefore this transaction will not join
the context of any outer transactions. For example, if the outer transaction rolls back, this command will not.
Calling this method will lead to deadlock if the outer transaction has locked any object that will be accessed
in this transaction. It can also lead to deadlock if the same table is accessed in the outer transaction as
this command. It can also lead to a deadlock if the connection pool is tied up in the outer transaction
and has nothing left for this command.
@param command an implementation of TransactionalCommand
@return whatever the transaction command's execute method returned.
@throws MithraBusinessException | [
"Use",
"this",
"method",
"very",
"carefully",
".",
"It",
"can",
"easily",
"lead",
"to",
"a",
"deadlock",
".",
"executes",
"the",
"transactional",
"command",
"in",
"a",
"separate",
"thread",
".",
"Using",
"a",
"separate",
"thread",
"creates",
"a",
"brand",
... | e9a069452eece7a6ef9551caf81a69d3d9a3d990 | https://github.com/goldmansachs/reladomo/blob/e9a069452eece7a6ef9551caf81a69d3d9a3d990/reladomo/src/main/java/com/gs/fw/common/mithra/MithraManager.java#L450-L454 |
31,278 | goldmansachs/reladomo | reladomo/src/main/java/com/gs/fw/common/mithra/MithraManager.java | MithraManager.executeTransactionalCommand | public <R> R executeTransactionalCommand(final TransactionalCommand<R> command, final int retryCount)
throws MithraBusinessException
{
return this.executeTransactionalCommand(command, new TransactionStyle(this.transactionTimeout, retryCount));
} | java | public <R> R executeTransactionalCommand(final TransactionalCommand<R> command, final int retryCount)
throws MithraBusinessException
{
return this.executeTransactionalCommand(command, new TransactionStyle(this.transactionTimeout, retryCount));
} | [
"public",
"<",
"R",
">",
"R",
"executeTransactionalCommand",
"(",
"final",
"TransactionalCommand",
"<",
"R",
">",
"command",
",",
"final",
"int",
"retryCount",
")",
"throws",
"MithraBusinessException",
"{",
"return",
"this",
".",
"executeTransactionalCommand",
"(",
... | executes the given transactional command with the custom number of retries
@param command
@param retryCount number of times to retry if the exception is retriable (e.g. deadlock)
@throws MithraBusinessException | [
"executes",
"the",
"given",
"transactional",
"command",
"with",
"the",
"custom",
"number",
"of",
"retries"
] | e9a069452eece7a6ef9551caf81a69d3d9a3d990 | https://github.com/goldmansachs/reladomo/blob/e9a069452eece7a6ef9551caf81a69d3d9a3d990/reladomo/src/main/java/com/gs/fw/common/mithra/MithraManager.java#L512-L516 |
31,279 | goldmansachs/reladomo | reladomo/src/main/java/com/gs/fw/common/mithra/MithraManager.java | MithraManager.executeTransactionalCommand | public <R> R executeTransactionalCommand(final TransactionalCommand<R> command, final TransactionStyle style)
throws MithraBusinessException
{
String commandName = command.getClass().getName();
MithraTransaction tx = this.getCurrentTransaction();
if (tx != null)
{
try
{
return command.executeTransaction(tx);
}
catch(RuntimeException e)
{
throw e;
}
catch (Throwable throwable)
{
getLogger().error(commandName+" rolled back tx, will not retry.", throwable);
tx.expectRollbackWithCause(throwable);
throw new MithraBusinessException(commandName+" transaction failed", throwable);
}
}
R result = null;
int retryCount = style.getRetries() + 1;
do
{
try
{
tx = this.startOrContinueTransaction(style);
tx.setTransactionName("Transactional Command: "+commandName);
result = command.executeTransaction(tx);
tx.commit();
retryCount = 0;
}
catch (Throwable throwable)
{
retryCount = MithraTransaction.handleTransactionException(tx, throwable, retryCount, style);
}
}
while(retryCount > 0);
return result;
} | java | public <R> R executeTransactionalCommand(final TransactionalCommand<R> command, final TransactionStyle style)
throws MithraBusinessException
{
String commandName = command.getClass().getName();
MithraTransaction tx = this.getCurrentTransaction();
if (tx != null)
{
try
{
return command.executeTransaction(tx);
}
catch(RuntimeException e)
{
throw e;
}
catch (Throwable throwable)
{
getLogger().error(commandName+" rolled back tx, will not retry.", throwable);
tx.expectRollbackWithCause(throwable);
throw new MithraBusinessException(commandName+" transaction failed", throwable);
}
}
R result = null;
int retryCount = style.getRetries() + 1;
do
{
try
{
tx = this.startOrContinueTransaction(style);
tx.setTransactionName("Transactional Command: "+commandName);
result = command.executeTransaction(tx);
tx.commit();
retryCount = 0;
}
catch (Throwable throwable)
{
retryCount = MithraTransaction.handleTransactionException(tx, throwable, retryCount, style);
}
}
while(retryCount > 0);
return result;
} | [
"public",
"<",
"R",
">",
"R",
"executeTransactionalCommand",
"(",
"final",
"TransactionalCommand",
"<",
"R",
">",
"command",
",",
"final",
"TransactionStyle",
"style",
")",
"throws",
"MithraBusinessException",
"{",
"String",
"commandName",
"=",
"command",
".",
"ge... | executes the given transactional command with the custom transaction style.
@param command
@param style
@throws MithraBusinessException | [
"executes",
"the",
"given",
"transactional",
"command",
"with",
"the",
"custom",
"transaction",
"style",
"."
] | e9a069452eece7a6ef9551caf81a69d3d9a3d990 | https://github.com/goldmansachs/reladomo/blob/e9a069452eece7a6ef9551caf81a69d3d9a3d990/reladomo/src/main/java/com/gs/fw/common/mithra/MithraManager.java#L524-L566 |
31,280 | goldmansachs/reladomo | reladomo/src/main/java/com/gs/fw/common/mithra/MithraManager.java | MithraManager.zLazyInitObjectsWithCallback | public void zLazyInitObjectsWithCallback(MithraRuntimeType mithraRuntimeType, MithraConfigurationManager.PostInitializeHook hook)
{
configManager.lazyInitObjectsWithCallback(mithraRuntimeType, hook);
} | java | public void zLazyInitObjectsWithCallback(MithraRuntimeType mithraRuntimeType, MithraConfigurationManager.PostInitializeHook hook)
{
configManager.lazyInitObjectsWithCallback(mithraRuntimeType, hook);
} | [
"public",
"void",
"zLazyInitObjectsWithCallback",
"(",
"MithraRuntimeType",
"mithraRuntimeType",
",",
"MithraConfigurationManager",
".",
"PostInitializeHook",
"hook",
")",
"{",
"configManager",
".",
"lazyInitObjectsWithCallback",
"(",
"mithraRuntimeType",
",",
"hook",
")",
... | only used for MithraTestResource. Do not use. use readConfiguration instead.
@param mithraRuntimeType
@param hook | [
"only",
"used",
"for",
"MithraTestResource",
".",
"Do",
"not",
"use",
".",
"use",
"readConfiguration",
"instead",
"."
] | e9a069452eece7a6ef9551caf81a69d3d9a3d990 | https://github.com/goldmansachs/reladomo/blob/e9a069452eece7a6ef9551caf81a69d3d9a3d990/reladomo/src/main/java/com/gs/fw/common/mithra/MithraManager.java#L702-L705 |
31,281 | goldmansachs/reladomo | reladomo/src/main/java/com/gs/fw/common/mithra/connectionmanager/ObjectPoolWithThreadAffinity.java | ObjectPoolWithThreadAffinity.clear | public synchronized void clear()
{
pool.forEachUntil(new DoUntilProcedure<E>()
{
public boolean execute(E object)
{
destroyObject(object);
return false;
}
});
pool.clear();
numActive = 0;
notifyAll(); // num sleeping has changed
} | java | public synchronized void clear()
{
pool.forEachUntil(new DoUntilProcedure<E>()
{
public boolean execute(E object)
{
destroyObject(object);
return false;
}
});
pool.clear();
numActive = 0;
notifyAll(); // num sleeping has changed
} | [
"public",
"synchronized",
"void",
"clear",
"(",
")",
"{",
"pool",
".",
"forEachUntil",
"(",
"new",
"DoUntilProcedure",
"<",
"E",
">",
"(",
")",
"{",
"public",
"boolean",
"execute",
"(",
"E",
"object",
")",
"{",
"destroyObject",
"(",
"object",
")",
";",
... | Clears any objects sitting idle in the pool. | [
"Clears",
"any",
"objects",
"sitting",
"idle",
"in",
"the",
"pool",
"."
] | e9a069452eece7a6ef9551caf81a69d3d9a3d990 | https://github.com/goldmansachs/reladomo/blob/e9a069452eece7a6ef9551caf81a69d3d9a3d990/reladomo/src/main/java/com/gs/fw/common/mithra/connectionmanager/ObjectPoolWithThreadAffinity.java#L719-L732 |
31,282 | goldmansachs/reladomo | reladomo/src/main/java/com/gs/fw/common/mithra/connectionmanager/ObjectPoolWithThreadAffinity.java | ObjectPoolWithThreadAffinity.evict | public void evict() throws Exception
{
assertOpen();
boolean isEmpty;
synchronized (this)
{
isEmpty = pool.isEmpty();
}
if (!isEmpty)
{
if (softMinEvictableIdleTimeMillis > 0)
{
int numToEvict = getNumIdle() - getMinIdle();
evict(System.currentTimeMillis() - softMinEvictableIdleTimeMillis, numToEvict);
}
if (minEvictableIdleTimeMillis > 0)
{
int numToEvict = getNumIdle();
evict(System.currentTimeMillis() - minEvictableIdleTimeMillis, numToEvict);
}
}
} | java | public void evict() throws Exception
{
assertOpen();
boolean isEmpty;
synchronized (this)
{
isEmpty = pool.isEmpty();
}
if (!isEmpty)
{
if (softMinEvictableIdleTimeMillis > 0)
{
int numToEvict = getNumIdle() - getMinIdle();
evict(System.currentTimeMillis() - softMinEvictableIdleTimeMillis, numToEvict);
}
if (minEvictableIdleTimeMillis > 0)
{
int numToEvict = getNumIdle();
evict(System.currentTimeMillis() - minEvictableIdleTimeMillis, numToEvict);
}
}
} | [
"public",
"void",
"evict",
"(",
")",
"throws",
"Exception",
"{",
"assertOpen",
"(",
")",
";",
"boolean",
"isEmpty",
";",
"synchronized",
"(",
"this",
")",
"{",
"isEmpty",
"=",
"pool",
".",
"isEmpty",
"(",
")",
";",
"}",
"if",
"(",
"!",
"isEmpty",
")"... | Make one pass of the idle object evictor.
@throws Exception if the pool is closed or eviction fails. | [
"Make",
"one",
"pass",
"of",
"the",
"idle",
"object",
"evictor",
"."
] | e9a069452eece7a6ef9551caf81a69d3d9a3d990 | https://github.com/goldmansachs/reladomo/blob/e9a069452eece7a6ef9551caf81a69d3d9a3d990/reladomo/src/main/java/com/gs/fw/common/mithra/connectionmanager/ObjectPoolWithThreadAffinity.java#L826-L848 |
31,283 | goldmansachs/reladomo | reladomo/src/main/java/com/gs/fw/common/mithra/cache/AbstractDatedCache.java | AbstractDatedCache.convertToBusinessObjectAndWrapInList | protected List convertToBusinessObjectAndWrapInList(Object o, Extractor[] extractors, Timestamp[] asOfDates, boolean weak, boolean isLocked)
{
if (!(o instanceof List))
{
if (o == null)
{
return ListFactory.EMPTY_LIST;
}
MithraDataObject data = (MithraDataObject) o;
this.extractTimestampsFromData(data, extractors, asOfDates);
return ListFactory.create(this.getBusinessObjectFromData(data, asOfDates, getNonDatedPkHashCode(data), weak, isLocked));
}
else
{
List result = (List) o;
boolean perData = isExtractorPerData(extractors, asOfDates);
if (!perData && MithraCpuBoundThreadPool.isParallelizable(result.size()))
{
convertToBusinessObjectsInParallel(result, asOfDates, weak);
}
else
{
for (int i = 0; i < result.size(); i++)
{
MithraDataObject data = (MithraDataObject) result.get(i);
if (perData) this.extractTimestampsFromData(data, extractors, asOfDates);
result.set(i, this.getBusinessObjectFromData(data, asOfDates, getNonDatedPkHashCode(data), weak, isLocked));
}
}
return result;
}
} | java | protected List convertToBusinessObjectAndWrapInList(Object o, Extractor[] extractors, Timestamp[] asOfDates, boolean weak, boolean isLocked)
{
if (!(o instanceof List))
{
if (o == null)
{
return ListFactory.EMPTY_LIST;
}
MithraDataObject data = (MithraDataObject) o;
this.extractTimestampsFromData(data, extractors, asOfDates);
return ListFactory.create(this.getBusinessObjectFromData(data, asOfDates, getNonDatedPkHashCode(data), weak, isLocked));
}
else
{
List result = (List) o;
boolean perData = isExtractorPerData(extractors, asOfDates);
if (!perData && MithraCpuBoundThreadPool.isParallelizable(result.size()))
{
convertToBusinessObjectsInParallel(result, asOfDates, weak);
}
else
{
for (int i = 0; i < result.size(); i++)
{
MithraDataObject data = (MithraDataObject) result.get(i);
if (perData) this.extractTimestampsFromData(data, extractors, asOfDates);
result.set(i, this.getBusinessObjectFromData(data, asOfDates, getNonDatedPkHashCode(data), weak, isLocked));
}
}
return result;
}
} | [
"protected",
"List",
"convertToBusinessObjectAndWrapInList",
"(",
"Object",
"o",
",",
"Extractor",
"[",
"]",
"extractors",
",",
"Timestamp",
"[",
"]",
"asOfDates",
",",
"boolean",
"weak",
",",
"boolean",
"isLocked",
")",
"{",
"if",
"(",
"!",
"(",
"o",
"insta... | if o is a list, we do the conversion in place | [
"if",
"o",
"is",
"a",
"list",
"we",
"do",
"the",
"conversion",
"in",
"place"
] | e9a069452eece7a6ef9551caf81a69d3d9a3d990 | https://github.com/goldmansachs/reladomo/blob/e9a069452eece7a6ef9551caf81a69d3d9a3d990/reladomo/src/main/java/com/gs/fw/common/mithra/cache/AbstractDatedCache.java#L1747-L1778 |
31,284 | goldmansachs/reladomo | reladomo/src/main/java/com/gs/fw/common/mithra/util/TimestampPool.java | TimestampPool.getOrAddToCache | public Timestamp getOrAddToCache(Timestamp newValue, boolean hard)
{
if (newValue == null || newValue instanceof CachedImmutableTimestamp || newValue == NullDataTimestamp.getInstance())
{
return newValue;
}
return (Timestamp) weakPool.getIfAbsentPut(newValue, hard);
} | java | public Timestamp getOrAddToCache(Timestamp newValue, boolean hard)
{
if (newValue == null || newValue instanceof CachedImmutableTimestamp || newValue == NullDataTimestamp.getInstance())
{
return newValue;
}
return (Timestamp) weakPool.getIfAbsentPut(newValue, hard);
} | [
"public",
"Timestamp",
"getOrAddToCache",
"(",
"Timestamp",
"newValue",
",",
"boolean",
"hard",
")",
"{",
"if",
"(",
"newValue",
"==",
"null",
"||",
"newValue",
"instanceof",
"CachedImmutableTimestamp",
"||",
"newValue",
"==",
"NullDataTimestamp",
".",
"getInstance"... | return the pooled value
@param newValue the value to look up in the pool and add if not there
@return the pooled value | [
"return",
"the",
"pooled",
"value"
] | e9a069452eece7a6ef9551caf81a69d3d9a3d990 | https://github.com/goldmansachs/reladomo/blob/e9a069452eece7a6ef9551caf81a69d3d9a3d990/reladomo/src/main/java/com/gs/fw/common/mithra/util/TimestampPool.java#L59-L66 |
31,285 | goldmansachs/reladomo | reladomo/src/main/java/com/gs/fw/common/mithra/cache/PartialPrimaryKeyIndex.java | PartialPrimaryKeyIndex.clear | public void clear()
{
// clear out ref queue. We don't need to expunge entries
// since gc'ed entries won't get copied.
emptyReferenceQueue();
for (int i = 0; i < table.length; i++)
{
Entry e = table[i];
Entry first = null;
Entry prev = null;
while (e != null)
{
Object candidate = e.get();
if (candidate != null)
{
Entry dirty = e.makeDirtyAndWeak(queue);
if (first == null)
{
first = dirty;
}
if (prev != null)
{
prev.setNext(dirty);
}
prev = dirty;
}
else
{
if (prev != null)
{
prev.setNext(e.getState().next);
}
size--;
}
e = e.getState().next;
}
table[i] = first;
}
// Allocation of array may have caused GC, which may have caused
// additional entries to go stale. Removing these entries from the
// reference queue will make them eligible for reclamation.
expungeStaleEntries();
} | java | public void clear()
{
// clear out ref queue. We don't need to expunge entries
// since gc'ed entries won't get copied.
emptyReferenceQueue();
for (int i = 0; i < table.length; i++)
{
Entry e = table[i];
Entry first = null;
Entry prev = null;
while (e != null)
{
Object candidate = e.get();
if (candidate != null)
{
Entry dirty = e.makeDirtyAndWeak(queue);
if (first == null)
{
first = dirty;
}
if (prev != null)
{
prev.setNext(dirty);
}
prev = dirty;
}
else
{
if (prev != null)
{
prev.setNext(e.getState().next);
}
size--;
}
e = e.getState().next;
}
table[i] = first;
}
// Allocation of array may have caused GC, which may have caused
// additional entries to go stale. Removing these entries from the
// reference queue will make them eligible for reclamation.
expungeStaleEntries();
} | [
"public",
"void",
"clear",
"(",
")",
"{",
"// clear out ref queue. We don't need to expunge entries\r",
"// since gc'ed entries won't get copied.\r",
"emptyReferenceQueue",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"table",
".",
"length",
";",
... | we don't actually clear anything, just make things weak and dirty | [
"we",
"don",
"t",
"actually",
"clear",
"anything",
"just",
"make",
"things",
"weak",
"and",
"dirty"
] | e9a069452eece7a6ef9551caf81a69d3d9a3d990 | https://github.com/goldmansachs/reladomo/blob/e9a069452eece7a6ef9551caf81a69d3d9a3d990/reladomo/src/main/java/com/gs/fw/common/mithra/cache/PartialPrimaryKeyIndex.java#L889-L933 |
31,286 | goldmansachs/reladomo | reladomo/src/main/java/com/gs/fw/common/mithra/notification/MithraNotificationEventManagerImpl.java | MithraNotificationEventManagerImpl.addMithraNotificationEventForUpdate | public void addMithraNotificationEventForUpdate(String databaseIdentifier, String classname, byte databaseOperation,
MithraDataObject mithraDataObject, List updateWrappers,
Object sourceAttribute)
{
MithraDataObject[] dataObjects = new MithraDataObject[1];
dataObjects[0] = mithraDataObject;
createAndAddNotificationEvent(databaseIdentifier, classname, databaseOperation, dataObjects, updateWrappers, null, sourceAttribute);
} | java | public void addMithraNotificationEventForUpdate(String databaseIdentifier, String classname, byte databaseOperation,
MithraDataObject mithraDataObject, List updateWrappers,
Object sourceAttribute)
{
MithraDataObject[] dataObjects = new MithraDataObject[1];
dataObjects[0] = mithraDataObject;
createAndAddNotificationEvent(databaseIdentifier, classname, databaseOperation, dataObjects, updateWrappers, null, sourceAttribute);
} | [
"public",
"void",
"addMithraNotificationEventForUpdate",
"(",
"String",
"databaseIdentifier",
",",
"String",
"classname",
",",
"byte",
"databaseOperation",
",",
"MithraDataObject",
"mithraDataObject",
",",
"List",
"updateWrappers",
",",
"Object",
"sourceAttribute",
")",
"... | This is called from single insert, update or delete. | [
"This",
"is",
"called",
"from",
"single",
"insert",
"update",
"or",
"delete",
"."
] | e9a069452eece7a6ef9551caf81a69d3d9a3d990 | https://github.com/goldmansachs/reladomo/blob/e9a069452eece7a6ef9551caf81a69d3d9a3d990/reladomo/src/main/java/com/gs/fw/common/mithra/notification/MithraNotificationEventManagerImpl.java#L360-L367 |
31,287 | goldmansachs/reladomo | reladomo/src/main/java/com/gs/fw/common/mithra/notification/MithraNotificationEventManagerImpl.java | MithraNotificationEventManagerImpl.getRegistrationEntryList | private RegistrationEntryList getRegistrationEntryList(String subject, RelatedFinder finder)
{
RegistrationEntryList registrationEntryList;
RegistrationKey key = new RegistrationKey(subject, finder.getFinderClassName());
if (logger.isDebugEnabled())
{
logger.debug("**************Adding application notification registration with key: " + key.toString());
}
registrationEntryList = mithraApplicationNotificationSubscriber.get(key);
if (registrationEntryList == null)
{
registrationEntryList = new RegistrationEntryList();
mithraApplicationNotificationSubscriber.put(key, registrationEntryList);
}
return registrationEntryList;
} | java | private RegistrationEntryList getRegistrationEntryList(String subject, RelatedFinder finder)
{
RegistrationEntryList registrationEntryList;
RegistrationKey key = new RegistrationKey(subject, finder.getFinderClassName());
if (logger.isDebugEnabled())
{
logger.debug("**************Adding application notification registration with key: " + key.toString());
}
registrationEntryList = mithraApplicationNotificationSubscriber.get(key);
if (registrationEntryList == null)
{
registrationEntryList = new RegistrationEntryList();
mithraApplicationNotificationSubscriber.put(key, registrationEntryList);
}
return registrationEntryList;
} | [
"private",
"RegistrationEntryList",
"getRegistrationEntryList",
"(",
"String",
"subject",
",",
"RelatedFinder",
"finder",
")",
"{",
"RegistrationEntryList",
"registrationEntryList",
";",
"RegistrationKey",
"key",
"=",
"new",
"RegistrationKey",
"(",
"subject",
",",
"finder... | Must only be called from the thread which is used for registration | [
"Must",
"only",
"be",
"called",
"from",
"the",
"thread",
"which",
"is",
"used",
"for",
"registration"
] | e9a069452eece7a6ef9551caf81a69d3d9a3d990 | https://github.com/goldmansachs/reladomo/blob/e9a069452eece7a6ef9551caf81a69d3d9a3d990/reladomo/src/main/java/com/gs/fw/common/mithra/notification/MithraNotificationEventManagerImpl.java#L486-L501 |
31,288 | goldmansachs/reladomo | reladomo/src/main/java/com/gs/fw/common/mithra/connectionmanager/MithraPoolableConnectionFactory.java | MithraPoolableConnectionFactory.makeObject | @Override
public Connection makeObject(ObjectPoolWithThreadAffinity<Connection> pool) throws Exception
{
Connection conn = connectionFactory.createConnection();
return new PooledConnection(conn, pool, this.statementsToPool);
} | java | @Override
public Connection makeObject(ObjectPoolWithThreadAffinity<Connection> pool) throws Exception
{
Connection conn = connectionFactory.createConnection();
return new PooledConnection(conn, pool, this.statementsToPool);
} | [
"@",
"Override",
"public",
"Connection",
"makeObject",
"(",
"ObjectPoolWithThreadAffinity",
"<",
"Connection",
">",
"pool",
")",
"throws",
"Exception",
"{",
"Connection",
"conn",
"=",
"connectionFactory",
".",
"createConnection",
"(",
")",
";",
"return",
"new",
"P... | overriding to remove synchronized. We never mutate any state that affects this method | [
"overriding",
"to",
"remove",
"synchronized",
".",
"We",
"never",
"mutate",
"any",
"state",
"that",
"affects",
"this",
"method"
] | e9a069452eece7a6ef9551caf81a69d3d9a3d990 | https://github.com/goldmansachs/reladomo/blob/e9a069452eece7a6ef9551caf81a69d3d9a3d990/reladomo/src/main/java/com/gs/fw/common/mithra/connectionmanager/MithraPoolableConnectionFactory.java#L41-L46 |
31,289 | goldmansachs/reladomo | reladomo/src/main/java/com/gs/fw/common/mithra/connectionmanager/AbstractConnectionManager.java | AbstractConnectionManager.initialisePool | public void initialisePool()
{
Properties loginProperties = createLoginProperties();
if (logger.isDebugEnabled())
{
logger.debug("about to create pool with user-id : " + this.getJdbcUser());
}
ConnectionFactory connectionFactory = createConnectionFactory(loginProperties);
PoolableObjectFactory objectFactoryForConnectionPool = getObjectFactoryForConnectionPool(connectionFactory, connectionPool);
connectionPool = new ObjectPoolWithThreadAffinity(objectFactoryForConnectionPool, this.getPoolSize(),
this.getMaxWait(), this.getPoolSize(), this.getInitialSize(), true, false, this.timeBetweenEvictionRunsMillis,
this.minEvictableIdleTimeMillis, this.softMinEvictableIdleTimeMillis);
dataSource = createPoolingDataSource(connectionPool);
if (this.getInitialSize() > 0)
{
try // test connection
{
this.getConnection().close();
}
catch (Exception e)
{
logger.error("Error initializing pool " + this, e);
}
}
} | java | public void initialisePool()
{
Properties loginProperties = createLoginProperties();
if (logger.isDebugEnabled())
{
logger.debug("about to create pool with user-id : " + this.getJdbcUser());
}
ConnectionFactory connectionFactory = createConnectionFactory(loginProperties);
PoolableObjectFactory objectFactoryForConnectionPool = getObjectFactoryForConnectionPool(connectionFactory, connectionPool);
connectionPool = new ObjectPoolWithThreadAffinity(objectFactoryForConnectionPool, this.getPoolSize(),
this.getMaxWait(), this.getPoolSize(), this.getInitialSize(), true, false, this.timeBetweenEvictionRunsMillis,
this.minEvictableIdleTimeMillis, this.softMinEvictableIdleTimeMillis);
dataSource = createPoolingDataSource(connectionPool);
if (this.getInitialSize() > 0)
{
try // test connection
{
this.getConnection().close();
}
catch (Exception e)
{
logger.error("Error initializing pool " + this, e);
}
}
} | [
"public",
"void",
"initialisePool",
"(",
")",
"{",
"Properties",
"loginProperties",
"=",
"createLoginProperties",
"(",
")",
";",
"if",
"(",
"logger",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"logger",
".",
"debug",
"(",
"\"about to create pool with user-id : \""... | This method must be called after all the connection pool properties have been set. | [
"This",
"method",
"must",
"be",
"called",
"after",
"all",
"the",
"connection",
"pool",
"properties",
"have",
"been",
"set",
"."
] | e9a069452eece7a6ef9551caf81a69d3d9a3d990 | https://github.com/goldmansachs/reladomo/blob/e9a069452eece7a6ef9551caf81a69d3d9a3d990/reladomo/src/main/java/com/gs/fw/common/mithra/connectionmanager/AbstractConnectionManager.java#L107-L136 |
31,290 | goldmansachs/reladomo | reladomo/src/main/java/com/gs/fw/common/mithra/connectionmanager/AbstractConnectionManager.java | AbstractConnectionManager.setDriverClassName | public void setDriverClassName(String driver)
{
try
{
this.driver = (Driver) Class.forName(driver).newInstance();
}
catch (Exception e)
{
throw new RuntimeException("Unable to load driver: " + driver, e);
}
} | java | public void setDriverClassName(String driver)
{
try
{
this.driver = (Driver) Class.forName(driver).newInstance();
}
catch (Exception e)
{
throw new RuntimeException("Unable to load driver: " + driver, e);
}
} | [
"public",
"void",
"setDriverClassName",
"(",
"String",
"driver",
")",
"{",
"try",
"{",
"this",
".",
"driver",
"=",
"(",
"Driver",
")",
"Class",
".",
"forName",
"(",
"driver",
")",
".",
"newInstance",
"(",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
... | sets the driver class name. This is used in conjunction with the JDBC connection string
@param driver the driver class name, for example "com.sybase.jdbc4.jdbc.SybDriver" | [
"sets",
"the",
"driver",
"class",
"name",
".",
"This",
"is",
"used",
"in",
"conjunction",
"with",
"the",
"JDBC",
"connection",
"string"
] | e9a069452eece7a6ef9551caf81a69d3d9a3d990 | https://github.com/goldmansachs/reladomo/blob/e9a069452eece7a6ef9551caf81a69d3d9a3d990/reladomo/src/main/java/com/gs/fw/common/mithra/connectionmanager/AbstractConnectionManager.java#L434-L444 |
31,291 | goldmansachs/reladomo | reladomo/src/main/java/com/gs/fw/common/mithra/util/SingleQueueExecutor.java | SingleQueueExecutor.setMaxRetriesBeforeRequeue | public void setMaxRetriesBeforeRequeue(int maxRetriesBeforeRequeue)
{
this.maxRetriesBeforeRequeue = maxRetriesBeforeRequeue;
this.transactionStyle = new TransactionStyle(MithraManagerProvider.getMithraManager().getTransactionTimeout(), maxRetriesBeforeRequeue, this.retryOnTimeout);
} | java | public void setMaxRetriesBeforeRequeue(int maxRetriesBeforeRequeue)
{
this.maxRetriesBeforeRequeue = maxRetriesBeforeRequeue;
this.transactionStyle = new TransactionStyle(MithraManagerProvider.getMithraManager().getTransactionTimeout(), maxRetriesBeforeRequeue, this.retryOnTimeout);
} | [
"public",
"void",
"setMaxRetriesBeforeRequeue",
"(",
"int",
"maxRetriesBeforeRequeue",
")",
"{",
"this",
".",
"maxRetriesBeforeRequeue",
"=",
"maxRetriesBeforeRequeue",
";",
"this",
".",
"transactionStyle",
"=",
"new",
"TransactionStyle",
"(",
"MithraManagerProvider",
"."... | default value is 3.
@param maxRetriesBeforeRequeue the number of retries before the particular chunk of work is requeued at the end
of the queue | [
"default",
"value",
"is",
"3",
"."
] | e9a069452eece7a6ef9551caf81a69d3d9a3d990 | https://github.com/goldmansachs/reladomo/blob/e9a069452eece7a6ef9551caf81a69d3d9a3d990/reladomo/src/main/java/com/gs/fw/common/mithra/util/SingleQueueExecutor.java#L208-L212 |
31,292 | goldmansachs/reladomo | reladomo/src/main/java/com/gs/fw/common/mithra/AggregateList.java | AggregateList.validateOrderByAttribute | private void validateOrderByAttribute(String attributeName)
{
if ((!nameToAggregateAttributeMap.containsKey(attributeName)) && (!nameToGroupByAttributeMap.containsKey(attributeName)))
{
throw new MithraBusinessException("Aggregate list cannot be order by attribute with name: " + attributeName + ".\n" +
"An AggregateList can only be ordered by an attribute which is either a AggregateAttribute or a GroupByAttribute");
}
} | java | private void validateOrderByAttribute(String attributeName)
{
if ((!nameToAggregateAttributeMap.containsKey(attributeName)) && (!nameToGroupByAttributeMap.containsKey(attributeName)))
{
throw new MithraBusinessException("Aggregate list cannot be order by attribute with name: " + attributeName + ".\n" +
"An AggregateList can only be ordered by an attribute which is either a AggregateAttribute or a GroupByAttribute");
}
} | [
"private",
"void",
"validateOrderByAttribute",
"(",
"String",
"attributeName",
")",
"{",
"if",
"(",
"(",
"!",
"nameToAggregateAttributeMap",
".",
"containsKey",
"(",
"attributeName",
")",
")",
"&&",
"(",
"!",
"nameToGroupByAttributeMap",
".",
"containsKey",
"(",
"... | The attribute to group by should be either a aggregate attribute or a group by attribute.
@param attributeName | [
"The",
"attribute",
"to",
"group",
"by",
"should",
"be",
"either",
"a",
"aggregate",
"attribute",
"or",
"a",
"group",
"by",
"attribute",
"."
] | e9a069452eece7a6ef9551caf81a69d3d9a3d990 | https://github.com/goldmansachs/reladomo/blob/e9a069452eece7a6ef9551caf81a69d3d9a3d990/reladomo/src/main/java/com/gs/fw/common/mithra/AggregateList.java#L302-L311 |
31,293 | goldmansachs/reladomo | reladomo/src/main/java/com/gs/fw/common/mithra/util/MithraConfigurationManager.java | MithraConfigurationManager.parseConfiguration | public MithraRuntimeType parseConfiguration(InputStream mithraFileIs)
{
if(mithraFileIs == null)
{
throw new MithraBusinessException("Could not parse Mithra configuration, because the input stream is null.");
}
try
{
MithraRuntimeUnmarshaller unmarshaller = new MithraRuntimeUnmarshaller();
unmarshaller.setValidateAttributes(false);
return unmarshaller.parse(mithraFileIs, "");
}
catch (IOException e)
{
throw new MithraBusinessException("unable to parse ",e);
}
finally
{
try
{
mithraFileIs.close();
}
catch (IOException e)
{
getLogger().error("Could not close Mithra XML input stream", e);
}
}
} | java | public MithraRuntimeType parseConfiguration(InputStream mithraFileIs)
{
if(mithraFileIs == null)
{
throw new MithraBusinessException("Could not parse Mithra configuration, because the input stream is null.");
}
try
{
MithraRuntimeUnmarshaller unmarshaller = new MithraRuntimeUnmarshaller();
unmarshaller.setValidateAttributes(false);
return unmarshaller.parse(mithraFileIs, "");
}
catch (IOException e)
{
throw new MithraBusinessException("unable to parse ",e);
}
finally
{
try
{
mithraFileIs.close();
}
catch (IOException e)
{
getLogger().error("Could not close Mithra XML input stream", e);
}
}
} | [
"public",
"MithraRuntimeType",
"parseConfiguration",
"(",
"InputStream",
"mithraFileIs",
")",
"{",
"if",
"(",
"mithraFileIs",
"==",
"null",
")",
"{",
"throw",
"new",
"MithraBusinessException",
"(",
"\"Could not parse Mithra configuration, because the input stream is null.\"",
... | Parses the configuration file. Should only be called by MithraTestResource. Use readConfiguration to parse
and initialize the configuration.
@param mithraFileIs input stream containing the runtime configuration.
@return the parsed configuration | [
"Parses",
"the",
"configuration",
"file",
".",
"Should",
"only",
"be",
"called",
"by",
"MithraTestResource",
".",
"Use",
"readConfiguration",
"to",
"parse",
"and",
"initialize",
"the",
"configuration",
"."
] | e9a069452eece7a6ef9551caf81a69d3d9a3d990 | https://github.com/goldmansachs/reladomo/blob/e9a069452eece7a6ef9551caf81a69d3d9a3d990/reladomo/src/main/java/com/gs/fw/common/mithra/util/MithraConfigurationManager.java#L1101-L1128 |
31,294 | goldmansachs/reladomo | reladomo/src/main/java/com/gs/fw/common/mithra/cache/PartialSemiUniqueDatedIndex.java | PartialSemiUniqueDatedIndex.expungeStaleEntries | private synchronized boolean expungeStaleEntries()
{
if (this.size == 0) return false;
Object r;
boolean result = false;
while ( (r = queue.poll()) != null)
{
result = true;
SingleEntry e = (SingleEntry)r;
this.size -= e.cleanupPkTable(this.table);
this.nonDatedEntryCount -= e.cleanupSemiUniqueTable(this.nonDatedTable);
}
return result;
} | java | private synchronized boolean expungeStaleEntries()
{
if (this.size == 0) return false;
Object r;
boolean result = false;
while ( (r = queue.poll()) != null)
{
result = true;
SingleEntry e = (SingleEntry)r;
this.size -= e.cleanupPkTable(this.table);
this.nonDatedEntryCount -= e.cleanupSemiUniqueTable(this.nonDatedTable);
}
return result;
} | [
"private",
"synchronized",
"boolean",
"expungeStaleEntries",
"(",
")",
"{",
"if",
"(",
"this",
".",
"size",
"==",
"0",
")",
"return",
"false",
";",
"Object",
"r",
";",
"boolean",
"result",
"=",
"false",
";",
"while",
"(",
"(",
"r",
"=",
"queue",
".",
... | Expunge stale entries from the nonDatedTable. | [
"Expunge",
"stale",
"entries",
"from",
"the",
"nonDatedTable",
"."
] | e9a069452eece7a6ef9551caf81a69d3d9a3d990 | https://github.com/goldmansachs/reladomo/blob/e9a069452eece7a6ef9551caf81a69d3d9a3d990/reladomo/src/main/java/com/gs/fw/common/mithra/cache/PartialSemiUniqueDatedIndex.java#L295-L308 |
31,295 | goldmansachs/reladomo | reladomo/src/main/java/com/gs/fw/common/mithra/cache/PartialSemiUniqueDatedIndex.java | PartialSemiUniqueDatedIndex.resizeSemiUnique | private void resizeSemiUnique(int newCapacity)
{
SemiUniqueEntry[] oldTable = getNonDatedTable();
int oldCapacity = oldTable.length;
if (oldCapacity == MAXIMUM_CAPACITY) {
semiUniqueThreshold = Integer.MAX_VALUE;
return;
}
SemiUniqueEntry[] newTable = new SemiUniqueEntry[newCapacity];
transferSemiUnique(oldTable, newTable);
nonDatedTable = newTable;
/*
* If ignoring null elements and processing ref queue caused massive
* shrinkage, then restore old nonDatedTable. This should be rare, but avoids
* unbounded expansion of garbage-filled tables.
*/
if (nonDatedEntryCount >= semiUniqueThreshold / 2) {
semiUniqueThreshold = (int)(newCapacity * loadFactor);
} else {
expungeStaleEntries();
transferSemiUnique(newTable, oldTable);
nonDatedTable = oldTable;
}
} | java | private void resizeSemiUnique(int newCapacity)
{
SemiUniqueEntry[] oldTable = getNonDatedTable();
int oldCapacity = oldTable.length;
if (oldCapacity == MAXIMUM_CAPACITY) {
semiUniqueThreshold = Integer.MAX_VALUE;
return;
}
SemiUniqueEntry[] newTable = new SemiUniqueEntry[newCapacity];
transferSemiUnique(oldTable, newTable);
nonDatedTable = newTable;
/*
* If ignoring null elements and processing ref queue caused massive
* shrinkage, then restore old nonDatedTable. This should be rare, but avoids
* unbounded expansion of garbage-filled tables.
*/
if (nonDatedEntryCount >= semiUniqueThreshold / 2) {
semiUniqueThreshold = (int)(newCapacity * loadFactor);
} else {
expungeStaleEntries();
transferSemiUnique(newTable, oldTable);
nonDatedTable = oldTable;
}
} | [
"private",
"void",
"resizeSemiUnique",
"(",
"int",
"newCapacity",
")",
"{",
"SemiUniqueEntry",
"[",
"]",
"oldTable",
"=",
"getNonDatedTable",
"(",
")",
";",
"int",
"oldCapacity",
"=",
"oldTable",
".",
"length",
";",
"if",
"(",
"oldCapacity",
"==",
"MAXIMUM_CAP... | Rehashes the contents of this map into a new array with a
larger capacity. This method is called automatically when the
number of keys in this map reaches its semiUniqueThreshold.
If current capacity is MAXIMUM_CAPACITY, this method does not
resize the map, but but sets semiUniqueThreshold to Integer.MAX_VALUE.
This has the effect of preventing future calls.
@param newCapacity the new capacity, MUST be a power of two;
must be greater than current capacity unless current
capacity is MAXIMUM_CAPACITY (in which case value
is irrelevant). | [
"Rehashes",
"the",
"contents",
"of",
"this",
"map",
"into",
"a",
"new",
"array",
"with",
"a",
"larger",
"capacity",
".",
"This",
"method",
"is",
"called",
"automatically",
"when",
"the",
"number",
"of",
"keys",
"in",
"this",
"map",
"reaches",
"its",
"semiU... | e9a069452eece7a6ef9551caf81a69d3d9a3d990 | https://github.com/goldmansachs/reladomo/blob/e9a069452eece7a6ef9551caf81a69d3d9a3d990/reladomo/src/main/java/com/gs/fw/common/mithra/cache/PartialSemiUniqueDatedIndex.java#L1045-L1070 |
31,296 | goldmansachs/reladomo | reladomo/src/main/java/com/gs/fw/common/mithra/cache/ConcurrentFullUniqueIndex.java | ConcurrentFullUniqueIndex.resize | private void resize(Object[] oldTable, int newSize)
{
int oldCapacity = oldTable.length;
int end = oldCapacity - 1;
Object last = arrayAt(oldTable, end);
if (this.size() < ((end*3) >> 2) && last == RESIZE_SENTINEL)
{
return;
}
if (oldCapacity >= MAXIMUM_CAPACITY)
{
throw new RuntimeException("max capacity of map exceeded");
}
ResizeContainer resizeContainer = null;
boolean ownResize = false;
if (last == null || last == RESIZE_SENTINEL)
{
synchronized (oldTable) // allocating a new array is too expensive to make this an atomic operation
{
if (arrayAt(oldTable, end) == null)
{
setArrayAt(oldTable, end, RESIZE_SENTINEL);
resizeContainer = new ResizeContainer(allocateTable(newSize), oldTable.length - 2);
setArrayAt(oldTable, end, resizeContainer);
ownResize = true;
}
}
}
if (ownResize)
{
this.transfer(oldTable, resizeContainer);
Object[] src = this.table;
while (!TABLE_UPDATER.compareAndSet(this, oldTable, resizeContainer.nextArray))
{
// we're in a double resize situation; we'll have to go help until it's our turn to set the table
if (src != oldTable)
{
this.helpWithResize(src);
}
}
}
else
{
this.helpWithResize(oldTable);
}
} | java | private void resize(Object[] oldTable, int newSize)
{
int oldCapacity = oldTable.length;
int end = oldCapacity - 1;
Object last = arrayAt(oldTable, end);
if (this.size() < ((end*3) >> 2) && last == RESIZE_SENTINEL)
{
return;
}
if (oldCapacity >= MAXIMUM_CAPACITY)
{
throw new RuntimeException("max capacity of map exceeded");
}
ResizeContainer resizeContainer = null;
boolean ownResize = false;
if (last == null || last == RESIZE_SENTINEL)
{
synchronized (oldTable) // allocating a new array is too expensive to make this an atomic operation
{
if (arrayAt(oldTable, end) == null)
{
setArrayAt(oldTable, end, RESIZE_SENTINEL);
resizeContainer = new ResizeContainer(allocateTable(newSize), oldTable.length - 2);
setArrayAt(oldTable, end, resizeContainer);
ownResize = true;
}
}
}
if (ownResize)
{
this.transfer(oldTable, resizeContainer);
Object[] src = this.table;
while (!TABLE_UPDATER.compareAndSet(this, oldTable, resizeContainer.nextArray))
{
// we're in a double resize situation; we'll have to go help until it's our turn to set the table
if (src != oldTable)
{
this.helpWithResize(src);
}
}
}
else
{
this.helpWithResize(oldTable);
}
} | [
"private",
"void",
"resize",
"(",
"Object",
"[",
"]",
"oldTable",
",",
"int",
"newSize",
")",
"{",
"int",
"oldCapacity",
"=",
"oldTable",
".",
"length",
";",
"int",
"end",
"=",
"oldCapacity",
"-",
"1",
";",
"Object",
"last",
"=",
"arrayAt",
"(",
"oldTa... | newSize must be a power of 2 + 1 | [
"newSize",
"must",
"be",
"a",
"power",
"of",
"2",
"+",
"1"
] | e9a069452eece7a6ef9551caf81a69d3d9a3d990 | https://github.com/goldmansachs/reladomo/blob/e9a069452eece7a6ef9551caf81a69d3d9a3d990/reladomo/src/main/java/com/gs/fw/common/mithra/cache/ConcurrentFullUniqueIndex.java#L472-L518 |
31,297 | goldmansachs/reladomo | reladomo/src/main/java/com/gs/fw/common/mithra/cache/ConcurrentFullUniqueIndex.java | ConcurrentFullUniqueIndex.forAllInParallel | public void forAllInParallel(final ParallelProcedure procedure)
{
MithraCpuBoundThreadPool pool = MithraCpuBoundThreadPool.getInstance();
final Object[] set = this.table;
ThreadChunkSize threadChunkSize = new ThreadChunkSize(pool.getThreads(), set.length - 2, 1);
final ArrayBasedQueue queue =new ArrayBasedQueue(set.length - 2, threadChunkSize.getChunkSize());
int threads = threadChunkSize.getThreads();
procedure.setThreads(threads, this.size() /threads);
CpuBoundTask[] tasks = new CpuBoundTask[threads];
for(int i=0;i<threads;i++)
{
final int thread = i;
tasks[i] = new CpuBoundTask()
{
@Override
public void execute()
{
ArrayBasedQueue.Segment segment = queue.borrow(null);
while(segment != null)
{
for (int i = segment.getStart(); i < segment.getEnd(); i++)
{
Object e = arrayAt(set, i);
if (e != null)
{
procedure.execute(e, thread);
}
}
segment = queue.borrow(segment);
}
}
};
}
new FixedCountTaskFactory(tasks).startAndWorkUntilFinished();
} | java | public void forAllInParallel(final ParallelProcedure procedure)
{
MithraCpuBoundThreadPool pool = MithraCpuBoundThreadPool.getInstance();
final Object[] set = this.table;
ThreadChunkSize threadChunkSize = new ThreadChunkSize(pool.getThreads(), set.length - 2, 1);
final ArrayBasedQueue queue =new ArrayBasedQueue(set.length - 2, threadChunkSize.getChunkSize());
int threads = threadChunkSize.getThreads();
procedure.setThreads(threads, this.size() /threads);
CpuBoundTask[] tasks = new CpuBoundTask[threads];
for(int i=0;i<threads;i++)
{
final int thread = i;
tasks[i] = new CpuBoundTask()
{
@Override
public void execute()
{
ArrayBasedQueue.Segment segment = queue.borrow(null);
while(segment != null)
{
for (int i = segment.getStart(); i < segment.getEnd(); i++)
{
Object e = arrayAt(set, i);
if (e != null)
{
procedure.execute(e, thread);
}
}
segment = queue.borrow(segment);
}
}
};
}
new FixedCountTaskFactory(tasks).startAndWorkUntilFinished();
} | [
"public",
"void",
"forAllInParallel",
"(",
"final",
"ParallelProcedure",
"procedure",
")",
"{",
"MithraCpuBoundThreadPool",
"pool",
"=",
"MithraCpuBoundThreadPool",
".",
"getInstance",
"(",
")",
";",
"final",
"Object",
"[",
"]",
"set",
"=",
"this",
".",
"table",
... | does not allow concurrent iteration with additions to the index | [
"does",
"not",
"allow",
"concurrent",
"iteration",
"with",
"additions",
"to",
"the",
"index"
] | e9a069452eece7a6ef9551caf81a69d3d9a3d990 | https://github.com/goldmansachs/reladomo/blob/e9a069452eece7a6ef9551caf81a69d3d9a3d990/reladomo/src/main/java/com/gs/fw/common/mithra/cache/ConcurrentFullUniqueIndex.java#L839-L873 |
31,298 | goldmansachs/reladomo | reladomo/src/main/java/com/gs/fw/common/mithra/cacheloader/DependentLoadingTaskSpawner.java | DependentLoadingTaskSpawner.createDependentKeyIndex | public DependentKeyIndex createDependentKeyIndex(CacheLoaderEngine cacheLoaderEngine, Extractor[] keyExtractors, Operation ownerObjectFilter)
{
DependentKeyIndex dependentKeyIndex = null;
for (DependentKeyIndex each : this.dependentKeyIndexes)
{
if (Arrays.equals(each.getKeyExtractors(), keyExtractors))
{
dependentKeyIndex = each;
break;
}
}
if (dependentKeyIndex == null)
{
dependentKeyIndex = (keyExtractors.length > 1)
? new DependentTupleKeyIndex(cacheLoaderEngine, this, keyExtractors)
: new DependentSingleKeyIndex(cacheLoaderEngine, this, keyExtractors);
dependentKeyIndex.setOwnerObjectFilter(ownerObjectFilter);
final LoadingTaskThreadPoolHolder threadPoolHolder = cacheLoaderEngine.getOrCreateThreadPool(this.getThreadPoolName());
dependentKeyIndex.setLoadingTaskThreadPoolHolder(threadPoolHolder);
threadPoolHolder.addDependentKeyIndex(dependentKeyIndex);
this.dependentKeyIndexes.add(dependentKeyIndex);
}
else
{
dependentKeyIndex.orOwnerObjectFilter(ownerObjectFilter);
}
return dependentKeyIndex;
} | java | public DependentKeyIndex createDependentKeyIndex(CacheLoaderEngine cacheLoaderEngine, Extractor[] keyExtractors, Operation ownerObjectFilter)
{
DependentKeyIndex dependentKeyIndex = null;
for (DependentKeyIndex each : this.dependentKeyIndexes)
{
if (Arrays.equals(each.getKeyExtractors(), keyExtractors))
{
dependentKeyIndex = each;
break;
}
}
if (dependentKeyIndex == null)
{
dependentKeyIndex = (keyExtractors.length > 1)
? new DependentTupleKeyIndex(cacheLoaderEngine, this, keyExtractors)
: new DependentSingleKeyIndex(cacheLoaderEngine, this, keyExtractors);
dependentKeyIndex.setOwnerObjectFilter(ownerObjectFilter);
final LoadingTaskThreadPoolHolder threadPoolHolder = cacheLoaderEngine.getOrCreateThreadPool(this.getThreadPoolName());
dependentKeyIndex.setLoadingTaskThreadPoolHolder(threadPoolHolder);
threadPoolHolder.addDependentKeyIndex(dependentKeyIndex);
this.dependentKeyIndexes.add(dependentKeyIndex);
}
else
{
dependentKeyIndex.orOwnerObjectFilter(ownerObjectFilter);
}
return dependentKeyIndex;
} | [
"public",
"DependentKeyIndex",
"createDependentKeyIndex",
"(",
"CacheLoaderEngine",
"cacheLoaderEngine",
",",
"Extractor",
"[",
"]",
"keyExtractors",
",",
"Operation",
"ownerObjectFilter",
")",
"{",
"DependentKeyIndex",
"dependentKeyIndex",
"=",
"null",
";",
"for",
"(",
... | executed from a single thread during the cacheloader startup. | [
"executed",
"from",
"a",
"single",
"thread",
"during",
"the",
"cacheloader",
"startup",
"."
] | e9a069452eece7a6ef9551caf81a69d3d9a3d990 | https://github.com/goldmansachs/reladomo/blob/e9a069452eece7a6ef9551caf81a69d3d9a3d990/reladomo/src/main/java/com/gs/fw/common/mithra/cacheloader/DependentLoadingTaskSpawner.java#L163-L194 |
31,299 | goldmansachs/reladomo | reladomo/src/main/java/com/gs/fw/common/mithra/finder/DeepFetchNode.java | DeepFetchNode.createMappedOperationForDeepFetch | public Operation createMappedOperationForDeepFetch(Mapper mapper)
{
Operation rootOperation = this.getRootOperation();
if (rootOperation == null) return null;
return mapper.createMappedOperationForDeepFetch(rootOperation);
} | java | public Operation createMappedOperationForDeepFetch(Mapper mapper)
{
Operation rootOperation = this.getRootOperation();
if (rootOperation == null) return null;
return mapper.createMappedOperationForDeepFetch(rootOperation);
} | [
"public",
"Operation",
"createMappedOperationForDeepFetch",
"(",
"Mapper",
"mapper",
")",
"{",
"Operation",
"rootOperation",
"=",
"this",
".",
"getRootOperation",
"(",
")",
";",
"if",
"(",
"rootOperation",
"==",
"null",
")",
"return",
"null",
";",
"return",
"map... | mapper is not necessarily this.relatedFinder.mapper. chained mapper and linked mapper's callbacks. | [
"mapper",
"is",
"not",
"necessarily",
"this",
".",
"relatedFinder",
".",
"mapper",
".",
"chained",
"mapper",
"and",
"linked",
"mapper",
"s",
"callbacks",
"."
] | e9a069452eece7a6ef9551caf81a69d3d9a3d990 | https://github.com/goldmansachs/reladomo/blob/e9a069452eece7a6ef9551caf81a69d3d9a3d990/reladomo/src/main/java/com/gs/fw/common/mithra/finder/DeepFetchNode.java#L876-L881 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.