code
stringlengths
130
281k
code_dependency
stringlengths
182
306k
public class class_name { private ParseTree parseImportSpecifier() { SourcePosition start = getTreeStartLocation(); IdentifierToken importedName = eatIdOrKeywordAsId(); IdentifierToken destinationName = null; if (peekPredefinedString(PredefinedName.AS)) { eatPredefinedString(PredefinedName.AS); destinationName = eatId(); } else if (isKeyword(importedName.value)) { reportExpectedError(null, PredefinedName.AS); } return new ImportSpecifierTree( getTreeLocation(start), importedName, destinationName); } }
public class class_name { private ParseTree parseImportSpecifier() { SourcePosition start = getTreeStartLocation(); IdentifierToken importedName = eatIdOrKeywordAsId(); IdentifierToken destinationName = null; if (peekPredefinedString(PredefinedName.AS)) { eatPredefinedString(PredefinedName.AS); // depends on control dependency: [if], data = [none] destinationName = eatId(); // depends on control dependency: [if], data = [none] } else if (isKeyword(importedName.value)) { reportExpectedError(null, PredefinedName.AS); // depends on control dependency: [if], data = [none] } return new ImportSpecifierTree( getTreeLocation(start), importedName, destinationName); } }
public class class_name { @Override public void skipElement() throws XMLStreamException { if (mCurrToken != START_ELEMENT) { throw new IllegalStateException(ErrorConsts.ERR_STATE_NOT_STELEM); } int nesting = 1; // need one more end elements than start elements while (true) { int type = next(); if (type == START_ELEMENT) { ++nesting; } else if (type == END_ELEMENT) { if (--nesting == 0) { break; } } } } }
public class class_name { @Override public void skipElement() throws XMLStreamException { if (mCurrToken != START_ELEMENT) { throw new IllegalStateException(ErrorConsts.ERR_STATE_NOT_STELEM); } int nesting = 1; // need one more end elements than start elements while (true) { int type = next(); if (type == START_ELEMENT) { ++nesting; // depends on control dependency: [if], data = [none] } else if (type == END_ELEMENT) { if (--nesting == 0) { break; } } } } }
public class class_name { private Object extractValue(Object aValue, String aName, String bName) { Class aClass = aValue.getClass(); Object value; // // a.isB() or a.getB() // String bNameCapped = Character.toUpperCase(bName.charAt(0)) + bName.substring(1); Method getMethod = null; Class retType; // // try a.isB() first, if found verify that a.isB() returns a boolean value, // and that there is not also a a.getB() method - if there is except // try { getMethod = aClass.getMethod("is" + bNameCapped, (Class[]) null); retType = getMethod.getReturnType(); if (!(retType.equals(Boolean.class) || retType.equals(Boolean.TYPE))) { // only boolean returns can be isB() getMethod = null; } else { /** * make sure ("get" + bNameCapped) does not exist as well * see CR216159 */ boolean getMethodFound = true; try { aClass.getMethod("get" + bNameCapped, (Class[])null); } catch (NoSuchMethodException e) { getMethodFound = false; } if (getMethodFound) { throw new ControlException("Colliding field accsessors in user defined class '" + aClass.getName() + "' for field '" + bName + "'. Please use is<FieldName> for boolean fields and get<FieldName> name for other datatypes."); } } } catch (NoSuchMethodException e) { // ignore } // // try a.getB() if a.isB() was not found. // if (getMethod == null) { try { getMethod = aClass.getMethod("get" + bNameCapped, (Class[])null); } catch (NoSuchMethodException e) { // ignore } } if (getMethod != null) { // OK- a.getB() try { value = getMethod.invoke(aValue, (Object[]) null); } catch (IllegalAccessException e) { throw new ControlException("Unable to access public method: " + e.toString()); } catch (java.lang.reflect.InvocationTargetException e) { throw new ControlException("Exception thrown when executing : " + getMethod.getName() + "() to use as parameter"); } return value; } // // try a.b // try { value = aClass.getField(bName).get(aValue); return value; } catch (NoSuchFieldException e) { // ignore } catch (IllegalAccessException e) { // ignore } // // try a.get(b) // if (aValue instanceof Map) { try { value = TypeMappingsFactory.getInstance().lookupType(aValue, new Object[]{bName}); return value; } catch (Exception mapex) { throw new ControlException("Exception thrown when executing Map.get() to resolve parameter" + mapex.toString()); } } // no other options... throw new ControlException("Illegal argument in SQL statement: " + _parameterName + "; unable to find suitable method of retrieving property " + bName + " out of object " + aName + "."); } }
public class class_name { private Object extractValue(Object aValue, String aName, String bName) { Class aClass = aValue.getClass(); Object value; // // a.isB() or a.getB() // String bNameCapped = Character.toUpperCase(bName.charAt(0)) + bName.substring(1); Method getMethod = null; Class retType; // // try a.isB() first, if found verify that a.isB() returns a boolean value, // and that there is not also a a.getB() method - if there is except // try { getMethod = aClass.getMethod("is" + bNameCapped, (Class[]) null); // depends on control dependency: [try], data = [none] retType = getMethod.getReturnType(); // depends on control dependency: [try], data = [none] if (!(retType.equals(Boolean.class) || retType.equals(Boolean.TYPE))) { // only boolean returns can be isB() getMethod = null; // depends on control dependency: [if], data = [none] } else { /** * make sure ("get" + bNameCapped) does not exist as well * see CR216159 */ boolean getMethodFound = true; try { aClass.getMethod("get" + bNameCapped, (Class[])null); // depends on control dependency: [try], data = [none] } catch (NoSuchMethodException e) { getMethodFound = false; } // depends on control dependency: [catch], data = [none] if (getMethodFound) { throw new ControlException("Colliding field accsessors in user defined class '" + aClass.getName() + "' for field '" + bName + "'. Please use is<FieldName> for boolean fields and get<FieldName> name for other datatypes."); } } } catch (NoSuchMethodException e) { // ignore } // depends on control dependency: [catch], data = [none] // // try a.getB() if a.isB() was not found. // if (getMethod == null) { try { getMethod = aClass.getMethod("get" + bNameCapped, (Class[])null); // depends on control dependency: [try], data = [none] } catch (NoSuchMethodException e) { // ignore } // depends on control dependency: [catch], data = [none] } if (getMethod != null) { // OK- a.getB() try { value = getMethod.invoke(aValue, (Object[]) null); // depends on control dependency: [try], data = [none] } catch (IllegalAccessException e) { throw new ControlException("Unable to access public method: " + e.toString()); } catch (java.lang.reflect.InvocationTargetException e) { // depends on control dependency: [catch], data = [none] throw new ControlException("Exception thrown when executing : " + getMethod.getName() + "() to use as parameter"); } return value; } // depends on control dependency: [catch], data = [none] // // try a.b // try { value = aClass.getField(bName).get(aValue); // depends on control dependency: [try], data = [none] return value; // depends on control dependency: [try], data = [none] } catch (NoSuchFieldException e) { // ignore } catch (IllegalAccessException e) { // depends on control dependency: [catch], data = [none] // ignore } // depends on control dependency: [catch], data = [none] // // try a.get(b) // if (aValue instanceof Map) { try { value = TypeMappingsFactory.getInstance().lookupType(aValue, new Object[]{bName}); // depends on control dependency: [try], data = [none] return value; // depends on control dependency: [try], data = [none] } catch (Exception mapex) { throw new ControlException("Exception thrown when executing Map.get() to resolve parameter" + mapex.toString()); } // depends on control dependency: [catch], data = [none] } // no other options... throw new ControlException("Illegal argument in SQL statement: " + _parameterName + "; unable to find suitable method of retrieving property " + bName + " out of object " + aName + "."); } }
public class class_name { protected void committableUpdated() { boolean committable = isCommittable(); if (hasChanged(oldCommittable, committable)) { oldCommittable = committable; firePropertyChange(COMMITTABLE_PROPERTY, !committable, committable); } } }
public class class_name { protected void committableUpdated() { boolean committable = isCommittable(); if (hasChanged(oldCommittable, committable)) { oldCommittable = committable; // depends on control dependency: [if], data = [none] firePropertyChange(COMMITTABLE_PROPERTY, !committable, committable); // depends on control dependency: [if], data = [none] } } }
public class class_name { public long getBackpointer(long newKeyNum) { int index = Arrays.binarySearch(newKeyNums, newKeyNum); if (index >= 0) { return oldKeyNums[index]; } return -1; } }
public class class_name { public long getBackpointer(long newKeyNum) { int index = Arrays.binarySearch(newKeyNums, newKeyNum); if (index >= 0) { return oldKeyNums[index]; // depends on control dependency: [if], data = [none] } return -1; } }
public class class_name { public <P extends Provider<?>> AbstractModule config(final Class<P> klass, final Configurator<P> configurator) { Function<P> initializer = new Function<P>() { @Override public P call(Object... args) { String m = ""; try { ProviderCreator creator = GWT.create(ProviderCreator.class); P provider = creator.create(klass); ProviderBinderFactory binderFactory = GWT.create(ProviderBinderFactory.class); JSClosure binder = binderFactory.create(provider); if (binder != null) { binder.apply(args); } LOG.log(Level.FINEST, "configuring " + klass.getName()); configurator.configure(provider); return provider; } catch (Exception e) { LOG.log(Level.WARNING, "Exception while " + m, e); return null; } } }; ProviderDependencyInspector inspector = GWT.create(ProviderDependencyInspector.class); String[] dependencies = inspector.inspect(klass); ngo.config(JSArray.create(dependencies), JSFunction.create(initializer)); return this; } }
public class class_name { public <P extends Provider<?>> AbstractModule config(final Class<P> klass, final Configurator<P> configurator) { Function<P> initializer = new Function<P>() { @Override public P call(Object... args) { String m = ""; try { ProviderCreator creator = GWT.create(ProviderCreator.class); P provider = creator.create(klass); ProviderBinderFactory binderFactory = GWT.create(ProviderBinderFactory.class); JSClosure binder = binderFactory.create(provider); if (binder != null) { binder.apply(args); // depends on control dependency: [if], data = [none] } LOG.log(Level.FINEST, "configuring " + klass.getName()); // depends on control dependency: [try], data = [none] configurator.configure(provider); // depends on control dependency: [try], data = [none] return provider; // depends on control dependency: [try], data = [none] } catch (Exception e) { LOG.log(Level.WARNING, "Exception while " + m, e); return null; } // depends on control dependency: [catch], data = [none] } }; ProviderDependencyInspector inspector = GWT.create(ProviderDependencyInspector.class); String[] dependencies = inspector.inspect(klass); ngo.config(JSArray.create(dependencies), JSFunction.create(initializer)); return this; } }
public class class_name { public void error(Marker marker, String format, Object arg1, Object arg2) { if (!logger.isErrorEnabled(marker)) return; if (instanceofLAL) { String formattedMessage = MessageFormatter.format(format, arg1, arg2).getMessage(); ((LocationAwareLogger) logger).log(marker, fqcn, LocationAwareLogger.ERROR_INT, formattedMessage, new Object[] { arg1, arg2 }, null); } else { logger.error(marker, format, arg1, arg2); } } }
public class class_name { public void error(Marker marker, String format, Object arg1, Object arg2) { if (!logger.isErrorEnabled(marker)) return; if (instanceofLAL) { String formattedMessage = MessageFormatter.format(format, arg1, arg2).getMessage(); ((LocationAwareLogger) logger).log(marker, fqcn, LocationAwareLogger.ERROR_INT, formattedMessage, new Object[] { arg1, arg2 }, null); // depends on control dependency: [if], data = [none] } else { logger.error(marker, format, arg1, arg2); // depends on control dependency: [if], data = [none] } } }
public class class_name { private void sendReset() { if (pullMode) { Ping recorded = new Ping(); recorded.setEventType(Ping.RECORDED_STREAM); recorded.setValue2(streamId); // recorded RTMPMessage recordedMsg = RTMPMessage.build(recorded); doPushMessage(recordedMsg); } Ping begin = new Ping(); begin.setEventType(Ping.STREAM_BEGIN); begin.setValue2(streamId); // begin RTMPMessage beginMsg = RTMPMessage.build(begin); doPushMessage(beginMsg); // reset ResetMessage reset = new ResetMessage(); doPushMessage(reset); } }
public class class_name { private void sendReset() { if (pullMode) { Ping recorded = new Ping(); recorded.setEventType(Ping.RECORDED_STREAM); // depends on control dependency: [if], data = [none] recorded.setValue2(streamId); // depends on control dependency: [if], data = [none] // recorded RTMPMessage recordedMsg = RTMPMessage.build(recorded); doPushMessage(recordedMsg); // depends on control dependency: [if], data = [none] } Ping begin = new Ping(); begin.setEventType(Ping.STREAM_BEGIN); begin.setValue2(streamId); // begin RTMPMessage beginMsg = RTMPMessage.build(begin); doPushMessage(beginMsg); // reset ResetMessage reset = new ResetMessage(); doPushMessage(reset); } }
public class class_name { public java.util.List<DeferredMaintenanceWindow> getDeferredMaintenanceWindows() { if (deferredMaintenanceWindows == null) { deferredMaintenanceWindows = new com.amazonaws.internal.SdkInternalList<DeferredMaintenanceWindow>(); } return deferredMaintenanceWindows; } }
public class class_name { public java.util.List<DeferredMaintenanceWindow> getDeferredMaintenanceWindows() { if (deferredMaintenanceWindows == null) { deferredMaintenanceWindows = new com.amazonaws.internal.SdkInternalList<DeferredMaintenanceWindow>(); // depends on control dependency: [if], data = [none] } return deferredMaintenanceWindows; } }
public class class_name { @Override public void enterScope(NodeTraversal t) { Node n = t.getScopeRoot(); BasicBlock parent = blockStack.isEmpty() ? null : peek(blockStack); // Don't add all ES6 scope roots to blockStack, only those that are also scopes according to // the ES5 scoping rules. Other nodes that ought to be considered the root of a BasicBlock // are added in shouldTraverse() or processScope() and removed in visit(). if (t.isHoistScope()) { blockStack.add(new BasicBlock(parent, n)); } } }
public class class_name { @Override public void enterScope(NodeTraversal t) { Node n = t.getScopeRoot(); BasicBlock parent = blockStack.isEmpty() ? null : peek(blockStack); // Don't add all ES6 scope roots to blockStack, only those that are also scopes according to // the ES5 scoping rules. Other nodes that ought to be considered the root of a BasicBlock // are added in shouldTraverse() or processScope() and removed in visit(). if (t.isHoistScope()) { blockStack.add(new BasicBlock(parent, n)); // depends on control dependency: [if], data = [none] } } }
public class class_name { public static CsvSchema convert(RowTypeInfo rowType) { final Builder builder = new CsvSchema.Builder(); final String[] fields = rowType.getFieldNames(); final TypeInformation<?>[] types = rowType.getFieldTypes(); for (int i = 0; i < rowType.getArity(); i++) { builder.addColumn(new Column(i, fields[i], convertType(fields[i], types[i]))); } return builder.build(); } }
public class class_name { public static CsvSchema convert(RowTypeInfo rowType) { final Builder builder = new CsvSchema.Builder(); final String[] fields = rowType.getFieldNames(); final TypeInformation<?>[] types = rowType.getFieldTypes(); for (int i = 0; i < rowType.getArity(); i++) { builder.addColumn(new Column(i, fields[i], convertType(fields[i], types[i]))); // depends on control dependency: [for], data = [i] } return builder.build(); } }
public class class_name { protected Set<Event> resolveMultifactorAuthenticationProvider(final Optional<RequestContext> context, final RegisteredService service, final Principal principal) { val globalPrincipalAttributeValueRegex = casProperties.getAuthn().getMfa().getGlobalPrincipalAttributeValueRegex(); val providerMap = MultifactorAuthenticationUtils.getAvailableMultifactorAuthenticationProviders(ApplicationContextProvider.getApplicationContext()); val providers = providerMap.values(); if (providers.size() == 1 && StringUtils.isNotBlank(globalPrincipalAttributeValueRegex)) { return resolveSingleMultifactorProvider(context, service, principal, providers); } return resolveMultifactorProviderViaPredicate(context, service, principal, providers); } }
public class class_name { protected Set<Event> resolveMultifactorAuthenticationProvider(final Optional<RequestContext> context, final RegisteredService service, final Principal principal) { val globalPrincipalAttributeValueRegex = casProperties.getAuthn().getMfa().getGlobalPrincipalAttributeValueRegex(); val providerMap = MultifactorAuthenticationUtils.getAvailableMultifactorAuthenticationProviders(ApplicationContextProvider.getApplicationContext()); val providers = providerMap.values(); if (providers.size() == 1 && StringUtils.isNotBlank(globalPrincipalAttributeValueRegex)) { return resolveSingleMultifactorProvider(context, service, principal, providers); // depends on control dependency: [if], data = [none] } return resolveMultifactorProviderViaPredicate(context, service, principal, providers); } }
public class class_name { public void marshall(DeleteLabelsRequest deleteLabelsRequest, ProtocolMarshaller protocolMarshaller) { if (deleteLabelsRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(deleteLabelsRequest.getResourceId(), RESOURCEID_BINDING); protocolMarshaller.marshall(deleteLabelsRequest.getAuthenticationToken(), AUTHENTICATIONTOKEN_BINDING); protocolMarshaller.marshall(deleteLabelsRequest.getLabels(), LABELS_BINDING); protocolMarshaller.marshall(deleteLabelsRequest.getDeleteAll(), DELETEALL_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(DeleteLabelsRequest deleteLabelsRequest, ProtocolMarshaller protocolMarshaller) { if (deleteLabelsRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(deleteLabelsRequest.getResourceId(), RESOURCEID_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(deleteLabelsRequest.getAuthenticationToken(), AUTHENTICATIONTOKEN_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(deleteLabelsRequest.getLabels(), LABELS_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(deleteLabelsRequest.getDeleteAll(), DELETEALL_BINDING); // depends on control dependency: [try], data = [none] } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { @Override public boolean traverseDescendents(FileSelectInfo fileSelectInfo) { try { if (fileSelectInfo.getFile().isHidden()) { return false; } } catch (FileSystemException e) {} return super.traverseDescendents(fileSelectInfo); } }
public class class_name { @Override public boolean traverseDescendents(FileSelectInfo fileSelectInfo) { try { if (fileSelectInfo.getFile().isHidden()) { return false; // depends on control dependency: [if], data = [none] } } catch (FileSystemException e) {} // depends on control dependency: [catch], data = [none] return super.traverseDescendents(fileSelectInfo); } }
public class class_name { @Override protected void onDraw(Canvas canvas) { super.onDraw(canvas); // If the API level is less than 11, we can't rely on the view animation system to // do the scrolling animation. Need to tick it here and call postInvalidate() until the scrolling is done. if (Build.VERSION.SDK_INT < 11) { tickScrollAnimation(); if (!mScroller.isFinished()) { mGraph.postInvalidate(); } } } }
public class class_name { @Override protected void onDraw(Canvas canvas) { super.onDraw(canvas); // If the API level is less than 11, we can't rely on the view animation system to // do the scrolling animation. Need to tick it here and call postInvalidate() until the scrolling is done. if (Build.VERSION.SDK_INT < 11) { tickScrollAnimation(); // depends on control dependency: [if], data = [none] if (!mScroller.isFinished()) { mGraph.postInvalidate(); // depends on control dependency: [if], data = [none] } } } }
public class class_name { public void addFont(Font font) { if (font.getBaseFont() != null) { fonts.add(font); return; } BaseFont bf = font.getCalculatedBaseFont(true); Font f2 = new Font(bf, font.getSize(), font.getCalculatedStyle(), font.getColor()); fonts.add(f2); } }
public class class_name { public void addFont(Font font) { if (font.getBaseFont() != null) { fonts.add(font); // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } BaseFont bf = font.getCalculatedBaseFont(true); Font f2 = new Font(bf, font.getSize(), font.getCalculatedStyle(), font.getColor()); fonts.add(f2); } }
public class class_name { public static HazelcastInstance newHazelcastInstance(Config config, String instanceName, NodeContext nodeContext) { if (config == null) { config = new XmlConfigBuilder().build(); } String name = getInstanceName(instanceName, config); InstanceFuture future = new InstanceFuture(); if (INSTANCE_MAP.putIfAbsent(name, future) != null) { throw new DuplicateInstanceNameException("HazelcastInstance with name '" + name + "' already exists!"); } try { return constructHazelcastInstance(config, name, nodeContext, future); } catch (Throwable t) { INSTANCE_MAP.remove(name, future); future.setFailure(t); throw ExceptionUtil.rethrow(t); } } }
public class class_name { public static HazelcastInstance newHazelcastInstance(Config config, String instanceName, NodeContext nodeContext) { if (config == null) { config = new XmlConfigBuilder().build(); // depends on control dependency: [if], data = [none] } String name = getInstanceName(instanceName, config); InstanceFuture future = new InstanceFuture(); if (INSTANCE_MAP.putIfAbsent(name, future) != null) { throw new DuplicateInstanceNameException("HazelcastInstance with name '" + name + "' already exists!"); } try { return constructHazelcastInstance(config, name, nodeContext, future); // depends on control dependency: [try], data = [none] } catch (Throwable t) { INSTANCE_MAP.remove(name, future); future.setFailure(t); throw ExceptionUtil.rethrow(t); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public java.util.List<String> getDefaultSecurityGroupNames() { if (defaultSecurityGroupNames == null) { defaultSecurityGroupNames = new com.amazonaws.internal.SdkInternalList<String>(); } return defaultSecurityGroupNames; } }
public class class_name { public java.util.List<String> getDefaultSecurityGroupNames() { if (defaultSecurityGroupNames == null) { defaultSecurityGroupNames = new com.amazonaws.internal.SdkInternalList<String>(); // depends on control dependency: [if], data = [none] } return defaultSecurityGroupNames; } }
public class class_name { @Override public void stop() { if (cancellable != null) { cancellable.cancel(); cancellable = null; } if (reader != null) { reader.close(); } super.stop(); } }
public class class_name { @Override public void stop() { if (cancellable != null) { cancellable.cancel(); // depends on control dependency: [if], data = [none] cancellable = null; // depends on control dependency: [if], data = [none] } if (reader != null) { reader.close(); // depends on control dependency: [if], data = [none] } super.stop(); } }
public class class_name { @Override public void visitMethodInsn(final int opcode, String owner, String name, String desc, final boolean isInterface) { // replace NEW.<init> if ((newInvokeReplacer != null) && (opcode == INVOKESPECIAL)) { String exOwner = owner; owner = newInvokeReplacer.getOwner(); name = newInvokeReplacer.getMethodName(); desc = changeReturnType(desc, 'L' + exOwner + ';'); super.visitMethodInsn(INVOKESTATIC, owner, name, desc, isInterface); newInvokeReplacer = null; return; } InvokeInfo invokeInfo = new InvokeInfo(owner, name, desc); // [*] // creating FooClone.<init>; inside the FOO constructor // replace the very first invokespecial <init> call (SUB.<init>) // to targets subclass with target (FOO.<init>). if (methodInfo.getMethodName().equals(INIT)) { if ( (!firstSuperCtorInitCalled) && (opcode == INVOKESPECIAL) && name.equals(INIT) && owner.equals(wd.nextSupername) ) { firstSuperCtorInitCalled = true; owner = wd.superReference; super.visitMethodInsn(opcode, owner, name, desc, isInterface); return; } } // detection of super calls if ((opcode == INVOKESPECIAL) && (owner.equals(wd.nextSupername) && (!name.equals(INIT)))) { throw new ProxettaException("Super call detected in class " + methodInfo.getClassname() + " method: " + methodInfo.getSignature() + "\nProxetta can't handle super calls due to VM limitations."); } InvokeReplacer ir = null; // find first matching aspect for (InvokeAspect aspect : aspects) { ir = aspect.pointcut(invokeInfo); if (ir != null) { break; } } if (ir == null || ir.isNone()) { if (ProxettaAsmUtil.isCreateArgumentsArrayMethod(name, desc)) { ProxyTargetReplacement.createArgumentsArray(mv, methodInfo); wd.proxyApplied = true; return; } if (ProxettaAsmUtil.isCreateArgumentsClassArrayMethod(name, desc)) { ProxyTargetReplacement.createArgumentsClassArray(mv, methodInfo); wd.proxyApplied = true; return; } if (ProxettaAsmUtil.isArgumentsCountMethod(name, desc)) { ProxyTargetReplacement.argumentsCount(mv, methodInfo); wd.proxyApplied = true; return; } if (ProxettaAsmUtil.isTargetMethodNameMethod(name, desc)) { ProxyTargetReplacement.targetMethodName(mv, methodInfo); wd.proxyApplied = true; return; } if (ProxettaAsmUtil.isTargetMethodDescriptionMethod(name, desc)) { ProxyTargetReplacement.targetMethodDescription(mv, methodInfo); wd.proxyApplied = true; return; } if (ProxettaAsmUtil.isTargetMethodSignatureMethod(name, desc)) { ProxyTargetReplacement.targetMethodSignature(mv, methodInfo); wd.proxyApplied = true; return; } if (ProxettaAsmUtil.isReturnTypeMethod(name, desc)) { ProxyTargetReplacement.returnType(mv, methodInfo); wd.proxyApplied = true; return; } if (ProxettaAsmUtil.isTargetClassMethod(name, desc)) { ProxyTargetReplacement.targetClass(mv, methodInfo); wd.proxyApplied = true; return; } if (isArgumentTypeMethod(name, desc)) { int argIndex = this.getArgumentIndex(); ProxyTargetReplacement.argumentType(mv, methodInfo, argIndex); wd.proxyApplied = true; return; } if (isArgumentMethod(name, desc)) { int argIndex = this.getArgumentIndex(); ProxyTargetReplacement.argument(mv, methodInfo, argIndex); wd.proxyApplied = true; return; } if (isInfoMethod(name, desc)) { proxyInfoRequested = true; // we are NOT calling the replacement here, as we would expect. // NO, we need to wait for the very next ASTORE method so we // can read the index and use it for replacement method!!! //ProxyTargetReplacement.info(mv, methodInfo); wd.proxyApplied = true; return; } if (isTargetMethodAnnotationMethod(name, desc)) { String[] args = getLastTwoStringArguments(); // pop current two args mv.visitInsn(POP); mv.visitInsn(POP); ProxyTargetReplacement.targetMethodAnnotation(mv, methodInfo, args); wd.proxyApplied = true; return; } if (isTargetClassAnnotationMethod(name, desc)) { String[] args = getLastTwoStringArguments(); // pop current two args mv.visitInsn(POP); mv.visitInsn(POP); ProxyTargetReplacement.targetClassAnnotation(mv, methodInfo.getClassInfo(), args); wd.proxyApplied = true; return; } super.visitMethodInsn(opcode, owner, name, desc, isInterface); return; } wd.proxyApplied = true; String exOwner = owner; owner = ir.getOwner(); name = ir.getMethodName(); switch (opcode) { case INVOKEINTERFACE: desc = prependArgument(desc, AsmUtil.L_SIGNATURE_JAVA_LANG_OBJECT); break; case INVOKEVIRTUAL: desc = prependArgument(desc, AsmUtil.L_SIGNATURE_JAVA_LANG_OBJECT); break; case INVOKESTATIC: break; default: throw new ProxettaException("Unsupported opcode: " + opcode); } // additional arguments if (ir.isPassOwnerName()) { desc = appendArgument(desc, AsmUtil.L_SIGNATURE_JAVA_LANG_STRING); super.visitLdcInsn(exOwner); } if (ir.isPassMethodName()) { desc = appendArgument(desc, AsmUtil.L_SIGNATURE_JAVA_LANG_STRING); super.visitLdcInsn(methodInfo.getMethodName()); } if (ir.isPassMethodSignature()) { desc = appendArgument(desc, AsmUtil.L_SIGNATURE_JAVA_LANG_STRING); super.visitLdcInsn(methodInfo.getSignature()); } if (ir.isPassTargetClass()) { desc = appendArgument(desc, AsmUtil.L_SIGNATURE_JAVA_LANG_CLASS); super.mv.visitLdcInsn(Type.getType('L' + wd.superReference + ';')); } if (ir.isPassThis()) { desc = appendArgument(desc, AsmUtil.L_SIGNATURE_JAVA_LANG_OBJECT); super.mv.visitVarInsn(ALOAD, 0); } super.visitMethodInsn(INVOKESTATIC, owner, name, desc, false); } }
public class class_name { @Override public void visitMethodInsn(final int opcode, String owner, String name, String desc, final boolean isInterface) { // replace NEW.<init> if ((newInvokeReplacer != null) && (opcode == INVOKESPECIAL)) { String exOwner = owner; owner = newInvokeReplacer.getOwner(); // depends on control dependency: [if], data = [none] name = newInvokeReplacer.getMethodName(); // depends on control dependency: [if], data = [none] desc = changeReturnType(desc, 'L' + exOwner + ';'); // depends on control dependency: [if], data = [none] super.visitMethodInsn(INVOKESTATIC, owner, name, desc, isInterface); // depends on control dependency: [if], data = [none] newInvokeReplacer = null; // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } InvokeInfo invokeInfo = new InvokeInfo(owner, name, desc); // [*] // creating FooClone.<init>; inside the FOO constructor // replace the very first invokespecial <init> call (SUB.<init>) // to targets subclass with target (FOO.<init>). if (methodInfo.getMethodName().equals(INIT)) { if ( (!firstSuperCtorInitCalled) && (opcode == INVOKESPECIAL) && name.equals(INIT) && owner.equals(wd.nextSupername) ) { firstSuperCtorInitCalled = true; // depends on control dependency: [if], data = [] owner = wd.superReference; // depends on control dependency: [if], data = [] super.visitMethodInsn(opcode, owner, name, desc, isInterface); // depends on control dependency: [if], data = [] return; // depends on control dependency: [if], data = [] } } // detection of super calls if ((opcode == INVOKESPECIAL) && (owner.equals(wd.nextSupername) && (!name.equals(INIT)))) { throw new ProxettaException("Super call detected in class " + methodInfo.getClassname() + " method: " + methodInfo.getSignature() + "\nProxetta can't handle super calls due to VM limitations."); } InvokeReplacer ir = null; // find first matching aspect for (InvokeAspect aspect : aspects) { ir = aspect.pointcut(invokeInfo); // depends on control dependency: [for], data = [aspect] if (ir != null) { break; } } if (ir == null || ir.isNone()) { if (ProxettaAsmUtil.isCreateArgumentsArrayMethod(name, desc)) { ProxyTargetReplacement.createArgumentsArray(mv, methodInfo); // depends on control dependency: [if], data = [none] wd.proxyApplied = true; // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } if (ProxettaAsmUtil.isCreateArgumentsClassArrayMethod(name, desc)) { ProxyTargetReplacement.createArgumentsClassArray(mv, methodInfo); // depends on control dependency: [if], data = [none] wd.proxyApplied = true; // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } if (ProxettaAsmUtil.isArgumentsCountMethod(name, desc)) { ProxyTargetReplacement.argumentsCount(mv, methodInfo); // depends on control dependency: [if], data = [none] wd.proxyApplied = true; // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } if (ProxettaAsmUtil.isTargetMethodNameMethod(name, desc)) { ProxyTargetReplacement.targetMethodName(mv, methodInfo); // depends on control dependency: [if], data = [none] wd.proxyApplied = true; // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } if (ProxettaAsmUtil.isTargetMethodDescriptionMethod(name, desc)) { ProxyTargetReplacement.targetMethodDescription(mv, methodInfo); // depends on control dependency: [if], data = [none] wd.proxyApplied = true; // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } if (ProxettaAsmUtil.isTargetMethodSignatureMethod(name, desc)) { ProxyTargetReplacement.targetMethodSignature(mv, methodInfo); // depends on control dependency: [if], data = [none] wd.proxyApplied = true; // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } if (ProxettaAsmUtil.isReturnTypeMethod(name, desc)) { ProxyTargetReplacement.returnType(mv, methodInfo); // depends on control dependency: [if], data = [none] wd.proxyApplied = true; // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } if (ProxettaAsmUtil.isTargetClassMethod(name, desc)) { ProxyTargetReplacement.targetClass(mv, methodInfo); // depends on control dependency: [if], data = [none] wd.proxyApplied = true; // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } if (isArgumentTypeMethod(name, desc)) { int argIndex = this.getArgumentIndex(); ProxyTargetReplacement.argumentType(mv, methodInfo, argIndex); // depends on control dependency: [if], data = [none] wd.proxyApplied = true; // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } if (isArgumentMethod(name, desc)) { int argIndex = this.getArgumentIndex(); ProxyTargetReplacement.argument(mv, methodInfo, argIndex); // depends on control dependency: [if], data = [none] wd.proxyApplied = true; // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } if (isInfoMethod(name, desc)) { proxyInfoRequested = true; // depends on control dependency: [if], data = [none] // we are NOT calling the replacement here, as we would expect. // NO, we need to wait for the very next ASTORE method so we // can read the index and use it for replacement method!!! //ProxyTargetReplacement.info(mv, methodInfo); wd.proxyApplied = true; // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } if (isTargetMethodAnnotationMethod(name, desc)) { String[] args = getLastTwoStringArguments(); // pop current two args mv.visitInsn(POP); // depends on control dependency: [if], data = [none] mv.visitInsn(POP); // depends on control dependency: [if], data = [none] ProxyTargetReplacement.targetMethodAnnotation(mv, methodInfo, args); // depends on control dependency: [if], data = [none] wd.proxyApplied = true; // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } if (isTargetClassAnnotationMethod(name, desc)) { String[] args = getLastTwoStringArguments(); // pop current two args mv.visitInsn(POP); // depends on control dependency: [if], data = [none] mv.visitInsn(POP); // depends on control dependency: [if], data = [none] ProxyTargetReplacement.targetClassAnnotation(mv, methodInfo.getClassInfo(), args); // depends on control dependency: [if], data = [none] wd.proxyApplied = true; // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } super.visitMethodInsn(opcode, owner, name, desc, isInterface); // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } wd.proxyApplied = true; String exOwner = owner; owner = ir.getOwner(); name = ir.getMethodName(); switch (opcode) { case INVOKEINTERFACE: desc = prependArgument(desc, AsmUtil.L_SIGNATURE_JAVA_LANG_OBJECT); break; case INVOKEVIRTUAL: desc = prependArgument(desc, AsmUtil.L_SIGNATURE_JAVA_LANG_OBJECT); break; case INVOKESTATIC: break; default: throw new ProxettaException("Unsupported opcode: " + opcode); } // additional arguments if (ir.isPassOwnerName()) { desc = appendArgument(desc, AsmUtil.L_SIGNATURE_JAVA_LANG_STRING); // depends on control dependency: [if], data = [none] super.visitLdcInsn(exOwner); // depends on control dependency: [if], data = [none] } if (ir.isPassMethodName()) { desc = appendArgument(desc, AsmUtil.L_SIGNATURE_JAVA_LANG_STRING); // depends on control dependency: [if], data = [none] super.visitLdcInsn(methodInfo.getMethodName()); // depends on control dependency: [if], data = [none] } if (ir.isPassMethodSignature()) { desc = appendArgument(desc, AsmUtil.L_SIGNATURE_JAVA_LANG_STRING); // depends on control dependency: [if], data = [none] super.visitLdcInsn(methodInfo.getSignature()); // depends on control dependency: [if], data = [none] } if (ir.isPassTargetClass()) { desc = appendArgument(desc, AsmUtil.L_SIGNATURE_JAVA_LANG_CLASS); // depends on control dependency: [if], data = [none] super.mv.visitLdcInsn(Type.getType('L' + wd.superReference + ';')); // depends on control dependency: [if], data = [none] } if (ir.isPassThis()) { desc = appendArgument(desc, AsmUtil.L_SIGNATURE_JAVA_LANG_OBJECT); // depends on control dependency: [if], data = [none] super.mv.visitVarInsn(ALOAD, 0); // depends on control dependency: [if], data = [none] } super.visitMethodInsn(INVOKESTATIC, owner, name, desc, false); } }
public class class_name { public boolean setExperimentalTechnique(String techniqueStr) { ExperimentalTechnique et = ExperimentalTechnique.getByName(techniqueStr); if (et==null) return false; if (techniques==null) { techniques = EnumSet.of(et); return true; } else { return techniques.add(et); } } }
public class class_name { public boolean setExperimentalTechnique(String techniqueStr) { ExperimentalTechnique et = ExperimentalTechnique.getByName(techniqueStr); if (et==null) return false; if (techniques==null) { techniques = EnumSet.of(et); // depends on control dependency: [if], data = [none] return true; // depends on control dependency: [if], data = [none] } else { return techniques.add(et); // depends on control dependency: [if], data = [none] } } }
public class class_name { public static int count(String regex, CharSequence content) { if (null == regex || null == content) { return 0; } // Pattern pattern = Pattern.compile(regex, Pattern.DOTALL); final Pattern pattern = PatternPool.get(regex, Pattern.DOTALL); return count(pattern, content); } }
public class class_name { public static int count(String regex, CharSequence content) { if (null == regex || null == content) { return 0; // depends on control dependency: [if], data = [none] } // Pattern pattern = Pattern.compile(regex, Pattern.DOTALL); final Pattern pattern = PatternPool.get(regex, Pattern.DOTALL); return count(pattern, content); } }
public class class_name { private Map<IChemObject, Color> makeHighlightAtomMap(List<IAtomContainer> reactants, List<IAtomContainer> products) { Map<IChemObject, Color> colorMap = new HashMap<>(); Map<Integer, Color> mapToColor = new HashMap<>(); int colorIdx = -1; for (IAtomContainer mol : reactants) { int prevPalletIdx = colorIdx; for (IAtom atom : mol.atoms()) { int mapidx = accessAtomMap(atom); if (mapidx > 0) { if (prevPalletIdx == colorIdx) { colorIdx++; // select next color if (colorIdx >= atomMapColors.length) throw new IllegalArgumentException("Not enough colors to highlight atom mapping, please provide mode"); } Color color = atomMapColors[colorIdx]; colorMap.put(atom, color); mapToColor.put(mapidx, color); } } if (colorIdx > prevPalletIdx) { for (IBond bond : mol.bonds()) { IAtom a1 = bond.getBegin(); IAtom a2 = bond.getEnd(); Color c1 = colorMap.get(a1); Color c2 = colorMap.get(a2); if (c1 != null && c1 == c2) colorMap.put(bond, c1); } } } for (IAtomContainer mol : products) { for (IAtom atom : mol.atoms()) { int mapidx = accessAtomMap(atom); if (mapidx > 0) { colorMap.put(atom, mapToColor.get(mapidx)); } } for (IBond bond : mol.bonds()) { IAtom a1 = bond.getBegin(); IAtom a2 = bond.getEnd(); Color c1 = colorMap.get(a1); Color c2 = colorMap.get(a2); if (c1 != null && c1 == c2) colorMap.put(bond, c1); } } return colorMap; } }
public class class_name { private Map<IChemObject, Color> makeHighlightAtomMap(List<IAtomContainer> reactants, List<IAtomContainer> products) { Map<IChemObject, Color> colorMap = new HashMap<>(); Map<Integer, Color> mapToColor = new HashMap<>(); int colorIdx = -1; for (IAtomContainer mol : reactants) { int prevPalletIdx = colorIdx; for (IAtom atom : mol.atoms()) { int mapidx = accessAtomMap(atom); if (mapidx > 0) { if (prevPalletIdx == colorIdx) { colorIdx++; // select next color // depends on control dependency: [if], data = [none] if (colorIdx >= atomMapColors.length) throw new IllegalArgumentException("Not enough colors to highlight atom mapping, please provide mode"); } Color color = atomMapColors[colorIdx]; colorMap.put(atom, color); // depends on control dependency: [if], data = [none] mapToColor.put(mapidx, color); // depends on control dependency: [if], data = [(mapidx] } } if (colorIdx > prevPalletIdx) { for (IBond bond : mol.bonds()) { IAtom a1 = bond.getBegin(); IAtom a2 = bond.getEnd(); Color c1 = colorMap.get(a1); Color c2 = colorMap.get(a2); if (c1 != null && c1 == c2) colorMap.put(bond, c1); } } } for (IAtomContainer mol : products) { for (IAtom atom : mol.atoms()) { int mapidx = accessAtomMap(atom); if (mapidx > 0) { colorMap.put(atom, mapToColor.get(mapidx)); // depends on control dependency: [if], data = [(mapidx] } } for (IBond bond : mol.bonds()) { IAtom a1 = bond.getBegin(); IAtom a2 = bond.getEnd(); Color c1 = colorMap.get(a1); Color c2 = colorMap.get(a2); if (c1 != null && c1 == c2) colorMap.put(bond, c1); } } return colorMap; } }
public class class_name { public final void setLang(final Languages pLang) { this.lang = pLang; if (this.itsId == null) { this.itsId = new IdI18nSpecificInList(); } this.itsId.setLang(this.lang); } }
public class class_name { public final void setLang(final Languages pLang) { this.lang = pLang; if (this.itsId == null) { this.itsId = new IdI18nSpecificInList(); // depends on control dependency: [if], data = [none] } this.itsId.setLang(this.lang); } }
public class class_name { public static Fetch createDefaultEntityFetch(EntityType entityType, String languageCode) { boolean hasRefAttr = false; Fetch fetch = new Fetch(); for (Attribute attr : entityType.getAtomicAttributes()) { Fetch subFetch = createDefaultAttributeFetch(attr, languageCode); if (subFetch != null) { hasRefAttr = true; } fetch.field(attr.getName(), subFetch); } return hasRefAttr ? fetch : null; } }
public class class_name { public static Fetch createDefaultEntityFetch(EntityType entityType, String languageCode) { boolean hasRefAttr = false; Fetch fetch = new Fetch(); for (Attribute attr : entityType.getAtomicAttributes()) { Fetch subFetch = createDefaultAttributeFetch(attr, languageCode); if (subFetch != null) { hasRefAttr = true; // depends on control dependency: [if], data = [none] } fetch.field(attr.getName(), subFetch); // depends on control dependency: [for], data = [attr] } return hasRefAttr ? fetch : null; } }
public class class_name { public void marshall(ListPipelinesRequest listPipelinesRequest, ProtocolMarshaller protocolMarshaller) { if (listPipelinesRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(listPipelinesRequest.getAscending(), ASCENDING_BINDING); protocolMarshaller.marshall(listPipelinesRequest.getPageToken(), PAGETOKEN_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(ListPipelinesRequest listPipelinesRequest, ProtocolMarshaller protocolMarshaller) { if (listPipelinesRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(listPipelinesRequest.getAscending(), ASCENDING_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(listPipelinesRequest.getPageToken(), PAGETOKEN_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 int getDefaultPageSize() { synchronized (sLock) { if (sDefaultPageSize == 0) { try { Class clazz = Class.forName("android.os.StatFs"); Method m = clazz.getMethod("getBlockSize"); Object statFsObj = clazz.getConstructor(String.class).newInstance("/data"); Integer value = (Integer) m.invoke(statFsObj, (Object[])null); if (value != null) return value.intValue(); } catch (Exception e) { } } if (sDefaultPageSize == 0) sDefaultPageSize = 1024; return sDefaultPageSize; } } }
public class class_name { public static int getDefaultPageSize() { synchronized (sLock) { if (sDefaultPageSize == 0) { try { Class clazz = Class.forName("android.os.StatFs"); Method m = clazz.getMethod("getBlockSize"); Object statFsObj = clazz.getConstructor(String.class).newInstance("/data"); Integer value = (Integer) m.invoke(statFsObj, (Object[])null); if (value != null) return value.intValue(); } catch (Exception e) { } } if (sDefaultPageSize == 0) sDefaultPageSize = 1024; return sDefaultPageSize; // depends on control dependency: [if], data = [none] } } }
public class class_name { void decodeContentType(String rawLine) { int slash = rawLine.indexOf('/'); if (slash == -1) { // if (DEBUG) getLogger().debug("decoding ... no slash found"); return; } else { primaryType = rawLine.substring(0, slash).trim(); } int semicolon = rawLine.indexOf(';'); if (semicolon == -1) { // if (DEBUG) getLogger().debug("decoding ... no semicolon found"); secondaryType = rawLine.substring(slash + 1).trim(); return; } // have parameters secondaryType = rawLine.substring(slash + 1, semicolon).trim(); Header h = new Header(rawLine); parameters = h.getParams(); } }
public class class_name { void decodeContentType(String rawLine) { int slash = rawLine.indexOf('/'); if (slash == -1) { // if (DEBUG) getLogger().debug("decoding ... no slash found"); return; // depends on control dependency: [if], data = [none] } else { primaryType = rawLine.substring(0, slash).trim(); // depends on control dependency: [if], data = [none] } int semicolon = rawLine.indexOf(';'); if (semicolon == -1) { // if (DEBUG) getLogger().debug("decoding ... no semicolon found"); secondaryType = rawLine.substring(slash + 1).trim(); // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } // have parameters secondaryType = rawLine.substring(slash + 1, semicolon).trim(); Header h = new Header(rawLine); parameters = h.getParams(); } }
public class class_name { public String eval(String expr) { String result = "undefined"; if (expr == null) { return result; } ContextData contextData = currentContextData(); if (contextData == null || frameIndex >= contextData.frameCount()) { return result; } StackFrame frame = contextData.getFrame(frameIndex); if (contextData.eventThreadFlag) { Context cx = Context.getCurrentContext(); result = do_eval(cx, frame, expr); } else { synchronized (monitor) { if (insideInterruptLoop) { evalRequest = expr; evalFrame = frame; monitor.notify(); do { try { monitor.wait(); } catch (InterruptedException exc) { Thread.currentThread().interrupt(); break; } } while (evalRequest != null); result = evalResult; } } } return result; } }
public class class_name { public String eval(String expr) { String result = "undefined"; if (expr == null) { return result; // depends on control dependency: [if], data = [none] } ContextData contextData = currentContextData(); if (contextData == null || frameIndex >= contextData.frameCount()) { return result; // depends on control dependency: [if], data = [none] } StackFrame frame = contextData.getFrame(frameIndex); if (contextData.eventThreadFlag) { Context cx = Context.getCurrentContext(); result = do_eval(cx, frame, expr); // depends on control dependency: [if], data = [none] } else { synchronized (monitor) { // depends on control dependency: [if], data = [none] if (insideInterruptLoop) { evalRequest = expr; // depends on control dependency: [if], data = [none] evalFrame = frame; // depends on control dependency: [if], data = [none] monitor.notify(); // depends on control dependency: [if], data = [none] do { try { monitor.wait(); // depends on control dependency: [try], data = [none] } catch (InterruptedException exc) { Thread.currentThread().interrupt(); break; } // depends on control dependency: [catch], data = [none] } while (evalRequest != null); result = evalResult; // depends on control dependency: [if], data = [none] } } } return result; } }
public class class_name { public void setFooterDivider(Drawable drawable) { mFooterDivider = drawable; if (drawable != null) { mFooterDividerHeight = drawable.getIntrinsicHeight(); } else { mFooterDividerHeight = 0; } mContentView.setWillNotDraw(drawable == null); mContentView.invalidate(); } }
public class class_name { public void setFooterDivider(Drawable drawable) { mFooterDivider = drawable; if (drawable != null) { mFooterDividerHeight = drawable.getIntrinsicHeight(); // depends on control dependency: [if], data = [none] } else { mFooterDividerHeight = 0; // depends on control dependency: [if], data = [none] } mContentView.setWillNotDraw(drawable == null); mContentView.invalidate(); } }
public class class_name { private void pushQueues( final Collection<AbstractHtml5SharedObject> sharedObjects, final boolean listenerInvoked) { if (listenerInvoked) { for (final AbstractHtml5SharedObject sharedObject : sharedObjects) { final PushQueue pushQueue = sharedObject .getPushQueue(ACCESS_OBJECT); if (pushQueue != null) { pushQueue.push(); } } } } }
public class class_name { private void pushQueues( final Collection<AbstractHtml5SharedObject> sharedObjects, final boolean listenerInvoked) { if (listenerInvoked) { for (final AbstractHtml5SharedObject sharedObject : sharedObjects) { final PushQueue pushQueue = sharedObject .getPushQueue(ACCESS_OBJECT); if (pushQueue != null) { pushQueue.push(); // depends on control dependency: [if], data = [none] } } } } }
public class class_name { public static int hashSearch(final Memory mem, final int lgArrLongs, final long hash, final int memOffsetBytes) { final int arrayMask = (1 << lgArrLongs) - 1; final int stride = getStride(hash, lgArrLongs); int curProbe = (int) (hash & arrayMask); final int loopIndex = curProbe; do { final int curProbeOffsetBytes = (curProbe << 3) + memOffsetBytes; final long curArrayHash = mem.getLong(curProbeOffsetBytes); if (curArrayHash == EMPTY) { return -1; } else if (curArrayHash == hash) { return curProbe; } curProbe = (curProbe + stride) & arrayMask; } while (curProbe != loopIndex); return -1; } }
public class class_name { public static int hashSearch(final Memory mem, final int lgArrLongs, final long hash, final int memOffsetBytes) { final int arrayMask = (1 << lgArrLongs) - 1; final int stride = getStride(hash, lgArrLongs); int curProbe = (int) (hash & arrayMask); final int loopIndex = curProbe; do { final int curProbeOffsetBytes = (curProbe << 3) + memOffsetBytes; final long curArrayHash = mem.getLong(curProbeOffsetBytes); if (curArrayHash == EMPTY) { return -1; } // depends on control dependency: [if], data = [none] else if (curArrayHash == hash) { return curProbe; } // depends on control dependency: [if], data = [none] curProbe = (curProbe + stride) & arrayMask; } while (curProbe != loopIndex); return -1; } }
public class class_name { public static MatrixStatistics extractStatistics( File inputMatrixFile, Format format, boolean countRowOccurrances, boolean countColumnOccurrances) { // Initialize the statistics. int numColumns = 0; int numRows = 0; double matrixSum = 0; Map<Integer, Double> rowCountMap = new IntegerMap<Double>(); Map<Integer, Double> colCountMap = new IntegerMap<Double>(); // Get an iterator for the matrix file. Iterator<MatrixEntry> iter; try { iter = MatrixIO.getMatrixFileIterator(inputMatrixFile, format); } catch (IOException ioe) { throw new IOError(ioe); } while (iter.hasNext()) { MatrixEntry entry = iter.next(); // Get the total number of columns and rows. if (entry.column() >= numColumns) numColumns = entry.column() + 1; if (entry.row() >= numRows) numRows = entry.row() + 1; // Skip non zero entries. if (entry.value() == 0d) continue; // Gather the row sums. Double occurance = rowCountMap.get(entry.row()); double rowDelta = (countRowOccurrances) ? 1 : entry.value(); rowCountMap.put(entry.row(), (occurance == null) ? rowDelta : occurance + rowDelta); // Gather the column sums. occurance = colCountMap.get(entry.column()); double columnDelta = (countColumnOccurrances) ? 1 : entry.value(); colCountMap.put(entry.column(), (occurance == null) ? columnDelta : occurance + columnDelta); matrixSum += entry.value(); } // Convert the maps to arrays. double[] rowSums = extractValues(rowCountMap, numRows); double[] columnSums = extractValues(colCountMap, numColumns); return new MatrixStatistics(rowSums, columnSums, matrixSum); } }
public class class_name { public static MatrixStatistics extractStatistics( File inputMatrixFile, Format format, boolean countRowOccurrances, boolean countColumnOccurrances) { // Initialize the statistics. int numColumns = 0; int numRows = 0; double matrixSum = 0; Map<Integer, Double> rowCountMap = new IntegerMap<Double>(); Map<Integer, Double> colCountMap = new IntegerMap<Double>(); // Get an iterator for the matrix file. Iterator<MatrixEntry> iter; try { iter = MatrixIO.getMatrixFileIterator(inputMatrixFile, format); // depends on control dependency: [try], data = [none] } catch (IOException ioe) { throw new IOError(ioe); } // depends on control dependency: [catch], data = [none] while (iter.hasNext()) { MatrixEntry entry = iter.next(); // Get the total number of columns and rows. if (entry.column() >= numColumns) numColumns = entry.column() + 1; if (entry.row() >= numRows) numRows = entry.row() + 1; // Skip non zero entries. if (entry.value() == 0d) continue; // Gather the row sums. Double occurance = rowCountMap.get(entry.row()); double rowDelta = (countRowOccurrances) ? 1 : entry.value(); rowCountMap.put(entry.row(), (occurance == null) ? rowDelta : occurance + rowDelta); // depends on control dependency: [while], data = [none] // Gather the column sums. occurance = colCountMap.get(entry.column()); // depends on control dependency: [while], data = [none] double columnDelta = (countColumnOccurrances) ? 1 : entry.value(); colCountMap.put(entry.column(), (occurance == null) ? columnDelta : occurance + columnDelta); // depends on control dependency: [while], data = [none] matrixSum += entry.value(); // depends on control dependency: [while], data = [none] } // Convert the maps to arrays. double[] rowSums = extractValues(rowCountMap, numRows); double[] columnSums = extractValues(colCountMap, numColumns); return new MatrixStatistics(rowSums, columnSums, matrixSum); } }
public class class_name { public Packet putShort(int s, ByteOrder order) { var buffer = HEAP_BUFFER_POOL.take(Short.BYTES); var value = (short) s; var array = buffer.putShort(order == ByteOrder.LITTLE_ENDIAN ? Short.reverseBytes(value) : value).array(); try { return enqueue(Arrays.copyOfRange(array, 0, Short.BYTES)); } finally { HEAP_BUFFER_POOL.give(buffer); } } }
public class class_name { public Packet putShort(int s, ByteOrder order) { var buffer = HEAP_BUFFER_POOL.take(Short.BYTES); var value = (short) s; var array = buffer.putShort(order == ByteOrder.LITTLE_ENDIAN ? Short.reverseBytes(value) : value).array(); try { return enqueue(Arrays.copyOfRange(array, 0, Short.BYTES)); // depends on control dependency: [try], data = [none] } finally { HEAP_BUFFER_POOL.give(buffer); } } }
public class class_name { static String pullFontPathFromTextAppearance(final Context context, AttributeSet attrs, int[] attributeId) { if (attributeId == null || attrs == null) { return null; } int textAppearanceId = -1; final TypedArray typedArrayAttr = context.obtainStyledAttributes(attrs, ANDROID_ATTR_TEXT_APPEARANCE); if (typedArrayAttr != null) { try { textAppearanceId = typedArrayAttr.getResourceId(0, -1); } catch (Exception ignored) { // Failed for some reason return null; } finally { typedArrayAttr.recycle(); } } final TypedArray textAppearanceAttrs = context.obtainStyledAttributes(textAppearanceId, attributeId); if (textAppearanceAttrs != null) { try { return textAppearanceAttrs.getString(0); } catch (Exception ignore) { // Failed for some reason. return null; } finally { textAppearanceAttrs.recycle(); } } return null; } }
public class class_name { static String pullFontPathFromTextAppearance(final Context context, AttributeSet attrs, int[] attributeId) { if (attributeId == null || attrs == null) { return null; // depends on control dependency: [if], data = [none] } int textAppearanceId = -1; final TypedArray typedArrayAttr = context.obtainStyledAttributes(attrs, ANDROID_ATTR_TEXT_APPEARANCE); if (typedArrayAttr != null) { try { textAppearanceId = typedArrayAttr.getResourceId(0, -1); // depends on control dependency: [try], data = [none] } catch (Exception ignored) { // Failed for some reason return null; } finally { // depends on control dependency: [catch], data = [none] typedArrayAttr.recycle(); } } final TypedArray textAppearanceAttrs = context.obtainStyledAttributes(textAppearanceId, attributeId); if (textAppearanceAttrs != null) { try { return textAppearanceAttrs.getString(0); // depends on control dependency: [try], data = [none] } catch (Exception ignore) { // Failed for some reason. return null; } finally { // depends on control dependency: [catch], data = [none] textAppearanceAttrs.recycle(); } } return null; } }
public class class_name { public void removeObjectListeners(Class<?> objectClass, long objectId) { if (objectClass == null) { return; } synchronized (objectListeners) { Map<Long, Map<Class<? extends ObjectAttachableListener>, Map<ObjectAttachableListener, ListenerManagerImpl<? extends ObjectAttachableListener>>>> objects = objectListeners.get(objectClass); if (objects == null) { return; } // Remove all listeners objects.computeIfPresent(objectId, (id, listeners) -> { listeners.values().stream() .flatMap(map -> map.values().stream()) .forEach(ListenerManagerImpl::removed); listeners.clear(); return null; }); // Cleanup if (objects.isEmpty()) { objectListeners.remove(objectClass); } } } }
public class class_name { public void removeObjectListeners(Class<?> objectClass, long objectId) { if (objectClass == null) { return; // depends on control dependency: [if], data = [none] } synchronized (objectListeners) { Map<Long, Map<Class<? extends ObjectAttachableListener>, Map<ObjectAttachableListener, ListenerManagerImpl<? extends ObjectAttachableListener>>>> objects = objectListeners.get(objectClass); if (objects == null) { return; // depends on control dependency: [if], data = [none] } // Remove all listeners objects.computeIfPresent(objectId, (id, listeners) -> { listeners.values().stream() .flatMap(map -> map.values().stream()) .forEach(ListenerManagerImpl::removed); listeners.clear(); return null; }); // Cleanup if (objects.isEmpty()) { objectListeners.remove(objectClass); // depends on control dependency: [if], data = [none] } } } }
public class class_name { public static <T> ApiFuture<T> createApiFuture(ValueSourceFuture<T> valueSourceFuture) { if (valueSourceFuture instanceof ApiFutureBackedValueSourceFuture) { return ((ApiFutureBackedValueSourceFuture<T>) valueSourceFuture).getWrappedFuture(); } else { return new ValueSourceFutureBackedApiFuture<>(valueSourceFuture); } } }
public class class_name { public static <T> ApiFuture<T> createApiFuture(ValueSourceFuture<T> valueSourceFuture) { if (valueSourceFuture instanceof ApiFutureBackedValueSourceFuture) { return ((ApiFutureBackedValueSourceFuture<T>) valueSourceFuture).getWrappedFuture(); // depends on control dependency: [if], data = [none] } else { return new ValueSourceFutureBackedApiFuture<>(valueSourceFuture); // depends on control dependency: [if], data = [none] } } }
public class class_name { static public VoltXMLDiff computeDiff(VoltXMLElement before, VoltXMLElement after) { // Top level call needs both names to match (I think this makes sense) if (!before.getUniqueName().equals(after.getUniqueName())) { // not sure this is best behavior, ponder as progress is made return null; } VoltXMLDiff result = new VoltXMLDiff(before.getUniqueName()); // Short-circuit check for any differences first. Can return early if there are no changes if (before.toMinString().equals(after.toMinString())) { return result; } // Store the final desired element order for (int i = 0; i < after.children.size(); i++) { VoltXMLElement child = after.children.get(i); result.m_elementOrder.put(child.getUniqueName(), i); } // first, check the attributes Set<String> firstKeys = before.attributes.keySet(); Set<String> secondKeys = new HashSet<>(); secondKeys.addAll(after.attributes.keySet()); // Do removed and changed attributes walking the first element's attributes for (String firstKey : firstKeys) { if (!secondKeys.contains(firstKey)) { result.m_removedAttributes.add(firstKey); } else if (!(after.attributes.get(firstKey).equals(before.attributes.get(firstKey)))) { result.m_changedAttributes.put(firstKey, after.attributes.get(firstKey)); } // remove the firstKey from secondKeys to track things added secondKeys.remove(firstKey); } // everything in secondKeys should be something added for (String key : secondKeys) { result.m_addedAttributes.put(key, after.attributes.get(key)); } // Now, need to check the children. Each pair of children with the same names // need to be descended to look for changes // Probably more efficient ways to do this, but brute force it for now // Would be helpful if the underlying children objects were Maps rather than // Lists. Set<String> firstChildren = new HashSet<>(); for (VoltXMLElement child : before.children) { firstChildren.add(child.getUniqueName()); } Set<String> secondChildren = new HashSet<>(); for (VoltXMLElement child : after.children) { secondChildren.add(child.getUniqueName()); } Set<String> commonNames = new HashSet<>(); for (VoltXMLElement firstChild : before.children) { if (!secondChildren.contains(firstChild.getUniqueName())) { // Need to duplicate the result.m_removedElements.add(firstChild); } else { commonNames.add(firstChild.getUniqueName()); } } for (VoltXMLElement secondChild : after.children) { if (!firstChildren.contains(secondChild.getUniqueName())) { result.m_addedElements.add(secondChild); } else { assert(commonNames.contains(secondChild.getUniqueName())); } } // This set contains uniquenames for (String name : commonNames) { VoltXMLDiff childDiff = computeDiff(before.findChild(name), after.findChild(name)); if (!childDiff.isEmpty()) { result.m_changedElements.put(name, childDiff); } } return result; } }
public class class_name { static public VoltXMLDiff computeDiff(VoltXMLElement before, VoltXMLElement after) { // Top level call needs both names to match (I think this makes sense) if (!before.getUniqueName().equals(after.getUniqueName())) { // not sure this is best behavior, ponder as progress is made return null; // depends on control dependency: [if], data = [none] } VoltXMLDiff result = new VoltXMLDiff(before.getUniqueName()); // Short-circuit check for any differences first. Can return early if there are no changes if (before.toMinString().equals(after.toMinString())) { return result; // depends on control dependency: [if], data = [none] } // Store the final desired element order for (int i = 0; i < after.children.size(); i++) { VoltXMLElement child = after.children.get(i); result.m_elementOrder.put(child.getUniqueName(), i); // depends on control dependency: [for], data = [i] } // first, check the attributes Set<String> firstKeys = before.attributes.keySet(); Set<String> secondKeys = new HashSet<>(); secondKeys.addAll(after.attributes.keySet()); // Do removed and changed attributes walking the first element's attributes for (String firstKey : firstKeys) { if (!secondKeys.contains(firstKey)) { result.m_removedAttributes.add(firstKey); // depends on control dependency: [if], data = [none] } else if (!(after.attributes.get(firstKey).equals(before.attributes.get(firstKey)))) { result.m_changedAttributes.put(firstKey, after.attributes.get(firstKey)); // depends on control dependency: [if], data = [none] } // remove the firstKey from secondKeys to track things added secondKeys.remove(firstKey); // depends on control dependency: [for], data = [firstKey] } // everything in secondKeys should be something added for (String key : secondKeys) { result.m_addedAttributes.put(key, after.attributes.get(key)); // depends on control dependency: [for], data = [key] } // Now, need to check the children. Each pair of children with the same names // need to be descended to look for changes // Probably more efficient ways to do this, but brute force it for now // Would be helpful if the underlying children objects were Maps rather than // Lists. Set<String> firstChildren = new HashSet<>(); for (VoltXMLElement child : before.children) { firstChildren.add(child.getUniqueName()); // depends on control dependency: [for], data = [child] } Set<String> secondChildren = new HashSet<>(); for (VoltXMLElement child : after.children) { secondChildren.add(child.getUniqueName()); // depends on control dependency: [for], data = [child] } Set<String> commonNames = new HashSet<>(); for (VoltXMLElement firstChild : before.children) { if (!secondChildren.contains(firstChild.getUniqueName())) { // Need to duplicate the result.m_removedElements.add(firstChild); // depends on control dependency: [if], data = [none] } else { commonNames.add(firstChild.getUniqueName()); // depends on control dependency: [if], data = [none] } } for (VoltXMLElement secondChild : after.children) { if (!firstChildren.contains(secondChild.getUniqueName())) { result.m_addedElements.add(secondChild); // depends on control dependency: [if], data = [none] } else { assert(commonNames.contains(secondChild.getUniqueName())); // depends on control dependency: [if], data = [none] } } // This set contains uniquenames for (String name : commonNames) { VoltXMLDiff childDiff = computeDiff(before.findChild(name), after.findChild(name)); if (!childDiff.isEmpty()) { result.m_changedElements.put(name, childDiff); // depends on control dependency: [if], data = [none] } } return result; } }
public class class_name { final void setFieldsNormalized(int fieldMask) { if (fieldMask != ALL_FIELDS) { for (int i = 0; i < fields.length; i++) { if ((fieldMask & 1) == 0) { stamp[i] = fields[i] = 0; // UNSET == 0 isSet[i] = false; } fieldMask >>= 1; } } // Some or all of the fields are in sync with the // milliseconds, but the stamp values are not normalized yet. areFieldsSet = true; areAllFieldsSet = false; } }
public class class_name { final void setFieldsNormalized(int fieldMask) { if (fieldMask != ALL_FIELDS) { for (int i = 0; i < fields.length; i++) { if ((fieldMask & 1) == 0) { stamp[i] = fields[i] = 0; // UNSET == 0 // depends on control dependency: [if], data = [none] isSet[i] = false; // depends on control dependency: [if], data = [none] } fieldMask >>= 1; // depends on control dependency: [for], data = [none] } } // Some or all of the fields are in sync with the // milliseconds, but the stamp values are not normalized yet. areFieldsSet = true; areAllFieldsSet = false; } }
public class class_name { public boolean match(String text, final String pattern) { // Create the cards by splitting using a RegEx. If more speed // is desired, a simpler character based splitting can be done. final String[] cards = REGEX_STAR.split(pattern); final int numCards = cards.length; // Iterate over the cards. for (int i = 0; i < numCards; ++i) { final String card = cards[i]; final int idx = text.indexOf(card); // Card not detected in the text. if (idx == -1) { return false; } if (idx != 0 && i == 0) { return false; // test needs to start from 'card' } // Move ahead, towards the right of the text. text = text.substring(idx + card.length()); } return true; } }
public class class_name { public boolean match(String text, final String pattern) { // Create the cards by splitting using a RegEx. If more speed // is desired, a simpler character based splitting can be done. final String[] cards = REGEX_STAR.split(pattern); final int numCards = cards.length; // Iterate over the cards. for (int i = 0; i < numCards; ++i) { final String card = cards[i]; final int idx = text.indexOf(card); // Card not detected in the text. if (idx == -1) { return false; // depends on control dependency: [if], data = [none] } if (idx != 0 && i == 0) { return false; // test needs to start from 'card' // depends on control dependency: [if], data = [none] } // Move ahead, towards the right of the text. text = text.substring(idx + card.length()); // depends on control dependency: [for], data = [none] } return true; } }
public class class_name { public long set(long instant, int year) { FieldUtils.verifyValueBounds(this, year, 1, getMaximumValue()); if (iChronology.getYear(instant) <= 0) { year = 1 - year; } return super.set(instant, year); } }
public class class_name { public long set(long instant, int year) { FieldUtils.verifyValueBounds(this, year, 1, getMaximumValue()); if (iChronology.getYear(instant) <= 0) { year = 1 - year; // depends on control dependency: [if], data = [none] } return super.set(instant, year); } }
public class class_name { public void resolveType() { if (getTypeStyle() == null) { setTypeStyle(""); } final String fieldType = getFieldType(); String generics = ""; if (fieldType.contains("<")) { generics = fieldType.substring(fieldType.indexOf('<')); } if (getTypeStyle().equals("smart")) { setType(fieldType); } else if (getTypeStyle().length() > 0) { if (getTypeStyle().contains("<>")) { setType(getTypeStyle().replace("<>", generics)); } else if (getTypeStyle().contains("<")) { setType(getTypeStyle()); } else { setType(getTypeStyle() + generics); } } else { setType(fieldType); } } }
public class class_name { public void resolveType() { if (getTypeStyle() == null) { setTypeStyle(""); // depends on control dependency: [if], data = [none] } final String fieldType = getFieldType(); String generics = ""; if (fieldType.contains("<")) { generics = fieldType.substring(fieldType.indexOf('<')); // depends on control dependency: [if], data = [none] } if (getTypeStyle().equals("smart")) { setType(fieldType); // depends on control dependency: [if], data = [none] } else if (getTypeStyle().length() > 0) { if (getTypeStyle().contains("<>")) { setType(getTypeStyle().replace("<>", generics)); // depends on control dependency: [if], data = [none] } else if (getTypeStyle().contains("<")) { setType(getTypeStyle()); // depends on control dependency: [if], data = [none] } else { setType(getTypeStyle() + generics); // depends on control dependency: [if], data = [none] } } else { setType(fieldType); // depends on control dependency: [if], data = [none] } } }
public class class_name { public int replace(Object dependency, ValueSet valueSet) { int returnCode = HTODDynacache.NO_EXCEPTION; dependencyNotUpdatedTable.remove(dependency); if (valueSet != null && valueSet.size() > this.delayOffloadEntriesLimit) { dependencyToEntryTable.remove(dependency); if (this.type == DEP_ID_TABLE) { returnCode = this.htod.writeValueSet(HTODDynacache.DEP_ID_DATA, dependency, valueSet, HTODDynacache.ALL); // valueSet may be empty after writeValueSet this.htod.cache.getCacheStatisticsListener().depIdsOffloadedToDisk(dependency); //System.out.println("***** replace dependency id=" + dependency + " size=" + valueSet.size()); } else { returnCode = this.htod.writeValueSet(HTODDynacache.TEMPLATE_ID_DATA, dependency, valueSet, HTODDynacache.ALL); // valueSet may be empty after writeValueSet this.htod.cache.getCacheStatisticsListener().templatesOffloadedToDisk(dependency); //System.out.println("***** replace template id=" + dependency + " size=" + valueSet.size()); } } else { if (valueSet.size() > 0) { dependencyToEntryTable.put(dependency, valueSet); } else { dependencyToEntryTable.remove(dependency); } } if (returnCode == HTODDynacache.DISK_SIZE_OVER_LIMIT_EXCEPTION && valueSet.size() > 0) { this.htod.delCacheEntry(valueSet, CachePerf.DISK_OVERFLOW, CachePerf.LOCAL, !Cache.FROM_DEPID_TEMPLATE_INVALIDATION, HTODInvalidationBuffer.FIRE_EVENT); returnCode = HTODDynacache.NO_EXCEPTION; } return returnCode; } }
public class class_name { public int replace(Object dependency, ValueSet valueSet) { int returnCode = HTODDynacache.NO_EXCEPTION; dependencyNotUpdatedTable.remove(dependency); if (valueSet != null && valueSet.size() > this.delayOffloadEntriesLimit) { dependencyToEntryTable.remove(dependency); // depends on control dependency: [if], data = [none] if (this.type == DEP_ID_TABLE) { returnCode = this.htod.writeValueSet(HTODDynacache.DEP_ID_DATA, dependency, valueSet, HTODDynacache.ALL); // valueSet may be empty after writeValueSet // depends on control dependency: [if], data = [none] this.htod.cache.getCacheStatisticsListener().depIdsOffloadedToDisk(dependency); // depends on control dependency: [if], data = [none] //System.out.println("***** replace dependency id=" + dependency + " size=" + valueSet.size()); } else { returnCode = this.htod.writeValueSet(HTODDynacache.TEMPLATE_ID_DATA, dependency, valueSet, HTODDynacache.ALL); // valueSet may be empty after writeValueSet // depends on control dependency: [if], data = [none] this.htod.cache.getCacheStatisticsListener().templatesOffloadedToDisk(dependency); // depends on control dependency: [if], data = [none] //System.out.println("***** replace template id=" + dependency + " size=" + valueSet.size()); } } else { if (valueSet.size() > 0) { dependencyToEntryTable.put(dependency, valueSet); // depends on control dependency: [if], data = [none] } else { dependencyToEntryTable.remove(dependency); // depends on control dependency: [if], data = [none] } } if (returnCode == HTODDynacache.DISK_SIZE_OVER_LIMIT_EXCEPTION && valueSet.size() > 0) { this.htod.delCacheEntry(valueSet, CachePerf.DISK_OVERFLOW, CachePerf.LOCAL, !Cache.FROM_DEPID_TEMPLATE_INVALIDATION, HTODInvalidationBuffer.FIRE_EVENT); // depends on control dependency: [if], data = [none] returnCode = HTODDynacache.NO_EXCEPTION; // depends on control dependency: [if], data = [none] } return returnCode; } }
public class class_name { public void detachFromParent() { if (parentNode == null) { return; } if (parentNode.childNodes != null) { parentNode.childNodes.remove(siblingIndex); parentNode.reindexChildren(); } parentNode = null; } }
public class class_name { public void detachFromParent() { if (parentNode == null) { return; // depends on control dependency: [if], data = [none] } if (parentNode.childNodes != null) { parentNode.childNodes.remove(siblingIndex); // depends on control dependency: [if], data = [none] parentNode.reindexChildren(); // depends on control dependency: [if], data = [none] } parentNode = null; } }
public class class_name { @VisibleForTesting @Override public void insertMetrics(Collection<IMetric> metrics, Granularity granularity) throws IOException { Timer.Context ctx = Instrumentation.getWriteTimerContext( CassandraModel.getPreaggregatedColumnFamilyName(granularity)); try { Multimap<Locator, IMetric> map = asMultimap(metrics); if ( isBatchIngestEnabled ) { insertMetricsInBatch(map, granularity); } else { insertMetricsIndividually(map, granularity); } } finally { ctx.stop(); } } }
public class class_name { @VisibleForTesting @Override public void insertMetrics(Collection<IMetric> metrics, Granularity granularity) throws IOException { Timer.Context ctx = Instrumentation.getWriteTimerContext( CassandraModel.getPreaggregatedColumnFamilyName(granularity)); try { Multimap<Locator, IMetric> map = asMultimap(metrics); if ( isBatchIngestEnabled ) { insertMetricsInBatch(map, granularity); // depends on control dependency: [if], data = [none] } else { insertMetricsIndividually(map, granularity); // depends on control dependency: [if], data = [none] } } finally { ctx.stop(); } } }
public class class_name { private static Object parseData(String str) { if (str.equals("true")) { return true; } else if (str.equals("false")) { return false; } else if (Character.isDigit(str.charAt(0))) { // number return Integer.parseInt(str); } else { return str; } } }
public class class_name { private static Object parseData(String str) { if (str.equals("true")) { return true; // depends on control dependency: [if], data = [none] } else if (str.equals("false")) { return false; // depends on control dependency: [if], data = [none] } else if (Character.isDigit(str.charAt(0))) { // number return Integer.parseInt(str); // depends on control dependency: [if], data = [none] } else { return str; // depends on control dependency: [if], data = [none] } } }
public class class_name { private void addPostParams(final Request request) { if (assetVersions != null) { for (String prop : assetVersions) { request.addPostParam("AssetVersions", prop); } } if (functionVersions != null) { for (String prop : functionVersions) { request.addPostParam("FunctionVersions", prop); } } if (dependencies != null) { request.addPostParam("Dependencies", dependencies); } } }
public class class_name { private void addPostParams(final Request request) { if (assetVersions != null) { for (String prop : assetVersions) { request.addPostParam("AssetVersions", prop); // depends on control dependency: [for], data = [prop] } } if (functionVersions != null) { for (String prop : functionVersions) { request.addPostParam("FunctionVersions", prop); // depends on control dependency: [for], data = [prop] } } if (dependencies != null) { request.addPostParam("Dependencies", dependencies); // depends on control dependency: [if], data = [none] } } }
public class class_name { private static void addAclHeaders(Request<? extends AmazonWebServiceRequest> request, AccessControlList acl) { List<Grant> grants = acl.getGrantsAsList(); Map<Permission, Collection<Grantee>> grantsByPermission = new HashMap<Permission, Collection<Grantee>>(); for ( Grant grant : grants ) { if ( !grantsByPermission.containsKey(grant.getPermission()) ) { grantsByPermission.put(grant.getPermission(), new LinkedList<Grantee>()); } grantsByPermission.get(grant.getPermission()).add(grant.getGrantee()); } for ( Permission permission : Permission.values() ) { if ( grantsByPermission.containsKey(permission) ) { Collection<Grantee> grantees = grantsByPermission.get(permission); boolean seenOne = false; StringBuilder granteeString = new StringBuilder(); for ( Grantee grantee : grantees ) { if ( !seenOne ) seenOne = true; else granteeString.append(", "); granteeString.append(grantee.getTypeIdentifier()).append("=").append("\"") .append(grantee.getIdentifier()).append("\""); } request.addHeader(permission.getHeaderName(), granteeString.toString()); } } } }
public class class_name { private static void addAclHeaders(Request<? extends AmazonWebServiceRequest> request, AccessControlList acl) { List<Grant> grants = acl.getGrantsAsList(); Map<Permission, Collection<Grantee>> grantsByPermission = new HashMap<Permission, Collection<Grantee>>(); for ( Grant grant : grants ) { if ( !grantsByPermission.containsKey(grant.getPermission()) ) { grantsByPermission.put(grant.getPermission(), new LinkedList<Grantee>()); // depends on control dependency: [if], data = [none] } grantsByPermission.get(grant.getPermission()).add(grant.getGrantee()); // depends on control dependency: [for], data = [grant] } for ( Permission permission : Permission.values() ) { if ( grantsByPermission.containsKey(permission) ) { Collection<Grantee> grantees = grantsByPermission.get(permission); boolean seenOne = false; StringBuilder granteeString = new StringBuilder(); for ( Grantee grantee : grantees ) { if ( !seenOne ) seenOne = true; else granteeString.append(", "); granteeString.append(grantee.getTypeIdentifier()).append("=").append("\"") .append(grantee.getIdentifier()).append("\""); // depends on control dependency: [for], data = [grantee] } request.addHeader(permission.getHeaderName(), granteeString.toString()); // depends on control dependency: [if], data = [none] } } } }
public class class_name { private AuditUtilityTask getTask(String taskName) { AuditUtilityTask task = null; for (AuditUtilityTask availTask : tasks) { if (availTask.getTaskName().equals(taskName)) { task = availTask; } } return task; } }
public class class_name { private AuditUtilityTask getTask(String taskName) { AuditUtilityTask task = null; for (AuditUtilityTask availTask : tasks) { if (availTask.getTaskName().equals(taskName)) { task = availTask; // depends on control dependency: [if], data = [none] } } return task; } }
public class class_name { public static ObjectFields convertGenObjectFieldsToObjectFields(org.fcrepo.server.types.gen.ObjectFields source) { if (source == null) { return null; } ObjectFields result = new ObjectFields(); result.setPid(source.getPid() != null ? source.getPid().getValue() : null); result.setLabel(source.getLabel() != null ? source.getLabel().getValue() : null); result.setState(source.getState() != null ? source.getState().getValue() : null); result.setOwnerId(source.getOwnerId() != null ? source.getOwnerId().getValue() : null); result.setCDate(source.getCDate() != null ? DateUtility.convertStringToDate(source.getCDate().getValue()) : null); result.setMDate(source.getMDate() != null ? DateUtility.convertStringToDate(source.getMDate().getValue()) : null); result.setDCMDate(source.getDcmDate() != null ? DateUtility.convertStringToDate(source.getDcmDate().getValue()) : null); result.titles().addAll(convertStringArray(source.getTitle())); result.subjects().addAll(convertStringArray(source.getSubject())); result.descriptions() .addAll(convertStringArray(source.getDescription())); result.publishers().addAll(convertStringArray(source.getPublisher())); result.contributors() .addAll(convertStringArray(source.getContributor())); result.dates().addAll(convertStringArray(source.getDate())); result.types().addAll(convertStringArray(source.getType())); result.formats().addAll(convertStringArray(source.getFormat())); result.identifiers().addAll(convertStringArray(source.getIdentifier())); result.sources().addAll(convertStringArray(source.getSource())); result.languages().addAll(convertStringArray(source.getLanguage())); result.relations().addAll(convertStringArray(source.getRelation())); result.coverages().addAll(convertStringArray(source.getCoverage())); result.rights().addAll(convertStringArray(source.getRights())); return result; } }
public class class_name { public static ObjectFields convertGenObjectFieldsToObjectFields(org.fcrepo.server.types.gen.ObjectFields source) { if (source == null) { return null; // depends on control dependency: [if], data = [none] } ObjectFields result = new ObjectFields(); result.setPid(source.getPid() != null ? source.getPid().getValue() : null); result.setLabel(source.getLabel() != null ? source.getLabel().getValue() : null); result.setState(source.getState() != null ? source.getState().getValue() : null); result.setOwnerId(source.getOwnerId() != null ? source.getOwnerId().getValue() : null); result.setCDate(source.getCDate() != null ? DateUtility.convertStringToDate(source.getCDate().getValue()) : null); result.setMDate(source.getMDate() != null ? DateUtility.convertStringToDate(source.getMDate().getValue()) : null); result.setDCMDate(source.getDcmDate() != null ? DateUtility.convertStringToDate(source.getDcmDate().getValue()) : null); result.titles().addAll(convertStringArray(source.getTitle())); result.subjects().addAll(convertStringArray(source.getSubject())); result.descriptions() .addAll(convertStringArray(source.getDescription())); result.publishers().addAll(convertStringArray(source.getPublisher())); result.contributors() .addAll(convertStringArray(source.getContributor())); result.dates().addAll(convertStringArray(source.getDate())); result.types().addAll(convertStringArray(source.getType())); result.formats().addAll(convertStringArray(source.getFormat())); result.identifiers().addAll(convertStringArray(source.getIdentifier())); result.sources().addAll(convertStringArray(source.getSource())); result.languages().addAll(convertStringArray(source.getLanguage())); result.relations().addAll(convertStringArray(source.getRelation())); result.coverages().addAll(convertStringArray(source.getCoverage())); result.rights().addAll(convertStringArray(source.getRights())); return result; } }
public class class_name { public byte[] getNextByte(final int pSize, final boolean pShift) { byte[] tab = new byte[(int) Math.ceil(pSize / BYTE_SIZE_F)]; if (currentBitIndex % BYTE_SIZE != 0) { int index = 0; int max = currentBitIndex + pSize; while (currentBitIndex < max) { int mod = currentBitIndex % BYTE_SIZE; int modTab = index % BYTE_SIZE; int length = Math.min(max - currentBitIndex, Math.min(BYTE_SIZE - mod, BYTE_SIZE - modTab)); byte val = (byte) (byteTab[currentBitIndex / BYTE_SIZE] & getMask(mod, length)); if (pShift || pSize % BYTE_SIZE == 0) { if (mod != 0) { val = (byte) (val << Math.min(mod, BYTE_SIZE - length)); } else { val = (byte) ((val & DEFAULT_VALUE) >> modTab); } } tab[index / BYTE_SIZE] |= val; currentBitIndex += length; index += length; } if (!pShift && pSize % BYTE_SIZE != 0) { tab[tab.length - 1] = (byte) (tab[tab.length - 1] & getMask((max - pSize - 1) % BYTE_SIZE, BYTE_SIZE)); } } else { System.arraycopy(byteTab, currentBitIndex / BYTE_SIZE, tab, 0, tab.length); int val = pSize % BYTE_SIZE; if (val == 0) { val = BYTE_SIZE; } tab[tab.length - 1] = (byte) (tab[tab.length - 1] & getMask(currentBitIndex % BYTE_SIZE, val)); currentBitIndex += pSize; } return tab; } }
public class class_name { public byte[] getNextByte(final int pSize, final boolean pShift) { byte[] tab = new byte[(int) Math.ceil(pSize / BYTE_SIZE_F)]; if (currentBitIndex % BYTE_SIZE != 0) { int index = 0; int max = currentBitIndex + pSize; while (currentBitIndex < max) { int mod = currentBitIndex % BYTE_SIZE; int modTab = index % BYTE_SIZE; int length = Math.min(max - currentBitIndex, Math.min(BYTE_SIZE - mod, BYTE_SIZE - modTab)); byte val = (byte) (byteTab[currentBitIndex / BYTE_SIZE] & getMask(mod, length)); if (pShift || pSize % BYTE_SIZE == 0) { if (mod != 0) { val = (byte) (val << Math.min(mod, BYTE_SIZE - length)); // depends on control dependency: [if], data = [(mod] } else { val = (byte) ((val & DEFAULT_VALUE) >> modTab); // depends on control dependency: [if], data = [none] } } tab[index / BYTE_SIZE] |= val; // depends on control dependency: [while], data = [none] currentBitIndex += length; // depends on control dependency: [while], data = [none] index += length; // depends on control dependency: [while], data = [none] } if (!pShift && pSize % BYTE_SIZE != 0) { tab[tab.length - 1] = (byte) (tab[tab.length - 1] & getMask((max - pSize - 1) % BYTE_SIZE, BYTE_SIZE)); // depends on control dependency: [if], data = [none] } } else { System.arraycopy(byteTab, currentBitIndex / BYTE_SIZE, tab, 0, tab.length); // depends on control dependency: [if], data = [none] int val = pSize % BYTE_SIZE; if (val == 0) { val = BYTE_SIZE; // depends on control dependency: [if], data = [none] } tab[tab.length - 1] = (byte) (tab[tab.length - 1] & getMask(currentBitIndex % BYTE_SIZE, val)); // depends on control dependency: [if], data = [(currentBitIndex % BYTE_SIZE] currentBitIndex += pSize; // depends on control dependency: [if], data = [none] } return tab; } }
public class class_name { private void infoLog(String format, String addr) { if (logger.isInfoEnabled()) { if (StringUtils.isNotEmpty(addr)) { logger.info(format, addr); } else { logger.info(format, "UNKNOWN-ADDR"); } } } }
public class class_name { private void infoLog(String format, String addr) { if (logger.isInfoEnabled()) { if (StringUtils.isNotEmpty(addr)) { logger.info(format, addr); // depends on control dependency: [if], data = [none] } else { logger.info(format, "UNKNOWN-ADDR"); // depends on control dependency: [if], data = [none] } } } }
public class class_name { public ManagementEdge getForwardEdge(final int index) { if (index < this.forwardEdges.size()) { return this.forwardEdges.get(index); } return null; } }
public class class_name { public ManagementEdge getForwardEdge(final int index) { if (index < this.forwardEdges.size()) { return this.forwardEdges.get(index); // depends on control dependency: [if], data = [(index] } return null; } }
public class class_name { public Matrix transpose () { final float tv[][] = new float [m_nCols] [m_nRows]; // transposed values // Set the values of the transpose. for (int r = 0; r < m_nRows; ++r) { for (int c = 0; c < m_nCols; ++c) { tv[c][r] = m_aValues[r][c]; } } return new Matrix (tv); } }
public class class_name { public Matrix transpose () { final float tv[][] = new float [m_nCols] [m_nRows]; // transposed values // Set the values of the transpose. for (int r = 0; r < m_nRows; ++r) { for (int c = 0; c < m_nCols; ++c) { tv[c][r] = m_aValues[r][c]; // depends on control dependency: [for], data = [c] } } return new Matrix (tv); } }
public class class_name { public GetTransitGatewayAttachmentPropagationsResult withTransitGatewayAttachmentPropagations( TransitGatewayAttachmentPropagation... transitGatewayAttachmentPropagations) { if (this.transitGatewayAttachmentPropagations == null) { setTransitGatewayAttachmentPropagations(new com.amazonaws.internal.SdkInternalList<TransitGatewayAttachmentPropagation>( transitGatewayAttachmentPropagations.length)); } for (TransitGatewayAttachmentPropagation ele : transitGatewayAttachmentPropagations) { this.transitGatewayAttachmentPropagations.add(ele); } return this; } }
public class class_name { public GetTransitGatewayAttachmentPropagationsResult withTransitGatewayAttachmentPropagations( TransitGatewayAttachmentPropagation... transitGatewayAttachmentPropagations) { if (this.transitGatewayAttachmentPropagations == null) { setTransitGatewayAttachmentPropagations(new com.amazonaws.internal.SdkInternalList<TransitGatewayAttachmentPropagation>( transitGatewayAttachmentPropagations.length)); // depends on control dependency: [if], data = [none] } for (TransitGatewayAttachmentPropagation ele : transitGatewayAttachmentPropagations) { this.transitGatewayAttachmentPropagations.add(ele); // depends on control dependency: [for], data = [ele] } return this; } }
public class class_name { private synchronized void updateBytesWrittenMeter() { if (this.bytesWrittenMeter.isPresent()) { try { this.bytesWrittenMeter.get().mark(bytesWritten() - this.bytesWrittenMeter.get().getCount()); } catch (IOException e) { log.error("Cannot get bytesWritten for DataWriter, will not update " + this.bytesWrittenMeter.get().toString(), e); } } } }
public class class_name { private synchronized void updateBytesWrittenMeter() { if (this.bytesWrittenMeter.isPresent()) { try { this.bytesWrittenMeter.get().mark(bytesWritten() - this.bytesWrittenMeter.get().getCount()); // depends on control dependency: [try], data = [none] } catch (IOException e) { log.error("Cannot get bytesWritten for DataWriter, will not update " + this.bytesWrittenMeter.get().toString(), e); } // depends on control dependency: [catch], data = [none] } } }
public class class_name { @Override public Map<String, String> getUserInfo(PortletRequest request, PortletWindow portletWindow) throws PortletContainerException { Map<String, String> mergedInfo = new HashMap<String, String>(); // iterate over all supplied user info services and add their // resulting key/value pairs to our merged map for (final UserInfoService service : this.userInfoServices) { Map<String, String> userInfo = service.getUserInfo(request, portletWindow); if (userInfo != null) { for (final Map.Entry<String, String> entry : userInfo.entrySet()) { final String attributeName = entry.getKey(); final String valueObj = entry.getValue(); mergedInfo.put(attributeName, valueObj); } } } return mergedInfo; } }
public class class_name { @Override public Map<String, String> getUserInfo(PortletRequest request, PortletWindow portletWindow) throws PortletContainerException { Map<String, String> mergedInfo = new HashMap<String, String>(); // iterate over all supplied user info services and add their // resulting key/value pairs to our merged map for (final UserInfoService service : this.userInfoServices) { Map<String, String> userInfo = service.getUserInfo(request, portletWindow); if (userInfo != null) { for (final Map.Entry<String, String> entry : userInfo.entrySet()) { final String attributeName = entry.getKey(); final String valueObj = entry.getValue(); mergedInfo.put(attributeName, valueObj); // depends on control dependency: [for], data = [none] } } } return mergedInfo; } }
public class class_name { public void setValue(String value, String type) { checkFrozen(); setAutoCreatePropertyDefinition(true); if (TYPE_SHARED.equalsIgnoreCase(type)) { // set the provided value as shared (resource) value setResourceValue(value); } else { // set the provided value as individual (structure) value setStructureValue(value); } } }
public class class_name { public void setValue(String value, String type) { checkFrozen(); setAutoCreatePropertyDefinition(true); if (TYPE_SHARED.equalsIgnoreCase(type)) { // set the provided value as shared (resource) value setResourceValue(value); // depends on control dependency: [if], data = [none] } else { // set the provided value as individual (structure) value setStructureValue(value); // depends on control dependency: [if], data = [none] } } }
public class class_name { private static String convertDoubleElementToString(Double value) { String valueToPrint = String.valueOf(value); if (valueToPrint.length() > ROUNDING_LENGTH) { int lengthBeforeDot = (int) Math.ceil(Math.log10(Math.abs(value))); BigDecimal bigDecimal = new BigDecimal(value); bigDecimal = bigDecimal.setScale(ACCURACY - lengthBeforeDot, BigDecimal.ROUND_HALF_UP); valueToPrint = String.valueOf(bigDecimal.doubleValue()); } valueToPrint = trimZerosFromEnd(valueToPrint); return valueToPrint; } }
public class class_name { private static String convertDoubleElementToString(Double value) { String valueToPrint = String.valueOf(value); if (valueToPrint.length() > ROUNDING_LENGTH) { int lengthBeforeDot = (int) Math.ceil(Math.log10(Math.abs(value))); BigDecimal bigDecimal = new BigDecimal(value); bigDecimal = bigDecimal.setScale(ACCURACY - lengthBeforeDot, BigDecimal.ROUND_HALF_UP); // depends on control dependency: [if], data = [none] valueToPrint = String.valueOf(bigDecimal.doubleValue()); // depends on control dependency: [if], data = [none] } valueToPrint = trimZerosFromEnd(valueToPrint); return valueToPrint; } }
public class class_name { void add(final Span span) { if (tags != null) { throw new AssertionError("The set of tags has already been computed" + ", you can't add more Spans to " + this); } // normalize timestamps to milliseconds for proper comparison final long start = (start_time & Const.SECOND_MASK) == 0 ? start_time * 1000 : start_time; final long end = (end_time & Const.SECOND_MASK) == 0 ? end_time * 1000 : end_time; if (span.size() == 0) { // copy annotations that are in the time range for (Annotation annot : span.getAnnotations()) { long annot_start = annot.getStartTime(); if ((annot_start & Const.SECOND_MASK) == 0) { annot_start *= 1000; } long annot_end = annot.getStartTime(); if ((annot_end & Const.SECOND_MASK) == 0) { annot_end *= 1000; } if (annot_end >= start && annot_start <= end) { annotations.add(annot); } } } else { long first_dp = span.timestamp(0); if ((first_dp & Const.SECOND_MASK) == 0) { first_dp *= 1000; } // The following call to timestamp() will throw an // IndexOutOfBoundsException if size == 0, which is OK since it would // be a programming error. long last_dp = span.timestamp(span.size() - 1); if ((last_dp & Const.SECOND_MASK) == 0) { last_dp *= 1000; } if (first_dp <= end && last_dp >= start) { this.spans.add(span); annotations.addAll(span.getAnnotations()); } } } }
public class class_name { void add(final Span span) { if (tags != null) { throw new AssertionError("The set of tags has already been computed" + ", you can't add more Spans to " + this); } // normalize timestamps to milliseconds for proper comparison final long start = (start_time & Const.SECOND_MASK) == 0 ? start_time * 1000 : start_time; final long end = (end_time & Const.SECOND_MASK) == 0 ? end_time * 1000 : end_time; if (span.size() == 0) { // copy annotations that are in the time range for (Annotation annot : span.getAnnotations()) { long annot_start = annot.getStartTime(); if ((annot_start & Const.SECOND_MASK) == 0) { annot_start *= 1000; // depends on control dependency: [if], data = [none] } long annot_end = annot.getStartTime(); if ((annot_end & Const.SECOND_MASK) == 0) { annot_end *= 1000; // depends on control dependency: [if], data = [none] } if (annot_end >= start && annot_start <= end) { annotations.add(annot); // depends on control dependency: [if], data = [none] } } } else { long first_dp = span.timestamp(0); if ((first_dp & Const.SECOND_MASK) == 0) { first_dp *= 1000; // depends on control dependency: [if], data = [none] } // The following call to timestamp() will throw an // IndexOutOfBoundsException if size == 0, which is OK since it would // be a programming error. long last_dp = span.timestamp(span.size() - 1); if ((last_dp & Const.SECOND_MASK) == 0) { last_dp *= 1000; // depends on control dependency: [if], data = [none] } if (first_dp <= end && last_dp >= start) { this.spans.add(span); // depends on control dependency: [if], data = [none] annotations.addAll(span.getAnnotations()); // depends on control dependency: [if], data = [none] } } } }
public class class_name { private static void find(List<File> files, File path, Boolean recursive) { if (path.isDirectory()) { // iterate over files for (File file : path.listFiles()) { if (recursive || !file.isDirectory()) { find(files, file, recursive); } } } else { // process the file files.add(path); } } }
public class class_name { private static void find(List<File> files, File path, Boolean recursive) { if (path.isDirectory()) { // iterate over files for (File file : path.listFiles()) { if (recursive || !file.isDirectory()) { find(files, file, recursive); // depends on control dependency: [if], data = [none] } } } else { // process the file files.add(path); // depends on control dependency: [if], data = [none] } } }
public class class_name { public synchronized void flush() throws ObjectManagerException { if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled()) trace.entry(this, cclass, "flush"); // Capture the ManagedObjects to write and delete. java.util.Map ourManagedObjectsToWrite = managedObjectsToWrite; managedObjectsToWrite = new ConcurrentHashMap(concurrency); java.util.Map ourTokensToDelete = tokensToDelete; tokensToDelete = new ConcurrentHashMap(concurrency); // Write the managed objects to disk. // Use of ConcurrentHashMap makes this a safe copy of the set at the time we construct the iterator. java.util.Iterator managedObjectIterator = ourManagedObjectsToWrite.values() .iterator(); while (managedObjectIterator.hasNext()) { ManagedObject managedObject = (ManagedObject) managedObjectIterator.next(); write(managedObject); } // While managedObjectIterator.hasNext(). // Delete the managed objects from disk. // Use of ConcurrentHashMap makes this a safe copy of the set at the time we construct the iterator. java.util.Iterator tokenIterator = ourTokensToDelete.values() .iterator(); while (tokenIterator.hasNext()) { Token token = (Token) tokenIterator.next(); if (managedObjectsOnDisk.contains(new Long(token.storedObjectIdentifier))) { java.io.File storeFile = new java.io.File(storeDirectoryName + java.io.File.separator + token.storedObjectIdentifier); storeFile.delete(); managedObjectsOnDisk.remove((new Long(token.storedObjectIdentifier))); } // if ... contains. } // While tokenIterator.hasNext(). // Write the header and force to disk. writeHeader(); if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled()) trace.exit(this, cclass, "flush"); } }
public class class_name { public synchronized void flush() throws ObjectManagerException { if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled()) trace.entry(this, cclass, "flush"); // Capture the ManagedObjects to write and delete. java.util.Map ourManagedObjectsToWrite = managedObjectsToWrite; managedObjectsToWrite = new ConcurrentHashMap(concurrency); java.util.Map ourTokensToDelete = tokensToDelete; tokensToDelete = new ConcurrentHashMap(concurrency); // Write the managed objects to disk. // Use of ConcurrentHashMap makes this a safe copy of the set at the time we construct the iterator. java.util.Iterator managedObjectIterator = ourManagedObjectsToWrite.values() .iterator(); while (managedObjectIterator.hasNext()) { ManagedObject managedObject = (ManagedObject) managedObjectIterator.next(); write(managedObject); } // While managedObjectIterator.hasNext(). // Delete the managed objects from disk. // Use of ConcurrentHashMap makes this a safe copy of the set at the time we construct the iterator. java.util.Iterator tokenIterator = ourTokensToDelete.values() .iterator(); while (tokenIterator.hasNext()) { Token token = (Token) tokenIterator.next(); if (managedObjectsOnDisk.contains(new Long(token.storedObjectIdentifier))) { java.io.File storeFile = new java.io.File(storeDirectoryName + java.io.File.separator + token.storedObjectIdentifier); storeFile.delete(); // depends on control dependency: [if], data = [none] managedObjectsOnDisk.remove((new Long(token.storedObjectIdentifier))); // depends on control dependency: [if], data = [none] } // if ... contains. } // While tokenIterator.hasNext(). // Write the header and force to disk. writeHeader(); if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled()) trace.exit(this, cclass, "flush"); } }
public class class_name { public void write(int b) { if (ivSuppress == true) { return; } byte[] data = new byte[1]; data[0] = (byte) b; // cache data now. { LogRecord se = cacheTraceData(data); if (se != null) { dispatchEvent(se); } } // // Write the data to the PrintStream this stream is wrapping. // if (ivFormatted == false) // ivStream.write(b); // else { // // Write data in formatted form. If a write is pending a header has // // already been written // // Otherwise new up an event and write it, which also writes the // // header. // synchronized (this) { // if (ivWritePending) { // ivStream.write(b); // } else { // LogRecord sse = createEvent(data); // sse.writeSelfToStream(ivStream, ivFormatType, false, ivBuffer, // ivFormatter, ivDate, ivFieldPos); // ivWritePending = true; // } // } // } } }
public class class_name { public void write(int b) { if (ivSuppress == true) { return; // depends on control dependency: [if], data = [none] } byte[] data = new byte[1]; data[0] = (byte) b; // cache data now. { LogRecord se = cacheTraceData(data); if (se != null) { dispatchEvent(se); // depends on control dependency: [if], data = [(se] } } // // Write the data to the PrintStream this stream is wrapping. // if (ivFormatted == false) // ivStream.write(b); // else { // // Write data in formatted form. If a write is pending a header has // // already been written // // Otherwise new up an event and write it, which also writes the // // header. // synchronized (this) { // if (ivWritePending) { // ivStream.write(b); // } else { // LogRecord sse = createEvent(data); // sse.writeSelfToStream(ivStream, ivFormatType, false, ivBuffer, // ivFormatter, ivDate, ivFieldPos); // ivWritePending = true; // } // } // } } }
public class class_name { public void deselect(Item item, int position, @Nullable Iterator<Integer> entries) { item.withSetSelected(false); if (entries != null) { entries.remove(); } if (position >= 0) { mFastAdapter.notifyItemChanged(position); } if (mSelectionListener != null) { mSelectionListener.onSelectionChanged(item, false); } } }
public class class_name { public void deselect(Item item, int position, @Nullable Iterator<Integer> entries) { item.withSetSelected(false); if (entries != null) { entries.remove(); // depends on control dependency: [if], data = [none] } if (position >= 0) { mFastAdapter.notifyItemChanged(position); // depends on control dependency: [if], data = [(position] } if (mSelectionListener != null) { mSelectionListener.onSelectionChanged(item, false); // depends on control dependency: [if], data = [none] } } }
public class class_name { public Writer write(Writer writer) throws JSONException { try { boolean notFirst = false; writer.write('{'); for(Iterator it = myHashMap.entrySet().iterator(); it.hasNext();) { Map.Entry entry = (Entry)it.next(); if (notFirst) { writer.write(','); } writeQuoted(writer, entry.getKey()); writer.write(':'); writeValue(writer, entry.getValue()); notFirst = true; } writer.write('}'); return writer; } catch (IOException e) { throw new JSONException(e); } } }
public class class_name { public Writer write(Writer writer) throws JSONException { try { boolean notFirst = false; writer.write('{'); for(Iterator it = myHashMap.entrySet().iterator(); it.hasNext();) { Map.Entry entry = (Entry)it.next(); if (notFirst) { writer.write(','); // depends on control dependency: [if], data = [none] } writeQuoted(writer, entry.getKey()); writer.write(':'); writeValue(writer, entry.getValue()); notFirst = true; } writer.write('}'); return writer; } catch (IOException e) { throw new JSONException(e); } } }
public class class_name { public void setTitles(Collection<String> titles) { if (null == this.titles) { this.titles = new ArrayList<>(); } this.titles.clear(); this.titles.addAll(titles); } }
public class class_name { public void setTitles(Collection<String> titles) { if (null == this.titles) { this.titles = new ArrayList<>(); // depends on control dependency: [if], data = [none] } this.titles.clear(); this.titles.addAll(titles); } }
public class class_name { private void buildPluralMethod( TypeSpec.Builder type, String pluralType, Map<String, PluralData> pluralMap, Map<String, FieldSpec> fieldMap) { MethodSpec.Builder method = MethodSpec.methodBuilder("eval" + pluralType) .addModifiers(PUBLIC) .addParameter(String.class, "language") .addParameter(NUMBER_OPERANDS, "o") .returns(PLURAL_CATEGORY); method.beginControlFlow("switch (language)"); List<MethodSpec> ruleMethods = new ArrayList<>(); for (Map.Entry<String, PluralData> entry : pluralMap.entrySet()) { String language = entry.getKey(); String methodName = String.format("eval%s%s", pluralType, language.toUpperCase()); method.addStatement("case $S:\n return $L(o)", language, methodName); MethodSpec ruleMethod = buildRuleMethod(methodName, entry.getValue(), fieldMap); ruleMethods.add(ruleMethod); } method.addStatement("default:\n return null"); method.endControlFlow(); type.addMethod(method.build()); for (MethodSpec ruleMethod : ruleMethods) { type.addMethod(ruleMethod); } } }
public class class_name { private void buildPluralMethod( TypeSpec.Builder type, String pluralType, Map<String, PluralData> pluralMap, Map<String, FieldSpec> fieldMap) { MethodSpec.Builder method = MethodSpec.methodBuilder("eval" + pluralType) .addModifiers(PUBLIC) .addParameter(String.class, "language") .addParameter(NUMBER_OPERANDS, "o") .returns(PLURAL_CATEGORY); method.beginControlFlow("switch (language)"); List<MethodSpec> ruleMethods = new ArrayList<>(); for (Map.Entry<String, PluralData> entry : pluralMap.entrySet()) { String language = entry.getKey(); String methodName = String.format("eval%s%s", pluralType, language.toUpperCase()); method.addStatement("case $S:\n return $L(o)", language, methodName); // depends on control dependency: [for], data = [none] MethodSpec ruleMethod = buildRuleMethod(methodName, entry.getValue(), fieldMap); ruleMethods.add(ruleMethod); // depends on control dependency: [for], data = [none] } method.addStatement("default:\n return null"); method.endControlFlow(); type.addMethod(method.build()); for (MethodSpec ruleMethod : ruleMethods) { type.addMethod(ruleMethod); // depends on control dependency: [for], data = [ruleMethod] } } }
public class class_name { Index flip(int index) { if ((index < 0) || (index >= rank)) throw new IllegalArgumentException(); Index i = (Index) this.clone(); if (shape[index] >= 0) { // !vlen case i.offset += stride[index] * (shape[index] - 1); i.stride[index] = -stride[index]; } i.fastIterator = false; i.precalc(); // any subclass-specific optimizations return i; } }
public class class_name { Index flip(int index) { if ((index < 0) || (index >= rank)) throw new IllegalArgumentException(); Index i = (Index) this.clone(); if (shape[index] >= 0) { // !vlen case i.offset += stride[index] * (shape[index] - 1); // depends on control dependency: [if], data = [(shape[index]] i.stride[index] = -stride[index]; // depends on control dependency: [if], data = [none] } i.fastIterator = false; i.precalc(); // any subclass-specific optimizations return i; } }
public class class_name { private final void growToHold(final int length) { if (length > stack.length) { final int[] newStack = new int[Math.max(length, stack.length * 2)]; System.arraycopy(stack, 0, newStack, 0, stack.length); stack = newStack; } } }
public class class_name { private final void growToHold(final int length) { if (length > stack.length) { final int[] newStack = new int[Math.max(length, stack.length * 2)]; System.arraycopy(stack, 0, newStack, 0, stack.length); // depends on control dependency: [if], data = [stack.length)] stack = newStack; // depends on control dependency: [if], data = [none] } } }
public class class_name { @SuppressWarnings("unchecked") public void execute() { Utils.require(m_metricPaths != null && m_metricPaths.length != 0, "Metric ('m') parameter is required"); List<String> allfieldNames = new ArrayList<String>(); for (GroupSetEntry groupSetEntry : m_groupSet) { for (GroupPath groupPath : groupSetEntry.m_groupPaths){ preserveGroupLink(groupPath, true); groupSetEntry.m_metricPath.addGroupPath(groupPath); } preserveGroupLink(groupSetEntry.m_metricPath, false); allfieldNames.addAll(groupSetEntry.m_metricPath.fieldNames); if (groupSetEntry.m_isComposite) { groupSetEntry.m_compositeGroup = groupSetEntry.m_totalGroup.createSubgroup(Group.COMPOSITE_GROUP_NAME); } } final List<String> fieldNames = new ArrayList<String>(new HashSet<String>(allfieldNames)); // remove duplicates String queryText = m_query; if (queryText == null) queryText = "*"; ArrayList<Integer> iGroupSet2Skip = new ArrayList<Integer>(); if (queryText.equals("*")) { // all items for (int i = 0; i < m_groupSet.length; i++) { if ((m_groupSet[i].m_groupPathsParam == null) && // no groups (m_groupSet[i].m_metricPath.branches.size() == 0) && // no branches (m_groupSet[i].m_metricPath.fieldType == FieldType.TIMESTAMP)) { // TIMESTAMP field Date date = null; if (m_groupSet[i].m_metricPath.function.equals("MAX")) { date = MaxMinHelper.getMaxDate(m_tableDef, m_groupSet[i].m_metricPath.name); } else if (m_groupSet[i].m_metricPath.function.equals("MIN")) { date = MaxMinHelper.getMinDate(m_tableDef, m_groupSet[i].m_metricPath.name); } if (date != null) { m_groupSet[i].m_totalGroup.update(Utils.formatDateUTC(date.getTime())); iGroupSet2Skip.add(i); } } } } if (iGroupSet2Skip.size() == m_groupSet.length) return; Timer searchTimer = new Timer(); timers.start("Search"); QueryExecutor executor = new QueryExecutor(m_tableDef); executor.setL2rEnabled(m_l2rEnable); Iterable<ObjectID> hits = executor.search(queryText); // ArrayList<ObjectID> hhh = new ArrayList<>(); // for (ObjectID hit : hits) { // String id = hit.toString(); // hhh.add(IDHelper.createID(id)); // } if (separateSearchTiming) { ArrayList<ObjectID> hitList = new ArrayList<ObjectID>(); for(ObjectID id : hits) hitList.add(id); hits = hitList; timers.stop("Search"); log.debug("Search '{}' took {}", new Object[] { queryText, searchTimer }); } timers.start("Aggregating"); DBEntitySequenceFactory factory = new DBEntitySequenceFactory(); EntitySequence collection = factory.getSequence(m_tableDef, hits, fieldNames); List<Set<String>[]> groupKeysSet = new ArrayList<Set<String>[]>(); for (GroupSetEntry groupSetEntry : m_groupSet) { Set<String>[] groupKeys = new HashSet[groupSetEntry.m_groupPaths.length]; for (int i = 0; i < groupKeys.length; i ++){ groupKeys[i] = new HashSet<String>(); } groupKeysSet.add(groupKeys); } m_totalObjects = 0; for (Entity obj : collection) { m_totalObjects++; for (int i = 0; i < m_groupSet.length; i++) { if (iGroupSet2Skip.contains(i)) continue; process(obj, m_groupSet[i].m_metricPath, m_groupSet[i], groupKeysSet.get(i)); } } // task #32,752 - include metrics for empty batches for (GroupSetEntry groupSetEntry : m_groupSet) { boolean useNullGroup = !groupSetEntry.m_metricPath.function.equals("COUNT"); addEmptyGroups(groupSetEntry.m_totalGroup, groupSetEntry.m_groupPaths, 0, useNullGroup); if (groupSetEntry.m_isComposite) { addEmptyGroups(groupSetEntry.m_compositeGroup, groupSetEntry.m_groupPaths, 1, useNullGroup); } } // When a multi-metric aggregate query ... if (m_metricPaths.length > 1) { if (m_groups != null) { int cMetrics = m_metricPaths.length; int cGroups = m_groups.size(); for (int ig = 0; ig < cGroups; ig++) { GroupSetEntry groupSetEntry = m_groupSet[ig]; // uses the TOP or BOTTOM function in the outer grouping field for the first metric function ... if ((groupSetEntry.m_groupPaths[0].groupOutputParameters.function == Selection.Top) || (groupSetEntry.m_groupPaths[0].groupOutputParameters.function == Selection.Bottom)) { List<Group> definedgroups = new ArrayList<Group>(); for (int im = 1; im < cMetrics; im++) { definedgroups.add(m_groupSet[im * cGroups + ig].m_totalGroup); } // the outer and inner groups are selected on this metric function. defineGroupsSelection(m_groupSet[ig].m_totalGroup, m_groupSet[ig].m_groupPaths, 0, definedgroups); } } } } factory.timers.log(); timers.stop("Aggregating"); timers.log("Aggregate '%s'", m_mParamValue); } }
public class class_name { @SuppressWarnings("unchecked") public void execute() { Utils.require(m_metricPaths != null && m_metricPaths.length != 0, "Metric ('m') parameter is required"); List<String> allfieldNames = new ArrayList<String>(); for (GroupSetEntry groupSetEntry : m_groupSet) { for (GroupPath groupPath : groupSetEntry.m_groupPaths){ preserveGroupLink(groupPath, true); // depends on control dependency: [for], data = [groupPath] groupSetEntry.m_metricPath.addGroupPath(groupPath); // depends on control dependency: [for], data = [groupPath] } preserveGroupLink(groupSetEntry.m_metricPath, false); // depends on control dependency: [for], data = [groupSetEntry] allfieldNames.addAll(groupSetEntry.m_metricPath.fieldNames); // depends on control dependency: [for], data = [groupSetEntry] if (groupSetEntry.m_isComposite) { groupSetEntry.m_compositeGroup = groupSetEntry.m_totalGroup.createSubgroup(Group.COMPOSITE_GROUP_NAME); // depends on control dependency: [if], data = [none] } } final List<String> fieldNames = new ArrayList<String>(new HashSet<String>(allfieldNames)); // remove duplicates String queryText = m_query; if (queryText == null) queryText = "*"; ArrayList<Integer> iGroupSet2Skip = new ArrayList<Integer>(); if (queryText.equals("*")) { // all items for (int i = 0; i < m_groupSet.length; i++) { if ((m_groupSet[i].m_groupPathsParam == null) && // no groups (m_groupSet[i].m_metricPath.branches.size() == 0) && // no branches (m_groupSet[i].m_metricPath.fieldType == FieldType.TIMESTAMP)) { // TIMESTAMP field Date date = null; if (m_groupSet[i].m_metricPath.function.equals("MAX")) { date = MaxMinHelper.getMaxDate(m_tableDef, m_groupSet[i].m_metricPath.name); // depends on control dependency: [if], data = [none] } else if (m_groupSet[i].m_metricPath.function.equals("MIN")) { date = MaxMinHelper.getMinDate(m_tableDef, m_groupSet[i].m_metricPath.name); // depends on control dependency: [if], data = [none] } if (date != null) { m_groupSet[i].m_totalGroup.update(Utils.formatDateUTC(date.getTime())); // depends on control dependency: [if], data = [(date] iGroupSet2Skip.add(i); // depends on control dependency: [if], data = [none] } } } } if (iGroupSet2Skip.size() == m_groupSet.length) return; Timer searchTimer = new Timer(); timers.start("Search"); QueryExecutor executor = new QueryExecutor(m_tableDef); executor.setL2rEnabled(m_l2rEnable); Iterable<ObjectID> hits = executor.search(queryText); // ArrayList<ObjectID> hhh = new ArrayList<>(); // for (ObjectID hit : hits) { // String id = hit.toString(); // hhh.add(IDHelper.createID(id)); // } if (separateSearchTiming) { ArrayList<ObjectID> hitList = new ArrayList<ObjectID>(); for(ObjectID id : hits) hitList.add(id); hits = hitList; // depends on control dependency: [if], data = [none] timers.stop("Search"); // depends on control dependency: [if], data = [none] log.debug("Search '{}' took {}", new Object[] { queryText, searchTimer }); // depends on control dependency: [if], data = [none] } timers.start("Aggregating"); DBEntitySequenceFactory factory = new DBEntitySequenceFactory(); EntitySequence collection = factory.getSequence(m_tableDef, hits, fieldNames); List<Set<String>[]> groupKeysSet = new ArrayList<Set<String>[]>(); for (GroupSetEntry groupSetEntry : m_groupSet) { Set<String>[] groupKeys = new HashSet[groupSetEntry.m_groupPaths.length]; for (int i = 0; i < groupKeys.length; i ++){ groupKeys[i] = new HashSet<String>(); // depends on control dependency: [for], data = [i] } groupKeysSet.add(groupKeys); // depends on control dependency: [for], data = [none] } m_totalObjects = 0; for (Entity obj : collection) { m_totalObjects++; // depends on control dependency: [for], data = [none] for (int i = 0; i < m_groupSet.length; i++) { if (iGroupSet2Skip.contains(i)) continue; process(obj, m_groupSet[i].m_metricPath, m_groupSet[i], groupKeysSet.get(i)); // depends on control dependency: [for], data = [i] } } // task #32,752 - include metrics for empty batches for (GroupSetEntry groupSetEntry : m_groupSet) { boolean useNullGroup = !groupSetEntry.m_metricPath.function.equals("COUNT"); addEmptyGroups(groupSetEntry.m_totalGroup, groupSetEntry.m_groupPaths, 0, useNullGroup); // depends on control dependency: [for], data = [groupSetEntry] if (groupSetEntry.m_isComposite) { addEmptyGroups(groupSetEntry.m_compositeGroup, groupSetEntry.m_groupPaths, 1, useNullGroup); // depends on control dependency: [if], data = [none] } } // When a multi-metric aggregate query ... if (m_metricPaths.length > 1) { if (m_groups != null) { int cMetrics = m_metricPaths.length; int cGroups = m_groups.size(); for (int ig = 0; ig < cGroups; ig++) { GroupSetEntry groupSetEntry = m_groupSet[ig]; // uses the TOP or BOTTOM function in the outer grouping field for the first metric function ... if ((groupSetEntry.m_groupPaths[0].groupOutputParameters.function == Selection.Top) || (groupSetEntry.m_groupPaths[0].groupOutputParameters.function == Selection.Bottom)) { List<Group> definedgroups = new ArrayList<Group>(); for (int im = 1; im < cMetrics; im++) { definedgroups.add(m_groupSet[im * cGroups + ig].m_totalGroup); // depends on control dependency: [for], data = [im] } // the outer and inner groups are selected on this metric function. defineGroupsSelection(m_groupSet[ig].m_totalGroup, m_groupSet[ig].m_groupPaths, 0, definedgroups); // depends on control dependency: [if], data = [none] } } } } factory.timers.log(); timers.stop("Aggregating"); timers.log("Aggregate '%s'", m_mParamValue); } }
public class class_name { public void setActionTypes(java.util.Collection<ActionType> actionTypes) { if (actionTypes == null) { this.actionTypes = null; return; } this.actionTypes = new java.util.ArrayList<ActionType>(actionTypes); } }
public class class_name { public void setActionTypes(java.util.Collection<ActionType> actionTypes) { if (actionTypes == null) { this.actionTypes = null; // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } this.actionTypes = new java.util.ArrayList<ActionType>(actionTypes); } }
public class class_name { protected ByteBuffer allocateBuffer() { if (_buffersToReuse != null && !_buffersToReuse.isEmpty()) { ByteBuffer bb = _buffersToReuse.poll(); bb.rewind(); bb.limit(bb.capacity()); return bb; } ByteBuffer r = StaticBuffers.getInstance().byteBuffer(BUFFER_KEY, _bufferSize); r.limit(_bufferSize); return r.order(_order); } }
public class class_name { protected ByteBuffer allocateBuffer() { if (_buffersToReuse != null && !_buffersToReuse.isEmpty()) { ByteBuffer bb = _buffersToReuse.poll(); bb.rewind(); // depends on control dependency: [if], data = [none] bb.limit(bb.capacity()); // depends on control dependency: [if], data = [none] return bb; // depends on control dependency: [if], data = [none] } ByteBuffer r = StaticBuffers.getInstance().byteBuffer(BUFFER_KEY, _bufferSize); r.limit(_bufferSize); return r.order(_order); } }
public class class_name { public static base_responses add(nitro_service client, vlan resources[]) throws Exception { base_responses result = null; if (resources != null && resources.length > 0) { vlan addresources[] = new vlan[resources.length]; for (int i=0;i<resources.length;i++){ addresources[i] = new vlan(); addresources[i].id = resources[i].id; addresources[i].aliasname = resources[i].aliasname; addresources[i].ipv6dynamicrouting = resources[i].ipv6dynamicrouting; } result = add_bulk_request(client, addresources); } return result; } }
public class class_name { public static base_responses add(nitro_service client, vlan resources[]) throws Exception { base_responses result = null; if (resources != null && resources.length > 0) { vlan addresources[] = new vlan[resources.length]; for (int i=0;i<resources.length;i++){ addresources[i] = new vlan(); // depends on control dependency: [for], data = [i] addresources[i].id = resources[i].id; // depends on control dependency: [for], data = [i] addresources[i].aliasname = resources[i].aliasname; // depends on control dependency: [for], data = [i] addresources[i].ipv6dynamicrouting = resources[i].ipv6dynamicrouting; // depends on control dependency: [for], data = [i] } result = add_bulk_request(client, addresources); } return result; } }
public class class_name { private void close(final SocketChannel channel, final SelectionKey key) { try { channel.close(); } catch (Exception e) { // already closed; ignore } try { key.cancel(); } catch (Exception e) { // already cancelled/closed; ignore } } }
public class class_name { private void close(final SocketChannel channel, final SelectionKey key) { try { channel.close(); // depends on control dependency: [try], data = [none] } catch (Exception e) { // already closed; ignore } // depends on control dependency: [catch], data = [none] try { key.cancel(); // depends on control dependency: [try], data = [none] } catch (Exception e) { // already cancelled/closed; ignore } // depends on control dependency: [catch], data = [none] } }
public class class_name { public void updateEntry(String sitePath) { CmsClientSitemapEntry entry = getEntry(sitePath); if ((entry != null) && (CmsSitemapTreeItem.getItemById(entry.getId()) != null)) { getChildren(entry.getId(), CmsSitemapTreeItem.getItemById(entry.getId()).isOpen(), null); } } }
public class class_name { public void updateEntry(String sitePath) { CmsClientSitemapEntry entry = getEntry(sitePath); if ((entry != null) && (CmsSitemapTreeItem.getItemById(entry.getId()) != null)) { getChildren(entry.getId(), CmsSitemapTreeItem.getItemById(entry.getId()).isOpen(), null); // depends on control dependency: [if], data = [none] } } }
public class class_name { private static void parseTarget(ArrayList<Shape> shapes, JSONObject modelJSON, Shape current) throws JSONException { if (modelJSON.has("target")) { JSONObject targetObject = modelJSON.getJSONObject("target"); if (targetObject.has("resourceId")) { current.setTarget(getShapeWithId(targetObject.getString("resourceId"), shapes)); } } } }
public class class_name { private static void parseTarget(ArrayList<Shape> shapes, JSONObject modelJSON, Shape current) throws JSONException { if (modelJSON.has("target")) { JSONObject targetObject = modelJSON.getJSONObject("target"); if (targetObject.has("resourceId")) { current.setTarget(getShapeWithId(targetObject.getString("resourceId"), shapes)); // depends on control dependency: [if], data = [none] } } } }
public class class_name { private void extractSubqueries(AbstractPlanNode node) throws Exception { assert(node != null); Collection<AbstractExpression> subexprs = node.findAllSubquerySubexpressions(); for (AbstractExpression nextexpr : subexprs) { assert(nextexpr instanceof AbstractSubqueryExpression); AbstractSubqueryExpression subqueryExpr = (AbstractSubqueryExpression) nextexpr; int stmtId = subqueryExpr.getSubqueryId(); List<AbstractPlanNode> planNodes = new ArrayList<>(); assert(!m_planNodesListMap.containsKey(stmtId)); m_planNodesListMap.put(stmtId, planNodes); constructTree(planNodes, subqueryExpr.getSubqueryNode()); } if (node instanceof SeqScanPlanNode) { // If this is a CTE scan, then we need to attach the // base and recursive plans. Both go into new elements // of the plan list. SeqScanPlanNode seqScanNode = (SeqScanPlanNode)node; StmtCommonTableScan scan = seqScanNode.getCommonTableScan(); if (scan != null) { List<AbstractPlanNode> planNodes = new ArrayList<>(); CompiledPlan basePlanNode = scan.getBestCostBasePlan(); Integer baseStmtId = scan.getBaseStmtId(); if ( ! m_planNodesListMap.containsKey(baseStmtId.intValue())) { // We may see the same scan several times in the tree. That's // ok, but only try to put the scan in the lists once. m_planNodesListMap.put(baseStmtId, planNodes); constructTree(planNodes, basePlanNode.rootPlanGraph); if (scan.isRecursiveCTE()) { CompiledPlan recursivePlanNode = scan.getBestCostRecursivePlan(); Integer recursiveStmtId = scan.getRecursiveStmtId(); // We should not have added this yet. We know // we didn't add the base plan. If we added a statement id // which is the same as that of the // recursive plan without the base plan that would // be evidence of confusion. assert((recursiveStmtId != null) && !m_planNodesListMap.containsKey(recursiveStmtId)); // Need a new list of Plan Nodes for the recursive case, as it's // a new plan. planNodes = new ArrayList<>(); m_planNodesListMap.put(recursiveStmtId, planNodes); constructTree(planNodes, recursivePlanNode.rootPlanGraph); } } } } } }
public class class_name { private void extractSubqueries(AbstractPlanNode node) throws Exception { assert(node != null); Collection<AbstractExpression> subexprs = node.findAllSubquerySubexpressions(); for (AbstractExpression nextexpr : subexprs) { assert(nextexpr instanceof AbstractSubqueryExpression); AbstractSubqueryExpression subqueryExpr = (AbstractSubqueryExpression) nextexpr; int stmtId = subqueryExpr.getSubqueryId(); List<AbstractPlanNode> planNodes = new ArrayList<>(); assert(!m_planNodesListMap.containsKey(stmtId)); m_planNodesListMap.put(stmtId, planNodes); constructTree(planNodes, subqueryExpr.getSubqueryNode()); } if (node instanceof SeqScanPlanNode) { // If this is a CTE scan, then we need to attach the // base and recursive plans. Both go into new elements // of the plan list. SeqScanPlanNode seqScanNode = (SeqScanPlanNode)node; StmtCommonTableScan scan = seqScanNode.getCommonTableScan(); if (scan != null) { List<AbstractPlanNode> planNodes = new ArrayList<>(); CompiledPlan basePlanNode = scan.getBestCostBasePlan(); Integer baseStmtId = scan.getBaseStmtId(); if ( ! m_planNodesListMap.containsKey(baseStmtId.intValue())) { // We may see the same scan several times in the tree. That's // ok, but only try to put the scan in the lists once. m_planNodesListMap.put(baseStmtId, planNodes); // depends on control dependency: [if], data = [none] constructTree(planNodes, basePlanNode.rootPlanGraph); // depends on control dependency: [if], data = [none] if (scan.isRecursiveCTE()) { CompiledPlan recursivePlanNode = scan.getBestCostRecursivePlan(); Integer recursiveStmtId = scan.getRecursiveStmtId(); // We should not have added this yet. We know // we didn't add the base plan. If we added a statement id // which is the same as that of the // recursive plan without the base plan that would // be evidence of confusion. assert((recursiveStmtId != null) && !m_planNodesListMap.containsKey(recursiveStmtId)); // depends on control dependency: [if], data = [none] // Need a new list of Plan Nodes for the recursive case, as it's // a new plan. planNodes = new ArrayList<>(); // depends on control dependency: [if], data = [none] m_planNodesListMap.put(recursiveStmtId, planNodes); // depends on control dependency: [if], data = [none] constructTree(planNodes, recursivePlanNode.rootPlanGraph); // depends on control dependency: [if], data = [none] } } } } } }
public class class_name { public static List<String> extractNonExistingColumns(final Collection<String> expectedColumns, final Collection<String> actualColumns) { final List<String> columnsNotSpecifiedInExpectedDataSet = new ArrayList<String>(); for (String column : expectedColumns) { if (!actualColumns.contains(column.toLowerCase())) { columnsNotSpecifiedInExpectedDataSet.add(column.toLowerCase()); } } return columnsNotSpecifiedInExpectedDataSet; } }
public class class_name { public static List<String> extractNonExistingColumns(final Collection<String> expectedColumns, final Collection<String> actualColumns) { final List<String> columnsNotSpecifiedInExpectedDataSet = new ArrayList<String>(); for (String column : expectedColumns) { if (!actualColumns.contains(column.toLowerCase())) { columnsNotSpecifiedInExpectedDataSet.add(column.toLowerCase()); // depends on control dependency: [if], data = [none] } } return columnsNotSpecifiedInExpectedDataSet; } }
public class class_name { private static MultiLineString linearZInterpolation(MultiLineString multiLineString) { int nbGeom = multiLineString.getNumGeometries(); LineString[] lines = new LineString[nbGeom]; for (int i = 0; i < nbGeom; i++) { LineString subGeom = (LineString) multiLineString.getGeometryN(i); double startz = subGeom.getStartPoint().getCoordinates()[0].z; double endz = subGeom.getEndPoint().getCoordinates()[0].z; double length = subGeom.getLength(); subGeom.apply(new LinearZInterpolationFilter(startz, endz, length)); lines[i] = subGeom; } return FACTORY.createMultiLineString(lines); } }
public class class_name { private static MultiLineString linearZInterpolation(MultiLineString multiLineString) { int nbGeom = multiLineString.getNumGeometries(); LineString[] lines = new LineString[nbGeom]; for (int i = 0; i < nbGeom; i++) { LineString subGeom = (LineString) multiLineString.getGeometryN(i); double startz = subGeom.getStartPoint().getCoordinates()[0].z; double endz = subGeom.getEndPoint().getCoordinates()[0].z; double length = subGeom.getLength(); subGeom.apply(new LinearZInterpolationFilter(startz, endz, length)); // depends on control dependency: [for], data = [none] lines[i] = subGeom; // depends on control dependency: [for], data = [i] } return FACTORY.createMultiLineString(lines); } }
public class class_name { private Enumeration<URL> getResources11g(ClassLoader classLoader, String configFileName) { List<URL> newProps = new ArrayList<URL>(); if (classLoader.getClass().getSimpleName().equalsIgnoreCase("IdcClassLoader")) { try { Field field = classLoader.getClass().getField("m_zipfiles"); @SuppressWarnings("unchecked") Map<String, IdcZipFile> zipFiles = (Map<String, IdcZipFile>) field.get(classLoader); for (Entry<String, IdcZipFile> entry : zipFiles.entrySet()) { if (entry.getValue().m_entries.get(configFileName) != null) { String jarFile = entry.getKey(); // windows needs a slash before the C:/ if (!jarFile.startsWith("/")) { jarFile = "/" + jarFile; } try { URL u = new URL("jar:file:" + entry.getKey() + "!/" + configFileName); newProps.add(u); } catch (MalformedURLException e) { e.printStackTrace(); } } } } catch (Exception e) { // If there is any exception the ClassLoader is an unrecognised format e.printStackTrace(); } } return Collections.enumeration(newProps); } }
public class class_name { private Enumeration<URL> getResources11g(ClassLoader classLoader, String configFileName) { List<URL> newProps = new ArrayList<URL>(); if (classLoader.getClass().getSimpleName().equalsIgnoreCase("IdcClassLoader")) { try { Field field = classLoader.getClass().getField("m_zipfiles"); @SuppressWarnings("unchecked") Map<String, IdcZipFile> zipFiles = (Map<String, IdcZipFile>) field.get(classLoader); for (Entry<String, IdcZipFile> entry : zipFiles.entrySet()) { if (entry.getValue().m_entries.get(configFileName) != null) { String jarFile = entry.getKey(); // windows needs a slash before the C:/ if (!jarFile.startsWith("/")) { jarFile = "/" + jarFile; // depends on control dependency: [if], data = [none] } try { URL u = new URL("jar:file:" + entry.getKey() + "!/" + configFileName); newProps.add(u); // depends on control dependency: [try], data = [none] } catch (MalformedURLException e) { e.printStackTrace(); } // depends on control dependency: [catch], data = [none] } } } catch (Exception e) { // If there is any exception the ClassLoader is an unrecognised format e.printStackTrace(); } // depends on control dependency: [catch], data = [none] } return Collections.enumeration(newProps); } }
public class class_name { public void marshall(UpdateScriptRequest updateScriptRequest, ProtocolMarshaller protocolMarshaller) { if (updateScriptRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(updateScriptRequest.getScriptId(), SCRIPTID_BINDING); protocolMarshaller.marshall(updateScriptRequest.getName(), NAME_BINDING); protocolMarshaller.marshall(updateScriptRequest.getVersion(), VERSION_BINDING); protocolMarshaller.marshall(updateScriptRequest.getStorageLocation(), STORAGELOCATION_BINDING); protocolMarshaller.marshall(updateScriptRequest.getZipFile(), ZIPFILE_BINDING); } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } } }
public class class_name { public void marshall(UpdateScriptRequest updateScriptRequest, ProtocolMarshaller protocolMarshaller) { if (updateScriptRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } try { protocolMarshaller.marshall(updateScriptRequest.getScriptId(), SCRIPTID_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(updateScriptRequest.getName(), NAME_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(updateScriptRequest.getVersion(), VERSION_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(updateScriptRequest.getStorageLocation(), STORAGELOCATION_BINDING); // depends on control dependency: [try], data = [none] protocolMarshaller.marshall(updateScriptRequest.getZipFile(), ZIPFILE_BINDING); // depends on control dependency: [try], data = [none] } catch (Exception e) { throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e); } // depends on control dependency: [catch], data = [none] } }
public class class_name { public void selectValue(String value) { if (m_selectCells.get(value) == null) { return; } updateOpener(value); if (m_textMetricsPrefix != null) { truncate(m_textMetricsPrefix, m_widgetWidth); } m_selectedValue = value; close(); } }
public class class_name { public void selectValue(String value) { if (m_selectCells.get(value) == null) { return; // depends on control dependency: [if], data = [none] } updateOpener(value); if (m_textMetricsPrefix != null) { truncate(m_textMetricsPrefix, m_widgetWidth); // depends on control dependency: [if], data = [(m_textMetricsPrefix] } m_selectedValue = value; close(); } }
public class class_name { public final String getLevelName(GridRecord gr) { if (cust != null) { String result = cust.getLevelNameShort( gr.getLevelType1()); if (result != null) return result; } String levelUnit = getLevelUnit(gr); if (levelUnit != null) { int level1 = (int) gr.getLevel1(); int level2 = (int) gr.getLevel2(); if (levelUnit.equalsIgnoreCase("hPa")) { return "pressure"; } else if (level1 == 1013) { return "mean sea level"; } else if (level1 == 0) { return "tropopause"; } else if (level1 == 1001) { return "surface"; } else if (level2 != 0) { return "layer"; } } return ""; } }
public class class_name { public final String getLevelName(GridRecord gr) { if (cust != null) { String result = cust.getLevelNameShort( gr.getLevelType1()); if (result != null) return result; } String levelUnit = getLevelUnit(gr); if (levelUnit != null) { int level1 = (int) gr.getLevel1(); int level2 = (int) gr.getLevel2(); if (levelUnit.equalsIgnoreCase("hPa")) { return "pressure"; // depends on control dependency: [if], data = [none] } else if (level1 == 1013) { return "mean sea level"; // depends on control dependency: [if], data = [none] } else if (level1 == 0) { return "tropopause"; // depends on control dependency: [if], data = [none] } else if (level1 == 1001) { return "surface"; // depends on control dependency: [if], data = [none] } else if (level2 != 0) { return "layer"; // depends on control dependency: [if], data = [none] } } return ""; } }
public class class_name { public static void sortIfNecessary(Object value) { if (value instanceof Object[]) { sort((Object[]) value); } else if (value instanceof List) { sort((List<?>) value); } } }
public class class_name { public static void sortIfNecessary(Object value) { if (value instanceof Object[]) { sort((Object[]) value); // depends on control dependency: [if], data = [none] } else if (value instanceof List) { sort((List<?>) value); // depends on control dependency: [if], data = [none] } } }
public class class_name { public String getWifiMacAddress() { WifiManager wifiMan = (WifiManager) context .getSystemService(Context.WIFI_SERVICE); if (wifiMan != null) { WifiInfo wifiInf = wifiMan.getConnectionInfo(); return wifiInf.getMacAddress(); } return ""; } }
public class class_name { public String getWifiMacAddress() { WifiManager wifiMan = (WifiManager) context .getSystemService(Context.WIFI_SERVICE); if (wifiMan != null) { WifiInfo wifiInf = wifiMan.getConnectionInfo(); return wifiInf.getMacAddress(); // depends on control dependency: [if], data = [none] } return ""; } }
public class class_name { private void onSessionClose(){ synchronized(pendingQueue){ while(! pendingQueue.isEmpty()){ Packet p = pendingQueue.remove(); onLossPacket(p); } } } }
public class class_name { private void onSessionClose(){ synchronized(pendingQueue){ while(! pendingQueue.isEmpty()){ Packet p = pendingQueue.remove(); onLossPacket(p); // depends on control dependency: [while], data = [none] } } } }
public class class_name { BeanGen parse() { BeanData data = new BeanData(); beanDefIndex = parseBeanDefinition(); data.getCurrentImports().addAll(parseImports(beanDefIndex)); data.setImportInsertLocation(parseImportLocation(beanDefIndex)); if (beanDefIndex < 0) { return new BeanGen(file, content, config, data); } data.setBeanStyle(parseBeanStyle(beanDefIndex)); data.resolveBeanStyle(config.getDefaultStyle()); if (data.isBeanStyleValid() == false) { throw new BeanCodeGenException("Invalid bean style: " + data.getBeanStyle(), file, beanDefIndex); } data.setConstructorScope(parseConstrucorScope(beanDefIndex)); if (data.isConstructorScopeValid() == false) { throw new BeanCodeGenException("Invalid constructor scope: " + data.getConstructorScope(), file, beanDefIndex); } data.setBeanMetaScope(parseBeanMetaScope(beanDefIndex)); if (data.isBeanMetaScopeValid() == false) { throw new BeanCodeGenException("Invalid meta-bean scope: " + data.getBeanMetaScope(), file, beanDefIndex); } data.setBeanBuilderScope(parseBeanBuilderScope(beanDefIndex)); if (data.isBeanBuilderScopeValid() == false) { throw new BeanCodeGenException("Invalid bean builder scope: " + data.getBeanBuilderScope(), file, beanDefIndex); } data.setFactoryName(parseFactoryName(beanDefIndex)); data.setCacheHashCode(parseCacheHashCode(beanDefIndex)); data.setCloneStyle(parseCloneStyle(beanDefIndex)); if (data.isCloneStyleValid() == false) { throw new BeanCodeGenException("Invalid clone style: " + data.getCloneStyle(), file, beanDefIndex); } data.setImmutableConstructor(parseImmutableConstructor(beanDefIndex)); data.setConstructable(parseConstructable(beanDefIndex)); data.setTypeParts(parseBeanType(beanDefIndex)); String classHeaderAfterType = classHeaderAfterType(beanDefIndex, data.getType()); data.setSuperTypeParts(parseBeanSuperType(classHeaderAfterType)); data.setSerializable(parseSerializable(classHeaderAfterType)); if (parseBeanHierarchy(beanDefIndex).equals("immutable")) { data.setImmutable(true); data.setConstructorStyle(CONSTRUCTOR_BY_BUILDER); } else if (data.getImmutableConstructor() == CONSTRUCTOR_NONE) { if (data.isImmutable()) { if (data.isTypeFinal()) { data.setConstructorStyle(CONSTRUCTOR_BY_ARGS); } else { data.setConstructorStyle(CONSTRUCTOR_BY_BUILDER); } } else { if (data.isBeanStyleLight()) { data.setConstructorStyle(CONSTRUCTOR_BY_ARGS); } else { data.setConstructorStyle(CONSTRUCTOR_BY_BUILDER); } } } else { data.setConstructorStyle(data.getImmutableConstructor()); } if (data.isImmutable()) { data.setImmutableValidator(parseImmutableValidator(beanDefIndex)); data.setImmutableDefaults(parseImmutableDefaults(beanDefIndex)); data.setImmutablePreBuild(parseImmutablePreBuild(beanDefIndex)); if (data.isBeanStyleLight() && !data.isTypeFinal()) { throw new BeanCodeGenException( "Invalid bean style: Light beans must be declared final", file, beanDefIndex); } if (data.isBeanStyleMinimal() && !data.isTypeFinal()) { throw new BeanCodeGenException( "Invalid bean style: Minimal beans must be declared final", file, beanDefIndex); } if (data.isFactoryRequired() && !data.isRootClass()) { throw new BeanCodeGenException( "Invalid bean style: Factory method only allowed when bean has no bean superclass", file, beanDefIndex); } if (data.isFactoryRequired() && !data.isTypeFinal()) { throw new BeanCodeGenException( "Invalid bean style: Factory method only allowed when bean is final", file, beanDefIndex); } } else { if (data.isBeanStyleLight() && !data.isTypeFinal()) { throw new BeanCodeGenException( "Invalid bean style: Light beans must be declared final", file, beanDefIndex); } if (data.isBeanStyleMinimal() && !data.isTypeFinal()) { throw new BeanCodeGenException( "Invalid bean style: Minimal beans must be declared final", file, beanDefIndex); } if (data.isFactoryRequired()) { throw new BeanCodeGenException( "Invalid bean style: Factory method only allowed when bean is immutable", file, beanDefIndex); } } properties = parseProperties(data); autoStartIndex = parseStartAutogen(); autoEndIndex = parseEndAutogen(); data.setManualSerializationId(parseManualSerializationId(beanDefIndex)); data.setManualClone(parseManualClone(beanDefIndex)); data.setManualEqualsHashCode(parseManualEqualsHashCode(beanDefIndex)); data.setManualToStringCode(parseManualToStringCode(beanDefIndex)); if (data.isImmutable()) { for (PropertyGen prop : properties) { if (prop.getData().isDerived() == false && prop.getData().isFinal() == false) { throw new BeanCodeGenException("ImmutableBean must have final properties: " + data.getTypeRaw() + "." + prop.getData().getFieldName(), file, prop.getData().getLineIndex()); } } } else { if (data.getImmutableConstructor() > CONSTRUCTOR_NONE) { throw new BeanCodeGenException("Mutable beans must not specify @ImmutableConstructor: " + data.getTypeRaw(), file, beanDefIndex); } if (!"smart".equals(data.getConstructorScope()) && !data.isBeanStyleLight()) { throw new BeanCodeGenException("Mutable beans must not specify @BeanDefinition(constructorScope): " + data.getTypeRaw(), file, beanDefIndex); } } if (data.isCacheHashCode()) { data.setCacheHashCode(data.isImmutable() && data.isManualEqualsHashCode() == false); } return new BeanGen(file, content, config, data, properties, autoStartIndex, autoEndIndex); } }
public class class_name { BeanGen parse() { BeanData data = new BeanData(); beanDefIndex = parseBeanDefinition(); data.getCurrentImports().addAll(parseImports(beanDefIndex)); data.setImportInsertLocation(parseImportLocation(beanDefIndex)); if (beanDefIndex < 0) { return new BeanGen(file, content, config, data); // depends on control dependency: [if], data = [none] } data.setBeanStyle(parseBeanStyle(beanDefIndex)); data.resolveBeanStyle(config.getDefaultStyle()); if (data.isBeanStyleValid() == false) { throw new BeanCodeGenException("Invalid bean style: " + data.getBeanStyle(), file, beanDefIndex); } data.setConstructorScope(parseConstrucorScope(beanDefIndex)); if (data.isConstructorScopeValid() == false) { throw new BeanCodeGenException("Invalid constructor scope: " + data.getConstructorScope(), file, beanDefIndex); } data.setBeanMetaScope(parseBeanMetaScope(beanDefIndex)); if (data.isBeanMetaScopeValid() == false) { throw new BeanCodeGenException("Invalid meta-bean scope: " + data.getBeanMetaScope(), file, beanDefIndex); } data.setBeanBuilderScope(parseBeanBuilderScope(beanDefIndex)); if (data.isBeanBuilderScopeValid() == false) { throw new BeanCodeGenException("Invalid bean builder scope: " + data.getBeanBuilderScope(), file, beanDefIndex); } data.setFactoryName(parseFactoryName(beanDefIndex)); data.setCacheHashCode(parseCacheHashCode(beanDefIndex)); data.setCloneStyle(parseCloneStyle(beanDefIndex)); if (data.isCloneStyleValid() == false) { throw new BeanCodeGenException("Invalid clone style: " + data.getCloneStyle(), file, beanDefIndex); } data.setImmutableConstructor(parseImmutableConstructor(beanDefIndex)); data.setConstructable(parseConstructable(beanDefIndex)); data.setTypeParts(parseBeanType(beanDefIndex)); String classHeaderAfterType = classHeaderAfterType(beanDefIndex, data.getType()); data.setSuperTypeParts(parseBeanSuperType(classHeaderAfterType)); data.setSerializable(parseSerializable(classHeaderAfterType)); if (parseBeanHierarchy(beanDefIndex).equals("immutable")) { data.setImmutable(true); // depends on control dependency: [if], data = [none] data.setConstructorStyle(CONSTRUCTOR_BY_BUILDER); // depends on control dependency: [if], data = [none] } else if (data.getImmutableConstructor() == CONSTRUCTOR_NONE) { if (data.isImmutable()) { if (data.isTypeFinal()) { data.setConstructorStyle(CONSTRUCTOR_BY_ARGS); // depends on control dependency: [if], data = [none] } else { data.setConstructorStyle(CONSTRUCTOR_BY_BUILDER); // depends on control dependency: [if], data = [none] } } else { if (data.isBeanStyleLight()) { data.setConstructorStyle(CONSTRUCTOR_BY_ARGS); // depends on control dependency: [if], data = [none] } else { data.setConstructorStyle(CONSTRUCTOR_BY_BUILDER); // depends on control dependency: [if], data = [none] } } } else { data.setConstructorStyle(data.getImmutableConstructor()); // depends on control dependency: [if], data = [(data.getImmutableConstructor()] } if (data.isImmutable()) { data.setImmutableValidator(parseImmutableValidator(beanDefIndex)); // depends on control dependency: [if], data = [none] data.setImmutableDefaults(parseImmutableDefaults(beanDefIndex)); // depends on control dependency: [if], data = [none] data.setImmutablePreBuild(parseImmutablePreBuild(beanDefIndex)); // depends on control dependency: [if], data = [none] if (data.isBeanStyleLight() && !data.isTypeFinal()) { throw new BeanCodeGenException( "Invalid bean style: Light beans must be declared final", file, beanDefIndex); } if (data.isBeanStyleMinimal() && !data.isTypeFinal()) { throw new BeanCodeGenException( "Invalid bean style: Minimal beans must be declared final", file, beanDefIndex); } if (data.isFactoryRequired() && !data.isRootClass()) { throw new BeanCodeGenException( "Invalid bean style: Factory method only allowed when bean has no bean superclass", file, beanDefIndex); } if (data.isFactoryRequired() && !data.isTypeFinal()) { throw new BeanCodeGenException( "Invalid bean style: Factory method only allowed when bean is final", file, beanDefIndex); } } else { if (data.isBeanStyleLight() && !data.isTypeFinal()) { throw new BeanCodeGenException( "Invalid bean style: Light beans must be declared final", file, beanDefIndex); } if (data.isBeanStyleMinimal() && !data.isTypeFinal()) { throw new BeanCodeGenException( "Invalid bean style: Minimal beans must be declared final", file, beanDefIndex); } if (data.isFactoryRequired()) { throw new BeanCodeGenException( "Invalid bean style: Factory method only allowed when bean is immutable", file, beanDefIndex); } } properties = parseProperties(data); autoStartIndex = parseStartAutogen(); autoEndIndex = parseEndAutogen(); data.setManualSerializationId(parseManualSerializationId(beanDefIndex)); data.setManualClone(parseManualClone(beanDefIndex)); data.setManualEqualsHashCode(parseManualEqualsHashCode(beanDefIndex)); data.setManualToStringCode(parseManualToStringCode(beanDefIndex)); if (data.isImmutable()) { for (PropertyGen prop : properties) { if (prop.getData().isDerived() == false && prop.getData().isFinal() == false) { throw new BeanCodeGenException("ImmutableBean must have final properties: " + data.getTypeRaw() + "." + prop.getData().getFieldName(), file, prop.getData().getLineIndex()); } } } else { if (data.getImmutableConstructor() > CONSTRUCTOR_NONE) { throw new BeanCodeGenException("Mutable beans must not specify @ImmutableConstructor: " + data.getTypeRaw(), file, beanDefIndex); } if (!"smart".equals(data.getConstructorScope()) && !data.isBeanStyleLight()) { throw new BeanCodeGenException("Mutable beans must not specify @BeanDefinition(constructorScope): " + data.getTypeRaw(), file, beanDefIndex); } } if (data.isCacheHashCode()) { data.setCacheHashCode(data.isImmutable() && data.isManualEqualsHashCode() == false); // depends on control dependency: [if], data = [none] } return new BeanGen(file, content, config, data, properties, autoStartIndex, autoEndIndex); } }
public class class_name { private Expr parseMultiplicativeExpression(EnclosingScope scope, boolean terminated) { int start = index; Expr lhs = parseAccessExpression(scope, terminated); Token lookahead = tryAndMatch(terminated, Star, RightSlash, Percent); if (lookahead != null) { Expr rhs = parseAccessExpression(scope, terminated); switch (lookahead.kind) { case Star: lhs = new Expr.IntegerMultiplication(Type.Void, lhs, rhs); break; case RightSlash: lhs = new Expr.IntegerDivision(Type.Void, lhs, rhs); break; case Percent: lhs = new Expr.IntegerRemainder(Type.Void, lhs, rhs); break; default: throw new RuntimeException("deadcode"); // dead-code } lhs = annotateSourceLocation(lhs, start); } return lhs; } }
public class class_name { private Expr parseMultiplicativeExpression(EnclosingScope scope, boolean terminated) { int start = index; Expr lhs = parseAccessExpression(scope, terminated); Token lookahead = tryAndMatch(terminated, Star, RightSlash, Percent); if (lookahead != null) { Expr rhs = parseAccessExpression(scope, terminated); switch (lookahead.kind) { case Star: lhs = new Expr.IntegerMultiplication(Type.Void, lhs, rhs); break; case RightSlash: lhs = new Expr.IntegerDivision(Type.Void, lhs, rhs); break; case Percent: lhs = new Expr.IntegerRemainder(Type.Void, lhs, rhs); break; default: throw new RuntimeException("deadcode"); // dead-code } lhs = annotateSourceLocation(lhs, start); // depends on control dependency: [if], data = [none] } return lhs; } }
public class class_name { private double prediction(Instance inst) { if(this.initialisePerceptron){ return 0; }else{ double[] normalizedInstance = normalizedInstance(inst); double normalizedPrediction = prediction(normalizedInstance); return denormalizedPrediction(normalizedPrediction); } } }
public class class_name { private double prediction(Instance inst) { if(this.initialisePerceptron){ return 0; // depends on control dependency: [if], data = [none] }else{ double[] normalizedInstance = normalizedInstance(inst); double normalizedPrediction = prediction(normalizedInstance); return denormalizedPrediction(normalizedPrediction); // depends on control dependency: [if], data = [none] } } }
public class class_name { public static String collectChar(String string, CharToCharFunction function) { int size = string.length(); StringBuilder builder = new StringBuilder(size); for (int i = 0; i < size; i++) { builder.append(function.valueOf(string.charAt(i))); } return builder.toString(); } }
public class class_name { public static String collectChar(String string, CharToCharFunction function) { int size = string.length(); StringBuilder builder = new StringBuilder(size); for (int i = 0; i < size; i++) { builder.append(function.valueOf(string.charAt(i))); // depends on control dependency: [for], data = [i] } return builder.toString(); } }
public class class_name { public static DatatypeFactory getDTF() { DatatypeFactory dtf = threadDTF.get(); if (dtf == null) { try { dtf = DatatypeFactory.newInstance(); } catch (Exception e) { throw wrap(e); } threadDTF.set(dtf); } return dtf; } }
public class class_name { public static DatatypeFactory getDTF() { DatatypeFactory dtf = threadDTF.get(); if (dtf == null) { try { dtf = DatatypeFactory.newInstance(); // depends on control dependency: [try], data = [none] } catch (Exception e) { throw wrap(e); } // depends on control dependency: [catch], data = [none] threadDTF.set(dtf); // depends on control dependency: [if], data = [(dtf] } return dtf; } }
public class class_name { @Override public Map<String, Object> getBestParameters(Map<String, Object> guess) { // Create the objective function for the solver class GARCHMaxLikelihoodFunction implements MultivariateFunction, Serializable { private static final long serialVersionUID = 7072187082052755854L; @Override public double value(double[] variables) { double omega = variables[0]; double alpha = variables[1]; double beta = variables[2]; double theta = variables[3]; double mu = variables[4]; double phi = variables[5]; double logLikelihood = getLogLikelihoodForParameters(variables); // Penalty to prevent solver from hitting the bounds logLikelihood -= Math.max(1E-30-omega,0)/1E-30; logLikelihood -= Math.max(1E-30-alpha,0)/1E-30; logLikelihood -= Math.max((alpha-1)+1E-30,0)/1E-30; logLikelihood -= Math.max(1E-30-beta,0)/1E-30; logLikelihood -= Math.max((beta-1)+1E-30,0)/1E-30; return logLikelihood; } } final GARCHMaxLikelihoodFunction objectiveFunction = new GARCHMaxLikelihoodFunction(); // Create a guess for the solver final double[] guessParameters = new double[parameterGuess.length]; System.arraycopy(parameterGuess, 0, guessParameters, 0, parameterGuess.length); if(guess != null) { // A guess was provided, use that one guessParameters[0] = (Double)guess.get("Omega"); guessParameters[1] = (Double)guess.get("Alpha"); guessParameters[2] = (Double)guess.get("Beta"); guessParameters[3] = (Double)guess.get("Theta"); guessParameters[4] = (Double)guess.get("Mu"); guessParameters[5] = (Double)guess.get("Phi"); } // Seek optimal parameter configuration LevenbergMarquardt lm = new LevenbergMarquardt(guessParameters, new double[] { 1000.0 }, 100*maxIterations, 2) { private static final long serialVersionUID = -8844232820888815090L; @Override public void setValues(double[] parameters, double[] values) { values[0] = objectiveFunction.value(parameters); } }; double[] bestParameters = null; boolean isUseLM = false; if(isUseLM) { try { lm.run(); } catch (SolverException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } bestParameters = lm.getBestFitParameters(); } else { org.apache.commons.math3.optim.nonlinear.scalar.noderiv.CMAESOptimizer optimizer2 = new org.apache.commons.math3.optim.nonlinear.scalar.noderiv.CMAESOptimizer(maxIterations, Double.POSITIVE_INFINITY, true, 0, 0, new MersenneTwister(3141), false, new SimplePointChecker<org.apache.commons.math3.optim.PointValuePair>(0, 0)) { @Override public double computeObjectiveValue(double[] params) { return objectiveFunction.value(params); } /* (non-Javadoc) * @see org.apache.commons.math3.optim.nonlinear.scalar.MultivariateOptimizer#getGoalType() */ @Override public org.apache.commons.math3.optim.nonlinear.scalar.GoalType getGoalType() { // TODO Auto-generated method stub return org.apache.commons.math3.optim.nonlinear.scalar.GoalType.MAXIMIZE; } /* (non-Javadoc) * @see org.apache.commons.math3.optim.BaseMultivariateOptimizer#getStartPoint() */ @Override public double[] getStartPoint() { return guessParameters; } /* (non-Javadoc) * @see org.apache.commons.math3.optim.BaseMultivariateOptimizer#getLowerBound() */ @Override public double[] getLowerBound() { return lowerBound; } /* (non-Javadoc) * @see org.apache.commons.math3.optim.BaseMultivariateOptimizer#getUpperBound() */ @Override public double[] getUpperBound() { return upperBound; } }; try { org.apache.commons.math3.optim.PointValuePair result = optimizer2.optimize( new org.apache.commons.math3.optim.nonlinear.scalar.noderiv.CMAESOptimizer.PopulationSize((int) (4 + 3 * Math.log(guessParameters.length))), new org.apache.commons.math3.optim.nonlinear.scalar.noderiv.CMAESOptimizer.Sigma(parameterStep) ); bestParameters = result.getPoint(); } catch(org.apache.commons.math3.exception.MathIllegalStateException e) { System.out.println("Solver failed"); bestParameters = guessParameters; } } // Transform parameters to GARCH parameters double omega = bestParameters[0]; double alpha = bestParameters[1]; double beta = bestParameters[2]; double theta = bestParameters[3]; double mu = bestParameters[4]; double phi = bestParameters[5]; double[] quantiles = {0.005, 0.01, 0.02, 0.05, 0.5}; double[] quantileValues = getQuantilPredictionsForParameters(bestParameters, quantiles); Map<String, Object> results = new HashMap<>(); results.put("parameters", bestParameters); results.put("Omega", omega); results.put("Alpha", alpha); results.put("Beta", beta); results.put("Theta", theta); results.put("Mu", mu); results.put("Phi", phi); results.put("Szenarios", this.getSzenarios(bestParameters)); results.put("Likelihood", this.getLogLikelihoodForParameters(bestParameters)); results.put("Vol", Math.sqrt(this.getLastResidualForParameters(bestParameters))); results.put("Quantile=05%", quantileValues[0]); results.put("Quantile=1%", quantileValues[1]); results.put("Quantile=2%", quantileValues[2]); results.put("Quantile=5%", quantileValues[3]); results.put("Quantile=50%", quantileValues[4]); return results; } }
public class class_name { @Override public Map<String, Object> getBestParameters(Map<String, Object> guess) { // Create the objective function for the solver class GARCHMaxLikelihoodFunction implements MultivariateFunction, Serializable { private static final long serialVersionUID = 7072187082052755854L; @Override public double value(double[] variables) { double omega = variables[0]; double alpha = variables[1]; double beta = variables[2]; double theta = variables[3]; double mu = variables[4]; double phi = variables[5]; double logLikelihood = getLogLikelihoodForParameters(variables); // Penalty to prevent solver from hitting the bounds logLikelihood -= Math.max(1E-30-omega,0)/1E-30; logLikelihood -= Math.max(1E-30-alpha,0)/1E-30; logLikelihood -= Math.max((alpha-1)+1E-30,0)/1E-30; logLikelihood -= Math.max(1E-30-beta,0)/1E-30; logLikelihood -= Math.max((beta-1)+1E-30,0)/1E-30; return logLikelihood; } } final GARCHMaxLikelihoodFunction objectiveFunction = new GARCHMaxLikelihoodFunction(); // Create a guess for the solver final double[] guessParameters = new double[parameterGuess.length]; System.arraycopy(parameterGuess, 0, guessParameters, 0, parameterGuess.length); if(guess != null) { // A guess was provided, use that one guessParameters[0] = (Double)guess.get("Omega"); // depends on control dependency: [if], data = [none] guessParameters[1] = (Double)guess.get("Alpha"); // depends on control dependency: [if], data = [none] guessParameters[2] = (Double)guess.get("Beta"); // depends on control dependency: [if], data = [none] guessParameters[3] = (Double)guess.get("Theta"); // depends on control dependency: [if], data = [none] guessParameters[4] = (Double)guess.get("Mu"); // depends on control dependency: [if], data = [none] guessParameters[5] = (Double)guess.get("Phi"); // depends on control dependency: [if], data = [none] } // Seek optimal parameter configuration LevenbergMarquardt lm = new LevenbergMarquardt(guessParameters, new double[] { 1000.0 }, 100*maxIterations, 2) { private static final long serialVersionUID = -8844232820888815090L; @Override public void setValues(double[] parameters, double[] values) { values[0] = objectiveFunction.value(parameters); } }; double[] bestParameters = null; boolean isUseLM = false; if(isUseLM) { try { lm.run(); // depends on control dependency: [try], data = [none] } catch (SolverException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } // depends on control dependency: [catch], data = [none] bestParameters = lm.getBestFitParameters(); // depends on control dependency: [if], data = [none] } else { org.apache.commons.math3.optim.nonlinear.scalar.noderiv.CMAESOptimizer optimizer2 = new org.apache.commons.math3.optim.nonlinear.scalar.noderiv.CMAESOptimizer(maxIterations, Double.POSITIVE_INFINITY, true, 0, 0, new MersenneTwister(3141), false, new SimplePointChecker<org.apache.commons.math3.optim.PointValuePair>(0, 0)) { @Override public double computeObjectiveValue(double[] params) { return objectiveFunction.value(params); } /* (non-Javadoc) * @see org.apache.commons.math3.optim.nonlinear.scalar.MultivariateOptimizer#getGoalType() */ @Override public org.apache.commons.math3.optim.nonlinear.scalar.GoalType getGoalType() { // TODO Auto-generated method stub return org.apache.commons.math3.optim.nonlinear.scalar.GoalType.MAXIMIZE; } /* (non-Javadoc) * @see org.apache.commons.math3.optim.BaseMultivariateOptimizer#getStartPoint() */ @Override public double[] getStartPoint() { return guessParameters; } /* (non-Javadoc) * @see org.apache.commons.math3.optim.BaseMultivariateOptimizer#getLowerBound() */ @Override public double[] getLowerBound() { return lowerBound; } /* (non-Javadoc) * @see org.apache.commons.math3.optim.BaseMultivariateOptimizer#getUpperBound() */ @Override public double[] getUpperBound() { return upperBound; } }; try { org.apache.commons.math3.optim.PointValuePair result = optimizer2.optimize( new org.apache.commons.math3.optim.nonlinear.scalar.noderiv.CMAESOptimizer.PopulationSize((int) (4 + 3 * Math.log(guessParameters.length))), new org.apache.commons.math3.optim.nonlinear.scalar.noderiv.CMAESOptimizer.Sigma(parameterStep) ); bestParameters = result.getPoint(); // depends on control dependency: [try], data = [none] } catch(org.apache.commons.math3.exception.MathIllegalStateException e) { System.out.println("Solver failed"); bestParameters = guessParameters; } // depends on control dependency: [catch], data = [none] } // Transform parameters to GARCH parameters double omega = bestParameters[0]; double alpha = bestParameters[1]; double beta = bestParameters[2]; double theta = bestParameters[3]; double mu = bestParameters[4]; double phi = bestParameters[5]; double[] quantiles = {0.005, 0.01, 0.02, 0.05, 0.5}; double[] quantileValues = getQuantilPredictionsForParameters(bestParameters, quantiles); Map<String, Object> results = new HashMap<>(); results.put("parameters", bestParameters); results.put("Omega", omega); results.put("Alpha", alpha); results.put("Beta", beta); results.put("Theta", theta); results.put("Mu", mu); results.put("Phi", phi); results.put("Szenarios", this.getSzenarios(bestParameters)); results.put("Likelihood", this.getLogLikelihoodForParameters(bestParameters)); results.put("Vol", Math.sqrt(this.getLastResidualForParameters(bestParameters))); results.put("Quantile=05%", quantileValues[0]); results.put("Quantile=1%", quantileValues[1]); results.put("Quantile=2%", quantileValues[2]); results.put("Quantile=5%", quantileValues[3]); results.put("Quantile=50%", quantileValues[4]); return results; } }
public class class_name { public static void validate(Object parameter) { // Validation of top level payload is done outside if (parameter == null) { return; } Class parameterType = parameter.getClass(); TypeToken<?> parameterToken = TypeToken.of(parameterType); if (Primitives.isWrapperType(parameterType)) { parameterToken = parameterToken.unwrap(); } if (parameterToken.isPrimitive() || parameterType.isEnum() || parameterType == Class.class || parameterToken.isSupertypeOf(LocalDate.class) || parameterToken.isSupertypeOf(DateTime.class) || parameterToken.isSupertypeOf(String.class) || parameterToken.isSupertypeOf(DateTimeRfc1123.class) || parameterToken.isSupertypeOf(Period.class)) { return; } Annotation skipParentAnnotation = parameterType.getAnnotation(SkipParentValidation.class); if (skipParentAnnotation == null) { for (Class<?> c : parameterToken.getTypes().classes().rawTypes()) { validateClass(c, parameter); } } else { validateClass(parameterType, parameter); } } }
public class class_name { public static void validate(Object parameter) { // Validation of top level payload is done outside if (parameter == null) { return; // depends on control dependency: [if], data = [none] } Class parameterType = parameter.getClass(); TypeToken<?> parameterToken = TypeToken.of(parameterType); if (Primitives.isWrapperType(parameterType)) { parameterToken = parameterToken.unwrap(); // depends on control dependency: [if], data = [none] } if (parameterToken.isPrimitive() || parameterType.isEnum() || parameterType == Class.class || parameterToken.isSupertypeOf(LocalDate.class) || parameterToken.isSupertypeOf(DateTime.class) || parameterToken.isSupertypeOf(String.class) || parameterToken.isSupertypeOf(DateTimeRfc1123.class) || parameterToken.isSupertypeOf(Period.class)) { return; // depends on control dependency: [if], data = [none] } Annotation skipParentAnnotation = parameterType.getAnnotation(SkipParentValidation.class); if (skipParentAnnotation == null) { for (Class<?> c : parameterToken.getTypes().classes().rawTypes()) { validateClass(c, parameter); // depends on control dependency: [for], data = [c] } } else { validateClass(parameterType, parameter); // depends on control dependency: [if], data = [none] } } }
public class class_name { public static String add( String... strings ) { int length = 0; for ( String str : strings ) { if ( str == null ) { continue; } length += str.length(); } CharBuf builder = CharBuf.createExact( length ); for ( String str : strings ) { if ( str == null ) { continue; } builder.add( str ); } return builder.toString(); } }
public class class_name { public static String add( String... strings ) { int length = 0; for ( String str : strings ) { if ( str == null ) { continue; } length += str.length(); // depends on control dependency: [for], data = [str] } CharBuf builder = CharBuf.createExact( length ); for ( String str : strings ) { if ( str == null ) { continue; } builder.add( str ); // depends on control dependency: [for], data = [str] } return builder.toString(); } }
public class class_name { public SIMPRequestedValueMessageInfo getRequestedValueMessageInfo() throws SIMPRuntimeOperationFailedException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "getRequestedValueMessageInfo"); SIMPRequestedValueMessageInfo requestedValueMessageInfo = null; try { TickRange tickRange = getTickRange(); synchronized(tickRange) { if (State.VALUE.toString().equals(getState(tickRange))) { // This RemoteMessageRequest is in state request so lets get the info requestedValueMessageInfo = new RequestedValueMessageInfo((AIValueTick)tickRange.value); } } } catch(SIMPException e) { FFDCFilter.processException( e, "com.ibm.ws.sib.processor.runtime.RemoteMessageRequest.getRequestedValueMessageInfo", "1:456:1.34", this); SIMPRuntimeOperationFailedException e1 = new SIMPRuntimeOperationFailedException( nls.getFormattedMessage( "INTERNAL_MESSAGING_ERROR_CWSIP0003", new Object[] {"RemoteMessageRequest.getRequestedValueMessageInfo", "1:464:1.34", e, _aiStream.getStreamId()}, null), e); SibTr.exception(tc, e1); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "getRequestedValueMessageInfo", e1); throw e1; } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "getRequestedValueMessageInfo", requestedValueMessageInfo); return requestedValueMessageInfo; } }
public class class_name { public SIMPRequestedValueMessageInfo getRequestedValueMessageInfo() throws SIMPRuntimeOperationFailedException { if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(tc, "getRequestedValueMessageInfo"); SIMPRequestedValueMessageInfo requestedValueMessageInfo = null; try { TickRange tickRange = getTickRange(); synchronized(tickRange) { if (State.VALUE.toString().equals(getState(tickRange))) { // This RemoteMessageRequest is in state request so lets get the info requestedValueMessageInfo = new RequestedValueMessageInfo((AIValueTick)tickRange.value); // depends on control dependency: [if], data = [none] } } } catch(SIMPException e) { FFDCFilter.processException( e, "com.ibm.ws.sib.processor.runtime.RemoteMessageRequest.getRequestedValueMessageInfo", "1:456:1.34", this); SIMPRuntimeOperationFailedException e1 = new SIMPRuntimeOperationFailedException( nls.getFormattedMessage( "INTERNAL_MESSAGING_ERROR_CWSIP0003", new Object[] {"RemoteMessageRequest.getRequestedValueMessageInfo", "1:464:1.34", e, _aiStream.getStreamId()}, null), e); SibTr.exception(tc, e1); if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "getRequestedValueMessageInfo", e1); throw e1; } if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(tc, "getRequestedValueMessageInfo", requestedValueMessageInfo); return requestedValueMessageInfo; } }
public class class_name { protected void appendArgOrValue(DatabaseType databaseType, FieldType fieldType, StringBuilder sb, List<ArgumentHolder> argList, Object argOrValue) throws SQLException { boolean appendSpace = true; if (argOrValue == null) { throw new SQLException("argument for '" + fieldType.getFieldName() + "' is null"); } else if (argOrValue instanceof ArgumentHolder) { sb.append('?'); ArgumentHolder argHolder = (ArgumentHolder) argOrValue; argHolder.setMetaInfo(columnName, fieldType); argList.add(argHolder); } else if (argOrValue instanceof ColumnArg) { ColumnArg columnArg = (ColumnArg) argOrValue; String tableName = columnArg.getTableName(); if (tableName != null) { databaseType.appendEscapedEntityName(sb, tableName); sb.append('.'); } databaseType.appendEscapedEntityName(sb, columnArg.getColumnName()); } else if (fieldType.isArgumentHolderRequired()) { sb.append('?'); ArgumentHolder argHolder = new SelectArg(); argHolder.setMetaInfo(columnName, fieldType); // conversion is done when the getValue() is called argHolder.setValue(argOrValue); argList.add(argHolder); } else if (fieldType.isForeign() && fieldType.getType().isAssignableFrom(argOrValue.getClass())) { /* * If we have a foreign field and our argument is an instance of the foreign object (i.e. not its id), then * we need to extract the id. We allow super-classes of the field but not sub-classes. */ FieldType idFieldType = fieldType.getForeignIdField(); appendArgOrValue(databaseType, idFieldType, sb, argList, idFieldType.extractJavaFieldValue(argOrValue)); // no need for the space since it was done in the recursion appendSpace = false; } else if (fieldType.isEscapedValue()) { databaseType.appendEscapedWord(sb, fieldType.convertJavaFieldToSqlArgValue(argOrValue).toString()); } else if (fieldType.isForeign()) { /* * I'm not entirely sure this is correct. This is trying to protect against someone trying to pass an object * into a comparison with a foreign field. Typically if they pass the same field type, then ORMLite will * extract the ID of the foreign. */ String value = fieldType.convertJavaFieldToSqlArgValue(argOrValue).toString(); if (value.length() > 0) { if (NUMBER_CHARACTERS.indexOf(value.charAt(0)) < 0) { throw new SQLException("Foreign field " + fieldType + " does not seem to be producing a numerical value '" + value + "'. Maybe you are passing the wrong object to comparison: " + this); } } sb.append(value); } else { // numbers can't have quotes around them in derby sb.append(fieldType.convertJavaFieldToSqlArgValue(argOrValue)); } if (appendSpace) { sb.append(' '); } } }
public class class_name { protected void appendArgOrValue(DatabaseType databaseType, FieldType fieldType, StringBuilder sb, List<ArgumentHolder> argList, Object argOrValue) throws SQLException { boolean appendSpace = true; if (argOrValue == null) { throw new SQLException("argument for '" + fieldType.getFieldName() + "' is null"); } else if (argOrValue instanceof ArgumentHolder) { sb.append('?'); ArgumentHolder argHolder = (ArgumentHolder) argOrValue; argHolder.setMetaInfo(columnName, fieldType); argList.add(argHolder); } else if (argOrValue instanceof ColumnArg) { ColumnArg columnArg = (ColumnArg) argOrValue; String tableName = columnArg.getTableName(); if (tableName != null) { databaseType.appendEscapedEntityName(sb, tableName); // depends on control dependency: [if], data = [none] sb.append('.'); // depends on control dependency: [if], data = [none] } databaseType.appendEscapedEntityName(sb, columnArg.getColumnName()); } else if (fieldType.isArgumentHolderRequired()) { sb.append('?'); ArgumentHolder argHolder = new SelectArg(); argHolder.setMetaInfo(columnName, fieldType); // conversion is done when the getValue() is called argHolder.setValue(argOrValue); argList.add(argHolder); } else if (fieldType.isForeign() && fieldType.getType().isAssignableFrom(argOrValue.getClass())) { /* * If we have a foreign field and our argument is an instance of the foreign object (i.e. not its id), then * we need to extract the id. We allow super-classes of the field but not sub-classes. */ FieldType idFieldType = fieldType.getForeignIdField(); appendArgOrValue(databaseType, idFieldType, sb, argList, idFieldType.extractJavaFieldValue(argOrValue)); // no need for the space since it was done in the recursion appendSpace = false; } else if (fieldType.isEscapedValue()) { databaseType.appendEscapedWord(sb, fieldType.convertJavaFieldToSqlArgValue(argOrValue).toString()); } else if (fieldType.isForeign()) { /* * I'm not entirely sure this is correct. This is trying to protect against someone trying to pass an object * into a comparison with a foreign field. Typically if they pass the same field type, then ORMLite will * extract the ID of the foreign. */ String value = fieldType.convertJavaFieldToSqlArgValue(argOrValue).toString(); if (value.length() > 0) { if (NUMBER_CHARACTERS.indexOf(value.charAt(0)) < 0) { throw new SQLException("Foreign field " + fieldType + " does not seem to be producing a numerical value '" + value + "'. Maybe you are passing the wrong object to comparison: " + this); } } sb.append(value); } else { // numbers can't have quotes around them in derby sb.append(fieldType.convertJavaFieldToSqlArgValue(argOrValue)); } if (appendSpace) { sb.append(' '); } } }
public class class_name { boolean isIdenticalTree(MathNode aTree, MathNode bTree) { // first check if they have the same number of children if (aTree.equals(bTree) && aTree.getChildren().size() == bTree.getChildren().size()) { if (aTree.isOrderSensitive()) { // all children order sensitive for (int i = 0; i < aTree.getChildren().size(); i++) { if (!isIdenticalTree(aTree.getChildren().get(i), bTree.getChildren().get(i))) { return false; } } } else { // order insensitive List<MathNode> bChildren = new ArrayList<>(bTree.getChildren()); OUTER: for (MathNode aChild : aTree.getChildren()) { for (MathNode bChild : filterSameChildren(aChild, bChildren)) { if (isIdenticalTree(aChild, bChild)) { // found an identical child bChildren.remove(bChild); continue OUTER; } } // aChild is missing in bChildren return false; } } return true; } return false; } }
public class class_name { boolean isIdenticalTree(MathNode aTree, MathNode bTree) { // first check if they have the same number of children if (aTree.equals(bTree) && aTree.getChildren().size() == bTree.getChildren().size()) { if (aTree.isOrderSensitive()) { // all children order sensitive for (int i = 0; i < aTree.getChildren().size(); i++) { if (!isIdenticalTree(aTree.getChildren().get(i), bTree.getChildren().get(i))) { return false; // depends on control dependency: [if], data = [none] } } } else { // order insensitive List<MathNode> bChildren = new ArrayList<>(bTree.getChildren()); OUTER: for (MathNode aChild : aTree.getChildren()) { for (MathNode bChild : filterSameChildren(aChild, bChildren)) { if (isIdenticalTree(aChild, bChild)) { // found an identical child bChildren.remove(bChild); // depends on control dependency: [if], data = [none] continue OUTER; } } // aChild is missing in bChildren return false; // depends on control dependency: [for], data = [none] } } return true; // depends on control dependency: [if], data = [none] } return false; } }
public class class_name { private Event createEvent(Endpoint endpoint, EventTypeEnum type) { Event event = new Event(); MessageInfo messageInfo = new MessageInfo(); Originator originator = new Originator(); event.setMessageInfo(messageInfo); event.setOriginator(originator); Date date = new Date(); event.setTimestamp(date); event.setEventType(type); messageInfo.setPortType( endpoint.getBinding().getBindingInfo().getService().getInterface().getName().toString()); String transportType = null; if (endpoint.getBinding() instanceof SoapBinding) { SoapBinding soapBinding = (SoapBinding)endpoint.getBinding(); if (soapBinding.getBindingInfo() instanceof SoapBindingInfo) { SoapBindingInfo soapBindingInfo = (SoapBindingInfo)soapBinding.getBindingInfo(); transportType = soapBindingInfo.getTransportURI(); } } messageInfo.setTransportType((transportType != null) ? transportType : "Unknown transport type"); originator.setProcessId(Converter.getPID()); try { InetAddress inetAddress = InetAddress.getLocalHost(); originator.setIp(inetAddress.getHostAddress()); originator.setHostname(inetAddress.getHostName()); } catch (UnknownHostException e) { originator.setHostname("Unknown hostname"); originator.setIp("Unknown ip address"); } String address = endpoint.getEndpointInfo().getAddress(); event.getCustomInfo().put("address", address); return event; } }
public class class_name { private Event createEvent(Endpoint endpoint, EventTypeEnum type) { Event event = new Event(); MessageInfo messageInfo = new MessageInfo(); Originator originator = new Originator(); event.setMessageInfo(messageInfo); event.setOriginator(originator); Date date = new Date(); event.setTimestamp(date); event.setEventType(type); messageInfo.setPortType( endpoint.getBinding().getBindingInfo().getService().getInterface().getName().toString()); String transportType = null; if (endpoint.getBinding() instanceof SoapBinding) { SoapBinding soapBinding = (SoapBinding)endpoint.getBinding(); if (soapBinding.getBindingInfo() instanceof SoapBindingInfo) { SoapBindingInfo soapBindingInfo = (SoapBindingInfo)soapBinding.getBindingInfo(); transportType = soapBindingInfo.getTransportURI(); // depends on control dependency: [if], data = [none] } } messageInfo.setTransportType((transportType != null) ? transportType : "Unknown transport type"); originator.setProcessId(Converter.getPID()); try { InetAddress inetAddress = InetAddress.getLocalHost(); originator.setIp(inetAddress.getHostAddress()); // depends on control dependency: [try], data = [none] originator.setHostname(inetAddress.getHostName()); // depends on control dependency: [try], data = [none] } catch (UnknownHostException e) { originator.setHostname("Unknown hostname"); originator.setIp("Unknown ip address"); } // depends on control dependency: [catch], data = [none] String address = endpoint.getEndpointInfo().getAddress(); event.getCustomInfo().put("address", address); return event; } }
public class class_name { public void updateContractProject(String projectName, Path rootStubsFolder) { File clonedRepo = this.gitContractsRepo .clonedRepo(this.stubRunnerOptions.stubRepositoryRoot); GitStubDownloaderProperties properties = new GitStubDownloaderProperties( this.stubRunnerOptions.stubRepositoryRoot, this.stubRunnerOptions); copyStubs(projectName, rootStubsFolder, clonedRepo); GitRepo gitRepo = new GitRepo(clonedRepo, properties); String msg = StubRunnerPropertyUtils .getProperty(this.stubRunnerOptions.getProperties(), GIT_COMMIT_MESSAGE); GitRepo.CommitResult commit = gitRepo.commit(clonedRepo, commitMessage(projectName, msg)); if (commit == GitRepo.CommitResult.EMPTY) { log.info("There were no changes to commit. Won't push the changes"); return; } String attempts = StubRunnerPropertyUtils.getProperty( this.stubRunnerOptions.getProperties(), GIT_ATTEMPTS_NO_PROP); int intAttempts = StringUtils.hasText(attempts) ? Integer.parseInt(attempts) : DEFAULT_ATTEMPTS_NO; String wait = StubRunnerPropertyUtils.getProperty( this.stubRunnerOptions.getProperties(), GIT_WAIT_BETWEEN_ATTEMPTS); long longWait = StringUtils.hasText(wait) ? Long.parseLong(wait) : DEFAULT_WAIT_BETWEEN_ATTEMPTS; tryToPushCurrentBranch(clonedRepo, gitRepo, intAttempts, longWait); } }
public class class_name { public void updateContractProject(String projectName, Path rootStubsFolder) { File clonedRepo = this.gitContractsRepo .clonedRepo(this.stubRunnerOptions.stubRepositoryRoot); GitStubDownloaderProperties properties = new GitStubDownloaderProperties( this.stubRunnerOptions.stubRepositoryRoot, this.stubRunnerOptions); copyStubs(projectName, rootStubsFolder, clonedRepo); GitRepo gitRepo = new GitRepo(clonedRepo, properties); String msg = StubRunnerPropertyUtils .getProperty(this.stubRunnerOptions.getProperties(), GIT_COMMIT_MESSAGE); GitRepo.CommitResult commit = gitRepo.commit(clonedRepo, commitMessage(projectName, msg)); if (commit == GitRepo.CommitResult.EMPTY) { log.info("There were no changes to commit. Won't push the changes"); // depends on control dependency: [if], data = [none] return; // depends on control dependency: [if], data = [none] } String attempts = StubRunnerPropertyUtils.getProperty( this.stubRunnerOptions.getProperties(), GIT_ATTEMPTS_NO_PROP); int intAttempts = StringUtils.hasText(attempts) ? Integer.parseInt(attempts) : DEFAULT_ATTEMPTS_NO; String wait = StubRunnerPropertyUtils.getProperty( this.stubRunnerOptions.getProperties(), GIT_WAIT_BETWEEN_ATTEMPTS); long longWait = StringUtils.hasText(wait) ? Long.parseLong(wait) : DEFAULT_WAIT_BETWEEN_ATTEMPTS; tryToPushCurrentBranch(clonedRepo, gitRepo, intAttempts, longWait); } }
public class class_name { public final Reliability getReliability() { // If the transient is not set, get the int value from the message then // obtain the corresponding Reliability instance and cache it. if (cachedReliability == null) { Byte rType = (Byte) getHdr2().getField(JsHdr2Access.RELIABILITY); cachedReliability = Reliability.getReliability(rType); } // Return the (possibly newly) cached value return cachedReliability; } }
public class class_name { public final Reliability getReliability() { // If the transient is not set, get the int value from the message then // obtain the corresponding Reliability instance and cache it. if (cachedReliability == null) { Byte rType = (Byte) getHdr2().getField(JsHdr2Access.RELIABILITY); cachedReliability = Reliability.getReliability(rType); // depends on control dependency: [if], data = [none] } // Return the (possibly newly) cached value return cachedReliability; } }