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
|
|---|---|---|---|---|---|---|---|---|---|---|---|
149,800
|
craterdog/java-general-utilities
|
src/main/java/craterdog/utils/ByteUtils.java
|
ByteUtils.bigDecimalToBytes
|
static public int bigDecimalToBytes(BigDecimal decimal, byte[] buffer, int index) {
BigInteger intVal = decimal.unscaledValue();
int length = 12 + (intVal.bitLength() + 8) / 8;
int scale = decimal.scale();
System.arraycopy(intToBytes(scale), 0, buffer, index, 4); // copy in the scale
index += 4;
int precision = decimal.precision();
System.arraycopy(intToBytes(precision), 0, buffer, index, 4); // copy in the scale
index += 4;
System.arraycopy(bigIntegerToBytes(intVal), 0, buffer, index, length - 8); // copy in the big integer
return length;
}
|
java
|
static public int bigDecimalToBytes(BigDecimal decimal, byte[] buffer, int index) {
BigInteger intVal = decimal.unscaledValue();
int length = 12 + (intVal.bitLength() + 8) / 8;
int scale = decimal.scale();
System.arraycopy(intToBytes(scale), 0, buffer, index, 4); // copy in the scale
index += 4;
int precision = decimal.precision();
System.arraycopy(intToBytes(precision), 0, buffer, index, 4); // copy in the scale
index += 4;
System.arraycopy(bigIntegerToBytes(intVal), 0, buffer, index, length - 8); // copy in the big integer
return length;
}
|
[
"static",
"public",
"int",
"bigDecimalToBytes",
"(",
"BigDecimal",
"decimal",
",",
"byte",
"[",
"]",
"buffer",
",",
"int",
"index",
")",
"{",
"BigInteger",
"intVal",
"=",
"decimal",
".",
"unscaledValue",
"(",
")",
";",
"int",
"length",
"=",
"12",
"+",
"(",
"intVal",
".",
"bitLength",
"(",
")",
"+",
"8",
")",
"/",
"8",
";",
"int",
"scale",
"=",
"decimal",
".",
"scale",
"(",
")",
";",
"System",
".",
"arraycopy",
"(",
"intToBytes",
"(",
"scale",
")",
",",
"0",
",",
"buffer",
",",
"index",
",",
"4",
")",
";",
"// copy in the scale",
"index",
"+=",
"4",
";",
"int",
"precision",
"=",
"decimal",
".",
"precision",
"(",
")",
";",
"System",
".",
"arraycopy",
"(",
"intToBytes",
"(",
"precision",
")",
",",
"0",
",",
"buffer",
",",
"index",
",",
"4",
")",
";",
"// copy in the scale",
"index",
"+=",
"4",
";",
"System",
".",
"arraycopy",
"(",
"bigIntegerToBytes",
"(",
"intVal",
")",
",",
"0",
",",
"buffer",
",",
"index",
",",
"length",
"-",
"8",
")",
";",
"// copy in the big integer",
"return",
"length",
";",
"}"
] |
This function converts a big decimal into its corresponding byte format and inserts
it into the specified buffer at the specified index.
@param decimal The big decimal to be converted.
@param buffer The byte array.
@param index The index in the array to begin inserting bytes.
@return The number of bytes inserted.
|
[
"This",
"function",
"converts",
"a",
"big",
"decimal",
"into",
"its",
"corresponding",
"byte",
"format",
"and",
"inserts",
"it",
"into",
"the",
"specified",
"buffer",
"at",
"the",
"specified",
"index",
"."
] |
a3ff45eaa00c2b8ed5c53efe9fe5166065fc1f57
|
https://github.com/craterdog/java-general-utilities/blob/a3ff45eaa00c2b8ed5c53efe9fe5166065fc1f57/src/main/java/craterdog/utils/ByteUtils.java#L499-L513
|
149,801
|
craterdog/java-general-utilities
|
src/main/java/craterdog/utils/ByteUtils.java
|
ByteUtils.bytesToBigDecimal
|
static public BigDecimal bytesToBigDecimal(byte[] buffer, int index) {
int scale = bytesToInt(buffer, index);
index += 4;
int precision = bytesToInt(buffer, index);
index += 4;
BigInteger intVal = bytesToBigInteger(buffer, index);
return new BigDecimal(intVal, scale, new MathContext(precision));
}
|
java
|
static public BigDecimal bytesToBigDecimal(byte[] buffer, int index) {
int scale = bytesToInt(buffer, index);
index += 4;
int precision = bytesToInt(buffer, index);
index += 4;
BigInteger intVal = bytesToBigInteger(buffer, index);
return new BigDecimal(intVal, scale, new MathContext(precision));
}
|
[
"static",
"public",
"BigDecimal",
"bytesToBigDecimal",
"(",
"byte",
"[",
"]",
"buffer",
",",
"int",
"index",
")",
"{",
"int",
"scale",
"=",
"bytesToInt",
"(",
"buffer",
",",
"index",
")",
";",
"index",
"+=",
"4",
";",
"int",
"precision",
"=",
"bytesToInt",
"(",
"buffer",
",",
"index",
")",
";",
"index",
"+=",
"4",
";",
"BigInteger",
"intVal",
"=",
"bytesToBigInteger",
"(",
"buffer",
",",
"index",
")",
";",
"return",
"new",
"BigDecimal",
"(",
"intVal",
",",
"scale",
",",
"new",
"MathContext",
"(",
"precision",
")",
")",
";",
"}"
] |
This function converts the bytes in a byte array at the specified index to its
corresponding big decimal value.
@param buffer The byte array containing the big decimal.
@param index The index for the first byte in the byte array.
@return The corresponding big decimal value.
|
[
"This",
"function",
"converts",
"the",
"bytes",
"in",
"a",
"byte",
"array",
"at",
"the",
"specified",
"index",
"to",
"its",
"corresponding",
"big",
"decimal",
"value",
"."
] |
a3ff45eaa00c2b8ed5c53efe9fe5166065fc1f57
|
https://github.com/craterdog/java-general-utilities/blob/a3ff45eaa00c2b8ed5c53efe9fe5166065fc1f57/src/main/java/craterdog/utils/ByteUtils.java#L536-L543
|
149,802
|
craterdog/java-general-utilities
|
src/main/java/craterdog/utils/ByteUtils.java
|
ByteUtils.stringToBytes
|
static public int stringToBytes(String string, byte[] buffer, int index) {
byte[] bytes = string.getBytes();
int length = bytes.length;
System.arraycopy(bytes, 0, buffer, index, length);
return length;
}
|
java
|
static public int stringToBytes(String string, byte[] buffer, int index) {
byte[] bytes = string.getBytes();
int length = bytes.length;
System.arraycopy(bytes, 0, buffer, index, length);
return length;
}
|
[
"static",
"public",
"int",
"stringToBytes",
"(",
"String",
"string",
",",
"byte",
"[",
"]",
"buffer",
",",
"int",
"index",
")",
"{",
"byte",
"[",
"]",
"bytes",
"=",
"string",
".",
"getBytes",
"(",
")",
";",
"int",
"length",
"=",
"bytes",
".",
"length",
";",
"System",
".",
"arraycopy",
"(",
"bytes",
",",
"0",
",",
"buffer",
",",
"index",
",",
"length",
")",
";",
"return",
"length",
";",
"}"
] |
This function converts a string into its corresponding byte format and inserts
it into the specified buffer at the specified index.
@param string The string to be converted.
@param buffer The byte array.
@param index The index in the array to begin inserting bytes.
@return The number of bytes inserted.
|
[
"This",
"function",
"converts",
"a",
"string",
"into",
"its",
"corresponding",
"byte",
"format",
"and",
"inserts",
"it",
"into",
"the",
"specified",
"buffer",
"at",
"the",
"specified",
"index",
"."
] |
a3ff45eaa00c2b8ed5c53efe9fe5166065fc1f57
|
https://github.com/craterdog/java-general-utilities/blob/a3ff45eaa00c2b8ed5c53efe9fe5166065fc1f57/src/main/java/craterdog/utils/ByteUtils.java#L581-L586
|
149,803
|
craterdog/java-general-utilities
|
src/main/java/craterdog/utils/ByteUtils.java
|
ByteUtils.compare
|
static public int compare(byte[] first, byte[] second) {
// choose the shorter array length
int firstLength = first.length;
int secondLength = second.length;
int shorterLength = Math.min(firstLength, secondLength);
// compare matching bytes
for (int i = 0; i < shorterLength; i++) {
int result = Byte.compare(first[i], second[i]);
if (result != 0) return Integer.signum(result);
}
// compare lengths if bytes match
if (firstLength < secondLength) return -1;
if (firstLength > secondLength) return 1;
// must be same length and equal
return 0;
}
|
java
|
static public int compare(byte[] first, byte[] second) {
// choose the shorter array length
int firstLength = first.length;
int secondLength = second.length;
int shorterLength = Math.min(firstLength, secondLength);
// compare matching bytes
for (int i = 0; i < shorterLength; i++) {
int result = Byte.compare(first[i], second[i]);
if (result != 0) return Integer.signum(result);
}
// compare lengths if bytes match
if (firstLength < secondLength) return -1;
if (firstLength > secondLength) return 1;
// must be same length and equal
return 0;
}
|
[
"static",
"public",
"int",
"compare",
"(",
"byte",
"[",
"]",
"first",
",",
"byte",
"[",
"]",
"second",
")",
"{",
"// choose the shorter array length",
"int",
"firstLength",
"=",
"first",
".",
"length",
";",
"int",
"secondLength",
"=",
"second",
".",
"length",
";",
"int",
"shorterLength",
"=",
"Math",
".",
"min",
"(",
"firstLength",
",",
"secondLength",
")",
";",
"// compare matching bytes",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"shorterLength",
";",
"i",
"++",
")",
"{",
"int",
"result",
"=",
"Byte",
".",
"compare",
"(",
"first",
"[",
"i",
"]",
",",
"second",
"[",
"i",
"]",
")",
";",
"if",
"(",
"result",
"!=",
"0",
")",
"return",
"Integer",
".",
"signum",
"(",
"result",
")",
";",
"}",
"// compare lengths if bytes match",
"if",
"(",
"firstLength",
"<",
"secondLength",
")",
"return",
"-",
"1",
";",
"if",
"(",
"firstLength",
">",
"secondLength",
")",
"return",
"1",
";",
"// must be same length and equal",
"return",
"0",
";",
"}"
] |
This function compares two byte arrays for canonical ordering.
@param first The first byte array.
@param second The second byte array.
@return The signum result of the comparison.
|
[
"This",
"function",
"compares",
"two",
"byte",
"arrays",
"for",
"canonical",
"ordering",
"."
] |
a3ff45eaa00c2b8ed5c53efe9fe5166065fc1f57
|
https://github.com/craterdog/java-general-utilities/blob/a3ff45eaa00c2b8ed5c53efe9fe5166065fc1f57/src/main/java/craterdog/utils/ByteUtils.java#L671-L689
|
149,804
|
bwkimmel/jdcp
|
jdcp-worker-app/src/main/java/ca/eandb/jdcp/worker/PreferencesDialog.java
|
PreferencesDialog.readPreferences
|
private void readPreferences() {
boolean runOnStartup = pref.getBoolean("runOnStartup", true);
getRunOnStartupCheckBox().setSelected(runOnStartup);
int maxCpus = pref.getInt("maxCpus", 0);
if (maxCpus <= 0) {
getLimitCpusCheckBox().setSelected(false);
getMaxCpusTextField().setValue(Runtime.getRuntime().availableProcessors());
getMaxCpusTextField().setEnabled(false);
} else {
getLimitCpusCheckBox().setSelected(true);
getMaxCpusTextField().setValue(maxCpus);
getMaxCpusTextField().setEnabled(true);
}
if (getRequireACCheckBox().isEnabled()) {
boolean requireAC = pref.getBoolean("requireAC", false);
int minBattLife = pref.getInt("minBattLife", 0);
int minBattLifeWhileChg = pref.getInt("minBattLifeWhileChg", 0);
getRequireACCheckBox().setSelected(requireAC);
getMinBatteryLifeSlider().setEnabled(!requireAC);
getMinBatteryLifeSlider().setValue(minBattLife);
getMinBatteryLifeWhileChargingSlider().setValue(minBattLifeWhileChg);
} else {
getRequireACCheckBox().setSelected(false);
getMinBatteryLifeSlider().setValue(0);
getMinBatteryLifeWhileChargingSlider().setValue(0);
getRequireACCheckBox().setEnabled(false);
getMinBatteryLifeSlider().setEnabled(false);
getMinBatteryLifeWhileChargingSlider().setEnabled(false);
}
boolean cacheClassDefinitions = pref.getBoolean("cacheClassDefinitions", true);
getCacheClassDefinitionsCheckBox().setSelected(cacheClassDefinitions);
}
|
java
|
private void readPreferences() {
boolean runOnStartup = pref.getBoolean("runOnStartup", true);
getRunOnStartupCheckBox().setSelected(runOnStartup);
int maxCpus = pref.getInt("maxCpus", 0);
if (maxCpus <= 0) {
getLimitCpusCheckBox().setSelected(false);
getMaxCpusTextField().setValue(Runtime.getRuntime().availableProcessors());
getMaxCpusTextField().setEnabled(false);
} else {
getLimitCpusCheckBox().setSelected(true);
getMaxCpusTextField().setValue(maxCpus);
getMaxCpusTextField().setEnabled(true);
}
if (getRequireACCheckBox().isEnabled()) {
boolean requireAC = pref.getBoolean("requireAC", false);
int minBattLife = pref.getInt("minBattLife", 0);
int minBattLifeWhileChg = pref.getInt("minBattLifeWhileChg", 0);
getRequireACCheckBox().setSelected(requireAC);
getMinBatteryLifeSlider().setEnabled(!requireAC);
getMinBatteryLifeSlider().setValue(minBattLife);
getMinBatteryLifeWhileChargingSlider().setValue(minBattLifeWhileChg);
} else {
getRequireACCheckBox().setSelected(false);
getMinBatteryLifeSlider().setValue(0);
getMinBatteryLifeWhileChargingSlider().setValue(0);
getRequireACCheckBox().setEnabled(false);
getMinBatteryLifeSlider().setEnabled(false);
getMinBatteryLifeWhileChargingSlider().setEnabled(false);
}
boolean cacheClassDefinitions = pref.getBoolean("cacheClassDefinitions", true);
getCacheClassDefinitionsCheckBox().setSelected(cacheClassDefinitions);
}
|
[
"private",
"void",
"readPreferences",
"(",
")",
"{",
"boolean",
"runOnStartup",
"=",
"pref",
".",
"getBoolean",
"(",
"\"runOnStartup\"",
",",
"true",
")",
";",
"getRunOnStartupCheckBox",
"(",
")",
".",
"setSelected",
"(",
"runOnStartup",
")",
";",
"int",
"maxCpus",
"=",
"pref",
".",
"getInt",
"(",
"\"maxCpus\"",
",",
"0",
")",
";",
"if",
"(",
"maxCpus",
"<=",
"0",
")",
"{",
"getLimitCpusCheckBox",
"(",
")",
".",
"setSelected",
"(",
"false",
")",
";",
"getMaxCpusTextField",
"(",
")",
".",
"setValue",
"(",
"Runtime",
".",
"getRuntime",
"(",
")",
".",
"availableProcessors",
"(",
")",
")",
";",
"getMaxCpusTextField",
"(",
")",
".",
"setEnabled",
"(",
"false",
")",
";",
"}",
"else",
"{",
"getLimitCpusCheckBox",
"(",
")",
".",
"setSelected",
"(",
"true",
")",
";",
"getMaxCpusTextField",
"(",
")",
".",
"setValue",
"(",
"maxCpus",
")",
";",
"getMaxCpusTextField",
"(",
")",
".",
"setEnabled",
"(",
"true",
")",
";",
"}",
"if",
"(",
"getRequireACCheckBox",
"(",
")",
".",
"isEnabled",
"(",
")",
")",
"{",
"boolean",
"requireAC",
"=",
"pref",
".",
"getBoolean",
"(",
"\"requireAC\"",
",",
"false",
")",
";",
"int",
"minBattLife",
"=",
"pref",
".",
"getInt",
"(",
"\"minBattLife\"",
",",
"0",
")",
";",
"int",
"minBattLifeWhileChg",
"=",
"pref",
".",
"getInt",
"(",
"\"minBattLifeWhileChg\"",
",",
"0",
")",
";",
"getRequireACCheckBox",
"(",
")",
".",
"setSelected",
"(",
"requireAC",
")",
";",
"getMinBatteryLifeSlider",
"(",
")",
".",
"setEnabled",
"(",
"!",
"requireAC",
")",
";",
"getMinBatteryLifeSlider",
"(",
")",
".",
"setValue",
"(",
"minBattLife",
")",
";",
"getMinBatteryLifeWhileChargingSlider",
"(",
")",
".",
"setValue",
"(",
"minBattLifeWhileChg",
")",
";",
"}",
"else",
"{",
"getRequireACCheckBox",
"(",
")",
".",
"setSelected",
"(",
"false",
")",
";",
"getMinBatteryLifeSlider",
"(",
")",
".",
"setValue",
"(",
"0",
")",
";",
"getMinBatteryLifeWhileChargingSlider",
"(",
")",
".",
"setValue",
"(",
"0",
")",
";",
"getRequireACCheckBox",
"(",
")",
".",
"setEnabled",
"(",
"false",
")",
";",
"getMinBatteryLifeSlider",
"(",
")",
".",
"setEnabled",
"(",
"false",
")",
";",
"getMinBatteryLifeWhileChargingSlider",
"(",
")",
".",
"setEnabled",
"(",
"false",
")",
";",
"}",
"boolean",
"cacheClassDefinitions",
"=",
"pref",
".",
"getBoolean",
"(",
"\"cacheClassDefinitions\"",
",",
"true",
")",
";",
"getCacheClassDefinitionsCheckBox",
"(",
")",
".",
"setSelected",
"(",
"cacheClassDefinitions",
")",
";",
"}"
] |
Updates the form elements based on preferences.
|
[
"Updates",
"the",
"form",
"elements",
"based",
"on",
"preferences",
"."
] |
630c5150c245054e2556ff370f4bad2ec793dfb7
|
https://github.com/bwkimmel/jdcp/blob/630c5150c245054e2556ff370f4bad2ec793dfb7/jdcp-worker-app/src/main/java/ca/eandb/jdcp/worker/PreferencesDialog.java#L114-L148
|
149,805
|
bwkimmel/jdcp
|
jdcp-worker-app/src/main/java/ca/eandb/jdcp/worker/PreferencesDialog.java
|
PreferencesDialog.writePreferences
|
private void writePreferences() {
boolean runOnStartup = getRunOnStartupCheckBox().isSelected();
pref.putBoolean("runOnStartup", runOnStartup);
if (getLimitCpusCheckBox().isSelected()) {
int maxCpus = ((Number) getMaxCpusTextField().getValue()).intValue();
pref.putInt("maxCpus", maxCpus);
} else {
pref.putInt("maxCpus", 0);
}
boolean requireAC = getRequireACCheckBox().isSelected();
int minBattLife = getMinBatteryLifeSlider().getValue();
int minBattLifeWhileChg = getMinBatteryLifeWhileChargingSlider().getValue();
pref.putBoolean("requireAC", requireAC);
pref.putInt("minBattLife", minBattLife);
pref.putInt("minBattLifeWhileChg", minBattLifeWhileChg);
boolean cacheClassDefinitions = getCacheClassDefinitionsCheckBox().isSelected();
pref.putBoolean("cacheClassDefinitions", cacheClassDefinitions);
}
|
java
|
private void writePreferences() {
boolean runOnStartup = getRunOnStartupCheckBox().isSelected();
pref.putBoolean("runOnStartup", runOnStartup);
if (getLimitCpusCheckBox().isSelected()) {
int maxCpus = ((Number) getMaxCpusTextField().getValue()).intValue();
pref.putInt("maxCpus", maxCpus);
} else {
pref.putInt("maxCpus", 0);
}
boolean requireAC = getRequireACCheckBox().isSelected();
int minBattLife = getMinBatteryLifeSlider().getValue();
int minBattLifeWhileChg = getMinBatteryLifeWhileChargingSlider().getValue();
pref.putBoolean("requireAC", requireAC);
pref.putInt("minBattLife", minBattLife);
pref.putInt("minBattLifeWhileChg", minBattLifeWhileChg);
boolean cacheClassDefinitions = getCacheClassDefinitionsCheckBox().isSelected();
pref.putBoolean("cacheClassDefinitions", cacheClassDefinitions);
}
|
[
"private",
"void",
"writePreferences",
"(",
")",
"{",
"boolean",
"runOnStartup",
"=",
"getRunOnStartupCheckBox",
"(",
")",
".",
"isSelected",
"(",
")",
";",
"pref",
".",
"putBoolean",
"(",
"\"runOnStartup\"",
",",
"runOnStartup",
")",
";",
"if",
"(",
"getLimitCpusCheckBox",
"(",
")",
".",
"isSelected",
"(",
")",
")",
"{",
"int",
"maxCpus",
"=",
"(",
"(",
"Number",
")",
"getMaxCpusTextField",
"(",
")",
".",
"getValue",
"(",
")",
")",
".",
"intValue",
"(",
")",
";",
"pref",
".",
"putInt",
"(",
"\"maxCpus\"",
",",
"maxCpus",
")",
";",
"}",
"else",
"{",
"pref",
".",
"putInt",
"(",
"\"maxCpus\"",
",",
"0",
")",
";",
"}",
"boolean",
"requireAC",
"=",
"getRequireACCheckBox",
"(",
")",
".",
"isSelected",
"(",
")",
";",
"int",
"minBattLife",
"=",
"getMinBatteryLifeSlider",
"(",
")",
".",
"getValue",
"(",
")",
";",
"int",
"minBattLifeWhileChg",
"=",
"getMinBatteryLifeWhileChargingSlider",
"(",
")",
".",
"getValue",
"(",
")",
";",
"pref",
".",
"putBoolean",
"(",
"\"requireAC\"",
",",
"requireAC",
")",
";",
"pref",
".",
"putInt",
"(",
"\"minBattLife\"",
",",
"minBattLife",
")",
";",
"pref",
".",
"putInt",
"(",
"\"minBattLifeWhileChg\"",
",",
"minBattLifeWhileChg",
")",
";",
"boolean",
"cacheClassDefinitions",
"=",
"getCacheClassDefinitionsCheckBox",
"(",
")",
".",
"isSelected",
"(",
")",
";",
"pref",
".",
"putBoolean",
"(",
"\"cacheClassDefinitions\"",
",",
"cacheClassDefinitions",
")",
";",
"}"
] |
Writes the form values to preferences.
|
[
"Writes",
"the",
"form",
"values",
"to",
"preferences",
"."
] |
630c5150c245054e2556ff370f4bad2ec793dfb7
|
https://github.com/bwkimmel/jdcp/blob/630c5150c245054e2556ff370f4bad2ec793dfb7/jdcp-worker-app/src/main/java/ca/eandb/jdcp/worker/PreferencesDialog.java#L153-L173
|
149,806
|
trustathsh/ifmapj
|
src/main/java/de/hshannover/f4/trust/ifmapj/identifier/Identity.java
|
Identity.extendedIdentifierEquals
|
private boolean extendedIdentifierEquals(String eid1, String eid2) {
try {
return DomHelpers.compare(DomHelpers.toDocument(eid1, null),
DomHelpers.toDocument(eid2, null));
} catch (MarshalException e) {
return false;
}
}
|
java
|
private boolean extendedIdentifierEquals(String eid1, String eid2) {
try {
return DomHelpers.compare(DomHelpers.toDocument(eid1, null),
DomHelpers.toDocument(eid2, null));
} catch (MarshalException e) {
return false;
}
}
|
[
"private",
"boolean",
"extendedIdentifierEquals",
"(",
"String",
"eid1",
",",
"String",
"eid2",
")",
"{",
"try",
"{",
"return",
"DomHelpers",
".",
"compare",
"(",
"DomHelpers",
".",
"toDocument",
"(",
"eid1",
",",
"null",
")",
",",
"DomHelpers",
".",
"toDocument",
"(",
"eid2",
",",
"null",
")",
")",
";",
"}",
"catch",
"(",
"MarshalException",
"e",
")",
"{",
"return",
"false",
";",
"}",
"}"
] |
Compare two extended identifiers
@param eid1 Extended identifier XML string
@param eid2 Extended identifier XML string
@return boolean true if both are equal
@since 0.1.5
|
[
"Compare",
"two",
"extended",
"identifiers"
] |
44ece9e95a3d2a1b7019573ba6178598a6cbdaa3
|
https://github.com/trustathsh/ifmapj/blob/44ece9e95a3d2a1b7019573ba6178598a6cbdaa3/src/main/java/de/hshannover/f4/trust/ifmapj/identifier/Identity.java#L181-L188
|
149,807
|
trustathsh/ifmapj
|
src/main/java/de/hshannover/f4/trust/ifmapj/identifier/Identity.java
|
Identity.distinguishedNameEquals
|
private boolean distinguishedNameEquals(String dsn1, String dsn2) {
return new X500Principal(dsn1).equals(new X500Principal(dsn2));
}
|
java
|
private boolean distinguishedNameEquals(String dsn1, String dsn2) {
return new X500Principal(dsn1).equals(new X500Principal(dsn2));
}
|
[
"private",
"boolean",
"distinguishedNameEquals",
"(",
"String",
"dsn1",
",",
"String",
"dsn2",
")",
"{",
"return",
"new",
"X500Principal",
"(",
"dsn1",
")",
".",
"equals",
"(",
"new",
"X500Principal",
"(",
"dsn2",
")",
")",
";",
"}"
] |
Compare two DSN
@param dsn1 Distinguished name (X.500 DSN) string
@param dsn2 Distinguished name (X.500 DSN) string
@return boolean true if both DSN are equal
@since 0.1.5
|
[
"Compare",
"two",
"DSN"
] |
44ece9e95a3d2a1b7019573ba6178598a6cbdaa3
|
https://github.com/trustathsh/ifmapj/blob/44ece9e95a3d2a1b7019573ba6178598a6cbdaa3/src/main/java/de/hshannover/f4/trust/ifmapj/identifier/Identity.java#L198-L200
|
149,808
|
ruifigueira/platypus
|
src/main/java/platypus/internal/Classes.java
|
Classes.getAllInterfaces
|
private static void getAllInterfaces(Class<?> cls, Collection<Class<?>> interfacesFound) {
while (cls != null) {
Class<?>[] interfaces = cls.getInterfaces();
for (int i = 0; i < interfaces.length; i++) {
interfacesFound.add(interfaces[i]);
getAllInterfaces(interfaces[i], interfacesFound);
}
cls = cls.getSuperclass();
}
}
|
java
|
private static void getAllInterfaces(Class<?> cls, Collection<Class<?>> interfacesFound) {
while (cls != null) {
Class<?>[] interfaces = cls.getInterfaces();
for (int i = 0; i < interfaces.length; i++) {
interfacesFound.add(interfaces[i]);
getAllInterfaces(interfaces[i], interfacesFound);
}
cls = cls.getSuperclass();
}
}
|
[
"private",
"static",
"void",
"getAllInterfaces",
"(",
"Class",
"<",
"?",
">",
"cls",
",",
"Collection",
"<",
"Class",
"<",
"?",
">",
">",
"interfacesFound",
")",
"{",
"while",
"(",
"cls",
"!=",
"null",
")",
"{",
"Class",
"<",
"?",
">",
"[",
"]",
"interfaces",
"=",
"cls",
".",
"getInterfaces",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"interfaces",
".",
"length",
";",
"i",
"++",
")",
"{",
"interfacesFound",
".",
"add",
"(",
"interfaces",
"[",
"i",
"]",
")",
";",
"getAllInterfaces",
"(",
"interfaces",
"[",
"i",
"]",
",",
"interfacesFound",
")",
";",
"}",
"cls",
"=",
"cls",
".",
"getSuperclass",
"(",
")",
";",
"}",
"}"
] |
Get the interfaces for the specified class.
@param cls the class to look up, may be <code>null</code>
@param interfacesFound the <code>Set</code> of interfaces for the class
|
[
"Get",
"the",
"interfaces",
"for",
"the",
"specified",
"class",
"."
] |
d848de1a7af1171307e955cb73783efd626a8af8
|
https://github.com/ruifigueira/platypus/blob/d848de1a7af1171307e955cb73783efd626a8af8/src/main/java/platypus/internal/Classes.java#L54-L65
|
149,809
|
nhurion/vaadin-for-heroku
|
src/main/java/eu/hurion/vaadin/heroku/FilterDefinitionBuilder.java
|
FilterDefinitionBuilder.withParameter
|
public FilterDefinitionBuilder withParameter(final String name, final String value) {
if (parameters.containsKey(name)) {
// The spec does not define this but the TCK expects the first
// definition to take precedence
return this;
}
this.parameters.put(name, value);
return this;
}
|
java
|
public FilterDefinitionBuilder withParameter(final String name, final String value) {
if (parameters.containsKey(name)) {
// The spec does not define this but the TCK expects the first
// definition to take precedence
return this;
}
this.parameters.put(name, value);
return this;
}
|
[
"public",
"FilterDefinitionBuilder",
"withParameter",
"(",
"final",
"String",
"name",
",",
"final",
"String",
"value",
")",
"{",
"if",
"(",
"parameters",
".",
"containsKey",
"(",
"name",
")",
")",
"{",
"// The spec does not define this but the TCK expects the first",
"// definition to take precedence",
"return",
"this",
";",
"}",
"this",
".",
"parameters",
".",
"put",
"(",
"name",
",",
"value",
")",
";",
"return",
"this",
";",
"}"
] |
Add a parameter with its associated value.
One a parameter has been added, its value cannot be changed.
@param name the name of the parameter
@param value the value of the parameter
@return this
|
[
"Add",
"a",
"parameter",
"with",
"its",
"associated",
"value",
".",
"One",
"a",
"parameter",
"has",
"been",
"added",
"its",
"value",
"cannot",
"be",
"changed",
"."
] |
51b1c22827934eb6105b0cfb0254cc15df23e991
|
https://github.com/nhurion/vaadin-for-heroku/blob/51b1c22827934eb6105b0cfb0254cc15df23e991/src/main/java/eu/hurion/vaadin/heroku/FilterDefinitionBuilder.java#L72-L80
|
149,810
|
mlhartme/mork
|
src/main/java/net/oneandone/mork/scanner/CompleteFA.java
|
CompleteFA.create
|
public static FA create(FA fa, int errorSi) {
FA cfa; // result
int[] sorted;
int si;
int idx;
int faSize;
State faState;
State cfaState;
int nextChar;
int width;
Range range;
int nextSi;
faSize = fa.size();
cfa = new FA();
for (si = 0; si < faSize; si++) {
faState = fa.get(si);
if (cfa.add(faState.getLabel()) != si) {
throw new RuntimeException();
}
cfaState = cfa.get(si);
if (fa.getStart() == si) {
cfa.setStart(si);
}
if (fa.isEnd(si)) {
cfa.setEnd(si);
}
sorted = faState.sortRanges();
nextChar = 0;
for (idx = 0; idx < sorted.length; idx += width) {
width = countConsecutive(faState, sorted, idx);
range = firstToLast(faState, sorted, idx, width);
nextSi = faState.getEnd(sorted[idx]);
if (nextChar < range.getFirst()) {
cfaState.add(errorSi, new Range((char) nextChar, (char) (range.getFirst() - 1)));
}
cfaState.add(faState.getEnd(sorted[idx]), range);
nextChar = range.getLast() + 1;
}
if (nextChar <= Character.MAX_VALUE) {
cfaState.add(errorSi, new Range((char) nextChar, Character.MAX_VALUE));
}
}
return cfa;
}
|
java
|
public static FA create(FA fa, int errorSi) {
FA cfa; // result
int[] sorted;
int si;
int idx;
int faSize;
State faState;
State cfaState;
int nextChar;
int width;
Range range;
int nextSi;
faSize = fa.size();
cfa = new FA();
for (si = 0; si < faSize; si++) {
faState = fa.get(si);
if (cfa.add(faState.getLabel()) != si) {
throw new RuntimeException();
}
cfaState = cfa.get(si);
if (fa.getStart() == si) {
cfa.setStart(si);
}
if (fa.isEnd(si)) {
cfa.setEnd(si);
}
sorted = faState.sortRanges();
nextChar = 0;
for (idx = 0; idx < sorted.length; idx += width) {
width = countConsecutive(faState, sorted, idx);
range = firstToLast(faState, sorted, idx, width);
nextSi = faState.getEnd(sorted[idx]);
if (nextChar < range.getFirst()) {
cfaState.add(errorSi, new Range((char) nextChar, (char) (range.getFirst() - 1)));
}
cfaState.add(faState.getEnd(sorted[idx]), range);
nextChar = range.getLast() + 1;
}
if (nextChar <= Character.MAX_VALUE) {
cfaState.add(errorSi, new Range((char) nextChar, Character.MAX_VALUE));
}
}
return cfa;
}
|
[
"public",
"static",
"FA",
"create",
"(",
"FA",
"fa",
",",
"int",
"errorSi",
")",
"{",
"FA",
"cfa",
";",
"// result",
"int",
"[",
"]",
"sorted",
";",
"int",
"si",
";",
"int",
"idx",
";",
"int",
"faSize",
";",
"State",
"faState",
";",
"State",
"cfaState",
";",
"int",
"nextChar",
";",
"int",
"width",
";",
"Range",
"range",
";",
"int",
"nextSi",
";",
"faSize",
"=",
"fa",
".",
"size",
"(",
")",
";",
"cfa",
"=",
"new",
"FA",
"(",
")",
";",
"for",
"(",
"si",
"=",
"0",
";",
"si",
"<",
"faSize",
";",
"si",
"++",
")",
"{",
"faState",
"=",
"fa",
".",
"get",
"(",
"si",
")",
";",
"if",
"(",
"cfa",
".",
"add",
"(",
"faState",
".",
"getLabel",
"(",
")",
")",
"!=",
"si",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
")",
";",
"}",
"cfaState",
"=",
"cfa",
".",
"get",
"(",
"si",
")",
";",
"if",
"(",
"fa",
".",
"getStart",
"(",
")",
"==",
"si",
")",
"{",
"cfa",
".",
"setStart",
"(",
"si",
")",
";",
"}",
"if",
"(",
"fa",
".",
"isEnd",
"(",
"si",
")",
")",
"{",
"cfa",
".",
"setEnd",
"(",
"si",
")",
";",
"}",
"sorted",
"=",
"faState",
".",
"sortRanges",
"(",
")",
";",
"nextChar",
"=",
"0",
";",
"for",
"(",
"idx",
"=",
"0",
";",
"idx",
"<",
"sorted",
".",
"length",
";",
"idx",
"+=",
"width",
")",
"{",
"width",
"=",
"countConsecutive",
"(",
"faState",
",",
"sorted",
",",
"idx",
")",
";",
"range",
"=",
"firstToLast",
"(",
"faState",
",",
"sorted",
",",
"idx",
",",
"width",
")",
";",
"nextSi",
"=",
"faState",
".",
"getEnd",
"(",
"sorted",
"[",
"idx",
"]",
")",
";",
"if",
"(",
"nextChar",
"<",
"range",
".",
"getFirst",
"(",
")",
")",
"{",
"cfaState",
".",
"add",
"(",
"errorSi",
",",
"new",
"Range",
"(",
"(",
"char",
")",
"nextChar",
",",
"(",
"char",
")",
"(",
"range",
".",
"getFirst",
"(",
")",
"-",
"1",
")",
")",
")",
";",
"}",
"cfaState",
".",
"add",
"(",
"faState",
".",
"getEnd",
"(",
"sorted",
"[",
"idx",
"]",
")",
",",
"range",
")",
";",
"nextChar",
"=",
"range",
".",
"getLast",
"(",
")",
"+",
"1",
";",
"}",
"if",
"(",
"nextChar",
"<=",
"Character",
".",
"MAX_VALUE",
")",
"{",
"cfaState",
".",
"add",
"(",
"errorSi",
",",
"new",
"Range",
"(",
"(",
"char",
")",
"nextChar",
",",
"Character",
".",
"MAX_VALUE",
")",
")",
";",
"}",
"}",
"return",
"cfa",
";",
"}"
] |
The last state of the automaton returned is the error state.
|
[
"The",
"last",
"state",
"of",
"the",
"automaton",
"returned",
"is",
"the",
"error",
"state",
"."
] |
a069b087750c4133bfeebaf1f599c3bc96762113
|
https://github.com/mlhartme/mork/blob/a069b087750c4133bfeebaf1f599c3bc96762113/src/main/java/net/oneandone/mork/scanner/CompleteFA.java#L30-L76
|
149,811
|
bwkimmel/jdcp
|
jdcp-console/src/main/java/ca/eandb/jdcp/client/ScriptFacade.java
|
ScriptFacade.setJobPriority
|
public void setJobPriority(UUID jobId, int priority) throws Exception {
config.getJobService().setJobPriority(jobId, priority);
}
|
java
|
public void setJobPriority(UUID jobId, int priority) throws Exception {
config.getJobService().setJobPriority(jobId, priority);
}
|
[
"public",
"void",
"setJobPriority",
"(",
"UUID",
"jobId",
",",
"int",
"priority",
")",
"throws",
"Exception",
"{",
"config",
".",
"getJobService",
"(",
")",
".",
"setJobPriority",
"(",
"jobId",
",",
"priority",
")",
";",
"}"
] |
Sets the priority of the specified job.
@param jobId The <code>UUID</code> of the job for which to set the
priority.
@param priority The priority to assign to the job.
@throws Exception if an error occurs in delegating the request to the
configured job service
|
[
"Sets",
"the",
"priority",
"of",
"the",
"specified",
"job",
"."
] |
630c5150c245054e2556ff370f4bad2ec793dfb7
|
https://github.com/bwkimmel/jdcp/blob/630c5150c245054e2556ff370f4bad2ec793dfb7/jdcp-console/src/main/java/ca/eandb/jdcp/client/ScriptFacade.java#L71-L73
|
149,812
|
BellaDati/belladati-sdk-api
|
src/main/java/com/belladati/sdk/dataset/data/DataColumn.java
|
DataColumn.toJson
|
public JsonNode toJson() {
ObjectNode node = new ObjectMapper().createObjectNode();
node.put("code", code);
if (format != null) {
node.put("format", format);
}
return node;
}
|
java
|
public JsonNode toJson() {
ObjectNode node = new ObjectMapper().createObjectNode();
node.put("code", code);
if (format != null) {
node.put("format", format);
}
return node;
}
|
[
"public",
"JsonNode",
"toJson",
"(",
")",
"{",
"ObjectNode",
"node",
"=",
"new",
"ObjectMapper",
"(",
")",
".",
"createObjectNode",
"(",
")",
";",
"node",
".",
"put",
"(",
"\"code\"",
",",
"code",
")",
";",
"if",
"(",
"format",
"!=",
"null",
")",
"{",
"node",
".",
"put",
"(",
"\"format\"",
",",
"format",
")",
";",
"}",
"return",
"node",
";",
"}"
] |
Returns this column in JSON representation.
@return this column in JSON representation
|
[
"Returns",
"this",
"column",
"in",
"JSON",
"representation",
"."
] |
ec45a42048d8255838ad0200aa6784a8e8a121c1
|
https://github.com/BellaDati/belladati-sdk-api/blob/ec45a42048d8255838ad0200aa6784a8e8a121c1/src/main/java/com/belladati/sdk/dataset/data/DataColumn.java#L58-L65
|
149,813
|
mlhartme/mork
|
src/main/java/net/oneandone/mork/classfile/ClassRef.java
|
ClassRef.findComponent
|
public static Type findComponent(Class<?> type) {
int i;
Type cmp;
for (i = 0; i < Type.PRIMITIVES.length; i++) {
cmp = Type.PRIMITIVES[i];
if (type == cmp.type) {
return cmp;
}
}
return Type.REFERENCE;
}
|
java
|
public static Type findComponent(Class<?> type) {
int i;
Type cmp;
for (i = 0; i < Type.PRIMITIVES.length; i++) {
cmp = Type.PRIMITIVES[i];
if (type == cmp.type) {
return cmp;
}
}
return Type.REFERENCE;
}
|
[
"public",
"static",
"Type",
"findComponent",
"(",
"Class",
"<",
"?",
">",
"type",
")",
"{",
"int",
"i",
";",
"Type",
"cmp",
";",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"Type",
".",
"PRIMITIVES",
".",
"length",
";",
"i",
"++",
")",
"{",
"cmp",
"=",
"Type",
".",
"PRIMITIVES",
"[",
"i",
"]",
";",
"if",
"(",
"type",
"==",
"cmp",
".",
"type",
")",
"{",
"return",
"cmp",
";",
"}",
"}",
"return",
"Type",
".",
"REFERENCE",
";",
"}"
] |
returns Type.REFERENCE_TYPE;
|
[
"returns",
"Type",
".",
"REFERENCE_TYPE",
";"
] |
a069b087750c4133bfeebaf1f599c3bc96762113
|
https://github.com/mlhartme/mork/blob/a069b087750c4133bfeebaf1f599c3bc96762113/src/main/java/net/oneandone/mork/classfile/ClassRef.java#L120-L131
|
149,814
|
mlhartme/mork
|
src/main/java/net/oneandone/mork/classfile/ClassRef.java
|
ClassRef.wrappedType
|
public static Class<?> wrappedType(Class<?> c) {
int i;
if (c.isPrimitive()) {
for (i = 0; i < Type.PRIMITIVES.length; i++) {
if (Type.PRIMITIVES[i].type == c) {
return Type.PRIMITIVES[i].wrapper;
}
}
throw new RuntimeException();
} else {
return c;
}
}
|
java
|
public static Class<?> wrappedType(Class<?> c) {
int i;
if (c.isPrimitive()) {
for (i = 0; i < Type.PRIMITIVES.length; i++) {
if (Type.PRIMITIVES[i].type == c) {
return Type.PRIMITIVES[i].wrapper;
}
}
throw new RuntimeException();
} else {
return c;
}
}
|
[
"public",
"static",
"Class",
"<",
"?",
">",
"wrappedType",
"(",
"Class",
"<",
"?",
">",
"c",
")",
"{",
"int",
"i",
";",
"if",
"(",
"c",
".",
"isPrimitive",
"(",
")",
")",
"{",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"Type",
".",
"PRIMITIVES",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"Type",
".",
"PRIMITIVES",
"[",
"i",
"]",
".",
"type",
"==",
"c",
")",
"{",
"return",
"Type",
".",
"PRIMITIVES",
"[",
"i",
"]",
".",
"wrapper",
";",
"}",
"}",
"throw",
"new",
"RuntimeException",
"(",
")",
";",
"}",
"else",
"{",
"return",
"c",
";",
"}",
"}"
] |
additional functionality for primitive Java Classes
|
[
"additional",
"functionality",
"for",
"primitive",
"Java",
"Classes"
] |
a069b087750c4133bfeebaf1f599c3bc96762113
|
https://github.com/mlhartme/mork/blob/a069b087750c4133bfeebaf1f599c3bc96762113/src/main/java/net/oneandone/mork/classfile/ClassRef.java#L302-L315
|
149,815
|
mlhartme/mork
|
src/main/java/net/oneandone/mork/classfile/ClassRef.java
|
ClassRef.classFind
|
public static Class<?> classFind(String name) {
try {
return Class.forName(name);
} catch (ClassNotFoundException e) {
return findType(name).type;
}
}
|
java
|
public static Class<?> classFind(String name) {
try {
return Class.forName(name);
} catch (ClassNotFoundException e) {
return findType(name).type;
}
}
|
[
"public",
"static",
"Class",
"<",
"?",
">",
"classFind",
"(",
"String",
"name",
")",
"{",
"try",
"{",
"return",
"Class",
".",
"forName",
"(",
"name",
")",
";",
"}",
"catch",
"(",
"ClassNotFoundException",
"e",
")",
"{",
"return",
"findType",
"(",
"name",
")",
".",
"type",
";",
"}",
"}"
] |
Looks up a class by name. In contrast to Class.forName, primitive
classes are found and not found is indicated by null.
@param name the name of the Class to be found
@return the Class found, null if nothing was found
|
[
"Looks",
"up",
"a",
"class",
"by",
"name",
".",
"In",
"contrast",
"to",
"Class",
".",
"forName",
"primitive",
"classes",
"are",
"found",
"and",
"not",
"found",
"is",
"indicated",
"by",
"null",
"."
] |
a069b087750c4133bfeebaf1f599c3bc96762113
|
https://github.com/mlhartme/mork/blob/a069b087750c4133bfeebaf1f599c3bc96762113/src/main/java/net/oneandone/mork/classfile/ClassRef.java#L338-L344
|
149,816
|
mlhartme/mork
|
src/main/java/net/oneandone/mork/classfile/ClassRef.java
|
ClassRef.commonBase
|
public static Class<?> commonBase(Class<?> a, Class<?> b) {
Class<?> result;
Class<?> ifc;
if (b == null) {
throw new IllegalArgumentException();
} else if (a == null) {
return b;
} else {
result = commonSuperClass(a, b);
if (Object.class.equals(result)) {
ifc = commonInterfaces(a, b);
if (ifc != null) {
result = ifc;
}
}
return result;
}
}
|
java
|
public static Class<?> commonBase(Class<?> a, Class<?> b) {
Class<?> result;
Class<?> ifc;
if (b == null) {
throw new IllegalArgumentException();
} else if (a == null) {
return b;
} else {
result = commonSuperClass(a, b);
if (Object.class.equals(result)) {
ifc = commonInterfaces(a, b);
if (ifc != null) {
result = ifc;
}
}
return result;
}
}
|
[
"public",
"static",
"Class",
"<",
"?",
">",
"commonBase",
"(",
"Class",
"<",
"?",
">",
"a",
",",
"Class",
"<",
"?",
">",
"b",
")",
"{",
"Class",
"<",
"?",
">",
"result",
";",
"Class",
"<",
"?",
">",
"ifc",
";",
"if",
"(",
"b",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
")",
";",
"}",
"else",
"if",
"(",
"a",
"==",
"null",
")",
"{",
"return",
"b",
";",
"}",
"else",
"{",
"result",
"=",
"commonSuperClass",
"(",
"a",
",",
"b",
")",
";",
"if",
"(",
"Object",
".",
"class",
".",
"equals",
"(",
"result",
")",
")",
"{",
"ifc",
"=",
"commonInterfaces",
"(",
"a",
",",
"b",
")",
";",
"if",
"(",
"ifc",
"!=",
"null",
")",
"{",
"result",
"=",
"ifc",
";",
"}",
"}",
"return",
"result",
";",
"}",
"}"
] |
Gets the common base of two classes. Common base is the most special
class both argument are assignable to. The common base for
different primitive types is null; the common base for a primitive
type and a reference type is null.
@param a first class, may be null
@param b second class
@return the common base; b, if a == null;
|
[
"Gets",
"the",
"common",
"base",
"of",
"two",
"classes",
".",
"Common",
"base",
"is",
"the",
"most",
"special",
"class",
"both",
"argument",
"are",
"assignable",
"to",
".",
"The",
"common",
"base",
"for",
"different",
"primitive",
"types",
"is",
"null",
";",
"the",
"common",
"base",
"for",
"a",
"primitive",
"type",
"and",
"a",
"reference",
"type",
"is",
"null",
"."
] |
a069b087750c4133bfeebaf1f599c3bc96762113
|
https://github.com/mlhartme/mork/blob/a069b087750c4133bfeebaf1f599c3bc96762113/src/main/java/net/oneandone/mork/classfile/ClassRef.java#L356-L374
|
149,817
|
mlhartme/mork
|
src/main/java/net/oneandone/mork/classfile/ClassRef.java
|
ClassRef.write
|
public static void write(ObjectOutput out, Class<?> cl) throws IOException {
int dim;
if (cl == null) {
out.writeByte(-1);
} else {
dim = 0;
while (cl.isArray()) {
dim++;
cl = cl.getComponentType();
}
if (dim > Byte.MAX_VALUE) {
throw new RuntimeException("to many dimensions");
}
out.writeByte((byte) dim);
out.writeUTF(cl.getName());
}
}
|
java
|
public static void write(ObjectOutput out, Class<?> cl) throws IOException {
int dim;
if (cl == null) {
out.writeByte(-1);
} else {
dim = 0;
while (cl.isArray()) {
dim++;
cl = cl.getComponentType();
}
if (dim > Byte.MAX_VALUE) {
throw new RuntimeException("to many dimensions");
}
out.writeByte((byte) dim);
out.writeUTF(cl.getName());
}
}
|
[
"public",
"static",
"void",
"write",
"(",
"ObjectOutput",
"out",
",",
"Class",
"<",
"?",
">",
"cl",
")",
"throws",
"IOException",
"{",
"int",
"dim",
";",
"if",
"(",
"cl",
"==",
"null",
")",
"{",
"out",
".",
"writeByte",
"(",
"-",
"1",
")",
";",
"}",
"else",
"{",
"dim",
"=",
"0",
";",
"while",
"(",
"cl",
".",
"isArray",
"(",
")",
")",
"{",
"dim",
"++",
";",
"cl",
"=",
"cl",
".",
"getComponentType",
"(",
")",
";",
"}",
"if",
"(",
"dim",
">",
"Byte",
".",
"MAX_VALUE",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"\"to many dimensions\"",
")",
";",
"}",
"out",
".",
"writeByte",
"(",
"(",
"byte",
")",
"dim",
")",
";",
"out",
".",
"writeUTF",
"(",
"cl",
".",
"getName",
"(",
")",
")",
";",
"}",
"}"
] |
Writes a class Object.
@param out target to write to
@param cl class to be written
|
[
"Writes",
"a",
"class",
"Object",
"."
] |
a069b087750c4133bfeebaf1f599c3bc96762113
|
https://github.com/mlhartme/mork/blob/a069b087750c4133bfeebaf1f599c3bc96762113/src/main/java/net/oneandone/mork/classfile/ClassRef.java#L407-L426
|
149,818
|
mlhartme/mork
|
src/main/java/net/oneandone/mork/classfile/ClassRef.java
|
ClassRef.read
|
public static Class<?> read(ObjectInput in) throws java.io.IOException {
byte dim;
Class<?> cl;
String name;
dim = in.readByte();
if (dim == -1) {
return null;
} else {
name = in.readUTF();
cl = classFind(name);
if (cl == null) {
throw new RuntimeException("can't load class " + name);
}
while (dim-- > 0) {
cl = net.oneandone.sushi.util.Arrays.getArrayClass(cl);
}
return cl;
}
}
|
java
|
public static Class<?> read(ObjectInput in) throws java.io.IOException {
byte dim;
Class<?> cl;
String name;
dim = in.readByte();
if (dim == -1) {
return null;
} else {
name = in.readUTF();
cl = classFind(name);
if (cl == null) {
throw new RuntimeException("can't load class " + name);
}
while (dim-- > 0) {
cl = net.oneandone.sushi.util.Arrays.getArrayClass(cl);
}
return cl;
}
}
|
[
"public",
"static",
"Class",
"<",
"?",
">",
"read",
"(",
"ObjectInput",
"in",
")",
"throws",
"java",
".",
"io",
".",
"IOException",
"{",
"byte",
"dim",
";",
"Class",
"<",
"?",
">",
"cl",
";",
"String",
"name",
";",
"dim",
"=",
"in",
".",
"readByte",
"(",
")",
";",
"if",
"(",
"dim",
"==",
"-",
"1",
")",
"{",
"return",
"null",
";",
"}",
"else",
"{",
"name",
"=",
"in",
".",
"readUTF",
"(",
")",
";",
"cl",
"=",
"classFind",
"(",
"name",
")",
";",
"if",
"(",
"cl",
"==",
"null",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"\"can't load class \"",
"+",
"name",
")",
";",
"}",
"while",
"(",
"dim",
"--",
">",
"0",
")",
"{",
"cl",
"=",
"net",
".",
"oneandone",
".",
"sushi",
".",
"util",
".",
"Arrays",
".",
"getArrayClass",
"(",
"cl",
")",
";",
"}",
"return",
"cl",
";",
"}",
"}"
] |
Reads a class Object.
@param in source to read from
@return the Class read
|
[
"Reads",
"a",
"class",
"Object",
"."
] |
a069b087750c4133bfeebaf1f599c3bc96762113
|
https://github.com/mlhartme/mork/blob/a069b087750c4133bfeebaf1f599c3bc96762113/src/main/java/net/oneandone/mork/classfile/ClassRef.java#L433-L453
|
149,819
|
mlhartme/mork
|
src/main/java/net/oneandone/mork/classfile/ClassRef.java
|
ClassRef.writeClasses
|
public static void writeClasses(ObjectOutput out, Class<?>[] types)
throws java.io.IOException {
int i;
if (types.length > Byte.MAX_VALUE) {
throw new RuntimeException("to many dimensions");
}
out.writeByte((byte) types.length);
for (i = 0; i < types.length; i++) {
write(out, types[i]);
}
}
|
java
|
public static void writeClasses(ObjectOutput out, Class<?>[] types)
throws java.io.IOException {
int i;
if (types.length > Byte.MAX_VALUE) {
throw new RuntimeException("to many dimensions");
}
out.writeByte((byte) types.length);
for (i = 0; i < types.length; i++) {
write(out, types[i]);
}
}
|
[
"public",
"static",
"void",
"writeClasses",
"(",
"ObjectOutput",
"out",
",",
"Class",
"<",
"?",
">",
"[",
"]",
"types",
")",
"throws",
"java",
".",
"io",
".",
"IOException",
"{",
"int",
"i",
";",
"if",
"(",
"types",
".",
"length",
">",
"Byte",
".",
"MAX_VALUE",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"\"to many dimensions\"",
")",
";",
"}",
"out",
".",
"writeByte",
"(",
"(",
"byte",
")",
"types",
".",
"length",
")",
";",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"types",
".",
"length",
";",
"i",
"++",
")",
"{",
"write",
"(",
"out",
",",
"types",
"[",
"i",
"]",
")",
";",
"}",
"}"
] |
Writes an array of Class objects.
@param out target to write to
@param types Classes to be written
|
[
"Writes",
"an",
"array",
"of",
"Class",
"objects",
"."
] |
a069b087750c4133bfeebaf1f599c3bc96762113
|
https://github.com/mlhartme/mork/blob/a069b087750c4133bfeebaf1f599c3bc96762113/src/main/java/net/oneandone/mork/classfile/ClassRef.java#L460-L471
|
149,820
|
mlhartme/mork
|
src/main/java/net/oneandone/mork/classfile/ClassRef.java
|
ClassRef.readClasses
|
public static Class<?>[] readClasses(ObjectInput in)
throws java.io.IOException, ClassNotFoundException {
int i, len;
Class<?>[] result;
len = in.readByte();
result = new Class[len];
for (i = 0; i < len; i++) {
result[i] = read(in);
}
return result;
}
|
java
|
public static Class<?>[] readClasses(ObjectInput in)
throws java.io.IOException, ClassNotFoundException {
int i, len;
Class<?>[] result;
len = in.readByte();
result = new Class[len];
for (i = 0; i < len; i++) {
result[i] = read(in);
}
return result;
}
|
[
"public",
"static",
"Class",
"<",
"?",
">",
"[",
"]",
"readClasses",
"(",
"ObjectInput",
"in",
")",
"throws",
"java",
".",
"io",
".",
"IOException",
",",
"ClassNotFoundException",
"{",
"int",
"i",
",",
"len",
";",
"Class",
"<",
"?",
">",
"[",
"]",
"result",
";",
"len",
"=",
"in",
".",
"readByte",
"(",
")",
";",
"result",
"=",
"new",
"Class",
"[",
"len",
"]",
";",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"len",
";",
"i",
"++",
")",
"{",
"result",
"[",
"i",
"]",
"=",
"read",
"(",
"in",
")",
";",
"}",
"return",
"result",
";",
"}"
] |
Reads an array of Class objects.
@param in source to read from
@return the Classes read
|
[
"Reads",
"an",
"array",
"of",
"Class",
"objects",
"."
] |
a069b087750c4133bfeebaf1f599c3bc96762113
|
https://github.com/mlhartme/mork/blob/a069b087750c4133bfeebaf1f599c3bc96762113/src/main/java/net/oneandone/mork/classfile/ClassRef.java#L478-L489
|
149,821
|
mlhartme/mork
|
src/main/java/net/oneandone/mork/classfile/ClassRef.java
|
ClassRef.emitArrayNew
|
public void emitArrayNew(Code dest) {
Type typeCode;
typeCode = getTypeCode();
if (typeCode.id == T_REFERENCE) {
dest.emit(ANEWARRAY, this);
} else {
dest.emit(NEWARRAY, typeCode.id);
}
}
|
java
|
public void emitArrayNew(Code dest) {
Type typeCode;
typeCode = getTypeCode();
if (typeCode.id == T_REFERENCE) {
dest.emit(ANEWARRAY, this);
} else {
dest.emit(NEWARRAY, typeCode.id);
}
}
|
[
"public",
"void",
"emitArrayNew",
"(",
"Code",
"dest",
")",
"{",
"Type",
"typeCode",
";",
"typeCode",
"=",
"getTypeCode",
"(",
")",
";",
"if",
"(",
"typeCode",
".",
"id",
"==",
"T_REFERENCE",
")",
"{",
"dest",
".",
"emit",
"(",
"ANEWARRAY",
",",
"this",
")",
";",
"}",
"else",
"{",
"dest",
".",
"emit",
"(",
"NEWARRAY",
",",
"typeCode",
".",
"id",
")",
";",
"}",
"}"
] |
create an array with this as component type
|
[
"create",
"an",
"array",
"with",
"this",
"as",
"component",
"type"
] |
a069b087750c4133bfeebaf1f599c3bc96762113
|
https://github.com/mlhartme/mork/blob/a069b087750c4133bfeebaf1f599c3bc96762113/src/main/java/net/oneandone/mork/classfile/ClassRef.java#L536-L545
|
149,822
|
mlhartme/mork
|
src/main/java/net/oneandone/mork/classfile/ClassDef.java
|
ClassDef.write
|
public void write(Output dest) throws IOException {
int i, max;
dest.writeU2(Access.toFlags(accessFlags));
dest.writeClassRef(thisClass);
if (superClass != null) {
dest.writeClassRef(superClass);
} else {
dest.writeU2(0);
}
max = interfaces.size();
dest.writeU2(max);
for (i = 0; i < max; i++) {
dest.writeClassRef(interfaces.get(i));
}
max = fields.size();
dest.writeU2(max);
for (i = 0; i < max; i++) {
fields.get(i).write(dest);
}
max = methods.size();
dest.writeU2(max);
for (i = 0; i < max; i++) {
methods.get(i).write(dest);
}
max = attributes.size();
dest.writeU2(max);
for (i = 0; i < max; i++) {
attributes.get(i).write(dest);
}
}
|
java
|
public void write(Output dest) throws IOException {
int i, max;
dest.writeU2(Access.toFlags(accessFlags));
dest.writeClassRef(thisClass);
if (superClass != null) {
dest.writeClassRef(superClass);
} else {
dest.writeU2(0);
}
max = interfaces.size();
dest.writeU2(max);
for (i = 0; i < max; i++) {
dest.writeClassRef(interfaces.get(i));
}
max = fields.size();
dest.writeU2(max);
for (i = 0; i < max; i++) {
fields.get(i).write(dest);
}
max = methods.size();
dest.writeU2(max);
for (i = 0; i < max; i++) {
methods.get(i).write(dest);
}
max = attributes.size();
dest.writeU2(max);
for (i = 0; i < max; i++) {
attributes.get(i).write(dest);
}
}
|
[
"public",
"void",
"write",
"(",
"Output",
"dest",
")",
"throws",
"IOException",
"{",
"int",
"i",
",",
"max",
";",
"dest",
".",
"writeU2",
"(",
"Access",
".",
"toFlags",
"(",
"accessFlags",
")",
")",
";",
"dest",
".",
"writeClassRef",
"(",
"thisClass",
")",
";",
"if",
"(",
"superClass",
"!=",
"null",
")",
"{",
"dest",
".",
"writeClassRef",
"(",
"superClass",
")",
";",
"}",
"else",
"{",
"dest",
".",
"writeU2",
"(",
"0",
")",
";",
"}",
"max",
"=",
"interfaces",
".",
"size",
"(",
")",
";",
"dest",
".",
"writeU2",
"(",
"max",
")",
";",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"max",
";",
"i",
"++",
")",
"{",
"dest",
".",
"writeClassRef",
"(",
"interfaces",
".",
"get",
"(",
"i",
")",
")",
";",
"}",
"max",
"=",
"fields",
".",
"size",
"(",
")",
";",
"dest",
".",
"writeU2",
"(",
"max",
")",
";",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"max",
";",
"i",
"++",
")",
"{",
"fields",
".",
"get",
"(",
"i",
")",
".",
"write",
"(",
"dest",
")",
";",
"}",
"max",
"=",
"methods",
".",
"size",
"(",
")",
";",
"dest",
".",
"writeU2",
"(",
"max",
")",
";",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"max",
";",
"i",
"++",
")",
"{",
"methods",
".",
"get",
"(",
"i",
")",
".",
"write",
"(",
"dest",
")",
";",
"}",
"max",
"=",
"attributes",
".",
"size",
"(",
")",
";",
"dest",
".",
"writeU2",
"(",
"max",
")",
";",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"max",
";",
"i",
"++",
")",
"{",
"attributes",
".",
"get",
"(",
"i",
")",
".",
"write",
"(",
"dest",
")",
";",
"}",
"}"
] |
Write this class file to the specified output stream.
|
[
"Write",
"this",
"class",
"file",
"to",
"the",
"specified",
"output",
"stream",
"."
] |
a069b087750c4133bfeebaf1f599c3bc96762113
|
https://github.com/mlhartme/mork/blob/a069b087750c4133bfeebaf1f599c3bc96762113/src/main/java/net/oneandone/mork/classfile/ClassDef.java#L154-L185
|
149,823
|
mlhartme/mork
|
src/main/java/net/oneandone/mork/grammar/Concat.java
|
Concat.with
|
public boolean with(PrefixSet op) {
PrefixSet next;
long tmp;
Prefix l;
Prefix r;
next = new PrefixSet();
l = todo.iterator();
while (l.step()) {
r = op.iterator();
while (r.step()) {
tmp = Prefix.concat(l.data, r.data, k);
if (tmp >= firstFullValue) {
done.add(tmp);
} else {
next.add(tmp);
}
}
}
todo = next;
return todo.isEmpty();
}
|
java
|
public boolean with(PrefixSet op) {
PrefixSet next;
long tmp;
Prefix l;
Prefix r;
next = new PrefixSet();
l = todo.iterator();
while (l.step()) {
r = op.iterator();
while (r.step()) {
tmp = Prefix.concat(l.data, r.data, k);
if (tmp >= firstFullValue) {
done.add(tmp);
} else {
next.add(tmp);
}
}
}
todo = next;
return todo.isEmpty();
}
|
[
"public",
"boolean",
"with",
"(",
"PrefixSet",
"op",
")",
"{",
"PrefixSet",
"next",
";",
"long",
"tmp",
";",
"Prefix",
"l",
";",
"Prefix",
"r",
";",
"next",
"=",
"new",
"PrefixSet",
"(",
")",
";",
"l",
"=",
"todo",
".",
"iterator",
"(",
")",
";",
"while",
"(",
"l",
".",
"step",
"(",
")",
")",
"{",
"r",
"=",
"op",
".",
"iterator",
"(",
")",
";",
"while",
"(",
"r",
".",
"step",
"(",
")",
")",
"{",
"tmp",
"=",
"Prefix",
".",
"concat",
"(",
"l",
".",
"data",
",",
"r",
".",
"data",
",",
"k",
")",
";",
"if",
"(",
"tmp",
">=",
"firstFullValue",
")",
"{",
"done",
".",
"add",
"(",
"tmp",
")",
";",
"}",
"else",
"{",
"next",
".",
"add",
"(",
"tmp",
")",
";",
"}",
"}",
"}",
"todo",
"=",
"next",
";",
"return",
"todo",
".",
"isEmpty",
"(",
")",
";",
"}"
] |
true when done
|
[
"true",
"when",
"done"
] |
a069b087750c4133bfeebaf1f599c3bc96762113
|
https://github.com/mlhartme/mork/blob/a069b087750c4133bfeebaf1f599c3bc96762113/src/main/java/net/oneandone/mork/grammar/Concat.java#L42-L63
|
149,824
|
trustathsh/ifmapj
|
src/main/java/de/hshannover/f4/trust/ifmapj/extendedIdentifiers/ExtendedIdentifiers.java
|
ExtendedIdentifiers.createExtendedIdentifier
|
public static Identity createExtendedIdentifier(String namespaceUri, String namespacePrefix, String identifierName,
String attributeValue,
String administrativeDomain) {
Document doc = mDocumentBuilder.newDocument();
Element e = doc.createElementNS(namespaceUri,
namespacePrefix
+ ":" + identifierName);
if (attributeValue != null) {
e.setAttribute("name", attributeValue);
}
e.setAttribute("administrative-domain", administrativeDomain);
doc.appendChild(e);
try {
return Identifiers.createExtendedIdentity(doc);
} catch (MarshalException e1) {
IfmapJLog.error("document that contains the extended identifier can't be handled");
throw new RuntimeException(e1);
}
}
|
java
|
public static Identity createExtendedIdentifier(String namespaceUri, String namespacePrefix, String identifierName,
String attributeValue,
String administrativeDomain) {
Document doc = mDocumentBuilder.newDocument();
Element e = doc.createElementNS(namespaceUri,
namespacePrefix
+ ":" + identifierName);
if (attributeValue != null) {
e.setAttribute("name", attributeValue);
}
e.setAttribute("administrative-domain", administrativeDomain);
doc.appendChild(e);
try {
return Identifiers.createExtendedIdentity(doc);
} catch (MarshalException e1) {
IfmapJLog.error("document that contains the extended identifier can't be handled");
throw new RuntimeException(e1);
}
}
|
[
"public",
"static",
"Identity",
"createExtendedIdentifier",
"(",
"String",
"namespaceUri",
",",
"String",
"namespacePrefix",
",",
"String",
"identifierName",
",",
"String",
"attributeValue",
",",
"String",
"administrativeDomain",
")",
"{",
"Document",
"doc",
"=",
"mDocumentBuilder",
".",
"newDocument",
"(",
")",
";",
"Element",
"e",
"=",
"doc",
".",
"createElementNS",
"(",
"namespaceUri",
",",
"namespacePrefix",
"+",
"\":\"",
"+",
"identifierName",
")",
";",
"if",
"(",
"attributeValue",
"!=",
"null",
")",
"{",
"e",
".",
"setAttribute",
"(",
"\"name\"",
",",
"attributeValue",
")",
";",
"}",
"e",
".",
"setAttribute",
"(",
"\"administrative-domain\"",
",",
"administrativeDomain",
")",
";",
"doc",
".",
"appendChild",
"(",
"e",
")",
";",
"try",
"{",
"return",
"Identifiers",
".",
"createExtendedIdentity",
"(",
"doc",
")",
";",
"}",
"catch",
"(",
"MarshalException",
"e1",
")",
"{",
"IfmapJLog",
".",
"error",
"(",
"\"document that contains the extended identifier can't be handled\"",
")",
";",
"throw",
"new",
"RuntimeException",
"(",
"e1",
")",
";",
"}",
"}"
] |
Creates an Extended Identifier.
@param namespaceUri
URI of the namespace of the inner XML of the Extended Identifier
@param namespacePrefix
prefix of the namespace of the inner XML of the Extended Identifier
@param identifierName
the name value of the Extended Identifier (will be the root node of the inner XML)
@param attributeValue
a value for the attribute <i>name</i>
@param administrativeDomain
the value of the administrativeDomain attribute
@return an {@link Identity} instance encapsulating the Extended Identifier
|
[
"Creates",
"an",
"Extended",
"Identifier",
"."
] |
44ece9e95a3d2a1b7019573ba6178598a6cbdaa3
|
https://github.com/trustathsh/ifmapj/blob/44ece9e95a3d2a1b7019573ba6178598a6cbdaa3/src/main/java/de/hshannover/f4/trust/ifmapj/extendedIdentifiers/ExtendedIdentifiers.java#L93-L111
|
149,825
|
trustathsh/ifmapj
|
src/main/java/de/hshannover/f4/trust/ifmapj/extendedIdentifiers/ExtendedIdentifiers.java
|
ExtendedIdentifiers.createExtendedIdentifier
|
public static Identity createExtendedIdentifier(String namespaceUri, String namespacePrefix, String identifierName,
String attributeValue) {
return createExtendedIdentifier(namespaceUri, namespacePrefix, identifierName, attributeValue, "");
}
|
java
|
public static Identity createExtendedIdentifier(String namespaceUri, String namespacePrefix, String identifierName,
String attributeValue) {
return createExtendedIdentifier(namespaceUri, namespacePrefix, identifierName, attributeValue, "");
}
|
[
"public",
"static",
"Identity",
"createExtendedIdentifier",
"(",
"String",
"namespaceUri",
",",
"String",
"namespacePrefix",
",",
"String",
"identifierName",
",",
"String",
"attributeValue",
")",
"{",
"return",
"createExtendedIdentifier",
"(",
"namespaceUri",
",",
"namespacePrefix",
",",
"identifierName",
",",
"attributeValue",
",",
"\"\"",
")",
";",
"}"
] |
Creates an Extended Identifier; uses an empty string for the administrativeDomain attribute.
@param namespaceUri
URI of the namespace of the inner XML of the Extended Identifier
@param namespacePrefix
prefix of the namespace of the inner XML of the Extended Identifier
@param identifierName
the name value of the Extended Identifier (will be the root node of the inner XML)
@param attributeValue
a value for the attribute <i>name</i>
@return an {@link Identity} instance encapsulating the Extended Identifier
|
[
"Creates",
"an",
"Extended",
"Identifier",
";",
"uses",
"an",
"empty",
"string",
"for",
"the",
"administrativeDomain",
"attribute",
"."
] |
44ece9e95a3d2a1b7019573ba6178598a6cbdaa3
|
https://github.com/trustathsh/ifmapj/blob/44ece9e95a3d2a1b7019573ba6178598a6cbdaa3/src/main/java/de/hshannover/f4/trust/ifmapj/extendedIdentifiers/ExtendedIdentifiers.java#L126-L129
|
149,826
|
qmetric/halreader
|
src/main/java/com/qmetric/hal/reader/HalResource.java
|
HalResource.getLinkByRel
|
public Optional<Link> getLinkByRel(final String rel)
{
return Optional.ofNullable(representation.getLinkByRel(rel));
}
|
java
|
public Optional<Link> getLinkByRel(final String rel)
{
return Optional.ofNullable(representation.getLinkByRel(rel));
}
|
[
"public",
"Optional",
"<",
"Link",
">",
"getLinkByRel",
"(",
"final",
"String",
"rel",
")",
"{",
"return",
"Optional",
".",
"ofNullable",
"(",
"representation",
".",
"getLinkByRel",
"(",
"rel",
")",
")",
";",
"}"
] |
Get link.
@param rel Relation name
@return Link
|
[
"Get",
"link",
"."
] |
584167b25ac7ae0559c6e3cdd300b8a02e59b00b
|
https://github.com/qmetric/halreader/blob/584167b25ac7ae0559c6e3cdd300b8a02e59b00b/src/main/java/com/qmetric/hal/reader/HalResource.java#L49-L52
|
149,827
|
qmetric/halreader
|
src/main/java/com/qmetric/hal/reader/HalResource.java
|
HalResource.getResourcesByRel
|
public List<HalResource> getResourcesByRel(final String rel)
{
final List<? extends ReadableRepresentation> resources = representation.getResourcesByRel(rel);
return resources.stream()
.map(representation -> new HalResource(objectMapper, representation))
.collect(Collectors.toList());
}
|
java
|
public List<HalResource> getResourcesByRel(final String rel)
{
final List<? extends ReadableRepresentation> resources = representation.getResourcesByRel(rel);
return resources.stream()
.map(representation -> new HalResource(objectMapper, representation))
.collect(Collectors.toList());
}
|
[
"public",
"List",
"<",
"HalResource",
">",
"getResourcesByRel",
"(",
"final",
"String",
"rel",
")",
"{",
"final",
"List",
"<",
"?",
"extends",
"ReadableRepresentation",
">",
"resources",
"=",
"representation",
".",
"getResourcesByRel",
"(",
"rel",
")",
";",
"return",
"resources",
".",
"stream",
"(",
")",
".",
"map",
"(",
"representation",
"->",
"new",
"HalResource",
"(",
"objectMapper",
",",
"representation",
")",
")",
".",
"collect",
"(",
"Collectors",
".",
"toList",
"(",
")",
")",
";",
"}"
] |
Get embedded resources by relation
@param rel Relation name
@return Embedded resources
|
[
"Get",
"embedded",
"resources",
"by",
"relation"
] |
584167b25ac7ae0559c6e3cdd300b8a02e59b00b
|
https://github.com/qmetric/halreader/blob/584167b25ac7ae0559c6e3cdd300b8a02e59b00b/src/main/java/com/qmetric/hal/reader/HalResource.java#L71-L78
|
149,828
|
qmetric/halreader
|
src/main/java/com/qmetric/hal/reader/HalResource.java
|
HalResource.getValueAsString
|
public Optional<String> getValueAsString(final String name)
{
return Optional.ofNullable((String) representation.getValue(name, null));
}
|
java
|
public Optional<String> getValueAsString(final String name)
{
return Optional.ofNullable((String) representation.getValue(name, null));
}
|
[
"public",
"Optional",
"<",
"String",
">",
"getValueAsString",
"(",
"final",
"String",
"name",
")",
"{",
"return",
"Optional",
".",
"ofNullable",
"(",
"(",
"String",
")",
"representation",
".",
"getValue",
"(",
"name",
",",
"null",
")",
")",
";",
"}"
] |
Get property value by name.
@param name property name
@return value as string
|
[
"Get",
"property",
"value",
"by",
"name",
"."
] |
584167b25ac7ae0559c6e3cdd300b8a02e59b00b
|
https://github.com/qmetric/halreader/blob/584167b25ac7ae0559c6e3cdd300b8a02e59b00b/src/main/java/com/qmetric/hal/reader/HalResource.java#L86-L89
|
149,829
|
qmetric/halreader
|
src/main/java/com/qmetric/hal/reader/HalResource.java
|
HalResource.getResourceAsObject
|
public <T> T getResourceAsObject(final TypeToken<T> type)
{
try
{
//noinspection unchecked
return (T) objectMapper.readValue(((ContentRepresentation) getUnderlyingRepresentation()).getContent(), objectMapper.constructType(type.getType()));
}
catch (IOException e)
{
LOGGER.warn("failed to parse resource as object: {}", e.getMessage());
throw new RuntimeException(e);
}
}
|
java
|
public <T> T getResourceAsObject(final TypeToken<T> type)
{
try
{
//noinspection unchecked
return (T) objectMapper.readValue(((ContentRepresentation) getUnderlyingRepresentation()).getContent(), objectMapper.constructType(type.getType()));
}
catch (IOException e)
{
LOGGER.warn("failed to parse resource as object: {}", e.getMessage());
throw new RuntimeException(e);
}
}
|
[
"public",
"<",
"T",
">",
"T",
"getResourceAsObject",
"(",
"final",
"TypeToken",
"<",
"T",
">",
"type",
")",
"{",
"try",
"{",
"//noinspection unchecked",
"return",
"(",
"T",
")",
"objectMapper",
".",
"readValue",
"(",
"(",
"(",
"ContentRepresentation",
")",
"getUnderlyingRepresentation",
"(",
")",
")",
".",
"getContent",
"(",
")",
",",
"objectMapper",
".",
"constructType",
"(",
"type",
".",
"getType",
"(",
")",
")",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"LOGGER",
".",
"warn",
"(",
"\"failed to parse resource as object: {}\"",
",",
"e",
".",
"getMessage",
"(",
")",
")",
";",
"throw",
"new",
"RuntimeException",
"(",
"e",
")",
";",
"}",
"}"
] |
Parse root resource as an object.
@param type Type
@return Object representation as an object
|
[
"Parse",
"root",
"resource",
"as",
"an",
"object",
"."
] |
584167b25ac7ae0559c6e3cdd300b8a02e59b00b
|
https://github.com/qmetric/halreader/blob/584167b25ac7ae0559c6e3cdd300b8a02e59b00b/src/main/java/com/qmetric/hal/reader/HalResource.java#L127-L139
|
149,830
|
mlhartme/mork
|
src/main/java/net/oneandone/mork/scanner/Minimizer.java
|
Minimizer.setDistinct
|
private void setDistinct(int leftSi, int rightSi) {
IntArrayList tmp;
int pair;
int i, max;
tmp = distinct[leftSi][rightSi];
if (tmp != YES) {
distinct[leftSi][rightSi] = YES;
if (tmp != UNKNOWN) {
max = tmp.size();
for (i = 0; i < max; i++) {
pair = tmp.get(i);
setDistinct(left(pair), right(pair));
}
}
}
}
|
java
|
private void setDistinct(int leftSi, int rightSi) {
IntArrayList tmp;
int pair;
int i, max;
tmp = distinct[leftSi][rightSi];
if (tmp != YES) {
distinct[leftSi][rightSi] = YES;
if (tmp != UNKNOWN) {
max = tmp.size();
for (i = 0; i < max; i++) {
pair = tmp.get(i);
setDistinct(left(pair), right(pair));
}
}
}
}
|
[
"private",
"void",
"setDistinct",
"(",
"int",
"leftSi",
",",
"int",
"rightSi",
")",
"{",
"IntArrayList",
"tmp",
";",
"int",
"pair",
";",
"int",
"i",
",",
"max",
";",
"tmp",
"=",
"distinct",
"[",
"leftSi",
"]",
"[",
"rightSi",
"]",
";",
"if",
"(",
"tmp",
"!=",
"YES",
")",
"{",
"distinct",
"[",
"leftSi",
"]",
"[",
"rightSi",
"]",
"=",
"YES",
";",
"if",
"(",
"tmp",
"!=",
"UNKNOWN",
")",
"{",
"max",
"=",
"tmp",
".",
"size",
"(",
")",
";",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"max",
";",
"i",
"++",
")",
"{",
"pair",
"=",
"tmp",
".",
"get",
"(",
"i",
")",
";",
"setDistinct",
"(",
"left",
"(",
"pair",
")",
",",
"right",
"(",
"pair",
")",
")",
";",
"}",
"}",
"}",
"}"
] |
Mark the pair to be distinct. Recursively marks depending pairs.
|
[
"Mark",
"the",
"pair",
"to",
"be",
"distinct",
".",
"Recursively",
"marks",
"depending",
"pairs",
"."
] |
a069b087750c4133bfeebaf1f599c3bc96762113
|
https://github.com/mlhartme/mork/blob/a069b087750c4133bfeebaf1f599c3bc96762113/src/main/java/net/oneandone/mork/scanner/Minimizer.java#L237-L253
|
149,831
|
mlhartme/mork
|
src/main/java/net/oneandone/mork/reflect/Constructor.java
|
Constructor.forClass
|
public static Selection forClass(Class cl) {
java.lang.reflect.Constructor[] constrs;
int i;
List<Function> lst;
Function fn;
lst = new ArrayList<Function>();
constrs = cl.getConstructors();
for (i = 0; i < constrs.length; i++) {
fn = create(constrs[i]);
if (fn != null) {
lst.add(fn);
}
}
return new Selection(lst);
}
|
java
|
public static Selection forClass(Class cl) {
java.lang.reflect.Constructor[] constrs;
int i;
List<Function> lst;
Function fn;
lst = new ArrayList<Function>();
constrs = cl.getConstructors();
for (i = 0; i < constrs.length; i++) {
fn = create(constrs[i]);
if (fn != null) {
lst.add(fn);
}
}
return new Selection(lst);
}
|
[
"public",
"static",
"Selection",
"forClass",
"(",
"Class",
"cl",
")",
"{",
"java",
".",
"lang",
".",
"reflect",
".",
"Constructor",
"[",
"]",
"constrs",
";",
"int",
"i",
";",
"List",
"<",
"Function",
">",
"lst",
";",
"Function",
"fn",
";",
"lst",
"=",
"new",
"ArrayList",
"<",
"Function",
">",
"(",
")",
";",
"constrs",
"=",
"cl",
".",
"getConstructors",
"(",
")",
";",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"constrs",
".",
"length",
";",
"i",
"++",
")",
"{",
"fn",
"=",
"create",
"(",
"constrs",
"[",
"i",
"]",
")",
";",
"if",
"(",
"fn",
"!=",
"null",
")",
"{",
"lst",
".",
"add",
"(",
"fn",
")",
";",
"}",
"}",
"return",
"new",
"Selection",
"(",
"lst",
")",
";",
"}"
] |
Gets all valid Constructors for the specified Class.
@param cl the clase whose constructors are searched
@return all valid Constructors found.
|
[
"Gets",
"all",
"valid",
"Constructors",
"for",
"the",
"specified",
"Class",
"."
] |
a069b087750c4133bfeebaf1f599c3bc96762113
|
https://github.com/mlhartme/mork/blob/a069b087750c4133bfeebaf1f599c3bc96762113/src/main/java/net/oneandone/mork/reflect/Constructor.java#L56-L71
|
149,832
|
mlhartme/mork
|
src/main/java/net/oneandone/mork/reflect/Constructor.java
|
Constructor.invoke
|
@Override
public Object invoke(Object[] vals) throws InvocationTargetException {
try {
return constr.newInstance(vals);
} catch (InvocationTargetException | IllegalArgumentException e) {
throw e;
} catch (IllegalAccessException e) {
// runtime exception, isValid should prevent this case
throw new RuntimeException("can't access constructor");
} catch (InstantiationException e) {
// runtime excpetion, because the constructor of constructor
// has to prevent this situation.
throw new RuntimeException("can't instantiate");
}
}
|
java
|
@Override
public Object invoke(Object[] vals) throws InvocationTargetException {
try {
return constr.newInstance(vals);
} catch (InvocationTargetException | IllegalArgumentException e) {
throw e;
} catch (IllegalAccessException e) {
// runtime exception, isValid should prevent this case
throw new RuntimeException("can't access constructor");
} catch (InstantiationException e) {
// runtime excpetion, because the constructor of constructor
// has to prevent this situation.
throw new RuntimeException("can't instantiate");
}
}
|
[
"@",
"Override",
"public",
"Object",
"invoke",
"(",
"Object",
"[",
"]",
"vals",
")",
"throws",
"InvocationTargetException",
"{",
"try",
"{",
"return",
"constr",
".",
"newInstance",
"(",
"vals",
")",
";",
"}",
"catch",
"(",
"InvocationTargetException",
"|",
"IllegalArgumentException",
"e",
")",
"{",
"throw",
"e",
";",
"}",
"catch",
"(",
"IllegalAccessException",
"e",
")",
"{",
"// runtime exception, isValid should prevent this case",
"throw",
"new",
"RuntimeException",
"(",
"\"can't access constructor\"",
")",
";",
"}",
"catch",
"(",
"InstantiationException",
"e",
")",
"{",
"// runtime excpetion, because the constructor of constructor",
"// has to prevent this situation.",
"throw",
"new",
"RuntimeException",
"(",
"\"can't instantiate\"",
")",
";",
"}",
"}"
] |
Invokes the Java constructor.
@param vals arguments to the Java constructor
@return the Object returned by the Java constructor
|
[
"Invokes",
"the",
"Java",
"constructor",
"."
] |
a069b087750c4133bfeebaf1f599c3bc96762113
|
https://github.com/mlhartme/mork/blob/a069b087750c4133bfeebaf1f599c3bc96762113/src/main/java/net/oneandone/mork/reflect/Constructor.java#L136-L150
|
149,833
|
mlhartme/mork
|
src/main/java/net/oneandone/mork/reflect/Constructor.java
|
Constructor.write
|
public static void write(ObjectOutput out, java.lang.reflect.Constructor constr) throws IOException {
Class cl;
if (constr == null) {
ClassRef.write(out, null);
} else {
cl = constr.getDeclaringClass();
ClassRef.write(out, cl);
ClassRef.writeClasses(out, constr.getParameterTypes());
}
}
|
java
|
public static void write(ObjectOutput out, java.lang.reflect.Constructor constr) throws IOException {
Class cl;
if (constr == null) {
ClassRef.write(out, null);
} else {
cl = constr.getDeclaringClass();
ClassRef.write(out, cl);
ClassRef.writeClasses(out, constr.getParameterTypes());
}
}
|
[
"public",
"static",
"void",
"write",
"(",
"ObjectOutput",
"out",
",",
"java",
".",
"lang",
".",
"reflect",
".",
"Constructor",
"constr",
")",
"throws",
"IOException",
"{",
"Class",
"cl",
";",
"if",
"(",
"constr",
"==",
"null",
")",
"{",
"ClassRef",
".",
"write",
"(",
"out",
",",
"null",
")",
";",
"}",
"else",
"{",
"cl",
"=",
"constr",
".",
"getDeclaringClass",
"(",
")",
";",
"ClassRef",
".",
"write",
"(",
"out",
",",
"cl",
")",
";",
"ClassRef",
".",
"writeClasses",
"(",
"out",
",",
"constr",
".",
"getParameterTypes",
"(",
")",
")",
";",
"}",
"}"
] |
Writes a Java Constructor.
@param out target to write to
@param constr the Java Construtor to be written
|
[
"Writes",
"a",
"Java",
"Constructor",
"."
] |
a069b087750c4133bfeebaf1f599c3bc96762113
|
https://github.com/mlhartme/mork/blob/a069b087750c4133bfeebaf1f599c3bc96762113/src/main/java/net/oneandone/mork/reflect/Constructor.java#L180-L190
|
149,834
|
mlhartme/mork
|
src/main/java/net/oneandone/mork/reflect/Constructor.java
|
Constructor.read
|
public static java.lang.reflect.Constructor read(ObjectInput in) throws ClassNotFoundException, IOException, NoSuchMethodException {
Class cl;
Class[] types;
cl = ClassRef.read(in);
if (cl == null) {
return null;
} else {
types = ClassRef.readClasses(in);
return cl.getConstructor(types);
}
}
|
java
|
public static java.lang.reflect.Constructor read(ObjectInput in) throws ClassNotFoundException, IOException, NoSuchMethodException {
Class cl;
Class[] types;
cl = ClassRef.read(in);
if (cl == null) {
return null;
} else {
types = ClassRef.readClasses(in);
return cl.getConstructor(types);
}
}
|
[
"public",
"static",
"java",
".",
"lang",
".",
"reflect",
".",
"Constructor",
"read",
"(",
"ObjectInput",
"in",
")",
"throws",
"ClassNotFoundException",
",",
"IOException",
",",
"NoSuchMethodException",
"{",
"Class",
"cl",
";",
"Class",
"[",
"]",
"types",
";",
"cl",
"=",
"ClassRef",
".",
"read",
"(",
"in",
")",
";",
"if",
"(",
"cl",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"else",
"{",
"types",
"=",
"ClassRef",
".",
"readClasses",
"(",
"in",
")",
";",
"return",
"cl",
".",
"getConstructor",
"(",
"types",
")",
";",
"}",
"}"
] |
Reads a Java Constructor.
@param in source to read from
@return the Java Constructor read
|
[
"Reads",
"a",
"Java",
"Constructor",
"."
] |
a069b087750c4133bfeebaf1f599c3bc96762113
|
https://github.com/mlhartme/mork/blob/a069b087750c4133bfeebaf1f599c3bc96762113/src/main/java/net/oneandone/mork/reflect/Constructor.java#L197-L208
|
149,835
|
eurekaclinical/javautil
|
src/main/java/org/arp/javautil/sql/DatabaseMetaDataWrapper.java
|
DatabaseMetaDataWrapper.isDatabaseCompatible
|
public boolean isDatabaseCompatible(String databaseProductNameRegex, DatabaseVersion minVersion, DatabaseVersion maxVersion) throws SQLException {
readMetaDataIfNeeded();
if (!this.databaseProductName.matches(databaseProductNameRegex)) {
return false;
}
return new VersionRange(minVersion, maxVersion).isWithinRange(this.databaseVersion);
}
|
java
|
public boolean isDatabaseCompatible(String databaseProductNameRegex, DatabaseVersion minVersion, DatabaseVersion maxVersion) throws SQLException {
readMetaDataIfNeeded();
if (!this.databaseProductName.matches(databaseProductNameRegex)) {
return false;
}
return new VersionRange(minVersion, maxVersion).isWithinRange(this.databaseVersion);
}
|
[
"public",
"boolean",
"isDatabaseCompatible",
"(",
"String",
"databaseProductNameRegex",
",",
"DatabaseVersion",
"minVersion",
",",
"DatabaseVersion",
"maxVersion",
")",
"throws",
"SQLException",
"{",
"readMetaDataIfNeeded",
"(",
")",
";",
"if",
"(",
"!",
"this",
".",
"databaseProductName",
".",
"matches",
"(",
"databaseProductNameRegex",
")",
")",
"{",
"return",
"false",
";",
"}",
"return",
"new",
"VersionRange",
"(",
"minVersion",
",",
"maxVersion",
")",
".",
"isWithinRange",
"(",
"this",
".",
"databaseVersion",
")",
";",
"}"
] |
Compares database product name and version information to that reported
by the database.
@param databaseProductNameRegex a regular expression that the actual
database product name will match. Use a regular expression that is
unlikely to overlap with the product names of other database systems.
@param minVersion the expected minimum version, if any.
@param maxVersion the expected maximum version, if any.
@return whether the actual database product name and version match the
provided arguments. The database product name comparison checks whether
the actual database product name matches the provided database product
name regular expression. The min and max version comparisons are
inclusive.
@throws SQLException if an error occurs fetching metadata containing the
database product name and version from the database.
|
[
"Compares",
"database",
"product",
"name",
"and",
"version",
"information",
"to",
"that",
"reported",
"by",
"the",
"database",
"."
] |
779bbc5bf096c75f8eed4f99ca45b99c1d44df43
|
https://github.com/eurekaclinical/javautil/blob/779bbc5bf096c75f8eed4f99ca45b99c1d44df43/src/main/java/org/arp/javautil/sql/DatabaseMetaDataWrapper.java#L72-L79
|
149,836
|
eurekaclinical/javautil
|
src/main/java/org/arp/javautil/sql/DatabaseMetaDataWrapper.java
|
DatabaseMetaDataWrapper.isDriverCompatible
|
public boolean isDriverCompatible(String driverName, DriverVersion minVersion, DriverVersion maxVersion) throws SQLException {
readMetaDataIfNeeded();
if (!this.driverName.equals(driverName)) {
return false;
}
return new VersionRange(minVersion, maxVersion).isWithinRange(this.driverVersion);
}
|
java
|
public boolean isDriverCompatible(String driverName, DriverVersion minVersion, DriverVersion maxVersion) throws SQLException {
readMetaDataIfNeeded();
if (!this.driverName.equals(driverName)) {
return false;
}
return new VersionRange(minVersion, maxVersion).isWithinRange(this.driverVersion);
}
|
[
"public",
"boolean",
"isDriverCompatible",
"(",
"String",
"driverName",
",",
"DriverVersion",
"minVersion",
",",
"DriverVersion",
"maxVersion",
")",
"throws",
"SQLException",
"{",
"readMetaDataIfNeeded",
"(",
")",
";",
"if",
"(",
"!",
"this",
".",
"driverName",
".",
"equals",
"(",
"driverName",
")",
")",
"{",
"return",
"false",
";",
"}",
"return",
"new",
"VersionRange",
"(",
"minVersion",
",",
"maxVersion",
")",
".",
"isWithinRange",
"(",
"this",
".",
"driverVersion",
")",
";",
"}"
] |
Compares JDBC driver name and version information to that reported
by the driver.
@param driverName the expected driver name.
@param minVersion the expected minimum version, if any.
@param maxVersion the expected maximum version, if any.
@return whether the actual JDBC driver name and version match the
provided arguments. The min and max version comparisons are
inclusive.
@throws SQLException if an error occurs fetching metadata containing the
JDBC driver name and version from the database.
|
[
"Compares",
"JDBC",
"driver",
"name",
"and",
"version",
"information",
"to",
"that",
"reported",
"by",
"the",
"driver",
"."
] |
779bbc5bf096c75f8eed4f99ca45b99c1d44df43
|
https://github.com/eurekaclinical/javautil/blob/779bbc5bf096c75f8eed4f99ca45b99c1d44df43/src/main/java/org/arp/javautil/sql/DatabaseMetaDataWrapper.java#L95-L102
|
149,837
|
mlhartme/mork
|
examples/command/src/main/java/command/Declarations.java
|
Declarations.checkDuplicates
|
private void checkDuplicates() throws Failure {
int i;
Variable v;
String name;
for (i = 0; i < vars.length; i++) {
v = vars[i];
name = v.getName();
if (lookup(name) != v) {
throw new Failure("duplicate variable name: " + name);
}
}
}
|
java
|
private void checkDuplicates() throws Failure {
int i;
Variable v;
String name;
for (i = 0; i < vars.length; i++) {
v = vars[i];
name = v.getName();
if (lookup(name) != v) {
throw new Failure("duplicate variable name: " + name);
}
}
}
|
[
"private",
"void",
"checkDuplicates",
"(",
")",
"throws",
"Failure",
"{",
"int",
"i",
";",
"Variable",
"v",
";",
"String",
"name",
";",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"vars",
".",
"length",
";",
"i",
"++",
")",
"{",
"v",
"=",
"vars",
"[",
"i",
"]",
";",
"name",
"=",
"v",
".",
"getName",
"(",
")",
";",
"if",
"(",
"lookup",
"(",
"name",
")",
"!=",
"v",
")",
"{",
"throw",
"new",
"Failure",
"(",
"\"duplicate variable name: \"",
"+",
"name",
")",
";",
"}",
"}",
"}"
] |
Throws Failure if there are multiple variables with the same name.
|
[
"Throws",
"Failure",
"if",
"there",
"are",
"multiple",
"variables",
"with",
"the",
"same",
"name",
"."
] |
a069b087750c4133bfeebaf1f599c3bc96762113
|
https://github.com/mlhartme/mork/blob/a069b087750c4133bfeebaf1f599c3bc96762113/examples/command/src/main/java/command/Declarations.java#L14-L26
|
149,838
|
trustathsh/ifmapj
|
src/main/java/util/DateHelpers.java
|
DateHelpers.getUtcTimeAsIso8601
|
public static String getUtcTimeAsIso8601(Calendar cal) {
try {
if (cal == null) {
return DatatypeFactory.newInstance().newXMLGregorianCalendar(
new GregorianCalendar(TimeZone.getTimeZone("UTC")))
.toXMLFormat().replaceAll("\\.[0-9]{3}", "");
}
GregorianCalendar suppliedDateCalendar =
new GregorianCalendar(TimeZone.getTimeZone("UTC"));
suppliedDateCalendar.setTimeInMillis(cal.getTimeInMillis());
return DatatypeFactory.newInstance().newXMLGregorianCalendar(
suppliedDateCalendar).toXMLFormat().replaceAll("\\.[0-9]{3}", "");
} catch (DatatypeConfigurationException e) {
SimpleDateFormat xmlDateUtc = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'");
xmlDateUtc.setTimeZone(TimeZone.getTimeZone("UTC"));
return xmlDateUtc.format(Calendar.getInstance());
}
}
|
java
|
public static String getUtcTimeAsIso8601(Calendar cal) {
try {
if (cal == null) {
return DatatypeFactory.newInstance().newXMLGregorianCalendar(
new GregorianCalendar(TimeZone.getTimeZone("UTC")))
.toXMLFormat().replaceAll("\\.[0-9]{3}", "");
}
GregorianCalendar suppliedDateCalendar =
new GregorianCalendar(TimeZone.getTimeZone("UTC"));
suppliedDateCalendar.setTimeInMillis(cal.getTimeInMillis());
return DatatypeFactory.newInstance().newXMLGregorianCalendar(
suppliedDateCalendar).toXMLFormat().replaceAll("\\.[0-9]{3}", "");
} catch (DatatypeConfigurationException e) {
SimpleDateFormat xmlDateUtc = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'");
xmlDateUtc.setTimeZone(TimeZone.getTimeZone("UTC"));
return xmlDateUtc.format(Calendar.getInstance());
}
}
|
[
"public",
"static",
"String",
"getUtcTimeAsIso8601",
"(",
"Calendar",
"cal",
")",
"{",
"try",
"{",
"if",
"(",
"cal",
"==",
"null",
")",
"{",
"return",
"DatatypeFactory",
".",
"newInstance",
"(",
")",
".",
"newXMLGregorianCalendar",
"(",
"new",
"GregorianCalendar",
"(",
"TimeZone",
".",
"getTimeZone",
"(",
"\"UTC\"",
")",
")",
")",
".",
"toXMLFormat",
"(",
")",
".",
"replaceAll",
"(",
"\"\\\\.[0-9]{3}\"",
",",
"\"\"",
")",
";",
"}",
"GregorianCalendar",
"suppliedDateCalendar",
"=",
"new",
"GregorianCalendar",
"(",
"TimeZone",
".",
"getTimeZone",
"(",
"\"UTC\"",
")",
")",
";",
"suppliedDateCalendar",
".",
"setTimeInMillis",
"(",
"cal",
".",
"getTimeInMillis",
"(",
")",
")",
";",
"return",
"DatatypeFactory",
".",
"newInstance",
"(",
")",
".",
"newXMLGregorianCalendar",
"(",
"suppliedDateCalendar",
")",
".",
"toXMLFormat",
"(",
")",
".",
"replaceAll",
"(",
"\"\\\\.[0-9]{3}\"",
",",
"\"\"",
")",
";",
"}",
"catch",
"(",
"DatatypeConfigurationException",
"e",
")",
"{",
"SimpleDateFormat",
"xmlDateUtc",
"=",
"new",
"SimpleDateFormat",
"(",
"\"yyyy-MM-dd'T'HH:mm:ss'Z'\"",
")",
";",
"xmlDateUtc",
".",
"setTimeZone",
"(",
"TimeZone",
".",
"getTimeZone",
"(",
"\"UTC\"",
")",
")",
";",
"return",
"xmlDateUtc",
".",
"format",
"(",
"Calendar",
".",
"getInstance",
"(",
")",
")",
";",
"}",
"}"
] |
Formats the given Calendar to an ISO-8601 compliant string
without milliseconds.
@param cal the java.util.Calendar to convert
@return date and time as UTC ISO-8601 string representation.
|
[
"Formats",
"the",
"given",
"Calendar",
"to",
"an",
"ISO",
"-",
"8601",
"compliant",
"string",
"without",
"milliseconds",
"."
] |
44ece9e95a3d2a1b7019573ba6178598a6cbdaa3
|
https://github.com/trustathsh/ifmapj/blob/44ece9e95a3d2a1b7019573ba6178598a6cbdaa3/src/main/java/util/DateHelpers.java#L73-L92
|
149,839
|
io7m/jcanephora
|
com.io7m.jcanephora.profiler/src/main/java/com/io7m/jcanephora/profiler/JCGLProfiling.java
|
JCGLProfiling.startFrame
|
@Override
public JCGLProfilingFrameType startFrame()
{
final Frame f = this.frames[this.frame_index];
f.start();
this.frame_index = (this.frame_index + 1) % this.frames.length;
return f;
}
|
java
|
@Override
public JCGLProfilingFrameType startFrame()
{
final Frame f = this.frames[this.frame_index];
f.start();
this.frame_index = (this.frame_index + 1) % this.frames.length;
return f;
}
|
[
"@",
"Override",
"public",
"JCGLProfilingFrameType",
"startFrame",
"(",
")",
"{",
"final",
"Frame",
"f",
"=",
"this",
".",
"frames",
"[",
"this",
".",
"frame_index",
"]",
";",
"f",
".",
"start",
"(",
")",
";",
"this",
".",
"frame_index",
"=",
"(",
"this",
".",
"frame_index",
"+",
"1",
")",
"%",
"this",
".",
"frames",
".",
"length",
";",
"return",
"f",
";",
"}"
] |
Start rendering a frame.
@return A new frame
|
[
"Start",
"rendering",
"a",
"frame",
"."
] |
0004c1744b7f0969841d04cd4fa693f402b10980
|
https://github.com/io7m/jcanephora/blob/0004c1744b7f0969841d04cd4fa693f402b10980/com.io7m.jcanephora.profiler/src/main/java/com/io7m/jcanephora/profiler/JCGLProfiling.java#L78-L85
|
149,840
|
io7m/jcanephora
|
com.io7m.jcanephora.profiler/src/main/java/com/io7m/jcanephora/profiler/JCGLProfiling.java
|
JCGLProfiling.trimContexts
|
@Override
public void trimContexts()
{
for (int index = 0; index < this.frames.length; ++index) {
final Frame f = this.frames[index];
f.trimRecursive();
}
this.frame_index = 0;
}
|
java
|
@Override
public void trimContexts()
{
for (int index = 0; index < this.frames.length; ++index) {
final Frame f = this.frames[index];
f.trimRecursive();
}
this.frame_index = 0;
}
|
[
"@",
"Override",
"public",
"void",
"trimContexts",
"(",
")",
"{",
"for",
"(",
"int",
"index",
"=",
"0",
";",
"index",
"<",
"this",
".",
"frames",
".",
"length",
";",
"++",
"index",
")",
"{",
"final",
"Frame",
"f",
"=",
"this",
".",
"frames",
"[",
"index",
"]",
";",
"f",
".",
"trimRecursive",
"(",
")",
";",
"}",
"this",
".",
"frame_index",
"=",
"0",
";",
"}"
] |
Trim any cached internal storage.
This is primarily useful because implementations are expected to reuse a
lot of data structures internally (because the graph of renderers and
filters being profiled rarely changes).
|
[
"Trim",
"any",
"cached",
"internal",
"storage",
"."
] |
0004c1744b7f0969841d04cd4fa693f402b10980
|
https://github.com/io7m/jcanephora/blob/0004c1744b7f0969841d04cd4fa693f402b10980/com.io7m.jcanephora.profiler/src/main/java/com/io7m/jcanephora/profiler/JCGLProfiling.java#L94-L103
|
149,841
|
mlhartme/mork
|
src/main/java/net/oneandone/mork/classfile/Code.java
|
Code.layout
|
private void layout(Output dest) {
Instruction instr;
int instrSize, varSize;
IntArrayList vars; // indexes of instructions with variable length
IntArrayList lens; // lengths of var-len instructions
int i, j, k, ofs;
int shrink, len;
boolean changes;
instrSize = instructions.size();
vars = new IntArrayList();
lens = new IntArrayList();
ofs = 0;
for (i = 0; i < instrSize; i++) {
instr = instructions.get(i);
instr.ofs = ofs;
len = instr.getMaxLength(dest);
ofs += len;
if (instr.type.isVariable()) {
vars.add(i);
lens.add(len);
}
}
codeSize = ofs;
varSize = vars.size();
do {
changes = false;
shrink = 0;
for (i = 0; i < varSize; i++) {
j = vars.get(i);
instr = instructions.get(j);
len = instr.getVariableLength(this);
if (len < lens.get(i)) {
changes = true;
shrink += (lens.get(i) - len);
lens.set(i, len);
}
if (shrink > 0) {
// relocate up to end or next var-instr
for (k = (i + 1 == varSize)? instrSize - 1 : vars.get(i + 1); k > j; k--) {
instructions.get(k).ofs -= shrink;
}
}
}
codeSize -= shrink;
} while (changes);
}
|
java
|
private void layout(Output dest) {
Instruction instr;
int instrSize, varSize;
IntArrayList vars; // indexes of instructions with variable length
IntArrayList lens; // lengths of var-len instructions
int i, j, k, ofs;
int shrink, len;
boolean changes;
instrSize = instructions.size();
vars = new IntArrayList();
lens = new IntArrayList();
ofs = 0;
for (i = 0; i < instrSize; i++) {
instr = instructions.get(i);
instr.ofs = ofs;
len = instr.getMaxLength(dest);
ofs += len;
if (instr.type.isVariable()) {
vars.add(i);
lens.add(len);
}
}
codeSize = ofs;
varSize = vars.size();
do {
changes = false;
shrink = 0;
for (i = 0; i < varSize; i++) {
j = vars.get(i);
instr = instructions.get(j);
len = instr.getVariableLength(this);
if (len < lens.get(i)) {
changes = true;
shrink += (lens.get(i) - len);
lens.set(i, len);
}
if (shrink > 0) {
// relocate up to end or next var-instr
for (k = (i + 1 == varSize)? instrSize - 1 : vars.get(i + 1); k > j; k--) {
instructions.get(k).ofs -= shrink;
}
}
}
codeSize -= shrink;
} while (changes);
}
|
[
"private",
"void",
"layout",
"(",
"Output",
"dest",
")",
"{",
"Instruction",
"instr",
";",
"int",
"instrSize",
",",
"varSize",
";",
"IntArrayList",
"vars",
";",
"// indexes of instructions with variable length",
"IntArrayList",
"lens",
";",
"// lengths of var-len instructions",
"int",
"i",
",",
"j",
",",
"k",
",",
"ofs",
";",
"int",
"shrink",
",",
"len",
";",
"boolean",
"changes",
";",
"instrSize",
"=",
"instructions",
".",
"size",
"(",
")",
";",
"vars",
"=",
"new",
"IntArrayList",
"(",
")",
";",
"lens",
"=",
"new",
"IntArrayList",
"(",
")",
";",
"ofs",
"=",
"0",
";",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"instrSize",
";",
"i",
"++",
")",
"{",
"instr",
"=",
"instructions",
".",
"get",
"(",
"i",
")",
";",
"instr",
".",
"ofs",
"=",
"ofs",
";",
"len",
"=",
"instr",
".",
"getMaxLength",
"(",
"dest",
")",
";",
"ofs",
"+=",
"len",
";",
"if",
"(",
"instr",
".",
"type",
".",
"isVariable",
"(",
")",
")",
"{",
"vars",
".",
"add",
"(",
"i",
")",
";",
"lens",
".",
"add",
"(",
"len",
")",
";",
"}",
"}",
"codeSize",
"=",
"ofs",
";",
"varSize",
"=",
"vars",
".",
"size",
"(",
")",
";",
"do",
"{",
"changes",
"=",
"false",
";",
"shrink",
"=",
"0",
";",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"varSize",
";",
"i",
"++",
")",
"{",
"j",
"=",
"vars",
".",
"get",
"(",
"i",
")",
";",
"instr",
"=",
"instructions",
".",
"get",
"(",
"j",
")",
";",
"len",
"=",
"instr",
".",
"getVariableLength",
"(",
"this",
")",
";",
"if",
"(",
"len",
"<",
"lens",
".",
"get",
"(",
"i",
")",
")",
"{",
"changes",
"=",
"true",
";",
"shrink",
"+=",
"(",
"lens",
".",
"get",
"(",
"i",
")",
"-",
"len",
")",
";",
"lens",
".",
"set",
"(",
"i",
",",
"len",
")",
";",
"}",
"if",
"(",
"shrink",
">",
"0",
")",
"{",
"// relocate up to end or next var-instr",
"for",
"(",
"k",
"=",
"(",
"i",
"+",
"1",
"==",
"varSize",
")",
"?",
"instrSize",
"-",
"1",
":",
"vars",
".",
"get",
"(",
"i",
"+",
"1",
")",
";",
"k",
">",
"j",
";",
"k",
"--",
")",
"{",
"instructions",
".",
"get",
"(",
"k",
")",
".",
"ofs",
"-=",
"shrink",
";",
"}",
"}",
"}",
"codeSize",
"-=",
"shrink",
";",
"}",
"while",
"(",
"changes",
")",
";",
"}"
] |
compute ofs for all instructions.
|
[
"compute",
"ofs",
"for",
"all",
"instructions",
"."
] |
a069b087750c4133bfeebaf1f599c3bc96762113
|
https://github.com/mlhartme/mork/blob/a069b087750c4133bfeebaf1f599c3bc96762113/src/main/java/net/oneandone/mork/classfile/Code.java#L162-L208
|
149,842
|
mlhartme/mork
|
src/main/java/net/oneandone/mork/classfile/Code.java
|
Code.resolveLabel
|
public int resolveLabel(int idx) {
int trueIdx;
if (idx < 0) {
trueIdx = labels.get(-idx);
if (trueIdx < 0) {
throw new RuntimeException("undefined label: " + idx);
}
return trueIdx;
} else {
return idx;
}
}
|
java
|
public int resolveLabel(int idx) {
int trueIdx;
if (idx < 0) {
trueIdx = labels.get(-idx);
if (trueIdx < 0) {
throw new RuntimeException("undefined label: " + idx);
}
return trueIdx;
} else {
return idx;
}
}
|
[
"public",
"int",
"resolveLabel",
"(",
"int",
"idx",
")",
"{",
"int",
"trueIdx",
";",
"if",
"(",
"idx",
"<",
"0",
")",
"{",
"trueIdx",
"=",
"labels",
".",
"get",
"(",
"-",
"idx",
")",
";",
"if",
"(",
"trueIdx",
"<",
"0",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"\"undefined label: \"",
"+",
"idx",
")",
";",
"}",
"return",
"trueIdx",
";",
"}",
"else",
"{",
"return",
"idx",
";",
"}",
"}"
] |
a forward reference is first declared and then defined
|
[
"a",
"forward",
"reference",
"is",
"first",
"declared",
"and",
"then",
"defined"
] |
a069b087750c4133bfeebaf1f599c3bc96762113
|
https://github.com/mlhartme/mork/blob/a069b087750c4133bfeebaf1f599c3bc96762113/src/main/java/net/oneandone/mork/classfile/Code.java#L267-L279
|
149,843
|
mlhartme/mork
|
src/main/java/net/oneandone/mork/classfile/Code.java
|
Code.emitGeneric
|
public void emitGeneric(int opcode, Object[] args) {
Instruction instr;
InstructionType type;
type = Set.TYPES[opcode];
instr = new Instruction(-1, type, args);
instructions.add(instr);
}
|
java
|
public void emitGeneric(int opcode, Object[] args) {
Instruction instr;
InstructionType type;
type = Set.TYPES[opcode];
instr = new Instruction(-1, type, args);
instructions.add(instr);
}
|
[
"public",
"void",
"emitGeneric",
"(",
"int",
"opcode",
",",
"Object",
"[",
"]",
"args",
")",
"{",
"Instruction",
"instr",
";",
"InstructionType",
"type",
";",
"type",
"=",
"Set",
".",
"TYPES",
"[",
"opcode",
"]",
";",
"instr",
"=",
"new",
"Instruction",
"(",
"-",
"1",
",",
"type",
",",
"args",
")",
";",
"instructions",
".",
"add",
"(",
"instr",
")",
";",
"}"
] |
pc is increased by 1.
|
[
"pc",
"is",
"increased",
"by",
"1",
"."
] |
a069b087750c4133bfeebaf1f599c3bc96762113
|
https://github.com/mlhartme/mork/blob/a069b087750c4133bfeebaf1f599c3bc96762113/src/main/java/net/oneandone/mork/classfile/Code.java#L330-L337
|
149,844
|
mlhartme/mork
|
src/main/java/net/oneandone/mork/classfile/Code.java
|
Code.calcStackSize
|
private int calcStackSize() {
int i, max;
int result;
int[] startStack;
ExceptionInfo e;
int tmp;
int unreachable;
IntBitSet todo;
List<Jsr> jsrs;
jsrs = Jsr.findJsrs(this);
startStack = new int[instructions.size()];
for (i = 0; i < startStack.length; i++) {
startStack[i] = -1;
}
startStack[0] = 0;
todo = new IntBitSet();
todo.add(0);
max = exceptions.size();
for (i = 0; i < max; i++) {
e = exceptions.get(i);
startStack[e.handler] = 1;
todo.add(e.handler);
}
fillStack(jsrs, todo, startStack);
result = 0;
unreachable = -1;
for (i = 0; i < startStack.length; i++) {
tmp = startStack[i];
if (tmp > result) {
result = tmp;
}
if ((unreachable == -1) && (tmp == -1)) {
unreachable = i;
}
}
if (unreachable != -1) {
// There are several class file in Sun JDK 1.3 with dead
// code, and they pass class file validation:
// (e.g. com.sun.corba.se.intneral.io.util.Arrays)
LOGGER.warning("unreachable code, starting " + unreachable + "\n");
}
return result;
}
|
java
|
private int calcStackSize() {
int i, max;
int result;
int[] startStack;
ExceptionInfo e;
int tmp;
int unreachable;
IntBitSet todo;
List<Jsr> jsrs;
jsrs = Jsr.findJsrs(this);
startStack = new int[instructions.size()];
for (i = 0; i < startStack.length; i++) {
startStack[i] = -1;
}
startStack[0] = 0;
todo = new IntBitSet();
todo.add(0);
max = exceptions.size();
for (i = 0; i < max; i++) {
e = exceptions.get(i);
startStack[e.handler] = 1;
todo.add(e.handler);
}
fillStack(jsrs, todo, startStack);
result = 0;
unreachable = -1;
for (i = 0; i < startStack.length; i++) {
tmp = startStack[i];
if (tmp > result) {
result = tmp;
}
if ((unreachable == -1) && (tmp == -1)) {
unreachable = i;
}
}
if (unreachable != -1) {
// There are several class file in Sun JDK 1.3 with dead
// code, and they pass class file validation:
// (e.g. com.sun.corba.se.intneral.io.util.Arrays)
LOGGER.warning("unreachable code, starting " + unreachable + "\n");
}
return result;
}
|
[
"private",
"int",
"calcStackSize",
"(",
")",
"{",
"int",
"i",
",",
"max",
";",
"int",
"result",
";",
"int",
"[",
"]",
"startStack",
";",
"ExceptionInfo",
"e",
";",
"int",
"tmp",
";",
"int",
"unreachable",
";",
"IntBitSet",
"todo",
";",
"List",
"<",
"Jsr",
">",
"jsrs",
";",
"jsrs",
"=",
"Jsr",
".",
"findJsrs",
"(",
"this",
")",
";",
"startStack",
"=",
"new",
"int",
"[",
"instructions",
".",
"size",
"(",
")",
"]",
";",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"startStack",
".",
"length",
";",
"i",
"++",
")",
"{",
"startStack",
"[",
"i",
"]",
"=",
"-",
"1",
";",
"}",
"startStack",
"[",
"0",
"]",
"=",
"0",
";",
"todo",
"=",
"new",
"IntBitSet",
"(",
")",
";",
"todo",
".",
"add",
"(",
"0",
")",
";",
"max",
"=",
"exceptions",
".",
"size",
"(",
")",
";",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"max",
";",
"i",
"++",
")",
"{",
"e",
"=",
"exceptions",
".",
"get",
"(",
"i",
")",
";",
"startStack",
"[",
"e",
".",
"handler",
"]",
"=",
"1",
";",
"todo",
".",
"add",
"(",
"e",
".",
"handler",
")",
";",
"}",
"fillStack",
"(",
"jsrs",
",",
"todo",
",",
"startStack",
")",
";",
"result",
"=",
"0",
";",
"unreachable",
"=",
"-",
"1",
";",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"startStack",
".",
"length",
";",
"i",
"++",
")",
"{",
"tmp",
"=",
"startStack",
"[",
"i",
"]",
";",
"if",
"(",
"tmp",
">",
"result",
")",
"{",
"result",
"=",
"tmp",
";",
"}",
"if",
"(",
"(",
"unreachable",
"==",
"-",
"1",
")",
"&&",
"(",
"tmp",
"==",
"-",
"1",
")",
")",
"{",
"unreachable",
"=",
"i",
";",
"}",
"}",
"if",
"(",
"unreachable",
"!=",
"-",
"1",
")",
"{",
"// There are several class file in Sun JDK 1.3 with dead",
"// code, and they pass class file validation:",
"// (e.g. com.sun.corba.se.intneral.io.util.Arrays)",
"LOGGER",
".",
"warning",
"(",
"\"unreachable code, starting \"",
"+",
"unreachable",
"+",
"\"\\n\"",
")",
";",
"}",
"return",
"result",
";",
"}"
] |
computed the stack size
|
[
"computed",
"the",
"stack",
"size"
] |
a069b087750c4133bfeebaf1f599c3bc96762113
|
https://github.com/mlhartme/mork/blob/a069b087750c4133bfeebaf1f599c3bc96762113/src/main/java/net/oneandone/mork/classfile/Code.java#L431-L477
|
149,845
|
seedstack/jms-addon
|
src/main/java/org/seedstack/jms/internal/JmsPlugin.java
|
JmsPlugin.registerConnection
|
public void registerConnection(Connection connection, ConnectionDefinition connectionDefinition) {
checkNotNull(connection);
checkNotNull(connectionDefinition);
if (this.connectionDefinitions.putIfAbsent(connectionDefinition.getName(), connectionDefinition) != null) {
throw SeedException.createNew(JmsErrorCode.DUPLICATE_CONNECTION_NAME).put(ERROR_CONNECTION_NAME, connectionDefinition.getName());
}
if (this.connections.putIfAbsent(connectionDefinition.getName(), connection) != null) {
throw SeedException.createNew(JmsErrorCode.DUPLICATE_CONNECTION_NAME).put(ERROR_CONNECTION_NAME, connectionDefinition.getName());
}
if (shouldStartConnections.get()) {
try {
connection.start();
} catch (JMSException e) {
throw SeedException.wrap(e, JmsErrorCode.UNABLE_TO_START_JMS_CONNECTION).put(ERROR_CONNECTION_NAME, connectionDefinition.getName());
}
}
}
|
java
|
public void registerConnection(Connection connection, ConnectionDefinition connectionDefinition) {
checkNotNull(connection);
checkNotNull(connectionDefinition);
if (this.connectionDefinitions.putIfAbsent(connectionDefinition.getName(), connectionDefinition) != null) {
throw SeedException.createNew(JmsErrorCode.DUPLICATE_CONNECTION_NAME).put(ERROR_CONNECTION_NAME, connectionDefinition.getName());
}
if (this.connections.putIfAbsent(connectionDefinition.getName(), connection) != null) {
throw SeedException.createNew(JmsErrorCode.DUPLICATE_CONNECTION_NAME).put(ERROR_CONNECTION_NAME, connectionDefinition.getName());
}
if (shouldStartConnections.get()) {
try {
connection.start();
} catch (JMSException e) {
throw SeedException.wrap(e, JmsErrorCode.UNABLE_TO_START_JMS_CONNECTION).put(ERROR_CONNECTION_NAME, connectionDefinition.getName());
}
}
}
|
[
"public",
"void",
"registerConnection",
"(",
"Connection",
"connection",
",",
"ConnectionDefinition",
"connectionDefinition",
")",
"{",
"checkNotNull",
"(",
"connection",
")",
";",
"checkNotNull",
"(",
"connectionDefinition",
")",
";",
"if",
"(",
"this",
".",
"connectionDefinitions",
".",
"putIfAbsent",
"(",
"connectionDefinition",
".",
"getName",
"(",
")",
",",
"connectionDefinition",
")",
"!=",
"null",
")",
"{",
"throw",
"SeedException",
".",
"createNew",
"(",
"JmsErrorCode",
".",
"DUPLICATE_CONNECTION_NAME",
")",
".",
"put",
"(",
"ERROR_CONNECTION_NAME",
",",
"connectionDefinition",
".",
"getName",
"(",
")",
")",
";",
"}",
"if",
"(",
"this",
".",
"connections",
".",
"putIfAbsent",
"(",
"connectionDefinition",
".",
"getName",
"(",
")",
",",
"connection",
")",
"!=",
"null",
")",
"{",
"throw",
"SeedException",
".",
"createNew",
"(",
"JmsErrorCode",
".",
"DUPLICATE_CONNECTION_NAME",
")",
".",
"put",
"(",
"ERROR_CONNECTION_NAME",
",",
"connectionDefinition",
".",
"getName",
"(",
")",
")",
";",
"}",
"if",
"(",
"shouldStartConnections",
".",
"get",
"(",
")",
")",
"{",
"try",
"{",
"connection",
".",
"start",
"(",
")",
";",
"}",
"catch",
"(",
"JMSException",
"e",
")",
"{",
"throw",
"SeedException",
".",
"wrap",
"(",
"e",
",",
"JmsErrorCode",
".",
"UNABLE_TO_START_JMS_CONNECTION",
")",
".",
"put",
"(",
"ERROR_CONNECTION_NAME",
",",
"connectionDefinition",
".",
"getName",
"(",
")",
")",
";",
"}",
"}",
"}"
] |
Register an existing JMS connection to be managed by the JMS plugin.
@param connection the connection.
@param connectionDefinition the connection definition.
|
[
"Register",
"an",
"existing",
"JMS",
"connection",
"to",
"be",
"managed",
"by",
"the",
"JMS",
"plugin",
"."
] |
d6014811daaac29f591b32bfd2358500fb25d804
|
https://github.com/seedstack/jms-addon/blob/d6014811daaac29f591b32bfd2358500fb25d804/src/main/java/org/seedstack/jms/internal/JmsPlugin.java#L299-L318
|
149,846
|
seedstack/jms-addon
|
src/main/java/org/seedstack/jms/internal/JmsPlugin.java
|
JmsPlugin.registerMessageListener
|
public void registerMessageListener(MessageListenerDefinition messageListenerDefinition) {
checkNotNull(messageListenerDefinition);
ConnectionDefinition connectionDefinition = connectionDefinitions.get(messageListenerDefinition.getConnectionName());
if (connectionDefinition.isJeeMode() && messageListenerDefinition.getPoller() == null) {
throw SeedException.createNew(JmsErrorCode.MESSAGE_POLLER_REQUIRED_IN_JEE_MODE)
.put(ERROR_CONNECTION_NAME, connectionDefinition.getName())
.put(ERROR_MESSAGE_LISTENER_NAME, messageListenerDefinition.getName());
}
try {
createMessageConsumer(messageListenerDefinition);
} catch (JMSException e) {
throw SeedException.wrap(e, JmsErrorCode.UNABLE_TO_CREATE_MESSAGE_CONSUMER)
.put(ERROR_MESSAGE_LISTENER_NAME, messageListenerDefinition.getName());
}
if (messageListenerDefinitions.putIfAbsent(messageListenerDefinition.getName(), messageListenerDefinition) != null) {
throw SeedException.createNew(JmsErrorCode.DUPLICATE_MESSAGE_LISTENER_NAME)
.put(ERROR_MESSAGE_LISTENER_NAME, messageListenerDefinition.getName());
}
}
|
java
|
public void registerMessageListener(MessageListenerDefinition messageListenerDefinition) {
checkNotNull(messageListenerDefinition);
ConnectionDefinition connectionDefinition = connectionDefinitions.get(messageListenerDefinition.getConnectionName());
if (connectionDefinition.isJeeMode() && messageListenerDefinition.getPoller() == null) {
throw SeedException.createNew(JmsErrorCode.MESSAGE_POLLER_REQUIRED_IN_JEE_MODE)
.put(ERROR_CONNECTION_NAME, connectionDefinition.getName())
.put(ERROR_MESSAGE_LISTENER_NAME, messageListenerDefinition.getName());
}
try {
createMessageConsumer(messageListenerDefinition);
} catch (JMSException e) {
throw SeedException.wrap(e, JmsErrorCode.UNABLE_TO_CREATE_MESSAGE_CONSUMER)
.put(ERROR_MESSAGE_LISTENER_NAME, messageListenerDefinition.getName());
}
if (messageListenerDefinitions.putIfAbsent(messageListenerDefinition.getName(), messageListenerDefinition) != null) {
throw SeedException.createNew(JmsErrorCode.DUPLICATE_MESSAGE_LISTENER_NAME)
.put(ERROR_MESSAGE_LISTENER_NAME, messageListenerDefinition.getName());
}
}
|
[
"public",
"void",
"registerMessageListener",
"(",
"MessageListenerDefinition",
"messageListenerDefinition",
")",
"{",
"checkNotNull",
"(",
"messageListenerDefinition",
")",
";",
"ConnectionDefinition",
"connectionDefinition",
"=",
"connectionDefinitions",
".",
"get",
"(",
"messageListenerDefinition",
".",
"getConnectionName",
"(",
")",
")",
";",
"if",
"(",
"connectionDefinition",
".",
"isJeeMode",
"(",
")",
"&&",
"messageListenerDefinition",
".",
"getPoller",
"(",
")",
"==",
"null",
")",
"{",
"throw",
"SeedException",
".",
"createNew",
"(",
"JmsErrorCode",
".",
"MESSAGE_POLLER_REQUIRED_IN_JEE_MODE",
")",
".",
"put",
"(",
"ERROR_CONNECTION_NAME",
",",
"connectionDefinition",
".",
"getName",
"(",
")",
")",
".",
"put",
"(",
"ERROR_MESSAGE_LISTENER_NAME",
",",
"messageListenerDefinition",
".",
"getName",
"(",
")",
")",
";",
"}",
"try",
"{",
"createMessageConsumer",
"(",
"messageListenerDefinition",
")",
";",
"}",
"catch",
"(",
"JMSException",
"e",
")",
"{",
"throw",
"SeedException",
".",
"wrap",
"(",
"e",
",",
"JmsErrorCode",
".",
"UNABLE_TO_CREATE_MESSAGE_CONSUMER",
")",
".",
"put",
"(",
"ERROR_MESSAGE_LISTENER_NAME",
",",
"messageListenerDefinition",
".",
"getName",
"(",
")",
")",
";",
"}",
"if",
"(",
"messageListenerDefinitions",
".",
"putIfAbsent",
"(",
"messageListenerDefinition",
".",
"getName",
"(",
")",
",",
"messageListenerDefinition",
")",
"!=",
"null",
")",
"{",
"throw",
"SeedException",
".",
"createNew",
"(",
"JmsErrorCode",
".",
"DUPLICATE_MESSAGE_LISTENER_NAME",
")",
".",
"put",
"(",
"ERROR_MESSAGE_LISTENER_NAME",
",",
"messageListenerDefinition",
".",
"getName",
"(",
")",
")",
";",
"}",
"}"
] |
Register a message listener definition to be managed by the JMS plugin.
@param messageListenerDefinition the message listener definition.
|
[
"Register",
"a",
"message",
"listener",
"definition",
"to",
"be",
"managed",
"by",
"the",
"JMS",
"plugin",
"."
] |
d6014811daaac29f591b32bfd2358500fb25d804
|
https://github.com/seedstack/jms-addon/blob/d6014811daaac29f591b32bfd2358500fb25d804/src/main/java/org/seedstack/jms/internal/JmsPlugin.java#L325-L346
|
149,847
|
lukas-krecan/lambda-param-name-extractor
|
src/main/java/net/javacrumbs/lambdaextractor/ParameterNameExtractor.java
|
ParameterNameExtractor.extractParameterNames
|
public static List<String> extractParameterNames(Serializable lambda, int lambdaParametersCount) {
SerializedLambda serializedLambda = serialized(lambda);
Method lambdaMethod = lambdaMethod(serializedLambda);
String[] paramNames = paramNameReader.getParamNames(lambdaMethod);
return asList(Arrays.copyOfRange(paramNames, paramNames.length - lambdaParametersCount, paramNames.length));
}
|
java
|
public static List<String> extractParameterNames(Serializable lambda, int lambdaParametersCount) {
SerializedLambda serializedLambda = serialized(lambda);
Method lambdaMethod = lambdaMethod(serializedLambda);
String[] paramNames = paramNameReader.getParamNames(lambdaMethod);
return asList(Arrays.copyOfRange(paramNames, paramNames.length - lambdaParametersCount, paramNames.length));
}
|
[
"public",
"static",
"List",
"<",
"String",
">",
"extractParameterNames",
"(",
"Serializable",
"lambda",
",",
"int",
"lambdaParametersCount",
")",
"{",
"SerializedLambda",
"serializedLambda",
"=",
"serialized",
"(",
"lambda",
")",
";",
"Method",
"lambdaMethod",
"=",
"lambdaMethod",
"(",
"serializedLambda",
")",
";",
"String",
"[",
"]",
"paramNames",
"=",
"paramNameReader",
".",
"getParamNames",
"(",
"lambdaMethod",
")",
";",
"return",
"asList",
"(",
"Arrays",
".",
"copyOfRange",
"(",
"paramNames",
",",
"paramNames",
".",
"length",
"-",
"lambdaParametersCount",
",",
"paramNames",
".",
"length",
")",
")",
";",
"}"
] |
Extracts names of a serializable lambda parameters
@param lambda Serializable lambda
@param lambdaParametersCount number of lambda parameters
|
[
"Extracts",
"names",
"of",
"a",
"serializable",
"lambda",
"parameters"
] |
dec73479df14797771c8ec92819577f32a679362
|
https://github.com/lukas-krecan/lambda-param-name-extractor/blob/dec73479df14797771c8ec92819577f32a679362/src/main/java/net/javacrumbs/lambdaextractor/ParameterNameExtractor.java#L47-L53
|
149,848
|
Metrink/croquet
|
croquet-core/src/main/java/com/metrink/croquet/AbstractSettings.java
|
AbstractSettings.initialize
|
protected final void initialize() {
// Enabling development mode forces these settings. This is somewhat inelegant, because to configure one of
// these values differently will require disabling development mode and manually configure the remaining values.
if (development) {
loggingSettings.getLoggers().put("org.hibernate.SQL", Level.DEBUG);
loggingSettings.getLoggers().put("com.metrink.croquet", Level.DEBUG);
}
// call the class's init method
init();
}
|
java
|
protected final void initialize() {
// Enabling development mode forces these settings. This is somewhat inelegant, because to configure one of
// these values differently will require disabling development mode and manually configure the remaining values.
if (development) {
loggingSettings.getLoggers().put("org.hibernate.SQL", Level.DEBUG);
loggingSettings.getLoggers().put("com.metrink.croquet", Level.DEBUG);
}
// call the class's init method
init();
}
|
[
"protected",
"final",
"void",
"initialize",
"(",
")",
"{",
"// Enabling development mode forces these settings. This is somewhat inelegant, because to configure one of",
"// these values differently will require disabling development mode and manually configure the remaining values.",
"if",
"(",
"development",
")",
"{",
"loggingSettings",
".",
"getLoggers",
"(",
")",
".",
"put",
"(",
"\"org.hibernate.SQL\"",
",",
"Level",
".",
"DEBUG",
")",
";",
"loggingSettings",
".",
"getLoggers",
"(",
")",
".",
"put",
"(",
"\"com.metrink.croquet\"",
",",
"Level",
".",
"DEBUG",
")",
";",
"}",
"// call the class's init method",
"init",
"(",
")",
";",
"}"
] |
Perform post de-serialization modification of the Settings.
|
[
"Perform",
"post",
"de",
"-",
"serialization",
"modification",
"of",
"the",
"Settings",
"."
] |
1b0ed1327a104cf1f809ce4c3c5bf30a3d95384b
|
https://github.com/Metrink/croquet/blob/1b0ed1327a104cf1f809ce4c3c5bf30a3d95384b/croquet-core/src/main/java/com/metrink/croquet/AbstractSettings.java#L40-L50
|
149,849
|
Metrink/croquet
|
croquet-core/src/main/java/com/metrink/croquet/AbstractSettings.java
|
AbstractSettings.getClassOrDefault
|
@SuppressWarnings("unchecked")
protected <T> Class<T> getClassOrDefault(final String className, final Class<T> defaultResult) {
try {
return className == null
? defaultResult
: (Class<T>)Class.forName(className);
} catch (final ClassNotFoundException e) {
LOG.error("ClassNotFoundException for {} - defaulting to {}", className, defaultResult);
return defaultResult;
}
}
|
java
|
@SuppressWarnings("unchecked")
protected <T> Class<T> getClassOrDefault(final String className, final Class<T> defaultResult) {
try {
return className == null
? defaultResult
: (Class<T>)Class.forName(className);
} catch (final ClassNotFoundException e) {
LOG.error("ClassNotFoundException for {} - defaulting to {}", className, defaultResult);
return defaultResult;
}
}
|
[
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"protected",
"<",
"T",
">",
"Class",
"<",
"T",
">",
"getClassOrDefault",
"(",
"final",
"String",
"className",
",",
"final",
"Class",
"<",
"T",
">",
"defaultResult",
")",
"{",
"try",
"{",
"return",
"className",
"==",
"null",
"?",
"defaultResult",
":",
"(",
"Class",
"<",
"T",
">",
")",
"Class",
".",
"forName",
"(",
"className",
")",
";",
"}",
"catch",
"(",
"final",
"ClassNotFoundException",
"e",
")",
"{",
"LOG",
".",
"error",
"(",
"\"ClassNotFoundException for {} - defaulting to {}\"",
",",
"className",
",",
"defaultResult",
")",
";",
"return",
"defaultResult",
";",
"}",
"}"
] |
Helper method used to obtain a class from a fully qualified class name. If the value is null or an exception is
thrown, return the default result instead.
@param className the fully qualified class name to try
@param defaultResult the nullable default result
@param <T> the class type
@return the class or null
|
[
"Helper",
"method",
"used",
"to",
"obtain",
"a",
"class",
"from",
"a",
"fully",
"qualified",
"class",
"name",
".",
"If",
"the",
"value",
"is",
"null",
"or",
"an",
"exception",
"is",
"thrown",
"return",
"the",
"default",
"result",
"instead",
"."
] |
1b0ed1327a104cf1f809ce4c3c5bf30a3d95384b
|
https://github.com/Metrink/croquet/blob/1b0ed1327a104cf1f809ce4c3c5bf30a3d95384b/croquet-core/src/main/java/com/metrink/croquet/AbstractSettings.java#L65-L75
|
149,850
|
eurekaclinical/eurekaclinical-standard-apis
|
src/main/java/org/eurekaclinical/standardapis/dao/GenericDao.java
|
GenericDao.getAll
|
@Override
public List<T> getAll(int firstResult, int maxResults) {
return getDatabaseSupport().getAll(getEntityClass(), firstResult, maxResults);
}
|
java
|
@Override
public List<T> getAll(int firstResult, int maxResults) {
return getDatabaseSupport().getAll(getEntityClass(), firstResult, maxResults);
}
|
[
"@",
"Override",
"public",
"List",
"<",
"T",
">",
"getAll",
"(",
"int",
"firstResult",
",",
"int",
"maxResults",
")",
"{",
"return",
"getDatabaseSupport",
"(",
")",
".",
"getAll",
"(",
"getEntityClass",
"(",
")",
",",
"firstResult",
",",
"maxResults",
")",
";",
"}"
] |
Gets all of this DAO's entities.
@return a list of entities. Guaranteed not <code>null</code>.
|
[
"Gets",
"all",
"of",
"this",
"DAO",
"s",
"entities",
"."
] |
690036dde82a4f2c2106d32403cdf1c713429377
|
https://github.com/eurekaclinical/eurekaclinical-standard-apis/blob/690036dde82a4f2c2106d32403cdf1c713429377/src/main/java/org/eurekaclinical/standardapis/dao/GenericDao.java#L166-L169
|
149,851
|
eurekaclinical/eurekaclinical-standard-apis
|
src/main/java/org/eurekaclinical/standardapis/dao/GenericDao.java
|
GenericDao.getListAsc
|
protected List<T> getListAsc(SingularAttribute<T, ?> attribute) {
EntityManager entityManager = this.getEntityManager();
CriteriaBuilder builder = entityManager.getCriteriaBuilder();
CriteriaQuery<T> criteriaQuery = builder.createQuery(getEntityClass());
Root<T> root = criteriaQuery.from(getEntityClass());
criteriaQuery.orderBy(builder.asc(root.get(attribute)));
return entityManager.createQuery(criteriaQuery).getResultList();
}
|
java
|
protected List<T> getListAsc(SingularAttribute<T, ?> attribute) {
EntityManager entityManager = this.getEntityManager();
CriteriaBuilder builder = entityManager.getCriteriaBuilder();
CriteriaQuery<T> criteriaQuery = builder.createQuery(getEntityClass());
Root<T> root = criteriaQuery.from(getEntityClass());
criteriaQuery.orderBy(builder.asc(root.get(attribute)));
return entityManager.createQuery(criteriaQuery).getResultList();
}
|
[
"protected",
"List",
"<",
"T",
">",
"getListAsc",
"(",
"SingularAttribute",
"<",
"T",
",",
"?",
">",
"attribute",
")",
"{",
"EntityManager",
"entityManager",
"=",
"this",
".",
"getEntityManager",
"(",
")",
";",
"CriteriaBuilder",
"builder",
"=",
"entityManager",
".",
"getCriteriaBuilder",
"(",
")",
";",
"CriteriaQuery",
"<",
"T",
">",
"criteriaQuery",
"=",
"builder",
".",
"createQuery",
"(",
"getEntityClass",
"(",
")",
")",
";",
"Root",
"<",
"T",
">",
"root",
"=",
"criteriaQuery",
".",
"from",
"(",
"getEntityClass",
"(",
")",
")",
";",
"criteriaQuery",
".",
"orderBy",
"(",
"builder",
".",
"asc",
"(",
"root",
".",
"get",
"(",
"attribute",
")",
")",
")",
";",
"return",
"entityManager",
".",
"createQuery",
"(",
"criteriaQuery",
")",
".",
"getResultList",
"(",
")",
";",
"}"
] |
Gets all of this DAO's entities ordered by the provided attribute in
ascending order.
@param attribute the attribute to order by.
@return an ordered list of entities. Guaranteed not <code>null</code>.
|
[
"Gets",
"all",
"of",
"this",
"DAO",
"s",
"entities",
"ordered",
"by",
"the",
"provided",
"attribute",
"in",
"ascending",
"order",
"."
] |
690036dde82a4f2c2106d32403cdf1c713429377
|
https://github.com/eurekaclinical/eurekaclinical-standard-apis/blob/690036dde82a4f2c2106d32403cdf1c713429377/src/main/java/org/eurekaclinical/standardapis/dao/GenericDao.java#L179-L186
|
149,852
|
eurekaclinical/eurekaclinical-standard-apis
|
src/main/java/org/eurekaclinical/standardapis/dao/GenericDao.java
|
GenericDao.getListByAttribute
|
protected <Y> List<T> getListByAttribute(SingularAttribute<T, Y> attribute, Y value) {
return getDatabaseSupport().getListByAttribute(getEntityClass(), attribute, value);
}
|
java
|
protected <Y> List<T> getListByAttribute(SingularAttribute<T, Y> attribute, Y value) {
return getDatabaseSupport().getListByAttribute(getEntityClass(), attribute, value);
}
|
[
"protected",
"<",
"Y",
">",
"List",
"<",
"T",
">",
"getListByAttribute",
"(",
"SingularAttribute",
"<",
"T",
",",
"Y",
">",
"attribute",
",",
"Y",
"value",
")",
"{",
"return",
"getDatabaseSupport",
"(",
")",
".",
"getListByAttribute",
"(",
"getEntityClass",
"(",
")",
",",
"attribute",
",",
"value",
")",
";",
"}"
] |
Gets the entities that have the target value of the specified attribute.
@param <Y> the type of the attribute and target value.
@param attribute the attribute of the entity to compare.
@param value the target value of the given attribute.
@return the matching entities. Guaranteed not <code>null</code>.
|
[
"Gets",
"the",
"entities",
"that",
"have",
"the",
"target",
"value",
"of",
"the",
"specified",
"attribute",
"."
] |
690036dde82a4f2c2106d32403cdf1c713429377
|
https://github.com/eurekaclinical/eurekaclinical-standard-apis/blob/690036dde82a4f2c2106d32403cdf1c713429377/src/main/java/org/eurekaclinical/standardapis/dao/GenericDao.java#L254-L256
|
149,853
|
eurekaclinical/eurekaclinical-standard-apis
|
src/main/java/org/eurekaclinical/standardapis/dao/GenericDao.java
|
GenericDao.getListByAttributeIn
|
protected <Y> List<T> getListByAttributeIn(SingularAttribute<T, Y> attribute, List<Y> values) {
return getDatabaseSupport().getListByAttributeIn(getEntityClass(), attribute, values);
}
|
java
|
protected <Y> List<T> getListByAttributeIn(SingularAttribute<T, Y> attribute, List<Y> values) {
return getDatabaseSupport().getListByAttributeIn(getEntityClass(), attribute, values);
}
|
[
"protected",
"<",
"Y",
">",
"List",
"<",
"T",
">",
"getListByAttributeIn",
"(",
"SingularAttribute",
"<",
"T",
",",
"Y",
">",
"attribute",
",",
"List",
"<",
"Y",
">",
"values",
")",
"{",
"return",
"getDatabaseSupport",
"(",
")",
".",
"getListByAttributeIn",
"(",
"getEntityClass",
"(",
")",
",",
"attribute",
",",
"values",
")",
";",
"}"
] |
Gets the entities that have any of the target values of the specified
attribute.
@param <Y> the type of the attribute and target value.
@param attribute the attribute of the entity to compare.
@param values the target values of the given attribute.
@return the matching entities. Guaranteed not <code>null</code>.
|
[
"Gets",
"the",
"entities",
"that",
"have",
"any",
"of",
"the",
"target",
"values",
"of",
"the",
"specified",
"attribute",
"."
] |
690036dde82a4f2c2106d32403cdf1c713429377
|
https://github.com/eurekaclinical/eurekaclinical-standard-apis/blob/690036dde82a4f2c2106d32403cdf1c713429377/src/main/java/org/eurekaclinical/standardapis/dao/GenericDao.java#L287-L289
|
149,854
|
dhemery/hartley
|
src/main/java/com/dhemery/expressing/Expressive.java
|
Expressive.the
|
public boolean the(Condition condition, Ticker ticker) {
try {
poll(ticker, condition);
return true;
} catch (PollTimeoutException ignored) {
return false;
}
}
|
java
|
public boolean the(Condition condition, Ticker ticker) {
try {
poll(ticker, condition);
return true;
} catch (PollTimeoutException ignored) {
return false;
}
}
|
[
"public",
"boolean",
"the",
"(",
"Condition",
"condition",
",",
"Ticker",
"ticker",
")",
"{",
"try",
"{",
"poll",
"(",
"ticker",
",",
"condition",
")",
";",
"return",
"true",
";",
"}",
"catch",
"(",
"PollTimeoutException",
"ignored",
")",
"{",
"return",
"false",
";",
"}",
"}"
] |
Report whether the condition is satisfied during a poll.
|
[
"Report",
"whether",
"the",
"condition",
"is",
"satisfied",
"during",
"a",
"poll",
"."
] |
7754bd6bc12695f2249601b8890da530a61fcf33
|
https://github.com/dhemery/hartley/blob/7754bd6bc12695f2249601b8890da530a61fcf33/src/main/java/com/dhemery/expressing/Expressive.java#L136-L143
|
149,855
|
dhemery/hartley
|
src/main/java/com/dhemery/expressing/Expressive.java
|
Expressive.the
|
public <V> boolean the(Sampler<V> variable, Ticker ticker, Matcher<? super V> criteria) {
return the(sampleOf(variable, criteria), ticker);
}
|
java
|
public <V> boolean the(Sampler<V> variable, Ticker ticker, Matcher<? super V> criteria) {
return the(sampleOf(variable, criteria), ticker);
}
|
[
"public",
"<",
"V",
">",
"boolean",
"the",
"(",
"Sampler",
"<",
"V",
">",
"variable",
",",
"Ticker",
"ticker",
",",
"Matcher",
"<",
"?",
"super",
"V",
">",
"criteria",
")",
"{",
"return",
"the",
"(",
"sampleOf",
"(",
"variable",
",",
"criteria",
")",
",",
"ticker",
")",
";",
"}"
] |
Report whether a polled sample of the variable satisfies the criteria.
|
[
"Report",
"whether",
"a",
"polled",
"sample",
"of",
"the",
"variable",
"satisfies",
"the",
"criteria",
"."
] |
7754bd6bc12695f2249601b8890da530a61fcf33
|
https://github.com/dhemery/hartley/blob/7754bd6bc12695f2249601b8890da530a61fcf33/src/main/java/com/dhemery/expressing/Expressive.java#L148-L150
|
149,856
|
dhemery/hartley
|
src/main/java/com/dhemery/expressing/Expressive.java
|
Expressive.waitUntil
|
public <V> void waitUntil(Sampler<V> variable, Matcher<? super V> criteria) {
waitUntil(variable, eventually(), criteria);
}
|
java
|
public <V> void waitUntil(Sampler<V> variable, Matcher<? super V> criteria) {
waitUntil(variable, eventually(), criteria);
}
|
[
"public",
"<",
"V",
">",
"void",
"waitUntil",
"(",
"Sampler",
"<",
"V",
">",
"variable",
",",
"Matcher",
"<",
"?",
"super",
"V",
">",
"criteria",
")",
"{",
"waitUntil",
"(",
"variable",
",",
"eventually",
"(",
")",
",",
"criteria",
")",
";",
"}"
] |
Wait until a polled sample of the variable satisfies the criteria.
Uses a default ticker.
|
[
"Wait",
"until",
"a",
"polled",
"sample",
"of",
"the",
"variable",
"satisfies",
"the",
"criteria",
".",
"Uses",
"a",
"default",
"ticker",
"."
] |
7754bd6bc12695f2249601b8890da530a61fcf33
|
https://github.com/dhemery/hartley/blob/7754bd6bc12695f2249601b8890da530a61fcf33/src/main/java/com/dhemery/expressing/Expressive.java#L192-L194
|
149,857
|
dhemery/hartley
|
src/main/java/com/dhemery/expressing/Expressive.java
|
Expressive.waitUntil
|
public void waitUntil(Sampler<Boolean> variable, Ticker ticker) {
waitUntil(variable, ticker, isQuietlyTrue());
}
|
java
|
public void waitUntil(Sampler<Boolean> variable, Ticker ticker) {
waitUntil(variable, ticker, isQuietlyTrue());
}
|
[
"public",
"void",
"waitUntil",
"(",
"Sampler",
"<",
"Boolean",
">",
"variable",
",",
"Ticker",
"ticker",
")",
"{",
"waitUntil",
"(",
"variable",
",",
"ticker",
",",
"isQuietlyTrue",
"(",
")",
")",
";",
"}"
] |
Wait until a polled sample of the variable is [@code true).
|
[
"Wait",
"until",
"a",
"polled",
"sample",
"of",
"the",
"variable",
"is",
"["
] |
7754bd6bc12695f2249601b8890da530a61fcf33
|
https://github.com/dhemery/hartley/blob/7754bd6bc12695f2249601b8890da530a61fcf33/src/main/java/com/dhemery/expressing/Expressive.java#L214-L216
|
149,858
|
dhemery/hartley
|
src/main/java/com/dhemery/expressing/Expressive.java
|
Expressive.when
|
public <S,V> S when(S subject, Feature<? super S, V> feature, Matcher<? super V> criteria) {
return when(subject, feature, eventually(), criteria);
}
|
java
|
public <S,V> S when(S subject, Feature<? super S, V> feature, Matcher<? super V> criteria) {
return when(subject, feature, eventually(), criteria);
}
|
[
"public",
"<",
"S",
",",
"V",
">",
"S",
"when",
"(",
"S",
"subject",
",",
"Feature",
"<",
"?",
"super",
"S",
",",
"V",
">",
"feature",
",",
"Matcher",
"<",
"?",
"super",
"V",
">",
"criteria",
")",
"{",
"return",
"when",
"(",
"subject",
",",
"feature",
",",
"eventually",
"(",
")",
",",
"criteria",
")",
";",
"}"
] |
Return the subject when a polled sample of the feature satisfies the criteria.
Uses a default ticker.
|
[
"Return",
"the",
"subject",
"when",
"a",
"polled",
"sample",
"of",
"the",
"feature",
"satisfies",
"the",
"criteria",
".",
"Uses",
"a",
"default",
"ticker",
"."
] |
7754bd6bc12695f2249601b8890da530a61fcf33
|
https://github.com/dhemery/hartley/blob/7754bd6bc12695f2249601b8890da530a61fcf33/src/main/java/com/dhemery/expressing/Expressive.java#L252-L254
|
149,859
|
dhemery/hartley
|
src/main/java/com/dhemery/expressing/Expressive.java
|
Expressive.when
|
public <S,V> void when(S subject, Feature<? super S, V> feature, Ticker ticker, Matcher<? super V> criteria, Action<? super S> action) {
waitUntil(subject, feature, ticker, criteria);
action.actOn(subject);
}
|
java
|
public <S,V> void when(S subject, Feature<? super S, V> feature, Ticker ticker, Matcher<? super V> criteria, Action<? super S> action) {
waitUntil(subject, feature, ticker, criteria);
action.actOn(subject);
}
|
[
"public",
"<",
"S",
",",
"V",
">",
"void",
"when",
"(",
"S",
"subject",
",",
"Feature",
"<",
"?",
"super",
"S",
",",
"V",
">",
"feature",
",",
"Ticker",
"ticker",
",",
"Matcher",
"<",
"?",
"super",
"V",
">",
"criteria",
",",
"Action",
"<",
"?",
"super",
"S",
">",
"action",
")",
"{",
"waitUntil",
"(",
"subject",
",",
"feature",
",",
"ticker",
",",
"criteria",
")",
";",
"action",
".",
"actOn",
"(",
"subject",
")",
";",
"}"
] |
Act on the subject when a polled sample of the feature satisfies the criteria.
|
[
"Act",
"on",
"the",
"subject",
"when",
"a",
"polled",
"sample",
"of",
"the",
"feature",
"satisfies",
"the",
"criteria",
"."
] |
7754bd6bc12695f2249601b8890da530a61fcf33
|
https://github.com/dhemery/hartley/blob/7754bd6bc12695f2249601b8890da530a61fcf33/src/main/java/com/dhemery/expressing/Expressive.java#L298-L301
|
149,860
|
likethecolor/Alchemy-API
|
src/main/java/com/likethecolor/alchemy/api/entity/DisambiguatedAlchemyEntity.java
|
DisambiguatedAlchemyEntity.setLatitude
|
public void setLatitude(final String latitude) {
if(StringUtils.isBlank(latitude)) {
return;
}
try {
setLatitude(Double.parseDouble(latitude.trim()));
}
catch(Exception e) {
// nothing is set
}
}
|
java
|
public void setLatitude(final String latitude) {
if(StringUtils.isBlank(latitude)) {
return;
}
try {
setLatitude(Double.parseDouble(latitude.trim()));
}
catch(Exception e) {
// nothing is set
}
}
|
[
"public",
"void",
"setLatitude",
"(",
"final",
"String",
"latitude",
")",
"{",
"if",
"(",
"StringUtils",
".",
"isBlank",
"(",
"latitude",
")",
")",
"{",
"return",
";",
"}",
"try",
"{",
"setLatitude",
"(",
"Double",
".",
"parseDouble",
"(",
"latitude",
".",
"trim",
"(",
")",
")",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"// nothing is set",
"}",
"}"
] |
Set the latitude.
@param latitude latitude
@see #setGeo(String)
|
[
"Set",
"the",
"latitude",
"."
] |
5208cfc92a878ceeaff052787af29da92d98db7e
|
https://github.com/likethecolor/Alchemy-API/blob/5208cfc92a878ceeaff052787af29da92d98db7e/src/main/java/com/likethecolor/alchemy/api/entity/DisambiguatedAlchemyEntity.java#L284-L294
|
149,861
|
likethecolor/Alchemy-API
|
src/main/java/com/likethecolor/alchemy/api/entity/DisambiguatedAlchemyEntity.java
|
DisambiguatedAlchemyEntity.setLongitude
|
public void setLongitude(final String longitude) {
if(StringUtils.isBlank(longitude)) {
return;
}
try {
setLongitude(Double.parseDouble(longitude.trim()));
}
catch(Exception e) {
// nothing is set
}
}
|
java
|
public void setLongitude(final String longitude) {
if(StringUtils.isBlank(longitude)) {
return;
}
try {
setLongitude(Double.parseDouble(longitude.trim()));
}
catch(Exception e) {
// nothing is set
}
}
|
[
"public",
"void",
"setLongitude",
"(",
"final",
"String",
"longitude",
")",
"{",
"if",
"(",
"StringUtils",
".",
"isBlank",
"(",
"longitude",
")",
")",
"{",
"return",
";",
"}",
"try",
"{",
"setLongitude",
"(",
"Double",
".",
"parseDouble",
"(",
"longitude",
".",
"trim",
"(",
")",
")",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"// nothing is set",
"}",
"}"
] |
Set the longitude.
@param longitude longitude
@see #setGeo(String)
|
[
"Set",
"the",
"longitude",
"."
] |
5208cfc92a878ceeaff052787af29da92d98db7e
|
https://github.com/likethecolor/Alchemy-API/blob/5208cfc92a878ceeaff052787af29da92d98db7e/src/main/java/com/likethecolor/alchemy/api/entity/DisambiguatedAlchemyEntity.java#L323-L333
|
149,862
|
likethecolor/Alchemy-API
|
src/main/java/com/likethecolor/alchemy/api/entity/DisambiguatedAlchemyEntity.java
|
DisambiguatedAlchemyEntity.addSubtype
|
public void addSubtype(String subtype) {
if(!StringUtils.isBlank(subtype) && !subtypes.contains(subtype.trim())) {
subtypes.add(subtype.trim());
}
}
|
java
|
public void addSubtype(String subtype) {
if(!StringUtils.isBlank(subtype) && !subtypes.contains(subtype.trim())) {
subtypes.add(subtype.trim());
}
}
|
[
"public",
"void",
"addSubtype",
"(",
"String",
"subtype",
")",
"{",
"if",
"(",
"!",
"StringUtils",
".",
"isBlank",
"(",
"subtype",
")",
"&&",
"!",
"subtypes",
".",
"contains",
"(",
"subtype",
".",
"trim",
"(",
")",
")",
")",
"{",
"subtypes",
".",
"add",
"(",
"subtype",
".",
"trim",
"(",
")",
")",
";",
"}",
"}"
] |
Set the disambiguated entity subType. SubTypes expose additional
ontological mappings for a detected entity, such as identification of a
Person as a Politician or Athlete.
@param subtype disambiguated entity subType
|
[
"Set",
"the",
"disambiguated",
"entity",
"subType",
".",
"SubTypes",
"expose",
"additional",
"ontological",
"mappings",
"for",
"a",
"detected",
"entity",
"such",
"as",
"identification",
"of",
"a",
"Person",
"as",
"a",
"Politician",
"or",
"Athlete",
"."
] |
5208cfc92a878ceeaff052787af29da92d98db7e
|
https://github.com/likethecolor/Alchemy-API/blob/5208cfc92a878ceeaff052787af29da92d98db7e/src/main/java/com/likethecolor/alchemy/api/entity/DisambiguatedAlchemyEntity.java#L443-L447
|
149,863
|
likethecolor/Alchemy-API
|
src/main/java/com/likethecolor/alchemy/api/entity/DisambiguatedAlchemyEntity.java
|
DisambiguatedAlchemyEntity.setWebsite
|
public void setWebsite(String website) {
if(website != null) {
website = website.trim();
}
this.website = website;
}
|
java
|
public void setWebsite(String website) {
if(website != null) {
website = website.trim();
}
this.website = website;
}
|
[
"public",
"void",
"setWebsite",
"(",
"String",
"website",
")",
"{",
"if",
"(",
"website",
"!=",
"null",
")",
"{",
"website",
"=",
"website",
".",
"trim",
"(",
")",
";",
"}",
"this",
".",
"website",
"=",
"website",
";",
"}"
] |
Set the website associated with this concept tag.
@param website website associated with this concept tag
|
[
"Set",
"the",
"website",
"associated",
"with",
"this",
"concept",
"tag",
"."
] |
5208cfc92a878ceeaff052787af29da92d98db7e
|
https://github.com/likethecolor/Alchemy-API/blob/5208cfc92a878ceeaff052787af29da92d98db7e/src/main/java/com/likethecolor/alchemy/api/entity/DisambiguatedAlchemyEntity.java#L497-L502
|
149,864
|
mlhartme/mork
|
src/main/java/net/oneandone/mork/grammar/Ebnf.java
|
Ebnf.translate
|
public static Grammar translate(Rule[] rules, StringArrayList symbolTable) throws ActionException {
int i;
Ebnf builder;
Grammar tmp;
Grammar buffer;
int firstHelper;
int lastHelper;
firstHelper = symbolTable.size();
buffer = new Grammar(rules[0].getLeft(), symbolTable);
builder = new Ebnf(firstHelper);
for (i = 0; i < rules.length; i++) {
tmp = (Grammar) rules[i].getRight().visit(builder);
buffer.addProduction(new int[]{rules[i].getLeft(), tmp.getStart()});
buffer.addProductions(tmp);
buffer.expandSymbol(tmp.getStart());
buffer.removeProductions(tmp.getStart());
}
lastHelper = builder.getHelper() - 1;
buffer.removeDuplicateSymbols(firstHelper, lastHelper);
buffer.removeDuplicateRules();
buffer.packSymbols(firstHelper, lastHelper + 1);
return buffer;
}
|
java
|
public static Grammar translate(Rule[] rules, StringArrayList symbolTable) throws ActionException {
int i;
Ebnf builder;
Grammar tmp;
Grammar buffer;
int firstHelper;
int lastHelper;
firstHelper = symbolTable.size();
buffer = new Grammar(rules[0].getLeft(), symbolTable);
builder = new Ebnf(firstHelper);
for (i = 0; i < rules.length; i++) {
tmp = (Grammar) rules[i].getRight().visit(builder);
buffer.addProduction(new int[]{rules[i].getLeft(), tmp.getStart()});
buffer.addProductions(tmp);
buffer.expandSymbol(tmp.getStart());
buffer.removeProductions(tmp.getStart());
}
lastHelper = builder.getHelper() - 1;
buffer.removeDuplicateSymbols(firstHelper, lastHelper);
buffer.removeDuplicateRules();
buffer.packSymbols(firstHelper, lastHelper + 1);
return buffer;
}
|
[
"public",
"static",
"Grammar",
"translate",
"(",
"Rule",
"[",
"]",
"rules",
",",
"StringArrayList",
"symbolTable",
")",
"throws",
"ActionException",
"{",
"int",
"i",
";",
"Ebnf",
"builder",
";",
"Grammar",
"tmp",
";",
"Grammar",
"buffer",
";",
"int",
"firstHelper",
";",
"int",
"lastHelper",
";",
"firstHelper",
"=",
"symbolTable",
".",
"size",
"(",
")",
";",
"buffer",
"=",
"new",
"Grammar",
"(",
"rules",
"[",
"0",
"]",
".",
"getLeft",
"(",
")",
",",
"symbolTable",
")",
";",
"builder",
"=",
"new",
"Ebnf",
"(",
"firstHelper",
")",
";",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"rules",
".",
"length",
";",
"i",
"++",
")",
"{",
"tmp",
"=",
"(",
"Grammar",
")",
"rules",
"[",
"i",
"]",
".",
"getRight",
"(",
")",
".",
"visit",
"(",
"builder",
")",
";",
"buffer",
".",
"addProduction",
"(",
"new",
"int",
"[",
"]",
"{",
"rules",
"[",
"i",
"]",
".",
"getLeft",
"(",
")",
",",
"tmp",
".",
"getStart",
"(",
")",
"}",
")",
";",
"buffer",
".",
"addProductions",
"(",
"tmp",
")",
";",
"buffer",
".",
"expandSymbol",
"(",
"tmp",
".",
"getStart",
"(",
")",
")",
";",
"buffer",
".",
"removeProductions",
"(",
"tmp",
".",
"getStart",
"(",
")",
")",
";",
"}",
"lastHelper",
"=",
"builder",
".",
"getHelper",
"(",
")",
"-",
"1",
";",
"buffer",
".",
"removeDuplicateSymbols",
"(",
"firstHelper",
",",
"lastHelper",
")",
";",
"buffer",
".",
"removeDuplicateRules",
"(",
")",
";",
"buffer",
".",
"packSymbols",
"(",
"firstHelper",
",",
"lastHelper",
"+",
"1",
")",
";",
"return",
"buffer",
";",
"}"
] |
helper symbols are added without gaps, starting with freeHelper.
|
[
"helper",
"symbols",
"are",
"added",
"without",
"gaps",
"starting",
"with",
"freeHelper",
"."
] |
a069b087750c4133bfeebaf1f599c3bc96762113
|
https://github.com/mlhartme/mork/blob/a069b087750c4133bfeebaf1f599c3bc96762113/src/main/java/net/oneandone/mork/grammar/Ebnf.java#L30-L53
|
149,865
|
mlhartme/mork
|
src/main/java/net/oneandone/mork/mapping/Mapper.java
|
Mapper.newInstance
|
public Mapper newInstance() {
Mapper mapper;
mapper = new Mapper(name, parser.newInstance(), oag.newInstance());
mapper.setLogging(logParsing, logAttribution);
return mapper;
}
|
java
|
public Mapper newInstance() {
Mapper mapper;
mapper = new Mapper(name, parser.newInstance(), oag.newInstance());
mapper.setLogging(logParsing, logAttribution);
return mapper;
}
|
[
"public",
"Mapper",
"newInstance",
"(",
")",
"{",
"Mapper",
"mapper",
";",
"mapper",
"=",
"new",
"Mapper",
"(",
"name",
",",
"parser",
".",
"newInstance",
"(",
")",
",",
"oag",
".",
"newInstance",
"(",
")",
")",
";",
"mapper",
".",
"setLogging",
"(",
"logParsing",
",",
"logAttribution",
")",
";",
"return",
"mapper",
";",
"}"
] |
Creates a new mapper instance.
Shares common data (esp. scanner and parser table with this instance.
|
[
"Creates",
"a",
"new",
"mapper",
"instance",
".",
"Shares",
"common",
"data",
"(",
"esp",
".",
"scanner",
"and",
"parser",
"table",
"with",
"this",
"instance",
"."
] |
a069b087750c4133bfeebaf1f599c3bc96762113
|
https://github.com/mlhartme/mork/blob/a069b087750c4133bfeebaf1f599c3bc96762113/src/main/java/net/oneandone/mork/mapping/Mapper.java#L88-L94
|
149,866
|
leadware/jpersistence-tools
|
jpersistence-tools-core/src/main/java/net/leadware/persistence/tools/core/dao/utils/Encrypter.java
|
Encrypter.decryptText
|
public synchronized String decryptText(String text) {
try {
// Mise en mode Decrypt
cipher.init(Cipher.DECRYPT_MODE, this.createDESSecretKey(stringKey));
// Obtention des bytes
byte[] encodedByteText = new Base64().decode(text);
// Decryption
byte[] byteText = cipher.doFinal(encodedByteText);
// Retour de la chaine
return new String(byteText);
} catch (Exception e) {
// On relance l'exception
throw new RuntimeException(e);
}
}
|
java
|
public synchronized String decryptText(String text) {
try {
// Mise en mode Decrypt
cipher.init(Cipher.DECRYPT_MODE, this.createDESSecretKey(stringKey));
// Obtention des bytes
byte[] encodedByteText = new Base64().decode(text);
// Decryption
byte[] byteText = cipher.doFinal(encodedByteText);
// Retour de la chaine
return new String(byteText);
} catch (Exception e) {
// On relance l'exception
throw new RuntimeException(e);
}
}
|
[
"public",
"synchronized",
"String",
"decryptText",
"(",
"String",
"text",
")",
"{",
"try",
"{",
"// Mise en mode Decrypt",
"cipher",
".",
"init",
"(",
"Cipher",
".",
"DECRYPT_MODE",
",",
"this",
".",
"createDESSecretKey",
"(",
"stringKey",
")",
")",
";",
"// Obtention des bytes",
"byte",
"[",
"]",
"encodedByteText",
"=",
"new",
"Base64",
"(",
")",
".",
"decode",
"(",
"text",
")",
";",
"// Decryption",
"byte",
"[",
"]",
"byteText",
"=",
"cipher",
".",
"doFinal",
"(",
"encodedByteText",
")",
";",
"// Retour de la chaine",
"return",
"new",
"String",
"(",
"byteText",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"// On relance l'exception",
"throw",
"new",
"RuntimeException",
"(",
"e",
")",
";",
"}",
"}"
] |
Methode de decryptage d'un texte
@param text Texte a decrypter
@return Texte decrypte
|
[
"Methode",
"de",
"decryptage",
"d",
"un",
"texte"
] |
4c15372993584579d7dbb9b23dd4c0c0fdc9e789
|
https://github.com/leadware/jpersistence-tools/blob/4c15372993584579d7dbb9b23dd4c0c0fdc9e789/jpersistence-tools-core/src/main/java/net/leadware/persistence/tools/core/dao/utils/Encrypter.java#L101-L122
|
149,867
|
leadware/jpersistence-tools
|
jpersistence-tools-core/src/main/java/net/leadware/persistence/tools/core/dao/utils/Encrypter.java
|
Encrypter.encryptText
|
public synchronized String encryptText(String text) {
try {
// Mise en mode Encrypt
cipher.init(Cipher.ENCRYPT_MODE, this.createDESSecretKey(stringKey));
// Obtention des bytes
byte[] byteText = text.getBytes();
// Encodage
byte[] encodedByteText = cipher.doFinal(byteText);
// Retour de la chaine encodee
return new Base64().encodeToString(encodedByteText);
} catch (Exception e) {
// On relance l'exception
throw new RuntimeException(e);
}
}
|
java
|
public synchronized String encryptText(String text) {
try {
// Mise en mode Encrypt
cipher.init(Cipher.ENCRYPT_MODE, this.createDESSecretKey(stringKey));
// Obtention des bytes
byte[] byteText = text.getBytes();
// Encodage
byte[] encodedByteText = cipher.doFinal(byteText);
// Retour de la chaine encodee
return new Base64().encodeToString(encodedByteText);
} catch (Exception e) {
// On relance l'exception
throw new RuntimeException(e);
}
}
|
[
"public",
"synchronized",
"String",
"encryptText",
"(",
"String",
"text",
")",
"{",
"try",
"{",
"// Mise en mode Encrypt",
"cipher",
".",
"init",
"(",
"Cipher",
".",
"ENCRYPT_MODE",
",",
"this",
".",
"createDESSecretKey",
"(",
"stringKey",
")",
")",
";",
"// Obtention des bytes",
"byte",
"[",
"]",
"byteText",
"=",
"text",
".",
"getBytes",
"(",
")",
";",
"// Encodage",
"byte",
"[",
"]",
"encodedByteText",
"=",
"cipher",
".",
"doFinal",
"(",
"byteText",
")",
";",
"// Retour de la chaine encodee",
"return",
"new",
"Base64",
"(",
")",
".",
"encodeToString",
"(",
"encodedByteText",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"// On relance l'exception",
"throw",
"new",
"RuntimeException",
"(",
"e",
")",
";",
"}",
"}"
] |
Methode d'encryptage d'un texte
@param text Texte a encrypter
@return Texte encrypte
|
[
"Methode",
"d",
"encryptage",
"d",
"un",
"texte"
] |
4c15372993584579d7dbb9b23dd4c0c0fdc9e789
|
https://github.com/leadware/jpersistence-tools/blob/4c15372993584579d7dbb9b23dd4c0c0fdc9e789/jpersistence-tools-core/src/main/java/net/leadware/persistence/tools/core/dao/utils/Encrypter.java#L129-L149
|
149,868
|
leadware/jpersistence-tools
|
jpersistence-tools-core/src/main/java/net/leadware/persistence/tools/core/dao/utils/Encrypter.java
|
Encrypter.hashText
|
public synchronized String hashText(String text) {
// Hachage du texte
return new Base64().encodeToString(digester.digest(text.getBytes()));
}
|
java
|
public synchronized String hashText(String text) {
// Hachage du texte
return new Base64().encodeToString(digester.digest(text.getBytes()));
}
|
[
"public",
"synchronized",
"String",
"hashText",
"(",
"String",
"text",
")",
"{",
"// Hachage du texte",
"return",
"new",
"Base64",
"(",
")",
".",
"encodeToString",
"(",
"digester",
".",
"digest",
"(",
"text",
".",
"getBytes",
"(",
")",
")",
")",
";",
"}"
] |
Methode de hachage d'un texte
@param text Texte a hacher
@return Texte hache
|
[
"Methode",
"de",
"hachage",
"d",
"un",
"texte"
] |
4c15372993584579d7dbb9b23dd4c0c0fdc9e789
|
https://github.com/leadware/jpersistence-tools/blob/4c15372993584579d7dbb9b23dd4c0c0fdc9e789/jpersistence-tools-core/src/main/java/net/leadware/persistence/tools/core/dao/utils/Encrypter.java#L156-L160
|
149,869
|
leadware/jpersistence-tools
|
jpersistence-tools-core/src/main/java/net/leadware/persistence/tools/core/dao/utils/Encrypter.java
|
Encrypter.createDESSecretKey
|
private SecretKey createDESSecretKey(String keytext){
try {
// Generation de la cle DES basees sur une mot de passe
DESKeySpec desKeySpec = new DESKeySpec(keytext.getBytes());
// On retourne la cle DES
return SecretKeyFactory.getInstance("DES").generateSecret(desKeySpec);
} catch (Exception e) {
// On relance l'exception
throw new RuntimeException(e);
}
}
|
java
|
private SecretKey createDESSecretKey(String keytext){
try {
// Generation de la cle DES basees sur une mot de passe
DESKeySpec desKeySpec = new DESKeySpec(keytext.getBytes());
// On retourne la cle DES
return SecretKeyFactory.getInstance("DES").generateSecret(desKeySpec);
} catch (Exception e) {
// On relance l'exception
throw new RuntimeException(e);
}
}
|
[
"private",
"SecretKey",
"createDESSecretKey",
"(",
"String",
"keytext",
")",
"{",
"try",
"{",
"// Generation de la cle DES basees sur une mot de passe",
"DESKeySpec",
"desKeySpec",
"=",
"new",
"DESKeySpec",
"(",
"keytext",
".",
"getBytes",
"(",
")",
")",
";",
"// On retourne la cle DES",
"return",
"SecretKeyFactory",
".",
"getInstance",
"(",
"\"DES\"",
")",
".",
"generateSecret",
"(",
"desKeySpec",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"// On relance l'exception",
"throw",
"new",
"RuntimeException",
"(",
"e",
")",
";",
"}",
"}"
] |
Methode de generation de cle prives sur la base d'un mot de passe
@param keytext Texte cle
@return Cle secrete
|
[
"Methode",
"de",
"generation",
"de",
"cle",
"prives",
"sur",
"la",
"base",
"d",
"un",
"mot",
"de",
"passe"
] |
4c15372993584579d7dbb9b23dd4c0c0fdc9e789
|
https://github.com/leadware/jpersistence-tools/blob/4c15372993584579d7dbb9b23dd4c0c0fdc9e789/jpersistence-tools-core/src/main/java/net/leadware/persistence/tools/core/dao/utils/Encrypter.java#L167-L182
|
149,870
|
eurekaclinical/datastore
|
src/main/java/org/eurekaclinical/datastore/bdb/BdbStoreShutdownHook.java
|
BdbStoreShutdownHook.shutdown
|
void shutdown() throws IOException {
synchronized (this) {
for (BdbEnvironmentInfo envInfo : this.envInfos) {
try {
envInfo.getClassCatalog().close();
} catch (DatabaseException ignore) {
LOGGER.log(Level.SEVERE, "Failure closing class catalog", ignore);
}
envInfo.closeAndRemoveAllDatabaseHandles();
try (Environment env = envInfo.getEnvironment()) {
if (this.deleteOnExit) {
FileUtil.deleteDirectory(env.getHome());
}
}
}
this.envInfos.clear();
}
}
|
java
|
void shutdown() throws IOException {
synchronized (this) {
for (BdbEnvironmentInfo envInfo : this.envInfos) {
try {
envInfo.getClassCatalog().close();
} catch (DatabaseException ignore) {
LOGGER.log(Level.SEVERE, "Failure closing class catalog", ignore);
}
envInfo.closeAndRemoveAllDatabaseHandles();
try (Environment env = envInfo.getEnvironment()) {
if (this.deleteOnExit) {
FileUtil.deleteDirectory(env.getHome());
}
}
}
this.envInfos.clear();
}
}
|
[
"void",
"shutdown",
"(",
")",
"throws",
"IOException",
"{",
"synchronized",
"(",
"this",
")",
"{",
"for",
"(",
"BdbEnvironmentInfo",
"envInfo",
":",
"this",
".",
"envInfos",
")",
"{",
"try",
"{",
"envInfo",
".",
"getClassCatalog",
"(",
")",
".",
"close",
"(",
")",
";",
"}",
"catch",
"(",
"DatabaseException",
"ignore",
")",
"{",
"LOGGER",
".",
"log",
"(",
"Level",
".",
"SEVERE",
",",
"\"Failure closing class catalog\"",
",",
"ignore",
")",
";",
"}",
"envInfo",
".",
"closeAndRemoveAllDatabaseHandles",
"(",
")",
";",
"try",
"(",
"Environment",
"env",
"=",
"envInfo",
".",
"getEnvironment",
"(",
")",
")",
"{",
"if",
"(",
"this",
".",
"deleteOnExit",
")",
"{",
"FileUtil",
".",
"deleteDirectory",
"(",
"env",
".",
"getHome",
"(",
")",
")",
";",
"}",
"}",
"}",
"this",
".",
"envInfos",
".",
"clear",
"(",
")",
";",
"}",
"}"
] |
Cleanly shuts down all databases in the provided environment.
@throws IOException if a database delete attempt failed.
@throws DatabaseException if an error occurs while closing the class
catalog database.
|
[
"Cleanly",
"shuts",
"down",
"all",
"databases",
"in",
"the",
"provided",
"environment",
"."
] |
a03a70819bb562ba45eac66ca49f778035ee45e0
|
https://github.com/eurekaclinical/datastore/blob/a03a70819bb562ba45eac66ca49f778035ee45e0/src/main/java/org/eurekaclinical/datastore/bdb/BdbStoreShutdownHook.java#L72-L90
|
149,871
|
eurekaclinical/datastore
|
src/main/java/org/eurekaclinical/datastore/bdb/BdbStoreShutdownHook.java
|
BdbStoreShutdownHook.run
|
@Override
public void run() {
try {
shutdown();
} catch (IOException ex) {
LOGGER.log(Level.SEVERE, "Error during shutdown", ex);
}
}
|
java
|
@Override
public void run() {
try {
shutdown();
} catch (IOException ex) {
LOGGER.log(Level.SEVERE, "Error during shutdown", ex);
}
}
|
[
"@",
"Override",
"public",
"void",
"run",
"(",
")",
"{",
"try",
"{",
"shutdown",
"(",
")",
";",
"}",
"catch",
"(",
"IOException",
"ex",
")",
"{",
"LOGGER",
".",
"log",
"(",
"Level",
".",
"SEVERE",
",",
"\"Error during shutdown\"",
",",
"ex",
")",
";",
"}",
"}"
] |
Runs the shutdown hook.
|
[
"Runs",
"the",
"shutdown",
"hook",
"."
] |
a03a70819bb562ba45eac66ca49f778035ee45e0
|
https://github.com/eurekaclinical/datastore/blob/a03a70819bb562ba45eac66ca49f778035ee45e0/src/main/java/org/eurekaclinical/datastore/bdb/BdbStoreShutdownHook.java#L95-L102
|
149,872
|
eurekaclinical/javautil
|
src/main/java/org/arp/javautil/sql/DriverManagerConnectionSpec.java
|
DriverManagerConnectionSpec.getOrCreate
|
@Override
public Connection getOrCreate() throws SQLException {
Connection con = DriverManager.getConnection(this.url, this.user, this.password);
con.setAutoCommit(isAutoCommitEnabled());
return con;
}
|
java
|
@Override
public Connection getOrCreate() throws SQLException {
Connection con = DriverManager.getConnection(this.url, this.user, this.password);
con.setAutoCommit(isAutoCommitEnabled());
return con;
}
|
[
"@",
"Override",
"public",
"Connection",
"getOrCreate",
"(",
")",
"throws",
"SQLException",
"{",
"Connection",
"con",
"=",
"DriverManager",
".",
"getConnection",
"(",
"this",
".",
"url",
",",
"this",
".",
"user",
",",
"this",
".",
"password",
")",
";",
"con",
".",
"setAutoCommit",
"(",
"isAutoCommitEnabled",
"(",
")",
")",
";",
"return",
"con",
";",
"}"
] |
Creates a database connection or gets an existing connection with
the JDBC URL, username and password specified in the constructor.
@return a {@link Connection}.
@throws SQLException if an error occurred creating/getting a
{@link Connection}, possibly because the JDBC URL, username and/or
password are invalid.
|
[
"Creates",
"a",
"database",
"connection",
"or",
"gets",
"an",
"existing",
"connection",
"with",
"the",
"JDBC",
"URL",
"username",
"and",
"password",
"specified",
"in",
"the",
"constructor",
"."
] |
779bbc5bf096c75f8eed4f99ca45b99c1d44df43
|
https://github.com/eurekaclinical/javautil/blob/779bbc5bf096c75f8eed4f99ca45b99c1d44df43/src/main/java/org/arp/javautil/sql/DriverManagerConnectionSpec.java#L71-L76
|
149,873
|
trustathsh/ifmapj
|
src/main/java/de/hshannover/f4/trust/ifmapj/messages/Requests.java
|
Requests.registerRequestHandler
|
public static void registerRequestHandler(RequestHandler<? extends Request> rh) {
if (rh == null) {
throw new NullPointerException("rh is null");
}
if (rh.handles() == null) {
throw new NullPointerException("rh.handles() returns null");
}
if (sRequestHandlers == null) {
initializeDefaultHandlers();
}
if (sRequestHandlers.containsKey(rh.handles())) {
throw new RuntimeException("RequestHandler already registered for "
+ rh.handles());
}
sRequestHandlers.put(rh.handles(), rh);
}
|
java
|
public static void registerRequestHandler(RequestHandler<? extends Request> rh) {
if (rh == null) {
throw new NullPointerException("rh is null");
}
if (rh.handles() == null) {
throw new NullPointerException("rh.handles() returns null");
}
if (sRequestHandlers == null) {
initializeDefaultHandlers();
}
if (sRequestHandlers.containsKey(rh.handles())) {
throw new RuntimeException("RequestHandler already registered for "
+ rh.handles());
}
sRequestHandlers.put(rh.handles(), rh);
}
|
[
"public",
"static",
"void",
"registerRequestHandler",
"(",
"RequestHandler",
"<",
"?",
"extends",
"Request",
">",
"rh",
")",
"{",
"if",
"(",
"rh",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
"\"rh is null\"",
")",
";",
"}",
"if",
"(",
"rh",
".",
"handles",
"(",
")",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
"\"rh.handles() returns null\"",
")",
";",
"}",
"if",
"(",
"sRequestHandlers",
"==",
"null",
")",
"{",
"initializeDefaultHandlers",
"(",
")",
";",
"}",
"if",
"(",
"sRequestHandlers",
".",
"containsKey",
"(",
"rh",
".",
"handles",
"(",
")",
")",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
"\"RequestHandler already registered for \"",
"+",
"rh",
".",
"handles",
"(",
")",
")",
";",
"}",
"sRequestHandlers",
".",
"put",
"(",
"rh",
".",
"handles",
"(",
")",
",",
"rh",
")",
";",
"}"
] |
Register a custom request handler.
@param rh
|
[
"Register",
"a",
"custom",
"request",
"handler",
"."
] |
44ece9e95a3d2a1b7019573ba6178598a6cbdaa3
|
https://github.com/trustathsh/ifmapj/blob/44ece9e95a3d2a1b7019573ba6178598a6cbdaa3/src/main/java/de/hshannover/f4/trust/ifmapj/messages/Requests.java#L102-L121
|
149,874
|
leadware/jpersistence-tools
|
jpersistence-tools-api/src/main/java/net/leadware/persistence/tools/api/utils/PropertyContainer.java
|
PropertyContainer.add
|
public PropertyContainer add(String property) {
// Si la propriete n'est pas nulle
if(property != null && property.trim().length() > 0) properties.add(property);
// On retourne le conteneur
return this;
}
|
java
|
public PropertyContainer add(String property) {
// Si la propriete n'est pas nulle
if(property != null && property.trim().length() > 0) properties.add(property);
// On retourne le conteneur
return this;
}
|
[
"public",
"PropertyContainer",
"add",
"(",
"String",
"property",
")",
"{",
"// Si la propriete n'est pas nulle\r",
"if",
"(",
"property",
"!=",
"null",
"&&",
"property",
".",
"trim",
"(",
")",
".",
"length",
"(",
")",
">",
"0",
")",
"properties",
".",
"add",
"(",
"property",
")",
";",
"// On retourne le conteneur\r",
"return",
"this",
";",
"}"
] |
Methode d'ajour d'une propriete
@param property Propriete a ajouter
@return Conteneur de proprietes
|
[
"Methode",
"d",
"ajour",
"d",
"une",
"propriete"
] |
4c15372993584579d7dbb9b23dd4c0c0fdc9e789
|
https://github.com/leadware/jpersistence-tools/blob/4c15372993584579d7dbb9b23dd4c0c0fdc9e789/jpersistence-tools-api/src/main/java/net/leadware/persistence/tools/api/utils/PropertyContainer.java#L58-L65
|
149,875
|
gondor/kbop
|
src/main/java/org/pacesys/kbop/internal/PoolableObject.java
|
PoolableObject.initialize
|
@SuppressWarnings("unchecked")
<K, E extends PoolableObject<V>> E initialize(PoolKey<K> key, IKeyedObjectPool<?, V> pool) {
this.key = key;
this.pool = pool;
return (E) this;
}
|
java
|
@SuppressWarnings("unchecked")
<K, E extends PoolableObject<V>> E initialize(PoolKey<K> key, IKeyedObjectPool<?, V> pool) {
this.key = key;
this.pool = pool;
return (E) this;
}
|
[
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"<",
"K",
",",
"E",
"extends",
"PoolableObject",
"<",
"V",
">",
">",
"E",
"initialize",
"(",
"PoolKey",
"<",
"K",
">",
"key",
",",
"IKeyedObjectPool",
"<",
"?",
",",
"V",
">",
"pool",
")",
"{",
"this",
".",
"key",
"=",
"key",
";",
"this",
".",
"pool",
"=",
"pool",
";",
"return",
"(",
"E",
")",
"this",
";",
"}"
] |
Initializes this Object when initially created by the Pool for allocation
@param <K> The Key wrapped Type
@param <E> the Entry Type
@param key The Key which is associated with this Pool Object
@param pool the pool creating this allocation
@return Poolable Object
|
[
"Initializes",
"this",
"Object",
"when",
"initially",
"created",
"by",
"the",
"Pool",
"for",
"allocation"
] |
a176fd845f1e146610f03a1cb3cb0d661ebf4faa
|
https://github.com/gondor/kbop/blob/a176fd845f1e146610f03a1cb3cb0d661ebf4faa/src/main/java/org/pacesys/kbop/internal/PoolableObject.java#L41-L46
|
149,876
|
gondor/kbop
|
src/main/java/org/pacesys/kbop/internal/PoolableObject.java
|
PoolableObject.flagOwner
|
@SuppressWarnings("unchecked")
<K, E extends PoolableObject<V>> E flagOwner() {
this.owner = Thread.currentThread();
return (E) this;
}
|
java
|
@SuppressWarnings("unchecked")
<K, E extends PoolableObject<V>> E flagOwner() {
this.owner = Thread.currentThread();
return (E) this;
}
|
[
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"<",
"K",
",",
"E",
"extends",
"PoolableObject",
"<",
"V",
">",
">",
"E",
"flagOwner",
"(",
")",
"{",
"this",
".",
"owner",
"=",
"Thread",
".",
"currentThread",
"(",
")",
";",
"return",
"(",
"E",
")",
"this",
";",
"}"
] |
Flags the current thread as the new Owner of this Object
@param <K> the Key wrapped Type
@param <E> the Entry Type
@return PoolableObject for method chaining
|
[
"Flags",
"the",
"current",
"thread",
"as",
"the",
"new",
"Owner",
"of",
"this",
"Object"
] |
a176fd845f1e146610f03a1cb3cb0d661ebf4faa
|
https://github.com/gondor/kbop/blob/a176fd845f1e146610f03a1cb3cb0d661ebf4faa/src/main/java/org/pacesys/kbop/internal/PoolableObject.java#L55-L59
|
149,877
|
gondor/kbop
|
src/main/java/org/pacesys/kbop/internal/PoolableObject.java
|
PoolableObject.releaseOwner
|
@SuppressWarnings("unchecked")
<K, E extends PoolableObject<V>> E releaseOwner() {
this.owner = null;
return (E) this;
}
|
java
|
@SuppressWarnings("unchecked")
<K, E extends PoolableObject<V>> E releaseOwner() {
this.owner = null;
return (E) this;
}
|
[
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"<",
"K",
",",
"E",
"extends",
"PoolableObject",
"<",
"V",
">",
">",
"E",
"releaseOwner",
"(",
")",
"{",
"this",
".",
"owner",
"=",
"null",
";",
"return",
"(",
"E",
")",
"this",
";",
"}"
] |
Releases the current owning thread from this Object
@param <K> the Key wrapped Type
@param <E> the Entry type
@return PoolableObject for method chaining
|
[
"Releases",
"the",
"current",
"owning",
"thread",
"from",
"this",
"Object"
] |
a176fd845f1e146610f03a1cb3cb0d661ebf4faa
|
https://github.com/gondor/kbop/blob/a176fd845f1e146610f03a1cb3cb0d661ebf4faa/src/main/java/org/pacesys/kbop/internal/PoolableObject.java#L68-L72
|
149,878
|
leadware/jpersistence-tools
|
jpersistence-tools-core/src/main/java/net/leadware/persistence/tools/core/dao/utils/DAOValidatorHelper.java
|
DAOValidatorHelper.loadDAOGeneratorAnnotations
|
public static List<Annotation> loadDAOGeneratorAnnotations(Field field) {
// Liste des annotations retrouvees
List<Annotation> daoAnnotations = new ArrayList<Annotation>();
// Si l'objet est null
if(field == null) {
// On retourne une liste vide
return daoAnnotations;
}
// Obtention des annotations de la classe
Annotation[] objectAnnotations = field.getDeclaredAnnotations();
// Si le tableau est vide
if(objectAnnotations == null || objectAnnotations.length == 0) {
// On retourne une liste vide
return daoAnnotations;
}
// Parcours
for (Annotation annotation : objectAnnotations) {
// Si c'est une annotation du Framework
if(isDAOGeneratorAnnotation(annotation)) {
// On ajoute l'annotation
daoAnnotations.add(annotation);
}
}
// On retourne la liste
return daoAnnotations;
}
|
java
|
public static List<Annotation> loadDAOGeneratorAnnotations(Field field) {
// Liste des annotations retrouvees
List<Annotation> daoAnnotations = new ArrayList<Annotation>();
// Si l'objet est null
if(field == null) {
// On retourne une liste vide
return daoAnnotations;
}
// Obtention des annotations de la classe
Annotation[] objectAnnotations = field.getDeclaredAnnotations();
// Si le tableau est vide
if(objectAnnotations == null || objectAnnotations.length == 0) {
// On retourne une liste vide
return daoAnnotations;
}
// Parcours
for (Annotation annotation : objectAnnotations) {
// Si c'est une annotation du Framework
if(isDAOGeneratorAnnotation(annotation)) {
// On ajoute l'annotation
daoAnnotations.add(annotation);
}
}
// On retourne la liste
return daoAnnotations;
}
|
[
"public",
"static",
"List",
"<",
"Annotation",
">",
"loadDAOGeneratorAnnotations",
"(",
"Field",
"field",
")",
"{",
"// Liste des annotations retrouvees\r",
"List",
"<",
"Annotation",
">",
"daoAnnotations",
"=",
"new",
"ArrayList",
"<",
"Annotation",
">",
"(",
")",
";",
"// Si l'objet est null\r",
"if",
"(",
"field",
"==",
"null",
")",
"{",
"// On retourne une liste vide\r",
"return",
"daoAnnotations",
";",
"}",
"// Obtention des annotations de la classe\r",
"Annotation",
"[",
"]",
"objectAnnotations",
"=",
"field",
".",
"getDeclaredAnnotations",
"(",
")",
";",
"// Si le tableau est vide\r",
"if",
"(",
"objectAnnotations",
"==",
"null",
"||",
"objectAnnotations",
".",
"length",
"==",
"0",
")",
"{",
"// On retourne une liste vide\r",
"return",
"daoAnnotations",
";",
"}",
"// Parcours\r",
"for",
"(",
"Annotation",
"annotation",
":",
"objectAnnotations",
")",
"{",
"// Si c'est une annotation du Framework\r",
"if",
"(",
"isDAOGeneratorAnnotation",
"(",
"annotation",
")",
")",
"{",
"// On ajoute l'annotation\r",
"daoAnnotations",
".",
"add",
"(",
"annotation",
")",
";",
"}",
"}",
"// On retourne la liste\r",
"return",
"daoAnnotations",
";",
"}"
] |
Methode permettant de charger toutes les annotations DAO de generation sur la propriete
@param field Champ a inspecter
@return Liste des annotations DAO de generation retrouvees
|
[
"Methode",
"permettant",
"de",
"charger",
"toutes",
"les",
"annotations",
"DAO",
"de",
"generation",
"sur",
"la",
"propriete"
] |
4c15372993584579d7dbb9b23dd4c0c0fdc9e789
|
https://github.com/leadware/jpersistence-tools/blob/4c15372993584579d7dbb9b23dd4c0c0fdc9e789/jpersistence-tools-core/src/main/java/net/leadware/persistence/tools/core/dao/utils/DAOValidatorHelper.java#L186-L221
|
149,879
|
leadware/jpersistence-tools
|
jpersistence-tools-core/src/main/java/net/leadware/persistence/tools/core/dao/utils/DAOValidatorHelper.java
|
DAOValidatorHelper.loadDAOValidatorAnnotations
|
public static List<Annotation> loadDAOValidatorAnnotations(Object object) {
// Liste des annotations retrouvees
List<Annotation> daoAnnotations = new ArrayList<Annotation>();
// Si l'objet est null
if(object == null) {
// On retourne une liste vide
return daoAnnotations;
}
// Obtention des annotations de la classe
Annotation[] objectAnnotations = object.getClass().getAnnotations();
// Si le tableau est vide
if(objectAnnotations == null || objectAnnotations.length == 0) {
// On retourne une liste vide
return daoAnnotations;
}
// Parcours
for (Annotation annotation : objectAnnotations) {
// Si c'est une annotation du Framework
if(isDAOValidatorAnnotation(annotation)) {
// On ajoute l'annotation
daoAnnotations.add(annotation);
}
}
// On retourne la liste
return daoAnnotations;
}
|
java
|
public static List<Annotation> loadDAOValidatorAnnotations(Object object) {
// Liste des annotations retrouvees
List<Annotation> daoAnnotations = new ArrayList<Annotation>();
// Si l'objet est null
if(object == null) {
// On retourne une liste vide
return daoAnnotations;
}
// Obtention des annotations de la classe
Annotation[] objectAnnotations = object.getClass().getAnnotations();
// Si le tableau est vide
if(objectAnnotations == null || objectAnnotations.length == 0) {
// On retourne une liste vide
return daoAnnotations;
}
// Parcours
for (Annotation annotation : objectAnnotations) {
// Si c'est une annotation du Framework
if(isDAOValidatorAnnotation(annotation)) {
// On ajoute l'annotation
daoAnnotations.add(annotation);
}
}
// On retourne la liste
return daoAnnotations;
}
|
[
"public",
"static",
"List",
"<",
"Annotation",
">",
"loadDAOValidatorAnnotations",
"(",
"Object",
"object",
")",
"{",
"// Liste des annotations retrouvees\r",
"List",
"<",
"Annotation",
">",
"daoAnnotations",
"=",
"new",
"ArrayList",
"<",
"Annotation",
">",
"(",
")",
";",
"// Si l'objet est null\r",
"if",
"(",
"object",
"==",
"null",
")",
"{",
"// On retourne une liste vide\r",
"return",
"daoAnnotations",
";",
"}",
"// Obtention des annotations de la classe\r",
"Annotation",
"[",
"]",
"objectAnnotations",
"=",
"object",
".",
"getClass",
"(",
")",
".",
"getAnnotations",
"(",
")",
";",
"// Si le tableau est vide\r",
"if",
"(",
"objectAnnotations",
"==",
"null",
"||",
"objectAnnotations",
".",
"length",
"==",
"0",
")",
"{",
"// On retourne une liste vide\r",
"return",
"daoAnnotations",
";",
"}",
"// Parcours\r",
"for",
"(",
"Annotation",
"annotation",
":",
"objectAnnotations",
")",
"{",
"// Si c'est une annotation du Framework\r",
"if",
"(",
"isDAOValidatorAnnotation",
"(",
"annotation",
")",
")",
"{",
"// On ajoute l'annotation\r",
"daoAnnotations",
".",
"add",
"(",
"annotation",
")",
";",
"}",
"}",
"// On retourne la liste\r",
"return",
"daoAnnotations",
";",
"}"
] |
Methode permettant de charger toutes les annotations DAO sur l'objet pour un mode donne et un temps d'evaluation donne
@param object Objet a inspecter
@return Liste des annotations DAO retrouvees
|
[
"Methode",
"permettant",
"de",
"charger",
"toutes",
"les",
"annotations",
"DAO",
"sur",
"l",
"objet",
"pour",
"un",
"mode",
"donne",
"et",
"un",
"temps",
"d",
"evaluation",
"donne"
] |
4c15372993584579d7dbb9b23dd4c0c0fdc9e789
|
https://github.com/leadware/jpersistence-tools/blob/4c15372993584579d7dbb9b23dd4c0c0fdc9e789/jpersistence-tools-core/src/main/java/net/leadware/persistence/tools/core/dao/utils/DAOValidatorHelper.java#L228-L263
|
149,880
|
leadware/jpersistence-tools
|
jpersistence-tools-core/src/main/java/net/leadware/persistence/tools/core/dao/utils/DAOValidatorHelper.java
|
DAOValidatorHelper.loadDAOValidatorClass
|
public static List<Class<? extends IDAOValidator<? extends Annotation>>> loadDAOValidatorClass(Object object) {
// Liste de classes de validation retrouvees
List<Class<? extends IDAOValidator<? extends Annotation>>> result = new ArrayList<Class<? extends IDAOValidator<? extends Annotation>>>();
// Si l'objet est null
if(object == null) {
// On retourne une liste vide
return result;
}
// Obtention des annotations de la classe
Annotation[] objectAnnotations = object.getClass().getAnnotations();
// Si le tableau est vide
if(objectAnnotations == null || objectAnnotations.length == 0) {
// On retourne une liste vide
return result;
}
// Parcours
for (Annotation annotation : objectAnnotations) {
// Si c'est une annotation du Framework
if(isDAOValidatorAnnotation(annotation)) {
// Obtention de l'annotation de validfation
DAOConstraint daoAnnotation = annotation.annotationType().getAnnotation(DAOConstraint.class);
// On ajoute l'annotation
result.add(daoAnnotation.validatedBy());
}
}
// On retourne la liste
return result;
}
|
java
|
public static List<Class<? extends IDAOValidator<? extends Annotation>>> loadDAOValidatorClass(Object object) {
// Liste de classes de validation retrouvees
List<Class<? extends IDAOValidator<? extends Annotation>>> result = new ArrayList<Class<? extends IDAOValidator<? extends Annotation>>>();
// Si l'objet est null
if(object == null) {
// On retourne une liste vide
return result;
}
// Obtention des annotations de la classe
Annotation[] objectAnnotations = object.getClass().getAnnotations();
// Si le tableau est vide
if(objectAnnotations == null || objectAnnotations.length == 0) {
// On retourne une liste vide
return result;
}
// Parcours
for (Annotation annotation : objectAnnotations) {
// Si c'est une annotation du Framework
if(isDAOValidatorAnnotation(annotation)) {
// Obtention de l'annotation de validfation
DAOConstraint daoAnnotation = annotation.annotationType().getAnnotation(DAOConstraint.class);
// On ajoute l'annotation
result.add(daoAnnotation.validatedBy());
}
}
// On retourne la liste
return result;
}
|
[
"public",
"static",
"List",
"<",
"Class",
"<",
"?",
"extends",
"IDAOValidator",
"<",
"?",
"extends",
"Annotation",
">",
">",
">",
"loadDAOValidatorClass",
"(",
"Object",
"object",
")",
"{",
"// Liste de classes de validation retrouvees\r",
"List",
"<",
"Class",
"<",
"?",
"extends",
"IDAOValidator",
"<",
"?",
"extends",
"Annotation",
">",
">",
">",
"result",
"=",
"new",
"ArrayList",
"<",
"Class",
"<",
"?",
"extends",
"IDAOValidator",
"<",
"?",
"extends",
"Annotation",
">",
">",
">",
"(",
")",
";",
"// Si l'objet est null\r",
"if",
"(",
"object",
"==",
"null",
")",
"{",
"// On retourne une liste vide\r",
"return",
"result",
";",
"}",
"// Obtention des annotations de la classe\r",
"Annotation",
"[",
"]",
"objectAnnotations",
"=",
"object",
".",
"getClass",
"(",
")",
".",
"getAnnotations",
"(",
")",
";",
"// Si le tableau est vide\r",
"if",
"(",
"objectAnnotations",
"==",
"null",
"||",
"objectAnnotations",
".",
"length",
"==",
"0",
")",
"{",
"// On retourne une liste vide\r",
"return",
"result",
";",
"}",
"// Parcours\r",
"for",
"(",
"Annotation",
"annotation",
":",
"objectAnnotations",
")",
"{",
"// Si c'est une annotation du Framework\r",
"if",
"(",
"isDAOValidatorAnnotation",
"(",
"annotation",
")",
")",
"{",
"// Obtention de l'annotation de validfation\r",
"DAOConstraint",
"daoAnnotation",
"=",
"annotation",
".",
"annotationType",
"(",
")",
".",
"getAnnotation",
"(",
"DAOConstraint",
".",
"class",
")",
";",
"// On ajoute l'annotation\r",
"result",
".",
"add",
"(",
"daoAnnotation",
".",
"validatedBy",
"(",
")",
")",
";",
"}",
"}",
"// On retourne la liste\r",
"return",
"result",
";",
"}"
] |
Methode permettant de charger toutes les Classes de validation de l'Objet en fonction du Mode
@param object Objet a inspecter
@return Liste des classes d'implementation
|
[
"Methode",
"permettant",
"de",
"charger",
"toutes",
"les",
"Classes",
"de",
"validation",
"de",
"l",
"Objet",
"en",
"fonction",
"du",
"Mode"
] |
4c15372993584579d7dbb9b23dd4c0c0fdc9e789
|
https://github.com/leadware/jpersistence-tools/blob/4c15372993584579d7dbb9b23dd4c0c0fdc9e789/jpersistence-tools-core/src/main/java/net/leadware/persistence/tools/core/dao/utils/DAOValidatorHelper.java#L270-L309
|
149,881
|
leadware/jpersistence-tools
|
jpersistence-tools-core/src/main/java/net/leadware/persistence/tools/core/dao/utils/DAOValidatorHelper.java
|
DAOValidatorHelper.getGenerationLogicClass
|
public static Class<? extends IDAOGeneratorManager<? extends Annotation>> getGenerationLogicClass(Annotation annotation) {
// Si l'annotation est nulle
if(annotation == null) {
// On retourne null
return null;
}
// Recherche dans la MAP
Class<? extends IDAOGeneratorManager<? extends Annotation>> mappedLogicClass = mGeneratorMapping.get(annotation.annotationType().getName());
// Si la Classe est non nulle
if(mappedLogicClass != null) return mappedLogicClass;
// Obtention de l'annotation DAO
DAOGeneratorManager logicAnnotation = annotation.annotationType().getAnnotation(DAOGeneratorManager.class);
// On retourne cette annotation
return logicAnnotation.managerClass();
}
|
java
|
public static Class<? extends IDAOGeneratorManager<? extends Annotation>> getGenerationLogicClass(Annotation annotation) {
// Si l'annotation est nulle
if(annotation == null) {
// On retourne null
return null;
}
// Recherche dans la MAP
Class<? extends IDAOGeneratorManager<? extends Annotation>> mappedLogicClass = mGeneratorMapping.get(annotation.annotationType().getName());
// Si la Classe est non nulle
if(mappedLogicClass != null) return mappedLogicClass;
// Obtention de l'annotation DAO
DAOGeneratorManager logicAnnotation = annotation.annotationType().getAnnotation(DAOGeneratorManager.class);
// On retourne cette annotation
return logicAnnotation.managerClass();
}
|
[
"public",
"static",
"Class",
"<",
"?",
"extends",
"IDAOGeneratorManager",
"<",
"?",
"extends",
"Annotation",
">",
">",
"getGenerationLogicClass",
"(",
"Annotation",
"annotation",
")",
"{",
"// Si l'annotation est nulle\r",
"if",
"(",
"annotation",
"==",
"null",
")",
"{",
"// On retourne null\r",
"return",
"null",
";",
"}",
"// Recherche dans la MAP\r",
"Class",
"<",
"?",
"extends",
"IDAOGeneratorManager",
"<",
"?",
"extends",
"Annotation",
">",
">",
"mappedLogicClass",
"=",
"mGeneratorMapping",
".",
"get",
"(",
"annotation",
".",
"annotationType",
"(",
")",
".",
"getName",
"(",
")",
")",
";",
"// Si la Classe est non nulle\r",
"if",
"(",
"mappedLogicClass",
"!=",
"null",
")",
"return",
"mappedLogicClass",
";",
"// Obtention de l'annotation DAO\r",
"DAOGeneratorManager",
"logicAnnotation",
"=",
"annotation",
".",
"annotationType",
"(",
")",
".",
"getAnnotation",
"(",
"DAOGeneratorManager",
".",
"class",
")",
";",
"// On retourne cette annotation\r",
"return",
"logicAnnotation",
".",
"managerClass",
"(",
")",
";",
"}"
] |
Methode permettant d'obtenir la classe de gestion du generateur
@param annotation Annotation a inspecter
@return Class d'implementation de la logique de generation
|
[
"Methode",
"permettant",
"d",
"obtenir",
"la",
"classe",
"de",
"gestion",
"du",
"generateur"
] |
4c15372993584579d7dbb9b23dd4c0c0fdc9e789
|
https://github.com/leadware/jpersistence-tools/blob/4c15372993584579d7dbb9b23dd4c0c0fdc9e789/jpersistence-tools-core/src/main/java/net/leadware/persistence/tools/core/dao/utils/DAOValidatorHelper.java#L316-L336
|
149,882
|
leadware/jpersistence-tools
|
jpersistence-tools-core/src/main/java/net/leadware/persistence/tools/core/dao/utils/DAOValidatorHelper.java
|
DAOValidatorHelper.getValidationLogicClass
|
public static Class<? extends IDAOValidator<? extends Annotation>> getValidationLogicClass(Annotation annotation) {
// Si l'annotation est nulle
if(annotation == null) {
// On retourne null
return null;
}
// Recherche dans la MAP
Class<? extends IDAOValidator<? extends Annotation>> mappedLogicClass = mValidatorMapping.get(annotation.annotationType().getName());
// Si la Classe est non nulle
if(mappedLogicClass != null) return mappedLogicClass;
// Obtention de l'annotation DAO
DAOConstraint logicAnnotation = annotation.annotationType().getAnnotation(DAOConstraint.class);
// On retourne cette annotation
return logicAnnotation.validatedBy();
}
|
java
|
public static Class<? extends IDAOValidator<? extends Annotation>> getValidationLogicClass(Annotation annotation) {
// Si l'annotation est nulle
if(annotation == null) {
// On retourne null
return null;
}
// Recherche dans la MAP
Class<? extends IDAOValidator<? extends Annotation>> mappedLogicClass = mValidatorMapping.get(annotation.annotationType().getName());
// Si la Classe est non nulle
if(mappedLogicClass != null) return mappedLogicClass;
// Obtention de l'annotation DAO
DAOConstraint logicAnnotation = annotation.annotationType().getAnnotation(DAOConstraint.class);
// On retourne cette annotation
return logicAnnotation.validatedBy();
}
|
[
"public",
"static",
"Class",
"<",
"?",
"extends",
"IDAOValidator",
"<",
"?",
"extends",
"Annotation",
">",
">",
"getValidationLogicClass",
"(",
"Annotation",
"annotation",
")",
"{",
"// Si l'annotation est nulle\r",
"if",
"(",
"annotation",
"==",
"null",
")",
"{",
"// On retourne null\r",
"return",
"null",
";",
"}",
"// Recherche dans la MAP\r",
"Class",
"<",
"?",
"extends",
"IDAOValidator",
"<",
"?",
"extends",
"Annotation",
">",
">",
"mappedLogicClass",
"=",
"mValidatorMapping",
".",
"get",
"(",
"annotation",
".",
"annotationType",
"(",
")",
".",
"getName",
"(",
")",
")",
";",
"// Si la Classe est non nulle\r",
"if",
"(",
"mappedLogicClass",
"!=",
"null",
")",
"return",
"mappedLogicClass",
";",
"// Obtention de l'annotation DAO\r",
"DAOConstraint",
"logicAnnotation",
"=",
"annotation",
".",
"annotationType",
"(",
")",
".",
"getAnnotation",
"(",
"DAOConstraint",
".",
"class",
")",
";",
"// On retourne cette annotation\r",
"return",
"logicAnnotation",
".",
"validatedBy",
"(",
")",
";",
"}"
] |
Methode permettant d'obtenir la classe d'implementation de la
logique de validation parametree sur l'annotation
@param annotation Annotation a inspecter
@return Class d'implementation de la logique de validation
|
[
"Methode",
"permettant",
"d",
"obtenir",
"la",
"classe",
"d",
"implementation",
"de",
"la",
"logique",
"de",
"validation",
"parametree",
"sur",
"l",
"annotation"
] |
4c15372993584579d7dbb9b23dd4c0c0fdc9e789
|
https://github.com/leadware/jpersistence-tools/blob/4c15372993584579d7dbb9b23dd4c0c0fdc9e789/jpersistence-tools-core/src/main/java/net/leadware/persistence/tools/core/dao/utils/DAOValidatorHelper.java#L344-L364
|
149,883
|
leadware/jpersistence-tools
|
jpersistence-tools-core/src/main/java/net/leadware/persistence/tools/core/dao/utils/DAOValidatorHelper.java
|
DAOValidatorHelper.arraryContains
|
public static <T extends Object> boolean arraryContains(T[] array, T value) {
// Si le tableau est vide
if(array == null || array.length == 0) {
// On retourne false
return false;
}
// Si le mode est vide
if(value == null) {
// On retourne false
return false;
}
// Mode dedans
boolean modeIn = false;
// Index du Tableau
int index = 0;
// Parcours
while(index < array.length && !modeIn) {
// Valeur du Tableau
T tValue = array[index++];
modeIn = tValue.equals(value);
}
// On retourne false
return modeIn;
}
|
java
|
public static <T extends Object> boolean arraryContains(T[] array, T value) {
// Si le tableau est vide
if(array == null || array.length == 0) {
// On retourne false
return false;
}
// Si le mode est vide
if(value == null) {
// On retourne false
return false;
}
// Mode dedans
boolean modeIn = false;
// Index du Tableau
int index = 0;
// Parcours
while(index < array.length && !modeIn) {
// Valeur du Tableau
T tValue = array[index++];
modeIn = tValue.equals(value);
}
// On retourne false
return modeIn;
}
|
[
"public",
"static",
"<",
"T",
"extends",
"Object",
">",
"boolean",
"arraryContains",
"(",
"T",
"[",
"]",
"array",
",",
"T",
"value",
")",
"{",
"// Si le tableau est vide\r",
"if",
"(",
"array",
"==",
"null",
"||",
"array",
".",
"length",
"==",
"0",
")",
"{",
"// On retourne false\r",
"return",
"false",
";",
"}",
"// Si le mode est vide\r",
"if",
"(",
"value",
"==",
"null",
")",
"{",
"// On retourne false\r",
"return",
"false",
";",
"}",
"// Mode dedans\r",
"boolean",
"modeIn",
"=",
"false",
";",
"// Index du Tableau\r",
"int",
"index",
"=",
"0",
";",
"// Parcours\r",
"while",
"(",
"index",
"<",
"array",
".",
"length",
"&&",
"!",
"modeIn",
")",
"{",
"// Valeur du Tableau\r",
"T",
"tValue",
"=",
"array",
"[",
"index",
"++",
"]",
";",
"modeIn",
"=",
"tValue",
".",
"equals",
"(",
"value",
")",
";",
"}",
"// On retourne false\r",
"return",
"modeIn",
";",
"}"
] |
Methode permettant de savoir si un Objet de type T est contenu dans un Tableau d'objet de type T
@param array Tableau d'objet d'un type T
@param value Objet d'un Type T
@param <T> Type de valeurs du tableau
@return Etat de presence
|
[
"Methode",
"permettant",
"de",
"savoir",
"si",
"un",
"Objet",
"de",
"type",
"T",
"est",
"contenu",
"dans",
"un",
"Tableau",
"d",
"objet",
"de",
"type",
"T"
] |
4c15372993584579d7dbb9b23dd4c0c0fdc9e789
|
https://github.com/leadware/jpersistence-tools/blob/4c15372993584579d7dbb9b23dd4c0c0fdc9e789/jpersistence-tools-core/src/main/java/net/leadware/persistence/tools/core/dao/utils/DAOValidatorHelper.java#L373-L406
|
149,884
|
leadware/jpersistence-tools
|
jpersistence-tools-core/src/main/java/net/leadware/persistence/tools/core/dao/utils/DAOValidatorHelper.java
|
DAOValidatorHelper.isExpressionContainsENV
|
public static boolean isExpressionContainsENV(String expression) {
// Si la chaine est vide : false
if(expression == null || expression.trim().length() == 0) {
// On retourne false
return false;
}
// On split
return isExpressionContainPattern(expression, ENV_CHAIN_PATTERN);
}
|
java
|
public static boolean isExpressionContainsENV(String expression) {
// Si la chaine est vide : false
if(expression == null || expression.trim().length() == 0) {
// On retourne false
return false;
}
// On split
return isExpressionContainPattern(expression, ENV_CHAIN_PATTERN);
}
|
[
"public",
"static",
"boolean",
"isExpressionContainsENV",
"(",
"String",
"expression",
")",
"{",
"// Si la chaine est vide : false\r",
"if",
"(",
"expression",
"==",
"null",
"||",
"expression",
".",
"trim",
"(",
")",
".",
"length",
"(",
")",
"==",
"0",
")",
"{",
"// On retourne false\r",
"return",
"false",
";",
"}",
"// On split\r",
"return",
"isExpressionContainPattern",
"(",
"expression",
",",
"ENV_CHAIN_PATTERN",
")",
";",
"}"
] |
Methode permettant de verifier si un chemin contient des variables d'environnement
@param expression Chaine a controler
@return Resultat de la verification
|
[
"Methode",
"permettant",
"de",
"verifier",
"si",
"un",
"chemin",
"contient",
"des",
"variables",
"d",
"environnement"
] |
4c15372993584579d7dbb9b23dd4c0c0fdc9e789
|
https://github.com/leadware/jpersistence-tools/blob/4c15372993584579d7dbb9b23dd4c0c0fdc9e789/jpersistence-tools-core/src/main/java/net/leadware/persistence/tools/core/dao/utils/DAOValidatorHelper.java#L413-L424
|
149,885
|
leadware/jpersistence-tools
|
jpersistence-tools-core/src/main/java/net/leadware/persistence/tools/core/dao/utils/DAOValidatorHelper.java
|
DAOValidatorHelper.resolveEnvironmentsParameters
|
public static String resolveEnvironmentsParameters(String expression) {
// Si l'expression est vide
if(expression == null || expression.trim().length() == 0) {
// On retourne null
return null;
}
// Tant que la chaene traitee contient des ENVs
while(isExpressionContainPattern(expression, ENV_CHAIN_PATTERN)) {
// Obtention de la liste des ENVs
String[] envs = extractToken(expression, ENV_CHAIN_PATTERN);
// Parcours
for (String env : envs) {
String cleanEnv = env.replace("${", "");
cleanEnv = cleanEnv.replace("}", "");
// On remplace l'occurence courante par le nom de la variable
expression = expression.replace(env, System.getProperty(cleanEnv));
}
}
// On retourne l'expression
return expression;
}
|
java
|
public static String resolveEnvironmentsParameters(String expression) {
// Si l'expression est vide
if(expression == null || expression.trim().length() == 0) {
// On retourne null
return null;
}
// Tant que la chaene traitee contient des ENVs
while(isExpressionContainPattern(expression, ENV_CHAIN_PATTERN)) {
// Obtention de la liste des ENVs
String[] envs = extractToken(expression, ENV_CHAIN_PATTERN);
// Parcours
for (String env : envs) {
String cleanEnv = env.replace("${", "");
cleanEnv = cleanEnv.replace("}", "");
// On remplace l'occurence courante par le nom de la variable
expression = expression.replace(env, System.getProperty(cleanEnv));
}
}
// On retourne l'expression
return expression;
}
|
[
"public",
"static",
"String",
"resolveEnvironmentsParameters",
"(",
"String",
"expression",
")",
"{",
"// Si l'expression est vide\r",
"if",
"(",
"expression",
"==",
"null",
"||",
"expression",
".",
"trim",
"(",
")",
".",
"length",
"(",
")",
"==",
"0",
")",
"{",
"// On retourne null\r",
"return",
"null",
";",
"}",
"// Tant que la chaene traitee contient des ENVs\r",
"while",
"(",
"isExpressionContainPattern",
"(",
"expression",
",",
"ENV_CHAIN_PATTERN",
")",
")",
"{",
"// Obtention de la liste des ENVs\r",
"String",
"[",
"]",
"envs",
"=",
"extractToken",
"(",
"expression",
",",
"ENV_CHAIN_PATTERN",
")",
";",
"// Parcours\r",
"for",
"(",
"String",
"env",
":",
"envs",
")",
"{",
"String",
"cleanEnv",
"=",
"env",
".",
"replace",
"(",
"\"${\"",
",",
"\"\"",
")",
";",
"cleanEnv",
"=",
"cleanEnv",
".",
"replace",
"(",
"\"}\"",
",",
"\"\"",
")",
";",
"// On remplace l'occurence courante par le nom de la variable\r",
"expression",
"=",
"expression",
".",
"replace",
"(",
"env",
",",
"System",
".",
"getProperty",
"(",
"cleanEnv",
")",
")",
";",
"}",
"}",
"// On retourne l'expression\r",
"return",
"expression",
";",
"}"
] |
Methode permettant de resoudre les variables d'environnement dans une chemin
@param expression Expression du chemin
@return Expression resolue
|
[
"Methode",
"permettant",
"de",
"resoudre",
"les",
"variables",
"d",
"environnement",
"dans",
"une",
"chemin"
] |
4c15372993584579d7dbb9b23dd4c0c0fdc9e789
|
https://github.com/leadware/jpersistence-tools/blob/4c15372993584579d7dbb9b23dd4c0c0fdc9e789/jpersistence-tools-core/src/main/java/net/leadware/persistence/tools/core/dao/utils/DAOValidatorHelper.java#L442-L470
|
149,886
|
leadware/jpersistence-tools
|
jpersistence-tools-core/src/main/java/net/leadware/persistence/tools/core/dao/utils/DAOValidatorHelper.java
|
DAOValidatorHelper.computeExpression
|
public static ExpressionModel computeExpression(String expression) {
// Si l'expression est vide
if(expression == null || expression.trim().length() == 0) {
// On retourne null
return null;
}
// On Instancie un model d'expression
ExpressionModel expressionModel = new ExpressionModel(expression.trim());
// Index de l'iteration
int i = 0;
// Si la chaine contient des Fonctions
if(isExpressionContainPattern(expression.trim(), FUNC_CHAIN_PATTERN)) {
// Obtention de la liste des Fonctions
String[] functions = extractToken(expression, FUNC_CHAIN_PATTERN);
// Parcours
for (String function : functions) {
// Chaine en cours
String currentExpression = expressionModel.getComputedExpression();
// Nom de la Variable
String parameterName = "var" + i++;
// On remplace l'occurence courante par le nom de la variable
currentExpression = currentExpression.replace(function, ":" + parameterName);
// On met a jour l'expression computee
expressionModel.setComputedExpression(currentExpression);
// On ajoute les parametres
expressionModel.addParameter(parameterName, function);
}
}
// Tant que la chaene traitee contient des ENVs
while(isExpressionContainPattern(expressionModel.getComputedExpression(), ENV_CHAIN_PATTERN)) {
// Obtention de la liste des ENVs
String[] envs = extractToken(expressionModel.getComputedExpression(), ENV_CHAIN_PATTERN);
// Parcours
for (String env : envs) {
// Chaine en cours
String currentExpression = expressionModel.getComputedExpression();
// Nom de la Variable
String parameterName = "var" + i++;
// On remplace l'occurence courante par le nom de la variable
currentExpression = currentExpression.replace(env, ":" + parameterName);
// On met a jour l'expression computee
expressionModel.setComputedExpression(currentExpression);
// On ajoute les parametres
expressionModel.addParameter(parameterName, env);
}
}
// On retourne l'expression
return expressionModel;
}
|
java
|
public static ExpressionModel computeExpression(String expression) {
// Si l'expression est vide
if(expression == null || expression.trim().length() == 0) {
// On retourne null
return null;
}
// On Instancie un model d'expression
ExpressionModel expressionModel = new ExpressionModel(expression.trim());
// Index de l'iteration
int i = 0;
// Si la chaine contient des Fonctions
if(isExpressionContainPattern(expression.trim(), FUNC_CHAIN_PATTERN)) {
// Obtention de la liste des Fonctions
String[] functions = extractToken(expression, FUNC_CHAIN_PATTERN);
// Parcours
for (String function : functions) {
// Chaine en cours
String currentExpression = expressionModel.getComputedExpression();
// Nom de la Variable
String parameterName = "var" + i++;
// On remplace l'occurence courante par le nom de la variable
currentExpression = currentExpression.replace(function, ":" + parameterName);
// On met a jour l'expression computee
expressionModel.setComputedExpression(currentExpression);
// On ajoute les parametres
expressionModel.addParameter(parameterName, function);
}
}
// Tant que la chaene traitee contient des ENVs
while(isExpressionContainPattern(expressionModel.getComputedExpression(), ENV_CHAIN_PATTERN)) {
// Obtention de la liste des ENVs
String[] envs = extractToken(expressionModel.getComputedExpression(), ENV_CHAIN_PATTERN);
// Parcours
for (String env : envs) {
// Chaine en cours
String currentExpression = expressionModel.getComputedExpression();
// Nom de la Variable
String parameterName = "var" + i++;
// On remplace l'occurence courante par le nom de la variable
currentExpression = currentExpression.replace(env, ":" + parameterName);
// On met a jour l'expression computee
expressionModel.setComputedExpression(currentExpression);
// On ajoute les parametres
expressionModel.addParameter(parameterName, env);
}
}
// On retourne l'expression
return expressionModel;
}
|
[
"public",
"static",
"ExpressionModel",
"computeExpression",
"(",
"String",
"expression",
")",
"{",
"// Si l'expression est vide\r",
"if",
"(",
"expression",
"==",
"null",
"||",
"expression",
".",
"trim",
"(",
")",
".",
"length",
"(",
")",
"==",
"0",
")",
"{",
"// On retourne null\r",
"return",
"null",
";",
"}",
"// On Instancie un model d'expression\r",
"ExpressionModel",
"expressionModel",
"=",
"new",
"ExpressionModel",
"(",
"expression",
".",
"trim",
"(",
")",
")",
";",
"// Index de l'iteration\r",
"int",
"i",
"=",
"0",
";",
"// Si la chaine contient des Fonctions\r",
"if",
"(",
"isExpressionContainPattern",
"(",
"expression",
".",
"trim",
"(",
")",
",",
"FUNC_CHAIN_PATTERN",
")",
")",
"{",
"// Obtention de la liste des Fonctions\r",
"String",
"[",
"]",
"functions",
"=",
"extractToken",
"(",
"expression",
",",
"FUNC_CHAIN_PATTERN",
")",
";",
"// Parcours\r",
"for",
"(",
"String",
"function",
":",
"functions",
")",
"{",
"// Chaine en cours\r",
"String",
"currentExpression",
"=",
"expressionModel",
".",
"getComputedExpression",
"(",
")",
";",
"// Nom de la Variable\r",
"String",
"parameterName",
"=",
"\"var\"",
"+",
"i",
"++",
";",
"// On remplace l'occurence courante par le nom de la variable\r",
"currentExpression",
"=",
"currentExpression",
".",
"replace",
"(",
"function",
",",
"\":\"",
"+",
"parameterName",
")",
";",
"// On met a jour l'expression computee\r",
"expressionModel",
".",
"setComputedExpression",
"(",
"currentExpression",
")",
";",
"// On ajoute les parametres\r",
"expressionModel",
".",
"addParameter",
"(",
"parameterName",
",",
"function",
")",
";",
"}",
"}",
"// Tant que la chaene traitee contient des ENVs\r",
"while",
"(",
"isExpressionContainPattern",
"(",
"expressionModel",
".",
"getComputedExpression",
"(",
")",
",",
"ENV_CHAIN_PATTERN",
")",
")",
"{",
"// Obtention de la liste des ENVs\r",
"String",
"[",
"]",
"envs",
"=",
"extractToken",
"(",
"expressionModel",
".",
"getComputedExpression",
"(",
")",
",",
"ENV_CHAIN_PATTERN",
")",
";",
"// Parcours\r",
"for",
"(",
"String",
"env",
":",
"envs",
")",
"{",
"// Chaine en cours\r",
"String",
"currentExpression",
"=",
"expressionModel",
".",
"getComputedExpression",
"(",
")",
";",
"// Nom de la Variable\r",
"String",
"parameterName",
"=",
"\"var\"",
"+",
"i",
"++",
";",
"// On remplace l'occurence courante par le nom de la variable\r",
"currentExpression",
"=",
"currentExpression",
".",
"replace",
"(",
"env",
",",
"\":\"",
"+",
"parameterName",
")",
";",
"// On met a jour l'expression computee\r",
"expressionModel",
".",
"setComputedExpression",
"(",
"currentExpression",
")",
";",
"// On ajoute les parametres\r",
"expressionModel",
".",
"addParameter",
"(",
"parameterName",
",",
"env",
")",
";",
"}",
"}",
"// On retourne l'expression\r",
"return",
"expressionModel",
";",
"}"
] |
Methode de resolution d'une Expression
@param expression Expression a transformer
@return Modele de l'expression transformee
|
[
"Methode",
"de",
"resolution",
"d",
"une",
"Expression"
] |
4c15372993584579d7dbb9b23dd4c0c0fdc9e789
|
https://github.com/leadware/jpersistence-tools/blob/4c15372993584579d7dbb9b23dd4c0c0fdc9e789/jpersistence-tools-core/src/main/java/net/leadware/persistence/tools/core/dao/utils/DAOValidatorHelper.java#L477-L547
|
149,887
|
leadware/jpersistence-tools
|
jpersistence-tools-core/src/main/java/net/leadware/persistence/tools/core/dao/utils/DAOValidatorHelper.java
|
DAOValidatorHelper.extractFunctionName
|
public static String extractFunctionName(String functionToken) {
// Si le Token est null
if(functionToken == null || functionToken.trim().length() == 0){
// On retourne la chaine
return functionToken;
}
int index0 = functionToken.indexOf(SIMPLE_FUNCTION_LEFT_DELIMITER);
int index1 = functionToken.indexOf(SIMPLE_FUNCTION_OPEN);
// Extraction du nom de la fonction
String fName = functionToken.substring(index0 + SIMPLE_FUNCTION_LEFT_DELIMITER.length(), index1);
// On retourne la deuxieme
return fName;
}
|
java
|
public static String extractFunctionName(String functionToken) {
// Si le Token est null
if(functionToken == null || functionToken.trim().length() == 0){
// On retourne la chaine
return functionToken;
}
int index0 = functionToken.indexOf(SIMPLE_FUNCTION_LEFT_DELIMITER);
int index1 = functionToken.indexOf(SIMPLE_FUNCTION_OPEN);
// Extraction du nom de la fonction
String fName = functionToken.substring(index0 + SIMPLE_FUNCTION_LEFT_DELIMITER.length(), index1);
// On retourne la deuxieme
return fName;
}
|
[
"public",
"static",
"String",
"extractFunctionName",
"(",
"String",
"functionToken",
")",
"{",
"// Si le Token est null\r",
"if",
"(",
"functionToken",
"==",
"null",
"||",
"functionToken",
".",
"trim",
"(",
")",
".",
"length",
"(",
")",
"==",
"0",
")",
"{",
"// On retourne la chaine\r",
"return",
"functionToken",
";",
"}",
"int",
"index0",
"=",
"functionToken",
".",
"indexOf",
"(",
"SIMPLE_FUNCTION_LEFT_DELIMITER",
")",
";",
"int",
"index1",
"=",
"functionToken",
".",
"indexOf",
"(",
"SIMPLE_FUNCTION_OPEN",
")",
";",
"// Extraction du nom de la fonction\r",
"String",
"fName",
"=",
"functionToken",
".",
"substring",
"(",
"index0",
"+",
"SIMPLE_FUNCTION_LEFT_DELIMITER",
".",
"length",
"(",
")",
",",
"index1",
")",
";",
"// On retourne la deuxieme\r",
"return",
"fName",
";",
"}"
] |
Methode permettant d'extraire le nom de la fonction
@param functionToken Topken de fonction
@return Nom de la fonction
|
[
"Methode",
"permettant",
"d",
"extraire",
"le",
"nom",
"de",
"la",
"fonction"
] |
4c15372993584579d7dbb9b23dd4c0c0fdc9e789
|
https://github.com/leadware/jpersistence-tools/blob/4c15372993584579d7dbb9b23dd4c0c0fdc9e789/jpersistence-tools-core/src/main/java/net/leadware/persistence/tools/core/dao/utils/DAOValidatorHelper.java#L614-L631
|
149,888
|
leadware/jpersistence-tools
|
jpersistence-tools-core/src/main/java/net/leadware/persistence/tools/core/dao/utils/DAOValidatorHelper.java
|
DAOValidatorHelper.extractToken
|
public static String[] extractToken(String expression, String pattern) {
// Si la chaine est vide
if(expression == null || expression.trim().length() == 0) {
// On retourne null;
return null;
}
// Si le pattern est null
if(pattern == null) {
// On retourne null;
return null;
}
// On splitte par l'espace
String[] spacePlitted = expression.split(SPLITTER_CHAIN);
// Array des Tokens
StringBuffer aTokens = new StringBuffer();
// Un Index
int index = 0;
// On parcours le tableau
for (String spaceToken : spacePlitted) {
// Si le token ne respecte pas le pattern
if(isExpressionContainPattern(spaceToken, pattern)) {
// Si on est pas au premier
if(index++ > 0) aTokens.append("@");
// On ajoute
aTokens.append(spaceToken);
}
}
// On split la chaine originale avec ce pattern
return aTokens.toString().split("@");
}
|
java
|
public static String[] extractToken(String expression, String pattern) {
// Si la chaine est vide
if(expression == null || expression.trim().length() == 0) {
// On retourne null;
return null;
}
// Si le pattern est null
if(pattern == null) {
// On retourne null;
return null;
}
// On splitte par l'espace
String[] spacePlitted = expression.split(SPLITTER_CHAIN);
// Array des Tokens
StringBuffer aTokens = new StringBuffer();
// Un Index
int index = 0;
// On parcours le tableau
for (String spaceToken : spacePlitted) {
// Si le token ne respecte pas le pattern
if(isExpressionContainPattern(spaceToken, pattern)) {
// Si on est pas au premier
if(index++ > 0) aTokens.append("@");
// On ajoute
aTokens.append(spaceToken);
}
}
// On split la chaine originale avec ce pattern
return aTokens.toString().split("@");
}
|
[
"public",
"static",
"String",
"[",
"]",
"extractToken",
"(",
"String",
"expression",
",",
"String",
"pattern",
")",
"{",
"// Si la chaine est vide\r",
"if",
"(",
"expression",
"==",
"null",
"||",
"expression",
".",
"trim",
"(",
")",
".",
"length",
"(",
")",
"==",
"0",
")",
"{",
"// On retourne null;\r",
"return",
"null",
";",
"}",
"// Si le pattern est null\r",
"if",
"(",
"pattern",
"==",
"null",
")",
"{",
"// On retourne null;\r",
"return",
"null",
";",
"}",
"// On splitte par l'espace\r",
"String",
"[",
"]",
"spacePlitted",
"=",
"expression",
".",
"split",
"(",
"SPLITTER_CHAIN",
")",
";",
"// Array des Tokens\r",
"StringBuffer",
"aTokens",
"=",
"new",
"StringBuffer",
"(",
")",
";",
"// Un Index\r",
"int",
"index",
"=",
"0",
";",
"// On parcours le tableau\r",
"for",
"(",
"String",
"spaceToken",
":",
"spacePlitted",
")",
"{",
"// Si le token ne respecte pas le pattern\r",
"if",
"(",
"isExpressionContainPattern",
"(",
"spaceToken",
",",
"pattern",
")",
")",
"{",
"// Si on est pas au premier\r",
"if",
"(",
"index",
"++",
">",
"0",
")",
"aTokens",
".",
"append",
"(",
"\"@\"",
")",
";",
"// On ajoute\r",
"aTokens",
".",
"append",
"(",
"spaceToken",
")",
";",
"}",
"}",
"// On split la chaine originale avec ce pattern\r",
"return",
"aTokens",
".",
"toString",
"(",
")",
".",
"split",
"(",
"\"@\"",
")",
";",
"}"
] |
Methode d'extraction de toutes les sous-chaines respectant le pattern donne
@param expression Expression mere
@param pattern Pattern a rechercher
@return Liste des sous-chaines respectant ce pattern
|
[
"Methode",
"d",
"extraction",
"de",
"toutes",
"les",
"sous",
"-",
"chaines",
"respectant",
"le",
"pattern",
"donne"
] |
4c15372993584579d7dbb9b23dd4c0c0fdc9e789
|
https://github.com/leadware/jpersistence-tools/blob/4c15372993584579d7dbb9b23dd4c0c0fdc9e789/jpersistence-tools-core/src/main/java/net/leadware/persistence/tools/core/dao/utils/DAOValidatorHelper.java#L660-L701
|
149,889
|
leadware/jpersistence-tools
|
jpersistence-tools-core/src/main/java/net/leadware/persistence/tools/core/dao/utils/DAOValidatorHelper.java
|
DAOValidatorHelper.checkContainsInvalidCharacter
|
public static boolean checkContainsInvalidCharacter(String text, String invalidCharacters){
if(text == null || text.trim().length() == 0 || invalidCharacters == null) return false;
for (char c : invalidCharacters.toCharArray()) {
if(text.indexOf(new String(new char[]{c})) >= 0) return true;
}
return false;
}
|
java
|
public static boolean checkContainsInvalidCharacter(String text, String invalidCharacters){
if(text == null || text.trim().length() == 0 || invalidCharacters == null) return false;
for (char c : invalidCharacters.toCharArray()) {
if(text.indexOf(new String(new char[]{c})) >= 0) return true;
}
return false;
}
|
[
"public",
"static",
"boolean",
"checkContainsInvalidCharacter",
"(",
"String",
"text",
",",
"String",
"invalidCharacters",
")",
"{",
"if",
"(",
"text",
"==",
"null",
"||",
"text",
".",
"trim",
"(",
")",
".",
"length",
"(",
")",
"==",
"0",
"||",
"invalidCharacters",
"==",
"null",
")",
"return",
"false",
";",
"for",
"(",
"char",
"c",
":",
"invalidCharacters",
".",
"toCharArray",
"(",
")",
")",
"{",
"if",
"(",
"text",
".",
"indexOf",
"(",
"new",
"String",
"(",
"new",
"char",
"[",
"]",
"{",
"c",
"}",
")",
")",
">=",
"0",
")",
"return",
"true",
";",
"}",
"return",
"false",
";",
"}"
] |
Methode qui teste si une chaine donnee contient un des caracteres d'une liste
@param text Chaine dans laquelle on rcherche les caracteres
@param invalidCharacters Liste ds caracteres recherches
@return Etat de contenance
|
[
"Methode",
"qui",
"teste",
"si",
"une",
"chaine",
"donnee",
"contient",
"un",
"des",
"caracteres",
"d",
"une",
"liste"
] |
4c15372993584579d7dbb9b23dd4c0c0fdc9e789
|
https://github.com/leadware/jpersistence-tools/blob/4c15372993584579d7dbb9b23dd4c0c0fdc9e789/jpersistence-tools-core/src/main/java/net/leadware/persistence/tools/core/dao/utils/DAOValidatorHelper.java#L810-L818
|
149,890
|
leadware/jpersistence-tools
|
jpersistence-tools-core/src/main/java/net/leadware/persistence/tools/core/dao/utils/DAOValidatorHelper.java
|
DAOValidatorHelper.isAlphaNumericString
|
public static boolean isAlphaNumericString(String text){
// Le Pattern representant une chaine AlphaNumerique
Pattern pattern = Pattern.compile("\\w+");
// Test
return (text != null) && (text.trim().length() > 0) && (pattern.matcher(text).matches());
}
|
java
|
public static boolean isAlphaNumericString(String text){
// Le Pattern representant une chaine AlphaNumerique
Pattern pattern = Pattern.compile("\\w+");
// Test
return (text != null) && (text.trim().length() > 0) && (pattern.matcher(text).matches());
}
|
[
"public",
"static",
"boolean",
"isAlphaNumericString",
"(",
"String",
"text",
")",
"{",
"// Le Pattern representant une chaine AlphaNumerique\r",
"Pattern",
"pattern",
"=",
"Pattern",
".",
"compile",
"(",
"\"\\\\w+\"",
")",
";",
"// Test\r",
"return",
"(",
"text",
"!=",
"null",
")",
"&&",
"(",
"text",
".",
"trim",
"(",
")",
".",
"length",
"(",
")",
">",
"0",
")",
"&&",
"(",
"pattern",
".",
"matcher",
"(",
"text",
")",
".",
"matches",
"(",
")",
")",
";",
"}"
] |
Methode qui teste si une chaine ne contient que des caracteres alphanumeriques
@param text Chaine a tester
@return Statut de contenance
|
[
"Methode",
"qui",
"teste",
"si",
"une",
"chaine",
"ne",
"contient",
"que",
"des",
"caracteres",
"alphanumeriques"
] |
4c15372993584579d7dbb9b23dd4c0c0fdc9e789
|
https://github.com/leadware/jpersistence-tools/blob/4c15372993584579d7dbb9b23dd4c0c0fdc9e789/jpersistence-tools-core/src/main/java/net/leadware/persistence/tools/core/dao/utils/DAOValidatorHelper.java#L825-L832
|
149,891
|
leadware/jpersistence-tools
|
jpersistence-tools-core/src/main/java/net/leadware/persistence/tools/core/dao/utils/DAOValidatorHelper.java
|
DAOValidatorHelper.getAllFields
|
public static List<Field> getAllFields(Class<?> type, boolean ignoreRoot) {
// Liste des champs
List<Field> fields = new ArrayList<Field>();
// Ajout des champs directs de la classe
fields.addAll(Arrays.asList(type.getDeclaredFields()));
// Superclasse
Class<?> superType = type.getSuperclass();
// Si la super classe est Object
if(superType != null && !superType.equals(Object.class)) fields.addAll(getAllFields(superType, ignoreRoot));
// On retourne la liste
return fields;
}
|
java
|
public static List<Field> getAllFields(Class<?> type, boolean ignoreRoot) {
// Liste des champs
List<Field> fields = new ArrayList<Field>();
// Ajout des champs directs de la classe
fields.addAll(Arrays.asList(type.getDeclaredFields()));
// Superclasse
Class<?> superType = type.getSuperclass();
// Si la super classe est Object
if(superType != null && !superType.equals(Object.class)) fields.addAll(getAllFields(superType, ignoreRoot));
// On retourne la liste
return fields;
}
|
[
"public",
"static",
"List",
"<",
"Field",
">",
"getAllFields",
"(",
"Class",
"<",
"?",
">",
"type",
",",
"boolean",
"ignoreRoot",
")",
"{",
"// Liste des champs\r",
"List",
"<",
"Field",
">",
"fields",
"=",
"new",
"ArrayList",
"<",
"Field",
">",
"(",
")",
";",
"// Ajout des champs directs de la classe\r",
"fields",
".",
"addAll",
"(",
"Arrays",
".",
"asList",
"(",
"type",
".",
"getDeclaredFields",
"(",
")",
")",
")",
";",
"// Superclasse\r",
"Class",
"<",
"?",
">",
"superType",
"=",
"type",
".",
"getSuperclass",
"(",
")",
";",
"// Si la super classe est Object\r",
"if",
"(",
"superType",
"!=",
"null",
"&&",
"!",
"superType",
".",
"equals",
"(",
"Object",
".",
"class",
")",
")",
"fields",
".",
"addAll",
"(",
"getAllFields",
"(",
"superType",
",",
"ignoreRoot",
")",
")",
";",
"// On retourne la liste \r",
"return",
"fields",
";",
"}"
] |
Methode permettant d'obtenir la liste de tous les champs d'une classe
@param type Classes source
@param ignoreRoot ignorer ou traiter le root
@return Liste des classes
|
[
"Methode",
"permettant",
"d",
"obtenir",
"la",
"liste",
"de",
"tous",
"les",
"champs",
"d",
"une",
"classe"
] |
4c15372993584579d7dbb9b23dd4c0c0fdc9e789
|
https://github.com/leadware/jpersistence-tools/blob/4c15372993584579d7dbb9b23dd4c0c0fdc9e789/jpersistence-tools-core/src/main/java/net/leadware/persistence/tools/core/dao/utils/DAOValidatorHelper.java#L840-L856
|
149,892
|
mlhartme/mork
|
src/main/java/net/oneandone/mork/grammar/Grammar.java
|
Grammar.forProductions
|
public static Grammar forProductions(String ... prods) {
StringArrayList symbolTable;
Grammar grammar;
String s;
String[] stringProd;
int[] prod;
int idx;
grammar = new Grammar();
symbolTable = grammar.symbolTable;
idx = 0; // definite assignment
for (int p = 0; p < prods.length; p++) {
stringProd = Strings.toArray(Separator.SPACE.split(prods[p]));
if (stringProd.length == 0) {
throw new IllegalArgumentException();
}
prod = new int[stringProd.length];
// count backwards to have the left-hand-side in idx when the loop has finished
for (int ofs = prod.length - 1; ofs >= 0; ofs--) {
s = stringProd[ofs];
idx = symbolTable.indexOf(s);
if (idx == -1) {
idx = symbolTable.size();
symbolTable.add(s);
}
prod[ofs] = idx;
}
if (p == 0) {
grammar.start = idx;
}
grammar.addProduction(prod);
}
return grammar;
}
|
java
|
public static Grammar forProductions(String ... prods) {
StringArrayList symbolTable;
Grammar grammar;
String s;
String[] stringProd;
int[] prod;
int idx;
grammar = new Grammar();
symbolTable = grammar.symbolTable;
idx = 0; // definite assignment
for (int p = 0; p < prods.length; p++) {
stringProd = Strings.toArray(Separator.SPACE.split(prods[p]));
if (stringProd.length == 0) {
throw new IllegalArgumentException();
}
prod = new int[stringProd.length];
// count backwards to have the left-hand-side in idx when the loop has finished
for (int ofs = prod.length - 1; ofs >= 0; ofs--) {
s = stringProd[ofs];
idx = symbolTable.indexOf(s);
if (idx == -1) {
idx = symbolTable.size();
symbolTable.add(s);
}
prod[ofs] = idx;
}
if (p == 0) {
grammar.start = idx;
}
grammar.addProduction(prod);
}
return grammar;
}
|
[
"public",
"static",
"Grammar",
"forProductions",
"(",
"String",
"...",
"prods",
")",
"{",
"StringArrayList",
"symbolTable",
";",
"Grammar",
"grammar",
";",
"String",
"s",
";",
"String",
"[",
"]",
"stringProd",
";",
"int",
"[",
"]",
"prod",
";",
"int",
"idx",
";",
"grammar",
"=",
"new",
"Grammar",
"(",
")",
";",
"symbolTable",
"=",
"grammar",
".",
"symbolTable",
";",
"idx",
"=",
"0",
";",
"// definite assignment",
"for",
"(",
"int",
"p",
"=",
"0",
";",
"p",
"<",
"prods",
".",
"length",
";",
"p",
"++",
")",
"{",
"stringProd",
"=",
"Strings",
".",
"toArray",
"(",
"Separator",
".",
"SPACE",
".",
"split",
"(",
"prods",
"[",
"p",
"]",
")",
")",
";",
"if",
"(",
"stringProd",
".",
"length",
"==",
"0",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
")",
";",
"}",
"prod",
"=",
"new",
"int",
"[",
"stringProd",
".",
"length",
"]",
";",
"// count backwards to have the left-hand-side in idx when the loop has finished",
"for",
"(",
"int",
"ofs",
"=",
"prod",
".",
"length",
"-",
"1",
";",
"ofs",
">=",
"0",
";",
"ofs",
"--",
")",
"{",
"s",
"=",
"stringProd",
"[",
"ofs",
"]",
";",
"idx",
"=",
"symbolTable",
".",
"indexOf",
"(",
"s",
")",
";",
"if",
"(",
"idx",
"==",
"-",
"1",
")",
"{",
"idx",
"=",
"symbolTable",
".",
"size",
"(",
")",
";",
"symbolTable",
".",
"add",
"(",
"s",
")",
";",
"}",
"prod",
"[",
"ofs",
"]",
"=",
"idx",
";",
"}",
"if",
"(",
"p",
"==",
"0",
")",
"{",
"grammar",
".",
"start",
"=",
"idx",
";",
"}",
"grammar",
".",
"addProduction",
"(",
"prod",
")",
";",
"}",
"return",
"grammar",
";",
"}"
] |
start symbol is set to the subject of the first production.
|
[
"start",
"symbol",
"is",
"set",
"to",
"the",
"subject",
"of",
"the",
"first",
"production",
"."
] |
a069b087750c4133bfeebaf1f599c3bc96762113
|
https://github.com/mlhartme/mork/blob/a069b087750c4133bfeebaf1f599c3bc96762113/src/main/java/net/oneandone/mork/grammar/Grammar.java#L39-L72
|
149,893
|
mlhartme/mork
|
src/main/java/net/oneandone/mork/grammar/Grammar.java
|
Grammar.packSymbols
|
public void packSymbols(int first, int end) {
int src;
int dest;
boolean touched;
dest = first;
for (src = first; src < end; src++) {
touched = renameSymbol(src, dest);
if (touched) {
dest++;
} else {
// src not found; dest stays unused
}
}
}
|
java
|
public void packSymbols(int first, int end) {
int src;
int dest;
boolean touched;
dest = first;
for (src = first; src < end; src++) {
touched = renameSymbol(src, dest);
if (touched) {
dest++;
} else {
// src not found; dest stays unused
}
}
}
|
[
"public",
"void",
"packSymbols",
"(",
"int",
"first",
",",
"int",
"end",
")",
"{",
"int",
"src",
";",
"int",
"dest",
";",
"boolean",
"touched",
";",
"dest",
"=",
"first",
";",
"for",
"(",
"src",
"=",
"first",
";",
"src",
"<",
"end",
";",
"src",
"++",
")",
"{",
"touched",
"=",
"renameSymbol",
"(",
"src",
",",
"dest",
")",
";",
"if",
"(",
"touched",
")",
"{",
"dest",
"++",
";",
"}",
"else",
"{",
"// src not found; dest stays unused",
"}",
"}",
"}"
] |
pack helper symbols
@param end = last + 1
|
[
"pack",
"helper",
"symbols"
] |
a069b087750c4133bfeebaf1f599c3bc96762113
|
https://github.com/mlhartme/mork/blob/a069b087750c4133bfeebaf1f599c3bc96762113/src/main/java/net/oneandone/mork/grammar/Grammar.java#L492-L506
|
149,894
|
mlhartme/mork
|
src/main/java/net/oneandone/mork/grammar/Grammar.java
|
Grammar.expandSymbol
|
public void expandSymbol(int symbol) {
int prod, maxProd;
int ofs, maxOfs;
int ofs2, maxOfs2;
int i, j;
boolean found;
int count, nextCount;
IntArrayList next;
int[][] expand;
List<int[]> expandLst;
int right;
maxProd = getProductionCount();
// make an array of the expand prods to easily index them;
// storing the indexes instead is difficult because the indexes
// max change
expandLst = new ArrayList<int[]>();
for (prod = 0; prod < maxProd; prod++) {
if (getLeft(prod) == symbol) {
expandLst.add(getProduction(prod));
}
}
expand = new int[expandLst.size()][];
expandLst.toArray(expand);
for (prod = maxProd - 1; prod >= 0; prod--) {
maxOfs = getLength(prod);
found = false;
nextCount = 1;
for (ofs = 0; ofs < maxOfs; ofs++) {
if (getRight(prod, ofs) == symbol) {
found = true;
nextCount *= expand.length;
}
}
if (found) {
// testing found is an optimization
for (i = 0; i < nextCount; i++) {
count = i;
next = new IntArrayList();
next.add(getLeft(prod));
for (ofs = 0; ofs < maxOfs; ofs++) {
right = getRight(prod, ofs);
if (right == symbol) {
j = count % expand.length;
maxOfs2 = expand[j].length;
for (ofs2 = 1; ofs2 < maxOfs2; ofs2++) {
next.add(expand[j][ofs2]);
}
count /= expand.length;
} else {
next.add(right);
}
}
if (count != 0) {
throw new RuntimeException();
}
addProduction(prod + 1, next.toArray());
}
removeProduction(prod);
}
}
}
|
java
|
public void expandSymbol(int symbol) {
int prod, maxProd;
int ofs, maxOfs;
int ofs2, maxOfs2;
int i, j;
boolean found;
int count, nextCount;
IntArrayList next;
int[][] expand;
List<int[]> expandLst;
int right;
maxProd = getProductionCount();
// make an array of the expand prods to easily index them;
// storing the indexes instead is difficult because the indexes
// max change
expandLst = new ArrayList<int[]>();
for (prod = 0; prod < maxProd; prod++) {
if (getLeft(prod) == symbol) {
expandLst.add(getProduction(prod));
}
}
expand = new int[expandLst.size()][];
expandLst.toArray(expand);
for (prod = maxProd - 1; prod >= 0; prod--) {
maxOfs = getLength(prod);
found = false;
nextCount = 1;
for (ofs = 0; ofs < maxOfs; ofs++) {
if (getRight(prod, ofs) == symbol) {
found = true;
nextCount *= expand.length;
}
}
if (found) {
// testing found is an optimization
for (i = 0; i < nextCount; i++) {
count = i;
next = new IntArrayList();
next.add(getLeft(prod));
for (ofs = 0; ofs < maxOfs; ofs++) {
right = getRight(prod, ofs);
if (right == symbol) {
j = count % expand.length;
maxOfs2 = expand[j].length;
for (ofs2 = 1; ofs2 < maxOfs2; ofs2++) {
next.add(expand[j][ofs2]);
}
count /= expand.length;
} else {
next.add(right);
}
}
if (count != 0) {
throw new RuntimeException();
}
addProduction(prod + 1, next.toArray());
}
removeProduction(prod);
}
}
}
|
[
"public",
"void",
"expandSymbol",
"(",
"int",
"symbol",
")",
"{",
"int",
"prod",
",",
"maxProd",
";",
"int",
"ofs",
",",
"maxOfs",
";",
"int",
"ofs2",
",",
"maxOfs2",
";",
"int",
"i",
",",
"j",
";",
"boolean",
"found",
";",
"int",
"count",
",",
"nextCount",
";",
"IntArrayList",
"next",
";",
"int",
"[",
"]",
"[",
"]",
"expand",
";",
"List",
"<",
"int",
"[",
"]",
">",
"expandLst",
";",
"int",
"right",
";",
"maxProd",
"=",
"getProductionCount",
"(",
")",
";",
"// make an array of the expand prods to easily index them;",
"// storing the indexes instead is difficult because the indexes",
"// max change",
"expandLst",
"=",
"new",
"ArrayList",
"<",
"int",
"[",
"]",
">",
"(",
")",
";",
"for",
"(",
"prod",
"=",
"0",
";",
"prod",
"<",
"maxProd",
";",
"prod",
"++",
")",
"{",
"if",
"(",
"getLeft",
"(",
"prod",
")",
"==",
"symbol",
")",
"{",
"expandLst",
".",
"add",
"(",
"getProduction",
"(",
"prod",
")",
")",
";",
"}",
"}",
"expand",
"=",
"new",
"int",
"[",
"expandLst",
".",
"size",
"(",
")",
"]",
"[",
"",
"]",
";",
"expandLst",
".",
"toArray",
"(",
"expand",
")",
";",
"for",
"(",
"prod",
"=",
"maxProd",
"-",
"1",
";",
"prod",
">=",
"0",
";",
"prod",
"--",
")",
"{",
"maxOfs",
"=",
"getLength",
"(",
"prod",
")",
";",
"found",
"=",
"false",
";",
"nextCount",
"=",
"1",
";",
"for",
"(",
"ofs",
"=",
"0",
";",
"ofs",
"<",
"maxOfs",
";",
"ofs",
"++",
")",
"{",
"if",
"(",
"getRight",
"(",
"prod",
",",
"ofs",
")",
"==",
"symbol",
")",
"{",
"found",
"=",
"true",
";",
"nextCount",
"*=",
"expand",
".",
"length",
";",
"}",
"}",
"if",
"(",
"found",
")",
"{",
"// testing found is an optimization",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"nextCount",
";",
"i",
"++",
")",
"{",
"count",
"=",
"i",
";",
"next",
"=",
"new",
"IntArrayList",
"(",
")",
";",
"next",
".",
"add",
"(",
"getLeft",
"(",
"prod",
")",
")",
";",
"for",
"(",
"ofs",
"=",
"0",
";",
"ofs",
"<",
"maxOfs",
";",
"ofs",
"++",
")",
"{",
"right",
"=",
"getRight",
"(",
"prod",
",",
"ofs",
")",
";",
"if",
"(",
"right",
"==",
"symbol",
")",
"{",
"j",
"=",
"count",
"%",
"expand",
".",
"length",
";",
"maxOfs2",
"=",
"expand",
"[",
"j",
"]",
".",
"length",
";",
"for",
"(",
"ofs2",
"=",
"1",
";",
"ofs2",
"<",
"maxOfs2",
";",
"ofs2",
"++",
")",
"{",
"next",
".",
"add",
"(",
"expand",
"[",
"j",
"]",
"[",
"ofs2",
"]",
")",
";",
"}",
"count",
"/=",
"expand",
".",
"length",
";",
"}",
"else",
"{",
"next",
".",
"add",
"(",
"right",
")",
";",
"}",
"}",
"if",
"(",
"count",
"!=",
"0",
")",
"{",
"throw",
"new",
"RuntimeException",
"(",
")",
";",
"}",
"addProduction",
"(",
"prod",
"+",
"1",
",",
"next",
".",
"toArray",
"(",
")",
")",
";",
"}",
"removeProduction",
"(",
"prod",
")",
";",
"}",
"}",
"}"
] |
expansion is not performed recurively
|
[
"expansion",
"is",
"not",
"performed",
"recurively"
] |
a069b087750c4133bfeebaf1f599c3bc96762113
|
https://github.com/mlhartme/mork/blob/a069b087750c4133bfeebaf1f599c3bc96762113/src/main/java/net/oneandone/mork/grammar/Grammar.java#L541-L604
|
149,895
|
mlhartme/mork
|
src/main/java/net/oneandone/mork/grammar/Grammar.java
|
Grammar.addNullable
|
public void addNullable(IntBitSet result) {
IntBitSet remaining; // indexes of productions
boolean modified;
int i;
int prod;
int max;
remaining = new IntBitSet();
remaining.addRange(0, getProductionCount() - 1);
do {
modified = false;
for (prod = remaining.first(); prod != -1; prod = remaining.next(prod)) {
if (result.contains(getLeft(prod))) {
remaining.remove(prod);
} else {
max = getLength(prod);
for (i = 0; i < max; i++) {
if (!result.contains(getRight(prod, i))) {
break;
}
}
if (i == max) {
result.add(getLeft(prod));
modified = true;
}
}
}
} while (modified);
}
|
java
|
public void addNullable(IntBitSet result) {
IntBitSet remaining; // indexes of productions
boolean modified;
int i;
int prod;
int max;
remaining = new IntBitSet();
remaining.addRange(0, getProductionCount() - 1);
do {
modified = false;
for (prod = remaining.first(); prod != -1; prod = remaining.next(prod)) {
if (result.contains(getLeft(prod))) {
remaining.remove(prod);
} else {
max = getLength(prod);
for (i = 0; i < max; i++) {
if (!result.contains(getRight(prod, i))) {
break;
}
}
if (i == max) {
result.add(getLeft(prod));
modified = true;
}
}
}
} while (modified);
}
|
[
"public",
"void",
"addNullable",
"(",
"IntBitSet",
"result",
")",
"{",
"IntBitSet",
"remaining",
";",
"// indexes of productions",
"boolean",
"modified",
";",
"int",
"i",
";",
"int",
"prod",
";",
"int",
"max",
";",
"remaining",
"=",
"new",
"IntBitSet",
"(",
")",
";",
"remaining",
".",
"addRange",
"(",
"0",
",",
"getProductionCount",
"(",
")",
"-",
"1",
")",
";",
"do",
"{",
"modified",
"=",
"false",
";",
"for",
"(",
"prod",
"=",
"remaining",
".",
"first",
"(",
")",
";",
"prod",
"!=",
"-",
"1",
";",
"prod",
"=",
"remaining",
".",
"next",
"(",
"prod",
")",
")",
"{",
"if",
"(",
"result",
".",
"contains",
"(",
"getLeft",
"(",
"prod",
")",
")",
")",
"{",
"remaining",
".",
"remove",
"(",
"prod",
")",
";",
"}",
"else",
"{",
"max",
"=",
"getLength",
"(",
"prod",
")",
";",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"max",
";",
"i",
"++",
")",
"{",
"if",
"(",
"!",
"result",
".",
"contains",
"(",
"getRight",
"(",
"prod",
",",
"i",
")",
")",
")",
"{",
"break",
";",
"}",
"}",
"if",
"(",
"i",
"==",
"max",
")",
"{",
"result",
".",
"add",
"(",
"getLeft",
"(",
"prod",
")",
")",
";",
"modified",
"=",
"true",
";",
"}",
"}",
"}",
"}",
"while",
"(",
"modified",
")",
";",
"}"
] |
Returns a symbols that can derive the empty word. Also called removable symbols
|
[
"Returns",
"a",
"symbols",
"that",
"can",
"derive",
"the",
"empty",
"word",
".",
"Also",
"called",
"removable",
"symbols"
] |
a069b087750c4133bfeebaf1f599c3bc96762113
|
https://github.com/mlhartme/mork/blob/a069b087750c4133bfeebaf1f599c3bc96762113/src/main/java/net/oneandone/mork/grammar/Grammar.java#L607-L635
|
149,896
|
likethecolor/Alchemy-API
|
src/main/java/com/likethecolor/alchemy/api/util/NumberUtil.java
|
NumberUtil.getValue
|
private static int getValue(String str, boolean getMaximumValue) {
int multiplier = 1;
String upperOrLowerValue = null;
final String[] rangeUnit = splitRangeUnit(str);
if(rangeUnit.length == 2) {
multiplier = getMultiplier(rangeUnit[1]);
}
String[] range = splitRange(rangeUnit[0]);
upperOrLowerValue = range[0];
if(range.length == 2) {
if(getMaximumValue) {
upperOrLowerValue = range[1];
}
}
return (int) (convertStringToDouble(upperOrLowerValue) * multiplier);
}
|
java
|
private static int getValue(String str, boolean getMaximumValue) {
int multiplier = 1;
String upperOrLowerValue = null;
final String[] rangeUnit = splitRangeUnit(str);
if(rangeUnit.length == 2) {
multiplier = getMultiplier(rangeUnit[1]);
}
String[] range = splitRange(rangeUnit[0]);
upperOrLowerValue = range[0];
if(range.length == 2) {
if(getMaximumValue) {
upperOrLowerValue = range[1];
}
}
return (int) (convertStringToDouble(upperOrLowerValue) * multiplier);
}
|
[
"private",
"static",
"int",
"getValue",
"(",
"String",
"str",
",",
"boolean",
"getMaximumValue",
")",
"{",
"int",
"multiplier",
"=",
"1",
";",
"String",
"upperOrLowerValue",
"=",
"null",
";",
"final",
"String",
"[",
"]",
"rangeUnit",
"=",
"splitRangeUnit",
"(",
"str",
")",
";",
"if",
"(",
"rangeUnit",
".",
"length",
"==",
"2",
")",
"{",
"multiplier",
"=",
"getMultiplier",
"(",
"rangeUnit",
"[",
"1",
"]",
")",
";",
"}",
"String",
"[",
"]",
"range",
"=",
"splitRange",
"(",
"rangeUnit",
"[",
"0",
"]",
")",
";",
"upperOrLowerValue",
"=",
"range",
"[",
"0",
"]",
";",
"if",
"(",
"range",
".",
"length",
"==",
"2",
")",
"{",
"if",
"(",
"getMaximumValue",
")",
"{",
"upperOrLowerValue",
"=",
"range",
"[",
"1",
"]",
";",
"}",
"}",
"return",
"(",
"int",
")",
"(",
"convertStringToDouble",
"(",
"upperOrLowerValue",
")",
"*",
"multiplier",
")",
";",
"}"
] |
Return the specified value from the string.
@param str string to parse; assume it is either a single value or a range (delimited by "-")
@param getMaximumValue if true return the maximum value
@return specified value from the string
|
[
"Return",
"the",
"specified",
"value",
"from",
"the",
"string",
"."
] |
5208cfc92a878ceeaff052787af29da92d98db7e
|
https://github.com/likethecolor/Alchemy-API/blob/5208cfc92a878ceeaff052787af29da92d98db7e/src/main/java/com/likethecolor/alchemy/api/util/NumberUtil.java#L95-L114
|
149,897
|
eurekaclinical/eurekaclinical-standard-apis
|
src/main/java/org/eurekaclinical/standardapis/props/EurekaClinicalProperties.java
|
EurekaClinicalProperties.getValue
|
protected final String getValue(final String propertyName, String defaultValue) {
String value = getValue(propertyName);
if (value == null) {
if (defaultValue == null) {
LOGGER.warn(
"Property '{}' is not specified in "
+ getClass().getName()
+ ", and no default is specified.", propertyName);
}
value = defaultValue;
}
return value;
}
|
java
|
protected final String getValue(final String propertyName, String defaultValue) {
String value = getValue(propertyName);
if (value == null) {
if (defaultValue == null) {
LOGGER.warn(
"Property '{}' is not specified in "
+ getClass().getName()
+ ", and no default is specified.", propertyName);
}
value = defaultValue;
}
return value;
}
|
[
"protected",
"final",
"String",
"getValue",
"(",
"final",
"String",
"propertyName",
",",
"String",
"defaultValue",
")",
"{",
"String",
"value",
"=",
"getValue",
"(",
"propertyName",
")",
";",
"if",
"(",
"value",
"==",
"null",
")",
"{",
"if",
"(",
"defaultValue",
"==",
"null",
")",
"{",
"LOGGER",
".",
"warn",
"(",
"\"Property '{}' is not specified in \"",
"+",
"getClass",
"(",
")",
".",
"getName",
"(",
")",
"+",
"\", and no default is specified.\"",
",",
"propertyName",
")",
";",
"}",
"value",
"=",
"defaultValue",
";",
"}",
"return",
"value",
";",
"}"
] |
Returns the String value of the given property name, or the given default
if the given property name does not exist.
@param propertyName The name of the property to fetch a value for.
@param defaultValue The default value to return if the property name does
not exist.
@return A string containing either the value of the property, or the
default value.
|
[
"Returns",
"the",
"String",
"value",
"of",
"the",
"given",
"property",
"name",
"or",
"the",
"given",
"default",
"if",
"the",
"given",
"property",
"name",
"does",
"not",
"exist",
"."
] |
690036dde82a4f2c2106d32403cdf1c713429377
|
https://github.com/eurekaclinical/eurekaclinical-standard-apis/blob/690036dde82a4f2c2106d32403cdf1c713429377/src/main/java/org/eurekaclinical/standardapis/props/EurekaClinicalProperties.java#L164-L176
|
149,898
|
eurekaclinical/eurekaclinical-standard-apis
|
src/main/java/org/eurekaclinical/standardapis/props/EurekaClinicalProperties.java
|
EurekaClinicalProperties.getIntValue
|
protected final int getIntValue(final String propertyName, int defaultValue) {
int result;
String property = this.properties.getProperty(propertyName);
try {
result = Integer.parseInt(property);
} catch (NumberFormatException e) {
LOGGER.warn("Invalid integer property in configuration: {}",
propertyName);
result = defaultValue;
}
return result;
}
|
java
|
protected final int getIntValue(final String propertyName, int defaultValue) {
int result;
String property = this.properties.getProperty(propertyName);
try {
result = Integer.parseInt(property);
} catch (NumberFormatException e) {
LOGGER.warn("Invalid integer property in configuration: {}",
propertyName);
result = defaultValue;
}
return result;
}
|
[
"protected",
"final",
"int",
"getIntValue",
"(",
"final",
"String",
"propertyName",
",",
"int",
"defaultValue",
")",
"{",
"int",
"result",
";",
"String",
"property",
"=",
"this",
".",
"properties",
".",
"getProperty",
"(",
"propertyName",
")",
";",
"try",
"{",
"result",
"=",
"Integer",
".",
"parseInt",
"(",
"property",
")",
";",
"}",
"catch",
"(",
"NumberFormatException",
"e",
")",
"{",
"LOGGER",
".",
"warn",
"(",
"\"Invalid integer property in configuration: {}\"",
",",
"propertyName",
")",
";",
"result",
"=",
"defaultValue",
";",
"}",
"return",
"result",
";",
"}"
] |
Utility method to get an int from the properties file.
@param propertyName The name of the property.
@param defaultValue The default value to return, if the property is not
found, or is malformed.
@return The property value, as an int.
|
[
"Utility",
"method",
"to",
"get",
"an",
"int",
"from",
"the",
"properties",
"file",
"."
] |
690036dde82a4f2c2106d32403cdf1c713429377
|
https://github.com/eurekaclinical/eurekaclinical-standard-apis/blob/690036dde82a4f2c2106d32403cdf1c713429377/src/main/java/org/eurekaclinical/standardapis/props/EurekaClinicalProperties.java#L229-L240
|
149,899
|
mlhartme/mork
|
src/main/java/net/oneandone/mork/compiler/Mork.java
|
Mork.compileCurrent
|
private boolean compileCurrent() throws IOException {
Specification spec;
Mapper result;
output.normal(currentJob.source + ":");
if (currentJob.listing != null) {
output.openListing(currentJob.listing);
}
spec = (Specification) mapperMapper.invoke(currentJob.source);
if (spec == null) {
return false;
}
try {
result = spec.translate(currentJob.k, currentJob.threadCount, output);
compiler.run(result, spec.getMapperName(), currentJob.source, currentJob.outputPath);
} catch (GenericException e) {
output.error(currentJob.source.getName(), e);
return false;
} catch (IOException e) {
output.error(currentJob.source.getName(), e.getMessage());
return false;
}
return true;
}
|
java
|
private boolean compileCurrent() throws IOException {
Specification spec;
Mapper result;
output.normal(currentJob.source + ":");
if (currentJob.listing != null) {
output.openListing(currentJob.listing);
}
spec = (Specification) mapperMapper.invoke(currentJob.source);
if (spec == null) {
return false;
}
try {
result = spec.translate(currentJob.k, currentJob.threadCount, output);
compiler.run(result, spec.getMapperName(), currentJob.source, currentJob.outputPath);
} catch (GenericException e) {
output.error(currentJob.source.getName(), e);
return false;
} catch (IOException e) {
output.error(currentJob.source.getName(), e.getMessage());
return false;
}
return true;
}
|
[
"private",
"boolean",
"compileCurrent",
"(",
")",
"throws",
"IOException",
"{",
"Specification",
"spec",
";",
"Mapper",
"result",
";",
"output",
".",
"normal",
"(",
"currentJob",
".",
"source",
"+",
"\":\"",
")",
";",
"if",
"(",
"currentJob",
".",
"listing",
"!=",
"null",
")",
"{",
"output",
".",
"openListing",
"(",
"currentJob",
".",
"listing",
")",
";",
"}",
"spec",
"=",
"(",
"Specification",
")",
"mapperMapper",
".",
"invoke",
"(",
"currentJob",
".",
"source",
")",
";",
"if",
"(",
"spec",
"==",
"null",
")",
"{",
"return",
"false",
";",
"}",
"try",
"{",
"result",
"=",
"spec",
".",
"translate",
"(",
"currentJob",
".",
"k",
",",
"currentJob",
".",
"threadCount",
",",
"output",
")",
";",
"compiler",
".",
"run",
"(",
"result",
",",
"spec",
".",
"getMapperName",
"(",
")",
",",
"currentJob",
".",
"source",
",",
"currentJob",
".",
"outputPath",
")",
";",
"}",
"catch",
"(",
"GenericException",
"e",
")",
"{",
"output",
".",
"error",
"(",
"currentJob",
".",
"source",
".",
"getName",
"(",
")",
",",
"e",
")",
";",
"return",
"false",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"output",
".",
"error",
"(",
"currentJob",
".",
"source",
".",
"getName",
"(",
")",
",",
"e",
".",
"getMessage",
"(",
")",
")",
";",
"return",
"false",
";",
"}",
"return",
"true",
";",
"}"
] |
Helper for compile
|
[
"Helper",
"for",
"compile"
] |
a069b087750c4133bfeebaf1f599c3bc96762113
|
https://github.com/mlhartme/mork/blob/a069b087750c4133bfeebaf1f599c3bc96762113/src/main/java/net/oneandone/mork/compiler/Mork.java#L78-L101
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.