code
stringlengths 130
281k
| code_dependency
stringlengths 182
306k
|
|---|---|
public class class_name {
public <T> T query(String sql, RsHandler<T> rsh, Object... params) throws SQLException {
Connection conn = null;
try {
conn = this.getConnection();
return SqlExecutor.query(conn, sql, rsh, params);
} catch (SQLException e) {
throw e;
} finally {
this.closeConnection(conn);
}
} }
|
public class class_name {
public <T> T query(String sql, RsHandler<T> rsh, Object... params) throws SQLException {
Connection conn = null;
try {
conn = this.getConnection();
// depends on control dependency: [try], data = [none]
return SqlExecutor.query(conn, sql, rsh, params);
// depends on control dependency: [try], data = [none]
} catch (SQLException e) {
throw e;
} finally {
// depends on control dependency: [catch], data = [none]
this.closeConnection(conn);
}
} }
|
public class class_name {
private synchronized String getCallerId10()
{
final String[] parsedCallerId;
if (!callerIdCreated)
{
rawCallerId = request.get("callerid");
callerIdCreated = true;
}
parsedCallerId = AstUtil.parseCallerId(rawCallerId);
if (parsedCallerId[1] == null)
{
return parsedCallerId[0];
}
return parsedCallerId[1];
} }
|
public class class_name {
private synchronized String getCallerId10()
{
final String[] parsedCallerId;
if (!callerIdCreated)
{
rawCallerId = request.get("callerid"); // depends on control dependency: [if], data = [none]
callerIdCreated = true; // depends on control dependency: [if], data = [none]
}
parsedCallerId = AstUtil.parseCallerId(rawCallerId);
if (parsedCallerId[1] == null)
{
return parsedCallerId[0]; // depends on control dependency: [if], data = [none]
}
return parsedCallerId[1];
} }
|
public class class_name {
@Deprecated public static Object invoke(String methodName, Class<?> cls, PrintStream out, PrintStream err, Help.Ansi ansi, String... args) {
List<Method> candidates = getCommandMethods(cls, methodName);
if (candidates.size() != 1) { throw new InitializationException("Expected exactly one @Command-annotated method for " + cls.getName() + "::" + methodName + "(...), but got: " + candidates); }
Method method = candidates.get(0);
CommandLine cmd = new CommandLine(method);
List<Object> list = cmd.parseWithHandlers(new RunLast().useOut(out).useAnsi(ansi), new DefaultExceptionHandler<List<Object>>().useErr(err).useAnsi(ansi), args);
return list == null ? null : list.get(0);
} }
|
public class class_name {
@Deprecated public static Object invoke(String methodName, Class<?> cls, PrintStream out, PrintStream err, Help.Ansi ansi, String... args) {
List<Method> candidates = getCommandMethods(cls, methodName);
if (candidates.size() != 1) { throw new InitializationException("Expected exactly one @Command-annotated method for " + cls.getName() + "::" + methodName + "(...), but got: " + candidates); } // depends on control dependency: [if], data = [none]
Method method = candidates.get(0);
CommandLine cmd = new CommandLine(method);
List<Object> list = cmd.parseWithHandlers(new RunLast().useOut(out).useAnsi(ansi), new DefaultExceptionHandler<List<Object>>().useErr(err).useAnsi(ansi), args);
return list == null ? null : list.get(0);
} }
|
public class class_name {
public static int calcUtfLength(String str) {
final int strlen = str.length();
int utflen = 0;
for (int i = 0; i < strlen; i++) {
int c = str.charAt(i);
if ((c >= 0x0001) && (c <= 0x007F)) {
utflen++;
} else if (c > 0x07FF) {
utflen += 3;
} else {
utflen += 2;
}
}
return utflen;
} }
|
public class class_name {
public static int calcUtfLength(String str) {
final int strlen = str.length();
int utflen = 0;
for (int i = 0; i < strlen; i++) {
int c = str.charAt(i);
if ((c >= 0x0001) && (c <= 0x007F)) {
utflen++;
// depends on control dependency: [if], data = [none]
} else if (c > 0x07FF) {
utflen += 3;
// depends on control dependency: [if], data = [none]
} else {
utflen += 2;
// depends on control dependency: [if], data = [none]
}
}
return utflen;
} }
|
public class class_name {
private static void setupBindInfoPackage() {
String nsuri = "http://www.hibernate.org/xsd/orm/hbm";
String packageInfoClassName = "org.hibernate.boot.jaxb.hbm.spi.package-info";
try {
final Class<?> packageInfoClass = Class
.forName(packageInfoClassName);
final XmlSchema xmlSchema = packageInfoClass
.getAnnotation(XmlSchema.class);
if (xmlSchema == null) {
LOG.warn(MessageFormat.format(
"Class [{0}] is missing the [{1}] annotation. Processing bindings will probably fail.",
packageInfoClassName, XmlSchema.class.getName()));
} else {
final String namespace = xmlSchema.namespace();
if (nsuri.equals(namespace)) {
LOG.warn(MessageFormat.format(
"Namespace of the [{0}] annotation does not match [{1}]. Processing bindings will probably fail.",
XmlSchema.class.getName(), nsuri));
}
}
} catch (ClassNotFoundException cnfex) {
LOG.warn(MessageFormat.format(
"Class [{0}] could not be found. Processing bindings will probably fail.",
packageInfoClassName), cnfex);
}
} }
|
public class class_name {
private static void setupBindInfoPackage() {
String nsuri = "http://www.hibernate.org/xsd/orm/hbm";
String packageInfoClassName = "org.hibernate.boot.jaxb.hbm.spi.package-info";
try {
final Class<?> packageInfoClass = Class
.forName(packageInfoClassName);
final XmlSchema xmlSchema = packageInfoClass
.getAnnotation(XmlSchema.class);
if (xmlSchema == null) {
LOG.warn(MessageFormat.format(
"Class [{0}] is missing the [{1}] annotation. Processing bindings will probably fail.",
packageInfoClassName, XmlSchema.class.getName()));
} else {
// depends on control dependency: [try], data = [none]
final String namespace = xmlSchema.namespace();
if (nsuri.equals(namespace)) {
LOG.warn(MessageFormat.format(
"Namespace of the [{0}] annotation does not match [{1}]. Processing bindings will probably fail.",
XmlSchema.class.getName(), nsuri));
// depends on control dependency: [if], data = [none]
}
}
} catch (ClassNotFoundException cnfex) {
LOG.warn(MessageFormat.format(
"Class [{0}] could not be found. Processing bindings will probably fail.",
packageInfoClassName), cnfex);
}
// depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
private Document createCompositeILF(
final IPerson person,
final Document PLF,
final List<Document> applicableLayouts,
final IntegrationResult integrationResult) {
final Document ILF = ILFBuilder.constructILF(PLF, applicableLayouts, person);
PLFIntegrator.mergePLFintoILF(PLF, ILF, integrationResult);
if (logger.isDebugEnabled()) {
logger.debug(
"PLF for {} after MERGING\n{}",
person.getAttribute(IPerson.USERNAME),
XmlUtilitiesImpl.toString(PLF));
logger.debug(
"ILF for {} after MERGING\n{}",
person.getAttribute(IPerson.USERNAME),
XmlUtilitiesImpl.toString(ILF));
}
return ILF;
} }
|
public class class_name {
private Document createCompositeILF(
final IPerson person,
final Document PLF,
final List<Document> applicableLayouts,
final IntegrationResult integrationResult) {
final Document ILF = ILFBuilder.constructILF(PLF, applicableLayouts, person);
PLFIntegrator.mergePLFintoILF(PLF, ILF, integrationResult);
if (logger.isDebugEnabled()) {
logger.debug(
"PLF for {} after MERGING\n{}",
person.getAttribute(IPerson.USERNAME),
XmlUtilitiesImpl.toString(PLF)); // depends on control dependency: [if], data = [none]
logger.debug(
"ILF for {} after MERGING\n{}",
person.getAttribute(IPerson.USERNAME),
XmlUtilitiesImpl.toString(ILF)); // depends on control dependency: [if], data = [none]
}
return ILF;
} }
|
public class class_name {
private static byte[] checkIllegalCharacters(final byte[] bytes) {
final ByteArrayOutputStream out = new ByteArrayOutputStream();
for (final byte byt: bytes) {
if (BASE64CHARS.indexOf(byt) < 0) {
out.write(byt);
}
}
return out.toByteArray();
} }
|
public class class_name {
private static byte[] checkIllegalCharacters(final byte[] bytes) {
final ByteArrayOutputStream out = new ByteArrayOutputStream();
for (final byte byt: bytes) {
if (BASE64CHARS.indexOf(byt) < 0) {
out.write(byt); // depends on control dependency: [if], data = [none]
}
}
return out.toByteArray();
} }
|
public class class_name {
@SuppressWarnings("incomplete-switch")
protected CandidateCompareResult compareTo(AbstractPendingLinkingCandidate<?> right, boolean invalid) {
{
CandidateCompareResult arityCompareResult = compareByArityWith(right);
switch(arityCompareResult) {
case SUSPICIOUS_OTHER:
throw new IllegalStateException();
case EQUALLY_INVALID:
invalid = true;
break;
case OTHER:
case THIS:
return arityCompareResult;
}
}
{
boolean visible = isVisible();
if (visible != right.isVisible()) {
if (visible)
return CandidateCompareResult.THIS;
return CandidateCompareResult.OTHER;
} else if (!visible) {
invalid = true;
}
}
{
CandidateCompareResult typeArityCompareResult = compareByArity(getTypeArityMismatch(), right.getTypeArityMismatch());
switch(typeArityCompareResult) {
case SUSPICIOUS_OTHER:
throw new IllegalStateException();
case EQUALLY_INVALID:
invalid = true;
break;
case OTHER:
case THIS:
return typeArityCompareResult;
}
}
{
CandidateCompareResult nameCompareResult = compareByName(right);
switch(nameCompareResult) {
case SUSPICIOUS_OTHER:
throw new IllegalStateException();
case EQUALLY_INVALID:
invalid = true;
break;
case OTHER:
case THIS:
return nameCompareResult;
}
}
{
CandidateCompareResult argumentTypeCompareResult = compareByArgumentTypes(right);
switch(argumentTypeCompareResult) {
case EQUALLY_INVALID:
invalid = true;
break;
case SUSPICIOUS_OTHER:
case OTHER:
case THIS:
return argumentTypeCompareResult;
}
}
{
CandidateCompareResult typeArgumentCompareResult = compareByTypeArguments(right);
switch(typeArgumentCompareResult) {
case SUSPICIOUS_OTHER:
throw new IllegalStateException();
case EQUALLY_INVALID:
invalid = true;
break;
case OTHER:
case THIS:
return typeArgumentCompareResult;
}
}
if (isVarArgs() != right.isVarArgs()) {
if (isVarArgs())
return CandidateCompareResult.OTHER;
return CandidateCompareResult.THIS;
}
// member feature calls done on type literals have precedence over instance calls, i.e. R.array binds to R$array rather than Class.isArray()
// see https://bugs.eclipse.org/bugs/show_bug.cgi?id=437660
if (getExpression() instanceof XMemberFeatureCall && !getFeature().getSimpleName().equals(right.getFeature().getSimpleName())) {
if (isTypeLiteral() && !right.isTypeLiteral()) {
return CandidateCompareResult.THIS;
} else if (right.isTypeLiteral() && !isTypeLiteral()){
return CandidateCompareResult.OTHER;
}
}
if(isTypeLiteral() && !right.isTypeLiteral()) {
return CandidateCompareResult.OTHER;
}
{
CandidateCompareResult bucketCompareResult = compareByBucket(right);
switch(bucketCompareResult) {
case SUSPICIOUS_OTHER:
throw new IllegalStateException();
case EQUALLY_INVALID:
invalid = true;
break;
case OTHER:
case THIS:
return bucketCompareResult;
}
}
if (invalid)
return CandidateCompareResult.EQUALLY_INVALID;
return CandidateCompareResult.AMBIGUOUS;
} }
|
public class class_name {
@SuppressWarnings("incomplete-switch")
protected CandidateCompareResult compareTo(AbstractPendingLinkingCandidate<?> right, boolean invalid) {
{
CandidateCompareResult arityCompareResult = compareByArityWith(right);
switch(arityCompareResult) {
case SUSPICIOUS_OTHER:
throw new IllegalStateException();
case EQUALLY_INVALID:
invalid = true;
break;
case OTHER:
case THIS:
return arityCompareResult;
}
}
{
boolean visible = isVisible();
if (visible != right.isVisible()) {
if (visible)
return CandidateCompareResult.THIS;
return CandidateCompareResult.OTHER; // depends on control dependency: [if], data = [none]
} else if (!visible) {
invalid = true; // depends on control dependency: [if], data = [none]
}
}
{
CandidateCompareResult typeArityCompareResult = compareByArity(getTypeArityMismatch(), right.getTypeArityMismatch());
switch(typeArityCompareResult) {
case SUSPICIOUS_OTHER:
throw new IllegalStateException();
case EQUALLY_INVALID:
invalid = true;
break;
case OTHER:
case THIS:
return typeArityCompareResult;
}
}
{
CandidateCompareResult nameCompareResult = compareByName(right);
switch(nameCompareResult) {
case SUSPICIOUS_OTHER:
throw new IllegalStateException();
case EQUALLY_INVALID:
invalid = true;
break;
case OTHER:
case THIS:
return nameCompareResult;
}
}
{
CandidateCompareResult argumentTypeCompareResult = compareByArgumentTypes(right);
switch(argumentTypeCompareResult) {
case EQUALLY_INVALID:
invalid = true;
break;
case SUSPICIOUS_OTHER:
case OTHER:
case THIS:
return argumentTypeCompareResult;
}
}
{
CandidateCompareResult typeArgumentCompareResult = compareByTypeArguments(right);
switch(typeArgumentCompareResult) {
case SUSPICIOUS_OTHER:
throw new IllegalStateException();
case EQUALLY_INVALID:
invalid = true;
break;
case OTHER:
case THIS:
return typeArgumentCompareResult;
}
}
if (isVarArgs() != right.isVarArgs()) {
if (isVarArgs())
return CandidateCompareResult.OTHER;
return CandidateCompareResult.THIS; // depends on control dependency: [if], data = [none]
}
// member feature calls done on type literals have precedence over instance calls, i.e. R.array binds to R$array rather than Class.isArray()
// see https://bugs.eclipse.org/bugs/show_bug.cgi?id=437660
if (getExpression() instanceof XMemberFeatureCall && !getFeature().getSimpleName().equals(right.getFeature().getSimpleName())) {
if (isTypeLiteral() && !right.isTypeLiteral()) {
return CandidateCompareResult.THIS; // depends on control dependency: [if], data = [none]
} else if (right.isTypeLiteral() && !isTypeLiteral()){
return CandidateCompareResult.OTHER; // depends on control dependency: [if], data = [none]
}
}
if(isTypeLiteral() && !right.isTypeLiteral()) {
return CandidateCompareResult.OTHER; // depends on control dependency: [if], data = [none]
}
{
CandidateCompareResult bucketCompareResult = compareByBucket(right);
switch(bucketCompareResult) {
case SUSPICIOUS_OTHER:
throw new IllegalStateException();
case EQUALLY_INVALID:
invalid = true;
break;
case OTHER:
case THIS:
return bucketCompareResult;
}
}
if (invalid)
return CandidateCompareResult.EQUALLY_INVALID;
return CandidateCompareResult.AMBIGUOUS;
} }
|
public class class_name {
private void setupStyles() {
TypedArray styledAttributes = obtainStyledAttributes(R.style.PinLock, R.styleable.PinLock);
final int layoutBackground = styledAttributes.getColor(R.styleable.PinLock_backgroundColor, Color.WHITE);
View layout = findViewById(R.id.pinLockLayout);
layout.setBackgroundColor(layoutBackground);
final int cancelForgotTextSize = styledAttributes.getInt(R.styleable.PinLock_cancelForgotTextSize, 20);
cancelButton.setTextSize(TypedValue.COMPLEX_UNIT_SP, cancelForgotTextSize);
forgetButton.setTextSize(TypedValue.COMPLEX_UNIT_SP, cancelForgotTextSize);
final int cancelForgotTextColor = styledAttributes.getColor(R.styleable.PinLock_cancelForgotTextColor, Color.BLACK);
cancelButton.setTextColor(cancelForgotTextColor);
if(forgetButton.isEnabled()) {
forgetButton.setTextColor(cancelForgotTextColor);
} else {
forgetButton.setTextColor(Color.parseColor("#a9abac"));
}
final int infoTextSize = styledAttributes.getInt(R.styleable.PinLock_infoTextSize, 20);
final int infoTextColor = styledAttributes.getColor(R.styleable.PinLock_infoTextColor, Color.BLACK);
label.setTextSize(TypedValue.COMPLEX_UNIT_SP, infoTextSize);
label.setTextColor(infoTextColor);
} }
|
public class class_name {
private void setupStyles() {
TypedArray styledAttributes = obtainStyledAttributes(R.style.PinLock, R.styleable.PinLock);
final int layoutBackground = styledAttributes.getColor(R.styleable.PinLock_backgroundColor, Color.WHITE);
View layout = findViewById(R.id.pinLockLayout);
layout.setBackgroundColor(layoutBackground);
final int cancelForgotTextSize = styledAttributes.getInt(R.styleable.PinLock_cancelForgotTextSize, 20);
cancelButton.setTextSize(TypedValue.COMPLEX_UNIT_SP, cancelForgotTextSize);
forgetButton.setTextSize(TypedValue.COMPLEX_UNIT_SP, cancelForgotTextSize);
final int cancelForgotTextColor = styledAttributes.getColor(R.styleable.PinLock_cancelForgotTextColor, Color.BLACK);
cancelButton.setTextColor(cancelForgotTextColor);
if(forgetButton.isEnabled()) {
forgetButton.setTextColor(cancelForgotTextColor); // depends on control dependency: [if], data = [none]
} else {
forgetButton.setTextColor(Color.parseColor("#a9abac")); // depends on control dependency: [if], data = [none]
}
final int infoTextSize = styledAttributes.getInt(R.styleable.PinLock_infoTextSize, 20);
final int infoTextColor = styledAttributes.getColor(R.styleable.PinLock_infoTextColor, Color.BLACK);
label.setTextSize(TypedValue.COMPLEX_UNIT_SP, infoTextSize);
label.setTextColor(infoTextColor);
} }
|
public class class_name {
public static RestoreSnapshotTaskParameters deserialize(String taskParameters) {
JaxbJsonSerializer<RestoreSnapshotTaskParameters> serializer =
new JaxbJsonSerializer<>(RestoreSnapshotTaskParameters.class);
try {
RestoreSnapshotTaskParameters params =
serializer.deserialize(taskParameters);
// Verify expected parameters
if (null == params.getSnapshotId() || params.getSnapshotId().isEmpty() ||
null == params.getUserEmail() || params.getUserEmail().isEmpty()) {
throw new SnapshotDataException("Task parameter values may not be empty");
}
return params;
} catch (IOException e) {
throw new SnapshotDataException(
"Unable to parse task parameters due to: " + e.getMessage());
}
} }
|
public class class_name {
public static RestoreSnapshotTaskParameters deserialize(String taskParameters) {
JaxbJsonSerializer<RestoreSnapshotTaskParameters> serializer =
new JaxbJsonSerializer<>(RestoreSnapshotTaskParameters.class);
try {
RestoreSnapshotTaskParameters params =
serializer.deserialize(taskParameters);
// Verify expected parameters
if (null == params.getSnapshotId() || params.getSnapshotId().isEmpty() ||
null == params.getUserEmail() || params.getUserEmail().isEmpty()) {
throw new SnapshotDataException("Task parameter values may not be empty");
}
return params; // depends on control dependency: [try], data = [none]
} catch (IOException e) {
throw new SnapshotDataException(
"Unable to parse task parameters due to: " + e.getMessage());
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public static Matcher<ExpressionTree> methodInvocation(
final Matcher<ExpressionTree> methodSelectMatcher) {
return new Matcher<ExpressionTree>() {
@Override
public boolean matches(ExpressionTree expressionTree, VisitorState state) {
if (!(expressionTree instanceof MethodInvocationTree)) {
return false;
}
MethodInvocationTree tree = (MethodInvocationTree) expressionTree;
return methodSelectMatcher.matches(tree.getMethodSelect(), state);
}
};
} }
|
public class class_name {
public static Matcher<ExpressionTree> methodInvocation(
final Matcher<ExpressionTree> methodSelectMatcher) {
return new Matcher<ExpressionTree>() {
@Override
public boolean matches(ExpressionTree expressionTree, VisitorState state) {
if (!(expressionTree instanceof MethodInvocationTree)) {
return false; // depends on control dependency: [if], data = [none]
}
MethodInvocationTree tree = (MethodInvocationTree) expressionTree;
return methodSelectMatcher.matches(tree.getMethodSelect(), state);
}
};
} }
|
public class class_name {
public static final void closeOutputStream(OutputStream os) {
if (os != null) {
try {
os.close();
} catch (Exception e) {
logger.warn(e.toString());
}
}
} }
|
public class class_name {
public static final void closeOutputStream(OutputStream os) {
if (os != null) {
try {
os.close(); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
logger.warn(e.toString());
} // depends on control dependency: [catch], data = [none]
}
} }
|
public class class_name {
@Override
public EClass getIfcProtectiveDeviceTrippingUnit() {
if (ifcProtectiveDeviceTrippingUnitEClass == null) {
ifcProtectiveDeviceTrippingUnitEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI)
.getEClassifiers().get(481);
}
return ifcProtectiveDeviceTrippingUnitEClass;
} }
|
public class class_name {
@Override
public EClass getIfcProtectiveDeviceTrippingUnit() {
if (ifcProtectiveDeviceTrippingUnitEClass == null) {
ifcProtectiveDeviceTrippingUnitEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI)
.getEClassifiers().get(481);
// depends on control dependency: [if], data = [none]
}
return ifcProtectiveDeviceTrippingUnitEClass;
} }
|
public class class_name {
public Type getNestedGenericParameterType() {
if (this.nestingLevel > 1) {
Type type = getGenericParameterType();
for (int i = 2; i <= this.nestingLevel; i++) {
if (type instanceof ParameterizedType) {
Type[] args = ((ParameterizedType) type).getActualTypeArguments();
Integer index = getTypeIndexForLevel(i);
type = args[index != null ? index : args.length - 1];
}
}
return type;
} else {
return getGenericParameterType();
}
} }
|
public class class_name {
public Type getNestedGenericParameterType() {
if (this.nestingLevel > 1) {
Type type = getGenericParameterType();
for (int i = 2; i <= this.nestingLevel; i++) {
if (type instanceof ParameterizedType) {
Type[] args = ((ParameterizedType) type).getActualTypeArguments();
Integer index = getTypeIndexForLevel(i);
type = args[index != null ? index : args.length - 1]; // depends on control dependency: [if], data = [none]
}
}
return type; // depends on control dependency: [if], data = [none]
} else {
return getGenericParameterType(); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
private void loadDefinition(String def, Color trans) throws SlickException {
BufferedReader reader = new BufferedReader(new InputStreamReader(ResourceLoader.getResourceAsStream(def)));
try {
image = new Image(basePath+reader.readLine(), false, filter, trans);
while (reader.ready()) {
if (reader.readLine() == null) {
break;
}
Section sect = new Section(reader);
sections.put(sect.name, sect);
if (reader.readLine() == null) {
break;
}
}
} catch (Exception e) {
Log.error(e);
throw new SlickException("Failed to process definitions file - invalid format?", e);
}
} }
|
public class class_name {
private void loadDefinition(String def, Color trans) throws SlickException {
BufferedReader reader = new BufferedReader(new InputStreamReader(ResourceLoader.getResourceAsStream(def)));
try {
image = new Image(basePath+reader.readLine(), false, filter, trans);
while (reader.ready()) {
if (reader.readLine() == null) {
break;
}
Section sect = new Section(reader);
sections.put(sect.name, sect);
// depends on control dependency: [while], data = [none]
if (reader.readLine() == null) {
break;
}
}
} catch (Exception e) {
Log.error(e);
throw new SlickException("Failed to process definitions file - invalid format?", e);
}
} }
|
public class class_name {
public void marshall(Stage stage, ProtocolMarshaller protocolMarshaller) {
if (stage == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(stage.getDeploymentId(), DEPLOYMENTID_BINDING);
protocolMarshaller.marshall(stage.getClientCertificateId(), CLIENTCERTIFICATEID_BINDING);
protocolMarshaller.marshall(stage.getStageName(), STAGENAME_BINDING);
protocolMarshaller.marshall(stage.getDescription(), DESCRIPTION_BINDING);
protocolMarshaller.marshall(stage.getCacheClusterEnabled(), CACHECLUSTERENABLED_BINDING);
protocolMarshaller.marshall(stage.getCacheClusterSize(), CACHECLUSTERSIZE_BINDING);
protocolMarshaller.marshall(stage.getCacheClusterStatus(), CACHECLUSTERSTATUS_BINDING);
protocolMarshaller.marshall(stage.getMethodSettings(), METHODSETTINGS_BINDING);
protocolMarshaller.marshall(stage.getVariables(), VARIABLES_BINDING);
protocolMarshaller.marshall(stage.getDocumentationVersion(), DOCUMENTATIONVERSION_BINDING);
protocolMarshaller.marshall(stage.getAccessLogSettings(), ACCESSLOGSETTINGS_BINDING);
protocolMarshaller.marshall(stage.getCanarySettings(), CANARYSETTINGS_BINDING);
protocolMarshaller.marshall(stage.getTracingEnabled(), TRACINGENABLED_BINDING);
protocolMarshaller.marshall(stage.getWebAclArn(), WEBACLARN_BINDING);
protocolMarshaller.marshall(stage.getTags(), TAGS_BINDING);
protocolMarshaller.marshall(stage.getCreatedDate(), CREATEDDATE_BINDING);
protocolMarshaller.marshall(stage.getLastUpdatedDate(), LASTUPDATEDDATE_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} }
|
public class class_name {
public void marshall(Stage stage, ProtocolMarshaller protocolMarshaller) {
if (stage == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(stage.getDeploymentId(), DEPLOYMENTID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(stage.getClientCertificateId(), CLIENTCERTIFICATEID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(stage.getStageName(), STAGENAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(stage.getDescription(), DESCRIPTION_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(stage.getCacheClusterEnabled(), CACHECLUSTERENABLED_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(stage.getCacheClusterSize(), CACHECLUSTERSIZE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(stage.getCacheClusterStatus(), CACHECLUSTERSTATUS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(stage.getMethodSettings(), METHODSETTINGS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(stage.getVariables(), VARIABLES_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(stage.getDocumentationVersion(), DOCUMENTATIONVERSION_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(stage.getAccessLogSettings(), ACCESSLOGSETTINGS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(stage.getCanarySettings(), CANARYSETTINGS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(stage.getTracingEnabled(), TRACINGENABLED_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(stage.getWebAclArn(), WEBACLARN_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(stage.getTags(), TAGS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(stage.getCreatedDate(), CREATEDDATE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(stage.getLastUpdatedDate(), LASTUPDATEDDATE_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public static List<String> valueSplit(String str, String valueRegex, String separatorRegex) {
Pattern vPat = Pattern.compile(valueRegex);
Pattern sPat = Pattern.compile(separatorRegex);
List<String> ret = new ArrayList<String>();
while (str.length() > 0) {
Matcher vm = vPat.matcher(str);
if (vm.lookingAt()) {
ret.add(vm.group());
str = str.substring(vm.end());
// String got = vm.group();
// System.err.println("vmatched " + got + "; now str is " + str);
} else {
throw new IllegalArgumentException("valueSplit: " + valueRegex + " doesn't match " + str);
}
if (str.length() > 0) {
Matcher sm = sPat.matcher(str);
if (sm.lookingAt()) {
str = str.substring(sm.end());
// String got = sm.group();
// System.err.println("smatched " + got + "; now str is " + str);
} else {
throw new IllegalArgumentException("valueSplit: " + separatorRegex + " doesn't match " + str);
}
}
} // end while
return ret;
} }
|
public class class_name {
public static List<String> valueSplit(String str, String valueRegex, String separatorRegex) {
Pattern vPat = Pattern.compile(valueRegex);
Pattern sPat = Pattern.compile(separatorRegex);
List<String> ret = new ArrayList<String>();
while (str.length() > 0) {
Matcher vm = vPat.matcher(str);
if (vm.lookingAt()) {
ret.add(vm.group());
// depends on control dependency: [if], data = [none]
str = str.substring(vm.end());
// depends on control dependency: [if], data = [none]
// String got = vm.group();
// System.err.println("vmatched " + got + "; now str is " + str);
} else {
throw new IllegalArgumentException("valueSplit: " + valueRegex + " doesn't match " + str);
}
if (str.length() > 0) {
Matcher sm = sPat.matcher(str);
if (sm.lookingAt()) {
str = str.substring(sm.end());
// String got = sm.group();
// System.err.println("smatched " + got + "; now str is " + str);
} else {
throw new IllegalArgumentException("valueSplit: " + separatorRegex + " doesn't match " + str);
}
}
} // end while
return ret;
} }
|
public class class_name {
public F getInstance(final String pattern, TimeZone timeZone, Locale locale) {
Validate.notNull(pattern, "pattern must not be null");
if (timeZone == null) {
timeZone = TimeZone.getDefault();
}
if (locale == null) {
locale = Locale.getDefault();
}
final MultipartKey key = new MultipartKey(pattern, timeZone, locale);
F format = cInstanceCache.get(key);
if (format == null) {
format = createInstance(pattern, timeZone, locale);
final F previousValue= cInstanceCache.putIfAbsent(key, format);
if (previousValue != null) {
// another thread snuck in and did the same work
// we should return the instance that is in ConcurrentMap
format= previousValue;
}
}
return format;
} }
|
public class class_name {
public F getInstance(final String pattern, TimeZone timeZone, Locale locale) {
Validate.notNull(pattern, "pattern must not be null");
if (timeZone == null) {
timeZone = TimeZone.getDefault(); // depends on control dependency: [if], data = [none]
}
if (locale == null) {
locale = Locale.getDefault(); // depends on control dependency: [if], data = [none]
}
final MultipartKey key = new MultipartKey(pattern, timeZone, locale);
F format = cInstanceCache.get(key);
if (format == null) {
format = createInstance(pattern, timeZone, locale); // depends on control dependency: [if], data = [none]
final F previousValue= cInstanceCache.putIfAbsent(key, format);
if (previousValue != null) {
// another thread snuck in and did the same work
// we should return the instance that is in ConcurrentMap
format= previousValue; // depends on control dependency: [if], data = [none]
}
}
return format;
} }
|
public class class_name {
public String generateRandomToken(int length) {
final char[] token = new char[length];
for (int i = 0; i < length; i++) {
final int tokenIndex = random.nextInt(this.tokenChars.length);
token[i] = tokenChars[tokenIndex];
}
return new String(token);
} }
|
public class class_name {
public String generateRandomToken(int length) {
final char[] token = new char[length];
for (int i = 0; i < length; i++) {
final int tokenIndex = random.nextInt(this.tokenChars.length);
token[i] = tokenChars[tokenIndex]; // depends on control dependency: [for], data = [i]
}
return new String(token);
} }
|
public class class_name {
public boolean isElementContentWhitespace() {
// dynamic load to support jre 1.4 and 1.5
try {
Method m = section.getClass().getMethod("isElementContentWhitespace", new Class[] {});
return Caster.toBooleanValue(m.invoke(section, ArrayUtil.OBJECT_EMPTY));
}
catch (Exception e) {
throw new PageRuntimeException(Caster.toPageException(e));
}
} }
|
public class class_name {
public boolean isElementContentWhitespace() {
// dynamic load to support jre 1.4 and 1.5
try {
Method m = section.getClass().getMethod("isElementContentWhitespace", new Class[] {});
return Caster.toBooleanValue(m.invoke(section, ArrayUtil.OBJECT_EMPTY)); // depends on control dependency: [try], data = [none]
}
catch (Exception e) {
throw new PageRuntimeException(Caster.toPageException(e));
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public void incrErrorCount() {
long count = errorCount.incrementAndGet();
// 如果节点是可用状态,同时当前连续失败的次数超过限制maxClientConnection次,那么把该节点标示为不可用
if (count >= maxInvokeError && stat.get()) {
if (stat.compareAndSet(true, false)) {
logger.error("NettyClient unavailable Error: config='" + config.getInterfaceName() + "' '" + config.identity() + "'");
}
}
} }
|
public class class_name {
public void incrErrorCount() {
long count = errorCount.incrementAndGet();
// 如果节点是可用状态,同时当前连续失败的次数超过限制maxClientConnection次,那么把该节点标示为不可用
if (count >= maxInvokeError && stat.get()) {
if (stat.compareAndSet(true, false)) {
logger.error("NettyClient unavailable Error: config='" + config.getInterfaceName() + "' '" + config.identity() + "'"); // depends on control dependency: [if], data = [none]
}
}
} }
|
public class class_name {
public Double getDouble(String name) {
Object o = get(name);
if (o instanceof Number) {
return ((Number)o).doubleValue();
}
if (o != null) {
try {
String string = o.toString();
if (string != null) {
return Double.parseDouble(string);
}
}
catch (NumberFormatException e) {}
}
return null;
} }
|
public class class_name {
public Double getDouble(String name) {
Object o = get(name);
if (o instanceof Number) {
return ((Number)o).doubleValue(); // depends on control dependency: [if], data = [none]
}
if (o != null) {
try {
String string = o.toString();
if (string != null) {
return Double.parseDouble(string); // depends on control dependency: [if], data = [(string]
}
}
catch (NumberFormatException e) {} // depends on control dependency: [catch], data = [none]
}
return null;
} }
|
public class class_name {
private void processElementPoint(List<double[]> points, Node cur) {
double[] point = null;
String vstr = ((Element) cur).getAttribute(ATTR_VECTOR);
if(vstr != null && vstr.length() > 0) {
point = parseVector(vstr);
}
if(point == null) {
throw new AbortException("No translation vector given.");
}
// *** add new point
points.add(point);
// TODO: check for unknown attributes.
XMLNodeIterator iter = new XMLNodeIterator(cur.getFirstChild());
while(iter.hasNext()) {
Node child = iter.next();
if(child.getNodeType() == Node.ELEMENT_NODE) {
LOG.warning("Unknown element in XML specification file: " + child.getNodeName());
}
}
} }
|
public class class_name {
private void processElementPoint(List<double[]> points, Node cur) {
double[] point = null;
String vstr = ((Element) cur).getAttribute(ATTR_VECTOR);
if(vstr != null && vstr.length() > 0) {
point = parseVector(vstr); // depends on control dependency: [if], data = [(vstr]
}
if(point == null) {
throw new AbortException("No translation vector given.");
}
// *** add new point
points.add(point);
// TODO: check for unknown attributes.
XMLNodeIterator iter = new XMLNodeIterator(cur.getFirstChild());
while(iter.hasNext()) {
Node child = iter.next();
if(child.getNodeType() == Node.ELEMENT_NODE) {
LOG.warning("Unknown element in XML specification file: " + child.getNodeName()); // depends on control dependency: [if], data = [none]
}
}
} }
|
public class class_name {
public void unlinkAll(ParaObject obj) {
if (obj == null || obj.getId() == null) {
return;
}
String url = Utils.formatMessage("{0}/links", obj.getObjectURI());
invokeDelete(url, null);
} }
|
public class class_name {
public void unlinkAll(ParaObject obj) {
if (obj == null || obj.getId() == null) {
return; // depends on control dependency: [if], data = [none]
}
String url = Utils.formatMessage("{0}/links", obj.getObjectURI());
invokeDelete(url, null);
} }
|
public class class_name {
public synchronized boolean removePreInvalidationListener(PreInvalidationListener listener) {
if (bEnableListener && listener != null) {
eventSource.removeListener(listener);
return true;
}
return false;
} }
|
public class class_name {
public synchronized boolean removePreInvalidationListener(PreInvalidationListener listener) {
if (bEnableListener && listener != null) {
eventSource.removeListener(listener); // depends on control dependency: [if], data = [none]
return true; // depends on control dependency: [if], data = [none]
}
return false;
} }
|
public class class_name {
@Override
public void setMethod(MethodValues method) {
this.myMethod = method;
super.setFirstLineChanged();
if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
Tr.event(tc, "setMethod(v): " + (null != method ? method.getName() : null));
}
} }
|
public class class_name {
@Override
public void setMethod(MethodValues method) {
this.myMethod = method;
super.setFirstLineChanged();
if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
Tr.event(tc, "setMethod(v): " + (null != method ? method.getName() : null)); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public List<ModelServiceInstance> getAllInstances() {
List<ModelServiceInstance> result = Collections.emptyList();
try {
result = getDirectoryServiceClient().getAllInstances();
}catch (ServiceException se){
LOGGER.error("Error when getAllInstances()",se);
}
return result;
} }
|
public class class_name {
public List<ModelServiceInstance> getAllInstances() {
List<ModelServiceInstance> result = Collections.emptyList();
try {
result = getDirectoryServiceClient().getAllInstances(); // depends on control dependency: [try], data = [none]
}catch (ServiceException se){
LOGGER.error("Error when getAllInstances()",se);
} // depends on control dependency: [catch], data = [none]
return result;
} }
|
public class class_name {
public String getString()
{
StringBuilder sb = new StringBuilder();
for (int ii=0;ii<marked;ii++)
{
sb.append(charAt(ii));
}
return sb.toString();
} }
|
public class class_name {
public String getString()
{
StringBuilder sb = new StringBuilder();
for (int ii=0;ii<marked;ii++)
{
sb.append(charAt(ii));
// depends on control dependency: [for], data = [ii]
}
return sb.toString();
} }
|
public class class_name {
public static void or2by2(BitmapContainer container, SparseBitmap bitmap1,
SparseBitmap bitmap2) {
int it1 = 0;
int it2 = 0;
int p1 = bitmap1.buffer.get(it1);
int p2 = bitmap2.buffer.get(it2);
if ((it1 < bitmap1.buffer.size()) && (it2 < bitmap2.buffer.size()))
while (true) {
if (p1 < p2) {
container.add(bitmap1.buffer.get(it1 + 1), p1);
it1 += 2;
if (it1 >= bitmap1.buffer.size())
break;
p1 += bitmap1.buffer.get(it1) + 1;
} else if (p1 > p2) {
container.add(bitmap2.buffer.get(it2 + 1), p2);
it2 += 2;
if (it2 >= bitmap2.buffer.size())
break;
p2 += bitmap2.buffer.get(it2) + 1;
} else {
container.add(
bitmap1.buffer.get(it1 + 1)
| bitmap2.buffer.get(it2 + 1), p1);
it1 += 2;
it2 += 2;
if (it1 < bitmap1.buffer.size())
p1 += bitmap1.buffer.get(it1) + 1;
if (it2 < bitmap2.buffer.size())
p2 += bitmap2.buffer.get(it2) + 1;
if ((it1 >= bitmap1.buffer.size())
|| (it2 >= bitmap2.buffer.size()))
break;
}
}
if (it1 < bitmap1.buffer.size()) {
while (true) {
container.add(bitmap1.buffer.get(it1 + 1), p1);
it1 += 2;
if (it1 == bitmap1.buffer.size())
break;
p1 += bitmap1.buffer.get(it1) + 1;
}
}
if (it2 < bitmap2.buffer.size()) {
while (true) {
container.add(bitmap2.buffer.get(it2 + 1), p2);
it2 += 2;
if (it2 == bitmap2.buffer.size())
break;
p2 += bitmap2.buffer.get(it2) + 1;
}
}
} }
|
public class class_name {
public static void or2by2(BitmapContainer container, SparseBitmap bitmap1,
SparseBitmap bitmap2) {
int it1 = 0;
int it2 = 0;
int p1 = bitmap1.buffer.get(it1);
int p2 = bitmap2.buffer.get(it2);
if ((it1 < bitmap1.buffer.size()) && (it2 < bitmap2.buffer.size()))
while (true) {
if (p1 < p2) {
container.add(bitmap1.buffer.get(it1 + 1), p1); // depends on control dependency: [if], data = [none]
it1 += 2; // depends on control dependency: [if], data = [none]
if (it1 >= bitmap1.buffer.size())
break;
p1 += bitmap1.buffer.get(it1) + 1; // depends on control dependency: [if], data = [none]
} else if (p1 > p2) {
container.add(bitmap2.buffer.get(it2 + 1), p2); // depends on control dependency: [if], data = [p2)]
it2 += 2; // depends on control dependency: [if], data = [none]
if (it2 >= bitmap2.buffer.size())
break;
p2 += bitmap2.buffer.get(it2) + 1; // depends on control dependency: [if], data = [none]
} else {
container.add(
bitmap1.buffer.get(it1 + 1)
| bitmap2.buffer.get(it2 + 1), p1); // depends on control dependency: [if], data = [none]
it1 += 2; // depends on control dependency: [if], data = [none]
it2 += 2; // depends on control dependency: [if], data = [none]
if (it1 < bitmap1.buffer.size())
p1 += bitmap1.buffer.get(it1) + 1;
if (it2 < bitmap2.buffer.size())
p2 += bitmap2.buffer.get(it2) + 1;
if ((it1 >= bitmap1.buffer.size())
|| (it2 >= bitmap2.buffer.size()))
break;
}
}
if (it1 < bitmap1.buffer.size()) {
while (true) {
container.add(bitmap1.buffer.get(it1 + 1), p1); // depends on control dependency: [while], data = [none]
it1 += 2; // depends on control dependency: [while], data = [none]
if (it1 == bitmap1.buffer.size())
break;
p1 += bitmap1.buffer.get(it1) + 1; // depends on control dependency: [while], data = [none]
}
}
if (it2 < bitmap2.buffer.size()) {
while (true) {
container.add(bitmap2.buffer.get(it2 + 1), p2); // depends on control dependency: [while], data = [none]
it2 += 2; // depends on control dependency: [while], data = [none]
if (it2 == bitmap2.buffer.size())
break;
p2 += bitmap2.buffer.get(it2) + 1; // depends on control dependency: [while], data = [none]
}
}
} }
|
public class class_name {
protected void processTemplate(String templateName, OutputStream outputStream) throws ReportException {
InputStream input = null;
String logTag = null;
final File f = new File(templateName);
try {
if (f.isFile()) {
try {
logTag = templateName;
input = new FileInputStream(f);
} catch (FileNotFoundException ex) {
throw new ReportException("Unable to locate template file: " + templateName, ex);
}
} else {
logTag = "templates/" + templateName + ".vsl";
input = FileUtils.getResourceAsStream(logTag);
}
if (input == null) {
logTag = templateName;
input = FileUtils.getResourceAsStream(templateName);
}
if (input == null) {
throw new ReportException("Template file doesn't exist: " + logTag);
}
try (InputStreamReader reader = new InputStreamReader(input, StandardCharsets.UTF_8);
OutputStreamWriter writer = new OutputStreamWriter(outputStream, StandardCharsets.UTF_8)) {
if (!velocityEngine.evaluate(context, writer, logTag, reader)) {
throw new ReportException("Failed to convert the template into html.");
}
writer.flush();
} catch (UnsupportedEncodingException ex) {
throw new ReportException("Unable to generate the report using UTF-8", ex);
} catch (IOException ex) {
throw new ReportException("Unable to write the report", ex);
}
} finally {
if (input != null) {
try {
input.close();
} catch (IOException ex) {
LOGGER.trace("Error closing input", ex);
}
}
}
} }
|
public class class_name {
protected void processTemplate(String templateName, OutputStream outputStream) throws ReportException {
InputStream input = null;
String logTag = null;
final File f = new File(templateName);
try {
if (f.isFile()) {
try {
logTag = templateName; // depends on control dependency: [try], data = [none]
input = new FileInputStream(f); // depends on control dependency: [try], data = [none]
} catch (FileNotFoundException ex) {
throw new ReportException("Unable to locate template file: " + templateName, ex);
} // depends on control dependency: [catch], data = [none]
} else {
logTag = "templates/" + templateName + ".vsl"; // depends on control dependency: [if], data = [none]
input = FileUtils.getResourceAsStream(logTag); // depends on control dependency: [if], data = [none]
}
if (input == null) {
logTag = templateName; // depends on control dependency: [if], data = [none]
input = FileUtils.getResourceAsStream(templateName); // depends on control dependency: [if], data = [none]
}
if (input == null) {
throw new ReportException("Template file doesn't exist: " + logTag);
}
try (InputStreamReader reader = new InputStreamReader(input, StandardCharsets.UTF_8);
OutputStreamWriter writer = new OutputStreamWriter(outputStream, StandardCharsets.UTF_8)) {
if (!velocityEngine.evaluate(context, writer, logTag, reader)) {
throw new ReportException("Failed to convert the template into html.");
}
writer.flush();
} catch (UnsupportedEncodingException ex) {
throw new ReportException("Unable to generate the report using UTF-8", ex);
} catch (IOException ex) {
throw new ReportException("Unable to write the report", ex);
}
} finally {
if (input != null) {
try {
input.close();
} catch (IOException ex) {
LOGGER.trace("Error closing input", ex);
}
}
}
} }
|
public class class_name {
static List<String> extractAsArrayOfClassName(String value) {
Matcher matcher = classPattern.matcher(value);
List<String> result = new ArrayList<String>();
while (matcher.find()) {
result.add(matcher.group(1));
}
return result;
} }
|
public class class_name {
static List<String> extractAsArrayOfClassName(String value) {
Matcher matcher = classPattern.matcher(value);
List<String> result = new ArrayList<String>();
while (matcher.find()) {
result.add(matcher.group(1)); // depends on control dependency: [while], data = [none]
}
return result;
} }
|
public class class_name {
public void deleteColumnFamily(DBConn dbConn, String cfName) {
m_logger.info("Deleting ColumnFamily: {}", cfName);
try {
dbConn.getClientSession().system_drop_column_family(cfName);
waitForSchemaPropagation(dbConn);
} catch (Exception ex) {
throw new RuntimeException("drop_column_family failed", ex);
}
} }
|
public class class_name {
public void deleteColumnFamily(DBConn dbConn, String cfName) {
m_logger.info("Deleting ColumnFamily: {}", cfName);
try {
dbConn.getClientSession().system_drop_column_family(cfName);
// depends on control dependency: [try], data = [none]
waitForSchemaPropagation(dbConn);
// depends on control dependency: [try], data = [none]
} catch (Exception ex) {
throw new RuntimeException("drop_column_family failed", ex);
}
// depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public void buildTaxonomy() {
// Determine if a full or incremental calculation is required
if(!hasBeenIncrementallyClassified) {
buildTaxonomyConcurrent();
//buildTaxonomySequential();
} else {
final IConceptMap<IConceptSet> newConceptSubs = getNewSubsumptions();
final IConceptMap<IConceptSet> affectedConceptSubs = getAffectedSubsumptions();
// 1. Keep only the subsumptions that involve real atomic concepts
IConceptMap<IConceptSet> allNew = new SparseConceptMap<IConceptSet>(newConceptSubs.size());
IConceptMap<IConceptSet> allAffected = new SparseConceptMap<IConceptSet>(newConceptSubs.size());
for (IntIterator itr = newConceptSubs.keyIterator(); itr.hasNext();) {
final int x = itr.next();
if (!factory.isVirtualConcept(x)) {
IConceptSet set = new SparseConceptHashSet();
allNew.put(x, set);
for (IntIterator it = newConceptSubs.get(x).iterator(); it.hasNext();) {
int next = it.next();
if (!factory.isVirtualConcept(next)) {
set.add(next);
}
}
}
}
for (IntIterator itr = affectedConceptSubs.keyIterator(); itr.hasNext();) {
final int x = itr.next();
if (!factory.isVirtualConcept(x)) {
IConceptSet set = new SparseConceptHashSet();
allAffected.put(x, set);
for (IntIterator it = affectedConceptSubs.get(x).iterator(); it.hasNext();) {
int next = it.next();
if (!factory.isVirtualConcept(next)) {
set.add(next);
}
}
}
}
// 2. Create nodes for new concepts and connect to node hierarchy
// a. First create the nodes and add to index
for (IntIterator itr = allNew.keyIterator(); itr.hasNext();) {
final String key = factory.lookupConceptId(itr.next()).toString();
Node cn = new Node();
cn.getEquivalentConcepts().add(key);
conceptNodeIndex.put(key, cn);
}
// b. Now connect the nodes disregarding redundant connections
Node bottomNode = conceptNodeIndex.get(au.csiro.ontology.model.NamedConcept.BOTTOM);
for (IntIterator itr = allNew.keyIterator(); itr.hasNext();) {
int id = itr.next();
final String key = factory.lookupConceptId(id).toString();
Node cn = conceptNodeIndex.get(key);
IConceptSet parents = allNew.get(id);
for (IntIterator itr2 = parents.iterator(); itr2.hasNext();) {
// Create a connection to each parent
int parentId = itr2.next();
if (parentId == id)
continue;
Node parent = conceptNodeIndex.get(factory.lookupConceptId(parentId));
cn.getParents().add(parent);
parent.getChildren().add(cn);
// All nodes that get new children and are connected to BOTTOM
// must be disconnected
if (parent.getChildren().contains(bottomNode)) {
parent.getChildren().remove(bottomNode);
bottomNode.getParents().remove(parent);
}
}
}
Set<Integer> toRemoveFromAffected = new HashSet<Integer>();
for (IntIterator itr = allAffected.keyIterator(); itr.hasNext();) {
final int id = itr.next();
final String key = factory.lookupConceptId(id).toString();
Node cn = conceptNodeIndex.get(key);
IConceptSet parents = allAffected.get(id);
if(parents.contains(IFactory.BOTTOM_CONCEPT)) {
// Special case - bottom is parent
// a. add equivalents to bottom node
bottomNode.getEquivalentConcepts().addAll(cn.getEquivalentConcepts());
Set<Node> tempParents = cn.getParents();
Set<Node> tempChildren = cn.getChildren();
// b. reconnect parents to children
for(Node parent : tempParents) {
parent.getChildren().remove(cn);
parent.getChildren().addAll(tempChildren);
}
for(Node child : tempChildren) {
child.getParents().remove(cn);
child.getParents().addAll(tempParents);
}
for(String k : cn.getEquivalentConcepts()) {
conceptNodeIndex.remove(k);
conceptNodeIndex.put(key, bottomNode);
}
toRemoveFromAffected.add(id);
} else {
for (IntIterator itr2 = parents.iterator(); itr2.hasNext();) {
// Create a connection to each parent
int parentId = itr2.next();
if (parentId == id)
continue;
Node parent = conceptNodeIndex.get(factory.lookupConceptId(parentId));
cn.getParents().add(parent);
parent.getChildren().add(cn);
// All nodes that get new children and are connected to BOTTOM must be disconnected
if (parent.getChildren().contains(bottomNode)) {
parent.getChildren().remove(bottomNode);
bottomNode.getParents().remove(parent);
}
}
}
}
for(Integer i : toRemoveFromAffected) {
allAffected.remove(i.intValue());
allNew.remove(i.intValue());
}
// 3. Connect new nodes without parents to TOP
Node topNode = conceptNodeIndex.get(au.csiro.ontology.model.NamedConcept.TOP);
for (IntIterator itr = allNew.keyIterator(); itr.hasNext();) {
final String key = factory.lookupConceptId(itr.next()).toString();
Node cn = conceptNodeIndex.get(key);
if (cn.getParents().isEmpty()) {
cn.getParents().add(topNode);
topNode.getChildren().add(cn);
}
}
// 4. Fix connections for new and affected concepts
// a. Check for equivalents
Set<Pair> pairsToMerge = new HashSet<Pair>();
for (IntIterator itr = allNew.keyIterator(); itr.hasNext();) {
final String key = factory.lookupConceptId(itr.next()).toString();
Node cn = conceptNodeIndex.get(key);
for (Node parent : cn.getParents()) {
if (parent.getParents().contains(cn)) {
pairsToMerge.add(new Pair(cn, parent));
}
}
}
for (IntIterator itr = allAffected.keyIterator(); itr.hasNext();) {
final String key = factory.lookupConceptId(itr.next()).toString();
Node cn = conceptNodeIndex.get(key);
for (Node parent : cn.getParents()) {
if (parent.getParents().contains(cn)) {
pairsToMerge.add(new Pair(cn, parent));
}
}
}
Set<Node> affectedByMerge = new HashSet<Node>();
// Merge equivalents
for (Pair p : pairsToMerge) {
Node cn1 = p.getA();
Node cn2 = p.getB();
affectedByMerge.addAll(cn1.getChildren());
affectedByMerge.addAll(cn2.getChildren());
// Merge into cn1 - remove cn2 from index and replace with cn1
for (String n : cn2.getEquivalentConcepts()) {
conceptNodeIndex.put(n, cn1);
}
cn1.getEquivalentConcepts().addAll(cn2.getEquivalentConcepts());
// Remove relationships between merged concepts
cn1.getParents().remove(cn2);
cn2.getChildren().remove(cn1);
cn2.getParents().remove(cn1);
cn1.getChildren().remove(cn2);
// Taxonomy is bidirectional
cn1.getParents().addAll(cn2.getParents());
for (Node parent : cn2.getParents()) {
parent.getChildren().remove(cn2);
parent.getChildren().add(cn1);
}
cn1.getChildren().addAll(cn2.getChildren());
for (Node child : cn2.getChildren()) {
child.getParents().remove(cn2);
child.getParents().add(cn1);
}
cn2 = null; // nothing should reference cn2 now
}
// b. Fix all new and affected nodes
Set<Node> all = new HashSet<Node>();
for (IntIterator it = allNew.keyIterator(); it.hasNext();) {
all.add(conceptNodeIndex.get(factory.lookupConceptId(it.next())));
}
for (IntIterator it = allAffected.keyIterator(); it.hasNext();) {
all.add(conceptNodeIndex.get(factory.lookupConceptId(it.next())));
}
for (Node cn : affectedByMerge) {
all.add(cn);
}
// Add also the children of the affected nodes
Set<Node> childrenToAdd = new HashSet<Node>();
for (Node cn : all) {
for (Node ccn : cn.getChildren()) {
if (ccn.equals(bottomNode))
continue;
childrenToAdd.add(ccn);
}
}
all.addAll(childrenToAdd);
// Find redundant relationships
for (Node cn : all) {
Set<Node> ps = cn.getParents();
Object[] parents = ps.toArray(new Object[ps.size()]);
Set<Node> toRemove = new HashSet<Node>();
for (int i = 0; i < parents.length; i++) {
for (int j = i + 1; j < parents.length; j++) {
if (isChild((Node)parents[j], (Node)parents[i])) {
toRemove.add((Node)parents[i]);
continue;
}
if (isChild((Node)parents[i], (Node)parents[j])) {
toRemove.add((Node)parents[j]);
continue;
}
}
}
for (Node tr : toRemove) {
cn.getParents().remove(tr);
tr.getChildren().remove(cn);
}
}
// 5. Connect bottom to new and affected concepts with no children
for (IntIterator itr = allNew.keyIterator(); itr.hasNext();) {
final int key = itr.next();
Node cn = conceptNodeIndex.get(factory.lookupConceptId(key));
if (cn.getChildren().isEmpty()) {
cn.getChildren().add(bottomNode);
bottomNode.getParents().add(cn);
}
}
for (IntIterator itr = allAffected.keyIterator(); itr.hasNext();) {
final int key = itr.next();
Node cn = conceptNodeIndex.get(factory.lookupConceptId(key));
if (cn.getChildren().isEmpty()) {
cn.getChildren().add(bottomNode);
bottomNode.getParents().add(cn);
}
}
// 6. Connect the top node to new and affected concepts with no parents
for (IntIterator itr = allNew.keyIterator(); itr.hasNext();) {
final int key = itr.next();
Node cn = conceptNodeIndex.get(factory.lookupConceptId(key));
if (cn.getParents().isEmpty()) {
cn.getParents().add(topNode);
topNode.getChildren().add(cn);
}
}
for (IntIterator itr = allAffected.keyIterator(); itr.hasNext();) {
final int key = itr.next();
Node cn = conceptNodeIndex.get(factory.lookupConceptId(key));
if (cn.getParents().isEmpty()) {
cn.getParents().add(topNode);
topNode.getChildren().add(cn);
}
}
}
} }
|
public class class_name {
public void buildTaxonomy() {
// Determine if a full or incremental calculation is required
if(!hasBeenIncrementallyClassified) {
buildTaxonomyConcurrent(); // depends on control dependency: [if], data = [none]
//buildTaxonomySequential();
} else {
final IConceptMap<IConceptSet> newConceptSubs = getNewSubsumptions();
final IConceptMap<IConceptSet> affectedConceptSubs = getAffectedSubsumptions();
// 1. Keep only the subsumptions that involve real atomic concepts
IConceptMap<IConceptSet> allNew = new SparseConceptMap<IConceptSet>(newConceptSubs.size());
IConceptMap<IConceptSet> allAffected = new SparseConceptMap<IConceptSet>(newConceptSubs.size());
for (IntIterator itr = newConceptSubs.keyIterator(); itr.hasNext();) {
final int x = itr.next();
if (!factory.isVirtualConcept(x)) {
IConceptSet set = new SparseConceptHashSet();
allNew.put(x, set); // depends on control dependency: [if], data = [none]
for (IntIterator it = newConceptSubs.get(x).iterator(); it.hasNext();) {
int next = it.next();
if (!factory.isVirtualConcept(next)) {
set.add(next); // depends on control dependency: [if], data = [none]
}
}
}
}
for (IntIterator itr = affectedConceptSubs.keyIterator(); itr.hasNext();) {
final int x = itr.next();
if (!factory.isVirtualConcept(x)) {
IConceptSet set = new SparseConceptHashSet();
allAffected.put(x, set); // depends on control dependency: [if], data = [none]
for (IntIterator it = affectedConceptSubs.get(x).iterator(); it.hasNext();) {
int next = it.next();
if (!factory.isVirtualConcept(next)) {
set.add(next); // depends on control dependency: [if], data = [none]
}
}
}
}
// 2. Create nodes for new concepts and connect to node hierarchy
// a. First create the nodes and add to index
for (IntIterator itr = allNew.keyIterator(); itr.hasNext();) {
final String key = factory.lookupConceptId(itr.next()).toString();
Node cn = new Node();
cn.getEquivalentConcepts().add(key); // depends on control dependency: [for], data = [none]
conceptNodeIndex.put(key, cn); // depends on control dependency: [for], data = [none]
}
// b. Now connect the nodes disregarding redundant connections
Node bottomNode = conceptNodeIndex.get(au.csiro.ontology.model.NamedConcept.BOTTOM);
for (IntIterator itr = allNew.keyIterator(); itr.hasNext();) {
int id = itr.next();
final String key = factory.lookupConceptId(id).toString();
Node cn = conceptNodeIndex.get(key);
IConceptSet parents = allNew.get(id);
for (IntIterator itr2 = parents.iterator(); itr2.hasNext();) {
// Create a connection to each parent
int parentId = itr2.next();
if (parentId == id)
continue;
Node parent = conceptNodeIndex.get(factory.lookupConceptId(parentId));
cn.getParents().add(parent); // depends on control dependency: [for], data = [none]
parent.getChildren().add(cn); // depends on control dependency: [for], data = [none]
// All nodes that get new children and are connected to BOTTOM
// must be disconnected
if (parent.getChildren().contains(bottomNode)) {
parent.getChildren().remove(bottomNode); // depends on control dependency: [if], data = [none]
bottomNode.getParents().remove(parent); // depends on control dependency: [if], data = [none]
}
}
}
Set<Integer> toRemoveFromAffected = new HashSet<Integer>();
for (IntIterator itr = allAffected.keyIterator(); itr.hasNext();) {
final int id = itr.next();
final String key = factory.lookupConceptId(id).toString();
Node cn = conceptNodeIndex.get(key);
IConceptSet parents = allAffected.get(id);
if(parents.contains(IFactory.BOTTOM_CONCEPT)) {
// Special case - bottom is parent
// a. add equivalents to bottom node
bottomNode.getEquivalentConcepts().addAll(cn.getEquivalentConcepts()); // depends on control dependency: [if], data = [none]
Set<Node> tempParents = cn.getParents();
Set<Node> tempChildren = cn.getChildren();
// b. reconnect parents to children
for(Node parent : tempParents) {
parent.getChildren().remove(cn); // depends on control dependency: [for], data = [parent]
parent.getChildren().addAll(tempChildren); // depends on control dependency: [for], data = [parent]
}
for(Node child : tempChildren) {
child.getParents().remove(cn); // depends on control dependency: [for], data = [child]
child.getParents().addAll(tempParents); // depends on control dependency: [for], data = [child]
}
for(String k : cn.getEquivalentConcepts()) {
conceptNodeIndex.remove(k); // depends on control dependency: [for], data = [k]
conceptNodeIndex.put(key, bottomNode); // depends on control dependency: [for], data = [k]
}
toRemoveFromAffected.add(id); // depends on control dependency: [if], data = [none]
} else {
for (IntIterator itr2 = parents.iterator(); itr2.hasNext();) {
// Create a connection to each parent
int parentId = itr2.next();
if (parentId == id)
continue;
Node parent = conceptNodeIndex.get(factory.lookupConceptId(parentId));
cn.getParents().add(parent); // depends on control dependency: [for], data = [none]
parent.getChildren().add(cn); // depends on control dependency: [for], data = [none]
// All nodes that get new children and are connected to BOTTOM must be disconnected
if (parent.getChildren().contains(bottomNode)) {
parent.getChildren().remove(bottomNode); // depends on control dependency: [if], data = [none]
bottomNode.getParents().remove(parent); // depends on control dependency: [if], data = [none]
}
}
}
}
for(Integer i : toRemoveFromAffected) {
allAffected.remove(i.intValue()); // depends on control dependency: [for], data = [i]
allNew.remove(i.intValue()); // depends on control dependency: [for], data = [i]
}
// 3. Connect new nodes without parents to TOP
Node topNode = conceptNodeIndex.get(au.csiro.ontology.model.NamedConcept.TOP);
for (IntIterator itr = allNew.keyIterator(); itr.hasNext();) {
final String key = factory.lookupConceptId(itr.next()).toString();
Node cn = conceptNodeIndex.get(key);
if (cn.getParents().isEmpty()) {
cn.getParents().add(topNode); // depends on control dependency: [if], data = [none]
topNode.getChildren().add(cn); // depends on control dependency: [if], data = [none]
}
}
// 4. Fix connections for new and affected concepts
// a. Check for equivalents
Set<Pair> pairsToMerge = new HashSet<Pair>();
for (IntIterator itr = allNew.keyIterator(); itr.hasNext();) {
final String key = factory.lookupConceptId(itr.next()).toString();
Node cn = conceptNodeIndex.get(key);
for (Node parent : cn.getParents()) {
if (parent.getParents().contains(cn)) {
pairsToMerge.add(new Pair(cn, parent)); // depends on control dependency: [if], data = [none]
}
}
}
for (IntIterator itr = allAffected.keyIterator(); itr.hasNext();) {
final String key = factory.lookupConceptId(itr.next()).toString();
Node cn = conceptNodeIndex.get(key);
for (Node parent : cn.getParents()) {
if (parent.getParents().contains(cn)) {
pairsToMerge.add(new Pair(cn, parent)); // depends on control dependency: [if], data = [none]
}
}
}
Set<Node> affectedByMerge = new HashSet<Node>();
// Merge equivalents
for (Pair p : pairsToMerge) {
Node cn1 = p.getA();
Node cn2 = p.getB();
affectedByMerge.addAll(cn1.getChildren()); // depends on control dependency: [for], data = [none]
affectedByMerge.addAll(cn2.getChildren()); // depends on control dependency: [for], data = [none]
// Merge into cn1 - remove cn2 from index and replace with cn1
for (String n : cn2.getEquivalentConcepts()) {
conceptNodeIndex.put(n, cn1); // depends on control dependency: [for], data = [n]
}
cn1.getEquivalentConcepts().addAll(cn2.getEquivalentConcepts()); // depends on control dependency: [for], data = [p]
// Remove relationships between merged concepts
cn1.getParents().remove(cn2); // depends on control dependency: [for], data = [none]
cn2.getChildren().remove(cn1); // depends on control dependency: [for], data = [none]
cn2.getParents().remove(cn1); // depends on control dependency: [for], data = [none]
cn1.getChildren().remove(cn2); // depends on control dependency: [for], data = [none]
// Taxonomy is bidirectional
cn1.getParents().addAll(cn2.getParents()); // depends on control dependency: [for], data = [none]
for (Node parent : cn2.getParents()) {
parent.getChildren().remove(cn2); // depends on control dependency: [for], data = [parent]
parent.getChildren().add(cn1); // depends on control dependency: [for], data = [parent]
}
cn1.getChildren().addAll(cn2.getChildren()); // depends on control dependency: [for], data = [none]
for (Node child : cn2.getChildren()) {
child.getParents().remove(cn2); // depends on control dependency: [for], data = [child]
child.getParents().add(cn1); // depends on control dependency: [for], data = [child]
}
cn2 = null; // nothing should reference cn2 now // depends on control dependency: [for], data = [none]
}
// b. Fix all new and affected nodes
Set<Node> all = new HashSet<Node>();
for (IntIterator it = allNew.keyIterator(); it.hasNext();) {
all.add(conceptNodeIndex.get(factory.lookupConceptId(it.next()))); // depends on control dependency: [for], data = [it]
}
for (IntIterator it = allAffected.keyIterator(); it.hasNext();) {
all.add(conceptNodeIndex.get(factory.lookupConceptId(it.next()))); // depends on control dependency: [for], data = [it]
}
for (Node cn : affectedByMerge) {
all.add(cn); // depends on control dependency: [for], data = [cn]
}
// Add also the children of the affected nodes
Set<Node> childrenToAdd = new HashSet<Node>();
for (Node cn : all) {
for (Node ccn : cn.getChildren()) {
if (ccn.equals(bottomNode))
continue;
childrenToAdd.add(ccn); // depends on control dependency: [for], data = [ccn]
}
}
all.addAll(childrenToAdd); // depends on control dependency: [if], data = [none]
// Find redundant relationships
for (Node cn : all) {
Set<Node> ps = cn.getParents();
Object[] parents = ps.toArray(new Object[ps.size()]);
Set<Node> toRemove = new HashSet<Node>();
for (int i = 0; i < parents.length; i++) {
for (int j = i + 1; j < parents.length; j++) {
if (isChild((Node)parents[j], (Node)parents[i])) {
toRemove.add((Node)parents[i]); // depends on control dependency: [if], data = [none]
continue;
}
if (isChild((Node)parents[i], (Node)parents[j])) {
toRemove.add((Node)parents[j]); // depends on control dependency: [if], data = [none]
continue;
}
}
}
for (Node tr : toRemove) {
cn.getParents().remove(tr); // depends on control dependency: [for], data = [tr]
tr.getChildren().remove(cn); // depends on control dependency: [for], data = [tr]
}
}
// 5. Connect bottom to new and affected concepts with no children
for (IntIterator itr = allNew.keyIterator(); itr.hasNext();) {
final int key = itr.next();
Node cn = conceptNodeIndex.get(factory.lookupConceptId(key));
if (cn.getChildren().isEmpty()) {
cn.getChildren().add(bottomNode); // depends on control dependency: [if], data = [none]
bottomNode.getParents().add(cn); // depends on control dependency: [if], data = [none]
}
}
for (IntIterator itr = allAffected.keyIterator(); itr.hasNext();) {
final int key = itr.next();
Node cn = conceptNodeIndex.get(factory.lookupConceptId(key));
if (cn.getChildren().isEmpty()) {
cn.getChildren().add(bottomNode); // depends on control dependency: [if], data = [none]
bottomNode.getParents().add(cn); // depends on control dependency: [if], data = [none]
}
}
// 6. Connect the top node to new and affected concepts with no parents
for (IntIterator itr = allNew.keyIterator(); itr.hasNext();) {
final int key = itr.next();
Node cn = conceptNodeIndex.get(factory.lookupConceptId(key));
if (cn.getParents().isEmpty()) {
cn.getParents().add(topNode); // depends on control dependency: [if], data = [none]
topNode.getChildren().add(cn); // depends on control dependency: [if], data = [none]
}
}
for (IntIterator itr = allAffected.keyIterator(); itr.hasNext();) {
final int key = itr.next();
Node cn = conceptNodeIndex.get(factory.lookupConceptId(key));
if (cn.getParents().isEmpty()) {
cn.getParents().add(topNode); // depends on control dependency: [if], data = [none]
topNode.getChildren().add(cn); // depends on control dependency: [if], data = [none]
}
}
}
} }
|
public class class_name {
public static void setCol(final double[][] m1, final int c, final double[] column) {
assert column.length == m1.length : ERR_DIMENSIONS;
for(int i = 0; i < m1.length; i++) {
m1[i][c] = column[i];
}
} }
|
public class class_name {
public static void setCol(final double[][] m1, final int c, final double[] column) {
assert column.length == m1.length : ERR_DIMENSIONS;
for(int i = 0; i < m1.length; i++) {
m1[i][c] = column[i]; // depends on control dependency: [for], data = [i]
}
} }
|
public class class_name {
public IRObject getReference() {
if (ref == null) {
ref = org.omg.CORBA.SequenceDefHelper.narrow(
servantToReference(new SequenceDefPOATie(this)));
}
return ref;
} }
|
public class class_name {
public IRObject getReference() {
if (ref == null) {
ref = org.omg.CORBA.SequenceDefHelper.narrow(
servantToReference(new SequenceDefPOATie(this))); // depends on control dependency: [if], data = [none]
}
return ref;
} }
|
public class class_name {
public List<CmsDetailPageInfo> toList() {
List<CmsDetailPageInfo> result = new ArrayList<CmsDetailPageInfo>();
for (String key : m_map.keySet()) {
for (CmsDetailPageInfo info : m_map.get(key)) {
result.add(info);
}
}
return result;
} }
|
public class class_name {
public List<CmsDetailPageInfo> toList() {
List<CmsDetailPageInfo> result = new ArrayList<CmsDetailPageInfo>();
for (String key : m_map.keySet()) {
for (CmsDetailPageInfo info : m_map.get(key)) {
result.add(info); // depends on control dependency: [for], data = [info]
}
}
return result;
} }
|
public class class_name {
public static <T> T[] insertIntoArrayAt(T item, T[] items, int idx, Class<T> tClass) {
// Make an array that's one bigger. It's too bad that the JVM bothers to
// initialize this with nulls.
@SuppressWarnings("unchecked")
T[] newItems = (T[]) ((tClass == null) ? new Object[items.length + 1]
: Array.newInstance(tClass, items.length + 1) );
// If we aren't inserting at the first item, array-copy the items before the insert
// point.
if (idx > 0) {
System.arraycopy(items, 0, newItems, 0, idx);
}
// Insert the new item.
newItems[idx] = item;
// If we aren't inserting at the last item, array-copy the items after the insert
// point.
if (idx < items.length) {
System.arraycopy(items, idx, newItems, idx + 1, items.length - idx);
}
return newItems;
} }
|
public class class_name {
public static <T> T[] insertIntoArrayAt(T item, T[] items, int idx, Class<T> tClass) {
// Make an array that's one bigger. It's too bad that the JVM bothers to
// initialize this with nulls.
@SuppressWarnings("unchecked")
T[] newItems = (T[]) ((tClass == null) ? new Object[items.length + 1]
: Array.newInstance(tClass, items.length + 1) );
// If we aren't inserting at the first item, array-copy the items before the insert
// point.
if (idx > 0) {
System.arraycopy(items, 0, newItems, 0, idx); // depends on control dependency: [if], data = [none]
}
// Insert the new item.
newItems[idx] = item;
// If we aren't inserting at the last item, array-copy the items after the insert
// point.
if (idx < items.length) {
System.arraycopy(items, idx, newItems, idx + 1, items.length - idx); // depends on control dependency: [if], data = [none]
}
return newItems;
} }
|
public class class_name {
protected static void multTransBBlockMinus_L( double[] dataA, double []dataC,
int indexA, int indexB, int indexC,
final int widthA, final int heightA, final int widthC ) {
// for( int i = 0; i < heightA; i++ ) {
// for( int j = 0; j <= i; j++ ) {
// double sum = 0;
// for( int k = 0; k < widthA; k++ ) {
// sum += dataA[i*widthA + k + indexA] * dataA[j*widthA + k + indexB];
// }
// dataC[ i*widthC + j + indexC ] -= sum;
// }
// }
for( int i = 0; i < heightA; i++ ) {
int rowA = i*widthA+indexA;
int endA = rowA + widthA;
int rowB = indexB;
int rowC = i*widthC + indexC;
for( int j = 0; j <= i; j++ , rowB += widthA) {
double sum = 0;
int a = rowA;
int b = rowB;
while( a != endA ) {
sum += dataA[a++] * dataA[b++];
}
dataC[ rowC + j ] -= sum;
}
}
} }
|
public class class_name {
protected static void multTransBBlockMinus_L( double[] dataA, double []dataC,
int indexA, int indexB, int indexC,
final int widthA, final int heightA, final int widthC ) {
// for( int i = 0; i < heightA; i++ ) {
// for( int j = 0; j <= i; j++ ) {
// double sum = 0;
// for( int k = 0; k < widthA; k++ ) {
// sum += dataA[i*widthA + k + indexA] * dataA[j*widthA + k + indexB];
// }
// dataC[ i*widthC + j + indexC ] -= sum;
// }
// }
for( int i = 0; i < heightA; i++ ) {
int rowA = i*widthA+indexA;
int endA = rowA + widthA;
int rowB = indexB;
int rowC = i*widthC + indexC;
for( int j = 0; j <= i; j++ , rowB += widthA) {
double sum = 0;
int a = rowA;
int b = rowB;
while( a != endA ) {
sum += dataA[a++] * dataA[b++]; // depends on control dependency: [while], data = [none]
}
dataC[ rowC + j ] -= sum; // depends on control dependency: [for], data = [j]
}
}
} }
|
public class class_name {
@Override
public ObjectData compileObjectType(Set<String> filter, Boolean includeAllowableActions,
ObjectInfoHandler objectInfos, boolean requiresObjectInfo) {
try {
ObjectDataImpl result = new ObjectDataImpl();
ObjectInfoImpl objectInfo = new ObjectInfoImpl();
PropertiesImpl properties = new PropertiesImpl();
filter = filter == null ? null : new HashSet<>(filter);
compileProperties(properties, filter, objectInfo);
result.setProperties(properties);
if (Boolean.TRUE.equals(includeAllowableActions)) {
result.setAllowableActions(getAllowableActions());
}
if (requiresObjectInfo) {
objectInfo.setObject(result);
objectInfos.addObjectInfo(objectInfo);
}
return result;
} catch (RepositoryException e) {
throw new CmisRuntimeException(e.getMessage(), e);
}
} }
|
public class class_name {
@Override
public ObjectData compileObjectType(Set<String> filter, Boolean includeAllowableActions,
ObjectInfoHandler objectInfos, boolean requiresObjectInfo) {
try {
ObjectDataImpl result = new ObjectDataImpl();
ObjectInfoImpl objectInfo = new ObjectInfoImpl();
PropertiesImpl properties = new PropertiesImpl();
filter = filter == null ? null : new HashSet<>(filter); // depends on control dependency: [try], data = [none]
compileProperties(properties, filter, objectInfo); // depends on control dependency: [try], data = [none]
result.setProperties(properties); // depends on control dependency: [try], data = [none]
if (Boolean.TRUE.equals(includeAllowableActions)) {
result.setAllowableActions(getAllowableActions()); // depends on control dependency: [if], data = [none]
}
if (requiresObjectInfo) {
objectInfo.setObject(result); // depends on control dependency: [if], data = [none]
objectInfos.addObjectInfo(objectInfo); // depends on control dependency: [if], data = [none]
}
return result; // depends on control dependency: [try], data = [none]
} catch (RepositoryException e) {
throw new CmisRuntimeException(e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public Transition getNextTransition(ExecutionElement currentElem, List<ExecutionElement> peerExecutionElements, ExecutionStatus currentStatus)
throws IllegalTransitionException {
final String method = "getNextTransition";
if (logger.isLoggable(Level.FINE)) {
logger.fine(method + " ,currentStatus=" + currentStatus);
}
Transition returnTransition = new TransitionImpl();
ExecutionElement nextExecutionElement = null;
List<TransitionElement> transitionElements = currentElem.getTransitionElements();
// Check the transition elements first.
if (!transitionElements.isEmpty()) {
for (TransitionElement t : transitionElements) {
logger.fine(method + " Trying to match next transition element: " + t);
boolean isMatched = matchExitStatusAgainstOnAttribute(currentStatus.getExitStatus(), t);
if (isMatched) {
if (t instanceof Next) {
Next next = (Next)t;
nextExecutionElement = getExecutionElementFromId(peerExecutionElements, next.getTo());
returnTransition.setNextExecutionElement(nextExecutionElement);
break;
} else {
returnTransition.setTransitionElement(t);
}
return returnTransition;
}
}
}
// We've returned already if we matched a Stop, End or Fail
if (nextExecutionElement == null) {
if (currentStatus.getExtendedBatchStatus().equals(ExtendedBatchStatus.EXCEPTION_THROWN)) {
logger.fine("Didn't match transition element, after exception thrown. Need to fail job");
returnTransition.setNoTransitionElementMatchAfterException();
return returnTransition;
} else {
logger.fine("Didn't match transition element, check @next attribute now.");
nextExecutionElement = getNextExecutionElemFromAttribute(peerExecutionElements, currentElem);
returnTransition.setNextExecutionElement(nextExecutionElement);
}
}
if (nextExecutionElement != null) {
if (alreadyExecutedElements.containsKey(nextExecutionElement.getId())) {
String errorMsg = "Execution loop detected !!! Trying to re-execute execution element: " + nextExecutionElement.getId();
logger.severe(errorMsg);
throw new IllegalTransitionException(errorMsg);
}
if (!disallowDecisionLoopback) {
// We allow repeating a decision
if (!(nextExecutionElement instanceof Decision)) {
alreadyExecutedElements.put(nextExecutionElement.getId(), nextExecutionElement);
}
} else {
alreadyExecutedElements.put(nextExecutionElement.getId(), nextExecutionElement);
}
logger.fine(method + " Transitioning to next element id = " + nextExecutionElement.getId());
} else {
logger.fine(method + " There is no next execution element. Mark transition to show we're finished.");
returnTransition.setFinishedTransitioning();
}
return returnTransition;
} }
|
public class class_name {
public Transition getNextTransition(ExecutionElement currentElem, List<ExecutionElement> peerExecutionElements, ExecutionStatus currentStatus)
throws IllegalTransitionException {
final String method = "getNextTransition";
if (logger.isLoggable(Level.FINE)) {
logger.fine(method + " ,currentStatus=" + currentStatus);
}
Transition returnTransition = new TransitionImpl();
ExecutionElement nextExecutionElement = null;
List<TransitionElement> transitionElements = currentElem.getTransitionElements();
// Check the transition elements first.
if (!transitionElements.isEmpty()) {
for (TransitionElement t : transitionElements) {
logger.fine(method + " Trying to match next transition element: " + t);
boolean isMatched = matchExitStatusAgainstOnAttribute(currentStatus.getExitStatus(), t);
if (isMatched) {
if (t instanceof Next) {
Next next = (Next)t;
nextExecutionElement = getExecutionElementFromId(peerExecutionElements, next.getTo());
// depends on control dependency: [if], data = [none]
returnTransition.setNextExecutionElement(nextExecutionElement);
// depends on control dependency: [if], data = [none]
break;
} else {
returnTransition.setTransitionElement(t);
// depends on control dependency: [if], data = [none]
}
return returnTransition;
// depends on control dependency: [if], data = [none]
}
}
}
// We've returned already if we matched a Stop, End or Fail
if (nextExecutionElement == null) {
if (currentStatus.getExtendedBatchStatus().equals(ExtendedBatchStatus.EXCEPTION_THROWN)) {
logger.fine("Didn't match transition element, after exception thrown. Need to fail job");
returnTransition.setNoTransitionElementMatchAfterException();
return returnTransition;
} else {
logger.fine("Didn't match transition element, check @next attribute now.");
nextExecutionElement = getNextExecutionElemFromAttribute(peerExecutionElements, currentElem);
returnTransition.setNextExecutionElement(nextExecutionElement);
}
}
if (nextExecutionElement != null) {
if (alreadyExecutedElements.containsKey(nextExecutionElement.getId())) {
String errorMsg = "Execution loop detected !!! Trying to re-execute execution element: " + nextExecutionElement.getId();
logger.severe(errorMsg);
throw new IllegalTransitionException(errorMsg);
}
if (!disallowDecisionLoopback) {
// We allow repeating a decision
if (!(nextExecutionElement instanceof Decision)) {
alreadyExecutedElements.put(nextExecutionElement.getId(), nextExecutionElement);
}
} else {
alreadyExecutedElements.put(nextExecutionElement.getId(), nextExecutionElement);
}
logger.fine(method + " Transitioning to next element id = " + nextExecutionElement.getId());
} else {
logger.fine(method + " There is no next execution element. Mark transition to show we're finished.");
returnTransition.setFinishedTransitioning();
}
return returnTransition;
} }
|
public class class_name {
private void initGraphics() {
if (Double.compare(getPrefWidth(), 0.0) <= 0 || Double.compare(getPrefHeight(), 0.0) <= 0 || Double.compare(getWidth(), 0.0) <= 0 ||
Double.compare(getHeight(), 0.0) <= 0) {
if (getPrefWidth() > 0 && getPrefHeight() > 0) {
setPrefSize(getPrefWidth(), getPrefHeight());
} else {
setPrefSize(PREFERRED_WIDTH, PREFERRED_HEIGHT);
}
}
segmentPane = new Pane();
chartCanvas = new Canvas(PREFERRED_WIDTH, PREFERRED_HEIGHT);
chartCanvas.setMouseTransparent(true);
chartCtx = chartCanvas.getGraphicsContext2D();
pane = new Pane(segmentPane, chartCanvas);
pane.setBackground(new Background(new BackgroundFill(backgroundPaint, CornerRadii.EMPTY, Insets.EMPTY)));
pane.setBorder(new Border(new BorderStroke(borderPaint, BorderStrokeStyle.SOLID, CornerRadii.EMPTY, new BorderWidths(borderWidth))));
getChildren().setAll(pane);
prepareData();
} }
|
public class class_name {
private void initGraphics() {
if (Double.compare(getPrefWidth(), 0.0) <= 0 || Double.compare(getPrefHeight(), 0.0) <= 0 || Double.compare(getWidth(), 0.0) <= 0 ||
Double.compare(getHeight(), 0.0) <= 0) {
if (getPrefWidth() > 0 && getPrefHeight() > 0) {
setPrefSize(getPrefWidth(), getPrefHeight()); // depends on control dependency: [if], data = [(getPrefWidth()]
} else {
setPrefSize(PREFERRED_WIDTH, PREFERRED_HEIGHT); // depends on control dependency: [if], data = [none]
}
}
segmentPane = new Pane();
chartCanvas = new Canvas(PREFERRED_WIDTH, PREFERRED_HEIGHT);
chartCanvas.setMouseTransparent(true);
chartCtx = chartCanvas.getGraphicsContext2D();
pane = new Pane(segmentPane, chartCanvas);
pane.setBackground(new Background(new BackgroundFill(backgroundPaint, CornerRadii.EMPTY, Insets.EMPTY)));
pane.setBorder(new Border(new BorderStroke(borderPaint, BorderStrokeStyle.SOLID, CornerRadii.EMPTY, new BorderWidths(borderWidth))));
getChildren().setAll(pane);
prepareData();
} }
|
public class class_name {
public static List <NameValuePair> parse (
final HttpEntity entity) throws IOException {
ContentType contentType = ContentType.get(entity);
if (contentType != null && contentType.getMimeType().equalsIgnoreCase(CONTENT_TYPE)) {
String content = EntityUtils.toString(entity, Consts.ASCII);
if (content != null && content.length() > 0) {
Charset charset = contentType.getCharset();
if (charset == null) {
charset = HTTP.DEF_CONTENT_CHARSET;
}
return parse(content, charset);
}
}
return Collections.emptyList();
} }
|
public class class_name {
public static List <NameValuePair> parse (
final HttpEntity entity) throws IOException {
ContentType contentType = ContentType.get(entity);
if (contentType != null && contentType.getMimeType().equalsIgnoreCase(CONTENT_TYPE)) {
String content = EntityUtils.toString(entity, Consts.ASCII);
if (content != null && content.length() > 0) {
Charset charset = contentType.getCharset();
if (charset == null) {
charset = HTTP.DEF_CONTENT_CHARSET; // depends on control dependency: [if], data = [none]
}
return parse(content, charset); // depends on control dependency: [if], data = [(content]
}
}
return Collections.emptyList();
} }
|
public class class_name {
public ReviewReport withReviewActions(ReviewActionDetail... reviewActions) {
if (this.reviewActions == null) {
setReviewActions(new java.util.ArrayList<ReviewActionDetail>(reviewActions.length));
}
for (ReviewActionDetail ele : reviewActions) {
this.reviewActions.add(ele);
}
return this;
} }
|
public class class_name {
public ReviewReport withReviewActions(ReviewActionDetail... reviewActions) {
if (this.reviewActions == null) {
setReviewActions(new java.util.ArrayList<ReviewActionDetail>(reviewActions.length)); // depends on control dependency: [if], data = [none]
}
for (ReviewActionDetail ele : reviewActions) {
this.reviewActions.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} }
|
public class class_name {
public String next() throws java.io.IOException {
int zzInput;
int zzAction;
// cached fields:
int zzCurrentPosL;
int zzMarkedPosL;
int zzEndReadL = zzEndRead;
char [] zzBufferL = zzBuffer;
char [] zzCMapL = ZZ_CMAP;
int [] zzTransL = ZZ_TRANS;
int [] zzRowMapL = ZZ_ROWMAP;
int [] zzAttrL = ZZ_ATTRIBUTE;
while (true) {
zzMarkedPosL = zzMarkedPos;
zzAction = -1;
zzCurrentPosL = zzCurrentPos = zzStartRead = zzMarkedPosL;
zzState = ZZ_LEXSTATE[zzLexicalState];
zzForAction: {
while (true) {
if (zzCurrentPosL < zzEndReadL)
zzInput = zzBufferL[zzCurrentPosL++];
else if (zzAtEOF) {
zzInput = YYEOF;
break zzForAction;
}
else {
// store back cached positions
zzCurrentPos = zzCurrentPosL;
zzMarkedPos = zzMarkedPosL;
boolean eof = zzRefill();
// get translated positions and possibly new buffer
zzCurrentPosL = zzCurrentPos;
zzMarkedPosL = zzMarkedPos;
zzBufferL = zzBuffer;
zzEndReadL = zzEndRead;
if (eof) {
zzInput = YYEOF;
break zzForAction;
}
else {
zzInput = zzBufferL[zzCurrentPosL++];
}
}
int zzNext = zzTransL[ zzRowMapL[zzState] + zzCMapL[zzInput] ];
if (zzNext == -1) break zzForAction;
zzState = zzNext;
int zzAttributes = zzAttrL[zzState];
if ( (zzAttributes & 1) == 1 ) {
zzAction = zzState;
zzMarkedPosL = zzCurrentPosL;
if ( (zzAttributes & 8) == 8 ) break zzForAction;
}
}
}
// store back cached position
zzMarkedPos = zzMarkedPosL;
switch (zzAction < 0 ? zzAction : ZZ_ACTION[zzAction]) {
case 21:
{ return("n't");
}
case 31: break;
case 28:
// lookahead expression with fixed lookahead length
yypushback(2);
{ return yytext();
}
case 32: break;
case 27:
// lookahead expression with fixed lookahead length
yypushback(1);
{ return yytext();
}
case 33: break;
case 26:
// lookahead expression with fixed lookahead length
yypushback(1);
{ return yytext();
}
case 34: break;
case 12:
{ return "/";
}
case 35: break;
case 5:
{ return yytext();
}
case 36: break;
case 3:
{ return "&";
}
case 37: break;
case 6:
{ yybegin(YYINITIAL); return "\"";
}
case 38: break;
case 13:
{ return "(";
}
case 39: break;
case 8:
{ return(")");
}
case 40: break;
case 22:
{ return "<";
}
case 41: break;
case 23:
{ return ">";
}
case 42: break;
case 29:
{ return "cannot";
}
case 43: break;
case 1:
{ return(yytext());
}
case 44: break;
case 20:
// lookahead expression with fixed lookahead length
yypushback(2);
{ return "\"";
}
case 45: break;
case 16:
// lookahead expression with fixed lookahead length
yypushback(1);
{ return "\"";
}
case 46: break;
case 17:
{ return "\"";
}
case 47: break;
case 11:
{ return("`");
}
case 48: break;
case 14:
{ return("{");
}
case 49: break;
case 19:
{ return("\"");
}
case 50: break;
case 15:
{ return("$");
}
case 51: break;
case 7:
{ return(yytext().substring(1, yytext().length()));
}
case 52: break;
case 24:
// lookahead expression with fixed lookahead length
yypushback(1);
{ yybegin(INQUOTE); return "\" \"";
}
case 53: break;
case 10:
{ return("%");
}
case 54: break;
case 4:
{ yybegin(YYINITIAL); return(yytext());
}
case 55: break;
case 9:
{ return("}");
}
case 56: break;
case 30:
// lookahead expression with fixed lookahead length
yypushback(1);
{ return removeWhite(yytext());
}
case 57: break;
case 25:
{ return removeWhite(yytext());
}
case 58: break;
case 18:
// lookahead expression with fixed lookahead length
yypushback(1);
{ yybegin(INQUOTE); return "\"";
}
case 59: break;
case 2:
{ yybegin(INQUOTE); return "\"";
}
case 60: break;
default:
if (zzInput == YYEOF && zzStartRead == zzCurrentPos) {
zzAtEOF = true;
{
return null;
}
}
else {
zzScanError(ZZ_NO_MATCH);
}
}
}
} }
|
public class class_name {
public String next() throws java.io.IOException {
int zzInput;
int zzAction;
// cached fields:
int zzCurrentPosL;
int zzMarkedPosL;
int zzEndReadL = zzEndRead;
char [] zzBufferL = zzBuffer;
char [] zzCMapL = ZZ_CMAP;
int [] zzTransL = ZZ_TRANS;
int [] zzRowMapL = ZZ_ROWMAP;
int [] zzAttrL = ZZ_ATTRIBUTE;
while (true) {
zzMarkedPosL = zzMarkedPos;
zzAction = -1;
zzCurrentPosL = zzCurrentPos = zzStartRead = zzMarkedPosL;
zzState = ZZ_LEXSTATE[zzLexicalState];
zzForAction: {
while (true) {
if (zzCurrentPosL < zzEndReadL)
zzInput = zzBufferL[zzCurrentPosL++];
else if (zzAtEOF) {
zzInput = YYEOF;
// depends on control dependency: [if], data = [none]
break zzForAction;
}
else {
// store back cached positions
zzCurrentPos = zzCurrentPosL;
// depends on control dependency: [if], data = [none]
zzMarkedPos = zzMarkedPosL;
// depends on control dependency: [if], data = [none]
boolean eof = zzRefill();
// get translated positions and possibly new buffer
zzCurrentPosL = zzCurrentPos;
// depends on control dependency: [if], data = [none]
zzMarkedPosL = zzMarkedPos;
// depends on control dependency: [if], data = [none]
zzBufferL = zzBuffer;
// depends on control dependency: [if], data = [none]
zzEndReadL = zzEndRead;
// depends on control dependency: [if], data = [none]
if (eof) {
zzInput = YYEOF;
// depends on control dependency: [if], data = [none]
break zzForAction;
}
else {
zzInput = zzBufferL[zzCurrentPosL++];
// depends on control dependency: [if], data = [none]
}
}
int zzNext = zzTransL[ zzRowMapL[zzState] + zzCMapL[zzInput] ];
if (zzNext == -1) break zzForAction;
zzState = zzNext;
// depends on control dependency: [while], data = [none]
int zzAttributes = zzAttrL[zzState];
if ( (zzAttributes & 1) == 1 ) {
zzAction = zzState;
// depends on control dependency: [if], data = [none]
zzMarkedPosL = zzCurrentPosL;
// depends on control dependency: [if], data = [none]
if ( (zzAttributes & 8) == 8 ) break zzForAction;
}
}
}
// store back cached position
zzMarkedPos = zzMarkedPosL;
switch (zzAction < 0 ? zzAction : ZZ_ACTION[zzAction]) {
case 21:
{ return("n't");
}
case 31: break;
case 28:
// lookahead expression with fixed lookahead length
yypushback(2);
{ return yytext();
}
case 32: break;
case 27:
// lookahead expression with fixed lookahead length
yypushback(1);
{ return yytext();
}
case 33: break;
case 26:
// lookahead expression with fixed lookahead length
yypushback(1);
{ return yytext();
}
case 34: break;
case 12:
{ return "/";
}
case 35: break;
case 5:
{ return yytext();
}
case 36: break;
case 3:
{ return "&";
}
case 37: break;
case 6:
{ yybegin(YYINITIAL); return "\"";
}
case 38: break;
case 13:
{ return "(";
}
case 39: break;
case 8:
{ return(")");
}
case 40: break;
case 22:
{ return "<";
}
case 41: break;
case 23:
{ return ">";
}
case 42: break;
case 29:
{ return "cannot";
}
case 43: break;
case 1:
{ return(yytext());
}
case 44: break;
case 20:
// lookahead expression with fixed lookahead length
yypushback(2);
{ return "\"";
}
case 45: break;
case 16:
// lookahead expression with fixed lookahead length
yypushback(1);
{ return "\"";
}
case 46: break;
case 17:
{ return "\"";
}
case 47: break;
case 11:
{ return("`");
}
case 48: break;
case 14:
{ return("{");
}
case 49: break;
case 19:
{ return("\"");
}
case 50: break;
case 15:
{ return("$");
}
case 51: break;
case 7:
{ return(yytext().substring(1, yytext().length()));
}
case 52: break;
case 24:
// lookahead expression with fixed lookahead length
yypushback(1);
{ yybegin(INQUOTE); return "\" \"";
}
case 53: break;
case 10:
{ return("%");
}
case 54: break;
case 4:
{ yybegin(YYINITIAL); return(yytext());
}
case 55: break;
case 9:
{ return("}");
}
case 56: break;
case 30:
// lookahead expression with fixed lookahead length
yypushback(1);
{ return removeWhite(yytext());
}
case 57: break;
case 25:
{ return removeWhite(yytext());
}
case 58: break;
case 18:
// lookahead expression with fixed lookahead length
yypushback(1);
{ yybegin(INQUOTE); return "\"";
}
case 59: break;
case 2:
{ yybegin(INQUOTE); return "\"";
}
case 60: break;
default:
if (zzInput == YYEOF && zzStartRead == zzCurrentPos) {
zzAtEOF = true;
{
return null;
}
}
else {
zzScanError(ZZ_NO_MATCH);
}
}
}
} }
|
public class class_name {
private void populateCqlVersion(Map<String, Object> externalProperties) {
String cqlVersion =
externalProperties != null ? (String) externalProperties.get(CassandraConstants.CQL_VERSION) : null;
if (cqlVersion == null || !(cqlVersion != null && (cqlVersion.equals(CassandraConstants.CQL_VERSION_2_0)
|| cqlVersion.equals(CassandraConstants.CQL_VERSION_3_0)))) {
cqlVersion = (CassandraPropertyReader.csmd != null ? CassandraPropertyReader.csmd.getCqlVersion()
: CassandraConstants.CQL_VERSION_2_0);
}
if (cqlVersion.equals(CassandraConstants.CQL_VERSION_3_0)) {
setCqlVersion(CassandraConstants.CQL_VERSION_3_0);
} else {
setCqlVersion(CassandraConstants.CQL_VERSION_2_0);
}
} }
|
public class class_name {
private void populateCqlVersion(Map<String, Object> externalProperties) {
String cqlVersion =
externalProperties != null ? (String) externalProperties.get(CassandraConstants.CQL_VERSION) : null;
if (cqlVersion == null || !(cqlVersion != null && (cqlVersion.equals(CassandraConstants.CQL_VERSION_2_0)
|| cqlVersion.equals(CassandraConstants.CQL_VERSION_3_0)))) {
cqlVersion = (CassandraPropertyReader.csmd != null ? CassandraPropertyReader.csmd.getCqlVersion()
: CassandraConstants.CQL_VERSION_2_0); // depends on control dependency: [if], data = [none]
}
if (cqlVersion.equals(CassandraConstants.CQL_VERSION_3_0)) {
setCqlVersion(CassandraConstants.CQL_VERSION_3_0); // depends on control dependency: [if], data = [none]
} else {
setCqlVersion(CassandraConstants.CQL_VERSION_2_0); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
void addFileName(final String fileName) {
writeLock.lock();
try {
final FileListCacheValue fileList = getFileList();
boolean done = fileList.add(fileName);
if (done) {
updateFileList(fileList);
if (trace)
log.trace("Updated file listing: added " + fileName);
}
} finally {
writeLock.unlock();
}
} }
|
public class class_name {
void addFileName(final String fileName) {
writeLock.lock();
try {
final FileListCacheValue fileList = getFileList();
boolean done = fileList.add(fileName);
if (done) {
updateFileList(fileList); // depends on control dependency: [if], data = [none]
if (trace)
log.trace("Updated file listing: added " + fileName);
}
} finally {
writeLock.unlock();
}
} }
|
public class class_name {
private void processCustomFieldValues()
{
byte[] data = m_projectProps.getByteArray(Props.TASK_FIELD_ATTRIBUTES);
if (data != null)
{
int index = 0;
int offset = 0;
// First the length
int length = MPPUtility.getInt(data, offset);
offset += 4;
// Then the number of custom value lists
int numberOfValueLists = MPPUtility.getInt(data, offset);
offset += 4;
// Then the value lists themselves
FieldType field;
int valueListOffset = 0;
while (index < numberOfValueLists && offset < length)
{
// Each item consists of the Field ID (4 bytes) and the offset to the value list (4 bytes)
// Get the Field
field = FieldTypeHelper.getInstance(MPPUtility.getInt(data, offset));
offset += 4;
// Get the value list offset
valueListOffset = MPPUtility.getInt(data, offset);
offset += 4;
// Read the value list itself
if (valueListOffset < data.length)
{
int tempOffset = valueListOffset;
tempOffset += 8;
// Get the data offset
int dataOffset = MPPUtility.getInt(data, tempOffset) + valueListOffset;
tempOffset += 4;
// Get the end of the data offset
int endDataOffset = MPPUtility.getInt(data, tempOffset) + valueListOffset;
tempOffset += 4;
// Get the end of the description
int endDescriptionOffset = MPPUtility.getInt(data, tempOffset) + valueListOffset;
// Get the values themselves
int valuesLength = endDataOffset - dataOffset;
byte[] values = new byte[valuesLength];
MPPUtility.getByteArray(data, dataOffset, valuesLength, values, 0);
// Get the descriptions
int descriptionsLength = endDescriptionOffset - endDataOffset;
byte[] descriptions = new byte[descriptionsLength];
MPPUtility.getByteArray(data, endDataOffset, descriptionsLength, descriptions, 0);
populateContainer(field, values, descriptions);
}
index++;
}
}
} }
|
public class class_name {
private void processCustomFieldValues()
{
byte[] data = m_projectProps.getByteArray(Props.TASK_FIELD_ATTRIBUTES);
if (data != null)
{
int index = 0;
int offset = 0;
// First the length
int length = MPPUtility.getInt(data, offset);
offset += 4; // depends on control dependency: [if], data = [none]
// Then the number of custom value lists
int numberOfValueLists = MPPUtility.getInt(data, offset);
offset += 4; // depends on control dependency: [if], data = [none]
// Then the value lists themselves
FieldType field;
int valueListOffset = 0;
while (index < numberOfValueLists && offset < length)
{
// Each item consists of the Field ID (4 bytes) and the offset to the value list (4 bytes)
// Get the Field
field = FieldTypeHelper.getInstance(MPPUtility.getInt(data, offset)); // depends on control dependency: [while], data = [none]
offset += 4; // depends on control dependency: [while], data = [none]
// Get the value list offset
valueListOffset = MPPUtility.getInt(data, offset); // depends on control dependency: [while], data = [none]
offset += 4; // depends on control dependency: [while], data = [none]
// Read the value list itself
if (valueListOffset < data.length)
{
int tempOffset = valueListOffset;
tempOffset += 8; // depends on control dependency: [if], data = [none]
// Get the data offset
int dataOffset = MPPUtility.getInt(data, tempOffset) + valueListOffset;
tempOffset += 4; // depends on control dependency: [if], data = [none]
// Get the end of the data offset
int endDataOffset = MPPUtility.getInt(data, tempOffset) + valueListOffset;
tempOffset += 4; // depends on control dependency: [if], data = [none]
// Get the end of the description
int endDescriptionOffset = MPPUtility.getInt(data, tempOffset) + valueListOffset;
// Get the values themselves
int valuesLength = endDataOffset - dataOffset;
byte[] values = new byte[valuesLength];
MPPUtility.getByteArray(data, dataOffset, valuesLength, values, 0); // depends on control dependency: [if], data = [none]
// Get the descriptions
int descriptionsLength = endDescriptionOffset - endDataOffset;
byte[] descriptions = new byte[descriptionsLength];
MPPUtility.getByteArray(data, endDataOffset, descriptionsLength, descriptions, 0); // depends on control dependency: [if], data = [none]
populateContainer(field, values, descriptions); // depends on control dependency: [if], data = [none]
}
index++; // depends on control dependency: [while], data = [none]
}
}
} }
|
public class class_name {
@Override
public void close(String namespace)
{
if (config.isEvictOnClose()) {
cache.asMap().keySet().removeIf(key -> key.namespace.equals(namespace));
}
} }
|
public class class_name {
@Override
public void close(String namespace)
{
if (config.isEvictOnClose()) {
cache.asMap().keySet().removeIf(key -> key.namespace.equals(namespace)); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public ServiceCall<Grammar> getGrammar(GetGrammarOptions getGrammarOptions) {
Validator.notNull(getGrammarOptions, "getGrammarOptions cannot be null");
String[] pathSegments = { "v1/customizations", "grammars" };
String[] pathParameters = { getGrammarOptions.customizationId(), getGrammarOptions.grammarName() };
RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments,
pathParameters));
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("speech_to_text", "v1", "getGrammar");
for (Entry<String, String> header : sdkHeaders.entrySet()) {
builder.header(header.getKey(), header.getValue());
}
builder.header("Accept", "application/json");
return createServiceCall(builder.build(), ResponseConverterUtils.getObject(Grammar.class));
} }
|
public class class_name {
public ServiceCall<Grammar> getGrammar(GetGrammarOptions getGrammarOptions) {
Validator.notNull(getGrammarOptions, "getGrammarOptions cannot be null");
String[] pathSegments = { "v1/customizations", "grammars" };
String[] pathParameters = { getGrammarOptions.customizationId(), getGrammarOptions.grammarName() };
RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments,
pathParameters));
Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("speech_to_text", "v1", "getGrammar");
for (Entry<String, String> header : sdkHeaders.entrySet()) {
builder.header(header.getKey(), header.getValue()); // depends on control dependency: [for], data = [header]
}
builder.header("Accept", "application/json");
return createServiceCall(builder.build(), ResponseConverterUtils.getObject(Grammar.class));
} }
|
public class class_name {
@Override
public InvocationResponse sendActivity(SPFActivity activity) {
Utils.logCall(TAG, "sendActivity", activity);
InvocationResponse response;
try {
response = SPF.get().getServiceRegistry().sendActivity(activity);
} catch (Throwable t) {
response = InvocationResponse.error("remote exception : " + t.getMessage());
}
return response;
} }
|
public class class_name {
@Override
public InvocationResponse sendActivity(SPFActivity activity) {
Utils.logCall(TAG, "sendActivity", activity);
InvocationResponse response;
try {
response = SPF.get().getServiceRegistry().sendActivity(activity); // depends on control dependency: [try], data = [none]
} catch (Throwable t) {
response = InvocationResponse.error("remote exception : " + t.getMessage());
} // depends on control dependency: [catch], data = [none]
return response;
} }
|
public class class_name {
@Override
public MeasureModel buildMeasureModel(InvocationStat invocationStat) {
InvocationStatDimension statDimension = invocationStat.getDimension();
String key = statDimension.getDimensionKey();
MeasureModel measureModel = appServiceMeasureModels.get(key);
if (measureModel == null) {
measureModel = new MeasureModel(statDimension.getAppName(), statDimension.getService());
MeasureModel oldMeasureModel = appServiceMeasureModels.putIfAbsent(key, measureModel);
if (oldMeasureModel == null) {
measureModel.addInvocationStat(invocationStat);
return measureModel;
} else {
oldMeasureModel.addInvocationStat(invocationStat);
return null;
}
} else {
measureModel.addInvocationStat(invocationStat);
return null;
}
} }
|
public class class_name {
@Override
public MeasureModel buildMeasureModel(InvocationStat invocationStat) {
InvocationStatDimension statDimension = invocationStat.getDimension();
String key = statDimension.getDimensionKey();
MeasureModel measureModel = appServiceMeasureModels.get(key);
if (measureModel == null) {
measureModel = new MeasureModel(statDimension.getAppName(), statDimension.getService()); // depends on control dependency: [if], data = [none]
MeasureModel oldMeasureModel = appServiceMeasureModels.putIfAbsent(key, measureModel);
if (oldMeasureModel == null) {
measureModel.addInvocationStat(invocationStat); // depends on control dependency: [if], data = [none]
return measureModel; // depends on control dependency: [if], data = [none]
} else {
oldMeasureModel.addInvocationStat(invocationStat); // depends on control dependency: [if], data = [none]
return null; // depends on control dependency: [if], data = [none]
}
} else {
measureModel.addInvocationStat(invocationStat); // depends on control dependency: [if], data = [none]
return null; // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public static String readFile(String fileName) throws IOException {
logger.entering(fileName);
Preconditions.checkArgument(StringUtils.isNotBlank(fileName), "File name cannot be null (or) empty.");
StringBuilder output = new StringBuilder();
try (BufferedReader buffreader = new BufferedReader(new InputStreamReader(loadFile(fileName),
Charset.forName("UTF-8")))) {
String line = null;
while ((line = buffreader.readLine()) != null) {
output.append(line);
}
}
logger.exiting(output);
return output.toString();
} }
|
public class class_name {
public static String readFile(String fileName) throws IOException {
logger.entering(fileName);
Preconditions.checkArgument(StringUtils.isNotBlank(fileName), "File name cannot be null (or) empty.");
StringBuilder output = new StringBuilder();
try (BufferedReader buffreader = new BufferedReader(new InputStreamReader(loadFile(fileName),
Charset.forName("UTF-8")))) {
String line = null;
while ((line = buffreader.readLine()) != null) {
output.append(line); // depends on control dependency: [while], data = [none]
}
}
logger.exiting(output);
return output.toString();
} }
|
public class class_name {
public Attribute getLabelAttribute() {
Attribute labelAttr = getOwnLabelAttribute();
if (labelAttr == null) {
EntityType extend = getExtends();
if (extend != null) {
labelAttr = extend.getLabelAttribute();
}
}
return labelAttr;
} }
|
public class class_name {
public Attribute getLabelAttribute() {
Attribute labelAttr = getOwnLabelAttribute();
if (labelAttr == null) {
EntityType extend = getExtends();
if (extend != null) {
labelAttr = extend.getLabelAttribute(); // depends on control dependency: [if], data = [none]
}
}
return labelAttr;
} }
|
public class class_name {
protected Property getSwaggerProperty(Swagger swagger, Class<?> objectClass) {
Property swaggerProperty = null;
if (byte.class == objectClass || Byte.class == objectClass) {
// STRING
swaggerProperty = new StringProperty("byte");
} else if (char.class == objectClass || Character.class == objectClass) {
// CHAR is STRING LEN 1
StringProperty property = new StringProperty();
property.setMaxLength(1);
swaggerProperty = property;
} else if (short.class == objectClass || Short.class == objectClass) {
// SHORT is INTEGER with 16-bit max & min
IntegerProperty property = new IntegerProperty();
property.setMinimum(BigDecimal.valueOf(Short.MIN_VALUE));
property.setMaximum(BigDecimal.valueOf(Short.MAX_VALUE));
swaggerProperty = property;
} else if (int.class == objectClass || Integer.class == objectClass) {
// INTEGER
swaggerProperty = new IntegerProperty();
} else if (long.class == objectClass || Long.class == objectClass) {
// LONG
swaggerProperty = new LongProperty();
} else if (float.class == objectClass || Float.class == objectClass) {
// FLOAT
swaggerProperty = new FloatProperty();
} else if (double.class == objectClass || Double.class == objectClass) {
// DOUBLE
swaggerProperty = new DoubleProperty();
} else if (BigDecimal.class == objectClass) {
// DECIMAL
swaggerProperty = new DecimalProperty();
} else if (boolean.class == objectClass || Boolean.class == objectClass) {
// BOOLEAN
swaggerProperty = new BooleanProperty();
} else if (String.class == objectClass) {
// STRING
swaggerProperty = new StringProperty();
} else if (Date.class == objectClass || Timestamp.class == objectClass) {
// DATETIME
swaggerProperty = new DateTimeProperty();
} else if (java.sql.Date.class == objectClass) {
// DATE
swaggerProperty = new DateProperty();
} else if (java.sql.Time.class == objectClass) {
// TIME -> STRING
StringProperty property = new StringProperty();
property.setPattern("HH:mm:ss");
swaggerProperty = property;
} else if (UUID.class == objectClass) {
// UUID
swaggerProperty = new UUIDProperty();
} else if (objectClass.isEnum()) {
// ENUM
StringProperty property = new StringProperty();
List<String> enumValues = new ArrayList<>();
for (Object enumValue : objectClass.getEnumConstants()) {
enumValues.add(((Enum) enumValue).name());
}
property.setEnum(enumValues);
swaggerProperty = property;
} else if (FileItem.class == objectClass) {
// FILE UPLOAD
swaggerProperty = new FileProperty();
} else {
// Register a Model class
String modelRef = registerModel(swagger, objectClass);
swaggerProperty = new RefProperty(modelRef);
}
return swaggerProperty;
} }
|
public class class_name {
protected Property getSwaggerProperty(Swagger swagger, Class<?> objectClass) {
Property swaggerProperty = null;
if (byte.class == objectClass || Byte.class == objectClass) {
// STRING
swaggerProperty = new StringProperty("byte"); // depends on control dependency: [if], data = [none]
} else if (char.class == objectClass || Character.class == objectClass) {
// CHAR is STRING LEN 1
StringProperty property = new StringProperty();
property.setMaxLength(1); // depends on control dependency: [if], data = [none]
swaggerProperty = property; // depends on control dependency: [if], data = [none]
} else if (short.class == objectClass || Short.class == objectClass) {
// SHORT is INTEGER with 16-bit max & min
IntegerProperty property = new IntegerProperty();
property.setMinimum(BigDecimal.valueOf(Short.MIN_VALUE)); // depends on control dependency: [if], data = [none]
property.setMaximum(BigDecimal.valueOf(Short.MAX_VALUE)); // depends on control dependency: [if], data = [none]
swaggerProperty = property; // depends on control dependency: [if], data = [none]
} else if (int.class == objectClass || Integer.class == objectClass) {
// INTEGER
swaggerProperty = new IntegerProperty(); // depends on control dependency: [if], data = [none]
} else if (long.class == objectClass || Long.class == objectClass) {
// LONG
swaggerProperty = new LongProperty(); // depends on control dependency: [if], data = [none]
} else if (float.class == objectClass || Float.class == objectClass) {
// FLOAT
swaggerProperty = new FloatProperty(); // depends on control dependency: [if], data = [none]
} else if (double.class == objectClass || Double.class == objectClass) {
// DOUBLE
swaggerProperty = new DoubleProperty(); // depends on control dependency: [if], data = [none]
} else if (BigDecimal.class == objectClass) {
// DECIMAL
swaggerProperty = new DecimalProperty(); // depends on control dependency: [if], data = [none]
} else if (boolean.class == objectClass || Boolean.class == objectClass) {
// BOOLEAN
swaggerProperty = new BooleanProperty(); // depends on control dependency: [if], data = [none]
} else if (String.class == objectClass) {
// STRING
swaggerProperty = new StringProperty(); // depends on control dependency: [if], data = [none]
} else if (Date.class == objectClass || Timestamp.class == objectClass) {
// DATETIME
swaggerProperty = new DateTimeProperty(); // depends on control dependency: [if], data = [none]
} else if (java.sql.Date.class == objectClass) {
// DATE
swaggerProperty = new DateProperty(); // depends on control dependency: [if], data = [none]
} else if (java.sql.Time.class == objectClass) {
// TIME -> STRING
StringProperty property = new StringProperty();
property.setPattern("HH:mm:ss"); // depends on control dependency: [if], data = [none]
swaggerProperty = property; // depends on control dependency: [if], data = [none]
} else if (UUID.class == objectClass) {
// UUID
swaggerProperty = new UUIDProperty(); // depends on control dependency: [if], data = [none]
} else if (objectClass.isEnum()) {
// ENUM
StringProperty property = new StringProperty();
List<String> enumValues = new ArrayList<>();
for (Object enumValue : objectClass.getEnumConstants()) {
enumValues.add(((Enum) enumValue).name()); // depends on control dependency: [for], data = [enumValue]
}
property.setEnum(enumValues); // depends on control dependency: [if], data = [none]
swaggerProperty = property; // depends on control dependency: [if], data = [none]
} else if (FileItem.class == objectClass) {
// FILE UPLOAD
swaggerProperty = new FileProperty(); // depends on control dependency: [if], data = [none]
} else {
// Register a Model class
String modelRef = registerModel(swagger, objectClass);
swaggerProperty = new RefProperty(modelRef); // depends on control dependency: [if], data = [none]
}
return swaggerProperty;
} }
|
public class class_name {
public void marshall(DescribeExportTasksRequest describeExportTasksRequest, ProtocolMarshaller protocolMarshaller) {
if (describeExportTasksRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(describeExportTasksRequest.getExportIds(), EXPORTIDS_BINDING);
protocolMarshaller.marshall(describeExportTasksRequest.getFilters(), FILTERS_BINDING);
protocolMarshaller.marshall(describeExportTasksRequest.getMaxResults(), MAXRESULTS_BINDING);
protocolMarshaller.marshall(describeExportTasksRequest.getNextToken(), NEXTTOKEN_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} }
|
public class class_name {
public void marshall(DescribeExportTasksRequest describeExportTasksRequest, ProtocolMarshaller protocolMarshaller) {
if (describeExportTasksRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(describeExportTasksRequest.getExportIds(), EXPORTIDS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(describeExportTasksRequest.getFilters(), FILTERS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(describeExportTasksRequest.getMaxResults(), MAXRESULTS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(describeExportTasksRequest.getNextToken(), NEXTTOKEN_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 {
synchronized private static Date extractFromTimestamp(String watermark) {
final SimpleDateFormat inputFormat = new SimpleDateFormat(INPUTFORMAT);
final SimpleDateFormat outputFormat = new SimpleDateFormat(OUTPUTFORMAT);
Date outDate = null;
try {
Date date = inputFormat.parse(watermark);
String dateStr = outputFormat.format(date);
outDate = outputFormat.parse(dateStr);
} catch (ParseException e) {
LOG.error(e.getMessage(), e);
}
return outDate;
} }
|
public class class_name {
synchronized private static Date extractFromTimestamp(String watermark) {
final SimpleDateFormat inputFormat = new SimpleDateFormat(INPUTFORMAT);
final SimpleDateFormat outputFormat = new SimpleDateFormat(OUTPUTFORMAT);
Date outDate = null;
try {
Date date = inputFormat.parse(watermark);
String dateStr = outputFormat.format(date);
outDate = outputFormat.parse(dateStr); // depends on control dependency: [try], data = [none]
} catch (ParseException e) {
LOG.error(e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
return outDate;
} }
|
public class class_name {
protected static int compareVersions(String left, String right) {
int result = 0;
//while the strings are well formed - the backslashes will be in the exact
//same location in equal strings - for version numbers the cost of conversion
//should not be incurred
//final List<String> subLeft = splitVersion(Convert.fromWellFormed(left));
//final List<String> subRight = splitVersion(Convert.fromWellFormed(right));
final List<String> subLeft = splitVersion(left);
final List<String> subRight = splitVersion(right);
final int subMax = (subLeft.size() <= subRight.size()) ? subLeft.size() : subRight.size();
for (int x = 0; result == 0 && x < subMax; x++) {
if (isPositiveInteger(subLeft.get(x)) && isPositiveInteger(subRight.get(x))) {
try {
result = Long.valueOf(subLeft.get(x)).compareTo(Long.valueOf(subRight.get(x)));
} catch (NumberFormatException ex) {
//infeasible path - unless one of the values is larger then a long?
if (!subLeft.get(x).equalsIgnoreCase(subRight.get(x))) {
result = subLeft.get(x).compareTo(subRight.get(x));
}
}
} else {
result = subLeft.get(x).compareTo(subRight.get(x));
}
if (result != 0) {
return result;
}
}
if (subLeft.size() > subRight.size()) {
result = 1;
}
if (subRight.size() > subLeft.size()) {
result = -1;
}
return result;
} }
|
public class class_name {
protected static int compareVersions(String left, String right) {
int result = 0;
//while the strings are well formed - the backslashes will be in the exact
//same location in equal strings - for version numbers the cost of conversion
//should not be incurred
//final List<String> subLeft = splitVersion(Convert.fromWellFormed(left));
//final List<String> subRight = splitVersion(Convert.fromWellFormed(right));
final List<String> subLeft = splitVersion(left);
final List<String> subRight = splitVersion(right);
final int subMax = (subLeft.size() <= subRight.size()) ? subLeft.size() : subRight.size();
for (int x = 0; result == 0 && x < subMax; x++) {
if (isPositiveInteger(subLeft.get(x)) && isPositiveInteger(subRight.get(x))) {
try {
result = Long.valueOf(subLeft.get(x)).compareTo(Long.valueOf(subRight.get(x))); // depends on control dependency: [try], data = [none]
} catch (NumberFormatException ex) {
//infeasible path - unless one of the values is larger then a long?
if (!subLeft.get(x).equalsIgnoreCase(subRight.get(x))) {
result = subLeft.get(x).compareTo(subRight.get(x)); // depends on control dependency: [if], data = [none]
}
} // depends on control dependency: [catch], data = [none]
} else {
result = subLeft.get(x).compareTo(subRight.get(x)); // depends on control dependency: [if], data = [none]
}
if (result != 0) {
return result; // depends on control dependency: [if], data = [none]
}
}
if (subLeft.size() > subRight.size()) {
result = 1; // depends on control dependency: [if], data = [none]
}
if (subRight.size() > subLeft.size()) {
result = -1; // depends on control dependency: [if], data = [none]
}
return result;
} }
|
public class class_name {
public static void mult(DMatrixSparseCSC A, DMatrixSparseCSC B, DMatrixSparseCSC C,
@Nullable IGrowArray gw, @Nullable DGrowArray gx )
{
double []x = adjust(gx, A.numRows);
int []w = adjust(gw, A.numRows, A.numRows);
C.growMaxLength(A.nz_length+B.nz_length,false);
C.indicesSorted = false;
C.nz_length = 0;
// C(i,j) = sum_k A(i,k) * B(k,j)
int idx0 = B.col_idx[0];
for (int bj = 1; bj <= B.numCols; bj++) {
int colB = bj-1;
int idx1 = B.col_idx[bj];
C.col_idx[bj] = C.nz_length;
if( idx0 == idx1 ) {
continue;
}
// C(:,j) = sum_k A(:,k)*B(k,j)
for (int bi = idx0; bi < idx1; bi++) {
int rowB = B.nz_rows[bi];
double valB = B.nz_values[bi]; // B(k,j) k=rowB j=colB
multAddColA(A,rowB,valB,C,colB+1,x,w);
}
// take the values in the dense vector 'x' and put them into 'C'
int idxC0 = C.col_idx[colB];
int idxC1 = C.col_idx[colB+1];
for (int i = idxC0; i < idxC1; i++) {
C.nz_values[i] = x[C.nz_rows[i]];
}
idx0 = idx1;
}
} }
|
public class class_name {
public static void mult(DMatrixSparseCSC A, DMatrixSparseCSC B, DMatrixSparseCSC C,
@Nullable IGrowArray gw, @Nullable DGrowArray gx )
{
double []x = adjust(gx, A.numRows);
int []w = adjust(gw, A.numRows, A.numRows);
C.growMaxLength(A.nz_length+B.nz_length,false);
C.indicesSorted = false;
C.nz_length = 0;
// C(i,j) = sum_k A(i,k) * B(k,j)
int idx0 = B.col_idx[0];
for (int bj = 1; bj <= B.numCols; bj++) {
int colB = bj-1;
int idx1 = B.col_idx[bj];
C.col_idx[bj] = C.nz_length; // depends on control dependency: [for], data = [bj]
if( idx0 == idx1 ) {
continue;
}
// C(:,j) = sum_k A(:,k)*B(k,j)
for (int bi = idx0; bi < idx1; bi++) {
int rowB = B.nz_rows[bi];
double valB = B.nz_values[bi]; // B(k,j) k=rowB j=colB
multAddColA(A,rowB,valB,C,colB+1,x,w); // depends on control dependency: [for], data = [none]
}
// take the values in the dense vector 'x' and put them into 'C'
int idxC0 = C.col_idx[colB];
int idxC1 = C.col_idx[colB+1];
for (int i = idxC0; i < idxC1; i++) {
C.nz_values[i] = x[C.nz_rows[i]]; // depends on control dependency: [for], data = [i]
}
idx0 = idx1; // depends on control dependency: [for], data = [none]
}
} }
|
public class class_name {
private final ClientResponseImpl dispatchLoadSinglepartitionTable(Procedure catProc,
StoredProcedureInvocation task,
InvocationClientHandler handler,
Connection ccxn)
{
int partition = -1;
try {
CatalogMap<Table> tables = m_catalogContext.get().database.getTables();
int partitionParamType = getLoadSinglePartitionTablePartitionParamType(tables, task);
byte[] valueToHash = (byte[])task.getParameterAtIndex(0);
partition = TheHashinator.getPartitionForParameter(partitionParamType, valueToHash);
}
catch (Exception e) {
authLog.warn(e.getMessage());
return new ClientResponseImpl(ClientResponseImpl.UNEXPECTED_FAILURE,
new VoltTable[0], e.getMessage(), task.clientHandle);
}
assert(partition != -1);
createTransaction(handler.connectionId(),
task,
catProc.getReadonly(),
catProc.getSinglepartition(),
catProc.getEverysite(),
new int[] { partition },
task.getSerializedSize(),
System.nanoTime());
return null;
} }
|
public class class_name {
private final ClientResponseImpl dispatchLoadSinglepartitionTable(Procedure catProc,
StoredProcedureInvocation task,
InvocationClientHandler handler,
Connection ccxn)
{
int partition = -1;
try {
CatalogMap<Table> tables = m_catalogContext.get().database.getTables();
int partitionParamType = getLoadSinglePartitionTablePartitionParamType(tables, task);
byte[] valueToHash = (byte[])task.getParameterAtIndex(0);
partition = TheHashinator.getPartitionForParameter(partitionParamType, valueToHash); // depends on control dependency: [try], data = [none]
}
catch (Exception e) {
authLog.warn(e.getMessage());
return new ClientResponseImpl(ClientResponseImpl.UNEXPECTED_FAILURE,
new VoltTable[0], e.getMessage(), task.clientHandle);
} // depends on control dependency: [catch], data = [none]
assert(partition != -1);
createTransaction(handler.connectionId(),
task,
catProc.getReadonly(),
catProc.getSinglepartition(),
catProc.getEverysite(),
new int[] { partition },
task.getSerializedSize(),
System.nanoTime());
return null;
} }
|
public class class_name {
public void handleLostConnection() {
try {
clientEngine.applySelector(ClientSelectors.any());
} catch (Exception e) {
LOGGER.warning("Could not clean up client B/W list filtering.", e);
}
} }
|
public class class_name {
public void handleLostConnection() {
try {
clientEngine.applySelector(ClientSelectors.any()); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
LOGGER.warning("Could not clean up client B/W list filtering.", e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
@Override
public final void closeTcpConnection() throws CommunicationException {
IOException tmpException = null;
try {
closeTcpConnectionImpl();
} catch (IOException e) {
tmpException = e;
} finally {
try {
if (mSocket != null) {
mSocket.close();
}
} catch (IOException e) {
tmpException = e;
} finally {
mSocket = null;
}
}
if (tmpException != null) {
throw new CommunicationException(tmpException);
}
} }
|
public class class_name {
@Override
public final void closeTcpConnection() throws CommunicationException {
IOException tmpException = null;
try {
closeTcpConnectionImpl();
} catch (IOException e) {
tmpException = e;
} finally {
try {
if (mSocket != null) {
mSocket.close(); // depends on control dependency: [if], data = [none]
}
} catch (IOException e) {
tmpException = e;
} finally { // depends on control dependency: [catch], data = [none]
mSocket = null;
}
}
if (tmpException != null) {
throw new CommunicationException(tmpException);
}
} }
|
public class class_name {
public final void reset() {
if (trace) {
log.tracef("Resetting Node Scope Statistics");
}
globalContainer.reset();
percentiles = new EnumMap<>(PercentileStatistic.class);
for (PercentileStatistic percentileStatistic : PercentileStatistic.values()) {
percentiles.put(percentileStatistic, new ReservoirSampler());
}
} }
|
public class class_name {
public final void reset() {
if (trace) {
log.tracef("Resetting Node Scope Statistics"); // depends on control dependency: [if], data = [none]
}
globalContainer.reset();
percentiles = new EnumMap<>(PercentileStatistic.class);
for (PercentileStatistic percentileStatistic : PercentileStatistic.values()) {
percentiles.put(percentileStatistic, new ReservoirSampler()); // depends on control dependency: [for], data = [percentileStatistic]
}
} }
|
public class class_name {
@Override
public void link(NGScope scope, JQElement element, JSON attrs) {
ImageResource resource = scope.get(getName());
if (resource == null) {
LOG.log(Level.WARNING, "Mandatory attribute " + getName() + " value is mssing");
return;
}
Image image = new Image(resource);
Element target = image.asWidget().getElement();
String className = element.attr("class");
target.addClassName(className);
String style = element.attr("style");
target.setAttribute("style", style);
element.replaceWith(target);
} }
|
public class class_name {
@Override
public void link(NGScope scope, JQElement element, JSON attrs) {
ImageResource resource = scope.get(getName());
if (resource == null) {
LOG.log(Level.WARNING, "Mandatory attribute " + getName() + " value is mssing"); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
Image image = new Image(resource);
Element target = image.asWidget().getElement();
String className = element.attr("class");
target.addClassName(className);
String style = element.attr("style");
target.setAttribute("style", style);
element.replaceWith(target);
} }
|
public class class_name {
public void next(Action action,String depClass) {
assert (!isFinalState());
// 左焦点词在句子中的位置
int lNode = trees.get(leftFocus).id;
int rNode = trees.get(leftFocus + 1).id;
switch (action) {
case LEFT:
trees.get(leftFocus + 1).setDepClass(depClass);
trees.get(leftFocus).addRightChild(trees.get(leftFocus + 1));
trees.remove(leftFocus + 1);
isUpdated = true;
break;
case RIGHT:
trees.get(leftFocus).setDepClass(depClass);
trees.get(leftFocus + 1).addLeftChild(trees.get(leftFocus));
trees.remove(leftFocus);
isUpdated = true;
break;
default:
leftFocus++;
}
if (leftFocus >= trees.size() - 1) {
if (!isUpdated) {
isFinal = true;
}
back();
}
} }
|
public class class_name {
public void next(Action action,String depClass) {
assert (!isFinalState());
// 左焦点词在句子中的位置
int lNode = trees.get(leftFocus).id;
int rNode = trees.get(leftFocus + 1).id;
switch (action) {
case LEFT:
trees.get(leftFocus + 1).setDepClass(depClass);
trees.get(leftFocus).addRightChild(trees.get(leftFocus + 1));
trees.remove(leftFocus + 1);
isUpdated = true;
break;
case RIGHT:
trees.get(leftFocus).setDepClass(depClass);
trees.get(leftFocus + 1).addLeftChild(trees.get(leftFocus));
trees.remove(leftFocus);
isUpdated = true;
break;
default:
leftFocus++;
}
if (leftFocus >= trees.size() - 1) {
if (!isUpdated) {
isFinal = true;
// depends on control dependency: [if], data = [none]
}
back();
// depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
protected void cacheResultSetEntities(final Object[] result) {
if (entitiesCache == null) {
entitiesCache = new HashMap<>();
}
for (int i = 0; i < result.length; i++) {
Object object = result[i];
if (object == null) {
continue;
}
DbEntityDescriptor ded = cachedDbEntityDescriptors[i];
if (ded == null) { // not a type, continue
continue;
}
// calculate key
Object key;
if (ded.hasIdColumn()) {
//noinspection unchecked
key = ded.getKeyValue(object);
} else {
key = object;
}
Object cachedObject = entitiesCache.get(key);
if (cachedObject == null) {
// object is not in the cache, add it
entitiesCache.put(key, object);
} else {
// object is in the cache, replace it
result[i] = cachedObject;
}
}
} }
|
public class class_name {
protected void cacheResultSetEntities(final Object[] result) {
if (entitiesCache == null) {
entitiesCache = new HashMap<>(); // depends on control dependency: [if], data = [none]
}
for (int i = 0; i < result.length; i++) {
Object object = result[i];
if (object == null) {
continue;
}
DbEntityDescriptor ded = cachedDbEntityDescriptors[i];
if (ded == null) { // not a type, continue
continue;
}
// calculate key
Object key;
if (ded.hasIdColumn()) {
//noinspection unchecked
key = ded.getKeyValue(object); // depends on control dependency: [if], data = [none]
} else {
key = object; // depends on control dependency: [if], data = [none]
}
Object cachedObject = entitiesCache.get(key);
if (cachedObject == null) {
// object is not in the cache, add it
entitiesCache.put(key, object); // depends on control dependency: [if], data = [none]
} else {
// object is in the cache, replace it
result[i] = cachedObject; // depends on control dependency: [if], data = [none]
}
}
} }
|
public class class_name {
public static Polygon makePolygon(Geometry shell, Geometry... holes) throws IllegalArgumentException {
if(shell == null) {
return null;
}
LinearRing outerLine = checkLineString(shell);
LinearRing[] interiorlinestrings = new LinearRing[holes.length];
for (int i = 0; i < holes.length; i++) {
interiorlinestrings[i] = checkLineString(holes[i]);
}
return shell.getFactory().createPolygon(outerLine, interiorlinestrings);
} }
|
public class class_name {
public static Polygon makePolygon(Geometry shell, Geometry... holes) throws IllegalArgumentException {
if(shell == null) {
return null; // depends on control dependency: [if], data = [none]
}
LinearRing outerLine = checkLineString(shell);
LinearRing[] interiorlinestrings = new LinearRing[holes.length];
for (int i = 0; i < holes.length; i++) {
interiorlinestrings[i] = checkLineString(holes[i]); // depends on control dependency: [for], data = [i]
}
return shell.getFactory().createPolygon(outerLine, interiorlinestrings);
} }
|
public class class_name {
@SuppressWarnings("all")
protected Object newInstance(String className) {
log.debug("Loading class: {}", className);
Object instance = null;
Class<?> clazz = null;
if ("".equals(className) || className == null)
return instance;
try {
// check for special DS class aliases
if (className.length() == 3) {
className = classAliases.get(className);
}
if (className.startsWith("flex.")) {
// Use Red5 compatibility class instead
className = "org.red5.compatibility." + className;
log.debug("Modified classname: {}", className);
}
if (!classAllowed(className)) {
log.error("Class creation is not allowed {}", className);
} else {
clazz = Thread.currentThread().getContextClassLoader()
.loadClass(className);
instance = clazz.newInstance();
}
} catch (InstantiationException iex) {
try {
// check for default ctor
clazz.getConstructor(null);
log.error("Error loading class: {}", className);
} catch (NoSuchMethodException nse) {
log.error(
"Error loading class: {}; this can be resolved by adding a default constructor to your class",
className);
}
log.debug("Exception was: {}", iex);
} catch (Exception ex) {
log.error("Error loading class: {}", className);
log.debug("Exception was: {}", ex);
}
return instance;
} }
|
public class class_name {
@SuppressWarnings("all")
protected Object newInstance(String className) {
log.debug("Loading class: {}", className);
Object instance = null;
Class<?> clazz = null;
if ("".equals(className) || className == null)
return instance;
try {
// check for special DS class aliases
if (className.length() == 3) {
className = classAliases.get(className); // depends on control dependency: [if], data = [none]
}
if (className.startsWith("flex.")) {
// Use Red5 compatibility class instead
className = "org.red5.compatibility." + className; // depends on control dependency: [if], data = [none]
log.debug("Modified classname: {}", className); // depends on control dependency: [if], data = [none]
}
if (!classAllowed(className)) {
log.error("Class creation is not allowed {}", className); // depends on control dependency: [if], data = [none]
} else {
clazz = Thread.currentThread().getContextClassLoader()
.loadClass(className); // depends on control dependency: [if], data = [none]
instance = clazz.newInstance(); // depends on control dependency: [if], data = [none]
}
} catch (InstantiationException iex) {
try {
// check for default ctor
clazz.getConstructor(null); // depends on control dependency: [try], data = [none]
log.error("Error loading class: {}", className); // depends on control dependency: [try], data = [none]
} catch (NoSuchMethodException nse) {
log.error(
"Error loading class: {}; this can be resolved by adding a default constructor to your class",
className);
} // depends on control dependency: [catch], data = [none]
log.debug("Exception was: {}", iex);
} catch (Exception ex) { // depends on control dependency: [catch], data = [none]
log.error("Error loading class: {}", className);
log.debug("Exception was: {}", ex);
} // depends on control dependency: [catch], data = [none]
return instance;
} }
|
public class class_name {
@Override
public byte[] bitcoinSerialize() {
// we have completely cached byte array.
if (headerBytesValid && transactionBytesValid) {
Preconditions.checkNotNull(payload, "Bytes should never be null if headerBytesValid && transactionBytesValid");
if (length == payload.length) {
return payload;
} else {
// byte array is offset so copy out the correct range.
byte[] buf = new byte[length];
System.arraycopy(payload, offset, buf, 0, length);
return buf;
}
}
// At least one of the two cacheable components is invalid
// so fall back to stream write since we can't be sure of the length.
ByteArrayOutputStream stream = new UnsafeByteArrayOutputStream(length == UNKNOWN_LENGTH ? HEADER_SIZE + guessTransactionsLength() : length);
try {
writeHeader(stream);
writeTransactions(stream);
} catch (IOException e) {
// Cannot happen, we are serializing to a memory stream.
}
return stream.toByteArray();
} }
|
public class class_name {
@Override
public byte[] bitcoinSerialize() {
// we have completely cached byte array.
if (headerBytesValid && transactionBytesValid) {
Preconditions.checkNotNull(payload, "Bytes should never be null if headerBytesValid && transactionBytesValid"); // depends on control dependency: [if], data = [none]
if (length == payload.length) {
return payload; // depends on control dependency: [if], data = [none]
} else {
// byte array is offset so copy out the correct range.
byte[] buf = new byte[length];
System.arraycopy(payload, offset, buf, 0, length); // depends on control dependency: [if], data = [none]
return buf; // depends on control dependency: [if], data = [none]
}
}
// At least one of the two cacheable components is invalid
// so fall back to stream write since we can't be sure of the length.
ByteArrayOutputStream stream = new UnsafeByteArrayOutputStream(length == UNKNOWN_LENGTH ? HEADER_SIZE + guessTransactionsLength() : length);
try {
writeHeader(stream); // depends on control dependency: [try], data = [none]
writeTransactions(stream); // depends on control dependency: [try], data = [none]
} catch (IOException e) {
// Cannot happen, we are serializing to a memory stream.
} // depends on control dependency: [catch], data = [none]
return stream.toByteArray();
} }
|
public class class_name {
public final void persist() {
if (persisted) {
// Do nothing if already done
return;
}
try {
// Compare new and old file
if (FileUtils.contentEquals(tmpFile, file)) {
LOG.debug("Omitted: {} {}", getPath(), logInfo);
if (!tmpFile.delete()) {
tmpFile.deleteOnExit();
}
} else {
if (file.exists() && !file.delete()) {
throw new IOException("Wasn't able to delete file " + file);
}
if (!tmpFile.renameTo(file)) {
throw new IOException("Wasn't able to rename temporary file " + tmpFile + " to " + file);
}
LOG.info("Generated: {} {}", getPath(), logInfo);
}
persisted = true;
} catch (final IOException ex) {
throw new RuntimeException("Error comparing content: tmp=" + tmpFile + ", target=" + file + logInfo, ex);
}
} }
|
public class class_name {
public final void persist() {
if (persisted) {
// Do nothing if already done
return;
// depends on control dependency: [if], data = [none]
}
try {
// Compare new and old file
if (FileUtils.contentEquals(tmpFile, file)) {
LOG.debug("Omitted: {} {}", getPath(), logInfo);
// depends on control dependency: [if], data = [none]
if (!tmpFile.delete()) {
tmpFile.deleteOnExit();
// depends on control dependency: [if], data = [none]
}
} else {
if (file.exists() && !file.delete()) {
throw new IOException("Wasn't able to delete file " + file);
}
if (!tmpFile.renameTo(file)) {
throw new IOException("Wasn't able to rename temporary file " + tmpFile + " to " + file);
}
LOG.info("Generated: {} {}", getPath(), logInfo);
// depends on control dependency: [if], data = [none]
}
persisted = true;
// depends on control dependency: [try], data = [none]
} catch (final IOException ex) {
throw new RuntimeException("Error comparing content: tmp=" + tmpFile + ", target=" + file + logInfo, ex);
}
// depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public void marshall(UpdateLinkAttributesRequest updateLinkAttributesRequest, ProtocolMarshaller protocolMarshaller) {
if (updateLinkAttributesRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(updateLinkAttributesRequest.getDirectoryArn(), DIRECTORYARN_BINDING);
protocolMarshaller.marshall(updateLinkAttributesRequest.getTypedLinkSpecifier(), TYPEDLINKSPECIFIER_BINDING);
protocolMarshaller.marshall(updateLinkAttributesRequest.getAttributeUpdates(), ATTRIBUTEUPDATES_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} }
|
public class class_name {
public void marshall(UpdateLinkAttributesRequest updateLinkAttributesRequest, ProtocolMarshaller protocolMarshaller) {
if (updateLinkAttributesRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(updateLinkAttributesRequest.getDirectoryArn(), DIRECTORYARN_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(updateLinkAttributesRequest.getTypedLinkSpecifier(), TYPEDLINKSPECIFIER_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(updateLinkAttributesRequest.getAttributeUpdates(), ATTRIBUTEUPDATES_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public static base_responses kill(nitro_service client, aaasession resources[]) throws Exception {
base_responses result = null;
if (resources != null && resources.length > 0) {
aaasession killresources[] = new aaasession[resources.length];
for (int i=0;i<resources.length;i++){
killresources[i] = new aaasession();
killresources[i].username = resources[i].username;
killresources[i].groupname = resources[i].groupname;
killresources[i].iip = resources[i].iip;
killresources[i].netmask = resources[i].netmask;
killresources[i].all = resources[i].all;
}
result = perform_operation_bulk_request(client, killresources,"kill");
}
return result;
} }
|
public class class_name {
public static base_responses kill(nitro_service client, aaasession resources[]) throws Exception {
base_responses result = null;
if (resources != null && resources.length > 0) {
aaasession killresources[] = new aaasession[resources.length];
for (int i=0;i<resources.length;i++){
killresources[i] = new aaasession(); // depends on control dependency: [for], data = [i]
killresources[i].username = resources[i].username; // depends on control dependency: [for], data = [i]
killresources[i].groupname = resources[i].groupname; // depends on control dependency: [for], data = [i]
killresources[i].iip = resources[i].iip; // depends on control dependency: [for], data = [i]
killresources[i].netmask = resources[i].netmask; // depends on control dependency: [for], data = [i]
killresources[i].all = resources[i].all; // depends on control dependency: [for], data = [i]
}
result = perform_operation_bulk_request(client, killresources,"kill");
}
return result;
} }
|
public class class_name {
private void checkElement(Element elementToBeAdded) {
if (!(elementToBeAdded instanceof Person) && !(elementToBeAdded instanceof SoftwareSystem) && !(elementToBeAdded instanceof Container) && !(elementToBeAdded instanceof Component)) {
throw new IllegalArgumentException("Only people, software systems, containers and components can be added to dynamic views.");
}
// people can always be added
if (elementToBeAdded instanceof Person) {
return;
}
// if the scope of this dynamic view is a software system, we only want:
// - containers inside that software system
// - other software systems
if (element instanceof SoftwareSystem) {
if (elementToBeAdded.equals(element)) {
throw new IllegalArgumentException(elementToBeAdded.getName() + " is already the scope of this view and cannot be added to it.");
}
if (elementToBeAdded instanceof Container && !elementToBeAdded.getParent().equals(element)) {
throw new IllegalArgumentException("Only containers that reside inside " + element.getName() + " can be added to this view.");
}
if (elementToBeAdded instanceof Component) {
throw new IllegalArgumentException("Components can't be added to a dynamic view when the scope is a software system.");
}
}
// if the scope of this dynamic view is a container, we only want other containers inside the same software system
// and other components inside the container
if (element instanceof Container) {
if (elementToBeAdded.equals(element) || elementToBeAdded.equals(element.getParent())) {
throw new IllegalArgumentException(elementToBeAdded.getName() + " is already the scope of this view and cannot be added to it.");
}
if (elementToBeAdded instanceof Container && !elementToBeAdded.getParent().equals(element.getParent())) {
throw new IllegalArgumentException("Only containers that reside inside " + element.getParent().getName() + " can be added to this view.");
}
if (elementToBeAdded instanceof Component && !elementToBeAdded.getParent().equals(element)) {
throw new IllegalArgumentException("Only components that reside inside " + element.getName() + " can be added to this view.");
}
}
if (element == null) {
if (!(elementToBeAdded instanceof SoftwareSystem)) {
throw new IllegalArgumentException("Only people and software systems can be added to this dynamic view.");
}
}
} }
|
public class class_name {
private void checkElement(Element elementToBeAdded) {
if (!(elementToBeAdded instanceof Person) && !(elementToBeAdded instanceof SoftwareSystem) && !(elementToBeAdded instanceof Container) && !(elementToBeAdded instanceof Component)) {
throw new IllegalArgumentException("Only people, software systems, containers and components can be added to dynamic views.");
}
// people can always be added
if (elementToBeAdded instanceof Person) {
return; // depends on control dependency: [if], data = [none]
}
// if the scope of this dynamic view is a software system, we only want:
// - containers inside that software system
// - other software systems
if (element instanceof SoftwareSystem) {
if (elementToBeAdded.equals(element)) {
throw new IllegalArgumentException(elementToBeAdded.getName() + " is already the scope of this view and cannot be added to it.");
}
if (elementToBeAdded instanceof Container && !elementToBeAdded.getParent().equals(element)) {
throw new IllegalArgumentException("Only containers that reside inside " + element.getName() + " can be added to this view.");
}
if (elementToBeAdded instanceof Component) {
throw new IllegalArgumentException("Components can't be added to a dynamic view when the scope is a software system.");
}
}
// if the scope of this dynamic view is a container, we only want other containers inside the same software system
// and other components inside the container
if (element instanceof Container) {
if (elementToBeAdded.equals(element) || elementToBeAdded.equals(element.getParent())) {
throw new IllegalArgumentException(elementToBeAdded.getName() + " is already the scope of this view and cannot be added to it.");
}
if (elementToBeAdded instanceof Container && !elementToBeAdded.getParent().equals(element.getParent())) {
throw new IllegalArgumentException("Only containers that reside inside " + element.getParent().getName() + " can be added to this view.");
}
if (elementToBeAdded instanceof Component && !elementToBeAdded.getParent().equals(element)) {
throw new IllegalArgumentException("Only components that reside inside " + element.getName() + " can be added to this view.");
}
}
if (element == null) {
if (!(elementToBeAdded instanceof SoftwareSystem)) {
throw new IllegalArgumentException("Only people and software systems can be added to this dynamic view.");
}
}
} }
|
public class class_name {
public void setWindowExecutionTaskInvocationIdentities(
java.util.Collection<MaintenanceWindowExecutionTaskInvocationIdentity> windowExecutionTaskInvocationIdentities) {
if (windowExecutionTaskInvocationIdentities == null) {
this.windowExecutionTaskInvocationIdentities = null;
return;
}
this.windowExecutionTaskInvocationIdentities = new com.amazonaws.internal.SdkInternalList<MaintenanceWindowExecutionTaskInvocationIdentity>(
windowExecutionTaskInvocationIdentities);
} }
|
public class class_name {
public void setWindowExecutionTaskInvocationIdentities(
java.util.Collection<MaintenanceWindowExecutionTaskInvocationIdentity> windowExecutionTaskInvocationIdentities) {
if (windowExecutionTaskInvocationIdentities == null) {
this.windowExecutionTaskInvocationIdentities = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.windowExecutionTaskInvocationIdentities = new com.amazonaws.internal.SdkInternalList<MaintenanceWindowExecutionTaskInvocationIdentity>(
windowExecutionTaskInvocationIdentities);
} }
|
public class class_name {
boolean evict(StoreEventSink<K, V> eventSink) {
evictionObserver.begin();
Random random = new Random();
@SuppressWarnings("unchecked")
Map.Entry<K, OnHeapValueHolder<V>> candidate = map.getEvictionCandidate(random, SAMPLE_SIZE, EVICTION_PRIORITIZER, EVICTION_ADVISOR);
if (candidate == null) {
// 2nd attempt without any advisor
candidate = map.getEvictionCandidate(random, SAMPLE_SIZE, EVICTION_PRIORITIZER, noAdvice());
}
if (candidate == null) {
return false;
} else {
Map.Entry<K, OnHeapValueHolder<V>> evictionCandidate = candidate;
AtomicBoolean removed = new AtomicBoolean(false);
map.computeIfPresent(evictionCandidate.getKey(), (mappedKey, mappedValue) -> {
if (mappedValue.equals(evictionCandidate.getValue())) {
removed.set(true);
if (!(evictionCandidate.getValue() instanceof Fault)) {
eventSink.evicted(evictionCandidate.getKey(), evictionCandidate.getValue());
invalidationListener.onInvalidation(mappedKey, evictionCandidate.getValue());
}
updateUsageInBytesIfRequired(-mappedValue.size());
return null;
}
return mappedValue;
});
if (removed.get()) {
evictionObserver.end(StoreOperationOutcomes.EvictionOutcome.SUCCESS);
return true;
} else {
evictionObserver.end(StoreOperationOutcomes.EvictionOutcome.FAILURE);
return false;
}
}
} }
|
public class class_name {
boolean evict(StoreEventSink<K, V> eventSink) {
evictionObserver.begin();
Random random = new Random();
@SuppressWarnings("unchecked")
Map.Entry<K, OnHeapValueHolder<V>> candidate = map.getEvictionCandidate(random, SAMPLE_SIZE, EVICTION_PRIORITIZER, EVICTION_ADVISOR);
if (candidate == null) {
// 2nd attempt without any advisor
candidate = map.getEvictionCandidate(random, SAMPLE_SIZE, EVICTION_PRIORITIZER, noAdvice()); // depends on control dependency: [if], data = [none]
}
if (candidate == null) {
return false; // depends on control dependency: [if], data = [none]
} else {
Map.Entry<K, OnHeapValueHolder<V>> evictionCandidate = candidate;
AtomicBoolean removed = new AtomicBoolean(false);
map.computeIfPresent(evictionCandidate.getKey(), (mappedKey, mappedValue) -> {
if (mappedValue.equals(evictionCandidate.getValue())) {
removed.set(true); // depends on control dependency: [if], data = [none]
if (!(evictionCandidate.getValue() instanceof Fault)) {
eventSink.evicted(evictionCandidate.getKey(), evictionCandidate.getValue()); // depends on control dependency: [if], data = [none]
invalidationListener.onInvalidation(mappedKey, evictionCandidate.getValue()); // depends on control dependency: [if], data = [none]
}
updateUsageInBytesIfRequired(-mappedValue.size()); // depends on control dependency: [if], data = [none]
return null; // depends on control dependency: [if], data = [none]
}
return mappedValue;
});
if (removed.get()) {
evictionObserver.end(StoreOperationOutcomes.EvictionOutcome.SUCCESS); // depends on control dependency: [if], data = [none]
return true; // depends on control dependency: [if], data = [none]
} else {
evictionObserver.end(StoreOperationOutcomes.EvictionOutcome.FAILURE); // depends on control dependency: [if], data = [none]
return false; // depends on control dependency: [if], data = [none]
}
}
} }
|
public class class_name {
protected static <T> T modifyKeys(T object, Function<String, String> keyMapper, String toReplace) {
if (object instanceof Map) {
Map<String, Object> document = (Map<String, Object>) object;
List<String> keysWithDots = new LinkedList<>();
for (Map.Entry<String, Object> entry : document.entrySet()) {
if (entry.getKey().contains(toReplace)) {
keysWithDots.add(entry.getKey());
}
modifyKeys(entry.getValue(), keyMapper, toReplace);
}
for (String key : keysWithDots) {
Object o = document.remove(key);
document.put(keyMapper.apply(key), o);
}
} else if (object instanceof Collection) {
Collection collection = (Collection) object;
for (Object o : collection) {
modifyKeys(o, keyMapper, toReplace);
}
}
return object;
} }
|
public class class_name {
protected static <T> T modifyKeys(T object, Function<String, String> keyMapper, String toReplace) {
if (object instanceof Map) {
Map<String, Object> document = (Map<String, Object>) object;
List<String> keysWithDots = new LinkedList<>();
for (Map.Entry<String, Object> entry : document.entrySet()) {
if (entry.getKey().contains(toReplace)) {
keysWithDots.add(entry.getKey()); // depends on control dependency: [if], data = [none]
}
modifyKeys(entry.getValue(), keyMapper, toReplace); // depends on control dependency: [for], data = [entry]
}
for (String key : keysWithDots) {
Object o = document.remove(key);
document.put(keyMapper.apply(key), o); // depends on control dependency: [for], data = [key]
}
} else if (object instanceof Collection) {
Collection collection = (Collection) object;
for (Object o : collection) {
modifyKeys(o, keyMapper, toReplace); // depends on control dependency: [for], data = [o]
}
}
return object;
} }
|
public class class_name {
public void remove(String identifier, ItemData item)
{
boolean inTransaction = cache.isTransactionActive();
try
{
if (!inTransaction)
{
cache.beginTransaction();
}
cache.setLocal(true);
cache.remove(new CacheId(getOwnerId(), identifier), item);
}
finally
{
cache.setLocal(false);
if (!inTransaction)
{
dedicatedTxCommit();
}
}
} }
|
public class class_name {
public void remove(String identifier, ItemData item)
{
boolean inTransaction = cache.isTransactionActive();
try
{
if (!inTransaction)
{
cache.beginTransaction();
// depends on control dependency: [if], data = [none]
}
cache.setLocal(true);
// depends on control dependency: [try], data = [none]
cache.remove(new CacheId(getOwnerId(), identifier), item);
// depends on control dependency: [try], data = [none]
}
finally
{
cache.setLocal(false);
if (!inTransaction)
{
dedicatedTxCommit();
// depends on control dependency: [if], data = [none]
}
}
} }
|
public class class_name {
public TransactionConfidence getOrCreate(Sha256Hash hash) {
checkNotNull(hash);
lock.lock();
try {
WeakConfidenceReference reference = table.get(hash);
if (reference != null) {
TransactionConfidence confidence = reference.get();
if (confidence != null)
return confidence;
}
TransactionConfidence newConfidence = confidenceFactory.createConfidence(hash);
table.put(hash, new WeakConfidenceReference(newConfidence, referenceQueue));
return newConfidence;
} finally {
lock.unlock();
}
} }
|
public class class_name {
public TransactionConfidence getOrCreate(Sha256Hash hash) {
checkNotNull(hash);
lock.lock();
try {
WeakConfidenceReference reference = table.get(hash);
if (reference != null) {
TransactionConfidence confidence = reference.get();
if (confidence != null)
return confidence;
}
TransactionConfidence newConfidence = confidenceFactory.createConfidence(hash);
table.put(hash, new WeakConfidenceReference(newConfidence, referenceQueue)); // depends on control dependency: [try], data = [none]
return newConfidence; // depends on control dependency: [try], data = [none]
} finally {
lock.unlock();
}
} }
|
public class class_name {
public static int searchLast(int[] intArray, int value, int occurrence) {
if(occurrence <= 0 || occurrence > intArray.length) {
throw new IllegalArgumentException("Occurrence must be greater or equal to 1 and less than "
+ "the array length: " + occurrence);
}
int valuesSeen = 0;
for(int i = intArray.length-1; i >=0; i--) {
if(intArray[i] == value) {
valuesSeen++;
if(valuesSeen == occurrence) {
return i;
}
}
}
return -1;
} }
|
public class class_name {
public static int searchLast(int[] intArray, int value, int occurrence) {
if(occurrence <= 0 || occurrence > intArray.length) {
throw new IllegalArgumentException("Occurrence must be greater or equal to 1 and less than "
+ "the array length: " + occurrence);
}
int valuesSeen = 0;
for(int i = intArray.length-1; i >=0; i--) {
if(intArray[i] == value) {
valuesSeen++; // depends on control dependency: [if], data = [none]
if(valuesSeen == occurrence) {
return i; // depends on control dependency: [if], data = [none]
}
}
}
return -1;
} }
|
public class class_name {
public com.google.protobuf.ByteString
getPivotForBodyNameBytes() {
java.lang.Object ref = pivotForBodyName_;
if (ref instanceof java.lang.String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
pivotForBodyName_ = b;
return b;
} else {
return (com.google.protobuf.ByteString) ref;
}
} }
|
public class class_name {
public com.google.protobuf.ByteString
getPivotForBodyNameBytes() {
java.lang.Object ref = pivotForBodyName_;
if (ref instanceof java.lang.String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8(
(java.lang.String) ref);
pivotForBodyName_ = 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 {
private String _write_multi_line(String tag, String text) {
if (text == null) {
text = "";
}
int max_len = MAX_WIDTH - HEADER_WIDTH;
ArrayList<String> lines = _split_multi_line(text, max_len);
String output = _write_single_line(tag, lines.get(0));
for (int i = 1; i < lines.size(); i++) {
output += _write_single_line("", lines.get(i));
}
return output;
} }
|
public class class_name {
private String _write_multi_line(String tag, String text) {
if (text == null) {
text = ""; // depends on control dependency: [if], data = [none]
}
int max_len = MAX_WIDTH - HEADER_WIDTH;
ArrayList<String> lines = _split_multi_line(text, max_len);
String output = _write_single_line(tag, lines.get(0));
for (int i = 1; i < lines.size(); i++) {
output += _write_single_line("", lines.get(i)); // depends on control dependency: [for], data = [i]
}
return output;
} }
|
public class class_name {
public static int decodeLength(ByteBuffer buf) {
if (buf == null || buf.remaining() == 0) {
throw new IllegalArgumentException("Null or empty buffer");
}
int len = 0;
byte first = buf.get();
if (first >> 7 == 0) {
// Bit 8 is zero: Short form
len = first & 0x7f;
} else {
// Bit 8 is one: Long form
// Bit 7-1 represents number of subsequent octets
int numOctets = first & 0x7f;
if (buf.remaining() < numOctets) {
throw new IllegalArgumentException("Insufficient data to decode long-form DER length");
}
// Combine subsequent octets to compute length
for (int i = 0; i < numOctets; i++) {
len = (len << 8) + (0xff & buf.get());
}
}
return len;
} }
|
public class class_name {
public static int decodeLength(ByteBuffer buf) {
if (buf == null || buf.remaining() == 0) {
throw new IllegalArgumentException("Null or empty buffer");
}
int len = 0;
byte first = buf.get();
if (first >> 7 == 0) {
// Bit 8 is zero: Short form
len = first & 0x7f; // depends on control dependency: [if], data = [none]
} else {
// Bit 8 is one: Long form
// Bit 7-1 represents number of subsequent octets
int numOctets = first & 0x7f;
if (buf.remaining() < numOctets) {
throw new IllegalArgumentException("Insufficient data to decode long-form DER length");
}
// Combine subsequent octets to compute length
for (int i = 0; i < numOctets; i++) {
len = (len << 8) + (0xff & buf.get()); // depends on control dependency: [for], data = [none]
}
}
return len;
} }
|
public class class_name {
public static boolean isEmptyMethodString(final String str) {
if (str == null) {
return false;
}
return str.startsWith(TieConstants.METHOD_PREFIX);
} }
|
public class class_name {
public static boolean isEmptyMethodString(final String str) {
if (str == null) {
return false;
// depends on control dependency: [if], data = [none]
}
return str.startsWith(TieConstants.METHOD_PREFIX);
} }
|
public class class_name {
private static void registerMiddlewareHandler(Object handler) {
if(handler instanceof MiddlewareHandler) {
// register the middleware handler if it is enabled.
if(((MiddlewareHandler) handler).isEnabled()) {
((MiddlewareHandler) handler).register();
}
}
} }
|
public class class_name {
private static void registerMiddlewareHandler(Object handler) {
if(handler instanceof MiddlewareHandler) {
// register the middleware handler if it is enabled.
if(((MiddlewareHandler) handler).isEnabled()) {
((MiddlewareHandler) handler).register(); // depends on control dependency: [if], data = [none]
}
}
} }
|
public class class_name {
public long remove(Data data) {
Iterator<QueueItem> iterator = getItemQueue().iterator();
while (iterator.hasNext()) {
QueueItem item = iterator.next();
if (data.equals(item.getData())) {
if (store.isEnabled()) {
try {
store.delete(item.getItemId());
} catch (Exception e) {
throw new HazelcastException(e);
}
}
iterator.remove();
// for stats
age(item, Clock.currentTimeMillis());
scheduleEvictionIfEmpty();
return item.getItemId();
}
}
return -1;
} }
|
public class class_name {
public long remove(Data data) {
Iterator<QueueItem> iterator = getItemQueue().iterator();
while (iterator.hasNext()) {
QueueItem item = iterator.next();
if (data.equals(item.getData())) {
if (store.isEnabled()) {
try {
store.delete(item.getItemId()); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new HazelcastException(e);
} // depends on control dependency: [catch], data = [none]
}
iterator.remove(); // depends on control dependency: [if], data = [none]
// for stats
age(item, Clock.currentTimeMillis()); // depends on control dependency: [if], data = [none]
scheduleEvictionIfEmpty(); // depends on control dependency: [if], data = [none]
return item.getItemId(); // depends on control dependency: [if], data = [none]
}
}
return -1;
} }
|
public class class_name {
@JsonIgnore
public void setTag(String key, String value) {
requireArgument(key != null && !key.trim().isEmpty(), "Tag key cannot be null.");
requireArgument(!ReservedField.isReservedField(key), "Tag is a reserved tag name.");
if (value == null || value.isEmpty()) {
_tags.remove(key);
} else {
_tags.put(key, value);
}
} }
|
public class class_name {
@JsonIgnore
public void setTag(String key, String value) {
requireArgument(key != null && !key.trim().isEmpty(), "Tag key cannot be null.");
requireArgument(!ReservedField.isReservedField(key), "Tag is a reserved tag name.");
if (value == null || value.isEmpty()) {
_tags.remove(key); // depends on control dependency: [if], data = [none]
} else {
_tags.put(key, value); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public static void setRepositoriesWritable(final boolean writable) {
for (final Map.Entry<String, Repository> entry : REPOS_HOLDER.entrySet()) {
final String repositoryName = entry.getKey();
final Repository repository = entry.getValue();
repository.setWritable(writable);
LOGGER.log(Level.INFO, "Sets repository[name={0}] writable[{1}]", new Object[]{repositoryName, writable});
}
repositoryiesWritable = writable;
} }
|
public class class_name {
public static void setRepositoriesWritable(final boolean writable) {
for (final Map.Entry<String, Repository> entry : REPOS_HOLDER.entrySet()) {
final String repositoryName = entry.getKey();
final Repository repository = entry.getValue();
repository.setWritable(writable); // depends on control dependency: [for], data = [none]
LOGGER.log(Level.INFO, "Sets repository[name={0}] writable[{1}]", new Object[]{repositoryName, writable}); // depends on control dependency: [for], data = [none]
}
repositoryiesWritable = writable;
} }
|
public class class_name {
private void setConstantSpecs(EntitySpec[] constantParameterSpecs) {
if (constantParameterSpecs == null) {
this.constantSpecs = EMPTY_ES_ARR;
} else {
this.constantSpecs = constantParameterSpecs.clone();
}
} }
|
public class class_name {
private void setConstantSpecs(EntitySpec[] constantParameterSpecs) {
if (constantParameterSpecs == null) {
this.constantSpecs = EMPTY_ES_ARR; // depends on control dependency: [if], data = [none]
} else {
this.constantSpecs = constantParameterSpecs.clone(); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public static Serializer switchSerializerIfHTML(
String ns, String localName, Properties props, Serializer oldSerializer)
throws TransformerException
{
Serializer newSerializer = oldSerializer;
if (((null == ns) || (ns.length() == 0))
&& localName.equalsIgnoreCase("html"))
{
// System.out.println("transformer.getOutputPropertyNoDefault(OutputKeys.METHOD): "+
// transformer.getOutputPropertyNoDefault(OutputKeys.METHOD));
// Access at level of hashtable to see if the method has been set.
if (null != getOutputPropertyNoDefault(OutputKeys.METHOD, props))
return newSerializer;
// Getting the output properties this way won't cause a clone of
// the properties.
Properties prevProperties = props;
// We have to make sure we get an output properties with the proper
// defaults for the HTML method. The easiest way to do this is to
// have the OutputProperties class do it.
OutputProperties htmlOutputProperties = new OutputProperties(Method.HTML);
htmlOutputProperties.copyFrom(prevProperties, true);
Properties htmlProperties = htmlOutputProperties.getProperties();
// try
{
if (null != oldSerializer)
{
Serializer serializer =
SerializerFactory.getSerializer(htmlProperties);
Writer writer = oldSerializer.getWriter();
if (null != writer)
serializer.setWriter(writer);
else
{
OutputStream os = serializer.getOutputStream();
if (null != os)
serializer.setOutputStream(os);
}
newSerializer = serializer;
}
}
// catch (java.io.IOException e)
// {
// throw new TransformerException(e);
// }
}
return newSerializer;
} }
|
public class class_name {
public static Serializer switchSerializerIfHTML(
String ns, String localName, Properties props, Serializer oldSerializer)
throws TransformerException
{
Serializer newSerializer = oldSerializer;
if (((null == ns) || (ns.length() == 0))
&& localName.equalsIgnoreCase("html"))
{
// System.out.println("transformer.getOutputPropertyNoDefault(OutputKeys.METHOD): "+
// transformer.getOutputPropertyNoDefault(OutputKeys.METHOD));
// Access at level of hashtable to see if the method has been set.
if (null != getOutputPropertyNoDefault(OutputKeys.METHOD, props))
return newSerializer;
// Getting the output properties this way won't cause a clone of
// the properties.
Properties prevProperties = props;
// We have to make sure we get an output properties with the proper
// defaults for the HTML method. The easiest way to do this is to
// have the OutputProperties class do it.
OutputProperties htmlOutputProperties = new OutputProperties(Method.HTML);
htmlOutputProperties.copyFrom(prevProperties, true);
Properties htmlProperties = htmlOutputProperties.getProperties();
// try
{
if (null != oldSerializer)
{
Serializer serializer =
SerializerFactory.getSerializer(htmlProperties);
Writer writer = oldSerializer.getWriter();
if (null != writer)
serializer.setWriter(writer);
else
{
OutputStream os = serializer.getOutputStream();
if (null != os)
serializer.setOutputStream(os);
}
newSerializer = serializer; // depends on control dependency: [if], data = [none]
}
}
// catch (java.io.IOException e)
// {
// throw new TransformerException(e);
// }
}
return newSerializer;
} }
|
public class class_name {
private HeaderElement findHeader(HeaderKeys key, int instance) {
final int ord = key.getOrdinal();
if (!storage.containsKey(ord) && ord <= HttpHeaderKeys.ORD_MAX) {
return null;
}
HeaderElement elem = null;
//If the ordinal created for this key is larger than 1024, the header key
//storage has been capped. As such, search the internal header storage
//to see if we have a header with this name already added.
if (ord > HttpHeaderKeys.ORD_MAX) {
for (HeaderElement header : storage.values()) {
if (header.getKey().getName().equals(key.getName())) {
elem = header;
break;
}
}
} else {
elem = storage.get(ord);
}
int i = -1;
while (null != elem) {
if (!elem.wasRemoved()) {
if (++i == instance) {
return elem;
}
}
elem = elem.nextInstance;
}
return null;
} }
|
public class class_name {
private HeaderElement findHeader(HeaderKeys key, int instance) {
final int ord = key.getOrdinal();
if (!storage.containsKey(ord) && ord <= HttpHeaderKeys.ORD_MAX) {
return null; // depends on control dependency: [if], data = [none]
}
HeaderElement elem = null;
//If the ordinal created for this key is larger than 1024, the header key
//storage has been capped. As such, search the internal header storage
//to see if we have a header with this name already added.
if (ord > HttpHeaderKeys.ORD_MAX) {
for (HeaderElement header : storage.values()) {
if (header.getKey().getName().equals(key.getName())) {
elem = header; // depends on control dependency: [if], data = [none]
break;
}
}
} else {
elem = storage.get(ord); // depends on control dependency: [if], data = [(ord]
}
int i = -1;
while (null != elem) {
if (!elem.wasRemoved()) {
if (++i == instance) {
return elem; // depends on control dependency: [if], data = [none]
}
}
elem = elem.nextInstance; // depends on control dependency: [while], data = [none]
}
return null;
} }
|
public class class_name {
protected void combineContentItem(
String itemValue,
String itemKey,
StringBuffer content,
Map<String, String> contentItems) {
if (CmsStringUtil.isNotEmpty(itemValue)) {
contentItems.put(itemKey, itemValue);
content.append('\n');
content.append(itemValue);
}
} }
|
public class class_name {
protected void combineContentItem(
String itemValue,
String itemKey,
StringBuffer content,
Map<String, String> contentItems) {
if (CmsStringUtil.isNotEmpty(itemValue)) {
contentItems.put(itemKey, itemValue); // depends on control dependency: [if], data = [none]
content.append('\n'); // depends on control dependency: [if], data = [none]
content.append(itemValue); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
@Override
public void put(Key key, Value value) {
if (value == null) {
delete(key);
return;
}
root = put(root, key, value);
root.setParent(null);
root.setColor(BLACK);
} }
|
public class class_name {
@Override
public void put(Key key, Value value) {
if (value == null) {
delete(key); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
root = put(root, key, value);
root.setParent(null);
root.setColor(BLACK);
} }
|
public class class_name {
@Override
public void close(RetryContext context) {
RetryContext[] contexts = ((CompositeRetryContext) context).contexts;
RetryPolicy[] policies = ((CompositeRetryContext) context).policies;
RuntimeException exception = null;
for (int i = 0; i < contexts.length; i++) {
try {
policies[i].close(contexts[i]);
}
catch (RuntimeException e) {
if (exception == null) {
exception = e;
}
}
}
if (exception != null) {
throw exception;
}
} }
|
public class class_name {
@Override
public void close(RetryContext context) {
RetryContext[] contexts = ((CompositeRetryContext) context).contexts;
RetryPolicy[] policies = ((CompositeRetryContext) context).policies;
RuntimeException exception = null;
for (int i = 0; i < contexts.length; i++) {
try {
policies[i].close(contexts[i]); // depends on control dependency: [try], data = [none]
}
catch (RuntimeException e) {
if (exception == null) {
exception = e; // depends on control dependency: [if], data = [none]
}
} // depends on control dependency: [catch], data = [none]
}
if (exception != null) {
throw exception;
}
} }
|
public class class_name {
private void handleClusterEvent(ClusterMembershipEvent event) {
PrimaryTerm term = this.term;
if (term != null
&& event.type() == ClusterMembershipEvent.Type.MEMBER_REMOVED
&& event.subject().id().equals(term.primary().memberId())) {
changeState(PrimitiveState.SUSPENDED);
}
} }
|
public class class_name {
private void handleClusterEvent(ClusterMembershipEvent event) {
PrimaryTerm term = this.term;
if (term != null
&& event.type() == ClusterMembershipEvent.Type.MEMBER_REMOVED
&& event.subject().id().equals(term.primary().memberId())) {
changeState(PrimitiveState.SUSPENDED); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
@FFDCIgnore(BundleException.class)
public BundleLifecycleStatus preStartBundles(List<Bundle> installedBundles) {
BundleLifecycleStatus startStatus = new BundleLifecycleStatus();
if (installedBundles == null || installedBundles.size() == 0)
return startStatus;
for (Bundle b : installedBundles) {
// Skip any null bundles in the list
if (b == null)
continue;
int state = b.getState();
// Only start bundles that are in certain states (not UNINSTALLED, or already STARTING)
if (state == Bundle.UNINSTALLED || state >= org.osgi.framework.Bundle.STARTING)
continue;
try {
b.start(Bundle.START_ACTIVATION_POLICY);
} catch (BundleException e) {
// No FFDC, these are handled later.
startStatus.addStartException(b, e);
}
}
return startStatus;
} }
|
public class class_name {
@FFDCIgnore(BundleException.class)
public BundleLifecycleStatus preStartBundles(List<Bundle> installedBundles) {
BundleLifecycleStatus startStatus = new BundleLifecycleStatus();
if (installedBundles == null || installedBundles.size() == 0)
return startStatus;
for (Bundle b : installedBundles) {
// Skip any null bundles in the list
if (b == null)
continue;
int state = b.getState();
// Only start bundles that are in certain states (not UNINSTALLED, or already STARTING)
if (state == Bundle.UNINSTALLED || state >= org.osgi.framework.Bundle.STARTING)
continue;
try {
b.start(Bundle.START_ACTIVATION_POLICY); // depends on control dependency: [try], data = [none]
} catch (BundleException e) {
// No FFDC, these are handled later.
startStatus.addStartException(b, e);
} // depends on control dependency: [catch], data = [none]
}
return startStatus;
} }
|
public class class_name {
protected boolean isSwitchingToNonHttp1Protocol(HttpResponse msg) {
if (msg.status().code() != HttpResponseStatus.SWITCHING_PROTOCOLS.code()) {
return false;
}
String newProtocol = msg.headers().get(HttpHeaderNames.UPGRADE);
return newProtocol == null ||
!newProtocol.contains(HttpVersion.HTTP_1_0.text()) &&
!newProtocol.contains(HttpVersion.HTTP_1_1.text());
} }
|
public class class_name {
protected boolean isSwitchingToNonHttp1Protocol(HttpResponse msg) {
if (msg.status().code() != HttpResponseStatus.SWITCHING_PROTOCOLS.code()) {
return false; // depends on control dependency: [if], data = [none]
}
String newProtocol = msg.headers().get(HttpHeaderNames.UPGRADE);
return newProtocol == null ||
!newProtocol.contains(HttpVersion.HTTP_1_0.text()) &&
!newProtocol.contains(HttpVersion.HTTP_1_1.text());
} }
|
public class class_name {
private int findSingleHit(ArrayDouble.D2 boundsForRun, double target) {
int hits = 0;
int idxFound = -1;
int n = boundsForRun.getShape()[0];
for (int i = 0; i < n; i++) {
if (contains(target, boundsForRun.get(i,0), boundsForRun.get(i,1))) {
hits++;
idxFound = i;
}
}
if (hits == 1) return idxFound;
if (hits == 0) return -1;
return -hits;
} }
|
public class class_name {
private int findSingleHit(ArrayDouble.D2 boundsForRun, double target) {
int hits = 0;
int idxFound = -1;
int n = boundsForRun.getShape()[0];
for (int i = 0; i < n; i++) {
if (contains(target, boundsForRun.get(i,0), boundsForRun.get(i,1))) {
hits++;
// depends on control dependency: [if], data = [none]
idxFound = i;
// depends on control dependency: [if], data = [none]
}
}
if (hits == 1) return idxFound;
if (hits == 0) return -1;
return -hits;
} }
|
public class class_name {
@Override
public int predict(double[] x, double[] posteriori) {
if (x.length != p) {
throw new IllegalArgumentException(String.format("Invalid input vector size: %d", x.length));
}
if (posteriori != null && posteriori.length != k) {
throw new IllegalArgumentException(String.format("Invalid posteriori vector size: %d, expected: %d", posteriori.length, k));
}
int label = -1;
double max = Double.NEGATIVE_INFINITY;
boolean any = model == Model.GENERAL ? true : false;
for (int i = 0; i < k; i++) {
double logprob = Math.log(priori[i]);
for (int j = 0; j < p; j++) {
switch (model) {
case GENERAL:
logprob += prob[i][j].logp(x[j]);
break;
case MULTINOMIAL:
case POLYAURN:
if (x[j] > 0) {
logprob += x[j] * Math.log(condprob[i][j]);
any = true;
}
break;
case BERNOULLI:
if (x[j] > 0) {
logprob += Math.log(condprob[i][j]);
any = true;
} else {
logprob += Math.log(1.0 - condprob[i][j]);
}
break;
}
}
if (logprob > max && any) {
max = logprob;
label = i;
}
if (posteriori != null) {
posteriori[i] = logprob;
}
}
if (posteriori != null && any) {
double Z = 0.0;
for (int i = 0; i < k; i++) {
posteriori[i] = Math.exp(posteriori[i] - max);
Z += posteriori[i];
}
for (int i = 0; i < k; i++) {
posteriori[i] /= Z;
}
}
return label;
} }
|
public class class_name {
@Override
public int predict(double[] x, double[] posteriori) {
if (x.length != p) {
throw new IllegalArgumentException(String.format("Invalid input vector size: %d", x.length));
}
if (posteriori != null && posteriori.length != k) {
throw new IllegalArgumentException(String.format("Invalid posteriori vector size: %d, expected: %d", posteriori.length, k));
}
int label = -1;
double max = Double.NEGATIVE_INFINITY;
boolean any = model == Model.GENERAL ? true : false;
for (int i = 0; i < k; i++) {
double logprob = Math.log(priori[i]);
for (int j = 0; j < p; j++) {
switch (model) {
case GENERAL:
logprob += prob[i][j].logp(x[j]);
break;
case MULTINOMIAL:
case POLYAURN:
if (x[j] > 0) {
logprob += x[j] * Math.log(condprob[i][j]); // depends on control dependency: [if], data = [none]
any = true; // depends on control dependency: [if], data = [none]
}
break;
case BERNOULLI:
if (x[j] > 0) {
logprob += Math.log(condprob[i][j]); // depends on control dependency: [if], data = [none]
any = true; // depends on control dependency: [if], data = [none]
} else {
logprob += Math.log(1.0 - condprob[i][j]); // depends on control dependency: [if], data = [none]
}
break;
}
}
if (logprob > max && any) {
max = logprob; // depends on control dependency: [if], data = [none]
label = i; // depends on control dependency: [if], data = [none]
}
if (posteriori != null) {
posteriori[i] = logprob; // depends on control dependency: [if], data = [none]
}
}
if (posteriori != null && any) {
double Z = 0.0;
for (int i = 0; i < k; i++) {
posteriori[i] = Math.exp(posteriori[i] - max); // depends on control dependency: [for], data = [i]
Z += posteriori[i]; // depends on control dependency: [for], data = [i]
}
for (int i = 0; i < k; i++) {
posteriori[i] /= Z; // depends on control dependency: [for], data = [i]
}
}
return label;
} }
|
public class class_name {
private void enumerative( EnumDeclarationDescrBuilder declare ) {
EnumLiteralDescrBuilder literal = null;
String lit = null;
try {
Token enumLit = match( input,
DRL5Lexer.ID,
null,
null,
DroolsEditorType.IDENTIFIER );
lit = enumLit.getText();
if ( state.failed ) return;
} catch ( RecognitionException re ) {
reportError( re );
}
try {
literal = helper.start( declare,
EnumLiteralDescrBuilder.class,
lit );
if ( input.LA( 1 ) == DRL5Lexer.LEFT_PAREN ) {
match( input,
DRL5Lexer.LEFT_PAREN,
null,
null,
DroolsEditorType.SYMBOL );
if ( state.failed ) return;
boolean more;
do {
int first = input.index();
exprParser.conditionalExpression();
if ( state.failed ) return;
if ( state.backtracking == 0 && input.index() > first ) {
// expression consumed something
String arg = input.toString( first,
input.LT( -1 ).getTokenIndex() );
literal.constructorArg( arg );
}
more = input.LA( 1 ) == DRL5Lexer.COMMA;
if ( more ) {
match( input,
DRL5Lexer.COMMA,
null,
null,
DroolsEditorType.SYMBOL );
}
} while ( more );
match( input,
DRL5Lexer.RIGHT_PAREN,
null,
null,
DroolsEditorType.SYMBOL );
if ( state.failed ) return;
}
} catch ( RecognitionException re ) {
reportError( re );
} finally {
helper.end( FieldDescrBuilder.class,
literal );
}
} }
|
public class class_name {
private void enumerative( EnumDeclarationDescrBuilder declare ) {
EnumLiteralDescrBuilder literal = null;
String lit = null;
try {
Token enumLit = match( input,
DRL5Lexer.ID,
null,
null,
DroolsEditorType.IDENTIFIER );
lit = enumLit.getText(); // depends on control dependency: [try], data = [none]
if ( state.failed ) return;
} catch ( RecognitionException re ) {
reportError( re );
} // depends on control dependency: [catch], data = [none]
try {
literal = helper.start( declare,
EnumLiteralDescrBuilder.class,
lit ); // depends on control dependency: [try], data = [none]
if ( input.LA( 1 ) == DRL5Lexer.LEFT_PAREN ) {
match( input,
DRL5Lexer.LEFT_PAREN,
null,
null,
DroolsEditorType.SYMBOL ); // depends on control dependency: [if], data = [none]
if ( state.failed ) return;
boolean more;
do {
int first = input.index();
exprParser.conditionalExpression();
if ( state.failed ) return;
if ( state.backtracking == 0 && input.index() > first ) {
// expression consumed something
String arg = input.toString( first,
input.LT( -1 ).getTokenIndex() );
literal.constructorArg( arg ); // depends on control dependency: [if], data = [none]
}
more = input.LA( 1 ) == DRL5Lexer.COMMA;
if ( more ) {
match( input,
DRL5Lexer.COMMA,
null,
null,
DroolsEditorType.SYMBOL ); // depends on control dependency: [if], data = [none]
}
} while ( more );
match( input,
DRL5Lexer.RIGHT_PAREN,
null,
null,
DroolsEditorType.SYMBOL ); // depends on control dependency: [if], data = [none]
if ( state.failed ) return;
}
} catch ( RecognitionException re ) {
reportError( re );
} finally { // depends on control dependency: [catch], data = [none]
helper.end( FieldDescrBuilder.class,
literal );
}
} }
|
public class class_name {
private boolean includeInStartPosition(final int currentColumn, final int currentRow) {
if(startColumn >=0 && startRow >= 0
&& currentColumn == startColumn && currentRow == startRow) {
// 行と列の両方の指定がある場合
return true;
} else if(startColumn >= 0 && startRow < 0 && currentColumn == startColumn) {
// 列の指定のみ
return true;
} else if(startColumn < 0 && startRow >= 0 && currentRow == startRow) {
// 行の指定のみ
return true;
}
return false;
} }
|
public class class_name {
private boolean includeInStartPosition(final int currentColumn, final int currentRow) {
if(startColumn >=0 && startRow >= 0
&& currentColumn == startColumn && currentRow == startRow) {
// 行と列の両方の指定がある場合
return true;
// depends on control dependency: [if], data = [none]
} else if(startColumn >= 0 && startRow < 0 && currentColumn == startColumn) {
// 列の指定のみ
return true;
// depends on control dependency: [if], data = [none]
} else if(startColumn < 0 && startRow >= 0 && currentRow == startRow) {
// 行の指定のみ
return true;
// depends on control dependency: [if], data = [none]
}
return false;
} }
|
public class class_name {
public static byte[] getLMv2Response(String domain, String user,
String password, byte[] challenge, byte[] clientChallenge) {
try {
byte[] hash = new byte[16];
byte[] response = new byte[24];
// The next 2-1/2 lines of this should be placed with nTOWFv1 in place of password
MD4 md4 = new MD4();
md4.update(password.getBytes(SmbConstants.UNI_ENCODING));
HMACT64 hmac = new HMACT64(md4.digest());
hmac.update(user.toUpperCase().getBytes(SmbConstants.UNI_ENCODING));
hmac.update(domain.toUpperCase().getBytes(SmbConstants.UNI_ENCODING));
hmac = new HMACT64(hmac.digest());
hmac.update(challenge);
hmac.update(clientChallenge);
hmac.digest(response, 0, 16);
System.arraycopy(clientChallenge, 0, response, 16, 8);
return response;
} catch (Exception ex) {
if( log.level > 0 )
ex.printStackTrace( log );
return null;
}
} }
|
public class class_name {
public static byte[] getLMv2Response(String domain, String user,
String password, byte[] challenge, byte[] clientChallenge) {
try {
byte[] hash = new byte[16];
byte[] response = new byte[24];
// The next 2-1/2 lines of this should be placed with nTOWFv1 in place of password
MD4 md4 = new MD4();
md4.update(password.getBytes(SmbConstants.UNI_ENCODING));
// depends on control dependency: [try], data = [none]
HMACT64 hmac = new HMACT64(md4.digest());
hmac.update(user.toUpperCase().getBytes(SmbConstants.UNI_ENCODING));
// depends on control dependency: [try], data = [none]
hmac.update(domain.toUpperCase().getBytes(SmbConstants.UNI_ENCODING));
// depends on control dependency: [try], data = [none]
hmac = new HMACT64(hmac.digest());
// depends on control dependency: [try], data = [none]
hmac.update(challenge);
// depends on control dependency: [try], data = [none]
hmac.update(clientChallenge);
// depends on control dependency: [try], data = [none]
hmac.digest(response, 0, 16);
// depends on control dependency: [try], data = [none]
System.arraycopy(clientChallenge, 0, response, 16, 8);
// depends on control dependency: [try], data = [none]
return response;
// depends on control dependency: [try], data = [none]
} catch (Exception ex) {
if( log.level > 0 )
ex.printStackTrace( log );
return null;
}
// depends on control dependency: [catch], data = [none]
} }
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.