code
stringlengths 130
281k
| code_dependency
stringlengths 182
306k
|
|---|---|
public class class_name {
private JsonParserException createParseException(Exception e, String message, boolean tokenPos) {
if (tokenPos)
return new JsonParserException(e, message + " on line " + tokenLinePos + ", char " + tokenCharPos,
tokenLinePos, tokenCharPos, tokenCharOffset);
else {
int charPos = Math.max(1, index - rowPos - utf8adjust);
return new JsonParserException(e, message + " on line " + linePos + ", char " + charPos, linePos, charPos,
index + charOffset);
}
} }
|
public class class_name {
private JsonParserException createParseException(Exception e, String message, boolean tokenPos) {
if (tokenPos)
return new JsonParserException(e, message + " on line " + tokenLinePos + ", char " + tokenCharPos,
tokenLinePos, tokenCharPos, tokenCharOffset);
else {
int charPos = Math.max(1, index - rowPos - utf8adjust);
return new JsonParserException(e, message + " on line " + linePos + ", char " + charPos, linePos, charPos,
index + charOffset); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public void setApiStages(java.util.Collection<ApiStage> apiStages) {
if (apiStages == null) {
this.apiStages = null;
return;
}
this.apiStages = new java.util.ArrayList<ApiStage>(apiStages);
} }
|
public class class_name {
public void setApiStages(java.util.Collection<ApiStage> apiStages) {
if (apiStages == null) {
this.apiStages = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.apiStages = new java.util.ArrayList<ApiStage>(apiStages);
} }
|
public class class_name {
public void removeNamingListener(final NamingListener listener) {
final NamingEventCoordinator coordinator = eventCoordinator;
if (coordinator != null) {
coordinator.removeListener(listener);
}
} }
|
public class class_name {
public void removeNamingListener(final NamingListener listener) {
final NamingEventCoordinator coordinator = eventCoordinator;
if (coordinator != null) {
coordinator.removeListener(listener); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public String execute(List<String> parameterList, TestContext context) {
if (!parameterList.isEmpty()) {
throw new InvalidFunctionUsageException("Unexpected parameter for function.");
}
try {
return InetAddress.getLocalHost().getHostName();
} catch (UnknownHostException e) {
throw new CitrusRuntimeException("Unable to locate local host address", e);
}
} }
|
public class class_name {
public String execute(List<String> parameterList, TestContext context) {
if (!parameterList.isEmpty()) {
throw new InvalidFunctionUsageException("Unexpected parameter for function.");
}
try {
return InetAddress.getLocalHost().getHostName(); // depends on control dependency: [try], data = [none]
} catch (UnknownHostException e) {
throw new CitrusRuntimeException("Unable to locate local host address", e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public void messageReceived (MessageEvent event)
{
if (_msghandlers != null) {
MessageHandler handler = _msghandlers.get(event.getName());
if (handler != null) {
handler.handleEvent(event, this);
}
}
// If the message is directed at us, see if it's a request for a method invocation
if (event.isPrivate()) { // aka if (event instanceof ServerMessageEvent)
// the first argument should be the client object of the caller or null if it is
// a server-originated event
int srcoid = event.getSourceOid();
DObject source = (srcoid <= 0) ? null : _omgr.getObject(srcoid);
String method = event.getName();
Object[] args = event.getArgs(), nargs;
// validate that this call is allowed
if (!allowManagerCall(method)) {
log.warning("Client tried to invoke forbidden manager call!",
"source", source, "method", method, "args", args);
return;
}
if (args == null) {
nargs = new Object[] { source };
} else {
nargs = new Object[args.length+1];
nargs[0] = source;
System.arraycopy(args, 0, nargs, 1, args.length);
}
// Lazily create our dispatcher now that it's actually getting a message
if (_dispatcher == null) {
Class<?> clazz = getClass();
MethodFinder finder = _dispatcherFinders.get(clazz);
if (finder == null) {
finder = new MethodFinder(clazz);
_dispatcherFinders.put(clazz, finder);
}
_dispatcher = new DynamicListener<DSet.Entry>(this, finder);
}
_dispatcher.dispatchMethod(method, nargs);
}
} }
|
public class class_name {
public void messageReceived (MessageEvent event)
{
if (_msghandlers != null) {
MessageHandler handler = _msghandlers.get(event.getName());
if (handler != null) {
handler.handleEvent(event, this); // depends on control dependency: [if], data = [none]
}
}
// If the message is directed at us, see if it's a request for a method invocation
if (event.isPrivate()) { // aka if (event instanceof ServerMessageEvent)
// the first argument should be the client object of the caller or null if it is
// a server-originated event
int srcoid = event.getSourceOid();
DObject source = (srcoid <= 0) ? null : _omgr.getObject(srcoid);
String method = event.getName();
Object[] args = event.getArgs(), nargs;
// validate that this call is allowed
if (!allowManagerCall(method)) {
log.warning("Client tried to invoke forbidden manager call!",
"source", source, "method", method, "args", args); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
if (args == null) {
nargs = new Object[] { source }; // depends on control dependency: [if], data = [none]
} else {
nargs = new Object[args.length+1]; // depends on control dependency: [if], data = [none]
nargs[0] = source; // depends on control dependency: [if], data = [none]
System.arraycopy(args, 0, nargs, 1, args.length); // depends on control dependency: [if], data = [(args]
}
// Lazily create our dispatcher now that it's actually getting a message
if (_dispatcher == null) {
Class<?> clazz = getClass();
MethodFinder finder = _dispatcherFinders.get(clazz);
if (finder == null) {
finder = new MethodFinder(clazz); // depends on control dependency: [if], data = [none]
_dispatcherFinders.put(clazz, finder); // depends on control dependency: [if], data = [none]
}
_dispatcher = new DynamicListener<DSet.Entry>(this, finder); // depends on control dependency: [if], data = [none]
}
_dispatcher.dispatchMethod(method, nargs); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
@Override
public EClass getIfcStructuralCurveReaction() {
if (ifcStructuralCurveReactionEClass == null) {
ifcStructuralCurveReactionEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI)
.getEClassifiers().get(637);
}
return ifcStructuralCurveReactionEClass;
} }
|
public class class_name {
@Override
public EClass getIfcStructuralCurveReaction() {
if (ifcStructuralCurveReactionEClass == null) {
ifcStructuralCurveReactionEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc4Package.eNS_URI)
.getEClassifiers().get(637);
// depends on control dependency: [if], data = [none]
}
return ifcStructuralCurveReactionEClass;
} }
|
public class class_name {
private static String showCommandAliases() {
final Command[] commands = Command.values();
StringBuilder sb = new StringBuilder();
for (int i = 0; i < commands.length; ++i) {
if (i != 0) {
sb.append(", ");
if (i == commands.length - 1) {
sb.append("or ");
}
}
sb.append("`--");
sb.append(commands[i].getAlias());
sb.append("`");
}
return sb.toString();
} }
|
public class class_name {
private static String showCommandAliases() {
final Command[] commands = Command.values();
StringBuilder sb = new StringBuilder();
for (int i = 0; i < commands.length; ++i) {
if (i != 0) {
sb.append(", "); // depends on control dependency: [if], data = [none]
if (i == commands.length - 1) {
sb.append("or "); // depends on control dependency: [if], data = [none]
}
}
sb.append("`--"); // depends on control dependency: [for], data = [none]
sb.append(commands[i].getAlias()); // depends on control dependency: [for], data = [i]
sb.append("`"); // depends on control dependency: [for], data = [none]
}
return sb.toString();
} }
|
public class class_name {
@Route(method = HttpMethod.POST, uri = "/monitor/login")
public Result authenticate(@FormParameter("username") String username, @FormParameter("password") String password) {
if (!configuration.getBooleanWithDefault("monitor.auth.enabled", true)) {
// If the authentication is disabled, just jump to the dashboard page.
return dashboard();
}
final String name = configuration.getOrDie("monitor.auth.username");
final String pwd = configuration.getOrDie("monitor.auth.password");
if (name.equals(username) && pwd.equals(password)) {
session().put("wisdom.monitor.username", username);
logger().info("Authentication successful - {}", username);
return dashboard();
} else {
logger().info("Authentication failed - {}", username);
context().flash().error("Authentication failed - check your credentials");
return login();
}
} }
|
public class class_name {
@Route(method = HttpMethod.POST, uri = "/monitor/login")
public Result authenticate(@FormParameter("username") String username, @FormParameter("password") String password) {
if (!configuration.getBooleanWithDefault("monitor.auth.enabled", true)) {
// If the authentication is disabled, just jump to the dashboard page.
return dashboard(); // depends on control dependency: [if], data = [none]
}
final String name = configuration.getOrDie("monitor.auth.username");
final String pwd = configuration.getOrDie("monitor.auth.password");
if (name.equals(username) && pwd.equals(password)) {
session().put("wisdom.monitor.username", username); // depends on control dependency: [if], data = [none]
logger().info("Authentication successful - {}", username); // depends on control dependency: [if], data = [none]
return dashboard(); // depends on control dependency: [if], data = [none]
} else {
logger().info("Authentication failed - {}", username); // depends on control dependency: [if], data = [none]
context().flash().error("Authentication failed - check your credentials"); // depends on control dependency: [if], data = [none]
return login(); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public static ByteBuffer cloneByteBuffer(ByteBuffer buf) {
ByteBuffer ret = ByteBuffer.allocate(buf.limit() - buf.position());
if (buf.hasArray()) {
ret.put(buf.array(), buf.position(), buf.limit() - buf.position());
} else {
// direct buffer
ret.put(buf);
}
ret.flip();
return ret;
} }
|
public class class_name {
public static ByteBuffer cloneByteBuffer(ByteBuffer buf) {
ByteBuffer ret = ByteBuffer.allocate(buf.limit() - buf.position());
if (buf.hasArray()) {
ret.put(buf.array(), buf.position(), buf.limit() - buf.position()); // depends on control dependency: [if], data = [none]
} else {
// direct buffer
ret.put(buf); // depends on control dependency: [if], data = [none]
}
ret.flip();
return ret;
} }
|
public class class_name {
public List<String> getHelp() {
List<String> out = new ArrayList<>();
if (helpAppVersion != null) {
out.add(helpAppVersion);
}
if (helpAppExample != null) {
out.add(helpAppExample);
}
if (helpAppVersion != null || helpAppExample != null) {
out.add(""); // new line
}
// find longest option to format all other options by this one
int max = 0;
for (CommandOption option: options) {
String command = option.toCommandString();
max = Math.max(max, command.length());
}
for (CommandOption option: options) {
String info = option.toCommandString();
int spaces = max - info.length() + 1;
String delimiter = new String(new char[spaces]).replace("\0", " "); // returns 'spaces' long empty string
info = info + delimiter + option.getDescription();
out.add(info);
}
return out;
} }
|
public class class_name {
public List<String> getHelp() {
List<String> out = new ArrayList<>();
if (helpAppVersion != null) {
out.add(helpAppVersion); // depends on control dependency: [if], data = [(helpAppVersion]
}
if (helpAppExample != null) {
out.add(helpAppExample); // depends on control dependency: [if], data = [(helpAppExample]
}
if (helpAppVersion != null || helpAppExample != null) {
out.add(""); // new line // depends on control dependency: [if], data = [none]
}
// find longest option to format all other options by this one
int max = 0;
for (CommandOption option: options) {
String command = option.toCommandString();
max = Math.max(max, command.length()); // depends on control dependency: [for], data = [none]
}
for (CommandOption option: options) {
String info = option.toCommandString();
int spaces = max - info.length() + 1;
String delimiter = new String(new char[spaces]).replace("\0", " "); // returns 'spaces' long empty string
info = info + delimiter + option.getDescription(); // depends on control dependency: [for], data = [option]
out.add(info); // depends on control dependency: [for], data = [none]
}
return out;
} }
|
public class class_name {
@Override
public byte[] buildBytes(final boolean outer) {
final Set<Entry<String, ValueValueType>> superEntrySet = super.entrySet();
final int capacity = outer ? superEntrySet.size() + 1
: superEntrySet.size();
final Deque<NameValue> nameValues = new ArrayDeque<>(capacity);
if (outer) {
final NameValue typeNameValue = new NameValue();
typeNameValue.setName(BMType.OBJECT.getType());
nameValues.add(typeNameValue);
}
for (final Entry<String, ValueValueType> entry : superEntrySet) {
final String key = entry.getKey();
final ValueValueType valueValueType = entry.getValue();
final byte valueType = valueValueType.getValueTypeByte();
final NameValue nameValue = new NameValue();
nameValue.setName(key.getBytes(StandardCharsets.UTF_8));
nameValues.add(nameValue);
if (valueType == BMValueType.STRING.getType()) {
final String value = (String) valueValueType.getValue();
nameValue.setValues(new byte[] { valueType },
value.getBytes(StandardCharsets.UTF_8));
} else if (valueType == BMValueType.NUMBER.getType()) {
final Number value = (Number) valueValueType.getValue();
final byte[] valueBytes = WffBinaryMessageUtil
.getOptimizedBytesFromDouble(value.doubleValue());
nameValue.setValues(new byte[] { valueType }, valueBytes);
} else if (valueType == BMValueType.UNDEFINED.getType()) {
final byte[] valueBytes = {};
nameValue.setValues(new byte[] { valueType }, valueBytes);
} else if (valueType == BMValueType.NULL.getType()) {
final byte[] valueBytes = {};
nameValue.setValues(new byte[] { valueType }, valueBytes);
} else if (valueType == BMValueType.BOOLEAN.getType()) {
final Boolean value = (Boolean) valueValueType.getValue();
final byte[] valueBytes = {
(byte) (value.booleanValue() ? 1 : 0) };
nameValue.setValues(new byte[] { valueType }, valueBytes);
} else if (valueType == BMValueType.BM_OBJECT.getType()) {
final WffBMObject value = (WffBMObject) valueValueType
.getValue();
final byte[] valueBytes = value.buildBytes(false);
nameValue.setValues(new byte[] { valueType }, valueBytes);
} else if (valueType == BMValueType.BM_ARRAY.getType()) {
final WffBMArray value = (WffBMArray) valueValueType.getValue();
final byte[] valueBytes = value.buildBytes(false);
nameValue.setValues(new byte[] { valueType }, valueBytes);
} else if (valueType == BMValueType.BM_BYTE_ARRAY.getType()) {
final WffBMByteArray value = (WffBMByteArray) valueValueType
.getValue();
final byte[] valueBytes = value.build(false);
nameValue.setValues(new byte[] { valueType }, valueBytes);
} else if (valueType == BMValueType.REG_EXP.getType()) {
final String value = (String) valueValueType.getValue();
nameValue.setValues(new byte[] { valueType },
value.getBytes(StandardCharsets.UTF_8));
} else if (valueType == BMValueType.FUNCTION.getType()) {
final String value = (String) valueValueType.getValue();
nameValue.setValues(new byte[] { valueType },
value.getBytes(StandardCharsets.UTF_8));
} else if (valueType == BMValueType.INTERNAL_BYTE.getType()) {
throw new WffRuntimeException(
"BMValueType.BYTE is only for internal use, use WffBMByteArray for row bytes.");
}
}
return WffBinaryMessageUtil.VERSION_1
.getWffBinaryMessageBytes(nameValues);
} }
|
public class class_name {
@Override
public byte[] buildBytes(final boolean outer) {
final Set<Entry<String, ValueValueType>> superEntrySet = super.entrySet();
final int capacity = outer ? superEntrySet.size() + 1
: superEntrySet.size();
final Deque<NameValue> nameValues = new ArrayDeque<>(capacity);
if (outer) {
final NameValue typeNameValue = new NameValue();
typeNameValue.setName(BMType.OBJECT.getType()); // depends on control dependency: [if], data = [none]
nameValues.add(typeNameValue); // depends on control dependency: [if], data = [none]
}
for (final Entry<String, ValueValueType> entry : superEntrySet) {
final String key = entry.getKey();
final ValueValueType valueValueType = entry.getValue();
final byte valueType = valueValueType.getValueTypeByte();
final NameValue nameValue = new NameValue();
nameValue.setName(key.getBytes(StandardCharsets.UTF_8)); // depends on control dependency: [for], data = [none]
nameValues.add(nameValue); // depends on control dependency: [for], data = [none]
if (valueType == BMValueType.STRING.getType()) {
final String value = (String) valueValueType.getValue();
nameValue.setValues(new byte[] { valueType },
value.getBytes(StandardCharsets.UTF_8)); // depends on control dependency: [if], data = [none]
} else if (valueType == BMValueType.NUMBER.getType()) {
final Number value = (Number) valueValueType.getValue();
final byte[] valueBytes = WffBinaryMessageUtil
.getOptimizedBytesFromDouble(value.doubleValue());
nameValue.setValues(new byte[] { valueType }, valueBytes); // depends on control dependency: [if], data = [none]
} else if (valueType == BMValueType.UNDEFINED.getType()) {
final byte[] valueBytes = {};
nameValue.setValues(new byte[] { valueType }, valueBytes); // depends on control dependency: [if], data = [none]
} else if (valueType == BMValueType.NULL.getType()) {
final byte[] valueBytes = {};
nameValue.setValues(new byte[] { valueType }, valueBytes); // depends on control dependency: [if], data = [none]
} else if (valueType == BMValueType.BOOLEAN.getType()) {
final Boolean value = (Boolean) valueValueType.getValue();
final byte[] valueBytes = {
(byte) (value.booleanValue() ? 1 : 0) };
nameValue.setValues(new byte[] { valueType }, valueBytes); // depends on control dependency: [if], data = [none]
} else if (valueType == BMValueType.BM_OBJECT.getType()) {
final WffBMObject value = (WffBMObject) valueValueType
.getValue();
final byte[] valueBytes = value.buildBytes(false);
nameValue.setValues(new byte[] { valueType }, valueBytes); // depends on control dependency: [if], data = [none]
} else if (valueType == BMValueType.BM_ARRAY.getType()) {
final WffBMArray value = (WffBMArray) valueValueType.getValue();
final byte[] valueBytes = value.buildBytes(false);
nameValue.setValues(new byte[] { valueType }, valueBytes); // depends on control dependency: [if], data = [none]
} else if (valueType == BMValueType.BM_BYTE_ARRAY.getType()) {
final WffBMByteArray value = (WffBMByteArray) valueValueType
.getValue();
final byte[] valueBytes = value.build(false);
nameValue.setValues(new byte[] { valueType }, valueBytes); // depends on control dependency: [if], data = [none]
} else if (valueType == BMValueType.REG_EXP.getType()) {
final String value = (String) valueValueType.getValue();
nameValue.setValues(new byte[] { valueType },
value.getBytes(StandardCharsets.UTF_8)); // depends on control dependency: [if], data = [none]
} else if (valueType == BMValueType.FUNCTION.getType()) {
final String value = (String) valueValueType.getValue();
nameValue.setValues(new byte[] { valueType },
value.getBytes(StandardCharsets.UTF_8)); // depends on control dependency: [if], data = [none]
} else if (valueType == BMValueType.INTERNAL_BYTE.getType()) {
throw new WffRuntimeException(
"BMValueType.BYTE is only for internal use, use WffBMByteArray for row bytes.");
}
}
return WffBinaryMessageUtil.VERSION_1
.getWffBinaryMessageBytes(nameValues);
} }
|
public class class_name {
public java.util.List<String> getSetup() {
if (setup == null) {
setup = new com.amazonaws.internal.SdkInternalList<String>();
}
return setup;
} }
|
public class class_name {
public java.util.List<String> getSetup() {
if (setup == null) {
setup = new com.amazonaws.internal.SdkInternalList<String>(); // depends on control dependency: [if], data = [none]
}
return setup;
} }
|
public class class_name {
public int scanChar() throws IOException {
// load more characters, if needed
if (fCurrentEntity.position == fCurrentEntity.count) {
load(0, true);
}
// scan character
int c = fCurrentEntity.ch[fCurrentEntity.position++];
boolean external = false;
if (c == '\n' ||
(c == '\r' && (external = fCurrentEntity.isExternal()))) {
fCurrentEntity.lineNumber++;
fCurrentEntity.columnNumber = 1;
if (fCurrentEntity.position == fCurrentEntity.count) {
fCurrentEntity.ch[0] = (char)c;
load(1, false);
}
if (c == '\r' && external) {
if (fCurrentEntity.ch[fCurrentEntity.position++] != '\n') {
fCurrentEntity.position--;
}
c = '\n';
}
}
// return character that was scanned
fCurrentEntity.columnNumber++;
return c;
} }
|
public class class_name {
public int scanChar() throws IOException {
// load more characters, if needed
if (fCurrentEntity.position == fCurrentEntity.count) {
load(0, true);
}
// scan character
int c = fCurrentEntity.ch[fCurrentEntity.position++];
boolean external = false;
if (c == '\n' ||
(c == '\r' && (external = fCurrentEntity.isExternal()))) {
fCurrentEntity.lineNumber++;
fCurrentEntity.columnNumber = 1;
if (fCurrentEntity.position == fCurrentEntity.count) {
fCurrentEntity.ch[0] = (char)c;
load(1, false);
}
if (c == '\r' && external) {
if (fCurrentEntity.ch[fCurrentEntity.position++] != '\n') {
fCurrentEntity.position--; // depends on control dependency: [if], data = [none]
}
c = '\n';
}
}
// return character that was scanned
fCurrentEntity.columnNumber++;
return c;
} }
|
public class class_name {
public void marshall(CreateAccountStatus createAccountStatus, ProtocolMarshaller protocolMarshaller) {
if (createAccountStatus == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(createAccountStatus.getId(), ID_BINDING);
protocolMarshaller.marshall(createAccountStatus.getAccountName(), ACCOUNTNAME_BINDING);
protocolMarshaller.marshall(createAccountStatus.getState(), STATE_BINDING);
protocolMarshaller.marshall(createAccountStatus.getRequestedTimestamp(), REQUESTEDTIMESTAMP_BINDING);
protocolMarshaller.marshall(createAccountStatus.getCompletedTimestamp(), COMPLETEDTIMESTAMP_BINDING);
protocolMarshaller.marshall(createAccountStatus.getAccountId(), ACCOUNTID_BINDING);
protocolMarshaller.marshall(createAccountStatus.getGovCloudAccountId(), GOVCLOUDACCOUNTID_BINDING);
protocolMarshaller.marshall(createAccountStatus.getFailureReason(), FAILUREREASON_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} }
|
public class class_name {
public void marshall(CreateAccountStatus createAccountStatus, ProtocolMarshaller protocolMarshaller) {
if (createAccountStatus == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(createAccountStatus.getId(), ID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(createAccountStatus.getAccountName(), ACCOUNTNAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(createAccountStatus.getState(), STATE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(createAccountStatus.getRequestedTimestamp(), REQUESTEDTIMESTAMP_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(createAccountStatus.getCompletedTimestamp(), COMPLETEDTIMESTAMP_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(createAccountStatus.getAccountId(), ACCOUNTID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(createAccountStatus.getGovCloudAccountId(), GOVCLOUDACCOUNTID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(createAccountStatus.getFailureReason(), FAILUREREASON_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 {
protected void wrapBuffer()
throws IOException
{
// Handle chunking
int size=size();
if (_chunking && size()>0)
{
prewrite(__CRLF,0,__CRLF.length);
while (size>0)
{
int d=size%16;
if (d<=9)
prewrite('0'+d);
else
prewrite('a'-10+d);
size=size/16;
}
postwrite(__CRLF,0,__CRLF.length);
}
// Complete it if we must.
if (_complete && !_completed)
{
_completed=true;
if (_chunking)
postwrite(__CHUNK_EOF,0,__CHUNK_EOF.length);
}
} }
|
public class class_name {
protected void wrapBuffer()
throws IOException
{
// Handle chunking
int size=size();
if (_chunking && size()>0)
{
prewrite(__CRLF,0,__CRLF.length);
while (size>0)
{
int d=size%16;
if (d<=9)
prewrite('0'+d);
else
prewrite('a'-10+d);
size=size/16; // depends on control dependency: [while], data = [none]
}
postwrite(__CRLF,0,__CRLF.length);
}
// Complete it if we must.
if (_complete && !_completed)
{
_completed=true;
if (_chunking)
postwrite(__CHUNK_EOF,0,__CHUNK_EOF.length);
}
} }
|
public class class_name {
public final void enter(boolean fast) {
cancel();
mSoftwareAnimator = createSoftwareEnter(fast);
if (mSoftwareAnimator != null) {
mSoftwareAnimator.start();
}
} }
|
public class class_name {
public final void enter(boolean fast) {
cancel();
mSoftwareAnimator = createSoftwareEnter(fast);
if (mSoftwareAnimator != null) {
mSoftwareAnimator.start(); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public <E> E get(Class<E> clss) {
testControllerClass(clss);
synchronized (controllers) {
for (Controller controller : controllers) {
if (clss.isAssignableFrom(controller.getClass())) {
return clss.cast(controller);
}
}
}
return null;
} }
|
public class class_name {
public <E> E get(Class<E> clss) {
testControllerClass(clss);
synchronized (controllers) {
for (Controller controller : controllers) {
if (clss.isAssignableFrom(controller.getClass())) {
return clss.cast(controller);
// depends on control dependency: [if], data = [none]
}
}
}
return null;
} }
|
public class class_name {
@Override
public LepResource getResource(ContextsHolder contextsHolder, LepResourceKey resourceKey) {
Objects.requireNonNull(resourceKey, "resourceKey can't be null");
log.debug("Getting LEP resource for key {}", resourceKey);
final Resource scriptResource = getScriptResource(contextsHolder, resourceKey);
if (!scriptResource.exists()) {
log.debug("No LEP resource for key {}", resourceKey);
return null;
}
// build descriptor
LepResourceDescriptor descriptor = getLepResourceDescriptor(resourceKey, scriptResource);
log.debug("LEP resource for key {} found, descriptor: {}", resourceKey, descriptor);
return new ScriptLepResource(descriptor, ScriptLepResource.DEFAULT_ENCODING,
new InputStreamSupplier() {
/**
* {@inheritDoc}
*/
@Override
public InputStream getInputStream() throws IOException {
return scriptResource.getInputStream();
}
});
} }
|
public class class_name {
@Override
public LepResource getResource(ContextsHolder contextsHolder, LepResourceKey resourceKey) {
Objects.requireNonNull(resourceKey, "resourceKey can't be null");
log.debug("Getting LEP resource for key {}", resourceKey);
final Resource scriptResource = getScriptResource(contextsHolder, resourceKey);
if (!scriptResource.exists()) {
log.debug("No LEP resource for key {}", resourceKey); // depends on control dependency: [if], data = [none]
return null; // depends on control dependency: [if], data = [none]
}
// build descriptor
LepResourceDescriptor descriptor = getLepResourceDescriptor(resourceKey, scriptResource);
log.debug("LEP resource for key {} found, descriptor: {}", resourceKey, descriptor);
return new ScriptLepResource(descriptor, ScriptLepResource.DEFAULT_ENCODING,
new InputStreamSupplier() {
/**
* {@inheritDoc}
*/
@Override
public InputStream getInputStream() throws IOException {
return scriptResource.getInputStream();
}
});
} }
|
public class class_name {
private static Gson getGson() {
if (gson == null) {
// Creates the Gson object which will manage the information
// received
GsonBuilder builder = new GsonBuilder();
// Serializes enums as lower-case.
builder.registerTypeHierarchyAdapter(Enum.class,
new EnumLowercaseSerializer());
// Serializes calendar in format YYYY-MM-DDThh:mm.
builder.registerTypeHierarchyAdapter(Calendar.class,
new CalendarSerializer());
// Deserializes payloads from interface.
builder.registerTypeAdapter(Attachment.class,
new AttachmentDeserializer());
// Serializes/deserializes buttons from interface.
builder.registerTypeAdapter(Button.class, new ButtonSerializer());
// Deserializes incoming messages from interface.
builder.registerTypeAdapter(IncomingMessage.class,
new IncomingMessageDeserializer());
// Deserializes timestamp as Calendar.
builder.registerTypeAdapter(Calendar.class,
new CalendarFromTimestampJsonDeserializer());
gson = builder.create();
}
return gson;
} }
|
public class class_name {
private static Gson getGson() {
if (gson == null) {
// Creates the Gson object which will manage the information
// received
GsonBuilder builder = new GsonBuilder();
// Serializes enums as lower-case.
builder.registerTypeHierarchyAdapter(Enum.class,
new EnumLowercaseSerializer()); // depends on control dependency: [if], data = [none]
// Serializes calendar in format YYYY-MM-DDThh:mm.
builder.registerTypeHierarchyAdapter(Calendar.class,
new CalendarSerializer()); // depends on control dependency: [if], data = [none]
// Deserializes payloads from interface.
builder.registerTypeAdapter(Attachment.class,
new AttachmentDeserializer()); // depends on control dependency: [if], data = [none]
// Serializes/deserializes buttons from interface.
builder.registerTypeAdapter(Button.class, new ButtonSerializer()); // depends on control dependency: [if], data = [none]
// Deserializes incoming messages from interface.
builder.registerTypeAdapter(IncomingMessage.class,
new IncomingMessageDeserializer()); // depends on control dependency: [if], data = [none]
// Deserializes timestamp as Calendar.
builder.registerTypeAdapter(Calendar.class,
new CalendarFromTimestampJsonDeserializer()); // depends on control dependency: [if], data = [none]
gson = builder.create(); // depends on control dependency: [if], data = [none]
}
return gson;
} }
|
public class class_name {
public static boolean[] toPrimitive(Boolean[] array) {
if (array == null) {
return null;
} else if (array.length == 0) {
return EMPTY_BOOLEAN_ARRAY;
}
final boolean[] result = new boolean[array.length];
for (int i = 0; i < array.length; i++) {
result[i] = array[i];
}
return result;
} }
|
public class class_name {
public static boolean[] toPrimitive(Boolean[] array) {
if (array == null) {
return null; // depends on control dependency: [if], data = [none]
} else if (array.length == 0) {
return EMPTY_BOOLEAN_ARRAY; // depends on control dependency: [if], data = [none]
}
final boolean[] result = new boolean[array.length];
for (int i = 0; i < array.length; i++) {
result[i] = array[i]; // depends on control dependency: [for], data = [i]
}
return result;
} }
|
public class class_name {
public void receiveAudio(boolean receive) {
//check if engine currently receives audio, returns previous value
boolean receiveAudio = engine.receiveAudio(receive);
if (receiveAudio && !receive) {
//send a blank audio packet to reset the player
engine.sendBlankAudio(true);
} else if (!receiveAudio && receive) {
//do a seek
seekToCurrentPlayback();
}
} }
|
public class class_name {
public void receiveAudio(boolean receive) {
//check if engine currently receives audio, returns previous value
boolean receiveAudio = engine.receiveAudio(receive);
if (receiveAudio && !receive) {
//send a blank audio packet to reset the player
engine.sendBlankAudio(true);
// depends on control dependency: [if], data = [none]
} else if (!receiveAudio && receive) {
//do a seek
seekToCurrentPlayback();
// depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public static void saveActionForm(ActionForm form, ActionMapping mapping, HttpServletRequest request) {
if ((form != null) && (mapping.getAttribute() != null)) {
if ("request".equals(mapping.getScope())) {
request.setAttribute(mapping.getAttribute(), form);
} else {
HttpSession session = request.getSession();
session.setAttribute(mapping.getAttribute(), form);
request.setAttribute(mapping.getAttribute(), form);
}
}
} }
|
public class class_name {
public static void saveActionForm(ActionForm form, ActionMapping mapping, HttpServletRequest request) {
if ((form != null) && (mapping.getAttribute() != null)) {
if ("request".equals(mapping.getScope())) {
request.setAttribute(mapping.getAttribute(), form);
// depends on control dependency: [if], data = [none]
} else {
HttpSession session = request.getSession();
session.setAttribute(mapping.getAttribute(), form);
// depends on control dependency: [if], data = [none]
request.setAttribute(mapping.getAttribute(), form);
// depends on control dependency: [if], data = [none]
}
}
} }
|
public class class_name {
@Override
public void actionPerformed(ActionEvent e) {
String cmd = e.getActionCommand();
if (cmd.equals("Cancel")) {
setVisible(false);
value = null;
} else if (cmd.equals("Select")) {
value = list.getSelectedValue();
setVisible(false);
swingGui.showFileWindow(value, -1);
}
} }
|
public class class_name {
@Override
public void actionPerformed(ActionEvent e) {
String cmd = e.getActionCommand();
if (cmd.equals("Cancel")) {
setVisible(false); // depends on control dependency: [if], data = [none]
value = null; // depends on control dependency: [if], data = [none]
} else if (cmd.equals("Select")) {
value = list.getSelectedValue(); // depends on control dependency: [if], data = [none]
setVisible(false); // depends on control dependency: [if], data = [none]
swingGui.showFileWindow(value, -1); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
private static Object parse(int parseMod, int mode, Object value,
XAlias[] xAlias, XAliasField[] xAliasFields,
XAliasAttribute[] xAliasAttributes, XOmitField[] xOmitFields,
XImplicitCollection[] xImplicitCollection,
XImmutableType[] xImmutableTypes, XConverter[] xConverters) {
if (value == null) {
return null;
}
if (value instanceof String) {
if (value.equals("")) {
return null;
}
}
final XStream xstream = new XStream();
xstream.setMode(mode);
initXstream(xstream, xAlias, xAliasFields, xAliasAttributes,
xOmitFields, xImplicitCollection, xImmutableTypes, xConverters);
if (parseMod == 0) {
return xstream.toXML(value);
} else {
return xstream.fromXML((String) value);
}
} }
|
public class class_name {
private static Object parse(int parseMod, int mode, Object value,
XAlias[] xAlias, XAliasField[] xAliasFields,
XAliasAttribute[] xAliasAttributes, XOmitField[] xOmitFields,
XImplicitCollection[] xImplicitCollection,
XImmutableType[] xImmutableTypes, XConverter[] xConverters) {
if (value == null) {
return null; // depends on control dependency: [if], data = [none]
}
if (value instanceof String) {
if (value.equals("")) {
return null; // depends on control dependency: [if], data = [none]
}
}
final XStream xstream = new XStream();
xstream.setMode(mode);
initXstream(xstream, xAlias, xAliasFields, xAliasAttributes,
xOmitFields, xImplicitCollection, xImmutableTypes, xConverters);
if (parseMod == 0) {
return xstream.toXML(value); // depends on control dependency: [if], data = [none]
} else {
return xstream.fromXML((String) value); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public void setValueExpression(String name, ValueExpression binding) {
if ("value".equals(name)) {
this.model = null;
} else if ("var".equals(name) || "rowIndex".equals(name)) {
throw new IllegalArgumentException();
}
super.setValueExpression(name, binding);
} }
|
public class class_name {
public void setValueExpression(String name, ValueExpression binding) {
if ("value".equals(name)) {
this.model = null; // depends on control dependency: [if], data = [none]
} else if ("var".equals(name) || "rowIndex".equals(name)) {
throw new IllegalArgumentException();
}
super.setValueExpression(name, binding);
} }
|
public class class_name {
public boolean isValid(String email) {
if (email == null) {
return false;
}
if (email.endsWith(".")) { // check this first - it's cheap!
return false;
}
// Check the whole email address structure
Matcher emailMatcher = EMAIL_PATTERN.matcher(email);
if (!emailMatcher.matches()) {
return false;
}
if (!isValidUser(emailMatcher.group(1))) {
return false;
}
if (!isValidDomain(emailMatcher.group(2))) {
return false;
}
return true;
} }
|
public class class_name {
public boolean isValid(String email) {
if (email == null) {
return false; // depends on control dependency: [if], data = [none]
}
if (email.endsWith(".")) { // check this first - it's cheap!
return false; // depends on control dependency: [if], data = [none]
}
// Check the whole email address structure
Matcher emailMatcher = EMAIL_PATTERN.matcher(email);
if (!emailMatcher.matches()) {
return false; // depends on control dependency: [if], data = [none]
}
if (!isValidUser(emailMatcher.group(1))) {
return false; // depends on control dependency: [if], data = [none]
}
if (!isValidDomain(emailMatcher.group(2))) {
return false; // depends on control dependency: [if], data = [none]
}
return true;
} }
|
public class class_name {
public Form getFormContainerById(Long formContainerIdParam) {
Form form = new Form(formContainerIdParam);
if(this.serviceTicket != null) {
form.setServiceTicket(this.serviceTicket);
}
return new Form(this.postJson(
form, WS.Path.FormContainer.Version1.getById()));
} }
|
public class class_name {
public Form getFormContainerById(Long formContainerIdParam) {
Form form = new Form(formContainerIdParam);
if(this.serviceTicket != null) {
form.setServiceTicket(this.serviceTicket); // depends on control dependency: [if], data = [(this.serviceTicket]
}
return new Form(this.postJson(
form, WS.Path.FormContainer.Version1.getById()));
} }
|
public class class_name {
private Accum scanLeafDirectoryCollection(boolean isGrib1, FeatureCollectionConfig config,
Counters parentCounters,
Logger logger, Path dirPath, boolean isTop,
Indent indent, Formatter fm) throws IOException {
if (config.ptype == FeatureCollectionConfig.PartitionType.file) {
reportOneFileHeader(indent, fm);
fm.format("%sDirectory %s%n", indent, dirPath);
}
Accum accum = new Accum();
int nfiles = 0;
Counters countersThisDir = parentCounters.makeSubCounters();
Formatter errlog = new Formatter();
CollectionSpecParser specp = config.getCollectionSpecParser(errlog);
DirectoryCollection dcm = new DirectoryCollection(config.collectionName, dirPath, isTop, config.olderThan, logger);
// dcm.setUseGribFilter(false);
dcm.putAuxInfo(FeatureCollectionConfig.AUX_CONFIG, config);
if (specp.getFilter() != null)
dcm.setStreamFilter(new StreamFilter(specp.getFilter(), specp.getFilterOnName()));
try (CloseableIterator<MFile> iter = dcm.getFileIterator()) {
while (iter.hasNext()) {
MFile mfile = iter.next();
Counters countersOneFile = countersThisDir.makeSubCounters();
int nrecords = 0;
if (isGrib1) {
Grib1Index grib1Index = readGrib1Index(mfile, false);
if (grib1Index == null) {
System.out.printf("%s%s: read or create failed%n", indent, mfile.getPath());
continue;
}
for (ucar.nc2.grib.grib1.Grib1Record gr : grib1Index.getRecords()) {
accumGrib1Record(gr, countersOneFile);
nrecords++;
}
} else {
Grib2Index grib2Index = readGrib2Index(mfile, false);
if (grib2Index == null) {
System.out.printf("%s%s: read or create failed%n", indent, mfile.getPath());
continue;
}
for (ucar.nc2.grib.grib2.Grib2Record gr : grib2Index.getRecords()) {
accumGrib2Record(gr, countersOneFile);
nrecords++;
}
}
accum.nrecords += nrecords;
countersThisDir.addTo(countersOneFile);
if (config.ptype == FeatureCollectionConfig.PartitionType.file)
reportOneFile(mfile, nrecords, countersOneFile, indent, fm);
nfiles++;
// get file sizes
String path = mfile.getPath();
if (path.endsWith(GribIndex.GBX9_IDX)) {
accum.indexSize += ((float) mfile.getLength() / (1000 * 1000)); // mb
} else {
accum.fileSize += ((float) mfile.getLength() / (1000 * 1000)); // mb
File idxFile = GribIndexCache.getExistingFileOrCache(path + GribIndex.GBX9_IDX);
if (idxFile.exists())
accum.indexSize += ((float) idxFile.length() / (1000 * 1000)); // mb
}
}
}
parentCounters.addTo(countersThisDir);
accum.nfiles += nfiles;
accum.last = reportOneDir(dirPath.toString(), accum, countersThisDir, indent, accum.last);
return accum;
} }
|
public class class_name {
private Accum scanLeafDirectoryCollection(boolean isGrib1, FeatureCollectionConfig config,
Counters parentCounters,
Logger logger, Path dirPath, boolean isTop,
Indent indent, Formatter fm) throws IOException {
if (config.ptype == FeatureCollectionConfig.PartitionType.file) {
reportOneFileHeader(indent, fm);
fm.format("%sDirectory %s%n", indent, dirPath);
}
Accum accum = new Accum();
int nfiles = 0;
Counters countersThisDir = parentCounters.makeSubCounters();
Formatter errlog = new Formatter();
CollectionSpecParser specp = config.getCollectionSpecParser(errlog);
DirectoryCollection dcm = new DirectoryCollection(config.collectionName, dirPath, isTop, config.olderThan, logger);
// dcm.setUseGribFilter(false);
dcm.putAuxInfo(FeatureCollectionConfig.AUX_CONFIG, config);
if (specp.getFilter() != null)
dcm.setStreamFilter(new StreamFilter(specp.getFilter(), specp.getFilterOnName()));
try (CloseableIterator<MFile> iter = dcm.getFileIterator()) {
while (iter.hasNext()) {
MFile mfile = iter.next();
Counters countersOneFile = countersThisDir.makeSubCounters();
int nrecords = 0;
if (isGrib1) {
Grib1Index grib1Index = readGrib1Index(mfile, false);
if (grib1Index == null) {
System.out.printf("%s%s: read or create failed%n", indent, mfile.getPath());
continue;
}
for (ucar.nc2.grib.grib1.Grib1Record gr : grib1Index.getRecords()) {
accumGrib1Record(gr, countersOneFile); // depends on control dependency: [for], data = [gr]
nrecords++; // depends on control dependency: [for], data = [none]
}
} else {
Grib2Index grib2Index = readGrib2Index(mfile, false);
if (grib2Index == null) {
System.out.printf("%s%s: read or create failed%n", indent, mfile.getPath());
continue;
}
for (ucar.nc2.grib.grib2.Grib2Record gr : grib2Index.getRecords()) {
accumGrib2Record(gr, countersOneFile); // depends on control dependency: [for], data = [gr]
nrecords++; // depends on control dependency: [for], data = [none]
}
}
accum.nrecords += nrecords;
countersThisDir.addTo(countersOneFile);
if (config.ptype == FeatureCollectionConfig.PartitionType.file)
reportOneFile(mfile, nrecords, countersOneFile, indent, fm);
nfiles++;
// get file sizes
String path = mfile.getPath();
if (path.endsWith(GribIndex.GBX9_IDX)) {
accum.indexSize += ((float) mfile.getLength() / (1000 * 1000)); // mb // depends on control dependency: [if], data = [none]
} else {
accum.fileSize += ((float) mfile.getLength() / (1000 * 1000)); // mb // depends on control dependency: [if], data = [none]
File idxFile = GribIndexCache.getExistingFileOrCache(path + GribIndex.GBX9_IDX);
if (idxFile.exists())
accum.indexSize += ((float) idxFile.length() / (1000 * 1000)); // mb
}
}
}
parentCounters.addTo(countersThisDir);
accum.nfiles += nfiles;
accum.last = reportOneDir(dirPath.toString(), accum, countersThisDir, indent, accum.last);
return accum;
} }
|
public class class_name {
public Object get(int accessor) {
try {
return getValue(accessor);
} catch (JMFException ex) {
FFDCFilter.processException(ex, "get", "134", this);
return null;
}
} }
|
public class class_name {
public Object get(int accessor) {
try {
return getValue(accessor); // depends on control dependency: [try], data = [none]
} catch (JMFException ex) {
FFDCFilter.processException(ex, "get", "134", this);
return null;
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
@JsonIgnore
public Map<String, Set<String>> getGroupingSpecification() {
Map<String, Set<String>> result = new LinkedHashMap<>();
if (!StringUtils.isBlank(grouping)) {
String[] groups = split(grouping, '|');
for (String group : groups) {
String[] groupSpec = split(group.trim(), '=');
if (groupSpec.length != 2) throw new ExportRequestGroupingFormatException(grouping);
String groupName = groupSpec[0].trim();
result.put(
groupName,
Sets.newLinkedHashSet(
Arrays.asList(
split(groupSpec[1].trim(), ',')
).stream()
.map(String::trim)
.collect(Collectors.toList())
)
);
}
}
return result;
} }
|
public class class_name {
@JsonIgnore
public Map<String, Set<String>> getGroupingSpecification() {
Map<String, Set<String>> result = new LinkedHashMap<>();
if (!StringUtils.isBlank(grouping)) {
String[] groups = split(grouping, '|');
for (String group : groups) {
String[] groupSpec = split(group.trim(), '=');
if (groupSpec.length != 2) throw new ExportRequestGroupingFormatException(grouping);
String groupName = groupSpec[0].trim();
result.put(
groupName,
Sets.newLinkedHashSet(
Arrays.asList(
split(groupSpec[1].trim(), ',')
).stream()
.map(String::trim)
.collect(Collectors.toList())
)
); // depends on control dependency: [for], data = [none]
}
}
return result;
} }
|
public class class_name {
public Set<IBond> findBonds(IAtomContainer molecule) throws CDKException {
// build graph data-structures for fast cycle perception
final EdgeToBondMap bondMap = EdgeToBondMap.withSpaceFor(molecule);
final int[][] graph = GraphUtil.toAdjList(molecule, bondMap);
// initial ring/cycle search and get the contribution from each atom
final RingSearch ringSearch = new RingSearch(molecule, graph);
final int[] electrons = model.contribution(molecule, ringSearch);
final Set<IBond> bonds = Sets.newHashSetWithExpectedSize(molecule.getBondCount());
// obtain the subset of electron contributions which are >= 0 (i.e.
// allowed to be aromatic) - we then find the cycles in this subgraph
// and 'lift' the indices back to the original graph using the subset
// as a lookup
final int[] subset = subset(electrons);
final int[][] subgraph = GraphUtil.subgraph(graph, subset);
// for each cycle if the electron sum is valid add the bonds of the
// cycle to the set or aromatic bonds
for (final int[] cycle : cycles.find(molecule, subgraph, subgraph.length).paths()) {
if (checkElectronSum(cycle, electrons, subset)) {
for (int i = 1; i < cycle.length; i++) {
bonds.add(bondMap.get(subset[cycle[i]], subset[cycle[i - 1]]));
}
}
}
return bonds;
} }
|
public class class_name {
public Set<IBond> findBonds(IAtomContainer molecule) throws CDKException {
// build graph data-structures for fast cycle perception
final EdgeToBondMap bondMap = EdgeToBondMap.withSpaceFor(molecule);
final int[][] graph = GraphUtil.toAdjList(molecule, bondMap);
// initial ring/cycle search and get the contribution from each atom
final RingSearch ringSearch = new RingSearch(molecule, graph);
final int[] electrons = model.contribution(molecule, ringSearch);
final Set<IBond> bonds = Sets.newHashSetWithExpectedSize(molecule.getBondCount());
// obtain the subset of electron contributions which are >= 0 (i.e.
// allowed to be aromatic) - we then find the cycles in this subgraph
// and 'lift' the indices back to the original graph using the subset
// as a lookup
final int[] subset = subset(electrons);
final int[][] subgraph = GraphUtil.subgraph(graph, subset);
// for each cycle if the electron sum is valid add the bonds of the
// cycle to the set or aromatic bonds
for (final int[] cycle : cycles.find(molecule, subgraph, subgraph.length).paths()) {
if (checkElectronSum(cycle, electrons, subset)) {
for (int i = 1; i < cycle.length; i++) {
bonds.add(bondMap.get(subset[cycle[i]], subset[cycle[i - 1]])); // depends on control dependency: [for], data = [i]
}
}
}
return bonds;
} }
|
public class class_name {
protected int convertText(String text, Locale locale) {
try {
return Integer.parseInt(text);
} catch (NumberFormatException ex) {
throw new IllegalFieldValueException(getType(), text);
}
} }
|
public class class_name {
protected int convertText(String text, Locale locale) {
try {
return Integer.parseInt(text); // depends on control dependency: [try], data = [none]
} catch (NumberFormatException ex) {
throw new IllegalFieldValueException(getType(), text);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
@Override
public void run() {
if (m_restoreAgent != null) {
// start restore process
m_restoreAgent.restore();
}
else {
onSnapshotRestoreCompletion();
onReplayCompletion(Long.MIN_VALUE, m_iv2InitiatorStartingTxnIds);
}
// Start the rejoin coordinator
if (m_joinCoordinator != null) {
try {
m_statusTracker.set(NodeState.REJOINING);
if (!m_joinCoordinator.startJoin(m_catalogContext.database)) {
VoltDB.crashLocalVoltDB("Failed to join the cluster", true, null);
}
} catch (Exception e) {
VoltDB.crashLocalVoltDB("Failed to join the cluster", true, e);
}
}
m_isRunning = true;
} }
|
public class class_name {
@Override
public void run() {
if (m_restoreAgent != null) {
// start restore process
m_restoreAgent.restore(); // depends on control dependency: [if], data = [none]
}
else {
onSnapshotRestoreCompletion(); // depends on control dependency: [if], data = [none]
onReplayCompletion(Long.MIN_VALUE, m_iv2InitiatorStartingTxnIds); // depends on control dependency: [if], data = [none]
}
// Start the rejoin coordinator
if (m_joinCoordinator != null) {
try {
m_statusTracker.set(NodeState.REJOINING); // depends on control dependency: [try], data = [none]
if (!m_joinCoordinator.startJoin(m_catalogContext.database)) {
VoltDB.crashLocalVoltDB("Failed to join the cluster", true, null); // depends on control dependency: [if], data = [none]
}
} catch (Exception e) {
VoltDB.crashLocalVoltDB("Failed to join the cluster", true, e);
} // depends on control dependency: [catch], data = [none]
}
m_isRunning = true;
} }
|
public class class_name {
private Map<String, String> readProperties(Element properties)
{
Map<String, String> values = new HashMap<>();
for (Element p : $(properties).find("prop"))
{
String key = $(p).attr("key");
String val = $(p).text();
values.put(key, val);
}
for (Element p : $(properties).find("entry"))
{
String key = $(p).attr("key");
String val = $(p).attr("value");
values.put(key, val);
}
for (Element p : $(properties).find("value"))
{
String propVal = StringUtils.trim($(p).text());
String key = StringUtils.substringBefore(propVal, "=");
String val = StringUtils.substringAfter(propVal, "=");
values.put(key, val);
}
return values;
} }
|
public class class_name {
private Map<String, String> readProperties(Element properties)
{
Map<String, String> values = new HashMap<>();
for (Element p : $(properties).find("prop"))
{
String key = $(p).attr("key");
String val = $(p).text();
values.put(key, val); // depends on control dependency: [for], data = [p]
}
for (Element p : $(properties).find("entry"))
{
String key = $(p).attr("key");
String val = $(p).attr("value");
values.put(key, val); // depends on control dependency: [for], data = [p]
}
for (Element p : $(properties).find("value"))
{
String propVal = StringUtils.trim($(p).text());
String key = StringUtils.substringBefore(propVal, "=");
String val = StringUtils.substringAfter(propVal, "=");
values.put(key, val); // depends on control dependency: [for], data = [p]
}
return values;
} }
|
public class class_name {
@Override
public final void makeCartTotals(final Map<String, Object> pRqVs,
final TradingSettings pTs, final CartLn pCartLn, final AccSettings pAs,
final TaxDestination pTxRules) throws Exception {
BigDecimal txTot = BigDecimal.ZERO;
BigDecimal txTotSe = BigDecimal.ZERO;
String descr = null;
if (pTxRules != null) {
descr = "Tax rules: aggregate/invoice basis/zip/RM = " + pTxRules
.getSalTaxUseAggregItBas() + "/" + pTxRules.getSalTaxIsInvoiceBase()
+ "/" + pTxRules.getRegZip() + "/" + pTxRules.getSalTaxRoundMode();
boolean isDbgSh = getLogger().getDbgSh(this.getClass())
&& getLogger().getDbgFl() < 13001 && getLogger().getDbgCl() > 13003;
if (isDbgSh) {
String txCat;
if (pCartLn.getTxCat() != null) {
txCat = pCartLn.getTxCat().getItsName();
} else {
txCat = "-";
}
getLogger().debug(pRqVs, SrvShoppingCart.class,
"Item: name/tax category/disabled = " + pCartLn.getItsName() + "/"
+ txCat + "/" + pCartLn.getDisab());
}
for (CartTxLn ctl : pCartLn.getItsOwner().getTaxes()) {
if (!ctl.getDisab() && (ctl.getSeller() == null
&& pCartLn.getSeller() == null || ctl.getSeller() != null
&& pCartLn.getSeller() != null && pCartLn.getSeller().getItsId()
.getItsId().equals(ctl.getSeller().getItsId().getItsId()))) {
ctl.setDisab(true);
}
}
//data storage for aggregate rate
//and non-aggregate invoice basis taxes included:
List<CartLn> txdLns = null;
//data storages for non-aggregate rate
//except invoice basis with included taxes:
List<Tax> txs = null; //taxes
List<Double> txTotTaxb = null; //tax's totals/taxables
List<Double> txPerc = null; //tax's percents for invoice basis
String query;
if (!pTxRules.getSalTaxUseAggregItBas()
&& !(pTxRules.getSalTaxIsInvoiceBase() && !pTs.getTxExcl())) {
//non-aggregate except invoice basis with included taxes:
txs = new ArrayList<Tax>();
txTotTaxb = new ArrayList<Double>();
if (!pTxRules.getSalTaxIsInvoiceBase()) {
//item basis:
query = lazyGetQuTxItBas();
} else {
//invoice basis, taxes excluded:
txPerc = new ArrayList<Double>();
query = lazyGetQuTxInvBas();
}
} else { //non-aggregate invoice basis with included taxes
//and aggregate for others:
txdLns = new ArrayList<CartLn>();
if (!pTxRules.getSalTaxIsInvoiceBase()) { //item basis
query = lazyGetQuTxItBasAggr();
} else { //invoice basis:
query = lazyGetQuTxInvBasAggr();
}
}
String condSel;
if (pCartLn.getSeller() == null) {
condSel = " is null";
} else {
condSel = "=" + pCartLn.getSeller().getItsId().getItsId();
}
query = query.replace(":CARTID", pCartLn.getItsOwner().getBuyer()
.getItsId().toString()).replace(":CONDSEL", condSel);
IRecordSet<RS> recordSet = null;
try {
recordSet = getSrvDatabase().retrieveRecords(query);
if (recordSet.moveToFirst()) {
do {
Long txId = recordSet.getLong("TAXID");
String txNm = recordSet.getString("TAXNAME");
Tax tax = new Tax();
tax.setItsId(txId);
tax.setItsName(txNm);
if (!pTxRules.getSalTaxUseAggregItBas()
&& !(pTxRules.getSalTaxIsInvoiceBase() && !pTs.getTxExcl())) {
//non-aggregate except invoice basis with included taxes:
txs.add(tax);
if (!pTxRules.getSalTaxIsInvoiceBase()) {
//item basis, taxes excluded/included:
txTotTaxb.add(recordSet.getDouble("TOTALTAX"));
} else {
//invoice basis, taxes excluded:
txPerc.add(recordSet.getDouble("ITSPERCENTAGE"));
txTotTaxb.add(recordSet.getDouble("SUBTOTAL"));
}
} else { //non-aggregate invoice basis with included taxes
//and aggregate for others:
Double percent = recordSet.getDouble("ITSPERCENTAGE");
Long tcId = recordSet.getLong("TAXCATID");
if (!pTxRules.getSalTaxIsInvoiceBase()) { //item basis:
Long clId = recordSet.getLong("CLID");
CartLn txdLn = makeTxdLine(txdLns, clId, tcId, tax, percent,
pAs);
txdLn.setTotTx(BigDecimal.valueOf(recordSet
.getDouble("TOTALTAXES"))
.setScale(pAs.getPricePrecision(), RoundingMode.HALF_UP));
} else { //invoice basis:
CartLn txdLn = makeTxdLine(txdLns, tcId, tcId, tax, percent,
pAs);
txdLn.setTot(BigDecimal.valueOf(recordSet
.getDouble("ITSTOTAL"))
.setScale(pAs.getPricePrecision(), RoundingMode.HALF_UP));
txdLn.setSubt(BigDecimal.valueOf(recordSet
.getDouble("SUBTOTAL"))
.setScale(pAs.getPricePrecision(), RoundingMode.HALF_UP));
}
}
} while (recordSet.moveToNext());
}
} finally {
if (recordSet != null) {
recordSet.close();
}
}
if (!pTxRules.getSalTaxUseAggregItBas()
&& !(pTxRules.getSalTaxIsInvoiceBase() && !pTs.getTxExcl())) {
//non-aggregate except invoice basis with included taxes:
for (int i = 0; i < txs.size(); i++) {
CartTxLn ctl = findCreateTaxLine(pRqVs, pCartLn.getItsOwner(),
txs.get(i), pCartLn.getSeller(), false);
Double txTotd;
if (!pTxRules.getSalTaxIsInvoiceBase()) {
//item basis, taxes excluded/included:
txTotd = txTotTaxb.get(i);
} else {
//invoice basis, taxes excluded:
txTotd = txTotTaxb.get(i) * txPerc.get(i) / 100.0;
ctl.setTaxab(BigDecimal.valueOf(txTotTaxb.get(i)));
}
ctl.setTot(BigDecimal.valueOf(txTotd).setScale(pAs.
getPricePrecision(), pTxRules.getSalTaxRoundMode()));
if (ctl.getIsNew()) {
getSrvOrm().insertEntity(pRqVs, ctl);
ctl.setIsNew(false);
} else {
getSrvOrm().updateEntity(pRqVs, ctl);
}
}
} else { //non-aggregate invoice basis with included taxes
//and aggregate for others:
BigDecimal bd100 = new BigDecimal("100.00");
Comparator<InvItemTaxCategoryLine> cmpr = Collections
.reverseOrder(new CmprTaxCatLnRate());
for (CartLn txdLn : txdLns) {
int ti = 0;
//aggregate rate line scoped storages:
BigDecimal taxAggegated = null;
BigDecimal taxAggrAccum = BigDecimal.ZERO;
Collections.sort(txdLn.getTxCat().getTaxes(), cmpr);
for (InvItemTaxCategoryLine itcl : txdLn.getTxCat().getTaxes()) {
ti++;
if (taxAggegated == null) {
if (pTxRules.getSalTaxIsInvoiceBase()) { //invoice basis:
if (!pTs.getTxExcl()) {
taxAggegated = txdLn.getTot().subtract(txdLn.getTot().divide(
BigDecimal.ONE.add(txdLn.getTxCat().getAggrOnlyPercent().divide(
bd100)), pAs.getPricePrecision(), pTxRules.getSalTaxRoundMode()));
} else {
taxAggegated = txdLn.getSubt().multiply(txdLn.getTxCat()
.getAggrOnlyPercent()).divide(bd100, pAs.getPricePrecision(),
pTxRules.getSalTaxRoundMode());
}
} else {
//item basis, taxes included/excluded
taxAggegated = txdLn.getTotTx();
}
}
if (ti < txdLn.getTxCat().getTaxes().size()) {
txdLn.setTotTx(taxAggegated.multiply(itcl.getItsPercentage())
.divide(txdLn.getTxCat().getAggrOnlyPercent(),
pAs.getPricePrecision(), pTxRules.getSalTaxRoundMode()));
taxAggrAccum = taxAggrAccum.add(txdLn.getTotTx());
} else { //the rest or only tax:
txdLn.setTotTx(taxAggegated.subtract(taxAggrAccum));
}
CartTxLn ctl = findCreateTaxLine(pRqVs, pCartLn.getItsOwner(),
itcl.getTax(), pCartLn.getSeller(), true);
ctl.setTot(ctl.getTot().add(txdLn.getTotTx()));
if (pTxRules.getSalTaxIsInvoiceBase()) {
if (pTs.getTxExcl()) {
ctl.setTaxab(ctl.getTaxab().add(txdLn.getSubt()));
} else {
ctl.setTaxab(ctl.getTaxab().add(txdLn.getTot()));
}
}
if (ctl.getIsNew()) {
getSrvOrm().insertEntity(pRqVs, ctl);
ctl.setIsNew(false);
} else {
getSrvOrm().updateEntity(pRqVs, ctl);
}
}
}
}
for (CartTxLn ctl : pCartLn.getItsOwner().getTaxes()) {
if (!ctl.getDisab()) {
if (ctl.getSeller() == null && pCartLn.getSeller() == null
|| ctl.getSeller() != null && pCartLn.getSeller() != null
&& pCartLn.getSeller().getItsId().getItsId()
.equals(ctl.getSeller().getItsId().getItsId())) {
txTotSe = txTotSe.add(ctl.getTot());
}
txTot = txTot.add(ctl.getTot());
} else if (ctl.getSeller() == null && pCartLn.getSeller() == null
|| ctl.getSeller() != null && pCartLn.getSeller() != null
&& pCartLn.getSeller().getItsId().getItsId()
.equals(ctl.getSeller().getItsId().getItsId())) {
getSrvOrm().updateEntity(pRqVs, ctl);
}
}
}
BigDecimal tot = BigDecimal.ZERO;
BigDecimal totSe = BigDecimal.ZERO;
for (CartLn cl : pCartLn.getItsOwner().getItems()) {
if (!cl.getDisab()) {
if (cl.getSeller() == null && pCartLn.getSeller() == null
|| cl.getSeller() != null && pCartLn.getSeller() != null
&& pCartLn.getSeller().getItsId().getItsId()
.equals(cl.getSeller().getItsId().getItsId())) {
totSe = totSe.add(cl.getTot());
}
tot = tot.add(cl.getTot());
}
}
pCartLn.getItsOwner().setTotTx(txTot);
pCartLn.getItsOwner().setSubt(tot.subtract(txTot));
pCartLn.getItsOwner().setTot(tot);
pCartLn.getItsOwner().setDescr(descr);
getSrvOrm().updateEntity(pRqVs, pCartLn.getItsOwner());
CartTot cartTot = null;
for (CartTot ct : pCartLn.getItsOwner().getTotals()) {
if (!ct.getDisab() && (ct.getSeller() == null && pCartLn
.getSeller() == null || ct.getSeller() != null && pCartLn
.getSeller() != null && pCartLn.getSeller().getItsId().getItsId()
.equals(ct.getSeller().getItsId().getItsId()))) {
cartTot = ct;
break;
}
}
if (totSe.compareTo(BigDecimal.ZERO) == 0 && cartTot != null) {
//last seller's line has been deleted, disable enabled:
cartTot.setDisab(true);
getSrvOrm().updateEntity(pRqVs, cartTot);
} else if (totSe.compareTo(BigDecimal.ZERO) == 1) {
if (cartTot == null) {
for (CartTot ct : pCartLn.getItsOwner().getTotals()) {
if (ct.getDisab()) {
cartTot = ct;
cartTot.setDisab(false);
break;
}
}
}
if (cartTot == null) {
cartTot = new CartTot();
cartTot.setItsOwner(pCartLn.getItsOwner());
cartTot.setIsNew(true);
}
cartTot.setSeller(pCartLn.getSeller());
cartTot.setTotTx(txTotSe);
cartTot.setSubt(totSe.subtract(txTotSe));
cartTot.setTot(totSe);
if (cartTot.getIsNew()) {
getSrvOrm().insertEntity(pRqVs, cartTot);
} else {
getSrvOrm().updateEntity(pRqVs, cartTot);
}
}
} }
|
public class class_name {
@Override
public final void makeCartTotals(final Map<String, Object> pRqVs,
final TradingSettings pTs, final CartLn pCartLn, final AccSettings pAs,
final TaxDestination pTxRules) throws Exception {
BigDecimal txTot = BigDecimal.ZERO;
BigDecimal txTotSe = BigDecimal.ZERO;
String descr = null;
if (pTxRules != null) {
descr = "Tax rules: aggregate/invoice basis/zip/RM = " + pTxRules
.getSalTaxUseAggregItBas() + "/" + pTxRules.getSalTaxIsInvoiceBase()
+ "/" + pTxRules.getRegZip() + "/" + pTxRules.getSalTaxRoundMode();
boolean isDbgSh = getLogger().getDbgSh(this.getClass())
&& getLogger().getDbgFl() < 13001 && getLogger().getDbgCl() > 13003;
if (isDbgSh) {
String txCat;
if (pCartLn.getTxCat() != null) {
txCat = pCartLn.getTxCat().getItsName(); // depends on control dependency: [if], data = [none]
} else {
txCat = "-"; // depends on control dependency: [if], data = [none]
}
getLogger().debug(pRqVs, SrvShoppingCart.class,
"Item: name/tax category/disabled = " + pCartLn.getItsName() + "/"
+ txCat + "/" + pCartLn.getDisab());
}
for (CartTxLn ctl : pCartLn.getItsOwner().getTaxes()) {
if (!ctl.getDisab() && (ctl.getSeller() == null
&& pCartLn.getSeller() == null || ctl.getSeller() != null
&& pCartLn.getSeller() != null && pCartLn.getSeller().getItsId()
.getItsId().equals(ctl.getSeller().getItsId().getItsId()))) {
ctl.setDisab(true);
}
}
//data storage for aggregate rate
//and non-aggregate invoice basis taxes included:
List<CartLn> txdLns = null;
//data storages for non-aggregate rate
//except invoice basis with included taxes:
List<Tax> txs = null; //taxes
List<Double> txTotTaxb = null; //tax's totals/taxables
List<Double> txPerc = null; //tax's percents for invoice basis
String query;
if (!pTxRules.getSalTaxUseAggregItBas()
&& !(pTxRules.getSalTaxIsInvoiceBase() && !pTs.getTxExcl())) {
//non-aggregate except invoice basis with included taxes:
txs = new ArrayList<Tax>();
txTotTaxb = new ArrayList<Double>();
if (!pTxRules.getSalTaxIsInvoiceBase()) {
//item basis:
query = lazyGetQuTxItBas();
} else {
//invoice basis, taxes excluded:
txPerc = new ArrayList<Double>();
query = lazyGetQuTxInvBas();
}
} else { //non-aggregate invoice basis with included taxes
//and aggregate for others:
txdLns = new ArrayList<CartLn>();
if (!pTxRules.getSalTaxIsInvoiceBase()) { //item basis
query = lazyGetQuTxItBasAggr();
} else { //invoice basis:
query = lazyGetQuTxInvBasAggr();
}
}
String condSel;
if (pCartLn.getSeller() == null) {
condSel = " is null";
} else {
condSel = "=" + pCartLn.getSeller().getItsId().getItsId();
}
query = query.replace(":CARTID", pCartLn.getItsOwner().getBuyer()
.getItsId().toString()).replace(":CONDSEL", condSel);
IRecordSet<RS> recordSet = null;
try {
recordSet = getSrvDatabase().retrieveRecords(query);
if (recordSet.moveToFirst()) {
do {
Long txId = recordSet.getLong("TAXID");
String txNm = recordSet.getString("TAXNAME");
Tax tax = new Tax();
tax.setItsId(txId);
tax.setItsName(txNm);
if (!pTxRules.getSalTaxUseAggregItBas()
&& !(pTxRules.getSalTaxIsInvoiceBase() && !pTs.getTxExcl())) {
//non-aggregate except invoice basis with included taxes:
txs.add(tax);
if (!pTxRules.getSalTaxIsInvoiceBase()) {
//item basis, taxes excluded/included:
txTotTaxb.add(recordSet.getDouble("TOTALTAX"));
} else {
//invoice basis, taxes excluded:
txPerc.add(recordSet.getDouble("ITSPERCENTAGE"));
txTotTaxb.add(recordSet.getDouble("SUBTOTAL"));
}
} else { //non-aggregate invoice basis with included taxes
//and aggregate for others:
Double percent = recordSet.getDouble("ITSPERCENTAGE");
Long tcId = recordSet.getLong("TAXCATID");
if (!pTxRules.getSalTaxIsInvoiceBase()) { //item basis:
Long clId = recordSet.getLong("CLID");
CartLn txdLn = makeTxdLine(txdLns, clId, tcId, tax, percent,
pAs);
txdLn.setTotTx(BigDecimal.valueOf(recordSet
.getDouble("TOTALTAXES"))
.setScale(pAs.getPricePrecision(), RoundingMode.HALF_UP));
} else { //invoice basis:
CartLn txdLn = makeTxdLine(txdLns, tcId, tcId, tax, percent,
pAs);
txdLn.setTot(BigDecimal.valueOf(recordSet
.getDouble("ITSTOTAL"))
.setScale(pAs.getPricePrecision(), RoundingMode.HALF_UP));
txdLn.setSubt(BigDecimal.valueOf(recordSet
.getDouble("SUBTOTAL"))
.setScale(pAs.getPricePrecision(), RoundingMode.HALF_UP));
}
}
} while (recordSet.moveToNext());
}
} finally {
if (recordSet != null) {
recordSet.close();
}
}
if (!pTxRules.getSalTaxUseAggregItBas()
&& !(pTxRules.getSalTaxIsInvoiceBase() && !pTs.getTxExcl())) {
//non-aggregate except invoice basis with included taxes:
for (int i = 0; i < txs.size(); i++) {
CartTxLn ctl = findCreateTaxLine(pRqVs, pCartLn.getItsOwner(),
txs.get(i), pCartLn.getSeller(), false);
Double txTotd;
if (!pTxRules.getSalTaxIsInvoiceBase()) {
//item basis, taxes excluded/included:
txTotd = txTotTaxb.get(i);
} else {
//invoice basis, taxes excluded:
txTotd = txTotTaxb.get(i) * txPerc.get(i) / 100.0;
ctl.setTaxab(BigDecimal.valueOf(txTotTaxb.get(i)));
}
ctl.setTot(BigDecimal.valueOf(txTotd).setScale(pAs.
getPricePrecision(), pTxRules.getSalTaxRoundMode()));
if (ctl.getIsNew()) {
getSrvOrm().insertEntity(pRqVs, ctl);
ctl.setIsNew(false);
} else {
getSrvOrm().updateEntity(pRqVs, ctl);
}
}
} else { //non-aggregate invoice basis with included taxes
//and aggregate for others:
BigDecimal bd100 = new BigDecimal("100.00");
Comparator<InvItemTaxCategoryLine> cmpr = Collections
.reverseOrder(new CmprTaxCatLnRate());
for (CartLn txdLn : txdLns) {
int ti = 0;
//aggregate rate line scoped storages:
BigDecimal taxAggegated = null;
BigDecimal taxAggrAccum = BigDecimal.ZERO;
Collections.sort(txdLn.getTxCat().getTaxes(), cmpr);
for (InvItemTaxCategoryLine itcl : txdLn.getTxCat().getTaxes()) {
ti++;
if (taxAggegated == null) {
if (pTxRules.getSalTaxIsInvoiceBase()) { //invoice basis:
if (!pTs.getTxExcl()) {
taxAggegated = txdLn.getTot().subtract(txdLn.getTot().divide(
BigDecimal.ONE.add(txdLn.getTxCat().getAggrOnlyPercent().divide(
bd100)), pAs.getPricePrecision(), pTxRules.getSalTaxRoundMode()));
} else {
taxAggegated = txdLn.getSubt().multiply(txdLn.getTxCat()
.getAggrOnlyPercent()).divide(bd100, pAs.getPricePrecision(),
pTxRules.getSalTaxRoundMode());
}
} else {
//item basis, taxes included/excluded
taxAggegated = txdLn.getTotTx();
}
}
if (ti < txdLn.getTxCat().getTaxes().size()) {
txdLn.setTotTx(taxAggegated.multiply(itcl.getItsPercentage())
.divide(txdLn.getTxCat().getAggrOnlyPercent(),
pAs.getPricePrecision(), pTxRules.getSalTaxRoundMode()));
taxAggrAccum = taxAggrAccum.add(txdLn.getTotTx());
} else { //the rest or only tax:
txdLn.setTotTx(taxAggegated.subtract(taxAggrAccum));
}
CartTxLn ctl = findCreateTaxLine(pRqVs, pCartLn.getItsOwner(),
itcl.getTax(), pCartLn.getSeller(), true);
ctl.setTot(ctl.getTot().add(txdLn.getTotTx()));
if (pTxRules.getSalTaxIsInvoiceBase()) {
if (pTs.getTxExcl()) {
ctl.setTaxab(ctl.getTaxab().add(txdLn.getSubt()));
} else {
ctl.setTaxab(ctl.getTaxab().add(txdLn.getTot()));
}
}
if (ctl.getIsNew()) {
getSrvOrm().insertEntity(pRqVs, ctl);
ctl.setIsNew(false);
} else {
getSrvOrm().updateEntity(pRqVs, ctl);
}
}
}
}
for (CartTxLn ctl : pCartLn.getItsOwner().getTaxes()) {
if (!ctl.getDisab()) {
if (ctl.getSeller() == null && pCartLn.getSeller() == null
|| ctl.getSeller() != null && pCartLn.getSeller() != null
&& pCartLn.getSeller().getItsId().getItsId()
.equals(ctl.getSeller().getItsId().getItsId())) {
txTotSe = txTotSe.add(ctl.getTot());
}
txTot = txTot.add(ctl.getTot());
} else if (ctl.getSeller() == null && pCartLn.getSeller() == null
|| ctl.getSeller() != null && pCartLn.getSeller() != null
&& pCartLn.getSeller().getItsId().getItsId()
.equals(ctl.getSeller().getItsId().getItsId())) {
getSrvOrm().updateEntity(pRqVs, ctl);
}
}
}
BigDecimal tot = BigDecimal.ZERO;
BigDecimal totSe = BigDecimal.ZERO;
for (CartLn cl : pCartLn.getItsOwner().getItems()) {
if (!cl.getDisab()) {
if (cl.getSeller() == null && pCartLn.getSeller() == null
|| cl.getSeller() != null && pCartLn.getSeller() != null
&& pCartLn.getSeller().getItsId().getItsId()
.equals(cl.getSeller().getItsId().getItsId())) {
totSe = totSe.add(cl.getTot());
}
tot = tot.add(cl.getTot());
}
}
pCartLn.getItsOwner().setTotTx(txTot);
pCartLn.getItsOwner().setSubt(tot.subtract(txTot));
pCartLn.getItsOwner().setTot(tot);
pCartLn.getItsOwner().setDescr(descr);
getSrvOrm().updateEntity(pRqVs, pCartLn.getItsOwner());
CartTot cartTot = null;
for (CartTot ct : pCartLn.getItsOwner().getTotals()) {
if (!ct.getDisab() && (ct.getSeller() == null && pCartLn
.getSeller() == null || ct.getSeller() != null && pCartLn
.getSeller() != null && pCartLn.getSeller().getItsId().getItsId()
.equals(ct.getSeller().getItsId().getItsId()))) {
cartTot = ct;
break;
}
}
if (totSe.compareTo(BigDecimal.ZERO) == 0 && cartTot != null) {
//last seller's line has been deleted, disable enabled:
cartTot.setDisab(true);
getSrvOrm().updateEntity(pRqVs, cartTot);
} else if (totSe.compareTo(BigDecimal.ZERO) == 1) {
if (cartTot == null) {
for (CartTot ct : pCartLn.getItsOwner().getTotals()) {
if (ct.getDisab()) {
cartTot = ct;
cartTot.setDisab(false);
break;
}
}
}
if (cartTot == null) {
cartTot = new CartTot();
cartTot.setItsOwner(pCartLn.getItsOwner());
cartTot.setIsNew(true);
}
cartTot.setSeller(pCartLn.getSeller());
cartTot.setTotTx(txTotSe);
cartTot.setSubt(totSe.subtract(txTotSe));
cartTot.setTot(totSe);
if (cartTot.getIsNew()) {
getSrvOrm().insertEntity(pRqVs, cartTot);
} else {
getSrvOrm().updateEntity(pRqVs, cartTot);
}
}
} }
|
public class class_name {
public void assertContains(Description description, Set<?> actual, Object[] values) {
assertNotNull(description, actual);
checkNotEmpty(description, actual);
checkIsNotNullAndNotEmpty(values);
Set<Object> notFound = new LinkedHashSet<Object>();
for (Object value : values) {
if (!actual.contains(value)) {
notFound.add(value);
}
}
if (!notFound.isEmpty()) {
throw failures.failure(description, ShouldContain.shouldContain(actual, values, notFound));
}
} }
|
public class class_name {
public void assertContains(Description description, Set<?> actual, Object[] values) {
assertNotNull(description, actual);
checkNotEmpty(description, actual);
checkIsNotNullAndNotEmpty(values);
Set<Object> notFound = new LinkedHashSet<Object>();
for (Object value : values) {
if (!actual.contains(value)) {
notFound.add(value);
// depends on control dependency: [if], data = [none]
}
}
if (!notFound.isEmpty()) {
throw failures.failure(description, ShouldContain.shouldContain(actual, values, notFound));
}
} }
|
public class class_name {
private Node createParameters(boolean lastVarArgs, JSType... parameterTypes) {
FunctionParamBuilder builder = new FunctionParamBuilder(this);
int max = parameterTypes.length - 1;
for (int i = 0; i <= max; i++) {
if (lastVarArgs && i == max) {
builder.addVarArgs(parameterTypes[i]);
} else {
builder.addRequiredParams(parameterTypes[i]);
}
}
return builder.build();
} }
|
public class class_name {
private Node createParameters(boolean lastVarArgs, JSType... parameterTypes) {
FunctionParamBuilder builder = new FunctionParamBuilder(this);
int max = parameterTypes.length - 1;
for (int i = 0; i <= max; i++) {
if (lastVarArgs && i == max) {
builder.addVarArgs(parameterTypes[i]); // depends on control dependency: [if], data = [none]
} else {
builder.addRequiredParams(parameterTypes[i]); // depends on control dependency: [if], data = [none]
}
}
return builder.build();
} }
|
public class class_name {
public void setPrev(Polygon prev) {
if(prev instanceof CFPolygon) {
setPrev((CFPolygon) prev);
}
else this.prev = prev;
} }
|
public class class_name {
public void setPrev(Polygon prev) {
if(prev instanceof CFPolygon) {
setPrev((CFPolygon) prev);
// depends on control dependency: [if], data = [none]
}
else this.prev = prev;
} }
|
public class class_name {
public String prettyHtml() {
StringBuilder html = new StringBuilder();
for (Change aDiff : getChangeList()) {
String text = aDiff.text.replace("&", "&")
.replace("<", "<")
.replace(">", ">")
.replace("\n", "¶<br>");
switch (aDiff.operation) {
case INSERT:
html.append("<ins style=\"background:#e6ffe6;\">").append(text)
.append("</ins>");
break;
case DELETE:
html.append("<del style=\"background:#ffe6e6;\">").append(text)
.append("</del>");
break;
case EQUAL:
html.append("<span>").append(text).append("</span>");
break;
}
}
return html.toString();
} }
|
public class class_name {
public String prettyHtml() {
StringBuilder html = new StringBuilder();
for (Change aDiff : getChangeList()) {
String text = aDiff.text.replace("&", "&")
.replace("<", "<") // depends on control dependency: [for], data = [none]
.replace(">", ">") // depends on control dependency: [for], data = [none]
.replace("\n", "¶<br>"); // depends on control dependency: [for], data = [none]
switch (aDiff.operation) {
case INSERT:
html.append("<ins style=\"background:#e6ffe6;\">").append(text)
.append("</ins>");
break;
case DELETE:
html.append("<del style=\"background:#ffe6e6;\">").append(text)
.append("</del>");
break;
case EQUAL:
html.append("<span>").append(text).append("</span>");
break;
}
}
return html.toString();
} }
|
public class class_name {
public static char[] unbox(final Character[] a, final char valueForNull) {
if (a == null) {
return null;
}
return unbox(a, 0, a.length, valueForNull);
} }
|
public class class_name {
public static char[] unbox(final Character[] a, final char valueForNull) {
if (a == null) {
return null;
// depends on control dependency: [if], data = [none]
}
return unbox(a, 0, a.length, valueForNull);
} }
|
public class class_name {
public String getIdentifier(String name) {
String upperCaseName = name.toUpperCase();
if (iso_reservedWords.contains(upperCaseName)) {
return getQuotedIdentifier(name);
}
if (reservedWords.contains(upperCaseName)) {
return getQuotedIdentifier(name);
}
return name;
} }
|
public class class_name {
public String getIdentifier(String name) {
String upperCaseName = name.toUpperCase();
if (iso_reservedWords.contains(upperCaseName)) {
return getQuotedIdentifier(name); // depends on control dependency: [if], data = [none]
}
if (reservedWords.contains(upperCaseName)) {
return getQuotedIdentifier(name); // depends on control dependency: [if], data = [none]
}
return name;
} }
|
public class class_name {
public static StrMatcher charSetMatcher(final String chars) {
if (StringUtils.isEmpty(chars)) {
return NONE_MATCHER;
}
if (chars.length() == 1) {
return new CharMatcher(chars.charAt(0));
}
return new CharSetMatcher(chars.toCharArray());
} }
|
public class class_name {
public static StrMatcher charSetMatcher(final String chars) {
if (StringUtils.isEmpty(chars)) {
return NONE_MATCHER; // depends on control dependency: [if], data = [none]
}
if (chars.length() == 1) {
return new CharMatcher(chars.charAt(0)); // depends on control dependency: [if], data = [none]
}
return new CharSetMatcher(chars.toCharArray());
} }
|
public class class_name {
private static boolean isAlgorithmSupported(final String algorithm) {
// Java 7 specific checks.
if (Runtime.class.getPackage() != null && Runtime.class.getPackage().getImplementationVersion() != null) {
if (Runtime.class.getPackage().getImplementationVersion().startsWith("1.7")) {
// Java 7 does not support the PBKDF2_SHA256_ALGORITHM.
if (algorithm != null && algorithm.equals(PBKDF2_SHA256_ALGORITHM)) {
return false;
}
}
}
return true;
} }
|
public class class_name {
private static boolean isAlgorithmSupported(final String algorithm) {
// Java 7 specific checks.
if (Runtime.class.getPackage() != null && Runtime.class.getPackage().getImplementationVersion() != null) {
if (Runtime.class.getPackage().getImplementationVersion().startsWith("1.7")) {
// Java 7 does not support the PBKDF2_SHA256_ALGORITHM.
if (algorithm != null && algorithm.equals(PBKDF2_SHA256_ALGORITHM)) {
return false;
// depends on control dependency: [if], data = [none]
}
}
}
return true;
} }
|
public class class_name {
private void injectEventListeners(final ServiceRegistry registry) {
EventListenerRegistry eventRegistry = registry
.getService(EventListenerRegistry.class);
List<PostInsertEventListener> postInsertEvents = locator
.getAllServices(PostInsertEventListener.class);
for (PostInsertEventListener piEventListener : postInsertEvents) {
logger.trace("Registering PostInsert: " + piEventListener
.getClass().getCanonicalName());
eventRegistry.appendListeners(EventType.POST_INSERT,
piEventListener);
}
List<PostUpdateEventListener> postUpdateEvents = locator
.getAllServices(PostUpdateEventListener.class);
for (PostUpdateEventListener puEventListener : postUpdateEvents) {
logger.trace("Registering PostUpdate: " + puEventListener
.getClass().getCanonicalName());
eventRegistry.appendListeners(EventType.POST_UPDATE,
puEventListener);
}
List<PostDeleteEventListener> postDeleteEvents = locator
.getAllServices(PostDeleteEventListener.class);
for (PostDeleteEventListener pdEventListener : postDeleteEvents) {
logger.trace("Registering PostDelete: " + pdEventListener
.getClass().getCanonicalName());
eventRegistry.appendListeners(EventType.POST_DELETE,
pdEventListener);
}
List<PreInsertEventListener> preInsertEvents = locator
.getAllServices(PreInsertEventListener.class);
for (PreInsertEventListener piEventListener : preInsertEvents) {
logger.trace("Registering PreInsert: " + piEventListener
.getClass().getCanonicalName());
eventRegistry.appendListeners(EventType.PRE_INSERT,
piEventListener);
}
List<PreUpdateEventListener> preUpdateEvents = locator
.getAllServices(PreUpdateEventListener.class);
for (PreUpdateEventListener puEventListener : preUpdateEvents) {
logger.trace("Registering PreUpdate: " + puEventListener
.getClass().getCanonicalName());
eventRegistry.appendListeners(EventType.PRE_UPDATE,
puEventListener);
}
List<PreDeleteEventListener> preDeleteEvents = locator
.getAllServices(PreDeleteEventListener.class);
for (PreDeleteEventListener pdEventListener : preDeleteEvents) {
logger.trace("Registering PreDelete: " + pdEventListener
.getClass().getCanonicalName());
eventRegistry.appendListeners(EventType.PRE_DELETE,
pdEventListener);
}
List<PostCommitInsertEventListener> pciEvents = locator
.getAllServices(PostCommitInsertEventListener.class);
for (PostCommitInsertEventListener cpiEventListener : pciEvents) {
logger.trace("Registering PostCommitInsert: " + cpiEventListener
.getClass().getCanonicalName());
eventRegistry.appendListeners(EventType.POST_COMMIT_INSERT,
cpiEventListener);
}
List<PostCommitUpdateEventListener> pcuEvents = locator
.getAllServices(PostCommitUpdateEventListener.class);
for (PostCommitUpdateEventListener cpuEventListener : pcuEvents) {
logger.trace("Registering PostCommitUpdate: " + cpuEventListener
.getClass().getCanonicalName());
eventRegistry.appendListeners(EventType.POST_COMMIT_UPDATE,
cpuEventListener);
}
List<PostCommitDeleteEventListener> pcdEvents = locator
.getAllServices(PostCommitDeleteEventListener.class);
for (PostCommitDeleteEventListener cpdEventListener : pcdEvents) {
logger.trace("Registering PostCommitDelete: " + cpdEventListener
.getClass().getCanonicalName());
eventRegistry.appendListeners(EventType.POST_COMMIT_DELETE,
cpdEventListener);
}
} }
|
public class class_name {
private void injectEventListeners(final ServiceRegistry registry) {
EventListenerRegistry eventRegistry = registry
.getService(EventListenerRegistry.class);
List<PostInsertEventListener> postInsertEvents = locator
.getAllServices(PostInsertEventListener.class);
for (PostInsertEventListener piEventListener : postInsertEvents) {
logger.trace("Registering PostInsert: " + piEventListener
.getClass().getCanonicalName()); // depends on control dependency: [for], data = [none]
eventRegistry.appendListeners(EventType.POST_INSERT,
piEventListener); // depends on control dependency: [for], data = [none]
}
List<PostUpdateEventListener> postUpdateEvents = locator
.getAllServices(PostUpdateEventListener.class);
for (PostUpdateEventListener puEventListener : postUpdateEvents) {
logger.trace("Registering PostUpdate: " + puEventListener
.getClass().getCanonicalName()); // depends on control dependency: [for], data = [none]
eventRegistry.appendListeners(EventType.POST_UPDATE,
puEventListener); // depends on control dependency: [for], data = [none]
}
List<PostDeleteEventListener> postDeleteEvents = locator
.getAllServices(PostDeleteEventListener.class);
for (PostDeleteEventListener pdEventListener : postDeleteEvents) {
logger.trace("Registering PostDelete: " + pdEventListener
.getClass().getCanonicalName()); // depends on control dependency: [for], data = [none]
eventRegistry.appendListeners(EventType.POST_DELETE,
pdEventListener); // depends on control dependency: [for], data = [none]
}
List<PreInsertEventListener> preInsertEvents = locator
.getAllServices(PreInsertEventListener.class);
for (PreInsertEventListener piEventListener : preInsertEvents) {
logger.trace("Registering PreInsert: " + piEventListener
.getClass().getCanonicalName()); // depends on control dependency: [for], data = [none]
eventRegistry.appendListeners(EventType.PRE_INSERT,
piEventListener); // depends on control dependency: [for], data = [none]
}
List<PreUpdateEventListener> preUpdateEvents = locator
.getAllServices(PreUpdateEventListener.class);
for (PreUpdateEventListener puEventListener : preUpdateEvents) {
logger.trace("Registering PreUpdate: " + puEventListener
.getClass().getCanonicalName()); // depends on control dependency: [for], data = [none]
eventRegistry.appendListeners(EventType.PRE_UPDATE,
puEventListener); // depends on control dependency: [for], data = [none]
}
List<PreDeleteEventListener> preDeleteEvents = locator
.getAllServices(PreDeleteEventListener.class);
for (PreDeleteEventListener pdEventListener : preDeleteEvents) {
logger.trace("Registering PreDelete: " + pdEventListener
.getClass().getCanonicalName()); // depends on control dependency: [for], data = [none]
eventRegistry.appendListeners(EventType.PRE_DELETE,
pdEventListener); // depends on control dependency: [for], data = [none]
}
List<PostCommitInsertEventListener> pciEvents = locator
.getAllServices(PostCommitInsertEventListener.class);
for (PostCommitInsertEventListener cpiEventListener : pciEvents) {
logger.trace("Registering PostCommitInsert: " + cpiEventListener
.getClass().getCanonicalName()); // depends on control dependency: [for], data = [none]
eventRegistry.appendListeners(EventType.POST_COMMIT_INSERT,
cpiEventListener); // depends on control dependency: [for], data = [none]
}
List<PostCommitUpdateEventListener> pcuEvents = locator
.getAllServices(PostCommitUpdateEventListener.class);
for (PostCommitUpdateEventListener cpuEventListener : pcuEvents) {
logger.trace("Registering PostCommitUpdate: " + cpuEventListener
.getClass().getCanonicalName()); // depends on control dependency: [for], data = [none]
eventRegistry.appendListeners(EventType.POST_COMMIT_UPDATE,
cpuEventListener); // depends on control dependency: [for], data = [none]
}
List<PostCommitDeleteEventListener> pcdEvents = locator
.getAllServices(PostCommitDeleteEventListener.class);
for (PostCommitDeleteEventListener cpdEventListener : pcdEvents) {
logger.trace("Registering PostCommitDelete: " + cpdEventListener
.getClass().getCanonicalName()); // depends on control dependency: [for], data = [none]
eventRegistry.appendListeners(EventType.POST_COMMIT_DELETE,
cpdEventListener); // depends on control dependency: [for], data = [none]
}
} }
|
public class class_name {
public static ClassNode lowestUpperBound(ClassNode a, ClassNode b) {
ClassNode lub = lowestUpperBound(a, b, null, null);
if (lub==null || !lub.isUsingGenerics()) return lub;
// types may be parameterized. If so, we must ensure that generic type arguments
// are made compatible
if (lub instanceof LowestUpperBoundClassNode) {
// no parent super class representing both types could be found
// or both class nodes implement common interfaces which may have
// been parameterized differently.
// We must create a classnode for which the "superclass" is potentially parameterized
// plus the interfaces
ClassNode superClass = lub.getSuperClass();
ClassNode psc = superClass.isUsingGenerics()?parameterizeLowestUpperBound(superClass, a, b, lub):superClass;
ClassNode[] interfaces = lub.getInterfaces();
ClassNode[] pinterfaces = new ClassNode[interfaces.length];
for (int i = 0, interfacesLength = interfaces.length; i < interfacesLength; i++) {
final ClassNode icn = interfaces[i];
if (icn.isUsingGenerics()) {
pinterfaces[i] = parameterizeLowestUpperBound(icn, a, b, lub);
} else {
pinterfaces[i] = icn;
}
}
return new LowestUpperBoundClassNode(((LowestUpperBoundClassNode)lub).name, psc, pinterfaces);
} else {
return parameterizeLowestUpperBound(lub, a, b, lub);
}
} }
|
public class class_name {
public static ClassNode lowestUpperBound(ClassNode a, ClassNode b) {
ClassNode lub = lowestUpperBound(a, b, null, null);
if (lub==null || !lub.isUsingGenerics()) return lub;
// types may be parameterized. If so, we must ensure that generic type arguments
// are made compatible
if (lub instanceof LowestUpperBoundClassNode) {
// no parent super class representing both types could be found
// or both class nodes implement common interfaces which may have
// been parameterized differently.
// We must create a classnode for which the "superclass" is potentially parameterized
// plus the interfaces
ClassNode superClass = lub.getSuperClass();
ClassNode psc = superClass.isUsingGenerics()?parameterizeLowestUpperBound(superClass, a, b, lub):superClass;
ClassNode[] interfaces = lub.getInterfaces();
ClassNode[] pinterfaces = new ClassNode[interfaces.length];
for (int i = 0, interfacesLength = interfaces.length; i < interfacesLength; i++) {
final ClassNode icn = interfaces[i];
if (icn.isUsingGenerics()) {
pinterfaces[i] = parameterizeLowestUpperBound(icn, a, b, lub); // depends on control dependency: [if], data = [none]
} else {
pinterfaces[i] = icn; // depends on control dependency: [if], data = [none]
}
}
return new LowestUpperBoundClassNode(((LowestUpperBoundClassNode)lub).name, psc, pinterfaces); // depends on control dependency: [if], data = [none]
} else {
return parameterizeLowestUpperBound(lub, a, b, lub); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public EClass getIfcUnitaryEquipmentType() {
if (ifcUnitaryEquipmentTypeEClass == null) {
ifcUnitaryEquipmentTypeEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI)
.getEClassifiers().get(630);
}
return ifcUnitaryEquipmentTypeEClass;
} }
|
public class class_name {
public EClass getIfcUnitaryEquipmentType() {
if (ifcUnitaryEquipmentTypeEClass == null) {
ifcUnitaryEquipmentTypeEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(Ifc2x3tc1Package.eNS_URI)
.getEClassifiers().get(630);
// depends on control dependency: [if], data = [none]
}
return ifcUnitaryEquipmentTypeEClass;
} }
|
public class class_name {
public InternalDocumentRevision getCurrentRevision() {
for(DocumentRevisionNode n : leafs) {
if(n.getData().isCurrent()) {
return n.getData();
}
}
throw new IllegalStateException("No current revision found.");
} }
|
public class class_name {
public InternalDocumentRevision getCurrentRevision() {
for(DocumentRevisionNode n : leafs) {
if(n.getData().isCurrent()) {
return n.getData(); // depends on control dependency: [if], data = [none]
}
}
throw new IllegalStateException("No current revision found.");
} }
|
public class class_name {
public static boolean validLocale(final Locale locale) {
for (final Locale found : Locale.getAvailableLocales()) {
if (found.equals(locale)) {
return true;
}
}
return false;
} }
|
public class class_name {
public static boolean validLocale(final Locale locale) {
for (final Locale found : Locale.getAvailableLocales()) {
if (found.equals(locale)) {
return true;
// depends on control dependency: [if], data = [none]
}
}
return false;
} }
|
public class class_name {
public CmsInheritedContainerState getInheritedContainerState(CmsObject cms, CmsResource resource, String name) {
String rootPath = resource.getRootPath();
if (!resource.isFolder()) {
rootPath = CmsResource.getParentFolder(rootPath);
}
CmsInheritedContainerState result = new CmsInheritedContainerState();
boolean online = isOnline(cms);
CmsContainerConfigurationCache cache = online
? m_onlineContainerConfigurationCache
: m_offlineContainerConfigurationCache;
result.addConfigurations(cache, rootPath, name);
return result;
} }
|
public class class_name {
public CmsInheritedContainerState getInheritedContainerState(CmsObject cms, CmsResource resource, String name) {
String rootPath = resource.getRootPath();
if (!resource.isFolder()) {
rootPath = CmsResource.getParentFolder(rootPath); // depends on control dependency: [if], data = [none]
}
CmsInheritedContainerState result = new CmsInheritedContainerState();
boolean online = isOnline(cms);
CmsContainerConfigurationCache cache = online
? m_onlineContainerConfigurationCache
: m_offlineContainerConfigurationCache;
result.addConfigurations(cache, rootPath, name);
return result;
} }
|
public class class_name {
@Override
public String doTransformSql(final SqlContext sqlContext, final String sql) {
if (getFilters().isEmpty()) {
return sql;
}
String newSql = sql;
for (final SqlFilter filter : getFilters()) {
newSql = filter.doTransformSql(sqlContext, newSql);
}
return newSql;
} }
|
public class class_name {
@Override
public String doTransformSql(final SqlContext sqlContext, final String sql) {
if (getFilters().isEmpty()) {
return sql; // depends on control dependency: [if], data = [none]
}
String newSql = sql;
for (final SqlFilter filter : getFilters()) {
newSql = filter.doTransformSql(sqlContext, newSql); // depends on control dependency: [for], data = [filter]
}
return newSql;
} }
|
public class class_name {
public Element toElement(JdbcDatastore datastore) {
final Element ds = getDocument().createElement("jdbc-datastore");
ds.setAttribute("name", datastore.getName());
if (!StringUtils.isNullOrEmpty(datastore.getDescription())) {
ds.setAttribute("description", datastore.getDescription());
}
String jndiUrl = datastore.getDatasourceJndiUrl();
if (Strings.isNullOrEmpty(jndiUrl)) {
appendElement(ds, "url", datastore.getJdbcUrl());
appendElement(ds, "driver", datastore.getDriverClass());
appendElement(ds, "username", datastore.getUsername());
appendElement(ds, "password", datastore.getPassword());
appendElement(ds, "multiple-connections", datastore.isMultipleConnections() + "");
} else {
appendElement(ds, "datasource-jndi-url", jndiUrl);
}
final TableType[] tableTypes = datastore.getTableTypes();
if (tableTypes != null && tableTypes.length != 0 && !Arrays.equals(TableType.DEFAULT_TABLE_TYPES, tableTypes)) {
final Element tableTypesElement = getDocument().createElement("table-types");
ds.appendChild(tableTypesElement);
for (final TableType tableType : tableTypes) {
appendElement(tableTypesElement, "table-type", tableType.name());
}
}
final String catalogName = datastore.getCatalogName();
if (!Strings.isNullOrEmpty(catalogName)) {
appendElement(ds, "catalog-name", catalogName);
}
return ds;
} }
|
public class class_name {
public Element toElement(JdbcDatastore datastore) {
final Element ds = getDocument().createElement("jdbc-datastore");
ds.setAttribute("name", datastore.getName());
if (!StringUtils.isNullOrEmpty(datastore.getDescription())) {
ds.setAttribute("description", datastore.getDescription()); // depends on control dependency: [if], data = [none]
}
String jndiUrl = datastore.getDatasourceJndiUrl();
if (Strings.isNullOrEmpty(jndiUrl)) {
appendElement(ds, "url", datastore.getJdbcUrl()); // depends on control dependency: [if], data = [none]
appendElement(ds, "driver", datastore.getDriverClass()); // depends on control dependency: [if], data = [none]
appendElement(ds, "username", datastore.getUsername()); // depends on control dependency: [if], data = [none]
appendElement(ds, "password", datastore.getPassword()); // depends on control dependency: [if], data = [none]
appendElement(ds, "multiple-connections", datastore.isMultipleConnections() + ""); // depends on control dependency: [if], data = [none]
} else {
appendElement(ds, "datasource-jndi-url", jndiUrl); // depends on control dependency: [if], data = [none]
}
final TableType[] tableTypes = datastore.getTableTypes();
if (tableTypes != null && tableTypes.length != 0 && !Arrays.equals(TableType.DEFAULT_TABLE_TYPES, tableTypes)) {
final Element tableTypesElement = getDocument().createElement("table-types");
ds.appendChild(tableTypesElement); // depends on control dependency: [if], data = [(tableTypes]
for (final TableType tableType : tableTypes) {
appendElement(tableTypesElement, "table-type", tableType.name()); // depends on control dependency: [for], data = [tableType]
}
}
final String catalogName = datastore.getCatalogName();
if (!Strings.isNullOrEmpty(catalogName)) {
appendElement(ds, "catalog-name", catalogName); // depends on control dependency: [if], data = [none]
}
return ds;
} }
|
public class class_name {
protected final FilePath preferredLocation(ToolInstallation tool, Node node) {
if (node == null) {
throw new IllegalArgumentException("must pass non-null node");
}
String home = Util.fixEmptyAndTrim(tool.getHome());
if (home == null) {
home = sanitize(tool.getDescriptor().getId()) + File.separatorChar + sanitize(tool.getName());
}
FilePath root = node.getRootPath();
if (root == null) {
throw new IllegalArgumentException("Node " + node.getDisplayName() + " seems to be offline");
}
return root.child("tools").child(home);
} }
|
public class class_name {
protected final FilePath preferredLocation(ToolInstallation tool, Node node) {
if (node == null) {
throw new IllegalArgumentException("must pass non-null node");
}
String home = Util.fixEmptyAndTrim(tool.getHome());
if (home == null) {
home = sanitize(tool.getDescriptor().getId()) + File.separatorChar + sanitize(tool.getName()); // depends on control dependency: [if], data = [none]
}
FilePath root = node.getRootPath();
if (root == null) {
throw new IllegalArgumentException("Node " + node.getDisplayName() + " seems to be offline");
}
return root.child("tools").child(home);
} }
|
public class class_name {
private void dynamicallyCreateDestination() {
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled())
SibTr.entry(this, TRACE, "dynamicallyCreateDestination");
if (_destination != null)
return;
// Can we create a new destination object?
if (_destinationType != null && _destinationName != null) {
try {
if (_destinationType.equals(QUEUE)) {
_destination = com.ibm.websphere.sib.api.jms.JmsFactoryFactory.getInstance().createQueue(_destinationName);
if (TraceComponent.isAnyTracingEnabled() && TRACE.isDebugEnabled())
SibTr.debug(this, TRACE, "Dynamically created queue:" + _destination);
} else if (_destinationType.equals(TOPIC)) {
_destination = com.ibm.websphere.sib.api.jms.JmsFactoryFactory.getInstance().createTopic(_destinationName);
if (TraceComponent.isAnyTracingEnabled() && TRACE.isDebugEnabled())
SibTr.debug(this, TRACE, "Dynamically created topic:" + _destination);
}
} catch (javax.jms.JMSException e) {
FFDCFilter.processException(e, CLASS_NAME, FFDC_PROBE_4);
if (TraceComponent.isAnyTracingEnabled() && TRACE.isDebugEnabled())
SibTr.exception(this, TRACE, e);
}
}
// If we have a destination object do we need to set additional properties on it?
if (_destination != null) {
try {
if (_destinationType.equals(TOPIC)) {
if (_topicSpace != null) {
((JmsTopic) _destination).setTopicSpace(_topicSpace);
if (TraceComponent.isAnyTracingEnabled() && TRACE.isDebugEnabled())
SibTr.debug(this, TRACE, "Set topicSpace on destination");
}
}
} catch (javax.jms.JMSException e) {
FFDCFilter.processException(e, CLASS_NAME, FFDC_PROBE_5);
if (TraceComponent.isAnyTracingEnabled() && TRACE.isDebugEnabled())
SibTr.exception(this, TRACE, e);
}
}
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled())
SibTr.exit(this, TRACE, "dynamicallyCreateDestination");
} }
|
public class class_name {
private void dynamicallyCreateDestination() {
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled())
SibTr.entry(this, TRACE, "dynamicallyCreateDestination");
if (_destination != null)
return;
// Can we create a new destination object?
if (_destinationType != null && _destinationName != null) {
try {
if (_destinationType.equals(QUEUE)) {
_destination = com.ibm.websphere.sib.api.jms.JmsFactoryFactory.getInstance().createQueue(_destinationName); // depends on control dependency: [if], data = [none]
if (TraceComponent.isAnyTracingEnabled() && TRACE.isDebugEnabled())
SibTr.debug(this, TRACE, "Dynamically created queue:" + _destination);
} else if (_destinationType.equals(TOPIC)) {
_destination = com.ibm.websphere.sib.api.jms.JmsFactoryFactory.getInstance().createTopic(_destinationName); // depends on control dependency: [if], data = [none]
if (TraceComponent.isAnyTracingEnabled() && TRACE.isDebugEnabled())
SibTr.debug(this, TRACE, "Dynamically created topic:" + _destination);
}
} catch (javax.jms.JMSException e) {
FFDCFilter.processException(e, CLASS_NAME, FFDC_PROBE_4);
if (TraceComponent.isAnyTracingEnabled() && TRACE.isDebugEnabled())
SibTr.exception(this, TRACE, e);
} // depends on control dependency: [catch], data = [none]
}
// If we have a destination object do we need to set additional properties on it?
if (_destination != null) {
try {
if (_destinationType.equals(TOPIC)) {
if (_topicSpace != null) {
((JmsTopic) _destination).setTopicSpace(_topicSpace); // depends on control dependency: [if], data = [(_topicSpace]
if (TraceComponent.isAnyTracingEnabled() && TRACE.isDebugEnabled())
SibTr.debug(this, TRACE, "Set topicSpace on destination");
}
}
} catch (javax.jms.JMSException e) {
FFDCFilter.processException(e, CLASS_NAME, FFDC_PROBE_5);
if (TraceComponent.isAnyTracingEnabled() && TRACE.isDebugEnabled())
SibTr.exception(this, TRACE, e);
} // depends on control dependency: [catch], data = [none]
}
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled())
SibTr.exit(this, TRACE, "dynamicallyCreateDestination");
} }
|
public class class_name {
protected Object unmarshalDomSource(DOMSource domSource) throws XmlMappingException {
if (domSource.getNode() == null) {
try {
synchronized (this.documentBuilderFactoryMonitor) {
if (this.documentBuilderFactory == null) {
this.documentBuilderFactory = createDocumentBuilderFactory();
}
}
DocumentBuilder documentBuilder = createDocumentBuilder(this.documentBuilderFactory);
domSource.setNode(documentBuilder.newDocument());
}
catch (ParserConfigurationException ex) {
throw new UnmarshallingFailureException(
"Could not create document placeholder for DOMSource: " + ex.getMessage(), ex);
}
}
return unmarshalDomNode(domSource.getNode());
} }
|
public class class_name {
protected Object unmarshalDomSource(DOMSource domSource) throws XmlMappingException {
if (domSource.getNode() == null) {
try {
synchronized (this.documentBuilderFactoryMonitor) {
if (this.documentBuilderFactory == null) {
this.documentBuilderFactory = createDocumentBuilderFactory(); // depends on control dependency: [if], data = [none]
}
}
DocumentBuilder documentBuilder = createDocumentBuilder(this.documentBuilderFactory);
domSource.setNode(documentBuilder.newDocument());
}
catch (ParserConfigurationException ex) {
throw new UnmarshallingFailureException(
"Could not create document placeholder for DOMSource: " + ex.getMessage(), ex);
}
}
return unmarshalDomNode(domSource.getNode());
} }
|
public class class_name {
static Flake createFlake(float xRange, Bitmap originalBitmap) {
Flake flake = new Flake();
// Size each flake with a width between 5 and 55 and a proportional height
flake.width = (int)(5 + (float)Math.random() * 50);
float hwRatio = originalBitmap.getHeight() / originalBitmap.getWidth();
flake.height = (int)(flake.width * hwRatio);
// Position the flake horizontally between the left and right of the range
flake.x = (float)Math.random() * (xRange - flake.width);
// Position the flake vertically slightly off the top of the display
flake.y = 0 - (flake.height + (float)Math.random() * flake.height);
// Each flake travels at 50-200 pixels per second
flake.speed = 50 + (float) Math.random() * 150;
// Flakes start at -90 to 90 degrees rotation, and rotate between -45 and 45
// degrees per second
flake.rotation = (float) Math.random() * 180 - 90;
flake.rotationSpeed = (float) Math.random() * 90 - 45;
// Get the cached bitmap for this size if it exists, otherwise create and cache one
flake.bitmap = bitmapMap.get(flake.width);
if (flake.bitmap == null) {
flake.bitmap = Bitmap.createScaledBitmap(originalBitmap,
(int)flake.width, (int)flake.height, true);
bitmapMap.put(flake.width, flake.bitmap);
}
return flake;
} }
|
public class class_name {
static Flake createFlake(float xRange, Bitmap originalBitmap) {
Flake flake = new Flake();
// Size each flake with a width between 5 and 55 and a proportional height
flake.width = (int)(5 + (float)Math.random() * 50);
float hwRatio = originalBitmap.getHeight() / originalBitmap.getWidth();
flake.height = (int)(flake.width * hwRatio);
// Position the flake horizontally between the left and right of the range
flake.x = (float)Math.random() * (xRange - flake.width);
// Position the flake vertically slightly off the top of the display
flake.y = 0 - (flake.height + (float)Math.random() * flake.height);
// Each flake travels at 50-200 pixels per second
flake.speed = 50 + (float) Math.random() * 150;
// Flakes start at -90 to 90 degrees rotation, and rotate between -45 and 45
// degrees per second
flake.rotation = (float) Math.random() * 180 - 90;
flake.rotationSpeed = (float) Math.random() * 90 - 45;
// Get the cached bitmap for this size if it exists, otherwise create and cache one
flake.bitmap = bitmapMap.get(flake.width);
if (flake.bitmap == null) {
flake.bitmap = Bitmap.createScaledBitmap(originalBitmap,
(int)flake.width, (int)flake.height, true); // depends on control dependency: [if], data = [none]
bitmapMap.put(flake.width, flake.bitmap); // depends on control dependency: [if], data = [none]
}
return flake;
} }
|
public class class_name {
private boolean executePreStepCommand(String topLevelFolder) {
String[] command;
if (DependencyCollector.isWindows()) {
command = getCommand(COMPOSER_BAT);
} else {
command = getCommand(COMPOSER);
}
String commandString = String.join(Constants.WHITESPACE, command);
File file = new File(topLevelFolder + FORWARD_SLASH + COMPOSER_JSON);
CommandLineProcess composerInstall = null;
if (file.exists()) {
logger.info("Running install command : {}", commandString);
composerInstall = new CommandLineProcess(topLevelFolder, command);
}
try {
composerInstall.executeProcessWithoutOutput();
} catch (IOException e) {
logger.warn("Could not run {} in folder {} : {}", commandString, topLevelFolder, e.getMessage());
return true;
}
return composerInstall.isErrorInProcess();
} }
|
public class class_name {
private boolean executePreStepCommand(String topLevelFolder) {
String[] command;
if (DependencyCollector.isWindows()) {
command = getCommand(COMPOSER_BAT); // depends on control dependency: [if], data = [none]
} else {
command = getCommand(COMPOSER); // depends on control dependency: [if], data = [none]
}
String commandString = String.join(Constants.WHITESPACE, command);
File file = new File(topLevelFolder + FORWARD_SLASH + COMPOSER_JSON);
CommandLineProcess composerInstall = null;
if (file.exists()) {
logger.info("Running install command : {}", commandString);
composerInstall = new CommandLineProcess(topLevelFolder, command);
}
try {
composerInstall.executeProcessWithoutOutput();
} catch (IOException e) {
logger.warn("Could not run {} in folder {} : {}", commandString, topLevelFolder, e.getMessage());
return true;
}
return composerInstall.isErrorInProcess();
} }
|
public class class_name {
public static boolean isPossibleExample(CcgParser parser, CcgExample example) {
CcgBeamSearchChart chart = new CcgBeamSearchChart(example.getSentence(), Integer.MAX_VALUE, 100);
SyntacticChartCost filter = SyntacticChartCost.createAgreementCost(example.getSyntacticParse());
parser.parseCommon(chart, example.getSentence(), filter, null, -1, 1);
List<CcgParse> parses = chart.decodeBestParsesForSpan(0, example.getSentence().size() - 1, 100, parser);
if (parses.size() == 0) {
// Provide a deeper analysis of why parsing failed.
analyzeParseFailure(example.getSyntacticParse(), chart, parser.getSyntaxVarType(), "Parse failure", 0);
System.out.println("Discarding example: " + example);
return false;
} else if (parses.size() > 1) {
analyzeParseFailure(example.getSyntacticParse(), chart, parser.getSyntaxVarType(), "Parse duplication", 2);
System.out.println("Duplicate correct parse: " + example.getSyntacticParse());
}
return true;
} }
|
public class class_name {
public static boolean isPossibleExample(CcgParser parser, CcgExample example) {
CcgBeamSearchChart chart = new CcgBeamSearchChart(example.getSentence(), Integer.MAX_VALUE, 100);
SyntacticChartCost filter = SyntacticChartCost.createAgreementCost(example.getSyntacticParse());
parser.parseCommon(chart, example.getSentence(), filter, null, -1, 1);
List<CcgParse> parses = chart.decodeBestParsesForSpan(0, example.getSentence().size() - 1, 100, parser);
if (parses.size() == 0) {
// Provide a deeper analysis of why parsing failed.
analyzeParseFailure(example.getSyntacticParse(), chart, parser.getSyntaxVarType(), "Parse failure", 0); // depends on control dependency: [if], data = [0)]
System.out.println("Discarding example: " + example); // depends on control dependency: [if], data = [none]
return false; // depends on control dependency: [if], data = [none]
} else if (parses.size() > 1) {
analyzeParseFailure(example.getSyntacticParse(), chart, parser.getSyntaxVarType(), "Parse duplication", 2); // depends on control dependency: [if], data = [none]
System.out.println("Duplicate correct parse: " + example.getSyntacticParse()); // depends on control dependency: [if], data = [none]
}
return true;
} }
|
public class class_name {
private void unlinkLast(Node<E> last, Node<E> prev) {
// assert last != null;
// assert prev != null;
// assert last.item == null;
for (Node<E> o = null, p = prev, q;;) {
if (p.item != null || (q = p.prev) == null) {
if (o != null && p.next != p &&
PREV.compareAndSet(last, prev, p)) {
skipDeletedSuccessors(p);
if (last.next == null &&
(p.prev == null || p.item != null) &&
p.next == last) {
updateHead(); // Ensure o is not reachable from head
updateTail(); // Ensure o is not reachable from tail
// Finally, actually gc-unlink
PREV.setRelease(o, o);
NEXT.setRelease(o, nextTerminator());
}
}
return;
}
else if (p == q)
return;
else {
o = p;
p = q;
}
}
} }
|
public class class_name {
private void unlinkLast(Node<E> last, Node<E> prev) {
// assert last != null;
// assert prev != null;
// assert last.item == null;
for (Node<E> o = null, p = prev, q;;) {
if (p.item != null || (q = p.prev) == null) {
if (o != null && p.next != p &&
PREV.compareAndSet(last, prev, p)) {
skipDeletedSuccessors(p); // depends on control dependency: [if], data = [none]
if (last.next == null &&
(p.prev == null || p.item != null) &&
p.next == last) {
updateHead(); // Ensure o is not reachable from head // depends on control dependency: [if], data = [none]
updateTail(); // Ensure o is not reachable from tail // depends on control dependency: [if], data = [none]
// Finally, actually gc-unlink
PREV.setRelease(o, o); // depends on control dependency: [if], data = [none]
NEXT.setRelease(o, nextTerminator()); // depends on control dependency: [if], data = [none]
}
}
return; // depends on control dependency: [if], data = [none]
}
else if (p == q)
return;
else {
o = p; // depends on control dependency: [if], data = [none]
p = q; // depends on control dependency: [if], data = [none]
}
}
} }
|
public class class_name {
private boolean enqueueLocked(Reference<? extends T> r) {
// Verify the reference has not already been enqueued.
if (r.queueNext != null) {
return false;
}
/* J2ObjC removed.
if (r instanceof Cleaner) {
// If this reference is a Cleaner, then simply invoke the clean method instead
// of enqueueing it in the queue. Cleaners are associated with dummy queues that
// are never polled and objects are never enqueued on them.
Cleaner cl = (sun.misc.Cleaner) r;
cl.clean();
// Update queueNext to indicate that the reference has been
// enqueued, but is now removed from the queue.
r.queueNext = sQueueNextUnenqueued;
return true;
}
*/
if (tail == null) {
head = r;
} else {
tail.queueNext = r;
}
tail = r;
tail.queueNext = SENTINEL;
return true;
} }
|
public class class_name {
private boolean enqueueLocked(Reference<? extends T> r) {
// Verify the reference has not already been enqueued.
if (r.queueNext != null) {
return false; // depends on control dependency: [if], data = [none]
}
/* J2ObjC removed.
if (r instanceof Cleaner) {
// If this reference is a Cleaner, then simply invoke the clean method instead
// of enqueueing it in the queue. Cleaners are associated with dummy queues that
// are never polled and objects are never enqueued on them.
Cleaner cl = (sun.misc.Cleaner) r;
cl.clean();
// Update queueNext to indicate that the reference has been
// enqueued, but is now removed from the queue.
r.queueNext = sQueueNextUnenqueued;
return true;
}
*/
if (tail == null) {
head = r; // depends on control dependency: [if], data = [none]
} else {
tail.queueNext = r; // depends on control dependency: [if], data = [none]
}
tail = r;
tail.queueNext = SENTINEL;
return true;
} }
|
public class class_name {
@Override
public boolean isAuditRequired(String eventType, String outcome) {
// TODO: need to handle auditData
for (Map.Entry<String, List<Map<String, Object>>> handlerMap : handlerEventsMap.entrySet()) {
List<Map<String, Object>> handlerEventsList = handlerMap.getValue();
if (handlerEventsList.isEmpty()) {
if (tc.isDebugEnabled()) {
Tr.debug(tc, "handlerEventsList is empty, returning true for isAuditRequired");
}
return true;
}
for (Map<String, Object> handlerEvents : handlerEventsList) {
if (handlerEvents.isEmpty()) {
if (tc.isDebugEnabled()) {
Tr.debug(tc, "no events or outcomes specified, all events and outcomes are honoured");
}
return true;
} else {
boolean foundMatchingEvent = false;
boolean foundAnOutcome = false;
boolean foundMatchingEventAndOutcome = false;
for (Entry<String, Object> entry : handlerEvents.entrySet()) {
if (entry.getKey().equals(AuditConstants.EVENT_NAME) && entry.getValue().equals(eventType)) {
foundMatchingEvent = true;
} else {
if (entry.getKey().equals(AuditConstants.OUTCOME)) {
foundAnOutcome = true;
if (entry.getValue().toString().equalsIgnoreCase(outcome)) {
if (foundMatchingEvent) {
foundMatchingEventAndOutcome = true;
}
}
}
}
}
if (foundMatchingEventAndOutcome || (foundMatchingEvent && !foundAnOutcome)) {
return true;
}
}
}
}
return false;
} }
|
public class class_name {
@Override
public boolean isAuditRequired(String eventType, String outcome) {
// TODO: need to handle auditData
for (Map.Entry<String, List<Map<String, Object>>> handlerMap : handlerEventsMap.entrySet()) {
List<Map<String, Object>> handlerEventsList = handlerMap.getValue();
if (handlerEventsList.isEmpty()) {
if (tc.isDebugEnabled()) {
Tr.debug(tc, "handlerEventsList is empty, returning true for isAuditRequired"); // depends on control dependency: [if], data = [none]
}
return true; // depends on control dependency: [if], data = [none]
}
for (Map<String, Object> handlerEvents : handlerEventsList) {
if (handlerEvents.isEmpty()) {
if (tc.isDebugEnabled()) {
Tr.debug(tc, "no events or outcomes specified, all events and outcomes are honoured"); // depends on control dependency: [if], data = [none]
}
return true; // depends on control dependency: [if], data = [none]
} else {
boolean foundMatchingEvent = false;
boolean foundAnOutcome = false;
boolean foundMatchingEventAndOutcome = false;
for (Entry<String, Object> entry : handlerEvents.entrySet()) {
if (entry.getKey().equals(AuditConstants.EVENT_NAME) && entry.getValue().equals(eventType)) {
foundMatchingEvent = true; // depends on control dependency: [if], data = [none]
} else {
if (entry.getKey().equals(AuditConstants.OUTCOME)) {
foundAnOutcome = true; // depends on control dependency: [if], data = [none]
if (entry.getValue().toString().equalsIgnoreCase(outcome)) {
if (foundMatchingEvent) {
foundMatchingEventAndOutcome = true; // depends on control dependency: [if], data = [none]
}
}
}
}
}
if (foundMatchingEventAndOutcome || (foundMatchingEvent && !foundAnOutcome)) {
return true; // depends on control dependency: [if], data = [none]
}
}
}
}
return false;
} }
|
public class class_name {
protected boolean isFirstVisit(Object expression) {
if (visited.contains(expression)) {
return false;
}
visited.add(expression);
return true;
} }
|
public class class_name {
protected boolean isFirstVisit(Object expression) {
if (visited.contains(expression)) {
return false;
// depends on control dependency: [if], data = [none]
}
visited.add(expression);
return true;
} }
|
public class class_name {
public static DMatrixRMaj nullVector(SingularValueDecomposition_F64<DMatrixRMaj> svd ,
boolean isRight ,
DMatrixRMaj nullVector )
{
int N = svd.numberOfSingularValues();
double s[] = svd.getSingularValues();
DMatrixRMaj A = isRight ? svd.getV(null,true) : svd.getU(null,false);
if( isRight ) {
if( A.numRows != svd.numCols() ) {
throw new IllegalArgumentException("Can't compute the null space using a compact SVD for a matrix of this size.");
}
if( nullVector == null ) {
nullVector = new DMatrixRMaj(svd.numCols(),1);
} else {
nullVector.reshape(svd.numCols(),1);
}
} else {
if (A.numCols != svd.numRows()) {
throw new IllegalArgumentException("Can't compute the null space using a compact SVD for a matrix of this size.");
}
if (nullVector == null) {
nullVector = new DMatrixRMaj(svd.numRows(), 1);
} else {
nullVector.reshape(svd.numRows(), 1);
}
}
int smallestIndex = -1;
if( isRight && svd.numCols() > svd.numRows() )
smallestIndex = svd.numCols()-1;
else if( !isRight && svd.numCols() < svd.numRows() )
smallestIndex = svd.numRows()-1;
else {
// find the smallest singular value
double smallestValue = Double.MAX_VALUE;
for( int i = 0; i < N; i++ ) {
if( s[i] < smallestValue ) {
smallestValue = s[i];
smallestIndex = i;
}
}
}
// extract the null space
if( isRight )
SpecializedOps_DDRM.subvector(A,smallestIndex,0,A.numRows,true,0,nullVector);
else
SpecializedOps_DDRM.subvector(A,0,smallestIndex,A.numRows,false,0,nullVector);
return nullVector;
} }
|
public class class_name {
public static DMatrixRMaj nullVector(SingularValueDecomposition_F64<DMatrixRMaj> svd ,
boolean isRight ,
DMatrixRMaj nullVector )
{
int N = svd.numberOfSingularValues();
double s[] = svd.getSingularValues();
DMatrixRMaj A = isRight ? svd.getV(null,true) : svd.getU(null,false);
if( isRight ) {
if( A.numRows != svd.numCols() ) {
throw new IllegalArgumentException("Can't compute the null space using a compact SVD for a matrix of this size.");
}
if( nullVector == null ) {
nullVector = new DMatrixRMaj(svd.numCols(),1);
} else {
nullVector.reshape(svd.numCols(),1);
}
} else {
if (A.numCols != svd.numRows()) {
throw new IllegalArgumentException("Can't compute the null space using a compact SVD for a matrix of this size.");
}
if (nullVector == null) {
nullVector = new DMatrixRMaj(svd.numRows(), 1); // depends on control dependency: [if], data = [none]
} else {
nullVector.reshape(svd.numRows(), 1); // depends on control dependency: [if], data = [none]
}
}
int smallestIndex = -1;
if( isRight && svd.numCols() > svd.numRows() )
smallestIndex = svd.numCols()-1;
else if( !isRight && svd.numCols() < svd.numRows() )
smallestIndex = svd.numRows()-1;
else {
// find the smallest singular value
double smallestValue = Double.MAX_VALUE;
for( int i = 0; i < N; i++ ) {
if( s[i] < smallestValue ) {
smallestValue = s[i]; // depends on control dependency: [if], data = [none]
smallestIndex = i; // depends on control dependency: [if], data = [none]
}
}
}
// extract the null space
if( isRight )
SpecializedOps_DDRM.subvector(A,smallestIndex,0,A.numRows,true,0,nullVector);
else
SpecializedOps_DDRM.subvector(A,0,smallestIndex,A.numRows,false,0,nullVector);
return nullVector;
} }
|
public class class_name {
@Nullable
public static <T> DbMapper<T> findOrResolveMapperByType(@NotNull Class<T> type, @Nullable Map<Class, DbMapper> registeredMappers) {
DbMapper<T> mapper = registeredMappers == null ? null : registeredMappers.get(type);
if (mapper == null) {
// search for a field marked as mapper with valid parameter type
for (Field f : type.getDeclaredFields()) {
int mods = f.getModifiers();
if (Modifier.isStatic(mods) && Modifier.isPublic(mods) && Modifier.isFinal(mods) && f.getType().isAssignableFrom(DbMapper.class)) {
AnnotatedType at = f.getAnnotatedType();
if (at instanceof AnnotatedParameterizedType) {
AnnotatedParameterizedType apt = (AnnotatedParameterizedType) at;
AnnotatedType[] args = apt.getAnnotatedActualTypeArguments();
if (args.length == 1 && args[0].getType() == type) {
Mapper a = f.getAnnotation(Mapper.class);
if (a != null) {
try {
//noinspection unchecked
mapper = (DbMapper<T>) f.get(type);
if (mapper == null) {
throw new IllegalArgumentException("Mapper must not be null: " + f);
}
} catch (IllegalAccessException ignored) { // already checked for 'isPublic' before
}
if (registeredMappers != null) {
if (registeredMappers.containsKey(type)) {
throw new IllegalArgumentException("Found multiple mappers per type: m1: " + mapper + ", m2: " + registeredMappers.get(type));
}
registeredMappers.put(type, mapper);
}
}
}
}
} else {
if (f.getAnnotation(Mapper.class) != null) {
throw new IllegalArgumentException("@Mapper field must be public, static final and have valid parametrized type type: " + f);
}
}
}
}
return mapper;
} }
|
public class class_name {
@Nullable
public static <T> DbMapper<T> findOrResolveMapperByType(@NotNull Class<T> type, @Nullable Map<Class, DbMapper> registeredMappers) {
DbMapper<T> mapper = registeredMappers == null ? null : registeredMappers.get(type);
if (mapper == null) {
// search for a field marked as mapper with valid parameter type
for (Field f : type.getDeclaredFields()) {
int mods = f.getModifiers();
if (Modifier.isStatic(mods) && Modifier.isPublic(mods) && Modifier.isFinal(mods) && f.getType().isAssignableFrom(DbMapper.class)) {
AnnotatedType at = f.getAnnotatedType();
if (at instanceof AnnotatedParameterizedType) {
AnnotatedParameterizedType apt = (AnnotatedParameterizedType) at;
AnnotatedType[] args = apt.getAnnotatedActualTypeArguments();
if (args.length == 1 && args[0].getType() == type) {
Mapper a = f.getAnnotation(Mapper.class);
if (a != null) {
try {
//noinspection unchecked
mapper = (DbMapper<T>) f.get(type); // depends on control dependency: [try], data = [none]
if (mapper == null) {
throw new IllegalArgumentException("Mapper must not be null: " + f);
}
} catch (IllegalAccessException ignored) { // already checked for 'isPublic' before
} // depends on control dependency: [catch], data = [none]
if (registeredMappers != null) {
if (registeredMappers.containsKey(type)) {
throw new IllegalArgumentException("Found multiple mappers per type: m1: " + mapper + ", m2: " + registeredMappers.get(type));
}
registeredMappers.put(type, mapper); // depends on control dependency: [if], data = [none]
}
}
}
}
} else {
if (f.getAnnotation(Mapper.class) != null) {
throw new IllegalArgumentException("@Mapper field must be public, static final and have valid parametrized type type: " + f);
}
}
}
}
return mapper;
} }
|
public class class_name {
protected void setTessVariables() {
Enumeration<?> em = prop.propertyNames();
while (em.hasMoreElements()) {
String key = (String) em.nextElement();
TessBaseAPISetVariable(handle, key, prop.getProperty(key));
}
} }
|
public class class_name {
protected void setTessVariables() {
Enumeration<?> em = prop.propertyNames();
while (em.hasMoreElements()) {
String key = (String) em.nextElement();
TessBaseAPISetVariable(handle, key, prop.getProperty(key)); // depends on control dependency: [while], data = [none]
}
} }
|
public class class_name {
public float optFloat(String key, float defaultValue) {
Number val = this.optNumber(key);
if (val == null) {
return defaultValue;
}
final float floatValue = val.floatValue();
// if (Float.isNaN(floatValue) || Float.isInfinite(floatValue)) {
// return defaultValue;
// }
return floatValue;
} }
|
public class class_name {
public float optFloat(String key, float defaultValue) {
Number val = this.optNumber(key);
if (val == null) {
return defaultValue; // depends on control dependency: [if], data = [none]
}
final float floatValue = val.floatValue();
// if (Float.isNaN(floatValue) || Float.isInfinite(floatValue)) {
// return defaultValue;
// }
return floatValue;
} }
|
public class class_name {
public static int getDayOfWeek(
int year,
int month,
int dayOfMonth
) {
if ((dayOfMonth < 1) || (dayOfMonth > 31)) {
throw new IllegalArgumentException(
"Day out of range: " + dayOfMonth);
} else if (dayOfMonth > getLengthOfMonth(year, month)) {
throw new IllegalArgumentException(
"Day exceeds month length: "
+ toString(year, month, dayOfMonth));
}
int m = gaussianWeekTerm(month);
int y = (year % 100);
int c = Math.floorDiv(year, 100);
if (y < 0) {
y += 100;
}
if (month <= 2) { // Januar oder Februar
y--;
if (y < 0) {
y = 99;
c--;
}
}
// Gauß'sche Wochentagsformel
int k = Math.floorDiv(c, 4);
int w = ((dayOfMonth + m + y + (y / 4) + k - 2 * c) % 7);
if (w <= 0) {
w += 7;
}
return w;
} }
|
public class class_name {
public static int getDayOfWeek(
int year,
int month,
int dayOfMonth
) {
if ((dayOfMonth < 1) || (dayOfMonth > 31)) {
throw new IllegalArgumentException(
"Day out of range: " + dayOfMonth);
} else if (dayOfMonth > getLengthOfMonth(year, month)) {
throw new IllegalArgumentException(
"Day exceeds month length: "
+ toString(year, month, dayOfMonth));
}
int m = gaussianWeekTerm(month);
int y = (year % 100);
int c = Math.floorDiv(year, 100);
if (y < 0) {
y += 100; // depends on control dependency: [if], data = [none]
}
if (month <= 2) { // Januar oder Februar
y--; // depends on control dependency: [if], data = [none]
if (y < 0) {
y = 99; // depends on control dependency: [if], data = [none]
c--; // depends on control dependency: [if], data = [none]
}
}
// Gauß'sche Wochentagsformel
int k = Math.floorDiv(c, 4);
int w = ((dayOfMonth + m + y + (y / 4) + k - 2 * c) % 7);
if (w <= 0) {
w += 7; // depends on control dependency: [if], data = [none]
}
return w;
} }
|
public class class_name {
@Override
public Answer processRequest(IRequest request, IRealm matchedRealm) {
try {
Answer ans = request.createAnswer(RESULT_REDIRECT_INDICATION);
AvpSet set = ans.getAvps();
String[] destHosts = matchedRealm.getPeerNames();
for (String host:destHosts) {
set.addAvp(Avp.REDIRECT_HOST, host, false);
}
IAgentConfiguration agentConfiguration = matchedRealm.getAgentConfiguration();
//default
int rhuValue = RHU_REALM_AND_APPLICATION;
if (agentConfiguration != null) {
Properties p = agentConfiguration.getProperties();
try {
rhuValue = Integer.parseInt(p.getProperty(RHU_PROPERTY, "" + rhuValue));
}
catch (Exception e) {
if (logger.isWarnEnabled()) {
logger.warn("Failed to parse configuration value. ", e);
}
}
}
set.addAvp(Avp.REDIRECT_HOST_USAGE, rhuValue);
ans.setError(true);
super.container.sendMessage((IMessage) ans);
}
catch (Exception e) {
if (logger.isDebugEnabled()) {
logger.debug("Failure when trying to send Answer", e);
}
Answer ans = request.createAnswer(RESULT_INVALID_AVP_VALUE);
// now lets do the magic.
if (e instanceof AvpDataException && ((AvpDataException) e).getAvp() != null) {
// lets add failed if its present
AvpSet failedAvp = ans.getAvps().addGroupedAvp(Avp.FAILED_AVP);
failedAvp.addAvp(((AvpDataException) e).getAvp());
}
try {
container.sendMessage((IMessage) ans);
}
catch (RouteException re) {
if (logger.isDebugEnabled()) {
logger.debug("Failure when trying to send failure answer", re);
}
}
catch (AvpDataException ade) {
if (logger.isDebugEnabled()) {
logger.debug("Failure when trying to send failure answer", ade);
}
}
catch (IllegalDiameterStateException idse) {
if (logger.isDebugEnabled()) {
logger.debug("Failure when trying to send failure answer", idse);
}
}
catch (IOException ioe) {
if (logger.isDebugEnabled()) {
logger.debug("Failure when trying to send failure answer", ioe);
}
}
}
return null;
} }
|
public class class_name {
@Override
public Answer processRequest(IRequest request, IRealm matchedRealm) {
try {
Answer ans = request.createAnswer(RESULT_REDIRECT_INDICATION);
AvpSet set = ans.getAvps();
String[] destHosts = matchedRealm.getPeerNames();
for (String host:destHosts) {
set.addAvp(Avp.REDIRECT_HOST, host, false);
// depends on control dependency: [for], data = [host]
}
IAgentConfiguration agentConfiguration = matchedRealm.getAgentConfiguration();
//default
int rhuValue = RHU_REALM_AND_APPLICATION;
if (agentConfiguration != null) {
Properties p = agentConfiguration.getProperties();
try {
rhuValue = Integer.parseInt(p.getProperty(RHU_PROPERTY, "" + rhuValue));
// depends on control dependency: [try], data = [none]
}
catch (Exception e) {
if (logger.isWarnEnabled()) {
logger.warn("Failed to parse configuration value. ", e);
// depends on control dependency: [if], data = [none]
}
}
// depends on control dependency: [catch], data = [none]
}
set.addAvp(Avp.REDIRECT_HOST_USAGE, rhuValue);
// depends on control dependency: [try], data = [none]
ans.setError(true);
// depends on control dependency: [try], data = [none]
super.container.sendMessage((IMessage) ans);
// depends on control dependency: [try], data = [none]
}
catch (Exception e) {
if (logger.isDebugEnabled()) {
logger.debug("Failure when trying to send Answer", e);
// depends on control dependency: [if], data = [none]
}
Answer ans = request.createAnswer(RESULT_INVALID_AVP_VALUE);
// now lets do the magic.
if (e instanceof AvpDataException && ((AvpDataException) e).getAvp() != null) {
// lets add failed if its present
AvpSet failedAvp = ans.getAvps().addGroupedAvp(Avp.FAILED_AVP);
failedAvp.addAvp(((AvpDataException) e).getAvp());
// depends on control dependency: [if], data = [none]
}
try {
container.sendMessage((IMessage) ans);
// depends on control dependency: [try], data = [none]
}
catch (RouteException re) {
if (logger.isDebugEnabled()) {
logger.debug("Failure when trying to send failure answer", re);
// depends on control dependency: [if], data = [none]
}
}
// depends on control dependency: [catch], data = [none]
catch (AvpDataException ade) {
if (logger.isDebugEnabled()) {
logger.debug("Failure when trying to send failure answer", ade);
// depends on control dependency: [if], data = [none]
}
}
// depends on control dependency: [catch], data = [none]
catch (IllegalDiameterStateException idse) {
if (logger.isDebugEnabled()) {
logger.debug("Failure when trying to send failure answer", idse);
// depends on control dependency: [if], data = [none]
}
}
// depends on control dependency: [catch], data = [none]
catch (IOException ioe) {
if (logger.isDebugEnabled()) {
logger.debug("Failure when trying to send failure answer", ioe);
// depends on control dependency: [if], data = [none]
}
}
// depends on control dependency: [catch], data = [none]
}
// depends on control dependency: [catch], data = [none]
return null;
} }
|
public class class_name {
@Override
public boolean execute(final LineReader reader, final String[] parts, final SqlConfig sqlConfig,
final Properties props) {
PrintWriter writer = reader.getTerminal().writer();
String tableNamePattern = parts.length > 1 ? parts[parts.length - 1] : "%";
try {
Connection conn = sqlConfig.getConnectionSupplier().getConnection();
DatabaseMetaData md = conn.getMetaData();
List<Map<String, String>> columns = new ArrayList<>();
Map<String, Integer> labelLength = new HashMap<>();
for (String label : DESC_COLUMN_LABELS) {
labelLength.put(label, label.length());
}
try (ResultSet rs = md.getColumns(conn.getCatalog(), conn.getSchema(), tableNamePattern, null)) {
while (rs.next()) {
Map<String, String> column = new HashMap<>();
for (String label : DESC_COLUMN_LABELS) {
final String value = StringUtils.defaultString(rs.getString(label));
column.put(label, value);
labelLength.compute(
label,
(k, v) -> v == null ? getByteLength(value)
: v.compareTo(getByteLength(value)) >= 0 ? v : getByteLength(value));
}
columns.add(column);
}
}
// ラベル
writer.print("-");
for (String label : DESC_COLUMN_LABELS) {
writer.print(StringUtils.rightPad("", labelLength.get(label), "-"));
writer.print("-");
}
writer.println();
writer.print("|");
for (String label : DESC_COLUMN_LABELS) {
writer.print(StringUtils.rightPad(label, labelLength.get(label)));
writer.print("|");
}
writer.println();
// カラムデータ
String tableName = null;
boolean breakFlag = false;
for (Map<String, String> column : columns) {
if (tableName == null || !tableName.equalsIgnoreCase(column.get("TABLE_NAME"))) {
tableName = column.get("TABLE_NAME");
breakFlag = true;
}
if (breakFlag) {
writer.print("-");
for (String label : DESC_COLUMN_LABELS) {
writer.print(StringUtils.rightPad("", labelLength.get(label), "-"));
writer.print("-");
}
writer.println();
breakFlag = false;
}
writer.print("|");
for (String label : DESC_COLUMN_LABELS) {
String val = column.get(label);
if (StringUtils.isNumeric(val)) {
writer.print(StringUtils.leftPad(val, labelLength.get(label)));
} else {
writer.print(StringUtils.rightPad(val, labelLength.get(label)));
}
writer.print("|");
}
writer.println();
}
writer.print("-");
for (String label : DESC_COLUMN_LABELS) {
writer.print(StringUtils.rightPad("", labelLength.get(label), "-"));
writer.print("-");
}
writer.println();
} catch (SQLException ex) {
ex.printStackTrace();
}
writer.flush();
return true;
} }
|
public class class_name {
@Override
public boolean execute(final LineReader reader, final String[] parts, final SqlConfig sqlConfig,
final Properties props) {
PrintWriter writer = reader.getTerminal().writer();
String tableNamePattern = parts.length > 1 ? parts[parts.length - 1] : "%";
try {
Connection conn = sqlConfig.getConnectionSupplier().getConnection();
DatabaseMetaData md = conn.getMetaData();
List<Map<String, String>> columns = new ArrayList<>();
Map<String, Integer> labelLength = new HashMap<>();
for (String label : DESC_COLUMN_LABELS) {
labelLength.put(label, label.length()); // depends on control dependency: [for], data = [label]
}
try (ResultSet rs = md.getColumns(conn.getCatalog(), conn.getSchema(), tableNamePattern, null)) {
while (rs.next()) {
Map<String, String> column = new HashMap<>();
for (String label : DESC_COLUMN_LABELS) {
final String value = StringUtils.defaultString(rs.getString(label));
column.put(label, value); // depends on control dependency: [for], data = [label]
labelLength.compute(
label,
(k, v) -> v == null ? getByteLength(value)
: v.compareTo(getByteLength(value)) >= 0 ? v : getByteLength(value)); // depends on control dependency: [for], data = [label]
}
columns.add(column); // depends on control dependency: [while], data = [none]
}
}
// ラベル
writer.print("-");
for (String label : DESC_COLUMN_LABELS) {
writer.print(StringUtils.rightPad("", labelLength.get(label), "-"));
writer.print("-");
}
writer.println();
writer.print("|");
for (String label : DESC_COLUMN_LABELS) {
writer.print(StringUtils.rightPad(label, labelLength.get(label))); // depends on control dependency: [for], data = [label]
writer.print("|"); // depends on control dependency: [for], data = [none]
}
writer.println();
// カラムデータ
String tableName = null;
boolean breakFlag = false;
for (Map<String, String> column : columns) {
if (tableName == null || !tableName.equalsIgnoreCase(column.get("TABLE_NAME"))) {
tableName = column.get("TABLE_NAME"); // depends on control dependency: [if], data = [none]
breakFlag = true; // depends on control dependency: [if], data = [none]
}
if (breakFlag) {
writer.print("-"); // depends on control dependency: [if], data = [none]
for (String label : DESC_COLUMN_LABELS) {
writer.print(StringUtils.rightPad("", labelLength.get(label), "-")); // depends on control dependency: [for], data = [label]
writer.print("-"); // depends on control dependency: [for], data = [none]
}
writer.println(); // depends on control dependency: [if], data = [none]
breakFlag = false; // depends on control dependency: [if], data = [none]
}
writer.print("|"); // depends on control dependency: [for], data = [none]
for (String label : DESC_COLUMN_LABELS) {
String val = column.get(label);
if (StringUtils.isNumeric(val)) {
writer.print(StringUtils.leftPad(val, labelLength.get(label))); // depends on control dependency: [if], data = [none]
} else {
writer.print(StringUtils.rightPad(val, labelLength.get(label))); // depends on control dependency: [if], data = [none]
}
writer.print("|"); // depends on control dependency: [for], data = [none]
}
writer.println(); // depends on control dependency: [for], data = [none]
}
writer.print("-");
for (String label : DESC_COLUMN_LABELS) {
writer.print(StringUtils.rightPad("", labelLength.get(label), "-")); // depends on control dependency: [for], data = [label]
writer.print("-"); // depends on control dependency: [for], data = [none]
}
writer.println();
} catch (SQLException ex) {
ex.printStackTrace();
}
writer.flush();
return true;
} }
|
public class class_name {
public static int extractFromClasspathToFile(String packagePath, File toDir) throws IOException {
String locationPattern = "classpath*:" + packagePath + "/**";
ResourcePatternResolver resourcePatternResolver = new PathMatchingResourcePatternResolver();
Resource[] resources = resourcePatternResolver.getResources(locationPattern);
if (resources.length == 0) {
throw new IOException("Nothing found at " + locationPattern);
}
int counter = 0;
for (Resource resource : resources) {
if (resource.isReadable()) { // Skip hidden or system files
final URL url = resource.getURL();
String path = url.toString();
if (!path.endsWith("/")) { // Skip directories
int p = path.lastIndexOf(packagePath) + packagePath.length();
path = path.substring(p);
final File targetFile = new File(toDir, path);
long len = resource.contentLength();
if (!targetFile.exists() || targetFile.length() != len) { // Only copy new files
tryN(5, 500, new Procedure<IOException>() {
@Override
public void apply() throws IOException {
FileUtils.copyURLToFile(url, targetFile);
}
});
counter++;
}
}
}
}
if (counter > 0) {
Object[] info = new Object[] { counter, locationPattern, toDir };
logger.info("Unpacked {} files from {} to {}", info);
}
return counter;
} }
|
public class class_name {
public static int extractFromClasspathToFile(String packagePath, File toDir) throws IOException {
String locationPattern = "classpath*:" + packagePath + "/**";
ResourcePatternResolver resourcePatternResolver = new PathMatchingResourcePatternResolver();
Resource[] resources = resourcePatternResolver.getResources(locationPattern);
if (resources.length == 0) {
throw new IOException("Nothing found at " + locationPattern);
}
int counter = 0;
for (Resource resource : resources) {
if (resource.isReadable()) { // Skip hidden or system files
final URL url = resource.getURL();
String path = url.toString();
if (!path.endsWith("/")) { // Skip directories
int p = path.lastIndexOf(packagePath) + packagePath.length();
path = path.substring(p); // depends on control dependency: [if], data = [none]
final File targetFile = new File(toDir, path);
long len = resource.contentLength();
if (!targetFile.exists() || targetFile.length() != len) { // Only copy new files
tryN(5, 500, new Procedure<IOException>() {
@Override
public void apply() throws IOException {
FileUtils.copyURLToFile(url, targetFile);
}
}); // depends on control dependency: [if], data = [none]
counter++; // depends on control dependency: [if], data = [none]
}
}
}
}
if (counter > 0) {
Object[] info = new Object[] { counter, locationPattern, toDir };
logger.info("Unpacked {} files from {} to {}", info);
}
return counter;
} }
|
public class class_name {
public void dispose() {
Logger.d("Disposing.");
mSetupDone = false;
if (mServiceConn != null) {
Logger.d("Unbinding from service.");
if (mContext != null) mContext.unbindService(mServiceConn);
mServiceConn = null;
mService = null;
mPurchaseListener = null;
}
} }
|
public class class_name {
public void dispose() {
Logger.d("Disposing.");
mSetupDone = false;
if (mServiceConn != null) {
Logger.d("Unbinding from service."); // depends on control dependency: [if], data = [none]
if (mContext != null) mContext.unbindService(mServiceConn);
mServiceConn = null; // depends on control dependency: [if], data = [none]
mService = null; // depends on control dependency: [if], data = [none]
mPurchaseListener = null; // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public static Optional<String> getParameterNameFromAnnotations(Annotation[] memberAnnotations) {
for (Annotation a : memberAnnotations) {
if (a instanceof QueryParam) {
return Optional.of("query param " + ((QueryParam) a).value());
} else if (a instanceof PathParam) {
return Optional.of("path param " + ((PathParam) a).value());
} else if (a instanceof HeaderParam) {
return Optional.of("header " + ((HeaderParam) a).value());
} else if (a instanceof CookieParam) {
return Optional.of("cookie " + ((CookieParam) a).value());
} else if (a instanceof FormParam) {
return Optional.of("form field " + ((FormParam) a).value());
} else if (a instanceof Context) {
return Optional.of("context");
} else if (a instanceof MatrixParam) {
return Optional.of("matrix param " + ((MatrixParam) a).value());
}
}
return Optional.empty();
} }
|
public class class_name {
public static Optional<String> getParameterNameFromAnnotations(Annotation[] memberAnnotations) {
for (Annotation a : memberAnnotations) {
if (a instanceof QueryParam) {
return Optional.of("query param " + ((QueryParam) a).value()); // depends on control dependency: [if], data = [none]
} else if (a instanceof PathParam) {
return Optional.of("path param " + ((PathParam) a).value()); // depends on control dependency: [if], data = [none]
} else if (a instanceof HeaderParam) {
return Optional.of("header " + ((HeaderParam) a).value()); // depends on control dependency: [if], data = [none]
} else if (a instanceof CookieParam) {
return Optional.of("cookie " + ((CookieParam) a).value()); // depends on control dependency: [if], data = [none]
} else if (a instanceof FormParam) {
return Optional.of("form field " + ((FormParam) a).value()); // depends on control dependency: [if], data = [none]
} else if (a instanceof Context) {
return Optional.of("context"); // depends on control dependency: [if], data = [none]
} else if (a instanceof MatrixParam) {
return Optional.of("matrix param " + ((MatrixParam) a).value()); // depends on control dependency: [if], data = [none]
}
}
return Optional.empty();
} }
|
public class class_name {
protected static String prettyPrint(Object obj){
StringBuilder sb = new StringBuilder();
if (obj == null){
sb.append("NULL");
} else if (obj instanceof Blob){
sb.append(formatLogParam((Blob)obj));
} else if (obj instanceof Clob){
sb.append(formatLogParam((Clob)obj));
} else if (obj instanceof Ref){
sb.append(formatLogParam((Ref)obj));
} else if (obj instanceof Array){
sb.append(formatLogParam((Array)obj));
} else if (obj instanceof String || obj instanceof Date){
sb.append("'" + obj.toString()+"'");
} else {
sb.append(obj.toString());
}
return sb.toString();
} }
|
public class class_name {
protected static String prettyPrint(Object obj){
StringBuilder sb = new StringBuilder();
if (obj == null){
sb.append("NULL"); // depends on control dependency: [if], data = [none]
} else if (obj instanceof Blob){
sb.append(formatLogParam((Blob)obj)); // depends on control dependency: [if], data = [none]
} else if (obj instanceof Clob){
sb.append(formatLogParam((Clob)obj)); // depends on control dependency: [if], data = [none]
} else if (obj instanceof Ref){
sb.append(formatLogParam((Ref)obj)); // depends on control dependency: [if], data = [none]
} else if (obj instanceof Array){
sb.append(formatLogParam((Array)obj)); // depends on control dependency: [if], data = [none]
} else if (obj instanceof String || obj instanceof Date){
sb.append("'" + obj.toString()+"'"); // depends on control dependency: [if], data = [none]
} else {
sb.append(obj.toString()); // depends on control dependency: [if], data = [none]
}
return sb.toString();
} }
|
public class class_name {
public Iterable<HistoryPageEntry<T>> getRenderList() {
if(trimmed) {
List<HistoryPageEntry<T>> pageEntries = toPageEntries(baseList);
if(pageEntries.size() > THRESHOLD) {
return updateFirstTransientBuildKey(pageEntries.subList(0,THRESHOLD));
} else {
trimmed=false;
return updateFirstTransientBuildKey(pageEntries);
}
} else {
// to prevent baseList's concrete type from getting picked up by <j:forEach> in view
return updateFirstTransientBuildKey(toPageEntries(baseList));
}
} }
|
public class class_name {
public Iterable<HistoryPageEntry<T>> getRenderList() {
if(trimmed) {
List<HistoryPageEntry<T>> pageEntries = toPageEntries(baseList);
if(pageEntries.size() > THRESHOLD) {
return updateFirstTransientBuildKey(pageEntries.subList(0,THRESHOLD)); // depends on control dependency: [if], data = [THRESHOLD)]
} else {
trimmed=false; // depends on control dependency: [if], data = [none]
return updateFirstTransientBuildKey(pageEntries); // depends on control dependency: [if], data = [none]
}
} else {
// to prevent baseList's concrete type from getting picked up by <j:forEach> in view
return updateFirstTransientBuildKey(toPageEntries(baseList)); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public static Map<String,String> formatImportedVars( Instance instance ) {
// The map we will return
Map<String, String> importedVars = new HashMap<String, String>();
for( Map.Entry<String,Collection<Import>> entry : instance.getImports().entrySet()) {
Collection<Import> importList = entry.getValue();
String importTypeName = entry.getKey();
// For each ImportType, put the number of Import it has, so the script knows
importedVars.put(importTypeName + "_size", "" + importList.size());
// Now put each var contained in an Import
int i = 0;
for( Import imprt : importList ) {
// "workers_0_name=tomcat1"
/*int index = imprt.getInstancePath().lastIndexOf( '/' );
String instanceName = imprt.getInstancePath().substring( index + 1 );
importedVars.put(importTypeName + "_" + i + "_name", instanceName);*/
importedVars.put(importTypeName + "_" + i + "_name", imprt.getInstancePath());
for (Entry<String, String> entry2 : imprt.getExportedVars().entrySet()) {
// "workers_0_ip=127.0.0.1"
String vname = VariableHelpers.parseVariableName(entry2.getKey()).getValue();
importedVars.put(importTypeName + "_" + i + "_" + vname, entry2.getValue());
}
++i;
}
}
return importedVars;
} }
|
public class class_name {
public static Map<String,String> formatImportedVars( Instance instance ) {
// The map we will return
Map<String, String> importedVars = new HashMap<String, String>();
for( Map.Entry<String,Collection<Import>> entry : instance.getImports().entrySet()) {
Collection<Import> importList = entry.getValue();
String importTypeName = entry.getKey();
// For each ImportType, put the number of Import it has, so the script knows
importedVars.put(importTypeName + "_size", "" + importList.size()); // depends on control dependency: [for], data = [none]
// Now put each var contained in an Import
int i = 0;
for( Import imprt : importList ) {
// "workers_0_name=tomcat1"
/*int index = imprt.getInstancePath().lastIndexOf( '/' );
String instanceName = imprt.getInstancePath().substring( index + 1 );
importedVars.put(importTypeName + "_" + i + "_name", instanceName);*/
importedVars.put(importTypeName + "_" + i + "_name", imprt.getInstancePath()); // depends on control dependency: [for], data = [imprt]
for (Entry<String, String> entry2 : imprt.getExportedVars().entrySet()) {
// "workers_0_ip=127.0.0.1"
String vname = VariableHelpers.parseVariableName(entry2.getKey()).getValue();
importedVars.put(importTypeName + "_" + i + "_" + vname, entry2.getValue()); // depends on control dependency: [for], data = [entry2]
}
++i; // depends on control dependency: [for], data = [none]
}
}
return importedVars;
} }
|
public class class_name {
public final void commit() {
if (indexQueue == null) {
luceneIndex.commit();
} else {
indexQueue.submitSynchronous(new Runnable() {
@Override
public void run() {
luceneIndex.commit();
}
});
}
} }
|
public class class_name {
public final void commit() {
if (indexQueue == null) {
luceneIndex.commit(); // depends on control dependency: [if], data = [none]
} else {
indexQueue.submitSynchronous(new Runnable() {
@Override
public void run() {
luceneIndex.commit();
}
}); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
@Measure
public void onStoreEnablement( @Observes final ArtifactStoreEnablementEvent event )
{
Logger logger = LoggerFactory.getLogger( getClass() );
logger.trace( "Got store-enablement event: {}", event );
if ( event.isPreprocessing() )
{
if ( event.isDisabling() )
{
/* For disablement, we remove the merged metadata files by paths via listing mergable files in the target repo's local cache.
* We do not cache pom/jar files in affected groups so don't worry about them.
*/
processAllPaths( event, mergablePathStrings(), false );
}
else
{
/* When enabling a repo, we have to clean all (mergable) content from containing groups' cache because
* we don't have complete listing of the enabled repo and listing it is very slow. The only option how to keep
* the cache consistent is to drop everything from it.
*/
processAllPathsExt( event, mergablePathStrings() );
}
}
} }
|
public class class_name {
@Measure
public void onStoreEnablement( @Observes final ArtifactStoreEnablementEvent event )
{
Logger logger = LoggerFactory.getLogger( getClass() );
logger.trace( "Got store-enablement event: {}", event );
if ( event.isPreprocessing() )
{
if ( event.isDisabling() )
{
/* For disablement, we remove the merged metadata files by paths via listing mergable files in the target repo's local cache.
* We do not cache pom/jar files in affected groups so don't worry about them.
*/
processAllPaths( event, mergablePathStrings(), false ); // depends on control dependency: [if], data = [none]
}
else
{
/* When enabling a repo, we have to clean all (mergable) content from containing groups' cache because
* we don't have complete listing of the enabled repo and listing it is very slow. The only option how to keep
* the cache consistent is to drop everything from it.
*/
processAllPathsExt( event, mergablePathStrings() ); // depends on control dependency: [if], data = [none]
}
}
} }
|
public class class_name {
public SecurityConstraintType<WebAppDescriptor> getOrCreateSecurityConstraint()
{
List<Node> nodeList = model.get("security-constraint");
if (nodeList != null && nodeList.size() > 0)
{
return new SecurityConstraintTypeImpl<WebAppDescriptor>(this, "security-constraint", model, nodeList.get(0));
}
return createSecurityConstraint();
} }
|
public class class_name {
public SecurityConstraintType<WebAppDescriptor> getOrCreateSecurityConstraint()
{
List<Node> nodeList = model.get("security-constraint");
if (nodeList != null && nodeList.size() > 0)
{
return new SecurityConstraintTypeImpl<WebAppDescriptor>(this, "security-constraint", model, nodeList.get(0)); // depends on control dependency: [if], data = [none]
}
return createSecurityConstraint();
} }
|
public class class_name {
public List<Map.Entry<K, Float>> nearest(K key, int size)
{
Vector vector = storage.get(key);
if (vector == null)
{
return Collections.emptyList();
}
return nearest(key, vector, size);
} }
|
public class class_name {
public List<Map.Entry<K, Float>> nearest(K key, int size)
{
Vector vector = storage.get(key);
if (vector == null)
{
return Collections.emptyList(); // depends on control dependency: [if], data = [none]
}
return nearest(key, vector, size);
} }
|
public class class_name {
public boolean detectSonyMylo() {
if ((userAgent.indexOf(manuSony) != -1)
&& ((userAgent.indexOf(qtembedded) != -1) || (userAgent.indexOf(mylocom2) != -1))) {
return true;
}
return false;
} }
|
public class class_name {
public boolean detectSonyMylo() {
if ((userAgent.indexOf(manuSony) != -1)
&& ((userAgent.indexOf(qtembedded) != -1) || (userAgent.indexOf(mylocom2) != -1))) {
return true;
// depends on control dependency: [if], data = [none]
}
return false;
} }
|
public class class_name {
@Override
public final String readObjectB(final Class clazz) {
char ch = nextGoodChar();
if (ch == '{') return "";
if (ch == 'n' && nextChar() == 'u' && nextChar() == 'l' && nextChar() == 'l') return null;
if (ch == 'N' && nextChar() == 'U' && nextChar() == 'L' && nextChar() == 'L') return null;
StringBuilder sb = new StringBuilder();
sb.append(ch);
char one;
try {
while ((one = nextChar()) != 0) sb.append(one);
} catch (Exception e) {
}
throw new ConvertException("a json object text must begin with '{' (position = " + position + ") but '" + ch + "' in (" + sb + ")");
} }
|
public class class_name {
@Override
public final String readObjectB(final Class clazz) {
char ch = nextGoodChar();
if (ch == '{') return "";
if (ch == 'n' && nextChar() == 'u' && nextChar() == 'l' && nextChar() == 'l') return null;
if (ch == 'N' && nextChar() == 'U' && nextChar() == 'L' && nextChar() == 'L') return null;
StringBuilder sb = new StringBuilder();
sb.append(ch);
char one;
try {
while ((one = nextChar()) != 0) sb.append(one);
} catch (Exception e) {
}
// depends on control dependency: [catch], data = [none]
throw new ConvertException("a json object text must begin with '{' (position = " + position + ") but '" + ch + "' in (" + sb + ")");
} }
|
public class class_name {
public static String getPrincipal(String principalKey) {
if ( principalKey == null) {
return principalKey;
}
if (principalKey.length() <= GRANTED_MARKER.length()) {
return null;
}
if ( principalKey.endsWith(GRANTED_MARKER) ) {
return principalKey.substring(0, principalKey.length()-GRANTED_MARKER.length());
} else if ( principalKey.endsWith(DENIED_MARKER) ) {
return principalKey.substring(0, principalKey.length()-DENIED_MARKER.length());
} else {
return null;
}
} }
|
public class class_name {
public static String getPrincipal(String principalKey) {
if ( principalKey == null) {
return principalKey; // depends on control dependency: [if], data = [none]
}
if (principalKey.length() <= GRANTED_MARKER.length()) {
return null; // depends on control dependency: [if], data = [none]
}
if ( principalKey.endsWith(GRANTED_MARKER) ) {
return principalKey.substring(0, principalKey.length()-GRANTED_MARKER.length()); // depends on control dependency: [if], data = [none]
} else if ( principalKey.endsWith(DENIED_MARKER) ) {
return principalKey.substring(0, principalKey.length()-DENIED_MARKER.length()); // depends on control dependency: [if], data = [none]
} else {
return null; // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
protected <OTHER, MISC, X> Specification<ENTITY> buildReferringEntitySpecification(Filter<X> filter,
Function<Root<ENTITY>, SetJoin<MISC, OTHER>> functionToEntity,
Function<SetJoin<MISC, OTHER>, Expression<X>> entityToColumn) {
if (filter.getEquals() != null) {
return equalsSpecification(functionToEntity.andThen(entityToColumn), filter.getEquals());
} else if (filter.getSpecified() != null) {
// Interestingly, 'functionToEntity' doesn't work, we need the longer lambda formula
return byFieldSpecified(root -> functionToEntity.apply(root), filter.getSpecified());
}
return null;
} }
|
public class class_name {
protected <OTHER, MISC, X> Specification<ENTITY> buildReferringEntitySpecification(Filter<X> filter,
Function<Root<ENTITY>, SetJoin<MISC, OTHER>> functionToEntity,
Function<SetJoin<MISC, OTHER>, Expression<X>> entityToColumn) {
if (filter.getEquals() != null) {
return equalsSpecification(functionToEntity.andThen(entityToColumn), filter.getEquals()); // depends on control dependency: [if], data = [none]
} else if (filter.getSpecified() != null) {
// Interestingly, 'functionToEntity' doesn't work, we need the longer lambda formula
return byFieldSpecified(root -> functionToEntity.apply(root), filter.getSpecified()); // depends on control dependency: [if], data = [none]
}
return null;
} }
|
public class class_name {
private List<Field> allFields(final Class<?> c) {
List<Field> l = this.fieldsCache.get(c);
if (l == null) {
l = new LinkedList<Field>();
final Field[] fields = c.getDeclaredFields();
addAll(l, fields);
Class<?> sc = c;
while (((sc = sc.getSuperclass()) != Object.class) && (sc != null)) {
addAll(l, sc.getDeclaredFields());
}
this.fieldsCache.putIfAbsent(c, l);
}
return l;
} }
|
public class class_name {
private List<Field> allFields(final Class<?> c) {
List<Field> l = this.fieldsCache.get(c);
if (l == null) {
l = new LinkedList<Field>(); // depends on control dependency: [if], data = [none]
final Field[] fields = c.getDeclaredFields();
addAll(l, fields); // depends on control dependency: [if], data = [(l]
Class<?> sc = c;
while (((sc = sc.getSuperclass()) != Object.class) && (sc != null)) {
addAll(l, sc.getDeclaredFields()); // depends on control dependency: [while], data = [none]
}
this.fieldsCache.putIfAbsent(c, l); // depends on control dependency: [if], data = [none]
}
return l;
} }
|
public class class_name {
public void marshall(DescribeDomainControllersRequest describeDomainControllersRequest, ProtocolMarshaller protocolMarshaller) {
if (describeDomainControllersRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(describeDomainControllersRequest.getDirectoryId(), DIRECTORYID_BINDING);
protocolMarshaller.marshall(describeDomainControllersRequest.getDomainControllerIds(), DOMAINCONTROLLERIDS_BINDING);
protocolMarshaller.marshall(describeDomainControllersRequest.getNextToken(), NEXTTOKEN_BINDING);
protocolMarshaller.marshall(describeDomainControllersRequest.getLimit(), LIMIT_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} }
|
public class class_name {
public void marshall(DescribeDomainControllersRequest describeDomainControllersRequest, ProtocolMarshaller protocolMarshaller) {
if (describeDomainControllersRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(describeDomainControllersRequest.getDirectoryId(), DIRECTORYID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(describeDomainControllersRequest.getDomainControllerIds(), DOMAINCONTROLLERIDS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(describeDomainControllersRequest.getNextToken(), NEXTTOKEN_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(describeDomainControllersRequest.getLimit(), LIMIT_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 <O extends Object> O copyFields(Class<?> clazz, Object input, O output, boolean copyCollections,
Collection<String> ignoreFields, boolean ignoreNonExisiting) {
if (null == clazz) {
clazz = input.getClass();
}
Field[] fields = clazz.getDeclaredFields();
for (Field field : fields) {
/*
* do not copy collections because of possible
* org.hibernate.HibernateException: Found shared references to a collection
*/
if (ReflectUtils.isNotStatic(field)) {
if (null != ignoreFields && ignoreFields.contains(field.getName())) {
if(LOGGER.isTraceEnabled()) {
LOGGER.trace(String.format("ignoring field: %s", field.getName()));
}
continue;
}
if (Collection.class.isAssignableFrom(field.getType()) && !copyCollections) {
if(LOGGER.isTraceEnabled()) {
LOGGER.trace(String.format("skipping collection field: %s", field.getName()));
}
continue;
}
if(LOGGER.isTraceEnabled()) {
LOGGER.trace(String.format("copying field: %s, with value: %s", field.getName(), ReflectUtils.invokeGetter(input, field)));
}
ReflectUtils.copy(input, output, field.getName(), ignoreNonExisiting);
}
}
Class<?> superClazz = clazz.getSuperclass();
if (null != superClazz && !superClazz.isAssignableFrom(Object.class)) {
output = copyFields(superClazz, input, output, copyCollections, ignoreFields, ignoreNonExisiting);
}
return output;
} }
|
public class class_name {
public static <O extends Object> O copyFields(Class<?> clazz, Object input, O output, boolean copyCollections,
Collection<String> ignoreFields, boolean ignoreNonExisiting) {
if (null == clazz) {
clazz = input.getClass(); // depends on control dependency: [if], data = [none]
}
Field[] fields = clazz.getDeclaredFields();
for (Field field : fields) {
/*
* do not copy collections because of possible
* org.hibernate.HibernateException: Found shared references to a collection
*/
if (ReflectUtils.isNotStatic(field)) {
if (null != ignoreFields && ignoreFields.contains(field.getName())) {
if(LOGGER.isTraceEnabled()) {
LOGGER.trace(String.format("ignoring field: %s", field.getName())); // depends on control dependency: [if], data = [none]
}
continue;
}
if (Collection.class.isAssignableFrom(field.getType()) && !copyCollections) {
if(LOGGER.isTraceEnabled()) {
LOGGER.trace(String.format("skipping collection field: %s", field.getName())); // depends on control dependency: [if], data = [none]
}
continue;
}
if(LOGGER.isTraceEnabled()) {
LOGGER.trace(String.format("copying field: %s, with value: %s", field.getName(), ReflectUtils.invokeGetter(input, field))); // depends on control dependency: [if], data = [none]
}
ReflectUtils.copy(input, output, field.getName(), ignoreNonExisiting); // depends on control dependency: [if], data = [none]
}
}
Class<?> superClazz = clazz.getSuperclass();
if (null != superClazz && !superClazz.isAssignableFrom(Object.class)) {
output = copyFields(superClazz, input, output, copyCollections, ignoreFields, ignoreNonExisiting); // depends on control dependency: [if], data = [none]
}
return output;
} }
|
public class class_name {
public static TerminalOp<Integer, OptionalInt>
makeInt(IntBinaryOperator operator) {
Objects.requireNonNull(operator);
class ReducingSink
implements AccumulatingSink<Integer, OptionalInt, ReducingSink>, Sink.OfInt {
private boolean empty;
private int state;
public void begin(long size) {
empty = true;
state = 0;
}
@Override
public void accept(int t) {
if (empty) {
empty = false;
state = t;
}
else {
state = operator.applyAsInt(state, t);
}
}
@Override
public OptionalInt get() {
return empty ? OptionalInt.empty() : OptionalInt.of(state);
}
@Override
public void combine(ReducingSink other) {
if (!other.empty)
accept(other.state);
}
}
return new ReduceOp<Integer, OptionalInt, ReducingSink>(StreamShape.INT_VALUE) {
@Override
public ReducingSink makeSink() {
return new ReducingSink();
}
};
} }
|
public class class_name {
public static TerminalOp<Integer, OptionalInt>
makeInt(IntBinaryOperator operator) {
Objects.requireNonNull(operator);
class ReducingSink
implements AccumulatingSink<Integer, OptionalInt, ReducingSink>, Sink.OfInt {
private boolean empty;
private int state;
public void begin(long size) {
empty = true;
state = 0;
}
@Override
public void accept(int t) {
if (empty) {
empty = false; // depends on control dependency: [if], data = [none]
state = t; // depends on control dependency: [if], data = [none]
}
else {
state = operator.applyAsInt(state, t); // depends on control dependency: [if], data = [none]
}
}
@Override
public OptionalInt get() {
return empty ? OptionalInt.empty() : OptionalInt.of(state);
}
@Override
public void combine(ReducingSink other) {
if (!other.empty)
accept(other.state);
}
}
return new ReduceOp<Integer, OptionalInt, ReducingSink>(StreamShape.INT_VALUE) {
@Override
public ReducingSink makeSink() {
return new ReducingSink();
}
};
} }
|
public class class_name {
@Override
public long getContentSize() {
try {
if (hasDescriptionProperty(CONTENT_SIZE)) {
return getDescriptionProperty(CONTENT_SIZE).getLong();
}
} catch (final RepositoryException e) {
LOGGER.warn("Could not get contentSize(): {}", e.getMessage());
}
return -1L;
} }
|
public class class_name {
@Override
public long getContentSize() {
try {
if (hasDescriptionProperty(CONTENT_SIZE)) {
return getDescriptionProperty(CONTENT_SIZE).getLong(); // depends on control dependency: [if], data = [none]
}
} catch (final RepositoryException e) {
LOGGER.warn("Could not get contentSize(): {}", e.getMessage());
} // depends on control dependency: [catch], data = [none]
return -1L;
} }
|
public class class_name {
public void copyVendorExtensions(Schema source, Schema target) {
if (source.getExtensions() != null) {
Map<String, Object> vendorExtensions = source.getExtensions();
for (String extName : vendorExtensions.keySet()) {
((SchemaImpl) target).addExtension_compat(extName, vendorExtensions.get(extName));
}
}
} }
|
public class class_name {
public void copyVendorExtensions(Schema source, Schema target) {
if (source.getExtensions() != null) {
Map<String, Object> vendorExtensions = source.getExtensions();
for (String extName : vendorExtensions.keySet()) {
((SchemaImpl) target).addExtension_compat(extName, vendorExtensions.get(extName)); // depends on control dependency: [for], data = [extName]
}
}
} }
|
public class class_name {
public synchronized void clear()
{
for (String keyspaceName : getNonSystemKeyspaces())
{
KSMetaData ksm = getKSMetaData(keyspaceName);
for (CFMetaData cfm : ksm.cfMetaData().values())
purge(cfm);
clearKeyspaceDefinition(ksm);
}
updateVersionAndAnnounce();
} }
|
public class class_name {
public synchronized void clear()
{
for (String keyspaceName : getNonSystemKeyspaces())
{
KSMetaData ksm = getKSMetaData(keyspaceName);
for (CFMetaData cfm : ksm.cfMetaData().values())
purge(cfm);
clearKeyspaceDefinition(ksm); // depends on control dependency: [for], data = [none]
}
updateVersionAndAnnounce();
} }
|
public class class_name {
@Override
protected boolean authenticateUsernamePasswordInternal(final UsernamePasswordCredentials usernamePasswordCredentials) throws AuthenticationException {
try {
final String uid = usernamePasswordCredentials.getUsername();
final String otp = usernamePasswordCredentials.getPassword();
if (YubicoClient.isValidOTPFormat(otp)) {
final String publicId = YubicoClient.getPublicId(otp);
if (this.registry.isYubiKeyRegisteredFor(uid, publicId)) {
final YubicoResponse response = client.verify(otp);
log.debug("YubiKey response status {} at {}", response.getStatus(), response.getTimestamp());
return (response.getStatus() == YubicoResponseStatus.OK);
}
else {
log.debug("YubiKey public id [{}] is not registered for user [{}]", publicId, uid);
}
}
else {
log.debug("Invalid OTP format [{}]", otp);
}
return false;
}
catch (final Exception e) {
throw new BadUsernameOrPasswordAuthenticationException(e);
}
} }
|
public class class_name {
@Override
protected boolean authenticateUsernamePasswordInternal(final UsernamePasswordCredentials usernamePasswordCredentials) throws AuthenticationException {
try {
final String uid = usernamePasswordCredentials.getUsername();
final String otp = usernamePasswordCredentials.getPassword();
if (YubicoClient.isValidOTPFormat(otp)) {
final String publicId = YubicoClient.getPublicId(otp);
if (this.registry.isYubiKeyRegisteredFor(uid, publicId)) {
final YubicoResponse response = client.verify(otp);
log.debug("YubiKey response status {} at {}", response.getStatus(), response.getTimestamp()); // depends on control dependency: [if], data = [none]
return (response.getStatus() == YubicoResponseStatus.OK); // depends on control dependency: [if], data = [none]
}
else {
log.debug("YubiKey public id [{}] is not registered for user [{}]", publicId, uid); // depends on control dependency: [if], data = [none]
}
}
else {
log.debug("Invalid OTP format [{}]", otp);
}
return false;
}
catch (final Exception e) {
throw new BadUsernameOrPasswordAuthenticationException(e);
}
} }
|
public class class_name {
@Pure
public boolean isTemporaryChange() {
final Object src = getSource();
if (src instanceof MapLayer) {
return ((MapLayer) src).isTemporaryLayer();
}
return false;
} }
|
public class class_name {
@Pure
public boolean isTemporaryChange() {
final Object src = getSource();
if (src instanceof MapLayer) {
return ((MapLayer) src).isTemporaryLayer(); // depends on control dependency: [if], data = [none]
}
return false;
} }
|
public class class_name {
public void removeItem (T item)
{
if (_model == null) {
return; // if we have no model, stop here
}
// remove the item from our data model
_model.removeItem(item);
// force a relayout of this page
displayPage(_page, true);
} }
|
public class class_name {
public void removeItem (T item)
{
if (_model == null) {
return; // if we have no model, stop here // depends on control dependency: [if], data = [none]
}
// remove the item from our data model
_model.removeItem(item);
// force a relayout of this page
displayPage(_page, true);
} }
|
public class class_name {
private synchronized Producer<EncodedImage> getBackgroundLocalFileFetchToEncodeMemorySequence() {
if (FrescoSystrace.isTracing()) {
FrescoSystrace.beginSection(
"ProducerSequenceFactory#getBackgroundLocalFileFetchToEncodeMemorySequence");
}
if (mBackgroundLocalFileFetchToEncodedMemorySequence == null) {
if (FrescoSystrace.isTracing()) {
FrescoSystrace.beginSection(
"ProducerSequenceFactory#getBackgroundLocalFileFetchToEncodeMemorySequence:init");
}
final LocalFileFetchProducer localFileFetchProducer =
mProducerFactory.newLocalFileFetchProducer();
final Producer<EncodedImage> toEncodedMultiplexProducer =
newEncodedCacheMultiplexToTranscodeSequence(localFileFetchProducer);
mBackgroundLocalFileFetchToEncodedMemorySequence =
mProducerFactory.newBackgroundThreadHandoffProducer(
toEncodedMultiplexProducer, mThreadHandoffProducerQueue);
if (FrescoSystrace.isTracing()) {
FrescoSystrace.endSection();
}
}
if (FrescoSystrace.isTracing()) {
FrescoSystrace.endSection();
}
return mBackgroundLocalFileFetchToEncodedMemorySequence;
} }
|
public class class_name {
private synchronized Producer<EncodedImage> getBackgroundLocalFileFetchToEncodeMemorySequence() {
if (FrescoSystrace.isTracing()) {
FrescoSystrace.beginSection(
"ProducerSequenceFactory#getBackgroundLocalFileFetchToEncodeMemorySequence"); // depends on control dependency: [if], data = [none]
}
if (mBackgroundLocalFileFetchToEncodedMemorySequence == null) {
if (FrescoSystrace.isTracing()) {
FrescoSystrace.beginSection(
"ProducerSequenceFactory#getBackgroundLocalFileFetchToEncodeMemorySequence:init"); // depends on control dependency: [if], data = [none]
}
final LocalFileFetchProducer localFileFetchProducer =
mProducerFactory.newLocalFileFetchProducer();
final Producer<EncodedImage> toEncodedMultiplexProducer =
newEncodedCacheMultiplexToTranscodeSequence(localFileFetchProducer);
mBackgroundLocalFileFetchToEncodedMemorySequence =
mProducerFactory.newBackgroundThreadHandoffProducer(
toEncodedMultiplexProducer, mThreadHandoffProducerQueue); // depends on control dependency: [if], data = [none]
if (FrescoSystrace.isTracing()) {
FrescoSystrace.endSection(); // depends on control dependency: [if], data = [none]
}
}
if (FrescoSystrace.isTracing()) {
FrescoSystrace.endSection(); // depends on control dependency: [if], data = [none]
}
return mBackgroundLocalFileFetchToEncodedMemorySequence;
} }
|
public class class_name {
public void setRootMethodAdapter(JavaRootMethodAdapter rootMethodAdapter) {
if (rootMethodAdapter == null) {
throw new NullPointerException();
}
if (acceptableTestFramework == null) {
throw new IllegalStateException("acceptableTestFramework is not set");
}
if (acceptableTestFramework.equals(rootMethodAdapter.getName())) {
this.rootMethodAdapter = rootMethodAdapter;
}
} }
|
public class class_name {
public void setRootMethodAdapter(JavaRootMethodAdapter rootMethodAdapter) {
if (rootMethodAdapter == null) {
throw new NullPointerException();
}
if (acceptableTestFramework == null) {
throw new IllegalStateException("acceptableTestFramework is not set");
}
if (acceptableTestFramework.equals(rootMethodAdapter.getName())) {
this.rootMethodAdapter = rootMethodAdapter; // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public static final String serializeToString(final Object object) {
if (object == null)
throw new IllegalArgumentException("Object was null");
try {
return jsonMapper.writeValueAsString(object);
} catch (JsonProcessingException e) {
throw new JSONException(e);
}
} }
|
public class class_name {
public static final String serializeToString(final Object object) {
if (object == null)
throw new IllegalArgumentException("Object was null");
try {
return jsonMapper.writeValueAsString(object); // depends on control dependency: [try], data = [none]
} catch (JsonProcessingException e) {
throw new JSONException(e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public Collection<String> combineUncheckedPlugins( Collection<String> uncheckedPlugins, String uncheckedPluginsList )
{
//if the comma list is empty, then there's nothing to do here.
if ( StringUtils.isNotEmpty( uncheckedPluginsList ) )
{
//make sure there is a collection to add to.
if ( uncheckedPlugins == null )
{
uncheckedPlugins = new HashSet<String>();
}
else if ( !uncheckedPlugins.isEmpty() && log != null )
{
log.warn( "The parameter 'unCheckedPlugins' is deprecated. Use 'unCheckedPluginList' instead" );
}
uncheckedPlugins.addAll( Arrays.asList( uncheckedPluginsList.split( "," ) ) );
}
return uncheckedPlugins;
} }
|
public class class_name {
public Collection<String> combineUncheckedPlugins( Collection<String> uncheckedPlugins, String uncheckedPluginsList )
{
//if the comma list is empty, then there's nothing to do here.
if ( StringUtils.isNotEmpty( uncheckedPluginsList ) )
{
//make sure there is a collection to add to.
if ( uncheckedPlugins == null )
{
uncheckedPlugins = new HashSet<String>(); // depends on control dependency: [if], data = [none]
}
else if ( !uncheckedPlugins.isEmpty() && log != null )
{
log.warn( "The parameter 'unCheckedPlugins' is deprecated. Use 'unCheckedPluginList' instead" ); // depends on control dependency: [if], data = [none]
}
uncheckedPlugins.addAll( Arrays.asList( uncheckedPluginsList.split( "," ) ) ); // depends on control dependency: [if], data = [none]
}
return uncheckedPlugins;
} }
|
public class class_name {
public Resource addRendering(OtherContent first, OtherContent... rest) {
if (renderings == null) {
this.renderings = new ArrayList<>();
}
List<OtherContent> renderingsToAdd = Lists.asList(first, rest);
renderingsToAdd.forEach(this::verifyRendering);
this.renderings.addAll(renderingsToAdd);
return this;
} }
|
public class class_name {
public Resource addRendering(OtherContent first, OtherContent... rest) {
if (renderings == null) {
this.renderings = new ArrayList<>(); // depends on control dependency: [if], data = [none]
}
List<OtherContent> renderingsToAdd = Lists.asList(first, rest);
renderingsToAdd.forEach(this::verifyRendering);
this.renderings.addAll(renderingsToAdd);
return this;
} }
|
public class class_name {
protected ORecordInternal<?> readCurrentRecord(ORecordInternal<?> iRecord, final int iMovement) {
if (limit > -1 && browsedRecords >= limit)
// LIMIT REACHED
return null;
current.clusterPosition += iMovement;
if (iRecord != null) {
iRecord.setIdentity(current);
iRecord = lowLevelDatabase.load(iRecord, fetchPlan);
} else
iRecord = lowLevelDatabase.load(current, fetchPlan);
if (iRecord != null)
browsedRecords++;
return iRecord;
} }
|
public class class_name {
protected ORecordInternal<?> readCurrentRecord(ORecordInternal<?> iRecord, final int iMovement) {
if (limit > -1 && browsedRecords >= limit)
// LIMIT REACHED
return null;
current.clusterPosition += iMovement;
if (iRecord != null) {
iRecord.setIdentity(current);
// depends on control dependency: [if], data = [none]
iRecord = lowLevelDatabase.load(iRecord, fetchPlan);
// depends on control dependency: [if], data = [(iRecord]
} else
iRecord = lowLevelDatabase.load(current, fetchPlan);
if (iRecord != null)
browsedRecords++;
return iRecord;
} }
|
public class class_name {
public void setExecutionSummaries(java.util.Collection<JobExecutionSummaryForThing> executionSummaries) {
if (executionSummaries == null) {
this.executionSummaries = null;
return;
}
this.executionSummaries = new java.util.ArrayList<JobExecutionSummaryForThing>(executionSummaries);
} }
|
public class class_name {
public void setExecutionSummaries(java.util.Collection<JobExecutionSummaryForThing> executionSummaries) {
if (executionSummaries == null) {
this.executionSummaries = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.executionSummaries = new java.util.ArrayList<JobExecutionSummaryForThing>(executionSummaries);
} }
|
public class class_name {
private static String getFilenameInfo(String path) {
if (StringUtils.isEmpty(path)) {
return null;
}
try {
return new File(path).getCanonicalPath();
}
catch (IOException ex) {
return new File(path).getAbsolutePath();
}
} }
|
public class class_name {
private static String getFilenameInfo(String path) {
if (StringUtils.isEmpty(path)) {
return null; // depends on control dependency: [if], data = [none]
}
try {
return new File(path).getCanonicalPath(); // depends on control dependency: [try], data = [none]
}
catch (IOException ex) {
return new File(path).getAbsolutePath();
} // depends on control dependency: [catch], data = [none]
} }
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.