code
stringlengths 130
281k
| code_dependency
stringlengths 182
306k
|
|---|---|
public class class_name {
@Override
public void close()
{
isOpen.set(false);
Iterator<Future<?>> iterator = futures.iterator();
while ( iterator.hasNext() )
{
Future<?> future = iterator.next();
iterator.remove();
if ( !future.isDone() && !future.isCancelled() && !future.cancel(true) )
{
log.warn("Could not cancel " + future);
}
}
if (shutdownOnClose) {
executorService.shutdownNow();
}
} }
|
public class class_name {
@Override
public void close()
{
isOpen.set(false);
Iterator<Future<?>> iterator = futures.iterator();
while ( iterator.hasNext() )
{
Future<?> future = iterator.next();
iterator.remove(); // depends on control dependency: [while], data = [none]
if ( !future.isDone() && !future.isCancelled() && !future.cancel(true) )
{
log.warn("Could not cancel " + future); // depends on control dependency: [if], data = [none]
}
}
if (shutdownOnClose) {
executorService.shutdownNow(); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
private void onCompleteHandler(StreamElementQueueEntry<?> streamElementQueueEntry) throws InterruptedException {
lock.lockInterruptibly();
try {
if (!queue.isEmpty() && queue.peek().isDone()) {
LOG.debug("Signal ordered stream element queue has completed head element.");
headIsCompleted.signalAll();
}
} finally {
lock.unlock();
}
} }
|
public class class_name {
private void onCompleteHandler(StreamElementQueueEntry<?> streamElementQueueEntry) throws InterruptedException {
lock.lockInterruptibly();
try {
if (!queue.isEmpty() && queue.peek().isDone()) {
LOG.debug("Signal ordered stream element queue has completed head element."); // depends on control dependency: [if], data = [none]
headIsCompleted.signalAll(); // depends on control dependency: [if], data = [none]
}
} finally {
lock.unlock();
}
} }
|
public class class_name {
public void setCertificateEntry(String alias, Certificate cert) throws KeyStoreException, KeyException {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.entry(this, tc, "setCertificateEntry", new Object[] { alias, cert });
}
if (Boolean.parseBoolean(getProperty(Constants.SSLPROP_KEY_STORE_READ_ONLY))) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(this, tc, "Unable to update readonly store");
}
throw new KeyStoreException("Unable to add to read-only store");
}
final KeyStoreManager mgr = KeyStoreManager.getInstance();
try {
KeyStore jKeyStore = getKeyStore(false, false);
if (null == jKeyStore) {
final String keyStoreLocation = getProperty(Constants.SSLPROP_KEY_STORE);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Cannot load the Java keystore at location \"" + keyStoreLocation + "\"");
}
throw new KeyStoreException("Cannot load the Java keystore at location \"" + keyStoreLocation + "\"");
}
// store the cert... errors are thrown if conflicts or errors occur
jKeyStore.setCertificateEntry(alias, cert);
try {
store();
} catch (IOException e) {
// Note: debug + ffdc in store() itself
// on z/OS we have an issue where the certificate may be stored but the
// alias
// already exists in RACF so the keystore API will through an
// IOException
// we need to catch this condition on z/OS and if the certs is in the
// keystore
// prior after adding the certificate then we know the cert was actually
// added and its not
// a true failure. If the cert was not added then we need to rethrow the
// exception.
final String ksType = getProperty(Constants.SSLPROP_KEY_STORE_TYPE);
if ((ksType.equals(Constants.KEYSTORE_TYPE_JCERACFKS) || ksType.equals(Constants.KEYSTORE_TYPE_JCECCARACFKS)
|| ksType.equals(Constants.KEYSTORE_TYPE_JCEHYBRIDRACFKS))) {
KeyStore ks = getKeyStore(true, false);
if (mgr.checkIfSignerAlreadyExistsInTrustStore((X509Certificate) cert, ks)) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Certificate already exists in RACF: " + e.getMessage());
}
} else {
throw new KeyException(e.getMessage(), e);
}
} else {
throw new KeyException(e.getMessage(), e);
}
}
} catch (KeyStoreException kse) {
throw kse;
} catch (KeyException ke) {
throw ke;
} catch (Exception e) {
throw new KeyException(e.getMessage(), e);
}
// after adding the certificate, clear the keystore and SSL caches so it
// reloads it.
AbstractJSSEProvider.clearSSLContextCache();
mgr.clearJavaKeyStoresFromKeyStoreMap();
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.exit(this, tc, "setCertificateEntry");
}
} }
|
public class class_name {
public void setCertificateEntry(String alias, Certificate cert) throws KeyStoreException, KeyException {
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.entry(this, tc, "setCertificateEntry", new Object[] { alias, cert });
}
if (Boolean.parseBoolean(getProperty(Constants.SSLPROP_KEY_STORE_READ_ONLY))) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(this, tc, "Unable to update readonly store"); // depends on control dependency: [if], data = [none]
}
throw new KeyStoreException("Unable to add to read-only store");
}
final KeyStoreManager mgr = KeyStoreManager.getInstance();
try {
KeyStore jKeyStore = getKeyStore(false, false);
if (null == jKeyStore) {
final String keyStoreLocation = getProperty(Constants.SSLPROP_KEY_STORE);
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Cannot load the Java keystore at location \"" + keyStoreLocation + "\""); // depends on control dependency: [if], data = [none]
}
throw new KeyStoreException("Cannot load the Java keystore at location \"" + keyStoreLocation + "\"");
}
// store the cert... errors are thrown if conflicts or errors occur
jKeyStore.setCertificateEntry(alias, cert);
try {
store(); // depends on control dependency: [try], data = [none]
} catch (IOException e) {
// Note: debug + ffdc in store() itself
// on z/OS we have an issue where the certificate may be stored but the
// alias
// already exists in RACF so the keystore API will through an
// IOException
// we need to catch this condition on z/OS and if the certs is in the
// keystore
// prior after adding the certificate then we know the cert was actually
// added and its not
// a true failure. If the cert was not added then we need to rethrow the
// exception.
final String ksType = getProperty(Constants.SSLPROP_KEY_STORE_TYPE);
if ((ksType.equals(Constants.KEYSTORE_TYPE_JCERACFKS) || ksType.equals(Constants.KEYSTORE_TYPE_JCECCARACFKS)
|| ksType.equals(Constants.KEYSTORE_TYPE_JCEHYBRIDRACFKS))) {
KeyStore ks = getKeyStore(true, false);
if (mgr.checkIfSignerAlreadyExistsInTrustStore((X509Certificate) cert, ks)) {
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "Certificate already exists in RACF: " + e.getMessage()); // depends on control dependency: [if], data = [none]
}
} else {
throw new KeyException(e.getMessage(), e);
}
} else {
throw new KeyException(e.getMessage(), e);
}
} // depends on control dependency: [catch], data = [none]
} catch (KeyStoreException kse) {
throw kse;
} catch (KeyException ke) {
throw ke;
} catch (Exception e) {
throw new KeyException(e.getMessage(), e);
}
// after adding the certificate, clear the keystore and SSL caches so it
// reloads it.
AbstractJSSEProvider.clearSSLContextCache();
mgr.clearJavaKeyStoresFromKeyStoreMap();
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
Tr.exit(this, tc, "setCertificateEntry");
}
} }
|
public class class_name {
private CollisionResult computeCollision(CollisionCategory category, double ox, double oy, double x, double y)
{
final Tile tile = map.getTileAt(getPositionToSide(ox, x), getPositionToSide(oy, y));
if (tile != null)
{
final TileCollision tileCollision = tile.getFeature(TileCollision.class);
if (containsCollisionFormula(tileCollision, category))
{
final Double cx = getCollisionX(category, tileCollision, x, y);
final Double cy = getCollisionY(category, tileCollision, x, y);
// CHECKSTYLE IGNORE LINE: NestedIfDepth
if (cx != null || cy != null)
{
return new CollisionResult(cx, cy, tile);
}
}
}
return null;
} }
|
public class class_name {
private CollisionResult computeCollision(CollisionCategory category, double ox, double oy, double x, double y)
{
final Tile tile = map.getTileAt(getPositionToSide(ox, x), getPositionToSide(oy, y));
if (tile != null)
{
final TileCollision tileCollision = tile.getFeature(TileCollision.class);
if (containsCollisionFormula(tileCollision, category))
{
final Double cx = getCollisionX(category, tileCollision, x, y);
final Double cy = getCollisionY(category, tileCollision, x, y);
// CHECKSTYLE IGNORE LINE: NestedIfDepth
if (cx != null || cy != null)
{
return new CollisionResult(cx, cy, tile);
// depends on control dependency: [if], data = [(cx]
}
}
}
return null;
} }
|
public class class_name {
@Override
public SecurityUtilityReturnCodes handleTask(ConsoleWrapper stdin, PrintStream stdout, PrintStream stderr, String[] args) throws Exception {
this.stdin = stdin;
this.stdout = stdout;
validateArgumentList(args, Arrays.asList(new String[] { ARG_PASSWORD }));
String path = getArgumentValue(ARG_FILE, args, DEFAULT_LTPA_KEY_FILE);
String serverName = getArgumentValue(ARG_SERVER, args, null);
// Verify the server or client exists, if it does not then exit and do not create the certificate
// Do this first so we don't prompt for a password we'll not use
if (serverName != null) {
String usrServers = fileUtility.getServersDirectory();
String serverDir = usrServers + serverName + SLASH;
if (!fileUtility.exists(serverDir)) {
usrServers = fileUtility.resolvePath(usrServers);
stdout.println(getMessage("createLTPAKeys.abort"));
stdout.println(getMessage("serverNotFound", serverName, usrServers));
return SecurityUtilityReturnCodes.ERR_SERVER_NOT_FOUND;
}
// Create the directories we need before we prompt for a password
String location = serverDir + "resources" + SLASH + "security" + SLASH + "ltpa.keys";
location = fileUtility.resolvePath(location);
File fLocation = new File(location);
if (!fileUtility.createParentDirectory(stdout, fLocation)) {
stdout.println(getMessage("createLTPAKeys.abort"));
stdout.println(getMessage("file.requiredDirNotCreated", location));
return SecurityUtilityReturnCodes.ERR_PATH_CANNOT_BE_CREATED;
}
path = location;
}
if (fileUtility.exists(path)) {
stdout.println(getMessage("createLTPAKeys.abort"));
stdout.println(getMessage("createLTPAKeys.fileExists", path));
return SecurityUtilityReturnCodes.ERR_FILE_EXISTS;
} else {
String password = getArgumentValue(ARG_PASSWORD, args, null);
String encoding = getArgumentValue(ARG_ENCODING, args, PasswordUtil.getDefaultEncoding());
String key = getArgumentValue(ARG_KEY, args, null);
String encodedPassword = PasswordUtil.encode(password, encoding, key);
String xmlSnippet;
// If the keys are generated for a server, omit the keysFileName as it would end up
// being the default value
if (serverName != null) {
xmlSnippet = " <ltpa keysPassword=\"" + encodedPassword + "\" />";
} else {
xmlSnippet = " <ltpa keysPassword=\"" + encodedPassword + "\" keysFileName=\"" + path + "\" />";
}
ltpaKeyFileUtil.createLTPAKeysFile(path, password.getBytes());
stdout.println(getMessage("createLTPAKeys.createdFile", path, xmlSnippet));
return SecurityUtilityReturnCodes.OK;
}
} }
|
public class class_name {
@Override
public SecurityUtilityReturnCodes handleTask(ConsoleWrapper stdin, PrintStream stdout, PrintStream stderr, String[] args) throws Exception {
this.stdin = stdin;
this.stdout = stdout;
validateArgumentList(args, Arrays.asList(new String[] { ARG_PASSWORD }));
String path = getArgumentValue(ARG_FILE, args, DEFAULT_LTPA_KEY_FILE);
String serverName = getArgumentValue(ARG_SERVER, args, null);
// Verify the server or client exists, if it does not then exit and do not create the certificate
// Do this first so we don't prompt for a password we'll not use
if (serverName != null) {
String usrServers = fileUtility.getServersDirectory();
String serverDir = usrServers + serverName + SLASH;
if (!fileUtility.exists(serverDir)) {
usrServers = fileUtility.resolvePath(usrServers); // depends on control dependency: [if], data = [none]
stdout.println(getMessage("createLTPAKeys.abort"));
stdout.println(getMessage("serverNotFound", serverName, usrServers));
return SecurityUtilityReturnCodes.ERR_SERVER_NOT_FOUND;
}
// Create the directories we need before we prompt for a password
String location = serverDir + "resources" + SLASH + "security" + SLASH + "ltpa.keys";
location = fileUtility.resolvePath(location); // depends on control dependency: [if], data = [none]
File fLocation = new File(location);
if (!fileUtility.createParentDirectory(stdout, fLocation)) {
stdout.println(getMessage("createLTPAKeys.abort"));
stdout.println(getMessage("file.requiredDirNotCreated", location)); // depends on control dependency: [if], data = [none]
return SecurityUtilityReturnCodes.ERR_PATH_CANNOT_BE_CREATED; // depends on control dependency: [if], data = [none]
}
path = location; // depends on control dependency: [if], data = [none]
}
if (fileUtility.exists(path)) {
stdout.println(getMessage("createLTPAKeys.abort"));
stdout.println(getMessage("createLTPAKeys.fileExists", path)); // depends on control dependency: [if], data = [none]
return SecurityUtilityReturnCodes.ERR_FILE_EXISTS; // depends on control dependency: [if], data = [none]
} else {
String password = getArgumentValue(ARG_PASSWORD, args, null);
String encoding = getArgumentValue(ARG_ENCODING, args, PasswordUtil.getDefaultEncoding());
String key = getArgumentValue(ARG_KEY, args, null);
String encodedPassword = PasswordUtil.encode(password, encoding, key);
String xmlSnippet;
// If the keys are generated for a server, omit the keysFileName as it would end up
// being the default value
if (serverName != null) {
xmlSnippet = " <ltpa keysPassword=\"" + encodedPassword + "\" />"; // depends on control dependency: [if], data = [none]
} else {
xmlSnippet = " <ltpa keysPassword=\"" + encodedPassword + "\" keysFileName=\"" + path + "\" />"; // depends on control dependency: [if], data = [none]
}
ltpaKeyFileUtil.createLTPAKeysFile(path, password.getBytes()); // depends on control dependency: [if], data = [none]
stdout.println(getMessage("createLTPAKeys.createdFile", path, xmlSnippet)); // depends on control dependency: [if], data = [none]
return SecurityUtilityReturnCodes.OK; // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
@Pure
public static String getText(Node document, String... path) {
assert document != null : AssertMessages.notNullParameter(0);
Node parentNode = getNodeFromPath(document, path);
if (parentNode == null) {
parentNode = document;
}
final StringBuilder text = new StringBuilder();
final NodeList children = parentNode.getChildNodes();
final int len = children.getLength();
for (int i = 0; i < len; ++i) {
final Node child = children.item(i);
if (child instanceof Text) {
text.append(((Text) child).getWholeText());
}
}
if (text.length() > 0) {
return text.toString();
}
return null;
} }
|
public class class_name {
@Pure
public static String getText(Node document, String... path) {
assert document != null : AssertMessages.notNullParameter(0);
Node parentNode = getNodeFromPath(document, path);
if (parentNode == null) {
parentNode = document; // depends on control dependency: [if], data = [none]
}
final StringBuilder text = new StringBuilder();
final NodeList children = parentNode.getChildNodes();
final int len = children.getLength();
for (int i = 0; i < len; ++i) {
final Node child = children.item(i);
if (child instanceof Text) {
text.append(((Text) child).getWholeText()); // depends on control dependency: [if], data = [none]
}
}
if (text.length() > 0) {
return text.toString(); // depends on control dependency: [if], data = [none]
}
return null;
} }
|
public class class_name {
protected I_CmsXmlContentValue removeBookmark(String path, Locale locale) {
// remove mapping of element name to locale
Set<Locale> sl;
sl = m_elementLocales.get(path);
if (sl != null) {
sl.remove(locale);
}
// remove mapping of locale to element name
Set<String> sn = m_elementNames.get(locale);
if (sn != null) {
sn.remove(path);
}
// remove the bookmark and return the removed element
return m_bookmarks.remove(getBookmarkName(path, locale));
} }
|
public class class_name {
protected I_CmsXmlContentValue removeBookmark(String path, Locale locale) {
// remove mapping of element name to locale
Set<Locale> sl;
sl = m_elementLocales.get(path);
if (sl != null) {
sl.remove(locale); // depends on control dependency: [if], data = [none]
}
// remove mapping of locale to element name
Set<String> sn = m_elementNames.get(locale);
if (sn != null) {
sn.remove(path); // depends on control dependency: [if], data = [none]
}
// remove the bookmark and return the removed element
return m_bookmarks.remove(getBookmarkName(path, locale));
} }
|
public class class_name {
public static <T> Iterator<T> cycle(final Iterable<T> iterable) {
checkNotNull(iterable);
return new Iterator<T>() {
Iterator<T> iterator = emptyIterator();
Iterator<T> removeFrom;
@Override
public boolean hasNext() {
if (!iterator.hasNext()) {
iterator = iterable.iterator();
}
return iterator.hasNext();
}
@Override
public T next() {
if (!hasNext()) {
throw new NoSuchElementException();
}
removeFrom = iterator;
return iterator.next();
}
@Override
public void remove() {
checkRemove(removeFrom != null);
removeFrom.remove();
removeFrom = null;
}
};
} }
|
public class class_name {
public static <T> Iterator<T> cycle(final Iterable<T> iterable) {
checkNotNull(iterable);
return new Iterator<T>() {
Iterator<T> iterator = emptyIterator();
Iterator<T> removeFrom;
@Override
public boolean hasNext() {
if (!iterator.hasNext()) {
iterator = iterable.iterator(); // depends on control dependency: [if], data = [none]
}
return iterator.hasNext();
}
@Override
public T next() {
if (!hasNext()) {
throw new NoSuchElementException();
}
removeFrom = iterator;
return iterator.next();
}
@Override
public void remove() {
checkRemove(removeFrom != null);
removeFrom.remove();
removeFrom = null;
}
};
} }
|
public class class_name {
static boolean resolveLocks(Environment env, long startTs, TxStats stats,
List<Entry<Key, Value>> locksKVs, long startTime) {
// check if transactor is still alive
int numResolved = 0;
Map<ByteSequence, Mutation> mutations = new HashMap<>();
boolean timedOut = false;
TransactorCache transactorCache = env.getSharedResources().getTransactorCache();
List<LockInfo> locks = new ArrayList<>();
locksKVs.forEach(e -> locks.add(new LockInfo(e)));
List<LockInfo> locksToRecover;
if (System.currentTimeMillis() - startTime > env.getConfiguration()
.getTransactionRollbackTime()) {
locksToRecover = locks;
stats.incrementTimedOutLocks(locksToRecover.size());
timedOut = true;
} else {
locksToRecover = new ArrayList<>(locks.size());
for (LockInfo lockInfo : locks) {
if (transactorCache.checkTimedout(lockInfo.transactorId, lockInfo.lockTs)) {
locksToRecover.add(lockInfo);
stats.incrementTimedOutLocks();
} else if (!transactorCache.checkExists(lockInfo.transactorId)) {
locksToRecover.add(lockInfo);
stats.incrementDeadLocks();
}
}
}
Map<PrimaryRowColumn, List<LockInfo>> groupedLocks = groupLocksByPrimary(locksToRecover);
if (timedOut) {
Set<Entry<PrimaryRowColumn, List<LockInfo>>> es = groupedLocks.entrySet();
for (Entry<PrimaryRowColumn, List<LockInfo>> entry : es) {
long lockTs = entry.getKey().startTs;
Long transactorId = entry.getValue().get(0).transactorId;
transactorCache.addTimedoutTransactor(transactorId, lockTs, startTime);
}
}
TxInfoCache txiCache = env.getSharedResources().getTxInfoCache();
Set<Entry<PrimaryRowColumn, List<LockInfo>>> es = groupedLocks.entrySet();
for (Entry<PrimaryRowColumn, List<LockInfo>> group : es) {
TxInfo txInfo = txiCache.getTransactionInfo(group.getKey());
switch (txInfo.status) {
case COMMITTED:
commitColumns(env, group.getKey(), group.getValue(), txInfo.commitTs, mutations);
numResolved += group.getValue().size();
break;
case LOCKED:
if (rollbackPrimary(env, startTs, group.getKey(), txInfo.lockValue)) {
rollback(env, startTs, group.getKey(), group.getValue(), mutations);
numResolved += group.getValue().size();
}
break;
case ROLLED_BACK:
// TODO ensure this if ok if there concurrent rollback
rollback(env, startTs, group.getKey(), group.getValue(), mutations);
numResolved += group.getValue().size();
break;
case UNKNOWN:
default:
throw new IllegalStateException(
"can not abort : " + group.getKey() + " (" + txInfo.status + ")");
}
}
if (!mutations.isEmpty()) {
env.getSharedResources().getBatchWriter().writeMutations(new ArrayList<>(mutations.values()));
}
return numResolved == locks.size();
} }
|
public class class_name {
static boolean resolveLocks(Environment env, long startTs, TxStats stats,
List<Entry<Key, Value>> locksKVs, long startTime) {
// check if transactor is still alive
int numResolved = 0;
Map<ByteSequence, Mutation> mutations = new HashMap<>();
boolean timedOut = false;
TransactorCache transactorCache = env.getSharedResources().getTransactorCache();
List<LockInfo> locks = new ArrayList<>();
locksKVs.forEach(e -> locks.add(new LockInfo(e)));
List<LockInfo> locksToRecover;
if (System.currentTimeMillis() - startTime > env.getConfiguration()
.getTransactionRollbackTime()) {
locksToRecover = locks; // depends on control dependency: [if], data = [none]
stats.incrementTimedOutLocks(locksToRecover.size()); // depends on control dependency: [if], data = [none]
timedOut = true; // depends on control dependency: [if], data = [none]
} else {
locksToRecover = new ArrayList<>(locks.size()); // depends on control dependency: [if], data = [none]
for (LockInfo lockInfo : locks) {
if (transactorCache.checkTimedout(lockInfo.transactorId, lockInfo.lockTs)) {
locksToRecover.add(lockInfo); // depends on control dependency: [if], data = [none]
stats.incrementTimedOutLocks(); // depends on control dependency: [if], data = [none]
} else if (!transactorCache.checkExists(lockInfo.transactorId)) {
locksToRecover.add(lockInfo); // depends on control dependency: [if], data = [none]
stats.incrementDeadLocks(); // depends on control dependency: [if], data = [none]
}
}
}
Map<PrimaryRowColumn, List<LockInfo>> groupedLocks = groupLocksByPrimary(locksToRecover);
if (timedOut) {
Set<Entry<PrimaryRowColumn, List<LockInfo>>> es = groupedLocks.entrySet();
for (Entry<PrimaryRowColumn, List<LockInfo>> entry : es) {
long lockTs = entry.getKey().startTs;
Long transactorId = entry.getValue().get(0).transactorId;
transactorCache.addTimedoutTransactor(transactorId, lockTs, startTime); // depends on control dependency: [for], data = [none]
}
}
TxInfoCache txiCache = env.getSharedResources().getTxInfoCache();
Set<Entry<PrimaryRowColumn, List<LockInfo>>> es = groupedLocks.entrySet();
for (Entry<PrimaryRowColumn, List<LockInfo>> group : es) {
TxInfo txInfo = txiCache.getTransactionInfo(group.getKey());
switch (txInfo.status) {
case COMMITTED:
commitColumns(env, group.getKey(), group.getValue(), txInfo.commitTs, mutations);
numResolved += group.getValue().size();
break;
case LOCKED:
if (rollbackPrimary(env, startTs, group.getKey(), txInfo.lockValue)) {
rollback(env, startTs, group.getKey(), group.getValue(), mutations); // depends on control dependency: [if], data = [none]
numResolved += group.getValue().size(); // depends on control dependency: [if], data = [none]
}
break;
case ROLLED_BACK:
// TODO ensure this if ok if there concurrent rollback
rollback(env, startTs, group.getKey(), group.getValue(), mutations);
numResolved += group.getValue().size();
break;
case UNKNOWN:
default:
throw new IllegalStateException(
"can not abort : " + group.getKey() + " (" + txInfo.status + ")");
}
}
if (!mutations.isEmpty()) {
env.getSharedResources().getBatchWriter().writeMutations(new ArrayList<>(mutations.values())); // depends on control dependency: [if], data = [none]
}
return numResolved == locks.size();
} }
|
public class class_name {
@Override
public BsonDocument toBsonDocument() {
final BsonDocument asDoc = new BsonDocument();
asDoc.put(Fields.ID_FIELD, id);
asDoc.put(Fields.OPERATION_TYPE_FIELD, new BsonString(getOperationType().toRemote()));
final BsonDocument nsDoc = new BsonDocument();
nsDoc.put(Fields.NS_DB_FIELD, new BsonString(ns.getDatabaseName()));
nsDoc.put(Fields.NS_COLL_FIELD, new BsonString(getNamespace().getCollectionName()));
asDoc.put(Fields.NS_FIELD, nsDoc);
asDoc.put(Fields.DOCUMENT_KEY_FIELD, getDocumentKey());
if (getFullDocument() != null && (getFullDocument() instanceof BsonValue)
&& ((BsonValue) getFullDocument()).isDocument()) {
asDoc.put(Fields.FULL_DOCUMENT_FIELD, (BsonValue) getFullDocument());
}
if (getUpdateDescription() != null) {
asDoc.put(Fields.UPDATE_DESCRIPTION_FIELD, getUpdateDescription().toBsonDocument());
}
asDoc.put(Fields.WRITE_PENDING_FIELD, new BsonBoolean(hasUncommittedWrites()));
return asDoc;
} }
|
public class class_name {
@Override
public BsonDocument toBsonDocument() {
final BsonDocument asDoc = new BsonDocument();
asDoc.put(Fields.ID_FIELD, id);
asDoc.put(Fields.OPERATION_TYPE_FIELD, new BsonString(getOperationType().toRemote()));
final BsonDocument nsDoc = new BsonDocument();
nsDoc.put(Fields.NS_DB_FIELD, new BsonString(ns.getDatabaseName()));
nsDoc.put(Fields.NS_COLL_FIELD, new BsonString(getNamespace().getCollectionName()));
asDoc.put(Fields.NS_FIELD, nsDoc);
asDoc.put(Fields.DOCUMENT_KEY_FIELD, getDocumentKey());
if (getFullDocument() != null && (getFullDocument() instanceof BsonValue)
&& ((BsonValue) getFullDocument()).isDocument()) {
asDoc.put(Fields.FULL_DOCUMENT_FIELD, (BsonValue) getFullDocument()); // depends on control dependency: [if], data = [none]
}
if (getUpdateDescription() != null) {
asDoc.put(Fields.UPDATE_DESCRIPTION_FIELD, getUpdateDescription().toBsonDocument()); // depends on control dependency: [if], data = [none]
}
asDoc.put(Fields.WRITE_PENDING_FIELD, new BsonBoolean(hasUncommittedWrites()));
return asDoc;
} }
|
public class class_name {
public TenantOperationResponse importWithResources(
final ITenant tenant, final Set<Resource> resources) {
/*
* First load dom4j Documents and sort the entity files into the proper order
*/
final Map<PortalDataKey, Set<BucketTuple>> importQueue;
try {
importQueue = prepareImportQueue(tenant, resources);
} catch (Exception e) {
final TenantOperationResponse error =
new TenantOperationResponse(this, TenantOperationResponse.Result.ABORT);
error.addMessage(
createLocalizedMessage(
FAILED_TO_LOAD_TENANT_TEMPLATE, new String[] {tenant.getName()}));
return error;
}
log.trace(
"Ready to import data entity templates for new tenant '{}'; importQueue={}",
tenant.getName(),
importQueue);
// We're going to report on every item imported; TODO it would be better
// if we could display human-friendly entity type name + sysid (fname, etc.)
final StringBuilder importReport = new StringBuilder();
/*
* Now import the identified entities each bucket in turn
*/
try {
importQueue(tenant, importQueue, importReport);
} catch (Exception e) {
final TenantOperationResponse error =
new TenantOperationResponse(this, TenantOperationResponse.Result.ABORT);
error.addMessage(finalizeImportReport(importReport));
error.addMessage(
createLocalizedMessage(
FAILED_TO_IMPORT_TENANT_TEMPLATE_DATA,
new String[] {tenant.getName()}));
return error;
}
TenantOperationResponse rslt =
new TenantOperationResponse(this, TenantOperationResponse.Result.SUCCESS);
rslt.addMessage(finalizeImportReport(importReport));
rslt.addMessage(
createLocalizedMessage(TENANT_ENTITIES_IMPORTED, new String[] {tenant.getName()}));
return rslt;
} }
|
public class class_name {
public TenantOperationResponse importWithResources(
final ITenant tenant, final Set<Resource> resources) {
/*
* First load dom4j Documents and sort the entity files into the proper order
*/
final Map<PortalDataKey, Set<BucketTuple>> importQueue;
try {
importQueue = prepareImportQueue(tenant, resources); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
final TenantOperationResponse error =
new TenantOperationResponse(this, TenantOperationResponse.Result.ABORT);
error.addMessage(
createLocalizedMessage(
FAILED_TO_LOAD_TENANT_TEMPLATE, new String[] {tenant.getName()}));
return error;
} // depends on control dependency: [catch], data = [none]
log.trace(
"Ready to import data entity templates for new tenant '{}'; importQueue={}",
tenant.getName(),
importQueue);
// We're going to report on every item imported; TODO it would be better
// if we could display human-friendly entity type name + sysid (fname, etc.)
final StringBuilder importReport = new StringBuilder();
/*
* Now import the identified entities each bucket in turn
*/
try {
importQueue(tenant, importQueue, importReport); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
final TenantOperationResponse error =
new TenantOperationResponse(this, TenantOperationResponse.Result.ABORT);
error.addMessage(finalizeImportReport(importReport));
error.addMessage(
createLocalizedMessage(
FAILED_TO_IMPORT_TENANT_TEMPLATE_DATA,
new String[] {tenant.getName()}));
return error;
} // depends on control dependency: [catch], data = [none]
TenantOperationResponse rslt =
new TenantOperationResponse(this, TenantOperationResponse.Result.SUCCESS);
rslt.addMessage(finalizeImportReport(importReport));
rslt.addMessage(
createLocalizedMessage(TENANT_ENTITIES_IMPORTED, new String[] {tenant.getName()}));
return rslt;
} }
|
public class class_name {
@Override
public EClass getStoreExtendedData() {
if (storeExtendedDataEClass == null) {
storeExtendedDataEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(StorePackage.eNS_URI).getEClassifiers().get(115);
}
return storeExtendedDataEClass;
} }
|
public class class_name {
@Override
public EClass getStoreExtendedData() {
if (storeExtendedDataEClass == null) {
storeExtendedDataEClass = (EClass) EPackage.Registry.INSTANCE.getEPackage(StorePackage.eNS_URI).getEClassifiers().get(115);
// depends on control dependency: [if], data = [none]
}
return storeExtendedDataEClass;
} }
|
public class class_name {
public int deleteProperty(String property) {
int count = 0;
if (has()) {
TDao dao = getDao();
String where = dao.buildWhere(COLUMN_PROPERTY, property);
String[] whereArgs = dao.buildWhereArgs(property);
count = dao.delete(where, whereArgs);
}
return count;
} }
|
public class class_name {
public int deleteProperty(String property) {
int count = 0;
if (has()) {
TDao dao = getDao();
String where = dao.buildWhere(COLUMN_PROPERTY, property);
String[] whereArgs = dao.buildWhereArgs(property);
count = dao.delete(where, whereArgs); // depends on control dependency: [if], data = [none]
}
return count;
} }
|
public class class_name {
public Collection<Axiom> getInferredAxioms() {
final Collection<Axiom> inferred = new HashSet<>();
if(!isClassified) classify();
if (!no.isTaxonomyComputed()) {
log.info("Building taxonomy");
no.buildTaxonomy();
}
final Map<String, Node> taxonomy = no.getTaxonomy();
final IConceptMap<Context> contextIndex = no.getContextIndex();
final IntIterator itr = contextIndex.keyIterator();
while (itr.hasNext()) {
final int key = itr.next();
final String id = factory.lookupConceptId(key).toString();
if (factory.isVirtualConcept(key) || NamedConcept.BOTTOM.equals(id)) {
continue;
}
Concept rhs = getNecessary(contextIndex, taxonomy, key);
final Concept lhs = new NamedConcept(id);
if (!lhs.equals(rhs) && !rhs.equals(NamedConcept.TOP_CONCEPT)) { // skip trivial axioms
inferred.add(new ConceptInclusion(lhs, rhs));
}
}
return inferred;
} }
|
public class class_name {
public Collection<Axiom> getInferredAxioms() {
final Collection<Axiom> inferred = new HashSet<>();
if(!isClassified) classify();
if (!no.isTaxonomyComputed()) {
log.info("Building taxonomy"); // depends on control dependency: [if], data = [none]
no.buildTaxonomy(); // depends on control dependency: [if], data = [none]
}
final Map<String, Node> taxonomy = no.getTaxonomy();
final IConceptMap<Context> contextIndex = no.getContextIndex();
final IntIterator itr = contextIndex.keyIterator();
while (itr.hasNext()) {
final int key = itr.next();
final String id = factory.lookupConceptId(key).toString();
if (factory.isVirtualConcept(key) || NamedConcept.BOTTOM.equals(id)) {
continue;
}
Concept rhs = getNecessary(contextIndex, taxonomy, key);
final Concept lhs = new NamedConcept(id);
if (!lhs.equals(rhs) && !rhs.equals(NamedConcept.TOP_CONCEPT)) { // skip trivial axioms
inferred.add(new ConceptInclusion(lhs, rhs)); // depends on control dependency: [if], data = [none]
}
}
return inferred;
} }
|
public class class_name {
protected MapPosition getInitialPosition() {
MapDataStore mapFile = getMapFile();
if (mapFile.startPosition() != null) {
Byte startZoomLevel = mapFile.startZoomLevel();
if (startZoomLevel == null) {
// it is actually possible to have no start zoom level in the file
startZoomLevel = new Byte((byte) 12);
}
return new MapPosition(mapFile.startPosition(), startZoomLevel);
} else {
return getDefaultInitialPosition();
}
} }
|
public class class_name {
protected MapPosition getInitialPosition() {
MapDataStore mapFile = getMapFile();
if (mapFile.startPosition() != null) {
Byte startZoomLevel = mapFile.startZoomLevel();
if (startZoomLevel == null) {
// it is actually possible to have no start zoom level in the file
startZoomLevel = new Byte((byte) 12); // depends on control dependency: [if], data = [none]
}
return new MapPosition(mapFile.startPosition(), startZoomLevel); // depends on control dependency: [if], data = [(mapFile.startPosition()]
} else {
return getDefaultInitialPosition(); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
@SuppressWarnings({"rawtypes", "unchecked"})
private void initializeFormFieldWidget(final I_CmsFormField formField) {
final I_CmsFormWidget widget = formField.getWidget();
if (widget instanceof HasValueChangeHandlers) {
((HasValueChangeHandlers)widget).addValueChangeHandler(new ValueChangeHandler() {
/**
* @see com.google.gwt.event.logical.shared.ValueChangeHandler#onValueChange(ValueChangeEvent event)
*/
public void onValueChange(ValueChangeEvent event) {
boolean inhibitValidation = false;
if (event instanceof CmsExtendedValueChangeEvent) {
CmsExtendedValueChangeEvent extEvent = (CmsExtendedValueChangeEvent)event;
inhibitValidation = extEvent.isInhibitValidation();
}
Object eventValue = event.getValue();
if ((eventValue instanceof String) || (event.getValue() == null)) {
// only makes sense for strings
defaultHandleValueChange(formField, (String)(event.getValue()), inhibitValidation);
} else if (eventValue instanceof Date) {
defaultHandleValueChange(formField, "" + ((Date)eventValue).getTime(), inhibitValidation);
} else if (eventValue instanceof Boolean) {
defaultHandleValueChange(formField, "" + eventValue, inhibitValidation);
}
}
});
}
if (widget instanceof HasKeyPressHandlers) {
((HasKeyPressHandlers)widget).addKeyPressHandler(new KeyPressHandler() {
/**
* @see com.google.gwt.event.dom.client.KeyPressHandler#onKeyPress(com.google.gwt.event.dom.client.KeyPressEvent)
*/
public void onKeyPress(KeyPressEvent event) {
int keyCode = event.getNativeEvent().getKeyCode();
defaultHandleKeyPress(formField, keyCode);
}
});
}
} }
|
public class class_name {
@SuppressWarnings({"rawtypes", "unchecked"})
private void initializeFormFieldWidget(final I_CmsFormField formField) {
final I_CmsFormWidget widget = formField.getWidget();
if (widget instanceof HasValueChangeHandlers) {
((HasValueChangeHandlers)widget).addValueChangeHandler(new ValueChangeHandler() {
/**
* @see com.google.gwt.event.logical.shared.ValueChangeHandler#onValueChange(ValueChangeEvent event)
*/
public void onValueChange(ValueChangeEvent event) {
boolean inhibitValidation = false;
if (event instanceof CmsExtendedValueChangeEvent) {
CmsExtendedValueChangeEvent extEvent = (CmsExtendedValueChangeEvent)event;
inhibitValidation = extEvent.isInhibitValidation(); // depends on control dependency: [if], data = [none]
}
Object eventValue = event.getValue();
if ((eventValue instanceof String) || (event.getValue() == null)) {
// only makes sense for strings
defaultHandleValueChange(formField, (String)(event.getValue()), inhibitValidation); // depends on control dependency: [if], data = [none]
} else if (eventValue instanceof Date) {
defaultHandleValueChange(formField, "" + ((Date)eventValue).getTime(), inhibitValidation); // depends on control dependency: [if], data = [none]
} else if (eventValue instanceof Boolean) {
defaultHandleValueChange(formField, "" + eventValue, inhibitValidation); // depends on control dependency: [if], data = [none]
}
}
}); // depends on control dependency: [if], data = [none]
}
if (widget instanceof HasKeyPressHandlers) {
((HasKeyPressHandlers)widget).addKeyPressHandler(new KeyPressHandler() {
/**
* @see com.google.gwt.event.dom.client.KeyPressHandler#onKeyPress(com.google.gwt.event.dom.client.KeyPressEvent)
*/
public void onKeyPress(KeyPressEvent event) {
int keyCode = event.getNativeEvent().getKeyCode();
defaultHandleKeyPress(formField, keyCode);
}
}); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
@Override
public Set<VM> getMisPlacedVMs(Instance i) {
for (SatConstraint c : i.getSatConstraints()) {
if (!(c instanceof ResourceRelated && ((ResourceRelated) c).getResource().equals(rc.getResourceIdentifier()))) {
continue;
}
if (c instanceof Preserve) {
VM v = c.getInvolvedVMs().iterator().next();
wantedAmount.put(v, consumption(v, ((Preserve) c).getAmount()));
} else if (c instanceof Overbook) {
Node n = c.getInvolvedNodes().iterator().next();
wantedRatios.put(n, ratio(n, ((Overbook) c).getRatio()));
} else if (c instanceof ResourceCapacity && c.getInvolvedNodes().size() == 1) {
Node n = c.getInvolvedNodes().iterator().next();
wantedCapacity.put(n, capacity(n, ((ResourceCapacity) c).getAmount()));
}
}
Mapping m = i.getModel().getMapping();
Set<VM> candidates = new HashSet<>();
for (Node n : m.getOnlineNodes()) {
if (overloaded(m, n)) {
candidates.addAll(m.getRunningVMs(n));
}
}
return candidates;
} }
|
public class class_name {
@Override
public Set<VM> getMisPlacedVMs(Instance i) {
for (SatConstraint c : i.getSatConstraints()) {
if (!(c instanceof ResourceRelated && ((ResourceRelated) c).getResource().equals(rc.getResourceIdentifier()))) {
continue;
}
if (c instanceof Preserve) {
VM v = c.getInvolvedVMs().iterator().next();
wantedAmount.put(v, consumption(v, ((Preserve) c).getAmount())); // depends on control dependency: [if], data = [none]
} else if (c instanceof Overbook) {
Node n = c.getInvolvedNodes().iterator().next();
wantedRatios.put(n, ratio(n, ((Overbook) c).getRatio())); // depends on control dependency: [if], data = [none]
} else if (c instanceof ResourceCapacity && c.getInvolvedNodes().size() == 1) {
Node n = c.getInvolvedNodes().iterator().next();
wantedCapacity.put(n, capacity(n, ((ResourceCapacity) c).getAmount())); // depends on control dependency: [if], data = [none]
}
}
Mapping m = i.getModel().getMapping();
Set<VM> candidates = new HashSet<>();
for (Node n : m.getOnlineNodes()) {
if (overloaded(m, n)) {
candidates.addAll(m.getRunningVMs(n)); // depends on control dependency: [if], data = [none]
}
}
return candidates;
} }
|
public class class_name {
public SIBUuid8 getRemoteMEUuid()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
{
SibTr.entry(this, tc, "getRemoteMEUuid");
SibTr.exit(this, tc, "getRemoteMEUuid", remoteMEUuid);
}
return remoteMEUuid;
} }
|
public class class_name {
public SIBUuid8 getRemoteMEUuid()
{
if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
{
SibTr.entry(this, tc, "getRemoteMEUuid"); // depends on control dependency: [if], data = [none]
SibTr.exit(this, tc, "getRemoteMEUuid", remoteMEUuid); // depends on control dependency: [if], data = [none]
}
return remoteMEUuid;
} }
|
public class class_name {
@Override
public boolean isCapabilitySatisfied(Collection<ProvisioningFeatureDefinition> featureDefinitionsToCheck) {
// If it isn't an autofeature, it's satisfied.
if (!iAttr.isAutoFeature)
return true;
if (mfDetails == null)
throw new IllegalStateException("Method called outside of provisioining operation or without a registered service");
boolean isCapabilitySatisfied = true;
Iterator<Filter> iter = mfDetails.getCapabilityFilters().iterator();
Set<ProvisioningFeatureDefinition> satisfiedFeatureDefs = new HashSet<ProvisioningFeatureDefinition>();
// Now we need to iterate over each of the filters, until we find we don't have a match.
while (iter.hasNext() && isCapabilitySatisfied) {
Filter checkFilter = iter.next();
Iterator<ProvisioningFeatureDefinition> featureDefIter = featureDefinitionsToCheck.iterator();
// Now for each filter, iterate over each of the FeatureDefinition headers, checking to see if we have a match.
boolean featureMatch = false;
while (featureDefIter.hasNext() && !featureMatch) {
ProvisioningFeatureDefinition featureDef = featureDefIter.next();
// If we've already satisfied a capability with this FeatureDefinition, we don't need to use it again
if (!satisfiedFeatureDefs.contains(featureDef)) {
// We have a mismatch between the key the filter is using to look up the feature name and the property containing the name in the
// headers. So we need to add a new property for osgi.identity (filter key) that contains the value of the
// Subsystem-SymbolicName (manifest header).
// We also have to do this for the Subsystem-Type(manifest header) and the type (filter key).
Map<String, String> filterProps = new HashMap<String, String>();
filterProps.put(FeatureDefinitionUtils.FILTER_FEATURE_KEY, featureDef.getSymbolicName());
try {
filterProps.put(FeatureDefinitionUtils.FILTER_TYPE_KEY,
mfDetails.getMainAttributeValue(FeatureDefinitionUtils.TYPE));
} catch (IOException e) {
// We should be well beyond any IOException issues..
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "IOException reading manifest attribute from {0}: {1}", iAttr.featureFile, e);
}
continue;
}
if (checkFilter.matches(filterProps)) {
satisfiedFeatureDefs.add(featureDef);
featureMatch = true;
}
}
}
// Once we've checked all the FeatureDefinitions, apply the result to the isCapabilitySatisfied boolean,
// so we stop processing as soon as we know we don't have a match.
isCapabilitySatisfied = featureMatch;
}
return isCapabilitySatisfied;
} }
|
public class class_name {
@Override
public boolean isCapabilitySatisfied(Collection<ProvisioningFeatureDefinition> featureDefinitionsToCheck) {
// If it isn't an autofeature, it's satisfied.
if (!iAttr.isAutoFeature)
return true;
if (mfDetails == null)
throw new IllegalStateException("Method called outside of provisioining operation or without a registered service");
boolean isCapabilitySatisfied = true;
Iterator<Filter> iter = mfDetails.getCapabilityFilters().iterator();
Set<ProvisioningFeatureDefinition> satisfiedFeatureDefs = new HashSet<ProvisioningFeatureDefinition>();
// Now we need to iterate over each of the filters, until we find we don't have a match.
while (iter.hasNext() && isCapabilitySatisfied) {
Filter checkFilter = iter.next();
Iterator<ProvisioningFeatureDefinition> featureDefIter = featureDefinitionsToCheck.iterator();
// Now for each filter, iterate over each of the FeatureDefinition headers, checking to see if we have a match.
boolean featureMatch = false;
while (featureDefIter.hasNext() && !featureMatch) {
ProvisioningFeatureDefinition featureDef = featureDefIter.next();
// If we've already satisfied a capability with this FeatureDefinition, we don't need to use it again
if (!satisfiedFeatureDefs.contains(featureDef)) {
// We have a mismatch between the key the filter is using to look up the feature name and the property containing the name in the
// headers. So we need to add a new property for osgi.identity (filter key) that contains the value of the
// Subsystem-SymbolicName (manifest header).
// We also have to do this for the Subsystem-Type(manifest header) and the type (filter key).
Map<String, String> filterProps = new HashMap<String, String>();
filterProps.put(FeatureDefinitionUtils.FILTER_FEATURE_KEY, featureDef.getSymbolicName()); // depends on control dependency: [if], data = [none]
try {
filterProps.put(FeatureDefinitionUtils.FILTER_TYPE_KEY,
mfDetails.getMainAttributeValue(FeatureDefinitionUtils.TYPE)); // depends on control dependency: [try], data = [none]
} catch (IOException e) {
// We should be well beyond any IOException issues..
if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
Tr.debug(tc, "IOException reading manifest attribute from {0}: {1}", iAttr.featureFile, e); // depends on control dependency: [if], data = [none]
}
continue;
} // depends on control dependency: [catch], data = [none]
if (checkFilter.matches(filterProps)) {
satisfiedFeatureDefs.add(featureDef); // depends on control dependency: [if], data = [none]
featureMatch = true; // depends on control dependency: [if], data = [none]
}
}
}
// Once we've checked all the FeatureDefinitions, apply the result to the isCapabilitySatisfied boolean,
// so we stop processing as soon as we know we don't have a match.
isCapabilitySatisfied = featureMatch; // depends on control dependency: [while], data = [none]
}
return isCapabilitySatisfied;
} }
|
public class class_name {
public static NodeSequence withBatches( final Collection<Batch> batches,
final int width ) {
if (batches == null || batches.isEmpty()) return emptySequence(width);
if (batches.size() == 1) {
Batch batch = batches.iterator().next();
assert width == batch.width();
return withBatch(batch);
}
// Tally the size of each batch ...
long rowCount = 0L;
for (Batch batch : batches) {
long count = batch.rowCount();
rowCount = count < 0L ? -1L : rowCount + count;
}
return withBatches(batches.iterator(), width, rowCount);
} }
|
public class class_name {
public static NodeSequence withBatches( final Collection<Batch> batches,
final int width ) {
if (batches == null || batches.isEmpty()) return emptySequence(width);
if (batches.size() == 1) {
Batch batch = batches.iterator().next();
assert width == batch.width();
return withBatch(batch); // depends on control dependency: [if], data = [none]
}
// Tally the size of each batch ...
long rowCount = 0L;
for (Batch batch : batches) {
long count = batch.rowCount();
rowCount = count < 0L ? -1L : rowCount + count; // depends on control dependency: [for], data = [none]
}
return withBatches(batches.iterator(), width, rowCount);
} }
|
public class class_name {
public static LdapName removeFirst(Name dn, Name pathToRemove) {
Assert.notNull(dn, "dn must not be null");
Assert.notNull(pathToRemove, "pathToRemove must not be null");
LdapName result = newLdapName(dn);
LdapName path = returnOrConstructLdapNameFromName(pathToRemove);
if(path.size() == 0 || !dn.startsWith(path)) {
return result;
}
for(int i = 0; i < path.size(); i++) {
try {
result.remove(0);
} catch (InvalidNameException e) {
throw convertLdapException(e);
}
}
return result;
} }
|
public class class_name {
public static LdapName removeFirst(Name dn, Name pathToRemove) {
Assert.notNull(dn, "dn must not be null");
Assert.notNull(pathToRemove, "pathToRemove must not be null");
LdapName result = newLdapName(dn);
LdapName path = returnOrConstructLdapNameFromName(pathToRemove);
if(path.size() == 0 || !dn.startsWith(path)) {
return result; // depends on control dependency: [if], data = [none]
}
for(int i = 0; i < path.size(); i++) {
try {
result.remove(0); // depends on control dependency: [try], data = [none]
} catch (InvalidNameException e) {
throw convertLdapException(e);
} // depends on control dependency: [catch], data = [none]
}
return result;
} }
|
public class class_name {
@Override
public double validate(IMolecularFormula formula) throws CDKException {
logger.info("Start validation of ", formula);
double mass = MolecularFormulaManipulator.getTotalMassNumber(formula);
if (mass == 0) return 0.0;
int numberN = MolecularFormulaManipulator.getElementCount(formula,
formula.getBuilder().newInstance(IElement.class, "N"));
numberN += getOthers(formula);
if (formula.getCharge() == null || formula.getCharge() == 0 || !isOdd(Math.abs(formula.getCharge()))) {
if (isOdd(mass) && isOdd(numberN)) {
return 1.0;
} else if (!isOdd(mass) && (numberN == 0 || !isOdd(numberN))) {
return 1.0;
} else
return 0.0;
} else {
if (!isOdd(mass) && isOdd(numberN)) {
return 1.0;
} else if (isOdd(mass) && (numberN == 0 || !isOdd(numberN))) {
return 1.0;
} else
return 0.0;
}
} }
|
public class class_name {
@Override
public double validate(IMolecularFormula formula) throws CDKException {
logger.info("Start validation of ", formula);
double mass = MolecularFormulaManipulator.getTotalMassNumber(formula);
if (mass == 0) return 0.0;
int numberN = MolecularFormulaManipulator.getElementCount(formula,
formula.getBuilder().newInstance(IElement.class, "N"));
numberN += getOthers(formula);
if (formula.getCharge() == null || formula.getCharge() == 0 || !isOdd(Math.abs(formula.getCharge()))) {
if (isOdd(mass) && isOdd(numberN)) {
return 1.0; // depends on control dependency: [if], data = [none]
} else if (!isOdd(mass) && (numberN == 0 || !isOdd(numberN))) {
return 1.0; // depends on control dependency: [if], data = [none]
} else
return 0.0;
} else {
if (!isOdd(mass) && isOdd(numberN)) {
return 1.0; // depends on control dependency: [if], data = [none]
} else if (isOdd(mass) && (numberN == 0 || !isOdd(numberN))) {
return 1.0; // depends on control dependency: [if], data = [none]
} else
return 0.0;
}
} }
|
public class class_name {
public static long getTimeMicros() {
// Use use a dedicated lock object rather than synchronizing on the method, which
// would synchronize on the Utils.class object, which is too coarse-grained.
synchronized (g_lastMicroLock) {
// We use System.currentTimeMillis() * 1000 for compatibility with the CLI and
// other tools. This makes our timestamps "milliseconds since the epoch".
long newValue = System.currentTimeMillis() * 1000;
if (newValue <= g_lastMicroValue) {
// Either two threads called us very quickly or the system clock was set
// back a little. Just return the last value allocated + 1. Eventually,
// the system clock will catch up.
newValue = g_lastMicroValue + 1;
}
g_lastMicroValue = newValue;
return newValue;
}
} }
|
public class class_name {
public static long getTimeMicros() {
// Use use a dedicated lock object rather than synchronizing on the method, which
// would synchronize on the Utils.class object, which is too coarse-grained.
synchronized (g_lastMicroLock) {
// We use System.currentTimeMillis() * 1000 for compatibility with the CLI and
// other tools. This makes our timestamps "milliseconds since the epoch".
long newValue = System.currentTimeMillis() * 1000;
if (newValue <= g_lastMicroValue) {
// Either two threads called us very quickly or the system clock was set
// back a little. Just return the last value allocated + 1. Eventually,
// the system clock will catch up.
newValue = g_lastMicroValue + 1;
// depends on control dependency: [if], data = [none]
}
g_lastMicroValue = newValue;
return newValue;
}
} }
|
public class class_name {
public String[] makeSvmLabelMap() {
String[] labelMap = new String[numClasses()];
if (numClasses() > 2) {
for (int i = 0; i < labelMap.length; i++) {
labelMap[i] = String.valueOf((i + 1));
}
} else {
labelMap = new String[]{"+1", "-1"};
}
return labelMap;
} }
|
public class class_name {
public String[] makeSvmLabelMap() {
String[] labelMap = new String[numClasses()];
if (numClasses() > 2) {
for (int i = 0; i < labelMap.length; i++) {
labelMap[i] = String.valueOf((i + 1));
// depends on control dependency: [for], data = [i]
}
} else {
labelMap = new String[]{"+1", "-1"};
// depends on control dependency: [if], data = [none]
}
return labelMap;
} }
|
public class class_name {
public ValidationData findListParent() {
if (!this.listChild) {
return null;
}
ValidationData parent = this.parent;
while (parent != null && !parent.isList()) {
parent = parent.parent;
}
return parent;
} }
|
public class class_name {
public ValidationData findListParent() {
if (!this.listChild) {
return null; // depends on control dependency: [if], data = [none]
}
ValidationData parent = this.parent;
while (parent != null && !parent.isList()) {
parent = parent.parent; // depends on control dependency: [while], data = [none]
}
return parent;
} }
|
public class class_name {
public void setSkeleton(GVRSkeleton newSkel)
{
if (mSkeleton == newSkel)
{
return;
}
int[] newMap = new int[newSkel.getNumBones()];
for (int i = 0; i < mBoneMap.length; ++i)
{
int oldIndex = mBoneMap[i];
String boneName = mSkeleton.getBoneName(oldIndex);
int newIndex = newSkel.getBoneIndex(boneName);
if (newIndex >= 0)
{
newMap[i] = newIndex;
}
else
{
throw new IllegalArgumentException("Destination skeleton does not have bone " + boneName);
}
}
mBoneMap = newMap;
mSkeleton = newSkel;
} }
|
public class class_name {
public void setSkeleton(GVRSkeleton newSkel)
{
if (mSkeleton == newSkel)
{
return; // depends on control dependency: [if], data = [none]
}
int[] newMap = new int[newSkel.getNumBones()];
for (int i = 0; i < mBoneMap.length; ++i)
{
int oldIndex = mBoneMap[i];
String boneName = mSkeleton.getBoneName(oldIndex);
int newIndex = newSkel.getBoneIndex(boneName);
if (newIndex >= 0)
{
newMap[i] = newIndex; // depends on control dependency: [if], data = [none]
}
else
{
throw new IllegalArgumentException("Destination skeleton does not have bone " + boneName);
}
}
mBoneMap = newMap;
mSkeleton = newSkel;
} }
|
public class class_name {
@Override
public SparseTensor elementwiseProduct(Tensor other) {
int[] dimensionNums = getDimensionNumbers();
int[] dimensionSizes = getDimensionSizes();
int[] otherDimensions = other.getDimensionNumbers();
int[] otherSizes = other.getDimensionSizes();
// Check that dimensionNums contains a superset of otherDimensions
int myInd = 0, otherInd = 0;
int myLength = dimensionNums.length;
int otherLength = otherDimensions.length;
while (myInd < myLength && otherInd < otherLength) {
if (dimensionNums[myInd] < otherDimensions[otherInd]) {
myInd++;
} else if (dimensionNums[myInd] == otherDimensions[otherInd]) {
Preconditions.checkArgument(dimensionSizes[myInd] == otherSizes[otherInd],
"dimensionSizes[myInd]: %s\notherSizes[otherInd]: %s",
dimensionSizes[myInd], otherSizes[otherInd]);
myInd++;
otherInd++;
} else {
// Not a superset.
Preconditions.checkArgument(false, "Dimensions not a superset");
}
}
// There are three possible multiplication implementations: an extremely
// fast one for the case when both sets of dimensions are exactly equal,
// a pretty fast one for when the dimensions of other line up
// against the leftmost dimensions of this, and another for all
// other cases. Check which case applies, then use the
// fastest possible algorithm.
for (int i = 0; i < otherDimensions.length; i++) {
if (otherDimensions[i] != dimensionNums[i]) {
// Not left aligned.
return elementwiseMultiplyNaive(this, other);
}
}
if (otherDimensions.length == dimensionNums.length) {
// Both tensors contain the exact same set of dimensions
return elementwiseMultiplySparseDense(this, other);
} else {
// Dimensions of other are aligned with the leftmost dimensions
// of this tensor.
return elementwiseMultiplyLeftAligned(this, other);
}
} }
|
public class class_name {
@Override
public SparseTensor elementwiseProduct(Tensor other) {
int[] dimensionNums = getDimensionNumbers();
int[] dimensionSizes = getDimensionSizes();
int[] otherDimensions = other.getDimensionNumbers();
int[] otherSizes = other.getDimensionSizes();
// Check that dimensionNums contains a superset of otherDimensions
int myInd = 0, otherInd = 0;
int myLength = dimensionNums.length;
int otherLength = otherDimensions.length;
while (myInd < myLength && otherInd < otherLength) {
if (dimensionNums[myInd] < otherDimensions[otherInd]) {
myInd++; // depends on control dependency: [if], data = [none]
} else if (dimensionNums[myInd] == otherDimensions[otherInd]) {
Preconditions.checkArgument(dimensionSizes[myInd] == otherSizes[otherInd],
"dimensionSizes[myInd]: %s\notherSizes[otherInd]: %s",
dimensionSizes[myInd], otherSizes[otherInd]); // depends on control dependency: [if], data = [none]
myInd++; // depends on control dependency: [if], data = [none]
otherInd++; // depends on control dependency: [if], data = [none]
} else {
// Not a superset.
Preconditions.checkArgument(false, "Dimensions not a superset"); // depends on control dependency: [if], data = [none]
}
}
// There are three possible multiplication implementations: an extremely
// fast one for the case when both sets of dimensions are exactly equal,
// a pretty fast one for when the dimensions of other line up
// against the leftmost dimensions of this, and another for all
// other cases. Check which case applies, then use the
// fastest possible algorithm.
for (int i = 0; i < otherDimensions.length; i++) {
if (otherDimensions[i] != dimensionNums[i]) {
// Not left aligned.
return elementwiseMultiplyNaive(this, other); // depends on control dependency: [if], data = [none]
}
}
if (otherDimensions.length == dimensionNums.length) {
// Both tensors contain the exact same set of dimensions
return elementwiseMultiplySparseDense(this, other); // depends on control dependency: [if], data = [none]
} else {
// Dimensions of other are aligned with the leftmost dimensions
// of this tensor.
return elementwiseMultiplyLeftAligned(this, other); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
private void menuNewFileActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menuNewFileActionPerformed
File currentFolder = this.explorerTree.getCurrentFocusedFolder();
if (currentFolder == null) {
currentFolder = this.explorerTree.findFirstProjectFolder();
}
final JFileChooser fileChooser = new JFileChooser(currentFolder);
fileChooser.setDialogTitle("New file");
class Filter extends FileFilter {
final String extension;
final String description;
Filter(@Nonnull final String extension, @Nonnull final String description) {
this.extension = '.' + extension;
this.description = description;
}
@Override
public boolean accept(@Nonnull final File f) {
return f.isDirectory() || f.getName().toLowerCase(Locale.ENGLISH).endsWith(this.extension);
}
@Override
@Nonnull
public String getDescription() {
return this.description;
}
}
fileChooser.setAcceptAllFileFilterUsed(false);
final Filter filerMindMap = new Filter("mmd", "Mind Map file (*.mmd)");
final Filter filerText = new Filter("txt", "Text file (*.txt)");
final Filter filerPuml = new Filter("puml", "PantUML file (*.puml)");
fileChooser.addChoosableFileFilter(filerMindMap);
fileChooser.addChoosableFileFilter(filerText);
fileChooser.addChoosableFileFilter(filerPuml);
fileChooser.setFileFilter(filerMindMap);
if (fileChooser.showDialog(this, "Create") == JFileChooser.APPROVE_OPTION) {
final Filter choosenFilter = (Filter) fileChooser.getFileFilter();
File selectedFile = fileChooser.getSelectedFile();
if (!selectedFile.getName().contains(".")) {
selectedFile = new File(selectedFile.getParent(), selectedFile.getName() + choosenFilter.extension);
}
final String text;
if (choosenFilter == filerMindMap) {
final MindMap model = new MindMap(null, true);
model.setAttribute("showJumps", "true"); //NOI18N
final Topic root = model.getRoot();
if (root != null) {
root.setText("Root"); //NOI18N
}
try {
text = model.write(new StringWriter()).toString();
} catch (IOException ex) {
throw new Error("Unexpected error", ex);
}
} else if (choosenFilter == filerPuml) {
final String nextLine = GetUtils.ensureNonNull(System.getProperty("line.separator"), "\n");
text = "@startuml " + nextLine + nextLine + "@enduml";
} else {
text = "";
}
try {
org.apache.commons.io.FileUtils.write(selectedFile, text, "UTF-8");
this.explorerTree.addFileIfPossible(selectedFile, true);
} catch (IOException ex) {
LOGGER.error("Can't create file : " + selectedFile);
JOptionPane.showMessageDialog(this, "Can't create file", "Error", JOptionPane.ERROR_MESSAGE);
}
}
} }
|
public class class_name {
private void menuNewFileActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menuNewFileActionPerformed
File currentFolder = this.explorerTree.getCurrentFocusedFolder();
if (currentFolder == null) {
currentFolder = this.explorerTree.findFirstProjectFolder(); // depends on control dependency: [if], data = [none]
}
final JFileChooser fileChooser = new JFileChooser(currentFolder);
fileChooser.setDialogTitle("New file");
class Filter extends FileFilter {
final String extension;
final String description;
Filter(@Nonnull final String extension, @Nonnull final String description) {
this.extension = '.' + extension;
this.description = description;
}
@Override
public boolean accept(@Nonnull final File f) {
return f.isDirectory() || f.getName().toLowerCase(Locale.ENGLISH).endsWith(this.extension);
}
@Override
@Nonnull
public String getDescription() {
return this.description;
}
}
fileChooser.setAcceptAllFileFilterUsed(false);
final Filter filerMindMap = new Filter("mmd", "Mind Map file (*.mmd)");
final Filter filerText = new Filter("txt", "Text file (*.txt)");
final Filter filerPuml = new Filter("puml", "PantUML file (*.puml)");
fileChooser.addChoosableFileFilter(filerMindMap);
fileChooser.addChoosableFileFilter(filerText);
fileChooser.addChoosableFileFilter(filerPuml);
fileChooser.setFileFilter(filerMindMap);
if (fileChooser.showDialog(this, "Create") == JFileChooser.APPROVE_OPTION) {
final Filter choosenFilter = (Filter) fileChooser.getFileFilter();
File selectedFile = fileChooser.getSelectedFile();
if (!selectedFile.getName().contains(".")) {
selectedFile = new File(selectedFile.getParent(), selectedFile.getName() + choosenFilter.extension); // depends on control dependency: [if], data = [none]
}
final String text;
if (choosenFilter == filerMindMap) {
final MindMap model = new MindMap(null, true);
model.setAttribute("showJumps", "true"); //NOI18N
final Topic root = model.getRoot();
if (root != null) {
root.setText("Root"); //NOI18N // depends on control dependency: [if], data = [none]
}
try {
text = model.write(new StringWriter()).toString(); // depends on control dependency: [try], data = [none]
} catch (IOException ex) {
throw new Error("Unexpected error", ex);
} // depends on control dependency: [catch], data = [none]
} else if (choosenFilter == filerPuml) {
final String nextLine = GetUtils.ensureNonNull(System.getProperty("line.separator"), "\n");
text = "@startuml " + nextLine + nextLine + "@enduml";
} else {
text = "";
}
try {
org.apache.commons.io.FileUtils.write(selectedFile, text, "UTF-8");
this.explorerTree.addFileIfPossible(selectedFile, true);
} catch (IOException ex) {
LOGGER.error("Can't create file : " + selectedFile);
JOptionPane.showMessageDialog(this, "Can't create file", "Error", JOptionPane.ERROR_MESSAGE);
}
}
} }
|
public class class_name {
private void showColumnMeta(PrintStream output, CfDef cfDef, ColumnDef colDef)
{
output.append(NEWLINE + TAB + TAB + "{");
final AbstractType<?> comparator = getFormatType(cfDef.column_type.equals("Super")
? cfDef.subcomparator_type
: cfDef.comparator_type);
output.append("column_name : '" + CliUtils.escapeSQLString(comparator.getString(colDef.name)) + "'," + NEWLINE);
String validationClass = normaliseType(colDef.validation_class, "org.apache.cassandra.db.marshal");
output.append(TAB + TAB + "validation_class : " + CliUtils.escapeSQLString(validationClass));
if (colDef.isSetIndex_name())
{
output.append(",").append(NEWLINE)
.append(TAB + TAB + "index_name : '" + CliUtils.escapeSQLString(colDef.index_name) + "'," + NEWLINE)
.append(TAB + TAB + "index_type : " + CliUtils.escapeSQLString(Integer.toString(colDef.index_type.getValue())));
if (colDef.index_options != null && !colDef.index_options.isEmpty())
{
output.append(",").append(NEWLINE);
output.append(TAB + TAB + "index_options : {" + NEWLINE);
int numOpts = colDef.index_options.size();
for (Map.Entry<String, String> entry : colDef.index_options.entrySet())
{
String option = CliUtils.escapeSQLString(entry.getKey());
String optionValue = CliUtils.escapeSQLString(entry.getValue());
output.append(TAB + TAB + TAB)
.append("'" + option + "' : '")
.append(optionValue)
.append("'");
if (--numOpts > 0)
output.append(",").append(NEWLINE);
}
output.append("}");
}
}
output.append("}");
} }
|
public class class_name {
private void showColumnMeta(PrintStream output, CfDef cfDef, ColumnDef colDef)
{
output.append(NEWLINE + TAB + TAB + "{");
final AbstractType<?> comparator = getFormatType(cfDef.column_type.equals("Super")
? cfDef.subcomparator_type
: cfDef.comparator_type);
output.append("column_name : '" + CliUtils.escapeSQLString(comparator.getString(colDef.name)) + "'," + NEWLINE);
String validationClass = normaliseType(colDef.validation_class, "org.apache.cassandra.db.marshal");
output.append(TAB + TAB + "validation_class : " + CliUtils.escapeSQLString(validationClass));
if (colDef.isSetIndex_name())
{
output.append(",").append(NEWLINE)
.append(TAB + TAB + "index_name : '" + CliUtils.escapeSQLString(colDef.index_name) + "'," + NEWLINE)
.append(TAB + TAB + "index_type : " + CliUtils.escapeSQLString(Integer.toString(colDef.index_type.getValue()))); // depends on control dependency: [if], data = [none]
if (colDef.index_options != null && !colDef.index_options.isEmpty())
{
output.append(",").append(NEWLINE); // depends on control dependency: [if], data = [none]
output.append(TAB + TAB + "index_options : {" + NEWLINE); // depends on control dependency: [if], data = [none]
int numOpts = colDef.index_options.size();
for (Map.Entry<String, String> entry : colDef.index_options.entrySet())
{
String option = CliUtils.escapeSQLString(entry.getKey());
String optionValue = CliUtils.escapeSQLString(entry.getValue());
output.append(TAB + TAB + TAB)
.append("'" + option + "' : '")
.append(optionValue)
.append("'"); // depends on control dependency: [for], data = [none]
if (--numOpts > 0)
output.append(",").append(NEWLINE);
}
output.append("}"); // depends on control dependency: [if], data = [none]
}
}
output.append("}");
} }
|
public class class_name {
@Override
public void update(IEntityGroup group) throws GroupsException {
Connection conn = null;
boolean exists = existsInDatabase(group);
try {
conn = RDBMServices.getConnection();
setAutoCommit(conn, false);
try {
if (exists) {
primUpdate(group, conn);
} else {
primAdd(group, conn);
}
primUpdateMembers((EntityGroupImpl) group, conn);
commit(conn);
} catch (Exception ex) {
rollback(conn);
throw new GroupsException("Problem updating " + this + ex);
}
} catch (SQLException sqlex) {
throw new GroupsException(sqlex);
} finally {
if (conn != null) {
try {
setAutoCommit(conn, true);
} catch (SQLException sqle) {
throw new GroupsException(sqle);
} finally {
RDBMServices.releaseConnection(conn);
}
}
}
} }
|
public class class_name {
@Override
public void update(IEntityGroup group) throws GroupsException {
Connection conn = null;
boolean exists = existsInDatabase(group);
try {
conn = RDBMServices.getConnection();
setAutoCommit(conn, false);
try {
if (exists) {
primUpdate(group, conn); // depends on control dependency: [if], data = [none]
} else {
primAdd(group, conn); // depends on control dependency: [if], data = [none]
}
primUpdateMembers((EntityGroupImpl) group, conn); // depends on control dependency: [try], data = [none]
commit(conn); // depends on control dependency: [try], data = [none]
} catch (Exception ex) {
rollback(conn);
throw new GroupsException("Problem updating " + this + ex);
} // depends on control dependency: [catch], data = [none]
} catch (SQLException sqlex) {
throw new GroupsException(sqlex);
} finally {
if (conn != null) {
try {
setAutoCommit(conn, true); // depends on control dependency: [try], data = [none]
} catch (SQLException sqle) {
throw new GroupsException(sqle);
} finally { // depends on control dependency: [catch], data = [none]
RDBMServices.releaseConnection(conn);
}
}
}
} }
|
public class class_name {
private static String convertSub(String path) {
if (isRestEasyPath(path)) {
// remove {}
path = path.substring(1, path.length() - 1);
int index = path.lastIndexOf(":"); // check for regular expression
if (index > 0 && index + 1 < path.length()) {
return path.substring(index + 1); // make regular expression the path part
}
return ":" + path; // put : in front of param name
}
if (isVertxRegExPath(path)) {
// remove parameter name - :parameter:<regularExpression>
int idx = path.indexOf(":", 1);
return path.substring(idx + 1);
}
return path;
} }
|
public class class_name {
private static String convertSub(String path) {
if (isRestEasyPath(path)) {
// remove {}
path = path.substring(1, path.length() - 1); // depends on control dependency: [if], data = [none]
int index = path.lastIndexOf(":"); // check for regular expression
if (index > 0 && index + 1 < path.length()) {
return path.substring(index + 1); // make regular expression the path part // depends on control dependency: [if], data = [(index]
}
return ":" + path; // put : in front of param name // depends on control dependency: [if], data = [none]
}
if (isVertxRegExPath(path)) {
// remove parameter name - :parameter:<regularExpression>
int idx = path.indexOf(":", 1);
return path.substring(idx + 1); // depends on control dependency: [if], data = [none]
}
return path;
} }
|
public class class_name {
public static String longToString(Date value) {
if (value == null) {
return null;
}
SimpleDateFormat sdf = new SimpleDateFormat();
return sdf.format(value);
} }
|
public class class_name {
public static String longToString(Date value) {
if (value == null) {
return null; // depends on control dependency: [if], data = [none]
}
SimpleDateFormat sdf = new SimpleDateFormat();
return sdf.format(value);
} }
|
public class class_name {
protected void logWebServiceMessage(String logMessage, WebServiceMessage message, boolean incoming) {
ByteArrayOutputStream os = new ByteArrayOutputStream();
try {
message.writeTo(os);
logMessage(logMessage, os.toString(), incoming);
} catch (IOException e) {
log.warn("Unable to log WebService message", e);
}
} }
|
public class class_name {
protected void logWebServiceMessage(String logMessage, WebServiceMessage message, boolean incoming) {
ByteArrayOutputStream os = new ByteArrayOutputStream();
try {
message.writeTo(os); // depends on control dependency: [try], data = [none]
logMessage(logMessage, os.toString(), incoming); // depends on control dependency: [try], data = [none]
} catch (IOException e) {
log.warn("Unable to log WebService message", e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
private void segmentPage()
{
DefaultContentRect.resetId(); //reset the default ID generator to obtain the same IDs for every segmentation
if (segmentatorCombo.getSelectedIndex() != -1)
{
AreaTreeProvider provider = segmentatorCombo.getItemAt(segmentatorCombo.getSelectedIndex());
proc.segmentPage(provider, null); //the parametres should have been set through the GUI
setAreaTree(proc.getAreaTree());
}
} }
|
public class class_name {
private void segmentPage()
{
DefaultContentRect.resetId(); //reset the default ID generator to obtain the same IDs for every segmentation
if (segmentatorCombo.getSelectedIndex() != -1)
{
AreaTreeProvider provider = segmentatorCombo.getItemAt(segmentatorCombo.getSelectedIndex());
proc.segmentPage(provider, null); //the parametres should have been set through the GUI // depends on control dependency: [if], data = [none]
setAreaTree(proc.getAreaTree()); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
private javax.swing.JPanel getBaseContentPane()
{
if (baseContentPane == null)
{
baseContentPane = new javax.swing.JPanel();
baseContentPane.setName("baseContentPane");
baseContentPane.setLayout(new java.awt.GridBagLayout());
baseContentPane.setBounds(0, 0, 0, 0);
baseContentPane.setMinimumSize(new java.awt.Dimension(0, 0));
java.awt.GridBagConstraints constraintsButton_GIF = new java.awt.GridBagConstraints();
constraintsButton_GIF.gridx = 0;
constraintsButton_GIF.gridy = 0;
constraintsButton_GIF.gridheight = 11;
constraintsButton_GIF.fill = java.awt.GridBagConstraints.VERTICAL;
constraintsButton_GIF.anchor = java.awt.GridBagConstraints.NORTHWEST;
constraintsButton_GIF.weightx = 1.0;
constraintsButton_GIF.weighty = 1.0;
constraintsButton_GIF.insets = new java.awt.Insets(4, 4, 4, 4);
baseContentPane.add(getButton_GIF(), constraintsButton_GIF);
java.awt.GridBagConstraints constraintsl_TextLine1 = new java.awt.GridBagConstraints();
constraintsl_TextLine1.gridx = 1;
constraintsl_TextLine1.gridy = 0;
constraintsl_TextLine1.gridwidth = 0;
constraintsl_TextLine1.anchor = java.awt.GridBagConstraints.CENTER;
constraintsl_TextLine1.fill = java.awt.GridBagConstraints.NONE;
constraintsl_TextLine1.weightx = 1.0;
constraintsl_TextLine1.weighty = 0.0;
constraintsl_TextLine1.insets = new java.awt.Insets(4, 4, 4, 4);
baseContentPane.add(getl_TextLine1(), constraintsl_TextLine1);
java.awt.GridBagConstraints constraintsl_TextLine2 = new java.awt.GridBagConstraints();
constraintsl_TextLine2.gridx = 1;
constraintsl_TextLine2.gridy = 1;
constraintsl_TextLine2.gridwidth = 0;
constraintsl_TextLine2.anchor = java.awt.GridBagConstraints.NORTH;
constraintsl_TextLine2.fill = java.awt.GridBagConstraints.NONE;
constraintsl_TextLine2.weightx = 1.0;
constraintsl_TextLine2.weighty = 1.0;
constraintsl_TextLine2.insets = new java.awt.Insets(4, 4, 4, 4);
baseContentPane.add(getl_TextLine2(), constraintsl_TextLine2);
java.awt.GridBagConstraints constraintsl_TextLine3 = new java.awt.GridBagConstraints();
constraintsl_TextLine3.gridx = 1;
constraintsl_TextLine3.gridy = 2;
constraintsl_TextLine3.gridwidth = 0;
constraintsl_TextLine3.anchor = java.awt.GridBagConstraints.CENTER;
constraintsl_TextLine3.fill = java.awt.GridBagConstraints.NONE;
constraintsl_TextLine3.weightx = 1.0;
constraintsl_TextLine3.weighty = 0.0;
constraintsl_TextLine3.insets = new java.awt.Insets(4, 4, 4, 4);
baseContentPane.add(getl_TextLine3(), constraintsl_TextLine3);
java.awt.GridBagConstraints constraintsl_TextLine4 = new java.awt.GridBagConstraints();
constraintsl_TextLine4.gridx = 1;
constraintsl_TextLine4.gridy = 3;
constraintsl_TextLine4.gridwidth = 0;
constraintsl_TextLine4.anchor = java.awt.GridBagConstraints.CENTER;
constraintsl_TextLine4.fill = java.awt.GridBagConstraints.NONE;
constraintsl_TextLine4.weightx = 1.0;
constraintsl_TextLine4.weighty = 0.0;
constraintsl_TextLine4.insets = new java.awt.Insets(4, 4, 4, 4);
baseContentPane.add(getl_TextLine4(), constraintsl_TextLine4);
java.awt.GridBagConstraints constraintsl_TextLine5 = new java.awt.GridBagConstraints();
constraintsl_TextLine5.gridx = 1;
constraintsl_TextLine5.gridy = 4;
constraintsl_TextLine5.gridwidth = 0;
constraintsl_TextLine5.anchor = java.awt.GridBagConstraints.CENTER;
constraintsl_TextLine5.fill = java.awt.GridBagConstraints.NONE;
constraintsl_TextLine5.weightx = 1.0;
constraintsl_TextLine5.weighty = 0.0;
constraintsl_TextLine5.insets = new java.awt.Insets(4, 4, 4, 4);
baseContentPane.add(getl_TextLine5(), constraintsl_TextLine5);
java.awt.GridBagConstraints constraintsl_TextLine6 = new java.awt.GridBagConstraints();
constraintsl_TextLine6.gridx = 1;
constraintsl_TextLine6.gridy = 5;
constraintsl_TextLine6.gridwidth = 0;
constraintsl_TextLine6.anchor = java.awt.GridBagConstraints.CENTER;
constraintsl_TextLine6.fill = java.awt.GridBagConstraints.NONE;
constraintsl_TextLine6.weightx = 1.0;
constraintsl_TextLine6.weighty = 0.0;
constraintsl_TextLine6.insets = new java.awt.Insets(4, 4, 4, 4);
baseContentPane.add(getl_TextLine6(), constraintsl_TextLine6);
java.awt.GridBagConstraints constraintsl_TextLine7 = new java.awt.GridBagConstraints();
constraintsl_TextLine7.gridx = 1;
constraintsl_TextLine7.gridy = 6;
constraintsl_TextLine7.gridwidth = 0;
constraintsl_TextLine7.anchor = java.awt.GridBagConstraints.CENTER;
constraintsl_TextLine7.fill = java.awt.GridBagConstraints.NONE;
constraintsl_TextLine7.weightx = 1.0;
constraintsl_TextLine7.weighty = 0.0;
constraintsl_TextLine7.insets = new java.awt.Insets(4, 4, 4, 4);
baseContentPane.add(getl_TextLine7(), constraintsl_TextLine7);
java.awt.GridBagConstraints constraintsl_TextLine8 = new java.awt.GridBagConstraints();
constraintsl_TextLine8.gridx = 1;
constraintsl_TextLine8.gridy = 7;
constraintsl_TextLine8.gridwidth = 0;
constraintsl_TextLine8.anchor = java.awt.GridBagConstraints.SOUTH;
constraintsl_TextLine8.fill = java.awt.GridBagConstraints.NONE;
constraintsl_TextLine8.weightx = 1.0;
constraintsl_TextLine8.weighty = 1.0;
constraintsl_TextLine8.insets = new java.awt.Insets(4, 4, 4, 4);
baseContentPane.add(getl_TextLine8(), constraintsl_TextLine8);
java.awt.GridBagConstraints constraintsl_TextLine9 = new java.awt.GridBagConstraints();
constraintsl_TextLine9.gridx = 1;
constraintsl_TextLine9.gridy = 8;
constraintsl_TextLine9.gridwidth = 0;
constraintsl_TextLine9.anchor = java.awt.GridBagConstraints.SOUTH;
constraintsl_TextLine9.fill = java.awt.GridBagConstraints.NONE;
constraintsl_TextLine9.weightx = 1.0;
constraintsl_TextLine9.weighty = 0.0;
constraintsl_TextLine9.insets = new java.awt.Insets(4, 4, 4, 4);
baseContentPane.add(getl_TextLine9(), constraintsl_TextLine9);
java.awt.GridBagConstraints constraintsl_TextLine10 = new java.awt.GridBagConstraints();
constraintsl_TextLine10.gridx = 1;
constraintsl_TextLine10.gridy = 9;
constraintsl_TextLine10.gridwidth = 0;
constraintsl_TextLine10.anchor = java.awt.GridBagConstraints.SOUTH;
constraintsl_TextLine10.fill = java.awt.GridBagConstraints.NONE;
constraintsl_TextLine10.weightx = 1.0;
constraintsl_TextLine10.weighty = 0.0;
constraintsl_TextLine10.insets = new java.awt.Insets(4, 4, 4, 4);
baseContentPane.add(getl_TextLine10(), constraintsl_TextLine10);
java.awt.GridBagConstraints constraintsBtn_OK = new java.awt.GridBagConstraints();
constraintsBtn_OK.gridx = 1;
constraintsBtn_OK.gridy = 10;
constraintsBtn_OK.gridwidth = 0;
constraintsBtn_OK.anchor = java.awt.GridBagConstraints.SOUTH;
constraintsBtn_OK.fill = java.awt.GridBagConstraints.NONE;
constraintsBtn_OK.weightx = 1.0;
constraintsBtn_OK.weighty = 0.0;
constraintsBtn_OK.insets = new java.awt.Insets(4, 4, 4, 4);
baseContentPane.add(getBtn_OK(), constraintsBtn_OK);
}
return baseContentPane;
} }
|
public class class_name {
private javax.swing.JPanel getBaseContentPane()
{
if (baseContentPane == null)
{
baseContentPane = new javax.swing.JPanel(); // depends on control dependency: [if], data = [none]
baseContentPane.setName("baseContentPane"); // depends on control dependency: [if], data = [none]
baseContentPane.setLayout(new java.awt.GridBagLayout()); // depends on control dependency: [if], data = [none]
baseContentPane.setBounds(0, 0, 0, 0); // depends on control dependency: [if], data = [none]
baseContentPane.setMinimumSize(new java.awt.Dimension(0, 0)); // depends on control dependency: [if], data = [none]
java.awt.GridBagConstraints constraintsButton_GIF = new java.awt.GridBagConstraints();
constraintsButton_GIF.gridx = 0; // depends on control dependency: [if], data = [none]
constraintsButton_GIF.gridy = 0; // depends on control dependency: [if], data = [none]
constraintsButton_GIF.gridheight = 11; // depends on control dependency: [if], data = [none]
constraintsButton_GIF.fill = java.awt.GridBagConstraints.VERTICAL; // depends on control dependency: [if], data = [none]
constraintsButton_GIF.anchor = java.awt.GridBagConstraints.NORTHWEST; // depends on control dependency: [if], data = [none]
constraintsButton_GIF.weightx = 1.0; // depends on control dependency: [if], data = [none]
constraintsButton_GIF.weighty = 1.0; // depends on control dependency: [if], data = [none]
constraintsButton_GIF.insets = new java.awt.Insets(4, 4, 4, 4); // depends on control dependency: [if], data = [none]
baseContentPane.add(getButton_GIF(), constraintsButton_GIF); // depends on control dependency: [if], data = [none]
java.awt.GridBagConstraints constraintsl_TextLine1 = new java.awt.GridBagConstraints();
constraintsl_TextLine1.gridx = 1; // depends on control dependency: [if], data = [none]
constraintsl_TextLine1.gridy = 0; // depends on control dependency: [if], data = [none]
constraintsl_TextLine1.gridwidth = 0; // depends on control dependency: [if], data = [none]
constraintsl_TextLine1.anchor = java.awt.GridBagConstraints.CENTER; // depends on control dependency: [if], data = [none]
constraintsl_TextLine1.fill = java.awt.GridBagConstraints.NONE; // depends on control dependency: [if], data = [none]
constraintsl_TextLine1.weightx = 1.0; // depends on control dependency: [if], data = [none]
constraintsl_TextLine1.weighty = 0.0; // depends on control dependency: [if], data = [none]
constraintsl_TextLine1.insets = new java.awt.Insets(4, 4, 4, 4); // depends on control dependency: [if], data = [none]
baseContentPane.add(getl_TextLine1(), constraintsl_TextLine1); // depends on control dependency: [if], data = [none]
java.awt.GridBagConstraints constraintsl_TextLine2 = new java.awt.GridBagConstraints();
constraintsl_TextLine2.gridx = 1; // depends on control dependency: [if], data = [none]
constraintsl_TextLine2.gridy = 1; // depends on control dependency: [if], data = [none]
constraintsl_TextLine2.gridwidth = 0; // depends on control dependency: [if], data = [none]
constraintsl_TextLine2.anchor = java.awt.GridBagConstraints.NORTH; // depends on control dependency: [if], data = [none]
constraintsl_TextLine2.fill = java.awt.GridBagConstraints.NONE; // depends on control dependency: [if], data = [none]
constraintsl_TextLine2.weightx = 1.0; // depends on control dependency: [if], data = [none]
constraintsl_TextLine2.weighty = 1.0; // depends on control dependency: [if], data = [none]
constraintsl_TextLine2.insets = new java.awt.Insets(4, 4, 4, 4); // depends on control dependency: [if], data = [none]
baseContentPane.add(getl_TextLine2(), constraintsl_TextLine2); // depends on control dependency: [if], data = [none]
java.awt.GridBagConstraints constraintsl_TextLine3 = new java.awt.GridBagConstraints();
constraintsl_TextLine3.gridx = 1; // depends on control dependency: [if], data = [none]
constraintsl_TextLine3.gridy = 2; // depends on control dependency: [if], data = [none]
constraintsl_TextLine3.gridwidth = 0; // depends on control dependency: [if], data = [none]
constraintsl_TextLine3.anchor = java.awt.GridBagConstraints.CENTER; // depends on control dependency: [if], data = [none]
constraintsl_TextLine3.fill = java.awt.GridBagConstraints.NONE; // depends on control dependency: [if], data = [none]
constraintsl_TextLine3.weightx = 1.0; // depends on control dependency: [if], data = [none]
constraintsl_TextLine3.weighty = 0.0; // depends on control dependency: [if], data = [none]
constraintsl_TextLine3.insets = new java.awt.Insets(4, 4, 4, 4); // depends on control dependency: [if], data = [none]
baseContentPane.add(getl_TextLine3(), constraintsl_TextLine3); // depends on control dependency: [if], data = [none]
java.awt.GridBagConstraints constraintsl_TextLine4 = new java.awt.GridBagConstraints();
constraintsl_TextLine4.gridx = 1; // depends on control dependency: [if], data = [none]
constraintsl_TextLine4.gridy = 3; // depends on control dependency: [if], data = [none]
constraintsl_TextLine4.gridwidth = 0; // depends on control dependency: [if], data = [none]
constraintsl_TextLine4.anchor = java.awt.GridBagConstraints.CENTER; // depends on control dependency: [if], data = [none]
constraintsl_TextLine4.fill = java.awt.GridBagConstraints.NONE; // depends on control dependency: [if], data = [none]
constraintsl_TextLine4.weightx = 1.0; // depends on control dependency: [if], data = [none]
constraintsl_TextLine4.weighty = 0.0; // depends on control dependency: [if], data = [none]
constraintsl_TextLine4.insets = new java.awt.Insets(4, 4, 4, 4); // depends on control dependency: [if], data = [none]
baseContentPane.add(getl_TextLine4(), constraintsl_TextLine4); // depends on control dependency: [if], data = [none]
java.awt.GridBagConstraints constraintsl_TextLine5 = new java.awt.GridBagConstraints();
constraintsl_TextLine5.gridx = 1; // depends on control dependency: [if], data = [none]
constraintsl_TextLine5.gridy = 4; // depends on control dependency: [if], data = [none]
constraintsl_TextLine5.gridwidth = 0; // depends on control dependency: [if], data = [none]
constraintsl_TextLine5.anchor = java.awt.GridBagConstraints.CENTER; // depends on control dependency: [if], data = [none]
constraintsl_TextLine5.fill = java.awt.GridBagConstraints.NONE; // depends on control dependency: [if], data = [none]
constraintsl_TextLine5.weightx = 1.0; // depends on control dependency: [if], data = [none]
constraintsl_TextLine5.weighty = 0.0; // depends on control dependency: [if], data = [none]
constraintsl_TextLine5.insets = new java.awt.Insets(4, 4, 4, 4); // depends on control dependency: [if], data = [none]
baseContentPane.add(getl_TextLine5(), constraintsl_TextLine5); // depends on control dependency: [if], data = [none]
java.awt.GridBagConstraints constraintsl_TextLine6 = new java.awt.GridBagConstraints();
constraintsl_TextLine6.gridx = 1; // depends on control dependency: [if], data = [none]
constraintsl_TextLine6.gridy = 5; // depends on control dependency: [if], data = [none]
constraintsl_TextLine6.gridwidth = 0; // depends on control dependency: [if], data = [none]
constraintsl_TextLine6.anchor = java.awt.GridBagConstraints.CENTER; // depends on control dependency: [if], data = [none]
constraintsl_TextLine6.fill = java.awt.GridBagConstraints.NONE; // depends on control dependency: [if], data = [none]
constraintsl_TextLine6.weightx = 1.0; // depends on control dependency: [if], data = [none]
constraintsl_TextLine6.weighty = 0.0; // depends on control dependency: [if], data = [none]
constraintsl_TextLine6.insets = new java.awt.Insets(4, 4, 4, 4); // depends on control dependency: [if], data = [none]
baseContentPane.add(getl_TextLine6(), constraintsl_TextLine6); // depends on control dependency: [if], data = [none]
java.awt.GridBagConstraints constraintsl_TextLine7 = new java.awt.GridBagConstraints();
constraintsl_TextLine7.gridx = 1; // depends on control dependency: [if], data = [none]
constraintsl_TextLine7.gridy = 6; // depends on control dependency: [if], data = [none]
constraintsl_TextLine7.gridwidth = 0; // depends on control dependency: [if], data = [none]
constraintsl_TextLine7.anchor = java.awt.GridBagConstraints.CENTER; // depends on control dependency: [if], data = [none]
constraintsl_TextLine7.fill = java.awt.GridBagConstraints.NONE; // depends on control dependency: [if], data = [none]
constraintsl_TextLine7.weightx = 1.0; // depends on control dependency: [if], data = [none]
constraintsl_TextLine7.weighty = 0.0; // depends on control dependency: [if], data = [none]
constraintsl_TextLine7.insets = new java.awt.Insets(4, 4, 4, 4); // depends on control dependency: [if], data = [none]
baseContentPane.add(getl_TextLine7(), constraintsl_TextLine7); // depends on control dependency: [if], data = [none]
java.awt.GridBagConstraints constraintsl_TextLine8 = new java.awt.GridBagConstraints();
constraintsl_TextLine8.gridx = 1; // depends on control dependency: [if], data = [none]
constraintsl_TextLine8.gridy = 7; // depends on control dependency: [if], data = [none]
constraintsl_TextLine8.gridwidth = 0; // depends on control dependency: [if], data = [none]
constraintsl_TextLine8.anchor = java.awt.GridBagConstraints.SOUTH; // depends on control dependency: [if], data = [none]
constraintsl_TextLine8.fill = java.awt.GridBagConstraints.NONE; // depends on control dependency: [if], data = [none]
constraintsl_TextLine8.weightx = 1.0; // depends on control dependency: [if], data = [none]
constraintsl_TextLine8.weighty = 1.0; // depends on control dependency: [if], data = [none]
constraintsl_TextLine8.insets = new java.awt.Insets(4, 4, 4, 4); // depends on control dependency: [if], data = [none]
baseContentPane.add(getl_TextLine8(), constraintsl_TextLine8); // depends on control dependency: [if], data = [none]
java.awt.GridBagConstraints constraintsl_TextLine9 = new java.awt.GridBagConstraints();
constraintsl_TextLine9.gridx = 1; // depends on control dependency: [if], data = [none]
constraintsl_TextLine9.gridy = 8; // depends on control dependency: [if], data = [none]
constraintsl_TextLine9.gridwidth = 0; // depends on control dependency: [if], data = [none]
constraintsl_TextLine9.anchor = java.awt.GridBagConstraints.SOUTH; // depends on control dependency: [if], data = [none]
constraintsl_TextLine9.fill = java.awt.GridBagConstraints.NONE; // depends on control dependency: [if], data = [none]
constraintsl_TextLine9.weightx = 1.0; // depends on control dependency: [if], data = [none]
constraintsl_TextLine9.weighty = 0.0; // depends on control dependency: [if], data = [none]
constraintsl_TextLine9.insets = new java.awt.Insets(4, 4, 4, 4); // depends on control dependency: [if], data = [none]
baseContentPane.add(getl_TextLine9(), constraintsl_TextLine9); // depends on control dependency: [if], data = [none]
java.awt.GridBagConstraints constraintsl_TextLine10 = new java.awt.GridBagConstraints();
constraintsl_TextLine10.gridx = 1; // depends on control dependency: [if], data = [none]
constraintsl_TextLine10.gridy = 9; // depends on control dependency: [if], data = [none]
constraintsl_TextLine10.gridwidth = 0; // depends on control dependency: [if], data = [none]
constraintsl_TextLine10.anchor = java.awt.GridBagConstraints.SOUTH; // depends on control dependency: [if], data = [none]
constraintsl_TextLine10.fill = java.awt.GridBagConstraints.NONE; // depends on control dependency: [if], data = [none]
constraintsl_TextLine10.weightx = 1.0; // depends on control dependency: [if], data = [none]
constraintsl_TextLine10.weighty = 0.0; // depends on control dependency: [if], data = [none]
constraintsl_TextLine10.insets = new java.awt.Insets(4, 4, 4, 4); // depends on control dependency: [if], data = [none]
baseContentPane.add(getl_TextLine10(), constraintsl_TextLine10); // depends on control dependency: [if], data = [none]
java.awt.GridBagConstraints constraintsBtn_OK = new java.awt.GridBagConstraints();
constraintsBtn_OK.gridx = 1; // depends on control dependency: [if], data = [none]
constraintsBtn_OK.gridy = 10; // depends on control dependency: [if], data = [none]
constraintsBtn_OK.gridwidth = 0; // depends on control dependency: [if], data = [none]
constraintsBtn_OK.anchor = java.awt.GridBagConstraints.SOUTH; // depends on control dependency: [if], data = [none]
constraintsBtn_OK.fill = java.awt.GridBagConstraints.NONE; // depends on control dependency: [if], data = [none]
constraintsBtn_OK.weightx = 1.0; // depends on control dependency: [if], data = [none]
constraintsBtn_OK.weighty = 0.0; // depends on control dependency: [if], data = [none]
constraintsBtn_OK.insets = new java.awt.Insets(4, 4, 4, 4); // depends on control dependency: [if], data = [none]
baseContentPane.add(getBtn_OK(), constraintsBtn_OK); // depends on control dependency: [if], data = [none]
}
return baseContentPane;
} }
|
public class class_name {
private static void checkMediaType(Multimap<MediaType, SerializationFormat> simplifiedMediaTypeToFormats,
MediaType mediaType) {
final MediaType simplifiedMediaType = mediaType.withoutParameters();
for (SerializationFormat format : simplifiedMediaTypeToFormats.get(simplifiedMediaType)) {
for (MediaType registeredMediaType : format.mediaTypes()) {
checkState(!registeredMediaType.is(mediaType) && !mediaType.is(registeredMediaType),
"media type registered already: ", mediaType);
}
}
} }
|
public class class_name {
private static void checkMediaType(Multimap<MediaType, SerializationFormat> simplifiedMediaTypeToFormats,
MediaType mediaType) {
final MediaType simplifiedMediaType = mediaType.withoutParameters();
for (SerializationFormat format : simplifiedMediaTypeToFormats.get(simplifiedMediaType)) {
for (MediaType registeredMediaType : format.mediaTypes()) {
checkState(!registeredMediaType.is(mediaType) && !mediaType.is(registeredMediaType),
"media type registered already: ", mediaType); // depends on control dependency: [for], data = [registeredMediaType]
}
}
} }
|
public class class_name {
@Override
public void onAdd(Response response) {
ensureInitialized();
// don't care about non-"disable" responses
if(! disableResponseActions.contains(response.getAction())) {
return;
}
Attack sourceAttack = findSourceAttack(response);
//couldn't find matching attack - need it for "resource"
if(sourceAttack == null) {
logger.warn("Could not discover attack match for given response. "
+ "This should not happen under normal circumstances. "
+ "Response is: " + response);
return;
}
if(response.getUser().getIPAddress() == null) {
logger.debug("Ignoring block response - user IP unknown. "
+ "Response is: " + response);
return;
}
if(sourceAttack.getResource() == null || sourceAttack.getResource().getLocation() == null) {
logger.debug("Ignoring block response - resource unknown. "
+ "Response is: " + response);
return;
}
BlockRequest blockRequest = new BlockRequest()
.setIpAddress(response.getUser().getIPAddress().getAddressAsString())
.setResource(sourceAttack.getResource().getLocation())
.setMilliseconds(response.getInterval().toMillis());
try {
target.request(MediaType.APPLICATION_JSON)
.post(Entity.entity(gson.toJson(blockRequest), MediaType.APPLICATION_JSON));
logger.info("Sent block request to block store. Request was to block: " + blockRequest);
} catch(Exception e) {
logger.error("Error sending block request to block store. ", e);
}
} }
|
public class class_name {
@Override
public void onAdd(Response response) {
ensureInitialized();
// don't care about non-"disable" responses
if(! disableResponseActions.contains(response.getAction())) {
return; // depends on control dependency: [if], data = [none]
}
Attack sourceAttack = findSourceAttack(response);
//couldn't find matching attack - need it for "resource"
if(sourceAttack == null) {
logger.warn("Could not discover attack match for given response. "
+ "This should not happen under normal circumstances. "
+ "Response is: " + response); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
if(response.getUser().getIPAddress() == null) {
logger.debug("Ignoring block response - user IP unknown. "
+ "Response is: " + response); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
if(sourceAttack.getResource() == null || sourceAttack.getResource().getLocation() == null) {
logger.debug("Ignoring block response - resource unknown. "
+ "Response is: " + response); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
BlockRequest blockRequest = new BlockRequest()
.setIpAddress(response.getUser().getIPAddress().getAddressAsString())
.setResource(sourceAttack.getResource().getLocation())
.setMilliseconds(response.getInterval().toMillis());
try {
target.request(MediaType.APPLICATION_JSON)
.post(Entity.entity(gson.toJson(blockRequest), MediaType.APPLICATION_JSON)); // depends on control dependency: [try], data = [none]
logger.info("Sent block request to block store. Request was to block: " + blockRequest); // depends on control dependency: [try], data = [none]
} catch(Exception e) {
logger.error("Error sending block request to block store. ", e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public Observable<ServiceResponse<Page<RecordSetInner>>> listByDnsZoneWithServiceResponseAsync(final String resourceGroupName, final String zoneName, final Integer top, final String recordsetnamesuffix) {
return listByDnsZoneSinglePageAsync(resourceGroupName, zoneName, top, recordsetnamesuffix)
.concatMap(new Func1<ServiceResponse<Page<RecordSetInner>>, Observable<ServiceResponse<Page<RecordSetInner>>>>() {
@Override
public Observable<ServiceResponse<Page<RecordSetInner>>> call(ServiceResponse<Page<RecordSetInner>> page) {
String nextPageLink = page.body().nextPageLink();
if (nextPageLink == null) {
return Observable.just(page);
}
return Observable.just(page).concatWith(listByDnsZoneNextWithServiceResponseAsync(nextPageLink));
}
});
} }
|
public class class_name {
public Observable<ServiceResponse<Page<RecordSetInner>>> listByDnsZoneWithServiceResponseAsync(final String resourceGroupName, final String zoneName, final Integer top, final String recordsetnamesuffix) {
return listByDnsZoneSinglePageAsync(resourceGroupName, zoneName, top, recordsetnamesuffix)
.concatMap(new Func1<ServiceResponse<Page<RecordSetInner>>, Observable<ServiceResponse<Page<RecordSetInner>>>>() {
@Override
public Observable<ServiceResponse<Page<RecordSetInner>>> call(ServiceResponse<Page<RecordSetInner>> page) {
String nextPageLink = page.body().nextPageLink();
if (nextPageLink == null) {
return Observable.just(page); // depends on control dependency: [if], data = [none]
}
return Observable.just(page).concatWith(listByDnsZoneNextWithServiceResponseAsync(nextPageLink));
}
});
} }
|
public class class_name {
private String[] toNameConfigPair(String token) throws ConfigurationException {
String[] pair = token.split("\\[", 2);
String name = StringUtils.clean(pair[0]);
if (name == null) {
throw new IllegalArgumentException("Filter name not found for filter chain definition token: " + token);
}
String config = null;
if (pair.length == 2) {
config = StringUtils.clean(pair[1]);
//if there was an open bracket, it assumed there is a closing bracket, so strip it too:
config = config.substring(0, config.length() - 1);
config = StringUtils.clean(config);
//backwards compatibility prior to implementing SHIRO-205:
//prior to SHIRO-205 being implemented, it was common for end-users to quote the config inside brackets
//if that config required commas. We need to strip those quotes to get to the interior quoted definition
//to ensure any existing quoted definitions still function for end users:
if (config != null && config.startsWith("\"") && config.endsWith("\"")) {
String stripped = config.substring(1, config.length() - 1);
stripped = StringUtils.clean(stripped);
//if the stripped value does not have any internal quotes, we can assume that the entire config was
//quoted and we can use the stripped value.
if (stripped != null && stripped.indexOf('"') == -1) {
config = stripped;
}
//else:
//the remaining config does have internal quotes, so we need to assume that each comma delimited
//pair might be quoted, in which case we need the leading and trailing quotes that we stripped
//So we ignore the stripped value.
}
}
return new String[]{name, config};
} }
|
public class class_name {
private String[] toNameConfigPair(String token) throws ConfigurationException {
String[] pair = token.split("\\[", 2);
String name = StringUtils.clean(pair[0]);
if (name == null) {
throw new IllegalArgumentException("Filter name not found for filter chain definition token: " + token);
}
String config = null;
if (pair.length == 2) {
config = StringUtils.clean(pair[1]);
//if there was an open bracket, it assumed there is a closing bracket, so strip it too:
config = config.substring(0, config.length() - 1);
config = StringUtils.clean(config);
//backwards compatibility prior to implementing SHIRO-205:
//prior to SHIRO-205 being implemented, it was common for end-users to quote the config inside brackets
//if that config required commas. We need to strip those quotes to get to the interior quoted definition
//to ensure any existing quoted definitions still function for end users:
if (config != null && config.startsWith("\"") && config.endsWith("\"")) {
String stripped = config.substring(1, config.length() - 1);
stripped = StringUtils.clean(stripped); // depends on control dependency: [if], data = [none]
//if the stripped value does not have any internal quotes, we can assume that the entire config was
//quoted and we can use the stripped value.
if (stripped != null && stripped.indexOf('"') == -1) {
config = stripped; // depends on control dependency: [if], data = [none]
}
//else:
//the remaining config does have internal quotes, so we need to assume that each comma delimited
//pair might be quoted, in which case we need the leading and trailing quotes that we stripped
//So we ignore the stripped value.
}
}
return new String[]{name, config};
} }
|
public class class_name {
private BitSet findInclusiveLevels(int colIdToFind) {
if (parent == null) {
return null;
}
if (parent.getColId() == colIdToFind) {
return inclusiveLevels;
}
return parent.findInclusiveLevels(colIdToFind);
} }
|
public class class_name {
private BitSet findInclusiveLevels(int colIdToFind) {
if (parent == null) {
return null; // depends on control dependency: [if], data = [none]
}
if (parent.getColId() == colIdToFind) {
return inclusiveLevels; // depends on control dependency: [if], data = [none]
}
return parent.findInclusiveLevels(colIdToFind);
} }
|
public class class_name {
public T findOneByAttribute(String attribute, Object value) {
CriteriaBuilder cb = getEntityManager().getCriteriaBuilder();
CriteriaQuery<T> query = cb.createQuery(getEntityClass());
Root<T> from = query.from(getEntityClass());
query.where(cb.equal(from.get(attribute), value));
try {
return getEntityManager().createQuery(query).getSingleResult();
} catch (NoResultException e) {
return null;
}
} }
|
public class class_name {
public T findOneByAttribute(String attribute, Object value) {
CriteriaBuilder cb = getEntityManager().getCriteriaBuilder();
CriteriaQuery<T> query = cb.createQuery(getEntityClass());
Root<T> from = query.from(getEntityClass());
query.where(cb.equal(from.get(attribute), value));
try {
return getEntityManager().createQuery(query).getSingleResult(); // depends on control dependency: [try], data = [none]
} catch (NoResultException e) {
return null;
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public static void onUiSync(Action action) {
if (Looper.myLooper() == Looper.getMainLooper()) {
action.call();
return;
}
ActionSyncTask poster = new ActionSyncTask(action);
getUiPoster().sync(poster);
poster.waitRun();
} }
|
public class class_name {
public static void onUiSync(Action action) {
if (Looper.myLooper() == Looper.getMainLooper()) {
action.call(); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
ActionSyncTask poster = new ActionSyncTask(action);
getUiPoster().sync(poster);
poster.waitRun();
} }
|
public class class_name {
protected CmsResource getNextResource() {
if ((m_collectorResult != null) && (m_collectorResult.size() > 0)) {
m_contentInfoBean.incResultIndex();
return m_collectorResult.remove(0);
}
return null;
} }
|
public class class_name {
protected CmsResource getNextResource() {
if ((m_collectorResult != null) && (m_collectorResult.size() > 0)) {
m_contentInfoBean.incResultIndex(); // depends on control dependency: [if], data = [none]
return m_collectorResult.remove(0); // depends on control dependency: [if], data = [none]
}
return null;
} }
|
public class class_name {
public static synchronized boolean compareMetricsCacheValuesByKey(String deployment, String key, ArrayList<Object> valuesToCompare) {
boolean isEqual = true;
ArrayList<Object> cacheValues;
cacheValues = getMetricsCache(deployment).get(key);
for (Object valueComp : valuesToCompare) {
for (Object value : cacheValues) {
if (value.toString().compareTo(valueComp.toString()) == 0) {
isEqual = true;
break;
}
isEqual = false;
}
}
return isEqual;
} }
|
public class class_name {
public static synchronized boolean compareMetricsCacheValuesByKey(String deployment, String key, ArrayList<Object> valuesToCompare) {
boolean isEqual = true;
ArrayList<Object> cacheValues;
cacheValues = getMetricsCache(deployment).get(key);
for (Object valueComp : valuesToCompare) {
for (Object value : cacheValues) {
if (value.toString().compareTo(valueComp.toString()) == 0) {
isEqual = true; // depends on control dependency: [if], data = [none]
break;
}
isEqual = false; // depends on control dependency: [for], data = [none]
}
}
return isEqual;
} }
|
public class class_name {
protected void callLifecycleInterceptors(InterceptorProxy[] proxies, int methodId)
{
final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
try
{
if (isTraceOn) // d527372
{
if (TEBeanLifeCycleInfo.isTraceEnabled())
TEBeanLifeCycleInfo.traceEJBCallEntry(LifecycleInterceptorWrapper.TRACE_NAMES[methodId]);
if (tc.isDebugEnabled())
Tr.debug(tc, "callLifecycleInterceptors");
}
InvocationContextImpl<?> inv = getInvocationContext();
BeanMetaData bmd = home.beanMetaData; //d450431
inv.doLifeCycle(proxies, bmd._moduleMetaData); //d450431, F743-14982
} catch (Throwable t)
{
// FFDCFilter.processException( t, CLASS_NAME + ".SessionBeanO", "251", this );
// Lifecycle interceptors are allowed to throw system runtime exceptions,
// but NOT application exceptions. Therefore, wrap the caught Throwable
// in a javax.ejb.EJBException and throw it so that it gets handled as
// an unchecked exception.
if (isTraceOn && tc.isDebugEnabled())
{
Tr.debug(tc, "SessionBean PostConstruct failure", t);
}
throw ExceptionUtil.EJBException("session bean lifecycle interceptor failure", t);
} finally
{
if (isTraceOn && // d527372
TEBeanLifeCycleInfo.isTraceEnabled())
{
TEBeanLifeCycleInfo.traceEJBCallExit(LifecycleInterceptorWrapper.TRACE_NAMES[methodId]);
}
}
} }
|
public class class_name {
protected void callLifecycleInterceptors(InterceptorProxy[] proxies, int methodId)
{
final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
try
{
if (isTraceOn) // d527372
{
if (TEBeanLifeCycleInfo.isTraceEnabled())
TEBeanLifeCycleInfo.traceEJBCallEntry(LifecycleInterceptorWrapper.TRACE_NAMES[methodId]);
if (tc.isDebugEnabled())
Tr.debug(tc, "callLifecycleInterceptors");
}
InvocationContextImpl<?> inv = getInvocationContext();
BeanMetaData bmd = home.beanMetaData; //d450431
inv.doLifeCycle(proxies, bmd._moduleMetaData); //d450431, F743-14982 // depends on control dependency: [try], data = [none]
} catch (Throwable t)
{
// FFDCFilter.processException( t, CLASS_NAME + ".SessionBeanO", "251", this );
// Lifecycle interceptors are allowed to throw system runtime exceptions,
// but NOT application exceptions. Therefore, wrap the caught Throwable
// in a javax.ejb.EJBException and throw it so that it gets handled as
// an unchecked exception.
if (isTraceOn && tc.isDebugEnabled())
{
Tr.debug(tc, "SessionBean PostConstruct failure", t); // depends on control dependency: [if], data = [none]
}
throw ExceptionUtil.EJBException("session bean lifecycle interceptor failure", t);
} finally // depends on control dependency: [catch], data = [none]
{
if (isTraceOn && // d527372
TEBeanLifeCycleInfo.isTraceEnabled())
{
TEBeanLifeCycleInfo.traceEJBCallExit(LifecycleInterceptorWrapper.TRACE_NAMES[methodId]); // depends on control dependency: [if], data = [none]
}
}
} }
|
public class class_name {
private void sendCancelRpcCall(int numberRetries) {
final LogicalSlot slot = assignedResource;
if (slot != null) {
final TaskManagerGateway taskManagerGateway = slot.getTaskManagerGateway();
final ComponentMainThreadExecutor jobMasterMainThreadExecutor =
getVertex().getExecutionGraph().getJobMasterMainThreadExecutor();
CompletableFuture<Acknowledge> cancelResultFuture = FutureUtils.retry(
() -> taskManagerGateway.cancelTask(attemptId, rpcTimeout),
numberRetries,
jobMasterMainThreadExecutor);
cancelResultFuture.whenComplete(
(ack, failure) -> {
if (failure != null) {
fail(new Exception("Task could not be canceled.", failure));
}
});
}
} }
|
public class class_name {
private void sendCancelRpcCall(int numberRetries) {
final LogicalSlot slot = assignedResource;
if (slot != null) {
final TaskManagerGateway taskManagerGateway = slot.getTaskManagerGateway();
final ComponentMainThreadExecutor jobMasterMainThreadExecutor =
getVertex().getExecutionGraph().getJobMasterMainThreadExecutor();
CompletableFuture<Acknowledge> cancelResultFuture = FutureUtils.retry(
() -> taskManagerGateway.cancelTask(attemptId, rpcTimeout),
numberRetries,
jobMasterMainThreadExecutor);
cancelResultFuture.whenComplete(
(ack, failure) -> {
if (failure != null) {
fail(new Exception("Task could not be canceled.", failure)); // depends on control dependency: [if], data = [none]
}
});
}
} }
|
public class class_name {
@Override // override for Javadoc and performance
public int get(TemporalField field) {
if (field == OFFSET_SECONDS) {
return totalSeconds;
} else if (field instanceof ChronoField) {
throw new UnsupportedTemporalTypeException("Unsupported field: " + field);
}
return range(field).checkValidIntValue(getLong(field), field);
} }
|
public class class_name {
@Override // override for Javadoc and performance
public int get(TemporalField field) {
if (field == OFFSET_SECONDS) {
return totalSeconds; // depends on control dependency: [if], data = [none]
} else if (field instanceof ChronoField) {
throw new UnsupportedTemporalTypeException("Unsupported field: " + field);
}
return range(field).checkValidIntValue(getLong(field), field);
} }
|
public class class_name {
@Override
public ITemplateSource createTemplateSource(Template<?> template, String source) {
try {
return new JarTemplateSource(getTemplatePath(template), source);
} catch(IOException e) {
throw new RuntimeException(e);
}
} }
|
public class class_name {
@Override
public ITemplateSource createTemplateSource(Template<?> template, String source) {
try {
return new JarTemplateSource(getTemplatePath(template), source); // depends on control dependency: [try], data = [none]
} catch(IOException e) {
throw new RuntimeException(e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public <T> T convert(Object value, Class<T> clazz) {
if (null == value) return null;
if (value instanceof String && Strings.isEmpty((String) value)) { return null; }
if (value.getClass().isArray()) {
Object[] values = (Object[]) value;
if (values.length >= 1) {
value = values[0];
}
}
return conversion.convert(value, clazz);
} }
|
public class class_name {
public <T> T convert(Object value, Class<T> clazz) {
if (null == value) return null;
if (value instanceof String && Strings.isEmpty((String) value)) { return null; } // depends on control dependency: [if], data = [none]
if (value.getClass().isArray()) {
Object[] values = (Object[]) value;
if (values.length >= 1) {
value = values[0]; // depends on control dependency: [if], data = [none]
}
}
return conversion.convert(value, clazz);
} }
|
public class class_name {
private void updatePredicateDependencyGraph(CQIE rule) {
List<Predicate> dependencyList = new LinkedList<>();
for (Function bodyAtom : rule.getBody()) {
if (bodyAtom.isDataFunction()) {
dependencyList.add(bodyAtom.getFunctionSymbol());
} else if (bodyAtom.isAlgebraFunction() || bodyAtom.isOperation()) {
updatePredicateDependencyGraph_traverseBodyAtom(dependencyList, bodyAtom);
//} else if (bodyAtom.isArithmeticFunction() || bodyAtom.isDataTypeFunction() {
} else if (bodyAtom.isDataTypeFunction()) {
continue;
} else {
throw new IllegalStateException("Unknown Function");
}
}
Predicate headPred = rule.getHead().getFunctionSymbol();
predicateDependencyGraph.addVertex(headPred);
for (Predicate dependentPred : dependencyList) {
predicateDependencyGraph.addVertex(dependentPred);
predicateDependencyGraph.addEdge(headPred, dependentPred);
}
} }
|
public class class_name {
private void updatePredicateDependencyGraph(CQIE rule) {
List<Predicate> dependencyList = new LinkedList<>();
for (Function bodyAtom : rule.getBody()) {
if (bodyAtom.isDataFunction()) {
dependencyList.add(bodyAtom.getFunctionSymbol()); // depends on control dependency: [if], data = [none]
} else if (bodyAtom.isAlgebraFunction() || bodyAtom.isOperation()) {
updatePredicateDependencyGraph_traverseBodyAtom(dependencyList, bodyAtom); // depends on control dependency: [if], data = [none]
//} else if (bodyAtom.isArithmeticFunction() || bodyAtom.isDataTypeFunction() {
} else if (bodyAtom.isDataTypeFunction()) {
continue;
} else {
throw new IllegalStateException("Unknown Function");
}
}
Predicate headPred = rule.getHead().getFunctionSymbol();
predicateDependencyGraph.addVertex(headPred);
for (Predicate dependentPred : dependencyList) {
predicateDependencyGraph.addVertex(dependentPred); // depends on control dependency: [for], data = [dependentPred]
predicateDependencyGraph.addEdge(headPred, dependentPred); // depends on control dependency: [for], data = [dependentPred]
}
} }
|
public class class_name {
private void refitText() {
if (!mSizeToFit) {
return;
}
if (mMaxLines <= 0) {
// Don't auto-size since there's no limit on lines.
return;
}
String text = mTextView.getText().toString();
int targetWidth = mTextView.getWidth() - mTextView.getPaddingLeft() - mTextView.getPaddingRight();
if (targetWidth > 0) {
Context context = mTextView.getContext();
Resources r = Resources.getSystem();
DisplayMetrics displayMetrics;
float size = mMaxTextSize;
float high = size;
float low = 0;
if (context != null) {
r = context.getResources();
}
displayMetrics = r.getDisplayMetrics();
mPaint.set(mTextView.getPaint());
mPaint.setTextSize(size);
if ((mMaxLines == 1 && mPaint.measureText(text) > targetWidth)
|| getLineCount(text, mPaint, size, targetWidth, displayMetrics) > mMaxLines) {
size = getTextSize(text, mPaint, targetWidth, mMaxLines, low, high, mPrecision,
displayMetrics);
}
if (size < mMinTextSize) {
size = mMinTextSize;
}
mTextView.setTextSize(TypedValue.COMPLEX_UNIT_PX, size);
}
} }
|
public class class_name {
private void refitText() {
if (!mSizeToFit) {
return; // depends on control dependency: [if], data = [none]
}
if (mMaxLines <= 0) {
// Don't auto-size since there's no limit on lines.
return; // depends on control dependency: [if], data = [none]
}
String text = mTextView.getText().toString();
int targetWidth = mTextView.getWidth() - mTextView.getPaddingLeft() - mTextView.getPaddingRight();
if (targetWidth > 0) {
Context context = mTextView.getContext();
Resources r = Resources.getSystem();
DisplayMetrics displayMetrics;
float size = mMaxTextSize;
float high = size;
float low = 0;
if (context != null) {
r = context.getResources(); // depends on control dependency: [if], data = [none]
}
displayMetrics = r.getDisplayMetrics(); // depends on control dependency: [if], data = [none]
mPaint.set(mTextView.getPaint()); // depends on control dependency: [if], data = [none]
mPaint.setTextSize(size); // depends on control dependency: [if], data = [none]
if ((mMaxLines == 1 && mPaint.measureText(text) > targetWidth)
|| getLineCount(text, mPaint, size, targetWidth, displayMetrics) > mMaxLines) {
size = getTextSize(text, mPaint, targetWidth, mMaxLines, low, high, mPrecision,
displayMetrics); // depends on control dependency: [if], data = [none]
}
if (size < mMinTextSize) {
size = mMinTextSize; // depends on control dependency: [if], data = [none]
}
mTextView.setTextSize(TypedValue.COMPLEX_UNIT_PX, size); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public void setDate(Date date) {
for (int i = 0; i < 4; i++) {
((JDateChooser) components[i]).setDate(date);
}
} }
|
public class class_name {
public void setDate(Date date) {
for (int i = 0; i < 4; i++) {
((JDateChooser) components[i]).setDate(date); // depends on control dependency: [for], data = [i]
}
} }
|
public class class_name {
protected <E extends Identifiable> void deleteEntity(EntityManager em, E entity) {
requireArgument(em != null, "The entity manager cannot be null.");
requireArgument(entity != null, "The entity cannot be null.");
if (!em.contains(entity)) {
Identifiable attached = findEntity(em, entity.getId(), entity.getClass());
em.remove(attached);
} else {
em.remove(entity);
}
} }
|
public class class_name {
protected <E extends Identifiable> void deleteEntity(EntityManager em, E entity) {
requireArgument(em != null, "The entity manager cannot be null.");
requireArgument(entity != null, "The entity cannot be null.");
if (!em.contains(entity)) {
Identifiable attached = findEntity(em, entity.getId(), entity.getClass());
em.remove(attached); // depends on control dependency: [if], data = [none]
} else {
em.remove(entity); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public static String toBinaryString(byte[] bytes) {
StringBuilder buffer = new StringBuilder();
for(byte b: bytes) {
String bin = Integer.toBinaryString(0xFF & b);
bin = bin.substring(0, Math.min(bin.length(), 8));
for(int j = 0; j < 8 - bin.length(); j++) {
buffer.append('0');
}
buffer.append(bin);
}
return buffer.toString();
} }
|
public class class_name {
public static String toBinaryString(byte[] bytes) {
StringBuilder buffer = new StringBuilder();
for(byte b: bytes) {
String bin = Integer.toBinaryString(0xFF & b);
bin = bin.substring(0, Math.min(bin.length(), 8)); // depends on control dependency: [for], data = [b]
for(int j = 0; j < 8 - bin.length(); j++) {
buffer.append('0'); // depends on control dependency: [for], data = [none]
}
buffer.append(bin); // depends on control dependency: [for], data = [b]
}
return buffer.toString();
} }
|
public class class_name {
public static void closeWTX(final boolean abortTransaction, final INodeWriteTrx wtx, final ISession ses)
throws TTException {
synchronized (ses) {
if (abortTransaction) {
wtx.abort();
}
ses.close();
}
} }
|
public class class_name {
public static void closeWTX(final boolean abortTransaction, final INodeWriteTrx wtx, final ISession ses)
throws TTException {
synchronized (ses) {
if (abortTransaction) {
wtx.abort(); // depends on control dependency: [if], data = [none]
}
ses.close();
}
} }
|
public class class_name {
protected void usage() {
String footnotes = null;
if (!getOptions().getCommands().isEmpty()) {
footnotes = "Use `" + CSLToolContext.current().getToolName() +
" help <command>' to read about a specific command.";
}
String name = CSLToolContext.current().getToolName();
String usageName = getUsageName();
if (usageName != null && !usageName.isEmpty()) {
name += " " + usageName;
}
String unknownArguments = OptionIntrospector.getUnknownArgumentName(
getClassesToIntrospect());
OptionParser.usage(name, getUsageDescription(), getOptions(),
unknownArguments, footnotes, new PrintWriter(System.out, true));
} }
|
public class class_name {
protected void usage() {
String footnotes = null;
if (!getOptions().getCommands().isEmpty()) {
footnotes = "Use `" + CSLToolContext.current().getToolName() +
" help <command>' to read about a specific command."; // depends on control dependency: [if], data = [none]
}
String name = CSLToolContext.current().getToolName();
String usageName = getUsageName();
if (usageName != null && !usageName.isEmpty()) {
name += " " + usageName; // depends on control dependency: [if], data = [none]
}
String unknownArguments = OptionIntrospector.getUnknownArgumentName(
getClassesToIntrospect());
OptionParser.usage(name, getUsageDescription(), getOptions(),
unknownArguments, footnotes, new PrintWriter(System.out, true));
} }
|
public class class_name {
public void setSslPolicies(java.util.Collection<SslPolicy> sslPolicies) {
if (sslPolicies == null) {
this.sslPolicies = null;
return;
}
this.sslPolicies = new java.util.ArrayList<SslPolicy>(sslPolicies);
} }
|
public class class_name {
public void setSslPolicies(java.util.Collection<SslPolicy> sslPolicies) {
if (sslPolicies == null) {
this.sslPolicies = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.sslPolicies = new java.util.ArrayList<SslPolicy>(sslPolicies);
} }
|
public class class_name {
private Map<String, Boolean> collapseSets(List<List<String>> allTableSets) {
Map<String, Boolean> answer = new TreeMap<>();
for (List<String> tables : allTableSets) {
for (String table : tables) {
answer.put(table, false);
}
}
return answer;
} }
|
public class class_name {
private Map<String, Boolean> collapseSets(List<List<String>> allTableSets) {
Map<String, Boolean> answer = new TreeMap<>();
for (List<String> tables : allTableSets) {
for (String table : tables) {
answer.put(table, false); // depends on control dependency: [for], data = [table]
}
}
return answer;
} }
|
public class class_name {
@SuppressWarnings("nls")
public void flush()
{
synchronized (this)
{
// write xml header
if (!hasXmlHeader)
{
out.println("<?xml version=\"1.0\" encoding=\"UTF-8\"?> ");
out.println("<java version=\"" + System.getProperty("java.version") + "\" class=\"com.googlecode.openbeans.XMLDecoder\"> ");
hasXmlHeader = true;
}
// preprocess pending objects
for (Iterator<Object> iter = flushPending.iterator(); iter.hasNext();)
{
Object o = iter.next();
Record rec = objRecordMap.get(o);
if (rec != null)
{
preprocess(o, rec);
}
}
// flush pending objects
for (Iterator<Object> iter = flushPending.iterator(); iter.hasNext();)
{
Object o = iter.next();
flushObject(o, INDENT_UNIT);
// remove flushed obj
iter.remove();
}
// clear statement records
objRecordMap.clear();
flushPendingStat.clear();
objPrePendingCache.clear();
clazzCounterMap.clear();
// remove all old->new mappings
super.clear();
}
} }
|
public class class_name {
@SuppressWarnings("nls")
public void flush()
{
synchronized (this)
{
// write xml header
if (!hasXmlHeader)
{
out.println("<?xml version=\"1.0\" encoding=\"UTF-8\"?> "); // depends on control dependency: [if], data = [none]
out.println("<java version=\"" + System.getProperty("java.version") + "\" class=\"com.googlecode.openbeans.XMLDecoder\"> "); // depends on control dependency: [if], data = [none]
hasXmlHeader = true; // depends on control dependency: [if], data = [none]
}
// preprocess pending objects
for (Iterator<Object> iter = flushPending.iterator(); iter.hasNext();)
{
Object o = iter.next();
Record rec = objRecordMap.get(o);
if (rec != null)
{
preprocess(o, rec); // depends on control dependency: [if], data = [none]
}
}
// flush pending objects
for (Iterator<Object> iter = flushPending.iterator(); iter.hasNext();)
{
Object o = iter.next();
flushObject(o, INDENT_UNIT); // depends on control dependency: [for], data = [none]
// remove flushed obj
iter.remove(); // depends on control dependency: [for], data = [iter]
}
// clear statement records
objRecordMap.clear();
flushPendingStat.clear();
objPrePendingCache.clear();
clazzCounterMap.clear();
// remove all old->new mappings
super.clear();
}
} }
|
public class class_name {
public Map<String, Accumulator<?, ?>> getJobAccumulators(JobID jobID) {
JobAccumulators jobAccumulators = this.jobAccumulators.get(jobID);
if (jobAccumulators == null) {
return new HashMap<String, Accumulator<?, ?>>();
}
return jobAccumulators.getAccumulators();
} }
|
public class class_name {
public Map<String, Accumulator<?, ?>> getJobAccumulators(JobID jobID) {
JobAccumulators jobAccumulators = this.jobAccumulators.get(jobID);
if (jobAccumulators == null) {
return new HashMap<String, Accumulator<?, ?>>(); // depends on control dependency: [if], data = [none]
}
return jobAccumulators.getAccumulators();
} }
|
public class class_name {
private boolean needInitSheet() {
if (null == this.currentSheet) {
//证明是第一页,肯定需要初始化
return true;
}
//标识即将写入的下一行的行标
int nextRowIndex = this.currentRowInSheet;
if (!this.isBlankLastRow || (this.isBlankLastRow && !this.isSkipBlankRow)) {
nextRowIndex++;
}
return nextRowIndex >= this.allowMaxRows;
} }
|
public class class_name {
private boolean needInitSheet() {
if (null == this.currentSheet) {
//证明是第一页,肯定需要初始化
return true; // depends on control dependency: [if], data = [none]
}
//标识即将写入的下一行的行标
int nextRowIndex = this.currentRowInSheet;
if (!this.isBlankLastRow || (this.isBlankLastRow && !this.isSkipBlankRow)) {
nextRowIndex++; // depends on control dependency: [if], data = [none]
}
return nextRowIndex >= this.allowMaxRows;
} }
|
public class class_name {
protected void createEventVertex(FlowElement flowElement) {
// Add styling for events if needed
if (!graph.getStylesheet().getStyles().containsKey(STYLE_EVENT)) {
Hashtable<String, Object> eventStyle = new Hashtable<String, Object>();
eventStyle.put(mxConstants.STYLE_SHAPE, mxConstants.SHAPE_ELLIPSE);
graph.getStylesheet().putCellStyle(STYLE_EVENT, eventStyle);
}
// Add vertex representing event to graph
Object eventVertex = graph.insertVertex(cellParent, flowElement.getId(), "", 0, 0, eventSize, eventSize, STYLE_EVENT);
generatedVertices.put(flowElement.getId(), eventVertex);
} }
|
public class class_name {
protected void createEventVertex(FlowElement flowElement) {
// Add styling for events if needed
if (!graph.getStylesheet().getStyles().containsKey(STYLE_EVENT)) {
Hashtable<String, Object> eventStyle = new Hashtable<String, Object>();
eventStyle.put(mxConstants.STYLE_SHAPE, mxConstants.SHAPE_ELLIPSE); // depends on control dependency: [if], data = [none]
graph.getStylesheet().putCellStyle(STYLE_EVENT, eventStyle); // depends on control dependency: [if], data = [none]
}
// Add vertex representing event to graph
Object eventVertex = graph.insertVertex(cellParent, flowElement.getId(), "", 0, 0, eventSize, eventSize, STYLE_EVENT);
generatedVertices.put(flowElement.getId(), eventVertex);
} }
|
public class class_name {
private static double wrap(double n, final double minValue, final double maxValue, final double interval) {
if (minValue > maxValue) {
throw new IllegalArgumentException("minValue must be smaller than maxValue: "
+ minValue + ">" + maxValue);
}
if (interval > maxValue - minValue + 1) {
throw new IllegalArgumentException(
"interval must be equal or smaller than maxValue-minValue: " + "min: "
+ minValue + " max:" + maxValue + " int:" + interval);
}
while (n < minValue) {
n += interval;
}
while (n > maxValue) {
n -= interval;
}
return n;
} }
|
public class class_name {
private static double wrap(double n, final double minValue, final double maxValue, final double interval) {
if (minValue > maxValue) {
throw new IllegalArgumentException("minValue must be smaller than maxValue: "
+ minValue + ">" + maxValue);
}
if (interval > maxValue - minValue + 1) {
throw new IllegalArgumentException(
"interval must be equal or smaller than maxValue-minValue: " + "min: "
+ minValue + " max:" + maxValue + " int:" + interval);
}
while (n < minValue) {
n += interval; // depends on control dependency: [while], data = [none]
}
while (n > maxValue) {
n -= interval; // depends on control dependency: [while], data = [none]
}
return n;
} }
|
public class class_name {
public void marshall(TapeArchive tapeArchive, ProtocolMarshaller protocolMarshaller) {
if (tapeArchive == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(tapeArchive.getTapeARN(), TAPEARN_BINDING);
protocolMarshaller.marshall(tapeArchive.getTapeBarcode(), TAPEBARCODE_BINDING);
protocolMarshaller.marshall(tapeArchive.getTapeCreatedDate(), TAPECREATEDDATE_BINDING);
protocolMarshaller.marshall(tapeArchive.getTapeSizeInBytes(), TAPESIZEINBYTES_BINDING);
protocolMarshaller.marshall(tapeArchive.getCompletionTime(), COMPLETIONTIME_BINDING);
protocolMarshaller.marshall(tapeArchive.getRetrievedTo(), RETRIEVEDTO_BINDING);
protocolMarshaller.marshall(tapeArchive.getTapeStatus(), TAPESTATUS_BINDING);
protocolMarshaller.marshall(tapeArchive.getTapeUsedInBytes(), TAPEUSEDINBYTES_BINDING);
protocolMarshaller.marshall(tapeArchive.getKMSKey(), KMSKEY_BINDING);
protocolMarshaller.marshall(tapeArchive.getPoolId(), POOLID_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} }
|
public class class_name {
public void marshall(TapeArchive tapeArchive, ProtocolMarshaller protocolMarshaller) {
if (tapeArchive == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(tapeArchive.getTapeARN(), TAPEARN_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(tapeArchive.getTapeBarcode(), TAPEBARCODE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(tapeArchive.getTapeCreatedDate(), TAPECREATEDDATE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(tapeArchive.getTapeSizeInBytes(), TAPESIZEINBYTES_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(tapeArchive.getCompletionTime(), COMPLETIONTIME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(tapeArchive.getRetrievedTo(), RETRIEVEDTO_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(tapeArchive.getTapeStatus(), TAPESTATUS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(tapeArchive.getTapeUsedInBytes(), TAPEUSEDINBYTES_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(tapeArchive.getKMSKey(), KMSKEY_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(tapeArchive.getPoolId(), POOLID_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 DataSource[] getDataSources() {
Entity[] entities;
try {
entities = getEntitiesByClassName(StorageConstants.DATASOURCES_ROOT, DataSource.class.getName());
} catch (NotFoundException e) {
// never happening
throw new RuntimeException(e);
}
DataSource[] dataSources = new DataSource[entities.length];
System.arraycopy(entities, 0, dataSources, 0, entities.length);
return dataSources;
} }
|
public class class_name {
public DataSource[] getDataSources() {
Entity[] entities;
try {
entities = getEntitiesByClassName(StorageConstants.DATASOURCES_ROOT, DataSource.class.getName()); // depends on control dependency: [try], data = [none]
} catch (NotFoundException e) {
// never happening
throw new RuntimeException(e);
} // depends on control dependency: [catch], data = [none]
DataSource[] dataSources = new DataSource[entities.length];
System.arraycopy(entities, 0, dataSources, 0, entities.length);
return dataSources;
} }
|
public class class_name {
public static long getTotalPhysicalMemory() {
long memory = -1;
try {
MBeanServer mBeanServer = ManagementFactory.getPlatformMBeanServer();
Object attribute = mBeanServer.getAttribute(new ObjectName("java.lang","type","OperatingSystem"), "TotalPhysicalMemorySize");
return (Long) attribute;
} catch (Throwable e) { e.printStackTrace(); }
return memory;
} }
|
public class class_name {
public static long getTotalPhysicalMemory() {
long memory = -1;
try {
MBeanServer mBeanServer = ManagementFactory.getPlatformMBeanServer();
Object attribute = mBeanServer.getAttribute(new ObjectName("java.lang","type","OperatingSystem"), "TotalPhysicalMemorySize");
return (Long) attribute; // depends on control dependency: [try], data = [none]
} catch (Throwable e) { e.printStackTrace(); } // depends on control dependency: [catch], data = [none]
return memory;
} }
|
public class class_name {
public void connect(String endpointID, String appID, boolean shouldReconnect, final Object initialPresence, Context context, final ConnectCompletionListener completionListener) {
if ((endpointID != null) && (appID != null) && (endpointID.length() > 0) && (appID.length() > 0)) {
connectionInProgress = true;
reconnect = shouldReconnect;
applicationID = appID;
appContext = context;
APIGetToken request = new APIGetToken(context, baseURL) {
@Override
public void transactionComplete() {
super.transactionComplete();
if (success) {
connect(this.token, initialPresence, appContext, new ConnectCompletionListener() {
@Override
public void onError(final String errorMessage) {
connectionInProgress = false;
postConnectError(completionListener, errorMessage);
}
});
} else {
connectionInProgress = false;
postConnectError(completionListener, this.errorMessage);
}
}
};
request.appID = appID;
request.endpointID = endpointID;
request.go();
} else {
postConnectError(completionListener, "AppID and endpointID must be specified");
}
} }
|
public class class_name {
public void connect(String endpointID, String appID, boolean shouldReconnect, final Object initialPresence, Context context, final ConnectCompletionListener completionListener) {
if ((endpointID != null) && (appID != null) && (endpointID.length() > 0) && (appID.length() > 0)) {
connectionInProgress = true; // depends on control dependency: [if], data = [none]
reconnect = shouldReconnect; // depends on control dependency: [if], data = [none]
applicationID = appID; // depends on control dependency: [if], data = [none]
appContext = context; // depends on control dependency: [if], data = [none]
APIGetToken request = new APIGetToken(context, baseURL) {
@Override
public void transactionComplete() {
super.transactionComplete();
if (success) {
connect(this.token, initialPresence, appContext, new ConnectCompletionListener() {
@Override
public void onError(final String errorMessage) {
connectionInProgress = false;
postConnectError(completionListener, errorMessage);
}
}); // depends on control dependency: [if], data = [none]
} else {
connectionInProgress = false; // depends on control dependency: [if], data = [none]
postConnectError(completionListener, this.errorMessage); // depends on control dependency: [if], data = [none]
}
}
};
request.appID = appID; // depends on control dependency: [if], data = [none]
request.endpointID = endpointID; // depends on control dependency: [if], data = [none]
request.go(); // depends on control dependency: [if], data = [none]
} else {
postConnectError(completionListener, "AppID and endpointID must be specified"); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
private long getWorkerStoringFile(AlluxioURI path)
throws FileDoesNotExistException, AccessControlException, UnavailableException {
long fileId = mFileSystemMasterView.getFileId(path);
try {
if (mFileSystemMasterView.getFileInfo(fileId).getLength() == 0) {
// if file is empty, return any worker
List<WorkerInfo> workerInfoList = mFileSystemMasterView.getWorkerInfoList();
if (workerInfoList.isEmpty()) {
LOG.error("No worker is available");
return IdUtils.INVALID_WORKER_ID;
}
// randomly pick a worker
int index = new Random().nextInt(workerInfoList.size());
return workerInfoList.get(index).getId();
}
} catch (UnavailableException e) {
return IdUtils.INVALID_WORKER_ID;
}
Map<Long, Integer> workerBlockCounts = new HashMap<>();
List<FileBlockInfo> blockInfoList;
try {
blockInfoList = mFileSystemMasterView.getFileBlockInfoList(path);
for (FileBlockInfo fileBlockInfo : blockInfoList) {
for (BlockLocation blockLocation : fileBlockInfo.getBlockInfo().getLocations()) {
if (workerBlockCounts.containsKey(blockLocation.getWorkerId())) {
workerBlockCounts.put(blockLocation.getWorkerId(),
workerBlockCounts.get(blockLocation.getWorkerId()) + 1);
} else {
workerBlockCounts.put(blockLocation.getWorkerId(), 1);
}
// all the blocks of a file must be stored on the same worker
if (workerBlockCounts.get(blockLocation.getWorkerId()) == blockInfoList.size()) {
return blockLocation.getWorkerId();
}
}
}
} catch (FileDoesNotExistException e) {
LOG.error("The file {} to persist does not exist", path);
return IdUtils.INVALID_WORKER_ID;
} catch (InvalidPathException e) {
LOG.error("The file {} to persist is invalid", path);
return IdUtils.INVALID_WORKER_ID;
} catch (UnavailableException e) {
return IdUtils.INVALID_WORKER_ID;
}
if (workerBlockCounts.size() == 0) {
LOG.error("The file " + path + " does not exist on any worker");
return IdUtils.INVALID_WORKER_ID;
}
LOG.error("Not all the blocks of file {} stored on the same worker", path);
return IdUtils.INVALID_WORKER_ID;
} }
|
public class class_name {
private long getWorkerStoringFile(AlluxioURI path)
throws FileDoesNotExistException, AccessControlException, UnavailableException {
long fileId = mFileSystemMasterView.getFileId(path);
try {
if (mFileSystemMasterView.getFileInfo(fileId).getLength() == 0) {
// if file is empty, return any worker
List<WorkerInfo> workerInfoList = mFileSystemMasterView.getWorkerInfoList();
if (workerInfoList.isEmpty()) {
LOG.error("No worker is available"); // depends on control dependency: [if], data = [none]
return IdUtils.INVALID_WORKER_ID; // depends on control dependency: [if], data = [none]
}
// randomly pick a worker
int index = new Random().nextInt(workerInfoList.size());
return workerInfoList.get(index).getId(); // depends on control dependency: [if], data = [none]
}
} catch (UnavailableException e) {
return IdUtils.INVALID_WORKER_ID;
}
Map<Long, Integer> workerBlockCounts = new HashMap<>();
List<FileBlockInfo> blockInfoList;
try {
blockInfoList = mFileSystemMasterView.getFileBlockInfoList(path);
for (FileBlockInfo fileBlockInfo : blockInfoList) {
for (BlockLocation blockLocation : fileBlockInfo.getBlockInfo().getLocations()) {
if (workerBlockCounts.containsKey(blockLocation.getWorkerId())) {
workerBlockCounts.put(blockLocation.getWorkerId(),
workerBlockCounts.get(blockLocation.getWorkerId()) + 1); // depends on control dependency: [if], data = [none]
} else {
workerBlockCounts.put(blockLocation.getWorkerId(), 1); // depends on control dependency: [if], data = [none]
}
// all the blocks of a file must be stored on the same worker
if (workerBlockCounts.get(blockLocation.getWorkerId()) == blockInfoList.size()) {
return blockLocation.getWorkerId(); // depends on control dependency: [if], data = [none]
}
}
}
} catch (FileDoesNotExistException e) {
LOG.error("The file {} to persist does not exist", path);
return IdUtils.INVALID_WORKER_ID;
} catch (InvalidPathException e) {
LOG.error("The file {} to persist is invalid", path);
return IdUtils.INVALID_WORKER_ID;
} catch (UnavailableException e) {
return IdUtils.INVALID_WORKER_ID;
}
if (workerBlockCounts.size() == 0) {
LOG.error("The file " + path + " does not exist on any worker");
return IdUtils.INVALID_WORKER_ID;
}
LOG.error("Not all the blocks of file {} stored on the same worker", path);
return IdUtils.INVALID_WORKER_ID;
} }
|
public class class_name {
private int typeDepth(Class<?> match, Class<?> actual)
{
if (actual == null) {
return Integer.MAX_VALUE / 2;
}
if (match.equals(Object.class)) {
return Integer.MAX_VALUE / 4;
}
if (match.equals(actual)) {
return 0;
}
int cost = 1 + typeDepth(match, actual.getSuperclass());
for (Class<?> iface : actual.getInterfaces()) {
cost = Math.min(cost, 1 + typeDepth(match, iface));
}
return cost;
} }
|
public class class_name {
private int typeDepth(Class<?> match, Class<?> actual)
{
if (actual == null) {
return Integer.MAX_VALUE / 2; // depends on control dependency: [if], data = [none]
}
if (match.equals(Object.class)) {
return Integer.MAX_VALUE / 4; // depends on control dependency: [if], data = [none]
}
if (match.equals(actual)) {
return 0; // depends on control dependency: [if], data = [none]
}
int cost = 1 + typeDepth(match, actual.getSuperclass());
for (Class<?> iface : actual.getInterfaces()) {
cost = Math.min(cost, 1 + typeDepth(match, iface)); // depends on control dependency: [for], data = [iface]
}
return cost;
} }
|
public class class_name {
public void streamClosed(Status status) {
if (closed.compareAndSet(false, true)) {
for (StreamTracer tracer : tracers) {
tracer.streamClosed(status);
}
}
} }
|
public class class_name {
public void streamClosed(Status status) {
if (closed.compareAndSet(false, true)) {
for (StreamTracer tracer : tracers) {
tracer.streamClosed(status); // depends on control dependency: [for], data = [tracer]
}
}
} }
|
public class class_name {
public CmsContainerPageBean prepareforModelGroupContent(
Map<String, CmsContainerElementBean> elements,
List<String> foundGroups,
CmsContainerPageBean page,
boolean alwaysCopy,
Locale locale)
throws CmsException {
for (Entry<String, CmsContainerElementBean> entry : elements.entrySet()) {
CmsContainerElementBean element = entry.getValue();
CmsContainerPageBean modelPage = null;
String modelInstanceId = null;
boolean foundInstance = false;
if (CmsModelGroupHelper.isModelGroupResource(element.getResource())) {
modelPage = getContainerPageBean(element.getResource());
CmsContainerElementBean baseElement = getModelBaseElement(modelPage, element.getResource());
if (baseElement == null) {
break;
}
String baseInstanceId = baseElement.getInstanceId();
String originalInstanceId = element.getInstanceId();
element = getModelReplacementElement(element, baseElement, true);
List<CmsContainerBean> modelContainers = readModelContainers(
baseInstanceId,
originalInstanceId,
modelPage,
baseElement.isCopyModel());
if (!m_isEditingModelGroups && baseElement.isCopyModel()) {
modelContainers = createNewElementsForModelGroup(m_cms, modelContainers, locale);
}
modelContainers.addAll(page.getContainers().values());
page = new CmsContainerPageBean(modelContainers);
// update the entry element value, as the settings will have changed
entry.setValue(element);
if (m_sessionCache != null) {
// also update the session cache
m_sessionCache.setCacheContainerElement(element.editorHash(), element);
}
} else {
// here we need to make sure to remove the source container page setting and to set a new element instance id
Map<String, String> settings = new HashMap<String, String>(element.getIndividualSettings());
String source = settings.get(CmsContainerpageService.SOURCE_CONTAINERPAGE_ID_SETTING);
settings.remove(CmsContainerpageService.SOURCE_CONTAINERPAGE_ID_SETTING);
// TODO: Make sure source id is available for second call
if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(source)) {
try {
CmsUUID sourceId = new CmsUUID(source);
CmsResource sourcePage = m_cms.readResource(sourceId);
if (CmsResourceTypeXmlContainerPage.isContainerPage(sourcePage)) {
CmsXmlContainerPage xmlCnt = CmsXmlContainerPageFactory.unmarshal(
m_cms,
m_cms.readFile(sourcePage));
modelPage = xmlCnt.getContainerPage(m_cms);
modelInstanceId = element.getInstanceId();
}
settings.remove(CmsContainerElement.ELEMENT_INSTANCE_ID);
boolean copyRoot = false;
if (alwaysCopy && (modelInstanceId != null) && (modelPage != null)) {
for (CmsContainerElementBean el : modelPage.getElements()) {
if (modelInstanceId.equals(el.getInstanceId())) {
copyRoot = el.isCreateNew();
break;
}
}
}
if (copyRoot) {
CmsObject cloneCms = OpenCms.initCmsObject(m_cms);
cloneCms.getRequestContext().setLocale(locale);
String typeName = OpenCms.getResourceManager().getResourceType(
element.getResource()).getTypeName();
CmsResourceTypeConfig typeConfig = m_configData.getResourceType(typeName);
if (typeConfig == null) {
throw new IllegalArgumentException(
"Can not copy template model element '"
+ element.getResource().getRootPath()
+ "' because the resource type '"
+ typeName
+ "' is not available in this sitemap.");
}
CmsResource newResource = typeConfig.createNewElement(
cloneCms,
element.getResource(),
m_configData.getBasePath());
element = new CmsContainerElementBean(
newResource.getStructureId(),
element.getFormatterId(),
settings,
false);
} else {
element = CmsContainerElementBean.cloneWithSettings(element, settings);
}
if (modelPage != null) {
Map<String, List<CmsContainerBean>> containerByParent = new HashMap<String, List<CmsContainerBean>>();
for (CmsContainerBean container : modelPage.getContainers().values()) {
if (container.getParentInstanceId() != null) {
if (!containerByParent.containsKey(container.getParentInstanceId())) {
containerByParent.put(
container.getParentInstanceId(),
new ArrayList<CmsContainerBean>());
}
containerByParent.get(container.getParentInstanceId()).add(container);
}
if (!foundInstance) {
for (CmsContainerElementBean child : container.getElements()) {
if (modelInstanceId == null) {
if (child.getId().equals(element.getId())) {
modelInstanceId = child.getInstanceId();
foundInstance = true;
// we also want to keep the settings of the model group
Map<String, String> setting = new HashMap<String, String>(
child.getIndividualSettings());
setting.remove(CmsContainerElement.ELEMENT_INSTANCE_ID);
element = CmsContainerElementBean.cloneWithSettings(element, setting);
break;
}
} else {
if (modelInstanceId.equals(child.getInstanceId())) {
foundInstance = true;
break;
}
}
}
}
}
if (foundInstance && containerByParent.containsKey(modelInstanceId)) {
List<CmsContainerBean> modelContainers = collectModelStructure(
modelInstanceId,
element.getInstanceId(),
containerByParent,
true);
if (alwaysCopy) {
modelContainers = createNewElementsForModelGroup(m_cms, modelContainers, locale);
}
foundGroups.add(element.editorHash());
modelContainers.addAll(page.getContainers().values());
page = new CmsContainerPageBean(modelContainers);
}
}
// update the entry element value, as the settings will have changed
entry.setValue(element);
if (m_sessionCache != null) {
// also update the session cache
m_sessionCache.setCacheContainerElement(element.editorHash(), element);
}
} catch (Exception e) {
LOG.info(e.getLocalizedMessage(), e);
}
}
}
}
return page;
} }
|
public class class_name {
public CmsContainerPageBean prepareforModelGroupContent(
Map<String, CmsContainerElementBean> elements,
List<String> foundGroups,
CmsContainerPageBean page,
boolean alwaysCopy,
Locale locale)
throws CmsException {
for (Entry<String, CmsContainerElementBean> entry : elements.entrySet()) {
CmsContainerElementBean element = entry.getValue();
CmsContainerPageBean modelPage = null;
String modelInstanceId = null;
boolean foundInstance = false;
if (CmsModelGroupHelper.isModelGroupResource(element.getResource())) {
modelPage = getContainerPageBean(element.getResource());
CmsContainerElementBean baseElement = getModelBaseElement(modelPage, element.getResource());
if (baseElement == null) {
break;
}
String baseInstanceId = baseElement.getInstanceId();
String originalInstanceId = element.getInstanceId();
element = getModelReplacementElement(element, baseElement, true);
List<CmsContainerBean> modelContainers = readModelContainers(
baseInstanceId,
originalInstanceId,
modelPage,
baseElement.isCopyModel());
if (!m_isEditingModelGroups && baseElement.isCopyModel()) {
modelContainers = createNewElementsForModelGroup(m_cms, modelContainers, locale); // depends on control dependency: [if], data = [none]
}
modelContainers.addAll(page.getContainers().values());
page = new CmsContainerPageBean(modelContainers);
// update the entry element value, as the settings will have changed
entry.setValue(element);
if (m_sessionCache != null) {
// also update the session cache
m_sessionCache.setCacheContainerElement(element.editorHash(), element); // depends on control dependency: [if], data = [none]
}
} else {
// here we need to make sure to remove the source container page setting and to set a new element instance id
Map<String, String> settings = new HashMap<String, String>(element.getIndividualSettings());
String source = settings.get(CmsContainerpageService.SOURCE_CONTAINERPAGE_ID_SETTING);
settings.remove(CmsContainerpageService.SOURCE_CONTAINERPAGE_ID_SETTING);
// TODO: Make sure source id is available for second call
if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(source)) {
try {
CmsUUID sourceId = new CmsUUID(source);
CmsResource sourcePage = m_cms.readResource(sourceId);
if (CmsResourceTypeXmlContainerPage.isContainerPage(sourcePage)) {
CmsXmlContainerPage xmlCnt = CmsXmlContainerPageFactory.unmarshal(
m_cms,
m_cms.readFile(sourcePage));
modelPage = xmlCnt.getContainerPage(m_cms); // depends on control dependency: [if], data = [none]
modelInstanceId = element.getInstanceId(); // depends on control dependency: [if], data = [none]
}
settings.remove(CmsContainerElement.ELEMENT_INSTANCE_ID); // depends on control dependency: [try], data = [none]
boolean copyRoot = false;
if (alwaysCopy && (modelInstanceId != null) && (modelPage != null)) {
for (CmsContainerElementBean el : modelPage.getElements()) {
if (modelInstanceId.equals(el.getInstanceId())) {
copyRoot = el.isCreateNew(); // depends on control dependency: [if], data = [none]
break;
}
}
}
if (copyRoot) {
CmsObject cloneCms = OpenCms.initCmsObject(m_cms);
cloneCms.getRequestContext().setLocale(locale); // depends on control dependency: [if], data = [none]
String typeName = OpenCms.getResourceManager().getResourceType(
element.getResource()).getTypeName();
CmsResourceTypeConfig typeConfig = m_configData.getResourceType(typeName);
if (typeConfig == null) {
throw new IllegalArgumentException(
"Can not copy template model element '"
+ element.getResource().getRootPath()
+ "' because the resource type '"
+ typeName
+ "' is not available in this sitemap.");
}
CmsResource newResource = typeConfig.createNewElement(
cloneCms,
element.getResource(),
m_configData.getBasePath());
element = new CmsContainerElementBean(
newResource.getStructureId(),
element.getFormatterId(),
settings,
false); // depends on control dependency: [if], data = [none]
} else {
element = CmsContainerElementBean.cloneWithSettings(element, settings); // depends on control dependency: [if], data = [none]
}
if (modelPage != null) {
Map<String, List<CmsContainerBean>> containerByParent = new HashMap<String, List<CmsContainerBean>>();
for (CmsContainerBean container : modelPage.getContainers().values()) {
if (container.getParentInstanceId() != null) {
if (!containerByParent.containsKey(container.getParentInstanceId())) {
containerByParent.put(
container.getParentInstanceId(),
new ArrayList<CmsContainerBean>()); // depends on control dependency: [if], data = [none]
}
containerByParent.get(container.getParentInstanceId()).add(container); // depends on control dependency: [if], data = [(container.getParentInstanceId()]
}
if (!foundInstance) {
for (CmsContainerElementBean child : container.getElements()) {
if (modelInstanceId == null) {
if (child.getId().equals(element.getId())) {
modelInstanceId = child.getInstanceId(); // depends on control dependency: [if], data = [none]
foundInstance = true; // depends on control dependency: [if], data = [none]
// we also want to keep the settings of the model group
Map<String, String> setting = new HashMap<String, String>(
child.getIndividualSettings());
setting.remove(CmsContainerElement.ELEMENT_INSTANCE_ID); // depends on control dependency: [if], data = [none]
element = CmsContainerElementBean.cloneWithSettings(element, setting); // depends on control dependency: [if], data = [none]
break;
}
} else {
if (modelInstanceId.equals(child.getInstanceId())) {
foundInstance = true; // depends on control dependency: [if], data = [none]
break;
}
}
}
}
}
if (foundInstance && containerByParent.containsKey(modelInstanceId)) {
List<CmsContainerBean> modelContainers = collectModelStructure(
modelInstanceId,
element.getInstanceId(),
containerByParent,
true);
if (alwaysCopy) {
modelContainers = createNewElementsForModelGroup(m_cms, modelContainers, locale); // depends on control dependency: [if], data = [none]
}
foundGroups.add(element.editorHash()); // depends on control dependency: [if], data = [none]
modelContainers.addAll(page.getContainers().values()); // depends on control dependency: [if], data = [none]
page = new CmsContainerPageBean(modelContainers); // depends on control dependency: [if], data = [none]
}
}
// update the entry element value, as the settings will have changed
entry.setValue(element); // depends on control dependency: [try], data = [none]
if (m_sessionCache != null) {
// also update the session cache
m_sessionCache.setCacheContainerElement(element.editorHash(), element); // depends on control dependency: [if], data = [none]
}
} catch (Exception e) {
LOG.info(e.getLocalizedMessage(), e);
} // depends on control dependency: [catch], data = [none]
}
}
}
return page;
} }
|
public class class_name {
protected void setRotation(float w, float x, float y, float z) {
if(disableRotation){
//we don't want to rotate a cursor with no rotation.
return;
}
GVRSceneObject sceneObject = gvrCursorController.getCursor();
if (sceneObject != null) {
sceneObject.getTransform().setRotation(w, x, y, z);
}
} }
|
public class class_name {
protected void setRotation(float w, float x, float y, float z) {
if(disableRotation){
//we don't want to rotate a cursor with no rotation.
return; // depends on control dependency: [if], data = [none]
}
GVRSceneObject sceneObject = gvrCursorController.getCursor();
if (sceneObject != null) {
sceneObject.getTransform().setRotation(w, x, y, z); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public void split() {
if(hasChildren()) {
return;
}
final boolean issplit = (maxSplitDimension >= (getDimensionality() - 1));
final int childLevel = issplit ? level + 1 : level;
final int splitDim = issplit ? 0 : maxSplitDimension + 1;
final double splitPoint = getMin(splitDim) + (getMax(splitDim) - getMin(splitDim)) * .5;
// left and right child
for(int i = 0; i < 2; i++) {
double[] min = SpatialUtil.getMin(this); // clone
double[] max = SpatialUtil.getMax(this); // clone
// right child
if(i == 0) {
min[splitDim] = splitPoint;
}
// left child
else {
max[splitDim] = splitPoint;
}
ModifiableDBIDs childIDs = split.determineIDs(getIDs(), new HyperBoundingBox(min, max), d_min, d_max);
if(childIDs != null) {
// right child
if(i == 0) {
rightChild = new CASHInterval(min, max, split, childIDs, splitDim, childLevel, d_min, d_max);
}
// left child
else {
leftChild = new CASHInterval(min, max, split, childIDs, splitDim, childLevel, d_min, d_max);
}
}
}
if(LOG.isDebuggingFine()) {
StringBuilder msg = new StringBuilder();
msg.append("Child level ").append(childLevel).append(", split Dim ").append(splitDim);
if(leftChild != null) {
msg.append("\nleft ").append(leftChild);
}
if(rightChild != null) {
msg.append("\nright ").append(rightChild);
}
LOG.fine(msg.toString());
}
} }
|
public class class_name {
public void split() {
if(hasChildren()) {
return; // depends on control dependency: [if], data = [none]
}
final boolean issplit = (maxSplitDimension >= (getDimensionality() - 1));
final int childLevel = issplit ? level + 1 : level;
final int splitDim = issplit ? 0 : maxSplitDimension + 1;
final double splitPoint = getMin(splitDim) + (getMax(splitDim) - getMin(splitDim)) * .5;
// left and right child
for(int i = 0; i < 2; i++) {
double[] min = SpatialUtil.getMin(this); // clone
double[] max = SpatialUtil.getMax(this); // clone
// right child
if(i == 0) {
min[splitDim] = splitPoint; // depends on control dependency: [if], data = [none]
}
// left child
else {
max[splitDim] = splitPoint; // depends on control dependency: [if], data = [none]
}
ModifiableDBIDs childIDs = split.determineIDs(getIDs(), new HyperBoundingBox(min, max), d_min, d_max);
if(childIDs != null) {
// right child
if(i == 0) {
rightChild = new CASHInterval(min, max, split, childIDs, splitDim, childLevel, d_min, d_max); // depends on control dependency: [if], data = [none]
}
// left child
else {
leftChild = new CASHInterval(min, max, split, childIDs, splitDim, childLevel, d_min, d_max); // depends on control dependency: [if], data = [none]
}
}
}
if(LOG.isDebuggingFine()) {
StringBuilder msg = new StringBuilder();
msg.append("Child level ").append(childLevel).append(", split Dim ").append(splitDim); // depends on control dependency: [if], data = [none]
if(leftChild != null) {
msg.append("\nleft ").append(leftChild); // depends on control dependency: [if], data = [(leftChild]
}
if(rightChild != null) {
msg.append("\nright ").append(rightChild); // depends on control dependency: [if], data = [(rightChild]
}
LOG.fine(msg.toString()); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
protected final void slicingBy4 (final int[] data) {
final int n = data.length;
for (int i = 0; i < n; i++) {
slicingBy4(data[i]);
}
crc ^= INT_FLAG_MASK_LONG;
} }
|
public class class_name {
protected final void slicingBy4 (final int[] data) {
final int n = data.length;
for (int i = 0; i < n; i++) {
slicingBy4(data[i]); // depends on control dependency: [for], data = [i]
}
crc ^= INT_FLAG_MASK_LONG;
} }
|
public class class_name {
public static HealthCheckRegistry tryGetDefault() {
final String name = defaultRegistryName.get();
if (name != null) {
return getOrCreate(name);
}
return null;
} }
|
public class class_name {
public static HealthCheckRegistry tryGetDefault() {
final String name = defaultRegistryName.get();
if (name != null) {
return getOrCreate(name); // depends on control dependency: [if], data = [(name]
}
return null;
} }
|
public class class_name {
protected KdTree.Node computeBranch(List<P> points, GrowQueue_I32 indexes)
{
// declare storage for the split data
List<P> left = new ArrayList<>(points.size()/2);
List<P> right = new ArrayList<>(points.size()/2);
GrowQueue_I32 leftIndexes,rightIndexes;
if( indexes == null ) {
leftIndexes = null; rightIndexes = null;
} else {
leftIndexes = new GrowQueue_I32(points.size()/2);
rightIndexes = new GrowQueue_I32(points.size()/2);
}
// perform the splitting
splitter.splitData(points,indexes,left,leftIndexes,right,rightIndexes);
// save the results into the current node and its children
KdTree.Node node = memory.requestNode();
node.split = splitter.getSplitAxis();
node.point = splitter.getSplitPoint();
node.index = splitter.getSplitIndex();
// Compute the left and right children
node.left = computeChild(left,leftIndexes);
// free memory
left = null; leftIndexes = null;
node.right = computeChild(right,rightIndexes);
return node;
} }
|
public class class_name {
protected KdTree.Node computeBranch(List<P> points, GrowQueue_I32 indexes)
{
// declare storage for the split data
List<P> left = new ArrayList<>(points.size()/2);
List<P> right = new ArrayList<>(points.size()/2);
GrowQueue_I32 leftIndexes,rightIndexes;
if( indexes == null ) {
leftIndexes = null; rightIndexes = null; // depends on control dependency: [if], data = [none] // depends on control dependency: [if], data = [none]
} else {
leftIndexes = new GrowQueue_I32(points.size()/2); // depends on control dependency: [if], data = [none]
rightIndexes = new GrowQueue_I32(points.size()/2); // depends on control dependency: [if], data = [none]
}
// perform the splitting
splitter.splitData(points,indexes,left,leftIndexes,right,rightIndexes);
// save the results into the current node and its children
KdTree.Node node = memory.requestNode();
node.split = splitter.getSplitAxis();
node.point = splitter.getSplitPoint();
node.index = splitter.getSplitIndex();
// Compute the left and right children
node.left = computeChild(left,leftIndexes);
// free memory
left = null; leftIndexes = null;
node.right = computeChild(right,rightIndexes);
return node;
} }
|
public class class_name {
public static double rmsdMin(Point3d[] x, Point3d[] y) {
if (x.length != y.length) {
throw new IllegalArgumentException(
"Point arrays are not of the same length.");
}
double sum = 0.0;
for (int i = 0; i < x.length; i++) {
double minDist = Double.MAX_VALUE;
for (int j = 0; j < y.length; j++) {
minDist = Math.min(minDist, x[i].distanceSquared(y[j]));
}
sum += minDist;
}
return Math.sqrt(sum / x.length);
} }
|
public class class_name {
public static double rmsdMin(Point3d[] x, Point3d[] y) {
if (x.length != y.length) {
throw new IllegalArgumentException(
"Point arrays are not of the same length.");
}
double sum = 0.0;
for (int i = 0; i < x.length; i++) {
double minDist = Double.MAX_VALUE;
for (int j = 0; j < y.length; j++) {
minDist = Math.min(minDist, x[i].distanceSquared(y[j])); // depends on control dependency: [for], data = [j]
}
sum += minDist; // depends on control dependency: [for], data = [none]
}
return Math.sqrt(sum / x.length);
} }
|
public class class_name {
private void rebindFilters(Map<String, OWhereClause> aliasFilters) {
for (OMatchExpression expression : matchExpressions) {
OWhereClause newFilter = aliasFilters.get(expression.origin.getAlias());
expression.origin.setFilter(newFilter);
for (OMatchPathItem item : expression.items) {
newFilter = aliasFilters.get(item.filter.getAlias());
item.filter.setFilter(newFilter);
}
}
} }
|
public class class_name {
private void rebindFilters(Map<String, OWhereClause> aliasFilters) {
for (OMatchExpression expression : matchExpressions) {
OWhereClause newFilter = aliasFilters.get(expression.origin.getAlias());
expression.origin.setFilter(newFilter); // depends on control dependency: [for], data = [expression]
for (OMatchPathItem item : expression.items) {
newFilter = aliasFilters.get(item.filter.getAlias()); // depends on control dependency: [for], data = [item]
item.filter.setFilter(newFilter); // depends on control dependency: [for], data = [item]
}
}
} }
|
public class class_name {
public PolicyComplianceStatus withEvaluationResults(EvaluationResult... evaluationResults) {
if (this.evaluationResults == null) {
setEvaluationResults(new java.util.ArrayList<EvaluationResult>(evaluationResults.length));
}
for (EvaluationResult ele : evaluationResults) {
this.evaluationResults.add(ele);
}
return this;
} }
|
public class class_name {
public PolicyComplianceStatus withEvaluationResults(EvaluationResult... evaluationResults) {
if (this.evaluationResults == null) {
setEvaluationResults(new java.util.ArrayList<EvaluationResult>(evaluationResults.length)); // depends on control dependency: [if], data = [none]
}
for (EvaluationResult ele : evaluationResults) {
this.evaluationResults.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} }
|
public class class_name {
private void handleSelectionRequest(final Request request) {
String[] paramValue = request.getParameterValues(getId() + ".selected");
if (paramValue == null) {
paramValue = new String[0];
}
Map<List<Integer>, Object> pageRowKeys = getCurrentRowIndexAndKeys();
String[] selectedRows = removeEmptyStrings(paramValue);
Set<?> oldSelections = getSelectedRows();
Set<Object> newSelections;
boolean singleSelect = getSelectMode() == SelectMode.SINGLE;
if (getTableModel().getRowCount() == 0) {
newSelections = new HashSet<>();
selectedRows = new String[0];
} else if (getPaginationMode() == PaginationMode.NONE || getPaginationMode() == PaginationMode.CLIENT
|| oldSelections == null || !isPaginated()) {
newSelections = new HashSet<>(selectedRows.length);
} else if (singleSelect && selectedRows.length > 0) {
// For single-select, we need to remove the old entries
newSelections = new HashSet<>(1);
} else {
// For multi-select, we need the entries for the current page only
newSelections = (Set<Object>) new HashSet<>(oldSelections);
newSelections.removeAll(pageRowKeys.values());
}
for (String selectedRow : selectedRows) {
List<Integer> rowIndex = TableUtil.rowIndexStringToList(selectedRow);
Object key = pageRowKeys.get(rowIndex);
if (key == null) {
continue;
}
newSelections.add(key);
if (singleSelect) {
break;
}
}
setSelectedRows(newSelections);
// If there is a selection change action specified, it may need to be fired
Action selectionChangeAction = getSelectionChangeAction();
if (selectionChangeAction != null && !newSelections.equals(oldSelections)) {
selectionChangeAction.execute(new ActionEvent(this, SELECTION_ACTION_COMMAND));
}
} }
|
public class class_name {
private void handleSelectionRequest(final Request request) {
String[] paramValue = request.getParameterValues(getId() + ".selected");
if (paramValue == null) {
paramValue = new String[0]; // depends on control dependency: [if], data = [none]
}
Map<List<Integer>, Object> pageRowKeys = getCurrentRowIndexAndKeys();
String[] selectedRows = removeEmptyStrings(paramValue);
Set<?> oldSelections = getSelectedRows();
Set<Object> newSelections;
boolean singleSelect = getSelectMode() == SelectMode.SINGLE;
if (getTableModel().getRowCount() == 0) {
newSelections = new HashSet<>(); // depends on control dependency: [if], data = [none]
selectedRows = new String[0]; // depends on control dependency: [if], data = [none]
} else if (getPaginationMode() == PaginationMode.NONE || getPaginationMode() == PaginationMode.CLIENT
|| oldSelections == null || !isPaginated()) {
newSelections = new HashSet<>(selectedRows.length); // depends on control dependency: [if], data = [none]
} else if (singleSelect && selectedRows.length > 0) {
// For single-select, we need to remove the old entries
newSelections = new HashSet<>(1); // depends on control dependency: [if], data = [none]
} else {
// For multi-select, we need the entries for the current page only
newSelections = (Set<Object>) new HashSet<>(oldSelections); // depends on control dependency: [if], data = [none]
newSelections.removeAll(pageRowKeys.values()); // depends on control dependency: [if], data = [none]
}
for (String selectedRow : selectedRows) {
List<Integer> rowIndex = TableUtil.rowIndexStringToList(selectedRow);
Object key = pageRowKeys.get(rowIndex);
if (key == null) {
continue;
}
newSelections.add(key); // depends on control dependency: [for], data = [none]
if (singleSelect) {
break;
}
}
setSelectedRows(newSelections);
// If there is a selection change action specified, it may need to be fired
Action selectionChangeAction = getSelectionChangeAction();
if (selectionChangeAction != null && !newSelections.equals(oldSelections)) {
selectionChangeAction.execute(new ActionEvent(this, SELECTION_ACTION_COMMAND)); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public void marshall(DeleteProfileRequest deleteProfileRequest, ProtocolMarshaller protocolMarshaller) {
if (deleteProfileRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(deleteProfileRequest.getProfileArn(), PROFILEARN_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} }
|
public class class_name {
public void marshall(DeleteProfileRequest deleteProfileRequest, ProtocolMarshaller protocolMarshaller) {
if (deleteProfileRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(deleteProfileRequest.getProfileArn(), PROFILEARN_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 {
private void collectAPIJars(FeatureInfo featureInfo,
Map<String, FeatureInfo> allowedFeatures,
Set<File> apiJars) {
for (SubsystemContentType contentType : JAR_CONTENT_TYPES) {
for (FeatureResource resource : featureInfo.feature.getConstituents(contentType)) {
if (APIType.getAPIType(resource) == APIType.API) {
File file = featureInfo.productInfo.repository.selectBundle(resource.getLocation(), resource.getSymbolicName(), resource.getVersionRange());
if (file != null) {
apiJars.add(file);
}
}
}
}
for (FeatureResource resource : featureInfo.feature.getConstituents(SubsystemContentType.FEATURE_TYPE)) {
String name = resource.getSymbolicName();
FeatureInfo childFeatureInfo = allowedFeatures.get(name);
if (childFeatureInfo != null && APIType.API.matches(resource)) {
allowedFeatures.remove(name);
collectAPIJars(childFeatureInfo, allowedFeatures, apiJars);
}
}
} }
|
public class class_name {
private void collectAPIJars(FeatureInfo featureInfo,
Map<String, FeatureInfo> allowedFeatures,
Set<File> apiJars) {
for (SubsystemContentType contentType : JAR_CONTENT_TYPES) {
for (FeatureResource resource : featureInfo.feature.getConstituents(contentType)) {
if (APIType.getAPIType(resource) == APIType.API) {
File file = featureInfo.productInfo.repository.selectBundle(resource.getLocation(), resource.getSymbolicName(), resource.getVersionRange());
if (file != null) {
apiJars.add(file); // depends on control dependency: [if], data = [(file]
}
}
}
}
for (FeatureResource resource : featureInfo.feature.getConstituents(SubsystemContentType.FEATURE_TYPE)) {
String name = resource.getSymbolicName();
FeatureInfo childFeatureInfo = allowedFeatures.get(name);
if (childFeatureInfo != null && APIType.API.matches(resource)) {
allowedFeatures.remove(name); // depends on control dependency: [if], data = [none]
collectAPIJars(childFeatureInfo, allowedFeatures, apiJars); // depends on control dependency: [if], data = [(childFeatureInfo]
}
}
} }
|
public class class_name {
public static void deaccelerateGeometry(Geometry geometry) {
Geometry.Type gt = geometry.getType();
if (Geometry.isMultiVertex(gt.value()))
{
GeometryAccelerators accel = ((MultiVertexGeometryImpl) geometry
._getImpl())._getAccelerators();
if (accel != null){
accel._setRasterizedGeometry(null);
accel._setQuadTree(null);
}
}
} }
|
public class class_name {
public static void deaccelerateGeometry(Geometry geometry) {
Geometry.Type gt = geometry.getType();
if (Geometry.isMultiVertex(gt.value()))
{
GeometryAccelerators accel = ((MultiVertexGeometryImpl) geometry
._getImpl())._getAccelerators();
if (accel != null){
accel._setRasterizedGeometry(null); // depends on control dependency: [if], data = [null)]
accel._setQuadTree(null); // depends on control dependency: [if], data = [null)]
}
}
} }
|
public class class_name {
public void generateFeatures() {
if (features != null) {
features.clear();
} else {
features = new ArrayList();
}
if (fmap != null) {
fmap.clear();
} else {
fmap = new HashMap();
}
if (currentFeatures != null) {
currentFeatures.clear();
} else {
currentFeatures = new ArrayList();
}
if (data.trnData == null || dict.dict == null) {
System.out.println("No data or dictionary for generating features");
return;
}
// scan over data list
for (int i = 0; i < data.trnData.size(); i++) {
Observation obsr = (Observation)data.trnData.get(i);
for (int j = 0; j < obsr.cps.length; j++) {
Element elem = null;
CountFIdx cntFIdx = null;
elem = (Element)dict.dict.get(new Integer(obsr.cps[j]));
if (elem != null) {
if (elem.count <= option.cpRareThreshold) {
// skip this context predicate, it is too rare
continue;
}
cntFIdx = (CountFIdx)elem.lbCntFidxes.get(new Integer(obsr.humanLabel));
if (cntFIdx != null) {
if (cntFIdx.count <= option.fRareThreshold) {
// skip this feature, it is too rare
continue;
}
} else {
// not found in the dictionary, then skip
continue;
}
} else {
// not found in the dictionary, then skip
continue;
}
// update the feature
Feature f = new Feature(obsr.humanLabel, obsr.cps[j]);
f.strId2Idx(fmap);
if (f.idx < 0) {
// new feature, add to the feature list
addFeature(f);
// update the feature index in the dictionary
cntFIdx.fidx = f.idx;
elem.chosen = 1;
}
}
}
option.numFeatures = features.size();
} }
|
public class class_name {
public void generateFeatures() {
if (features != null) {
features.clear(); // depends on control dependency: [if], data = [none]
} else {
features = new ArrayList(); // depends on control dependency: [if], data = [none]
}
if (fmap != null) {
fmap.clear(); // depends on control dependency: [if], data = [none]
} else {
fmap = new HashMap(); // depends on control dependency: [if], data = [none]
}
if (currentFeatures != null) {
currentFeatures.clear(); // depends on control dependency: [if], data = [none]
} else {
currentFeatures = new ArrayList(); // depends on control dependency: [if], data = [none]
}
if (data.trnData == null || dict.dict == null) {
System.out.println("No data or dictionary for generating features"); // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
// scan over data list
for (int i = 0; i < data.trnData.size(); i++) {
Observation obsr = (Observation)data.trnData.get(i);
for (int j = 0; j < obsr.cps.length; j++) {
Element elem = null;
CountFIdx cntFIdx = null;
elem = (Element)dict.dict.get(new Integer(obsr.cps[j])); // depends on control dependency: [for], data = [j]
if (elem != null) {
if (elem.count <= option.cpRareThreshold) {
// skip this context predicate, it is too rare
continue;
}
cntFIdx = (CountFIdx)elem.lbCntFidxes.get(new Integer(obsr.humanLabel)); // depends on control dependency: [if], data = [none]
if (cntFIdx != null) {
if (cntFIdx.count <= option.fRareThreshold) {
// skip this feature, it is too rare
continue;
}
} else {
// not found in the dictionary, then skip
continue;
}
} else {
// not found in the dictionary, then skip
continue;
}
// update the feature
Feature f = new Feature(obsr.humanLabel, obsr.cps[j]);
f.strId2Idx(fmap); // depends on control dependency: [for], data = [none]
if (f.idx < 0) {
// new feature, add to the feature list
addFeature(f); // depends on control dependency: [if], data = [none]
// update the feature index in the dictionary
cntFIdx.fidx = f.idx; // depends on control dependency: [if], data = [none]
elem.chosen = 1; // depends on control dependency: [if], data = [none]
}
}
}
option.numFeatures = features.size();
} }
|
public class class_name {
public void marshall(GetFilterRequest getFilterRequest, ProtocolMarshaller protocolMarshaller) {
if (getFilterRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(getFilterRequest.getDetectorId(), DETECTORID_BINDING);
protocolMarshaller.marshall(getFilterRequest.getFilterName(), FILTERNAME_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} }
|
public class class_name {
public void marshall(GetFilterRequest getFilterRequest, ProtocolMarshaller protocolMarshaller) {
if (getFilterRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(getFilterRequest.getDetectorId(), DETECTORID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(getFilterRequest.getFilterName(), FILTERNAME_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
@Override
public boolean cancel(boolean mayInterruptIfRunning) {
if (!isInitialized()) {
return internalFuture.cancel(mayInterruptIfRunning);
}
return synchronisationFuture.cancel(mayInterruptIfRunning) && internalFuture.cancel(mayInterruptIfRunning);
} }
|
public class class_name {
@Override
public boolean cancel(boolean mayInterruptIfRunning) {
if (!isInitialized()) {
return internalFuture.cancel(mayInterruptIfRunning); // depends on control dependency: [if], data = [none]
}
return synchronisationFuture.cancel(mayInterruptIfRunning) && internalFuture.cancel(mayInterruptIfRunning);
} }
|
public class class_name {
static IpFamily detectFamily(String ipString) {
boolean hasColon = false;
boolean hasDot = false;
for (int i = 0, length = ipString.length(); i < length; i++) {
char c = ipString.charAt(i);
if (c == '.') {
hasDot = true;
} else if (c == ':') {
if (hasDot) return IpFamily.Unknown; // Colons must not appear after dots.
hasColon = true;
} else if (notHex(c)) {
return IpFamily.Unknown; // Everything else must be a decimal or hex digit.
}
}
// Now decide which address family to parse.
if (hasColon) {
if (hasDot) {
int lastColonIndex = ipString.lastIndexOf(':');
if (!isValidIpV4Address(ipString, lastColonIndex + 1, ipString.length())) {
return IpFamily.Unknown;
}
if (lastColonIndex == 1 && ipString.charAt(0) == ':') {// compressed like ::1.2.3.4
return IpFamily.IPv4Embedded;
}
if (lastColonIndex != 6 || ipString.charAt(0) != ':' || ipString.charAt(1) != ':') {
return IpFamily.Unknown;
}
for (int i = 2; i < 6; i++) {
char c = ipString.charAt(i);
if (c != 'f' && c != 'F' && c != '0') return IpFamily.Unknown;
}
return IpFamily.IPv4Embedded;
}
return IpFamily.IPv6;
} else if (hasDot && isValidIpV4Address(ipString, 0, ipString.length())) {
return IpFamily.IPv4;
}
return IpFamily.Unknown;
} }
|
public class class_name {
static IpFamily detectFamily(String ipString) {
boolean hasColon = false;
boolean hasDot = false;
for (int i = 0, length = ipString.length(); i < length; i++) {
char c = ipString.charAt(i);
if (c == '.') {
hasDot = true; // depends on control dependency: [if], data = [none]
} else if (c == ':') {
if (hasDot) return IpFamily.Unknown; // Colons must not appear after dots.
hasColon = true; // depends on control dependency: [if], data = [none]
} else if (notHex(c)) {
return IpFamily.Unknown; // Everything else must be a decimal or hex digit. // depends on control dependency: [if], data = [none]
}
}
// Now decide which address family to parse.
if (hasColon) {
if (hasDot) {
int lastColonIndex = ipString.lastIndexOf(':');
if (!isValidIpV4Address(ipString, lastColonIndex + 1, ipString.length())) {
return IpFamily.Unknown; // depends on control dependency: [if], data = [none]
}
if (lastColonIndex == 1 && ipString.charAt(0) == ':') {// compressed like ::1.2.3.4
return IpFamily.IPv4Embedded; // depends on control dependency: [if], data = [none]
}
if (lastColonIndex != 6 || ipString.charAt(0) != ':' || ipString.charAt(1) != ':') {
return IpFamily.Unknown; // depends on control dependency: [if], data = [none]
}
for (int i = 2; i < 6; i++) {
char c = ipString.charAt(i);
if (c != 'f' && c != 'F' && c != '0') return IpFamily.Unknown;
}
return IpFamily.IPv4Embedded; // depends on control dependency: [if], data = [none]
}
return IpFamily.IPv6; // depends on control dependency: [if], data = [none]
} else if (hasDot && isValidIpV4Address(ipString, 0, ipString.length())) {
return IpFamily.IPv4; // depends on control dependency: [if], data = [none]
}
return IpFamily.Unknown;
} }
|
public class class_name {
private static int extractOptions(String pattern, int i, List options) {
while ((i < pattern.length()) && (pattern.charAt(i) == '{')) {
int end = pattern.indexOf('}', i);
if (end == -1) {
break;
}
String r = pattern.substring(i + 1, end);
options.add(r);
i = end + 1;
}
return i;
} }
|
public class class_name {
private static int extractOptions(String pattern, int i, List options) {
while ((i < pattern.length()) && (pattern.charAt(i) == '{')) {
int end = pattern.indexOf('}', i);
if (end == -1) {
break;
}
String r = pattern.substring(i + 1, end);
options.add(r); // depends on control dependency: [while], data = [none]
i = end + 1; // depends on control dependency: [while], data = [none]
}
return i;
} }
|
public class class_name {
private int expandHorizontally(Rectangular gp, Rectangular limit, AreaImpl template, boolean right, boolean sep)
{
//System.out.println("exp: " + gp + (right?" ->":" <-") + " " + sep);
int na = right ? gp.getX2() : gp.getX1(); //what to return when it's not possible to expand
int targetx = right ? (gp.getX2() + 1) : (gp.getX1() - 1);
//find candidate boxes
boolean found = false;
int y = gp.getY1();
while (y <= gp.getY2()) //scan everything at the target position
{
AreaImpl cand = (AreaImpl) getTopology().findAreaAt(targetx, y);
//ignore candidates that intersect with our area (could leat to an infinite loop)
if (cand != null && !cand.getGridPosition().intersects(gp))
{
found = true;
if (sep &&
((right && separatorLeft(cand.getGridPosition())) ||
(!right && separatorRight(cand.getGridPosition()))))
return na; //separated, cannot expand
else if ((matchstyles && !cand.hasSameStyle(cand)) || cand.getLevel() > maxlevel)
return na; //not the same style or level
else
{
Rectangular cgp = new Rectangular(cand.getGridPosition());
if (cgp.getY1() == gp.getY1() && cgp.getY2() == gp.getY2())
return targetx; //simple match
else if (cgp.getY1() < gp.getY1() || cgp.getY2() > gp.getY2())
return na; //area overflows, cannot expand
else //candidate is smaller, try to expand align to our width
{
if (right)
{
Rectangular newlimit = new Rectangular(targetx, gp.getY1(), limit.getX2(), gp.getY2());
expandToLimit(cand, cgp, newlimit, template, false, true, DIR_DOWN, REQ_VERTICAL);
if (cgp.getY1() == gp.getY1() && cgp.getY2() == gp.getY2())
return cgp.getX2(); //successfully aligned
}
else
{
Rectangular newlimit = new Rectangular(limit.getX1(), gp.getY1(), targetx, gp.getY2());
expandToLimit(cand, cgp, newlimit, template, false, true, DIR_DOWN, REQ_VERTICAL);
if (cgp.getY1() == gp.getY1() && cgp.getY2() == gp.getY2())
return cgp.getX1(); //successfully aligned
}
}
}
//skip the candidate
y += cand.getGridPosition().getY2() + 1;
}
else
y++;
}
if (!found)
return targetx; //everything below/above empty, can safely expand
else
return na; //some candidates but none usable
} }
|
public class class_name {
private int expandHorizontally(Rectangular gp, Rectangular limit, AreaImpl template, boolean right, boolean sep)
{
//System.out.println("exp: " + gp + (right?" ->":" <-") + " " + sep);
int na = right ? gp.getX2() : gp.getX1(); //what to return when it's not possible to expand
int targetx = right ? (gp.getX2() + 1) : (gp.getX1() - 1);
//find candidate boxes
boolean found = false;
int y = gp.getY1();
while (y <= gp.getY2()) //scan everything at the target position
{
AreaImpl cand = (AreaImpl) getTopology().findAreaAt(targetx, y);
//ignore candidates that intersect with our area (could leat to an infinite loop)
if (cand != null && !cand.getGridPosition().intersects(gp))
{
found = true; // depends on control dependency: [if], data = [none]
if (sep &&
((right && separatorLeft(cand.getGridPosition())) ||
(!right && separatorRight(cand.getGridPosition()))))
return na; //separated, cannot expand
else if ((matchstyles && !cand.hasSameStyle(cand)) || cand.getLevel() > maxlevel)
return na; //not the same style or level
else
{
Rectangular cgp = new Rectangular(cand.getGridPosition());
if (cgp.getY1() == gp.getY1() && cgp.getY2() == gp.getY2())
return targetx; //simple match
else if (cgp.getY1() < gp.getY1() || cgp.getY2() > gp.getY2())
return na; //area overflows, cannot expand
else //candidate is smaller, try to expand align to our width
{
if (right)
{
Rectangular newlimit = new Rectangular(targetx, gp.getY1(), limit.getX2(), gp.getY2());
expandToLimit(cand, cgp, newlimit, template, false, true, DIR_DOWN, REQ_VERTICAL); // depends on control dependency: [if], data = [none]
if (cgp.getY1() == gp.getY1() && cgp.getY2() == gp.getY2())
return cgp.getX2(); //successfully aligned
}
else
{
Rectangular newlimit = new Rectangular(limit.getX1(), gp.getY1(), targetx, gp.getY2());
expandToLimit(cand, cgp, newlimit, template, false, true, DIR_DOWN, REQ_VERTICAL); // depends on control dependency: [if], data = [none]
if (cgp.getY1() == gp.getY1() && cgp.getY2() == gp.getY2())
return cgp.getX1(); //successfully aligned
}
}
}
//skip the candidate
y += cand.getGridPosition().getY2() + 1; // depends on control dependency: [if], data = [none]
}
else
y++;
}
if (!found)
return targetx; //everything below/above empty, can safely expand
else
return na; //some candidates but none usable
} }
|
public class class_name {
static void initDrivers(final Config config) throws InitializationException {
for(String driverName : uniquePrefixSet(config)) {
Config driverConfig = config.getObject(driverName).toConfig();
if(driverConfig.hasPath("class")) {
String className = driverConfig.getString("class");
try {
Class.forName(className);
} catch(Throwable t) {
throw new InitializationException("Unable to load JDBC driver, '" + className + "'", t);
}
} else {
throw new InitializationException("A 'class' must be specified for JDBC driver, '" + driverName + "'");
}
}
} }
|
public class class_name {
static void initDrivers(final Config config) throws InitializationException {
for(String driverName : uniquePrefixSet(config)) {
Config driverConfig = config.getObject(driverName).toConfig();
if(driverConfig.hasPath("class")) {
String className = driverConfig.getString("class");
try {
Class.forName(className);
} catch(Throwable t) {
throw new InitializationException("Unable to load JDBC driver, '" + className + "'", t);
} // depends on control dependency: [catch], data = [none]
} else {
throw new InitializationException("A 'class' must be specified for JDBC driver, '" + driverName + "'");
}
}
} }
|
public class class_name {
@Override
public List<List<Token>> tokenize(final String[] sentences) {
final long start = System.nanoTime();
int noTokens = 0;
int prevIndex = 0;
int curIndex = 0;
final String language = this.lang;
final List<List<Token>> result = new ArrayList<List<Token>>();
// TODO improve this
final String offsetText = this.originalText;
for (final String sentence : sentences) {
if (DEBUG) {
System.err.println("-> Segmented:" + sentence);
}
final List<Token> tokens = new ArrayList<Token>();
final String[] curTokens = getTokens(sentence);
for (final String arrayToken : curTokens) {
curIndex = offsetText.indexOf(arrayToken, prevIndex);
// crap rule for corrected URLs
if (curIndex == -1) {
curIndex = prevIndex + 1;
}
final Token curToken = this.tokenFactory.createToken(arrayToken,
curIndex, arrayToken.length());
// exceptions to WFs
addTokens(curToken, tokens);
if (DEBUG) {
System.err.println("-> Token:" + arrayToken + " curIndex: " + curIndex
+ " prev: " + prevIndex);
}
prevIndex = curIndex + curToken.tokenLength();
}
result.add(tokens);
noTokens = noTokens + curTokens.length;
}
normalizeTokens(result, language);
final long duration = System.nanoTime() - start;
final double toksPerSecond = noTokens / (duration / 1000000000.0);
if (DEBUG) {
System.err.printf(
"ixa-pipe-tok tokenized %d tokens at %.2f tokens per second.%n",
noTokens, toksPerSecond);
}
return result;
} }
|
public class class_name {
@Override
public List<List<Token>> tokenize(final String[] sentences) {
final long start = System.nanoTime();
int noTokens = 0;
int prevIndex = 0;
int curIndex = 0;
final String language = this.lang;
final List<List<Token>> result = new ArrayList<List<Token>>();
// TODO improve this
final String offsetText = this.originalText;
for (final String sentence : sentences) {
if (DEBUG) {
System.err.println("-> Segmented:" + sentence); // depends on control dependency: [if], data = [none]
}
final List<Token> tokens = new ArrayList<Token>();
final String[] curTokens = getTokens(sentence);
for (final String arrayToken : curTokens) {
curIndex = offsetText.indexOf(arrayToken, prevIndex); // depends on control dependency: [for], data = [arrayToken]
// crap rule for corrected URLs
if (curIndex == -1) {
curIndex = prevIndex + 1; // depends on control dependency: [if], data = [none]
}
final Token curToken = this.tokenFactory.createToken(arrayToken,
curIndex, arrayToken.length());
// exceptions to WFs
addTokens(curToken, tokens); // depends on control dependency: [for], data = [none]
if (DEBUG) {
System.err.println("-> Token:" + arrayToken + " curIndex: " + curIndex
+ " prev: " + prevIndex); // depends on control dependency: [if], data = [none]
}
prevIndex = curIndex + curToken.tokenLength(); // depends on control dependency: [for], data = [none]
}
result.add(tokens); // depends on control dependency: [for], data = [none]
noTokens = noTokens + curTokens.length; // depends on control dependency: [for], data = [none]
}
normalizeTokens(result, language);
final long duration = System.nanoTime() - start;
final double toksPerSecond = noTokens / (duration / 1000000000.0);
if (DEBUG) {
System.err.printf(
"ixa-pipe-tok tokenized %d tokens at %.2f tokens per second.%n",
noTokens, toksPerSecond); // depends on control dependency: [if], data = [none]
}
return result;
} }
|
public class class_name {
public static int sum( int[] values, int start, int length ) {
long sum = 0;
for (int index = start; index < length; index++ ) {
sum+= values[index];
}
if (sum < Integer.MIN_VALUE) {
die ("overflow the sum is too small", sum);
}
if (sum > Integer.MAX_VALUE) {
die ("overflow the sum is too big", sum);
}
return (int) sum;
} }
|
public class class_name {
public static int sum( int[] values, int start, int length ) {
long sum = 0;
for (int index = start; index < length; index++ ) {
sum+= values[index]; // depends on control dependency: [for], data = [index]
}
if (sum < Integer.MIN_VALUE) {
die ("overflow the sum is too small", sum); // depends on control dependency: [if], data = [none]
}
if (sum > Integer.MAX_VALUE) {
die ("overflow the sum is too big", sum); // depends on control dependency: [if], data = [none]
}
return (int) sum;
} }
|
public class class_name {
public String form( double x ) {
String r;
if (precision < 0) {
precision = 6;
}
int s = 1;
if (x < 0) {
x = -x;
s = -1;
}
if (fmt == 'f') {
r = fixedFormat(x);
} else if (fmt == 'e' || fmt == 'E' || fmt == 'g' || fmt == 'G') {
r = expFormat(x);
} else {
throw new java.lang.IllegalArgumentException();
}
return pad(sign(s, r));
} }
|
public class class_name {
public String form( double x ) {
String r;
if (precision < 0) {
precision = 6; // depends on control dependency: [if], data = [none]
}
int s = 1;
if (x < 0) {
x = -x; // depends on control dependency: [if], data = [none]
s = -1; // depends on control dependency: [if], data = [none]
}
if (fmt == 'f') {
r = fixedFormat(x); // depends on control dependency: [if], data = [none]
} else if (fmt == 'e' || fmt == 'E' || fmt == 'g' || fmt == 'G') {
r = expFormat(x); // depends on control dependency: [if], data = [none]
} else {
throw new java.lang.IllegalArgumentException();
}
return pad(sign(s, r));
} }
|
public class class_name {
public static String crypt(String salt,String plaintext,String encoding){
try {
byte[] pwd = Crypt.crypt(salt.getBytes(encoding), plaintext.getBytes(encoding));
return new String(pwd);
} catch (Exception e) {
return null;
}
} }
|
public class class_name {
public static String crypt(String salt,String plaintext,String encoding){
try {
byte[] pwd = Crypt.crypt(salt.getBytes(encoding), plaintext.getBytes(encoding));
return new String(pwd);
// depends on control dependency: [try], data = [none]
} catch (Exception e) {
return null;
}
// depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public CmsNewResourceInfo getNewResourceInfoById(CmsUUID id) {
if (m_newElementInfos != null) {
for (CmsNewResourceInfo info : m_newElementInfos) {
if (info.getCopyResourceId().equals(id)) {
return info;
}
}
}
return null;
} }
|
public class class_name {
public CmsNewResourceInfo getNewResourceInfoById(CmsUUID id) {
if (m_newElementInfos != null) {
for (CmsNewResourceInfo info : m_newElementInfos) {
if (info.getCopyResourceId().equals(id)) {
return info; // depends on control dependency: [if], data = [none]
}
}
}
return null;
} }
|
public class class_name {
protected void jvmOperationCallToJavaExpression(final XExpression sourceObject, final JvmOperation operation,
XExpression receiver, List<XExpression> arguments, ITreeAppendable appendable) {
String name = null;
assert operation != null;
if (appendable.hasName(operation)) {
name = appendable.getName(operation);
} else {
name = this.featureNameProvider.getSimpleName(operation);
}
if (name == null) {
name = "/* name is null */"; //$NON-NLS-1$
}
if (operation.isStatic()) {
final JvmDeclaredType operationContainer = operation.getDeclaringType();
final JvmIdentifiableElement container = getLogicalContainerProvider().getNearestLogicalContainer(sourceObject);
final JvmType containerType = EcoreUtil2.getContainerOfType(container, JvmType.class);
final LightweightTypeReference reference = newTypeReferenceOwner(sourceObject)
.toLightweightTypeReference(operationContainer);
if (!reference.isAssignableFrom(containerType)) {
appendable.append(operationContainer);
appendable.append("."); //$NON-NLS-1$
}
} else if (receiver != null) {
internalToJavaExpression(receiver, appendable);
appendable.append("."); //$NON-NLS-1$
} else {
appendable.append("this."); //$NON-NLS-1$
}
appendable.trace(sourceObject, XbasePackage.Literals.XABSTRACT_FEATURE_CALL__FEATURE, 0).append(name);
appendable.append("("); //$NON-NLS-1$
if (arguments != null && !arguments.isEmpty()) {
appendArguments(arguments, appendable, true);
}
appendable.append(")"); //$NON-NLS-1$
} }
|
public class class_name {
protected void jvmOperationCallToJavaExpression(final XExpression sourceObject, final JvmOperation operation,
XExpression receiver, List<XExpression> arguments, ITreeAppendable appendable) {
String name = null;
assert operation != null;
if (appendable.hasName(operation)) {
name = appendable.getName(operation); // depends on control dependency: [if], data = [none]
} else {
name = this.featureNameProvider.getSimpleName(operation); // depends on control dependency: [if], data = [none]
}
if (name == null) {
name = "/* name is null */"; //$NON-NLS-1$ // depends on control dependency: [if], data = [none]
}
if (operation.isStatic()) {
final JvmDeclaredType operationContainer = operation.getDeclaringType();
final JvmIdentifiableElement container = getLogicalContainerProvider().getNearestLogicalContainer(sourceObject);
final JvmType containerType = EcoreUtil2.getContainerOfType(container, JvmType.class);
final LightweightTypeReference reference = newTypeReferenceOwner(sourceObject)
.toLightweightTypeReference(operationContainer);
if (!reference.isAssignableFrom(containerType)) {
appendable.append(operationContainer); // depends on control dependency: [if], data = [none]
appendable.append("."); //$NON-NLS-1$ // depends on control dependency: [if], data = [none]
}
} else if (receiver != null) {
internalToJavaExpression(receiver, appendable); // depends on control dependency: [if], data = [(receiver]
appendable.append("."); //$NON-NLS-1$ // depends on control dependency: [if], data = [none]
} else {
appendable.append("this."); //$NON-NLS-1$ // depends on control dependency: [if], data = [none]
}
appendable.trace(sourceObject, XbasePackage.Literals.XABSTRACT_FEATURE_CALL__FEATURE, 0).append(name);
appendable.append("("); //$NON-NLS-1$
if (arguments != null && !arguments.isEmpty()) {
appendArguments(arguments, appendable, true); // depends on control dependency: [if], data = [(arguments]
}
appendable.append(")"); //$NON-NLS-1$
} }
|
public class class_name {
private String getRelativePath(HttpServletRequest request) {
String result = request.getPathInfo();
if (result == null) {
//result = request.getServletPath();
}
if ((result == null) || (result.equals(""))) {
result = "/";
}
return (result);
} }
|
public class class_name {
private String getRelativePath(HttpServletRequest request) {
String result = request.getPathInfo();
if (result == null) {
//result = request.getServletPath();
}
if ((result == null) || (result.equals(""))) {
result = "/"; // depends on control dependency: [if], data = [none]
}
return (result);
} }
|
public class class_name {
boolean isProcessTreeOverLimit(String tId,
long currentMemUsage,
long curMemUsageOfAgedProcesses,
long limit) {
boolean isOverLimit = false;
if (currentMemUsage > (2*limit)) {
LOG.warn("Process tree for task: " + tId + " running over twice " +
"the configured limit. Limit=" + limit +
", current usage = " + currentMemUsage);
isOverLimit = true;
} else if (curMemUsageOfAgedProcesses > limit) {
LOG.warn("Process tree for task: " + tId + " has processes older than 1 " +
"iteration running over the configured limit. Limit=" + limit +
", current usage = " + curMemUsageOfAgedProcesses);
isOverLimit = true;
}
return isOverLimit;
} }
|
public class class_name {
boolean isProcessTreeOverLimit(String tId,
long currentMemUsage,
long curMemUsageOfAgedProcesses,
long limit) {
boolean isOverLimit = false;
if (currentMemUsage > (2*limit)) {
LOG.warn("Process tree for task: " + tId + " running over twice " +
"the configured limit. Limit=" + limit +
", current usage = " + currentMemUsage); // depends on control dependency: [if], data = [none]
isOverLimit = true; // depends on control dependency: [if], data = [none]
} else if (curMemUsageOfAgedProcesses > limit) {
LOG.warn("Process tree for task: " + tId + " has processes older than 1 " +
"iteration running over the configured limit. Limit=" + limit +
", current usage = " + curMemUsageOfAgedProcesses); // depends on control dependency: [if], data = [none]
isOverLimit = true; // depends on control dependency: [if], data = [none]
}
return isOverLimit;
} }
|
public class class_name {
public void setScriptExtension(String scriptExtension) {
if (scriptExtension.startsWith("*.")) {
this.scriptExtension = scriptExtension;
} else if (scriptExtension.startsWith(".")) {
this.scriptExtension = "*" + scriptExtension;
} else {
this.scriptExtension = "*." + scriptExtension;
}
} }
|
public class class_name {
public void setScriptExtension(String scriptExtension) {
if (scriptExtension.startsWith("*.")) {
this.scriptExtension = scriptExtension; // depends on control dependency: [if], data = [none]
} else if (scriptExtension.startsWith(".")) {
this.scriptExtension = "*" + scriptExtension; // depends on control dependency: [if], data = [none]
} else {
this.scriptExtension = "*." + scriptExtension; // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
@Override
public void startElement(String uri, String local, String raw, Attributes atts) {
currentChars = "";
if (NS_ATOMTYPE.equals(uri)) {
startAtomTypeElement(local, atts);
} // ignore other namespaces
} }
|
public class class_name {
@Override
public void startElement(String uri, String local, String raw, Attributes atts) {
currentChars = "";
if (NS_ATOMTYPE.equals(uri)) {
startAtomTypeElement(local, atts); // depends on control dependency: [if], data = [none]
} // ignore other namespaces
} }
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.