code
stringlengths 130
281k
| code_dependency
stringlengths 182
306k
|
|---|---|
public class class_name {
public void marshall(BusinessReport businessReport, ProtocolMarshaller protocolMarshaller) {
if (businessReport == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(businessReport.getStatus(), STATUS_BINDING);
protocolMarshaller.marshall(businessReport.getFailureCode(), FAILURECODE_BINDING);
protocolMarshaller.marshall(businessReport.getS3Location(), S3LOCATION_BINDING);
protocolMarshaller.marshall(businessReport.getDeliveryTime(), DELIVERYTIME_BINDING);
protocolMarshaller.marshall(businessReport.getDownloadUrl(), DOWNLOADURL_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} }
|
public class class_name {
public void marshall(BusinessReport businessReport, ProtocolMarshaller protocolMarshaller) {
if (businessReport == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(businessReport.getStatus(), STATUS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(businessReport.getFailureCode(), FAILURECODE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(businessReport.getS3Location(), S3LOCATION_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(businessReport.getDeliveryTime(), DELIVERYTIME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(businessReport.getDownloadUrl(), DOWNLOADURL_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 {
@SuppressWarnings("rawtypes")
public static String join(final Collection<?> col, final String separator,
final boolean ignoreEmptyElement, final boolean trim, final ElementConverter elementConverter) {
final List<Object> list = new ArrayList<Object>();
for(Object element : col) {
if(element == null) {
continue;
}
Object value = element;
if(element instanceof String) {
String str = (String) element;
if(ignoreEmptyElement && isEmpty(str)) {
continue;
} else if(trim) {
value = str.trim();
}
} else if(element instanceof Character && isEmpty(element.toString())) {
String str = element.toString();
if(ignoreEmptyElement && isEmpty(str)) {
continue;
} else if(trim) {
value = str.trim().charAt(0);
}
} else if(char.class.isAssignableFrom(element.getClass())) {
String str = element.toString();
if(ignoreEmptyElement && isEmpty(str)) {
continue;
} else if(trim) {
value = str.trim().charAt(0);
}
}
list.add(value);
}
return join(list, separator, elementConverter);
} }
|
public class class_name {
@SuppressWarnings("rawtypes")
public static String join(final Collection<?> col, final String separator,
final boolean ignoreEmptyElement, final boolean trim, final ElementConverter elementConverter) {
final List<Object> list = new ArrayList<Object>();
for(Object element : col) {
if(element == null) {
continue;
}
Object value = element;
if(element instanceof String) {
String str = (String) element;
if(ignoreEmptyElement && isEmpty(str)) {
continue;
} else if(trim) {
value = str.trim();
// depends on control dependency: [if], data = [none]
}
} else if(element instanceof Character && isEmpty(element.toString())) {
String str = element.toString();
if(ignoreEmptyElement && isEmpty(str)) {
continue;
} else if(trim) {
value = str.trim().charAt(0);
// depends on control dependency: [if], data = [none]
}
} else if(char.class.isAssignableFrom(element.getClass())) {
String str = element.toString();
if(ignoreEmptyElement && isEmpty(str)) {
continue;
} else if(trim) {
value = str.trim().charAt(0);
// depends on control dependency: [if], data = [none]
}
}
list.add(value);
// depends on control dependency: [for], data = [none]
}
return join(list, separator, elementConverter);
} }
|
public class class_name {
public static Boolean compareMultipleClientConfigAvro(String configAvro1, String configAvro2) {
Map<String, Properties> mapStoreToProps1 = readMultipleClientConfigAvro(configAvro1);
Map<String, Properties> mapStoreToProps2 = readMultipleClientConfigAvro(configAvro2);
Set<String> keySet1 = mapStoreToProps1.keySet();
Set<String> keySet2 = mapStoreToProps2.keySet();
if(!keySet1.equals(keySet2)) {
return false;
}
for(String storeName: keySet1) {
Properties props1 = mapStoreToProps1.get(storeName);
Properties props2 = mapStoreToProps2.get(storeName);
if(!props1.equals(props2)) {
return false;
}
}
return true;
} }
|
public class class_name {
public static Boolean compareMultipleClientConfigAvro(String configAvro1, String configAvro2) {
Map<String, Properties> mapStoreToProps1 = readMultipleClientConfigAvro(configAvro1);
Map<String, Properties> mapStoreToProps2 = readMultipleClientConfigAvro(configAvro2);
Set<String> keySet1 = mapStoreToProps1.keySet();
Set<String> keySet2 = mapStoreToProps2.keySet();
if(!keySet1.equals(keySet2)) {
return false; // depends on control dependency: [if], data = [none]
}
for(String storeName: keySet1) {
Properties props1 = mapStoreToProps1.get(storeName);
Properties props2 = mapStoreToProps2.get(storeName);
if(!props1.equals(props2)) {
return false; // depends on control dependency: [if], data = [none]
}
}
return true;
} }
|
public class class_name {
private SortedSet<String> applyOverrideForce(String configurationId, Map<String, Object> parameterValues,
SortedSet<String> ancestorLockedParameterNames) {
for (Parameter<?> parameter : allParameters) {
Object overrideValue = parameterOverride.getOverrideForce(configurationId, parameter);
if (overrideValue != null) {
parameterValues.put(parameter.getName(), overrideValue);
}
}
Set<String> overrideLockedParameterNames = parameterOverride.getLockedParameterNames(configurationId);
// aggregate set of locked parameter names from ancestor levels and this level
return mergeSets(ancestorLockedParameterNames, overrideLockedParameterNames);
} }
|
public class class_name {
private SortedSet<String> applyOverrideForce(String configurationId, Map<String, Object> parameterValues,
SortedSet<String> ancestorLockedParameterNames) {
for (Parameter<?> parameter : allParameters) {
Object overrideValue = parameterOverride.getOverrideForce(configurationId, parameter);
if (overrideValue != null) {
parameterValues.put(parameter.getName(), overrideValue); // depends on control dependency: [if], data = [none]
}
}
Set<String> overrideLockedParameterNames = parameterOverride.getLockedParameterNames(configurationId);
// aggregate set of locked parameter names from ancestor levels and this level
return mergeSets(ancestorLockedParameterNames, overrideLockedParameterNames);
} }
|
public class class_name {
private void cacheAuthorizationInfoById(String id, AuthorizationInfo authorizationInfo) {
Cache<String, AuthorizationInfo> idAuthorizationCache = getAvailableIdAuthorizationCache();
if (idAuthorizationCache != null) {
idAuthorizationCache.put(id, authorizationInfo);
}
} }
|
public class class_name {
private void cacheAuthorizationInfoById(String id, AuthorizationInfo authorizationInfo) {
Cache<String, AuthorizationInfo> idAuthorizationCache = getAvailableIdAuthorizationCache();
if (idAuthorizationCache != null) {
idAuthorizationCache.put(id, authorizationInfo); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
protected static Action findAction(EObject grammarComponent, String assignmentName) {
for (final Action action : GrammarUtil.containedActions(grammarComponent)) {
if (GrammarUtil.isAssignedAction(action)) {
if (Objects.equals(assignmentName, action.getFeature())) {
return action;
}
}
}
return null;
} }
|
public class class_name {
protected static Action findAction(EObject grammarComponent, String assignmentName) {
for (final Action action : GrammarUtil.containedActions(grammarComponent)) {
if (GrammarUtil.isAssignedAction(action)) {
if (Objects.equals(assignmentName, action.getFeature())) {
return action; // depends on control dependency: [if], data = [none]
}
}
}
return null;
} }
|
public class class_name {
private boolean awaitRunning(Service service, long timeoutAt) {
if (service.isRunning()) {
return true;
}
long waitMillis = timeoutAt - System.currentTimeMillis();
if (waitMillis <= 0) {
return false;
}
try {
service.start().get(waitMillis, TimeUnit.MILLISECONDS);
} catch (Exception e) {
// Fall through
}
return service.isRunning();
} }
|
public class class_name {
private boolean awaitRunning(Service service, long timeoutAt) {
if (service.isRunning()) {
return true; // depends on control dependency: [if], data = [none]
}
long waitMillis = timeoutAt - System.currentTimeMillis();
if (waitMillis <= 0) {
return false; // depends on control dependency: [if], data = [none]
}
try {
service.start().get(waitMillis, TimeUnit.MILLISECONDS); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
// Fall through
} // depends on control dependency: [catch], data = [none]
return service.isRunning();
} }
|
public class class_name {
public void printStackTrace(PrintStream printStream) {
if (mStackTrace == null) {
printStream.print(getMessage());
}
else {
printStream.print(mStackTrace);
}
} }
|
public class class_name {
public void printStackTrace(PrintStream printStream) {
if (mStackTrace == null) {
printStream.print(getMessage()); // depends on control dependency: [if], data = [none]
}
else {
printStream.print(mStackTrace); // depends on control dependency: [if], data = [(mStackTrace]
}
} }
|
public class class_name {
private boolean getLocalItemSupport(FPTree.Node node, int[] localItemSupport) {
boolean end = true;
Arrays.fill(localItemSupport, 0);
while (node != null) {
int support = node.count;
Node parent = node.parent;
while (parent != null) {
localItemSupport[parent.id] += support;
parent = parent.parent;
end = false;
}
node = node.next;
}
return !end;
} }
|
public class class_name {
private boolean getLocalItemSupport(FPTree.Node node, int[] localItemSupport) {
boolean end = true;
Arrays.fill(localItemSupport, 0);
while (node != null) {
int support = node.count;
Node parent = node.parent;
while (parent != null) {
localItemSupport[parent.id] += support; // depends on control dependency: [while], data = [none]
parent = parent.parent; // depends on control dependency: [while], data = [none]
end = false; // depends on control dependency: [while], data = [none]
}
node = node.next; // depends on control dependency: [while], data = [none]
}
return !end;
} }
|
public class class_name {
public final EObject entryRuleAssumeExpression() throws RecognitionException {
EObject current = null;
EObject iv_ruleAssumeExpression = null;
try {
// InternalSARL.g:7586:57: (iv_ruleAssumeExpression= ruleAssumeExpression EOF )
// InternalSARL.g:7587:2: iv_ruleAssumeExpression= ruleAssumeExpression EOF
{
if ( state.backtracking==0 ) {
newCompositeNode(grammarAccess.getAssumeExpressionRule());
}
pushFollow(FOLLOW_1);
iv_ruleAssumeExpression=ruleAssumeExpression();
state._fsp--;
if (state.failed) return current;
if ( state.backtracking==0 ) {
current =iv_ruleAssumeExpression;
}
match(input,EOF,FOLLOW_2); if (state.failed) return current;
}
}
catch (RecognitionException re) {
recover(input,re);
appendSkippedTokens();
}
finally {
}
return current;
} }
|
public class class_name {
public final EObject entryRuleAssumeExpression() throws RecognitionException {
EObject current = null;
EObject iv_ruleAssumeExpression = null;
try {
// InternalSARL.g:7586:57: (iv_ruleAssumeExpression= ruleAssumeExpression EOF )
// InternalSARL.g:7587:2: iv_ruleAssumeExpression= ruleAssumeExpression EOF
{
if ( state.backtracking==0 ) {
newCompositeNode(grammarAccess.getAssumeExpressionRule()); // depends on control dependency: [if], data = [none]
}
pushFollow(FOLLOW_1);
iv_ruleAssumeExpression=ruleAssumeExpression();
state._fsp--;
if (state.failed) return current;
if ( state.backtracking==0 ) {
current =iv_ruleAssumeExpression; // depends on control dependency: [if], data = [none]
}
match(input,EOF,FOLLOW_2); if (state.failed) return current;
}
}
catch (RecognitionException re) {
recover(input,re);
appendSkippedTokens();
}
finally {
}
return current;
} }
|
public class class_name {
public static AnnotationAttributes fromMap(Map<String, Object> map) {
if (map == null) {
return null;
}
if (map instanceof AnnotationAttributes) {
return (AnnotationAttributes) map;
}
return new AnnotationAttributes(map);
} }
|
public class class_name {
public static AnnotationAttributes fromMap(Map<String, Object> map) {
if (map == null) {
return null; // depends on control dependency: [if], data = [none]
}
if (map instanceof AnnotationAttributes) {
return (AnnotationAttributes) map; // depends on control dependency: [if], data = [none]
}
return new AnnotationAttributes(map);
} }
|
public class class_name {
public void marshall(Configurations configurations, ProtocolMarshaller protocolMarshaller) {
if (configurations == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(configurations.getCurrent(), CURRENT_BINDING);
protocolMarshaller.marshall(configurations.getHistory(), HISTORY_BINDING);
protocolMarshaller.marshall(configurations.getPending(), PENDING_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} }
|
public class class_name {
public void marshall(Configurations configurations, ProtocolMarshaller protocolMarshaller) {
if (configurations == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(configurations.getCurrent(), CURRENT_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(configurations.getHistory(), HISTORY_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(configurations.getPending(), PENDING_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 IScope createFeatureCallSerializationScope(EObject context) {
if (!(context instanceof XAbstractFeatureCall)) {
return IScope.NULLSCOPE;
}
XAbstractFeatureCall call = (XAbstractFeatureCall) context;
JvmIdentifiableElement feature = call.getFeature();
// this and super - logical container aware FeatureScopes
if (feature instanceof JvmType) {
return getTypeScope(call, (JvmType) feature);
}
if (feature instanceof JvmConstructor) {
return getThisOrSuperScope(call, (JvmConstructor) feature);
}
if (feature instanceof JvmExecutable) {
return getExecutableScope(call, feature);
}
if (feature instanceof JvmFormalParameter || feature instanceof JvmField || feature instanceof XVariableDeclaration || feature instanceof XSwitchExpression) {
return new SingletonScope(EObjectDescription.create(feature.getSimpleName(), feature), IScope.NULLSCOPE);
}
return IScope.NULLSCOPE;
} }
|
public class class_name {
public IScope createFeatureCallSerializationScope(EObject context) {
if (!(context instanceof XAbstractFeatureCall)) {
return IScope.NULLSCOPE; // depends on control dependency: [if], data = [none]
}
XAbstractFeatureCall call = (XAbstractFeatureCall) context;
JvmIdentifiableElement feature = call.getFeature();
// this and super - logical container aware FeatureScopes
if (feature instanceof JvmType) {
return getTypeScope(call, (JvmType) feature); // depends on control dependency: [if], data = [none]
}
if (feature instanceof JvmConstructor) {
return getThisOrSuperScope(call, (JvmConstructor) feature); // depends on control dependency: [if], data = [none]
}
if (feature instanceof JvmExecutable) {
return getExecutableScope(call, feature); // depends on control dependency: [if], data = [none]
}
if (feature instanceof JvmFormalParameter || feature instanceof JvmField || feature instanceof XVariableDeclaration || feature instanceof XSwitchExpression) {
return new SingletonScope(EObjectDescription.create(feature.getSimpleName(), feature), IScope.NULLSCOPE); // depends on control dependency: [if], data = [none]
}
return IScope.NULLSCOPE;
} }
|
public class class_name {
public static File[] findKthVersionedDir(File[] versionDirs, int start, int end) {
if(start < 0 || end >= versionDirs.length) {
logger.error("Incorrect version number requested (" + start + "," + end
+ "). Should be between (0," + (versionDirs.length - 1) + ")");
return null;
}
Collections.sort(Arrays.asList(versionDirs), new Comparator<File>() {
public int compare(File file1, File file2) {
long fileId1 = getVersionId(file1), fileId2 = getVersionId(file2);
if(fileId1 == fileId2) {
return 0;
} else {
if(fileId1 == -1) {
return 1;
}
if(fileId2 == -1) {
return -1;
}
if(fileId1 < fileId2) {
return -1;
} else {
return 1;
}
}
}
});
File[] returnedFiles = new File[end - start + 1];
for(int index = start, index2 = 0; index <= end; index++, index2++) {
returnedFiles[index2] = versionDirs[index];
}
return returnedFiles;
} }
|
public class class_name {
public static File[] findKthVersionedDir(File[] versionDirs, int start, int end) {
if(start < 0 || end >= versionDirs.length) {
logger.error("Incorrect version number requested (" + start + "," + end
+ "). Should be between (0," + (versionDirs.length - 1) + ")");
return null;
}
Collections.sort(Arrays.asList(versionDirs), new Comparator<File>() {
public int compare(File file1, File file2) {
long fileId1 = getVersionId(file1), fileId2 = getVersionId(file2);
if(fileId1 == fileId2) {
return 0; // depends on control dependency: [if], data = [none]
} else {
if(fileId1 == -1) {
return 1; // depends on control dependency: [if], data = [none]
}
if(fileId2 == -1) {
return -1; // depends on control dependency: [if], data = [none]
}
if(fileId1 < fileId2) {
return -1; // depends on control dependency: [if], data = [none]
} else {
return 1; // depends on control dependency: [if], data = [none]
}
}
}
});
File[] returnedFiles = new File[end - start + 1];
for(int index = start, index2 = 0; index <= end; index++, index2++) { // depends on control dependency: [if], data = [none]
returnedFiles[index2] = versionDirs[index];
}
return returnedFiles; // depends on control dependency: [if], data = [none]
} }
|
public class class_name {
public com.google.protobuf.ByteString
getNobuildFilesRegexBytes() {
java.lang.Object ref = nobuildFilesRegex_;
if (ref instanceof java.lang.String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
nobuildFilesRegex_ = b;
return b;
} else {
return (com.google.protobuf.ByteString) ref;
}
} }
|
public class class_name {
public com.google.protobuf.ByteString
getNobuildFilesRegexBytes() {
java.lang.Object ref = nobuildFilesRegex_;
if (ref instanceof java.lang.String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
nobuildFilesRegex_ = b; // depends on control dependency: [if], data = [none]
return b; // depends on control dependency: [if], data = [none]
} else {
return (com.google.protobuf.ByteString) ref; // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public char[] getCharBuffer(int expected) {
if (this.charBuffer.length >= expected) {
return charBuffer;
} else if (expected < MAX_SIZE) {
// ?预先设置多一点
this.charBuffer = new char[(int) (expected * 1.2)];
} else {
return EMPTY_CHAR_ARRAY;
}
return this.charBuffer;
} }
|
public class class_name {
public char[] getCharBuffer(int expected) {
if (this.charBuffer.length >= expected) {
return charBuffer;
// depends on control dependency: [if], data = [none]
} else if (expected < MAX_SIZE) {
// ?预先设置多一点
this.charBuffer = new char[(int) (expected * 1.2)];
// depends on control dependency: [if], data = [(expected]
} else {
return EMPTY_CHAR_ARRAY;
// depends on control dependency: [if], data = [none]
}
return this.charBuffer;
} }
|
public class class_name {
@Override
@Pure
public GraphIterator<RoadSegment, RoadConnection> depthIterator(
double depth, double position_from_starting_point,
RoadConnection starting_point, boolean allowManyReplies,
boolean assumeOrientedSegments) {
RoadConnection pt = starting_point.getWrappedRoadConnection();
if ((pt == null)
|| ((!getBeginPoint(StandardRoadConnection.class).equals(pt))
&& (!getEndPoint(StandardRoadConnection.class).equals(pt)))) {
pt = getBeginPoint(StandardRoadConnection.class);
}
return new DistanceBasedRoadNetworkIterator(
getRoadNetwork(),
depth, position_from_starting_point,
this, pt,
allowManyReplies, assumeOrientedSegments);
} }
|
public class class_name {
@Override
@Pure
public GraphIterator<RoadSegment, RoadConnection> depthIterator(
double depth, double position_from_starting_point,
RoadConnection starting_point, boolean allowManyReplies,
boolean assumeOrientedSegments) {
RoadConnection pt = starting_point.getWrappedRoadConnection();
if ((pt == null)
|| ((!getBeginPoint(StandardRoadConnection.class).equals(pt))
&& (!getEndPoint(StandardRoadConnection.class).equals(pt)))) {
pt = getBeginPoint(StandardRoadConnection.class); // depends on control dependency: [if], data = [none]
}
return new DistanceBasedRoadNetworkIterator(
getRoadNetwork(),
depth, position_from_starting_point,
this, pt,
allowManyReplies, assumeOrientedSegments);
} }
|
public class class_name {
private void updateContextDates(CmsDbContext dbc, CmsResource resource) {
CmsFlexRequestContextInfo info = dbc.getFlexRequestContextInfo();
if (info != null) {
info.updateFromResource(resource);
}
} }
|
public class class_name {
private void updateContextDates(CmsDbContext dbc, CmsResource resource) {
CmsFlexRequestContextInfo info = dbc.getFlexRequestContextInfo();
if (info != null) {
info.updateFromResource(resource); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
private String _wrap_location(String location) {
int length = MAX_WIDTH - QUALIFIER_INDENT;
if(location.length() <= length) {
return location;
}
int index = location.substring(length).lastIndexOf(",");
if(-1 == index) {
//No good place to split (!)
return location;
}
return location.substring(0,index+1) + lineSep + QUALIFIER_INDENT_STR + _wrap_location(location.substring(index+1));
} }
|
public class class_name {
private String _wrap_location(String location) {
int length = MAX_WIDTH - QUALIFIER_INDENT;
if(location.length() <= length) {
return location; // depends on control dependency: [if], data = [none]
}
int index = location.substring(length).lastIndexOf(",");
if(-1 == index) {
//No good place to split (!)
return location; // depends on control dependency: [if], data = [none]
}
return location.substring(0,index+1) + lineSep + QUALIFIER_INDENT_STR + _wrap_location(location.substring(index+1));
} }
|
public class class_name {
public void onResponse(final MobicentsSipServletResponse response, final int status) throws DispatcherException
{
// If we are canceled but still receiving provisional responses try to cancel them
if(canceled && status < 200) {
if(logger.isDebugEnabled()) {
logger.debug("ProxyBranch " + this + " with outgoing request " + outgoingRequest + " cancelled and still receiving provisional response, trying to cancel them");
}
try {
final SipServletRequest cancelRequest = outgoingRequest.createCancel();
cancelRequest.send();
} catch (Exception e) {
if(logger.isDebugEnabled()) {
logger.debug("Failed to cancel again a provisional response " + response.toString()
, e);
}
}
}
// We have already sent TRYING, don't send another one
if(status == 100) {
if(logger.isDebugEnabled() && proxyBranch1xxTimerStarted) {
logger.debug("1xx received, cancelling 1xx timer ");
}
cancel1xxTimer();
return;
}
// Send informational responses back immediately
if((status > 100 && status < 200) || (status == 200 &&
(Request.PRACK.equals(response.getMethod()) || Request.UPDATE.equals(response.getMethod()))))
{
// Deterimine if the response is reliable. We just look at RSeq, because
// every such response is required to have it.
if(response.getHeader("RSeq") != null) {
this.setWaitingForPrack(true); // this branch is expecting a PRACK now
}
final SipServletResponseImpl proxiedResponse =
ProxyUtils.createProxiedResponse(response, this);
if(proxiedResponse == null) {
if(logger.isDebugEnabled())
logger.debug("Response dropped because it was addressed to this machine.");
return; // this response was addressed to this proxy
}
try {
String branch = ((Via)proxiedResponse.getMessage().getHeader(Via.NAME)).getBranch();
synchronized(this.ongoingTransactions) {
for(TransactionRequest tr : this.ongoingTransactions) {
if(tr.branchId.equals(branch)) {
((SipServletResponseImpl)proxiedResponse).setTransaction(tr.request.getTransaction());
((SipServletResponseImpl)proxiedResponse).setOriginalRequest(tr.request);
break;
}
}
}
proxiedResponse.send();
if(logger.isDebugEnabled())
logger.debug("Proxy response sent out sucessfully");
} catch (Exception e) {
logger.error("A problem occured while proxying a response", e);
}
if(logger.isDebugEnabled())
logger.debug("SipSession state " + response.getSipSession().getState());
if(status == 200 &&
(Request.PRACK.equals(response.getMethod()) || Request.UPDATE.equals(response.getMethod()))
// Added for http://code.google.com/p/sipservlets/issues/detail?id=41
&& State.EARLY.equals(response.getSipSession().getState())) {
updateTimer(true, response.getSipApplicationSession(false));
}
if(logger.isDebugEnabled())
logger.debug("About to return from onResponse");
return;
}
// Non-provisional responses must also cancel the timer, otherwise it will timeout
// and return multiple responses for a single transaction.
cancelTimer();
if(status >= 600) // Cancel all 10.2.4
this.proxy.cancelAllExcept(this, null, null, null, false);
// FYI: ACK is sent automatically by jsip when needed
boolean recursed = false;
if(status >= 300 && status < 400 && recurse) {
String contact = response.getHeader("Contact");
if(contact != null) {
//javax.sip.address.SipURI uri = SipFactoryImpl.addressFactory.createAddress(contact);
try {
if(logger.isDebugEnabled())
logger.debug("Processing recursed response");
int start = contact.indexOf('<');
int end = contact.indexOf('>');
contact = contact.substring(start + 1, end);
URI uri = proxy.getSipFactoryImpl().createURI(contact);
ArrayList<SipURI> list = new ArrayList<SipURI>();
list.add((SipURI)uri);
List<ProxyBranch> pblist = proxy.createProxyBranches(list);
ProxyBranchImpl pbi = (ProxyBranchImpl)pblist.get(0);
this.addRecursedBranch(pbi);
pbi.start();
recursed = true;
} catch (ServletParseException e) {
throw new IllegalArgumentException("Can not parse contact header", e);
}
}
}
if(status >= 200 && !recursed)
{
if(proxy.getFinalBranchForSubsequentRequests() == null ||
(outgoingRequest != null && outgoingRequest.isInitial())) {
if(logger.isDebugEnabled())
logger.debug("Handling final response for initial request");
this.proxy.onFinalResponse(this);
} else {
if(logger.isDebugEnabled())
logger.debug("Handling final response for non-initial request");
this.proxy.sendFinalResponse(response, this);
}
}
} }
|
public class class_name {
public void onResponse(final MobicentsSipServletResponse response, final int status) throws DispatcherException
{
// If we are canceled but still receiving provisional responses try to cancel them
if(canceled && status < 200) {
if(logger.isDebugEnabled()) {
logger.debug("ProxyBranch " + this + " with outgoing request " + outgoingRequest + " cancelled and still receiving provisional response, trying to cancel them"); // depends on control dependency: [if], data = [none]
}
try {
final SipServletRequest cancelRequest = outgoingRequest.createCancel();
cancelRequest.send(); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
if(logger.isDebugEnabled()) {
logger.debug("Failed to cancel again a provisional response " + response.toString()
, e); // depends on control dependency: [if], data = [none]
}
} // depends on control dependency: [catch], data = [none]
}
// We have already sent TRYING, don't send another one
if(status == 100) {
if(logger.isDebugEnabled() && proxyBranch1xxTimerStarted) {
logger.debug("1xx received, cancelling 1xx timer ");
}
cancel1xxTimer();
return;
}
// Send informational responses back immediately
if((status > 100 && status < 200) || (status == 200 &&
(Request.PRACK.equals(response.getMethod()) || Request.UPDATE.equals(response.getMethod()))))
{
// Deterimine if the response is reliable. We just look at RSeq, because
// every such response is required to have it.
if(response.getHeader("RSeq") != null) {
this.setWaitingForPrack(true); // this branch is expecting a PRACK now
}
final SipServletResponseImpl proxiedResponse =
ProxyUtils.createProxiedResponse(response, this);
if(proxiedResponse == null) {
if(logger.isDebugEnabled())
logger.debug("Response dropped because it was addressed to this machine.");
return; // this response was addressed to this proxy
}
try {
String branch = ((Via)proxiedResponse.getMessage().getHeader(Via.NAME)).getBranch();
synchronized(this.ongoingTransactions) {
for(TransactionRequest tr : this.ongoingTransactions) {
if(tr.branchId.equals(branch)) {
((SipServletResponseImpl)proxiedResponse).setTransaction(tr.request.getTransaction());
((SipServletResponseImpl)proxiedResponse).setOriginalRequest(tr.request);
break;
}
}
}
proxiedResponse.send();
if(logger.isDebugEnabled())
logger.debug("Proxy response sent out sucessfully");
} catch (Exception e) {
logger.error("A problem occured while proxying a response", e);
}
if(logger.isDebugEnabled())
logger.debug("SipSession state " + response.getSipSession().getState());
if(status == 200 &&
(Request.PRACK.equals(response.getMethod()) || Request.UPDATE.equals(response.getMethod()))
// Added for http://code.google.com/p/sipservlets/issues/detail?id=41
&& State.EARLY.equals(response.getSipSession().getState())) {
updateTimer(true, response.getSipApplicationSession(false));
}
if(logger.isDebugEnabled())
logger.debug("About to return from onResponse");
return;
}
// Non-provisional responses must also cancel the timer, otherwise it will timeout
// and return multiple responses for a single transaction.
cancelTimer();
if(status >= 600) // Cancel all 10.2.4
this.proxy.cancelAllExcept(this, null, null, null, false);
// FYI: ACK is sent automatically by jsip when needed
boolean recursed = false;
if(status >= 300 && status < 400 && recurse) {
String contact = response.getHeader("Contact");
if(contact != null) {
//javax.sip.address.SipURI uri = SipFactoryImpl.addressFactory.createAddress(contact);
try {
if(logger.isDebugEnabled())
logger.debug("Processing recursed response");
int start = contact.indexOf('<');
int end = contact.indexOf('>');
contact = contact.substring(start + 1, end);
URI uri = proxy.getSipFactoryImpl().createURI(contact);
ArrayList<SipURI> list = new ArrayList<SipURI>();
list.add((SipURI)uri);
List<ProxyBranch> pblist = proxy.createProxyBranches(list);
ProxyBranchImpl pbi = (ProxyBranchImpl)pblist.get(0);
this.addRecursedBranch(pbi);
pbi.start();
recursed = true;
} catch (ServletParseException e) {
throw new IllegalArgumentException("Can not parse contact header", e);
}
}
}
if(status >= 200 && !recursed)
{
if(proxy.getFinalBranchForSubsequentRequests() == null ||
(outgoingRequest != null && outgoingRequest.isInitial())) {
if(logger.isDebugEnabled())
logger.debug("Handling final response for initial request");
this.proxy.onFinalResponse(this);
} else {
if(logger.isDebugEnabled())
logger.debug("Handling final response for non-initial request");
this.proxy.sendFinalResponse(response, this);
}
}
} }
|
public class class_name {
@NonNull
public static BeaconManager getInstanceForApplication(@NonNull Context context) {
/*
* Follow double check pattern from Effective Java v2 Item 71.
*
* Bloch recommends using the local variable for this for performance reasons:
*
* > What this variable does is ensure that `field` is read only once in the common case
* > where it's already initialized. While not strictly necessary, this may improve
* > performance and is more elegant by the standards applied to low-level concurrent
* > programming. On my machine, [this] is about 25 percent faster than the obvious
* > version without a local variable.
*
* Joshua Bloch. Effective Java, Second Edition. Addison-Wesley, 2008. pages 283-284
*/
BeaconManager instance = sInstance;
if (instance == null) {
synchronized (SINGLETON_LOCK) {
instance = sInstance;
if (instance == null) {
sInstance = instance = new BeaconManager(context);
}
}
}
return instance;
} }
|
public class class_name {
@NonNull
public static BeaconManager getInstanceForApplication(@NonNull Context context) {
/*
* Follow double check pattern from Effective Java v2 Item 71.
*
* Bloch recommends using the local variable for this for performance reasons:
*
* > What this variable does is ensure that `field` is read only once in the common case
* > where it's already initialized. While not strictly necessary, this may improve
* > performance and is more elegant by the standards applied to low-level concurrent
* > programming. On my machine, [this] is about 25 percent faster than the obvious
* > version without a local variable.
*
* Joshua Bloch. Effective Java, Second Edition. Addison-Wesley, 2008. pages 283-284
*/
BeaconManager instance = sInstance;
if (instance == null) {
synchronized (SINGLETON_LOCK) { // depends on control dependency: [if], data = [none]
instance = sInstance;
if (instance == null) {
sInstance = instance = new BeaconManager(context); // depends on control dependency: [if], data = [none]
}
}
}
return instance;
} }
|
public class class_name {
public boolean removeSubscriber(Handler handler) {
String handlerId = CollectorManagerUtils.getHandlerId(handler);
subscribers.remove(handlerId);
/*
* Inform the handler that this source/buffer will no longer be available:
* Synchronous Handler: Remove the synchronous handler from the Buffer/Conduit's sync handler set
* Asynchronous Handler: Remove the asynchronous handler from the the Buffer/Conduit
*/
if (handler instanceof SynchronousHandler) {
bufferMgr.removeSyncHandler((SynchronousHandler) handler);
} else {
bufferMgr.removeHandler(handlerId);
}
if (subscribers.isEmpty()) {
/*
* Can not set bufferMgr to null (in here or in the source )if this SrcMgr belongs
* to LogSource or TraceSource
*/
if (!sourceId.contains(CollectorConstants.MESSAGES_SOURCE) && !sourceId.contains(CollectorConstants.TRACE_SOURCE)) {
/*
* Last subscriber, unassign the buffer
* Inform the source that buffer will no longer be available
* and it should stop sending events to this buffer.
*/
source.unsetBufferManager(bufferMgr);
bufferMgr = null;
}
return true;
}
return false;
} }
|
public class class_name {
public boolean removeSubscriber(Handler handler) {
String handlerId = CollectorManagerUtils.getHandlerId(handler);
subscribers.remove(handlerId);
/*
* Inform the handler that this source/buffer will no longer be available:
* Synchronous Handler: Remove the synchronous handler from the Buffer/Conduit's sync handler set
* Asynchronous Handler: Remove the asynchronous handler from the the Buffer/Conduit
*/
if (handler instanceof SynchronousHandler) {
bufferMgr.removeSyncHandler((SynchronousHandler) handler); // depends on control dependency: [if], data = [none]
} else {
bufferMgr.removeHandler(handlerId); // depends on control dependency: [if], data = [none]
}
if (subscribers.isEmpty()) {
/*
* Can not set bufferMgr to null (in here or in the source )if this SrcMgr belongs
* to LogSource or TraceSource
*/
if (!sourceId.contains(CollectorConstants.MESSAGES_SOURCE) && !sourceId.contains(CollectorConstants.TRACE_SOURCE)) {
/*
* Last subscriber, unassign the buffer
* Inform the source that buffer will no longer be available
* and it should stop sending events to this buffer.
*/
source.unsetBufferManager(bufferMgr); // depends on control dependency: [if], data = [none]
bufferMgr = null; // depends on control dependency: [if], data = [none]
}
return true; // depends on control dependency: [if], data = [none]
}
return false;
} }
|
public class class_name {
private DeclaredType getDeclaredType0(Type outer,
ClassSymbol sym,
TypeMirror... typeArgs) {
if (typeArgs.length != sym.type.getTypeArguments().length())
throw new IllegalArgumentException(
"Incorrect number of type arguments");
ListBuffer<Type> targs = new ListBuffer<>();
for (TypeMirror t : typeArgs) {
if (!(t instanceof ReferenceType || t instanceof WildcardType))
throw new IllegalArgumentException(t.toString());
targs.append((Type) t);
}
// TODO: Would like a way to check that type args match formals.
return (DeclaredType) new Type.ClassType(outer, targs.toList(), sym);
} }
|
public class class_name {
private DeclaredType getDeclaredType0(Type outer,
ClassSymbol sym,
TypeMirror... typeArgs) {
if (typeArgs.length != sym.type.getTypeArguments().length())
throw new IllegalArgumentException(
"Incorrect number of type arguments");
ListBuffer<Type> targs = new ListBuffer<>();
for (TypeMirror t : typeArgs) {
if (!(t instanceof ReferenceType || t instanceof WildcardType))
throw new IllegalArgumentException(t.toString());
targs.append((Type) t); // depends on control dependency: [for], data = [t]
}
// TODO: Would like a way to check that type args match formals.
return (DeclaredType) new Type.ClassType(outer, targs.toList(), sym);
} }
|
public class class_name {
private void doTwoPhase(DbLoadContext context, List<List<EventData>> totalRows, boolean canBatch) {
// 预处理下数据
List<Future<Exception>> results = new ArrayList<Future<Exception>>();
for (List<EventData> rows : totalRows) {
if (CollectionUtils.isEmpty(rows)) {
continue; // 过滤空记录
}
results.add(executor.submit(new DbLoadWorker(context, rows, canBatch)));
}
boolean partFailed = false;
for (int i = 0; i < results.size(); i++) {
Future<Exception> result = results.get(i);
Exception ex = null;
try {
ex = result.get();
for (EventData data : totalRows.get(i)) {
interceptor.after(context, data);// 通知加载完成
}
} catch (Exception e) {
ex = e;
}
if (ex != null) {
logger.warn("##load phase one failed!", ex);
partFailed = true;
}
}
if (true == partFailed) {
// if (CollectionUtils.isEmpty(context.getFailedDatas())) {
// logger.error("##load phase one failed but failedDatas is empty!");
// return;
// }
// 尝试的内容换成phase one跑的所有数据,避免因failed datas计算错误而导致丢数据
List<EventData> retryEventDatas = new ArrayList<EventData>();
for (List<EventData> rows : totalRows) {
retryEventDatas.addAll(rows);
}
context.getFailedDatas().clear(); // 清理failed data数据
// 可能为null,manager老版本数据序列化传输时,因为数据库中没有skipLoadException变量配置
Boolean skipLoadException = context.getPipeline().getParameters().getSkipLoadException();
if (skipLoadException != null && skipLoadException) {// 如果设置为允许跳过单条异常,则一条条执行数据load,准确过滤掉出错的记录,并进行日志记录
for (EventData retryEventData : retryEventDatas) {
DbLoadWorker worker = new DbLoadWorker(context, Arrays.asList(retryEventData), false);// 强制设置batch为false
try {
Exception ex = worker.call();
if (ex != null) {
// do skip
logger.warn("skip exception for data : {} , caused by {}",
retryEventData,
ExceptionUtils.getFullStackTrace(ex));
}
} catch (Exception ex) {
// do skip
logger.warn("skip exception for data : {} , caused by {}",
retryEventData,
ExceptionUtils.getFullStackTrace(ex));
}
}
} else {
// 直接一批进行处理,减少线程调度
DbLoadWorker worker = new DbLoadWorker(context, retryEventDatas, false);// 强制设置batch为false
try {
Exception ex = worker.call();
if (ex != null) {
throw ex; // 自己抛自己接
}
} catch (Exception ex) {
logger.error("##load phase two failed!", ex);
throw new LoadException(ex);
}
}
// 清理failed data数据
for (EventData data : retryEventDatas) {
interceptor.after(context, data);// 通知加载完成
}
}
} }
|
public class class_name {
private void doTwoPhase(DbLoadContext context, List<List<EventData>> totalRows, boolean canBatch) {
// 预处理下数据
List<Future<Exception>> results = new ArrayList<Future<Exception>>();
for (List<EventData> rows : totalRows) {
if (CollectionUtils.isEmpty(rows)) {
continue; // 过滤空记录
}
results.add(executor.submit(new DbLoadWorker(context, rows, canBatch))); // depends on control dependency: [for], data = [rows]
}
boolean partFailed = false;
for (int i = 0; i < results.size(); i++) {
Future<Exception> result = results.get(i);
Exception ex = null;
try {
ex = result.get(); // depends on control dependency: [try], data = [none]
for (EventData data : totalRows.get(i)) {
interceptor.after(context, data);// 通知加载完成 // depends on control dependency: [for], data = [data]
}
} catch (Exception e) {
ex = e;
} // depends on control dependency: [catch], data = [none]
if (ex != null) {
logger.warn("##load phase one failed!", ex); // depends on control dependency: [if], data = [none]
partFailed = true; // depends on control dependency: [if], data = [none]
}
}
if (true == partFailed) {
// if (CollectionUtils.isEmpty(context.getFailedDatas())) {
// logger.error("##load phase one failed but failedDatas is empty!");
// return;
// }
// 尝试的内容换成phase one跑的所有数据,避免因failed datas计算错误而导致丢数据
List<EventData> retryEventDatas = new ArrayList<EventData>();
for (List<EventData> rows : totalRows) {
retryEventDatas.addAll(rows); // depends on control dependency: [for], data = [rows]
}
context.getFailedDatas().clear(); // 清理failed data数据 // depends on control dependency: [if], data = [none]
// 可能为null,manager老版本数据序列化传输时,因为数据库中没有skipLoadException变量配置
Boolean skipLoadException = context.getPipeline().getParameters().getSkipLoadException();
if (skipLoadException != null && skipLoadException) {// 如果设置为允许跳过单条异常,则一条条执行数据load,准确过滤掉出错的记录,并进行日志记录
for (EventData retryEventData : retryEventDatas) {
DbLoadWorker worker = new DbLoadWorker(context, Arrays.asList(retryEventData), false);// 强制设置batch为false
try {
Exception ex = worker.call();
if (ex != null) {
// do skip
logger.warn("skip exception for data : {} , caused by {}",
retryEventData,
ExceptionUtils.getFullStackTrace(ex)); // depends on control dependency: [if], data = [none]
}
} catch (Exception ex) {
// do skip
logger.warn("skip exception for data : {} , caused by {}",
retryEventData,
ExceptionUtils.getFullStackTrace(ex));
} // depends on control dependency: [catch], data = [none]
}
} else {
// 直接一批进行处理,减少线程调度
DbLoadWorker worker = new DbLoadWorker(context, retryEventDatas, false);// 强制设置batch为false
try {
Exception ex = worker.call();
if (ex != null) {
throw ex; // 自己抛自己接
}
} catch (Exception ex) {
logger.error("##load phase two failed!", ex);
throw new LoadException(ex);
} // depends on control dependency: [catch], data = [none]
}
// 清理failed data数据
for (EventData data : retryEventDatas) {
interceptor.after(context, data);// 通知加载完成 // depends on control dependency: [for], data = [data]
}
}
} }
|
public class class_name {
public String selectedOption() {
if (isNotPresentSelect()) {
return null;
}
WebElement webElement = element.getWebElement();
Select dropdown = new Select(webElement);
WebElement option = dropdown.getFirstSelectedOption();
return option.getText();
} }
|
public class class_name {
public String selectedOption() {
if (isNotPresentSelect()) {
return null; // depends on control dependency: [if], data = [none]
}
WebElement webElement = element.getWebElement();
Select dropdown = new Select(webElement);
WebElement option = dropdown.getFirstSelectedOption();
return option.getText();
} }
|
public class class_name {
@Override
public CPDefinitionOptionValueRel fetchByUuid_C_First(String uuid,
long companyId,
OrderByComparator<CPDefinitionOptionValueRel> orderByComparator) {
List<CPDefinitionOptionValueRel> list = findByUuid_C(uuid, companyId,
0, 1, orderByComparator);
if (!list.isEmpty()) {
return list.get(0);
}
return null;
} }
|
public class class_name {
@Override
public CPDefinitionOptionValueRel fetchByUuid_C_First(String uuid,
long companyId,
OrderByComparator<CPDefinitionOptionValueRel> orderByComparator) {
List<CPDefinitionOptionValueRel> list = findByUuid_C(uuid, companyId,
0, 1, orderByComparator);
if (!list.isEmpty()) {
return list.get(0); // depends on control dependency: [if], data = [none]
}
return null;
} }
|
public class class_name {
public static File createTempFile(final String ext) {
try {
File file;
file = File.createTempFile("jk-", "." + ext);
return file;
} catch (IOException e) {
JK.throww(e);
return null;
}
} }
|
public class class_name {
public static File createTempFile(final String ext) {
try {
File file;
file = File.createTempFile("jk-", "." + ext);
// depends on control dependency: [try], data = [none]
return file;
// depends on control dependency: [try], data = [none]
} catch (IOException e) {
JK.throww(e);
return null;
}
// depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public synchronized void updateProducer(PHPProducerDTO producerDTO) {
Mapper mapper = mappersRegistry.getMapper(producerDTO.getMapperId());
if (mapper == null) {
log.error("Mapper with id " + producerDTO.getMapperId() + " is not found to map producer "
+ producerDTO.getProducerId());
return;
}
try {
mapper.mapProducer(producerRegistry, producerDTO);
} catch (MappingException e) {
log.error("Failed to process producer data with producer id " +
producerDTO.getProducerId() +
" because mapper throws an exception", e);
}
} }
|
public class class_name {
public synchronized void updateProducer(PHPProducerDTO producerDTO) {
Mapper mapper = mappersRegistry.getMapper(producerDTO.getMapperId());
if (mapper == null) {
log.error("Mapper with id " + producerDTO.getMapperId() + " is not found to map producer "
+ producerDTO.getProducerId()); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
try {
mapper.mapProducer(producerRegistry, producerDTO); // depends on control dependency: [try], data = [none]
} catch (MappingException e) {
log.error("Failed to process producer data with producer id " +
producerDTO.getProducerId() +
" because mapper throws an exception", e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
private IndirectCosts getIndirectCosts(BudgetPeriodDto periodInfo) {
IndirectCosts indirectCosts = null;
if (periodInfo != null
&& periodInfo.getIndirectCosts() != null
&& periodInfo.getIndirectCosts().getIndirectCostDetails() != null) {
List<IndirectCosts.IndirectCost> indirectCostList = new ArrayList<>();
int IndirectCostCount = 0;
for (IndirectCostDetailsDto indirectCostDetails : periodInfo
.getIndirectCosts().getIndirectCostDetails()) {
IndirectCosts.IndirectCost indirectCost = IndirectCosts.IndirectCost.Factory
.newInstance();
if (indirectCostDetails.getBase() != null) {
indirectCost.setBase(indirectCostDetails.getBase()
.bigDecimalValue());
}
indirectCost.setCostType(indirectCostDetails.getCostType());
if (indirectCostDetails.getFunds() != null) {
indirectCost.setFundRequested(indirectCostDetails
.getFunds().bigDecimalValue());
}
if (indirectCostDetails.getRate() != null) {
indirectCost.setRate(indirectCostDetails.getRate()
.bigDecimalValue());
}
indirectCostList.add(indirectCost);
IndirectCostCount++;
if (IndirectCostCount == ARRAY_LIMIT_IN_SCHEMA) {
LOG
.warn("Stopping iteration over indirect cost details because array limit in schema is only 4");
break;
}
}
if (IndirectCostCount > 0) {
indirectCosts = IndirectCosts.Factory.newInstance();
IndirectCosts.IndirectCost indirectCostArray[] = new IndirectCosts.IndirectCost[0];
indirectCosts.setIndirectCostArray(indirectCostList
.toArray(indirectCostArray));
if (periodInfo.getIndirectCosts().getTotalIndirectCosts() != null) {
indirectCosts.setTotalIndirectCosts(periodInfo
.getIndirectCosts().getTotalIndirectCosts()
.bigDecimalValue());
}
}
}
return indirectCosts;
} }
|
public class class_name {
private IndirectCosts getIndirectCosts(BudgetPeriodDto periodInfo) {
IndirectCosts indirectCosts = null;
if (periodInfo != null
&& periodInfo.getIndirectCosts() != null
&& periodInfo.getIndirectCosts().getIndirectCostDetails() != null) {
List<IndirectCosts.IndirectCost> indirectCostList = new ArrayList<>();
int IndirectCostCount = 0;
for (IndirectCostDetailsDto indirectCostDetails : periodInfo
.getIndirectCosts().getIndirectCostDetails()) {
IndirectCosts.IndirectCost indirectCost = IndirectCosts.IndirectCost.Factory
.newInstance();
if (indirectCostDetails.getBase() != null) {
indirectCost.setBase(indirectCostDetails.getBase()
.bigDecimalValue()); // depends on control dependency: [if], data = [none]
}
indirectCost.setCostType(indirectCostDetails.getCostType()); // depends on control dependency: [for], data = [indirectCostDetails]
if (indirectCostDetails.getFunds() != null) {
indirectCost.setFundRequested(indirectCostDetails
.getFunds().bigDecimalValue()); // depends on control dependency: [if], data = [none]
}
if (indirectCostDetails.getRate() != null) {
indirectCost.setRate(indirectCostDetails.getRate()
.bigDecimalValue()); // depends on control dependency: [if], data = [none]
}
indirectCostList.add(indirectCost); // depends on control dependency: [for], data = [none]
IndirectCostCount++; // depends on control dependency: [for], data = [none]
if (IndirectCostCount == ARRAY_LIMIT_IN_SCHEMA) {
LOG
.warn("Stopping iteration over indirect cost details because array limit in schema is only 4"); // depends on control dependency: [if], data = [none]
break;
}
}
if (IndirectCostCount > 0) {
indirectCosts = IndirectCosts.Factory.newInstance(); // depends on control dependency: [if], data = [none]
IndirectCosts.IndirectCost indirectCostArray[] = new IndirectCosts.IndirectCost[0];
indirectCosts.setIndirectCostArray(indirectCostList
.toArray(indirectCostArray)); // depends on control dependency: [if], data = [none]
if (periodInfo.getIndirectCosts().getTotalIndirectCosts() != null) {
indirectCosts.setTotalIndirectCosts(periodInfo
.getIndirectCosts().getTotalIndirectCosts()
.bigDecimalValue()); // depends on control dependency: [if], data = [none]
}
}
}
return indirectCosts;
} }
|
public class class_name {
protected void setProcessName(String newProcessName) {
if (newProcessName == null) {
processName = getDefaultProcessName();
return;
} else if (!newProcessName.matches("[\\p{L}\\p{N}\\+\\_][\\p{L}\\p{N}\\-\\+\\.\\_]*")) {
// Translation of the above regex for the faint of heart:
// The first character can be a +, an _, a unicode letter \p{L}, or a unicode number \\p{N}
// Subsequent characters can be any of the above, in addition to a . and a -
throw new LocationException("Bad server name: " + newProcessName, MessageFormat.format(BootstrapConstants.messages.getString(getErrorProcessNameCharacterMessageKey()),
newProcessName));
} else
// use the new server name
processName = newProcessName;
} }
|
public class class_name {
protected void setProcessName(String newProcessName) {
if (newProcessName == null) {
processName = getDefaultProcessName(); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
} else if (!newProcessName.matches("[\\p{L}\\p{N}\\+\\_][\\p{L}\\p{N}\\-\\+\\.\\_]*")) {
// Translation of the above regex for the faint of heart:
// The first character can be a +, an _, a unicode letter \p{L}, or a unicode number \\p{N}
// Subsequent characters can be any of the above, in addition to a . and a -
throw new LocationException("Bad server name: " + newProcessName, MessageFormat.format(BootstrapConstants.messages.getString(getErrorProcessNameCharacterMessageKey()),
newProcessName));
} else
// use the new server name
processName = newProcessName;
} }
|
public class class_name {
@Override
public SymbolReference<? extends ResolvedValueDeclaration> solveSymbol(String name, TypeSolver typeSolver) {
if (typeSolver == null) throw new IllegalArgumentException();
if (this.getDeclaration().hasVisibleField(name)) {
return SymbolReference.solved(this.getDeclaration().getVisibleField(name));
}
// then to parent
return getParent().solveSymbol(name, typeSolver);
} }
|
public class class_name {
@Override
public SymbolReference<? extends ResolvedValueDeclaration> solveSymbol(String name, TypeSolver typeSolver) {
if (typeSolver == null) throw new IllegalArgumentException();
if (this.getDeclaration().hasVisibleField(name)) {
return SymbolReference.solved(this.getDeclaration().getVisibleField(name)); // depends on control dependency: [if], data = [none]
}
// then to parent
return getParent().solveSymbol(name, typeSolver);
} }
|
public class class_name {
private static HttpMethod valueOf(String method) {
try {
return HttpMethod.valueOf(method);
}
catch (IllegalArgumentException e) {
}
return null;
} }
|
public class class_name {
private static HttpMethod valueOf(String method) {
try {
return HttpMethod.valueOf(method); // depends on control dependency: [try], data = [none]
}
catch (IllegalArgumentException e) {
} // depends on control dependency: [catch], data = [none]
return null;
} }
|
public class class_name {
public synchronized static void addVirtualHost(final VirtualHostConfig oldConfig, final VirtualHostConfig newConfig) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
Tr.event(tc, "Add virtual host: " + newConfig.getVirtualHost(), oldConfig, newConfig, defaultHost.get(), alternateHostSelector.get());
}
// If the "default/catch-all-ness" of the host was modified,
// the virtual host was removed before calling this method.
if (newConfig.isDefaultHost()) {
defaultHost = StaticValue.mutateStaticValue(defaultHost, new Callable<VirtualHostConfig>() {
@Override
public VirtualHostConfig call() {
return newConfig;
}
});
if (alternateHostSelector.get() != null) {
alternateHostSelector.get().alternateAddDefaultHost(newConfig);
} else {
// notify default host of active listeners
for (HttpEndpointImpl e : HttpEndpointList.getInstance()) {
int ePort = e.getListeningHttpPort();
if (ePort > 0) {
defaultHost.get().listenerStarted(e, e.getResolvedHostName(), ePort, false);
}
ePort = e.getListeningSecureHttpPort();
if (ePort > 0) {
defaultHost.get().listenerStarted(e, e.getResolvedHostName(), ePort, true);
}
}
}
} else {
if (alternateHostSelector.get() == null) {
alternateHostSelector = StaticValue.mutateStaticValue(alternateHostSelector, new Callable<AlternateHostSelector>() {
@Override
public AlternateHostSelector call() throws Exception {
return new AlternateHostSelector();
}
});
}
AlternateHostSelector current = alternateHostSelector.get();
// Figure out which host aliases should be removed
List<HostAlias> toRemove = new ArrayList<HostAlias>(oldConfig.getHostAliases());
toRemove.removeAll(newConfig.getHostAliases());
if (!toRemove.isEmpty()) {
current.alternateRemoveVirtualHost(oldConfig, toRemove);
}
current.alternateAddVirtualHost(newConfig);
}
} }
|
public class class_name {
public synchronized static void addVirtualHost(final VirtualHostConfig oldConfig, final VirtualHostConfig newConfig) {
if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
Tr.event(tc, "Add virtual host: " + newConfig.getVirtualHost(), oldConfig, newConfig, defaultHost.get(), alternateHostSelector.get()); // depends on control dependency: [if], data = [none]
}
// If the "default/catch-all-ness" of the host was modified,
// the virtual host was removed before calling this method.
if (newConfig.isDefaultHost()) {
defaultHost = StaticValue.mutateStaticValue(defaultHost, new Callable<VirtualHostConfig>() {
@Override
public VirtualHostConfig call() {
return newConfig;
}
}); // depends on control dependency: [if], data = [none]
if (alternateHostSelector.get() != null) {
alternateHostSelector.get().alternateAddDefaultHost(newConfig); // depends on control dependency: [if], data = [none]
} else {
// notify default host of active listeners
for (HttpEndpointImpl e : HttpEndpointList.getInstance()) {
int ePort = e.getListeningHttpPort();
if (ePort > 0) {
defaultHost.get().listenerStarted(e, e.getResolvedHostName(), ePort, false); // depends on control dependency: [if], data = [none]
}
ePort = e.getListeningSecureHttpPort(); // depends on control dependency: [for], data = [e]
if (ePort > 0) {
defaultHost.get().listenerStarted(e, e.getResolvedHostName(), ePort, true); // depends on control dependency: [if], data = [none]
}
}
}
} else {
if (alternateHostSelector.get() == null) {
alternateHostSelector = StaticValue.mutateStaticValue(alternateHostSelector, new Callable<AlternateHostSelector>() {
@Override
public AlternateHostSelector call() throws Exception {
return new AlternateHostSelector();
}
}); // depends on control dependency: [if], data = [none]
}
AlternateHostSelector current = alternateHostSelector.get();
// Figure out which host aliases should be removed
List<HostAlias> toRemove = new ArrayList<HostAlias>(oldConfig.getHostAliases());
toRemove.removeAll(newConfig.getHostAliases()); // depends on control dependency: [if], data = [none]
if (!toRemove.isEmpty()) {
current.alternateRemoveVirtualHost(oldConfig, toRemove); // depends on control dependency: [if], data = [none]
}
current.alternateAddVirtualHost(newConfig); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
private void saveClientCertSettings(){
if (getBoolean(PERSIST_CLIENT_CERT, false)){
logger.warn("Saving Client Certificate settings: password will be found in config");
setUseClientCert(getBoolean(USE_CLIENT_CERT, false));
setClientCertLocation(getString(CLIENT_CERT_LOCATION, ""));
setClientCertPassword(getString(CLIENT_CERT_PASSWORD, ""));
setClientCertIndex(getInt(CLIENT_CERT_INDEX, 0));
} else {
// Default to clear settings
setUseClientCert(false);
setClientCertLocation("");
setClientCertPassword("");
setClientCertIndex(0);
}
} }
|
public class class_name {
private void saveClientCertSettings(){
if (getBoolean(PERSIST_CLIENT_CERT, false)){
logger.warn("Saving Client Certificate settings: password will be found in config");
// depends on control dependency: [if], data = [none]
setUseClientCert(getBoolean(USE_CLIENT_CERT, false));
// depends on control dependency: [if], data = [none]
setClientCertLocation(getString(CLIENT_CERT_LOCATION, ""));
// depends on control dependency: [if], data = [none]
setClientCertPassword(getString(CLIENT_CERT_PASSWORD, ""));
// depends on control dependency: [if], data = [none]
setClientCertIndex(getInt(CLIENT_CERT_INDEX, 0));
// depends on control dependency: [if], data = [none]
} else {
// Default to clear settings
setUseClientCert(false);
// depends on control dependency: [if], data = [none]
setClientCertLocation("");
// depends on control dependency: [if], data = [none]
setClientCertPassword("");
// depends on control dependency: [if], data = [none]
setClientCertIndex(0);
// depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public ProfileLocalObject getProfileLocalObject() {
final Class<?> profileLocalObjectConcreteClass = profileTable.getProfileSpecificationComponent().getProfileLocalObjectConcreteClass();
ProfileLocalObject profileLocalObject = null;
if (profileLocalObjectConcreteClass == null) {
profileLocalObject = new ProfileLocalObjectImpl(this);
}
else {
try {
profileLocalObject = (ProfileLocalObject) profileLocalObjectConcreteClass.getConstructor(ProfileObjectImpl.class).newInstance(this);
} catch (Throwable e) {
throw new SLEEException(e.getMessage(),e);
}
}
return profileLocalObject;
} }
|
public class class_name {
public ProfileLocalObject getProfileLocalObject() {
final Class<?> profileLocalObjectConcreteClass = profileTable.getProfileSpecificationComponent().getProfileLocalObjectConcreteClass();
ProfileLocalObject profileLocalObject = null;
if (profileLocalObjectConcreteClass == null) {
profileLocalObject = new ProfileLocalObjectImpl(this); // depends on control dependency: [if], data = [none]
}
else {
try {
profileLocalObject = (ProfileLocalObject) profileLocalObjectConcreteClass.getConstructor(ProfileObjectImpl.class).newInstance(this); // depends on control dependency: [try], data = [none]
} catch (Throwable e) {
throw new SLEEException(e.getMessage(),e);
} // depends on control dependency: [catch], data = [none]
}
return profileLocalObject;
} }
|
public class class_name {
public String convert(String input, String type) {
// set necessary header: request per form
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED);
// pack the latex string as the parameter q (q for query ;) )
MultiValueMap<String, String> map = new LinkedMultiValueMap<>();
map.add("q", input);
if (!type.isEmpty()) {
map.add("type", type);
}
HttpEntity<MultiValueMap<String, String>> request = new HttpEntity<>(map, headers);
try {
String rep = new RestTemplate().postForObject(mathoidConfig.getUrl(), request, String.class);
logger.info(rep);
return rep;
} catch (HttpClientErrorException e) {
logger.error(e.getResponseBodyAsString());
throw e;
}
} }
|
public class class_name {
public String convert(String input, String type) {
// set necessary header: request per form
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED);
// pack the latex string as the parameter q (q for query ;) )
MultiValueMap<String, String> map = new LinkedMultiValueMap<>();
map.add("q", input);
if (!type.isEmpty()) {
map.add("type", type); // depends on control dependency: [if], data = [none]
}
HttpEntity<MultiValueMap<String, String>> request = new HttpEntity<>(map, headers);
try {
String rep = new RestTemplate().postForObject(mathoidConfig.getUrl(), request, String.class);
logger.info(rep); // depends on control dependency: [try], data = [none]
return rep; // depends on control dependency: [try], data = [none]
} catch (HttpClientErrorException e) {
logger.error(e.getResponseBodyAsString());
throw e;
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
@Override
public EClass getIfcStairFlightType() {
if (ifcStairFlightTypeEClass == null) {
ifcStairFlightTypeEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI)
.getEClassifiers().get(626);
}
return ifcStairFlightTypeEClass;
} }
|
public class class_name {
@Override
public EClass getIfcStairFlightType() {
if (ifcStairFlightTypeEClass == null) {
ifcStairFlightTypeEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI)
.getEClassifiers().get(626);
// depends on control dependency: [if], data = [none]
}
return ifcStairFlightTypeEClass;
} }
|
public class class_name {
public void seekToRecord(long recordNumber) throws IOException {
if (currentRecordNumber == recordNumber)
return;
long skip;
if (recordNumber < fileIndex.getStartingRecordNumber()) {
if (currentRecordNumber < recordNumber)
skip = recordNumber - currentRecordNumber;
else {
skip = recordNumber;
seek0(0);
}
} else if (recordNumber > fileIndex.getLastRecordNumber()) {
if (currentRecordNumber < recordNumber)
skip = recordNumber - currentRecordNumber;
else {
long record = fileIndex.getLastRecordNumber();
skip = recordNumber - record;
seek0(fileIndex.getNearestPosition(record));
}
} else if (recordNumber > currentRecordNumber && recordNumber - currentRecordNumber < fileIndex.getStep()) {
skip = recordNumber - currentRecordNumber;
} else {
seek0(fileIndex.getNearestPosition(recordNumber));
skip = recordNumber - fileIndex.getNearestRecordNumber(recordNumber);
}
for (; skip > 0; --skip)
skip();
currentRecordNumber = recordNumber;
} }
|
public class class_name {
public void seekToRecord(long recordNumber) throws IOException {
if (currentRecordNumber == recordNumber)
return;
long skip;
if (recordNumber < fileIndex.getStartingRecordNumber()) {
if (currentRecordNumber < recordNumber)
skip = recordNumber - currentRecordNumber;
else {
skip = recordNumber;
seek0(0);
}
} else if (recordNumber > fileIndex.getLastRecordNumber()) {
if (currentRecordNumber < recordNumber)
skip = recordNumber - currentRecordNumber;
else {
long record = fileIndex.getLastRecordNumber();
skip = recordNumber - record; // depends on control dependency: [if], data = [none]
seek0(fileIndex.getNearestPosition(record)); // depends on control dependency: [if], data = [none]
}
} else if (recordNumber > currentRecordNumber && recordNumber - currentRecordNumber < fileIndex.getStep()) {
skip = recordNumber - currentRecordNumber;
} else {
seek0(fileIndex.getNearestPosition(recordNumber));
skip = recordNumber - fileIndex.getNearestRecordNumber(recordNumber);
}
for (; skip > 0; --skip)
skip();
currentRecordNumber = recordNumber;
} }
|
public class class_name {
@Override
public void cacheResult(
List<CommerceSubscriptionEntry> commerceSubscriptionEntries) {
for (CommerceSubscriptionEntry commerceSubscriptionEntry : commerceSubscriptionEntries) {
if (entityCache.getResult(
CommerceSubscriptionEntryModelImpl.ENTITY_CACHE_ENABLED,
CommerceSubscriptionEntryImpl.class,
commerceSubscriptionEntry.getPrimaryKey()) == null) {
cacheResult(commerceSubscriptionEntry);
}
else {
commerceSubscriptionEntry.resetOriginalValues();
}
}
} }
|
public class class_name {
@Override
public void cacheResult(
List<CommerceSubscriptionEntry> commerceSubscriptionEntries) {
for (CommerceSubscriptionEntry commerceSubscriptionEntry : commerceSubscriptionEntries) {
if (entityCache.getResult(
CommerceSubscriptionEntryModelImpl.ENTITY_CACHE_ENABLED,
CommerceSubscriptionEntryImpl.class,
commerceSubscriptionEntry.getPrimaryKey()) == null) {
cacheResult(commerceSubscriptionEntry); // depends on control dependency: [if], data = [none]
}
else {
commerceSubscriptionEntry.resetOriginalValues(); // depends on control dependency: [if], data = [none]
}
}
} }
|
public class class_name {
public ByteBuffer copy(int offset, int length, int capacity) {
// if not copying any data, just return an empty buffer
if (length == 0) {
return new ByteBuffer(1);
}
// validate offset, length ok
ByteBuffer.checkOffsetLength(size(), offset, length);
// is the capacity large enough?
if (capacity < length) {
throw new IllegalArgumentException("Capacity must be large enough to hold copied data of size=" + length);
}
// create a new ByteBuffer with enough capacity
ByteBuffer copyBuffer = new ByteBuffer(capacity);
// initialize everything now
// copy this buffer's data into the target buffer -- already allocated memory
this.toArray(offset, length, copyBuffer.buffer, 0);
// setup other variables to be correct position now
copyBuffer.currentBufferSize = length;
copyBuffer.currentReadPosition = 0;
copyBuffer.currentWritePosition = length;
return copyBuffer;
} }
|
public class class_name {
public ByteBuffer copy(int offset, int length, int capacity) {
// if not copying any data, just return an empty buffer
if (length == 0) {
return new ByteBuffer(1); // depends on control dependency: [if], data = [none]
}
// validate offset, length ok
ByteBuffer.checkOffsetLength(size(), offset, length);
// is the capacity large enough?
if (capacity < length) {
throw new IllegalArgumentException("Capacity must be large enough to hold copied data of size=" + length);
}
// create a new ByteBuffer with enough capacity
ByteBuffer copyBuffer = new ByteBuffer(capacity);
// initialize everything now
// copy this buffer's data into the target buffer -- already allocated memory
this.toArray(offset, length, copyBuffer.buffer, 0);
// setup other variables to be correct position now
copyBuffer.currentBufferSize = length;
copyBuffer.currentReadPosition = 0;
copyBuffer.currentWritePosition = length;
return copyBuffer;
} }
|
public class class_name {
@Override
public final InputStream doRequest(InputStream httpBody) throws CommunicationException {
InputStream reply = null;
try {
getSocket();
prepareCommunication();
createPostRequest(getPath());
writeHostLine();
writeContentTypeHeaders();
httpBody = logAndCloneInputStream(httpBody, "request");
if (usesGzip()) {
httpBody = compressInputStream(httpBody);
writeGzipHeaders();
}
if (usesBasicAuth()) {
writeAuthHeader();
}
writeContentLengthHeader(httpBody.available());
finishHeaders();
reply = doActualRequest(httpBody);
reply = logAndCloneInputStream(reply, "response");
if (replyIsGzipped()) {
reply = new GZIPInputStream(reply);
}
return reply;
} catch (IOException e) {
throw new CommunicationException(e.getMessage());
}
} }
|
public class class_name {
@Override
public final InputStream doRequest(InputStream httpBody) throws CommunicationException {
InputStream reply = null;
try {
getSocket();
prepareCommunication();
createPostRequest(getPath());
writeHostLine();
writeContentTypeHeaders();
httpBody = logAndCloneInputStream(httpBody, "request");
if (usesGzip()) {
httpBody = compressInputStream(httpBody); // depends on control dependency: [if], data = [none]
writeGzipHeaders(); // depends on control dependency: [if], data = [none]
}
if (usesBasicAuth()) {
writeAuthHeader(); // depends on control dependency: [if], data = [none]
}
writeContentLengthHeader(httpBody.available());
finishHeaders();
reply = doActualRequest(httpBody);
reply = logAndCloneInputStream(reply, "response");
if (replyIsGzipped()) {
reply = new GZIPInputStream(reply); // depends on control dependency: [if], data = [none]
}
return reply;
} catch (IOException e) {
throw new CommunicationException(e.getMessage());
}
} }
|
public class class_name {
public void deleteRelationshipIndex(EntityMetadata entityMetadata, GraphDatabaseService graphDb,
Relationship relationship)
{
if (!isRelationshipAutoIndexingEnabled(graphDb) && entityMetadata.isIndexable())
{
Index<Relationship> relationshipIndex = graphDb.index().forRelationships(entityMetadata.getIndexName());
relationshipIndex.remove(relationship);
}
} }
|
public class class_name {
public void deleteRelationshipIndex(EntityMetadata entityMetadata, GraphDatabaseService graphDb,
Relationship relationship)
{
if (!isRelationshipAutoIndexingEnabled(graphDb) && entityMetadata.isIndexable())
{
Index<Relationship> relationshipIndex = graphDb.index().forRelationships(entityMetadata.getIndexName());
relationshipIndex.remove(relationship); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public IntervalCollection<T> minus(Collection<? extends ChronoInterval<T>> intervals) {
if (this.isEmpty() || intervals.isEmpty()) {
return this;
}
List<ChronoInterval<T>> parts = new ArrayList<>();
List<ChronoInterval<T>> list = new ArrayList<>();
for (ChronoInterval<T> i : intervals) {
if (!i.isEmpty()) {
list.add(this.adjust(i));
}
}
list.sort(this.getComparator());
IntervalCollection<T> subtrahend = this.create(list);
for (int i = 0, n = this.intervals.size(); i < n; i++) {
ChronoInterval<T> minuend = this.intervals.get(i);
IntervalCollection<T> diff = subtrahend.withComplement(minuend);
if (!diff.isEmpty()) {
parts.addAll(diff.intervals);
}
}
parts.sort(this.getComparator());
return this.create(parts);
} }
|
public class class_name {
public IntervalCollection<T> minus(Collection<? extends ChronoInterval<T>> intervals) {
if (this.isEmpty() || intervals.isEmpty()) {
return this; // depends on control dependency: [if], data = [none]
}
List<ChronoInterval<T>> parts = new ArrayList<>();
List<ChronoInterval<T>> list = new ArrayList<>();
for (ChronoInterval<T> i : intervals) {
if (!i.isEmpty()) {
list.add(this.adjust(i)); // depends on control dependency: [if], data = [none]
}
}
list.sort(this.getComparator());
IntervalCollection<T> subtrahend = this.create(list);
for (int i = 0, n = this.intervals.size(); i < n; i++) {
ChronoInterval<T> minuend = this.intervals.get(i);
IntervalCollection<T> diff = subtrahend.withComplement(minuend);
if (!diff.isEmpty()) {
parts.addAll(diff.intervals); // depends on control dependency: [if], data = [none]
}
}
parts.sort(this.getComparator());
return this.create(parts);
} }
|
public class class_name {
public void execute() throws Exception {
String site1 = getSecureBaseUrl(sites.get(0));
String site2 = getSecureBaseUrl(sites.get(1));
if(site1.equalsIgnoreCase(site2)) {
System.err.println("Cannot clone a site into itself.");
System.exit(1);
}
try{
System.out.println("Getting status of ["+site1+"]");
Status site1Status = StatusCommand.getSiteStatus(site1, token);
System.out.println("Getting status of ["+site2+"]");
Status site2Status = StatusCommand.getSiteStatus(site2, token);
if(site1Status != null && site2Status != null) {
String repo = site1Status.getRepo();
String revision = site1Status.getRevision();
String branch = site1Status.getBranch();
if(site2Status.getRepo().equals(repo) && site2Status.getBranch().equals(branch) && site2Status.getRevision().equals(revision)) {
System.err.println("Source [" + site1 + "] is on the same content repo, branch, and revision as the target [" + site2 + "].");
checkSendUpdateConfigMessage(site1, site2, site1Status, site2Status);
System.exit(1);
}
System.out.println("Sending update message to ["+site2+"]");
UpdateCommand.sendUpdateMessage(site2, repo, branch, revision, "Cloned from ["+site1+"]: " + comment, token);
checkSendUpdateConfigMessage(site1, site2, site1Status, site2Status);
} else {
System.err.println("Failed to get status from source and/or target.");
System.exit(1);
}
} catch(Exception e) {
e.printStackTrace();
System.err.println("Failed to clone ["+site1+"] to ["+site2+"]: "+e.getMessage());
}
} }
|
public class class_name {
public void execute() throws Exception {
String site1 = getSecureBaseUrl(sites.get(0));
String site2 = getSecureBaseUrl(sites.get(1));
if(site1.equalsIgnoreCase(site2)) {
System.err.println("Cannot clone a site into itself.");
System.exit(1);
}
try{
System.out.println("Getting status of ["+site1+"]");
Status site1Status = StatusCommand.getSiteStatus(site1, token);
System.out.println("Getting status of ["+site2+"]");
Status site2Status = StatusCommand.getSiteStatus(site2, token);
if(site1Status != null && site2Status != null) {
String repo = site1Status.getRepo();
String revision = site1Status.getRevision();
String branch = site1Status.getBranch();
if(site2Status.getRepo().equals(repo) && site2Status.getBranch().equals(branch) && site2Status.getRevision().equals(revision)) {
System.err.println("Source [" + site1 + "] is on the same content repo, branch, and revision as the target [" + site2 + "]."); // depends on control dependency: [if], data = [none]
checkSendUpdateConfigMessage(site1, site2, site1Status, site2Status); // depends on control dependency: [if], data = [none]
System.exit(1); // depends on control dependency: [if], data = [none]
}
System.out.println("Sending update message to ["+site2+"]"); // depends on control dependency: [if], data = [none]
UpdateCommand.sendUpdateMessage(site2, repo, branch, revision, "Cloned from ["+site1+"]: " + comment, token); // depends on control dependency: [if], data = [none]
checkSendUpdateConfigMessage(site1, site2, site1Status, site2Status); // depends on control dependency: [if], data = [none]
} else {
System.err.println("Failed to get status from source and/or target."); // depends on control dependency: [if], data = [none]
System.exit(1); // depends on control dependency: [if], data = [none]
}
} catch(Exception e) {
e.printStackTrace();
System.err.println("Failed to clone ["+site1+"] to ["+site2+"]: "+e.getMessage());
}
} }
|
public class class_name {
String showScriptContextHTML( String s, int lineNo, int context )
{
StringBuilder sb = new StringBuilder();
BufferedReader br = new BufferedReader( new StringReader(s) );
int beginLine = Math.max( 1, lineNo-context );
int endLine = lineNo + context;
for( int i=1; i<=lineNo+context+1; i++ )
{
if ( i < beginLine )
{
try {
br.readLine();
} catch ( IOException e ) {
throw new RuntimeException( e.toString() );
}
continue;
}
if ( i > endLine )
break;
String line;
try {
line = br.readLine();
} catch ( IOException e ) {
throw new RuntimeException( e.toString() );
}
if ( line == null )
break;
if ( i == lineNo )
sb.append( "<font color=\"red\">"+i+": "+line +"</font><br/>" );
else
sb.append( i+": " +line +"<br/>" );
}
return sb.toString();
} }
|
public class class_name {
String showScriptContextHTML( String s, int lineNo, int context )
{
StringBuilder sb = new StringBuilder();
BufferedReader br = new BufferedReader( new StringReader(s) );
int beginLine = Math.max( 1, lineNo-context );
int endLine = lineNo + context;
for( int i=1; i<=lineNo+context+1; i++ )
{
if ( i < beginLine )
{
try {
br.readLine(); // depends on control dependency: [try], data = [none]
} catch ( IOException e ) {
throw new RuntimeException( e.toString() );
} // depends on control dependency: [catch], data = [none]
continue;
}
if ( i > endLine )
break;
String line;
try {
line = br.readLine(); // depends on control dependency: [try], data = [none]
} catch ( IOException e ) {
throw new RuntimeException( e.toString() );
} // depends on control dependency: [catch], data = [none]
if ( line == null )
break;
if ( i == lineNo )
sb.append( "<font color=\"red\">"+i+": "+line +"</font><br/>" );
else
sb.append( i+": " +line +"<br/>" );
}
return sb.toString();
} }
|
public class class_name {
public static <T extends ImageGray<T>>
BinaryEllipseDetector<T> ellipse(@Nullable ConfigEllipseDetector config , Class<T> imageType )
{
if( config == null )
config = new ConfigEllipseDetector();
config.checkValidity();
BinaryEllipseDetectorPixel detector = new BinaryEllipseDetectorPixel(config.contourRule);
detector.setMaxDistanceFromEllipse(config.maxDistanceFromEllipse);
detector.setMaximumContour(config.maximumContour);
detector.setMinimumContour(config.minimumContour);
detector.setMinimumMinorAxis(config.minimumMinorAxis);
detector.setInternalContour(config.processInternal);
detector.setMaxMajorToMinorRatio(config.maxMajorToMinorRatio);
SnapToEllipseEdge<T> refine = new SnapToEllipseEdge<>(config.numSampleContour, config.refineRadialSamples, imageType);
refine.setConvergenceTol(config.convergenceTol);
refine.setMaxIterations(config.maxIterations);
if( config.maxIterations <= 0 || config.numSampleContour <= 0 ) {
refine = null;
}
EdgeIntensityEllipse<T> check = new EdgeIntensityEllipse<>(
config.checkRadialDistance,
config.numSampleContour,
config.minimumEdgeIntensity, imageType);
return new BinaryEllipseDetector<>(detector, refine, check, imageType);
} }
|
public class class_name {
public static <T extends ImageGray<T>>
BinaryEllipseDetector<T> ellipse(@Nullable ConfigEllipseDetector config , Class<T> imageType )
{
if( config == null )
config = new ConfigEllipseDetector();
config.checkValidity();
BinaryEllipseDetectorPixel detector = new BinaryEllipseDetectorPixel(config.contourRule);
detector.setMaxDistanceFromEllipse(config.maxDistanceFromEllipse);
detector.setMaximumContour(config.maximumContour);
detector.setMinimumContour(config.minimumContour);
detector.setMinimumMinorAxis(config.minimumMinorAxis);
detector.setInternalContour(config.processInternal);
detector.setMaxMajorToMinorRatio(config.maxMajorToMinorRatio);
SnapToEllipseEdge<T> refine = new SnapToEllipseEdge<>(config.numSampleContour, config.refineRadialSamples, imageType);
refine.setConvergenceTol(config.convergenceTol);
refine.setMaxIterations(config.maxIterations);
if( config.maxIterations <= 0 || config.numSampleContour <= 0 ) {
refine = null; // depends on control dependency: [if], data = [none]
}
EdgeIntensityEllipse<T> check = new EdgeIntensityEllipse<>(
config.checkRadialDistance,
config.numSampleContour,
config.minimumEdgeIntensity, imageType);
return new BinaryEllipseDetector<>(detector, refine, check, imageType);
} }
|
public class class_name {
public void removeMember(String childName) {
assert isMap() : "'removeMember' allowed only for MAP nodes";
if (m_childNodeMap != null) {
// Remove from child name map and then list if found.
UNode removeNode = m_childNodeMap.remove(childName);
if (removeNode != null) {
m_children.remove(removeNode);
}
}
} }
|
public class class_name {
public void removeMember(String childName) {
assert isMap() : "'removeMember' allowed only for MAP nodes";
if (m_childNodeMap != null) {
// Remove from child name map and then list if found.
UNode removeNode = m_childNodeMap.remove(childName);
if (removeNode != null) {
m_children.remove(removeNode);
// depends on control dependency: [if], data = [(removeNode]
}
}
} }
|
public class class_name {
@Override
public InputStream getResourceAsStream(String resourceName, boolean processingBundle) {
String path = resourceName;
GeneratorRegistry generatorRegistry = jawrConfig.getGeneratorRegistry();
if (generatorRegistry.isGeneratedBinaryResource(path)) {
path = path.replace(':', '/');
path = JawrConstant.SPRITE_GENERATED_IMG_DIR + path;
}
return ((StreamResourceReader) resourceReader).getResourceAsStream(path, processingBundle);
} }
|
public class class_name {
@Override
public InputStream getResourceAsStream(String resourceName, boolean processingBundle) {
String path = resourceName;
GeneratorRegistry generatorRegistry = jawrConfig.getGeneratorRegistry();
if (generatorRegistry.isGeneratedBinaryResource(path)) {
path = path.replace(':', '/'); // depends on control dependency: [if], data = [none]
path = JawrConstant.SPRITE_GENERATED_IMG_DIR + path; // depends on control dependency: [if], data = [none]
}
return ((StreamResourceReader) resourceReader).getResourceAsStream(path, processingBundle);
} }
|
public class class_name {
public void deactivateCurrentButton() {
if (m_activeButton != null) {
if (m_activeButton == m_editor.getSelection()) {
m_controller.disableInlineEditing(null);
}
m_activeButton.setActive(false);
m_activeButton = null;
}
setEditButtonsVisible(false);
} }
|
public class class_name {
public void deactivateCurrentButton() {
if (m_activeButton != null) {
if (m_activeButton == m_editor.getSelection()) {
m_controller.disableInlineEditing(null); // depends on control dependency: [if], data = [none]
}
m_activeButton.setActive(false); // depends on control dependency: [if], data = [none]
m_activeButton = null; // depends on control dependency: [if], data = [none]
}
setEditButtonsVisible(false);
} }
|
public class class_name {
static String setupDefaultDeployment(VoltLogger logger, File voltdbroot) throws IOException {
File configInfoDir = new VoltFile(voltdbroot, Constants.CONFIG_DIR);
configInfoDir.mkdirs();
File depFH = new VoltFile(configInfoDir, "deployment.xml");
if (!depFH.exists()) {
logger.info("Generating default deployment file \"" + depFH.getAbsolutePath() + "\"");
try (BufferedWriter bw = new BufferedWriter(new FileWriter(depFH))) {
for (String line : defaultDeploymentXML) {
bw.write(line);
bw.newLine();
}
} finally {
}
}
return depFH.getAbsolutePath();
} }
|
public class class_name {
static String setupDefaultDeployment(VoltLogger logger, File voltdbroot) throws IOException {
File configInfoDir = new VoltFile(voltdbroot, Constants.CONFIG_DIR);
configInfoDir.mkdirs();
File depFH = new VoltFile(configInfoDir, "deployment.xml");
if (!depFH.exists()) {
logger.info("Generating default deployment file \"" + depFH.getAbsolutePath() + "\"");
try (BufferedWriter bw = new BufferedWriter(new FileWriter(depFH))) {
for (String line : defaultDeploymentXML) {
bw.write(line); // depends on control dependency: [for], data = [line]
bw.newLine(); // depends on control dependency: [for], data = [none]
}
} finally {
}
}
return depFH.getAbsolutePath();
} }
|
public class class_name {
public static Object invokeMethod(Object object, String methodName, Object[] args)
throws NoSuchMethodException, IllegalAccessException, InvocationTargetException {
Class<?>[] paramTypes;
if (args == null) {
args = EMPTY_OBJECT_ARRAY;
paramTypes = EMPTY_CLASS_PARAMETERS;
} else {
int arguments = args.length;
if (arguments == 0) {
paramTypes = EMPTY_CLASS_PARAMETERS;
} else {
paramTypes = new Class<?>[arguments];
for (int i = 0; i < arguments; i++) {
if (args[i] != null) {
paramTypes[i] = args[i].getClass();
}
}
}
}
return invokeMethod(object, methodName, args, paramTypes);
} }
|
public class class_name {
public static Object invokeMethod(Object object, String methodName, Object[] args)
throws NoSuchMethodException, IllegalAccessException, InvocationTargetException {
Class<?>[] paramTypes;
if (args == null) {
args = EMPTY_OBJECT_ARRAY;
paramTypes = EMPTY_CLASS_PARAMETERS;
} else {
int arguments = args.length;
if (arguments == 0) {
paramTypes = EMPTY_CLASS_PARAMETERS; // depends on control dependency: [if], data = [none]
} else {
paramTypes = new Class<?>[arguments]; // depends on control dependency: [if], data = [none]
for (int i = 0; i < arguments; i++) {
if (args[i] != null) {
paramTypes[i] = args[i].getClass(); // depends on control dependency: [if], data = [none]
}
}
}
}
return invokeMethod(object, methodName, args, paramTypes);
} }
|
public class class_name {
public static Date parse(String date) {
try {
int offset = 0;
// extract year
int year = parseInt(date, offset, offset += 4);
if (checkOffset(date, offset, '-')) {
offset += 1;
}
// extract month
int month = parseInt(date, offset, offset += 2);
if (checkOffset(date, offset, '-')) {
offset += 1;
}
// extract day
int day = parseInt(date, offset, offset += 2);
// default time value
int hour = 0;
int minutes = 0;
int seconds = 0;
int milliseconds =
0; // always use 0 otherwise returned date will include millis of current time
// if the value has no time component (and no time zone), we are done
boolean hasT = checkOffset(date, offset, 'T');
if (!hasT && (date.length() <= offset)) {
Calendar calendar = new GregorianCalendar(year, month - 1, day);
return calendar.getTime();
}
if (hasT) {
// extract hours, minutes, seconds and milliseconds
hour = parseInt(date, offset += 1, offset += 2);
if (checkOffset(date, offset, ':')) {
offset += 1;
}
minutes = parseInt(date, offset, offset += 2);
if (checkOffset(date, offset, ':')) {
offset += 1;
}
// second and milliseconds can be optional
if (date.length() > offset) {
char c = date.charAt(offset);
if (c != 'Z' && c != '+' && c != '-') {
seconds = parseInt(date, offset, offset += 2);
if (seconds > 59 && seconds < 63) {
seconds = 59; // truncate up to 3 leap seconds
}
// milliseconds can be optional in the format
if (checkOffset(date, offset, '.')) {
offset += 1;
int endOffset = indexOfNonDigit(date, offset + 1); // assume at least one digit
int parseEndOffset = Math.min(endOffset, offset + 3); // parse up to 3 digits
int fraction = parseInt(date, offset, parseEndOffset);
milliseconds = (int) (Math.pow(10, 3 - (parseEndOffset - offset)) * fraction);
offset = endOffset;
}
}
}
}
// extract timezone
if (date.length() <= offset) {
throw new IllegalArgumentException("No time zone indicator");
}
TimeZone timezone;
char timezoneIndicator = date.charAt(offset);
if (timezoneIndicator == 'Z') {
timezone = TIMEZONE_Z;
} else if (timezoneIndicator == '+' || timezoneIndicator == '-') {
String timezoneOffset = date.substring(offset);
// 18-Jun-2015, tatu: Minor simplification, skip offset of "+0000"/"+00:00"
if ("+0000".equals(timezoneOffset) || "+00:00".equals(timezoneOffset)) {
timezone = TIMEZONE_Z;
} else {
// 18-Jun-2015, tatu: Looks like offsets only work from GMT, not UTC...
// not sure why, but it is what it is.
String timezoneId = GMT_ID + timezoneOffset;
timezone = TimeZone.getTimeZone(timezoneId);
String act = timezone.getID();
if (!act.equals(timezoneId)) {
/* 22-Jan-2015, tatu: Looks like canonical version has colons, but we may be given
* one without. If so, don't sweat.
* Yes, very inefficient. Hopefully not hit often.
* If it becomes a perf problem, add 'loose' comparison instead.
*/
String cleaned = act.replace(":", "");
if (!cleaned.equals(timezoneId)) {
throw new IndexOutOfBoundsException(
"Mismatching time zone indicator: "
+ timezoneId
+ " given, resolves to "
+ timezone.getID());
}
}
}
} else {
throw new IndexOutOfBoundsException(
"Invalid time zone indicator '" + timezoneIndicator + "'");
}
Calendar calendar = new GregorianCalendar(timezone);
calendar.setLenient(false);
calendar.set(Calendar.YEAR, year);
calendar.set(Calendar.MONTH, month - 1);
calendar.set(Calendar.DAY_OF_MONTH, day);
calendar.set(Calendar.HOUR_OF_DAY, hour);
calendar.set(Calendar.MINUTE, minutes);
calendar.set(Calendar.SECOND, seconds);
calendar.set(Calendar.MILLISECOND, milliseconds);
return calendar.getTime();
// If we get a ParseException it'll already have the right message/offset.
// Other exception types can convert here.
} catch (IndexOutOfBoundsException | IllegalArgumentException e) {
throw new RuntimeException("Not an RFC 3339 date: " + date, e);
}
} }
|
public class class_name {
public static Date parse(String date) {
try {
int offset = 0;
// extract year
int year = parseInt(date, offset, offset += 4);
if (checkOffset(date, offset, '-')) {
offset += 1; // depends on control dependency: [if], data = [none]
}
// extract month
int month = parseInt(date, offset, offset += 2);
if (checkOffset(date, offset, '-')) {
offset += 1; // depends on control dependency: [if], data = [none]
}
// extract day
int day = parseInt(date, offset, offset += 2);
// default time value
int hour = 0;
int minutes = 0;
int seconds = 0;
int milliseconds =
0; // always use 0 otherwise returned date will include millis of current time
// if the value has no time component (and no time zone), we are done
boolean hasT = checkOffset(date, offset, 'T');
if (!hasT && (date.length() <= offset)) {
Calendar calendar = new GregorianCalendar(year, month - 1, day);
return calendar.getTime(); // depends on control dependency: [if], data = [none]
}
if (hasT) {
// extract hours, minutes, seconds and milliseconds
hour = parseInt(date, offset += 1, offset += 2); // depends on control dependency: [if], data = [none]
if (checkOffset(date, offset, ':')) {
offset += 1; // depends on control dependency: [if], data = [none]
}
minutes = parseInt(date, offset, offset += 2); // depends on control dependency: [if], data = [none]
if (checkOffset(date, offset, ':')) {
offset += 1; // depends on control dependency: [if], data = [none]
}
// second and milliseconds can be optional
if (date.length() > offset) {
char c = date.charAt(offset);
if (c != 'Z' && c != '+' && c != '-') {
seconds = parseInt(date, offset, offset += 2); // depends on control dependency: [if], data = [none]
if (seconds > 59 && seconds < 63) {
seconds = 59; // truncate up to 3 leap seconds // depends on control dependency: [if], data = [none]
}
// milliseconds can be optional in the format
if (checkOffset(date, offset, '.')) {
offset += 1; // depends on control dependency: [if], data = [none]
int endOffset = indexOfNonDigit(date, offset + 1); // assume at least one digit
int parseEndOffset = Math.min(endOffset, offset + 3); // parse up to 3 digits
int fraction = parseInt(date, offset, parseEndOffset);
milliseconds = (int) (Math.pow(10, 3 - (parseEndOffset - offset)) * fraction); // depends on control dependency: [if], data = [none]
offset = endOffset; // depends on control dependency: [if], data = [none]
}
}
}
}
// extract timezone
if (date.length() <= offset) {
throw new IllegalArgumentException("No time zone indicator");
}
TimeZone timezone;
char timezoneIndicator = date.charAt(offset);
if (timezoneIndicator == 'Z') {
timezone = TIMEZONE_Z; // depends on control dependency: [if], data = [none]
} else if (timezoneIndicator == '+' || timezoneIndicator == '-') {
String timezoneOffset = date.substring(offset);
// 18-Jun-2015, tatu: Minor simplification, skip offset of "+0000"/"+00:00"
if ("+0000".equals(timezoneOffset) || "+00:00".equals(timezoneOffset)) {
timezone = TIMEZONE_Z; // depends on control dependency: [if], data = [none]
} else {
// 18-Jun-2015, tatu: Looks like offsets only work from GMT, not UTC...
// not sure why, but it is what it is.
String timezoneId = GMT_ID + timezoneOffset;
timezone = TimeZone.getTimeZone(timezoneId); // depends on control dependency: [if], data = [none]
String act = timezone.getID();
if (!act.equals(timezoneId)) {
/* 22-Jan-2015, tatu: Looks like canonical version has colons, but we may be given
* one without. If so, don't sweat.
* Yes, very inefficient. Hopefully not hit often.
* If it becomes a perf problem, add 'loose' comparison instead.
*/
String cleaned = act.replace(":", "");
if (!cleaned.equals(timezoneId)) {
throw new IndexOutOfBoundsException(
"Mismatching time zone indicator: "
+ timezoneId
+ " given, resolves to "
+ timezone.getID());
}
}
}
} else {
throw new IndexOutOfBoundsException(
"Invalid time zone indicator '" + timezoneIndicator + "'");
}
Calendar calendar = new GregorianCalendar(timezone);
calendar.setLenient(false); // depends on control dependency: [try], data = [none]
calendar.set(Calendar.YEAR, year); // depends on control dependency: [try], data = [none]
calendar.set(Calendar.MONTH, month - 1); // depends on control dependency: [try], data = [none]
calendar.set(Calendar.DAY_OF_MONTH, day); // depends on control dependency: [try], data = [none]
calendar.set(Calendar.HOUR_OF_DAY, hour); // depends on control dependency: [try], data = [none]
calendar.set(Calendar.MINUTE, minutes); // depends on control dependency: [try], data = [none]
calendar.set(Calendar.SECOND, seconds); // depends on control dependency: [try], data = [none]
calendar.set(Calendar.MILLISECOND, milliseconds); // depends on control dependency: [try], data = [none]
return calendar.getTime(); // depends on control dependency: [try], data = [none]
// If we get a ParseException it'll already have the right message/offset.
// Other exception types can convert here.
} catch (IndexOutOfBoundsException | IllegalArgumentException e) {
throw new RuntimeException("Not an RFC 3339 date: " + date, e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
@Override
public void merge(Collection<Bean> beans) throws AbortRuntimeException {
init();
Map<HBeanRow, HBeanRow> providedRows = new HashMap<>();
for (Bean bean : beans) {
HBeanRow row = new HBeanRow(bean, uids);
providedRows.put(row, row);
for (BeanId id : bean.getReferences()) {
HBeanRow refRow = new HBeanRow(id, uids);
providedRows.put(refRow, refRow);
}
}
HBeanRowCollector storedCollector = null;
try {
storedCollector = table.getEager(providedRows);
} catch (HBeanNotFoundException e) {
// only throw exception if the bean was not provided
if (!idsFoundIn(beans, e)) {
throw Events.CFG301_MISSING_RUNTIME_REF(e.getNotFound().iterator().next());
}
}
Map<HBeanRow, HBeanRow> storedRows = storedCollector.getRowMap();
Set<RowMutations> mutations = new HashSet<>();
for (HBeanRow provided : providedRows.keySet()) {
HBeanRow stored = storedRows.get(provided);
RowMutations rowMutations = new RowMutations(provided.getRowKey());
Set<HBeanRow> deleteReferences = stored.merge(provided, rowMutations);
try {
deleteReferences = table.getLazy(deleteReferences);
for (HBeanRow row : deleteReferences) {
RowMutations mutation = row.removePredecessor(provided);
mutations.add(mutation);
}
} catch (HBeanNotFoundException e) {
throw new IllegalStateException("Broken predecessors");
}
mutations.add(rowMutations);
}
table.mutate(mutations);
} }
|
public class class_name {
@Override
public void merge(Collection<Bean> beans) throws AbortRuntimeException {
init();
Map<HBeanRow, HBeanRow> providedRows = new HashMap<>();
for (Bean bean : beans) {
HBeanRow row = new HBeanRow(bean, uids);
providedRows.put(row, row);
for (BeanId id : bean.getReferences()) {
HBeanRow refRow = new HBeanRow(id, uids);
providedRows.put(refRow, refRow); // depends on control dependency: [for], data = [id]
}
}
HBeanRowCollector storedCollector = null;
try {
storedCollector = table.getEager(providedRows);
} catch (HBeanNotFoundException e) {
// only throw exception if the bean was not provided
if (!idsFoundIn(beans, e)) {
throw Events.CFG301_MISSING_RUNTIME_REF(e.getNotFound().iterator().next());
}
}
Map<HBeanRow, HBeanRow> storedRows = storedCollector.getRowMap();
Set<RowMutations> mutations = new HashSet<>();
for (HBeanRow provided : providedRows.keySet()) {
HBeanRow stored = storedRows.get(provided);
RowMutations rowMutations = new RowMutations(provided.getRowKey());
Set<HBeanRow> deleteReferences = stored.merge(provided, rowMutations);
try {
deleteReferences = table.getLazy(deleteReferences);
for (HBeanRow row : deleteReferences) {
RowMutations mutation = row.removePredecessor(provided);
mutations.add(mutation); // depends on control dependency: [for], data = [none]
}
} catch (HBeanNotFoundException e) {
throw new IllegalStateException("Broken predecessors");
}
mutations.add(rowMutations);
}
table.mutate(mutations);
} }
|
public class class_name {
protected OptimizationLevel getOptimizationLevelFromRequest(HttpServletRequest request) {
final String sourceMethod = "getOptimizationLevelFromRequest"; //$NON-NLS-1$
boolean isTraceLogging = log.isLoggable(Level.FINER);
if (isTraceLogging) {
log.entering(sourceClass, sourceMethod, new Object[]{request.getQueryString()});
}
// Get the optimization level specified in the request and set the ComilationLevel
String optimize = getParameter(request, OPTIMIZATIONLEVEL_REQPARAMS);
OptimizationLevel level = OptimizationLevel.SIMPLE;
if (optimize != null && !optimize.equals("")) { //$NON-NLS-1$
if (optimize.equalsIgnoreCase("whitespace")) //$NON-NLS-1$
level = OptimizationLevel.WHITESPACE;
else if (optimize.equalsIgnoreCase("advanced")) //$NON-NLS-1$
level = OptimizationLevel.ADVANCED;
else if (optimize.equalsIgnoreCase("none")) //$NON-NLS-1$
level = OptimizationLevel.NONE;
}
if (isTraceLogging) {
log.exiting(sourceClass, sourceMethod, level);
}
return level;
} }
|
public class class_name {
protected OptimizationLevel getOptimizationLevelFromRequest(HttpServletRequest request) {
final String sourceMethod = "getOptimizationLevelFromRequest"; //$NON-NLS-1$
boolean isTraceLogging = log.isLoggable(Level.FINER);
if (isTraceLogging) {
log.entering(sourceClass, sourceMethod, new Object[]{request.getQueryString()});
// depends on control dependency: [if], data = [none]
}
// Get the optimization level specified in the request and set the ComilationLevel
String optimize = getParameter(request, OPTIMIZATIONLEVEL_REQPARAMS);
OptimizationLevel level = OptimizationLevel.SIMPLE;
if (optimize != null && !optimize.equals("")) { //$NON-NLS-1$
if (optimize.equalsIgnoreCase("whitespace")) //$NON-NLS-1$
level = OptimizationLevel.WHITESPACE;
else if (optimize.equalsIgnoreCase("advanced")) //$NON-NLS-1$
level = OptimizationLevel.ADVANCED;
else if (optimize.equalsIgnoreCase("none")) //$NON-NLS-1$
level = OptimizationLevel.NONE;
}
if (isTraceLogging) {
log.exiting(sourceClass, sourceMethod, level);
// depends on control dependency: [if], data = [none]
}
return level;
} }
|
public class class_name {
private boolean decode_Segmentlist(AnnouncementParmValue annPaVa) throws ParserException {
boolean decoded = false;
decoded = decode_SegmentDescriptor(annPaVa);
if (decoded) {
boolean f = true;
while (f && index < totalChars) {
if (chars[index] == ',') {
index++;
f = decode_SegmentDescriptor(annPaVa);
} else {
f = false;
}
}
}
return decoded;
} }
|
public class class_name {
private boolean decode_Segmentlist(AnnouncementParmValue annPaVa) throws ParserException {
boolean decoded = false;
decoded = decode_SegmentDescriptor(annPaVa);
if (decoded) {
boolean f = true;
while (f && index < totalChars) {
if (chars[index] == ',') {
index++; // depends on control dependency: [if], data = [none]
f = decode_SegmentDescriptor(annPaVa); // depends on control dependency: [if], data = [none]
} else {
f = false; // depends on control dependency: [if], data = [none]
}
}
}
return decoded;
} }
|
public class class_name {
private MonthCellWithMonthIndex getMonthCellWithIndexByDate(Date date) {
Calendar searchCal = Calendar.getInstance(timeZone, locale);
searchCal.setTime(date);
String monthKey = monthKey(searchCal);
Calendar actCal = Calendar.getInstance(timeZone, locale);
int index = cells.getIndexOfKey(monthKey);
List<List<MonthCellDescriptor>> monthCells = cells.get(monthKey);
for (List<MonthCellDescriptor> weekCells : monthCells) {
for (MonthCellDescriptor actCell : weekCells) {
actCal.setTime(actCell.getDate());
if (sameDate(actCal, searchCal) && actCell.isSelectable()) {
return new MonthCellWithMonthIndex(actCell, index);
}
}
}
return null;
} }
|
public class class_name {
private MonthCellWithMonthIndex getMonthCellWithIndexByDate(Date date) {
Calendar searchCal = Calendar.getInstance(timeZone, locale);
searchCal.setTime(date);
String monthKey = monthKey(searchCal);
Calendar actCal = Calendar.getInstance(timeZone, locale);
int index = cells.getIndexOfKey(monthKey);
List<List<MonthCellDescriptor>> monthCells = cells.get(monthKey);
for (List<MonthCellDescriptor> weekCells : monthCells) {
for (MonthCellDescriptor actCell : weekCells) {
actCal.setTime(actCell.getDate()); // depends on control dependency: [for], data = [actCell]
if (sameDate(actCal, searchCal) && actCell.isSelectable()) {
return new MonthCellWithMonthIndex(actCell, index); // depends on control dependency: [if], data = [none]
}
}
}
return null;
} }
|
public class class_name {
private static boolean canDisplayColumns(List<TerminalString> displayList, int numRows, int terminalWidth) {
int numColumns = displayList.size() / numRows;
if (displayList.size() % numRows > 0) {
numColumns++;
}
int[] columnSizes = calculateColumnSizes(displayList, numColumns, numRows, terminalWidth);
int totalSize = 0;
for (int columnSize : columnSizes) {
totalSize += columnSize;
}
return totalSize <= terminalWidth;
} }
|
public class class_name {
private static boolean canDisplayColumns(List<TerminalString> displayList, int numRows, int terminalWidth) {
int numColumns = displayList.size() / numRows;
if (displayList.size() % numRows > 0) {
numColumns++; // depends on control dependency: [if], data = [none]
}
int[] columnSizes = calculateColumnSizes(displayList, numColumns, numRows, terminalWidth);
int totalSize = 0;
for (int columnSize : columnSizes) {
totalSize += columnSize; // depends on control dependency: [for], data = [columnSize]
}
return totalSize <= terminalWidth;
} }
|
public class class_name {
public static void writeMatrix(Matrix matrix, File output, Format format)
throws IOException {
if (matrix.rows() == 0 || matrix.columns() == 0)
throw new IllegalArgumentException(
"cannot write 0-dimensional matrix");
switch (format) {
case DENSE_TEXT: {
PrintWriter pw = new PrintWriter(output);
for (int i = 0; i < matrix.rows(); ++i) {
StringBuffer sb = new StringBuffer(matrix.columns() * 5);
for (int j = 0; j < matrix.columns(); ++j) {
sb.append(matrix.get(i,j)).append(" ");
}
pw.println(sb.toString());
}
pw.close();
break;
}
// These two formats are equivalent
case CLUTO_DENSE:
case SVDLIBC_DENSE_TEXT: {
PrintWriter pw = new PrintWriter(output);
pw.println(matrix.rows() + " " + matrix.columns());
for (int i = 0; i < matrix.rows(); ++i) {
StringBuffer sb = new StringBuffer(32);
for (int j = 0; j < matrix.columns(); ++j) {
sb.append((float)(matrix.get(i,j))).append(" ");
}
pw.println(sb.toString());
}
pw.close();
break;
}
case SVDLIBC_DENSE_BINARY: {
DataOutputStream outStream = new DataOutputStream(
new BufferedOutputStream(new FileOutputStream(output)));
outStream.writeInt(matrix.rows());
outStream.writeInt(matrix.columns());
for (int i = 0; i < matrix.rows(); ++i) {
for (int j = 0; j < matrix.columns(); ++j) {
outStream.writeFloat((float)matrix.get(i,j));
}
}
outStream.close();
break;
}
case CLUTO_SPARSE: {
PrintWriter pw = new PrintWriter(output);
// Count the number of non-zero values in the matrix
int nonZero = 0;
int rows = matrix.rows();
for (int i = 0; i < rows; ++i) {
DoubleVector v = matrix.getRowVector(i);
if (v instanceof SparseVector)
nonZero += ((SparseVector)v).getNonZeroIndices().length;
else {
for (int col = 0; col < v.length(); ++col) {
if (v.get(col) != 0)
nonZero++;
}
}
}
// Write the header: rows cols non-zero
pw.println(matrix.rows() + " " + matrix.columns() + " " + nonZero);
for (int row = 0; row < rows; ++row) {
StringBuilder sb = new StringBuilder(nonZero / rows);
// NOTE: the columns in CLUTO start at 1, not 0, so increment
// one to each of the columns
DoubleVector v = matrix.getRowVector(row);
if (v instanceof SparseVector) {
int[] nzIndices = ((SparseVector)v).getNonZeroIndices();
for (int nz : nzIndices) {
sb.append(nz + 1).append(" ").
append(v.get(nz)).append(" ");
}
}
else {
for (int col = 0; col < v.length(); ++col) {
double d = v.get(col);
if (d != 0)
sb.append(col+1).append(" ").append(d).append(" ");
}
}
pw.println(sb.toString());
}
pw.close();
break;
}
case SVDLIBC_SPARSE_TEXT: {
PrintWriter pw = new PrintWriter(output);
// count the number of non-zero values for each column as well as
// the total
int nonZero = 0;
int[] nonZeroPerCol = new int[matrix.columns()];
for (int i = 0; i < matrix.rows(); ++i) {
for (int j = 0; j < matrix.columns(); ++j) {
if (matrix.get(i, j) != 0) {
nonZero++;
nonZeroPerCol[j]++;
}
}
}
// loop through the matrix a second time, printing out the number of
// non-zero values for each column, followed by those values and
// their associated row
pw.println(matrix.rows() + " " + matrix.columns() + " " + nonZero);
for (int col = 0; col < matrix.columns(); ++col) {
pw.println(nonZeroPerCol[col]);
if (nonZeroPerCol[col] > 0) {
for (int row = 0; row < matrix.rows(); ++row) {
double val = matrix.get(row, col);
if (val != 0d) {
// NOTE: need to convert to float since this is what
// SVDLIBC uses
pw.println(row + " " +
Double.valueOf(val).floatValue());
}
}
}
}
pw.close();
break;
}
case SVDLIBC_SPARSE_BINARY: {
DataOutputStream outStream = new DataOutputStream(
new BufferedOutputStream(new FileOutputStream(output)));
// count the number of non-zero values for each column as well as
// the total
int nonZero = 0;
int[] nonZeroPerCol = new int[matrix.columns()];
for (int i = 0; i < matrix.rows(); ++i) {
for (int j = 0; j < matrix.columns(); ++j) {
if (matrix.get(i, j) != 0) {
nonZero++;
nonZeroPerCol[j]++;
}
}
}
// Write the 12 byte header data
outStream.writeInt(matrix.rows());
outStream.writeInt(matrix.columns());
outStream.writeInt(nonZero);
// loop through the matrix a second time, printing out the number of
// non-zero values for each column, followed by those values and
// their associated row
for (int col = 0; col < matrix.columns(); ++col) {
outStream.writeInt(nonZeroPerCol[col]);
if (nonZeroPerCol[col] > 0) {
for (int row = 0; row < matrix.rows(); ++row) {
double val = matrix.get(row, col);
if (val != 0) {
// NOTE: need to convert to float since this is what
// SVDLIBC uses
outStream.writeInt(row);
outStream.writeFloat((float)val);
}
}
}
}
outStream.close();
break;
}
case MATLAB_SPARSE: {
PrintWriter pw = new PrintWriter(output);
// NOTE: Matlab's sparse matrix offers no way of specifying the
// original matrix's dimensions. This is only problematic if the
// matrix contains trailing rows or columns that are all
// zeros. Therefore to ensure that the matrix has the correct size,
// we track the maximum values written and write a 0-value to extend
// the matrix to its correct size
int maxRowSeen = 0;
int maxColSeen = 0;
for (int i = 0; i < matrix.rows(); ++i) {
for (int j = 0; j < matrix.columns(); ++j) {
if (matrix.get(i,j) == 0)
continue;
if (j > maxColSeen)
maxColSeen = j;
if (i > maxRowSeen)
maxRowSeen = i;
StringBuffer sb = new StringBuffer(32);
// Add 1 to index values since Matlab arrays are 1-based,
// not 0-based
sb.append(i+1).append(" ").append(j+1);
sb.append(" ").append(matrix.get(i,j));
pw.println(sb.toString());
}
}
// Check whether we need to extend the matrix
if (maxRowSeen + 1 != matrix.rows()
|| maxColSeen + 1 != matrix.columns()) {
pw.println(matrix.rows() + " " + matrix.columns() + " 0");
}
pw.close();
break;
}
default:
throw new UnsupportedOperationException(
"writing to " + format + " is currently unsupported");
}
} }
|
public class class_name {
public static void writeMatrix(Matrix matrix, File output, Format format)
throws IOException {
if (matrix.rows() == 0 || matrix.columns() == 0)
throw new IllegalArgumentException(
"cannot write 0-dimensional matrix");
switch (format) {
case DENSE_TEXT: {
PrintWriter pw = new PrintWriter(output);
for (int i = 0; i < matrix.rows(); ++i) {
StringBuffer sb = new StringBuffer(matrix.columns() * 5);
for (int j = 0; j < matrix.columns(); ++j) {
sb.append(matrix.get(i,j)).append(" "); // depends on control dependency: [for], data = [j]
}
pw.println(sb.toString()); // depends on control dependency: [for], data = [none]
}
pw.close();
break;
}
// These two formats are equivalent
case CLUTO_DENSE:
case SVDLIBC_DENSE_TEXT: {
PrintWriter pw = new PrintWriter(output);
pw.println(matrix.rows() + " " + matrix.columns());
for (int i = 0; i < matrix.rows(); ++i) {
StringBuffer sb = new StringBuffer(32);
for (int j = 0; j < matrix.columns(); ++j) {
sb.append((float)(matrix.get(i,j))).append(" ");
}
pw.println(sb.toString());
}
pw.close();
break;
}
case SVDLIBC_DENSE_BINARY: {
DataOutputStream outStream = new DataOutputStream(
new BufferedOutputStream(new FileOutputStream(output)));
outStream.writeInt(matrix.rows());
outStream.writeInt(matrix.columns());
for (int i = 0; i < matrix.rows(); ++i) {
for (int j = 0; j < matrix.columns(); ++j) {
outStream.writeFloat((float)matrix.get(i,j));
}
}
outStream.close();
break;
}
case CLUTO_SPARSE: {
PrintWriter pw = new PrintWriter(output);
// Count the number of non-zero values in the matrix
int nonZero = 0;
int rows = matrix.rows();
for (int i = 0; i < rows; ++i) {
DoubleVector v = matrix.getRowVector(i);
if (v instanceof SparseVector)
nonZero += ((SparseVector)v).getNonZeroIndices().length;
else {
for (int col = 0; col < v.length(); ++col) {
if (v.get(col) != 0)
nonZero++;
}
}
}
// Write the header: rows cols non-zero
pw.println(matrix.rows() + " " + matrix.columns() + " " + nonZero);
for (int row = 0; row < rows; ++row) {
StringBuilder sb = new StringBuilder(nonZero / rows);
// NOTE: the columns in CLUTO start at 1, not 0, so increment
// one to each of the columns
DoubleVector v = matrix.getRowVector(row);
if (v instanceof SparseVector) {
int[] nzIndices = ((SparseVector)v).getNonZeroIndices();
for (int nz : nzIndices) {
sb.append(nz + 1).append(" ").
append(v.get(nz)).append(" ");
}
}
else {
for (int col = 0; col < v.length(); ++col) {
double d = v.get(col);
if (d != 0)
sb.append(col+1).append(" ").append(d).append(" ");
}
}
pw.println(sb.toString());
}
pw.close();
break;
}
case SVDLIBC_SPARSE_TEXT: {
PrintWriter pw = new PrintWriter(output);
// count the number of non-zero values for each column as well as
// the total
int nonZero = 0;
int[] nonZeroPerCol = new int[matrix.columns()];
for (int i = 0; i < matrix.rows(); ++i) {
for (int j = 0; j < matrix.columns(); ++j) {
if (matrix.get(i, j) != 0) {
nonZero++;
nonZeroPerCol[j]++;
}
}
}
// loop through the matrix a second time, printing out the number of
// non-zero values for each column, followed by those values and
// their associated row
pw.println(matrix.rows() + " " + matrix.columns() + " " + nonZero);
for (int col = 0; col < matrix.columns(); ++col) {
pw.println(nonZeroPerCol[col]);
if (nonZeroPerCol[col] > 0) {
for (int row = 0; row < matrix.rows(); ++row) {
double val = matrix.get(row, col);
if (val != 0d) {
// NOTE: need to convert to float since this is what
// SVDLIBC uses
pw.println(row + " " +
Double.valueOf(val).floatValue());
}
}
}
}
pw.close();
break;
}
case SVDLIBC_SPARSE_BINARY: {
DataOutputStream outStream = new DataOutputStream(
new BufferedOutputStream(new FileOutputStream(output)));
// count the number of non-zero values for each column as well as
// the total
int nonZero = 0;
int[] nonZeroPerCol = new int[matrix.columns()];
for (int i = 0; i < matrix.rows(); ++i) {
for (int j = 0; j < matrix.columns(); ++j) {
if (matrix.get(i, j) != 0) {
nonZero++;
nonZeroPerCol[j]++;
}
}
}
// Write the 12 byte header data
outStream.writeInt(matrix.rows());
outStream.writeInt(matrix.columns());
outStream.writeInt(nonZero);
// loop through the matrix a second time, printing out the number of
// non-zero values for each column, followed by those values and
// their associated row
for (int col = 0; col < matrix.columns(); ++col) {
outStream.writeInt(nonZeroPerCol[col]);
if (nonZeroPerCol[col] > 0) {
for (int row = 0; row < matrix.rows(); ++row) {
double val = matrix.get(row, col);
if (val != 0) {
// NOTE: need to convert to float since this is what
// SVDLIBC uses
outStream.writeInt(row);
outStream.writeFloat((float)val);
}
}
}
}
outStream.close();
break;
}
case MATLAB_SPARSE: {
PrintWriter pw = new PrintWriter(output);
// NOTE: Matlab's sparse matrix offers no way of specifying the
// original matrix's dimensions. This is only problematic if the
// matrix contains trailing rows or columns that are all
// zeros. Therefore to ensure that the matrix has the correct size,
// we track the maximum values written and write a 0-value to extend
// the matrix to its correct size
int maxRowSeen = 0;
int maxColSeen = 0;
for (int i = 0; i < matrix.rows(); ++i) {
for (int j = 0; j < matrix.columns(); ++j) {
if (matrix.get(i,j) == 0)
continue;
if (j > maxColSeen)
maxColSeen = j;
if (i > maxRowSeen)
maxRowSeen = i;
StringBuffer sb = new StringBuffer(32);
// Add 1 to index values since Matlab arrays are 1-based,
// not 0-based
sb.append(i+1).append(" ").append(j+1);
sb.append(" ").append(matrix.get(i,j));
pw.println(sb.toString());
}
}
// Check whether we need to extend the matrix
if (maxRowSeen + 1 != matrix.rows()
|| maxColSeen + 1 != matrix.columns()) {
pw.println(matrix.rows() + " " + matrix.columns() + " 0");
}
pw.close();
break;
}
default:
throw new UnsupportedOperationException(
"writing to " + format + " is currently unsupported");
}
} }
|
public class class_name {
public void disposeTooltip() {
if (popup != null) {
timer.stop();
popup.setVisible(false);
popup = null;
}
} }
|
public class class_name {
public void disposeTooltip() {
if (popup != null) {
timer.stop(); // depends on control dependency: [if], data = [none]
popup.setVisible(false); // depends on control dependency: [if], data = [none]
popup = null; // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public static int getAtomCount(IMolecularFormula formula) {
int count = 0;
for (IIsotope isotope : formula.isotopes()) {
count += formula.getIsotopeCount(isotope);
}
return count;
} }
|
public class class_name {
public static int getAtomCount(IMolecularFormula formula) {
int count = 0;
for (IIsotope isotope : formula.isotopes()) {
count += formula.getIsotopeCount(isotope); // depends on control dependency: [for], data = [isotope]
}
return count;
} }
|
public class class_name {
public Revision next()
{
try {
Revision revision = new Revision(result.getInt(2));
this.primaryKey = result.getInt(1);
revision.setPrimaryKey(this.primaryKey);
revision.setRevisionID(result.getInt(3));
revision.setArticleID(result.getInt(4));
revision.setTimeStamp(new Timestamp(result.getLong(5)));
revision.setFullRevisionID(result.getInt(6));
return revision;
}
catch (Exception e) {
e.printStackTrace();
throw new RuntimeException(e);
}
} }
|
public class class_name {
public Revision next()
{
try {
Revision revision = new Revision(result.getInt(2));
this.primaryKey = result.getInt(1); // depends on control dependency: [try], data = [none]
revision.setPrimaryKey(this.primaryKey); // depends on control dependency: [try], data = [none]
revision.setRevisionID(result.getInt(3)); // depends on control dependency: [try], data = [none]
revision.setArticleID(result.getInt(4)); // depends on control dependency: [try], data = [none]
revision.setTimeStamp(new Timestamp(result.getLong(5))); // depends on control dependency: [try], data = [none]
revision.setFullRevisionID(result.getInt(6)); // depends on control dependency: [try], data = [none]
return revision; // depends on control dependency: [try], data = [none]
}
catch (Exception e) {
e.printStackTrace();
throw new RuntimeException(e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public OptionGroupOption withOptionsConflictsWith(String... optionsConflictsWith) {
if (this.optionsConflictsWith == null) {
setOptionsConflictsWith(new com.amazonaws.internal.SdkInternalList<String>(optionsConflictsWith.length));
}
for (String ele : optionsConflictsWith) {
this.optionsConflictsWith.add(ele);
}
return this;
} }
|
public class class_name {
public OptionGroupOption withOptionsConflictsWith(String... optionsConflictsWith) {
if (this.optionsConflictsWith == null) {
setOptionsConflictsWith(new com.amazonaws.internal.SdkInternalList<String>(optionsConflictsWith.length)); // depends on control dependency: [if], data = [none]
}
for (String ele : optionsConflictsWith) {
this.optionsConflictsWith.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} }
|
public class class_name {
@SuppressWarnings("unchecked")
protected List<EntityImpl> getList(String dbQueryName, Object parameter,
CachedEntityMatcher<EntityImpl> cachedEntityMatcher, boolean checkCache) {
Collection<EntityImpl> result = getDbSqlSession().selectList(dbQueryName, parameter);
if (checkCache) {
Collection<CachedEntity> cachedObjects = getEntityCache().findInCacheAsCachedObjects(getManagedEntityClass());
if ( (cachedObjects != null && cachedObjects.size() > 0) || getManagedEntitySubClasses() != null) {
HashMap<String, EntityImpl> entityMap = new HashMap<String, EntityImpl>(result.size());
// Database entities
for (EntityImpl entity : result) {
entityMap.put(entity.getId(), entity);
}
// Cache entities
if (cachedObjects != null && cachedEntityMatcher != null) {
for (CachedEntity cachedObject : cachedObjects) {
EntityImpl cachedEntity = (EntityImpl) cachedObject.getEntity();
if (cachedEntityMatcher.isRetained(result, cachedObjects, cachedEntity, parameter)) {
entityMap.put(cachedEntity.getId(), cachedEntity); // will overwite db version with newer version
}
}
}
if (getManagedEntitySubClasses() != null && cachedEntityMatcher != null) {
for (Class<? extends EntityImpl> entitySubClass : getManagedEntitySubClasses()) {
Collection<CachedEntity> subclassCachedObjects = getEntityCache().findInCacheAsCachedObjects(entitySubClass);
if (subclassCachedObjects != null) {
for (CachedEntity subclassCachedObject : subclassCachedObjects) {
EntityImpl cachedSubclassEntity = (EntityImpl) subclassCachedObject.getEntity();
if (cachedEntityMatcher.isRetained(result, cachedObjects, cachedSubclassEntity, parameter)) {
entityMap.put(cachedSubclassEntity.getId(), cachedSubclassEntity); // will overwite db version with newer version
}
}
}
}
}
result = entityMap.values();
}
}
// Remove entries which are already deleted
if (result.size() > 0) {
Iterator<EntityImpl> resultIterator = result.iterator();
while (resultIterator.hasNext()) {
if (getDbSqlSession().isEntityToBeDeleted(resultIterator.next())) {
resultIterator.remove();
}
}
}
return new ArrayList<EntityImpl>(result);
} }
|
public class class_name {
@SuppressWarnings("unchecked")
protected List<EntityImpl> getList(String dbQueryName, Object parameter,
CachedEntityMatcher<EntityImpl> cachedEntityMatcher, boolean checkCache) {
Collection<EntityImpl> result = getDbSqlSession().selectList(dbQueryName, parameter);
if (checkCache) {
Collection<CachedEntity> cachedObjects = getEntityCache().findInCacheAsCachedObjects(getManagedEntityClass());
if ( (cachedObjects != null && cachedObjects.size() > 0) || getManagedEntitySubClasses() != null) {
HashMap<String, EntityImpl> entityMap = new HashMap<String, EntityImpl>(result.size());
// Database entities
for (EntityImpl entity : result) {
entityMap.put(entity.getId(), entity); // depends on control dependency: [for], data = [entity]
}
// Cache entities
if (cachedObjects != null && cachedEntityMatcher != null) {
for (CachedEntity cachedObject : cachedObjects) {
EntityImpl cachedEntity = (EntityImpl) cachedObject.getEntity();
if (cachedEntityMatcher.isRetained(result, cachedObjects, cachedEntity, parameter)) {
entityMap.put(cachedEntity.getId(), cachedEntity); // will overwite db version with newer version // depends on control dependency: [if], data = [none]
}
}
}
if (getManagedEntitySubClasses() != null && cachedEntityMatcher != null) {
for (Class<? extends EntityImpl> entitySubClass : getManagedEntitySubClasses()) {
Collection<CachedEntity> subclassCachedObjects = getEntityCache().findInCacheAsCachedObjects(entitySubClass);
if (subclassCachedObjects != null) {
for (CachedEntity subclassCachedObject : subclassCachedObjects) {
EntityImpl cachedSubclassEntity = (EntityImpl) subclassCachedObject.getEntity();
if (cachedEntityMatcher.isRetained(result, cachedObjects, cachedSubclassEntity, parameter)) {
entityMap.put(cachedSubclassEntity.getId(), cachedSubclassEntity); // will overwite db version with newer version
}
}
}
}
}
result = entityMap.values();
}
}
// Remove entries which are already deleted
if (result.size() > 0) {
Iterator<EntityImpl> resultIterator = result.iterator();
while (resultIterator.hasNext()) {
if (getDbSqlSession().isEntityToBeDeleted(resultIterator.next())) {
resultIterator.remove();
}
}
}
return new ArrayList<EntityImpl>(result);
} }
|
public class class_name {
protected LightweightTypeReference getExpectedType(XtendExecutable executable, JvmTypeReference declaredReturnType) {
if (declaredReturnType == null) {
// Try to get any inferred return type.
if (executable instanceof XtendFunction) {
final XtendFunction function = (XtendFunction) executable;
final JvmOperation operation = this.sarlAssociations.getDirectlyInferredOperation(function);
if (operation != null) {
return Utils.toLightweightTypeReference(operation.getReturnType(), this.services);
}
}
if (!getEarlyExitComputer().isEarlyExit(executable.getExpression())) {
return getExpectedType(executable.getExpression());
}
return null;
}
if (!"void".equals(declaredReturnType.getIdentifier())) { //$NON-NLS-1$
return Utils.toLightweightTypeReference(declaredReturnType, this.services);
}
return null;
} }
|
public class class_name {
protected LightweightTypeReference getExpectedType(XtendExecutable executable, JvmTypeReference declaredReturnType) {
if (declaredReturnType == null) {
// Try to get any inferred return type.
if (executable instanceof XtendFunction) {
final XtendFunction function = (XtendFunction) executable;
final JvmOperation operation = this.sarlAssociations.getDirectlyInferredOperation(function);
if (operation != null) {
return Utils.toLightweightTypeReference(operation.getReturnType(), this.services); // depends on control dependency: [if], data = [(operation]
}
}
if (!getEarlyExitComputer().isEarlyExit(executable.getExpression())) {
return getExpectedType(executable.getExpression()); // depends on control dependency: [if], data = [none]
}
return null; // depends on control dependency: [if], data = [none]
}
if (!"void".equals(declaredReturnType.getIdentifier())) { //$NON-NLS-1$
return Utils.toLightweightTypeReference(declaredReturnType, this.services); // depends on control dependency: [if], data = [none]
}
return null;
} }
|
public class class_name {
public static String stripDefaultPortFromUrl(String url) {
String scheme = urlToScheme(url);
if(scheme == null) {
return url;
}
int defaultPort = schemeToDefaultPort(scheme);
if(defaultPort == -1) {
return url;
}
String portStr = null;
// is there a slash after the scheme?
int slashIdx = url.indexOf('/', scheme.length());
if(slashIdx == -1) {
portStr = String.format(":%d", defaultPort);
if(url.endsWith(portStr)) {
return url.substring(0,url.length() - portStr.length());
}
}
portStr = String.format(":%d/", defaultPort);
int idx = url.indexOf(portStr);
if(idx == -1) {
return url;
}
// if that occurred before the first / (after the scheme) then strip it:
if(slashIdx < idx) {
return url;
}
// we want to strip out the portStr:
StringBuilder sb = new StringBuilder(url.length());
sb.append(url.substring(0,idx));
sb.append(url.substring(idx + (portStr.length()-1)));
return sb.toString();
} }
|
public class class_name {
public static String stripDefaultPortFromUrl(String url) {
String scheme = urlToScheme(url);
if(scheme == null) {
return url; // depends on control dependency: [if], data = [none]
}
int defaultPort = schemeToDefaultPort(scheme);
if(defaultPort == -1) {
return url; // depends on control dependency: [if], data = [none]
}
String portStr = null;
// is there a slash after the scheme?
int slashIdx = url.indexOf('/', scheme.length());
if(slashIdx == -1) {
portStr = String.format(":%d", defaultPort); // depends on control dependency: [if], data = [none]
if(url.endsWith(portStr)) {
return url.substring(0,url.length() - portStr.length()); // depends on control dependency: [if], data = [none]
}
}
portStr = String.format(":%d/", defaultPort);
int idx = url.indexOf(portStr);
if(idx == -1) {
return url; // depends on control dependency: [if], data = [none]
}
// if that occurred before the first / (after the scheme) then strip it:
if(slashIdx < idx) {
return url; // depends on control dependency: [if], data = [none]
}
// we want to strip out the portStr:
StringBuilder sb = new StringBuilder(url.length());
sb.append(url.substring(0,idx));
sb.append(url.substring(idx + (portStr.length()-1)));
return sb.toString();
} }
|
public class class_name {
@Override
public final boolean incrementToken() throws IOException {
if (input.incrementToken()) {
if (!keywordAttr.isKeyword()) {
char termBuffer[] = termAtt.buffer();
final int length = termAtt.length();
stemmer.setCurrent(new String(Arrays.copyOf(termBuffer, length)));
if (stemmer.stem()) {
final char finalTerm[] = stemmer.getCurrent().toCharArray();
final int newLength = finalTerm.length;
termAtt.copyBuffer(finalTerm, 0, newLength);
} else {
termAtt.setLength(length);
}
}
return true;
}
return false;
} }
|
public class class_name {
@Override
public final boolean incrementToken() throws IOException {
if (input.incrementToken()) {
if (!keywordAttr.isKeyword()) {
char termBuffer[] = termAtt.buffer();
final int length = termAtt.length();
stemmer.setCurrent(new String(Arrays.copyOf(termBuffer, length)));
if (stemmer.stem()) {
final char finalTerm[] = stemmer.getCurrent().toCharArray();
final int newLength = finalTerm.length;
termAtt.copyBuffer(finalTerm, 0, newLength); // depends on control dependency: [if], data = [none]
} else {
termAtt.setLength(length); // depends on control dependency: [if], data = [none]
}
}
return true;
}
return false;
} }
|
public class class_name {
public void setDbWorkConStr(String dbWorkConStr) {
String driver;
String pool = '.' + getPool() + '.';
driver = getDbProperty(m_databaseKey + ".driver");
setExtProperty(CmsDbPoolV11.KEY_DATABASE_POOL + pool + CmsDbPoolV11.KEY_JDBC_DRIVER, driver);
setExtProperty(CmsDbPoolV11.KEY_DATABASE_POOL + pool + CmsDbPoolV11.KEY_JDBC_URL, dbWorkConStr);
String testQuery = getDbTestQuery();
if (!CmsStringUtil.isEmptyOrWhitespaceOnly(testQuery)) {
setExtProperty(CmsDbPoolV11.KEY_DATABASE_POOL + pool + "v11.connectionTestQuery", testQuery);
}
setExtProperty(CmsDbPoolV11.KEY_DATABASE_POOL + pool + CmsDbPoolV11.KEY_JDBC_URL_PARAMS, getDbConStrParams());
} }
|
public class class_name {
public void setDbWorkConStr(String dbWorkConStr) {
String driver;
String pool = '.' + getPool() + '.';
driver = getDbProperty(m_databaseKey + ".driver");
setExtProperty(CmsDbPoolV11.KEY_DATABASE_POOL + pool + CmsDbPoolV11.KEY_JDBC_DRIVER, driver);
setExtProperty(CmsDbPoolV11.KEY_DATABASE_POOL + pool + CmsDbPoolV11.KEY_JDBC_URL, dbWorkConStr);
String testQuery = getDbTestQuery();
if (!CmsStringUtil.isEmptyOrWhitespaceOnly(testQuery)) {
setExtProperty(CmsDbPoolV11.KEY_DATABASE_POOL + pool + "v11.connectionTestQuery", testQuery); // depends on control dependency: [if], data = [none]
}
setExtProperty(CmsDbPoolV11.KEY_DATABASE_POOL + pool + CmsDbPoolV11.KEY_JDBC_URL_PARAMS, getDbConStrParams());
} }
|
public class class_name {
public static String applyCodeReplacements(Iterable<CodeReplacement> replacements, String code) {
List<CodeReplacement> sortedReplacements = ORDER_CODE_REPLACEMENTS.sortedCopy(replacements);
validateNoOverlaps(sortedReplacements);
StringBuilder sb = new StringBuilder();
int lastIndex = 0;
for (CodeReplacement replacement : sortedReplacements) {
sb.append(code, lastIndex, replacement.getStartPosition());
sb.append(replacement.getNewContent());
lastIndex = replacement.getEndPosition();
}
if (lastIndex <= code.length()) {
sb.append(code, lastIndex, code.length());
}
return sb.toString();
} }
|
public class class_name {
public static String applyCodeReplacements(Iterable<CodeReplacement> replacements, String code) {
List<CodeReplacement> sortedReplacements = ORDER_CODE_REPLACEMENTS.sortedCopy(replacements);
validateNoOverlaps(sortedReplacements);
StringBuilder sb = new StringBuilder();
int lastIndex = 0;
for (CodeReplacement replacement : sortedReplacements) {
sb.append(code, lastIndex, replacement.getStartPosition()); // depends on control dependency: [for], data = [replacement]
sb.append(replacement.getNewContent()); // depends on control dependency: [for], data = [replacement]
lastIndex = replacement.getEndPosition(); // depends on control dependency: [for], data = [replacement]
}
if (lastIndex <= code.length()) {
sb.append(code, lastIndex, code.length()); // depends on control dependency: [if], data = [none]
}
return sb.toString();
} }
|
public class class_name {
private static boolean isRequired(ValidatorInfo info) {
if (null != info) {
for (ConstraintInfo constraint : info.getConstraints()) {
if (constraint instanceof NotNullConstraintInfo) {
return true;
}
}
}
return false;
} }
|
public class class_name {
private static boolean isRequired(ValidatorInfo info) {
if (null != info) {
for (ConstraintInfo constraint : info.getConstraints()) {
if (constraint instanceof NotNullConstraintInfo) {
return true; // depends on control dependency: [if], data = [none]
}
}
}
return false;
} }
|
public class class_name {
public static UnsafeSliceFactory getInstance()
{
// see setAccessible() in AccessibleObject
SecurityManager sm = System.getSecurityManager();
if (sm != null) {
sm.checkPermission(ACCESS_PERMISSION);
}
return INSTANCE;
} }
|
public class class_name {
public static UnsafeSliceFactory getInstance()
{
// see setAccessible() in AccessibleObject
SecurityManager sm = System.getSecurityManager();
if (sm != null) {
sm.checkPermission(ACCESS_PERMISSION); // depends on control dependency: [if], data = [none]
}
return INSTANCE;
} }
|
public class class_name {
protected final String getValidJPAColumnName(Class<?> entity, Field f)
{
String name = null;
if (f.isAnnotationPresent(Column.class))
{
Column c = f.getAnnotation(Column.class);
if (!c.name().isEmpty())
{
name = c.name();
}
else
{
name = f.getName();
}
}
else if (f.isAnnotationPresent(Basic.class))
{
name = f.getName();
}
if (f.isAnnotationPresent(Temporal.class))
{
if (!f.getType().equals(Date.class))
{
log.error("@Temporal must map to java.util.Date for @Entity(" + entity.getName() + "." + f.getName()
+ ")");
return name;
}
if (null == name)
{
name = f.getName();
}
}
return name;
} }
|
public class class_name {
protected final String getValidJPAColumnName(Class<?> entity, Field f)
{
String name = null;
if (f.isAnnotationPresent(Column.class))
{
Column c = f.getAnnotation(Column.class);
if (!c.name().isEmpty())
{
name = c.name();
// depends on control dependency: [if], data = [none]
}
else
{
name = f.getName();
// depends on control dependency: [if], data = [none]
}
}
else if (f.isAnnotationPresent(Basic.class))
{
name = f.getName();
// depends on control dependency: [if], data = [none]
}
if (f.isAnnotationPresent(Temporal.class))
{
if (!f.getType().equals(Date.class))
{
log.error("@Temporal must map to java.util.Date for @Entity(" + entity.getName() + "." + f.getName()
+ ")");
return name;
}
if (null == name)
{
name = f.getName();
}
}
return name;
// depends on control dependency: [if], data = [none]
} }
|
public class class_name {
public int getDocumentNumber(ForeignSegmentDocId docId) {
OffsetReader r = (OffsetReader) readersByCreationTick.get(
new Long(docId.getCreationTick()));
if (r != null && !r.reader.isDeleted(docId.getDocNumber())) {
return r.offset + docId.getDocNumber();
}
return -1;
} }
|
public class class_name {
public int getDocumentNumber(ForeignSegmentDocId docId) {
OffsetReader r = (OffsetReader) readersByCreationTick.get(
new Long(docId.getCreationTick()));
if (r != null && !r.reader.isDeleted(docId.getDocNumber())) {
return r.offset + docId.getDocNumber(); // depends on control dependency: [if], data = [none]
}
return -1;
} }
|
public class class_name {
public EEnum getIfcValveTypeEnum() {
if (ifcValveTypeEnumEEnum == null) {
ifcValveTypeEnumEEnum = (EEnum) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI)
.getEClassifiers().get(925);
}
return ifcValveTypeEnumEEnum;
} }
|
public class class_name {
public EEnum getIfcValveTypeEnum() {
if (ifcValveTypeEnumEEnum == null) {
ifcValveTypeEnumEEnum = (EEnum) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI)
.getEClassifiers().get(925);
// depends on control dependency: [if], data = [none]
}
return ifcValveTypeEnumEEnum;
} }
|
public class class_name {
@Override
public Object toJdbc(final Date original, final Connection connection,
final BindParameterMapperManager parameterMapperManager) {
if (original instanceof java.sql.Date || original instanceof java.sql.Timestamp
|| original instanceof java.sql.Time) {
return original;
}
return new java.sql.Timestamp(original.getTime());
} }
|
public class class_name {
@Override
public Object toJdbc(final Date original, final Connection connection,
final BindParameterMapperManager parameterMapperManager) {
if (original instanceof java.sql.Date || original instanceof java.sql.Timestamp
|| original instanceof java.sql.Time) {
return original; // depends on control dependency: [if], data = [none]
}
return new java.sql.Timestamp(original.getTime());
} }
|
public class class_name {
public boolean addVarArgs(JSType type) {
if (hasVarArgs()) {
return false;
}
newParameter(type).setVarArgs(true);
return true;
} }
|
public class class_name {
public boolean addVarArgs(JSType type) {
if (hasVarArgs()) {
return false; // depends on control dependency: [if], data = [none]
}
newParameter(type).setVarArgs(true);
return true;
} }
|
public class class_name {
@CheckReturnValue
@SchedulerSupport(SchedulerSupport.NONE)
public static Completable ambArray(final CompletableSource... sources) {
ObjectHelper.requireNonNull(sources, "sources is null");
if (sources.length == 0) {
return complete();
}
if (sources.length == 1) {
return wrap(sources[0]);
}
return RxJavaPlugins.onAssembly(new CompletableAmb(sources, null));
} }
|
public class class_name {
@CheckReturnValue
@SchedulerSupport(SchedulerSupport.NONE)
public static Completable ambArray(final CompletableSource... sources) {
ObjectHelper.requireNonNull(sources, "sources is null");
if (sources.length == 0) {
return complete(); // depends on control dependency: [if], data = [none]
}
if (sources.length == 1) {
return wrap(sources[0]); // depends on control dependency: [if], data = [none]
}
return RxJavaPlugins.onAssembly(new CompletableAmb(sources, null));
} }
|
public class class_name {
private void initConfig(String[] args) {
try {
ServerParams.load(args);
if (Utils.isEmpty(ServerParams.instance().getModuleParamString("DoradusServer", "super_user"))) {
m_logger.warn("'DoradusServer.super_user' parameter is not defined. " +
"Privileged commands will be available without authentication.");
}
} catch (ConfigurationException e) {
throw new RuntimeException("Failed to initialize server configuration", e);
}
} }
|
public class class_name {
private void initConfig(String[] args) {
try {
ServerParams.load(args);
// depends on control dependency: [try], data = [none]
if (Utils.isEmpty(ServerParams.instance().getModuleParamString("DoradusServer", "super_user"))) {
m_logger.warn("'DoradusServer.super_user' parameter is not defined. " +
"Privileged commands will be available without authentication.");
// depends on control dependency: [if], data = [none]
}
} catch (ConfigurationException e) {
throw new RuntimeException("Failed to initialize server configuration", e);
}
// depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public void run(String[] args) {
LOG.info("Starting GA4GHPicardRunner");
try {
parseCmdLine(args);
buildPicardCommand();
startProcess();
pumpInputData();
waitForProcessEnd();
} catch (Exception e) {
System.out.println(e.getMessage());
e.printStackTrace();
}
} }
|
public class class_name {
public void run(String[] args) {
LOG.info("Starting GA4GHPicardRunner");
try {
parseCmdLine(args); // depends on control dependency: [try], data = [none]
buildPicardCommand(); // depends on control dependency: [try], data = [none]
startProcess(); // depends on control dependency: [try], data = [none]
pumpInputData(); // depends on control dependency: [try], data = [none]
waitForProcessEnd(); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
System.out.println(e.getMessage());
e.printStackTrace();
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
@Override
public void close() {
try {
for (T client : activeClients) {
try {
invalidateObject(client);
} catch (Exception e) {
LOGGER.warn(e.getMessage(), e);
}
}
} finally {
super.close();
}
} }
|
public class class_name {
@Override
public void close() {
try {
for (T client : activeClients) {
try {
invalidateObject(client); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
LOGGER.warn(e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
}
} finally {
super.close();
}
} }
|
public class class_name {
public void unregisterService() {
try {
if( this.serviceReg != null ) {
this.logger.finer( "Running in an OSGi environment. Trying to unregister a MBean for the messaging." );
this.serviceReg.unregister();
this.logger.finer( "Running in an OSGi environment. The MBean was unregistered." );
}
} catch( Exception e ) {
this.logger.severe( "A MBean could not be unregistered for the messaging." );
Utils.logException( this.logger, e );
} finally {
this.serviceReg = null;
}
} }
|
public class class_name {
public void unregisterService() {
try {
if( this.serviceReg != null ) {
this.logger.finer( "Running in an OSGi environment. Trying to unregister a MBean for the messaging." ); // depends on control dependency: [if], data = [none]
this.serviceReg.unregister(); // depends on control dependency: [if], data = [none]
this.logger.finer( "Running in an OSGi environment. The MBean was unregistered." ); // depends on control dependency: [if], data = [none]
}
} catch( Exception e ) {
this.logger.severe( "A MBean could not be unregistered for the messaging." );
Utils.logException( this.logger, e );
} finally { // depends on control dependency: [catch], data = [none]
this.serviceReg = null;
}
} }
|
public class class_name {
private void getCapabilities(PrintWriter out, HttpServletRequest hsreq, SimpleGeometryCSBuilder sgcs) {
WFSGetCapabilitiesWriter gcdw = new WFSGetCapabilitiesWriter(out, WFSController.constructServerPath(hsreq));
gcdw.startXML();
gcdw.addOperation(WFSRequestType.GetCapabilities); gcdw.addOperation(WFSRequestType.DescribeFeatureType); gcdw.addOperation(WFSRequestType.GetFeature);
gcdw.writeOperations();
List<String> seriesNames = sgcs.getGeometrySeriesNames();
for(String name : seriesNames) {
gcdw.addFeature(new WFSFeature(TDSNAMESPACE + ":" + name, name));
}
gcdw.writeFeatureTypes();
gcdw.finishXML();
} }
|
public class class_name {
private void getCapabilities(PrintWriter out, HttpServletRequest hsreq, SimpleGeometryCSBuilder sgcs) {
WFSGetCapabilitiesWriter gcdw = new WFSGetCapabilitiesWriter(out, WFSController.constructServerPath(hsreq));
gcdw.startXML();
gcdw.addOperation(WFSRequestType.GetCapabilities); gcdw.addOperation(WFSRequestType.DescribeFeatureType); gcdw.addOperation(WFSRequestType.GetFeature);
gcdw.writeOperations();
List<String> seriesNames = sgcs.getGeometrySeriesNames();
for(String name : seriesNames) {
gcdw.addFeature(new WFSFeature(TDSNAMESPACE + ":" + name, name));
// depends on control dependency: [for], data = [name]
}
gcdw.writeFeatureTypes();
gcdw.finishXML();
} }
|
public class class_name {
public boolean hasNext(@Nullable CriterionBidLandscapePage page) {
if (page == null) {
return true;
}
return getTotalLandscapePointsInPage(page) >= pageSize;
} }
|
public class class_name {
public boolean hasNext(@Nullable CriterionBidLandscapePage page) {
if (page == null) {
return true; // depends on control dependency: [if], data = [none]
}
return getTotalLandscapePointsInPage(page) >= pageSize;
} }
|
public class class_name {
@Override
protected FeatureSample processSample(FeatureSample reference) {
String[] predictedFeatures = featurizer.featurize(reference.getSentence(),
reference.getTags());
String[] referenceTags = reference.getFeatures();
for (int i = 0; i < referenceTags.length; i++) {
if (referenceTags[i].equals(predictedFeatures[i])) {
wordAccuracy.add(1);
} else {
wordAccuracy.add(0);
}
}
FeatureSample result = new FeatureSample(reference.getSentence(), reference.getLemmas(),
reference.getTags(), predictedFeatures);
return result;
} }
|
public class class_name {
@Override
protected FeatureSample processSample(FeatureSample reference) {
String[] predictedFeatures = featurizer.featurize(reference.getSentence(),
reference.getTags());
String[] referenceTags = reference.getFeatures();
for (int i = 0; i < referenceTags.length; i++) {
if (referenceTags[i].equals(predictedFeatures[i])) {
wordAccuracy.add(1); // depends on control dependency: [if], data = [none]
} else {
wordAccuracy.add(0); // depends on control dependency: [if], data = [none]
}
}
FeatureSample result = new FeatureSample(reference.getSentence(), reference.getLemmas(),
reference.getTags(), predictedFeatures);
return result;
} }
|
public class class_name {
private boolean hasRole(CmsRole role) {
if (m_user != null) {
return OpenCms.getRoleManager().hasRole(m_cms, m_user.getName(), CmsRole.VFS_MANAGER);
}
return false;
} }
|
public class class_name {
private boolean hasRole(CmsRole role) {
if (m_user != null) {
return OpenCms.getRoleManager().hasRole(m_cms, m_user.getName(), CmsRole.VFS_MANAGER); // depends on control dependency: [if], data = [none]
}
return false;
} }
|
public class class_name {
public HomeRecord resolveEJBLink(String application,
String module,
String link)
throws EJBNotFoundException
{
final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
if (isTraceOn && tc.isEntryEnabled())
Tr.entry(tc, "resolveEJBLink: " + application + "#" + module + ", " + link);
AppLinkData linkData = null;
String origModule = module;
String bean;
// F743-25385
// There are three styles that can be used when specifying the ejb-link data.
// Style 1: just the bean-component-name itself
// For example: TestBeanA
//
// Style 2: the <relative physical path of the module containing the bean>#<bean-component-name>
// For example: <blah>/<blah>/myModule.jar#TestBeanA
//
// Style 3: the <logical name of the module containing the bean>/<bean-component-name>
// For example: testModule/TestBeanA
//
// The point here is to correctly extract the moduleName and beanName from
// the specified ejb-link data. Once we have determined which of the three
// styles the data is using, we then extract the moduleName/beanName using
// rules specific to that style.
int bidx = link.indexOf('#');
if (bidx > -1)
{
// F743-25385
// There is a '#' character, so this means we are dealing with style #2.
//
// For style #2, we have these rules:
// a) moduleName is the part between the last '/' character
// and the '#' character
//
// b) beanName is everything after the '#' character
int midx = link.lastIndexOf('/');
if (midx > -1 && midx < bidx)
{
module = link.substring(midx + 1, bidx);
}
else
{
// If no path was specified, then the referenced module
// is in the same location. d455591
module = link.substring(0, bidx);
}
bean = link.substring(bidx + 1);
// Verify that the physical module file specified using the style #2 syntax
// is actually a valid location for a bean.
if (!module.endsWith(".jar") && !module.endsWith(".war") && !module.equals(origModule))
{
throw new EJBNotFoundException("Incorrect usage of beanName/ejb-link syntax. " +
"The syntax used requires the physical module file " +
"to be specified, and the module must end in .jar " +
"or .war to be a valid location for a bean. " +
"The beanName/ejb-link data specified bean " + bean +
" and module " + module + ".");
}
if (isTraceOn && tc.isDebugEnabled())
{
Tr.debug(tc, "Used ejb-link style 2 to get module name " + module + " and beanName " + bean);
}
}
else
{
// F743-25385
// There is no '#' character, so we are not dealing with style #2.
// Determine if we are dealing with style #1 or #3.
//
// We do a 'lastIndexOf' instead of just an 'indexOf' to account for
// the potential case where the user has a '/' character in the logical
// name of the module. (If thats not possible, then we should probably
// verify they only have one '/' character, and error if there are
// multiple).
int forwardSlashIndex = link.lastIndexOf('/');
if (forwardSlashIndex > -1)
{
// There is a forward slash, so that means we have style #3.
//
// For style #3, we have these rules:
// a) moduleName is the everything before the last '/' character
//
// b) beanName is everything after the last '/' character
String logicalModule = link.substring(0, forwardSlashIndex);
bean = link.substring(forwardSlashIndex + 1);
if (isTraceOn && tc.isDebugEnabled())
Tr.debug(tc, "Used ejb-link style 3 to get module name " + logicalModule + " and beanName " + bean);
// We are using style #3 syntax, and so the user specified the logical
// name of the module file (eg, MyModule). However, the bean is
// associated with a J2EEName that was created using the physical module
// name, and so we need to map the logical module that was specified
// to its physical module, so we can then use the physical (and real)
// J2EEName to locate the bean.
//
// To support the scenario where we have two bean components that have
// the same beanName, and one is packaged in an ejbjar and the other
// is packaged in a war, and these two physical modules are assigned
// the same logical name, we split the logical-to-physical mappings
// into a 'ejbjar' and 'war' groups, and we search the 'ejbjar' group
// first, and only search the 'war' group if needed.
// F743-26072 - Use AppLinkData to map logical-to-physical.
linkData = getAppLinkData(application);
module = null;
if (linkData != null)
{
synchronized (linkData)
{
Set<String> modules = linkData.ivModulesByLogicalName.get(logicalModule);
if (modules != null)
{
if (modules.size() == 1)
{
module = modules.iterator().next();
}
else if (!modules.isEmpty())
{
throw new AmbiguousEJBReferenceException("The reference to bean " + bean +
" in the " + logicalModule +
" logical module is ambiguous. Application " + application +
" contains multiple modules with same logical name.");
}
}
}
}
if (module == null)
{
throw new EJBNotFoundException("The reference to the " + bean +
" bean in the " + logicalModule +
" logical module in the " + application +
" application did not map to any bean component.");
}
}
else
{
// There is no forward slash either, so we must be dealing with style #1.
//
// For style #1, we have these rules:
// a) trust the passed in module name
// b) use the passed in 'link' value as the beanName
bean = link;
if (isTraceOn && tc.isDebugEnabled())
{
Tr.debug(tc, "Used ejb-link style 1 to get module name " + module + " and beanName " + bean);
}
}
}
J2EEName j2eeName = null;
HomeRecord hr = null;
// The module name will be set if the ejb-ref was defined in an EJB or
// WAR module (not client), or a module name was specified as part of
// the beanName/ejb-link. If a module name is available, first attempt
// to locate the bean directly using the J2EEName. d657052
if (module != null)
{
j2eeName = j2eeNameFactory.create(application, module, bean);
hr = getHomeRecord(j2eeName);
}
if (hr == null)
{
// If the bean was not found in the same module, and a module
// was not explicitly specified, then look for it in the other
// modules within the same application. d429866.1
if (module == origModule)
{
if (isTraceOn && tc.isDebugEnabled())
Tr.debug(tc, "looking for home in other modules...");
// F743-26072 - Use AppLinkData to find the bean.
if (linkData == null)
{
linkData = getAppLinkData(application);
}
if (linkData != null)
{
synchronized (linkData)
{
j2eeName = findApplicationBean(linkData, application, bean);
}
}
if (j2eeName != null)
{
hr = getHomeRecord(j2eeName);
}
else
{
if (isTraceOn && tc.isDebugEnabled())
Tr.debug(tc, "EJB " + bean + " not found");
}
}
if (hr == null)
{
EJBNotFoundException ex =
new EJBNotFoundException("EJB named " + bean +
" not present in application " +
application + ".");
if (isTraceOn && tc.isEntryEnabled())
Tr.exit(tc, "resolveEJBLink: " + ex);
throw ex;
}
}
if (isTraceOn && tc.isEntryEnabled())
Tr.exit(tc, "resolveEJBLink: " + hr);
return hr;
} }
|
public class class_name {
public HomeRecord resolveEJBLink(String application,
String module,
String link)
throws EJBNotFoundException
{
final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
if (isTraceOn && tc.isEntryEnabled())
Tr.entry(tc, "resolveEJBLink: " + application + "#" + module + ", " + link);
AppLinkData linkData = null;
String origModule = module;
String bean;
// F743-25385
// There are three styles that can be used when specifying the ejb-link data.
// Style 1: just the bean-component-name itself
// For example: TestBeanA
//
// Style 2: the <relative physical path of the module containing the bean>#<bean-component-name>
// For example: <blah>/<blah>/myModule.jar#TestBeanA
//
// Style 3: the <logical name of the module containing the bean>/<bean-component-name>
// For example: testModule/TestBeanA
//
// The point here is to correctly extract the moduleName and beanName from
// the specified ejb-link data. Once we have determined which of the three
// styles the data is using, we then extract the moduleName/beanName using
// rules specific to that style.
int bidx = link.indexOf('#');
if (bidx > -1)
{
// F743-25385
// There is a '#' character, so this means we are dealing with style #2.
//
// For style #2, we have these rules:
// a) moduleName is the part between the last '/' character
// and the '#' character
//
// b) beanName is everything after the '#' character
int midx = link.lastIndexOf('/');
if (midx > -1 && midx < bidx)
{
module = link.substring(midx + 1, bidx); // depends on control dependency: [if], data = [(midx]
}
else
{
// If no path was specified, then the referenced module
// is in the same location. d455591
module = link.substring(0, bidx); // depends on control dependency: [if], data = [none]
}
bean = link.substring(bidx + 1);
// Verify that the physical module file specified using the style #2 syntax
// is actually a valid location for a bean.
if (!module.endsWith(".jar") && !module.endsWith(".war") && !module.equals(origModule))
{
throw new EJBNotFoundException("Incorrect usage of beanName/ejb-link syntax. " +
"The syntax used requires the physical module file " +
"to be specified, and the module must end in .jar " +
"or .war to be a valid location for a bean. " +
"The beanName/ejb-link data specified bean " + bean +
" and module " + module + ".");
}
if (isTraceOn && tc.isDebugEnabled())
{
Tr.debug(tc, "Used ejb-link style 2 to get module name " + module + " and beanName " + bean); // depends on control dependency: [if], data = [none]
}
}
else
{
// F743-25385
// There is no '#' character, so we are not dealing with style #2.
// Determine if we are dealing with style #1 or #3.
//
// We do a 'lastIndexOf' instead of just an 'indexOf' to account for
// the potential case where the user has a '/' character in the logical
// name of the module. (If thats not possible, then we should probably
// verify they only have one '/' character, and error if there are
// multiple).
int forwardSlashIndex = link.lastIndexOf('/');
if (forwardSlashIndex > -1)
{
// There is a forward slash, so that means we have style #3.
//
// For style #3, we have these rules:
// a) moduleName is the everything before the last '/' character
//
// b) beanName is everything after the last '/' character
String logicalModule = link.substring(0, forwardSlashIndex);
bean = link.substring(forwardSlashIndex + 1); // depends on control dependency: [if], data = [(forwardSlashIndex]
if (isTraceOn && tc.isDebugEnabled())
Tr.debug(tc, "Used ejb-link style 3 to get module name " + logicalModule + " and beanName " + bean);
// We are using style #3 syntax, and so the user specified the logical
// name of the module file (eg, MyModule). However, the bean is
// associated with a J2EEName that was created using the physical module
// name, and so we need to map the logical module that was specified
// to its physical module, so we can then use the physical (and real)
// J2EEName to locate the bean.
//
// To support the scenario where we have two bean components that have
// the same beanName, and one is packaged in an ejbjar and the other
// is packaged in a war, and these two physical modules are assigned
// the same logical name, we split the logical-to-physical mappings
// into a 'ejbjar' and 'war' groups, and we search the 'ejbjar' group
// first, and only search the 'war' group if needed.
// F743-26072 - Use AppLinkData to map logical-to-physical.
linkData = getAppLinkData(application); // depends on control dependency: [if], data = [none]
module = null; // depends on control dependency: [if], data = [none]
if (linkData != null)
{
synchronized (linkData) // depends on control dependency: [if], data = [(linkData]
{
Set<String> modules = linkData.ivModulesByLogicalName.get(logicalModule);
if (modules != null)
{
if (modules.size() == 1)
{
module = modules.iterator().next(); // depends on control dependency: [if], data = [none]
}
else if (!modules.isEmpty())
{
throw new AmbiguousEJBReferenceException("The reference to bean " + bean +
" in the " + logicalModule +
" logical module is ambiguous. Application " + application +
" contains multiple modules with same logical name.");
}
}
}
}
if (module == null)
{
throw new EJBNotFoundException("The reference to the " + bean +
" bean in the " + logicalModule +
" logical module in the " + application +
" application did not map to any bean component.");
}
}
else
{
// There is no forward slash either, so we must be dealing with style #1.
//
// For style #1, we have these rules:
// a) trust the passed in module name
// b) use the passed in 'link' value as the beanName
bean = link; // depends on control dependency: [if], data = [none]
if (isTraceOn && tc.isDebugEnabled())
{
Tr.debug(tc, "Used ejb-link style 1 to get module name " + module + " and beanName " + bean); // depends on control dependency: [if], data = [none]
}
}
}
J2EEName j2eeName = null;
HomeRecord hr = null;
// The module name will be set if the ejb-ref was defined in an EJB or
// WAR module (not client), or a module name was specified as part of
// the beanName/ejb-link. If a module name is available, first attempt
// to locate the bean directly using the J2EEName. d657052
if (module != null)
{
j2eeName = j2eeNameFactory.create(application, module, bean);
hr = getHomeRecord(j2eeName);
}
if (hr == null)
{
// If the bean was not found in the same module, and a module
// was not explicitly specified, then look for it in the other
// modules within the same application. d429866.1
if (module == origModule)
{
if (isTraceOn && tc.isDebugEnabled())
Tr.debug(tc, "looking for home in other modules...");
// F743-26072 - Use AppLinkData to find the bean.
if (linkData == null)
{
linkData = getAppLinkData(application); // depends on control dependency: [if], data = [none]
}
if (linkData != null)
{
synchronized (linkData) // depends on control dependency: [if], data = [(linkData]
{
j2eeName = findApplicationBean(linkData, application, bean);
}
}
if (j2eeName != null)
{
hr = getHomeRecord(j2eeName); // depends on control dependency: [if], data = [(j2eeName]
}
else
{
if (isTraceOn && tc.isDebugEnabled())
Tr.debug(tc, "EJB " + bean + " not found");
}
}
if (hr == null)
{
EJBNotFoundException ex =
new EJBNotFoundException("EJB named " + bean +
" not present in application " +
application + ".");
if (isTraceOn && tc.isEntryEnabled())
Tr.exit(tc, "resolveEJBLink: " + ex);
throw ex;
}
}
if (isTraceOn && tc.isEntryEnabled())
Tr.exit(tc, "resolveEJBLink: " + hr);
return hr;
} }
|
public class class_name {
public static Configuration getConfFromState(State state, Optional<String> encryptedPath) {
Config config = ConfigFactory.parseProperties(state.getProperties());
if (encryptedPath.isPresent()) {
config = ConfigUtils.resolveEncrypted(config, encryptedPath);
}
Configuration conf = newConfiguration();
for (Entry<String, ConfigValue> entry : config.entrySet()) {
conf.set(entry.getKey(), entry.getValue().unwrapped().toString());
}
return conf;
} }
|
public class class_name {
public static Configuration getConfFromState(State state, Optional<String> encryptedPath) {
Config config = ConfigFactory.parseProperties(state.getProperties());
if (encryptedPath.isPresent()) {
config = ConfigUtils.resolveEncrypted(config, encryptedPath); // depends on control dependency: [if], data = [none]
}
Configuration conf = newConfiguration();
for (Entry<String, ConfigValue> entry : config.entrySet()) {
conf.set(entry.getKey(), entry.getValue().unwrapped().toString()); // depends on control dependency: [for], data = [entry]
}
return conf;
} }
|
public class class_name {
public void marshall(Timing timing, ProtocolMarshaller protocolMarshaller) {
if (timing == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(timing.getFinishTime(), FINISHTIME_BINDING);
protocolMarshaller.marshall(timing.getStartTime(), STARTTIME_BINDING);
protocolMarshaller.marshall(timing.getSubmitTime(), SUBMITTIME_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} }
|
public class class_name {
public void marshall(Timing timing, ProtocolMarshaller protocolMarshaller) {
if (timing == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(timing.getFinishTime(), FINISHTIME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(timing.getStartTime(), STARTTIME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(timing.getSubmitTime(), SUBMITTIME_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
public void writePage(int pageID, P page) {
if (page.isDirty()) {
try {
countWrite();
byte[] array = pageToByteArray(page);
file.getRecordBuffer(pageID).put(array);
page.setDirty(false);
} catch (IOException e) {
throw new RuntimeException(e);
}
}
} }
|
public class class_name {
@Override
public void writePage(int pageID, P page) {
if (page.isDirty()) {
try {
countWrite(); // depends on control dependency: [try], data = [none]
byte[] array = pageToByteArray(page);
file.getRecordBuffer(pageID).put(array); // depends on control dependency: [try], data = [none]
page.setDirty(false); // depends on control dependency: [try], data = [none]
} catch (IOException e) {
throw new RuntimeException(e);
} // depends on control dependency: [catch], data = [none]
}
} }
|
public class class_name {
public static Map<Variant, List<String>> alldeNovoVariants(Pedigree pedigree, Iterator<Variant> variantIterator) {
PedigreeManager pedigreeManager = new PedigreeManager(pedigree);
// We get all children so we can check upwards
List<Member> allChildren = pedigreeManager.getWithoutChildren();
Map<Variant, List<String>> retDenovoVariants = new HashMap<>();
while (variantIterator.hasNext()) {
Variant variant = variantIterator.next();
// List of individuals with de novo variants
List<String> individualIds = new ArrayList<>();
Queue<String> queue = new LinkedList<>();
queue.addAll(allChildren.stream().map(Member::getId).collect(Collectors.toList()));
while (!queue.isEmpty()) {
String individualId = queue.remove();
Member childMember = pedigreeManager.getIndividualMap().get(individualId);
if (isDeNovoVariant(childMember, variant)) {
individualIds.add(individualId);
}
// Add parents to the queue
if (childMember.getFather() != null) {
if (!queue.contains(childMember.getFather().getId())) {
queue.add(childMember.getFather().getId());
}
}
if (childMember.getMother() != null) {
if (!queue.contains(childMember.getMother().getId())) {
queue.add(childMember.getMother().getId());
}
}
}
if (!individualIds.isEmpty()) {
retDenovoVariants.put(variant, individualIds);
}
}
return retDenovoVariants;
} }
|
public class class_name {
public static Map<Variant, List<String>> alldeNovoVariants(Pedigree pedigree, Iterator<Variant> variantIterator) {
PedigreeManager pedigreeManager = new PedigreeManager(pedigree);
// We get all children so we can check upwards
List<Member> allChildren = pedigreeManager.getWithoutChildren();
Map<Variant, List<String>> retDenovoVariants = new HashMap<>();
while (variantIterator.hasNext()) {
Variant variant = variantIterator.next();
// List of individuals with de novo variants
List<String> individualIds = new ArrayList<>();
Queue<String> queue = new LinkedList<>();
queue.addAll(allChildren.stream().map(Member::getId).collect(Collectors.toList())); // depends on control dependency: [while], data = [none]
while (!queue.isEmpty()) {
String individualId = queue.remove();
Member childMember = pedigreeManager.getIndividualMap().get(individualId);
if (isDeNovoVariant(childMember, variant)) {
individualIds.add(individualId); // depends on control dependency: [if], data = [none]
}
// Add parents to the queue
if (childMember.getFather() != null) {
if (!queue.contains(childMember.getFather().getId())) {
queue.add(childMember.getFather().getId()); // depends on control dependency: [if], data = [none]
}
}
if (childMember.getMother() != null) {
if (!queue.contains(childMember.getMother().getId())) {
queue.add(childMember.getMother().getId()); // depends on control dependency: [if], data = [none]
}
}
}
if (!individualIds.isEmpty()) {
retDenovoVariants.put(variant, individualIds); // depends on control dependency: [if], data = [none]
}
}
return retDenovoVariants;
} }
|
public class class_name {
public void marshall(PutResourceAttributesRequest putResourceAttributesRequest, ProtocolMarshaller protocolMarshaller) {
if (putResourceAttributesRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(putResourceAttributesRequest.getProgressUpdateStream(), PROGRESSUPDATESTREAM_BINDING);
protocolMarshaller.marshall(putResourceAttributesRequest.getMigrationTaskName(), MIGRATIONTASKNAME_BINDING);
protocolMarshaller.marshall(putResourceAttributesRequest.getResourceAttributeList(), RESOURCEATTRIBUTELIST_BINDING);
protocolMarshaller.marshall(putResourceAttributesRequest.getDryRun(), DRYRUN_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} }
|
public class class_name {
public void marshall(PutResourceAttributesRequest putResourceAttributesRequest, ProtocolMarshaller protocolMarshaller) {
if (putResourceAttributesRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(putResourceAttributesRequest.getProgressUpdateStream(), PROGRESSUPDATESTREAM_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(putResourceAttributesRequest.getMigrationTaskName(), MIGRATIONTASKNAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(putResourceAttributesRequest.getResourceAttributeList(), RESOURCEATTRIBUTELIST_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(putResourceAttributesRequest.getDryRun(), DRYRUN_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 DateTimeFormatter toFormatter(Locale locale) {
Jdk8Methods.requireNonNull(locale, "locale");
while (active.parent != null) {
optionalEnd();
}
CompositePrinterParser pp = new CompositePrinterParser(printerParsers, false);
return new DateTimeFormatter(pp, locale, DecimalStyle.STANDARD, ResolverStyle.SMART, null, null, null);
} }
|
public class class_name {
public DateTimeFormatter toFormatter(Locale locale) {
Jdk8Methods.requireNonNull(locale, "locale");
while (active.parent != null) {
optionalEnd(); // depends on control dependency: [while], data = [none]
}
CompositePrinterParser pp = new CompositePrinterParser(printerParsers, false);
return new DateTimeFormatter(pp, locale, DecimalStyle.STANDARD, ResolverStyle.SMART, null, null, null);
} }
|
public class class_name {
public void init(CmsImagePreviewHandler handler) {
m_handler = handler;
m_propertiesTab = new CmsPropertiesTab(m_galleryMode, m_dialogHeight, m_dialogWidth, m_handler);
m_tabbedPanel.add(m_propertiesTab, Messages.get().key(Messages.GUI_PREVIEW_TAB_PROPERTIES_0));
if ((m_galleryMode == GalleryMode.editor) || (m_galleryMode == GalleryMode.widget)) {
m_imageFormatTab = new CmsImageFormatsTab(m_galleryMode, m_dialogHeight, m_dialogWidth, handler, null);
m_tabbedPanel.add(m_imageFormatTab, Messages.get().key(Messages.GUI_PREVIEW_TAB_IMAGEFORMAT_0));
}
if (getGalleryMode() == GalleryMode.editor) {
m_imageEditorFormatsTab = new CmsImageEditorTab(m_galleryMode, m_dialogHeight, m_dialogWidth, handler);
String hideFormatsParam = Window.Location.getParameter("hideformats");
boolean hideFormats = "true".equals(hideFormatsParam);
if (!hideFormats) {
m_tabbedPanel.add(m_imageEditorFormatsTab, Messages.get().key(Messages.GUI_PREVIEW_TAB_IMAGEOPTIONS_0));
}
m_imageAdvancedTab = new CmsImageAdvancedTab(m_galleryMode, m_dialogHeight, m_dialogWidth, handler);
if (!hideFormats) {
m_tabbedPanel.add(m_imageAdvancedTab, Messages.get().key(Messages.GUI_PREVIEW_TAB_IMAGEADVANCED_0));
}
}
m_tabbedPanel.addSelectionHandler(new SelectionHandler<Integer>() {
public void onSelection(SelectionEvent<Integer> event) {
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
@SuppressWarnings("synthetic-access")
public void execute() {
updateClassForTab(event.getSelectedItem().intValue());
}
});
}
});
} }
|
public class class_name {
public void init(CmsImagePreviewHandler handler) {
m_handler = handler;
m_propertiesTab = new CmsPropertiesTab(m_galleryMode, m_dialogHeight, m_dialogWidth, m_handler);
m_tabbedPanel.add(m_propertiesTab, Messages.get().key(Messages.GUI_PREVIEW_TAB_PROPERTIES_0));
if ((m_galleryMode == GalleryMode.editor) || (m_galleryMode == GalleryMode.widget)) {
m_imageFormatTab = new CmsImageFormatsTab(m_galleryMode, m_dialogHeight, m_dialogWidth, handler, null); // depends on control dependency: [if], data = [none]
m_tabbedPanel.add(m_imageFormatTab, Messages.get().key(Messages.GUI_PREVIEW_TAB_IMAGEFORMAT_0)); // depends on control dependency: [if], data = [none]
}
if (getGalleryMode() == GalleryMode.editor) {
m_imageEditorFormatsTab = new CmsImageEditorTab(m_galleryMode, m_dialogHeight, m_dialogWidth, handler); // depends on control dependency: [if], data = [none]
String hideFormatsParam = Window.Location.getParameter("hideformats");
boolean hideFormats = "true".equals(hideFormatsParam);
if (!hideFormats) {
m_tabbedPanel.add(m_imageEditorFormatsTab, Messages.get().key(Messages.GUI_PREVIEW_TAB_IMAGEOPTIONS_0)); // depends on control dependency: [if], data = [none]
}
m_imageAdvancedTab = new CmsImageAdvancedTab(m_galleryMode, m_dialogHeight, m_dialogWidth, handler); // depends on control dependency: [if], data = [none]
if (!hideFormats) {
m_tabbedPanel.add(m_imageAdvancedTab, Messages.get().key(Messages.GUI_PREVIEW_TAB_IMAGEADVANCED_0)); // depends on control dependency: [if], data = [none]
}
}
m_tabbedPanel.addSelectionHandler(new SelectionHandler<Integer>() {
public void onSelection(SelectionEvent<Integer> event) {
Scheduler.get().scheduleDeferred(new ScheduledCommand() {
@SuppressWarnings("synthetic-access")
public void execute() {
updateClassForTab(event.getSelectedItem().intValue());
}
});
}
});
} }
|
public class class_name {
public static void apply(Annotated member, Schema property) {
if (member.hasAnnotation(XmlElementWrapper.class) || member.hasAnnotation(XmlElement.class)) {
applyElement(member, property);
} else if (member.hasAnnotation(XmlAttribute.class) && isAttributeAllowed(property)) {
applyAttribute(member, property);
}
} }
|
public class class_name {
public static void apply(Annotated member, Schema property) {
if (member.hasAnnotation(XmlElementWrapper.class) || member.hasAnnotation(XmlElement.class)) {
applyElement(member, property); // depends on control dependency: [if], data = [none]
} else if (member.hasAnnotation(XmlAttribute.class) && isAttributeAllowed(property)) {
applyAttribute(member, property); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public void removeFromTo(int from, int to) {
checkRangeFromTo(from, to, size);
int numMoved = size - to - 1;
if (numMoved >= 0) {
System.arraycopy(elements, to+1, elements, from, numMoved);
fillFromToWith(from+numMoved, size-1, null); //delta
}
int width = to-from+1;
if (width>0) size -= width;
} }
|
public class class_name {
public void removeFromTo(int from, int to) {
checkRangeFromTo(from, to, size);
int numMoved = size - to - 1;
if (numMoved >= 0) {
System.arraycopy(elements, to+1, elements, from, numMoved);
// depends on control dependency: [if], data = [none]
fillFromToWith(from+numMoved, size-1, null); //delta
// depends on control dependency: [if], data = [none]
}
int width = to-from+1;
if (width>0) size -= width;
} }
|
public class class_name {
protected static void appendHandler(Class<? extends LogRecordHandler> parent, LogRecordHandler child){
List<LogRecordHandler> toAdd = new LinkedList<LogRecordHandler>();
//--Find Parents
for(LogRecordHandler term : handlers){
if(parent.isAssignableFrom(term.getClass())){
toAdd.add(term);
}
}
//--Add Handler
for(LogRecordHandler p : toAdd){
appendHandler(p, child);
}
} }
|
public class class_name {
protected static void appendHandler(Class<? extends LogRecordHandler> parent, LogRecordHandler child){
List<LogRecordHandler> toAdd = new LinkedList<LogRecordHandler>();
//--Find Parents
for(LogRecordHandler term : handlers){
if(parent.isAssignableFrom(term.getClass())){
toAdd.add(term);
// depends on control dependency: [if], data = [none]
}
}
//--Add Handler
for(LogRecordHandler p : toAdd){
appendHandler(p, child);
// depends on control dependency: [for], data = [p]
}
} }
|
public class class_name {
public void marshall(InvalidateProjectCacheRequest invalidateProjectCacheRequest, ProtocolMarshaller protocolMarshaller) {
if (invalidateProjectCacheRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(invalidateProjectCacheRequest.getProjectName(), PROJECTNAME_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} }
|
public class class_name {
public void marshall(InvalidateProjectCacheRequest invalidateProjectCacheRequest, ProtocolMarshaller protocolMarshaller) {
if (invalidateProjectCacheRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(invalidateProjectCacheRequest.getProjectName(), PROJECTNAME_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 Object put(Object key, Object value)
{
// Synchronize on the cache to ensure its integrity in a multi-threaded environment.
synchronized (cache)
{
// Create a new ElementMonitor in the cache for the new element.
// Timestamp the new element with the present time.
long t = System.currentTimeMillis();
// Extract the element value out of the replaced element monitor if any.
ElementMonitor replaced = (ElementMonitor) cache.put(key, new ElementMonitor(value, t));
if (replaced != null)
{
return replaced.element;
}
else
{
return null;
}
}
} }
|
public class class_name {
public Object put(Object key, Object value)
{
// Synchronize on the cache to ensure its integrity in a multi-threaded environment.
synchronized (cache)
{
// Create a new ElementMonitor in the cache for the new element.
// Timestamp the new element with the present time.
long t = System.currentTimeMillis();
// Extract the element value out of the replaced element monitor if any.
ElementMonitor replaced = (ElementMonitor) cache.put(key, new ElementMonitor(value, t));
if (replaced != null)
{
return replaced.element; // depends on control dependency: [if], data = [none]
}
else
{
return null; // depends on control dependency: [if], data = [none]
}
}
} }
|
public class class_name {
public String getSVGPlotURI() {
if(plotnum < 0) {
plotnum = ThumbnailRegistryEntry.registerImage(plot);
}
return ThumbnailRegistryEntry.INTERNAL_PREFIX + plotnum;
} }
|
public class class_name {
public String getSVGPlotURI() {
if(plotnum < 0) {
plotnum = ThumbnailRegistryEntry.registerImage(plot); // depends on control dependency: [if], data = [none]
}
return ThumbnailRegistryEntry.INTERNAL_PREFIX + plotnum;
} }
|
public class class_name {
protected boolean appendFoundJars(Node container, Document factory,
Vector v, String desc)
{
if ((null == v) || (v.size() < 1))
return false;
boolean errors = false;
for (int i = 0; i < v.size(); i++)
{
Hashtable subhash = (Hashtable) v.elementAt(i);
for (Enumeration keys = subhash.keys();
keys.hasMoreElements();
/* no increment portion */
)
{
Object key = keys.nextElement();
try
{
String keyStr = (String) key;
if (keyStr.startsWith(ERROR))
{
errors = true;
}
Element node = factory.createElement("foundJar");
node.setAttribute("name", keyStr.substring(0, keyStr.indexOf("-")));
node.setAttribute("desc", keyStr.substring(keyStr.indexOf("-") + 1));
node.appendChild(factory.createTextNode((String)subhash.get(keyStr)));
container.appendChild(node);
}
catch (Exception e)
{
errors = true;
Element node = factory.createElement("foundJar");
node.appendChild(factory.createTextNode(ERROR + " Reading " + key + " threw: " + e.toString()));
container.appendChild(node);
}
}
}
return errors;
} }
|
public class class_name {
protected boolean appendFoundJars(Node container, Document factory,
Vector v, String desc)
{
if ((null == v) || (v.size() < 1))
return false;
boolean errors = false;
for (int i = 0; i < v.size(); i++)
{
Hashtable subhash = (Hashtable) v.elementAt(i);
for (Enumeration keys = subhash.keys();
keys.hasMoreElements();
/* no increment portion */
)
{
Object key = keys.nextElement();
try
{
String keyStr = (String) key;
if (keyStr.startsWith(ERROR))
{
errors = true; // depends on control dependency: [if], data = [none]
}
Element node = factory.createElement("foundJar");
node.setAttribute("name", keyStr.substring(0, keyStr.indexOf("-"))); // depends on control dependency: [try], data = [none]
node.setAttribute("desc", keyStr.substring(keyStr.indexOf("-") + 1)); // depends on control dependency: [try], data = [none]
node.appendChild(factory.createTextNode((String)subhash.get(keyStr))); // depends on control dependency: [try], data = [none]
container.appendChild(node); // depends on control dependency: [try], data = [none]
}
catch (Exception e)
{
errors = true;
Element node = factory.createElement("foundJar");
node.appendChild(factory.createTextNode(ERROR + " Reading " + key + " threw: " + e.toString()));
container.appendChild(node);
} // depends on control dependency: [catch], data = [none]
}
}
return errors;
} }
|
public class class_name {
public Parameter[] parameters() {
// generate the parameters on the fly: they're not cached
List<VarSymbol> params = sym.params();
Parameter result[] = new Parameter[params.length()];
int i = 0;
for (VarSymbol param : params) {
result[i++] = new ParameterImpl(env, param);
}
return result;
} }
|
public class class_name {
public Parameter[] parameters() {
// generate the parameters on the fly: they're not cached
List<VarSymbol> params = sym.params();
Parameter result[] = new Parameter[params.length()];
int i = 0;
for (VarSymbol param : params) {
result[i++] = new ParameterImpl(env, param); // depends on control dependency: [for], data = [param]
}
return result;
} }
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.