code stringlengths 130 281k | code_dependency stringlengths 182 306k |
|---|---|
public class class_name {
@Override
public void update(Sensor source, SensorData sd) {
if (socket == null || oos == null) {
return;
}
if (sd instanceof MicrophoneData) {
MicrophoneData microphoneData = (MicrophoneData) sd;
if (socket != null && socket.isConnected() && oos != null) {
try {
int totalSize = microphoneData.getData().length;
int frameSize = microphoneData.getAudioFormat().getFrameSize();
byte[] data = new byte[totalSize];
System.arraycopy(microphoneData.getData(), 0, data, 0, totalSize);
//int i = 0, j = 0, c = 0;
for (int i = 0, j = 0, c = 0; i < newRated.length - 1 && j < data.length - 1; i += 2, j += 6/*10*/) {
newRated[i] = data[j];
newRated[i + 1] = data[j + 1];
if (c > 2) {
//j += 2;
j -= 2;
c = 0;
} else {
c++;
}
}
//new AudioFormat(8000, 16, 1, true, false);
//System.out.println(microphoneData.getAudioFormat());
for (int i = 1; i < newRated.length; i += 2) {
if (random.nextBoolean()) {
newRated[i]++;
}
}
//System.out.println(totalSize+":"+newRated.length+":"+microphoneData.getAudioFormat().getSampleRate());
AudioStreamDataPacket asdp = new AudioStreamDataPacket(newRated, newRated.length / frameSize, frameSize);
oos.writeObject(asdp);
oos.flush();
oos.reset();
} catch (IOException e1) {
Logger.getLogger(getClass().getSimpleName()).log(Level.SEVERE, null, e1);
socket = null;
oos = null;
return;
}
}
}
} } | public class class_name {
@Override
public void update(Sensor source, SensorData sd) {
if (socket == null || oos == null) {
return; // depends on control dependency: [if], data = [none]
}
if (sd instanceof MicrophoneData) {
MicrophoneData microphoneData = (MicrophoneData) sd;
if (socket != null && socket.isConnected() && oos != null) {
try {
int totalSize = microphoneData.getData().length;
int frameSize = microphoneData.getAudioFormat().getFrameSize();
byte[] data = new byte[totalSize];
System.arraycopy(microphoneData.getData(), 0, data, 0, totalSize); // depends on control dependency: [try], data = [none]
//int i = 0, j = 0, c = 0;
for (int i = 0, j = 0, c = 0; i < newRated.length - 1 && j < data.length - 1; i += 2, j += 6/*10*/) {
newRated[i] = data[j]; // depends on control dependency: [for], data = [i]
newRated[i + 1] = data[j + 1]; // depends on control dependency: [for], data = [i]
if (c > 2) {
//j += 2;
j -= 2; // depends on control dependency: [if], data = [none]
c = 0; // depends on control dependency: [if], data = [none]
} else {
c++; // depends on control dependency: [if], data = [none]
}
}
//new AudioFormat(8000, 16, 1, true, false);
//System.out.println(microphoneData.getAudioFormat());
for (int i = 1; i < newRated.length; i += 2) {
if (random.nextBoolean()) {
newRated[i]++; // depends on control dependency: [if], data = [none]
}
}
//System.out.println(totalSize+":"+newRated.length+":"+microphoneData.getAudioFormat().getSampleRate());
AudioStreamDataPacket asdp = new AudioStreamDataPacket(newRated, newRated.length / frameSize, frameSize);
oos.writeObject(asdp); // depends on control dependency: [try], data = [none]
oos.flush(); // depends on control dependency: [try], data = [none]
oos.reset(); // depends on control dependency: [try], data = [none]
} catch (IOException e1) {
Logger.getLogger(getClass().getSimpleName()).log(Level.SEVERE, null, e1);
socket = null;
oos = null;
return;
} // depends on control dependency: [catch], data = [none]
}
}
} } |
public class class_name {
private void fillPropertyMap(Map<String, Set<String>> map, TransformationDescription description) {
for (TransformationStep step : description.getTransformingSteps()) {
if (step.getSourceFields() == null) {
LOGGER.debug("Step {} is ignored since no source properties are defined");
continue;
}
String targetField = step.getTargetField();
if (!map.containsKey(targetField) && isTemporaryProperty(targetField)) {
LOGGER.debug("Add new property entry for field {}", targetField);
map.put(targetField, new HashSet<String>());
}
for (String sourceField : step.getSourceFields()) {
if (sourceField == null) {
continue;
}
String[] result = StringUtils.split(sourceField, ".");
String mapValue = result[0];
Set<String> targets = map.get(mapValue);
if (targets != null) {
targets.add(targetField);
} else {
LOGGER.error("Accessed property with the name {} which isn't existing", mapValue);
}
}
}
} } | public class class_name {
private void fillPropertyMap(Map<String, Set<String>> map, TransformationDescription description) {
for (TransformationStep step : description.getTransformingSteps()) {
if (step.getSourceFields() == null) {
LOGGER.debug("Step {} is ignored since no source properties are defined"); // depends on control dependency: [if], data = [none]
continue;
}
String targetField = step.getTargetField();
if (!map.containsKey(targetField) && isTemporaryProperty(targetField)) {
LOGGER.debug("Add new property entry for field {}", targetField); // depends on control dependency: [if], data = [none]
map.put(targetField, new HashSet<String>()); // depends on control dependency: [if], data = [none]
}
for (String sourceField : step.getSourceFields()) {
if (sourceField == null) {
continue;
}
String[] result = StringUtils.split(sourceField, ".");
String mapValue = result[0];
Set<String> targets = map.get(mapValue);
if (targets != null) {
targets.add(targetField); // depends on control dependency: [if], data = [none]
} else {
LOGGER.error("Accessed property with the name {} which isn't existing", mapValue); // depends on control dependency: [if], data = [none]
}
}
}
} } |
public class class_name {
public final EObject ruleXForLoopExpression() throws RecognitionException {
EObject current = null;
Token otherlv_1=null;
Token otherlv_2=null;
Token otherlv_4=null;
Token otherlv_6=null;
EObject lv_declaredParam_3_0 = null;
EObject lv_forExpression_5_0 = null;
EObject lv_eachExpression_7_0 = null;
enterRule();
try {
// InternalXbaseWithAnnotations.g:3791:2: ( ( ( ( ( () 'for' '(' ( ( ruleJvmFormalParameter ) ) ':' ) )=> ( () otherlv_1= 'for' otherlv_2= '(' ( (lv_declaredParam_3_0= ruleJvmFormalParameter ) ) otherlv_4= ':' ) ) ( (lv_forExpression_5_0= ruleXExpression ) ) otherlv_6= ')' ( (lv_eachExpression_7_0= ruleXExpression ) ) ) )
// InternalXbaseWithAnnotations.g:3792:2: ( ( ( ( () 'for' '(' ( ( ruleJvmFormalParameter ) ) ':' ) )=> ( () otherlv_1= 'for' otherlv_2= '(' ( (lv_declaredParam_3_0= ruleJvmFormalParameter ) ) otherlv_4= ':' ) ) ( (lv_forExpression_5_0= ruleXExpression ) ) otherlv_6= ')' ( (lv_eachExpression_7_0= ruleXExpression ) ) )
{
// InternalXbaseWithAnnotations.g:3792:2: ( ( ( ( () 'for' '(' ( ( ruleJvmFormalParameter ) ) ':' ) )=> ( () otherlv_1= 'for' otherlv_2= '(' ( (lv_declaredParam_3_0= ruleJvmFormalParameter ) ) otherlv_4= ':' ) ) ( (lv_forExpression_5_0= ruleXExpression ) ) otherlv_6= ')' ( (lv_eachExpression_7_0= ruleXExpression ) ) )
// InternalXbaseWithAnnotations.g:3793:3: ( ( ( () 'for' '(' ( ( ruleJvmFormalParameter ) ) ':' ) )=> ( () otherlv_1= 'for' otherlv_2= '(' ( (lv_declaredParam_3_0= ruleJvmFormalParameter ) ) otherlv_4= ':' ) ) ( (lv_forExpression_5_0= ruleXExpression ) ) otherlv_6= ')' ( (lv_eachExpression_7_0= ruleXExpression ) )
{
// InternalXbaseWithAnnotations.g:3793:3: ( ( ( () 'for' '(' ( ( ruleJvmFormalParameter ) ) ':' ) )=> ( () otherlv_1= 'for' otherlv_2= '(' ( (lv_declaredParam_3_0= ruleJvmFormalParameter ) ) otherlv_4= ':' ) )
// InternalXbaseWithAnnotations.g:3794:4: ( ( () 'for' '(' ( ( ruleJvmFormalParameter ) ) ':' ) )=> ( () otherlv_1= 'for' otherlv_2= '(' ( (lv_declaredParam_3_0= ruleJvmFormalParameter ) ) otherlv_4= ':' )
{
// InternalXbaseWithAnnotations.g:3807:4: ( () otherlv_1= 'for' otherlv_2= '(' ( (lv_declaredParam_3_0= ruleJvmFormalParameter ) ) otherlv_4= ':' )
// InternalXbaseWithAnnotations.g:3808:5: () otherlv_1= 'for' otherlv_2= '(' ( (lv_declaredParam_3_0= ruleJvmFormalParameter ) ) otherlv_4= ':'
{
// InternalXbaseWithAnnotations.g:3808:5: ()
// InternalXbaseWithAnnotations.g:3809:6:
{
if ( state.backtracking==0 ) {
current = forceCreateModelElement(
grammarAccess.getXForLoopExpressionAccess().getXForLoopExpressionAction_0_0_0(),
current);
}
}
otherlv_1=(Token)match(input,65,FOLLOW_48); if (state.failed) return current;
if ( state.backtracking==0 ) {
newLeafNode(otherlv_1, grammarAccess.getXForLoopExpressionAccess().getForKeyword_0_0_1());
}
otherlv_2=(Token)match(input,14,FOLLOW_22); if (state.failed) return current;
if ( state.backtracking==0 ) {
newLeafNode(otherlv_2, grammarAccess.getXForLoopExpressionAccess().getLeftParenthesisKeyword_0_0_2());
}
// InternalXbaseWithAnnotations.g:3823:5: ( (lv_declaredParam_3_0= ruleJvmFormalParameter ) )
// InternalXbaseWithAnnotations.g:3824:6: (lv_declaredParam_3_0= ruleJvmFormalParameter )
{
// InternalXbaseWithAnnotations.g:3824:6: (lv_declaredParam_3_0= ruleJvmFormalParameter )
// InternalXbaseWithAnnotations.g:3825:7: lv_declaredParam_3_0= ruleJvmFormalParameter
{
if ( state.backtracking==0 ) {
newCompositeNode(grammarAccess.getXForLoopExpressionAccess().getDeclaredParamJvmFormalParameterParserRuleCall_0_0_3_0());
}
pushFollow(FOLLOW_51);
lv_declaredParam_3_0=ruleJvmFormalParameter();
state._fsp--;
if (state.failed) return current;
if ( state.backtracking==0 ) {
if (current==null) {
current = createModelElementForParent(grammarAccess.getXForLoopExpressionRule());
}
set(
current,
"declaredParam",
lv_declaredParam_3_0,
"org.eclipse.xtext.xbase.Xbase.JvmFormalParameter");
afterParserOrEnumRuleCall();
}
}
}
otherlv_4=(Token)match(input,62,FOLLOW_9); if (state.failed) return current;
if ( state.backtracking==0 ) {
newLeafNode(otherlv_4, grammarAccess.getXForLoopExpressionAccess().getColonKeyword_0_0_4());
}
}
}
// InternalXbaseWithAnnotations.g:3848:3: ( (lv_forExpression_5_0= ruleXExpression ) )
// InternalXbaseWithAnnotations.g:3849:4: (lv_forExpression_5_0= ruleXExpression )
{
// InternalXbaseWithAnnotations.g:3849:4: (lv_forExpression_5_0= ruleXExpression )
// InternalXbaseWithAnnotations.g:3850:5: lv_forExpression_5_0= ruleXExpression
{
if ( state.backtracking==0 ) {
newCompositeNode(grammarAccess.getXForLoopExpressionAccess().getForExpressionXExpressionParserRuleCall_1_0());
}
pushFollow(FOLLOW_7);
lv_forExpression_5_0=ruleXExpression();
state._fsp--;
if (state.failed) return current;
if ( state.backtracking==0 ) {
if (current==null) {
current = createModelElementForParent(grammarAccess.getXForLoopExpressionRule());
}
set(
current,
"forExpression",
lv_forExpression_5_0,
"org.eclipse.xtext.xbase.Xbase.XExpression");
afterParserOrEnumRuleCall();
}
}
}
otherlv_6=(Token)match(input,16,FOLLOW_9); if (state.failed) return current;
if ( state.backtracking==0 ) {
newLeafNode(otherlv_6, grammarAccess.getXForLoopExpressionAccess().getRightParenthesisKeyword_2());
}
// InternalXbaseWithAnnotations.g:3871:3: ( (lv_eachExpression_7_0= ruleXExpression ) )
// InternalXbaseWithAnnotations.g:3872:4: (lv_eachExpression_7_0= ruleXExpression )
{
// InternalXbaseWithAnnotations.g:3872:4: (lv_eachExpression_7_0= ruleXExpression )
// InternalXbaseWithAnnotations.g:3873:5: lv_eachExpression_7_0= ruleXExpression
{
if ( state.backtracking==0 ) {
newCompositeNode(grammarAccess.getXForLoopExpressionAccess().getEachExpressionXExpressionParserRuleCall_3_0());
}
pushFollow(FOLLOW_2);
lv_eachExpression_7_0=ruleXExpression();
state._fsp--;
if (state.failed) return current;
if ( state.backtracking==0 ) {
if (current==null) {
current = createModelElementForParent(grammarAccess.getXForLoopExpressionRule());
}
set(
current,
"eachExpression",
lv_eachExpression_7_0,
"org.eclipse.xtext.xbase.Xbase.XExpression");
afterParserOrEnumRuleCall();
}
}
}
}
}
if ( state.backtracking==0 ) {
leaveRule();
}
}
catch (RecognitionException re) {
recover(input,re);
appendSkippedTokens();
}
finally {
}
return current;
} } | public class class_name {
public final EObject ruleXForLoopExpression() throws RecognitionException {
EObject current = null;
Token otherlv_1=null;
Token otherlv_2=null;
Token otherlv_4=null;
Token otherlv_6=null;
EObject lv_declaredParam_3_0 = null;
EObject lv_forExpression_5_0 = null;
EObject lv_eachExpression_7_0 = null;
enterRule();
try {
// InternalXbaseWithAnnotations.g:3791:2: ( ( ( ( ( () 'for' '(' ( ( ruleJvmFormalParameter ) ) ':' ) )=> ( () otherlv_1= 'for' otherlv_2= '(' ( (lv_declaredParam_3_0= ruleJvmFormalParameter ) ) otherlv_4= ':' ) ) ( (lv_forExpression_5_0= ruleXExpression ) ) otherlv_6= ')' ( (lv_eachExpression_7_0= ruleXExpression ) ) ) )
// InternalXbaseWithAnnotations.g:3792:2: ( ( ( ( () 'for' '(' ( ( ruleJvmFormalParameter ) ) ':' ) )=> ( () otherlv_1= 'for' otherlv_2= '(' ( (lv_declaredParam_3_0= ruleJvmFormalParameter ) ) otherlv_4= ':' ) ) ( (lv_forExpression_5_0= ruleXExpression ) ) otherlv_6= ')' ( (lv_eachExpression_7_0= ruleXExpression ) ) )
{
// InternalXbaseWithAnnotations.g:3792:2: ( ( ( ( () 'for' '(' ( ( ruleJvmFormalParameter ) ) ':' ) )=> ( () otherlv_1= 'for' otherlv_2= '(' ( (lv_declaredParam_3_0= ruleJvmFormalParameter ) ) otherlv_4= ':' ) ) ( (lv_forExpression_5_0= ruleXExpression ) ) otherlv_6= ')' ( (lv_eachExpression_7_0= ruleXExpression ) ) )
// InternalXbaseWithAnnotations.g:3793:3: ( ( ( () 'for' '(' ( ( ruleJvmFormalParameter ) ) ':' ) )=> ( () otherlv_1= 'for' otherlv_2= '(' ( (lv_declaredParam_3_0= ruleJvmFormalParameter ) ) otherlv_4= ':' ) ) ( (lv_forExpression_5_0= ruleXExpression ) ) otherlv_6= ')' ( (lv_eachExpression_7_0= ruleXExpression ) )
{
// InternalXbaseWithAnnotations.g:3793:3: ( ( ( () 'for' '(' ( ( ruleJvmFormalParameter ) ) ':' ) )=> ( () otherlv_1= 'for' otherlv_2= '(' ( (lv_declaredParam_3_0= ruleJvmFormalParameter ) ) otherlv_4= ':' ) )
// InternalXbaseWithAnnotations.g:3794:4: ( ( () 'for' '(' ( ( ruleJvmFormalParameter ) ) ':' ) )=> ( () otherlv_1= 'for' otherlv_2= '(' ( (lv_declaredParam_3_0= ruleJvmFormalParameter ) ) otherlv_4= ':' )
{
// InternalXbaseWithAnnotations.g:3807:4: ( () otherlv_1= 'for' otherlv_2= '(' ( (lv_declaredParam_3_0= ruleJvmFormalParameter ) ) otherlv_4= ':' )
// InternalXbaseWithAnnotations.g:3808:5: () otherlv_1= 'for' otherlv_2= '(' ( (lv_declaredParam_3_0= ruleJvmFormalParameter ) ) otherlv_4= ':'
{
// InternalXbaseWithAnnotations.g:3808:5: ()
// InternalXbaseWithAnnotations.g:3809:6:
{
if ( state.backtracking==0 ) {
current = forceCreateModelElement(
grammarAccess.getXForLoopExpressionAccess().getXForLoopExpressionAction_0_0_0(),
current); // depends on control dependency: [if], data = [none]
}
}
otherlv_1=(Token)match(input,65,FOLLOW_48); if (state.failed) return current;
if ( state.backtracking==0 ) {
newLeafNode(otherlv_1, grammarAccess.getXForLoopExpressionAccess().getForKeyword_0_0_1()); // depends on control dependency: [if], data = [none]
}
otherlv_2=(Token)match(input,14,FOLLOW_22); if (state.failed) return current;
if ( state.backtracking==0 ) {
newLeafNode(otherlv_2, grammarAccess.getXForLoopExpressionAccess().getLeftParenthesisKeyword_0_0_2()); // depends on control dependency: [if], data = [none]
}
// InternalXbaseWithAnnotations.g:3823:5: ( (lv_declaredParam_3_0= ruleJvmFormalParameter ) )
// InternalXbaseWithAnnotations.g:3824:6: (lv_declaredParam_3_0= ruleJvmFormalParameter )
{
// InternalXbaseWithAnnotations.g:3824:6: (lv_declaredParam_3_0= ruleJvmFormalParameter )
// InternalXbaseWithAnnotations.g:3825:7: lv_declaredParam_3_0= ruleJvmFormalParameter
{
if ( state.backtracking==0 ) {
newCompositeNode(grammarAccess.getXForLoopExpressionAccess().getDeclaredParamJvmFormalParameterParserRuleCall_0_0_3_0()); // depends on control dependency: [if], data = [none]
}
pushFollow(FOLLOW_51);
lv_declaredParam_3_0=ruleJvmFormalParameter();
state._fsp--;
if (state.failed) return current;
if ( state.backtracking==0 ) {
if (current==null) {
current = createModelElementForParent(grammarAccess.getXForLoopExpressionRule()); // depends on control dependency: [if], data = [none]
}
set(
current,
"declaredParam",
lv_declaredParam_3_0,
"org.eclipse.xtext.xbase.Xbase.JvmFormalParameter");
afterParserOrEnumRuleCall(); // depends on control dependency: [if], data = [none]
}
}
}
otherlv_4=(Token)match(input,62,FOLLOW_9); if (state.failed) return current;
if ( state.backtracking==0 ) {
newLeafNode(otherlv_4, grammarAccess.getXForLoopExpressionAccess().getColonKeyword_0_0_4()); // depends on control dependency: [if], data = [none]
}
}
}
// InternalXbaseWithAnnotations.g:3848:3: ( (lv_forExpression_5_0= ruleXExpression ) )
// InternalXbaseWithAnnotations.g:3849:4: (lv_forExpression_5_0= ruleXExpression )
{
// InternalXbaseWithAnnotations.g:3849:4: (lv_forExpression_5_0= ruleXExpression )
// InternalXbaseWithAnnotations.g:3850:5: lv_forExpression_5_0= ruleXExpression
{
if ( state.backtracking==0 ) {
newCompositeNode(grammarAccess.getXForLoopExpressionAccess().getForExpressionXExpressionParserRuleCall_1_0()); // depends on control dependency: [if], data = [none]
}
pushFollow(FOLLOW_7);
lv_forExpression_5_0=ruleXExpression();
state._fsp--;
if (state.failed) return current;
if ( state.backtracking==0 ) {
if (current==null) {
current = createModelElementForParent(grammarAccess.getXForLoopExpressionRule()); // depends on control dependency: [if], data = [none]
}
set(
current,
"forExpression",
lv_forExpression_5_0,
"org.eclipse.xtext.xbase.Xbase.XExpression");
afterParserOrEnumRuleCall(); // depends on control dependency: [if], data = [none]
}
}
}
otherlv_6=(Token)match(input,16,FOLLOW_9); if (state.failed) return current;
if ( state.backtracking==0 ) {
newLeafNode(otherlv_6, grammarAccess.getXForLoopExpressionAccess().getRightParenthesisKeyword_2()); // depends on control dependency: [if], data = [none]
}
// InternalXbaseWithAnnotations.g:3871:3: ( (lv_eachExpression_7_0= ruleXExpression ) )
// InternalXbaseWithAnnotations.g:3872:4: (lv_eachExpression_7_0= ruleXExpression )
{
// InternalXbaseWithAnnotations.g:3872:4: (lv_eachExpression_7_0= ruleXExpression )
// InternalXbaseWithAnnotations.g:3873:5: lv_eachExpression_7_0= ruleXExpression
{
if ( state.backtracking==0 ) {
newCompositeNode(grammarAccess.getXForLoopExpressionAccess().getEachExpressionXExpressionParserRuleCall_3_0()); // depends on control dependency: [if], data = [none]
}
pushFollow(FOLLOW_2);
lv_eachExpression_7_0=ruleXExpression();
state._fsp--;
if (state.failed) return current;
if ( state.backtracking==0 ) {
if (current==null) {
current = createModelElementForParent(grammarAccess.getXForLoopExpressionRule()); // depends on control dependency: [if], data = [none]
}
set(
current,
"eachExpression",
lv_eachExpression_7_0,
"org.eclipse.xtext.xbase.Xbase.XExpression");
afterParserOrEnumRuleCall(); // depends on control dependency: [if], data = [none]
}
}
}
}
}
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 {
protected boolean canBePrintable(
String str)
{
for (int i = str.length() - 1; i >= 0; i--)
{
char ch = str.charAt(i);
if (str.charAt(i) > 0x007f)
{
return false;
}
if ('a' <= ch && ch <= 'z')
{
continue;
}
if ('A' <= ch && ch <= 'Z')
{
continue;
}
if ('0' <= ch && ch <= '9')
{
continue;
}
switch (ch)
{
case ' ':
case '\'':
case '(':
case ')':
case '+':
case '-':
case '.':
case ':':
case '=':
case '?':
continue;
}
return false;
}
return true;
} } | public class class_name {
protected boolean canBePrintable(
String str)
{
for (int i = str.length() - 1; i >= 0; i--)
{
char ch = str.charAt(i);
if (str.charAt(i) > 0x007f)
{
return false; // depends on control dependency: [if], data = [none]
}
if ('a' <= ch && ch <= 'z')
{
continue;
}
if ('A' <= ch && ch <= 'Z')
{
continue;
}
if ('0' <= ch && ch <= '9')
{
continue;
}
switch (ch)
{
case ' ':
case '\'':
case '(':
case ')':
case '+':
case '-':
case '.':
case ':':
case '=':
case '?':
continue;
}
return false; // depends on control dependency: [for], data = [none]
}
return true;
} } |
public class class_name {
@HEAD
public Response getContentProperties(@PathParam("spaceID") String spaceID,
@PathParam("contentID") String contentID,
@QueryParam("storeID") String storeID) {
StringBuilder msg = new StringBuilder("getting content properties(");
msg.append(spaceID);
msg.append(", ");
msg.append(contentID);
msg.append(", ");
msg.append(storeID);
msg.append(")");
try {
Map<String, String> properties =
contentResource.getContentProperties(spaceID, contentID, storeID);
log.debug(msg.toString());
return addContentPropertiesToResponse(Response.ok(), properties);
} catch (ResourceNotFoundException e) {
return responseNotFound(msg.toString(), e, NOT_FOUND);
} catch (ResourceException e) {
return responseBad(msg.toString(), e, INTERNAL_SERVER_ERROR);
} catch (Exception e) {
return responseBad(msg.toString(), e, INTERNAL_SERVER_ERROR);
}
} } | public class class_name {
@HEAD
public Response getContentProperties(@PathParam("spaceID") String spaceID,
@PathParam("contentID") String contentID,
@QueryParam("storeID") String storeID) {
StringBuilder msg = new StringBuilder("getting content properties(");
msg.append(spaceID);
msg.append(", ");
msg.append(contentID);
msg.append(", ");
msg.append(storeID);
msg.append(")");
try {
Map<String, String> properties =
contentResource.getContentProperties(spaceID, contentID, storeID);
log.debug(msg.toString()); // depends on control dependency: [try], data = [none]
return addContentPropertiesToResponse(Response.ok(), properties); // depends on control dependency: [try], data = [none]
} catch (ResourceNotFoundException e) {
return responseNotFound(msg.toString(), e, NOT_FOUND);
} catch (ResourceException e) { // depends on control dependency: [catch], data = [none]
return responseBad(msg.toString(), e, INTERNAL_SERVER_ERROR);
} catch (Exception e) { // depends on control dependency: [catch], data = [none]
return responseBad(msg.toString(), e, INTERNAL_SERVER_ERROR);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public void marshall(CreateConfigurationSetRequest createConfigurationSetRequest, ProtocolMarshaller protocolMarshaller) {
if (createConfigurationSetRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(createConfigurationSetRequest.getConfigurationSetName(), CONFIGURATIONSETNAME_BINDING);
protocolMarshaller.marshall(createConfigurationSetRequest.getTrackingOptions(), TRACKINGOPTIONS_BINDING);
protocolMarshaller.marshall(createConfigurationSetRequest.getDeliveryOptions(), DELIVERYOPTIONS_BINDING);
protocolMarshaller.marshall(createConfigurationSetRequest.getReputationOptions(), REPUTATIONOPTIONS_BINDING);
protocolMarshaller.marshall(createConfigurationSetRequest.getSendingOptions(), SENDINGOPTIONS_BINDING);
protocolMarshaller.marshall(createConfigurationSetRequest.getTags(), TAGS_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(CreateConfigurationSetRequest createConfigurationSetRequest, ProtocolMarshaller protocolMarshaller) {
if (createConfigurationSetRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(createConfigurationSetRequest.getConfigurationSetName(), CONFIGURATIONSETNAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(createConfigurationSetRequest.getTrackingOptions(), TRACKINGOPTIONS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(createConfigurationSetRequest.getDeliveryOptions(), DELIVERYOPTIONS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(createConfigurationSetRequest.getReputationOptions(), REPUTATIONOPTIONS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(createConfigurationSetRequest.getSendingOptions(), SENDINGOPTIONS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(createConfigurationSetRequest.getTags(), TAGS_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 marshall(InventoryFilter inventoryFilter, ProtocolMarshaller protocolMarshaller) {
if (inventoryFilter == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(inventoryFilter.getName(), NAME_BINDING);
protocolMarshaller.marshall(inventoryFilter.getCondition(), CONDITION_BINDING);
protocolMarshaller.marshall(inventoryFilter.getValue(), VALUE_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(InventoryFilter inventoryFilter, ProtocolMarshaller protocolMarshaller) {
if (inventoryFilter == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(inventoryFilter.getName(), NAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(inventoryFilter.getCondition(), CONDITION_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(inventoryFilter.getValue(), VALUE_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 void initializeW(final int blockLength,
final DSubmatrixD1 W, final DSubmatrixD1 Y,
final int widthB, final double b) {
final double dataW[] = W.original.data;
final double dataY[] = Y.original.data;
for( int i = W.row0; i < W.row1; i += blockLength ) {
int heightW = Math.min( blockLength , W.row1 - i );
int indexW = i*W.original.numCols + heightW*W.col0;
int indexY = i*Y.original.numCols + heightW*Y.col0;
// take in account the first element in V being 1
if( i == W.row0 ) {
dataW[indexW] = -b;
indexW += widthB;
indexY += widthB;
for( int k = 1; k < heightW; k++ , indexW += widthB , indexY += widthB ) {
dataW[indexW] = -b* dataY[indexY];
}
} else {
for( int k = 0; k < heightW; k++ , indexW += widthB , indexY += widthB ) {
dataW[indexW] = -b* dataY[indexY];
}
}
}
} } | public class class_name {
public static void initializeW(final int blockLength,
final DSubmatrixD1 W, final DSubmatrixD1 Y,
final int widthB, final double b) {
final double dataW[] = W.original.data;
final double dataY[] = Y.original.data;
for( int i = W.row0; i < W.row1; i += blockLength ) {
int heightW = Math.min( blockLength , W.row1 - i );
int indexW = i*W.original.numCols + heightW*W.col0;
int indexY = i*Y.original.numCols + heightW*Y.col0;
// take in account the first element in V being 1
if( i == W.row0 ) {
dataW[indexW] = -b; // depends on control dependency: [if], data = [none]
indexW += widthB; // depends on control dependency: [if], data = [none]
indexY += widthB; // depends on control dependency: [if], data = [none]
for( int k = 1; k < heightW; k++ , indexW += widthB , indexY += widthB ) {
dataW[indexW] = -b* dataY[indexY]; // depends on control dependency: [for], data = [none]
}
} else {
for( int k = 0; k < heightW; k++ , indexW += widthB , indexY += widthB ) {
dataW[indexW] = -b* dataY[indexY]; // depends on control dependency: [for], data = [none]
}
}
}
} } |
public class class_name {
public void updateMenuView(boolean cleared) {
final ViewGroup parent = (ViewGroup) mMenuView;
if (parent == null) {
return;
}
int childIndex = 0;
if (mMenu != null) {
mMenu.flagActionItems();
ArrayList<MenuItemImpl> visibleItems = mMenu.getVisibleItems();
final int itemCount = visibleItems.size();
for (int i = 0; i < itemCount; i++) {
MenuItemImpl item = visibleItems.get(i);
if (shouldIncludeItem(childIndex, item)) {
final View convertView = parent.getChildAt(childIndex);
final MenuItemImpl oldItem = convertView instanceof MenuView.ItemView ?
((MenuView.ItemView) convertView).getItemData() : null;
final View itemView = getItemView(item, convertView, parent);
if (item != oldItem) {
// Don't let old states linger with new data.
itemView.setPressed(false);
// itemView.jumpDrawablesToCurrentState();
// Animation API: Not available on API < 11
}
if (itemView != convertView) {
addItemView(itemView, childIndex);
}
childIndex++;
}
}
}
// Remove leftover views.
while (childIndex < parent.getChildCount()) {
if (!filterLeftoverView(parent, childIndex)) {
childIndex++;
}
}
} } | public class class_name {
public void updateMenuView(boolean cleared) {
final ViewGroup parent = (ViewGroup) mMenuView;
if (parent == null) {
return; // depends on control dependency: [if], data = [none]
}
int childIndex = 0;
if (mMenu != null) {
mMenu.flagActionItems(); // depends on control dependency: [if], data = [none]
ArrayList<MenuItemImpl> visibleItems = mMenu.getVisibleItems();
final int itemCount = visibleItems.size();
for (int i = 0; i < itemCount; i++) {
MenuItemImpl item = visibleItems.get(i);
if (shouldIncludeItem(childIndex, item)) {
final View convertView = parent.getChildAt(childIndex);
final MenuItemImpl oldItem = convertView instanceof MenuView.ItemView ?
((MenuView.ItemView) convertView).getItemData() : null;
final View itemView = getItemView(item, convertView, parent);
if (item != oldItem) {
// Don't let old states linger with new data.
itemView.setPressed(false); // depends on control dependency: [if], data = [none]
// itemView.jumpDrawablesToCurrentState();
// Animation API: Not available on API < 11
}
if (itemView != convertView) {
addItemView(itemView, childIndex); // depends on control dependency: [if], data = [(itemView]
}
childIndex++; // depends on control dependency: [if], data = [none]
}
}
}
// Remove leftover views.
while (childIndex < parent.getChildCount()) {
if (!filterLeftoverView(parent, childIndex)) {
childIndex++; // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
public static Component getDescendantNamed(String name, Component parent) {
Assert.notNull(name, "name");
Assert.notNull(parent, "parent");
if (name.equals(parent.getName())) { // Base case
return parent;
} else if (parent instanceof Container) { // Recursive case
for (final Component component : ((Container) parent).getComponents()) {
final Component foundComponent = SwingUtils.getDescendantNamed(name, component);
if (foundComponent != null) {
return foundComponent;
}
}
}
return null;
} } | public class class_name {
public static Component getDescendantNamed(String name, Component parent) {
Assert.notNull(name, "name");
Assert.notNull(parent, "parent");
if (name.equals(parent.getName())) { // Base case
return parent; // depends on control dependency: [if], data = [none]
} else if (parent instanceof Container) { // Recursive case
for (final Component component : ((Container) parent).getComponents()) {
final Component foundComponent = SwingUtils.getDescendantNamed(name, component);
if (foundComponent != null) {
return foundComponent; // depends on control dependency: [if], data = [none]
}
}
}
return null;
} } |
public class class_name {
protected DateTimeValue doNormalize() {
// year & month & day
int year = this.year;
int month = monthDay / MONTH_MULTIPLICATOR;
int day = monthDay - (month * MONTH_MULTIPLICATOR);
// time
int hour = time / SECONDS_IN_HOUR;
int time = this.time;
time -= hour * SECONDS_IN_HOUR;
int minutes = time / SECONDS_IN_MINUTE;
int seconds = time - minutes * SECONDS_IN_MINUTE;
// start Algorithm with not touching seconds to support leap-seconds
// https://www.w3.org/TR/2004/REC-xmlschema-2-20041028/#adding-durations-to-dateTimes
// if(seconds > 59) {
// seconds -= 60; // remove one minute
// minutes++; // adds one minute
// }
// if(minutes > 59) {
// minutes -= 60; // remove an hour
// hour++; // add one hour
// }
// timezone, per default 'Z'
int tzMinutes = 0;
int tzHours = 0;
if (this.presenceTimezone && this.timezone != 0) {
final int tz = this.timezone; // +/-
// hours
tzHours = tz / 64;
// minutes
tzMinutes = tz - (tzHours * 64);
}
final int negate = -1;
// Minutes temp := S[minute] + D[minute] + carry E[minute] :=
// modulo(temp, 60) carry := fQuotient(temp, 60)
int temp = minutes + negate * tzMinutes;
minutes = modulo(temp, 60);
int carry = fQuotient(temp, 60);
// Hours temp := S[hour] + D[hour] + carry E[hour] := modulo(temp, 24)
// carry := fQuotient(temp, 24)
temp = hour + negate * tzHours + carry;
hour = modulo(temp, 24);
carry = fQuotient(temp, 24);
// Days
int tempDays;
// if S[day] > maximumDayInMonthFor(E[year], E[month])
if (day > maximumDayInMonthFor(year, month)) {
// tempDays := maximumDayInMonthFor(E[year], E[month])
tempDays = maximumDayInMonthFor(year, month);
// else if S[day] < 1
} else if (day < 1) {
// tempDays := 1
tempDays = 1;
// else
} else {
// tempDays := S[day]
tempDays = day;
}
// E[day] := tempDays + D[day] + carry
day = tempDays + carry;
while (true) {
if (day < 1) {
day = day + maximumDayInMonthFor(year, month - 1);
carry = -1;
} else if (day > maximumDayInMonthFor(year, month)) {
day = day - maximumDayInMonthFor(year, month);
carry = 1;
} else {
break;
}
temp = month + carry;
month = modulo(temp, 1, 13);
year = year + fQuotient(temp, 1, 13);
}
// create new DateTimeValue
int monthDay = month * 32 + day; // Month * 32 + Day
time = ((hour * 64) + minutes) * 64 + seconds;// ((Hour * 64) + Minutes)
// * 64 + seconds
// TODO add timezone ONLY if timezone was present before
boolean presenceTimezone = this.presenceTimezone; // true;
int timezone = 0;
return new DateTimeValue(this.type, year, monthDay, time,
fractionalSecs, presenceTimezone, timezone, true);
} } | public class class_name {
protected DateTimeValue doNormalize() {
// year & month & day
int year = this.year;
int month = monthDay / MONTH_MULTIPLICATOR;
int day = monthDay - (month * MONTH_MULTIPLICATOR);
// time
int hour = time / SECONDS_IN_HOUR;
int time = this.time;
time -= hour * SECONDS_IN_HOUR;
int minutes = time / SECONDS_IN_MINUTE;
int seconds = time - minutes * SECONDS_IN_MINUTE;
// start Algorithm with not touching seconds to support leap-seconds
// https://www.w3.org/TR/2004/REC-xmlschema-2-20041028/#adding-durations-to-dateTimes
// if(seconds > 59) {
// seconds -= 60; // remove one minute
// minutes++; // adds one minute
// }
// if(minutes > 59) {
// minutes -= 60; // remove an hour
// hour++; // add one hour
// }
// timezone, per default 'Z'
int tzMinutes = 0;
int tzHours = 0;
if (this.presenceTimezone && this.timezone != 0) {
final int tz = this.timezone; // +/-
// hours
tzHours = tz / 64; // depends on control dependency: [if], data = [none]
// minutes
tzMinutes = tz - (tzHours * 64); // depends on control dependency: [if], data = [none]
}
final int negate = -1;
// Minutes temp := S[minute] + D[minute] + carry E[minute] :=
// modulo(temp, 60) carry := fQuotient(temp, 60)
int temp = minutes + negate * tzMinutes;
minutes = modulo(temp, 60);
int carry = fQuotient(temp, 60);
// Hours temp := S[hour] + D[hour] + carry E[hour] := modulo(temp, 24)
// carry := fQuotient(temp, 24)
temp = hour + negate * tzHours + carry;
hour = modulo(temp, 24);
carry = fQuotient(temp, 24);
// Days
int tempDays;
// if S[day] > maximumDayInMonthFor(E[year], E[month])
if (day > maximumDayInMonthFor(year, month)) {
// tempDays := maximumDayInMonthFor(E[year], E[month])
tempDays = maximumDayInMonthFor(year, month); // depends on control dependency: [if], data = [none]
// else if S[day] < 1
} else if (day < 1) {
// tempDays := 1
tempDays = 1; // depends on control dependency: [if], data = [none]
// else
} else {
// tempDays := S[day]
tempDays = day; // depends on control dependency: [if], data = [none]
}
// E[day] := tempDays + D[day] + carry
day = tempDays + carry;
while (true) {
if (day < 1) {
day = day + maximumDayInMonthFor(year, month - 1); // depends on control dependency: [if], data = [1)]
carry = -1; // depends on control dependency: [if], data = [none]
} else if (day > maximumDayInMonthFor(year, month)) {
day = day - maximumDayInMonthFor(year, month); // depends on control dependency: [if], data = [none]
carry = 1; // depends on control dependency: [if], data = [none]
} else {
break;
}
temp = month + carry; // depends on control dependency: [while], data = [none]
month = modulo(temp, 1, 13); // depends on control dependency: [while], data = [none]
year = year + fQuotient(temp, 1, 13); // depends on control dependency: [while], data = [none]
}
// create new DateTimeValue
int monthDay = month * 32 + day; // Month * 32 + Day
time = ((hour * 64) + minutes) * 64 + seconds;// ((Hour * 64) + Minutes)
// * 64 + seconds
// TODO add timezone ONLY if timezone was present before
boolean presenceTimezone = this.presenceTimezone; // true;
int timezone = 0;
return new DateTimeValue(this.type, year, monthDay, time,
fractionalSecs, presenceTimezone, timezone, true);
} } |
public class class_name {
@Override
public void upgradeFromPreviousVersion(OpenImmoDocument doc) {
doc.setDocumentVersion(OpenImmoVersion.V1_2_7);
if (doc instanceof OpenImmoTransferDocument) {
try {
this.upgradeSummemietenettoElements(doc.getDocument());
} catch (Exception ex) {
LOGGER.error("Can't upgrade <summemietenetto> elements!");
LOGGER.error("> " + ex.getLocalizedMessage(), ex);
}
try {
this.upgradeEnergiepassElements(doc.getDocument());
} catch (Exception ex) {
LOGGER.error("Can't upgrade <energiepass> elements!");
LOGGER.error("> " + ex.getLocalizedMessage(), ex);
}
}
} } | public class class_name {
@Override
public void upgradeFromPreviousVersion(OpenImmoDocument doc) {
doc.setDocumentVersion(OpenImmoVersion.V1_2_7);
if (doc instanceof OpenImmoTransferDocument) {
try {
this.upgradeSummemietenettoElements(doc.getDocument()); // depends on control dependency: [try], data = [none]
} catch (Exception ex) {
LOGGER.error("Can't upgrade <summemietenetto> elements!");
LOGGER.error("> " + ex.getLocalizedMessage(), ex);
}
try {
this.upgradeEnergiepassElements(doc.getDocument());
} catch (Exception ex) {
LOGGER.error("Can't upgrade <energiepass> elements!");
LOGGER.error("> " + ex.getLocalizedMessage(), ex);
} // depends on control dependency: [catch], data = [none]
}
} } |
public class class_name {
public void mergeSubtree(final OperationTransformerRegistry targetRegistry, final Map<PathAddress, ModelVersion> subTree) {
for(Map.Entry<PathAddress, ModelVersion> entry: subTree.entrySet()) {
mergeSubtree(targetRegistry, entry.getKey(), entry.getValue());
}
} } | public class class_name {
public void mergeSubtree(final OperationTransformerRegistry targetRegistry, final Map<PathAddress, ModelVersion> subTree) {
for(Map.Entry<PathAddress, ModelVersion> entry: subTree.entrySet()) {
mergeSubtree(targetRegistry, entry.getKey(), entry.getValue()); // depends on control dependency: [for], data = [entry]
}
} } |
public class class_name {
public static void main (String args[]) {
System.out.println("PDF document encryptor");
if (args.length <= STRENGTH || args[PERMISSIONS].length() != 8) {
usage();
return;
}
try {
int permissions = 0;
String p = args[PERMISSIONS];
for (int k = 0; k < p.length(); ++k) {
permissions |= (p.charAt(k) == '0' ? 0 : permit[k]);
}
System.out.println("Reading " + args[INPUT_FILE]);
PdfReader reader = new PdfReader(args[INPUT_FILE]);
System.out.println("Writing " + args[OUTPUT_FILE]);
HashMap moreInfo = new HashMap();
for (int k = MOREINFO; k < args.length - 1; k += 2)
moreInfo.put(args[k], args[k + 1]);
PdfEncryptor.encrypt(reader, new FileOutputStream(args[OUTPUT_FILE]),
args[USER_PASSWORD].getBytes(), args[OWNER_PASSWORD].getBytes(), permissions, args[STRENGTH].equals("128"), moreInfo);
System.out.println("Done.");
}
catch (Exception e) {
e.printStackTrace();
}
} } | public class class_name {
public static void main (String args[]) {
System.out.println("PDF document encryptor");
if (args.length <= STRENGTH || args[PERMISSIONS].length() != 8) {
usage(); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
try {
int permissions = 0;
String p = args[PERMISSIONS];
for (int k = 0; k < p.length(); ++k) {
permissions |= (p.charAt(k) == '0' ? 0 : permit[k]); // depends on control dependency: [for], data = [k]
}
System.out.println("Reading " + args[INPUT_FILE]); // depends on control dependency: [try], data = [none]
PdfReader reader = new PdfReader(args[INPUT_FILE]);
System.out.println("Writing " + args[OUTPUT_FILE]); // depends on control dependency: [try], data = [none]
HashMap moreInfo = new HashMap();
for (int k = MOREINFO; k < args.length - 1; k += 2)
moreInfo.put(args[k], args[k + 1]);
PdfEncryptor.encrypt(reader, new FileOutputStream(args[OUTPUT_FILE]),
args[USER_PASSWORD].getBytes(), args[OWNER_PASSWORD].getBytes(), permissions, args[STRENGTH].equals("128"), moreInfo); // depends on control dependency: [try], data = [none]
System.out.println("Done."); // depends on control dependency: [try], data = [none]
}
catch (Exception e) {
e.printStackTrace();
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
private StringBuffer format(BigInteger number, StringBuffer result,
FieldDelegate delegate, boolean formatLong) {
if (multiplier != 1) {
number = number.multiply(getBigIntegerMultiplier());
}
boolean isNegative = number.signum() == -1;
if (isNegative) {
number = number.negate();
}
synchronized(digitList) {
int maxIntDigits, minIntDigits, maxFraDigits, minFraDigits, maximumDigits;
if (formatLong) {
maxIntDigits = super.getMaximumIntegerDigits();
minIntDigits = super.getMinimumIntegerDigits();
maxFraDigits = super.getMaximumFractionDigits();
minFraDigits = super.getMinimumFractionDigits();
maximumDigits = maxIntDigits + maxFraDigits;
} else {
maxIntDigits = getMaximumIntegerDigits();
minIntDigits = getMinimumIntegerDigits();
maxFraDigits = getMaximumFractionDigits();
minFraDigits = getMinimumFractionDigits();
maximumDigits = maxIntDigits + maxFraDigits;
if (maximumDigits < 0) {
maximumDigits = Integer.MAX_VALUE;
}
}
digitList.set(isNegative, number,
useExponentialNotation ? maximumDigits : 0);
return subformat(result, delegate, isNegative, true,
maxIntDigits, minIntDigits, maxFraDigits, minFraDigits);
}
} } | public class class_name {
private StringBuffer format(BigInteger number, StringBuffer result,
FieldDelegate delegate, boolean formatLong) {
if (multiplier != 1) {
number = number.multiply(getBigIntegerMultiplier()); // depends on control dependency: [if], data = [none]
}
boolean isNegative = number.signum() == -1;
if (isNegative) {
number = number.negate(); // depends on control dependency: [if], data = [none]
}
synchronized(digitList) {
int maxIntDigits, minIntDigits, maxFraDigits, minFraDigits, maximumDigits;
if (formatLong) {
maxIntDigits = super.getMaximumIntegerDigits(); // depends on control dependency: [if], data = [none]
minIntDigits = super.getMinimumIntegerDigits(); // depends on control dependency: [if], data = [none]
maxFraDigits = super.getMaximumFractionDigits(); // depends on control dependency: [if], data = [none]
minFraDigits = super.getMinimumFractionDigits(); // depends on control dependency: [if], data = [none]
maximumDigits = maxIntDigits + maxFraDigits; // depends on control dependency: [if], data = [none]
} else {
maxIntDigits = getMaximumIntegerDigits(); // depends on control dependency: [if], data = [none]
minIntDigits = getMinimumIntegerDigits(); // depends on control dependency: [if], data = [none]
maxFraDigits = getMaximumFractionDigits(); // depends on control dependency: [if], data = [none]
minFraDigits = getMinimumFractionDigits(); // depends on control dependency: [if], data = [none]
maximumDigits = maxIntDigits + maxFraDigits; // depends on control dependency: [if], data = [none]
if (maximumDigits < 0) {
maximumDigits = Integer.MAX_VALUE; // depends on control dependency: [if], data = [none]
}
}
digitList.set(isNegative, number,
useExponentialNotation ? maximumDigits : 0);
return subformat(result, delegate, isNegative, true,
maxIntDigits, minIntDigits, maxFraDigits, minFraDigits);
}
} } |
public class class_name {
public void write(byte[] arr, int off, int len) throws IOException {
if (len > buf.length - pos) {
if (buf.length != getMaxPacketLength()) {
growBuffer(len);
}
//max buffer size
if (len > buf.length - pos) {
if (mark != -1) {
growBuffer(len);
if (mark != -1) {
flushBufferStopAtMark();
}
} else {
//not enough space in buffer, will stream :
// fill buffer and flush until all data are snd
int remainingLen = len;
do {
int lenToFillBuffer = Math.min(getMaxPacketLength() - pos, remainingLen);
System.arraycopy(arr, off, buf, pos, lenToFillBuffer);
remainingLen -= lenToFillBuffer;
off += lenToFillBuffer;
pos += lenToFillBuffer;
if (remainingLen > 0) {
flushBuffer(false);
} else {
break;
}
} while (true);
return;
}
}
}
System.arraycopy(arr, off, buf, pos, len);
pos += len;
} } | public class class_name {
public void write(byte[] arr, int off, int len) throws IOException {
if (len > buf.length - pos) {
if (buf.length != getMaxPacketLength()) {
growBuffer(len); // depends on control dependency: [if], data = [none]
}
//max buffer size
if (len > buf.length - pos) {
if (mark != -1) {
growBuffer(len); // depends on control dependency: [if], data = [none]
if (mark != -1) {
flushBufferStopAtMark(); // depends on control dependency: [if], data = [none]
}
} else {
//not enough space in buffer, will stream :
// fill buffer and flush until all data are snd
int remainingLen = len;
do {
int lenToFillBuffer = Math.min(getMaxPacketLength() - pos, remainingLen);
System.arraycopy(arr, off, buf, pos, lenToFillBuffer);
remainingLen -= lenToFillBuffer;
off += lenToFillBuffer;
pos += lenToFillBuffer;
if (remainingLen > 0) {
flushBuffer(false); // depends on control dependency: [if], data = [none]
} else {
break;
}
} while (true);
return; // depends on control dependency: [if], data = [none]
}
}
}
System.arraycopy(arr, off, buf, pos, len);
pos += len;
} } |
public class class_name {
private static SSLEngine createSSLEngine(SSLContext sslContext, OptionMap optionMap, InetSocketAddress peerAddress, boolean client) {
final SSLEngine engine = sslContext.createSSLEngine(
optionMap.get(Options.SSL_PEER_HOST_NAME, peerAddress.getHostString()),
optionMap.get(Options.SSL_PEER_PORT, peerAddress.getPort())
);
engine.setUseClientMode(client);
engine.setEnableSessionCreation(optionMap.get(Options.SSL_ENABLE_SESSION_CREATION, true));
final Sequence<String> cipherSuites = optionMap.get(Options.SSL_ENABLED_CIPHER_SUITES);
if (cipherSuites != null) {
final Set<String> supported = new HashSet<String>(Arrays.asList(engine.getSupportedCipherSuites()));
final List<String> finalList = new ArrayList<String>();
for (String name : cipherSuites) {
if (supported.contains(name)) {
finalList.add(name);
}
}
engine.setEnabledCipherSuites(finalList.toArray(new String[finalList.size()]));
}
final Sequence<String> protocols = optionMap.get(Options.SSL_ENABLED_PROTOCOLS);
if (protocols != null) {
final Set<String> supported = new HashSet<String>(Arrays.asList(engine.getSupportedProtocols()));
final List<String> finalList = new ArrayList<String>();
for (String name : protocols) {
if (supported.contains(name)) {
finalList.add(name);
}
}
engine.setEnabledProtocols(finalList.toArray(new String[finalList.size()]));
}
return engine;
} } | public class class_name {
private static SSLEngine createSSLEngine(SSLContext sslContext, OptionMap optionMap, InetSocketAddress peerAddress, boolean client) {
final SSLEngine engine = sslContext.createSSLEngine(
optionMap.get(Options.SSL_PEER_HOST_NAME, peerAddress.getHostString()),
optionMap.get(Options.SSL_PEER_PORT, peerAddress.getPort())
);
engine.setUseClientMode(client);
engine.setEnableSessionCreation(optionMap.get(Options.SSL_ENABLE_SESSION_CREATION, true));
final Sequence<String> cipherSuites = optionMap.get(Options.SSL_ENABLED_CIPHER_SUITES);
if (cipherSuites != null) {
final Set<String> supported = new HashSet<String>(Arrays.asList(engine.getSupportedCipherSuites()));
final List<String> finalList = new ArrayList<String>();
for (String name : cipherSuites) {
if (supported.contains(name)) {
finalList.add(name); // depends on control dependency: [if], data = [none]
}
}
engine.setEnabledCipherSuites(finalList.toArray(new String[finalList.size()])); // depends on control dependency: [if], data = [none]
}
final Sequence<String> protocols = optionMap.get(Options.SSL_ENABLED_PROTOCOLS);
if (protocols != null) {
final Set<String> supported = new HashSet<String>(Arrays.asList(engine.getSupportedProtocols()));
final List<String> finalList = new ArrayList<String>();
for (String name : protocols) {
if (supported.contains(name)) {
finalList.add(name); // depends on control dependency: [if], data = [none]
}
}
engine.setEnabledProtocols(finalList.toArray(new String[finalList.size()])); // depends on control dependency: [if], data = [none]
}
return engine;
} } |
public class class_name {
@Override
public EClass getIfcSwitchingDevice() {
if (ifcSwitchingDeviceEClass == null) {
ifcSwitchingDeviceEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI)
.getEClassifiers().get(689);
}
return ifcSwitchingDeviceEClass;
} } | public class class_name {
@Override
public EClass getIfcSwitchingDevice() {
if (ifcSwitchingDeviceEClass == null) {
ifcSwitchingDeviceEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI)
.getEClassifiers().get(689);
// depends on control dependency: [if], data = [none]
}
return ifcSwitchingDeviceEClass;
} } |
public class class_name {
public double getDistance(Coordinate coordinate) {
double distance = Double.MAX_VALUE;
if (!isEmpty()) {
for (LinearRing interiorRing : interiorRings) {
double d = interiorRing.getDistance(coordinate);
if (d < distance) {
distance = d;
}
}
double d = exteriorRing.getDistance(coordinate);
if (d < distance) {
distance = d;
}
}
return distance;
} } | public class class_name {
public double getDistance(Coordinate coordinate) {
double distance = Double.MAX_VALUE;
if (!isEmpty()) {
for (LinearRing interiorRing : interiorRings) {
double d = interiorRing.getDistance(coordinate);
if (d < distance) {
distance = d; // depends on control dependency: [if], data = [none]
}
}
double d = exteriorRing.getDistance(coordinate);
if (d < distance) {
distance = d; // depends on control dependency: [if], data = [none]
}
}
return distance;
} } |
public class class_name {
@SuppressWarnings("unused")
public void setHighlightedDays(Calendar[] highlightedDays) {
for (Calendar highlightedDay : highlightedDays) {
this.highlightedDays.add(Utils.trimToMidnight((Calendar) highlightedDay.clone()));
}
if (mDayPickerView != null) mDayPickerView.onChange();
} } | public class class_name {
@SuppressWarnings("unused")
public void setHighlightedDays(Calendar[] highlightedDays) {
for (Calendar highlightedDay : highlightedDays) {
this.highlightedDays.add(Utils.trimToMidnight((Calendar) highlightedDay.clone())); // depends on control dependency: [for], data = [highlightedDay]
}
if (mDayPickerView != null) mDayPickerView.onChange();
} } |
public class class_name {
private static int classPriority(Class<?> o1) {
Priority p = o1.getAnnotation(Priority.class);
if(p == null) {
Class<?> pa = o1.getDeclaringClass();
p = (pa != null) ? pa.getAnnotation(Priority.class) : null;
}
return p != null ? p.value() : Priority.DEFAULT;
} } | public class class_name {
private static int classPriority(Class<?> o1) {
Priority p = o1.getAnnotation(Priority.class);
if(p == null) {
Class<?> pa = o1.getDeclaringClass();
p = (pa != null) ? pa.getAnnotation(Priority.class) : null; // depends on control dependency: [if], data = [none]
}
return p != null ? p.value() : Priority.DEFAULT;
} } |
public class class_name {
public static Double toDouble(Number self) {
// Conversions in which all decimal digits are known to be good.
if ((self instanceof Double)
|| (self instanceof Long)
|| (self instanceof Integer)
|| (self instanceof Short)
|| (self instanceof Byte))
{
return self.doubleValue();
}
// Chances are this is a Float or a Big.
// With Float we're extending binary precision and that gets ugly in decimal.
// If we used Float.doubleValue() on 0.1f we get 0.10000000149011612.
// Note that this is different than casting '(double) 0.1f' which will do the
// binary extension just like in Java.
// With Bigs and other unknowns, this is likely to be the same.
return Double.valueOf(self.toString());
} } | public class class_name {
public static Double toDouble(Number self) {
// Conversions in which all decimal digits are known to be good.
if ((self instanceof Double)
|| (self instanceof Long)
|| (self instanceof Integer)
|| (self instanceof Short)
|| (self instanceof Byte))
{
return self.doubleValue(); // depends on control dependency: [if], data = [none]
}
// Chances are this is a Float or a Big.
// With Float we're extending binary precision and that gets ugly in decimal.
// If we used Float.doubleValue() on 0.1f we get 0.10000000149011612.
// Note that this is different than casting '(double) 0.1f' which will do the
// binary extension just like in Java.
// With Bigs and other unknowns, this is likely to be the same.
return Double.valueOf(self.toString());
} } |
public class class_name {
public static void init(com.typesafe.config.Config conf) {
try {
config = ConfigFactory.load().getConfig(PARA);
if (conf != null) {
config = conf.withFallback(config);
}
configMap = new HashMap<>();
for (Map.Entry<String, ConfigValue> con : config.entrySet()) {
if (con.getValue().valueType() != ConfigValueType.LIST) {
configMap.put(con.getKey(), config.getString(con.getKey()));
}
}
} catch (Exception ex) {
logger.warn("Para configuration file 'application.(conf|json|properties)' is missing from classpath.");
config = com.typesafe.config.ConfigFactory.empty();
}
} } | public class class_name {
public static void init(com.typesafe.config.Config conf) {
try {
config = ConfigFactory.load().getConfig(PARA); // depends on control dependency: [try], data = [none]
if (conf != null) {
config = conf.withFallback(config); // depends on control dependency: [if], data = [(conf]
}
configMap = new HashMap<>(); // depends on control dependency: [try], data = [none]
for (Map.Entry<String, ConfigValue> con : config.entrySet()) {
if (con.getValue().valueType() != ConfigValueType.LIST) {
configMap.put(con.getKey(), config.getString(con.getKey())); // depends on control dependency: [if], data = [none]
}
}
} catch (Exception ex) {
logger.warn("Para configuration file 'application.(conf|json|properties)' is missing from classpath.");
config = com.typesafe.config.ConfigFactory.empty();
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public static void injectManagedObjectContextFields(Object o,
AbstractResourceInfo cri,
Message m) {
for (Field f : cri.getContextFields()) {
// if (f.getType() == Application.class && cri.isSingleton()) {
// continue;
// }
Object value = JAXRSUtils.createContextValue(m, f.getGenericType(), f.getType());
InjectionUtils.injectManagedObjectContextField(cri, f, o, value);
}
} } | public class class_name {
public static void injectManagedObjectContextFields(Object o,
AbstractResourceInfo cri,
Message m) {
for (Field f : cri.getContextFields()) {
// if (f.getType() == Application.class && cri.isSingleton()) {
// continue;
// }
Object value = JAXRSUtils.createContextValue(m, f.getGenericType(), f.getType());
InjectionUtils.injectManagedObjectContextField(cri, f, o, value); // depends on control dependency: [for], data = [f]
}
} } |
public class class_name {
public String toRFC1779String(Map<String, String> oidMap) {
if (assertion.length == 1) {
return assertion[0].toRFC1779String(oidMap);
}
StringBuilder sb = new StringBuilder();
for (int i = 0; i < assertion.length; i++) {
if (i != 0) {
sb.append(" + ");
}
sb.append(assertion[i].toRFC1779String(oidMap));
}
return sb.toString();
} } | public class class_name {
public String toRFC1779String(Map<String, String> oidMap) {
if (assertion.length == 1) {
return assertion[0].toRFC1779String(oidMap); // depends on control dependency: [if], data = [none]
}
StringBuilder sb = new StringBuilder();
for (int i = 0; i < assertion.length; i++) {
if (i != 0) {
sb.append(" + "); // depends on control dependency: [if], data = [none]
}
sb.append(assertion[i].toRFC1779String(oidMap)); // depends on control dependency: [for], data = [i]
}
return sb.toString();
} } |
public class class_name {
private JSONObject listIndexesOfflineSync() throws AlgoliaException {
try {
final String rootDataPath = getRootDataDir().getAbsolutePath();
final File appDir = getAppDir();
final File[] directories = appDir.listFiles(new FileFilter() {
@Override
public boolean accept(File pathname) {
return pathname.isDirectory();
}
});
JSONObject response = new JSONObject();
JSONArray items = new JSONArray();
if (directories != null) {
for (File directory : directories) {
final String name = directory.getName();
if (hasOfflineData(name)) {
items.put(new JSONObject()
.put("name", name)
);
// TODO: Do we need other data as in the online API?
}
}
}
response.put("items", items);
return response;
} catch (JSONException e) {
throw new RuntimeException(e); // should never happen
}
} } | public class class_name {
private JSONObject listIndexesOfflineSync() throws AlgoliaException {
try {
final String rootDataPath = getRootDataDir().getAbsolutePath();
final File appDir = getAppDir();
final File[] directories = appDir.listFiles(new FileFilter() {
@Override
public boolean accept(File pathname) {
return pathname.isDirectory();
}
});
JSONObject response = new JSONObject();
JSONArray items = new JSONArray();
if (directories != null) {
for (File directory : directories) {
final String name = directory.getName();
if (hasOfflineData(name)) {
items.put(new JSONObject()
.put("name", name)
); // depends on control dependency: [if], data = [none]
// TODO: Do we need other data as in the online API?
}
}
}
response.put("items", items);
return response;
} catch (JSONException e) {
throw new RuntimeException(e); // should never happen
}
} } |
public class class_name {
public void setFailures(java.util.Collection<LayerFailure> failures) {
if (failures == null) {
this.failures = null;
return;
}
this.failures = new java.util.ArrayList<LayerFailure>(failures);
} } | public class class_name {
public void setFailures(java.util.Collection<LayerFailure> failures) {
if (failures == null) {
this.failures = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.failures = new java.util.ArrayList<LayerFailure>(failures);
} } |
public class class_name {
@Override
public void update(EventBean[] newEvents, EventBean[] oldEvents) {
if (newEvents == null) {
return;
}
for (EventBean newEvent : newEvents) {
List<Object> tuple = new ArrayList<>();
String eventType;
if (outputTypes.containsKey(newEvent.getEventType().getName())) {
eventType = newEvent.getEventType().getName();
for (String field : outputTypes.get(newEvent.getEventType().getName())) {
if (newEvent.get(field) != null) {
tuple.add(newEvent.get(field));
}
}
} else {
eventType = "default";
for (String field : newEvent.getEventType().getPropertyNames()) {
tuple.add(newEvent.get(field));
}
}
collector.emit(eventType, tuple);
}
} } | public class class_name {
@Override
public void update(EventBean[] newEvents, EventBean[] oldEvents) {
if (newEvents == null) {
return; // depends on control dependency: [if], data = [none]
}
for (EventBean newEvent : newEvents) {
List<Object> tuple = new ArrayList<>();
String eventType;
if (outputTypes.containsKey(newEvent.getEventType().getName())) {
eventType = newEvent.getEventType().getName(); // depends on control dependency: [if], data = [none]
for (String field : outputTypes.get(newEvent.getEventType().getName())) {
if (newEvent.get(field) != null) {
tuple.add(newEvent.get(field)); // depends on control dependency: [if], data = [(newEvent.get(field)]
}
}
} else {
eventType = "default"; // depends on control dependency: [if], data = [none]
for (String field : newEvent.getEventType().getPropertyNames()) {
tuple.add(newEvent.get(field)); // depends on control dependency: [for], data = [field]
}
}
collector.emit(eventType, tuple); // depends on control dependency: [for], data = [none]
}
} } |
public class class_name {
@Override
public void clear() {
if (this.nNorthWest != null) {
final N child = this.nNorthWest;
setFirstChild(null);
child.clear();
}
if (this.nNorthEast != null) {
final N child = this.nNorthEast;
setSecondChild(null);
child.clear();
}
if (this.nSouthWest != null) {
final N child = this.nSouthWest;
setThirdChild(null);
child.clear();
}
if (this.nSouthEast != null) {
final N child = this.nSouthEast;
setFourthChild(null);
child.clear();
}
removeAllUserData();
} } | public class class_name {
@Override
public void clear() {
if (this.nNorthWest != null) {
final N child = this.nNorthWest;
setFirstChild(null); // depends on control dependency: [if], data = [null)]
child.clear(); // depends on control dependency: [if], data = [none]
}
if (this.nNorthEast != null) {
final N child = this.nNorthEast;
setSecondChild(null); // depends on control dependency: [if], data = [null)]
child.clear(); // depends on control dependency: [if], data = [none]
}
if (this.nSouthWest != null) {
final N child = this.nSouthWest;
setThirdChild(null); // depends on control dependency: [if], data = [null)]
child.clear(); // depends on control dependency: [if], data = [none]
}
if (this.nSouthEast != null) {
final N child = this.nSouthEast;
setFourthChild(null); // depends on control dependency: [if], data = [null)]
child.clear(); // depends on control dependency: [if], data = [none]
}
removeAllUserData();
} } |
public class class_name {
public static int intersectLineSegmentAab(double p0X, double p0Y, double p0Z, double p1X, double p1Y, double p1Z,
double minX, double minY, double minZ, double maxX, double maxY, double maxZ, Vector2d result) {
double dirX = p1X - p0X, dirY = p1Y - p0Y, dirZ = p1Z - p0Z;
double invDirX = 1.0 / dirX, invDirY = 1.0 / dirY, invDirZ = 1.0 / dirZ;
double tNear, tFar, tymin, tymax, tzmin, tzmax;
if (invDirX >= 0.0) {
tNear = (minX - p0X) * invDirX;
tFar = (maxX - p0X) * invDirX;
} else {
tNear = (maxX - p0X) * invDirX;
tFar = (minX - p0X) * invDirX;
}
if (invDirY >= 0.0) {
tymin = (minY - p0Y) * invDirY;
tymax = (maxY - p0Y) * invDirY;
} else {
tymin = (maxY - p0Y) * invDirY;
tymax = (minY - p0Y) * invDirY;
}
if (tNear > tymax || tymin > tFar)
return OUTSIDE;
if (invDirZ >= 0.0) {
tzmin = (minZ - p0Z) * invDirZ;
tzmax = (maxZ - p0Z) * invDirZ;
} else {
tzmin = (maxZ - p0Z) * invDirZ;
tzmax = (minZ - p0Z) * invDirZ;
}
if (tNear > tzmax || tzmin > tFar)
return OUTSIDE;
tNear = tymin > tNear || Double.isNaN(tNear) ? tymin : tNear;
tFar = tymax < tFar || Double.isNaN(tFar) ? tymax : tFar;
tNear = tzmin > tNear ? tzmin : tNear;
tFar = tzmax < tFar ? tzmax : tFar;
int type = OUTSIDE;
if (tNear < tFar && tNear <= 1.0 && tFar >= 0.0) {
if (tNear > 0.0 && tFar > 1.0) {
tFar = tNear;
type = ONE_INTERSECTION;
} else if (tNear < 0.0 && tFar < 1.0) {
tNear = tFar;
type = ONE_INTERSECTION;
} else if (tNear < 0.0 && tFar > 1.0) {
type = INSIDE;
} else {
type = TWO_INTERSECTION;
}
result.x = tNear;
result.y = tFar;
}
return type;
} } | public class class_name {
public static int intersectLineSegmentAab(double p0X, double p0Y, double p0Z, double p1X, double p1Y, double p1Z,
double minX, double minY, double minZ, double maxX, double maxY, double maxZ, Vector2d result) {
double dirX = p1X - p0X, dirY = p1Y - p0Y, dirZ = p1Z - p0Z;
double invDirX = 1.0 / dirX, invDirY = 1.0 / dirY, invDirZ = 1.0 / dirZ;
double tNear, tFar, tymin, tymax, tzmin, tzmax;
if (invDirX >= 0.0) {
tNear = (minX - p0X) * invDirX; // depends on control dependency: [if], data = [none]
tFar = (maxX - p0X) * invDirX; // depends on control dependency: [if], data = [none]
} else {
tNear = (maxX - p0X) * invDirX; // depends on control dependency: [if], data = [none]
tFar = (minX - p0X) * invDirX; // depends on control dependency: [if], data = [none]
}
if (invDirY >= 0.0) {
tymin = (minY - p0Y) * invDirY; // depends on control dependency: [if], data = [none]
tymax = (maxY - p0Y) * invDirY; // depends on control dependency: [if], data = [none]
} else {
tymin = (maxY - p0Y) * invDirY; // depends on control dependency: [if], data = [none]
tymax = (minY - p0Y) * invDirY; // depends on control dependency: [if], data = [none]
}
if (tNear > tymax || tymin > tFar)
return OUTSIDE;
if (invDirZ >= 0.0) {
tzmin = (minZ - p0Z) * invDirZ; // depends on control dependency: [if], data = [none]
tzmax = (maxZ - p0Z) * invDirZ; // depends on control dependency: [if], data = [none]
} else {
tzmin = (maxZ - p0Z) * invDirZ; // depends on control dependency: [if], data = [none]
tzmax = (minZ - p0Z) * invDirZ; // depends on control dependency: [if], data = [none]
}
if (tNear > tzmax || tzmin > tFar)
return OUTSIDE;
tNear = tymin > tNear || Double.isNaN(tNear) ? tymin : tNear;
tFar = tymax < tFar || Double.isNaN(tFar) ? tymax : tFar;
tNear = tzmin > tNear ? tzmin : tNear;
tFar = tzmax < tFar ? tzmax : tFar;
int type = OUTSIDE;
if (tNear < tFar && tNear <= 1.0 && tFar >= 0.0) {
if (tNear > 0.0 && tFar > 1.0) {
tFar = tNear; // depends on control dependency: [if], data = [none]
type = ONE_INTERSECTION; // depends on control dependency: [if], data = [none]
} else if (tNear < 0.0 && tFar < 1.0) {
tNear = tFar; // depends on control dependency: [if], data = [none]
type = ONE_INTERSECTION; // depends on control dependency: [if], data = [none]
} else if (tNear < 0.0 && tFar > 1.0) {
type = INSIDE; // depends on control dependency: [if], data = [none]
} else {
type = TWO_INTERSECTION; // depends on control dependency: [if], data = [none]
}
result.x = tNear; // depends on control dependency: [if], data = [none]
result.y = tFar; // depends on control dependency: [if], data = [none]
}
return type;
} } |
public class class_name {
public double[][] getArray()
{
double[][] result = new double[getM()][];
for ( int m = 0; m < getM(); m++ )
{
result[m] = new double[ getN() ];
for ( int n = 0; n < getN(); n++ )
{
result[m][n] = getReal(m,n);
}
}
return result;
} } | public class class_name {
public double[][] getArray()
{
double[][] result = new double[getM()][];
for ( int m = 0; m < getM(); m++ )
{
result[m] = new double[ getN() ]; // depends on control dependency: [for], data = [m]
for ( int n = 0; n < getN(); n++ )
{
result[m][n] = getReal(m,n); // depends on control dependency: [for], data = [n]
}
}
return result;
} } |
public class class_name {
public static String getCoalesceColumnNames(String columnOrColumnList) {
if (Strings.isNullOrEmpty(columnOrColumnList)) {
return null;
}
if (columnOrColumnList.contains(",")) {
return "COALESCE(" + columnOrColumnList + ")";
}
return columnOrColumnList;
} } | public class class_name {
public static String getCoalesceColumnNames(String columnOrColumnList) {
if (Strings.isNullOrEmpty(columnOrColumnList)) {
return null; // depends on control dependency: [if], data = [none]
}
if (columnOrColumnList.contains(",")) {
return "COALESCE(" + columnOrColumnList + ")"; // depends on control dependency: [if], data = [none]
}
return columnOrColumnList;
} } |
public class class_name {
public static boolean isFunctionalInterface(JvmGenericType type, IActionPrototypeProvider sarlSignatureProvider) {
if (type != null && type.isInterface()) {
final Map<ActionPrototype, JvmOperation> operations = new HashMap<>();
populateInterfaceElements(type, operations, null, sarlSignatureProvider);
if (operations.size() == 1) {
final JvmOperation op = operations.values().iterator().next();
return !op.isStatic() && !op.isDefault();
}
}
return false;
} } | public class class_name {
public static boolean isFunctionalInterface(JvmGenericType type, IActionPrototypeProvider sarlSignatureProvider) {
if (type != null && type.isInterface()) {
final Map<ActionPrototype, JvmOperation> operations = new HashMap<>();
populateInterfaceElements(type, operations, null, sarlSignatureProvider); // depends on control dependency: [if], data = [(type]
if (operations.size() == 1) {
final JvmOperation op = operations.values().iterator().next();
return !op.isStatic() && !op.isDefault(); // depends on control dependency: [if], data = [none]
}
}
return false;
} } |
public class class_name {
@Override
public int compareTo(ComparableMethod rhs) {
if (rhs instanceof MethodDescriptor) {
return FieldOrMethodDescriptor.compareTo(this, (MethodDescriptor) rhs);
}
if (rhs instanceof XMethod) {
return XFactory.compare((XMethod) this, (XMethod) rhs);
}
throw new ClassCastException("Can't compare a " + this.getClass().getName() + " to a " + rhs.getClass().getName());
} } | public class class_name {
@Override
public int compareTo(ComparableMethod rhs) {
if (rhs instanceof MethodDescriptor) {
return FieldOrMethodDescriptor.compareTo(this, (MethodDescriptor) rhs); // depends on control dependency: [if], data = [none]
}
if (rhs instanceof XMethod) {
return XFactory.compare((XMethod) this, (XMethod) rhs); // depends on control dependency: [if], data = [none]
}
throw new ClassCastException("Can't compare a " + this.getClass().getName() + " to a " + rhs.getClass().getName());
} } |
public class class_name {
public List<JAXBElement<Object>> get_GenericApplicationPropertyOfVegetationObject() {
if (_GenericApplicationPropertyOfVegetationObject == null) {
_GenericApplicationPropertyOfVegetationObject = new ArrayList<JAXBElement<Object>>();
}
return this._GenericApplicationPropertyOfVegetationObject;
} } | public class class_name {
public List<JAXBElement<Object>> get_GenericApplicationPropertyOfVegetationObject() {
if (_GenericApplicationPropertyOfVegetationObject == null) {
_GenericApplicationPropertyOfVegetationObject = new ArrayList<JAXBElement<Object>>(); // depends on control dependency: [if], data = [none]
}
return this._GenericApplicationPropertyOfVegetationObject;
} } |
public class class_name {
public CopyProductRequest withSourceProvisioningArtifactIdentifiers(java.util.Map<String, String>... sourceProvisioningArtifactIdentifiers) {
if (this.sourceProvisioningArtifactIdentifiers == null) {
setSourceProvisioningArtifactIdentifiers(new java.util.ArrayList<java.util.Map<String, String>>(sourceProvisioningArtifactIdentifiers.length));
}
for (java.util.Map<String, String> ele : sourceProvisioningArtifactIdentifiers) {
this.sourceProvisioningArtifactIdentifiers.add(ele);
}
return this;
} } | public class class_name {
public CopyProductRequest withSourceProvisioningArtifactIdentifiers(java.util.Map<String, String>... sourceProvisioningArtifactIdentifiers) {
if (this.sourceProvisioningArtifactIdentifiers == null) {
setSourceProvisioningArtifactIdentifiers(new java.util.ArrayList<java.util.Map<String, String>>(sourceProvisioningArtifactIdentifiers.length)); // depends on control dependency: [if], data = [none]
}
for (java.util.Map<String, String> ele : sourceProvisioningArtifactIdentifiers) {
this.sourceProvisioningArtifactIdentifiers.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} } |
public class class_name {
public static void traceTransaction(TraceComponent callersTrace, String action, Object transaction, int commsId, int commsFlags)
{
if (light_tc.isDebugEnabled() || callersTrace.isDebugEnabled()) {
// Build the trace string
String traceText = action + ": " + transaction +
" CommsId:" + commsId + " CommsFlags:" + commsFlags;
// Trace using the correct trace group
if (light_tc.isDebugEnabled()) {
SibTr.debug(light_tc, traceText);
}
else {
SibTr.debug(callersTrace, traceText);
}
}
} } | public class class_name {
public static void traceTransaction(TraceComponent callersTrace, String action, Object transaction, int commsId, int commsFlags)
{
if (light_tc.isDebugEnabled() || callersTrace.isDebugEnabled()) {
// Build the trace string
String traceText = action + ": " + transaction +
" CommsId:" + commsId + " CommsFlags:" + commsFlags;
// Trace using the correct trace group
if (light_tc.isDebugEnabled()) {
SibTr.debug(light_tc, traceText); // depends on control dependency: [if], data = [none]
}
else {
SibTr.debug(callersTrace, traceText); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
public void buildExceptionSummary(XMLNode node, Content packageSummaryContentTree) {
String exceptionTableSummary =
configuration.getText("doclet.Member_Table_Summary",
configuration.getText("doclet.Exception_Summary"),
configuration.getText("doclet.exceptions"));
String[] exceptionTableHeader = new String[] {
configuration.getText("doclet.Exception"),
configuration.getText("doclet.Description")
};
ClassDoc[] exceptions = pkg.exceptions();
if (exceptions.length > 0) {
profileWriter.addClassesSummary(
exceptions,
configuration.getText("doclet.Exception_Summary"),
exceptionTableSummary, exceptionTableHeader, packageSummaryContentTree);
}
} } | public class class_name {
public void buildExceptionSummary(XMLNode node, Content packageSummaryContentTree) {
String exceptionTableSummary =
configuration.getText("doclet.Member_Table_Summary",
configuration.getText("doclet.Exception_Summary"),
configuration.getText("doclet.exceptions"));
String[] exceptionTableHeader = new String[] {
configuration.getText("doclet.Exception"),
configuration.getText("doclet.Description")
};
ClassDoc[] exceptions = pkg.exceptions();
if (exceptions.length > 0) {
profileWriter.addClassesSummary(
exceptions,
configuration.getText("doclet.Exception_Summary"),
exceptionTableSummary, exceptionTableHeader, packageSummaryContentTree); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
protected static CmsFile readFile(CmsObject cms, CmsUUID structureId, String version) throws CmsException {
if (Integer.parseInt(version) == CmsHistoryResourceHandler.PROJECT_OFFLINE_VERSION) {
// offline
CmsResource resource = cms.readResource(structureId, CmsResourceFilter.IGNORE_EXPIRATION);
return cms.readFile(resource);
} else {
int ver = Integer.parseInt(version);
if (ver < 0) {
// online
CmsProject project = cms.getRequestContext().getCurrentProject();
try {
cms.getRequestContext().setCurrentProject(cms.readProject(CmsProject.ONLINE_PROJECT_ID));
CmsResource resource = cms.readResource(structureId, CmsResourceFilter.IGNORE_EXPIRATION);
return cms.readFile(resource);
} finally {
cms.getRequestContext().setCurrentProject(project);
}
}
// backup
return cms.readFile((CmsHistoryFile)cms.readResource(structureId, ver));
}
} } | public class class_name {
protected static CmsFile readFile(CmsObject cms, CmsUUID structureId, String version) throws CmsException {
if (Integer.parseInt(version) == CmsHistoryResourceHandler.PROJECT_OFFLINE_VERSION) {
// offline
CmsResource resource = cms.readResource(structureId, CmsResourceFilter.IGNORE_EXPIRATION);
return cms.readFile(resource);
} else {
int ver = Integer.parseInt(version);
if (ver < 0) {
// online
CmsProject project = cms.getRequestContext().getCurrentProject();
try {
cms.getRequestContext().setCurrentProject(cms.readProject(CmsProject.ONLINE_PROJECT_ID)); // depends on control dependency: [try], data = [none]
CmsResource resource = cms.readResource(structureId, CmsResourceFilter.IGNORE_EXPIRATION);
return cms.readFile(resource); // depends on control dependency: [try], data = [none]
} finally {
cms.getRequestContext().setCurrentProject(project);
}
}
// backup
return cms.readFile((CmsHistoryFile)cms.readResource(structureId, ver));
}
} } |
public class class_name {
static void loadHadoopClustersProps(String filename) {
// read the property file
// populate the map
Properties prop = new Properties();
if (StringUtils.isBlank(filename)) {
filename = Constants.HRAVEN_CLUSTER_PROPERTIES_FILENAME;
}
try {
//TODO : property file to be moved out from resources into config dir
InputStream inp = Cluster.class.getResourceAsStream("/" + filename);
if (inp == null) {
LOG.error(filename
+ " for mapping clusters to cluster identifiers in hRaven does not exist");
return;
}
prop.load(inp);
Set<String> hostnames = prop.stringPropertyNames();
for (String h : hostnames) {
CLUSTERS_BY_HOST.put(h, prop.getProperty(h));
}
} catch (IOException e) {
// An ExceptionInInitializerError will be thrown to indicate that an
// exception occurred during evaluation of a static initializer or the
// initializer for a static variable.
throw new ExceptionInInitializerError(" Could not load properties file " + filename
+ " for mapping clusters to cluster identifiers in hRaven");
}
} } | public class class_name {
static void loadHadoopClustersProps(String filename) {
// read the property file
// populate the map
Properties prop = new Properties();
if (StringUtils.isBlank(filename)) {
filename = Constants.HRAVEN_CLUSTER_PROPERTIES_FILENAME; // depends on control dependency: [if], data = [none]
}
try {
//TODO : property file to be moved out from resources into config dir
InputStream inp = Cluster.class.getResourceAsStream("/" + filename);
if (inp == null) {
LOG.error(filename
+ " for mapping clusters to cluster identifiers in hRaven does not exist"); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
prop.load(inp); // depends on control dependency: [try], data = [none]
Set<String> hostnames = prop.stringPropertyNames();
for (String h : hostnames) {
CLUSTERS_BY_HOST.put(h, prop.getProperty(h)); // depends on control dependency: [for], data = [h]
}
} catch (IOException e) {
// An ExceptionInInitializerError will be thrown to indicate that an
// exception occurred during evaluation of a static initializer or the
// initializer for a static variable.
throw new ExceptionInInitializerError(" Could not load properties file " + filename
+ " for mapping clusters to cluster identifiers in hRaven");
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public void push(String key, long time) {
if (key.startsWith("CB_TIMER")) {
return;
}
times.put(key, time);
} } | public class class_name {
public void push(String key, long time) {
if (key.startsWith("CB_TIMER")) {
return; // depends on control dependency: [if], data = [none]
}
times.put(key, time);
} } |
public class class_name {
public static ArrayJS create(Collection<?> objects, StringifierFactory stringifierFactory) {
if (objects == null) {
return null;
}
ArrayJS arrayJS = new ArrayJS(objects.size());
for (Object object : objects) {
arrayJS.addElement(ObjectJS.create(object, stringifierFactory));
}
return arrayJS;
} } | public class class_name {
public static ArrayJS create(Collection<?> objects, StringifierFactory stringifierFactory) {
if (objects == null) {
return null;
// depends on control dependency: [if], data = [none]
}
ArrayJS arrayJS = new ArrayJS(objects.size());
for (Object object : objects) {
arrayJS.addElement(ObjectJS.create(object, stringifierFactory));
// depends on control dependency: [for], data = [object]
}
return arrayJS;
} } |
public class class_name {
private void eval( CssFormatter formatter ) {
try {
switch( super.toString().toLowerCase() ) {
case "": //parenthesis
if( parameters.size() > 1 ) {
throw ((LessObject)get( 0 )).createException( "Unrecognized input" );
}
evalParam( 0, formatter );
return;
case "percentage":
type = PERCENT;
doubleValue = getDouble( 0, formatter ) * 100;
return;
case "convert":
type = NUMBER;
String unit = get( 1 ).stringValue( formatter );
Expression param = get( 0 );
doubleValue = param.doubleValue( formatter ) * Operation.unitFactor( param.unit( formatter ), unit, false );
return;
case "abs":
type = getNumberDataType( formatter );
doubleValue = Math.abs( getDouble( 0, formatter ) );
return;
case "ceil":
type = getNumberDataType( formatter );
doubleValue = Math.ceil( getDouble( 0, formatter ) );
return;
case "floor":
type = getNumberDataType( formatter );
doubleValue = Math.floor( getDouble( 0, formatter ) );
return;
case "mod":
type = NUMBER;
doubleValue = getDouble( 0, formatter ) % getDouble( 1, formatter );
return;
case "pi":
type = NUMBER;
doubleValue = Math.PI;
return;
case "round":
type = getNumberDataType( formatter );
int decimalPlaces = getInt( 1, 0, formatter );
doubleValue = getDouble( 0, formatter );
for( int i = 0; i < decimalPlaces; i++ ) {
doubleValue *= 10;
}
doubleValue = Math.round( doubleValue );
for( int i = 0; i < decimalPlaces; i++ ) {
doubleValue /= 10;
}
return;
case "min":
type = NUMBER;
doubleValue = get( 0 ).doubleValue( formatter );
unit = unit( formatter );
for( int i = 1; i < parameters.size(); i++ ) {
param = parameters.get( i );
doubleValue = Math.min( doubleValue, param.doubleValue( formatter ) / Operation.unitFactor( unit, param.unit( formatter ), true ) );
}
return;
case "max":
type = NUMBER;
doubleValue = get( 0 ).doubleValue( formatter );
unit = unit( formatter );
for( int i = 1; i < parameters.size(); i++ ) {
param = parameters.get( i );
doubleValue = Math.max( doubleValue, param.doubleValue( formatter ) / Operation.unitFactor( unit, param.unit( formatter ), true ) );
}
return;
case "sqrt":
type = NUMBER;
doubleValue = Math.sqrt( getDouble( 0, formatter ) );
return;
case "pow":
type = NUMBER;
doubleValue = Math.pow( getDouble( 0, formatter ), getDouble( 1, formatter ) );
return;
case "sin":
type = NUMBER;
doubleValue = Math.sin( getRadians( formatter ) );
return;
case "cos":
type = NUMBER;
doubleValue = Math.cos( getRadians( formatter ) );
return;
case "tan":
type = NUMBER;
doubleValue = Math.tan( getRadians( formatter ) );
return;
case "acos":
type = NUMBER;
doubleValue = Math.acos( getRadians( formatter ) );
return;
case "asin":
type = NUMBER;
doubleValue = Math.asin( getRadians( formatter ) );
return;
case "atan":
type = NUMBER;
doubleValue = Math.atan( getRadians( formatter ) );
return;
case "increment":
type = NUMBER;
doubleValue = getDouble( 0, formatter ) + 1;
return;
case "add":
type = NUMBER;
doubleValue = getDouble( 0, formatter ) + getDouble( 1, formatter );
return;
case "length":
type = NUMBER;
doubleValue = getParamList( formatter ).size();
return;
case "extract":
extract( formatter );
return;
case "range":
type = LIST;
return;
case "alpha":
type = NUMBER;
switch( get( 0 ).getDataType( formatter ) ) {
case RGBA:
doubleValue = alpha( getDouble( 0, formatter ) );
break;
case COLOR:
doubleValue = 1;
break;
default:
type = STRING;
}
return;
case "red":
type = NUMBER;
doubleValue = red( getDouble( 0, formatter ) );
return;
case "green":
type = NUMBER;
doubleValue = green( getDouble( 0, formatter ) );
return;
case "blue":
type = NUMBER;
doubleValue = blue( getDouble( 0, formatter ) );
return;
case "rgba":
type = RGBA;
int r = getColorDigit( 0, formatter );
int g = getColorDigit( 1, formatter );
int b = getColorDigit( 2, formatter );
double a = getPercent( 3, formatter );
doubleValue = rgba( r, g, b, a );
return;
case "rgb":
type = COLOR;
r = getColorDigit( 0, formatter );
g = getColorDigit( 1, formatter );
b = getColorDigit( 2, formatter );
doubleValue = rgb( r, g, b );
return;
case "color":
param = get( 0 );
String str = UrlUtils.removeQuote( param.stringValue( formatter ) );
doubleValue = getColor( new ValueExpression( param, str ), formatter );
return;
case "argb":
type = STRING;
return;
case "saturate":
type = COLOR;
HSL hsl = toHSL( getDouble( 0, formatter ) );
hsl.s += getPercent( 1, formatter );
doubleValue = hsla( hsl );
return;
case "desaturate":
type = COLOR;
hsl = toHSL( getDouble( 0, formatter ) );
hsl.s -= getPercent( 1, formatter );
doubleValue = hsla( hsl );
return;
case "greyscale":
type = COLOR;
hsl = toHSL( getDouble( 0, formatter ) );
hsl.s = 0;
doubleValue = hsla( hsl );
return;
case "mix":
double c1 = getColor( 0, formatter );
double c2 = getColor( 1, formatter );
double weight = getPercent( 2, 0.5, formatter );
doubleValue = mix( c1, c2, weight );
return;
case "tint":
c1 = getColor( 0, formatter );
weight = getPercent( 1, 0.5, formatter );
doubleValue = mix( WHITE, c1, weight );
return;
case "shade":
c1 = getColor( 0, formatter );
weight = getPercent( 1, 0.5, formatter );
doubleValue = mix( BLACK, c1, weight );
return;
case "saturation":
type = PERCENT;
hsl = toHSL( getDouble( 0, formatter ) );
doubleValue = hsl.s * 100;
return;
case "hsl":
type = COLOR;
doubleValue = hsla( getDouble( 0, formatter ), getPercent( 1, formatter ), getPercent( 2, formatter ), 1 );
return;
case "hsla":
type = RGBA;
doubleValue = hsla( getDouble( 0, formatter ), getPercent( 1, formatter ), getPercent( 2, formatter ), getPercent( 3, formatter ) );
return;
case "hue":
type = NUMBER;
hsl = toHSL( getDouble( 0, formatter ) );
doubleValue = hsl.h;
return;
case "lightness":
type = PERCENT;
hsl = toHSL( getDouble( 0, formatter ) );
doubleValue = hsl.l * 100;
return;
case "spin":
type = COLOR;
hsl = toHSL( getDouble( 0, formatter ) );
hsl.h += getDouble( 1, formatter );
doubleValue = hsla( hsl );
return;
case "lighten":
hsl = toHSL( getColor( 0, formatter ) );
if (parameters.size() > 2 && "relative".equals( get( 2 ).stringValue( formatter )) ) {
hsl.l += hsl.l * getPercent(1, formatter);
} else {
hsl.l += getPercent(1, formatter);
}
doubleValue = hsla( hsl );
return;
case "darken":
hsl = toHSL( getColor( 0, formatter ) );
if (parameters.size() > 2 && "relative".equals( get( 2 ).stringValue( formatter )) ) {
hsl.l -= hsl.l * getPercent(1, formatter);
} else {
hsl.l -= getPercent(1, formatter);
}
doubleValue = hsla( hsl );
return;
case "fadein":
type = RGBA;
hsl = toHSL( getDouble( 0, formatter ) );
hsl.a += getPercent( 1, formatter );
doubleValue = hsla( hsl );
return;
case "fadeout":
type = RGBA;
hsl = toHSL( getDouble( 0, formatter ) );
hsl.a -= getPercent( 1, formatter );
doubleValue = hsla( hsl );
return;
case "fade":
type = RGBA;
hsl = toHSL( getDouble( 0, formatter ) );
hsl.a = getPercent( 1, formatter );
doubleValue = hsla( hsl );
return;
case "hsv":
type = COLOR;
doubleValue = hsva( getDouble( 0, formatter ), getPercent( 1, formatter ), getPercent( 2, formatter ), 1 );
return;
case "hsva":
type = RGBA;
doubleValue = hsva( getDouble( 0, formatter ), getPercent( 1, formatter ), getPercent( 2, formatter ), getPercent( 3, formatter ) );
return;
case "hsvhue":
doubleValue = toHSV( getColor( 0, formatter ) ).h;
type = NUMBER;
return;
case "hsvsaturation":
doubleValue = toHSV( getColor( 0, formatter ) ).s * 100;
type = PERCENT;
return;
case "hsvvalue":
doubleValue = toHSV( getColor( 0, formatter ) ).v * 100;
type = PERCENT;
return;
case "contrast":
double color = getColor( 0, formatter );
double dark = getDouble( 1, BLACK, formatter );
double light = getDouble( 2, WHITE, formatter );
double threshold = getPercent( 3, 0.43, formatter );
doubleValue = contrast( color, dark, light, threshold );
return;
case "luma":
color = getColor( 0, formatter );
type = PERCENT;
doubleValue = luma( color ) * 100;
return;
case "luminance":
color = getColor( 0, formatter );
type = PERCENT;
doubleValue = luminance( color ) * 100;
return;
case "multiply":
doubleValue = multiply( getColor( 0, formatter ), getColor( 1, formatter ) );
return;
case "screen":
doubleValue = screen( getColor( 0, formatter ), getColor( 1, formatter ) );
return;
case "overlay":
doubleValue = overlay( getColor( 0, formatter ), getColor( 1, formatter ) );
return;
case "softlight":
doubleValue = softlight( getColor( 0, formatter ), getColor( 1, formatter ) );
return;
case "hardlight":
doubleValue = hardlight( getColor( 0, formatter ), getColor( 1, formatter ) );
return;
case "difference":
doubleValue = difference( getColor( 0, formatter ), getColor( 1, formatter ) );
return;
case "exclusion":
doubleValue = exclusion( getColor( 0, formatter ), getColor( 1, formatter ) );
return;
case "average":
doubleValue = average( getColor( 0, formatter ), getColor( 1, formatter ) );
return;
case "negation":
doubleValue = negation( getColor( 0, formatter ), getColor( 1, formatter ) );
return;
case "unit":
type = NUMBER;
doubleValue = getDouble( 0, formatter );
return;
case "iscolor":
type = BOOLEAN;
int type0 = get( 0 ).getDataType( formatter );
booleanValue = type0 == COLOR || type0 == RGBA;
return;
case "isnumber":
type = BOOLEAN;
type0 = get( 0 ).getDataType( formatter );
booleanValue = type0 == NUMBER || type0 == PERCENT;
return;
case "isstring":
type = BOOLEAN;
booleanValue = get( 0 ).getDataType( formatter ) == STRING;
return;
case "iskeyword":
type = BOOLEAN;
param = get( 0 );
if( param.getDataType( formatter ) == STRING ) {
str = param.stringValue( formatter );
booleanValue = str == UrlUtils.removeQuote( str );
} else {
booleanValue = false;
}
return;
case "ispixel":
type = BOOLEAN;
param = get( 0 );
booleanValue = param.unit( formatter ).equals( "px" );
return;
case "isem":
type = BOOLEAN;
param = get( 0 );
booleanValue = param.unit( formatter ).equals( "em" );
return;
case "ispercentage":
type = BOOLEAN;
param = get( 0 );
booleanValue = param.unit( formatter ).equals( "%" );
return;
case "isunit":
type = BOOLEAN;
unit = get( 1 ).stringValue( formatter );
param = get( 0 );
booleanValue = param.unit( formatter ).equals( unit );
return;
case "if":
evalParam( get( 0 ).booleanValue( formatter ) ? 1 : 2, formatter );
return;
case "default":
if( formatter.isGuard() ) {
type = BOOLEAN;
booleanValue = formatter.getGuardDefault();
return;
}
break;
case "-":
type = get( 0 ).getDataType( formatter ) ;
doubleValue = -getDouble( 0, formatter );
return;
case "%":
case "escape":
type = STRING;
return;
}
if( super.toString().startsWith( "-" ) ) {
type = STRING;
return;
}
} catch( ParameterOutOfBoundsException ex ) {
// ignore and continue as CSS function
} catch (RuntimeException ex ) {
throw createException( ex );
}
type = STRING;
return;
} } | public class class_name {
private void eval( CssFormatter formatter ) {
try {
switch( super.toString().toLowerCase() ) {
case "": //parenthesis
if( parameters.size() > 1 ) {
throw ((LessObject)get( 0 )).createException( "Unrecognized input" );
}
evalParam( 0, formatter );
return;
case "percentage":
type = PERCENT;
doubleValue = getDouble( 0, formatter ) * 100;
return;
case "convert":
type = NUMBER;
String unit = get( 1 ).stringValue( formatter );
Expression param = get( 0 );
doubleValue = param.doubleValue( formatter ) * Operation.unitFactor( param.unit( formatter ), unit, false );
return;
case "abs":
type = getNumberDataType( formatter );
doubleValue = Math.abs( getDouble( 0, formatter ) );
return;
case "ceil":
type = getNumberDataType( formatter );
doubleValue = Math.ceil( getDouble( 0, formatter ) );
return;
case "floor":
type = getNumberDataType( formatter );
doubleValue = Math.floor( getDouble( 0, formatter ) );
return;
case "mod":
type = NUMBER;
doubleValue = getDouble( 0, formatter ) % getDouble( 1, formatter );
return;
case "pi":
type = NUMBER;
doubleValue = Math.PI;
return;
case "round":
type = getNumberDataType( formatter );
int decimalPlaces = getInt( 1, 0, formatter );
doubleValue = getDouble( 0, formatter );
for( int i = 0; i < decimalPlaces; i++ ) {
doubleValue *= 10; // depends on control dependency: [for], data = [none]
}
doubleValue = Math.round( doubleValue );
for( int i = 0; i < decimalPlaces; i++ ) {
doubleValue /= 10; // depends on control dependency: [for], data = [none]
}
return;
case "min":
type = NUMBER;
doubleValue = get( 0 ).doubleValue( formatter );
unit = unit( formatter );
for( int i = 1; i < parameters.size(); i++ ) {
param = parameters.get( i ); // depends on control dependency: [for], data = [i]
doubleValue = Math.min( doubleValue, param.doubleValue( formatter ) / Operation.unitFactor( unit, param.unit( formatter ), true ) ); // depends on control dependency: [for], data = [none]
}
return;
case "max":
type = NUMBER;
doubleValue = get( 0 ).doubleValue( formatter );
unit = unit( formatter );
for( int i = 1; i < parameters.size(); i++ ) {
param = parameters.get( i ); // depends on control dependency: [for], data = [i]
doubleValue = Math.max( doubleValue, param.doubleValue( formatter ) / Operation.unitFactor( unit, param.unit( formatter ), true ) ); // depends on control dependency: [for], data = [none]
}
return;
case "sqrt":
type = NUMBER;
doubleValue = Math.sqrt( getDouble( 0, formatter ) );
return;
case "pow":
type = NUMBER;
doubleValue = Math.pow( getDouble( 0, formatter ), getDouble( 1, formatter ) );
return;
case "sin":
type = NUMBER;
doubleValue = Math.sin( getRadians( formatter ) );
return;
case "cos":
type = NUMBER;
doubleValue = Math.cos( getRadians( formatter ) );
return;
case "tan":
type = NUMBER;
doubleValue = Math.tan( getRadians( formatter ) );
return;
case "acos":
type = NUMBER;
doubleValue = Math.acos( getRadians( formatter ) );
return;
case "asin":
type = NUMBER;
doubleValue = Math.asin( getRadians( formatter ) );
return;
case "atan":
type = NUMBER;
doubleValue = Math.atan( getRadians( formatter ) );
return;
case "increment":
type = NUMBER;
doubleValue = getDouble( 0, formatter ) + 1;
return;
case "add":
type = NUMBER;
doubleValue = getDouble( 0, formatter ) + getDouble( 1, formatter );
return;
case "length":
type = NUMBER;
doubleValue = getParamList( formatter ).size();
return;
case "extract":
extract( formatter );
return;
case "range":
type = LIST;
return;
case "alpha":
type = NUMBER;
switch( get( 0 ).getDataType( formatter ) ) {
case RGBA:
doubleValue = alpha( getDouble( 0, formatter ) );
break;
case COLOR:
doubleValue = 1;
break;
default:
type = STRING;
}
return; // depends on control dependency: [try], data = [none]
case "red":
type = NUMBER;
doubleValue = red( getDouble( 0, formatter ) ); // depends on control dependency: [try], data = [none]
return; // depends on control dependency: [try], data = [none]
case "green":
type = NUMBER;
doubleValue = green( getDouble( 0, formatter ) ); // depends on control dependency: [try], data = [none]
return; // depends on control dependency: [try], data = [none]
case "blue":
type = NUMBER;
doubleValue = blue( getDouble( 0, formatter ) ); // depends on control dependency: [try], data = [none]
return; // depends on control dependency: [try], data = [none]
case "rgba":
type = RGBA;
int r = getColorDigit( 0, formatter );
int g = getColorDigit( 1, formatter );
int b = getColorDigit( 2, formatter );
double a = getPercent( 3, formatter );
doubleValue = rgba( r, g, b, a ); // depends on control dependency: [try], data = [none]
return; // depends on control dependency: [try], data = [none]
case "rgb":
type = COLOR;
r = getColorDigit( 0, formatter ); // depends on control dependency: [try], data = [none]
g = getColorDigit( 1, formatter ); // depends on control dependency: [try], data = [none]
b = getColorDigit( 2, formatter ); // depends on control dependency: [try], data = [none]
doubleValue = rgb( r, g, b ); // depends on control dependency: [try], data = [none]
return; // depends on control dependency: [try], data = [none]
case "color":
param = get( 0 );
String str = UrlUtils.removeQuote( param.stringValue( formatter ) );
doubleValue = getColor( new ValueExpression( param, str ), formatter ); // depends on control dependency: [try], data = [none]
return; // depends on control dependency: [try], data = [none]
case "argb":
type = STRING;
return; // depends on control dependency: [try], data = [none]
case "saturate":
type = COLOR;
HSL hsl = toHSL( getDouble( 0, formatter ) );
hsl.s += getPercent( 1, formatter ); // depends on control dependency: [try], data = [none]
doubleValue = hsla( hsl ); // depends on control dependency: [try], data = [none]
return; // depends on control dependency: [try], data = [none]
case "desaturate":
type = COLOR;
hsl = toHSL( getDouble( 0, formatter ) ); // depends on control dependency: [try], data = [none]
hsl.s -= getPercent( 1, formatter ); // depends on control dependency: [try], data = [none]
doubleValue = hsla( hsl ); // depends on control dependency: [try], data = [none]
return; // depends on control dependency: [try], data = [none]
case "greyscale":
type = COLOR;
hsl = toHSL( getDouble( 0, formatter ) ); // depends on control dependency: [try], data = [none]
hsl.s = 0; // depends on control dependency: [try], data = [none]
doubleValue = hsla( hsl ); // depends on control dependency: [try], data = [none]
return; // depends on control dependency: [try], data = [none]
case "mix":
double c1 = getColor( 0, formatter );
double c2 = getColor( 1, formatter );
double weight = getPercent( 2, 0.5, formatter );
doubleValue = mix( c1, c2, weight ); // depends on control dependency: [try], data = [none]
return; // depends on control dependency: [try], data = [none]
case "tint":
c1 = getColor( 0, formatter );
weight = getPercent( 1, 0.5, formatter ); // depends on control dependency: [try], data = [none]
doubleValue = mix( WHITE, c1, weight ); // depends on control dependency: [try], data = [none]
return; // depends on control dependency: [try], data = [none]
case "shade":
c1 = getColor( 0, formatter );
weight = getPercent( 1, 0.5, formatter ); // depends on control dependency: [try], data = [none]
doubleValue = mix( BLACK, c1, weight ); // depends on control dependency: [try], data = [none]
return; // depends on control dependency: [try], data = [none]
case "saturation":
type = PERCENT;
hsl = toHSL( getDouble( 0, formatter ) ); // depends on control dependency: [try], data = [none]
doubleValue = hsl.s * 100; // depends on control dependency: [try], data = [none]
return; // depends on control dependency: [try], data = [none]
case "hsl":
type = COLOR;
doubleValue = hsla( getDouble( 0, formatter ), getPercent( 1, formatter ), getPercent( 2, formatter ), 1 ); // depends on control dependency: [try], data = [none]
return; // depends on control dependency: [try], data = [none]
case "hsla":
type = RGBA;
doubleValue = hsla( getDouble( 0, formatter ), getPercent( 1, formatter ), getPercent( 2, formatter ), getPercent( 3, formatter ) ); // depends on control dependency: [try], data = [none]
return; // depends on control dependency: [try], data = [none]
case "hue":
type = NUMBER;
hsl = toHSL( getDouble( 0, formatter ) ); // depends on control dependency: [try], data = [none]
doubleValue = hsl.h; // depends on control dependency: [try], data = [none]
return; // depends on control dependency: [try], data = [none]
case "lightness":
type = PERCENT;
hsl = toHSL( getDouble( 0, formatter ) ); // depends on control dependency: [try], data = [none]
doubleValue = hsl.l * 100; // depends on control dependency: [try], data = [none]
return; // depends on control dependency: [try], data = [none]
case "spin":
type = COLOR;
hsl = toHSL( getDouble( 0, formatter ) ); // depends on control dependency: [try], data = [none]
hsl.h += getDouble( 1, formatter ); // depends on control dependency: [try], data = [none]
doubleValue = hsla( hsl ); // depends on control dependency: [try], data = [none]
return; // depends on control dependency: [try], data = [none]
case "lighten":
hsl = toHSL( getColor( 0, formatter ) );
if (parameters.size() > 2 && "relative".equals( get( 2 ).stringValue( formatter )) ) {
hsl.l += hsl.l * getPercent(1, formatter); // depends on control dependency: [if], data = [none]
} else {
hsl.l += getPercent(1, formatter); // depends on control dependency: [if], data = [none]
}
doubleValue = hsla( hsl ); // depends on control dependency: [try], data = [none]
return; // depends on control dependency: [try], data = [none]
case "darken":
hsl = toHSL( getColor( 0, formatter ) );
if (parameters.size() > 2 && "relative".equals( get( 2 ).stringValue( formatter )) ) {
hsl.l -= hsl.l * getPercent(1, formatter); // depends on control dependency: [if], data = [none]
} else {
hsl.l -= getPercent(1, formatter); // depends on control dependency: [if], data = [none]
}
doubleValue = hsla( hsl ); // depends on control dependency: [try], data = [none]
return; // depends on control dependency: [try], data = [none]
case "fadein":
type = RGBA;
hsl = toHSL( getDouble( 0, formatter ) ); // depends on control dependency: [try], data = [none]
hsl.a += getPercent( 1, formatter ); // depends on control dependency: [try], data = [none]
doubleValue = hsla( hsl ); // depends on control dependency: [try], data = [none]
return; // depends on control dependency: [try], data = [none]
case "fadeout":
type = RGBA;
hsl = toHSL( getDouble( 0, formatter ) ); // depends on control dependency: [try], data = [none]
hsl.a -= getPercent( 1, formatter ); // depends on control dependency: [try], data = [none]
doubleValue = hsla( hsl ); // depends on control dependency: [try], data = [none]
return; // depends on control dependency: [try], data = [none]
case "fade":
type = RGBA;
hsl = toHSL( getDouble( 0, formatter ) ); // depends on control dependency: [try], data = [none]
hsl.a = getPercent( 1, formatter ); // depends on control dependency: [try], data = [none]
doubleValue = hsla( hsl ); // depends on control dependency: [try], data = [none]
return; // depends on control dependency: [try], data = [none]
case "hsv":
type = COLOR;
doubleValue = hsva( getDouble( 0, formatter ), getPercent( 1, formatter ), getPercent( 2, formatter ), 1 ); // depends on control dependency: [try], data = [none]
return; // depends on control dependency: [try], data = [none]
case "hsva":
type = RGBA;
doubleValue = hsva( getDouble( 0, formatter ), getPercent( 1, formatter ), getPercent( 2, formatter ), getPercent( 3, formatter ) ); // depends on control dependency: [try], data = [none]
return; // depends on control dependency: [try], data = [none]
case "hsvhue":
doubleValue = toHSV( getColor( 0, formatter ) ).h;
type = NUMBER; // depends on control dependency: [try], data = [none]
return; // depends on control dependency: [try], data = [none]
case "hsvsaturation":
doubleValue = toHSV( getColor( 0, formatter ) ).s * 100;
type = PERCENT; // depends on control dependency: [try], data = [none]
return; // depends on control dependency: [try], data = [none]
case "hsvvalue":
doubleValue = toHSV( getColor( 0, formatter ) ).v * 100;
type = PERCENT; // depends on control dependency: [try], data = [none]
return; // depends on control dependency: [try], data = [none]
case "contrast":
double color = getColor( 0, formatter );
double dark = getDouble( 1, BLACK, formatter );
double light = getDouble( 2, WHITE, formatter );
double threshold = getPercent( 3, 0.43, formatter );
doubleValue = contrast( color, dark, light, threshold ); // depends on control dependency: [try], data = [none]
return; // depends on control dependency: [try], data = [none]
case "luma":
color = getColor( 0, formatter );
type = PERCENT; // depends on control dependency: [try], data = [none]
doubleValue = luma( color ) * 100; // depends on control dependency: [try], data = [none]
return; // depends on control dependency: [try], data = [none]
case "luminance":
color = getColor( 0, formatter );
type = PERCENT; // depends on control dependency: [try], data = [none]
doubleValue = luminance( color ) * 100; // depends on control dependency: [try], data = [none]
return; // depends on control dependency: [try], data = [none]
case "multiply":
doubleValue = multiply( getColor( 0, formatter ), getColor( 1, formatter ) );
return; // depends on control dependency: [try], data = [none]
case "screen":
doubleValue = screen( getColor( 0, formatter ), getColor( 1, formatter ) );
return; // depends on control dependency: [try], data = [none]
case "overlay":
doubleValue = overlay( getColor( 0, formatter ), getColor( 1, formatter ) );
return; // depends on control dependency: [try], data = [none]
case "softlight":
doubleValue = softlight( getColor( 0, formatter ), getColor( 1, formatter ) );
return; // depends on control dependency: [try], data = [none]
case "hardlight":
doubleValue = hardlight( getColor( 0, formatter ), getColor( 1, formatter ) );
return; // depends on control dependency: [try], data = [none]
case "difference":
doubleValue = difference( getColor( 0, formatter ), getColor( 1, formatter ) );
return; // depends on control dependency: [try], data = [none]
case "exclusion":
doubleValue = exclusion( getColor( 0, formatter ), getColor( 1, formatter ) );
return; // depends on control dependency: [try], data = [none]
case "average":
doubleValue = average( getColor( 0, formatter ), getColor( 1, formatter ) );
return; // depends on control dependency: [try], data = [none]
case "negation":
doubleValue = negation( getColor( 0, formatter ), getColor( 1, formatter ) );
return; // depends on control dependency: [try], data = [none]
case "unit":
type = NUMBER;
doubleValue = getDouble( 0, formatter ); // depends on control dependency: [try], data = [none]
return; // depends on control dependency: [try], data = [none]
case "iscolor":
type = BOOLEAN;
int type0 = get( 0 ).getDataType( formatter );
booleanValue = type0 == COLOR || type0 == RGBA; // depends on control dependency: [try], data = [none]
return; // depends on control dependency: [try], data = [none]
case "isnumber":
type = BOOLEAN;
type0 = get( 0 ).getDataType( formatter ); // depends on control dependency: [try], data = [none]
booleanValue = type0 == NUMBER || type0 == PERCENT; // depends on control dependency: [try], data = [none]
return; // depends on control dependency: [try], data = [none]
case "isstring":
type = BOOLEAN;
booleanValue = get( 0 ).getDataType( formatter ) == STRING; // depends on control dependency: [try], data = [none]
return; // depends on control dependency: [try], data = [none]
case "iskeyword":
type = BOOLEAN;
param = get( 0 ); // depends on control dependency: [try], data = [none]
if( param.getDataType( formatter ) == STRING ) {
str = param.stringValue( formatter ); // depends on control dependency: [if], data = [none]
booleanValue = str == UrlUtils.removeQuote( str ); // depends on control dependency: [if], data = [none]
} else {
booleanValue = false; // depends on control dependency: [if], data = [none]
}
return; // depends on control dependency: [try], data = [none]
case "ispixel":
type = BOOLEAN;
param = get( 0 ); // depends on control dependency: [try], data = [none]
booleanValue = param.unit( formatter ).equals( "px" ); // depends on control dependency: [try], data = [none]
return; // depends on control dependency: [try], data = [none]
case "isem":
type = BOOLEAN;
param = get( 0 ); // depends on control dependency: [try], data = [none]
booleanValue = param.unit( formatter ).equals( "em" ); // depends on control dependency: [try], data = [none]
return; // depends on control dependency: [try], data = [none]
case "ispercentage":
type = BOOLEAN;
param = get( 0 ); // depends on control dependency: [try], data = [none]
booleanValue = param.unit( formatter ).equals( "%" ); // depends on control dependency: [try], data = [none]
return; // depends on control dependency: [try], data = [none]
case "isunit":
type = BOOLEAN;
unit = get( 1 ).stringValue( formatter ); // depends on control dependency: [try], data = [none]
param = get( 0 ); // depends on control dependency: [try], data = [none]
booleanValue = param.unit( formatter ).equals( unit ); // depends on control dependency: [try], data = [none]
return; // depends on control dependency: [try], data = [none]
case "if":
evalParam( get( 0 ).booleanValue( formatter ) ? 1 : 2, formatter );
return; // depends on control dependency: [try], data = [none]
case "default":
if( formatter.isGuard() ) {
type = BOOLEAN; // depends on control dependency: [if], data = [none]
booleanValue = formatter.getGuardDefault(); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
break;
case "-":
type = get( 0 ).getDataType( formatter ) ; // depends on control dependency: [try], data = [none]
doubleValue = -getDouble( 0, formatter ); // depends on control dependency: [try], data = [none]
return; // depends on control dependency: [try], data = [none]
case "%":
case "escape":
type = STRING; // depends on control dependency: [try], data = [none]
return; // depends on control dependency: [try], data = [none]
}
if( super.toString().startsWith( "-" ) ) {
type = STRING;
return;
}
} catch( ParameterOutOfBoundsException ex ) {
// ignore and continue as CSS function
} catch (RuntimeException ex ) { // depends on control dependency: [catch], data = [none]
throw createException( ex );
} // depends on control dependency: [catch], data = [none]
type = STRING;
return;
} } |
public class class_name {
public ContentInfo findMatch(byte[] bytes) {
if (bytes.length == 0) {
return ContentInfo.EMPTY_INFO;
}
// first do the start byte ones
int index = (0xFF & bytes[0]);
if (index < firstByteEntryLists.length && firstByteEntryLists[index] != null) {
ContentInfo info = findMatch(bytes, firstByteEntryLists[index]);
if (info != null) {
// this seems to be right to return even if only a partial match here
return info;
}
}
return findMatch(bytes, entryList);
} } | public class class_name {
public ContentInfo findMatch(byte[] bytes) {
if (bytes.length == 0) {
return ContentInfo.EMPTY_INFO; // depends on control dependency: [if], data = [none]
}
// first do the start byte ones
int index = (0xFF & bytes[0]);
if (index < firstByteEntryLists.length && firstByteEntryLists[index] != null) {
ContentInfo info = findMatch(bytes, firstByteEntryLists[index]);
if (info != null) {
// this seems to be right to return even if only a partial match here
return info; // depends on control dependency: [if], data = [none]
}
}
return findMatch(bytes, entryList);
} } |
public class class_name {
public Object invoke(Object[] arguments) {
try {
return new MethodInterceptorIterator(arguments).proceed();
} catch (Throwable e) {
throw new TransfuseInjectionException("Error while invoking Method Interceptor", e);
}
} } | public class class_name {
public Object invoke(Object[] arguments) {
try {
return new MethodInterceptorIterator(arguments).proceed(); // depends on control dependency: [try], data = [none]
} catch (Throwable e) {
throw new TransfuseInjectionException("Error while invoking Method Interceptor", e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public Map<String, List<String>> getNodePartition(Map<PartitionEntry, Integer> partition, Integer node) {
Map<String, List<String>> nodePartition = new HashMap<>();
if (partition != null) {
for (Entry<PartitionEntry, Integer> entry : partition.entrySet()) {
if (entry.getValue().equals(node)) {
add(nodePartition, entry.getKey());
}
}
}
return nodePartition;
} } | public class class_name {
public Map<String, List<String>> getNodePartition(Map<PartitionEntry, Integer> partition, Integer node) {
Map<String, List<String>> nodePartition = new HashMap<>();
if (partition != null) {
for (Entry<PartitionEntry, Integer> entry : partition.entrySet()) {
if (entry.getValue().equals(node)) {
add(nodePartition, entry.getKey()); // depends on control dependency: [if], data = [none]
}
}
}
return nodePartition;
} } |
public class class_name {
public void applyAndJournal(Supplier<JournalContext> context, RenameEntry entry) {
try {
applyRename(entry);
context.get().append(JournalEntry.newBuilder().setRename(entry).build());
} catch (Throwable t) {
ProcessUtils.fatalError(LOG, t, "Failed to apply %s", entry);
throw t; // fatalError will usually system.exit
}
} } | public class class_name {
public void applyAndJournal(Supplier<JournalContext> context, RenameEntry entry) {
try {
applyRename(entry); // depends on control dependency: [try], data = [none]
context.get().append(JournalEntry.newBuilder().setRename(entry).build()); // depends on control dependency: [try], data = [none]
} catch (Throwable t) {
ProcessUtils.fatalError(LOG, t, "Failed to apply %s", entry);
throw t; // fatalError will usually system.exit
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
protected FaultDescriptor getFaultDescriptor(Object fault) {
for (int i = 0; i < faultDescriptors.size(); i++) {
if (faultDescriptors.get(i).isValid(fault)) {
return faultDescriptors.get(i);
}
}
return null;
} } | public class class_name {
protected FaultDescriptor getFaultDescriptor(Object fault) {
for (int i = 0; i < faultDescriptors.size(); i++) {
if (faultDescriptors.get(i).isValid(fault)) {
return faultDescriptors.get(i); // depends on control dependency: [if], data = [none]
}
}
return null;
} } |
public class class_name {
@Override
public Properties getJawrBundleMapping() {
final Properties bundleMapping = new Properties();
InputStream is = null;
try {
is = getBundleMappingStream();
if (is != null) {
((Properties) bundleMapping).load(is);
} else {
LOGGER.info("The jawr bundle mapping '" + mappingFileName + "' is not found");
}
} catch (IOException e) {
LOGGER.info("Error while loading the jawr bundle mapping '"
+ JawrConstant.JAWR_JS_MAPPING_PROPERTIES_FILENAME + "'");
} finally {
IOUtils.close(is);
}
return bundleMapping;
} } | public class class_name {
@Override
public Properties getJawrBundleMapping() {
final Properties bundleMapping = new Properties();
InputStream is = null;
try {
is = getBundleMappingStream(); // depends on control dependency: [try], data = [none]
if (is != null) {
((Properties) bundleMapping).load(is); // depends on control dependency: [if], data = [(is]
} else {
LOGGER.info("The jawr bundle mapping '" + mappingFileName + "' is not found"); // depends on control dependency: [if], data = [none]
}
} catch (IOException e) {
LOGGER.info("Error while loading the jawr bundle mapping '"
+ JawrConstant.JAWR_JS_MAPPING_PROPERTIES_FILENAME + "'");
} finally { // depends on control dependency: [catch], data = [none]
IOUtils.close(is);
}
return bundleMapping;
} } |
public class class_name {
public long roundHalfCeiling(long instant) {
long floor = roundFloor(instant);
long ceiling = roundCeiling(instant);
long diffFromFloor = instant - floor;
long diffToCeiling = ceiling - instant;
if (diffToCeiling <= diffFromFloor) {
// Closer to the ceiling, or halfway - round ceiling
return ceiling;
} else {
return floor;
}
} } | public class class_name {
public long roundHalfCeiling(long instant) {
long floor = roundFloor(instant);
long ceiling = roundCeiling(instant);
long diffFromFloor = instant - floor;
long diffToCeiling = ceiling - instant;
if (diffToCeiling <= diffFromFloor) {
// Closer to the ceiling, or halfway - round ceiling
return ceiling; // depends on control dependency: [if], data = [none]
} else {
return floor; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public void classLoaderDestroy(DynamicClassLoader loader)
{
Method destroy = getDestroyMethod(_resource.getClass());
if (destroy == null)
return;
try {
destroy.invoke(_resource);
} catch (Throwable e) {
log.log(Level.WARNING, e.toString(), e);
}
} } | public class class_name {
public void classLoaderDestroy(DynamicClassLoader loader)
{
Method destroy = getDestroyMethod(_resource.getClass());
if (destroy == null)
return;
try {
destroy.invoke(_resource); // depends on control dependency: [try], data = [none]
} catch (Throwable e) {
log.log(Level.WARNING, e.toString(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public NumberExpression<Double> x() {
if (x == null) {
x = Expressions.numberOperation(Double.class, SpatialOps.X, mixin);
}
return x;
} } | public class class_name {
public NumberExpression<Double> x() {
if (x == null) {
x = Expressions.numberOperation(Double.class, SpatialOps.X, mixin); // depends on control dependency: [if], data = [none]
}
return x;
} } |
public class class_name {
public static AxisAlignedBB rotate(AxisAlignedBB aabb, int angle, Axis axis)
{
if (aabb == null || angle == 0 || axis == null)
return aabb;
int a = -angle & 3;
int s = sin[a];
int c = cos[a];
aabb = aabb.offset(-0.5F, -0.5F, -0.5F);
double minX = aabb.minX;
double minY = aabb.minY;
double minZ = aabb.minZ;
double maxX = aabb.maxX;
double maxY = aabb.maxY;
double maxZ = aabb.maxZ;
if (axis == Axis.X)
{
minY = (aabb.minY * c) - (aabb.minZ * s);
maxY = (aabb.maxY * c) - (aabb.maxZ * s);
minZ = (aabb.minY * s) + (aabb.minZ * c);
maxZ = (aabb.maxY * s) + (aabb.maxZ * c);
}
if (axis == Axis.Y)
{
minX = (aabb.minX * c) - (aabb.minZ * s);
maxX = (aabb.maxX * c) - (aabb.maxZ * s);
minZ = (aabb.minX * s) + (aabb.minZ * c);
maxZ = (aabb.maxX * s) + (aabb.maxZ * c);
}
if (axis == Axis.Z)
{
minX = (aabb.minX * c) - (aabb.minY * s);
maxX = (aabb.maxX * c) - (aabb.maxY * s);
minY = (aabb.minX * s) + (aabb.minY * c);
maxY = (aabb.maxX * s) + (aabb.maxY * c);
}
aabb = new AxisAlignedBB(minX + 0.5F, minY + 0.5F, minZ + 0.5F, maxX + 0.5F, maxY + 0.5F, maxZ + 0.5F);
return aabb;
} } | public class class_name {
public static AxisAlignedBB rotate(AxisAlignedBB aabb, int angle, Axis axis)
{
if (aabb == null || angle == 0 || axis == null)
return aabb;
int a = -angle & 3;
int s = sin[a];
int c = cos[a];
aabb = aabb.offset(-0.5F, -0.5F, -0.5F);
double minX = aabb.minX;
double minY = aabb.minY;
double minZ = aabb.minZ;
double maxX = aabb.maxX;
double maxY = aabb.maxY;
double maxZ = aabb.maxZ;
if (axis == Axis.X)
{
minY = (aabb.minY * c) - (aabb.minZ * s); // depends on control dependency: [if], data = [none]
maxY = (aabb.maxY * c) - (aabb.maxZ * s); // depends on control dependency: [if], data = [none]
minZ = (aabb.minY * s) + (aabb.minZ * c); // depends on control dependency: [if], data = [none]
maxZ = (aabb.maxY * s) + (aabb.maxZ * c); // depends on control dependency: [if], data = [none]
}
if (axis == Axis.Y)
{
minX = (aabb.minX * c) - (aabb.minZ * s); // depends on control dependency: [if], data = [none]
maxX = (aabb.maxX * c) - (aabb.maxZ * s); // depends on control dependency: [if], data = [none]
minZ = (aabb.minX * s) + (aabb.minZ * c); // depends on control dependency: [if], data = [none]
maxZ = (aabb.maxX * s) + (aabb.maxZ * c); // depends on control dependency: [if], data = [none]
}
if (axis == Axis.Z)
{
minX = (aabb.minX * c) - (aabb.minY * s); // depends on control dependency: [if], data = [none]
maxX = (aabb.maxX * c) - (aabb.maxY * s); // depends on control dependency: [if], data = [none]
minY = (aabb.minX * s) + (aabb.minY * c); // depends on control dependency: [if], data = [none]
maxY = (aabb.maxX * s) + (aabb.maxY * c); // depends on control dependency: [if], data = [none]
}
aabb = new AxisAlignedBB(minX + 0.5F, minY + 0.5F, minZ + 0.5F, maxX + 0.5F, maxY + 0.5F, maxZ + 0.5F);
return aabb;
} } |
public class class_name {
public void marshall(GenerateDataSetRequest generateDataSetRequest, ProtocolMarshaller protocolMarshaller) {
if (generateDataSetRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(generateDataSetRequest.getDataSetType(), DATASETTYPE_BINDING);
protocolMarshaller.marshall(generateDataSetRequest.getDataSetPublicationDate(), DATASETPUBLICATIONDATE_BINDING);
protocolMarshaller.marshall(generateDataSetRequest.getRoleNameArn(), ROLENAMEARN_BINDING);
protocolMarshaller.marshall(generateDataSetRequest.getDestinationS3BucketName(), DESTINATIONS3BUCKETNAME_BINDING);
protocolMarshaller.marshall(generateDataSetRequest.getDestinationS3Prefix(), DESTINATIONS3PREFIX_BINDING);
protocolMarshaller.marshall(generateDataSetRequest.getSnsTopicArn(), SNSTOPICARN_BINDING);
protocolMarshaller.marshall(generateDataSetRequest.getCustomerDefinedValues(), CUSTOMERDEFINEDVALUES_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(GenerateDataSetRequest generateDataSetRequest, ProtocolMarshaller protocolMarshaller) {
if (generateDataSetRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(generateDataSetRequest.getDataSetType(), DATASETTYPE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(generateDataSetRequest.getDataSetPublicationDate(), DATASETPUBLICATIONDATE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(generateDataSetRequest.getRoleNameArn(), ROLENAMEARN_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(generateDataSetRequest.getDestinationS3BucketName(), DESTINATIONS3BUCKETNAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(generateDataSetRequest.getDestinationS3Prefix(), DESTINATIONS3PREFIX_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(generateDataSetRequest.getSnsTopicArn(), SNSTOPICARN_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(generateDataSetRequest.getCustomerDefinedValues(), CUSTOMERDEFINEDVALUES_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 EClass getIfcConditionCriterion() {
if (ifcConditionCriterionEClass == null) {
ifcConditionCriterionEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI)
.getEClassifiers().get(98);
}
return ifcConditionCriterionEClass;
} } | public class class_name {
public EClass getIfcConditionCriterion() {
if (ifcConditionCriterionEClass == null) {
ifcConditionCriterionEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI)
.getEClassifiers().get(98);
// depends on control dependency: [if], data = [none]
}
return ifcConditionCriterionEClass;
} } |
public class class_name {
public Optional<CredentialsProvider> getCredentialsProvider(Stage.Context context, List<Stage.ConfigIssue> issues) {
CredentialsProvider provider = null;
if (credentialsProvider.equals(CredentialsProviderType.DEFAULT_PROVIDER)) {
return Optional.of(SubscriptionAdminSettings.defaultCredentialsProviderBuilder().build());
} else if (credentialsProvider.equals(CredentialsProviderType.JSON_PROVIDER)) {
Credentials credentials = getCredentials(context, issues);
provider = new FixedCredentialsProvider() {
@Nullable
@Override
public Credentials getCredentials() {
return credentials;
}
};
}
return Optional.ofNullable(provider);
} } | public class class_name {
public Optional<CredentialsProvider> getCredentialsProvider(Stage.Context context, List<Stage.ConfigIssue> issues) {
CredentialsProvider provider = null;
if (credentialsProvider.equals(CredentialsProviderType.DEFAULT_PROVIDER)) {
return Optional.of(SubscriptionAdminSettings.defaultCredentialsProviderBuilder().build()); // depends on control dependency: [if], data = [none]
} else if (credentialsProvider.equals(CredentialsProviderType.JSON_PROVIDER)) {
Credentials credentials = getCredentials(context, issues);
provider = new FixedCredentialsProvider() {
@Nullable
@Override
public Credentials getCredentials() {
return credentials;
}
}; // depends on control dependency: [if], data = [none]
}
return Optional.ofNullable(provider);
} } |
public class class_name {
public void dismissConfirmation() {
String action = "Clicking 'Cancel' on a confirmation";
String expected = "Confirmation is present to be clicked";
if (isNotConfirmation(action, expected)) {
return;
}
dismiss(action, expected, "confirmation");
} } | public class class_name {
public void dismissConfirmation() {
String action = "Clicking 'Cancel' on a confirmation";
String expected = "Confirmation is present to be clicked";
if (isNotConfirmation(action, expected)) {
return; // depends on control dependency: [if], data = [none]
}
dismiss(action, expected, "confirmation");
} } |
public class class_name {
public void reconcileLocalLinks()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "reconcileLocalLinks");
// Set reconciling flag to false
reconciling = false;
LinkTypeFilter filter = new LinkTypeFilter();
filter.LOCAL = Boolean.TRUE;
filter.UNRECONCILED = Boolean.TRUE;
SIMPIterator itr = linkIndex.iterator(filter);
while (itr.hasNext())
{
LinkHandler dh = (LinkHandler) itr.next();
// Mark the destination for deletion
try
{
// Set the deletion flag in the DH persistently. A transaction per DH??
LocalTransaction siTran = txManager.createLocalTransaction(true);
dh.setToBeDeleted(true);
//Adjust the destination lookups in Destination Manager
linkIndex.delete(dh);
dh.requestUpdate((Transaction) siTran);
// commit the transaction
siTran.commit();
SibTr.info(tc, "LOCAL_LINK_DELETE_INFO_CWSIP0065",
new Object[] { dh.getName(), dh.getUuid() });
} catch (MessageStoreException e)
{
// No FFDC code needed
SibTr.exception(tc, e);
//throw e;
} catch (SIException e)
{
// No FFDC code needed
SibTr.exception(tc, e);
//handleRollback(siTran);
// throw e;
}
}
itr.finished();
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "reconcileLocalLinks");
} } | public class class_name {
public void reconcileLocalLinks()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.entry(tc, "reconcileLocalLinks");
// Set reconciling flag to false
reconciling = false;
LinkTypeFilter filter = new LinkTypeFilter();
filter.LOCAL = Boolean.TRUE;
filter.UNRECONCILED = Boolean.TRUE;
SIMPIterator itr = linkIndex.iterator(filter);
while (itr.hasNext())
{
LinkHandler dh = (LinkHandler) itr.next();
// Mark the destination for deletion
try
{
// Set the deletion flag in the DH persistently. A transaction per DH??
LocalTransaction siTran = txManager.createLocalTransaction(true);
dh.setToBeDeleted(true); // depends on control dependency: [try], data = [none]
//Adjust the destination lookups in Destination Manager
linkIndex.delete(dh); // depends on control dependency: [try], data = [none]
dh.requestUpdate((Transaction) siTran); // depends on control dependency: [try], data = [none]
// commit the transaction
siTran.commit(); // depends on control dependency: [try], data = [none]
SibTr.info(tc, "LOCAL_LINK_DELETE_INFO_CWSIP0065",
new Object[] { dh.getName(), dh.getUuid() }); // depends on control dependency: [try], data = [none]
} catch (MessageStoreException e)
{
// No FFDC code needed
SibTr.exception(tc, e);
//throw e;
} catch (SIException e) // depends on control dependency: [catch], data = [none]
{
// No FFDC code needed
SibTr.exception(tc, e);
//handleRollback(siTran);
// throw e;
} // depends on control dependency: [catch], data = [none]
}
itr.finished();
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
SibTr.exit(tc, "reconcileLocalLinks");
} } |
public class class_name {
public AttributeTable fromPkiMessage(final PkiMessage<?> message) {
Hashtable<ASN1ObjectIdentifier, Attribute> table = new Hashtable<ASN1ObjectIdentifier, Attribute>();
List<Attribute> attributes = getMessageAttributes(message);
if (message instanceof CertRep) {
attributes.addAll(getResponseAttributes((CertRep) message));
}
for (Attribute attribute : attributes) {
table.put(attribute.getAttrType(), attribute);
}
return new AttributeTable(table);
} } | public class class_name {
public AttributeTable fromPkiMessage(final PkiMessage<?> message) {
Hashtable<ASN1ObjectIdentifier, Attribute> table = new Hashtable<ASN1ObjectIdentifier, Attribute>();
List<Attribute> attributes = getMessageAttributes(message);
if (message instanceof CertRep) {
attributes.addAll(getResponseAttributes((CertRep) message)); // depends on control dependency: [if], data = [none]
}
for (Attribute attribute : attributes) {
table.put(attribute.getAttrType(), attribute); // depends on control dependency: [for], data = [attribute]
}
return new AttributeTable(table);
} } |
public class class_name {
private void removeEmbedded2Dots() {
int i = 0;
while ((i = path.indexOf("/../", i)) >= 0) {
if (i > 0) {
end = path.lastIndexOf('/', i - 1);
if (end >= 0 && path.indexOf("/../", end) != 0) {
path = path.substring(0, end) + path.substring(i + 3);
i = 0;
} else if (end == 0) {
break;
}
} else {
i = i + 3;
}
}
} } | public class class_name {
private void removeEmbedded2Dots() {
int i = 0;
while ((i = path.indexOf("/../", i)) >= 0) {
if (i > 0) {
end = path.lastIndexOf('/', i - 1); // depends on control dependency: [if], data = [none]
if (end >= 0 && path.indexOf("/../", end) != 0) {
path = path.substring(0, end) + path.substring(i + 3); // depends on control dependency: [if], data = [none]
i = 0; // depends on control dependency: [if], data = [none]
} else if (end == 0) {
break;
}
} else {
i = i + 3; // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
Double readMaxNavPos(CmsResource target) throws CmsException {
List<CmsResource> existingResourcesInFolder = m_cms.readResources(
target,
CmsResourceFilter.IGNORE_EXPIRATION,
false);
double maxNavpos = 0.0;
boolean hasNavpos = false;
for (CmsResource existingResource : existingResourcesInFolder) {
CmsProperty navpos = m_cms.readPropertyObject(
existingResource,
CmsPropertyDefinition.PROPERTY_NAVPOS,
false);
if (navpos.getValue() != null) {
try {
double navposNum = Double.parseDouble(navpos.getValue());
hasNavpos = true;
maxNavpos = Math.max(navposNum, maxNavpos);
} catch (NumberFormatException e) {
// ignore
}
}
}
if (hasNavpos) {
return Double.valueOf(maxNavpos);
} else {
return null;
}
} } | public class class_name {
Double readMaxNavPos(CmsResource target) throws CmsException {
List<CmsResource> existingResourcesInFolder = m_cms.readResources(
target,
CmsResourceFilter.IGNORE_EXPIRATION,
false);
double maxNavpos = 0.0;
boolean hasNavpos = false;
for (CmsResource existingResource : existingResourcesInFolder) {
CmsProperty navpos = m_cms.readPropertyObject(
existingResource,
CmsPropertyDefinition.PROPERTY_NAVPOS,
false);
if (navpos.getValue() != null) {
try {
double navposNum = Double.parseDouble(navpos.getValue());
hasNavpos = true; // depends on control dependency: [try], data = [none]
maxNavpos = Math.max(navposNum, maxNavpos); // depends on control dependency: [try], data = [none]
} catch (NumberFormatException e) {
// ignore
} // depends on control dependency: [catch], data = [none]
}
}
if (hasNavpos) {
return Double.valueOf(maxNavpos);
} else {
return null;
}
} } |
public class class_name {
public void marshall(CancelWorkflowExecutionFailedEventAttributes cancelWorkflowExecutionFailedEventAttributes, ProtocolMarshaller protocolMarshaller) {
if (cancelWorkflowExecutionFailedEventAttributes == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(cancelWorkflowExecutionFailedEventAttributes.getCause(), CAUSE_BINDING);
protocolMarshaller.marshall(cancelWorkflowExecutionFailedEventAttributes.getDecisionTaskCompletedEventId(), DECISIONTASKCOMPLETEDEVENTID_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(CancelWorkflowExecutionFailedEventAttributes cancelWorkflowExecutionFailedEventAttributes, ProtocolMarshaller protocolMarshaller) {
if (cancelWorkflowExecutionFailedEventAttributes == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(cancelWorkflowExecutionFailedEventAttributes.getCause(), CAUSE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(cancelWorkflowExecutionFailedEventAttributes.getDecisionTaskCompletedEventId(), DECISIONTASKCOMPLETEDEVENTID_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 @Nullable List<Object> actualAsList() {
if (actual == null) {
return null;
}
return newArrayList(contentOfActual());
} } | public class class_name {
@Override
protected @Nullable List<Object> actualAsList() {
if (actual == null) {
return null; // depends on control dependency: [if], data = [none]
}
return newArrayList(contentOfActual());
} } |
public class class_name {
private ItemData itemData(QPath parentPath, ResultSet item, int itemClass, AccessControlList parentACL)
throws RepositoryException, SQLException, IOException
{
String cid = item.getString(COLUMN_ID);
String cname = item.getString(COLUMN_NAME);
int cversion = item.getInt(COLUMN_VERSION);
String cpid = item.getString(COLUMN_PARENTID);
// if parent ID is empty string - it's a root node
// cpid = cpid.equals(Constants.ROOT_PARENT_UUID) ? null : cpid;
try
{
if (itemClass == I_CLASS_NODE)
{
int cindex = item.getInt(COLUMN_INDEX);
int cnordernumb = item.getInt(COLUMN_NORDERNUM);
return loadNodeRecord(parentPath, cname, cid, cpid, cindex, cversion, cnordernumb, parentACL);
}
int cptype = item.getInt(COLUMN_PTYPE);
boolean cpmultivalued = item.getBoolean(COLUMN_PMULTIVALUED);
return loadPropertyRecord(parentPath, cname, cid, cpid, cversion, cptype, cpmultivalued);
}
catch (InvalidItemStateException e)
{
throw new InvalidItemStateException("FATAL: Can't build item path for name " + cname + " id: "
+ getIdentifier(cid) + ". " + e);
}
} } | public class class_name {
private ItemData itemData(QPath parentPath, ResultSet item, int itemClass, AccessControlList parentACL)
throws RepositoryException, SQLException, IOException
{
String cid = item.getString(COLUMN_ID);
String cname = item.getString(COLUMN_NAME);
int cversion = item.getInt(COLUMN_VERSION);
String cpid = item.getString(COLUMN_PARENTID);
// if parent ID is empty string - it's a root node
// cpid = cpid.equals(Constants.ROOT_PARENT_UUID) ? null : cpid;
try
{
if (itemClass == I_CLASS_NODE)
{
int cindex = item.getInt(COLUMN_INDEX);
int cnordernumb = item.getInt(COLUMN_NORDERNUM);
return loadNodeRecord(parentPath, cname, cid, cpid, cindex, cversion, cnordernumb, parentACL); // depends on control dependency: [if], data = [none]
}
int cptype = item.getInt(COLUMN_PTYPE);
boolean cpmultivalued = item.getBoolean(COLUMN_PMULTIVALUED);
return loadPropertyRecord(parentPath, cname, cid, cpid, cversion, cptype, cpmultivalued);
}
catch (InvalidItemStateException e)
{
throw new InvalidItemStateException("FATAL: Can't build item path for name " + cname + " id: "
+ getIdentifier(cid) + ". " + e);
}
} } |
public class class_name {
public void start() {
stop(); // Make sure any currently running dispatchers are stopped.
// Create the cache dispatcher and start it.
mCacheDispatcher = new CacheDispatcher(mCacheQueue, mNetworkQueue, mCache, mDelivery);
mCacheDispatcher.start();
// Create network dispatchers (and corresponding threads) up to the pool size.
for (int i = 0; i < mDispatchers.length; i++) {
NetworkDispatcher networkDispatcher = new NetworkDispatcher(mNetworkQueue, mNetwork,
mCache, mDelivery);
mDispatchers[i] = networkDispatcher;
networkDispatcher.start();
}
} } | public class class_name {
public void start() {
stop(); // Make sure any currently running dispatchers are stopped.
// Create the cache dispatcher and start it.
mCacheDispatcher = new CacheDispatcher(mCacheQueue, mNetworkQueue, mCache, mDelivery);
mCacheDispatcher.start();
// Create network dispatchers (and corresponding threads) up to the pool size.
for (int i = 0; i < mDispatchers.length; i++) {
NetworkDispatcher networkDispatcher = new NetworkDispatcher(mNetworkQueue, mNetwork,
mCache, mDelivery);
mDispatchers[i] = networkDispatcher; // depends on control dependency: [for], data = [i]
networkDispatcher.start(); // depends on control dependency: [for], data = [none]
}
} } |
public class class_name {
@CheckReturnValue
public AuditableRestAction<Void> modifyMemberRoles(Member member, Collection<Role> roles)
{
Checks.notNull(member, "Member");
Checks.notNull(roles, "Roles");
checkGuild(member.getGuild(), "Member");
roles.forEach(role ->
{
Checks.notNull(role, "Role in collection");
checkGuild(role.getGuild(), "Role: " + role.toString());
checkPosition(role);
});
Checks.check(!roles.contains(getGuild().getPublicRole()),
"Cannot add the PublicRole of a Guild to a Member. All members have this role by default!");
// Return an empty rest action if there were no changes
final List<Role> memberRoles = member.getRoles();
if (memberRoles.size() == roles.size() && memberRoles.containsAll(roles))
return new AuditableRestAction.EmptyRestAction<>(getGuild().getJDA());
//Make sure that the current managed roles are preserved and no new ones are added.
List<Role> currentManaged = memberRoles.stream().filter(Role::isManaged).collect(Collectors.toList());
List<Role> newManaged = roles.stream().filter(Role::isManaged).collect(Collectors.toList());
if (!currentManaged.isEmpty() || !newManaged.isEmpty())
{
if (!newManaged.containsAll(currentManaged))
{
currentManaged.removeAll(newManaged);
throw new IllegalArgumentException("Cannot remove managed roles from a member! Roles: " + currentManaged.toString());
}
if (!currentManaged.containsAll(newManaged))
{
newManaged.removeAll(currentManaged);
throw new IllegalArgumentException("Cannot add managed roles to a member! Roles: " + newManaged.toString());
}
}
//This is identical to the rest action stuff in #modifyMemberRoles(Member, Collection<Role>, Collection<Role>)
JSONObject body = new JSONObject()
.put("roles", roles.stream().map(Role::getId).collect(Collectors.toList()));
Route.CompiledRoute route = Route.Guilds.MODIFY_MEMBER.compile(getGuild().getId(), member.getUser().getId());
return new AuditableRestAction<Void>(getGuild().getJDA(), route, body)
{
@Override
protected void handleResponse(Response response, Request<Void> request)
{
if (response.isOk())
request.onSuccess(null);
else
request.onFailure(response);
}
};
} } | public class class_name {
@CheckReturnValue
public AuditableRestAction<Void> modifyMemberRoles(Member member, Collection<Role> roles)
{
Checks.notNull(member, "Member");
Checks.notNull(roles, "Roles");
checkGuild(member.getGuild(), "Member");
roles.forEach(role ->
{
Checks.notNull(role, "Role in collection");
checkGuild(role.getGuild(), "Role: " + role.toString());
checkPosition(role);
});
Checks.check(!roles.contains(getGuild().getPublicRole()),
"Cannot add the PublicRole of a Guild to a Member. All members have this role by default!");
// Return an empty rest action if there were no changes
final List<Role> memberRoles = member.getRoles();
if (memberRoles.size() == roles.size() && memberRoles.containsAll(roles))
return new AuditableRestAction.EmptyRestAction<>(getGuild().getJDA());
//Make sure that the current managed roles are preserved and no new ones are added.
List<Role> currentManaged = memberRoles.stream().filter(Role::isManaged).collect(Collectors.toList());
List<Role> newManaged = roles.stream().filter(Role::isManaged).collect(Collectors.toList());
if (!currentManaged.isEmpty() || !newManaged.isEmpty())
{
if (!newManaged.containsAll(currentManaged))
{
currentManaged.removeAll(newManaged); // depends on control dependency: [if], data = [none]
throw new IllegalArgumentException("Cannot remove managed roles from a member! Roles: " + currentManaged.toString());
}
if (!currentManaged.containsAll(newManaged))
{
newManaged.removeAll(currentManaged); // depends on control dependency: [if], data = [none]
throw new IllegalArgumentException("Cannot add managed roles to a member! Roles: " + newManaged.toString());
}
}
//This is identical to the rest action stuff in #modifyMemberRoles(Member, Collection<Role>, Collection<Role>)
JSONObject body = new JSONObject()
.put("roles", roles.stream().map(Role::getId).collect(Collectors.toList()));
Route.CompiledRoute route = Route.Guilds.MODIFY_MEMBER.compile(getGuild().getId(), member.getUser().getId());
return new AuditableRestAction<Void>(getGuild().getJDA(), route, body)
{
@Override
protected void handleResponse(Response response, Request<Void> request)
{
if (response.isOk())
request.onSuccess(null);
else
request.onFailure(response);
}
};
} } |
public class class_name {
protected Set<AnnotationPair> buildAnnotationPairs(
ProtoNetwork protoNetwork,
Map<String, Annotation> annotationMap) {
// build annotation value to annotation definition map
Set<AnnotationPair> valueDefinitions =
new LinkedHashSet<AnnotationPair>();
AnnotationValueTable avt = protoNetwork.getAnnotationValueTable();
AnnotationDefinitionTable adt =
protoNetwork.getAnnotationDefinitionTable();
Set<Annotation> annotationMapValues = new HashSet<Annotation>(
annotationMap.values());
for (Annotation a : annotationMapValues) {
int adid =
adt.getDefinitionIndex().get(
new TableAnnotationDefinition(a.getDefinition()));
int aid = avt.addAnnotationValue(adid, a.getValue());
valueDefinitions.add(new AnnotationPair(adid, aid));
}
return valueDefinitions;
} } | public class class_name {
protected Set<AnnotationPair> buildAnnotationPairs(
ProtoNetwork protoNetwork,
Map<String, Annotation> annotationMap) {
// build annotation value to annotation definition map
Set<AnnotationPair> valueDefinitions =
new LinkedHashSet<AnnotationPair>();
AnnotationValueTable avt = protoNetwork.getAnnotationValueTable();
AnnotationDefinitionTable adt =
protoNetwork.getAnnotationDefinitionTable();
Set<Annotation> annotationMapValues = new HashSet<Annotation>(
annotationMap.values());
for (Annotation a : annotationMapValues) {
int adid =
adt.getDefinitionIndex().get(
new TableAnnotationDefinition(a.getDefinition()));
int aid = avt.addAnnotationValue(adid, a.getValue());
valueDefinitions.add(new AnnotationPair(adid, aid)); // depends on control dependency: [for], data = [a]
}
return valueDefinitions;
} } |
public class class_name {
static int[] make_words(int[] l, int n){
int[] marker=new int[33];
int[] r=new int[n];
for(int i=0; i<n; i++){
int length=l[i];
if(length>0){
int entry=marker[length];
// when we claim a node for an entry, we also claim the nodes
// below it (pruning off the imagined tree that may have dangled
// from it) as well as blocking the use of any nodes directly
// above for leaves
// update ourself
if(length<32&&(entry>>>length)!=0){
// error condition; the lengths must specify an overpopulated tree
//free(r);
return (null);
}
r[i]=entry;
// Look to see if the next shorter marker points to the node
// above. if so, update it and repeat.
{
for(int j=length; j>0; j--){
if((marker[j]&1)!=0){
// have to jump branches
if(j==1)
marker[1]++;
else
marker[j]=marker[j-1]<<1;
break; // invariant says next upper marker would already
// have been moved if it was on the same path
}
marker[j]++;
}
}
// prune the tree; the implicit invariant says all the longer
// markers were dangling from our just-taken node. Dangle them
// from our *new* node.
for(int j=length+1; j<33; j++){
if((marker[j]>>>1)==entry){
entry=marker[j];
marker[j]=marker[j-1]<<1;
}
else{
break;
}
}
}
}
// bitreverse the words because our bitwise packer/unpacker is LSb
// endian
for(int i=0; i<n; i++){
int temp=0;
for(int j=0; j<l[i]; j++){
temp<<=1;
temp|=(r[i]>>>j)&1;
}
r[i]=temp;
}
return (r);
} } | public class class_name {
static int[] make_words(int[] l, int n){
int[] marker=new int[33];
int[] r=new int[n];
for(int i=0; i<n; i++){
int length=l[i];
if(length>0){
int entry=marker[length];
// when we claim a node for an entry, we also claim the nodes
// below it (pruning off the imagined tree that may have dangled
// from it) as well as blocking the use of any nodes directly
// above for leaves
// update ourself
if(length<32&&(entry>>>length)!=0){
// error condition; the lengths must specify an overpopulated tree
//free(r);
return (null); // depends on control dependency: [if], data = [none]
}
r[i]=entry; // depends on control dependency: [if], data = [none]
// Look to see if the next shorter marker points to the node
// above. if so, update it and repeat.
{
for(int j=length; j>0; j--){
if((marker[j]&1)!=0){
// have to jump branches
if(j==1)
marker[1]++;
else
marker[j]=marker[j-1]<<1;
break; // invariant says next upper marker would already
// have been moved if it was on the same path
}
marker[j]++; // depends on control dependency: [for], data = [j]
}
}
// prune the tree; the implicit invariant says all the longer
// markers were dangling from our just-taken node. Dangle them
// from our *new* node.
for(int j=length+1; j<33; j++){
if((marker[j]>>>1)==entry){
entry=marker[j]; // depends on control dependency: [if], data = [none]
marker[j]=marker[j-1]<<1; // depends on control dependency: [if], data = [none]
}
else{
break;
}
}
}
}
// bitreverse the words because our bitwise packer/unpacker is LSb
// endian
for(int i=0; i<n; i++){
int temp=0;
for(int j=0; j<l[i]; j++){
temp<<=1; // depends on control dependency: [for], data = [none]
temp|=(r[i]>>>j)&1; // depends on control dependency: [for], data = [j]
}
r[i]=temp; // depends on control dependency: [for], data = [i]
}
return (r);
} } |
public class class_name {
private static long skipToEOF(final ImageInputStream stream) throws IOException {
long length = stream.length();
if (length > 0) {
// Known length, skip there and we're done.
stream.seek(length);
}
else {
// Otherwise, seek to EOF the hard way.
// First, store stream position...
long pos = stream.getStreamPosition();
// ...skip 1k blocks until we're passed EOF...
while (stream.skipBytes(1024L) > 0) {
if (stream.read() == -1) {
break;
}
pos = stream.getStreamPosition();
}
// ...go back to last known pos...
stream.seek(pos);
// ...finally seek until EOF one byte at a time. Done.
while (stream.read() != -1) {
}
}
return stream.getStreamPosition();
} } | public class class_name {
private static long skipToEOF(final ImageInputStream stream) throws IOException {
long length = stream.length();
if (length > 0) {
// Known length, skip there and we're done.
stream.seek(length);
}
else {
// Otherwise, seek to EOF the hard way.
// First, store stream position...
long pos = stream.getStreamPosition();
// ...skip 1k blocks until we're passed EOF...
while (stream.skipBytes(1024L) > 0) {
if (stream.read() == -1) {
break;
}
pos = stream.getStreamPosition(); // depends on control dependency: [while], data = [none]
}
// ...go back to last known pos...
stream.seek(pos);
// ...finally seek until EOF one byte at a time. Done.
while (stream.read() != -1) {
}
}
return stream.getStreamPosition();
} } |
public class class_name {
public Object getField(Object o, String fieldName) {
if (o == null) {
throw new IllegalArgumentException("No object to get from provided");
}
Field field = findField(o, fieldName);
if (field == null) {
throw new IllegalArgumentException(o.getClass() + " does not have a field " + fieldName);
} else {
if (!field.isAccessible()) {
field.setAccessible(true);
}
try {
return field.get(o);
} catch (IllegalAccessException e) {
throw new IllegalArgumentException("Unable to get " + fieldName, e);
}
}
} } | public class class_name {
public Object getField(Object o, String fieldName) {
if (o == null) {
throw new IllegalArgumentException("No object to get from provided");
}
Field field = findField(o, fieldName);
if (field == null) {
throw new IllegalArgumentException(o.getClass() + " does not have a field " + fieldName);
} else {
if (!field.isAccessible()) {
field.setAccessible(true); // depends on control dependency: [if], data = [none]
}
try {
return field.get(o); // depends on control dependency: [try], data = [none]
} catch (IllegalAccessException e) {
throw new IllegalArgumentException("Unable to get " + fieldName, e);
} // depends on control dependency: [catch], data = [none]
}
} } |
public class class_name {
CompletableFuture<Void> createSegment(String segmentName, Collection<AttributeUpdate> attributes, Duration timeout) {
long traceId = LoggerHelpers.traceEnterWithContext(log, traceObjectId, "createSegment", segmentName);
long segmentId = this.connector.containerMetadata.getStreamSegmentId(segmentName, true);
if (isValidSegmentId(segmentId)) {
// Quick fail: see if this is an active Segment, and if so, don't bother with anything else.
return Futures.failedFuture(new StreamSegmentExistsException(segmentName));
}
ArrayView segmentInfo = SegmentInfo.serialize(SegmentInfo.newSegment(segmentName, attributes));
CompletableFuture<Void> result = createSegment(segmentName, segmentInfo, new TimeoutTimer(timeout));
if (log.isTraceEnabled()) {
result.thenAccept(v -> LoggerHelpers.traceLeave(log, traceObjectId, "createSegment", traceId, segmentName));
}
return result;
} } | public class class_name {
CompletableFuture<Void> createSegment(String segmentName, Collection<AttributeUpdate> attributes, Duration timeout) {
long traceId = LoggerHelpers.traceEnterWithContext(log, traceObjectId, "createSegment", segmentName);
long segmentId = this.connector.containerMetadata.getStreamSegmentId(segmentName, true);
if (isValidSegmentId(segmentId)) {
// Quick fail: see if this is an active Segment, and if so, don't bother with anything else.
return Futures.failedFuture(new StreamSegmentExistsException(segmentName)); // depends on control dependency: [if], data = [none]
}
ArrayView segmentInfo = SegmentInfo.serialize(SegmentInfo.newSegment(segmentName, attributes));
CompletableFuture<Void> result = createSegment(segmentName, segmentInfo, new TimeoutTimer(timeout));
if (log.isTraceEnabled()) {
result.thenAccept(v -> LoggerHelpers.traceLeave(log, traceObjectId, "createSegment", traceId, segmentName)); // depends on control dependency: [if], data = [none]
}
return result;
} } |
public class class_name {
public IVarDef.Position getPosition()
{
if( position_ == null)
{
setPosition( new Position( getParent(), seqNum_));
}
return position_;
} } | public class class_name {
public IVarDef.Position getPosition()
{
if( position_ == null)
{
setPosition( new Position( getParent(), seqNum_)); // depends on control dependency: [if], data = [none]
}
return position_;
} } |
public class class_name {
public static Map < Character, Integer > getPictureCharOccurences(
final String picture, final char currencySymbol) {
Map < Character, Integer > charNum = new HashMap < Character, Integer >();
charNum.put('A', 0);
charNum.put('B', 0);
charNum.put('G', 0);
charNum.put('N', 0);
charNum.put('X', 0);
charNum.put('P', 0);
charNum.put('Z', 0);
charNum.put('0', 0);
charNum.put('/', 0);
charNum.put('+', 0);
charNum.put('-', 0);
charNum.put('*', 0);
charNum.put('C', 0);
charNum.put('D', 0);
charNum.put('.', 0);
charNum.put(',', 0);
charNum.put('9', 0);
charNum.put('E', 0);
charNum.put('S', 0);
charNum.put('V', 0);
charNum.put(currencySymbol, 0);
List < PictureSymbol > pictureSymbols = parsePicture(picture,
currencySymbol);
for (PictureSymbol pictureSymbol : pictureSymbols) {
Integer number = charNum.get(pictureSymbol.getSymbol());
if (number != null) {
number += pictureSymbol.getNumber();
charNum.put(pictureSymbol.getSymbol(), number);
}
}
return charNum;
} } | public class class_name {
public static Map < Character, Integer > getPictureCharOccurences(
final String picture, final char currencySymbol) {
Map < Character, Integer > charNum = new HashMap < Character, Integer >();
charNum.put('A', 0);
charNum.put('B', 0);
charNum.put('G', 0);
charNum.put('N', 0);
charNum.put('X', 0);
charNum.put('P', 0);
charNum.put('Z', 0);
charNum.put('0', 0);
charNum.put('/', 0);
charNum.put('+', 0);
charNum.put('-', 0);
charNum.put('*', 0);
charNum.put('C', 0);
charNum.put('D', 0);
charNum.put('.', 0);
charNum.put(',', 0);
charNum.put('9', 0);
charNum.put('E', 0);
charNum.put('S', 0);
charNum.put('V', 0);
charNum.put(currencySymbol, 0);
List < PictureSymbol > pictureSymbols = parsePicture(picture,
currencySymbol);
for (PictureSymbol pictureSymbol : pictureSymbols) {
Integer number = charNum.get(pictureSymbol.getSymbol());
if (number != null) {
number += pictureSymbol.getNumber(); // depends on control dependency: [if], data = [none]
charNum.put(pictureSymbol.getSymbol(), number); // depends on control dependency: [if], data = [none]
}
}
return charNum;
} } |
public class class_name {
private Document loadValidating(InputStream is) {
try {
return getDOMObject(is, true);
} catch (SAXException e) {
e.printStackTrace();
System.out.println("Error parsing digital document from nitf inputstream.");
} catch (IOException e) {
e.printStackTrace();
System.out.println("Error parsing digital document from nitf inputstream.");
} catch (ParserConfigurationException e) {
e.printStackTrace();
System.out.println("Error parsing digital document from nitf inputstream.");
}
return null;
} } | public class class_name {
private Document loadValidating(InputStream is) {
try {
return getDOMObject(is, true); // depends on control dependency: [try], data = [none]
} catch (SAXException e) {
e.printStackTrace();
System.out.println("Error parsing digital document from nitf inputstream.");
} catch (IOException e) { // depends on control dependency: [catch], data = [none]
e.printStackTrace();
System.out.println("Error parsing digital document from nitf inputstream.");
} catch (ParserConfigurationException e) { // depends on control dependency: [catch], data = [none]
e.printStackTrace();
System.out.println("Error parsing digital document from nitf inputstream.");
} // depends on control dependency: [catch], data = [none]
return null;
} } |
public class class_name {
private void assignThreadsToQueues() {
int countOfQueues = jobQueues.size();
String[] queues = (String[]) jobQueues.keySet().toArray(
new String[countOfQueues]);
int numberOfQueuesPerThread = countOfQueues / poolSize;
int numberOfQueuesAssigned = 0;
for (int i = 0; i < poolSize; i++) {
JobInitializationThread initializer = createJobInitializationThread();
int batch = (i * numberOfQueuesPerThread);
for (int j = batch; j < (batch + numberOfQueuesPerThread); j++) {
initializer.addQueue(queues[j]);
threadsToQueueMap.put(queues[j], initializer);
numberOfQueuesAssigned++;
}
}
if (numberOfQueuesAssigned < countOfQueues) {
// Assign remaining queues in round robin fashion to other queues
int startIndex = 0;
for (int i = numberOfQueuesAssigned; i < countOfQueues; i++) {
JobInitializationThread t = threadsToQueueMap
.get(queues[startIndex]);
t.addQueue(queues[i]);
threadsToQueueMap.put(queues[i], t);
startIndex++;
}
}
} } | public class class_name {
private void assignThreadsToQueues() {
int countOfQueues = jobQueues.size();
String[] queues = (String[]) jobQueues.keySet().toArray(
new String[countOfQueues]);
int numberOfQueuesPerThread = countOfQueues / poolSize;
int numberOfQueuesAssigned = 0;
for (int i = 0; i < poolSize; i++) {
JobInitializationThread initializer = createJobInitializationThread();
int batch = (i * numberOfQueuesPerThread);
for (int j = batch; j < (batch + numberOfQueuesPerThread); j++) {
initializer.addQueue(queues[j]); // depends on control dependency: [for], data = [j]
threadsToQueueMap.put(queues[j], initializer); // depends on control dependency: [for], data = [j]
numberOfQueuesAssigned++; // depends on control dependency: [for], data = [none]
}
}
if (numberOfQueuesAssigned < countOfQueues) {
// Assign remaining queues in round robin fashion to other queues
int startIndex = 0;
for (int i = numberOfQueuesAssigned; i < countOfQueues; i++) {
JobInitializationThread t = threadsToQueueMap
.get(queues[startIndex]);
t.addQueue(queues[i]); // depends on control dependency: [for], data = [i]
threadsToQueueMap.put(queues[i], t); // depends on control dependency: [for], data = [i]
startIndex++; // depends on control dependency: [for], data = [none]
}
}
} } |
public class class_name {
protected ClassNode buildName(AST node) {
if (isType(TYPE, node)) {
node = node.getFirstChild();
}
ClassNode answer = null;
if (isType(DOT, node) || isType(OPTIONAL_DOT, node)) {
answer = ClassHelper.make(qualifiedName(node));
} else if (isPrimitiveTypeLiteral(node)) {
answer = ClassHelper.make(node.getText());
} else if (isType(INDEX_OP, node) || isType(ARRAY_DECLARATOR, node)) {
AST child = node.getFirstChild();
answer = buildName(child).makeArray();
configureAST(answer, node);
return answer;
} else {
String identifier = node.getText();
answer = ClassHelper.make(identifier);
}
AST nextSibling = node.getNextSibling();
if (isType(INDEX_OP, nextSibling) || isType(ARRAY_DECLARATOR, node)) {
answer = answer.makeArray();
configureAST(answer, node);
return answer;
} else {
configureAST(answer, node);
return answer;
}
} } | public class class_name {
protected ClassNode buildName(AST node) {
if (isType(TYPE, node)) {
node = node.getFirstChild(); // depends on control dependency: [if], data = [none]
}
ClassNode answer = null;
if (isType(DOT, node) || isType(OPTIONAL_DOT, node)) {
answer = ClassHelper.make(qualifiedName(node)); // depends on control dependency: [if], data = [none]
} else if (isPrimitiveTypeLiteral(node)) {
answer = ClassHelper.make(node.getText()); // depends on control dependency: [if], data = [none]
} else if (isType(INDEX_OP, node) || isType(ARRAY_DECLARATOR, node)) {
AST child = node.getFirstChild();
answer = buildName(child).makeArray(); // depends on control dependency: [if], data = [none]
configureAST(answer, node); // depends on control dependency: [if], data = [none]
return answer; // depends on control dependency: [if], data = [none]
} else {
String identifier = node.getText();
answer = ClassHelper.make(identifier); // depends on control dependency: [if], data = [none]
}
AST nextSibling = node.getNextSibling();
if (isType(INDEX_OP, nextSibling) || isType(ARRAY_DECLARATOR, node)) {
answer = answer.makeArray(); // depends on control dependency: [if], data = [none]
configureAST(answer, node); // depends on control dependency: [if], data = [none]
return answer; // depends on control dependency: [if], data = [none]
} else {
configureAST(answer, node); // depends on control dependency: [if], data = [none]
return answer; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
private int countNonNewline(String str, int off, int len) {
for(int cnt = 0; cnt < len; cnt++) {
final int pos = off + cnt;
if(str.charAt(pos) == UNIX_NEWLINE) {
return cnt;
}
if(str.charAt(pos) == CARRIAGE_RETURN) {
return cnt;
}
}
return len;
} } | public class class_name {
private int countNonNewline(String str, int off, int len) {
for(int cnt = 0; cnt < len; cnt++) {
final int pos = off + cnt;
if(str.charAt(pos) == UNIX_NEWLINE) {
return cnt; // depends on control dependency: [if], data = [none]
}
if(str.charAt(pos) == CARRIAGE_RETURN) {
return cnt; // depends on control dependency: [if], data = [none]
}
}
return len;
} } |
public class class_name {
public static String getFileExtension(Path path) {
Path name = path.getFileName();
// null for empty paths and root-only paths
if (name == null) {
return "";
}
String fileName = name.toString();
int dotIndex = fileName.lastIndexOf('.');
return dotIndex == -1 ? "" : fileName.substring(dotIndex + 1);
} } | public class class_name {
public static String getFileExtension(Path path) {
Path name = path.getFileName();
// null for empty paths and root-only paths
if (name == null) {
return ""; // depends on control dependency: [if], data = [none]
}
String fileName = name.toString();
int dotIndex = fileName.lastIndexOf('.');
return dotIndex == -1 ? "" : fileName.substring(dotIndex + 1);
} } |
public class class_name {
private InputStream safeOpen(String file) {
URL url = bundle.getEntry(file);
if (url != null) {
try {
return url.openStream();
} catch (IOException e) {
// if we get an IOException just return null for default page.
}
}
return null;
} } | public class class_name {
private InputStream safeOpen(String file) {
URL url = bundle.getEntry(file);
if (url != null) {
try {
return url.openStream(); // depends on control dependency: [try], data = [none]
} catch (IOException e) {
// if we get an IOException just return null for default page.
} // depends on control dependency: [catch], data = [none]
}
return null;
} } |
public class class_name {
public void processChildren(Node node) {
for (Node cursor = node.getFirstChild(); cursor != null; cursor = cursor.getNext()) {
if (cursor.getType() == Token.CALL) {
// The node is a function or method call
Node name = cursor.getFirstChild();
if (name != null && name.getType() == Token.NAME && // named function call
name.getString().equals("define")) { // name is "define" //$NON-NLS-1$
Node param = name.getNext();
if (param != null && param.getType() != Token.STRING) {
String expname = name.getProp(Node.SOURCENAME_PROP).toString();
if (source != null) {
PositionLocator locator = source.locate(name.getLineno(), name.getCharno()+6);
char tok = locator.findNextJSToken(); // move cursor to the open paren
if (tok == '(') {
// Try to insert the module name immediately following the open paren for the
// define call because the param location will be off if the argument list is parenthesized.
source.insert("\"" + expname + "\",", locator.getLineno(), locator.getCharno()+1); //$NON-NLS-1$ //$NON-NLS-2$
} else {
// First token following 'define' name is not a paren, so fall back to inserting
// before the first parameter.
source.insert("\"" + expname + "\",", param.getLineno(), param.getCharno()); //$NON-NLS-1$ //$NON-NLS-2$
}
}
param.getParent().addChildBefore(Node.newString(expname), param);
}
}
}
// Recursively call this method to process the child nodes
if (cursor.hasChildren())
processChildren(cursor);
}
} } | public class class_name {
public void processChildren(Node node) {
for (Node cursor = node.getFirstChild(); cursor != null; cursor = cursor.getNext()) {
if (cursor.getType() == Token.CALL) {
// The node is a function or method call
Node name = cursor.getFirstChild();
if (name != null && name.getType() == Token.NAME && // named function call
name.getString().equals("define")) { // name is "define" //$NON-NLS-1$
Node param = name.getNext();
if (param != null && param.getType() != Token.STRING) {
String expname = name.getProp(Node.SOURCENAME_PROP).toString();
if (source != null) {
PositionLocator locator = source.locate(name.getLineno(), name.getCharno()+6);
char tok = locator.findNextJSToken(); // move cursor to the open paren
if (tok == '(') {
// Try to insert the module name immediately following the open paren for the
// define call because the param location will be off if the argument list is parenthesized.
source.insert("\"" + expname + "\",", locator.getLineno(), locator.getCharno()+1); //$NON-NLS-1$ //$NON-NLS-2$
// depends on control dependency: [if], data = [none]
} else {
// First token following 'define' name is not a paren, so fall back to inserting
// before the first parameter.
source.insert("\"" + expname + "\",", param.getLineno(), param.getCharno()); //$NON-NLS-1$ //$NON-NLS-2$
// depends on control dependency: [if], data = [none]
}
}
param.getParent().addChildBefore(Node.newString(expname), param);
// depends on control dependency: [if], data = [none]
}
}
}
// Recursively call this method to process the child nodes
if (cursor.hasChildren())
processChildren(cursor);
}
} } |
public class class_name {
public ValueAssert valueByXPath(String xPath) {
isNotNull();
try {
return ValueAssert.create(actual, prefix2Uri, dbf, xpf, xPath);
} catch (Exception e) {
throwAssertionError(shouldNotHaveThrown(e));
}
return null; //fix compile issue
} } | public class class_name {
public ValueAssert valueByXPath(String xPath) {
isNotNull();
try {
return ValueAssert.create(actual, prefix2Uri, dbf, xpf, xPath); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throwAssertionError(shouldNotHaveThrown(e));
} // depends on control dependency: [catch], data = [none]
return null; //fix compile issue
} } |
public class class_name {
public void marshall(StreamRecord streamRecord, ProtocolMarshaller protocolMarshaller) {
if (streamRecord == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(streamRecord.getApproximateCreationDateTime(), APPROXIMATECREATIONDATETIME_BINDING);
protocolMarshaller.marshall(streamRecord.getKeys(), KEYS_BINDING);
protocolMarshaller.marshall(streamRecord.getNewImage(), NEWIMAGE_BINDING);
protocolMarshaller.marshall(streamRecord.getOldImage(), OLDIMAGE_BINDING);
protocolMarshaller.marshall(streamRecord.getSequenceNumber(), SEQUENCENUMBER_BINDING);
protocolMarshaller.marshall(streamRecord.getSizeBytes(), SIZEBYTES_BINDING);
protocolMarshaller.marshall(streamRecord.getStreamViewType(), STREAMVIEWTYPE_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(StreamRecord streamRecord, ProtocolMarshaller protocolMarshaller) {
if (streamRecord == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(streamRecord.getApproximateCreationDateTime(), APPROXIMATECREATIONDATETIME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(streamRecord.getKeys(), KEYS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(streamRecord.getNewImage(), NEWIMAGE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(streamRecord.getOldImage(), OLDIMAGE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(streamRecord.getSequenceNumber(), SEQUENCENUMBER_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(streamRecord.getSizeBytes(), SIZEBYTES_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(streamRecord.getStreamViewType(), STREAMVIEWTYPE_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 void closeBucket(Bucket bucket)
{
if (bucket != null)
{
if (!bucket.close())
{
LOGGER.error("Not able to close bucket [" + bucket.name() + "].");
throw new KunderaException("Not able to close bucket [" + bucket.name() + "].");
}
else
{
LOGGER.debug("Bucket [" + bucket.name() + "] is closed!");
}
}
} } | public class class_name {
public static void closeBucket(Bucket bucket)
{
if (bucket != null)
{
if (!bucket.close())
{
LOGGER.error("Not able to close bucket [" + bucket.name() + "]."); // depends on control dependency: [if], data = [none]
throw new KunderaException("Not able to close bucket [" + bucket.name() + "].");
}
else
{
LOGGER.debug("Bucket [" + bucket.name() + "] is closed!"); // depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
public static Map<String, String> parsePrefixMappings(String value, Report report, EPUBLocation location)
{
// ---- prefix attribute EBNF ----
// prefixes = mapping , { whitespace, { whitespace } , mapping } ;
// mapping = prefix , ":" , space , { space } , ? xsd:anyURI ? ;
// prefix = ? xsd:NCName ? ;
// space = #x20 ;
// whitespace = (#x20 | #x9 | #xD | #xA) ;
ImmutableMap.Builder<String, String> builder = new ImmutableMap.Builder<String, String>();
if (value == null)
return builder.build();
StringReader reader = new StringReader(value);
String prefix = null;
String uri = null;
try
{
State state = State.START;
int c;
String chars = "";
String badChars;
while ((c = reader.read()) != -1)
{
List<String> parsed = consume(reader, c, state);
chars = parsed.get(0);
badChars = parsed.get(1);
switch (state)
{
case START:
prefix = null;
uri = null;
if (!chars.isEmpty())
report.message(MessageId.OPF_004, location);
state = State.PREFIX;
break;
case PREFIX:
if (chars.isEmpty())
{
// empty prefix
report.message(MessageId.OPF_004a, location);
} else if (!NameChecker.isValidNCName(chars))
{
// bad prefix
report.message(MessageId.OPF_004b, location, chars);
} else
{
prefix = chars;
}
state = State.PREFIX_END;
break;
case PREFIX_END:
if (chars.isEmpty())
{
c = skip(reader, c, CharMatcher.whitespace(), State.PREFIX_END.accepted);
if (((char) c) == ':')
{
// some space before the colon char
report.message(MessageId.OPF_004c, location, prefix);
state = State.PREFIX_END;
} else
{
// no colon
report.message(MessageId.OPF_004c, location, prefix);
state = State.URI;
}
prefix = null;
break;
}
state = State.SPACE;
break;
case SPACE:
if (chars.isEmpty())
{
// no space
report.message(MessageId.OPF_004d, location, prefix);
prefix = null;
} else if (!badChars.isEmpty())
{
// unexpected whitespace
report.message(MessageId.OPF_004e, location, prefix);
}
state = State.URI;
break;
case URI:
try
{
uri = new URI(chars).toString();
if (prefix != null)
builder.put(prefix, uri);
} catch (URISyntaxException e)
{
// bad URI
report.message(MessageId.OPF_006, location, chars, prefix);
}
prefix = null;
state = State.WHITESPACE;
break;
case WHITESPACE:
if (!badChars.isEmpty())
report.message(MessageId.OPF_004f, location, prefix);
state = State.PREFIX;
break;
}
}
if (!FINAL_STATES.contains(state))// string ends with a single prefix
report.message(MessageId.OPF_005, location, prefix);
if (state == State.PREFIX && !chars.isEmpty())// trailing whitespace
report.message(MessageId.OPF_004, location);
} catch (IOException e)
{
throw new IllegalStateException(e);// Unexpected
} finally
{
reader.close();
}
return builder.build();
} } | public class class_name {
public static Map<String, String> parsePrefixMappings(String value, Report report, EPUBLocation location)
{
// ---- prefix attribute EBNF ----
// prefixes = mapping , { whitespace, { whitespace } , mapping } ;
// mapping = prefix , ":" , space , { space } , ? xsd:anyURI ? ;
// prefix = ? xsd:NCName ? ;
// space = #x20 ;
// whitespace = (#x20 | #x9 | #xD | #xA) ;
ImmutableMap.Builder<String, String> builder = new ImmutableMap.Builder<String, String>();
if (value == null)
return builder.build();
StringReader reader = new StringReader(value);
String prefix = null;
String uri = null;
try
{
State state = State.START;
int c;
String chars = "";
String badChars;
while ((c = reader.read()) != -1)
{
List<String> parsed = consume(reader, c, state);
chars = parsed.get(0); // depends on control dependency: [while], data = [none]
badChars = parsed.get(1); // depends on control dependency: [while], data = [none]
switch (state)
{
case START:
prefix = null;
uri = null;
if (!chars.isEmpty())
report.message(MessageId.OPF_004, location);
state = State.PREFIX;
break;
case PREFIX:
if (chars.isEmpty())
{
// empty prefix
report.message(MessageId.OPF_004a, location); // depends on control dependency: [if], data = [none]
} else if (!NameChecker.isValidNCName(chars))
{
// bad prefix
report.message(MessageId.OPF_004b, location, chars); // depends on control dependency: [if], data = [none]
} else
{
prefix = chars; // depends on control dependency: [if], data = [none]
}
state = State.PREFIX_END;
break;
case PREFIX_END:
if (chars.isEmpty())
{
c = skip(reader, c, CharMatcher.whitespace(), State.PREFIX_END.accepted); // depends on control dependency: [if], data = [none]
if (((char) c) == ':')
{
// some space before the colon char
report.message(MessageId.OPF_004c, location, prefix); // depends on control dependency: [if], data = [none]
state = State.PREFIX_END; // depends on control dependency: [if], data = [none]
} else
{
// no colon
report.message(MessageId.OPF_004c, location, prefix); // depends on control dependency: [if], data = [none]
state = State.URI; // depends on control dependency: [if], data = [none]
}
prefix = null; // depends on control dependency: [if], data = [none]
break;
}
state = State.SPACE;
break;
case SPACE:
if (chars.isEmpty())
{
// no space
report.message(MessageId.OPF_004d, location, prefix); // depends on control dependency: [if], data = [none]
prefix = null; // depends on control dependency: [if], data = [none]
} else if (!badChars.isEmpty())
{
// unexpected whitespace
report.message(MessageId.OPF_004e, location, prefix); // depends on control dependency: [if], data = [none]
}
state = State.URI;
break;
case URI:
try
{
uri = new URI(chars).toString(); // depends on control dependency: [try], data = [none]
if (prefix != null)
builder.put(prefix, uri);
} catch (URISyntaxException e)
{
// bad URI
report.message(MessageId.OPF_006, location, chars, prefix);
} // depends on control dependency: [catch], data = [none]
prefix = null;
state = State.WHITESPACE;
break;
case WHITESPACE:
if (!badChars.isEmpty())
report.message(MessageId.OPF_004f, location, prefix);
state = State.PREFIX;
break;
}
}
if (!FINAL_STATES.contains(state))// string ends with a single prefix
report.message(MessageId.OPF_005, location, prefix);
if (state == State.PREFIX && !chars.isEmpty())// trailing whitespace
report.message(MessageId.OPF_004, location);
} catch (IOException e)
{
throw new IllegalStateException(e);// Unexpected
} finally // depends on control dependency: [catch], data = [none]
{
reader.close();
}
return builder.build();
} } |
public class class_name {
public String mapValidationAnnotation(String annotation, String defaultAnnotation) {
String key = "validation.annotation." + toFirstUpper(annotation);
if (hasProperty(key)) {
return getProperty(key);
} else {
return defaultAnnotation;
}
} } | public class class_name {
public String mapValidationAnnotation(String annotation, String defaultAnnotation) {
String key = "validation.annotation." + toFirstUpper(annotation);
if (hasProperty(key)) {
return getProperty(key); // depends on control dependency: [if], data = [none]
} else {
return defaultAnnotation; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public static SentryClient getStoredClient() {
if (storedClient != null) {
return storedClient;
}
synchronized (Sentry.class) {
if (storedClient == null && !autoInitAttempted.get()) {
// attempt initialization by using configuration found in the environment
autoInitAttempted.set(true);
init();
}
}
return storedClient;
} } | public class class_name {
public static SentryClient getStoredClient() {
if (storedClient != null) {
return storedClient; // depends on control dependency: [if], data = [none]
}
synchronized (Sentry.class) {
if (storedClient == null && !autoInitAttempted.get()) {
// attempt initialization by using configuration found in the environment
autoInitAttempted.set(true); // depends on control dependency: [if], data = [none]
init(); // depends on control dependency: [if], data = [none]
}
}
return storedClient;
} } |
public class class_name {
public Change create(String name) {
Change plugin = getPlugin(name);
if (plugin == null) {
return null;
}
try {
return plugin.getClass().getConstructor().newInstance();
} catch (Exception e) {
throw new UnexpectedLiquibaseException(e);
}
} } | public class class_name {
public Change create(String name) {
Change plugin = getPlugin(name);
if (plugin == null) {
return null; // depends on control dependency: [if], data = [none]
}
try {
return plugin.getClass().getConstructor().newInstance(); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new UnexpectedLiquibaseException(e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
private PatternElement parseNamedElement(Node el, Map<String, Scope> scopes) {
PatternElement namedElement;
if (
nodeAttribute(el, TAG_VAR_ATTR_PARSE, DEFAULT_PARSE_VALUE)
&& !nodeHasAttribute(el, TAG_VAR_ATTR_REGEX)
&& !nodeHasAttribute(el, TAG_VAR_ATTR_ACTION)
) {
namedElement = parseText(el, scopes);
} else {
namedElement = parseVariable(el);
}
return namedElement;
} } | public class class_name {
private PatternElement parseNamedElement(Node el, Map<String, Scope> scopes) {
PatternElement namedElement;
if (
nodeAttribute(el, TAG_VAR_ATTR_PARSE, DEFAULT_PARSE_VALUE)
&& !nodeHasAttribute(el, TAG_VAR_ATTR_REGEX)
&& !nodeHasAttribute(el, TAG_VAR_ATTR_ACTION)
) {
namedElement = parseText(el, scopes); // depends on control dependency: [if], data = [(]
} else {
namedElement = parseVariable(el); // depends on control dependency: [if], data = [(]
}
return namedElement;
} } |
public class class_name {
@Nullable
private static NettyConfig createNettyConfig(
Configuration configuration,
boolean localTaskManagerCommunication,
InetAddress taskManagerAddress,
int dataport) {
final NettyConfig nettyConfig;
if (!localTaskManagerCommunication) {
final InetSocketAddress taskManagerInetSocketAddress = new InetSocketAddress(taskManagerAddress, dataport);
nettyConfig = new NettyConfig(taskManagerInetSocketAddress.getAddress(), taskManagerInetSocketAddress.getPort(),
getPageSize(configuration), ConfigurationParserUtils.getSlot(configuration), configuration);
} else {
nettyConfig = null;
}
return nettyConfig;
} } | public class class_name {
@Nullable
private static NettyConfig createNettyConfig(
Configuration configuration,
boolean localTaskManagerCommunication,
InetAddress taskManagerAddress,
int dataport) {
final NettyConfig nettyConfig;
if (!localTaskManagerCommunication) {
final InetSocketAddress taskManagerInetSocketAddress = new InetSocketAddress(taskManagerAddress, dataport);
nettyConfig = new NettyConfig(taskManagerInetSocketAddress.getAddress(), taskManagerInetSocketAddress.getPort(),
getPageSize(configuration), ConfigurationParserUtils.getSlot(configuration), configuration); // depends on control dependency: [if], data = [none]
} else {
nettyConfig = null; // depends on control dependency: [if], data = [none]
}
return nettyConfig;
} } |
public class class_name {
public <Value> MeasureManager wrapManager(final MeasureManager wrapped,
final Object measureKey) {
if (wrapped == null) {
throw new IllegalArgumentException("No manager provided");
} else if (measureKey != null
&& wrapped.getMeasureKeys().contains(measureKey)) {
throw new IllegalArgumentException("The key " + measureKey
+ " is already used by the wrapped manager " + wrapped);
} else {
MeasureManager wrapper;
if (measureKey != null) {
wrapper = new MeasureManager() {
@Override
public <T> PushMeasure<T> getPushMeasure(Object key) {
return wrapMeasure(wrapped.<T> getPushMeasure(key));
}
@SuppressWarnings("unchecked")
@Override
public <T> PullMeasure<T> getPullMeasure(Object key) {
if (key.equals(measureKey)) {
return (PullMeasure<T>) ListenerTimeMeasure.this;
} else {
return wrapped.<T> getPullMeasure(key);
}
}
@Override
public Collection<Object> getMeasureKeys() {
Collection<Object> keys = new LinkedList<>(
wrapped.getMeasureKeys());
keys.add(measureKey);
return keys;
}
};
} else {
wrapper = new MeasureManager() {
@Override
public <T> PushMeasure<T> getPushMeasure(Object key) {
return wrapMeasure(wrapped.<T> getPushMeasure(key));
}
@Override
public <T> PullMeasure<T> getPullMeasure(Object key) {
return wrapped.<T> getPullMeasure(key);
}
@Override
public Collection<Object> getMeasureKeys() {
return wrapped.getMeasureKeys();
}
};
}
return wrapper;
}
} } | public class class_name {
public <Value> MeasureManager wrapManager(final MeasureManager wrapped,
final Object measureKey) {
if (wrapped == null) {
throw new IllegalArgumentException("No manager provided");
} else if (measureKey != null
&& wrapped.getMeasureKeys().contains(measureKey)) {
throw new IllegalArgumentException("The key " + measureKey
+ " is already used by the wrapped manager " + wrapped);
} else {
MeasureManager wrapper;
if (measureKey != null) {
wrapper = new MeasureManager() {
@Override
public <T> PushMeasure<T> getPushMeasure(Object key) {
return wrapMeasure(wrapped.<T> getPushMeasure(key));
}
@SuppressWarnings("unchecked")
@Override
public <T> PullMeasure<T> getPullMeasure(Object key) {
if (key.equals(measureKey)) {
return (PullMeasure<T>) ListenerTimeMeasure.this; // depends on control dependency: [if], data = [none]
} else {
return wrapped.<T> getPullMeasure(key); // depends on control dependency: [if], data = [none]
}
}
@Override
public Collection<Object> getMeasureKeys() {
Collection<Object> keys = new LinkedList<>(
wrapped.getMeasureKeys());
keys.add(measureKey);
return keys;
}
}; // depends on control dependency: [if], data = [none]
} else {
wrapper = new MeasureManager() {
@Override
public <T> PushMeasure<T> getPushMeasure(Object key) {
return wrapMeasure(wrapped.<T> getPushMeasure(key));
}
@Override
public <T> PullMeasure<T> getPullMeasure(Object key) {
return wrapped.<T> getPullMeasure(key);
}
@Override
public Collection<Object> getMeasureKeys() {
return wrapped.getMeasureKeys();
}
}; // depends on control dependency: [if], data = [none]
}
return wrapper; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
private void open() throws ModbusIOException {
if (commPort != null && !commPort.isOpen()) {
setTimeout(timeout);
try {
commPort.open();
}
catch (IOException e) {
throw new ModbusIOException(String.format("Cannot open port %s - %s", commPort.getDescriptivePortName(), e.getMessage()));
}
}
} } | public class class_name {
private void open() throws ModbusIOException {
if (commPort != null && !commPort.isOpen()) {
setTimeout(timeout);
try {
commPort.open(); // depends on control dependency: [try], data = [none]
}
catch (IOException e) {
throw new ModbusIOException(String.format("Cannot open port %s - %s", commPort.getDescriptivePortName(), e.getMessage()));
} // depends on control dependency: [catch], data = [none]
}
} } |
public class class_name {
public Long zcount(Object key, double min, double max) {
Jedis jedis = getJedis();
try {
return jedis.zcount(keyToBytes(key), min, max);
}
finally {close(jedis);}
} } | public class class_name {
public Long zcount(Object key, double min, double max) {
Jedis jedis = getJedis();
try {
return jedis.zcount(keyToBytes(key), min, max);
// depends on control dependency: [try], data = [none]
}
finally {close(jedis);}
} } |
public class class_name {
private boolean mustSkip(File file)
{
String path = file.getPath();
if(Text.matches(path, ignorePathRegExp) || crawledPaths.contains(path))
{
Debugger.println(this, "skipped ="+path);
return true;
}
return false;
} } | public class class_name {
private boolean mustSkip(File file)
{
String path = file.getPath();
if(Text.matches(path, ignorePathRegExp) || crawledPaths.contains(path))
{
Debugger.println(this, "skipped ="+path);
// depends on control dependency: [if], data = [none]
return true;
// depends on control dependency: [if], data = [none]
}
return false;
} } |
public class class_name {
protected void checkRegisteredDataUsingReservedWord(ActionRuntime runtime, WebContext context, String varKey) {
if (isSuppressRegisteredDataUsingReservedWordCheck()) {
return;
}
if (context.getVariableNames().contains(varKey)) {
throwThymeleafRegisteredDataUsingReservedWordException(runtime, context, varKey);
}
} } | public class class_name {
protected void checkRegisteredDataUsingReservedWord(ActionRuntime runtime, WebContext context, String varKey) {
if (isSuppressRegisteredDataUsingReservedWordCheck()) {
return; // depends on control dependency: [if], data = [none]
}
if (context.getVariableNames().contains(varKey)) {
throwThymeleafRegisteredDataUsingReservedWordException(runtime, context, varKey); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
@Override
public String fetch(String url) {
try{
LOGGER.debug("url:"+url);
HtmlPage htmlPage = WEB_CLIENT.getPage(url);
String html = htmlPage.getBody().asXml();
LOGGER.debug("html:"+html);
return html;
}catch (Exception e) {
LOGGER.error("获取URL:"+url+"页面出错", e);
}
return "";
} } | public class class_name {
@Override
public String fetch(String url) {
try{
LOGGER.debug("url:"+url); // depends on control dependency: [try], data = [none]
HtmlPage htmlPage = WEB_CLIENT.getPage(url);
String html = htmlPage.getBody().asXml();
LOGGER.debug("html:"+html); // depends on control dependency: [try], data = [none]
return html; // depends on control dependency: [try], data = [none]
}catch (Exception e) {
LOGGER.error("获取URL:"+url+"页面出错", e);
} // depends on control dependency: [catch], data = [none]
return "";
} } |
public class class_name {
public static List<ApacheMetrics> findMetrics(List<String> metricsNames) {
if (metricsNames == null || metricsNames.isEmpty()) {
return Collections.singletonList(ApacheMetrics.SERVER_UPTIME);
}
final List<ApacheMetrics> result = new ArrayList<>(metricsNames.size());
for (ApacheMetrics metric : getMetricsOfType(ApacheMetrics.class)) {
if (metricsNames.contains(metric.getCaption())) {
result.add(metric);
continue;
}
//we need 'uptime' to monitor apache restarts.
if (metric == ApacheMetrics.SERVER_UPTIME) {
result.add(metric);
}
}
return result;
} } | public class class_name {
public static List<ApacheMetrics> findMetrics(List<String> metricsNames) {
if (metricsNames == null || metricsNames.isEmpty()) {
return Collections.singletonList(ApacheMetrics.SERVER_UPTIME); // depends on control dependency: [if], data = [none]
}
final List<ApacheMetrics> result = new ArrayList<>(metricsNames.size());
for (ApacheMetrics metric : getMetricsOfType(ApacheMetrics.class)) {
if (metricsNames.contains(metric.getCaption())) {
result.add(metric); // depends on control dependency: [if], data = [none]
continue;
}
//we need 'uptime' to monitor apache restarts.
if (metric == ApacheMetrics.SERVER_UPTIME) {
result.add(metric); // depends on control dependency: [if], data = [(metric]
}
}
return result;
} } |
public class class_name {
@Override
public void processGeneration(Object entity, Field field) {
// Si on ne doit pas evaluer cette annotation
if(!this.isProcessable()) {
// On sort
return;
}
// On caste l'annotation
FieldGenerator castedAnnotation = (FieldGenerator) this.annotation;
// Classe de generation
Class<? extends IFieldGenerator> generatorClass = castedAnnotation.generator();
// Instanciation de la classe
IFieldGenerator generator = null;
try {
// Instanciation de la classe
generator = generatorClass.newInstance();
} catch (Exception e) {
// On relance
throw new RuntimeException("jpersistencetools.generator.classbased.error.instanciate", e);
}
// Initialisation du gestionnaire d'entites
generator.setEntityManager(entityManager);
// Positionnement du gestionnaire d'entites de generation
generator.setGeneratorEntityManager(generatorEntityManager);
// Positionnement du champ a mettre a jour
generator.setField(field);
// Positionnement de l'entite
generator.setEntity(entity);
// Initialisation du generateur
generator.initialize();
// Generation
Serializable generatedValue = generator.generate();
try {
// Obtention du descripteur de proprietes pour cette propriete
PropertyDescriptor propertyDescriptor = new PropertyDescriptor(field.getName(), entity.getClass());
// Obtention du setter
Method propertySetter = propertyDescriptor.getWriteMethod();
// Invocation du setter
propertySetter.invoke(entity, generatedValue);
} catch (Exception e) {
// On relance
throw new RuntimeException("jpersistencetools.generator.classbased.error.update.field", e);
}
} } | public class class_name {
@Override
public void processGeneration(Object entity, Field field) {
// Si on ne doit pas evaluer cette annotation
if(!this.isProcessable()) {
// On sort
return; // depends on control dependency: [if], data = [none]
}
// On caste l'annotation
FieldGenerator castedAnnotation = (FieldGenerator) this.annotation;
// Classe de generation
Class<? extends IFieldGenerator> generatorClass = castedAnnotation.generator();
// Instanciation de la classe
IFieldGenerator generator = null;
try {
// Instanciation de la classe
generator = generatorClass.newInstance(); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
// On relance
throw new RuntimeException("jpersistencetools.generator.classbased.error.instanciate", e);
} // depends on control dependency: [catch], data = [none]
// Initialisation du gestionnaire d'entites
generator.setEntityManager(entityManager);
// Positionnement du gestionnaire d'entites de generation
generator.setGeneratorEntityManager(generatorEntityManager);
// Positionnement du champ a mettre a jour
generator.setField(field);
// Positionnement de l'entite
generator.setEntity(entity);
// Initialisation du generateur
generator.initialize();
// Generation
Serializable generatedValue = generator.generate();
try {
// Obtention du descripteur de proprietes pour cette propriete
PropertyDescriptor propertyDescriptor = new PropertyDescriptor(field.getName(), entity.getClass());
// Obtention du setter
Method propertySetter = propertyDescriptor.getWriteMethod();
// Invocation du setter
propertySetter.invoke(entity, generatedValue); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
// On relance
throw new RuntimeException("jpersistencetools.generator.classbased.error.update.field", e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
private static void shuffle(int[] a) {
Random rnd = ThreadLocalRandom.current();
for (int i = a.length - 1; i > 0; i--) {
int index = rnd.nextInt(i + 1);
int e = a[index];
a[index] = a[i];
a[i] = e;
}
} } | public class class_name {
private static void shuffle(int[] a) {
Random rnd = ThreadLocalRandom.current();
for (int i = a.length - 1; i > 0; i--) {
int index = rnd.nextInt(i + 1);
int e = a[index];
a[index] = a[i]; // depends on control dependency: [for], data = [i]
a[i] = e; // depends on control dependency: [for], data = [i]
}
} } |
public class class_name {
public void setTraceSegmentDocuments(java.util.Collection<String> traceSegmentDocuments) {
if (traceSegmentDocuments == null) {
this.traceSegmentDocuments = null;
return;
}
this.traceSegmentDocuments = new java.util.ArrayList<String>(traceSegmentDocuments);
} } | public class class_name {
public void setTraceSegmentDocuments(java.util.Collection<String> traceSegmentDocuments) {
if (traceSegmentDocuments == null) {
this.traceSegmentDocuments = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.traceSegmentDocuments = new java.util.ArrayList<String>(traceSegmentDocuments);
} } |
public class class_name {
public static DEigenpair computeEigenVector(DMatrixRMaj A , double eigenvalue )
{
if( A.numRows != A.numCols )
throw new IllegalArgumentException("Must be a square matrix.");
DMatrixRMaj M = new DMatrixRMaj(A.numRows,A.numCols);
DMatrixRMaj x = new DMatrixRMaj(A.numRows,1);
DMatrixRMaj b = new DMatrixRMaj(A.numRows,1);
CommonOps_DDRM.fill(b, 1);
// perturb the eigenvalue slightly so that its not an exact solution the first time
// eigenvalue -= eigenvalue*UtilEjml.EPS*10;
double origEigenvalue = eigenvalue;
SpecializedOps_DDRM.addIdentity(A,M,-eigenvalue);
double threshold = NormOps_DDRM.normPInf(A)*UtilEjml.EPS;
double prevError = Double.MAX_VALUE;
boolean hasWorked = false;
LinearSolverDense<DMatrixRMaj> solver = LinearSolverFactory_DDRM.linear(M.numRows);
double perp = 0.0001;
for( int i = 0; i < 200; i++ ) {
boolean failed = false;
// if the matrix is singular then the eigenvalue is within machine precision
// of the true value, meaning that x must also be.
if( !solver.setA(M) ) {
failed = true;
} else {
solver.solve(b,x);
}
// see if solve silently failed
if( MatrixFeatures_DDRM.hasUncountable(x)) {
failed = true;
}
if( failed ) {
if( !hasWorked ) {
// if it failed on the first trial try perturbing it some more
double val = i % 2 == 0 ? 1.0-perp : 1.0 + perp;
// maybe this should be turn into a parameter allowing the user
// to configure the wise of each step
eigenvalue = origEigenvalue * Math.pow(val,i/2+1);
SpecializedOps_DDRM.addIdentity(A,M,-eigenvalue);
} else {
// otherwise assume that it was so accurate that the matrix was singular
// and return that result
return new DEigenpair(eigenvalue,b);
}
} else {
hasWorked = true;
b.set(x);
NormOps_DDRM.normalizeF(b);
// compute the residual
CommonOps_DDRM.mult(M,b,x);
double error = NormOps_DDRM.normPInf(x);
if( error-prevError > UtilEjml.EPS*10) {
// if the error increased it is probably converging towards a different
// eigenvalue
// CommonOps.set(b,1);
prevError = Double.MAX_VALUE;
hasWorked = false;
double val = i % 2 == 0 ? 1.0-perp : 1.0 + perp;
eigenvalue = origEigenvalue * Math.pow(val,1);
} else {
// see if it has converged
if(error <= threshold || Math.abs(prevError-error) <= UtilEjml.EPS)
return new DEigenpair(eigenvalue,b);
// update everything
prevError = error;
eigenvalue = VectorVectorMult_DDRM.innerProdA(b,A,b);
}
SpecializedOps_DDRM.addIdentity(A,M,-eigenvalue);
}
}
return null;
} } | public class class_name {
public static DEigenpair computeEigenVector(DMatrixRMaj A , double eigenvalue )
{
if( A.numRows != A.numCols )
throw new IllegalArgumentException("Must be a square matrix.");
DMatrixRMaj M = new DMatrixRMaj(A.numRows,A.numCols);
DMatrixRMaj x = new DMatrixRMaj(A.numRows,1);
DMatrixRMaj b = new DMatrixRMaj(A.numRows,1);
CommonOps_DDRM.fill(b, 1);
// perturb the eigenvalue slightly so that its not an exact solution the first time
// eigenvalue -= eigenvalue*UtilEjml.EPS*10;
double origEigenvalue = eigenvalue;
SpecializedOps_DDRM.addIdentity(A,M,-eigenvalue);
double threshold = NormOps_DDRM.normPInf(A)*UtilEjml.EPS;
double prevError = Double.MAX_VALUE;
boolean hasWorked = false;
LinearSolverDense<DMatrixRMaj> solver = LinearSolverFactory_DDRM.linear(M.numRows);
double perp = 0.0001;
for( int i = 0; i < 200; i++ ) {
boolean failed = false;
// if the matrix is singular then the eigenvalue is within machine precision
// of the true value, meaning that x must also be.
if( !solver.setA(M) ) {
failed = true; // depends on control dependency: [if], data = [none]
} else {
solver.solve(b,x); // depends on control dependency: [if], data = [none]
}
// see if solve silently failed
if( MatrixFeatures_DDRM.hasUncountable(x)) {
failed = true; // depends on control dependency: [if], data = [none]
}
if( failed ) {
if( !hasWorked ) {
// if it failed on the first trial try perturbing it some more
double val = i % 2 == 0 ? 1.0-perp : 1.0 + perp;
// maybe this should be turn into a parameter allowing the user
// to configure the wise of each step
eigenvalue = origEigenvalue * Math.pow(val,i/2+1); // depends on control dependency: [if], data = [none]
SpecializedOps_DDRM.addIdentity(A,M,-eigenvalue); // depends on control dependency: [if], data = [none]
} else {
// otherwise assume that it was so accurate that the matrix was singular
// and return that result
return new DEigenpair(eigenvalue,b); // depends on control dependency: [if], data = [none]
}
} else {
hasWorked = true; // depends on control dependency: [if], data = [none]
b.set(x); // depends on control dependency: [if], data = [none]
NormOps_DDRM.normalizeF(b); // depends on control dependency: [if], data = [none]
// compute the residual
CommonOps_DDRM.mult(M,b,x); // depends on control dependency: [if], data = [none]
double error = NormOps_DDRM.normPInf(x);
if( error-prevError > UtilEjml.EPS*10) {
// if the error increased it is probably converging towards a different
// eigenvalue
// CommonOps.set(b,1);
prevError = Double.MAX_VALUE; // depends on control dependency: [if], data = [none]
hasWorked = false; // depends on control dependency: [if], data = [none]
double val = i % 2 == 0 ? 1.0-perp : 1.0 + perp;
eigenvalue = origEigenvalue * Math.pow(val,1); // depends on control dependency: [if], data = [none]
} else {
// see if it has converged
if(error <= threshold || Math.abs(prevError-error) <= UtilEjml.EPS)
return new DEigenpair(eigenvalue,b);
// update everything
prevError = error; // depends on control dependency: [if], data = [none]
eigenvalue = VectorVectorMult_DDRM.innerProdA(b,A,b); // depends on control dependency: [if], data = [none]
}
SpecializedOps_DDRM.addIdentity(A,M,-eigenvalue); // depends on control dependency: [if], data = [none]
}
}
return null;
} } |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.