code
stringlengths 130
281k
| code_dependency
stringlengths 182
306k
|
|---|---|
public class class_name {
public static Double[] nullToEmpty(Double[] array) {
if (array == null || array.length == 0) {
return EMPTY_DOUBLE_OBJECT_ARRAY;
}
return array;
} }
|
public class class_name {
public static Double[] nullToEmpty(Double[] array) {
if (array == null || array.length == 0) {
return EMPTY_DOUBLE_OBJECT_ARRAY; // depends on control dependency: [if], data = [none]
}
return array;
} }
|
public class class_name {
public static byte []
digestRRset(RRSIGRecord rrsig, RRset rrset) {
DNSOutput out = new DNSOutput();
digestSIG(out, rrsig);
int size = rrset.size();
Record [] records = new Record[size];
Iterator it = rrset.rrs();
Name name = rrset.getName();
Name wild = null;
int sigLabels = rrsig.getLabels() + 1; // Add the root label back.
if (name.labels() > sigLabels)
wild = name.wild(name.labels() - sigLabels);
while (it.hasNext())
records[--size] = (Record) it.next();
Arrays.sort(records);
DNSOutput header = new DNSOutput();
if (wild != null)
wild.toWireCanonical(header);
else
name.toWireCanonical(header);
header.writeU16(rrset.getType());
header.writeU16(rrset.getDClass());
header.writeU32(rrsig.getOrigTTL());
for (int i = 0; i < records.length; i++) {
out.writeByteArray(header.toByteArray());
int lengthPosition = out.current();
out.writeU16(0);
out.writeByteArray(records[i].rdataToWireCanonical());
int rrlength = out.current() - lengthPosition - 2;
out.save();
out.jump(lengthPosition);
out.writeU16(rrlength);
out.restore();
}
return out.toByteArray();
} }
|
public class class_name {
public static byte []
digestRRset(RRSIGRecord rrsig, RRset rrset) {
DNSOutput out = new DNSOutput();
digestSIG(out, rrsig);
int size = rrset.size();
Record [] records = new Record[size];
Iterator it = rrset.rrs();
Name name = rrset.getName();
Name wild = null;
int sigLabels = rrsig.getLabels() + 1; // Add the root label back.
if (name.labels() > sigLabels)
wild = name.wild(name.labels() - sigLabels);
while (it.hasNext())
records[--size] = (Record) it.next();
Arrays.sort(records);
DNSOutput header = new DNSOutput();
if (wild != null)
wild.toWireCanonical(header);
else
name.toWireCanonical(header);
header.writeU16(rrset.getType());
header.writeU16(rrset.getDClass());
header.writeU32(rrsig.getOrigTTL());
for (int i = 0; i < records.length; i++) {
out.writeByteArray(header.toByteArray()); // depends on control dependency: [for], data = [none]
int lengthPosition = out.current();
out.writeU16(0); // depends on control dependency: [for], data = [none]
out.writeByteArray(records[i].rdataToWireCanonical()); // depends on control dependency: [for], data = [i]
int rrlength = out.current() - lengthPosition - 2;
out.save(); // depends on control dependency: [for], data = [none]
out.jump(lengthPosition); // depends on control dependency: [for], data = [none]
out.writeU16(rrlength); // depends on control dependency: [for], data = [none]
out.restore(); // depends on control dependency: [for], data = [none]
}
return out.toByteArray();
} }
|
public class class_name {
public static <K,V> AListMap<K,V> fromKeysAndValues(AEquality equality, Iterable<ATuple2<K,V>> elements) {
AListMap<K,V> result = empty(equality);
for(ATuple2<K,V> el: elements) {
result = result.updated(el._1, el._2);
}
return result;
} }
|
public class class_name {
public static <K,V> AListMap<K,V> fromKeysAndValues(AEquality equality, Iterable<ATuple2<K,V>> elements) {
AListMap<K,V> result = empty(equality);
for(ATuple2<K,V> el: elements) {
result = result.updated(el._1, el._2); // depends on control dependency: [for], data = [el]
}
return result;
} }
|
public class class_name {
public V getSilent(K key) {
V value = cache.get(key);
if (value != null) {
cache.remove(key);
cache.put(key, value);
}
return value;
} }
|
public class class_name {
public V getSilent(K key) {
V value = cache.get(key);
if (value != null) {
cache.remove(key); // depends on control dependency: [if], data = [none]
cache.put(key, value); // depends on control dependency: [if], data = [none]
}
return value;
} }
|
public class class_name {
public Type cvarUpperBound(Type t) {
if (t.hasTag(TYPEVAR)) {
TypeVar v = (TypeVar) t;
return v.isCaptured() ? cvarUpperBound(v.bound) : v;
}
else return t;
} }
|
public class class_name {
public Type cvarUpperBound(Type t) {
if (t.hasTag(TYPEVAR)) {
TypeVar v = (TypeVar) t;
return v.isCaptured() ? cvarUpperBound(v.bound) : v; // depends on control dependency: [if], data = [none]
}
else return t;
} }
|
public class class_name {
@Override
public SingleSwapMove getRandomMove(PermutationSolution solution, Random rnd) {
int n = solution.size();
// check: move possible
if(n < 2){
return null;
}
// pick two random, distinct positions to swap
int i = rnd.nextInt(n);
int j = rnd.nextInt(n-1);
if(j >= i){
j++;
}
// generate swap move
return new SingleSwapMove(i, j);
} }
|
public class class_name {
@Override
public SingleSwapMove getRandomMove(PermutationSolution solution, Random rnd) {
int n = solution.size();
// check: move possible
if(n < 2){
return null; // depends on control dependency: [if], data = [none]
}
// pick two random, distinct positions to swap
int i = rnd.nextInt(n);
int j = rnd.nextInt(n-1);
if(j >= i){
j++; // depends on control dependency: [if], data = [none]
}
// generate swap move
return new SingleSwapMove(i, j);
} }
|
public class class_name {
protected Statement parseStatementSettings(XMLStreamReader reader) throws XMLStreamException, ParserException,
ValidateException
{
Long preparedStatementsCacheSize = null;
Boolean sharePreparedStatements = Defaults.SHARE_PREPARED_STATEMENTS;
TrackStatementsEnum trackStatements = null;
Map<String, String> expressions = new HashMap<String, String>();
while (reader.hasNext())
{
switch (reader.nextTag())
{
case END_ELEMENT : {
if (XML.ELEMENT_STATEMENT.equals(reader.getLocalName()))
{
return new StatementImpl(sharePreparedStatements, preparedStatementsCacheSize, trackStatements,
!expressions.isEmpty() ? expressions : null);
}
else
{
switch (reader.getLocalName())
{
case XML.ELEMENT_PREPARED_STATEMENT_CACHE_SIZE :
case XML.ELEMENT_TRACK_STATEMENTS :
case XML.ELEMENT_SHARE_PREPARED_STATEMENTS :
break;
default :
throw new ParserException(bundle.unexpectedEndTag(reader.getLocalName()));
}
}
break;
}
case START_ELEMENT : {
switch (reader.getLocalName())
{
case XML.ELEMENT_PREPARED_STATEMENT_CACHE_SIZE : {
preparedStatementsCacheSize = elementAsLong(reader, XML.ELEMENT_PREPARED_STATEMENT_CACHE_SIZE,
expressions);
break;
}
case XML.ELEMENT_TRACK_STATEMENTS : {
String elementString = elementAsString(reader, XML.ELEMENT_TRACK_STATEMENTS, expressions);
trackStatements = TrackStatementsEnum.valueOf(elementString == null ? "FALSE" : elementString
.toUpperCase(Locale.US));
break;
}
case XML.ELEMENT_SHARE_PREPARED_STATEMENTS : {
sharePreparedStatements = elementAsBoolean(reader, XML.ELEMENT_SHARE_PREPARED_STATEMENTS,
expressions);
break;
}
default :
throw new ParserException(bundle.unexpectedElement(reader.getLocalName()));
}
break;
}
}
}
throw new ParserException(bundle.unexpectedEndOfDocument());
} }
|
public class class_name {
protected Statement parseStatementSettings(XMLStreamReader reader) throws XMLStreamException, ParserException,
ValidateException
{
Long preparedStatementsCacheSize = null;
Boolean sharePreparedStatements = Defaults.SHARE_PREPARED_STATEMENTS;
TrackStatementsEnum trackStatements = null;
Map<String, String> expressions = new HashMap<String, String>();
while (reader.hasNext())
{
switch (reader.nextTag())
{
case END_ELEMENT : {
if (XML.ELEMENT_STATEMENT.equals(reader.getLocalName()))
{
return new StatementImpl(sharePreparedStatements, preparedStatementsCacheSize, trackStatements,
!expressions.isEmpty() ? expressions : null); // depends on control dependency: [if], data = [none]
}
else
{
switch (reader.getLocalName())
{
case XML.ELEMENT_PREPARED_STATEMENT_CACHE_SIZE :
case XML.ELEMENT_TRACK_STATEMENTS :
case XML.ELEMENT_SHARE_PREPARED_STATEMENTS :
break;
default :
throw new ParserException(bundle.unexpectedEndTag(reader.getLocalName()));
}
}
break;
}
case START_ELEMENT : {
switch (reader.getLocalName())
{
case XML.ELEMENT_PREPARED_STATEMENT_CACHE_SIZE : {
preparedStatementsCacheSize = elementAsLong(reader, XML.ELEMENT_PREPARED_STATEMENT_CACHE_SIZE,
expressions);
break;
}
case XML.ELEMENT_TRACK_STATEMENTS : {
String elementString = elementAsString(reader, XML.ELEMENT_TRACK_STATEMENTS, expressions);
trackStatements = TrackStatementsEnum.valueOf(elementString == null ? "FALSE" : elementString
.toUpperCase(Locale.US));
break;
}
case XML.ELEMENT_SHARE_PREPARED_STATEMENTS : {
sharePreparedStatements = elementAsBoolean(reader, XML.ELEMENT_SHARE_PREPARED_STATEMENTS,
expressions);
break;
}
default :
throw new ParserException(bundle.unexpectedElement(reader.getLocalName()));
}
break;
}
}
}
throw new ParserException(bundle.unexpectedEndOfDocument());
} }
|
public class class_name {
public static synchronized void clear() {
for (final Map.Entry<String, Cache> entry : CACHES.entrySet()) {
final Cache cache = entry.getValue();
cache.clear();
LOGGER.log(Level.TRACE, "Cleared cache [name={0}]", entry.getKey());
}
} }
|
public class class_name {
public static synchronized void clear() {
for (final Map.Entry<String, Cache> entry : CACHES.entrySet()) {
final Cache cache = entry.getValue();
cache.clear(); // depends on control dependency: [for], data = [none]
LOGGER.log(Level.TRACE, "Cleared cache [name={0}]", entry.getKey()); // depends on control dependency: [for], data = [entry]
}
} }
|
public class class_name {
public static void eliminationTree(DMatrixSparseCSC A, boolean ata, int parent[], @Nullable IGrowArray gwork) {
int m = A.numRows;
int n = A.numCols;
if (parent.length < n)
throw new IllegalArgumentException("parent must be of length N");
int[] work = UtilEjml.adjust(gwork, n + (ata ? m : 0));
int ancestor = 0; // reference to index in work array
int previous = n; // reference to index in work array
if( ata ) {
for (int i = 0; i < m; i++) {
work[previous+i] = -1;
}
}
// step through each column
for (int k = 0; k < n; k++) {
parent[k] = -1;
work[ancestor+k] = -1;
int idx0 = A.col_idx[k]; // node k has no parent
int idx1 = A.col_idx[k+1]; // node k has no ancestor
for (int p = idx0; p < idx1; p++) {
int nz_row_p = A.nz_rows[p];
int i = ata ? work[previous+nz_row_p] : nz_row_p;
int inext;
while( i != -1 && i < k ) {
inext = work[ancestor+i];
work[ancestor+i] = k;
if( inext == -1 ) {
parent[i] = k;
break;
} else {
i = inext;
}
}
if( ata ) {
work[previous+nz_row_p] = k;
}
}
}
} }
|
public class class_name {
public static void eliminationTree(DMatrixSparseCSC A, boolean ata, int parent[], @Nullable IGrowArray gwork) {
int m = A.numRows;
int n = A.numCols;
if (parent.length < n)
throw new IllegalArgumentException("parent must be of length N");
int[] work = UtilEjml.adjust(gwork, n + (ata ? m : 0));
int ancestor = 0; // reference to index in work array
int previous = n; // reference to index in work array
if( ata ) {
for (int i = 0; i < m; i++) {
work[previous+i] = -1; // depends on control dependency: [for], data = [i]
}
}
// step through each column
for (int k = 0; k < n; k++) {
parent[k] = -1; // depends on control dependency: [for], data = [k]
work[ancestor+k] = -1; // depends on control dependency: [for], data = [k]
int idx0 = A.col_idx[k]; // node k has no parent
int idx1 = A.col_idx[k+1]; // node k has no ancestor
for (int p = idx0; p < idx1; p++) {
int nz_row_p = A.nz_rows[p];
int i = ata ? work[previous+nz_row_p] : nz_row_p;
int inext;
while( i != -1 && i < k ) {
inext = work[ancestor+i]; // depends on control dependency: [while], data = [none]
work[ancestor+i] = k; // depends on control dependency: [while], data = [none]
if( inext == -1 ) {
parent[i] = k; // depends on control dependency: [if], data = [none]
break;
} else {
i = inext; // depends on control dependency: [if], data = [none]
}
}
if( ata ) {
work[previous+nz_row_p] = k; // depends on control dependency: [if], data = [none]
}
}
}
} }
|
public class class_name {
private void cacheClass(ClassSource classSource, String outerClassName) {
if (classCacheMode != UserCodeDeploymentConfig.ClassCacheMode.OFF) {
classSourceMap.put(outerClassName, classSource);
} else {
ThreadLocalClassCache.store(outerClassName, classSource);
}
} }
|
public class class_name {
private void cacheClass(ClassSource classSource, String outerClassName) {
if (classCacheMode != UserCodeDeploymentConfig.ClassCacheMode.OFF) {
classSourceMap.put(outerClassName, classSource); // depends on control dependency: [if], data = [none]
} else {
ThreadLocalClassCache.store(outerClassName, classSource); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
private static void handleResourceLoader(final Object resourceLoader, final ClassLoader classLoader,
final ClasspathOrder classpathOrderOut, final ScanSpec scanSpec, final LogNode log) {
if (resourceLoader == null) {
return;
}
// PathResourceLoader has root field, which is a Path object
final Object root = ReflectionUtils.getFieldVal(resourceLoader, "root", false);
// type VirtualFile
final File physicalFile = (File) ReflectionUtils.invokeMethod(root, "getPhysicalFile", false);
String path = null;
if (physicalFile != null) {
final String name = (String) ReflectionUtils.invokeMethod(root, "getName", false);
if (name != null) {
// getParentFile() removes "contents" directory
final File file = new File(physicalFile.getParentFile(), name);
if (FileUtils.canRead(file)) {
path = file.getAbsolutePath();
} else {
// This is an exploded jar or classpath directory
path = physicalFile.getAbsolutePath();
}
} else {
path = physicalFile.getAbsolutePath();
}
} else {
path = (String) ReflectionUtils.invokeMethod(root, "getPathName", false);
if (path == null) {
// Try Path or File
final File file = root instanceof Path ? ((Path) root).toFile()
: root instanceof File ? (File) root : null;
if (file != null) {
path = file.getAbsolutePath();
}
}
}
if (path == null) {
final File file = (File) ReflectionUtils.getFieldVal(resourceLoader, "fileOfJar", false);
if (file != null) {
path = file.getAbsolutePath();
}
}
if (path != null) {
classpathOrderOut.addClasspathEntry(path, classLoader, scanSpec, log);
} else {
if (log != null) {
log.log("Could not determine classpath for ResourceLoader: " + resourceLoader);
}
}
} }
|
public class class_name {
private static void handleResourceLoader(final Object resourceLoader, final ClassLoader classLoader,
final ClasspathOrder classpathOrderOut, final ScanSpec scanSpec, final LogNode log) {
if (resourceLoader == null) {
return; // depends on control dependency: [if], data = [none]
}
// PathResourceLoader has root field, which is a Path object
final Object root = ReflectionUtils.getFieldVal(resourceLoader, "root", false);
// type VirtualFile
final File physicalFile = (File) ReflectionUtils.invokeMethod(root, "getPhysicalFile", false);
String path = null;
if (physicalFile != null) {
final String name = (String) ReflectionUtils.invokeMethod(root, "getName", false);
if (name != null) {
// getParentFile() removes "contents" directory
final File file = new File(physicalFile.getParentFile(), name);
if (FileUtils.canRead(file)) {
path = file.getAbsolutePath(); // depends on control dependency: [if], data = [none]
} else {
// This is an exploded jar or classpath directory
path = physicalFile.getAbsolutePath(); // depends on control dependency: [if], data = [none]
}
} else {
path = physicalFile.getAbsolutePath(); // depends on control dependency: [if], data = [none]
}
} else {
path = (String) ReflectionUtils.invokeMethod(root, "getPathName", false); // depends on control dependency: [if], data = [none]
if (path == null) {
// Try Path or File
final File file = root instanceof Path ? ((Path) root).toFile()
: root instanceof File ? (File) root : null;
if (file != null) {
path = file.getAbsolutePath(); // depends on control dependency: [if], data = [none]
}
}
}
if (path == null) {
final File file = (File) ReflectionUtils.getFieldVal(resourceLoader, "fileOfJar", false);
if (file != null) {
path = file.getAbsolutePath(); // depends on control dependency: [if], data = [none]
}
}
if (path != null) {
classpathOrderOut.addClasspathEntry(path, classLoader, scanSpec, log); // depends on control dependency: [if], data = [(path]
} else {
if (log != null) {
log.log("Could not determine classpath for ResourceLoader: " + resourceLoader); // depends on control dependency: [if], data = [none]
}
}
} }
|
public class class_name {
byte[] uncompressed( ByteBuffer buf, int offset, int uncomplen ) throws IOException
{
byte[] header = new byte[offset];
buf.position(0);
buf.get(header);
byte[] out = new byte[offset+uncomplen];
System.arraycopy(header, 0, out, 0, offset);
CBZip2InputStream cbzip2 = new CBZip2InputStream();
int numCompBytes = buf.remaining();
byte[] bufc = new byte[numCompBytes];
buf.get(bufc, 0, numCompBytes);
ByteArrayInputStream bis = new ByteArrayInputStream(bufc, 2, numCompBytes - 2);
//CBZip2InputStream cbzip2 = new CBZip2InputStream(bis);
cbzip2.setStream(bis);
int total = 0;
int nread;
byte[] ubuff = new byte[40000];
byte[] obuff = new byte[40000];
try {
while ((nread = cbzip2.read(ubuff)) != -1) {
if (total + nread > obuff.length) {
byte[] temp = obuff;
obuff = new byte[temp.length * 2];
System.arraycopy(temp, 0, obuff, 0, temp.length);
}
System.arraycopy(ubuff, 0, obuff, total, nread);
total += nread;
}
if (obuff.length >= 0)
System.arraycopy(obuff, 0, out, offset, total);
} catch (BZip2ReadException ioe) {
log.warn("Nexrad2IOSP.uncompress "+raf.getLocation(), ioe);
}
return out;
} }
|
public class class_name {
byte[] uncompressed( ByteBuffer buf, int offset, int uncomplen ) throws IOException
{
byte[] header = new byte[offset];
buf.position(0);
buf.get(header);
byte[] out = new byte[offset+uncomplen];
System.arraycopy(header, 0, out, 0, offset);
CBZip2InputStream cbzip2 = new CBZip2InputStream();
int numCompBytes = buf.remaining();
byte[] bufc = new byte[numCompBytes];
buf.get(bufc, 0, numCompBytes);
ByteArrayInputStream bis = new ByteArrayInputStream(bufc, 2, numCompBytes - 2);
//CBZip2InputStream cbzip2 = new CBZip2InputStream(bis);
cbzip2.setStream(bis);
int total = 0;
int nread;
byte[] ubuff = new byte[40000];
byte[] obuff = new byte[40000];
try {
while ((nread = cbzip2.read(ubuff)) != -1) {
if (total + nread > obuff.length) {
byte[] temp = obuff;
obuff = new byte[temp.length * 2];
// depends on control dependency: [if], data = [none]
System.arraycopy(temp, 0, obuff, 0, temp.length);
// depends on control dependency: [if], data = [none]
}
System.arraycopy(ubuff, 0, obuff, total, nread);
// depends on control dependency: [while], data = [none]
total += nread;
// depends on control dependency: [while], data = [none]
}
if (obuff.length >= 0)
System.arraycopy(obuff, 0, out, offset, total);
} catch (BZip2ReadException ioe) {
log.warn("Nexrad2IOSP.uncompress "+raf.getLocation(), ioe);
}
return out;
} }
|
public class class_name {
public List<Listener<Listeners<T>>> getAllListener()
{
List<Listener<Listeners<T>>> list = new ArrayList<Listener<Listeners<T>>>();
List<Node> nodeList = childNode.get("listener");
for(Node node: nodeList)
{
Listener<Listeners<T>> type = new ListenerImpl<Listeners<T>>(this, "listener", childNode, node);
list.add(type);
}
return list;
} }
|
public class class_name {
public List<Listener<Listeners<T>>> getAllListener()
{
List<Listener<Listeners<T>>> list = new ArrayList<Listener<Listeners<T>>>();
List<Node> nodeList = childNode.get("listener");
for(Node node: nodeList)
{
Listener<Listeners<T>> type = new ListenerImpl<Listeners<T>>(this, "listener", childNode, node);
list.add(type); // depends on control dependency: [for], data = [none]
}
return list;
} }
|
public class class_name {
@Override
public Xml child(String name) {
List<Xml> children = children(name);
if (children.size() != 1) {
logger.debug("Could not find individual child node: " + name);
return new XmlAbsent(name);
}
return children.get(0);
} }
|
public class class_name {
@Override
public Xml child(String name) {
List<Xml> children = children(name);
if (children.size() != 1) {
logger.debug("Could not find individual child node: " + name);
// depends on control dependency: [if], data = [none]
return new XmlAbsent(name);
// depends on control dependency: [if], data = [none]
}
return children.get(0);
} }
|
public class class_name {
public void marshall(CloudWatchLoggingOptionUpdate cloudWatchLoggingOptionUpdate, ProtocolMarshaller protocolMarshaller) {
if (cloudWatchLoggingOptionUpdate == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(cloudWatchLoggingOptionUpdate.getCloudWatchLoggingOptionId(), CLOUDWATCHLOGGINGOPTIONID_BINDING);
protocolMarshaller.marshall(cloudWatchLoggingOptionUpdate.getLogStreamARNUpdate(), LOGSTREAMARNUPDATE_BINDING);
protocolMarshaller.marshall(cloudWatchLoggingOptionUpdate.getRoleARNUpdate(), ROLEARNUPDATE_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} }
|
public class class_name {
public void marshall(CloudWatchLoggingOptionUpdate cloudWatchLoggingOptionUpdate, ProtocolMarshaller protocolMarshaller) {
if (cloudWatchLoggingOptionUpdate == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(cloudWatchLoggingOptionUpdate.getCloudWatchLoggingOptionId(), CLOUDWATCHLOGGINGOPTIONID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(cloudWatchLoggingOptionUpdate.getLogStreamARNUpdate(), LOGSTREAMARNUPDATE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(cloudWatchLoggingOptionUpdate.getRoleARNUpdate(), ROLEARNUPDATE_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
@Override
public void connectController(String host, int port) {
try {
if (host == null && port == -1) {
try {
this.controllerHost = this.defaultControllerHost;
this.controllerPort = this.defaultControllerPort;
client.connect(new InetSocketAddress(this.controllerHost, this.controllerPort));
this.prompt = this.prefix + "(local)" + Shell.CLI_POSTFIX;
} catch (IOException e) {
this.printLine(e.getMessage());
}
} else {
this.controllerHost = host;
this.controllerPort = port;
client.connect(new InetSocketAddress(this.controllerHost, this.controllerPort));
this.prompt = this.prefix + "(" + host + ":" + port + ")" + Shell.CLI_POSTFIX;
}
Message incomingFirstMessage = this.client.run(null);
String mesage = incomingFirstMessage.toString();
this.printLine(mesage);
if (mesage.contains(CONNECTED_AUTHENTICATING_MESSAGE)) {
username = this.console.readLine("Username:");
this.client.run(messageFactory.createMessage(username));
password = this.console.readLine("Password:", '*');
Message message = this.client.run(messageFactory.createMessage(password));
mesage = message.toString();
if (mesage.equals(CONNECTED_AUTHENTICATION_FAILED)) {
this.printLine(message.toString());
this.disconnectController();
}
} else if (mesage.contains(CLOSING_CONNECTION_MESSAGE)) {
this.disconnectController();
}
} catch (Exception e) {
this.printLine(e.getMessage());
}
} }
|
public class class_name {
@Override
public void connectController(String host, int port) {
try {
if (host == null && port == -1) {
try {
this.controllerHost = this.defaultControllerHost; // depends on control dependency: [try], data = [none]
this.controllerPort = this.defaultControllerPort; // depends on control dependency: [try], data = [none]
client.connect(new InetSocketAddress(this.controllerHost, this.controllerPort)); // depends on control dependency: [try], data = [none]
this.prompt = this.prefix + "(local)" + Shell.CLI_POSTFIX; // depends on control dependency: [try], data = [none]
} catch (IOException e) {
this.printLine(e.getMessage());
} // depends on control dependency: [catch], data = [none]
} else {
this.controllerHost = host; // depends on control dependency: [if], data = [none]
this.controllerPort = port; // depends on control dependency: [if], data = [none]
client.connect(new InetSocketAddress(this.controllerHost, this.controllerPort)); // depends on control dependency: [if], data = [none]
this.prompt = this.prefix + "(" + host + ":" + port + ")" + Shell.CLI_POSTFIX; // depends on control dependency: [if], data = [none]
}
Message incomingFirstMessage = this.client.run(null);
String mesage = incomingFirstMessage.toString();
this.printLine(mesage); // depends on control dependency: [try], data = [none]
if (mesage.contains(CONNECTED_AUTHENTICATING_MESSAGE)) {
username = this.console.readLine("Username:"); // depends on control dependency: [if], data = [none]
this.client.run(messageFactory.createMessage(username)); // depends on control dependency: [if], data = [none]
password = this.console.readLine("Password:", '*'); // depends on control dependency: [if], data = [none]
Message message = this.client.run(messageFactory.createMessage(password));
mesage = message.toString(); // depends on control dependency: [if], data = [none]
if (mesage.equals(CONNECTED_AUTHENTICATION_FAILED)) {
this.printLine(message.toString()); // depends on control dependency: [if], data = [none]
this.disconnectController(); // depends on control dependency: [if], data = [none]
}
} else if (mesage.contains(CLOSING_CONNECTION_MESSAGE)) {
this.disconnectController(); // depends on control dependency: [if], data = [none]
}
} catch (Exception e) {
this.printLine(e.getMessage());
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
private void processRenderFunction() {
if (!hasInterface(processingEnv, component.asType(), HasRender.class)) {
return;
}
componentExposedTypeBuilder.addMethod(MethodSpec
.methodBuilder("vg$render")
.addModifiers(Modifier.PUBLIC)
.addAnnotation(JsMethod.class)
.returns(VNode.class)
.addParameter(CreateElementFunction.class, "createElementFunction")
.addStatement("return super.render(new $T(createElementFunction))", VNodeBuilder.class)
.build());
addMethodToProto("vg$render");
// Register the render method
optionsBuilder.addStatement("options.addHookMethod($S, p.$L)", "render", "vg$render");
} }
|
public class class_name {
private void processRenderFunction() {
if (!hasInterface(processingEnv, component.asType(), HasRender.class)) {
return; // depends on control dependency: [if], data = [none]
}
componentExposedTypeBuilder.addMethod(MethodSpec
.methodBuilder("vg$render")
.addModifiers(Modifier.PUBLIC)
.addAnnotation(JsMethod.class)
.returns(VNode.class)
.addParameter(CreateElementFunction.class, "createElementFunction")
.addStatement("return super.render(new $T(createElementFunction))", VNodeBuilder.class)
.build());
addMethodToProto("vg$render");
// Register the render method
optionsBuilder.addStatement("options.addHookMethod($S, p.$L)", "render", "vg$render");
} }
|
public class class_name {
public int getQueryCacheCount(String mapName) {
Map<String, InternalQueryCache<K, V>> queryCacheRegistry = queryCacheRegistryPerMap.get(mapName);
if (queryCacheRegistry == null) {
return 0;
}
return queryCacheRegistry.size();
} }
|
public class class_name {
public int getQueryCacheCount(String mapName) {
Map<String, InternalQueryCache<K, V>> queryCacheRegistry = queryCacheRegistryPerMap.get(mapName);
if (queryCacheRegistry == null) {
return 0; // depends on control dependency: [if], data = [none]
}
return queryCacheRegistry.size();
} }
|
public class class_name {
public static String joinStrings( String separator, String... strings ) {
if (separator == null) {
separator = "";
}
StringBuilder sb = new StringBuilder();
for( int i = 0; i < strings.length; i++ ) {
sb.append(strings[i]);
if (i < strings.length - 1) {
sb.append(separator);
}
}
return sb.toString();
} }
|
public class class_name {
public static String joinStrings( String separator, String... strings ) {
if (separator == null) {
separator = ""; // depends on control dependency: [if], data = [none]
}
StringBuilder sb = new StringBuilder();
for( int i = 0; i < strings.length; i++ ) {
sb.append(strings[i]); // depends on control dependency: [for], data = [i]
if (i < strings.length - 1) {
sb.append(separator); // depends on control dependency: [if], data = [none]
}
}
return sb.toString();
} }
|
public class class_name {
public static List<File> findAllFile(File file) {
if (file == null || !file.exists()) {
return Collections.emptyList();
}
if (file.isFile()) {
return Collections.singletonList(file);
}
List<File> fileList = new ArrayList<>();
File[] files = file.listFiles();
for (File f : files) {
fileList.addAll(findAllFile(f));
}
return fileList;
} }
|
public class class_name {
public static List<File> findAllFile(File file) {
if (file == null || !file.exists()) {
return Collections.emptyList(); // depends on control dependency: [if], data = [none]
}
if (file.isFile()) {
return Collections.singletonList(file); // depends on control dependency: [if], data = [none]
}
List<File> fileList = new ArrayList<>();
File[] files = file.listFiles();
for (File f : files) {
fileList.addAll(findAllFile(f)); // depends on control dependency: [for], data = [f]
}
return fileList;
} }
|
public class class_name {
private Writer doWrite(Writer writer, int indentFactor, int indent) throws IOException {
writer.write(CharUtil.BRACKET_START);
final int newindent = indent + indentFactor;
final boolean isIgnoreNullValue = this.config.isIgnoreNullValue();
boolean isFirst = true;
for (Object obj : this.rawList) {
if(ObjectUtil.isNull(obj) && isIgnoreNullValue) {
continue;
}
if (isFirst) {
isFirst = false;
}else {
writer.write(CharUtil.COMMA);
}
if (indentFactor > 0) {
writer.write(CharUtil.LF);
}
InternalJSONUtil.indent(writer, newindent);
InternalJSONUtil.writeValue(writer, obj, indentFactor, newindent, this.config);
}
if (indentFactor > 0) {
writer.write(CharUtil.LF);
}
InternalJSONUtil.indent(writer, indent);
writer.write(CharUtil.BRACKET_END);
return writer;
} }
|
public class class_name {
private Writer doWrite(Writer writer, int indentFactor, int indent) throws IOException {
writer.write(CharUtil.BRACKET_START);
final int newindent = indent + indentFactor;
final boolean isIgnoreNullValue = this.config.isIgnoreNullValue();
boolean isFirst = true;
for (Object obj : this.rawList) {
if(ObjectUtil.isNull(obj) && isIgnoreNullValue) {
continue;
}
if (isFirst) {
isFirst = false;
// depends on control dependency: [if], data = [none]
}else {
writer.write(CharUtil.COMMA);
// depends on control dependency: [if], data = [none]
}
if (indentFactor > 0) {
writer.write(CharUtil.LF);
// depends on control dependency: [if], data = [none]
}
InternalJSONUtil.indent(writer, newindent);
InternalJSONUtil.writeValue(writer, obj, indentFactor, newindent, this.config);
}
if (indentFactor > 0) {
writer.write(CharUtil.LF);
}
InternalJSONUtil.indent(writer, indent);
writer.write(CharUtil.BRACKET_END);
return writer;
} }
|
public class class_name {
public static boolean containsNaN(DoubleTuple tuple)
{
for (int i=0; i<tuple.getSize(); i++)
{
if (Double.isNaN(tuple.get(i)))
{
return true;
}
}
return false;
} }
|
public class class_name {
public static boolean containsNaN(DoubleTuple tuple)
{
for (int i=0; i<tuple.getSize(); i++)
{
if (Double.isNaN(tuple.get(i)))
{
return true;
// depends on control dependency: [if], data = [none]
}
}
return false;
} }
|
public class class_name {
private static Mac initHmacSha256(byte[] key) {
try {
SecretKeySpec keySpec = new SecretKeySpec(key, MAC_ALGORITHM);
Mac mac = Mac.getInstance(MAC_ALGORITHM);
mac.init(keySpec);
return mac;
}
catch (GeneralSecurityException e) {
throw new IllegalArgumentException(e);
}
} }
|
public class class_name {
private static Mac initHmacSha256(byte[] key) {
try {
SecretKeySpec keySpec = new SecretKeySpec(key, MAC_ALGORITHM);
Mac mac = Mac.getInstance(MAC_ALGORITHM);
mac.init(keySpec); // depends on control dependency: [try], data = [none]
return mac; // depends on control dependency: [try], data = [none]
}
catch (GeneralSecurityException e) {
throw new IllegalArgumentException(e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public void marshall(GetBotAliasRequest getBotAliasRequest, ProtocolMarshaller protocolMarshaller) {
if (getBotAliasRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(getBotAliasRequest.getName(), NAME_BINDING);
protocolMarshaller.marshall(getBotAliasRequest.getBotName(), BOTNAME_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} }
|
public class class_name {
public void marshall(GetBotAliasRequest getBotAliasRequest, ProtocolMarshaller protocolMarshaller) {
if (getBotAliasRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(getBotAliasRequest.getName(), NAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(getBotAliasRequest.getBotName(), BOTNAME_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public void hideWithAnimation() {
if (transition == null || transition.getStatus().equals(Animation.Status.STOPPED)) {
JFXAlertAnimation currentAnimation = getCurrentAnimation();
Animation animation = currentAnimation.createHidingAnimation(getDialogPane().getContent(), getDialogPane());
if (animation != null) {
transition = animation;
animation.setOnFinished(finish -> {
animateClosing = false;
hide();
transition = null;
});
animation.play();
} else {
animateClosing = false;
transition = null;
Platform.runLater(this::hide);
}
}
} }
|
public class class_name {
public void hideWithAnimation() {
if (transition == null || transition.getStatus().equals(Animation.Status.STOPPED)) {
JFXAlertAnimation currentAnimation = getCurrentAnimation();
Animation animation = currentAnimation.createHidingAnimation(getDialogPane().getContent(), getDialogPane());
if (animation != null) {
transition = animation; // depends on control dependency: [if], data = [none]
animation.setOnFinished(finish -> {
animateClosing = false; // depends on control dependency: [if], data = [none]
hide(); // depends on control dependency: [if], data = [none]
transition = null; // depends on control dependency: [if], data = [none]
});
animation.play(); // depends on control dependency: [if], data = [none]
} else {
animateClosing = false; // depends on control dependency: [if], data = [none]
transition = null; // depends on control dependency: [if], data = [none]
Platform.runLater(this::hide); // depends on control dependency: [if], data = [none]
}
}
} }
|
public class class_name {
private LinkedList<Device> getDevices(SSLSocket socket) throws CommunicationException {
// Compute
LinkedList<Device> listDev = null;
try {
InputStream socketStream = socket.getInputStream();
// Read bytes
byte[] b = new byte[1024];
ByteArrayOutputStream message = new ByteArrayOutputStream();
int nbBytes = 0;
// socketStream.available can return 0
// http://forums.sun.com/thread.jspa?threadID=5428561
while ((nbBytes = socketStream.read(b, 0, 1024)) != -1) {
message.write(b, 0, nbBytes);
}
listDev = new LinkedList<Device>();
byte[] listOfDevices = message.toByteArray();
int nbTuples = listOfDevices.length / FEEDBACK_TUPLE_SIZE;
logger.debug("Found: [" + nbTuples + "]");
for (int i = 0; i < nbTuples; i++) {
int offset = i * FEEDBACK_TUPLE_SIZE;
// Build date
int index = 0;
int firstByte = 0;
int secondByte = 0;
int thirdByte = 0;
int fourthByte = 0;
long anUnsignedInt = 0;
firstByte = (0x000000FF & ((int) listOfDevices[offset]));
secondByte = (0x000000FF & ((int) listOfDevices[offset + 1]));
thirdByte = (0x000000FF & ((int) listOfDevices[offset + 2]));
fourthByte = (0x000000FF & ((int) listOfDevices[offset + 3]));
index = index + 4;
anUnsignedInt = ((long) (firstByte << 24 | secondByte << 16 | thirdByte << 8 | fourthByte)) & 0xFFFFFFFFL;
Timestamp timestamp = new Timestamp(anUnsignedInt * 1000);
// Build device token length
int deviceTokenLength = listOfDevices[offset + 4] << 8 | listOfDevices[offset + 5];
// Build device token
String deviceToken = "";
int octet = 0;
for (int j = 0; j < 32; j++) {
octet = (0x000000FF & ((int) listOfDevices[offset + 6 + j]));
deviceToken = deviceToken.concat(String.format("%02x", octet));
}
// Build device and add to list
/* Create a basic device, as we do not want to go through the factory and create a device in the actual database... */
Device device = new BasicDevice();
device.setToken(deviceToken);
device.setLastRegister(timestamp);
listDev.add(device);
logger.info("FeedbackManager retrieves one device : " + timestamp + ";" + deviceTokenLength + ";" + deviceToken + ".");
}
// Close the socket and return the list
} catch (Exception e) {
logger.debug("Caught exception fetching devices from Feedback Service");
throw new CommunicationException("Problem communicating with Feedback service", e);
}
finally {
try {
socket.close();
} catch (Exception e) {
}
}
return listDev;
} }
|
public class class_name {
private LinkedList<Device> getDevices(SSLSocket socket) throws CommunicationException {
// Compute
LinkedList<Device> listDev = null;
try {
InputStream socketStream = socket.getInputStream();
// Read bytes
byte[] b = new byte[1024];
ByteArrayOutputStream message = new ByteArrayOutputStream();
int nbBytes = 0;
// socketStream.available can return 0
// http://forums.sun.com/thread.jspa?threadID=5428561
while ((nbBytes = socketStream.read(b, 0, 1024)) != -1) {
message.write(b, 0, nbBytes);
// depends on control dependency: [while], data = [none]
}
listDev = new LinkedList<Device>();
byte[] listOfDevices = message.toByteArray();
int nbTuples = listOfDevices.length / FEEDBACK_TUPLE_SIZE;
logger.debug("Found: [" + nbTuples + "]");
for (int i = 0; i < nbTuples; i++) {
int offset = i * FEEDBACK_TUPLE_SIZE;
// Build date
int index = 0;
int firstByte = 0;
int secondByte = 0;
int thirdByte = 0;
int fourthByte = 0;
long anUnsignedInt = 0;
firstByte = (0x000000FF & ((int) listOfDevices[offset]));
// depends on control dependency: [for], data = [none]
secondByte = (0x000000FF & ((int) listOfDevices[offset + 1]));
// depends on control dependency: [for], data = [none]
thirdByte = (0x000000FF & ((int) listOfDevices[offset + 2]));
// depends on control dependency: [for], data = [none]
fourthByte = (0x000000FF & ((int) listOfDevices[offset + 3]));
// depends on control dependency: [for], data = [none]
index = index + 4;
// depends on control dependency: [for], data = [none]
anUnsignedInt = ((long) (firstByte << 24 | secondByte << 16 | thirdByte << 8 | fourthByte)) & 0xFFFFFFFFL;
// depends on control dependency: [for], data = [none]
Timestamp timestamp = new Timestamp(anUnsignedInt * 1000);
// Build device token length
int deviceTokenLength = listOfDevices[offset + 4] << 8 | listOfDevices[offset + 5];
// Build device token
String deviceToken = "";
int octet = 0;
for (int j = 0; j < 32; j++) {
octet = (0x000000FF & ((int) listOfDevices[offset + 6 + j]));
// depends on control dependency: [for], data = [j]
deviceToken = deviceToken.concat(String.format("%02x", octet));
// depends on control dependency: [for], data = [none]
}
// Build device and add to list
/* Create a basic device, as we do not want to go through the factory and create a device in the actual database... */
Device device = new BasicDevice();
device.setToken(deviceToken);
// depends on control dependency: [for], data = [none]
device.setLastRegister(timestamp);
// depends on control dependency: [for], data = [none]
listDev.add(device);
// depends on control dependency: [for], data = [none]
logger.info("FeedbackManager retrieves one device : " + timestamp + ";" + deviceTokenLength + ";" + deviceToken + ".");
// depends on control dependency: [for], data = [none]
}
// Close the socket and return the list
} catch (Exception e) {
logger.debug("Caught exception fetching devices from Feedback Service");
throw new CommunicationException("Problem communicating with Feedback service", e);
}
finally {
try {
socket.close();
// depends on control dependency: [try], data = [none]
} catch (Exception e) {
}
// depends on control dependency: [catch], data = [none]
}
return listDev;
} }
|
public class class_name {
public ImmutableSortedSet<C> asSet(DiscreteDomain<C> domain) {
checkNotNull(domain);
if (isEmpty()) {
return ImmutableSortedSet.of();
}
Range<C> span = span().canonical(domain);
if (!span.hasLowerBound()) {
// according to the spec of canonical, neither this ImmutableRangeSet nor
// the range have a lower bound
throw new IllegalArgumentException(
"Neither the DiscreteDomain nor this range set are bounded below");
} else if (!span.hasUpperBound()) {
try {
domain.maxValue();
} catch (NoSuchElementException e) {
throw new IllegalArgumentException(
"Neither the DiscreteDomain nor this range set are bounded above");
}
}
return new AsSet(domain);
} }
|
public class class_name {
public ImmutableSortedSet<C> asSet(DiscreteDomain<C> domain) {
checkNotNull(domain);
if (isEmpty()) {
return ImmutableSortedSet.of(); // depends on control dependency: [if], data = [none]
}
Range<C> span = span().canonical(domain);
if (!span.hasLowerBound()) {
// according to the spec of canonical, neither this ImmutableRangeSet nor
// the range have a lower bound
throw new IllegalArgumentException(
"Neither the DiscreteDomain nor this range set are bounded below");
} else if (!span.hasUpperBound()) {
try {
domain.maxValue(); // depends on control dependency: [try], data = [none]
} catch (NoSuchElementException e) {
throw new IllegalArgumentException(
"Neither the DiscreteDomain nor this range set are bounded above");
} // depends on control dependency: [catch], data = [none]
}
return new AsSet(domain);
} }
|
public class class_name {
protected XExpression _generate(XBasicForLoopExpression forLoop, IAppendable it, IExtraLanguageGeneratorContext context) {
for (final XExpression expr : forLoop.getInitExpressions()) {
generate(expr, it, context);
it.newLine();
}
it.append("while "); //$NON-NLS-1$
generate(forLoop.getExpression(), it, context);
it.append(":"); //$NON-NLS-1$
it.increaseIndentation().newLine();
final XExpression last = generate(forLoop.getEachExpression(), it, context);
for (final XExpression expr : forLoop.getUpdateExpressions()) {
it.newLine();
generate(expr, it, context);
}
it.decreaseIndentation();
return last;
} }
|
public class class_name {
protected XExpression _generate(XBasicForLoopExpression forLoop, IAppendable it, IExtraLanguageGeneratorContext context) {
for (final XExpression expr : forLoop.getInitExpressions()) {
generate(expr, it, context); // depends on control dependency: [for], data = [expr]
it.newLine(); // depends on control dependency: [for], data = [none]
}
it.append("while "); //$NON-NLS-1$
generate(forLoop.getExpression(), it, context);
it.append(":"); //$NON-NLS-1$
it.increaseIndentation().newLine();
final XExpression last = generate(forLoop.getEachExpression(), it, context);
for (final XExpression expr : forLoop.getUpdateExpressions()) {
it.newLine(); // depends on control dependency: [for], data = [none]
generate(expr, it, context); // depends on control dependency: [for], data = [expr]
}
it.decreaseIndentation();
return last;
} }
|
public class class_name {
public ArrayList<HashMap<String, Object>> runGenerators(HashMap<String, Object> data, boolean refLeftFlg) {
if (this.allowGenerators) {
log.debug("Starting generators");
ArrayList<HashMap<String, Object>> results = new ArrayList<HashMap<String, Object>>();
HashSet<String> keysToExtract = new HashSet<String>();
ArrayList<HashMap<String, String>> gAcc = new ArrayList<HashMap<String, String>>();
ArrayList<ArrayList<HashMap<String, String>>> newEventArrs = new ArrayList<ArrayList<HashMap<String, String>>>();
// Run the generators
for (HashMap<String, String> generator : generators) {
// NPE defender
if (generator.get("variable") == null) {
log.error("Invalid generator: {}", generator.toString());
return new ArrayList<HashMap<String, Object>>();
}
String path = Command.getPathOrRoot(generator.get("variable"));
if (path.contains("weather")) {
keysToExtract.add("weather");
} else if (path.contains("soil")) {
keysToExtract.add("soil");
} else {
keysToExtract.add("experiment");
}
String a = generator.get("args");
if (a == null) {
a = "";
}
String[] args = a.split("[|]");
if (args[0].toUpperCase().equals("AUTO_REPLICATE_EVENTS()")) {
newEventArrs = Generate.runEvent(data, args, newEventArrs);
} else {
gAcc = Generate.run(data, args, gAcc);
}
}
// On the output of "each" generation, put the export blocks into results
HashMap tempRefHolder = new HashMap();
if (!keysToExtract.contains("weather")) {
tempRefHolder.put("weather", data.remove("weather"));
}
if (!keysToExtract.contains("soil")) {
tempRefHolder.put("soil", data.remove("soil"));
}
if (refLeftFlg) {
this.keysToExtractFinal.addAll(keysToExtract);
}
Cloner cloner = new Cloner();
if (newEventArrs.isEmpty()) {
int i = 0;
for (HashMap<String, String> grules : gAcc) {
i++;
Generate.applyGeneratedRules(data, grules, "" + i);
HashMap newData = cloner.deepClone(data);
if (refLeftFlg) {
newData.putAll(tempRefHolder);
}
results.add(newData);
}
} else {
int i = 0;
for (ArrayList<HashMap<String, String>> eventArr : newEventArrs) {
i++;
Generate.applyReplicatedEvents(data, eventArr, "" + i);
HashMap newData = cloner.deepClone(data);
if (refLeftFlg) {
newData.putAll(tempRefHolder);
}
results.add(newData);
}
}
return results;
// return the results.
} else {
log.error("You cannot run generators in this mode.");
return new ArrayList<HashMap<String, Object>>();
}
} }
|
public class class_name {
public ArrayList<HashMap<String, Object>> runGenerators(HashMap<String, Object> data, boolean refLeftFlg) {
if (this.allowGenerators) {
log.debug("Starting generators"); // depends on control dependency: [if], data = [none]
ArrayList<HashMap<String, Object>> results = new ArrayList<HashMap<String, Object>>();
HashSet<String> keysToExtract = new HashSet<String>();
ArrayList<HashMap<String, String>> gAcc = new ArrayList<HashMap<String, String>>();
ArrayList<ArrayList<HashMap<String, String>>> newEventArrs = new ArrayList<ArrayList<HashMap<String, String>>>();
// Run the generators
for (HashMap<String, String> generator : generators) {
// NPE defender
if (generator.get("variable") == null) {
log.error("Invalid generator: {}", generator.toString()); // depends on control dependency: [if], data = [none]
return new ArrayList<HashMap<String, Object>>(); // depends on control dependency: [if], data = [none]
}
String path = Command.getPathOrRoot(generator.get("variable"));
if (path.contains("weather")) {
keysToExtract.add("weather"); // depends on control dependency: [if], data = [none]
} else if (path.contains("soil")) {
keysToExtract.add("soil"); // depends on control dependency: [if], data = [none]
} else {
keysToExtract.add("experiment"); // depends on control dependency: [if], data = [none]
}
String a = generator.get("args");
if (a == null) {
a = ""; // depends on control dependency: [if], data = [none]
}
String[] args = a.split("[|]");
if (args[0].toUpperCase().equals("AUTO_REPLICATE_EVENTS()")) {
newEventArrs = Generate.runEvent(data, args, newEventArrs); // depends on control dependency: [if], data = [none]
} else {
gAcc = Generate.run(data, args, gAcc); // depends on control dependency: [if], data = [none]
}
}
// On the output of "each" generation, put the export blocks into results
HashMap tempRefHolder = new HashMap();
if (!keysToExtract.contains("weather")) {
tempRefHolder.put("weather", data.remove("weather")); // depends on control dependency: [if], data = [none]
}
if (!keysToExtract.contains("soil")) {
tempRefHolder.put("soil", data.remove("soil")); // depends on control dependency: [if], data = [none]
}
if (refLeftFlg) {
this.keysToExtractFinal.addAll(keysToExtract); // depends on control dependency: [if], data = [none]
}
Cloner cloner = new Cloner();
if (newEventArrs.isEmpty()) {
int i = 0;
for (HashMap<String, String> grules : gAcc) {
i++; // depends on control dependency: [for], data = [none]
Generate.applyGeneratedRules(data, grules, "" + i); // depends on control dependency: [for], data = [grules]
HashMap newData = cloner.deepClone(data);
if (refLeftFlg) {
newData.putAll(tempRefHolder); // depends on control dependency: [if], data = [none]
}
results.add(newData); // depends on control dependency: [for], data = [none]
}
} else {
int i = 0;
for (ArrayList<HashMap<String, String>> eventArr : newEventArrs) {
i++; // depends on control dependency: [for], data = [none]
Generate.applyReplicatedEvents(data, eventArr, "" + i); // depends on control dependency: [for], data = [eventArr]
HashMap newData = cloner.deepClone(data);
if (refLeftFlg) {
newData.putAll(tempRefHolder); // depends on control dependency: [if], data = [none]
}
results.add(newData); // depends on control dependency: [for], data = [none]
}
}
return results; // depends on control dependency: [if], data = [none]
// return the results.
} else {
log.error("You cannot run generators in this mode."); // depends on control dependency: [if], data = [none]
return new ArrayList<HashMap<String, Object>>(); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public static Object call(PageContext pc, String sql, Object params, Struct options, String name) throws PageException {
PageContextImpl pci = (PageContextImpl) pc;
lucee.runtime.tag.Query qry = (lucee.runtime.tag.Query) pci.use(lucee.runtime.tag.Query.class.getName(), "cfquery", TagLibTag.ATTRIBUTE_TYPE_FIXED);
try {
try {
qry.hasBody(true);
// set attributes
qry.setReturnVariable(true);
qry.setName(StringUtil.isEmpty(name) ? "QueryExecute" : name);
if (options != null) TagUtil.setAttributeCollection(pc, qry, null, options, TagLibTag.ATTRIBUTE_TYPE_FIXED);
qry.setParams(params);
int res = qry.doStartTag();
pc.initBody(qry, res);
pc.forceWrite(sql);
qry.doAfterBody();
}
catch (Throwable t) {
ExceptionUtil.rethrowIfNecessary(t);
try {
qry.doCatch(t);
}
catch (Throwable t2) {
ExceptionUtil.rethrowIfNecessary(t);
throw Caster.toPageException(t2);
}
}
finally {
pc.popBody();
qry.doFinally();
}
qry.doEndTag();
return qry.getReturnVariable();
}
finally {
pci.reuse(qry);
}
} }
|
public class class_name {
public static Object call(PageContext pc, String sql, Object params, Struct options, String name) throws PageException {
PageContextImpl pci = (PageContextImpl) pc;
lucee.runtime.tag.Query qry = (lucee.runtime.tag.Query) pci.use(lucee.runtime.tag.Query.class.getName(), "cfquery", TagLibTag.ATTRIBUTE_TYPE_FIXED);
try {
try {
qry.hasBody(true); // depends on control dependency: [try], data = [none]
// set attributes
qry.setReturnVariable(true); // depends on control dependency: [try], data = [none]
qry.setName(StringUtil.isEmpty(name) ? "QueryExecute" : name); // depends on control dependency: [try], data = [none]
if (options != null) TagUtil.setAttributeCollection(pc, qry, null, options, TagLibTag.ATTRIBUTE_TYPE_FIXED);
qry.setParams(params); // depends on control dependency: [try], data = [none]
int res = qry.doStartTag();
pc.initBody(qry, res); // depends on control dependency: [try], data = [none]
pc.forceWrite(sql); // depends on control dependency: [try], data = [none]
qry.doAfterBody(); // depends on control dependency: [try], data = [none]
}
catch (Throwable t) {
ExceptionUtil.rethrowIfNecessary(t);
try {
qry.doCatch(t); // depends on control dependency: [try], data = [none]
}
catch (Throwable t2) {
ExceptionUtil.rethrowIfNecessary(t);
throw Caster.toPageException(t2);
} // depends on control dependency: [catch], data = [none]
} // depends on control dependency: [catch], data = [none]
finally {
pc.popBody();
qry.doFinally();
}
qry.doEndTag();
return qry.getReturnVariable();
}
finally {
pci.reuse(qry);
}
} }
|
public class class_name {
private static String formatValue(String value) {
// The value can either be null (if the IS keyword is present before it or just a NULL string with no quotes)
if (value == null || NULL_STRING.equalsIgnoreCase(value)) {
return null;
}
String returnValue = format(value);
return returnValue.replaceAll("''", "'");
} }
|
public class class_name {
private static String formatValue(String value) {
// The value can either be null (if the IS keyword is present before it or just a NULL string with no quotes)
if (value == null || NULL_STRING.equalsIgnoreCase(value)) {
return null; // depends on control dependency: [if], data = [none]
}
String returnValue = format(value);
return returnValue.replaceAll("''", "'");
} }
|
public class class_name {
public String getFieldValue(String fieldName) {
Utils.require(!Utils.isEmpty(fieldName), "fieldName");
List<String> values = m_valueMap.get(fieldName);
if (values == null || values.size() == 0) {
return null;
}
Utils.require(values.size() == 1, "Field has more than 1 value: %s", fieldName);
return values.get(0);
} }
|
public class class_name {
public String getFieldValue(String fieldName) {
Utils.require(!Utils.isEmpty(fieldName), "fieldName");
List<String> values = m_valueMap.get(fieldName);
if (values == null || values.size() == 0) {
return null;
// depends on control dependency: [if], data = [none]
}
Utils.require(values.size() == 1, "Field has more than 1 value: %s", fieldName);
return values.get(0);
} }
|
public class class_name {
private static Type resolveWildcardTypeVariables(final WildcardType type,
final Map<String, Type> generics,
final boolean countPreservedVariables) {
final Type res;
if (type.getLowerBounds().length > 0) {
// only one lower bound could be (? super A)
final Type lowerBound = resolveTypeVariables(
type.getLowerBounds(), generics, countPreservedVariables)[0];
// flatten <? super Object> to Object
res = lowerBound == Object.class
? Object.class : WildcardTypeImpl.lower(lowerBound);
} else {
// could be multiple upper bounds because of named generic bounds repackage (T extends A & B)
final Type[] upperBounds = resolveTypeVariables(type.getUpperBounds(), generics, countPreservedVariables);
// flatten <? extends Object> (<?>) to Object and <? extends Something> to Something
res = upperBounds.length == 1 ? upperBounds[0] : WildcardTypeImpl.upper(upperBounds);
}
return res;
} }
|
public class class_name {
private static Type resolveWildcardTypeVariables(final WildcardType type,
final Map<String, Type> generics,
final boolean countPreservedVariables) {
final Type res;
if (type.getLowerBounds().length > 0) {
// only one lower bound could be (? super A)
final Type lowerBound = resolveTypeVariables(
type.getLowerBounds(), generics, countPreservedVariables)[0];
// flatten <? super Object> to Object
res = lowerBound == Object.class
? Object.class : WildcardTypeImpl.lower(lowerBound); // depends on control dependency: [if], data = [none]
} else {
// could be multiple upper bounds because of named generic bounds repackage (T extends A & B)
final Type[] upperBounds = resolveTypeVariables(type.getUpperBounds(), generics, countPreservedVariables);
// flatten <? extends Object> (<?>) to Object and <? extends Something> to Something
res = upperBounds.length == 1 ? upperBounds[0] : WildcardTypeImpl.upper(upperBounds); // depends on control dependency: [if], data = [none]
}
return res;
} }
|
public class class_name {
public int get_bits(int number_of_bits)
{
int returnvalue = 0;
int sum = bitindex + number_of_bits;
// E.B
// There is a problem here, wordpointer could be -1 ?!
if (wordpointer < 0) wordpointer = 0;
// E.B : End.
if (sum <= 32)
{
// all bits contained in *wordpointer
returnvalue = (framebuffer[wordpointer] >>> (32 - sum)) & bitmask[number_of_bits];
// returnvalue = (wordpointer[0] >> (32 - sum)) & bitmask[number_of_bits];
if ((bitindex += number_of_bits) == 32)
{
bitindex = 0;
wordpointer++; // added by me!
}
return returnvalue;
}
// E.B : Check that ?
//((short[])&returnvalue)[0] = ((short[])wordpointer + 1)[0];
//wordpointer++; // Added by me!
//((short[])&returnvalue + 1)[0] = ((short[])wordpointer)[0];
int Right = (framebuffer[wordpointer] & 0x0000FFFF);
wordpointer++;
int Left = (framebuffer[wordpointer] & 0xFFFF0000);
returnvalue = ((Right << 16) & 0xFFFF0000) | ((Left >>> 16)& 0x0000FFFF);
returnvalue >>>= 48 - sum; // returnvalue >>= 16 - (number_of_bits - (32 - bitindex))
returnvalue &= bitmask[number_of_bits];
bitindex = sum - 32;
return returnvalue;
} }
|
public class class_name {
public int get_bits(int number_of_bits)
{
int returnvalue = 0;
int sum = bitindex + number_of_bits;
// E.B
// There is a problem here, wordpointer could be -1 ?!
if (wordpointer < 0) wordpointer = 0;
// E.B : End.
if (sum <= 32)
{
// all bits contained in *wordpointer
returnvalue = (framebuffer[wordpointer] >>> (32 - sum)) & bitmask[number_of_bits]; // depends on control dependency: [if], data = [none]
// returnvalue = (wordpointer[0] >> (32 - sum)) & bitmask[number_of_bits];
if ((bitindex += number_of_bits) == 32)
{
bitindex = 0; // depends on control dependency: [if], data = [none]
wordpointer++; // added by me! // depends on control dependency: [if], data = [none]
}
return returnvalue; // depends on control dependency: [if], data = [none]
}
// E.B : Check that ?
//((short[])&returnvalue)[0] = ((short[])wordpointer + 1)[0];
//wordpointer++; // Added by me!
//((short[])&returnvalue + 1)[0] = ((short[])wordpointer)[0];
int Right = (framebuffer[wordpointer] & 0x0000FFFF);
wordpointer++;
int Left = (framebuffer[wordpointer] & 0xFFFF0000);
returnvalue = ((Right << 16) & 0xFFFF0000) | ((Left >>> 16)& 0x0000FFFF);
returnvalue >>>= 48 - sum; // returnvalue >>= 16 - (number_of_bits - (32 - bitindex))
returnvalue &= bitmask[number_of_bits];
bitindex = sum - 32;
return returnvalue;
} }
|
public class class_name {
public void renew(final Txn<T> newTxn) {
if (SHOULD_CHECK) {
requireNonNull(newTxn);
checkNotClosed();
this.txn.checkReadOnly(); // existing
newTxn.checkReadOnly();
newTxn.checkReady();
}
checkRc(LIB.mdb_cursor_renew(newTxn.pointer(), ptrCursor));
this.txn = newTxn;
} }
|
public class class_name {
public void renew(final Txn<T> newTxn) {
if (SHOULD_CHECK) {
requireNonNull(newTxn); // depends on control dependency: [if], data = [none]
checkNotClosed(); // depends on control dependency: [if], data = [none]
this.txn.checkReadOnly(); // existing // depends on control dependency: [if], data = [none]
newTxn.checkReadOnly(); // depends on control dependency: [if], data = [none]
newTxn.checkReady(); // depends on control dependency: [if], data = [none]
}
checkRc(LIB.mdb_cursor_renew(newTxn.pointer(), ptrCursor));
this.txn = newTxn;
} }
|
public class class_name {
private final String getChunk(String s, int slength, int marker)
{
StringBuilder chunk = new StringBuilder();
char c = s.charAt(marker);
chunk.append(c);
marker++;
if (isDigit(c))
{
while (marker < slength)
{
c = s.charAt(marker);
if (!isDigit(c))
break;
chunk.append(c);
marker++;
}
} else
{
while (marker < slength)
{
c = s.charAt(marker);
if (isDigit(c))
break;
chunk.append(c);
marker++;
}
}
return chunk.toString();
} }
|
public class class_name {
private final String getChunk(String s, int slength, int marker)
{
StringBuilder chunk = new StringBuilder();
char c = s.charAt(marker);
chunk.append(c);
marker++;
if (isDigit(c))
{
while (marker < slength)
{
c = s.charAt(marker); // depends on control dependency: [while], data = [(marker]
if (!isDigit(c))
break;
chunk.append(c); // depends on control dependency: [while], data = [none]
marker++; // depends on control dependency: [while], data = [none]
}
} else
{
while (marker < slength)
{
c = s.charAt(marker); // depends on control dependency: [while], data = [(marker]
if (isDigit(c))
break;
chunk.append(c); // depends on control dependency: [while], data = [none]
marker++; // depends on control dependency: [while], data = [none]
}
}
return chunk.toString();
} }
|
public class class_name {
@SuppressWarnings("unchecked")
public static BindingResult bindObjectToDomainInstance(PersistentEntity entity, Object object,
Object source, List include, List exclude, String filter) {
BindingResult bindingResult = null;
GrailsApplication grailsApplication = Holders.findApplication();
try {
final DataBindingSource bindingSource = createDataBindingSource(grailsApplication, object.getClass(), source);
final DataBinder grailsWebDataBinder = getGrailsWebDataBinder(grailsApplication);
grailsWebDataBinder.bind(object, bindingSource, filter, include, exclude);
} catch (InvalidRequestBodyException e) {
String messageCode = "invalidRequestBody";
Class objectType = object.getClass();
String defaultMessage = "An error occurred parsing the body of the request";
String[] codes = getMessageCodes(messageCode, objectType);
bindingResult = new BeanPropertyBindingResult(object, objectType.getName());
bindingResult.addError(new ObjectError(bindingResult.getObjectName(), codes, null, defaultMessage));
} catch (Exception e) {
bindingResult = new BeanPropertyBindingResult(object, object.getClass().getName());
bindingResult.addError(new ObjectError(bindingResult.getObjectName(), e.getMessage()));
}
if (entity != null && bindingResult != null) {
BindingResult newResult = new ValidationErrors(object);
for (Object error : bindingResult.getAllErrors()) {
if (error instanceof FieldError) {
FieldError fieldError = (FieldError)error;
final boolean isBlank = BLANK.equals(fieldError.getRejectedValue());
if (!isBlank) {
newResult.addError(fieldError);
}
else {
PersistentProperty property = entity.getPropertyByName(fieldError.getField());
if (property != null) {
final boolean isOptional = property.isNullable();
if (!isOptional) {
newResult.addError(fieldError);
}
}
else {
newResult.addError(fieldError);
}
}
}
else {
newResult.addError((ObjectError)error);
}
}
bindingResult = newResult;
}
MetaClass mc = GroovySystem.getMetaClassRegistry().getMetaClass(object.getClass());
if (mc.hasProperty(object, "errors")!=null && bindingResult!=null) {
ValidationErrors errors = new ValidationErrors(object);
errors.addAllErrors(bindingResult);
mc.setProperty(object,"errors", errors);
}
return bindingResult;
} }
|
public class class_name {
@SuppressWarnings("unchecked")
public static BindingResult bindObjectToDomainInstance(PersistentEntity entity, Object object,
Object source, List include, List exclude, String filter) {
BindingResult bindingResult = null;
GrailsApplication grailsApplication = Holders.findApplication();
try {
final DataBindingSource bindingSource = createDataBindingSource(grailsApplication, object.getClass(), source);
final DataBinder grailsWebDataBinder = getGrailsWebDataBinder(grailsApplication);
grailsWebDataBinder.bind(object, bindingSource, filter, include, exclude); // depends on control dependency: [try], data = [none]
} catch (InvalidRequestBodyException e) {
String messageCode = "invalidRequestBody";
Class objectType = object.getClass();
String defaultMessage = "An error occurred parsing the body of the request";
String[] codes = getMessageCodes(messageCode, objectType);
bindingResult = new BeanPropertyBindingResult(object, objectType.getName());
bindingResult.addError(new ObjectError(bindingResult.getObjectName(), codes, null, defaultMessage));
} catch (Exception e) { // depends on control dependency: [catch], data = [none]
bindingResult = new BeanPropertyBindingResult(object, object.getClass().getName());
bindingResult.addError(new ObjectError(bindingResult.getObjectName(), e.getMessage()));
} // depends on control dependency: [catch], data = [none]
if (entity != null && bindingResult != null) {
BindingResult newResult = new ValidationErrors(object);
for (Object error : bindingResult.getAllErrors()) {
if (error instanceof FieldError) {
FieldError fieldError = (FieldError)error;
final boolean isBlank = BLANK.equals(fieldError.getRejectedValue());
if (!isBlank) {
newResult.addError(fieldError); // depends on control dependency: [if], data = [none]
}
else {
PersistentProperty property = entity.getPropertyByName(fieldError.getField());
if (property != null) {
final boolean isOptional = property.isNullable();
if (!isOptional) {
newResult.addError(fieldError); // depends on control dependency: [if], data = [none]
}
}
else {
newResult.addError(fieldError); // depends on control dependency: [if], data = [none]
}
}
}
else {
newResult.addError((ObjectError)error); // depends on control dependency: [if], data = [none]
}
}
bindingResult = newResult; // depends on control dependency: [if], data = [none]
}
MetaClass mc = GroovySystem.getMetaClassRegistry().getMetaClass(object.getClass());
if (mc.hasProperty(object, "errors")!=null && bindingResult!=null) {
ValidationErrors errors = new ValidationErrors(object);
errors.addAllErrors(bindingResult); // depends on control dependency: [if], data = [none]
mc.setProperty(object,"errors", errors); // depends on control dependency: [if], data = [none]
}
return bindingResult;
} }
|
public class class_name {
public HttpSession getSession(boolean... create) {
assertAttached();
if (create.length == 0) {
return httpRequest.getSession();
}
// if create flag is true next call can throw IllegalStateException if HTTP response is committed
return httpRequest.getSession(create[0]);
} }
|
public class class_name {
public HttpSession getSession(boolean... create) {
assertAttached();
if (create.length == 0) {
return httpRequest.getSession();
// depends on control dependency: [if], data = [none]
}
// if create flag is true next call can throw IllegalStateException if HTTP response is committed
return httpRequest.getSession(create[0]);
} }
|
public class class_name {
public GetDocumentAnalysisResult withBlocks(Block... blocks) {
if (this.blocks == null) {
setBlocks(new java.util.ArrayList<Block>(blocks.length));
}
for (Block ele : blocks) {
this.blocks.add(ele);
}
return this;
} }
|
public class class_name {
public GetDocumentAnalysisResult withBlocks(Block... blocks) {
if (this.blocks == null) {
setBlocks(new java.util.ArrayList<Block>(blocks.length)); // depends on control dependency: [if], data = [none]
}
for (Block ele : blocks) {
this.blocks.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} }
|
public class class_name {
public void writeBytesLenenc(final byte[] value) {
if (0 == value.length) {
byteBuf.writeByte(0);
return;
}
writeIntLenenc(value.length);
byteBuf.writeBytes(value);
} }
|
public class class_name {
public void writeBytesLenenc(final byte[] value) {
if (0 == value.length) {
byteBuf.writeByte(0); // depends on control dependency: [if], data = [(0]
return; // depends on control dependency: [if], data = [none]
}
writeIntLenenc(value.length);
byteBuf.writeBytes(value);
} }
|
public class class_name {
public void setChainLength(int nrClusters) throws IOException {
if (nrClusters < 0) throw new IllegalArgumentException(
"negative cluster count"); //NOI18N
if ((this.startCluster == 0) && (nrClusters == 0)) {
/* nothing to do */
} else if ((this.startCluster == 0) && (nrClusters > 0)) {
final long[] chain = fat.allocNew(nrClusters);
this.startCluster = chain[0];
} else {
final long[] chain = fat.getChain(startCluster);
if (nrClusters != chain.length) {
if (nrClusters > chain.length) {
/* grow the chain */
int count = nrClusters - chain.length;
while (count > 0) {
fat.allocAppend(getStartCluster());
count--;
}
} else {
/* shrink the chain */
if (nrClusters > 0) {
fat.setEof(chain[nrClusters - 1]);
for (int i = nrClusters; i < chain.length; i++) {
fat.setFree(chain[i]);
}
} else {
for (int i=0; i < chain.length; i++) {
fat.setFree(chain[i]);
}
this.startCluster = 0;
}
}
}
}
} }
|
public class class_name {
public void setChainLength(int nrClusters) throws IOException {
if (nrClusters < 0) throw new IllegalArgumentException(
"negative cluster count"); //NOI18N
if ((this.startCluster == 0) && (nrClusters == 0)) {
/* nothing to do */
} else if ((this.startCluster == 0) && (nrClusters > 0)) {
final long[] chain = fat.allocNew(nrClusters);
this.startCluster = chain[0];
} else {
final long[] chain = fat.getChain(startCluster);
if (nrClusters != chain.length) {
if (nrClusters > chain.length) {
/* grow the chain */
int count = nrClusters - chain.length;
while (count > 0) {
fat.allocAppend(getStartCluster()); // depends on control dependency: [while], data = [none]
count--; // depends on control dependency: [while], data = [none]
}
} else {
/* shrink the chain */
if (nrClusters > 0) {
fat.setEof(chain[nrClusters - 1]); // depends on control dependency: [if], data = [none]
for (int i = nrClusters; i < chain.length; i++) {
fat.setFree(chain[i]); // depends on control dependency: [for], data = [i]
}
} else {
for (int i=0; i < chain.length; i++) {
fat.setFree(chain[i]); // depends on control dependency: [for], data = [i]
}
this.startCluster = 0; // depends on control dependency: [if], data = [none]
}
}
}
}
} }
|
public class class_name {
public void remapAll(List<IndexPair> listOfOldToNew) {
List<String> symbols = Lists.newArrayListWithCapacity(listOfOldToNew.size());
int max = -1;
for (int i = 0; i < listOfOldToNew.size(); i++) {
IndexPair indexPair = listOfOldToNew.get(i);
symbols.add(invert().keyForId(indexPair.getLeft()));
max = Math.max(max, indexPair.getRight());
}
if (max >= nextId) {
nextId = max + 1;
}
// now actually remap them
for (int i = 0; i < listOfOldToNew.size(); i++) {
IndexPair pair = listOfOldToNew.get(i);
String symbol = symbols.get(i);
idToSymbol.remove(pair.getLeft());
symbolToId.remove(symbol);
idToSymbol.put(pair.getRight(), symbol);
symbolToId.put(symbol, pair.getRight());
}
} }
|
public class class_name {
public void remapAll(List<IndexPair> listOfOldToNew) {
List<String> symbols = Lists.newArrayListWithCapacity(listOfOldToNew.size());
int max = -1;
for (int i = 0; i < listOfOldToNew.size(); i++) {
IndexPair indexPair = listOfOldToNew.get(i);
symbols.add(invert().keyForId(indexPair.getLeft())); // depends on control dependency: [for], data = [none]
max = Math.max(max, indexPair.getRight()); // depends on control dependency: [for], data = [none]
}
if (max >= nextId) {
nextId = max + 1; // depends on control dependency: [if], data = [none]
}
// now actually remap them
for (int i = 0; i < listOfOldToNew.size(); i++) {
IndexPair pair = listOfOldToNew.get(i);
String symbol = symbols.get(i);
idToSymbol.remove(pair.getLeft()); // depends on control dependency: [for], data = [none]
symbolToId.remove(symbol); // depends on control dependency: [for], data = [none]
idToSymbol.put(pair.getRight(), symbol); // depends on control dependency: [for], data = [none]
symbolToId.put(symbol, pair.getRight()); // depends on control dependency: [for], data = [none]
}
} }
|
public class class_name {
public TaskDefinition withRequiresCompatibilities(Compatibility... requiresCompatibilities) {
com.amazonaws.internal.SdkInternalList<String> requiresCompatibilitiesCopy = new com.amazonaws.internal.SdkInternalList<String>(
requiresCompatibilities.length);
for (Compatibility value : requiresCompatibilities) {
requiresCompatibilitiesCopy.add(value.toString());
}
if (getRequiresCompatibilities() == null) {
setRequiresCompatibilities(requiresCompatibilitiesCopy);
} else {
getRequiresCompatibilities().addAll(requiresCompatibilitiesCopy);
}
return this;
} }
|
public class class_name {
public TaskDefinition withRequiresCompatibilities(Compatibility... requiresCompatibilities) {
com.amazonaws.internal.SdkInternalList<String> requiresCompatibilitiesCopy = new com.amazonaws.internal.SdkInternalList<String>(
requiresCompatibilities.length);
for (Compatibility value : requiresCompatibilities) {
requiresCompatibilitiesCopy.add(value.toString()); // depends on control dependency: [for], data = [value]
}
if (getRequiresCompatibilities() == null) {
setRequiresCompatibilities(requiresCompatibilitiesCopy); // depends on control dependency: [if], data = [none]
} else {
getRequiresCompatibilities().addAll(requiresCompatibilitiesCopy); // depends on control dependency: [if], data = [none]
}
return this;
} }
|
public class class_name {
public static void initialize()
{
if (InfinispanCache.get().exists(SystemConfiguration.UUIDCACHE)) {
InfinispanCache.get().<UUID, SystemConfiguration>getCache(SystemConfiguration.UUIDCACHE).clear();
} else {
InfinispanCache.get().<UUID, SystemConfiguration>getCache(SystemConfiguration.UUIDCACHE)
.addListener(new CacheLogListener(SystemConfiguration.LOG));
}
if (InfinispanCache.get().exists(SystemConfiguration.IDCACHE)) {
InfinispanCache.get().<Long, SystemConfiguration>getCache(SystemConfiguration.IDCACHE).clear();
} else {
InfinispanCache.get().<Long, SystemConfiguration>getCache(SystemConfiguration.IDCACHE)
.addListener(new CacheLogListener(SystemConfiguration.LOG));
}
if (InfinispanCache.get().exists(SystemConfiguration.NAMECACHE)) {
InfinispanCache.get().<String, SystemConfiguration>getCache(SystemConfiguration.NAMECACHE).clear();
} else {
InfinispanCache.get().<String, SystemConfiguration>getCache(SystemConfiguration.NAMECACHE)
.addListener(new CacheLogListener(SystemConfiguration.LOG));
}
SystemConfiguration.ENCRYPTOR = new StandardPBEStringEncryptor();
SystemConfiguration.ENCRYPTOR.setConfig(SystemConfiguration.getPBEConfig());
} }
|
public class class_name {
public static void initialize()
{
if (InfinispanCache.get().exists(SystemConfiguration.UUIDCACHE)) {
InfinispanCache.get().<UUID, SystemConfiguration>getCache(SystemConfiguration.UUIDCACHE).clear(); // depends on control dependency: [if], data = [none]
} else {
InfinispanCache.get().<UUID, SystemConfiguration>getCache(SystemConfiguration.UUIDCACHE)
.addListener(new CacheLogListener(SystemConfiguration.LOG)); // depends on control dependency: [if], data = [none]
}
if (InfinispanCache.get().exists(SystemConfiguration.IDCACHE)) {
InfinispanCache.get().<Long, SystemConfiguration>getCache(SystemConfiguration.IDCACHE).clear(); // depends on control dependency: [if], data = [none]
} else {
InfinispanCache.get().<Long, SystemConfiguration>getCache(SystemConfiguration.IDCACHE)
.addListener(new CacheLogListener(SystemConfiguration.LOG)); // depends on control dependency: [if], data = [none]
}
if (InfinispanCache.get().exists(SystemConfiguration.NAMECACHE)) {
InfinispanCache.get().<String, SystemConfiguration>getCache(SystemConfiguration.NAMECACHE).clear(); // depends on control dependency: [if], data = [none]
} else {
InfinispanCache.get().<String, SystemConfiguration>getCache(SystemConfiguration.NAMECACHE)
.addListener(new CacheLogListener(SystemConfiguration.LOG)); // depends on control dependency: [if], data = [none]
}
SystemConfiguration.ENCRYPTOR = new StandardPBEStringEncryptor();
SystemConfiguration.ENCRYPTOR.setConfig(SystemConfiguration.getPBEConfig());
} }
|
public class class_name {
@Override
public List<CandidateSteps> createCandidateSteps() {
final List<CandidateSteps> result = new ArrayList<>();
for (final Class<?> type : steps) {
if (hasAnnotatedMethods(type)) {
configuration.parameterConverters().addConverters(methodReturningConverters(type));
result.add(new Steps(configuration, type, this));
}
}
return result;
} }
|
public class class_name {
@Override
public List<CandidateSteps> createCandidateSteps() {
final List<CandidateSteps> result = new ArrayList<>();
for (final Class<?> type : steps) {
if (hasAnnotatedMethods(type)) {
configuration.parameterConverters().addConverters(methodReturningConverters(type)); // depends on control dependency: [if], data = [none]
result.add(new Steps(configuration, type, this)); // depends on control dependency: [if], data = [none]
}
}
return result;
} }
|
public class class_name {
@SuppressWarnings("unchecked")
public <T> void unlink(PushMeasure<T> measure) {
MeasureListener<T> listener = (MeasureListener<T>) linkedMeasures
.get(measure);
if (listener == null) {
// no registered listener
} else {
measure.unregister(listener);
linkedMeasures.remove(measure);
}
} }
|
public class class_name {
@SuppressWarnings("unchecked")
public <T> void unlink(PushMeasure<T> measure) {
MeasureListener<T> listener = (MeasureListener<T>) linkedMeasures
.get(measure);
if (listener == null) {
// no registered listener
} else {
measure.unregister(listener); // depends on control dependency: [if], data = [(listener]
linkedMeasures.remove(measure); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
@Override
public Set<String> stringPropertyNames() {
lock.readLock().lock();
try {
final Set<String> result = new HashSet<String>();
for (final Object key : getKeyMap(true).keySet()) {
result.add(getUnprefixedKey((String) key));
}
return result;
} finally {
lock.readLock().unlock();
}
} }
|
public class class_name {
@Override
public Set<String> stringPropertyNames() {
lock.readLock().lock();
try {
final Set<String> result = new HashSet<String>();
for (final Object key : getKeyMap(true).keySet()) {
result.add(getUnprefixedKey((String) key)); // depends on control dependency: [for], data = [key]
}
return result; // depends on control dependency: [try], data = [none]
} finally {
lock.readLock().unlock();
}
} }
|
public class class_name {
private void leaderElection() {
loggingLog.info("Starting leader election for snapshot truncation daemon");
try {
while (true) {
Stat stat = m_zk.exists(VoltZK.snapshot_truncation_master, new Watcher() {
@Override
public void process(WatchedEvent event) {
switch(event.getType()) {
case NodeDeleted:
loggingLog.info("Detected the snapshot truncation leader's ephemeral node deletion");
m_es.execute(new Runnable() {
@Override
public void run() {
leaderElection();
}
});
break;
default:
break;
}
}
});
if (stat == null) {
try {
m_zk.create(VoltZK.snapshot_truncation_master, null, Ids.OPEN_ACL_UNSAFE, CreateMode.EPHEMERAL);
m_isAutoSnapshotLeader = true;
if (m_lastKnownSchedule != null) {
makeActivePrivate(m_lastKnownSchedule);
}
electedTruncationLeader();
return;
} catch (NodeExistsException e) {
}
} else {
loggingLog.info("Leader election concluded, a leader already exists");
break;
}
}
} catch (Exception e) {
VoltDB.crashLocalVoltDB("Exception in snapshot daemon electing master via ZK", true, e);
}
} }
|
public class class_name {
private void leaderElection() {
loggingLog.info("Starting leader election for snapshot truncation daemon");
try {
while (true) {
Stat stat = m_zk.exists(VoltZK.snapshot_truncation_master, new Watcher() {
@Override
public void process(WatchedEvent event) {
switch(event.getType()) {
case NodeDeleted:
loggingLog.info("Detected the snapshot truncation leader's ephemeral node deletion");
m_es.execute(new Runnable() {
@Override
public void run() {
leaderElection();
}
});
break;
default:
break;
}
}
});
if (stat == null) {
try {
m_zk.create(VoltZK.snapshot_truncation_master, null, Ids.OPEN_ACL_UNSAFE, CreateMode.EPHEMERAL); // depends on control dependency: [try], data = [none]
m_isAutoSnapshotLeader = true; // depends on control dependency: [try], data = [none]
if (m_lastKnownSchedule != null) {
makeActivePrivate(m_lastKnownSchedule); // depends on control dependency: [if], data = [(m_lastKnownSchedule]
}
electedTruncationLeader(); // depends on control dependency: [try], data = [none]
return; // depends on control dependency: [try], data = [none]
} catch (NodeExistsException e) {
} // depends on control dependency: [catch], data = [none]
} else {
loggingLog.info("Leader election concluded, a leader already exists"); // depends on control dependency: [if], data = [none]
break;
}
}
} catch (Exception e) {
VoltDB.crashLocalVoltDB("Exception in snapshot daemon electing master via ZK", true, e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public void copyMenuHelp()
{
Record recClassInfo = this.getMainRecord();
recClassInfo.setKeyArea(ClassInfo.CLASS_NAME_KEY);
Record recMenus = this.getRecord(Menus.MENUS_FILE);
try {
recMenus.setKeyArea(ClassInfo.ID_KEY);
recMenus.close();
while (recMenus.hasNext())
{
recMenus.next();
if (recMenus.getField(Menus.AUTO_DESC).getState())
{
String strClassReference = recMenus.getField(Menus.PROGRAM).toString();
String strClassType = recMenus.getField(Menus.TYPE).toString();
if ((strClassReference != null) && (strClassReference.length() > 0))
if (!strClassType.equalsIgnoreCase("menu"))
{
if (strClassReference.indexOf('.') != -1)
strClassReference = strClassReference.substring(strClassReference.lastIndexOf('.') + 1);
recClassInfo.getField(ClassInfo.CLASS_NAME).setString(strClassReference);
if (recClassInfo.seek(null))
{
recMenus.edit();
if (!recClassInfo.getField(ClassInfo.CLASS_DESC).isNull())
recMenus.getField(Menus.NAME).moveFieldToThis(recClassInfo.getField(ClassInfo.CLASS_DESC));
recMenus.getField(Menus.COMMENT).moveFieldToThis(recClassInfo.getField(ClassInfo.CLASS_EXPLAIN));
recMenus.set();
}
}
}
}
} catch (DBException ex) {
ex.printStackTrace();
}
} }
|
public class class_name {
public void copyMenuHelp()
{
Record recClassInfo = this.getMainRecord();
recClassInfo.setKeyArea(ClassInfo.CLASS_NAME_KEY);
Record recMenus = this.getRecord(Menus.MENUS_FILE);
try {
recMenus.setKeyArea(ClassInfo.ID_KEY); // depends on control dependency: [try], data = [none]
recMenus.close(); // depends on control dependency: [try], data = [none]
while (recMenus.hasNext())
{
recMenus.next(); // depends on control dependency: [while], data = [none]
if (recMenus.getField(Menus.AUTO_DESC).getState())
{
String strClassReference = recMenus.getField(Menus.PROGRAM).toString();
String strClassType = recMenus.getField(Menus.TYPE).toString();
if ((strClassReference != null) && (strClassReference.length() > 0))
if (!strClassType.equalsIgnoreCase("menu"))
{
if (strClassReference.indexOf('.') != -1)
strClassReference = strClassReference.substring(strClassReference.lastIndexOf('.') + 1);
recClassInfo.getField(ClassInfo.CLASS_NAME).setString(strClassReference); // depends on control dependency: [if], data = [none]
if (recClassInfo.seek(null))
{
recMenus.edit(); // depends on control dependency: [if], data = [none]
if (!recClassInfo.getField(ClassInfo.CLASS_DESC).isNull())
recMenus.getField(Menus.NAME).moveFieldToThis(recClassInfo.getField(ClassInfo.CLASS_DESC));
recMenus.getField(Menus.COMMENT).moveFieldToThis(recClassInfo.getField(ClassInfo.CLASS_EXPLAIN)); // depends on control dependency: [if], data = [none]
recMenus.set(); // depends on control dependency: [if], data = [none]
}
}
}
}
} catch (DBException ex) {
ex.printStackTrace();
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public void setStartFromZero(final boolean IS_TRUE) {
if (null == startFromZero) {
_startFromZero = IS_TRUE;
setValue(IS_TRUE && getMinValue() < 0 ? 0 : getMinValue());
fireTileEvent(REDRAW_EVENT);
} else {
startFromZero.set(IS_TRUE);
}
} }
|
public class class_name {
public void setStartFromZero(final boolean IS_TRUE) {
if (null == startFromZero) {
_startFromZero = IS_TRUE; // depends on control dependency: [if], data = [none]
setValue(IS_TRUE && getMinValue() < 0 ? 0 : getMinValue()); // depends on control dependency: [if], data = [none]
fireTileEvent(REDRAW_EVENT); // depends on control dependency: [if], data = [none]
} else {
startFromZero.set(IS_TRUE); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public static final byte[] loadByteArray(final URL urlToResource) {
InputStream in = null;
try {
final URLConnection uc = urlToResource.openConnection();
uc.setUseCaches(false);
in = uc.getInputStream();
return CClassLoader.loadByteArray(in);
} catch (final IOException ioe) {
return null;
} finally {
try {
in.close();
} catch (final Exception ignore) {
}
}
} }
|
public class class_name {
public static final byte[] loadByteArray(final URL urlToResource) {
InputStream in = null;
try {
final URLConnection uc = urlToResource.openConnection();
uc.setUseCaches(false); // depends on control dependency: [try], data = [none]
in = uc.getInputStream(); // depends on control dependency: [try], data = [none]
return CClassLoader.loadByteArray(in); // depends on control dependency: [try], data = [none]
} catch (final IOException ioe) {
return null;
} finally { // depends on control dependency: [catch], data = [none]
try {
in.close(); // depends on control dependency: [try], data = [none]
} catch (final Exception ignore) {
} // depends on control dependency: [catch], data = [none]
}
} }
|
public class class_name {
protected static Event.Level formatLevel(Level level) {
if (level.isMoreSpecificThan(Level.FATAL)) {
return Event.Level.FATAL;
} else if (level.isMoreSpecificThan(Level.ERROR)) {
return Event.Level.ERROR;
} else if (level.isMoreSpecificThan(Level.WARN)) {
return Event.Level.WARNING;
} else if (level.isMoreSpecificThan(Level.INFO)) {
return Event.Level.INFO;
} else {
return Event.Level.DEBUG;
}
} }
|
public class class_name {
protected static Event.Level formatLevel(Level level) {
if (level.isMoreSpecificThan(Level.FATAL)) {
return Event.Level.FATAL; // depends on control dependency: [if], data = [none]
} else if (level.isMoreSpecificThan(Level.ERROR)) {
return Event.Level.ERROR; // depends on control dependency: [if], data = [none]
} else if (level.isMoreSpecificThan(Level.WARN)) {
return Event.Level.WARNING; // depends on control dependency: [if], data = [none]
} else if (level.isMoreSpecificThan(Level.INFO)) {
return Event.Level.INFO; // depends on control dependency: [if], data = [none]
} else {
return Event.Level.DEBUG; // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public void marshall(ListLogSubscriptionsRequest listLogSubscriptionsRequest, ProtocolMarshaller protocolMarshaller) {
if (listLogSubscriptionsRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(listLogSubscriptionsRequest.getDirectoryId(), DIRECTORYID_BINDING);
protocolMarshaller.marshall(listLogSubscriptionsRequest.getNextToken(), NEXTTOKEN_BINDING);
protocolMarshaller.marshall(listLogSubscriptionsRequest.getLimit(), LIMIT_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} }
|
public class class_name {
public void marshall(ListLogSubscriptionsRequest listLogSubscriptionsRequest, ProtocolMarshaller protocolMarshaller) {
if (listLogSubscriptionsRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(listLogSubscriptionsRequest.getDirectoryId(), DIRECTORYID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(listLogSubscriptionsRequest.getNextToken(), NEXTTOKEN_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(listLogSubscriptionsRequest.getLimit(), LIMIT_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
private InterproceduralCallGraphVertex findVertex(XMethod xmethod) {
InterproceduralCallGraphVertex vertex;
vertex = callGraph.lookupVertex(xmethod.getMethodDescriptor());
if (vertex == null) {
vertex = new InterproceduralCallGraphVertex();
vertex.setXmethod(xmethod);
callGraph.addVertex(vertex);
}
return vertex;
} }
|
public class class_name {
private InterproceduralCallGraphVertex findVertex(XMethod xmethod) {
InterproceduralCallGraphVertex vertex;
vertex = callGraph.lookupVertex(xmethod.getMethodDescriptor());
if (vertex == null) {
vertex = new InterproceduralCallGraphVertex(); // depends on control dependency: [if], data = [none]
vertex.setXmethod(xmethod); // depends on control dependency: [if], data = [none]
callGraph.addVertex(vertex); // depends on control dependency: [if], data = [(vertex]
}
return vertex;
} }
|
public class class_name {
public void withUser(boolean user) {
if (user) {
addQueryParameter(Constants.WITH_PARAM, Constants.WITH_USER);
} else {
removeQueryParameter(Constants.WITH_PARAM);
}
} }
|
public class class_name {
public void withUser(boolean user) {
if (user) {
addQueryParameter(Constants.WITH_PARAM, Constants.WITH_USER); // depends on control dependency: [if], data = [none]
} else {
removeQueryParameter(Constants.WITH_PARAM); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
@Override
public boolean dispatchPopulateAccessibilityEvent(AccessibilityEvent event) {
if (event.getEventType() == AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED) {
// Clear the event's current text so that only the current time will be spoken.
event.getText().clear();
Time time = new Time();
time.hour = getHours();
time.minute = getMinutes();
long millis = time.normalize(true);
int flags = DateUtils.FORMAT_SHOW_TIME;
if (mIs24HourMode) {
flags |= DateUtils.FORMAT_24HOUR;
}
String timeString = DateUtils.formatDateTime(getContext(), millis, flags);
event.getText().add(timeString);
return true;
}
return super.dispatchPopulateAccessibilityEvent(event);
} }
|
public class class_name {
@Override
public boolean dispatchPopulateAccessibilityEvent(AccessibilityEvent event) {
if (event.getEventType() == AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED) {
// Clear the event's current text so that only the current time will be spoken.
event.getText().clear(); // depends on control dependency: [if], data = [none]
Time time = new Time();
time.hour = getHours(); // depends on control dependency: [if], data = [none]
time.minute = getMinutes(); // depends on control dependency: [if], data = [none]
long millis = time.normalize(true);
int flags = DateUtils.FORMAT_SHOW_TIME;
if (mIs24HourMode) {
flags |= DateUtils.FORMAT_24HOUR; // depends on control dependency: [if], data = [none]
}
String timeString = DateUtils.formatDateTime(getContext(), millis, flags);
event.getText().add(timeString); // depends on control dependency: [if], data = [none]
return true; // depends on control dependency: [if], data = [none]
}
return super.dispatchPopulateAccessibilityEvent(event);
} }
|
public class class_name {
public static <T, U> Collector<T, ?, Optional<T>> maxBy(Function<? super T, ? extends U> function, Comparator<? super U> comparator) {
class Accumulator {
T t;
U u;
}
return Collector.of(
() -> new Accumulator(),
(a, t) -> {
U u = function.apply(t);
if (a.u == null || comparator.compare(a.u, u) < 0) {
a.t = t;
a.u = u;
}
},
(a1, a2) ->
a1.u == null
? a2
: a2.u == null
? a1
: comparator.compare(a1.u, a2.u) < 0
? a2
: a1,
a -> Optional.ofNullable(a.t)
);
} }
|
public class class_name {
public static <T, U> Collector<T, ?, Optional<T>> maxBy(Function<? super T, ? extends U> function, Comparator<? super U> comparator) {
class Accumulator {
T t;
U u;
}
return Collector.of(
() -> new Accumulator(),
(a, t) -> {
U u = function.apply(t);
if (a.u == null || comparator.compare(a.u, u) < 0) {
a.t = t; // depends on control dependency: [if], data = [none]
a.u = u; // depends on control dependency: [if], data = [none]
}
},
(a1, a2) ->
a1.u == null
? a2
: a2.u == null
? a1
: comparator.compare(a1.u, a2.u) < 0
? a2
: a1,
a -> Optional.ofNullable(a.t)
);
} }
|
public class class_name {
static BinaryToASCIIConverter getBinaryToASCIIConverter(double d, boolean isCompatibleFormat) {
long dBits = Double.doubleToRawLongBits(d);
boolean isNegative = (dBits&DoubleConsts.SIGN_BIT_MASK) != 0; // discover sign
long fractBits = dBits & DoubleConsts.SIGNIF_BIT_MASK;
int binExp = (int)( (dBits&DoubleConsts.EXP_BIT_MASK) >> EXP_SHIFT );
// Discover obvious special cases of NaN and Infinity.
if ( binExp == (int)(DoubleConsts.EXP_BIT_MASK>>EXP_SHIFT) ) {
if ( fractBits == 0L ){
return isNegative ? B2AC_NEGATIVE_INFINITY : B2AC_POSITIVE_INFINITY;
} else {
return B2AC_NOT_A_NUMBER;
}
}
// Finish unpacking
// Normalize denormalized numbers.
// Insert assumed high-order bit for normalized numbers.
// Subtract exponent bias.
int nSignificantBits;
if ( binExp == 0 ){
if ( fractBits == 0L ){
// not a denorm, just a 0!
return isNegative ? B2AC_NEGATIVE_ZERO : B2AC_POSITIVE_ZERO;
}
int leadingZeros = Long.numberOfLeadingZeros(fractBits);
int shift = leadingZeros-(63-EXP_SHIFT);
fractBits <<= shift;
binExp = 1 - shift;
nSignificantBits = 64-leadingZeros; // recall binExp is - shift count.
} else {
fractBits |= FRACT_HOB;
nSignificantBits = EXP_SHIFT+1;
}
binExp -= DoubleConsts.EXP_BIAS;
BinaryToASCIIBuffer buf = getBinaryToASCIIBuffer();
buf.setSign(isNegative);
// call the routine that actually does all the hard work.
buf.dtoa(binExp, fractBits, nSignificantBits, isCompatibleFormat);
return buf;
} }
|
public class class_name {
static BinaryToASCIIConverter getBinaryToASCIIConverter(double d, boolean isCompatibleFormat) {
long dBits = Double.doubleToRawLongBits(d);
boolean isNegative = (dBits&DoubleConsts.SIGN_BIT_MASK) != 0; // discover sign
long fractBits = dBits & DoubleConsts.SIGNIF_BIT_MASK;
int binExp = (int)( (dBits&DoubleConsts.EXP_BIT_MASK) >> EXP_SHIFT );
// Discover obvious special cases of NaN and Infinity.
if ( binExp == (int)(DoubleConsts.EXP_BIT_MASK>>EXP_SHIFT) ) {
if ( fractBits == 0L ){
return isNegative ? B2AC_NEGATIVE_INFINITY : B2AC_POSITIVE_INFINITY; // depends on control dependency: [if], data = [none]
} else {
return B2AC_NOT_A_NUMBER; // depends on control dependency: [if], data = [none]
}
}
// Finish unpacking
// Normalize denormalized numbers.
// Insert assumed high-order bit for normalized numbers.
// Subtract exponent bias.
int nSignificantBits;
if ( binExp == 0 ){
if ( fractBits == 0L ){
// not a denorm, just a 0!
return isNegative ? B2AC_NEGATIVE_ZERO : B2AC_POSITIVE_ZERO; // depends on control dependency: [if], data = [none]
}
int leadingZeros = Long.numberOfLeadingZeros(fractBits);
int shift = leadingZeros-(63-EXP_SHIFT);
fractBits <<= shift; // depends on control dependency: [if], data = [none]
binExp = 1 - shift; // depends on control dependency: [if], data = [none]
nSignificantBits = 64-leadingZeros; // recall binExp is - shift count. // depends on control dependency: [if], data = [none]
} else {
fractBits |= FRACT_HOB; // depends on control dependency: [if], data = [none]
nSignificantBits = EXP_SHIFT+1; // depends on control dependency: [if], data = [none]
}
binExp -= DoubleConsts.EXP_BIAS;
BinaryToASCIIBuffer buf = getBinaryToASCIIBuffer();
buf.setSign(isNegative);
// call the routine that actually does all the hard work.
buf.dtoa(binExp, fractBits, nSignificantBits, isCompatibleFormat);
return buf;
} }
|
public class class_name {
@Api
public void registerWorldPaintable(WorldPaintable worldPaintable) {
if (worldPaintable != null && !worldPaintables.containsKey(worldPaintable.getId())) {
worldPaintables.put(worldPaintable.getId(), worldPaintable);
worldPaintable.transform(mapModel.getMapView().getWorldViewTransformer());
render(worldPaintable, RenderGroup.WORLD, RenderStatus.ALL);
}
} }
|
public class class_name {
@Api
public void registerWorldPaintable(WorldPaintable worldPaintable) {
if (worldPaintable != null && !worldPaintables.containsKey(worldPaintable.getId())) {
worldPaintables.put(worldPaintable.getId(), worldPaintable); // depends on control dependency: [if], data = [(worldPaintable]
worldPaintable.transform(mapModel.getMapView().getWorldViewTransformer()); // depends on control dependency: [if], data = [none]
render(worldPaintable, RenderGroup.WORLD, RenderStatus.ALL); // depends on control dependency: [if], data = [(worldPaintable]
}
} }
|
public class class_name {
public void setVariance (int dx, int dy)
{
if ((dx < 0) || (dy < 0) || ((dx == 0) && (dy == 0))) {
throw new IllegalArgumentException(
"Variance values must be positive, and at least one must be non-zero.");
} else {
_dx = dx;
_dy = dy;
}
} }
|
public class class_name {
public void setVariance (int dx, int dy)
{
if ((dx < 0) || (dy < 0) || ((dx == 0) && (dy == 0))) {
throw new IllegalArgumentException(
"Variance values must be positive, and at least one must be non-zero.");
} else {
_dx = dx; // depends on control dependency: [if], data = [none]
_dy = dy; // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public Set<RateType> getRateTypes() {
@SuppressWarnings("unchecked")
Set<RateType> rateSet = get(KEY_RATE_TYPES, Set.class);
if (rateSet == null) {
return Collections.emptySet();
}
return Collections.unmodifiableSet(rateSet);
} }
|
public class class_name {
public Set<RateType> getRateTypes() {
@SuppressWarnings("unchecked")
Set<RateType> rateSet = get(KEY_RATE_TYPES, Set.class);
if (rateSet == null) {
return Collections.emptySet(); // depends on control dependency: [if], data = [none]
}
return Collections.unmodifiableSet(rateSet);
} }
|
public class class_name {
private static String changeIDs(String text, Map<String, String> mapIds) {
String result = text;
for (String key : mapIds.keySet()) {
result = result.replace(key, mapIds.get(key));
}
return result;
} }
|
public class class_name {
private static String changeIDs(String text, Map<String, String> mapIds) {
String result = text;
for (String key : mapIds.keySet()) {
result = result.replace(key, mapIds.get(key));
// depends on control dependency: [for], data = [key]
}
return result;
} }
|
public class class_name {
public DescribeNatGatewaysResult withNatGateways(NatGateway... natGateways) {
if (this.natGateways == null) {
setNatGateways(new com.amazonaws.internal.SdkInternalList<NatGateway>(natGateways.length));
}
for (NatGateway ele : natGateways) {
this.natGateways.add(ele);
}
return this;
} }
|
public class class_name {
public DescribeNatGatewaysResult withNatGateways(NatGateway... natGateways) {
if (this.natGateways == null) {
setNatGateways(new com.amazonaws.internal.SdkInternalList<NatGateway>(natGateways.length)); // depends on control dependency: [if], data = [none]
}
for (NatGateway ele : natGateways) {
this.natGateways.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} }
|
public class class_name {
@Override
protected URL findResource(String name) {
URL result = null;
// Only check the parent bundle loader if the request is outside of "" or "/"
if (!!!"".equals(name) && !!!"/".equals(name)) {
// First try the bundleLoader
result = bundleLoader.getResource(name);
}
// This doesn't have access to ALL split packages (it just gets one) so it's augmented with a resource provider
return result == null ? resourceProviders.findResource(name) : result;
} }
|
public class class_name {
@Override
protected URL findResource(String name) {
URL result = null;
// Only check the parent bundle loader if the request is outside of "" or "/"
if (!!!"".equals(name) && !!!"/".equals(name)) {
// First try the bundleLoader
result = bundleLoader.getResource(name); // depends on control dependency: [if], data = [none]
}
// This doesn't have access to ALL split packages (it just gets one) so it's augmented with a resource provider
return result == null ? resourceProviders.findResource(name) : result;
} }
|
public class class_name {
public void setStartAngle(final double ANGLE) {
if (null == startAngle) {
_startAngle = Helper.clamp(0.0, 360.0, ANGLE);
fireUpdateEvent(RECALC_EVENT);
} else {
startAngle.set(ANGLE);
}
} }
|
public class class_name {
public void setStartAngle(final double ANGLE) {
if (null == startAngle) {
_startAngle = Helper.clamp(0.0, 360.0, ANGLE); // depends on control dependency: [if], data = [none]
fireUpdateEvent(RECALC_EVENT); // depends on control dependency: [if], data = [none]
} else {
startAngle.set(ANGLE); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public GeoLocation search(double deltaNM, GeoSearch... searches)
{
List<GeoLocation> list = search(false, searches);
if (!list.isEmpty() && GeoDB.isUnique(list, deltaNM))
{
return list.get(0);
}
else
{
list.removeIf((gl)->!gl.match(true, searches));
if (!list.isEmpty() && GeoDB.isUnique(list, deltaNM))
{
return list.get(0);
}
else
{
return null;
}
}
} }
|
public class class_name {
public GeoLocation search(double deltaNM, GeoSearch... searches)
{
List<GeoLocation> list = search(false, searches);
if (!list.isEmpty() && GeoDB.isUnique(list, deltaNM))
{
return list.get(0);
// depends on control dependency: [if], data = [none]
}
else
{
list.removeIf((gl)->!gl.match(true, searches));
// depends on control dependency: [if], data = [none]
if (!list.isEmpty() && GeoDB.isUnique(list, deltaNM))
{
return list.get(0);
// depends on control dependency: [if], data = [none]
}
else
{
return null;
// depends on control dependency: [if], data = [none]
}
}
} }
|
public class class_name {
void parseArgs(String[] args) {
int i = 0;
while (true) {
if (i >= args.length) {
break;
}
String s = args[i];
if (s.equals("-h") ||
s.equals("help") ||
s.equals("-help") ||
s.equals("--help")) {
usage();
}
else if (s.equals("-n") ||
s.equals("-nodes")) {
i++; if (i >= args.length) { usage(); }
numNodes = Integer.parseInt(args[i]);
}
else if (s.equals("-o") ||
s.equals("-output")) {
i++; if (i >= args.length) { usage(); }
outputPath = args[i];
}
else if (s.equals("-jobname")) {
i++; if (i >= args.length) { usage(); }
jobtrackerName = args[i];
}
else if (s.equals("-mapperXmx")) {
i++; if (i >= args.length) { usage(); }
mapperXmx = args[i];
}
else if (s.equals("-extramempercent")) {
i++; if (i >= args.length) { usage(); }
extraMemPercent = Integer.parseInt(args[i]);
}
else if (s.equals("-driverif")) {
i++; if (i >= args.length) { usage(); }
driverCallbackIp = args[i];
}
else if (s.equals("-driverport")) {
i++; if (i >= args.length) { usage(); }
driverCallbackPort = Integer.parseInt(args[i]);
}
else if (s.equals("-network")) {
i++; if (i >= args.length) { usage(); }
network = args[i];
}
else if (s.equals("-timeout")) {
i++; if (i >= args.length) { usage(); }
cloudFormationTimeoutSeconds = Integer.parseInt(args[i]);
}
else if (s.equals("-disown")) {
disown = true;
}
else if (s.equals("-notify")) {
i++; if (i >= args.length) { usage(); }
clusterReadyFileName = args[i];
}
else if (s.equals("-nthreads")) {
i++; if (i >= args.length) { usage(); }
nthreads = Integer.parseInt(args[i]);
}
else if (s.equals("-many_cols")) {
manyCols = true;
}
else if (s.equals("-chunk_bytes")) {
i++; if (i >= args.length) { usage(); }
chunk_bytes = Integer.parseInt(args[i]);
}
else if (s.equals("-data_max_factor_levels")) {
i++; if (i >= args.length) { usage(); }
data_max_factor_levels = Integer.parseInt(args[i]);
}
else if (s.equals("-baseport")) {
i++; if (i >= args.length) { usage(); }
basePort = Integer.parseInt(args[i]);
if ((basePort < 0) || (basePort > 65535)) {
error("Base port must be between 1 and 65535");
}
}
else if (s.equals("-beta")) {
beta = true;
}
else if (s.equals("-random_udp_drop")) {
enableRandomUdpDrop = true;
}
else if (s.equals("-ea")) {
enableExceptions = true;
}
else if (s.equals("-verbose:gc")) {
enableVerboseGC = true;
}
else if (s.equals("-verbose:class")) {
enableVerboseClass = true;
}
else if (s.equals("-XX:+PrintCompilation")) {
enablePrintCompilation = true;
}
else if (s.equals("-exclude")) {
enableExcludeMethods = true;
}
else if (s.equals("-Dlog4j.defaultInitOverride=true")) {
enableLog4jDefaultInitOverride = true;
}
else if (s.equals("-debug")) {
enableDebug = true;
}
else if (s.equals("-suspend")) {
enableSuspend = true;
}
else if (s.equals("-debugport")) {
i++; if (i >= args.length) { usage(); }
debugPort = Integer.parseInt(args[i]);
if ((debugPort < 0) || (debugPort > 65535)) {
error("Debug port must be between 1 and 65535");
}
}
else if (s.equals("-XX:+PrintGCDetails")) {
enablePrintGCDetails = true;
}
else if (s.equals("-XX:+PrintGCTimeStamps")) {
enablePrintGCTimeStamps = true;
}
else if (s.equals("-gc")) {
enableVerboseGC = true;
enablePrintGCDetails = true;
enablePrintGCTimeStamps = true;
}
else if (s.equals("-license")) {
i++; if (i >= args.length) { usage(); }
licenseFileName = args[i];
}
else if (s.equals("-extraJavaOpts")) {
i++; if (i >= args.length) { usage(); }
extraJavaOpts = args[i];
}
else {
error("Unrecognized option " + s);
}
i++;
}
// Check for mandatory arguments.
if (numNodes < 1) {
error("Number of H2O nodes must be greater than 0 (must specify -n)");
}
if (outputPath == null) {
error("Missing required option -output");
}
if (mapperXmx == null) {
error("Missing required option -mapperXmx");
}
// Check for sane arguments.
if (! mapperXmx.matches("[1-9][0-9]*[mgMG]")) {
error("-mapperXmx invalid (try something like -mapperXmx 4g)");
}
if (extraMemPercent < 0) {
extraMemPercent = DEFAULT_EXTRA_MEM_PERCENT;
}
if (jobtrackerName == null) {
Random rng = new Random();
int num = rng.nextInt(99999);
jobtrackerName = "H2O_" + num;
}
if (network == null) {
network = "";
}
else {
String[] networks;
if (network.contains(",")) {
networks = network.split(",");
}
else {
networks = new String[1];
networks[0] = network;
}
for (int j = 0; j < networks.length; j++) {
String n = networks[j];
Pattern p = Pattern.compile("(\\d+)\\.(\\d+)\\.(\\d+)\\.(\\d+)/(\\d+)");
Matcher m = p.matcher(n);
boolean b = m.matches();
if (! b) {
error("network invalid: " + n);
}
for (int k = 1; k <=4; k++) {
int o = Integer.parseInt(m.group(k));
if ((o < 0) || (o > 255)) {
error("network invalid: " + n);
}
int bits = Integer.parseInt(m.group(5));
if ((bits < 0) || (bits > 32)) {
error("network invalid: " + n);
}
}
}
}
if (network == null) {
error("Internal error, network should not be null at this point");
}
if ((nthreads >= 0) && (nthreads < 4)) {
error("nthreads invalid (must be >= 4): " + nthreads);
}
if (licenseFileName != null) {
try {
licenseData = readFile(licenseFileName);
}
catch (Exception xe) {
StringBuilder sb = new StringBuilder();
sb.append("Failed to read license file: ");
if (xe.getLocalizedMessage() != null) {
sb.append(xe.getLocalizedMessage());
}
else {
sb.append(licenseFileName);
}
error(sb.toString());
}
}
} }
|
public class class_name {
void parseArgs(String[] args) {
int i = 0;
while (true) {
if (i >= args.length) {
break;
}
String s = args[i];
if (s.equals("-h") ||
s.equals("help") ||
s.equals("-help") ||
s.equals("--help")) {
usage(); // depends on control dependency: [if], data = [none]
}
else if (s.equals("-n") ||
s.equals("-nodes")) {
i++; if (i >= args.length) { usage(); } // depends on control dependency: [if], data = [none] // depends on control dependency: [if], data = [none]
numNodes = Integer.parseInt(args[i]); // depends on control dependency: [if], data = [none]
}
else if (s.equals("-o") ||
s.equals("-output")) {
i++; if (i >= args.length) { usage(); } // depends on control dependency: [if], data = [none] // depends on control dependency: [if], data = [none]
outputPath = args[i]; // depends on control dependency: [if], data = [none]
}
else if (s.equals("-jobname")) {
i++; if (i >= args.length) { usage(); } // depends on control dependency: [if], data = [none] // depends on control dependency: [if], data = [none]
jobtrackerName = args[i]; // depends on control dependency: [if], data = [none]
}
else if (s.equals("-mapperXmx")) {
i++; if (i >= args.length) { usage(); } // depends on control dependency: [if], data = [none] // depends on control dependency: [if], data = [none]
mapperXmx = args[i]; // depends on control dependency: [if], data = [none]
}
else if (s.equals("-extramempercent")) {
i++; if (i >= args.length) { usage(); } // depends on control dependency: [if], data = [none] // depends on control dependency: [if], data = [none]
extraMemPercent = Integer.parseInt(args[i]); // depends on control dependency: [if], data = [none]
}
else if (s.equals("-driverif")) {
i++; if (i >= args.length) { usage(); } // depends on control dependency: [if], data = [none] // depends on control dependency: [if], data = [none]
driverCallbackIp = args[i]; // depends on control dependency: [if], data = [none]
}
else if (s.equals("-driverport")) {
i++; if (i >= args.length) { usage(); } // depends on control dependency: [if], data = [none] // depends on control dependency: [if], data = [none]
driverCallbackPort = Integer.parseInt(args[i]); // depends on control dependency: [if], data = [none]
}
else if (s.equals("-network")) {
i++; if (i >= args.length) { usage(); } // depends on control dependency: [if], data = [none] // depends on control dependency: [if], data = [none]
network = args[i]; // depends on control dependency: [if], data = [none]
}
else if (s.equals("-timeout")) {
i++; if (i >= args.length) { usage(); } // depends on control dependency: [if], data = [none] // depends on control dependency: [if], data = [none]
cloudFormationTimeoutSeconds = Integer.parseInt(args[i]); // depends on control dependency: [if], data = [none]
}
else if (s.equals("-disown")) {
disown = true; // depends on control dependency: [if], data = [none]
}
else if (s.equals("-notify")) {
i++; if (i >= args.length) { usage(); } // depends on control dependency: [if], data = [none] // depends on control dependency: [if], data = [none]
clusterReadyFileName = args[i]; // depends on control dependency: [if], data = [none]
}
else if (s.equals("-nthreads")) {
i++; if (i >= args.length) { usage(); } // depends on control dependency: [if], data = [none] // depends on control dependency: [if], data = [none]
nthreads = Integer.parseInt(args[i]); // depends on control dependency: [if], data = [none]
}
else if (s.equals("-many_cols")) {
manyCols = true; // depends on control dependency: [if], data = [none]
}
else if (s.equals("-chunk_bytes")) {
i++; if (i >= args.length) { usage(); } // depends on control dependency: [if], data = [none] // depends on control dependency: [if], data = [none]
chunk_bytes = Integer.parseInt(args[i]); // depends on control dependency: [if], data = [none]
}
else if (s.equals("-data_max_factor_levels")) {
i++; if (i >= args.length) { usage(); } // depends on control dependency: [if], data = [none] // depends on control dependency: [if], data = [none]
data_max_factor_levels = Integer.parseInt(args[i]); // depends on control dependency: [if], data = [none]
}
else if (s.equals("-baseport")) {
i++; if (i >= args.length) { usage(); } // depends on control dependency: [if], data = [none] // depends on control dependency: [if], data = [none]
basePort = Integer.parseInt(args[i]); // depends on control dependency: [if], data = [none]
if ((basePort < 0) || (basePort > 65535)) {
error("Base port must be between 1 and 65535"); // depends on control dependency: [if], data = [none]
}
}
else if (s.equals("-beta")) {
beta = true; // depends on control dependency: [if], data = [none]
}
else if (s.equals("-random_udp_drop")) {
enableRandomUdpDrop = true; // depends on control dependency: [if], data = [none]
}
else if (s.equals("-ea")) {
enableExceptions = true; // depends on control dependency: [if], data = [none]
}
else if (s.equals("-verbose:gc")) {
enableVerboseGC = true; // depends on control dependency: [if], data = [none]
}
else if (s.equals("-verbose:class")) {
enableVerboseClass = true; // depends on control dependency: [if], data = [none]
}
else if (s.equals("-XX:+PrintCompilation")) {
enablePrintCompilation = true; // depends on control dependency: [if], data = [none]
}
else if (s.equals("-exclude")) {
enableExcludeMethods = true; // depends on control dependency: [if], data = [none]
}
else if (s.equals("-Dlog4j.defaultInitOverride=true")) {
enableLog4jDefaultInitOverride = true; // depends on control dependency: [if], data = [none]
}
else if (s.equals("-debug")) {
enableDebug = true; // depends on control dependency: [if], data = [none]
}
else if (s.equals("-suspend")) {
enableSuspend = true; // depends on control dependency: [if], data = [none]
}
else if (s.equals("-debugport")) {
i++; if (i >= args.length) { usage(); } // depends on control dependency: [if], data = [none] // depends on control dependency: [if], data = [none]
debugPort = Integer.parseInt(args[i]); // depends on control dependency: [if], data = [none]
if ((debugPort < 0) || (debugPort > 65535)) {
error("Debug port must be between 1 and 65535"); // depends on control dependency: [if], data = [none]
}
}
else if (s.equals("-XX:+PrintGCDetails")) {
enablePrintGCDetails = true; // depends on control dependency: [if], data = [none]
}
else if (s.equals("-XX:+PrintGCTimeStamps")) {
enablePrintGCTimeStamps = true; // depends on control dependency: [if], data = [none]
}
else if (s.equals("-gc")) {
enableVerboseGC = true; // depends on control dependency: [if], data = [none]
enablePrintGCDetails = true; // depends on control dependency: [if], data = [none]
enablePrintGCTimeStamps = true; // depends on control dependency: [if], data = [none]
}
else if (s.equals("-license")) {
i++; if (i >= args.length) { usage(); } // depends on control dependency: [if], data = [none] // depends on control dependency: [if], data = [none]
licenseFileName = args[i]; // depends on control dependency: [if], data = [none]
}
else if (s.equals("-extraJavaOpts")) {
i++; if (i >= args.length) { usage(); } // depends on control dependency: [if], data = [none] // depends on control dependency: [if], data = [none]
extraJavaOpts = args[i]; // depends on control dependency: [if], data = [none]
}
else {
error("Unrecognized option " + s); // depends on control dependency: [if], data = [none]
}
i++; // depends on control dependency: [while], data = [none]
}
// Check for mandatory arguments.
if (numNodes < 1) {
error("Number of H2O nodes must be greater than 0 (must specify -n)"); // depends on control dependency: [if], data = [none]
}
if (outputPath == null) {
error("Missing required option -output"); // depends on control dependency: [if], data = [none]
}
if (mapperXmx == null) {
error("Missing required option -mapperXmx"); // depends on control dependency: [if], data = [none]
}
// Check for sane arguments.
if (! mapperXmx.matches("[1-9][0-9]*[mgMG]")) {
error("-mapperXmx invalid (try something like -mapperXmx 4g)"); // depends on control dependency: [if], data = [none]
}
if (extraMemPercent < 0) {
extraMemPercent = DEFAULT_EXTRA_MEM_PERCENT; // depends on control dependency: [if], data = [none]
}
if (jobtrackerName == null) {
Random rng = new Random();
int num = rng.nextInt(99999);
jobtrackerName = "H2O_" + num; // depends on control dependency: [if], data = [none]
}
if (network == null) {
network = "";
}
else {
String[] networks;
if (network.contains(",")) {
networks = network.split(","); // depends on control dependency: [if], data = [none]
}
else {
networks = new String[1]; // depends on control dependency: [if], data = [none]
networks[0] = network; // depends on control dependency: [if], data = [none]
}
for (int j = 0; j < networks.length; j++) {
String n = networks[j];
Pattern p = Pattern.compile("(\\d+)\\.(\\d+)\\.(\\d+)\\.(\\d+)/(\\d+)");
Matcher m = p.matcher(n);
boolean b = m.matches();
if (! b) {
error("network invalid: " + n);
}
for (int k = 1; k <=4; k++) {
int o = Integer.parseInt(m.group(k));
if ((o < 0) || (o > 255)) {
error("network invalid: " + n);
}
int bits = Integer.parseInt(m.group(5));
if ((bits < 0) || (bits > 32)) {
error("network invalid: " + n);
}
}
}
}
if (network == null) {
error("Internal error, network should not be null at this point");
}
if ((nthreads >= 0) && (nthreads < 4)) {
error("nthreads invalid (must be >= 4): " + nthreads);
}
if (licenseFileName != null) {
try {
licenseData = readFile(licenseFileName);
}
catch (Exception xe) {
StringBuilder sb = new StringBuilder();
sb.append("Failed to read license file: ");
if (xe.getLocalizedMessage() != null) {
sb.append(xe.getLocalizedMessage());
}
else {
sb.append(licenseFileName);
}
error(sb.toString());
}
}
} }
|
public class class_name {
public static String formatDate(long value, DateFormat threadLocalformat) {
String cachedDate = null;
Long longValue = Long.valueOf(value);
try {
cachedDate = formatCache.get(longValue);
}
catch (Exception ignored) {
}
if (cachedDate != null) {
return cachedDate;
}
String newDate;
Date dateValue = new Date(value);
if (threadLocalformat != null) {
newDate = threadLocalformat.format(dateValue);
synchronized (formatCache) {
updateCache(formatCache, longValue, newDate);
}
}
else {
synchronized (formatCache) {
newDate = format.format(dateValue);
updateCache(formatCache, longValue, newDate);
}
}
return newDate;
} }
|
public class class_name {
public static String formatDate(long value, DateFormat threadLocalformat) {
String cachedDate = null;
Long longValue = Long.valueOf(value);
try {
cachedDate = formatCache.get(longValue); // depends on control dependency: [try], data = [none]
}
catch (Exception ignored) {
} // depends on control dependency: [catch], data = [none]
if (cachedDate != null) {
return cachedDate; // depends on control dependency: [if], data = [none]
}
String newDate;
Date dateValue = new Date(value);
if (threadLocalformat != null) {
newDate = threadLocalformat.format(dateValue); // depends on control dependency: [if], data = [none]
synchronized (formatCache) { // depends on control dependency: [if], data = [none]
updateCache(formatCache, longValue, newDate);
}
}
else {
synchronized (formatCache) { // depends on control dependency: [if], data = [none]
newDate = format.format(dateValue);
updateCache(formatCache, longValue, newDate);
}
}
return newDate;
} }
|
public class class_name {
public void marshall(TypedLinkAttributeDefinition typedLinkAttributeDefinition, ProtocolMarshaller protocolMarshaller) {
if (typedLinkAttributeDefinition == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(typedLinkAttributeDefinition.getName(), NAME_BINDING);
protocolMarshaller.marshall(typedLinkAttributeDefinition.getType(), TYPE_BINDING);
protocolMarshaller.marshall(typedLinkAttributeDefinition.getDefaultValue(), DEFAULTVALUE_BINDING);
protocolMarshaller.marshall(typedLinkAttributeDefinition.getIsImmutable(), ISIMMUTABLE_BINDING);
protocolMarshaller.marshall(typedLinkAttributeDefinition.getRules(), RULES_BINDING);
protocolMarshaller.marshall(typedLinkAttributeDefinition.getRequiredBehavior(), REQUIREDBEHAVIOR_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} }
|
public class class_name {
public void marshall(TypedLinkAttributeDefinition typedLinkAttributeDefinition, ProtocolMarshaller protocolMarshaller) {
if (typedLinkAttributeDefinition == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(typedLinkAttributeDefinition.getName(), NAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(typedLinkAttributeDefinition.getType(), TYPE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(typedLinkAttributeDefinition.getDefaultValue(), DEFAULTVALUE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(typedLinkAttributeDefinition.getIsImmutable(), ISIMMUTABLE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(typedLinkAttributeDefinition.getRules(), RULES_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(typedLinkAttributeDefinition.getRequiredBehavior(), REQUIREDBEHAVIOR_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 readNameIdMapV2() throws IOException, InterruptedException {
nameIdMap.clear();
long localFileCounter = -1;
nameIdMapHolder.position(0);
NameFileIdEntry nameFileIdEntry;
final Map<Integer, String> idFileNameMap = new HashMap<>(1_000);
while ((nameFileIdEntry = readNextNameIdEntryV2()) != null) {
final long absFileId = Math.abs(nameFileIdEntry.fileId);
if (localFileCounter < absFileId) {
localFileCounter = absFileId;
}
nameIdMap.put(nameFileIdEntry.name, nameFileIdEntry.fileId);
if (nameFileIdEntry.fileId >= 0) {
idNameMap.put(nameFileIdEntry.fileId, nameFileIdEntry.name);
}
idFileNameMap.put(nameFileIdEntry.fileId, nameFileIdEntry.fileSystemName);
}
if (localFileCounter > 0 && nextInternalId < localFileCounter) {
nextInternalId = (int) localFileCounter;
}
for (final Map.Entry<String, Integer> nameIdEntry : nameIdMap.entrySet()) {
final int fileId = nameIdEntry.getValue();
if (fileId >= 0) {
final long externalId = composeFileId(id, nameIdEntry.getValue());
if (files.get(externalId) == null) {
final Path path = storagePath.resolve(idFileNameMap.get((nameIdEntry.getValue())));
final OFileClassic fileClassic = new OFileClassic(path);
if (fileClassic.exists()) {
fileClassic.open();
files.add(externalId, fileClassic);
} else {
nameIdMap.put(nameIdEntry.getKey(), -fileId);
idNameMap.remove(fileId);
}
}
}
}
} }
|
public class class_name {
private void readNameIdMapV2() throws IOException, InterruptedException {
nameIdMap.clear();
long localFileCounter = -1;
nameIdMapHolder.position(0);
NameFileIdEntry nameFileIdEntry;
final Map<Integer, String> idFileNameMap = new HashMap<>(1_000);
while ((nameFileIdEntry = readNextNameIdEntryV2()) != null) {
final long absFileId = Math.abs(nameFileIdEntry.fileId);
if (localFileCounter < absFileId) {
localFileCounter = absFileId; // depends on control dependency: [if], data = [none]
}
nameIdMap.put(nameFileIdEntry.name, nameFileIdEntry.fileId);
if (nameFileIdEntry.fileId >= 0) {
idNameMap.put(nameFileIdEntry.fileId, nameFileIdEntry.name); // depends on control dependency: [if], data = [(nameFileIdEntry.fileId]
}
idFileNameMap.put(nameFileIdEntry.fileId, nameFileIdEntry.fileSystemName);
}
if (localFileCounter > 0 && nextInternalId < localFileCounter) {
nextInternalId = (int) localFileCounter;
}
for (final Map.Entry<String, Integer> nameIdEntry : nameIdMap.entrySet()) {
final int fileId = nameIdEntry.getValue();
if (fileId >= 0) {
final long externalId = composeFileId(id, nameIdEntry.getValue());
if (files.get(externalId) == null) {
final Path path = storagePath.resolve(idFileNameMap.get((nameIdEntry.getValue())));
final OFileClassic fileClassic = new OFileClassic(path);
if (fileClassic.exists()) {
fileClassic.open(); // depends on control dependency: [if], data = [none]
files.add(externalId, fileClassic); // depends on control dependency: [if], data = [none]
} else {
nameIdMap.put(nameIdEntry.getKey(), -fileId); // depends on control dependency: [if], data = [none]
idNameMap.remove(fileId); // depends on control dependency: [if], data = [none]
}
}
}
}
} }
|
public class class_name {
private String limitString() {
if(params.length != 2){
throw new IllegalArgumentException("Wrong number of Parameters for limit string expression");
}
final String field = record.getValueByFieldName(params[0]);
int limit = Integer.parseInt(params[1]);
if (field.isEmpty() || field.length() < limit){
return field;
}
String result = field.substring(0, limit) + "...";
return result;
} }
|
public class class_name {
private String limitString() {
if(params.length != 2){
throw new IllegalArgumentException("Wrong number of Parameters for limit string expression");
}
final String field = record.getValueByFieldName(params[0]);
int limit = Integer.parseInt(params[1]);
if (field.isEmpty() || field.length() < limit){
return field; // depends on control dependency: [if], data = [none]
}
String result = field.substring(0, limit) + "...";
return result;
} }
|
public class class_name {
private String[] process(final String actionPath, final boolean match) {
// first check the first fixed as a prefix
if (match && !actionPath.startsWith(fixed[0])) {
return null;
}
String[] values = new String[macrosCount];
int offset = fixed[0].length();
int i = 0;
while (i < macrosCount) {
int nexti = i;
// defines next fixed string to match
String nextFixed;
while (true) {
nexti++;
if (nexti > macrosCount) {
nextFixed = null; // match to the end of line
break;
}
nextFixed = fixed[nexti];
if (nextFixed.length() != 0) {
break;
}
// next fixed is an empty string, so skip the next macro.
}
// find next fixed string
int ndx;
if (nextFixed != null) {
ndx = actionPath.indexOf(nextFixed, offset);
} else {
ndx = actionPath.length();
}
if (ndx == -1) {
return null;
}
String macroValue = actionPath.substring(offset, ndx);
values[i] = macroValue;
if (match && patterns[i] != null) {
if (!matchValue(i, macroValue)) {
return null;
}
}
if (nextFixed == null) {
offset = ndx;
break;
}
// iterate
int nextFixedLength = nextFixed.length();
offset = ndx + nextFixedLength;
i = nexti;
}
if (offset != actionPath.length()) {
// action path is not consumed fully during this matching
return null;
}
return values;
} }
|
public class class_name {
private String[] process(final String actionPath, final boolean match) {
// first check the first fixed as a prefix
if (match && !actionPath.startsWith(fixed[0])) {
return null; // depends on control dependency: [if], data = [none]
}
String[] values = new String[macrosCount];
int offset = fixed[0].length();
int i = 0;
while (i < macrosCount) {
int nexti = i;
// defines next fixed string to match
String nextFixed;
while (true) {
nexti++; // depends on control dependency: [while], data = [none]
if (nexti > macrosCount) {
nextFixed = null; // match to the end of line // depends on control dependency: [if], data = [none]
break;
}
nextFixed = fixed[nexti]; // depends on control dependency: [while], data = [none]
if (nextFixed.length() != 0) {
break;
}
// next fixed is an empty string, so skip the next macro.
}
// find next fixed string
int ndx;
if (nextFixed != null) {
ndx = actionPath.indexOf(nextFixed, offset); // depends on control dependency: [if], data = [(nextFixed]
} else {
ndx = actionPath.length(); // depends on control dependency: [if], data = [none]
}
if (ndx == -1) {
return null; // depends on control dependency: [if], data = [none]
}
String macroValue = actionPath.substring(offset, ndx);
values[i] = macroValue; // depends on control dependency: [while], data = [none]
if (match && patterns[i] != null) {
if (!matchValue(i, macroValue)) {
return null; // depends on control dependency: [if], data = [none]
}
}
if (nextFixed == null) {
offset = ndx; // depends on control dependency: [if], data = [none]
break;
}
// iterate
int nextFixedLength = nextFixed.length();
offset = ndx + nextFixedLength; // depends on control dependency: [while], data = [none]
i = nexti; // depends on control dependency: [while], data = [none]
}
if (offset != actionPath.length()) {
// action path is not consumed fully during this matching
return null; // depends on control dependency: [if], data = [none]
}
return values;
} }
|
public class class_name {
public int decodeType (String localtype)
{
if (ChatCodes.USER_CHAT_TYPE.equals(localtype)) {
return TELL;
} else if (ChatCodes.PLACE_CHAT_TYPE.equals(localtype)) {
return PLACE;
} else {
return 0;
}
} }
|
public class class_name {
public int decodeType (String localtype)
{
if (ChatCodes.USER_CHAT_TYPE.equals(localtype)) {
return TELL; // depends on control dependency: [if], data = [none]
} else if (ChatCodes.PLACE_CHAT_TYPE.equals(localtype)) {
return PLACE; // depends on control dependency: [if], data = [none]
} else {
return 0; // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public void entityProcessComplete(CAS aCas, EntityProcessStatus aStatus) {
// if there is an error above the individual document level,
// an entityProcessStatus is created with a null value for entity
if (aCas == null) {
for (int i = 0; i < aStatus.getFailedComponentNames().size(); i++) {
LOG.info("[{}] FailedComponentNames", aStatus
.getFailedComponentNames().get(i));
}
for (int i = 0; i < aStatus.getExceptions().size(); i++) {
LOG.info("[{}] Exceptions", aStatus.getExceptions().get(i));
}
return;
}
try {
entityCount++;
// FIXME int dataSize = 0;
// // get size here
// Type t = aCas.getTypeSystem().getType("uima.cpm.FileLocation");
// Feature f = t.getFeatureByBaseName("DocumentSize");
// FSIterator fsI = aCas.getAnnotationIndex(t).iterator();
// if (fsI.isValid()) {
// dataSize = fsI.get().getIntValue(f);
// }
//
// size += dataSize;
// to handle exceptions occured in any of the components for the
// entity
if (aStatus.isException()) {
for (int q = 0; q < aStatus.getExceptions().size(); q++) {
Exception e = (Exception) aStatus.getExceptions().get(q);
e.printStackTrace();
}
}
} catch (Exception io) {
UIMAFramework.getLogger(this.getClass()).log(Level.WARNING, "", io);
}
} }
|
public class class_name {
public void entityProcessComplete(CAS aCas, EntityProcessStatus aStatus) {
// if there is an error above the individual document level,
// an entityProcessStatus is created with a null value for entity
if (aCas == null) {
for (int i = 0; i < aStatus.getFailedComponentNames().size(); i++) {
LOG.info("[{}] FailedComponentNames", aStatus
.getFailedComponentNames().get(i)); // depends on control dependency: [for], data = [none]
}
for (int i = 0; i < aStatus.getExceptions().size(); i++) {
LOG.info("[{}] Exceptions", aStatus.getExceptions().get(i)); // depends on control dependency: [for], data = [i]
}
return; // depends on control dependency: [if], data = [none]
}
try {
entityCount++; // depends on control dependency: [try], data = [none]
// FIXME int dataSize = 0;
// // get size here
// Type t = aCas.getTypeSystem().getType("uima.cpm.FileLocation");
// Feature f = t.getFeatureByBaseName("DocumentSize");
// FSIterator fsI = aCas.getAnnotationIndex(t).iterator();
// if (fsI.isValid()) {
// dataSize = fsI.get().getIntValue(f);
// }
//
// size += dataSize;
// to handle exceptions occured in any of the components for the
// entity
if (aStatus.isException()) {
for (int q = 0; q < aStatus.getExceptions().size(); q++) {
Exception e = (Exception) aStatus.getExceptions().get(q);
e.printStackTrace(); // depends on control dependency: [for], data = [none]
}
}
} catch (Exception io) {
UIMAFramework.getLogger(this.getClass()).log(Level.WARNING, "", io);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public com.google.protobuf.ByteString getS() {
if (valueCase_ == 2) {
return (com.google.protobuf.ByteString) value_;
}
return com.google.protobuf.ByteString.EMPTY;
} }
|
public class class_name {
public com.google.protobuf.ByteString getS() {
if (valueCase_ == 2) {
return (com.google.protobuf.ByteString) value_; // depends on control dependency: [if], data = [none]
}
return com.google.protobuf.ByteString.EMPTY;
} }
|
public class class_name {
public static VehicleMessage deserialize(String data)
throws UnrecognizedMessageTypeException {
JsonObject root;
try {
JsonParser parser = new JsonParser();
root = parser.parse(data).getAsJsonObject();
} catch(JsonSyntaxException | IllegalStateException e) {
throw new UnrecognizedMessageTypeException(
"Unable to parse JSON from \"" + data + "\": " + e);
}
Set<String> fields = new HashSet<>();
for(Map.Entry<String, JsonElement> entry : root.entrySet()) {
fields.add(entry.getKey());
}
VehicleMessage message;
try {
if (CanMessage.containsRequiredFields(fields)) {
message = sGson.fromJson(root, CanMessage.class);
} else if (DiagnosticResponse.containsRequiredFields(fields)) {
message = sGson.fromJson(root, DiagnosticResponse.class);
} else if (Command.containsRequiredFields(fields)) {
message = sGson.fromJson(root, Command.class);
} else if (CommandResponse.containsRequiredFields(fields)) {
message = sGson.fromJson(root, CommandResponse.class);
if (((CommandResponse) message).getCommand() == null) {
/* Both CommandResponse and CustomCommandResponse have exact fields but different
keys. If Command(key) for CommandResponse can not be de-serialized then it
must be a CustomCommandResponse.
*/
message = sGson.fromJson(root, CustomCommandResponse.class);
}
} else if (EventedSimpleVehicleMessage.containsRequiredFields(fields)) {
message = sGson.fromJson(root, EventedSimpleVehicleMessage.class);
} else if (SimpleVehicleMessage.containsRequiredFields(fields)) {
message = sGson.fromJson(root, SimpleVehicleMessage.class);
} else if (NamedVehicleMessage.containsRequiredFields(fields)) {
message = sGson.fromJson(root, NamedVehicleMessage.class);
} else if (fields.contains(VehicleMessage.EXTRAS_KEY)) {
message = sGson.fromJson(root, VehicleMessage.class);
} else {
throw new UnrecognizedMessageTypeException(
"Unrecognized combination of fields: " + fields);
}
}catch (NumberFormatException e){
throw new UnrecognizedMessageTypeException(
"Unable to parse JSON from \"" + data + "\": " + e);
}
return message;
} }
|
public class class_name {
public static VehicleMessage deserialize(String data)
throws UnrecognizedMessageTypeException {
JsonObject root;
try {
JsonParser parser = new JsonParser();
root = parser.parse(data).getAsJsonObject();
} catch(JsonSyntaxException | IllegalStateException e) {
throw new UnrecognizedMessageTypeException(
"Unable to parse JSON from \"" + data + "\": " + e);
}
Set<String> fields = new HashSet<>();
for(Map.Entry<String, JsonElement> entry : root.entrySet()) {
fields.add(entry.getKey());
}
VehicleMessage message;
try {
if (CanMessage.containsRequiredFields(fields)) {
message = sGson.fromJson(root, CanMessage.class);
} else if (DiagnosticResponse.containsRequiredFields(fields)) {
message = sGson.fromJson(root, DiagnosticResponse.class);
} else if (Command.containsRequiredFields(fields)) {
message = sGson.fromJson(root, Command.class);
} else if (CommandResponse.containsRequiredFields(fields)) {
message = sGson.fromJson(root, CommandResponse.class);
if (((CommandResponse) message).getCommand() == null) {
/* Both CommandResponse and CustomCommandResponse have exact fields but different
keys. If Command(key) for CommandResponse can not be de-serialized then it
must be a CustomCommandResponse.
*/
message = sGson.fromJson(root, CustomCommandResponse.class); // depends on control dependency: [if], data = [none]
}
} else if (EventedSimpleVehicleMessage.containsRequiredFields(fields)) {
message = sGson.fromJson(root, EventedSimpleVehicleMessage.class);
} else if (SimpleVehicleMessage.containsRequiredFields(fields)) {
message = sGson.fromJson(root, SimpleVehicleMessage.class);
} else if (NamedVehicleMessage.containsRequiredFields(fields)) {
message = sGson.fromJson(root, NamedVehicleMessage.class);
} else if (fields.contains(VehicleMessage.EXTRAS_KEY)) {
message = sGson.fromJson(root, VehicleMessage.class);
} else {
throw new UnrecognizedMessageTypeException(
"Unrecognized combination of fields: " + fields);
}
}catch (NumberFormatException e){
throw new UnrecognizedMessageTypeException(
"Unable to parse JSON from \"" + data + "\": " + e);
}
return message;
} }
|
public class class_name {
public static void checkHeaderTypes(Map<String, Object> headers) {
if (headers.containsKey(IntegrationMessageHeaderAccessor.SEQUENCE_NUMBER)) {
String number = headers.get(IntegrationMessageHeaderAccessor.SEQUENCE_NUMBER).toString();
headers.put(IntegrationMessageHeaderAccessor.SEQUENCE_NUMBER, Integer.valueOf(number));
}
if (headers.containsKey(IntegrationMessageHeaderAccessor.SEQUENCE_SIZE)) {
String size = headers.get(IntegrationMessageHeaderAccessor.SEQUENCE_SIZE).toString();
headers.put(IntegrationMessageHeaderAccessor.SEQUENCE_SIZE, Integer.valueOf(size));
}
if (headers.containsKey(IntegrationMessageHeaderAccessor.PRIORITY)) {
String size = headers.get(IntegrationMessageHeaderAccessor.PRIORITY).toString();
headers.put(IntegrationMessageHeaderAccessor.PRIORITY, Integer.valueOf(size));
}
} }
|
public class class_name {
public static void checkHeaderTypes(Map<String, Object> headers) {
if (headers.containsKey(IntegrationMessageHeaderAccessor.SEQUENCE_NUMBER)) {
String number = headers.get(IntegrationMessageHeaderAccessor.SEQUENCE_NUMBER).toString();
headers.put(IntegrationMessageHeaderAccessor.SEQUENCE_NUMBER, Integer.valueOf(number)); // depends on control dependency: [if], data = [none]
}
if (headers.containsKey(IntegrationMessageHeaderAccessor.SEQUENCE_SIZE)) {
String size = headers.get(IntegrationMessageHeaderAccessor.SEQUENCE_SIZE).toString();
headers.put(IntegrationMessageHeaderAccessor.SEQUENCE_SIZE, Integer.valueOf(size)); // depends on control dependency: [if], data = [none]
}
if (headers.containsKey(IntegrationMessageHeaderAccessor.PRIORITY)) {
String size = headers.get(IntegrationMessageHeaderAccessor.PRIORITY).toString();
headers.put(IntegrationMessageHeaderAccessor.PRIORITY, Integer.valueOf(size)); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public synchronized void setMode(IndexerIoMode mode)
{
if (this.mode != mode)
{
log.info("Indexer io mode=" + mode);
this.mode = mode;
for (IndexerIoModeListener listener : listeners)
{
listener.onChangeMode(mode);
}
}
} }
|
public class class_name {
public synchronized void setMode(IndexerIoMode mode)
{
if (this.mode != mode)
{
log.info("Indexer io mode=" + mode); // depends on control dependency: [if], data = [mode)]
this.mode = mode; // depends on control dependency: [if], data = [none]
for (IndexerIoModeListener listener : listeners)
{
listener.onChangeMode(mode); // depends on control dependency: [for], data = [listener]
}
}
} }
|
public class class_name {
public <T> T notNull(final T object, final String message) {
if (object == null) {
failNull(message);
}
return object;
} }
|
public class class_name {
public <T> T notNull(final T object, final String message) {
if (object == null) {
failNull(message); // depends on control dependency: [if], data = [none]
}
return object;
} }
|
public class class_name {
public void makeAllRepeatUnlimited(int profileId, String client_uuid) {
PreparedStatement statement = null;
try (Connection sqlConnection = sqlService.getConnection()) {
statement = sqlConnection.prepareStatement(
"UPDATE " + Constants.DB_TABLE_REQUEST_RESPONSE +
" SET " + Constants.REQUEST_RESPONSE_REPEAT_NUMBER + " = ?" +
" WHERE " + Constants.GENERIC_PROFILE_ID + " = ?" +
" AND " + Constants.GENERIC_CLIENT_UUID + " = ?"
);
statement.setInt(1, -1);
statement.setInt(2, profileId);
statement.setString(3, client_uuid);
statement.executeUpdate();
} catch (SQLException e) {
e.printStackTrace();
} finally {
try {
if (statement != null) {
statement.close();
}
} catch (Exception e) {
}
}
} }
|
public class class_name {
public void makeAllRepeatUnlimited(int profileId, String client_uuid) {
PreparedStatement statement = null;
try (Connection sqlConnection = sqlService.getConnection()) {
statement = sqlConnection.prepareStatement(
"UPDATE " + Constants.DB_TABLE_REQUEST_RESPONSE +
" SET " + Constants.REQUEST_RESPONSE_REPEAT_NUMBER + " = ?" +
" WHERE " + Constants.GENERIC_PROFILE_ID + " = ?" +
" AND " + Constants.GENERIC_CLIENT_UUID + " = ?"
);
statement.setInt(1, -1);
statement.setInt(2, profileId);
statement.setString(3, client_uuid);
statement.executeUpdate();
} catch (SQLException e) {
e.printStackTrace();
} finally {
try {
if (statement != null) {
statement.close(); // depends on control dependency: [if], data = [none]
}
} catch (Exception e) {
} // depends on control dependency: [catch], data = [none]
}
} }
|
public class class_name {
public Message decodeProtobufMessage(String topic, byte[] payload){
Method parseMethod = allTopics ? messageParseMethodForAll : messageParseMethodByTopic.get(topic);
try {
return (Message) parseMethod.invoke(null, payload);
} catch (IllegalArgumentException e) {
throw new RuntimeException("Can't parse protobuf message, since parseMethod() is not callable. "
+ "Please check your protobuf version (this code works with protobuf >= 2.6.1)", e);
} catch (IllegalAccessException e) {
throw new RuntimeException("Can't parse protobuf message, since parseMethod() is not accessible. "
+ "Please check your protobuf version (this code works with protobuf >= 2.6.1)", e);
} catch (InvocationTargetException e) {
throw new RuntimeException("Error parsing protobuf message", e);
}
} }
|
public class class_name {
public Message decodeProtobufMessage(String topic, byte[] payload){
Method parseMethod = allTopics ? messageParseMethodForAll : messageParseMethodByTopic.get(topic);
try {
return (Message) parseMethod.invoke(null, payload); // depends on control dependency: [try], data = [none]
} catch (IllegalArgumentException e) {
throw new RuntimeException("Can't parse protobuf message, since parseMethod() is not callable. "
+ "Please check your protobuf version (this code works with protobuf >= 2.6.1)", e);
} catch (IllegalAccessException e) {
throw new RuntimeException("Can't parse protobuf message, since parseMethod() is not accessible. "
+ "Please check your protobuf version (this code works with protobuf >= 2.6.1)", e);
} catch (InvocationTargetException e) { // depends on control dependency: [catch], data = [none]
throw new RuntimeException("Error parsing protobuf message", e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
public int compareTo(java.util.Date o) {
if(o instanceof Timestamp) {
// When Timestamp instance compare it with a Timestamp
// Hence it is basically calling this.compareTo((Timestamp))o);
// Note typecasting is safe because o is instance of Timestamp
return compareTo((Timestamp)o);
} else {
// When Date doing a o.compareTo(this)
// will give wrong results.
Timestamp ts = new Timestamp(o.getTime());
return this.compareTo(ts);
}
} }
|
public class class_name {
public int compareTo(java.util.Date o) {
if(o instanceof Timestamp) {
// When Timestamp instance compare it with a Timestamp
// Hence it is basically calling this.compareTo((Timestamp))o);
// Note typecasting is safe because o is instance of Timestamp
return compareTo((Timestamp)o); // depends on control dependency: [if], data = [none]
} else {
// When Date doing a o.compareTo(this)
// will give wrong results.
Timestamp ts = new Timestamp(o.getTime());
return this.compareTo(ts); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public boolean contains(Object o) {
for(T e : elemArray) {
if((o == e) || ((o != null) && o.equals(e))) {
return true;
}
}
return false;
} }
|
public class class_name {
public boolean contains(Object o) {
for(T e : elemArray) {
if((o == e) || ((o != null) && o.equals(e))) {
return true; // depends on control dependency: [if], data = [none]
}
}
return false;
} }
|
public class class_name {
public Observable<ServiceResponse<List<TermList>>> getAllTermListsWithServiceResponseAsync() {
if (this.client.baseUrl() == null) {
throw new IllegalArgumentException("Parameter this.client.baseUrl() is required and cannot be null.");
}
String parameterizedHost = Joiner.on(", ").join("{baseUrl}", this.client.baseUrl());
return service.getAllTermLists(this.client.acceptLanguage(), parameterizedHost, this.client.userAgent())
.flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<List<TermList>>>>() {
@Override
public Observable<ServiceResponse<List<TermList>>> call(Response<ResponseBody> response) {
try {
ServiceResponse<List<TermList>> clientResponse = getAllTermListsDelegate(response);
return Observable.just(clientResponse);
} catch (Throwable t) {
return Observable.error(t);
}
}
});
} }
|
public class class_name {
public Observable<ServiceResponse<List<TermList>>> getAllTermListsWithServiceResponseAsync() {
if (this.client.baseUrl() == null) {
throw new IllegalArgumentException("Parameter this.client.baseUrl() is required and cannot be null.");
}
String parameterizedHost = Joiner.on(", ").join("{baseUrl}", this.client.baseUrl());
return service.getAllTermLists(this.client.acceptLanguage(), parameterizedHost, this.client.userAgent())
.flatMap(new Func1<Response<ResponseBody>, Observable<ServiceResponse<List<TermList>>>>() {
@Override
public Observable<ServiceResponse<List<TermList>>> call(Response<ResponseBody> response) {
try {
ServiceResponse<List<TermList>> clientResponse = getAllTermListsDelegate(response);
return Observable.just(clientResponse); // depends on control dependency: [try], data = [none]
} catch (Throwable t) {
return Observable.error(t);
} // depends on control dependency: [catch], data = [none]
}
});
} }
|
public class class_name {
public static boolean equalsAnyBottomElement(final LinkedList<String> stack, final String[] strs) {
ArgUtils.notNull(stack, "stack");
ArgUtils.notEmpty(strs, "strs");
if(stack.isEmpty()) {
return false;
}
final String bottom = stack.peekLast();
for(String str : strs) {
if(str.equals(bottom)) {
return true;
}
}
return false;
} }
|
public class class_name {
public static boolean equalsAnyBottomElement(final LinkedList<String> stack, final String[] strs) {
ArgUtils.notNull(stack, "stack");
ArgUtils.notEmpty(strs, "strs");
if(stack.isEmpty()) {
return false;
// depends on control dependency: [if], data = [none]
}
final String bottom = stack.peekLast();
for(String str : strs) {
if(str.equals(bottom)) {
return true;
// depends on control dependency: [if], data = [none]
}
}
return false;
} }
|
public class class_name {
public void process(CustomFieldContainer indicators, ProjectProperties properties, Props props)
{
m_container = indicators;
m_properties = properties;
m_data = props.getByteArray(Props.TASK_FIELD_ATTRIBUTES);
if (m_data != null)
{
int columnsCount = MPPUtility.getInt(m_data, 4);
m_headerOffset = 8;
for (int loop = 0; loop < columnsCount; loop++)
{
processColumns();
}
}
} }
|
public class class_name {
public void process(CustomFieldContainer indicators, ProjectProperties properties, Props props)
{
m_container = indicators;
m_properties = properties;
m_data = props.getByteArray(Props.TASK_FIELD_ATTRIBUTES);
if (m_data != null)
{
int columnsCount = MPPUtility.getInt(m_data, 4);
m_headerOffset = 8; // depends on control dependency: [if], data = [none]
for (int loop = 0; loop < columnsCount; loop++)
{
processColumns(); // depends on control dependency: [for], data = [none]
}
}
} }
|
public class class_name {
public final EObject entryRuleParameter() throws RecognitionException {
EObject current = null;
EObject iv_ruleParameter = null;
try {
// InternalSimpleAntlr.g:446:2: (iv_ruleParameter= ruleParameter EOF )
// InternalSimpleAntlr.g:447:2: iv_ruleParameter= ruleParameter EOF
{
if ( state.backtracking==0 ) {
newCompositeNode(grammarAccess.getParameterRule());
}
pushFollow(FOLLOW_1);
iv_ruleParameter=ruleParameter();
state._fsp--;
if (state.failed) return current;
if ( state.backtracking==0 ) {
current =iv_ruleParameter;
}
match(input,EOF,FOLLOW_2); if (state.failed) return current;
}
}
catch (RecognitionException re) {
recover(input,re);
appendSkippedTokens();
}
finally {
}
return current;
} }
|
public class class_name {
public final EObject entryRuleParameter() throws RecognitionException {
EObject current = null;
EObject iv_ruleParameter = null;
try {
// InternalSimpleAntlr.g:446:2: (iv_ruleParameter= ruleParameter EOF )
// InternalSimpleAntlr.g:447:2: iv_ruleParameter= ruleParameter EOF
{
if ( state.backtracking==0 ) {
newCompositeNode(grammarAccess.getParameterRule()); // depends on control dependency: [if], data = [none]
}
pushFollow(FOLLOW_1);
iv_ruleParameter=ruleParameter();
state._fsp--;
if (state.failed) return current;
if ( state.backtracking==0 ) {
current =iv_ruleParameter; // depends on control dependency: [if], data = [none]
}
match(input,EOF,FOLLOW_2); if (state.failed) return current;
}
}
catch (RecognitionException re) {
recover(input,re);
appendSkippedTokens();
}
finally {
}
return current;
} }
|
public class class_name {
private void commonConsoleLogHandlerUpdates() {
if (consoleLogHandler != null) {
consoleLogHandler.setBasicFormatter(formatter);
consoleLogHandler.setConsoleLogLevel(consoleLogLevel.intValue());
consoleLogHandler.setCopySystemStreams(copySystemStreams);
}
} }
|
public class class_name {
private void commonConsoleLogHandlerUpdates() {
if (consoleLogHandler != null) {
consoleLogHandler.setBasicFormatter(formatter); // depends on control dependency: [if], data = [none]
consoleLogHandler.setConsoleLogLevel(consoleLogLevel.intValue()); // depends on control dependency: [if], data = [none]
consoleLogHandler.setCopySystemStreams(copySystemStreams); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
public Set<Handler> getHandlers() {
modificationLock.readLock().lock();
try {
return new HashSet<>(handlers);
} finally {
modificationLock.readLock().unlock();
}
} }
|
public class class_name {
public Set<Handler> getHandlers() {
modificationLock.readLock().lock();
try {
return new HashSet<>(handlers); // depends on control dependency: [try], data = [none]
} finally {
modificationLock.readLock().unlock();
}
} }
|
public class class_name {
private static GeometryEncoder encoder(ITetrahedralChirality tc, Map<IAtom, Integer> atomToIndex) {
IAtom[] ligands = tc.getLigands();
int centre = atomToIndex.get(tc.getChiralAtom());
int[] indices = new int[4];
int offset = -1;
for (int i = 0; i < ligands.length; i++) {
indices[i] = atomToIndex.get(ligands[i]);
if (indices[i] == centre) offset = i;
}
// convert clockwise/anticlockwise to -1/+1
int parity = tc.getStereo() == CLOCKWISE ? -1 : 1;
// now if any atom is the centre (indicating an implicit
// hydrogen) we need to adjust the indicies and the parity
if (offset >= 0) {
// remove the 'implicit' central from the first 3 vertices
for (int i = offset; i < indices.length - 1; i++) {
indices[i] = indices[i + 1];
}
// we now take how many vertices we moved which is
// 3 (last index) minus the index where we started. if the
// value is odd we invert the parity (odd number of
// inversions)
if (Integer.lowestOneBit(3 - offset) == 0x1) parity *= -1;
// trim the array to size we don't include the last (implicit)
// vertex when checking the invariants
indices = Arrays.copyOf(indices, indices.length - 1);
}
return new GeometryEncoder(centre, new BasicPermutationParity(indices), GeometricParity.valueOf(parity));
} }
|
public class class_name {
private static GeometryEncoder encoder(ITetrahedralChirality tc, Map<IAtom, Integer> atomToIndex) {
IAtom[] ligands = tc.getLigands();
int centre = atomToIndex.get(tc.getChiralAtom());
int[] indices = new int[4];
int offset = -1;
for (int i = 0; i < ligands.length; i++) {
indices[i] = atomToIndex.get(ligands[i]); // depends on control dependency: [for], data = [i]
if (indices[i] == centre) offset = i;
}
// convert clockwise/anticlockwise to -1/+1
int parity = tc.getStereo() == CLOCKWISE ? -1 : 1;
// now if any atom is the centre (indicating an implicit
// hydrogen) we need to adjust the indicies and the parity
if (offset >= 0) {
// remove the 'implicit' central from the first 3 vertices
for (int i = offset; i < indices.length - 1; i++) {
indices[i] = indices[i + 1]; // depends on control dependency: [for], data = [i]
}
// we now take how many vertices we moved which is
// 3 (last index) minus the index where we started. if the
// value is odd we invert the parity (odd number of
// inversions)
if (Integer.lowestOneBit(3 - offset) == 0x1) parity *= -1;
// trim the array to size we don't include the last (implicit)
// vertex when checking the invariants
indices = Arrays.copyOf(indices, indices.length - 1); // depends on control dependency: [if], data = [none]
}
return new GeometryEncoder(centre, new BasicPermutationParity(indices), GeometricParity.valueOf(parity));
} }
|
public class class_name {
public static Result onBackground(Action action) {
final HandlerPoster poster = getBackgroundPoster();
if (Looper.myLooper() == poster.getLooper()) {
action.call();
return new ActionAsyncTask(action, true);
}
ActionAsyncTask task = new ActionAsyncTask(action);
poster.async(task);
return task;
} }
|
public class class_name {
public static Result onBackground(Action action) {
final HandlerPoster poster = getBackgroundPoster();
if (Looper.myLooper() == poster.getLooper()) {
action.call(); // depends on control dependency: [if], data = [none]
return new ActionAsyncTask(action, true); // depends on control dependency: [if], data = [none]
}
ActionAsyncTask task = new ActionAsyncTask(action);
poster.async(task);
return task;
} }
|
public class class_name {
public void marshall(UpdatePullRequestStatusRequest updatePullRequestStatusRequest, ProtocolMarshaller protocolMarshaller) {
if (updatePullRequestStatusRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(updatePullRequestStatusRequest.getPullRequestId(), PULLREQUESTID_BINDING);
protocolMarshaller.marshall(updatePullRequestStatusRequest.getPullRequestStatus(), PULLREQUESTSTATUS_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} }
|
public class class_name {
public void marshall(UpdatePullRequestStatusRequest updatePullRequestStatusRequest, ProtocolMarshaller protocolMarshaller) {
if (updatePullRequestStatusRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(updatePullRequestStatusRequest.getPullRequestId(), PULLREQUESTID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(updatePullRequestStatusRequest.getPullRequestStatus(), PULLREQUESTSTATUS_BINDING); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} }
|
public class class_name {
protected boolean evaluateLastAttemptAndSecondaryNotFound(RetryContext retryContext) {
Utility.assertNotNull("retryContext", retryContext);
// Retry interval of a request to a location must take the time spent sending requests
// to other locations into account. For example, assume a request was sent to the primary
// location first, then to the secondary, and then to the primary again. If it
// was supposed to wait 10 seconds between requests to the primary and the request to
// the secondary took 3 seconds in total, retry interval should only be 7 seconds. This is because,
// in total, the requests will be 10 seconds apart from the primary locations' point of view.
// For this calculation, current instance of the retry policy stores the time of the last
// request to a specific location.
if (retryContext.getLastRequestResult().getTargetLocation() == StorageLocation.PRIMARY) {
this.lastPrimaryAttempt = retryContext.getLastRequestResult().getStopDate();
}
else {
this.lastSecondaryAttempt = retryContext.getLastRequestResult().getStopDate();
}
// If a request sent to the secondary location fails with 404 (Not Found), it is possible
// that the the asynchronous geo-replication for the resource has not completed. So, in case of 404 only in the secondary
// location, the failure should still be retried.
return (retryContext.getLastRequestResult().getTargetLocation() == StorageLocation.SECONDARY)
&& (retryContext.getLastRequestResult().getStatusCode() == HttpURLConnection.HTTP_NOT_FOUND);
} }
|
public class class_name {
protected boolean evaluateLastAttemptAndSecondaryNotFound(RetryContext retryContext) {
Utility.assertNotNull("retryContext", retryContext);
// Retry interval of a request to a location must take the time spent sending requests
// to other locations into account. For example, assume a request was sent to the primary
// location first, then to the secondary, and then to the primary again. If it
// was supposed to wait 10 seconds between requests to the primary and the request to
// the secondary took 3 seconds in total, retry interval should only be 7 seconds. This is because,
// in total, the requests will be 10 seconds apart from the primary locations' point of view.
// For this calculation, current instance of the retry policy stores the time of the last
// request to a specific location.
if (retryContext.getLastRequestResult().getTargetLocation() == StorageLocation.PRIMARY) {
this.lastPrimaryAttempt = retryContext.getLastRequestResult().getStopDate(); // depends on control dependency: [if], data = [none]
}
else {
this.lastSecondaryAttempt = retryContext.getLastRequestResult().getStopDate(); // depends on control dependency: [if], data = [none]
}
// If a request sent to the secondary location fails with 404 (Not Found), it is possible
// that the the asynchronous geo-replication for the resource has not completed. So, in case of 404 only in the secondary
// location, the failure should still be retried.
return (retryContext.getLastRequestResult().getTargetLocation() == StorageLocation.SECONDARY)
&& (retryContext.getLastRequestResult().getStatusCode() == HttpURLConnection.HTTP_NOT_FOUND);
} }
|
public class class_name {
private boolean areClassesEqual(Class<?> c1, Class<?> c2) {
if (isMap(c1)) {
return isMap(c2);
} else if (isList(c1)) {
return isList(c2);
} else {
return c1.equals(c2);
}
} }
|
public class class_name {
private boolean areClassesEqual(Class<?> c1, Class<?> c2) {
if (isMap(c1)) {
return isMap(c2); // depends on control dependency: [if], data = [none]
} else if (isList(c1)) {
return isList(c2); // depends on control dependency: [if], data = [none]
} else {
return c1.equals(c2); // depends on control dependency: [if], data = [none]
}
} }
|
public class class_name {
private Action annotationToAction(Siren4JAction actionAnno, EntityContext context) throws Siren4JException {
ActionBuilder builder = ActionBuilder.newInstance();
builder.setName(actionAnno.name()).setHref(actionAnno.href()).setMethod(actionAnno.method());
if (ArrayUtils.isNotEmpty(actionAnno.actionClass())) {
builder.setComponentClass(actionAnno.actionClass());
}
if (StringUtils.isNotBlank(actionAnno.title())) {
builder.setTitle(actionAnno.title());
}
if (StringUtils.isNotBlank(actionAnno.type())) {
builder.setType(actionAnno.type());
}
if (ArrayUtils.isNotEmpty(actionAnno.fields())) {
for (Siren4JActionField f : actionAnno.fields()) {
builder.addField(annotationToField(f, context));
}
}
if (ArrayUtils.isNotEmpty(actionAnno.urlParams())) {
for (Siren4JActionField f : actionAnno.urlParams()) {
builder.addUrlParam(annotationToField(f, context));
}
}
if (ArrayUtils.isNotEmpty(actionAnno.headers())) {
for (Siren4JActionField f : actionAnno.headers()) {
builder.addHeader(annotationToField(f, context));
}
}
if(ArrayUtils.isNotEmpty(actionAnno.metaData())) {
Map<String, String> metaData = new HashMap();
for(Siren4JMetaData mdAnno : actionAnno.metaData()) {
metaData.put(mdAnno.key(), handleTokenReplacement(mdAnno.value(), context));
}
builder.setMetaData(metaData);
}
return builder.build();
} }
|
public class class_name {
private Action annotationToAction(Siren4JAction actionAnno, EntityContext context) throws Siren4JException {
ActionBuilder builder = ActionBuilder.newInstance();
builder.setName(actionAnno.name()).setHref(actionAnno.href()).setMethod(actionAnno.method());
if (ArrayUtils.isNotEmpty(actionAnno.actionClass())) {
builder.setComponentClass(actionAnno.actionClass());
}
if (StringUtils.isNotBlank(actionAnno.title())) {
builder.setTitle(actionAnno.title());
}
if (StringUtils.isNotBlank(actionAnno.type())) {
builder.setType(actionAnno.type());
}
if (ArrayUtils.isNotEmpty(actionAnno.fields())) {
for (Siren4JActionField f : actionAnno.fields()) {
builder.addField(annotationToField(f, context));
// depends on control dependency: [for], data = [f]
}
}
if (ArrayUtils.isNotEmpty(actionAnno.urlParams())) {
for (Siren4JActionField f : actionAnno.urlParams()) {
builder.addUrlParam(annotationToField(f, context));
// depends on control dependency: [for], data = [f]
}
}
if (ArrayUtils.isNotEmpty(actionAnno.headers())) {
for (Siren4JActionField f : actionAnno.headers()) {
builder.addHeader(annotationToField(f, context));
// depends on control dependency: [for], data = [f]
}
}
if(ArrayUtils.isNotEmpty(actionAnno.metaData())) {
Map<String, String> metaData = new HashMap();
for(Siren4JMetaData mdAnno : actionAnno.metaData()) {
metaData.put(mdAnno.key(), handleTokenReplacement(mdAnno.value(), context));
// depends on control dependency: [for], data = [mdAnno]
}
builder.setMetaData(metaData);
}
return builder.build();
} }
|
public class class_name {
private Map<String, Set<String>> getMinimalSetOfNodesForShardedQuery(String localNode, Map<String, Set<String>> clusterMap,
Set<String> queryClusters) {
//approximate algorithm, the problem is NP-complete
Map<String, Set<String>> result = new LinkedHashMap<>();
Set<String> uncovered = new HashSet<>();
uncovered.addAll(queryClusters);
uncovered = uncovered.stream().filter(x -> x != null).map(x -> x.toLowerCase(Locale.ENGLISH)).collect(Collectors.toSet());
//try local node first
Set<String> nextNodeClusters = new HashSet<>();
Set<String> clustersForNode = clusterMap.get(localNode);
if (clustersForNode != null) {
nextNodeClusters.addAll(clustersForNode);
}
nextNodeClusters.retainAll(uncovered);
if (nextNodeClusters.size() > 0) {
result.put(localNode, nextNodeClusters);
uncovered.removeAll(nextNodeClusters);
}
while (uncovered.size() > 0) {
String nextNode = findItemThatCoversMore(uncovered, clusterMap);
nextNodeClusters = new HashSet<>();
nextNodeClusters.addAll(clusterMap.get(nextNode));
nextNodeClusters.retainAll(uncovered);
if (nextNodeClusters.size() == 0) {
throw new OCommandExecutionException(
"Cannot execute a sharded query: clusters [" + uncovered.stream().collect(Collectors.joining(", "))
+ "] are not present on any node" + "\n [" + clusterMap.entrySet().stream()
.map(x -> "" + x.getKey() + ":(" + x.getValue().stream().collect(Collectors.joining(",")) + ")")
.collect(Collectors.joining(", ")) + "]");
}
result.put(nextNode, nextNodeClusters);
uncovered.removeAll(nextNodeClusters);
}
return result;
} }
|
public class class_name {
private Map<String, Set<String>> getMinimalSetOfNodesForShardedQuery(String localNode, Map<String, Set<String>> clusterMap,
Set<String> queryClusters) {
//approximate algorithm, the problem is NP-complete
Map<String, Set<String>> result = new LinkedHashMap<>();
Set<String> uncovered = new HashSet<>();
uncovered.addAll(queryClusters);
uncovered = uncovered.stream().filter(x -> x != null).map(x -> x.toLowerCase(Locale.ENGLISH)).collect(Collectors.toSet());
//try local node first
Set<String> nextNodeClusters = new HashSet<>();
Set<String> clustersForNode = clusterMap.get(localNode);
if (clustersForNode != null) {
nextNodeClusters.addAll(clustersForNode); // depends on control dependency: [if], data = [(clustersForNode]
}
nextNodeClusters.retainAll(uncovered);
if (nextNodeClusters.size() > 0) {
result.put(localNode, nextNodeClusters); // depends on control dependency: [if], data = [none]
uncovered.removeAll(nextNodeClusters); // depends on control dependency: [if], data = [none]
}
while (uncovered.size() > 0) {
String nextNode = findItemThatCoversMore(uncovered, clusterMap);
nextNodeClusters = new HashSet<>();
nextNodeClusters.addAll(clusterMap.get(nextNode));
nextNodeClusters.retainAll(uncovered);
if (nextNodeClusters.size() == 0) {
throw new OCommandExecutionException(
"Cannot execute a sharded query: clusters [" + uncovered.stream().collect(Collectors.joining(", "))
+ "] are not present on any node" + "\n [" + clusterMap.entrySet().stream()
.map(x -> "" + x.getKey() + ":(" + x.getValue().stream().collect(Collectors.joining(",")) + ")")
.collect(Collectors.joining(", ")) + "]");
}
result.put(nextNode, nextNodeClusters);
uncovered.removeAll(nextNodeClusters);
}
return result;
} }
|
public class class_name {
public boolean appendPrefix(int tl, int td, StringBuffer sb) {
if (dr.scopeData != null) {
int ix = tl * 3 + td;
ScopeData sd = dr.scopeData[ix];
if (sd != null) {
String prefix = sd.prefix;
if (prefix != null) {
sb.append(prefix);
return sd.requiresDigitPrefix;
}
}
}
return false;
} }
|
public class class_name {
public boolean appendPrefix(int tl, int td, StringBuffer sb) {
if (dr.scopeData != null) {
int ix = tl * 3 + td;
ScopeData sd = dr.scopeData[ix];
if (sd != null) {
String prefix = sd.prefix;
if (prefix != null) {
sb.append(prefix); // depends on control dependency: [if], data = [(prefix]
return sd.requiresDigitPrefix; // depends on control dependency: [if], data = [none]
}
}
}
return false;
} }
|
public class class_name {
@Override
public EDataType getDataHandler() {
if (dataHandlerEDataType == null) {
dataHandlerEDataType = (EDataType) EPackage.Registry.INSTANCE.getEPackage(StorePackage.eNS_URI).getEClassifiers().get(16);
}
return dataHandlerEDataType;
} }
|
public class class_name {
@Override
public EDataType getDataHandler() {
if (dataHandlerEDataType == null) {
dataHandlerEDataType = (EDataType) EPackage.Registry.INSTANCE.getEPackage(StorePackage.eNS_URI).getEClassifiers().get(16);
// depends on control dependency: [if], data = [none]
}
return dataHandlerEDataType;
} }
|
public class class_name {
@Override
public void handleOperation(Exchange exchange, KnowledgeOperation operation) throws HandlerException {
// Long sessionIdentifier = null;
Message inputMessage = exchange.getMessage();
ExchangePattern exchangePattern = exchange.getContract().getProviderOperation().getExchangePattern();
Map<String, Object> expressionVariables = new HashMap<String, Object>();
RulesOperationType operationType = (RulesOperationType)operation.getType();
switch (operationType) {
case EXECUTE: {
KnowledgeRuntimeEngine runtime = getPerRequestRuntimeEngine();
if (runtime.isRemote()) {
throw new UnsupportedOperationException("Remote rules integration is not yet supported.");
}
// sessionIdentifier = runtime.getSessionIdentifier();
setGlobals(inputMessage, operation, runtime, false);
try {
KieSession session = runtime.getKieSession();
if (ExchangePattern.IN_ONLY.equals(exchangePattern)) {
List<Object> facts = getInputList(inputMessage, operation, runtime);
for (Object fact : facts) {
session.insert(fact);
}
session.fireAllRules();
} else if (ExchangePattern.IN_OUT.equals(exchangePattern)) {
KieCommands cmds = KieServices.Factory.get().getCommands();
List<Command<?>> batch = new ArrayList<Command<?>>();
Map<String, Object> inouts = getInputOutputMap(inputMessage, operation, runtime);
for (Entry<String, Object> inout : inouts.entrySet()) {
batch.add(cmds.newInsert(inout.getValue(), inout.getKey()));
}
List<Object> facts = getInputOnlyList(inputMessage, operation, runtime);
batch.add(cmds.newInsertElements(facts));
batch.add(cmds.newFireAllRules());
BatchExecutionCommand exec = cmds.newBatchExecution(batch, KnowledgeConstants.RESULT);
ExecutionResults results = session.execute(exec);
for (String id : inouts.keySet()) {
expressionVariables.put(id, results.getValue(id));
}
expressionVariables.putAll(getGlobalVariables(runtime));
}
} finally {
disposePerRequestRuntimeEngine(runtime);
}
break;
}
case INSERT:
case FIRE_ALL_RULES: {
KnowledgeRuntimeEngine runtime = getSingletonRuntimeEngine();
if (runtime.isRemote()) {
throw new UnsupportedOperationException("Remote rules integration is not yet supported.");
}
if (ExchangePattern.IN_OUT.equals(exchangePattern)) {
synchronized (this) {
fireAllRules(inputMessage, operation);
expressionVariables.putAll(getGlobalVariables(runtime));
}
} else {
if (KnowledgeOperations.containsGlobals(inputMessage, operation, runtime)) {
synchronized (this) {
fireAllRules(inputMessage, operation);
}
} else {
fireAllRules(inputMessage, operation);
}
}
if (isDispose(exchange, inputMessage)) {
disposeSingletonRuntimeEngine();
}
break;
}
case FIRE_UNTIL_HALT: {
KnowledgeRuntimeEngine runtime = getSingletonRuntimeEngine();
if (runtime.isRemote()) {
throw new UnsupportedOperationException("Remote rules integration is not yet supported.");
}
if (ExchangePattern.IN_OUT.equals(exchangePattern)) {
synchronized (this) {
fireUntilHalt(inputMessage, exchange, operation);
expressionVariables.putAll(getGlobalVariables(runtime));
}
} else {
if (KnowledgeOperations.containsGlobals(inputMessage, operation, runtime)) {
synchronized (this) {
fireUntilHalt(inputMessage, exchange, operation);
}
} else {
fireUntilHalt(inputMessage, exchange, operation);
}
}
if (isDispose(exchange, inputMessage)) {
disposeSingletonRuntimeEngine();
}
break;
}
default: {
throw RulesMessages.MESSAGES.unsupportedOperationType(operationType.toString());
}
}
if (ExchangePattern.IN_OUT.equals(exchangePattern)) {
Message outputMessage = exchange.createMessage();
/*
* Context outputContext = exchange.getContext(outputMessage);
* if (sessionIdentifier != null) {
* outputContext.setProperty(RulesConstants.SESSION_ID_PROPERTY, sessionIdentifier);
* }
*/
setFaults(outputMessage, operation, expressionVariables);
if (outputMessage.getContent() != null) {
exchange.sendFault(outputMessage);
} else {
setOutputs(outputMessage, operation, expressionVariables);
exchange.send(outputMessage);
}
}
} }
|
public class class_name {
@Override
public void handleOperation(Exchange exchange, KnowledgeOperation operation) throws HandlerException {
// Long sessionIdentifier = null;
Message inputMessage = exchange.getMessage();
ExchangePattern exchangePattern = exchange.getContract().getProviderOperation().getExchangePattern();
Map<String, Object> expressionVariables = new HashMap<String, Object>();
RulesOperationType operationType = (RulesOperationType)operation.getType();
switch (operationType) {
case EXECUTE: {
KnowledgeRuntimeEngine runtime = getPerRequestRuntimeEngine();
if (runtime.isRemote()) {
throw new UnsupportedOperationException("Remote rules integration is not yet supported.");
}
// sessionIdentifier = runtime.getSessionIdentifier();
setGlobals(inputMessage, operation, runtime, false);
try {
KieSession session = runtime.getKieSession();
if (ExchangePattern.IN_ONLY.equals(exchangePattern)) {
List<Object> facts = getInputList(inputMessage, operation, runtime);
for (Object fact : facts) {
session.insert(fact); // depends on control dependency: [for], data = [fact]
}
session.fireAllRules(); // depends on control dependency: [if], data = [none]
} else if (ExchangePattern.IN_OUT.equals(exchangePattern)) {
KieCommands cmds = KieServices.Factory.get().getCommands();
List<Command<?>> batch = new ArrayList<Command<?>>(); // depends on control dependency: [if], data = [none]
Map<String, Object> inouts = getInputOutputMap(inputMessage, operation, runtime);
for (Entry<String, Object> inout : inouts.entrySet()) {
batch.add(cmds.newInsert(inout.getValue(), inout.getKey())); // depends on control dependency: [for], data = [inout]
}
List<Object> facts = getInputOnlyList(inputMessage, operation, runtime);
batch.add(cmds.newInsertElements(facts)); // depends on control dependency: [if], data = [none]
batch.add(cmds.newFireAllRules()); // depends on control dependency: [if], data = [none]
BatchExecutionCommand exec = cmds.newBatchExecution(batch, KnowledgeConstants.RESULT);
ExecutionResults results = session.execute(exec);
for (String id : inouts.keySet()) {
expressionVariables.put(id, results.getValue(id)); // depends on control dependency: [for], data = [id]
}
expressionVariables.putAll(getGlobalVariables(runtime)); // depends on control dependency: [if], data = [none]
}
} finally {
disposePerRequestRuntimeEngine(runtime);
}
break;
}
case INSERT:
case FIRE_ALL_RULES: {
KnowledgeRuntimeEngine runtime = getSingletonRuntimeEngine();
if (runtime.isRemote()) {
throw new UnsupportedOperationException("Remote rules integration is not yet supported.");
}
if (ExchangePattern.IN_OUT.equals(exchangePattern)) {
synchronized (this) {
fireAllRules(inputMessage, operation);
expressionVariables.putAll(getGlobalVariables(runtime));
}
} else {
if (KnowledgeOperations.containsGlobals(inputMessage, operation, runtime)) {
synchronized (this) {
fireAllRules(inputMessage, operation);
}
} else {
fireAllRules(inputMessage, operation);
}
}
if (isDispose(exchange, inputMessage)) {
disposeSingletonRuntimeEngine();
}
break;
}
case FIRE_UNTIL_HALT: {
KnowledgeRuntimeEngine runtime = getSingletonRuntimeEngine();
if (runtime.isRemote()) {
throw new UnsupportedOperationException("Remote rules integration is not yet supported.");
}
if (ExchangePattern.IN_OUT.equals(exchangePattern)) {
synchronized (this) {
fireUntilHalt(inputMessage, exchange, operation);
expressionVariables.putAll(getGlobalVariables(runtime));
}
} else {
if (KnowledgeOperations.containsGlobals(inputMessage, operation, runtime)) {
synchronized (this) {
fireUntilHalt(inputMessage, exchange, operation);
}
} else {
fireUntilHalt(inputMessage, exchange, operation);
}
}
if (isDispose(exchange, inputMessage)) {
disposeSingletonRuntimeEngine();
}
break;
}
default: {
throw RulesMessages.MESSAGES.unsupportedOperationType(operationType.toString());
}
}
if (ExchangePattern.IN_OUT.equals(exchangePattern)) {
Message outputMessage = exchange.createMessage();
/*
* Context outputContext = exchange.getContext(outputMessage);
* if (sessionIdentifier != null) {
* outputContext.setProperty(RulesConstants.SESSION_ID_PROPERTY, sessionIdentifier);
* }
*/
setFaults(outputMessage, operation, expressionVariables);
if (outputMessage.getContent() != null) {
exchange.sendFault(outputMessage);
} else {
setOutputs(outputMessage, operation, expressionVariables);
exchange.send(outputMessage);
}
}
} }
|
public class class_name {
public void reportFailure(E failureException) {
assert failureException != null;
connectionLock.lock();
try {
state = State.Failure;
this.failureException = failureException;
condition.signalAll();
}
finally {
connectionLock.unlock();
}
} }
|
public class class_name {
public void reportFailure(E failureException) {
assert failureException != null;
connectionLock.lock();
try {
state = State.Failure; // depends on control dependency: [try], data = [none]
this.failureException = failureException; // depends on control dependency: [try], data = [none]
condition.signalAll(); // depends on control dependency: [try], data = [none]
}
finally {
connectionLock.unlock();
}
} }
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.