code stringlengths 130 281k | code_dependency stringlengths 182 306k |
|---|---|
public class class_name {
public int layerSize(int layer) {
if (layer < 0 || layer > layers.length) {
throw new IllegalArgumentException("Invalid layer index: " + layer + ". Layer index must be between 0 and "
+ (layers.length - 1) + " inclusive");
}
org.deeplearning4j.nn.conf.layers.Layer conf = layers[layer].conf().getLayer();
if (conf == null || !(conf instanceof FeedForwardLayer)) {
return 0;
}
FeedForwardLayer ffl = (FeedForwardLayer) conf;
// FIXME: int cast
return (int) ffl.getNOut();
} } | public class class_name {
public int layerSize(int layer) {
if (layer < 0 || layer > layers.length) {
throw new IllegalArgumentException("Invalid layer index: " + layer + ". Layer index must be between 0 and "
+ (layers.length - 1) + " inclusive");
}
org.deeplearning4j.nn.conf.layers.Layer conf = layers[layer].conf().getLayer();
if (conf == null || !(conf instanceof FeedForwardLayer)) {
return 0; // depends on control dependency: [if], data = [none]
}
FeedForwardLayer ffl = (FeedForwardLayer) conf;
// FIXME: int cast
return (int) ffl.getNOut();
} } |
public class class_name {
public void destroy() {
for (Entry<String, Runnable> entry : destructionCallbacks.entrySet()) {
try {
entry.getValue().run();
} catch (Throwable t) {
log.error("Error during destruction callback for bean " + entry.getKey(), t);
}
}
beans.clear();
destructionCallbacks.clear();
} } | public class class_name {
public void destroy() {
for (Entry<String, Runnable> entry : destructionCallbacks.entrySet()) {
try {
entry.getValue().run(); // depends on control dependency: [try], data = [none]
} catch (Throwable t) {
log.error("Error during destruction callback for bean " + entry.getKey(), t);
} // depends on control dependency: [catch], data = [none]
}
beans.clear();
destructionCallbacks.clear();
} } |
public class class_name {
public ClassDocImpl lookupClass(String name) {
ClassSymbol c = getClassSymbol(name);
if (c != null) {
return getClassDoc(c);
} else {
return null;
}
} } | public class class_name {
public ClassDocImpl lookupClass(String name) {
ClassSymbol c = getClassSymbol(name);
if (c != null) {
return getClassDoc(c); // depends on control dependency: [if], data = [(c]
} else {
return null; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public final int compareTo(CacheKey o)
{
int result = getClass().getName().compareTo(o.getClass().getName());
if (result == 0 && ownerId != null)
{
// The key is of the same type and we assume that the distributed mode is enabled
result = ownerId.compareTo(o.ownerId);
}
return result == 0 ? id.compareTo(o.id) : result;
} } | public class class_name {
public final int compareTo(CacheKey o)
{
int result = getClass().getName().compareTo(o.getClass().getName());
if (result == 0 && ownerId != null)
{
// The key is of the same type and we assume that the distributed mode is enabled
result = ownerId.compareTo(o.ownerId);
// depends on control dependency: [if], data = [none]
}
return result == 0 ? id.compareTo(o.id) : result;
} } |
public class class_name {
public void registerScriptType(ScriptType type) {
if (typeMap.containsKey(type.getName())) {
throw new InvalidParameterException("ScriptType already registered: " + type.getName());
}
this.typeMap.put(type.getName(), type);
this.getTreeModel().addType(type);
if (shouldLoadTemplatesOnScriptTypeRegistration) {
loadScriptTemplates(type);
}
synchronized (trackedDirs) {
for (File dir : trackedDirs) {
addScriptsFromDir(dir, type, null);
}
}
} } | public class class_name {
public void registerScriptType(ScriptType type) {
if (typeMap.containsKey(type.getName())) {
throw new InvalidParameterException("ScriptType already registered: " + type.getName());
}
this.typeMap.put(type.getName(), type);
this.getTreeModel().addType(type);
if (shouldLoadTemplatesOnScriptTypeRegistration) {
loadScriptTemplates(type);
// depends on control dependency: [if], data = [none]
}
synchronized (trackedDirs) {
for (File dir : trackedDirs) {
addScriptsFromDir(dir, type, null);
// depends on control dependency: [for], data = [dir]
}
}
} } |
public class class_name {
static boolean nodeAbsent(Object json, Path path, boolean treatNullAsAbsent) {
Node node = getNode(json, path);
if (node.isNull()) {
return treatNullAsAbsent;
} else {
return node.isMissingNode();
}
} } | public class class_name {
static boolean nodeAbsent(Object json, Path path, boolean treatNullAsAbsent) {
Node node = getNode(json, path);
if (node.isNull()) {
return treatNullAsAbsent; // depends on control dependency: [if], data = [none]
} else {
return node.isMissingNode(); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public static String[] splitCSV(String str) {
if (str == null) return null;
String[] parts = StringUtils.split(str, ',');
List<String> results = new ArrayList<String>();
for (int i = 0; i < parts.length; i++) {
String s = parts[i].trim();
if (s.length() == 0) {
results.add(s);
} else {
char c = s.charAt(0);
if (c == '"' || c == '\'' || c == '`') {
StringBuilder sb = new StringBuilder();
sb.append(s);
while (i + 1 < parts.length) {
if (sb.length() > 1 && s.length() > 0 && s.charAt(s.length() - 1) == c) {
break;
}
s = parts[++i];
sb.append(',').append(s);
}
s = sb.toString().trim();
if (s.charAt(s.length() - 1) == c) {
s = s.substring(1, s.length() - 1);
}
results.add(s);
} else {
results.add(s);
}
}
}
return results.toArray(new String[results.size()]);
} } | public class class_name {
public static String[] splitCSV(String str) {
if (str == null) return null;
String[] parts = StringUtils.split(str, ',');
List<String> results = new ArrayList<String>();
for (int i = 0; i < parts.length; i++) {
String s = parts[i].trim();
if (s.length() == 0) {
results.add(s); // depends on control dependency: [if], data = [none]
} else {
char c = s.charAt(0);
if (c == '"' || c == '\'' || c == '`') {
StringBuilder sb = new StringBuilder();
sb.append(s); // depends on control dependency: [if], data = [none]
while (i + 1 < parts.length) {
if (sb.length() > 1 && s.length() > 0 && s.charAt(s.length() - 1) == c) {
break;
}
s = parts[++i]; // depends on control dependency: [while], data = [none]
sb.append(',').append(s); // depends on control dependency: [while], data = [none]
}
s = sb.toString().trim(); // depends on control dependency: [if], data = [none]
if (s.charAt(s.length() - 1) == c) {
s = s.substring(1, s.length() - 1); // depends on control dependency: [if], data = [none]
}
results.add(s); // depends on control dependency: [if], data = [none]
} else {
results.add(s); // depends on control dependency: [if], data = [none]
}
}
}
return results.toArray(new String[results.size()]);
} } |
public class class_name {
private static String checkP2WPKHP2SH(byte[] scriptPubKey) {
boolean validLength=scriptPubKey.length==23;
if (!(validLength)) {
return null;
}
boolean validStart=((scriptPubKey[0] & 0xFF)==0xA9) && ((scriptPubKey[1] & 0xFF)==0x14);
boolean validEnd=(scriptPubKey[22] & 0xFF)==0x87;
if (validStart && validEnd){
byte[] keyhash = Arrays.copyOfRange(scriptPubKey, 2, 22);
return "P2WPKHP2SH_"+BitcoinUtil.convertByteArrayToHexString(keyhash);
}
return null;
} } | public class class_name {
private static String checkP2WPKHP2SH(byte[] scriptPubKey) {
boolean validLength=scriptPubKey.length==23;
if (!(validLength)) {
return null; // depends on control dependency: [if], data = [none]
}
boolean validStart=((scriptPubKey[0] & 0xFF)==0xA9) && ((scriptPubKey[1] & 0xFF)==0x14);
boolean validEnd=(scriptPubKey[22] & 0xFF)==0x87;
if (validStart && validEnd){
byte[] keyhash = Arrays.copyOfRange(scriptPubKey, 2, 22);
return "P2WPKHP2SH_"+BitcoinUtil.convertByteArrayToHexString(keyhash); // depends on control dependency: [if], data = [none]
}
return null;
} } |
public class class_name {
public final EObject ruleXEqualityExpression() throws RecognitionException {
EObject current = null;
EObject this_XRelationalExpression_0 = null;
EObject lv_rightOperand_3_0 = null;
enterRule();
try {
// InternalXbaseWithAnnotations.g:1067:2: ( (this_XRelationalExpression_0= ruleXRelationalExpression ( ( ( ( () ( ( ruleOpEquality ) ) ) )=> ( () ( ( ruleOpEquality ) ) ) ) ( (lv_rightOperand_3_0= ruleXRelationalExpression ) ) )* ) )
// InternalXbaseWithAnnotations.g:1068:2: (this_XRelationalExpression_0= ruleXRelationalExpression ( ( ( ( () ( ( ruleOpEquality ) ) ) )=> ( () ( ( ruleOpEquality ) ) ) ) ( (lv_rightOperand_3_0= ruleXRelationalExpression ) ) )* )
{
// InternalXbaseWithAnnotations.g:1068:2: (this_XRelationalExpression_0= ruleXRelationalExpression ( ( ( ( () ( ( ruleOpEquality ) ) ) )=> ( () ( ( ruleOpEquality ) ) ) ) ( (lv_rightOperand_3_0= ruleXRelationalExpression ) ) )* )
// InternalXbaseWithAnnotations.g:1069:3: this_XRelationalExpression_0= ruleXRelationalExpression ( ( ( ( () ( ( ruleOpEquality ) ) ) )=> ( () ( ( ruleOpEquality ) ) ) ) ( (lv_rightOperand_3_0= ruleXRelationalExpression ) ) )*
{
if ( state.backtracking==0 ) {
newCompositeNode(grammarAccess.getXEqualityExpressionAccess().getXRelationalExpressionParserRuleCall_0());
}
pushFollow(FOLLOW_20);
this_XRelationalExpression_0=ruleXRelationalExpression();
state._fsp--;
if (state.failed) return current;
if ( state.backtracking==0 ) {
current = this_XRelationalExpression_0;
afterParserOrEnumRuleCall();
}
// InternalXbaseWithAnnotations.g:1077:3: ( ( ( ( () ( ( ruleOpEquality ) ) ) )=> ( () ( ( ruleOpEquality ) ) ) ) ( (lv_rightOperand_3_0= ruleXRelationalExpression ) ) )*
loop19:
do {
int alt19=2;
switch ( input.LA(1) ) {
case 31:
{
int LA19_2 = input.LA(2);
if ( (synpred10_InternalXbaseWithAnnotations()) ) {
alt19=1;
}
}
break;
case 32:
{
int LA19_3 = input.LA(2);
if ( (synpred10_InternalXbaseWithAnnotations()) ) {
alt19=1;
}
}
break;
case 33:
{
int LA19_4 = input.LA(2);
if ( (synpred10_InternalXbaseWithAnnotations()) ) {
alt19=1;
}
}
break;
case 34:
{
int LA19_5 = input.LA(2);
if ( (synpred10_InternalXbaseWithAnnotations()) ) {
alt19=1;
}
}
break;
}
switch (alt19) {
case 1 :
// InternalXbaseWithAnnotations.g:1078:4: ( ( ( () ( ( ruleOpEquality ) ) ) )=> ( () ( ( ruleOpEquality ) ) ) ) ( (lv_rightOperand_3_0= ruleXRelationalExpression ) )
{
// InternalXbaseWithAnnotations.g:1078:4: ( ( ( () ( ( ruleOpEquality ) ) ) )=> ( () ( ( ruleOpEquality ) ) ) )
// InternalXbaseWithAnnotations.g:1079:5: ( ( () ( ( ruleOpEquality ) ) ) )=> ( () ( ( ruleOpEquality ) ) )
{
// InternalXbaseWithAnnotations.g:1089:5: ( () ( ( ruleOpEquality ) ) )
// InternalXbaseWithAnnotations.g:1090:6: () ( ( ruleOpEquality ) )
{
// InternalXbaseWithAnnotations.g:1090:6: ()
// InternalXbaseWithAnnotations.g:1091:7:
{
if ( state.backtracking==0 ) {
current = forceCreateModelElementAndSet(
grammarAccess.getXEqualityExpressionAccess().getXBinaryOperationLeftOperandAction_1_0_0_0(),
current);
}
}
// InternalXbaseWithAnnotations.g:1097:6: ( ( ruleOpEquality ) )
// InternalXbaseWithAnnotations.g:1098:7: ( ruleOpEquality )
{
// InternalXbaseWithAnnotations.g:1098:7: ( ruleOpEquality )
// InternalXbaseWithAnnotations.g:1099:8: ruleOpEquality
{
if ( state.backtracking==0 ) {
if (current==null) {
current = createModelElement(grammarAccess.getXEqualityExpressionRule());
}
}
if ( state.backtracking==0 ) {
newCompositeNode(grammarAccess.getXEqualityExpressionAccess().getFeatureJvmIdentifiableElementCrossReference_1_0_0_1_0());
}
pushFollow(FOLLOW_9);
ruleOpEquality();
state._fsp--;
if (state.failed) return current;
if ( state.backtracking==0 ) {
afterParserOrEnumRuleCall();
}
}
}
}
}
// InternalXbaseWithAnnotations.g:1115:4: ( (lv_rightOperand_3_0= ruleXRelationalExpression ) )
// InternalXbaseWithAnnotations.g:1116:5: (lv_rightOperand_3_0= ruleXRelationalExpression )
{
// InternalXbaseWithAnnotations.g:1116:5: (lv_rightOperand_3_0= ruleXRelationalExpression )
// InternalXbaseWithAnnotations.g:1117:6: lv_rightOperand_3_0= ruleXRelationalExpression
{
if ( state.backtracking==0 ) {
newCompositeNode(grammarAccess.getXEqualityExpressionAccess().getRightOperandXRelationalExpressionParserRuleCall_1_1_0());
}
pushFollow(FOLLOW_20);
lv_rightOperand_3_0=ruleXRelationalExpression();
state._fsp--;
if (state.failed) return current;
if ( state.backtracking==0 ) {
if (current==null) {
current = createModelElementForParent(grammarAccess.getXEqualityExpressionRule());
}
set(
current,
"rightOperand",
lv_rightOperand_3_0,
"org.eclipse.xtext.xbase.Xbase.XRelationalExpression");
afterParserOrEnumRuleCall();
}
}
}
}
break;
default :
break loop19;
}
} while (true);
}
}
if ( state.backtracking==0 ) {
leaveRule();
}
}
catch (RecognitionException re) {
recover(input,re);
appendSkippedTokens();
}
finally {
}
return current;
} } | public class class_name {
public final EObject ruleXEqualityExpression() throws RecognitionException {
EObject current = null;
EObject this_XRelationalExpression_0 = null;
EObject lv_rightOperand_3_0 = null;
enterRule();
try {
// InternalXbaseWithAnnotations.g:1067:2: ( (this_XRelationalExpression_0= ruleXRelationalExpression ( ( ( ( () ( ( ruleOpEquality ) ) ) )=> ( () ( ( ruleOpEquality ) ) ) ) ( (lv_rightOperand_3_0= ruleXRelationalExpression ) ) )* ) )
// InternalXbaseWithAnnotations.g:1068:2: (this_XRelationalExpression_0= ruleXRelationalExpression ( ( ( ( () ( ( ruleOpEquality ) ) ) )=> ( () ( ( ruleOpEquality ) ) ) ) ( (lv_rightOperand_3_0= ruleXRelationalExpression ) ) )* )
{
// InternalXbaseWithAnnotations.g:1068:2: (this_XRelationalExpression_0= ruleXRelationalExpression ( ( ( ( () ( ( ruleOpEquality ) ) ) )=> ( () ( ( ruleOpEquality ) ) ) ) ( (lv_rightOperand_3_0= ruleXRelationalExpression ) ) )* )
// InternalXbaseWithAnnotations.g:1069:3: this_XRelationalExpression_0= ruleXRelationalExpression ( ( ( ( () ( ( ruleOpEquality ) ) ) )=> ( () ( ( ruleOpEquality ) ) ) ) ( (lv_rightOperand_3_0= ruleXRelationalExpression ) ) )*
{
if ( state.backtracking==0 ) {
newCompositeNode(grammarAccess.getXEqualityExpressionAccess().getXRelationalExpressionParserRuleCall_0()); // depends on control dependency: [if], data = [none]
}
pushFollow(FOLLOW_20);
this_XRelationalExpression_0=ruleXRelationalExpression();
state._fsp--;
if (state.failed) return current;
if ( state.backtracking==0 ) {
current = this_XRelationalExpression_0; // depends on control dependency: [if], data = [none]
afterParserOrEnumRuleCall(); // depends on control dependency: [if], data = [none]
}
// InternalXbaseWithAnnotations.g:1077:3: ( ( ( ( () ( ( ruleOpEquality ) ) ) )=> ( () ( ( ruleOpEquality ) ) ) ) ( (lv_rightOperand_3_0= ruleXRelationalExpression ) ) )*
loop19:
do {
int alt19=2;
switch ( input.LA(1) ) {
case 31:
{
int LA19_2 = input.LA(2);
if ( (synpred10_InternalXbaseWithAnnotations()) ) {
alt19=1; // depends on control dependency: [if], data = [none]
}
}
break;
case 32:
{
int LA19_3 = input.LA(2);
if ( (synpred10_InternalXbaseWithAnnotations()) ) {
alt19=1; // depends on control dependency: [if], data = [none]
}
}
break;
case 33:
{
int LA19_4 = input.LA(2);
if ( (synpred10_InternalXbaseWithAnnotations()) ) {
alt19=1; // depends on control dependency: [if], data = [none]
}
}
break;
case 34:
{
int LA19_5 = input.LA(2);
if ( (synpred10_InternalXbaseWithAnnotations()) ) {
alt19=1; // depends on control dependency: [if], data = [none]
}
}
break;
}
switch (alt19) {
case 1 :
// InternalXbaseWithAnnotations.g:1078:4: ( ( ( () ( ( ruleOpEquality ) ) ) )=> ( () ( ( ruleOpEquality ) ) ) ) ( (lv_rightOperand_3_0= ruleXRelationalExpression ) )
{
// InternalXbaseWithAnnotations.g:1078:4: ( ( ( () ( ( ruleOpEquality ) ) ) )=> ( () ( ( ruleOpEquality ) ) ) )
// InternalXbaseWithAnnotations.g:1079:5: ( ( () ( ( ruleOpEquality ) ) ) )=> ( () ( ( ruleOpEquality ) ) )
{
// InternalXbaseWithAnnotations.g:1089:5: ( () ( ( ruleOpEquality ) ) )
// InternalXbaseWithAnnotations.g:1090:6: () ( ( ruleOpEquality ) )
{
// InternalXbaseWithAnnotations.g:1090:6: ()
// InternalXbaseWithAnnotations.g:1091:7:
{
if ( state.backtracking==0 ) {
current = forceCreateModelElementAndSet(
grammarAccess.getXEqualityExpressionAccess().getXBinaryOperationLeftOperandAction_1_0_0_0(),
current); // depends on control dependency: [if], data = [none]
}
}
// InternalXbaseWithAnnotations.g:1097:6: ( ( ruleOpEquality ) )
// InternalXbaseWithAnnotations.g:1098:7: ( ruleOpEquality )
{
// InternalXbaseWithAnnotations.g:1098:7: ( ruleOpEquality )
// InternalXbaseWithAnnotations.g:1099:8: ruleOpEquality
{
if ( state.backtracking==0 ) {
if (current==null) {
current = createModelElement(grammarAccess.getXEqualityExpressionRule()); // depends on control dependency: [if], data = [none]
}
}
if ( state.backtracking==0 ) {
newCompositeNode(grammarAccess.getXEqualityExpressionAccess().getFeatureJvmIdentifiableElementCrossReference_1_0_0_1_0()); // depends on control dependency: [if], data = [none]
}
pushFollow(FOLLOW_9);
ruleOpEquality();
state._fsp--;
if (state.failed) return current;
if ( state.backtracking==0 ) {
afterParserOrEnumRuleCall(); // depends on control dependency: [if], data = [none]
}
}
}
}
}
// InternalXbaseWithAnnotations.g:1115:4: ( (lv_rightOperand_3_0= ruleXRelationalExpression ) )
// InternalXbaseWithAnnotations.g:1116:5: (lv_rightOperand_3_0= ruleXRelationalExpression )
{
// InternalXbaseWithAnnotations.g:1116:5: (lv_rightOperand_3_0= ruleXRelationalExpression )
// InternalXbaseWithAnnotations.g:1117:6: lv_rightOperand_3_0= ruleXRelationalExpression
{
if ( state.backtracking==0 ) {
newCompositeNode(grammarAccess.getXEqualityExpressionAccess().getRightOperandXRelationalExpressionParserRuleCall_1_1_0()); // depends on control dependency: [if], data = [none]
}
pushFollow(FOLLOW_20);
lv_rightOperand_3_0=ruleXRelationalExpression();
state._fsp--;
if (state.failed) return current;
if ( state.backtracking==0 ) {
if (current==null) {
current = createModelElementForParent(grammarAccess.getXEqualityExpressionRule()); // depends on control dependency: [if], data = [none]
}
set(
current,
"rightOperand",
lv_rightOperand_3_0,
"org.eclipse.xtext.xbase.Xbase.XRelationalExpression"); // depends on control dependency: [if], data = [none]
afterParserOrEnumRuleCall(); // depends on control dependency: [if], data = [none]
}
}
}
}
break;
default :
break loop19;
}
} while (true);
}
}
if ( state.backtracking==0 ) {
leaveRule(); // depends on control dependency: [if], data = [none]
}
}
catch (RecognitionException re) {
recover(input,re);
appendSkippedTokens();
}
finally {
}
return current;
} } |
public class class_name {
private static void encode(
byte[] data,
int pointer,
double timestamp
) {
// UT1-Mikrosekunden konstruieren
long ut1 = convert(timestamp);
boolean before2036 = (ut1 + OFFSET_2036 < 0);
long micros;
if (before2036) {
micros = ut1 + OFFSET_1900;
} else {
micros = ut1 + OFFSET_2036; // siehe RFC 4330, Abschnitt 3
}
// Festkomma vor Bit 32, deshalb Bits nach links schieben
long integer = micros / MIO;
long fraction = ((micros % MIO) << 32) / MIO;
if (before2036) {
integer |= 0x80000000L; // siehe RFC 4330, Abschnitt 3
}
long ntp = ((integer << 32) | fraction);
// Binäre Darstellung erzeugen
for (int i = 7; i >= 0; i--) {
data[i + pointer] = (byte) (ntp & 0xFF);
ntp >>>= 8;
}
// niedrigstes Byte nur als Zufallszahl (siehe RFC 4330, Abschnitt 3)
data[7 + pointer] = (byte) (Math.random() * BIT08);
} } | public class class_name {
private static void encode(
byte[] data,
int pointer,
double timestamp
) {
// UT1-Mikrosekunden konstruieren
long ut1 = convert(timestamp);
boolean before2036 = (ut1 + OFFSET_2036 < 0);
long micros;
if (before2036) {
micros = ut1 + OFFSET_1900; // depends on control dependency: [if], data = [none]
} else {
micros = ut1 + OFFSET_2036; // siehe RFC 4330, Abschnitt 3 // depends on control dependency: [if], data = [none]
}
// Festkomma vor Bit 32, deshalb Bits nach links schieben
long integer = micros / MIO;
long fraction = ((micros % MIO) << 32) / MIO;
if (before2036) {
integer |= 0x80000000L; // siehe RFC 4330, Abschnitt 3 // depends on control dependency: [if], data = [none]
}
long ntp = ((integer << 32) | fraction);
// Binäre Darstellung erzeugen
for (int i = 7; i >= 0; i--) {
data[i + pointer] = (byte) (ntp & 0xFF); // depends on control dependency: [for], data = [i]
ntp >>>= 8; // depends on control dependency: [for], data = [none]
}
// niedrigstes Byte nur als Zufallszahl (siehe RFC 4330, Abschnitt 3)
data[7 + pointer] = (byte) (Math.random() * BIT08);
} } |
public class class_name {
public static String calculateSHA1(String string) {
MessageDigest md = null;
try {
md = MessageDigest.getInstance("SHA-1");
} catch (NoSuchAlgorithmException e) {
QuickUtils.log.e("NoSuchAlgorithmException", e);
}
try {
md.update(string.getBytes("iso-8859-1"), 0, string.length());
} catch (UnsupportedEncodingException e) {
QuickUtils.log.e("UnsupportedEncodingException", e);
}
byte[] sha1hash = md.digest();
return convertToHex(sha1hash);
} } | public class class_name {
public static String calculateSHA1(String string) {
MessageDigest md = null;
try {
md = MessageDigest.getInstance("SHA-1");
// depends on control dependency: [try], data = [none]
} catch (NoSuchAlgorithmException e) {
QuickUtils.log.e("NoSuchAlgorithmException", e);
}
// depends on control dependency: [catch], data = [none]
try {
md.update(string.getBytes("iso-8859-1"), 0, string.length());
// depends on control dependency: [try], data = [none]
} catch (UnsupportedEncodingException e) {
QuickUtils.log.e("UnsupportedEncodingException", e);
}
// depends on control dependency: [catch], data = [none]
byte[] sha1hash = md.digest();
return convertToHex(sha1hash);
} } |
public class class_name {
private static int findWhitespace(CharSequence s, int start)
{
final int len = s.length();
for (int i = start; i < len; i++)
{
if (Character.isWhitespace(s.charAt(i)))
{
return i;
}
}
return len;
} } | public class class_name {
private static int findWhitespace(CharSequence s, int start)
{
final int len = s.length();
for (int i = start; i < len; i++)
{
if (Character.isWhitespace(s.charAt(i)))
{
return i; // depends on control dependency: [if], data = [none]
}
}
return len;
} } |
public class class_name {
private long getCalculatedTime(long baseTime, String deltaDays, String key, long defaultTime) {
try {
long days = Long.parseLong(deltaDays);
long delta = 1000L * 60L * 60L * 24L * days;
long result = baseTime - delta;
if (result >= 0) {
// result is a valid time stamp
return result;
}
} catch (NumberFormatException e) {
LOG.error(Messages.get().getBundle().key(Messages.ERR_COLLECTOR_PARAM_INVALID_1, key + "=" + deltaDays));
}
return defaultTime;
} } | public class class_name {
private long getCalculatedTime(long baseTime, String deltaDays, String key, long defaultTime) {
try {
long days = Long.parseLong(deltaDays);
long delta = 1000L * 60L * 60L * 24L * days;
long result = baseTime - delta;
if (result >= 0) {
// result is a valid time stamp
return result; // depends on control dependency: [if], data = [none]
}
} catch (NumberFormatException e) {
LOG.error(Messages.get().getBundle().key(Messages.ERR_COLLECTOR_PARAM_INVALID_1, key + "=" + deltaDays));
} // depends on control dependency: [catch], data = [none]
return defaultTime;
} } |
public class class_name {
public void setLocales(Locale... locales) {
String[] array = new String[locales.length];
for (int i = 0; i < locales.length; i++) {
array[i] = locales[i].toString();
}
setLocales(array);
} } | public class class_name {
public void setLocales(Locale... locales) {
String[] array = new String[locales.length];
for (int i = 0; i < locales.length; i++) {
array[i] = locales[i].toString(); // depends on control dependency: [for], data = [i]
}
setLocales(array);
} } |
public class class_name {
String convertCase(String str) {
if (str == null) {
return null;
}
return isSensitive ? str : str.toLowerCase();
} } | public class class_name {
String convertCase(String str) {
if (str == null) {
return null; // depends on control dependency: [if], data = [none]
}
return isSensitive ? str : str.toLowerCase();
} } |
public class class_name {
private void updateMeta(BundleMeta meta) {
final int cols = meta.size();
densecols = new NumberVector.Factory<?>[cols];
for(int i = 0; i < cols; i++) {
if(TypeUtil.SPARSE_VECTOR_VARIABLE_LENGTH.isAssignableFromType(meta.get(i))) {
throw new AbortException("Filtering sparse vectors is not yet supported by this filter. Please contribute.");
}
if(TypeUtil.NUMBER_VECTOR_VARIABLE_LENGTH.isAssignableFromType(meta.get(i))) {
VectorFieldTypeInformation<?> vmeta = (VectorFieldTypeInformation<?>) meta.get(i);
densecols[i] = (NumberVector.Factory<?>) vmeta.getFactory();
continue;
}
}
} } | public class class_name {
private void updateMeta(BundleMeta meta) {
final int cols = meta.size();
densecols = new NumberVector.Factory<?>[cols];
for(int i = 0; i < cols; i++) {
if(TypeUtil.SPARSE_VECTOR_VARIABLE_LENGTH.isAssignableFromType(meta.get(i))) {
throw new AbortException("Filtering sparse vectors is not yet supported by this filter. Please contribute.");
}
if(TypeUtil.NUMBER_VECTOR_VARIABLE_LENGTH.isAssignableFromType(meta.get(i))) {
VectorFieldTypeInformation<?> vmeta = (VectorFieldTypeInformation<?>) meta.get(i);
densecols[i] = (NumberVector.Factory<?>) vmeta.getFactory(); // depends on control dependency: [if], data = [none]
continue;
}
}
} } |
public class class_name {
public void referencedElementUpdated(ModelElementInstance referenceTargetElement, String oldIdentifier, String newIdentifier) {
for (ModelElementInstance referenceSourceElement : findReferenceSourceElements(referenceTargetElement)) {
updateReference(referenceSourceElement, oldIdentifier, newIdentifier);
}
} } | public class class_name {
public void referencedElementUpdated(ModelElementInstance referenceTargetElement, String oldIdentifier, String newIdentifier) {
for (ModelElementInstance referenceSourceElement : findReferenceSourceElements(referenceTargetElement)) {
updateReference(referenceSourceElement, oldIdentifier, newIdentifier); // depends on control dependency: [for], data = [referenceSourceElement]
}
} } |
public class class_name {
@Override
public boolean hasNext() {
while (!(iteratorList.isEmpty() || iteratorList.get(currentIteratorIndex).hasNext())) {
Assert.isFalse(iteratorList.remove(currentIteratorIndex).hasNext(), "removing a non-empty Iterator");
currentIteratorIndex = (iteratorList.isEmpty() ? 0 : (currentIteratorIndex % iteratorList.size()));
}
return !iteratorList.isEmpty();
} } | public class class_name {
@Override
public boolean hasNext() {
while (!(iteratorList.isEmpty() || iteratorList.get(currentIteratorIndex).hasNext())) {
Assert.isFalse(iteratorList.remove(currentIteratorIndex).hasNext(), "removing a non-empty Iterator"); // depends on control dependency: [while], data = [none]
currentIteratorIndex = (iteratorList.isEmpty() ? 0 : (currentIteratorIndex % iteratorList.size())); // depends on control dependency: [while], data = [none]
}
return !iteratorList.isEmpty();
} } |
public class class_name {
long next(int[][] graph, int v, long[] current, long[] unique, long[] included, Suppressed suppressed) {
if (suppressed.contains(v)) return current[v];
long invariant = distribute(current[v]);
int nUnique = 0;
for (int w : graph[v]) {
// skip suppressed atom
if (suppressed.contains(w)) continue;
long adjInv = current[w];
// find index of already included neighbor
int i = 0;
while (i < nUnique && unique[i] != adjInv) {
++i;
}
// no match, then the value is unique, use adjInv
// match, then rotate the previously included value
included[i] = (i == nUnique) ? unique[nUnique++] = adjInv : rotate(included[i]);
invariant ^= included[i];
}
return invariant;
} } | public class class_name {
long next(int[][] graph, int v, long[] current, long[] unique, long[] included, Suppressed suppressed) {
if (suppressed.contains(v)) return current[v];
long invariant = distribute(current[v]);
int nUnique = 0;
for (int w : graph[v]) {
// skip suppressed atom
if (suppressed.contains(w)) continue;
long adjInv = current[w];
// find index of already included neighbor
int i = 0;
while (i < nUnique && unique[i] != adjInv) {
++i; // depends on control dependency: [while], data = [none]
}
// no match, then the value is unique, use adjInv
// match, then rotate the previously included value
included[i] = (i == nUnique) ? unique[nUnique++] = adjInv : rotate(included[i]); // depends on control dependency: [for], data = [none]
invariant ^= included[i]; // depends on control dependency: [for], data = [none]
}
return invariant;
} } |
public class class_name {
@Override
public FedoraResource find(final FedoraSession session, final String path) {
final Session jcrSession = getJcrSession(session);
try {
return new FedoraResourceImpl(jcrSession.getNode(path));
} catch (final RepositoryException e) {
throw new RepositoryRuntimeException(e);
}
} } | public class class_name {
@Override
public FedoraResource find(final FedoraSession session, final String path) {
final Session jcrSession = getJcrSession(session);
try {
return new FedoraResourceImpl(jcrSession.getNode(path)); // depends on control dependency: [try], data = [none]
} catch (final RepositoryException e) {
throw new RepositoryRuntimeException(e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public static void repack(File zip, int compressionLevel) {
try {
File tmpZip = FileUtils.getTempFileFor(zip);
repack(zip, tmpZip, compressionLevel);
// Delete original zip
if (!zip.delete()) {
throw new IOException("Unable to delete the file: " + zip);
}
// Rename the archive
FileUtils.moveFile(tmpZip, zip);
}
catch (IOException e) {
throw ZipExceptionUtil.rethrow(e);
}
} } | public class class_name {
public static void repack(File zip, int compressionLevel) {
try {
File tmpZip = FileUtils.getTempFileFor(zip);
repack(zip, tmpZip, compressionLevel); // depends on control dependency: [try], data = [none]
// Delete original zip
if (!zip.delete()) {
throw new IOException("Unable to delete the file: " + zip);
}
// Rename the archive
FileUtils.moveFile(tmpZip, zip); // depends on control dependency: [try], data = [none]
}
catch (IOException e) {
throw ZipExceptionUtil.rethrow(e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public BatchGetObjectInformationResponse withSchemaFacets(SchemaFacet... schemaFacets) {
if (this.schemaFacets == null) {
setSchemaFacets(new java.util.ArrayList<SchemaFacet>(schemaFacets.length));
}
for (SchemaFacet ele : schemaFacets) {
this.schemaFacets.add(ele);
}
return this;
} } | public class class_name {
public BatchGetObjectInformationResponse withSchemaFacets(SchemaFacet... schemaFacets) {
if (this.schemaFacets == null) {
setSchemaFacets(new java.util.ArrayList<SchemaFacet>(schemaFacets.length)); // depends on control dependency: [if], data = [none]
}
for (SchemaFacet ele : schemaFacets) {
this.schemaFacets.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} } |
public class class_name {
public static String encodeQ(byte[] bytes, Usage usage) {
BitSet qChars = usage == Usage.TEXT_TOKEN ? Q_REGULAR_CHARS : Q_RESTRICTED_CHARS;
StringBuilder sb = new StringBuilder();
final int end = bytes.length;
for (int idx = 0; idx < end; idx++) {
int v = bytes[idx] & 0xff;
if (v == 32) {
sb.append('_');
} else if (!qChars.get(v)) {
sb.append('=');
sb.append(hexDigit(v >>> 4));
sb.append(hexDigit(v & 0xf));
} else {
sb.append((char) v);
}
}
return sb.toString();
} } | public class class_name {
public static String encodeQ(byte[] bytes, Usage usage) {
BitSet qChars = usage == Usage.TEXT_TOKEN ? Q_REGULAR_CHARS : Q_RESTRICTED_CHARS;
StringBuilder sb = new StringBuilder();
final int end = bytes.length;
for (int idx = 0; idx < end; idx++) {
int v = bytes[idx] & 0xff;
if (v == 32) {
sb.append('_'); // depends on control dependency: [if], data = [none]
} else if (!qChars.get(v)) {
sb.append('='); // depends on control dependency: [if], data = [none]
sb.append(hexDigit(v >>> 4)); // depends on control dependency: [if], data = [none]
sb.append(hexDigit(v & 0xf)); // depends on control dependency: [if], data = [none]
} else {
sb.append((char) v); // depends on control dependency: [if], data = [none]
}
}
return sb.toString();
} } |
public class class_name {
public static String getId(){
String paramId = RequestContext.getHttpRequest().getParameter("id");
if(paramId != null && RequestContext.getHttpRequest().getAttribute("id") != null){
LOGGER.warn("WARNING: probably you have 'id' supplied both as a HTTP parameter, as well as in the URI. Choosing parameter over URI value.");
}
String theId;
if(paramId != null){
theId = paramId;
}else{
Object id = RequestContext.getHttpRequest().getAttribute("id");
theId = id != null ? id.toString() : null;
}
return Util.blank(theId) ? null : theId;
} } | public class class_name {
public static String getId(){
String paramId = RequestContext.getHttpRequest().getParameter("id");
if(paramId != null && RequestContext.getHttpRequest().getAttribute("id") != null){
LOGGER.warn("WARNING: probably you have 'id' supplied both as a HTTP parameter, as well as in the URI. Choosing parameter over URI value."); // depends on control dependency: [if], data = [none]
}
String theId;
if(paramId != null){
theId = paramId; // depends on control dependency: [if], data = [none]
}else{
Object id = RequestContext.getHttpRequest().getAttribute("id");
theId = id != null ? id.toString() : null; // depends on control dependency: [if], data = [none]
}
return Util.blank(theId) ? null : theId;
} } |
public class class_name {
public void marshall(RequestCancelExternalWorkflowExecutionInitiatedEventAttributes requestCancelExternalWorkflowExecutionInitiatedEventAttributes,
ProtocolMarshaller protocolMarshaller) {
if (requestCancelExternalWorkflowExecutionInitiatedEventAttributes == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(requestCancelExternalWorkflowExecutionInitiatedEventAttributes.getWorkflowId(), WORKFLOWID_BINDING);
protocolMarshaller.marshall(requestCancelExternalWorkflowExecutionInitiatedEventAttributes.getRunId(), RUNID_BINDING);
protocolMarshaller.marshall(requestCancelExternalWorkflowExecutionInitiatedEventAttributes.getDecisionTaskCompletedEventId(),
DECISIONTASKCOMPLETEDEVENTID_BINDING);
protocolMarshaller.marshall(requestCancelExternalWorkflowExecutionInitiatedEventAttributes.getControl(), CONTROL_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(RequestCancelExternalWorkflowExecutionInitiatedEventAttributes requestCancelExternalWorkflowExecutionInitiatedEventAttributes,
ProtocolMarshaller protocolMarshaller) {
if (requestCancelExternalWorkflowExecutionInitiatedEventAttributes == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(requestCancelExternalWorkflowExecutionInitiatedEventAttributes.getWorkflowId(), WORKFLOWID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(requestCancelExternalWorkflowExecutionInitiatedEventAttributes.getRunId(), RUNID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(requestCancelExternalWorkflowExecutionInitiatedEventAttributes.getDecisionTaskCompletedEventId(),
DECISIONTASKCOMPLETEDEVENTID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(requestCancelExternalWorkflowExecutionInitiatedEventAttributes.getControl(), CONTROL_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public static String generateMessageDescription(final Message message) {
// if (message.getDescriptorForType().findFieldByName(TYPE_FIELD_LABEL) != null) {
// if (message.hasField(message.getDescriptorForType().findFieldByName(TYPE_FIELD_LABEL))) {
// return (String) message.getField(message.getDescriptorForType().findFieldByName(TYPE_FIELD_LABEL));
// }
// }
try {
return getId(message).toString();
} catch (CouldNotPerformException ex) {
ExceptionPrinter.printHistory(new CouldNotPerformException("Could not detect id value of internal message!", ex), logger, LogLevel.WARN);
return "?";
}
} } | public class class_name {
public static String generateMessageDescription(final Message message) {
// if (message.getDescriptorForType().findFieldByName(TYPE_FIELD_LABEL) != null) {
// if (message.hasField(message.getDescriptorForType().findFieldByName(TYPE_FIELD_LABEL))) {
// return (String) message.getField(message.getDescriptorForType().findFieldByName(TYPE_FIELD_LABEL));
// }
// }
try {
return getId(message).toString(); // depends on control dependency: [try], data = [none]
} catch (CouldNotPerformException ex) {
ExceptionPrinter.printHistory(new CouldNotPerformException("Could not detect id value of internal message!", ex), logger, LogLevel.WARN);
return "?";
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public static AFPChain fromXML(String xml, String name1, String name2, Atom[] ca1, Atom[] ca2) throws IOException, StructureException{
AFPChain[] afps = parseMultiXML( xml);
if ( afps.length > 0 ) {
AFPChain afpChain = afps[0];
String n1 = afpChain.getName1();
String n2 = afpChain.getName2();
if ( n1 == null )
n1 = "";
if ( n2 == null)
n2 = "";
//System.out.println("from AFPCHAIN: " + n1 + " " + n2);
if ( n1.equals(name2) && n2.equals(name1)){
// flipped order
//System.out.println("AfpChain in wrong order, flipping...");
afpChain = AFPChainFlipper.flipChain(afpChain);
}
rebuildAFPChain(afpChain, ca1, ca2);
return afpChain;
}
return null;
} } | public class class_name {
public static AFPChain fromXML(String xml, String name1, String name2, Atom[] ca1, Atom[] ca2) throws IOException, StructureException{
AFPChain[] afps = parseMultiXML( xml);
if ( afps.length > 0 ) {
AFPChain afpChain = afps[0];
String n1 = afpChain.getName1();
String n2 = afpChain.getName2();
if ( n1 == null )
n1 = "";
if ( n2 == null)
n2 = "";
//System.out.println("from AFPCHAIN: " + n1 + " " + n2);
if ( n1.equals(name2) && n2.equals(name1)){
// flipped order
//System.out.println("AfpChain in wrong order, flipping...");
afpChain = AFPChainFlipper.flipChain(afpChain); // depends on control dependency: [if], data = [none]
}
rebuildAFPChain(afpChain, ca1, ca2);
return afpChain;
}
return null;
} } |
public class class_name {
@Implementation(minSdk = LOLLIPOP_MR1, maxSdk = P)
@HiddenApi
protected static int getPhoneId(int subId) {
if (phoneIds.containsKey(subId)) {
return phoneIds.get(subId);
}
return INVALID_PHONE_INDEX;
} } | public class class_name {
@Implementation(minSdk = LOLLIPOP_MR1, maxSdk = P)
@HiddenApi
protected static int getPhoneId(int subId) {
if (phoneIds.containsKey(subId)) {
return phoneIds.get(subId); // depends on control dependency: [if], data = [none]
}
return INVALID_PHONE_INDEX;
} } |
public class class_name {
public synchronized XEvent remove(int index)
throws IndexOutOfBoundsException, IOException {
// check overflow list and adjust indices
XEvent removed = null;
int smallerOverflow = 0;
for (int i = 0; i < overflowSize; i++) {
if (overflowIndices[i] == index) {
removed = overflowEntries[i];
} else if (overflowIndices[i] > index) {
overflowIndices[i] = overflowIndices[i] - 1;
if (removed != null) {
// move left
overflowIndices[i - 1] = overflowIndices[i];
overflowEntries[i - 1] = overflowEntries[i];
}
} else if (overflowIndices[i] < index) {
smallerOverflow++;
}
}
if (removed != null) {
// adjust overflow size
overflowSize--;
// invalidate entry in overflow set
overflowIndices[overflowSize] = -1;
overflowEntries[overflowSize] = null;
} else {
int bufferIndex = index - smallerOverflow;
for (int hole = holeFlags.nextSetBit(0); hole >= 0
&& hole <= bufferIndex; hole = holeFlags
.nextSetBit(hole + 1)) {
bufferIndex++;
}
removed = buffer.get(bufferIndex);
holeFlags.set(bufferIndex, true);
}
size--;
return removed;
} } | public class class_name {
public synchronized XEvent remove(int index)
throws IndexOutOfBoundsException, IOException {
// check overflow list and adjust indices
XEvent removed = null;
int smallerOverflow = 0;
for (int i = 0; i < overflowSize; i++) {
if (overflowIndices[i] == index) {
removed = overflowEntries[i];
} else if (overflowIndices[i] > index) {
overflowIndices[i] = overflowIndices[i] - 1;
if (removed != null) {
// move left
overflowIndices[i - 1] = overflowIndices[i]; // depends on control dependency: [if], data = [none]
overflowEntries[i - 1] = overflowEntries[i]; // depends on control dependency: [if], data = [none]
}
} else if (overflowIndices[i] < index) {
smallerOverflow++;
}
}
if (removed != null) {
// adjust overflow size
overflowSize--;
// invalidate entry in overflow set
overflowIndices[overflowSize] = -1;
overflowEntries[overflowSize] = null;
} else {
int bufferIndex = index - smallerOverflow;
for (int hole = holeFlags.nextSetBit(0); hole >= 0
&& hole <= bufferIndex; hole = holeFlags
.nextSetBit(hole + 1)) {
bufferIndex++;
}
removed = buffer.get(bufferIndex);
holeFlags.set(bufferIndex, true);
}
size--;
return removed;
} } |
public class class_name {
public static RedissonRxClient createRx(Config config) {
RedissonRx react = new RedissonRx(config);
if (config.isReferenceEnabled()) {
react.enableRedissonReferenceSupport();
}
return react;
} } | public class class_name {
public static RedissonRxClient createRx(Config config) {
RedissonRx react = new RedissonRx(config);
if (config.isReferenceEnabled()) {
react.enableRedissonReferenceSupport(); // depends on control dependency: [if], data = [none]
}
return react;
} } |
public class class_name {
protected Object decode(ChannelHandlerContext ctx, ByteBuf in) throws Exception {
if (discardingTooLongFrame) {
long bytesToDiscard = this.bytesToDiscard;
int localBytesToDiscard = (int) Math.min(bytesToDiscard, in.readableBytes());
in.skipBytes(localBytesToDiscard);
bytesToDiscard -= localBytesToDiscard;
this.bytesToDiscard = bytesToDiscard;
failIfNecessary(false);
return null;
}
if (consumingLength) {
int delimIndex = indexOf(in, delimiter);
if (delimIndex < 0) {
return null;
}
final String lengthStr = in.toString(in.readerIndex(), delimIndex, lengthFieldCharset);
try {
frameLength = Long.parseLong(trimLengthString ? lengthStr.trim() : lengthStr);
} catch (NumberFormatException e) {
throw new CorruptedFrameException(
String.format(
"Invalid length field decoded (in %s charset): %s",
lengthFieldCharset.name(),
lengthStr
),
e
);
}
if (frameLength < 0) {
throw new CorruptedFrameException("negative pre-adjustment length field: " + frameLength);
}
frameLength += lengthAdjustment;
//consume length field and delimiter bytes
in.skipBytes(delimIndex + delimiter.capacity());
//consume delimiter bytes
consumingLength = false;
}
if (frameLength > maxFrameLength) {
long discard = frameLength - in.readableBytes();
tooLongFrameLength = frameLength;
if (discard < 0) {
// buffer contains more bytes then the frameLength so we can discard all now
in.skipBytes((int) frameLength);
} else {
// Enter the discard mode and discard everything received so far.
discardingTooLongFrame = true;
consumingLength = true;
bytesToDiscard = discard;
in.skipBytes(in.readableBytes());
}
failIfNecessary(true);
return null;
}
// never overflows because it's less than maxFrameLength
int frameLengthInt = (int) frameLength;
if (in.readableBytes() < frameLengthInt) {
// need more bytes available to read actual frame
return null;
}
// the frame is now entirely present, reset state vars
consumingLength = true;
frameLength = 0;
// extract frame
int readerIndex = in.readerIndex();
int actualFrameLength = frameLengthInt;// - initialBytesToStrip;
ByteBuf frame = extractFrame(ctx, in, readerIndex, actualFrameLength);
in.readerIndex(readerIndex + actualFrameLength);
return frame;
} } | public class class_name {
protected Object decode(ChannelHandlerContext ctx, ByteBuf in) throws Exception {
if (discardingTooLongFrame) {
long bytesToDiscard = this.bytesToDiscard;
int localBytesToDiscard = (int) Math.min(bytesToDiscard, in.readableBytes());
in.skipBytes(localBytesToDiscard);
bytesToDiscard -= localBytesToDiscard;
this.bytesToDiscard = bytesToDiscard;
failIfNecessary(false);
return null;
}
if (consumingLength) {
int delimIndex = indexOf(in, delimiter);
if (delimIndex < 0) {
return null; // depends on control dependency: [if], data = [none]
}
final String lengthStr = in.toString(in.readerIndex(), delimIndex, lengthFieldCharset);
try {
frameLength = Long.parseLong(trimLengthString ? lengthStr.trim() : lengthStr); // depends on control dependency: [try], data = [none]
} catch (NumberFormatException e) {
throw new CorruptedFrameException(
String.format(
"Invalid length field decoded (in %s charset): %s",
lengthFieldCharset.name(),
lengthStr
),
e
);
} // depends on control dependency: [catch], data = [none]
if (frameLength < 0) {
throw new CorruptedFrameException("negative pre-adjustment length field: " + frameLength);
}
frameLength += lengthAdjustment;
//consume length field and delimiter bytes
in.skipBytes(delimIndex + delimiter.capacity());
//consume delimiter bytes
consumingLength = false;
}
if (frameLength > maxFrameLength) {
long discard = frameLength - in.readableBytes();
tooLongFrameLength = frameLength;
if (discard < 0) {
// buffer contains more bytes then the frameLength so we can discard all now
in.skipBytes((int) frameLength); // depends on control dependency: [if], data = [none]
} else {
// Enter the discard mode and discard everything received so far.
discardingTooLongFrame = true; // depends on control dependency: [if], data = [none]
consumingLength = true; // depends on control dependency: [if], data = [none]
bytesToDiscard = discard; // depends on control dependency: [if], data = [none]
in.skipBytes(in.readableBytes()); // depends on control dependency: [if], data = [none]
}
failIfNecessary(true);
return null;
}
// never overflows because it's less than maxFrameLength
int frameLengthInt = (int) frameLength;
if (in.readableBytes() < frameLengthInt) {
// need more bytes available to read actual frame
return null;
}
// the frame is now entirely present, reset state vars
consumingLength = true;
frameLength = 0;
// extract frame
int readerIndex = in.readerIndex();
int actualFrameLength = frameLengthInt;// - initialBytesToStrip;
ByteBuf frame = extractFrame(ctx, in, readerIndex, actualFrameLength);
in.readerIndex(readerIndex + actualFrameLength);
return frame;
} } |
public class class_name {
protected String[] getDatabaseCatalogNames(Database database) throws SQLException, DatabaseException {
List<String> returnList = new ArrayList<>();
ResultSet catalogs = null;
try {
if (((AbstractJdbcDatabase) database).jdbcCallsCatalogsSchemas()) {
catalogs = ((JdbcConnection) database.getConnection()).getMetaData().getSchemas();
} else {
catalogs = ((JdbcConnection) database.getConnection()).getMetaData().getCatalogs();
}
while (catalogs.next()) {
if (((AbstractJdbcDatabase) database).jdbcCallsCatalogsSchemas()) {
returnList.add(catalogs.getString("TABLE_SCHEM"));
} else {
returnList.add(catalogs.getString("TABLE_CAT"));
}
}
} finally {
if (catalogs != null) {
try {
catalogs.close();
} catch (SQLException ignore) {
}
}
}
return returnList.toArray(new String[returnList.size()]);
} } | public class class_name {
protected String[] getDatabaseCatalogNames(Database database) throws SQLException, DatabaseException {
List<String> returnList = new ArrayList<>();
ResultSet catalogs = null;
try {
if (((AbstractJdbcDatabase) database).jdbcCallsCatalogsSchemas()) {
catalogs = ((JdbcConnection) database.getConnection()).getMetaData().getSchemas(); // depends on control dependency: [if], data = [none]
} else {
catalogs = ((JdbcConnection) database.getConnection()).getMetaData().getCatalogs(); // depends on control dependency: [if], data = [none]
}
while (catalogs.next()) {
if (((AbstractJdbcDatabase) database).jdbcCallsCatalogsSchemas()) {
returnList.add(catalogs.getString("TABLE_SCHEM")); // depends on control dependency: [if], data = [none]
} else {
returnList.add(catalogs.getString("TABLE_CAT")); // depends on control dependency: [if], data = [none]
}
}
} finally {
if (catalogs != null) {
try {
catalogs.close(); // depends on control dependency: [try], data = [none]
} catch (SQLException ignore) {
} // depends on control dependency: [catch], data = [none]
}
}
return returnList.toArray(new String[returnList.size()]);
} } |
public class class_name {
public static String[] intersect (String[] a, String[] b) {
if (a == null || b == null) return null;
final int maxLength = Math.max(a.length, b.length);// prevent growing of
// the ArrayList
final ArrayList<String> intersection = new ArrayList<>(maxLength);
for (int i = 0; i < a.length; ++i) {
for (int j = 0; j < b.length; ++j) {
if (a[i] == null || b[j] == null) return null;
if (a[i].matches(b[j])) {
// add element to intersection and check next String in a
intersection.add(a[i]);
break;
}
}
}
String[] result = new String[intersection.size()];
result = intersection.toArray(result);
return result;
} } | public class class_name {
public static String[] intersect (String[] a, String[] b) {
if (a == null || b == null) return null;
final int maxLength = Math.max(a.length, b.length);// prevent growing of
// the ArrayList
final ArrayList<String> intersection = new ArrayList<>(maxLength);
for (int i = 0; i < a.length; ++i) {
for (int j = 0; j < b.length; ++j) {
if (a[i] == null || b[j] == null) return null;
if (a[i].matches(b[j])) {
// add element to intersection and check next String in a
intersection.add(a[i]);
// depends on control dependency: [if], data = [none]
break;
}
}
}
String[] result = new String[intersection.size()];
result = intersection.toArray(result);
return result;
} } |
public class class_name {
public void marshall(InitiateDeviceClaimRequest initiateDeviceClaimRequest, ProtocolMarshaller protocolMarshaller) {
if (initiateDeviceClaimRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(initiateDeviceClaimRequest.getDeviceId(), DEVICEID_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(InitiateDeviceClaimRequest initiateDeviceClaimRequest, ProtocolMarshaller protocolMarshaller) {
if (initiateDeviceClaimRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(initiateDeviceClaimRequest.getDeviceId(), DEVICEID_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public boolean hasRole(CmsObject cms, String userName, CmsRole role) {
CmsUser user;
try {
user = cms.readUser(userName);
} catch (CmsException e) {
// ignore
return false;
}
return m_securityManager.hasRole(cms.getRequestContext(), user, role);
} } | public class class_name {
public boolean hasRole(CmsObject cms, String userName, CmsRole role) {
CmsUser user;
try {
user = cms.readUser(userName); // depends on control dependency: [try], data = [none]
} catch (CmsException e) {
// ignore
return false;
} // depends on control dependency: [catch], data = [none]
return m_securityManager.hasRole(cms.getRequestContext(), user, role);
} } |
public class class_name {
public final EObject entryRuleRichStringLiteralInbetween() throws RecognitionException {
EObject current = null;
EObject iv_ruleRichStringLiteralInbetween = null;
try {
// InternalSARL.g:10902:67: (iv_ruleRichStringLiteralInbetween= ruleRichStringLiteralInbetween EOF )
// InternalSARL.g:10903:2: iv_ruleRichStringLiteralInbetween= ruleRichStringLiteralInbetween EOF
{
if ( state.backtracking==0 ) {
newCompositeNode(grammarAccess.getRichStringLiteralInbetweenRule());
}
pushFollow(FOLLOW_1);
iv_ruleRichStringLiteralInbetween=ruleRichStringLiteralInbetween();
state._fsp--;
if (state.failed) return current;
if ( state.backtracking==0 ) {
current =iv_ruleRichStringLiteralInbetween;
}
match(input,EOF,FOLLOW_2); if (state.failed) return current;
}
}
catch (RecognitionException re) {
recover(input,re);
appendSkippedTokens();
}
finally {
}
return current;
} } | public class class_name {
public final EObject entryRuleRichStringLiteralInbetween() throws RecognitionException {
EObject current = null;
EObject iv_ruleRichStringLiteralInbetween = null;
try {
// InternalSARL.g:10902:67: (iv_ruleRichStringLiteralInbetween= ruleRichStringLiteralInbetween EOF )
// InternalSARL.g:10903:2: iv_ruleRichStringLiteralInbetween= ruleRichStringLiteralInbetween EOF
{
if ( state.backtracking==0 ) {
newCompositeNode(grammarAccess.getRichStringLiteralInbetweenRule()); // depends on control dependency: [if], data = [none]
}
pushFollow(FOLLOW_1);
iv_ruleRichStringLiteralInbetween=ruleRichStringLiteralInbetween();
state._fsp--;
if (state.failed) return current;
if ( state.backtracking==0 ) {
current =iv_ruleRichStringLiteralInbetween; // depends on control dependency: [if], data = [none]
}
match(input,EOF,FOLLOW_2); if (state.failed) return current;
}
}
catch (RecognitionException re) {
recover(input,re);
appendSkippedTokens();
}
finally {
}
return current;
} } |
public class class_name {
@Override
void stopListening() {
if (listening) {
try {
Log.v(
DOMAIN,
"%s: stopListening() unregistering %s with context %s", this, receiver, context);
context.unregisterReceiver(receiver);
}
catch (Exception e) {
Log.e(
DOMAIN,
"%s: stopListening() exception unregistering %s with context %s",
e,
this,
receiver,
context);
}
listening = false;
}
} } | public class class_name {
@Override
void stopListening() {
if (listening) {
try {
Log.v(
DOMAIN,
"%s: stopListening() unregistering %s with context %s", this, receiver, context); // depends on control dependency: [try], data = [none]
context.unregisterReceiver(receiver); // depends on control dependency: [try], data = [none]
}
catch (Exception e) {
Log.e(
DOMAIN,
"%s: stopListening() exception unregistering %s with context %s",
e,
this,
receiver,
context);
} // depends on control dependency: [catch], data = [none]
listening = false; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public List<CmsAliasBean> getAliases() {
List<CmsAliasBean> beans = new ArrayList<CmsAliasBean>();
for (AliasControls controls : m_aliasControls.values()) {
beans.add(controls.getAlias());
}
return beans;
} } | public class class_name {
public List<CmsAliasBean> getAliases() {
List<CmsAliasBean> beans = new ArrayList<CmsAliasBean>();
for (AliasControls controls : m_aliasControls.values()) {
beans.add(controls.getAlias());
// depends on control dependency: [for], data = [controls]
}
return beans;
} } |
public class class_name {
public Set<String> getNonJSExtensions(IAggregator aggregator) {
final String sourceMethod = "getNonJSExtensions"; //$NON-NLS-1$
boolean isTraceLogging = log.isLoggable(Level.FINER);
if (isTraceLogging) {
log.entering(sourceClass, sourceMethod, new Object[]{aggregator});
}
// Build set of non-js file extensions to include in the dependency names
Set<String> result = new HashSet<String>(Arrays.asList(IDependencies.defaultNonJSExtensions));
// Add any extensions specified in the config
Object cfgExtensions = aggregator.getConfig().getProperty(IDependencies.nonJSExtensionsCfgPropName, String[].class);
if (cfgExtensions != null && cfgExtensions instanceof String[]) {
result.addAll(Arrays.asList((String[])cfgExtensions));
}
// Add extensions specified by any module builders
Iterable<IAggregatorExtension> aggrExts = aggregator.getExtensions(IModuleBuilderExtensionPoint.ID);
if (aggrExts != null) {
for (IAggregatorExtension aggrExt : aggrExts) {
String ext = aggrExt.getAttribute(IModuleBuilderExtensionPoint.EXTENSION_ATTRIBUTE);
if (ext != null && ext.length() > 0 && !ext.equals("js") && !ext.equals("*")) { //$NON-NLS-1$ //$NON-NLS-2$
result.add(ext);
}
}
}
log.exiting(sourceClass, sourceMethod, result);
return result;
} } | public class class_name {
public Set<String> getNonJSExtensions(IAggregator aggregator) {
final String sourceMethod = "getNonJSExtensions"; //$NON-NLS-1$
boolean isTraceLogging = log.isLoggable(Level.FINER);
if (isTraceLogging) {
log.entering(sourceClass, sourceMethod, new Object[]{aggregator});
// depends on control dependency: [if], data = [none]
}
// Build set of non-js file extensions to include in the dependency names
Set<String> result = new HashSet<String>(Arrays.asList(IDependencies.defaultNonJSExtensions));
// Add any extensions specified in the config
Object cfgExtensions = aggregator.getConfig().getProperty(IDependencies.nonJSExtensionsCfgPropName, String[].class);
if (cfgExtensions != null && cfgExtensions instanceof String[]) {
result.addAll(Arrays.asList((String[])cfgExtensions));
// depends on control dependency: [if], data = [none]
}
// Add extensions specified by any module builders
Iterable<IAggregatorExtension> aggrExts = aggregator.getExtensions(IModuleBuilderExtensionPoint.ID);
if (aggrExts != null) {
for (IAggregatorExtension aggrExt : aggrExts) {
String ext = aggrExt.getAttribute(IModuleBuilderExtensionPoint.EXTENSION_ATTRIBUTE);
if (ext != null && ext.length() > 0 && !ext.equals("js") && !ext.equals("*")) { //$NON-NLS-1$ //$NON-NLS-2$
result.add(ext);
// depends on control dependency: [if], data = [(ext]
}
}
}
log.exiting(sourceClass, sourceMethod, result);
return result;
} } |
public class class_name {
public static Cluster getCluster(ZkClient zkClient) {
Cluster cluster = new Cluster();
List<String> nodes = getChildrenParentMayNotExist(zkClient, BrokerIdsPath);
for (String node : nodes) {
final String brokerInfoString = readData(zkClient, BrokerIdsPath + "/" + node);
cluster.add(Broker.createBroker(Integer.valueOf(node), brokerInfoString));
}
return cluster;
} } | public class class_name {
public static Cluster getCluster(ZkClient zkClient) {
Cluster cluster = new Cluster();
List<String> nodes = getChildrenParentMayNotExist(zkClient, BrokerIdsPath);
for (String node : nodes) {
final String brokerInfoString = readData(zkClient, BrokerIdsPath + "/" + node);
cluster.add(Broker.createBroker(Integer.valueOf(node), brokerInfoString)); // depends on control dependency: [for], data = [node]
}
return cluster;
} } |
public class class_name {
public static void assertMainThread() {
if (imp != null && !DispatchQueue.isMainQueue()) {
imp.assertFailed(StringUtils.format("Expected 'main' thread but was '%s'", Thread.currentThread().getName()));
}
} } | public class class_name {
public static void assertMainThread() {
if (imp != null && !DispatchQueue.isMainQueue()) {
imp.assertFailed(StringUtils.format("Expected 'main' thread but was '%s'", Thread.currentThread().getName())); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
protected LocalGossipMember selectPartner(List<LocalGossipMember> memberList) {
LocalGossipMember member = null;
if (memberList.size() > 0) {
int randomNeighborIndex = random.nextInt(memberList.size());
member = memberList.get(randomNeighborIndex);
} else {
GossipService.LOGGER.debug("I am alone in this world.");
}
return member;
} } | public class class_name {
protected LocalGossipMember selectPartner(List<LocalGossipMember> memberList) {
LocalGossipMember member = null;
if (memberList.size() > 0) {
int randomNeighborIndex = random.nextInt(memberList.size());
member = memberList.get(randomNeighborIndex); // depends on control dependency: [if], data = [none]
} else {
GossipService.LOGGER.debug("I am alone in this world."); // depends on control dependency: [if], data = [none]
}
return member;
} } |
public class class_name {
public boolean isReplicationActive(final String iClusterName, final String iLocalNode) {
final Collection<String> servers = getClusterConfiguration(iClusterName).field(SERVERS);
if (servers != null && !servers.isEmpty()) {
return true;
}
return false;
} } | public class class_name {
public boolean isReplicationActive(final String iClusterName, final String iLocalNode) {
final Collection<String> servers = getClusterConfiguration(iClusterName).field(SERVERS);
if (servers != null && !servers.isEmpty()) {
return true; // depends on control dependency: [if], data = [none]
}
return false;
} } |
public class class_name {
private static String sha1hash(Collection<String> nquads) {
try {
// create SHA-1 digest
final MessageDigest md = MessageDigest.getInstance("SHA-1");
for (final String nquad : nquads) {
md.update(nquad.getBytes("UTF-8"));
}
return encodeHex(md.digest());
} catch (final NoSuchAlgorithmException e) {
throw new RuntimeException(e);
} catch (final UnsupportedEncodingException e) {
throw new RuntimeException(e);
}
} } | public class class_name {
private static String sha1hash(Collection<String> nquads) {
try {
// create SHA-1 digest
final MessageDigest md = MessageDigest.getInstance("SHA-1");
for (final String nquad : nquads) {
md.update(nquad.getBytes("UTF-8")); // depends on control dependency: [for], data = [nquad]
}
return encodeHex(md.digest()); // depends on control dependency: [try], data = [none]
} catch (final NoSuchAlgorithmException e) {
throw new RuntimeException(e);
} catch (final UnsupportedEncodingException e) { // depends on control dependency: [catch], data = [none]
throw new RuntimeException(e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
private int pool( int row, int col, int prevNPool ) {
int in;
int jn;
int npool = prevNPool;
if (apool[col][row] <= 0) { /* not already part of a pool */
if (dir[col][row] != -1) {/* check only dir since dir was initialized */
/* not on boundary */
apool[col][row] = pooln;/* apool assigned pool number */
npool = npool + 1;// the number of pixel in the pool
if (npool >= pstack) {
if (pstack < nCols * nRows) {
pstack = (int) (pstack + nCols * nRows * .1);
if (pstack > nCols * nRows) {
/* Pool stack too large */
}
ipool = realloc(ipool, pstack);
jpool = realloc(jpool, pstack);
}
}
ipool[npool] = row;
jpool[npool] = col;
for( int k = 1; k <= 8; k++ ) {
in = row + DIR_WITHFLOW_EXITING_INVERTED[k][1];
jn = col + DIR_WITHFLOW_EXITING_INVERTED[k][0];
/* test if neighbor drains towards cell excluding boundaries */
if (((dir[jn][in] > 0) && ((dir[jn][in] - k == 4) || (dir[jn][in] - k == -4))) || ((dir[jn][in] == 0)
&& (pitIter.getSampleDouble(jn, in, 0) >= pitIter.getSampleDouble(col, row, 0)))) {
/* so that adjacent flats get included */
npool = pool(in, jn, npool);
}
}
}
}
return npool;
} } | public class class_name {
private int pool( int row, int col, int prevNPool ) {
int in;
int jn;
int npool = prevNPool;
if (apool[col][row] <= 0) { /* not already part of a pool */
if (dir[col][row] != -1) {/* check only dir since dir was initialized */
/* not on boundary */
apool[col][row] = pooln;/* apool assigned pool number */ // depends on control dependency: [if], data = [none]
npool = npool + 1;// the number of pixel in the pool // depends on control dependency: [if], data = [none]
if (npool >= pstack) {
if (pstack < nCols * nRows) {
pstack = (int) (pstack + nCols * nRows * .1); // depends on control dependency: [if], data = [(pstack]
if (pstack > nCols * nRows) {
/* Pool stack too large */
}
ipool = realloc(ipool, pstack); // depends on control dependency: [if], data = [none]
jpool = realloc(jpool, pstack); // depends on control dependency: [if], data = [none]
}
}
ipool[npool] = row; // depends on control dependency: [if], data = [none]
jpool[npool] = col; // depends on control dependency: [if], data = [none]
for( int k = 1; k <= 8; k++ ) {
in = row + DIR_WITHFLOW_EXITING_INVERTED[k][1]; // depends on control dependency: [for], data = [k]
jn = col + DIR_WITHFLOW_EXITING_INVERTED[k][0]; // depends on control dependency: [for], data = [k]
/* test if neighbor drains towards cell excluding boundaries */
if (((dir[jn][in] > 0) && ((dir[jn][in] - k == 4) || (dir[jn][in] - k == -4))) || ((dir[jn][in] == 0)
&& (pitIter.getSampleDouble(jn, in, 0) >= pitIter.getSampleDouble(col, row, 0)))) {
/* so that adjacent flats get included */
npool = pool(in, jn, npool); // depends on control dependency: [if], data = [none]
}
}
}
}
return npool;
} } |
public class class_name {
public void marshall(UdpContainerSettings udpContainerSettings, ProtocolMarshaller protocolMarshaller) {
if (udpContainerSettings == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(udpContainerSettings.getM2tsSettings(), M2TSSETTINGS_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(UdpContainerSettings udpContainerSettings, ProtocolMarshaller protocolMarshaller) {
if (udpContainerSettings == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(udpContainerSettings.getM2tsSettings(), M2TSSETTINGS_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
@Override
protected void doGet(final HttpServletRequest _req,
final HttpServletResponse _res)
throws ServletException
{
HelpServlet.LOG.debug("Recieved Request for Help Servlet: {}", _req);
try {
final List<String> wikis = new ArrayList<String>();
String path = _req.getPathInfo().substring(1);
final String end = path.substring(path.lastIndexOf("."), path.length());
if (end.equalsIgnoreCase(".png") || end.equalsIgnoreCase(".jpg") || end.equalsIgnoreCase(".jpeg")
|| end.equalsIgnoreCase(".gif")) {
final QueryBuilder queryBldr = new QueryBuilder(CIAdminProgram.WikiImage);
queryBldr.addWhereAttrEqValue("Name", path);
final MultiPrintQuery multi = queryBldr.getPrint();
multi.addAttribute("FileLength");
multi.execute();
if (multi.next()) {
final Long length = multi.<Long>getAttribute("FileLength");
final Checkout checkout = new Checkout(multi.getCurrentInstance());
_res.setContentType(getServletContext().getMimeType(end));
_res.setContentLength(length.intValue());
_res.setDateHeader("Expires", System.currentTimeMillis() + (3600 * 1000));
_res.setHeader("Cache-Control", "max-age=3600");
checkout.execute(_res.getOutputStream());
checkout.close();
}
} else {
if (!path.contains(".")) {
String referer = _req.getHeader("Referer");
if (referer.contains(":")) {
final String[] paths = referer.split(":");
referer = paths[0];
}
final String[] pack = referer.substring(referer.lastIndexOf("/") + 1).split("\\.");
final StringBuilder newPath = new StringBuilder();
for (int i = 0; i < pack.length - 2; i++) {
newPath.append(pack[i]).append(".");
}
newPath.append(path).append(".wiki");
path = newPath.toString();
wikis.add(path);
} else if (path.contains(":")) {
final String[] paths = path.split(":");
for (final String apath : paths) {
wikis.add(apath);
}
} else {
wikis.add(path);
}
final String menuStr;
if (Context.getThreadContext().containsSessionAttribute(HelpServlet.MENU_SESSION_KEY)) {
menuStr = (String) Context.getThreadContext().getSessionAttribute(HelpServlet.MENU_SESSION_KEY);
} else {
menuStr = getMenu();
Context.getThreadContext().setSessionAttribute(HelpServlet.MENU_SESSION_KEY, menuStr);
}
final StringBuilder html = new StringBuilder();
html.append("<html><head>")
.append("<script type=\"text/javascript\" src=\"../../wicket/resource/")
.append(AbstractDojoBehavior.JS_DOJO.getScope().getName()).append("/")
.append(AbstractDojoBehavior.JS_DOJO.getName())
.append("\" data-dojo-config=\"async: true,parseOnLoad: true\"></script>\n")
.append("<script type=\"text/javascript\" >")
.append("/*<![CDATA[*/\n")
.append("require([\"dijit/layout/BorderContainer\",\"dijit/layout/ContentPane\",")
.append(" \"dojo/parser\"]);\n")
.append("/*]]>*/")
.append("</script>\n")
.append("<link rel=\"stylesheet\" type=\"text/css\" href=\"../../wicket/resource/")
.append(AbstractDojoBehavior.CSS_TUNDRA.getScope().getName()).append("/")
.append(AbstractDojoBehavior.CSS_TUNDRA.getName())
.append("\" />")
.append("<link rel=\"stylesheet\" type=\"text/css\" ")
.append(" href=\"../../servlet/static/org.efaps.help.Help.css?")
.append("\" />")
.append("</head><body>")
.append("<div data-dojo-type=\"dijit/layout/BorderContainer\" ")
.append("data-dojo-props=\"design: 'sidebar'\"")
.append(" class=\"tundra\" ")
.append("style=\"width: 100%; height: 99%;\">")
.append("<div data-dojo-type=\"dijit/layout/ContentPane\" ")
.append("data-dojo-props=\"region: 'leading',splitter: true\" ")
.append("style=\"width: 200px\">")
.append("<div class=\"eFapsHelpMenu\">")
.append(menuStr)
.append("</div></div>")
.append("<div data-dojo-type=\"dijit/layout/ContentPane\" ")
.append("data-dojo-props=\"region: 'center'\" ")
.append("><div class=\"eFapsWikiPage\">");
for (final String wiki : wikis) {
final QueryBuilder queryBldr = new QueryBuilder(CIAdminProgram.WikiCompiled);
queryBldr.addWhereAttrEqValue("Name", wiki);
final InstanceQuery query = queryBldr.getQuery();
query.execute();
if (query.next()) {
final Checkout checkout = new Checkout(query.getCurrentValue());
final InputStreamReader in = new InputStreamReader(checkout.execute(), "UTF8");
if (in != null) {
final BufferedReader reader = new BufferedReader(in);
String line = null;
while ((line = reader.readLine()) != null) {
html.append(line);
}
}
}
}
html.append("</div></div></body></html>");
_res.setContentType("text/html;charset=UTF-8");
_res.setContentLength(html.length());
_res.getOutputStream().write(html.toString().getBytes("UTF8"));
}
} catch (final EFapsException e) {
throw new ServletException(e);
} catch (final IOException e) {
throw new ServletException(e);
}
} } | public class class_name {
@Override
protected void doGet(final HttpServletRequest _req,
final HttpServletResponse _res)
throws ServletException
{
HelpServlet.LOG.debug("Recieved Request for Help Servlet: {}", _req);
try {
final List<String> wikis = new ArrayList<String>();
String path = _req.getPathInfo().substring(1);
final String end = path.substring(path.lastIndexOf("."), path.length());
if (end.equalsIgnoreCase(".png") || end.equalsIgnoreCase(".jpg") || end.equalsIgnoreCase(".jpeg")
|| end.equalsIgnoreCase(".gif")) {
final QueryBuilder queryBldr = new QueryBuilder(CIAdminProgram.WikiImage);
queryBldr.addWhereAttrEqValue("Name", path);
final MultiPrintQuery multi = queryBldr.getPrint();
multi.addAttribute("FileLength");
multi.execute();
if (multi.next()) {
final Long length = multi.<Long>getAttribute("FileLength");
final Checkout checkout = new Checkout(multi.getCurrentInstance());
_res.setContentType(getServletContext().getMimeType(end)); // depends on control dependency: [if], data = [none]
_res.setContentLength(length.intValue()); // depends on control dependency: [if], data = [none]
_res.setDateHeader("Expires", System.currentTimeMillis() + (3600 * 1000)); // depends on control dependency: [if], data = [none]
_res.setHeader("Cache-Control", "max-age=3600"); // depends on control dependency: [if], data = [none]
checkout.execute(_res.getOutputStream()); // depends on control dependency: [if], data = [none]
checkout.close(); // depends on control dependency: [if], data = [none]
}
} else {
if (!path.contains(".")) {
String referer = _req.getHeader("Referer");
if (referer.contains(":")) {
final String[] paths = referer.split(":");
referer = paths[0]; // depends on control dependency: [if], data = [none]
}
final String[] pack = referer.substring(referer.lastIndexOf("/") + 1).split("\\.");
final StringBuilder newPath = new StringBuilder();
for (int i = 0; i < pack.length - 2; i++) {
newPath.append(pack[i]).append("."); // depends on control dependency: [for], data = [i]
}
newPath.append(path).append(".wiki"); // depends on control dependency: [if], data = [none]
path = newPath.toString(); // depends on control dependency: [if], data = [none]
wikis.add(path); // depends on control dependency: [if], data = [none]
} else if (path.contains(":")) {
final String[] paths = path.split(":");
for (final String apath : paths) {
wikis.add(apath); // depends on control dependency: [for], data = [apath]
}
} else {
wikis.add(path); // depends on control dependency: [if], data = [none]
}
final String menuStr;
if (Context.getThreadContext().containsSessionAttribute(HelpServlet.MENU_SESSION_KEY)) {
menuStr = (String) Context.getThreadContext().getSessionAttribute(HelpServlet.MENU_SESSION_KEY); // depends on control dependency: [if], data = [none]
} else {
menuStr = getMenu(); // depends on control dependency: [if], data = [none]
Context.getThreadContext().setSessionAttribute(HelpServlet.MENU_SESSION_KEY, menuStr); // depends on control dependency: [if], data = [none]
}
final StringBuilder html = new StringBuilder();
html.append("<html><head>")
.append("<script type=\"text/javascript\" src=\"../../wicket/resource/")
.append(AbstractDojoBehavior.JS_DOJO.getScope().getName()).append("/")
.append(AbstractDojoBehavior.JS_DOJO.getName())
.append("\" data-dojo-config=\"async: true,parseOnLoad: true\"></script>\n")
.append("<script type=\"text/javascript\" >")
.append("/*<![CDATA[*/\n")
.append("require([\"dijit/layout/BorderContainer\",\"dijit/layout/ContentPane\",")
.append(" \"dojo/parser\"]);\n")
.append("/*]]>*/")
.append("</script>\n")
.append("<link rel=\"stylesheet\" type=\"text/css\" href=\"../../wicket/resource/")
.append(AbstractDojoBehavior.CSS_TUNDRA.getScope().getName()).append("/")
.append(AbstractDojoBehavior.CSS_TUNDRA.getName())
.append("\" />")
.append("<link rel=\"stylesheet\" type=\"text/css\" ")
.append(" href=\"../../servlet/static/org.efaps.help.Help.css?")
.append("\" />")
.append("</head><body>")
.append("<div data-dojo-type=\"dijit/layout/BorderContainer\" ")
.append("data-dojo-props=\"design: 'sidebar'\"")
.append(" class=\"tundra\" ")
.append("style=\"width: 100%; height: 99%;\">")
.append("<div data-dojo-type=\"dijit/layout/ContentPane\" ")
.append("data-dojo-props=\"region: 'leading',splitter: true\" ")
.append("style=\"width: 200px\">")
.append("<div class=\"eFapsHelpMenu\">")
.append(menuStr)
.append("</div></div>")
.append("<div data-dojo-type=\"dijit/layout/ContentPane\" ")
.append("data-dojo-props=\"region: 'center'\" ")
.append("><div class=\"eFapsWikiPage\">");
for (final String wiki : wikis) {
final QueryBuilder queryBldr = new QueryBuilder(CIAdminProgram.WikiCompiled);
queryBldr.addWhereAttrEqValue("Name", wiki); // depends on control dependency: [for], data = [wiki]
final InstanceQuery query = queryBldr.getQuery();
query.execute(); // depends on control dependency: [for], data = [none]
if (query.next()) {
final Checkout checkout = new Checkout(query.getCurrentValue());
final InputStreamReader in = new InputStreamReader(checkout.execute(), "UTF8");
if (in != null) {
final BufferedReader reader = new BufferedReader(in);
String line = null;
while ((line = reader.readLine()) != null) {
html.append(line); // depends on control dependency: [while], data = [none]
}
}
}
}
html.append("</div></div></body></html>");
_res.setContentType("text/html;charset=UTF-8");
_res.setContentLength(html.length());
_res.getOutputStream().write(html.toString().getBytes("UTF8"));
}
} catch (final EFapsException e) {
throw new ServletException(e);
} catch (final IOException e) {
throw new ServletException(e);
}
} } |
public class class_name {
public void marshall(DescribeScriptRequest describeScriptRequest, ProtocolMarshaller protocolMarshaller) {
if (describeScriptRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(describeScriptRequest.getScriptId(), SCRIPTID_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(DescribeScriptRequest describeScriptRequest, ProtocolMarshaller protocolMarshaller) {
if (describeScriptRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(describeScriptRequest.getScriptId(), SCRIPTID_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
private Download doDownload(final GetObjectRequest getObjectRequest,
final File file, final TransferStateChangeListener stateListener,
final S3ProgressListener s3progressListener,
final boolean resumeExistingDownload,
final long timeoutMillis,
final Integer lastFullyDownloadedPart,
final long lastModifiedTimeRecordedDuringPause,
final boolean resumeOnRetry,
final Long lastFullyDownloadedPartPosition)
{
assertParameterNotNull(getObjectRequest,
"A valid GetObjectRequest must be provided to initiate download");
assertParameterNotNull(file,
"A valid file must be provided to download into");
appendSingleObjectUserAgent(getObjectRequest);
String description = "Downloading from " + getObjectRequest.getBucketName() + "/" + getObjectRequest.getKey();
TransferProgress transferProgress = new TransferProgress();
// S3 progress listener to capture the persistable transfer when available
S3ProgressListenerChain listenerChain = new S3ProgressListenerChain(
// The listener for updating transfer progress
new TransferProgressUpdatingListener(transferProgress),
getObjectRequest.getGeneralProgressListener(),
s3progressListener); // Listeners included in the original request
// The listener chain used by the low-level GetObject request.
// This listener chain ignores any COMPLETE event, so that we could
// delay firing the signal until the high-level download fully finishes.
getObjectRequest
.setGeneralProgressListener(new ProgressListenerChain(new TransferCompletionFilter(), listenerChain));
GetObjectMetadataRequest getObjectMetadataRequest = RequestCopyUtils.createGetObjectMetadataRequestFrom(getObjectRequest);
final ObjectMetadata objectMetadata = s3.getObjectMetadata(getObjectMetadataRequest);
// Used to check if the object is modified between pause and resume
long lastModifiedTime = objectMetadata.getLastModified().getTime();
long startingByte = 0;
long lastByte;
long[] range = getObjectRequest.getRange();
if (range != null && range.length == 2) {
startingByte = range[0];
lastByte = range[1];
} else {
lastByte = objectMetadata.getContentLength() - 1;
}
final long origStartingByte = startingByte;
final boolean isDownloadParallel = !configuration.isDisableParallelDownloads()
&& TransferManagerUtils.isDownloadParallelizable(s3, getObjectRequest, ServiceUtils.getPartCount(getObjectRequest, s3));
// We still pass the unfiltered listener chain into DownloadImpl
final DownloadImpl download = new DownloadImpl(description, transferProgress, listenerChain, null,
stateListener, getObjectRequest, file, objectMetadata, isDownloadParallel);
long totalBytesToDownload = lastByte - startingByte + 1;
transferProgress.setTotalBytesToTransfer(totalBytesToDownload);
// Range information is needed for auto retry of downloads so a retry
// request can start at the last downloaded location in the range.
//
// For obvious reasons, setting a Range header only makes sense if the
// object actually has content because it's inclusive, otherwise S3
// responds with 4xx
//
// In addition, we only set the range if the download was *NOT*
// determined to be parallelizable above. One of the conditions for
// parallel downloads is that getRange() returns null so preserve that.
if (totalBytesToDownload > 0 && !isDownloadParallel) {
getObjectRequest.withRange(startingByte, lastByte);
}
long fileLength = -1;
if (resumeExistingDownload) {
if (isS3ObjectModifiedSincePause(lastModifiedTime, lastModifiedTimeRecordedDuringPause)) {
throw new AmazonClientException("The requested object in bucket " + getObjectRequest.getBucketName()
+ " with key " + getObjectRequest.getKey() + " is modified on Amazon S3 since the last pause.");
}
// There's still a chance the object is modified while the request
// is in flight. Set this header so S3 fails the request if this happens.
getObjectRequest.setUnmodifiedSinceConstraint(new Date(lastModifiedTime));
if (!isDownloadParallel) {
if (!FileLocks.lock(file)) {
throw new FileLockException("Fail to lock " + file + " for resume download");
}
try {
if (file.exists()) {
fileLength = file.length();
startingByte = startingByte + fileLength;
getObjectRequest.setRange(startingByte, lastByte);
transferProgress.updateProgress(Math.min(fileLength, totalBytesToDownload));
totalBytesToDownload = lastByte - startingByte + 1;
if (log.isDebugEnabled()) {
log.debug("Resume download: totalBytesToDownload=" + totalBytesToDownload
+ ", origStartingByte=" + origStartingByte + ", startingByte=" + startingByte
+ ", lastByte=" + lastByte + ", numberOfBytesRead=" + fileLength + ", file: "
+ file);
}
}
} finally {
FileLocks.unlock(file);
}
}
}
if (totalBytesToDownload < 0) {
throw new IllegalArgumentException(
"Unable to determine the range for download operation.");
}
final CountDownLatch latch = new CountDownLatch(1);
Future<?> future = executorService.submit(
new DownloadCallable(s3, latch,
getObjectRequest, resumeExistingDownload,
download, file, origStartingByte, fileLength, timeoutMillis, timedThreadPool,
executorService, lastFullyDownloadedPart, isDownloadParallel, resumeOnRetry)
.withLastFullyMergedPartPosition(lastFullyDownloadedPartPosition));
download.setMonitor(new DownloadMonitor(download, future));
latch.countDown();
return download;
} } | public class class_name {
private Download doDownload(final GetObjectRequest getObjectRequest,
final File file, final TransferStateChangeListener stateListener,
final S3ProgressListener s3progressListener,
final boolean resumeExistingDownload,
final long timeoutMillis,
final Integer lastFullyDownloadedPart,
final long lastModifiedTimeRecordedDuringPause,
final boolean resumeOnRetry,
final Long lastFullyDownloadedPartPosition)
{
assertParameterNotNull(getObjectRequest,
"A valid GetObjectRequest must be provided to initiate download");
assertParameterNotNull(file,
"A valid file must be provided to download into");
appendSingleObjectUserAgent(getObjectRequest);
String description = "Downloading from " + getObjectRequest.getBucketName() + "/" + getObjectRequest.getKey();
TransferProgress transferProgress = new TransferProgress();
// S3 progress listener to capture the persistable transfer when available
S3ProgressListenerChain listenerChain = new S3ProgressListenerChain(
// The listener for updating transfer progress
new TransferProgressUpdatingListener(transferProgress),
getObjectRequest.getGeneralProgressListener(),
s3progressListener); // Listeners included in the original request
// The listener chain used by the low-level GetObject request.
// This listener chain ignores any COMPLETE event, so that we could
// delay firing the signal until the high-level download fully finishes.
getObjectRequest
.setGeneralProgressListener(new ProgressListenerChain(new TransferCompletionFilter(), listenerChain));
GetObjectMetadataRequest getObjectMetadataRequest = RequestCopyUtils.createGetObjectMetadataRequestFrom(getObjectRequest);
final ObjectMetadata objectMetadata = s3.getObjectMetadata(getObjectMetadataRequest);
// Used to check if the object is modified between pause and resume
long lastModifiedTime = objectMetadata.getLastModified().getTime();
long startingByte = 0;
long lastByte;
long[] range = getObjectRequest.getRange();
if (range != null && range.length == 2) {
startingByte = range[0]; // depends on control dependency: [if], data = [none]
lastByte = range[1]; // depends on control dependency: [if], data = [none]
} else {
lastByte = objectMetadata.getContentLength() - 1; // depends on control dependency: [if], data = [none]
}
final long origStartingByte = startingByte;
final boolean isDownloadParallel = !configuration.isDisableParallelDownloads()
&& TransferManagerUtils.isDownloadParallelizable(s3, getObjectRequest, ServiceUtils.getPartCount(getObjectRequest, s3));
// We still pass the unfiltered listener chain into DownloadImpl
final DownloadImpl download = new DownloadImpl(description, transferProgress, listenerChain, null,
stateListener, getObjectRequest, file, objectMetadata, isDownloadParallel);
long totalBytesToDownload = lastByte - startingByte + 1;
transferProgress.setTotalBytesToTransfer(totalBytesToDownload);
// Range information is needed for auto retry of downloads so a retry
// request can start at the last downloaded location in the range.
//
// For obvious reasons, setting a Range header only makes sense if the
// object actually has content because it's inclusive, otherwise S3
// responds with 4xx
//
// In addition, we only set the range if the download was *NOT*
// determined to be parallelizable above. One of the conditions for
// parallel downloads is that getRange() returns null so preserve that.
if (totalBytesToDownload > 0 && !isDownloadParallel) {
getObjectRequest.withRange(startingByte, lastByte); // depends on control dependency: [if], data = [none]
}
long fileLength = -1;
if (resumeExistingDownload) {
if (isS3ObjectModifiedSincePause(lastModifiedTime, lastModifiedTimeRecordedDuringPause)) {
throw new AmazonClientException("The requested object in bucket " + getObjectRequest.getBucketName()
+ " with key " + getObjectRequest.getKey() + " is modified on Amazon S3 since the last pause.");
}
// There's still a chance the object is modified while the request
// is in flight. Set this header so S3 fails the request if this happens.
getObjectRequest.setUnmodifiedSinceConstraint(new Date(lastModifiedTime)); // depends on control dependency: [if], data = [none]
if (!isDownloadParallel) {
if (!FileLocks.lock(file)) {
throw new FileLockException("Fail to lock " + file + " for resume download");
}
try {
if (file.exists()) {
fileLength = file.length(); // depends on control dependency: [if], data = [none]
startingByte = startingByte + fileLength; // depends on control dependency: [if], data = [none]
getObjectRequest.setRange(startingByte, lastByte); // depends on control dependency: [if], data = [none]
transferProgress.updateProgress(Math.min(fileLength, totalBytesToDownload)); // depends on control dependency: [if], data = [none]
totalBytesToDownload = lastByte - startingByte + 1; // depends on control dependency: [if], data = [none]
if (log.isDebugEnabled()) {
log.debug("Resume download: totalBytesToDownload=" + totalBytesToDownload
+ ", origStartingByte=" + origStartingByte + ", startingByte=" + startingByte
+ ", lastByte=" + lastByte + ", numberOfBytesRead=" + fileLength + ", file: "
+ file); // depends on control dependency: [if], data = [none]
}
}
} finally {
FileLocks.unlock(file);
}
}
}
if (totalBytesToDownload < 0) {
throw new IllegalArgumentException(
"Unable to determine the range for download operation.");
}
final CountDownLatch latch = new CountDownLatch(1);
Future<?> future = executorService.submit(
new DownloadCallable(s3, latch,
getObjectRequest, resumeExistingDownload,
download, file, origStartingByte, fileLength, timeoutMillis, timedThreadPool,
executorService, lastFullyDownloadedPart, isDownloadParallel, resumeOnRetry)
.withLastFullyMergedPartPosition(lastFullyDownloadedPartPosition));
download.setMonitor(new DownloadMonitor(download, future));
latch.countDown();
return download;
} } |
public class class_name {
public static MultiValueMap<String, Object> validFieldNamesWithCastedValues(MultiValueMap<String, String> requestedFilter, Class<?> entityClass) {
Set<String> inputFieldNames = requestedFilter.keySet();
// Regarding case insensitivity: build a map that maps from the input field name to its original field name,
// but add only those fields to the map that exist in the entity
Map<String, String> validInputFieldNameToOrigFieldName = new HashMap<>();
List<String> filterableFieldNames = getFilterableOrRestrictableFieldNames(entityClass);
for (String filterableFieldName : filterableFieldNames) {
// find the corresponding field in the input
for (String inputFieldName : inputFieldNames) {
if (filterableFieldName.equalsIgnoreCase(inputFieldName)) {
validInputFieldNameToOrigFieldName.put(inputFieldName, filterableFieldName);
break;
}
}
}
MultiValueMap<String, Object> result = new LinkedMultiValueMap<>();
Set<String> validInputFieldNames = validInputFieldNameToOrigFieldName.keySet();
for (String validInputFieldName : validInputFieldNames) {
String origInputFieldName = validInputFieldNameToOrigFieldName.get(validInputFieldName);
List<String> stringValues = requestedFilter.get(validInputFieldName);
// cast to the correct type to avoid hibernate exceptions when querying db or similar
for (String fieldStringValue : stringValues) {
Field f = FieldUtils.getField(entityClass, origInputFieldName, true);
Class<?> fieldType = f.getType();
Object castedValue = ConvertUtils.convert(fieldStringValue, fieldType);
result.add(origInputFieldName, castedValue);
}
}
return result;
} } | public class class_name {
public static MultiValueMap<String, Object> validFieldNamesWithCastedValues(MultiValueMap<String, String> requestedFilter, Class<?> entityClass) {
Set<String> inputFieldNames = requestedFilter.keySet();
// Regarding case insensitivity: build a map that maps from the input field name to its original field name,
// but add only those fields to the map that exist in the entity
Map<String, String> validInputFieldNameToOrigFieldName = new HashMap<>();
List<String> filterableFieldNames = getFilterableOrRestrictableFieldNames(entityClass);
for (String filterableFieldName : filterableFieldNames) {
// find the corresponding field in the input
for (String inputFieldName : inputFieldNames) {
if (filterableFieldName.equalsIgnoreCase(inputFieldName)) {
validInputFieldNameToOrigFieldName.put(inputFieldName, filterableFieldName); // depends on control dependency: [if], data = [none]
break;
}
}
}
MultiValueMap<String, Object> result = new LinkedMultiValueMap<>();
Set<String> validInputFieldNames = validInputFieldNameToOrigFieldName.keySet();
for (String validInputFieldName : validInputFieldNames) {
String origInputFieldName = validInputFieldNameToOrigFieldName.get(validInputFieldName);
List<String> stringValues = requestedFilter.get(validInputFieldName);
// cast to the correct type to avoid hibernate exceptions when querying db or similar
for (String fieldStringValue : stringValues) {
Field f = FieldUtils.getField(entityClass, origInputFieldName, true);
Class<?> fieldType = f.getType();
Object castedValue = ConvertUtils.convert(fieldStringValue, fieldType);
result.add(origInputFieldName, castedValue);
}
}
return result;
} } |
public class class_name {
static List<String> splitCommandLine(String commandLine) {
// Split the commandLine by whitespace.
// Allow escaping single and double quoted strings.
if (Objects.requireNonNull(commandLine, "commandLine").isEmpty()) {
return new LinkedList<>();
}
final List<String> elements = new ArrayList<>();
final QuoteStack quoteStack = new QuoteStack();
char c = commandLine.charAt(0);
boolean matching = !isWhitespace(c);
int matchStart = 0;
if (isQuote(c)) {
quoteStack.push(c);
matchStart = 1;
}
for (int i = 1; i < commandLine.length(); i++) {
c = commandLine.charAt(i);
if (matching) {
if (isWhitespace(c) && quoteStack.isEmpty()) {
// Detected a whitespace after matching, and we're not in a quote -
// this is a word boundary.
elements.add(commandLine.substring(matchStart, i));
matching = false;
} else if (isQuote(c) && quoteStack.quoteMatches(c)) {
// Quote closes a previous section of quoted text.
elements.add(commandLine.substring(matchStart, i));
quoteStack.pop();
matching = false;
}
} else if (isQuote(c)) {
// We're not matching - Quote opens a new section of quoted text.
quoteStack.push(c);
matchStart = i + 1;
matching = true;
} else if (!isWhitespace(c)) {
// Done slurping whitespaces - non-whitespace detected, start matching.
matching = true;
matchStart = i;
}
}
if (matching) {
// Finished processing commandLine, but we're still matching - add the last word.
elements.add(commandLine.substring(matchStart, commandLine.length()));
}
return elements;
} } | public class class_name {
static List<String> splitCommandLine(String commandLine) {
// Split the commandLine by whitespace.
// Allow escaping single and double quoted strings.
if (Objects.requireNonNull(commandLine, "commandLine").isEmpty()) {
return new LinkedList<>(); // depends on control dependency: [if], data = [none]
}
final List<String> elements = new ArrayList<>();
final QuoteStack quoteStack = new QuoteStack();
char c = commandLine.charAt(0);
boolean matching = !isWhitespace(c);
int matchStart = 0;
if (isQuote(c)) {
quoteStack.push(c); // depends on control dependency: [if], data = [none]
matchStart = 1; // depends on control dependency: [if], data = [none]
}
for (int i = 1; i < commandLine.length(); i++) {
c = commandLine.charAt(i); // depends on control dependency: [for], data = [i]
if (matching) {
if (isWhitespace(c) && quoteStack.isEmpty()) {
// Detected a whitespace after matching, and we're not in a quote -
// this is a word boundary.
elements.add(commandLine.substring(matchStart, i)); // depends on control dependency: [if], data = [none]
matching = false; // depends on control dependency: [if], data = [none]
} else if (isQuote(c) && quoteStack.quoteMatches(c)) {
// Quote closes a previous section of quoted text.
elements.add(commandLine.substring(matchStart, i)); // depends on control dependency: [if], data = [none]
quoteStack.pop(); // depends on control dependency: [if], data = [none]
matching = false; // depends on control dependency: [if], data = [none]
}
} else if (isQuote(c)) {
// We're not matching - Quote opens a new section of quoted text.
quoteStack.push(c); // depends on control dependency: [if], data = [none]
matchStart = i + 1; // depends on control dependency: [if], data = [none]
matching = true; // depends on control dependency: [if], data = [none]
} else if (!isWhitespace(c)) {
// Done slurping whitespaces - non-whitespace detected, start matching.
matching = true; // depends on control dependency: [if], data = [none]
matchStart = i; // depends on control dependency: [if], data = [none]
}
}
if (matching) {
// Finished processing commandLine, but we're still matching - add the last word.
elements.add(commandLine.substring(matchStart, commandLine.length())); // depends on control dependency: [if], data = [none]
}
return elements;
} } |
public class class_name {
public void marshall(HandshakeParty handshakeParty, ProtocolMarshaller protocolMarshaller) {
if (handshakeParty == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(handshakeParty.getId(), ID_BINDING);
protocolMarshaller.marshall(handshakeParty.getType(), TYPE_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(HandshakeParty handshakeParty, ProtocolMarshaller protocolMarshaller) {
if (handshakeParty == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(handshakeParty.getId(), ID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(handshakeParty.getType(), TYPE_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public void setContainerOverrides(java.util.Collection<ContainerOverride> containerOverrides) {
if (containerOverrides == null) {
this.containerOverrides = null;
return;
}
this.containerOverrides = new com.amazonaws.internal.SdkInternalList<ContainerOverride>(containerOverrides);
} } | public class class_name {
public void setContainerOverrides(java.util.Collection<ContainerOverride> containerOverrides) {
if (containerOverrides == null) {
this.containerOverrides = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.containerOverrides = new com.amazonaws.internal.SdkInternalList<ContainerOverride>(containerOverrides);
} } |
public class class_name {
static Tuple2<String, List<Tag>> resolveNameAndTags(Publisher<?> source) {
//resolve the tags and names at instantiation
String name;
List<Tag> tags;
Scannable scannable = Scannable.from(source);
if (scannable.isScanAvailable()) {
String nameOrDefault = scannable.name();
if (scannable.stepName().equals(nameOrDefault)) {
name = REACTOR_DEFAULT_NAME;
}
else {
name = nameOrDefault;
}
tags = scannable.tags()
.map(tuple -> Tag.of(tuple.getT1(), tuple.getT2()))
.collect(Collectors.toList());
}
else {
LOGGER.warn("Attempting to activate metrics but the upstream is not Scannable. " +
"You might want to use `name()` (and optionally `tags()`) right before `metrics()`");
name = REACTOR_DEFAULT_NAME;
tags = Collections.emptyList();
}
return Tuples.of(name, tags);
} } | public class class_name {
static Tuple2<String, List<Tag>> resolveNameAndTags(Publisher<?> source) {
//resolve the tags and names at instantiation
String name;
List<Tag> tags;
Scannable scannable = Scannable.from(source);
if (scannable.isScanAvailable()) {
String nameOrDefault = scannable.name();
if (scannable.stepName().equals(nameOrDefault)) {
name = REACTOR_DEFAULT_NAME; // depends on control dependency: [if], data = [none]
}
else {
name = nameOrDefault; // depends on control dependency: [if], data = [none]
}
tags = scannable.tags()
.map(tuple -> Tag.of(tuple.getT1(), tuple.getT2()))
.collect(Collectors.toList()); // depends on control dependency: [if], data = [none]
}
else {
LOGGER.warn("Attempting to activate metrics but the upstream is not Scannable. " +
"You might want to use `name()` (and optionally `tags()`) right before `metrics()`"); // depends on control dependency: [if], data = [none]
name = REACTOR_DEFAULT_NAME; // depends on control dependency: [if], data = [none]
tags = Collections.emptyList(); // depends on control dependency: [if], data = [none]
}
return Tuples.of(name, tags);
} } |
public class class_name {
@Override
public void doSessionCreatedListeners(final long sessionId, final ManagementSessionType managementSessionType) {
runManagementTask(new Runnable() {
@Override
public void run() {
try {
// The particular management listeners change on strategy, so get them here.
for (final GatewayManagementListener listener : getManagementListeners()) {
listener.doSessionCreated(GatewayManagementBeanImpl.this, sessionId);
}
markChanged(); // mark ourselves as changed, possibly tell listeners
} catch (Exception ex) {
logger.warn("Error during sessionCreated gateway listener notifications:", ex);
}
}
});
} } | public class class_name {
@Override
public void doSessionCreatedListeners(final long sessionId, final ManagementSessionType managementSessionType) {
runManagementTask(new Runnable() {
@Override
public void run() {
try {
// The particular management listeners change on strategy, so get them here.
for (final GatewayManagementListener listener : getManagementListeners()) {
listener.doSessionCreated(GatewayManagementBeanImpl.this, sessionId); // depends on control dependency: [for], data = [listener]
}
markChanged(); // mark ourselves as changed, possibly tell listeners // depends on control dependency: [try], data = [none]
} catch (Exception ex) {
logger.warn("Error during sessionCreated gateway listener notifications:", ex);
} // depends on control dependency: [catch], data = [none]
}
});
} } |
public class class_name {
public String setNodeAvailableForSessionId(final String sessionId, final boolean available) {
if ( _nodeIdService != null && isEncodeNodeIdInSessionId() ) {
final String nodeId = _sessionIdFormat.extractMemcachedId(sessionId);
if ( nodeId != null ) {
_nodeIdService.setNodeAvailable(nodeId, available);
return nodeId;
}
else {
LOG.warn("Got sessionId without nodeId: " + sessionId);
}
}
return null;
} } | public class class_name {
public String setNodeAvailableForSessionId(final String sessionId, final boolean available) {
if ( _nodeIdService != null && isEncodeNodeIdInSessionId() ) {
final String nodeId = _sessionIdFormat.extractMemcachedId(sessionId);
if ( nodeId != null ) {
_nodeIdService.setNodeAvailable(nodeId, available); // depends on control dependency: [if], data = [none]
return nodeId; // depends on control dependency: [if], data = [none]
}
else {
LOG.warn("Got sessionId without nodeId: " + sessionId); // depends on control dependency: [if], data = [none]
}
}
return null;
} } |
public class class_name {
protected void updateLastScanFile() {
final String methodName = "updateLastScanFile()";
final File f = new File(lastScanFileName);
final CacheOnDisk cod = this;
traceDebug(methodName, "cacheName=" + this.cacheName);
AccessController.doPrivileged(new PrivilegedAction() {
@Override
public Object run() {
FileOutputStream fos = null;
ObjectOutputStream oos = null;
try {
fos = new FileOutputStream(f);
oos = new ObjectOutputStream(fos);
oos.writeLong(System.currentTimeMillis());
} catch (Throwable t) {
com.ibm.ws.ffdc.FFDCFilter.processException(t, "com.ibm.ws.cache.CacheOnDisk.updateLastScanFile", "650", cod);
traceDebug(methodName, "cacheName=" + cod.cacheName + "\nException: " + ExceptionUtility.getStackTrace(t));
} finally {
try {
if (oos != null) {
oos.close();
}
if (fos != null) {
fos.close();
}
} catch (Throwable t) {
com.ibm.ws.ffdc.FFDCFilter.processException(t, "com.ibm.ws.cache.CacheOnDisk.updateLastScanFile", "661", cod);
traceDebug(methodName, "cacheName=" + cod.cacheName + "\nException: " + ExceptionUtility.getStackTrace(t));
}
}
return null;
}
});
} } | public class class_name {
protected void updateLastScanFile() {
final String methodName = "updateLastScanFile()";
final File f = new File(lastScanFileName);
final CacheOnDisk cod = this;
traceDebug(methodName, "cacheName=" + this.cacheName);
AccessController.doPrivileged(new PrivilegedAction() {
@Override
public Object run() {
FileOutputStream fos = null;
ObjectOutputStream oos = null;
try {
fos = new FileOutputStream(f); // depends on control dependency: [try], data = [none]
oos = new ObjectOutputStream(fos); // depends on control dependency: [try], data = [none]
oos.writeLong(System.currentTimeMillis()); // depends on control dependency: [try], data = [none]
} catch (Throwable t) {
com.ibm.ws.ffdc.FFDCFilter.processException(t, "com.ibm.ws.cache.CacheOnDisk.updateLastScanFile", "650", cod);
traceDebug(methodName, "cacheName=" + cod.cacheName + "\nException: " + ExceptionUtility.getStackTrace(t));
} finally { // depends on control dependency: [catch], data = [none]
try {
if (oos != null) {
oos.close(); // depends on control dependency: [if], data = [none]
}
if (fos != null) {
fos.close(); // depends on control dependency: [if], data = [none]
}
} catch (Throwable t) {
com.ibm.ws.ffdc.FFDCFilter.processException(t, "com.ibm.ws.cache.CacheOnDisk.updateLastScanFile", "661", cod);
traceDebug(methodName, "cacheName=" + cod.cacheName + "\nException: " + ExceptionUtility.getStackTrace(t));
} // depends on control dependency: [catch], data = [none]
}
return null;
}
});
} } |
public class class_name {
@Override
public EClass getIfcGroup() {
if (ifcGroupEClass == null) {
ifcGroupEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI).getEClassifiers()
.get(310);
}
return ifcGroupEClass;
} } | public class class_name {
@Override
public EClass getIfcGroup() {
if (ifcGroupEClass == null) {
ifcGroupEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI).getEClassifiers()
.get(310);
// depends on control dependency: [if], data = [none]
}
return ifcGroupEClass;
} } |
public class class_name {
public java.util.List<InventoryResultEntity> getEntities() {
if (entities == null) {
entities = new com.amazonaws.internal.SdkInternalList<InventoryResultEntity>();
}
return entities;
} } | public class class_name {
public java.util.List<InventoryResultEntity> getEntities() {
if (entities == null) {
entities = new com.amazonaws.internal.SdkInternalList<InventoryResultEntity>(); // depends on control dependency: [if], data = [none]
}
return entities;
} } |
public class class_name {
public static boolean isPointOnShape(LatLng point,
GoogleMapShape shape, boolean geodesic, double tolerance) {
boolean onShape = false;
switch (shape.getShapeType()) {
case LAT_LNG:
onShape = isPointNearPoint(point, (LatLng) shape.getShape(), tolerance);
break;
case MARKER_OPTIONS:
onShape = isPointNearMarker(point, (MarkerOptions) shape.getShape(), tolerance);
break;
case POLYLINE_OPTIONS:
onShape = isPointOnPolyline(point, (PolylineOptions) shape.getShape(), geodesic, tolerance);
break;
case POLYGON_OPTIONS:
onShape = isPointOnPolygon(point, (PolygonOptions) shape.getShape(), geodesic, tolerance);
break;
case MULTI_LAT_LNG:
onShape = isPointNearMultiLatLng(point, (MultiLatLng) shape.getShape(), tolerance);
break;
case MULTI_POLYLINE_OPTIONS:
onShape = isPointOnMultiPolyline(point, (MultiPolylineOptions) shape.getShape(), geodesic, tolerance);
break;
case MULTI_POLYGON_OPTIONS:
onShape = isPointOnMultiPolygon(point, (MultiPolygonOptions) shape.getShape(), geodesic, tolerance);
break;
case COLLECTION:
@SuppressWarnings("unchecked")
List<GoogleMapShape> shapeList = (List<GoogleMapShape>) shape
.getShape();
for (GoogleMapShape shapeListItem : shapeList) {
onShape = isPointOnShape(point, shapeListItem, geodesic, tolerance);
if (onShape) {
break;
}
}
break;
default:
throw new GeoPackageException("Unsupported Shape Type: "
+ shape.getShapeType());
}
return onShape;
} } | public class class_name {
public static boolean isPointOnShape(LatLng point,
GoogleMapShape shape, boolean geodesic, double tolerance) {
boolean onShape = false;
switch (shape.getShapeType()) {
case LAT_LNG:
onShape = isPointNearPoint(point, (LatLng) shape.getShape(), tolerance);
break;
case MARKER_OPTIONS:
onShape = isPointNearMarker(point, (MarkerOptions) shape.getShape(), tolerance);
break;
case POLYLINE_OPTIONS:
onShape = isPointOnPolyline(point, (PolylineOptions) shape.getShape(), geodesic, tolerance);
break;
case POLYGON_OPTIONS:
onShape = isPointOnPolygon(point, (PolygonOptions) shape.getShape(), geodesic, tolerance);
break;
case MULTI_LAT_LNG:
onShape = isPointNearMultiLatLng(point, (MultiLatLng) shape.getShape(), tolerance);
break;
case MULTI_POLYLINE_OPTIONS:
onShape = isPointOnMultiPolyline(point, (MultiPolylineOptions) shape.getShape(), geodesic, tolerance);
break;
case MULTI_POLYGON_OPTIONS:
onShape = isPointOnMultiPolygon(point, (MultiPolygonOptions) shape.getShape(), geodesic, tolerance);
break;
case COLLECTION:
@SuppressWarnings("unchecked")
List<GoogleMapShape> shapeList = (List<GoogleMapShape>) shape
.getShape();
for (GoogleMapShape shapeListItem : shapeList) {
onShape = isPointOnShape(point, shapeListItem, geodesic, tolerance); // depends on control dependency: [for], data = [shapeListItem]
if (onShape) {
break;
}
}
break;
default:
throw new GeoPackageException("Unsupported Shape Type: "
+ shape.getShapeType());
}
return onShape;
} } |
public class class_name {
private void updateForeground(Color color) {
StyledDocument doc = (StyledDocument)getComponent().getDocument();
Style style = doc.getStyle(StyleContext.DEFAULT_STYLE);
if (style == null) {
return;
}
if (color == null) {
style.removeAttribute(StyleConstants.Foreground);
} else {
StyleConstants.setForeground(style, color);
}
} } | public class class_name {
private void updateForeground(Color color) {
StyledDocument doc = (StyledDocument)getComponent().getDocument();
Style style = doc.getStyle(StyleContext.DEFAULT_STYLE);
if (style == null) {
return;
// depends on control dependency: [if], data = [none]
}
if (color == null) {
style.removeAttribute(StyleConstants.Foreground);
// depends on control dependency: [if], data = [none]
} else {
StyleConstants.setForeground(style, color);
// depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public static Client createRESTClient(String userName, String password)
{
DefaultApacheHttpClient4Config rc = new DefaultApacheHttpClient4Config();
rc.getClasses().add(SaltProjectProvider.class);
ThreadSafeClientConnManager clientConnMgr = new ThreadSafeClientConnManager();
clientConnMgr.setDefaultMaxPerRoute(10);
rc.getProperties().put(ApacheHttpClient4Config.PROPERTY_CONNECTION_MANAGER,
clientConnMgr);
if (userName != null && password != null)
{
CredentialsProvider credentialsProvider = new BasicCredentialsProvider();
credentialsProvider.setCredentials(AuthScope.ANY,
new UsernamePasswordCredentials(userName, password));
rc.getProperties().put(
ApacheHttpClient4Config.PROPERTY_CREDENTIALS_PROVIDER,
credentialsProvider);
rc.getProperties().put(
ApacheHttpClient4Config.PROPERTY_PREEMPTIVE_BASIC_AUTHENTICATION,
true);
}
Client c = ApacheHttpClient4.create(rc);
return c;
} } | public class class_name {
public static Client createRESTClient(String userName, String password)
{
DefaultApacheHttpClient4Config rc = new DefaultApacheHttpClient4Config();
rc.getClasses().add(SaltProjectProvider.class);
ThreadSafeClientConnManager clientConnMgr = new ThreadSafeClientConnManager();
clientConnMgr.setDefaultMaxPerRoute(10);
rc.getProperties().put(ApacheHttpClient4Config.PROPERTY_CONNECTION_MANAGER,
clientConnMgr);
if (userName != null && password != null)
{
CredentialsProvider credentialsProvider = new BasicCredentialsProvider();
credentialsProvider.setCredentials(AuthScope.ANY,
new UsernamePasswordCredentials(userName, password)); // depends on control dependency: [if], data = [none]
rc.getProperties().put(
ApacheHttpClient4Config.PROPERTY_CREDENTIALS_PROVIDER,
credentialsProvider); // depends on control dependency: [if], data = [none]
rc.getProperties().put(
ApacheHttpClient4Config.PROPERTY_PREEMPTIVE_BASIC_AUTHENTICATION,
true); // depends on control dependency: [if], data = [none]
}
Client c = ApacheHttpClient4.create(rc);
return c;
} } |
public class class_name {
public void close()
{
try
{
if (w != null && readyForCommit)
{
w.commit();
copy(index, FSDirectory.open(getIndexDirectory().toPath()));
}
}
catch (Exception e)
{
log.error("Error while closing lucene indexes, Caused by: ", e);
throw new LuceneIndexingException("Error while closing lucene indexes.", e);
}
} } | public class class_name {
public void close()
{
try
{
if (w != null && readyForCommit)
{
w.commit(); // depends on control dependency: [if], data = [none]
copy(index, FSDirectory.open(getIndexDirectory().toPath())); // depends on control dependency: [if], data = [none]
}
}
catch (Exception e)
{
log.error("Error while closing lucene indexes, Caused by: ", e);
throw new LuceneIndexingException("Error while closing lucene indexes.", e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public void setTargets(Collection<IPermissionTarget> targets) {
// clear out any existing targets
targetMap.clear();
// add each target to the internal map and index it by the target key
for (IPermissionTarget target : targets) {
targetMap.put(target.getKey(), target);
}
} } | public class class_name {
public void setTargets(Collection<IPermissionTarget> targets) {
// clear out any existing targets
targetMap.clear();
// add each target to the internal map and index it by the target key
for (IPermissionTarget target : targets) {
targetMap.put(target.getKey(), target); // depends on control dependency: [for], data = [target]
}
} } |
public class class_name {
public void setRootToParentThingGroups(java.util.Collection<GroupNameAndArn> rootToParentThingGroups) {
if (rootToParentThingGroups == null) {
this.rootToParentThingGroups = null;
return;
}
this.rootToParentThingGroups = new java.util.ArrayList<GroupNameAndArn>(rootToParentThingGroups);
} } | public class class_name {
public void setRootToParentThingGroups(java.util.Collection<GroupNameAndArn> rootToParentThingGroups) {
if (rootToParentThingGroups == null) {
this.rootToParentThingGroups = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.rootToParentThingGroups = new java.util.ArrayList<GroupNameAndArn>(rootToParentThingGroups);
} } |
public class class_name {
@Override
public Object getAttribute(String name) {
if (name == null) {
logger.logp(Level.SEVERE, CLASS_NAME, "getAttribute", servlet40NLS.getString("name.is.null"));
throw new java.lang.NullPointerException(servlet40NLS.getString("name.is.null"));
}
return super.getAttribute(name);
} } | public class class_name {
@Override
public Object getAttribute(String name) {
if (name == null) {
logger.logp(Level.SEVERE, CLASS_NAME, "getAttribute", servlet40NLS.getString("name.is.null")); // depends on control dependency: [if], data = [none]
throw new java.lang.NullPointerException(servlet40NLS.getString("name.is.null"));
}
return super.getAttribute(name);
} } |
public class class_name {
synchronized List<TaskTrackerAction> getTasksToKill(String taskTracker) {
Set<TaskAttemptIDWithTip> taskset = trackerToTaskMap.get(taskTracker);
List<TaskTrackerAction> killList = new ArrayList<TaskTrackerAction>();
if (taskset != null) {
for (TaskAttemptIDWithTip onetask : taskset) {
TaskAttemptID killTaskId = onetask.attemptId;
TaskInProgress tip = onetask.tip;
if (tip == null) {
continue;
}
if (tip.shouldClose(killTaskId)) {
//
// This is how the JobTracker ends a task at the TaskTracker.
// It may be successfully completed, or may be killed in
// mid-execution.
//
if (!((JobInProgress)tip.getJob()).isComplete()) {
killList.add(new KillTaskAction(killTaskId));
LOG.debug(taskTracker + " -> KillTaskAction: " + killTaskId);
}
}
}
}
// add the stray attempts for uninited jobs
synchronized (trackerToTasksToCleanup) {
Set<TaskAttemptID> set = trackerToTasksToCleanup.remove(taskTracker);
if (set != null) {
for (TaskAttemptID id : set) {
killList.add(new KillTaskAction(id));
}
}
}
return killList;
} } | public class class_name {
synchronized List<TaskTrackerAction> getTasksToKill(String taskTracker) {
Set<TaskAttemptIDWithTip> taskset = trackerToTaskMap.get(taskTracker);
List<TaskTrackerAction> killList = new ArrayList<TaskTrackerAction>();
if (taskset != null) {
for (TaskAttemptIDWithTip onetask : taskset) {
TaskAttemptID killTaskId = onetask.attemptId;
TaskInProgress tip = onetask.tip;
if (tip == null) {
continue;
}
if (tip.shouldClose(killTaskId)) {
//
// This is how the JobTracker ends a task at the TaskTracker.
// It may be successfully completed, or may be killed in
// mid-execution.
//
if (!((JobInProgress)tip.getJob()).isComplete()) {
killList.add(new KillTaskAction(killTaskId)); // depends on control dependency: [if], data = [none]
LOG.debug(taskTracker + " -> KillTaskAction: " + killTaskId); // depends on control dependency: [if], data = [none]
}
}
}
}
// add the stray attempts for uninited jobs
synchronized (trackerToTasksToCleanup) {
Set<TaskAttemptID> set = trackerToTasksToCleanup.remove(taskTracker);
if (set != null) {
for (TaskAttemptID id : set) {
killList.add(new KillTaskAction(id)); // depends on control dependency: [for], data = [id]
}
}
}
return killList;
} } |
public class class_name {
public void print() {
System.out.println("========================= attrs =========================");
for(Map.Entry<String, Attribute> entry : this.attributes.entrySet()) {
Attribute attr = entry.getValue();
System.out.println(entry.getKey() + ": " + attr.getName() + ": " + entry.getValue());
}
} } | public class class_name {
public void print() {
System.out.println("========================= attrs =========================");
for(Map.Entry<String, Attribute> entry : this.attributes.entrySet()) {
Attribute attr = entry.getValue();
System.out.println(entry.getKey() + ": " + attr.getName() + ": " + entry.getValue()); // depends on control dependency: [for], data = [entry]
}
} } |
public class class_name {
public static void killProcess(String pid) {
synchronized (lock) {
LOG.info("Begin to kill process " + pid);
WorkerShutdown shutdownHandle = getProcessHandle(pid);
if (shutdownHandle != null) {
shutdownHandle.shutdown();
}
processMap.remove(pid);
LOG.info("Successfully killed process " + pid);
}
} } | public class class_name {
public static void killProcess(String pid) {
synchronized (lock) {
LOG.info("Begin to kill process " + pid);
WorkerShutdown shutdownHandle = getProcessHandle(pid);
if (shutdownHandle != null) {
shutdownHandle.shutdown(); // depends on control dependency: [if], data = [none]
}
processMap.remove(pid);
LOG.info("Successfully killed process " + pid);
}
} } |
public class class_name {
private void locatePerson(final Map<String, Set<PersonRenderer>> aMap,
final Person person) {
final PersonRenderer renderer = new PersonRenderer(person,
getRendererFactory(), getRenderingContext());
for (final String place : getPlaces(person)) {
placePerson(aMap, renderer, place);
}
} } | public class class_name {
private void locatePerson(final Map<String, Set<PersonRenderer>> aMap,
final Person person) {
final PersonRenderer renderer = new PersonRenderer(person,
getRendererFactory(), getRenderingContext());
for (final String place : getPlaces(person)) {
placePerson(aMap, renderer, place); // depends on control dependency: [for], data = [place]
}
} } |
public class class_name {
public VariableElement getLocalVariable(int index)
{
int idx = 0;
for (VariableElement lv : localVariables)
{
if (idx == index)
{
return lv;
}
if (Typ.isCategory2(lv.asType()))
{
idx += 2;
}
else
{
idx++;
}
}
throw new IllegalArgumentException("local variable at index "+index+" not found");
} } | public class class_name {
public VariableElement getLocalVariable(int index)
{
int idx = 0;
for (VariableElement lv : localVariables)
{
if (idx == index)
{
return lv;
// depends on control dependency: [if], data = [none]
}
if (Typ.isCategory2(lv.asType()))
{
idx += 2;
// depends on control dependency: [if], data = [none]
}
else
{
idx++;
// depends on control dependency: [if], data = [none]
}
}
throw new IllegalArgumentException("local variable at index "+index+" not found");
} } |
public class class_name {
public Object parse(String value, Class type)
{
if (StringUtil.isBlank(value))
{
return null;
}
return doConvert(value.trim(), type);
} } | public class class_name {
public Object parse(String value, Class type)
{
if (StringUtil.isBlank(value))
{
return null; // depends on control dependency: [if], data = [none]
}
return doConvert(value.trim(), type);
} } |
public class class_name {
private Object getConnection() {
Object connection ;
if (type == RedisToolsConstant.SINGLE){
RedisConnection redisConnection = jedisConnectionFactory.getConnection();
connection = redisConnection.getNativeConnection();
}else {
RedisClusterConnection clusterConnection = jedisConnectionFactory.getClusterConnection();
connection = clusterConnection.getNativeConnection() ;
}
return connection;
} } | public class class_name {
private Object getConnection() {
Object connection ;
if (type == RedisToolsConstant.SINGLE){
RedisConnection redisConnection = jedisConnectionFactory.getConnection();
connection = redisConnection.getNativeConnection(); // depends on control dependency: [if], data = [none]
}else {
RedisClusterConnection clusterConnection = jedisConnectionFactory.getClusterConnection();
connection = clusterConnection.getNativeConnection() ; // depends on control dependency: [if], data = [none]
}
return connection;
} } |
public class class_name {
private void serializeKeyAsColumn(String fieldName, byte[] family,
String prefix, Object fieldValue, Put put) {
// keyAsColumn mapping, so extract each value from the keyAsColumn field
// using the entityComposer, serialize them, and them to the put.
Map<CharSequence, Object> keyAsColumnValues = entityComposer
.extractKeyAsColumnValues(fieldName, fieldValue);
for (Entry<CharSequence, Object> entry : keyAsColumnValues.entrySet()) {
CharSequence qualifier = entry.getKey();
byte[] qualifierBytes;
byte[] columnKeyBytes = serializeKeyAsColumnKeyToBytes(fieldName,
qualifier);
if (prefix != null) {
byte[] prefixBytes = prefix.getBytes();
qualifierBytes = new byte[prefixBytes.length + columnKeyBytes.length];
System.arraycopy(prefixBytes, 0, qualifierBytes, 0, prefixBytes.length);
System.arraycopy(columnKeyBytes, 0, qualifierBytes, prefixBytes.length,
columnKeyBytes.length);
} else {
qualifierBytes = columnKeyBytes;
}
// serialize the value, and add it to the put.
byte[] bytes = serializeKeyAsColumnValueToBytes(fieldName, qualifier,
entry.getValue());
put.add(family, qualifierBytes, bytes);
}
} } | public class class_name {
private void serializeKeyAsColumn(String fieldName, byte[] family,
String prefix, Object fieldValue, Put put) {
// keyAsColumn mapping, so extract each value from the keyAsColumn field
// using the entityComposer, serialize them, and them to the put.
Map<CharSequence, Object> keyAsColumnValues = entityComposer
.extractKeyAsColumnValues(fieldName, fieldValue);
for (Entry<CharSequence, Object> entry : keyAsColumnValues.entrySet()) {
CharSequence qualifier = entry.getKey();
byte[] qualifierBytes;
byte[] columnKeyBytes = serializeKeyAsColumnKeyToBytes(fieldName,
qualifier);
if (prefix != null) {
byte[] prefixBytes = prefix.getBytes();
qualifierBytes = new byte[prefixBytes.length + columnKeyBytes.length]; // depends on control dependency: [if], data = [none]
System.arraycopy(prefixBytes, 0, qualifierBytes, 0, prefixBytes.length); // depends on control dependency: [if], data = [(prefix]
System.arraycopy(columnKeyBytes, 0, qualifierBytes, prefixBytes.length,
columnKeyBytes.length); // depends on control dependency: [if], data = [none]
} else {
qualifierBytes = columnKeyBytes; // depends on control dependency: [if], data = [none]
}
// serialize the value, and add it to the put.
byte[] bytes = serializeKeyAsColumnValueToBytes(fieldName, qualifier,
entry.getValue());
put.add(family, qualifierBytes, bytes); // depends on control dependency: [for], data = [none]
}
} } |
public class class_name {
public char[] toArray(final char[] array) {
final char[] a = array.length >= length() ?
array : new char[length()];
for (int i = length(); --i >= 0;) {
a[i] = charAt(i);
}
return a;
} } | public class class_name {
public char[] toArray(final char[] array) {
final char[] a = array.length >= length() ?
array : new char[length()];
for (int i = length(); --i >= 0;) {
a[i] = charAt(i); // depends on control dependency: [for], data = [i]
}
return a;
} } |
public class class_name {
private static Boolean checkMethod(NetworkInterface iface, Method toCheck) {
if (toCheck != null) {
try {
return (Boolean) toCheck.invoke(iface, (Object[]) null);
} catch (IllegalAccessException e) {
return false;
} catch (InvocationTargetException e) {
return false;
}
}
// Cannot check, hence we assume that is true
return true;
} } | public class class_name {
private static Boolean checkMethod(NetworkInterface iface, Method toCheck) {
if (toCheck != null) {
try {
return (Boolean) toCheck.invoke(iface, (Object[]) null); // depends on control dependency: [try], data = [none]
} catch (IllegalAccessException e) {
return false;
} catch (InvocationTargetException e) { // depends on control dependency: [catch], data = [none]
return false;
} // depends on control dependency: [catch], data = [none]
}
// Cannot check, hence we assume that is true
return true;
} } |
public class class_name {
public void disableSettingsCursor() {
if (menuCursor != null) {
if (menuCursor.getIoDevice() == null)
{
menuCursor.transferIoDevice(settingsCursor);
}
IoDevice device = menuCursor.getIoDevice();
device.setFarDepth(settingsIoDeviceFarDepth);
device.setNearDepth(settingsIoDeviceNearDepth);
menuCursor = null;
}
} } | public class class_name {
public void disableSettingsCursor() {
if (menuCursor != null) {
if (menuCursor.getIoDevice() == null)
{
menuCursor.transferIoDevice(settingsCursor); // depends on control dependency: [if], data = [none]
}
IoDevice device = menuCursor.getIoDevice();
device.setFarDepth(settingsIoDeviceFarDepth); // depends on control dependency: [if], data = [none]
device.setNearDepth(settingsIoDeviceNearDepth); // depends on control dependency: [if], data = [none]
menuCursor = null; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public OutputStream getXpathResource(final String resourceName, final String xpath, final boolean nodeid,
final Long revision, final OutputStream output, final boolean wrapResult) throws IOException,
TTException {
// work around because of query root char '/'
String qQuery = xpath;
if (xpath.charAt(0) == '/')
qQuery = ".".concat(xpath);
if (mDatabase.existsResource(resourceName)) {
if (wrapResult) {
output.write(beginResult.getBytes());
doXPathRes(resourceName, revision, output, nodeid, qQuery);
output.write(endResult.getBytes());
} else {
doXPathRes(resourceName, revision, output, nodeid, qQuery);
}
} else {
throw new WebApplicationException(Response.Status.NOT_FOUND);
}
return output;
} } | public class class_name {
public OutputStream getXpathResource(final String resourceName, final String xpath, final boolean nodeid,
final Long revision, final OutputStream output, final boolean wrapResult) throws IOException,
TTException {
// work around because of query root char '/'
String qQuery = xpath;
if (xpath.charAt(0) == '/')
qQuery = ".".concat(xpath);
if (mDatabase.existsResource(resourceName)) {
if (wrapResult) {
output.write(beginResult.getBytes()); // depends on control dependency: [if], data = [none]
doXPathRes(resourceName, revision, output, nodeid, qQuery); // depends on control dependency: [if], data = [none]
output.write(endResult.getBytes()); // depends on control dependency: [if], data = [none]
} else {
doXPathRes(resourceName, revision, output, nodeid, qQuery); // depends on control dependency: [if], data = [none]
}
} else {
throw new WebApplicationException(Response.Status.NOT_FOUND);
}
return output;
} } |
public class class_name {
protected byte[] getClipData (SoundKey key)
throws IOException, UnsupportedAudioFileException
{
byte[][] data;
synchronized (_clipCache) {
// if we're testing, clear all non-locked sounds every time
if (isTesting()) {
_clipCache.clear();
}
data = _clipCache.get(key);
// see if it's in the locked cache (we first look in the regular
// clip cache so that locked clips that are still cached continue
// to be moved to the head of the LRU queue)
if (data == null) {
data = _lockedClips.get(key);
}
if (data == null) {
// if there is a test sound, JUST use the test sound.
InputStream stream = getTestClip(key);
if (stream != null) {
data = new byte[1][];
data[0] = StreamUtil.toByteArray(stream);
} else {
data = _loader.load(key.pkgPath, key.key);
}
_clipCache.put(key, data);
}
}
return (data.length > 0) ? data[RandomUtil.getInt(data.length)] : null;
} } | public class class_name {
protected byte[] getClipData (SoundKey key)
throws IOException, UnsupportedAudioFileException
{
byte[][] data;
synchronized (_clipCache) {
// if we're testing, clear all non-locked sounds every time
if (isTesting()) {
_clipCache.clear(); // depends on control dependency: [if], data = [none]
}
data = _clipCache.get(key);
// see if it's in the locked cache (we first look in the regular
// clip cache so that locked clips that are still cached continue
// to be moved to the head of the LRU queue)
if (data == null) {
data = _lockedClips.get(key); // depends on control dependency: [if], data = [none]
}
if (data == null) {
// if there is a test sound, JUST use the test sound.
InputStream stream = getTestClip(key);
if (stream != null) {
data = new byte[1][]; // depends on control dependency: [if], data = [none]
data[0] = StreamUtil.toByteArray(stream); // depends on control dependency: [if], data = [(stream]
} else {
data = _loader.load(key.pkgPath, key.key); // depends on control dependency: [if], data = [none]
}
_clipCache.put(key, data); // depends on control dependency: [if], data = [none]
}
}
return (data.length > 0) ? data[RandomUtil.getInt(data.length)] : null;
} } |
public class class_name {
Type attribArg(JCTree tree, Env<AttrContext> env) {
Env<AttrContext> prevEnv = this.env;
try {
this.env = env;
tree.accept(this);
return result;
} finally {
this.env = prevEnv;
}
} } | public class class_name {
Type attribArg(JCTree tree, Env<AttrContext> env) {
Env<AttrContext> prevEnv = this.env;
try {
this.env = env; // depends on control dependency: [try], data = [none]
tree.accept(this); // depends on control dependency: [try], data = [none]
return result; // depends on control dependency: [try], data = [none]
} finally {
this.env = prevEnv;
}
} } |
public class class_name {
public void setSshPublicKeys(java.util.Collection<SshPublicKey> sshPublicKeys) {
if (sshPublicKeys == null) {
this.sshPublicKeys = null;
return;
}
this.sshPublicKeys = new java.util.ArrayList<SshPublicKey>(sshPublicKeys);
} } | public class class_name {
public void setSshPublicKeys(java.util.Collection<SshPublicKey> sshPublicKeys) {
if (sshPublicKeys == null) {
this.sshPublicKeys = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.sshPublicKeys = new java.util.ArrayList<SshPublicKey>(sshPublicKeys);
} } |
public class class_name {
private void openFiles() throws FileNotFoundException {
// Populate the mFiles array
final File base = new File(mLocation);
mFiles.add(new RandomAccessFile(base, "r"));
mFileNames.add(base.getPath());
int i = 0;
for(;;) {
i = i + 1;
final File nextFile = new File(mLocation + "-" + i);
if (nextFile.exists()) {
mFiles.add(new RandomAccessFile(nextFile, "r"));
mFileNames.add(nextFile.getPath());
} else {
break;
}
}
} } | public class class_name {
private void openFiles() throws FileNotFoundException {
// Populate the mFiles array
final File base = new File(mLocation);
mFiles.add(new RandomAccessFile(base, "r"));
mFileNames.add(base.getPath());
int i = 0;
for(;;) {
i = i + 1;
final File nextFile = new File(mLocation + "-" + i);
if (nextFile.exists()) {
mFiles.add(new RandomAccessFile(nextFile, "r")); // depends on control dependency: [if], data = [none]
mFileNames.add(nextFile.getPath()); // depends on control dependency: [if], data = [none]
} else {
break;
}
}
} } |
public class class_name {
public Permutation multiply(Permutation other) {
Permutation newPermutation = new Permutation(values.length);
for (int i = 0; i < values.length; i++) {
newPermutation.values[i] = this.values[other.values[i]];
}
return newPermutation;
} } | public class class_name {
public Permutation multiply(Permutation other) {
Permutation newPermutation = new Permutation(values.length);
for (int i = 0; i < values.length; i++) {
newPermutation.values[i] = this.values[other.values[i]]; // depends on control dependency: [for], data = [i]
}
return newPermutation;
} } |
public class class_name {
private Credential newCredential(String userId) {
Credential.Builder builder = new Credential.Builder(getMethod())
.setTransport(getTransport())
.setJsonFactory(getJsonFactory())
.setTokenServerEncodedUrl(getTokenServerEncodedUrl())
.setClientAuthentication(getClientAuthentication())
.setRequestInitializer(getRequestInitializer())
.setClock(getClock());
if (getCredentialStore() != null) {
builder.addRefreshListener(
new CredentialStoreRefreshListener(userId, getCredentialStore()));
}
builder.getRefreshListeners().addAll(getRefreshListeners());
return builder.build();
} } | public class class_name {
private Credential newCredential(String userId) {
Credential.Builder builder = new Credential.Builder(getMethod())
.setTransport(getTransport())
.setJsonFactory(getJsonFactory())
.setTokenServerEncodedUrl(getTokenServerEncodedUrl())
.setClientAuthentication(getClientAuthentication())
.setRequestInitializer(getRequestInitializer())
.setClock(getClock());
if (getCredentialStore() != null) {
builder.addRefreshListener(
new CredentialStoreRefreshListener(userId, getCredentialStore())); // depends on control dependency: [if], data = [none]
}
builder.getRefreshListeners().addAll(getRefreshListeners());
return builder.build();
} } |
public class class_name {
public static synchronized boolean removeDenyIP(String ip) {
if(deniedIP!=null && deniedIP.remove(ip)!=null) {
writeIP();
if(deniedIP.isEmpty()) {
deniedIP=null;
}
return true;
}
return false;
} } | public class class_name {
public static synchronized boolean removeDenyIP(String ip) {
if(deniedIP!=null && deniedIP.remove(ip)!=null) {
writeIP(); // depends on control dependency: [if], data = [none]
if(deniedIP.isEmpty()) {
deniedIP=null; // depends on control dependency: [if], data = [none]
}
return true; // depends on control dependency: [if], data = [none]
}
return false;
} } |
public class class_name {
public static BigComplex valueOfPolar(BigDecimal radius, BigDecimal angle, MathContext mathContext) {
if (radius.signum() == 0) {
return ZERO;
}
return valueOf(
radius.multiply(BigDecimalMath.cos(angle, mathContext), mathContext),
radius.multiply(BigDecimalMath.sin(angle, mathContext), mathContext));
} } | public class class_name {
public static BigComplex valueOfPolar(BigDecimal radius, BigDecimal angle, MathContext mathContext) {
if (radius.signum() == 0) {
return ZERO; // depends on control dependency: [if], data = [none]
}
return valueOf(
radius.multiply(BigDecimalMath.cos(angle, mathContext), mathContext),
radius.multiply(BigDecimalMath.sin(angle, mathContext), mathContext));
} } |
public class class_name {
public static StackTraceElement[][] getStackTraceChain(Throwable t, final String[] allow, final String[] deny) {
ArrayList<StackTraceElement[]> result = new ArrayList<>();
while (t != null) {
StackTraceElement[] stack = getStackTrace(t, allow, deny);
result.add(stack);
t = t.getCause();
}
StackTraceElement[][] allStacks = new StackTraceElement[result.size()][];
for (int i = 0; i < allStacks.length; i++) {
allStacks[i] = result.get(i);
}
return allStacks;
} } | public class class_name {
public static StackTraceElement[][] getStackTraceChain(Throwable t, final String[] allow, final String[] deny) {
ArrayList<StackTraceElement[]> result = new ArrayList<>();
while (t != null) {
StackTraceElement[] stack = getStackTrace(t, allow, deny);
result.add(stack); // depends on control dependency: [while], data = [none]
t = t.getCause(); // depends on control dependency: [while], data = [none]
}
StackTraceElement[][] allStacks = new StackTraceElement[result.size()][];
for (int i = 0; i < allStacks.length; i++) {
allStacks[i] = result.get(i); // depends on control dependency: [for], data = [i]
}
return allStacks;
} } |
public class class_name {
protected void generateIndexFile() throws DocFileIOException {
String title = configuration.getText("doclet.Window_Single_Index");
HtmlTree body = getBody(true, getWindowTitle(title));
HtmlTree htmlTree = (configuration.allowTag(HtmlTag.HEADER))
? HtmlTree.HEADER()
: body;
addTop(htmlTree);
addNavLinks(true, htmlTree);
if (configuration.allowTag(HtmlTag.HEADER)) {
body.addContent(htmlTree);
}
HtmlTree divTree = new HtmlTree(HtmlTag.DIV);
divTree.addStyle(HtmlStyle.contentContainer);
elements = new TreeSet<>(indexbuilder.getIndexMap().keySet());
elements.addAll(configuration.tagSearchIndexKeys);
addLinksForIndexes(divTree);
for (Character unicode : elements) {
if (configuration.tagSearchIndexMap.get(unicode) == null) {
addContents(unicode, indexbuilder.getMemberList(unicode), divTree);
} else if (indexbuilder.getMemberList(unicode) == null) {
addSearchContents(unicode, configuration.tagSearchIndexMap.get(unicode), divTree);
} else {
addContents(unicode, indexbuilder.getMemberList(unicode),
configuration.tagSearchIndexMap.get(unicode), divTree);
}
}
addLinksForIndexes(divTree);
body.addContent((configuration.allowTag(HtmlTag.MAIN))
? HtmlTree.MAIN(divTree)
: divTree);
if (configuration.allowTag(HtmlTag.FOOTER)) {
htmlTree = HtmlTree.FOOTER();
}
addNavLinks(false, htmlTree);
addBottom(htmlTree);
if (configuration.allowTag(HtmlTag.FOOTER)) {
body.addContent(htmlTree);
}
createSearchIndexFiles();
printHtmlDocument(null, true, body);
} } | public class class_name {
protected void generateIndexFile() throws DocFileIOException {
String title = configuration.getText("doclet.Window_Single_Index");
HtmlTree body = getBody(true, getWindowTitle(title));
HtmlTree htmlTree = (configuration.allowTag(HtmlTag.HEADER))
? HtmlTree.HEADER()
: body;
addTop(htmlTree);
addNavLinks(true, htmlTree);
if (configuration.allowTag(HtmlTag.HEADER)) {
body.addContent(htmlTree);
}
HtmlTree divTree = new HtmlTree(HtmlTag.DIV);
divTree.addStyle(HtmlStyle.contentContainer);
elements = new TreeSet<>(indexbuilder.getIndexMap().keySet());
elements.addAll(configuration.tagSearchIndexKeys);
addLinksForIndexes(divTree);
for (Character unicode : elements) {
if (configuration.tagSearchIndexMap.get(unicode) == null) {
addContents(unicode, indexbuilder.getMemberList(unicode), divTree); // depends on control dependency: [if], data = [none]
} else if (indexbuilder.getMemberList(unicode) == null) {
addSearchContents(unicode, configuration.tagSearchIndexMap.get(unicode), divTree); // depends on control dependency: [if], data = [none]
} else {
addContents(unicode, indexbuilder.getMemberList(unicode),
configuration.tagSearchIndexMap.get(unicode), divTree); // depends on control dependency: [if], data = [none]
}
}
addLinksForIndexes(divTree);
body.addContent((configuration.allowTag(HtmlTag.MAIN))
? HtmlTree.MAIN(divTree)
: divTree);
if (configuration.allowTag(HtmlTag.FOOTER)) {
htmlTree = HtmlTree.FOOTER();
}
addNavLinks(false, htmlTree);
addBottom(htmlTree);
if (configuration.allowTag(HtmlTag.FOOTER)) {
body.addContent(htmlTree);
}
createSearchIndexFiles();
printHtmlDocument(null, true, body);
} } |
public class class_name {
@NonNull
@Override
public List<Object> toList() {
final List<Object> array = new ArrayList<>();
for (int i = 0; i < count(); i++) {
array.add(values.get(i).asObject());
}
return array;
} } | public class class_name {
@NonNull
@Override
public List<Object> toList() {
final List<Object> array = new ArrayList<>();
for (int i = 0; i < count(); i++) {
array.add(values.get(i).asObject()); // depends on control dependency: [for], data = [i]
}
return array;
} } |
public class class_name {
public static void rollbackTransaction() {
Connection connection = tl_conn.get();
if (connection == null) {
throw new RuntimeException("You do not start a Transaction so you can not rollback a transaction!");
}
try {
connection.rollback();
connection.close();
tl_conn.remove();
tl_sp.remove();
} catch (SQLException e) {
throw new RuntimeException(e);
}
} } | public class class_name {
public static void rollbackTransaction() {
Connection connection = tl_conn.get();
if (connection == null) {
throw new RuntimeException("You do not start a Transaction so you can not rollback a transaction!");
}
try {
connection.rollback(); // depends on control dependency: [try], data = [none]
connection.close(); // depends on control dependency: [try], data = [none]
tl_conn.remove(); // depends on control dependency: [try], data = [none]
tl_sp.remove(); // depends on control dependency: [try], data = [none]
} catch (SQLException e) {
throw new RuntimeException(e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
private List<ClassDocImpl> getClasses(boolean filtered) {
if (allClasses != null && !filtered) {
return allClasses;
}
if (allClassesFiltered != null && filtered) {
return allClassesFiltered;
}
ListBuffer<ClassDocImpl> classes = new ListBuffer<ClassDocImpl>();
for (Scope.Entry e = sym.members().elems; e != null; e = e.sibling) {
if (e.sym != null) {
ClassSymbol s = (ClassSymbol)e.sym;
ClassDocImpl c = env.getClassDoc(s);
if (c != null && !c.isSynthetic())
c.addAllClasses(classes, filtered);
}
}
if (filtered)
return allClassesFiltered = classes.toList();
else
return allClasses = classes.toList();
} } | public class class_name {
private List<ClassDocImpl> getClasses(boolean filtered) {
if (allClasses != null && !filtered) {
return allClasses; // depends on control dependency: [if], data = [none]
}
if (allClassesFiltered != null && filtered) {
return allClassesFiltered; // depends on control dependency: [if], data = [none]
}
ListBuffer<ClassDocImpl> classes = new ListBuffer<ClassDocImpl>();
for (Scope.Entry e = sym.members().elems; e != null; e = e.sibling) {
if (e.sym != null) {
ClassSymbol s = (ClassSymbol)e.sym;
ClassDocImpl c = env.getClassDoc(s);
if (c != null && !c.isSynthetic())
c.addAllClasses(classes, filtered);
}
}
if (filtered)
return allClassesFiltered = classes.toList();
else
return allClasses = classes.toList();
} } |
public class class_name {
public CmsModelPageConfig getDefaultModelPage() {
List<CmsModelPageConfig> modelPages = getModelPages();
for (CmsModelPageConfig modelPageConfig : getModelPages()) {
if (modelPageConfig.isDefault()) {
return modelPageConfig;
}
}
if (modelPages.isEmpty()) {
return null;
}
return modelPages.get(0);
} } | public class class_name {
public CmsModelPageConfig getDefaultModelPage() {
List<CmsModelPageConfig> modelPages = getModelPages();
for (CmsModelPageConfig modelPageConfig : getModelPages()) {
if (modelPageConfig.isDefault()) {
return modelPageConfig; // depends on control dependency: [if], data = [none]
}
}
if (modelPages.isEmpty()) {
return null; // depends on control dependency: [if], data = [none]
}
return modelPages.get(0);
} } |
public class class_name {
public void marshall(LoadBalancerTlsCertificate loadBalancerTlsCertificate, ProtocolMarshaller protocolMarshaller) {
if (loadBalancerTlsCertificate == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(loadBalancerTlsCertificate.getName(), NAME_BINDING);
protocolMarshaller.marshall(loadBalancerTlsCertificate.getArn(), ARN_BINDING);
protocolMarshaller.marshall(loadBalancerTlsCertificate.getSupportCode(), SUPPORTCODE_BINDING);
protocolMarshaller.marshall(loadBalancerTlsCertificate.getCreatedAt(), CREATEDAT_BINDING);
protocolMarshaller.marshall(loadBalancerTlsCertificate.getLocation(), LOCATION_BINDING);
protocolMarshaller.marshall(loadBalancerTlsCertificate.getResourceType(), RESOURCETYPE_BINDING);
protocolMarshaller.marshall(loadBalancerTlsCertificate.getTags(), TAGS_BINDING);
protocolMarshaller.marshall(loadBalancerTlsCertificate.getLoadBalancerName(), LOADBALANCERNAME_BINDING);
protocolMarshaller.marshall(loadBalancerTlsCertificate.getIsAttached(), ISATTACHED_BINDING);
protocolMarshaller.marshall(loadBalancerTlsCertificate.getStatus(), STATUS_BINDING);
protocolMarshaller.marshall(loadBalancerTlsCertificate.getDomainName(), DOMAINNAME_BINDING);
protocolMarshaller.marshall(loadBalancerTlsCertificate.getDomainValidationRecords(), DOMAINVALIDATIONRECORDS_BINDING);
protocolMarshaller.marshall(loadBalancerTlsCertificate.getFailureReason(), FAILUREREASON_BINDING);
protocolMarshaller.marshall(loadBalancerTlsCertificate.getIssuedAt(), ISSUEDAT_BINDING);
protocolMarshaller.marshall(loadBalancerTlsCertificate.getIssuer(), ISSUER_BINDING);
protocolMarshaller.marshall(loadBalancerTlsCertificate.getKeyAlgorithm(), KEYALGORITHM_BINDING);
protocolMarshaller.marshall(loadBalancerTlsCertificate.getNotAfter(), NOTAFTER_BINDING);
protocolMarshaller.marshall(loadBalancerTlsCertificate.getNotBefore(), NOTBEFORE_BINDING);
protocolMarshaller.marshall(loadBalancerTlsCertificate.getRenewalSummary(), RENEWALSUMMARY_BINDING);
protocolMarshaller.marshall(loadBalancerTlsCertificate.getRevocationReason(), REVOCATIONREASON_BINDING);
protocolMarshaller.marshall(loadBalancerTlsCertificate.getRevokedAt(), REVOKEDAT_BINDING);
protocolMarshaller.marshall(loadBalancerTlsCertificate.getSerial(), SERIAL_BINDING);
protocolMarshaller.marshall(loadBalancerTlsCertificate.getSignatureAlgorithm(), SIGNATUREALGORITHM_BINDING);
protocolMarshaller.marshall(loadBalancerTlsCertificate.getSubject(), SUBJECT_BINDING);
protocolMarshaller.marshall(loadBalancerTlsCertificate.getSubjectAlternativeNames(), SUBJECTALTERNATIVENAMES_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(LoadBalancerTlsCertificate loadBalancerTlsCertificate, ProtocolMarshaller protocolMarshaller) {
if (loadBalancerTlsCertificate == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(loadBalancerTlsCertificate.getName(), NAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(loadBalancerTlsCertificate.getArn(), ARN_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(loadBalancerTlsCertificate.getSupportCode(), SUPPORTCODE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(loadBalancerTlsCertificate.getCreatedAt(), CREATEDAT_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(loadBalancerTlsCertificate.getLocation(), LOCATION_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(loadBalancerTlsCertificate.getResourceType(), RESOURCETYPE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(loadBalancerTlsCertificate.getTags(), TAGS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(loadBalancerTlsCertificate.getLoadBalancerName(), LOADBALANCERNAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(loadBalancerTlsCertificate.getIsAttached(), ISATTACHED_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(loadBalancerTlsCertificate.getStatus(), STATUS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(loadBalancerTlsCertificate.getDomainName(), DOMAINNAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(loadBalancerTlsCertificate.getDomainValidationRecords(), DOMAINVALIDATIONRECORDS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(loadBalancerTlsCertificate.getFailureReason(), FAILUREREASON_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(loadBalancerTlsCertificate.getIssuedAt(), ISSUEDAT_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(loadBalancerTlsCertificate.getIssuer(), ISSUER_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(loadBalancerTlsCertificate.getKeyAlgorithm(), KEYALGORITHM_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(loadBalancerTlsCertificate.getNotAfter(), NOTAFTER_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(loadBalancerTlsCertificate.getNotBefore(), NOTBEFORE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(loadBalancerTlsCertificate.getRenewalSummary(), RENEWALSUMMARY_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(loadBalancerTlsCertificate.getRevocationReason(), REVOCATIONREASON_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(loadBalancerTlsCertificate.getRevokedAt(), REVOKEDAT_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(loadBalancerTlsCertificate.getSerial(), SERIAL_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(loadBalancerTlsCertificate.getSignatureAlgorithm(), SIGNATUREALGORITHM_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(loadBalancerTlsCertificate.getSubject(), SUBJECT_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(loadBalancerTlsCertificate.getSubjectAlternativeNames(), SUBJECTALTERNATIVENAMES_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public static boolean fit(double[] data, int offset , int length , PolynomialQuadratic2D_F64 output ) {
final int N = length/3;
if( N < 6 )
throw new IllegalArgumentException("Need at least 6 points and not "+N);
// Unrolled pseudo inverse
// coef = inv(A^T*A)*A^T*y
double sx1=0, sy1=0, sx1y1=0, sx2=0, sy2=0, sx2y1=0, sx1y2=0, sx2y2=0, sx3=0, sy3=0, sx3y1=0, sx1y3=0, sx4=0, sy4=0;
double b0=0,b1=0,b2=0,b3=0,b4=0,b5=0;
int end = offset+length;
for (int i = offset; i < end; i += 3 ) {
double x = data[i];
double y = data[i+1];
double z = data[i+2];
double x2 = x*x;
double x3 = x2*x;
double x4 = x2*x2;
double y2 = y*y;
double y3 = y2*y;
double y4 = y2*y2;
sx1 += x; sx2 += x2; sx3 += x3;sx4 += x4;
sy1 += y; sy2 += y2; sy3 += y3;sy4 += y4;
sx1y1 += x*y; sx2y1 += x2*y; sx1y2 += x*y2; sx2y2 +=x2*y2;
sx3y1 += x3*y; sx1y3 += x*y3;
b0 += z;
b1 += x*z;
b2 += y*z;
b3 += x*y*z;
b4 += x2*z;
b5 += y2*z;
}
// using a fixed size matrix because the notation is much nicer
DMatrix6x6 A = new DMatrix6x6();
A.set( N ,sx1, sy1 ,sx1y1,sx2 ,sy2 ,
sx1 ,sx2, sx1y1,sx2y1,sx3 ,sx1y2,
sy1 ,sx1y1,sy2 ,sx1y2,sx2y1,sy3 ,
sx1y1,sx2y1,sx1y2,sx2y2,sx3y1,sx1y3,
sx2 ,sx3 ,sx2y1,sx3y1,sx4 ,sx2y2,
sy2 ,sx1y2,sy3 ,sx1y3,sx2y2,sy4 );
DMatrixRMaj _A = new DMatrixRMaj(6,6);
ConvertDMatrixStruct.convert(A,_A);
// pseudo inverse is required to handle degenerate matrices, e.g. lines
LinearSolverDense<DMatrixRMaj> solver = LinearSolverFactory_DDRM.pseudoInverse(true);
if( !solver.setA(_A) )
return false;
solver.invert(_A);
DMatrixRMaj B = new DMatrixRMaj(6,1,true,b0,b1,b2,b3,b4,b5);
DMatrixRMaj Y = new DMatrixRMaj(6,1);
CommonOps_DDRM.mult(_A,B,Y);
// output = inv(A)*B Unrolled here for speed
output.a = Y.data[0];
output.b = Y.data[1];
output.c = Y.data[2];
output.d = Y.data[3];
output.e = Y.data[4];
output.f = Y.data[5];
return true;
} } | public class class_name {
public static boolean fit(double[] data, int offset , int length , PolynomialQuadratic2D_F64 output ) {
final int N = length/3;
if( N < 6 )
throw new IllegalArgumentException("Need at least 6 points and not "+N);
// Unrolled pseudo inverse
// coef = inv(A^T*A)*A^T*y
double sx1=0, sy1=0, sx1y1=0, sx2=0, sy2=0, sx2y1=0, sx1y2=0, sx2y2=0, sx3=0, sy3=0, sx3y1=0, sx1y3=0, sx4=0, sy4=0;
double b0=0,b1=0,b2=0,b3=0,b4=0,b5=0;
int end = offset+length;
for (int i = offset; i < end; i += 3 ) {
double x = data[i];
double y = data[i+1];
double z = data[i+2];
double x2 = x*x;
double x3 = x2*x;
double x4 = x2*x2;
double y2 = y*y;
double y3 = y2*y;
double y4 = y2*y2;
sx1 += x; sx2 += x2; sx3 += x3;sx4 += x4; // depends on control dependency: [for], data = [none] // depends on control dependency: [for], data = [none] // depends on control dependency: [for], data = [none] // depends on control dependency: [for], data = [none]
sy1 += y; sy2 += y2; sy3 += y3;sy4 += y4; // depends on control dependency: [for], data = [none] // depends on control dependency: [for], data = [none] // depends on control dependency: [for], data = [none] // depends on control dependency: [for], data = [none]
sx1y1 += x*y; sx2y1 += x2*y; sx1y2 += x*y2; sx2y2 +=x2*y2; // depends on control dependency: [for], data = [none] // depends on control dependency: [for], data = [none] // depends on control dependency: [for], data = [none] // depends on control dependency: [for], data = [none]
sx3y1 += x3*y; sx1y3 += x*y3; // depends on control dependency: [for], data = [none] // depends on control dependency: [for], data = [none]
b0 += z; // depends on control dependency: [for], data = [none]
b1 += x*z; // depends on control dependency: [for], data = [none]
b2 += y*z; // depends on control dependency: [for], data = [none]
b3 += x*y*z; // depends on control dependency: [for], data = [none]
b4 += x2*z; // depends on control dependency: [for], data = [none]
b5 += y2*z; // depends on control dependency: [for], data = [none]
}
// using a fixed size matrix because the notation is much nicer
DMatrix6x6 A = new DMatrix6x6();
A.set( N ,sx1, sy1 ,sx1y1,sx2 ,sy2 ,
sx1 ,sx2, sx1y1,sx2y1,sx3 ,sx1y2,
sy1 ,sx1y1,sy2 ,sx1y2,sx2y1,sy3 ,
sx1y1,sx2y1,sx1y2,sx2y2,sx3y1,sx1y3,
sx2 ,sx3 ,sx2y1,sx3y1,sx4 ,sx2y2,
sy2 ,sx1y2,sy3 ,sx1y3,sx2y2,sy4 );
DMatrixRMaj _A = new DMatrixRMaj(6,6);
ConvertDMatrixStruct.convert(A,_A);
// pseudo inverse is required to handle degenerate matrices, e.g. lines
LinearSolverDense<DMatrixRMaj> solver = LinearSolverFactory_DDRM.pseudoInverse(true);
if( !solver.setA(_A) )
return false;
solver.invert(_A);
DMatrixRMaj B = new DMatrixRMaj(6,1,true,b0,b1,b2,b3,b4,b5);
DMatrixRMaj Y = new DMatrixRMaj(6,1);
CommonOps_DDRM.mult(_A,B,Y);
// output = inv(A)*B Unrolled here for speed
output.a = Y.data[0];
output.b = Y.data[1];
output.c = Y.data[2];
output.d = Y.data[3];
output.e = Y.data[4];
output.f = Y.data[5];
return true;
} } |
public class class_name {
@Override
public void addPackageDescription(Content packageContentTree) {
if (!utils.getBody(packageElement).isEmpty()) {
Content tree = configuration.allowTag(HtmlTag.SECTION) ? sectionTree : packageContentTree;
addDeprecationInfo(tree);
addInlineComment(packageElement, tree);
}
} } | public class class_name {
@Override
public void addPackageDescription(Content packageContentTree) {
if (!utils.getBody(packageElement).isEmpty()) {
Content tree = configuration.allowTag(HtmlTag.SECTION) ? sectionTree : packageContentTree;
addDeprecationInfo(tree); // depends on control dependency: [if], data = [none]
addInlineComment(packageElement, tree); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
private void addToJ2eeNameList(String j2eeName, int size, ArrayList listenerJ2eeNames) {
int start = listenerJ2eeNames.size();
int end = start + size;
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_CORE.isLoggable(Level.FINE)) {
StringBuffer sb = new StringBuffer("starting at ").append(start).append(" going to ").append(end).append(" for ").append(j2eeName);
LoggingUtil.SESSION_LOGGER_CORE.logp(Level.FINE, methodClassName, "addToJ2eeNameList", sb.toString());
}
for (int x = start; x < end; x++) {
listenerJ2eeNames.add(j2eeName);
}
} } | public class class_name {
private void addToJ2eeNameList(String j2eeName, int size, ArrayList listenerJ2eeNames) {
int start = listenerJ2eeNames.size();
int end = start + size;
if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_CORE.isLoggable(Level.FINE)) {
StringBuffer sb = new StringBuffer("starting at ").append(start).append(" going to ").append(end).append(" for ").append(j2eeName);
LoggingUtil.SESSION_LOGGER_CORE.logp(Level.FINE, methodClassName, "addToJ2eeNameList", sb.toString()); // depends on control dependency: [if], data = [none]
}
for (int x = start; x < end; x++) {
listenerJ2eeNames.add(j2eeName); // depends on control dependency: [for], data = [none]
}
} } |
public class class_name {
private EntityManager getOrCreateTransactionalEntityManager(TransactionManager transactionManager) {
try {
if (transactionManager.getStatus() == Status.STATUS_ACTIVE) {
EntityManager entityManager = this.transactionalEntityManagerHelper.getTransactionScopedEntityManager(getPersistenceUnitName());
if (entityManager == null) {
entityManager = createEntityManager(transactionManager);
this.transactionalEntityManagerHelper.putEntityManagerInTransactionRegistry(getPersistenceUnitName(), entityManager);
}
return entityManager;
}
} catch (Exception e) {
throw ROOT_LOGGER.idmJpaFailedCreateTransactionEntityManager(e);
}
return null;
} } | public class class_name {
private EntityManager getOrCreateTransactionalEntityManager(TransactionManager transactionManager) {
try {
if (transactionManager.getStatus() == Status.STATUS_ACTIVE) {
EntityManager entityManager = this.transactionalEntityManagerHelper.getTransactionScopedEntityManager(getPersistenceUnitName());
if (entityManager == null) {
entityManager = createEntityManager(transactionManager); // depends on control dependency: [if], data = [none]
this.transactionalEntityManagerHelper.putEntityManagerInTransactionRegistry(getPersistenceUnitName(), entityManager); // depends on control dependency: [if], data = [none]
}
return entityManager; // depends on control dependency: [if], data = [none]
}
} catch (Exception e) {
throw ROOT_LOGGER.idmJpaFailedCreateTransactionEntityManager(e);
} // depends on control dependency: [catch], data = [none]
return null;
} } |
public class class_name {
@NullSafe
public static double min(final double... values) {
double minValue = Double.NaN;
if (values != null) {
for (double value : values) {
minValue = (Double.isNaN(minValue) ? value : Math.min(minValue, value));
}
}
return minValue;
} } | public class class_name {
@NullSafe
public static double min(final double... values) {
double minValue = Double.NaN;
if (values != null) {
for (double value : values) {
minValue = (Double.isNaN(minValue) ? value : Math.min(minValue, value)); // depends on control dependency: [for], data = [value]
}
}
return minValue;
} } |
public class class_name {
final int getSetStateFields() {
int mask = 0;
for (int i = 0; i < fields.length; i++) {
if (stamp[i] != UNSET) {
mask |= 1 << i;
}
}
return mask;
} } | public class class_name {
final int getSetStateFields() {
int mask = 0;
for (int i = 0; i < fields.length; i++) {
if (stamp[i] != UNSET) {
mask |= 1 << i; // depends on control dependency: [if], data = [none]
}
}
return mask;
} } |
public class class_name {
public EEnum getIfcElectricGeneratorTypeEnum() {
if (ifcElectricGeneratorTypeEnumEEnum == null) {
ifcElectricGeneratorTypeEnumEEnum = (EEnum) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI)
.getEClassifiers().get(826);
}
return ifcElectricGeneratorTypeEnumEEnum;
} } | public class class_name {
public EEnum getIfcElectricGeneratorTypeEnum() {
if (ifcElectricGeneratorTypeEnumEEnum == null) {
ifcElectricGeneratorTypeEnumEEnum = (EEnum) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI)
.getEClassifiers().get(826);
// depends on control dependency: [if], data = [none]
}
return ifcElectricGeneratorTypeEnumEEnum;
} } |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.