code stringlengths 130 281k | code_dependency stringlengths 182 306k |
|---|---|
public class class_name {
public void killAllProcesses( long blockTimeMS ) {
// remove already dead processes from the GUI
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
DefaultListModel model = (DefaultListModel)processList.getModel();
for (int i = model.size()-1; i >= 0; i--) {
ActiveProcess p = (ActiveProcess)model.get(i);
removeProcessTab(p,false);
}
}
});
// kill processes that are already running
synchronized (processes) {
for (int i = 0; i < processes.size(); i++) {
processes.get(i).requestKill();
}
}
// block until everything is dead
if( blockTimeMS > 0 ) {
long abortTime = System.currentTimeMillis()+blockTimeMS;
while( abortTime > System.currentTimeMillis() ) {
int total = 0;
synchronized (processes) {
for (int i = 0; i < processes.size(); i++) {
if (!processes.get(i).isActive()) {
total++;
}
}
if( processes.size() == total ) {
break;
}
}
}
}
} } | public class class_name {
public void killAllProcesses( long blockTimeMS ) {
// remove already dead processes from the GUI
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
DefaultListModel model = (DefaultListModel)processList.getModel();
for (int i = model.size()-1; i >= 0; i--) {
ActiveProcess p = (ActiveProcess)model.get(i);
removeProcessTab(p,false); // depends on control dependency: [for], data = [none]
}
}
});
// kill processes that are already running
synchronized (processes) {
for (int i = 0; i < processes.size(); i++) {
processes.get(i).requestKill(); // depends on control dependency: [for], data = [i]
}
}
// block until everything is dead
if( blockTimeMS > 0 ) {
long abortTime = System.currentTimeMillis()+blockTimeMS;
while( abortTime > System.currentTimeMillis() ) {
int total = 0;
synchronized (processes) { // depends on control dependency: [while], data = [none]
for (int i = 0; i < processes.size(); i++) {
if (!processes.get(i).isActive()) {
total++; // depends on control dependency: [if], data = [none]
}
}
if( processes.size() == total ) {
break;
}
}
}
}
} } |
public class class_name {
public void putCacheField()
{
try {
Record record = this.getOwner();
Object objKey = record.getHandle(DBConstants.OBJECT_ID_HANDLE);
m_hsCache.add(objKey);
} catch (DBException ex) {
ex.printStackTrace();
}
} } | public class class_name {
public void putCacheField()
{
try {
Record record = this.getOwner();
Object objKey = record.getHandle(DBConstants.OBJECT_ID_HANDLE);
m_hsCache.add(objKey); // depends on control dependency: [try], data = [none]
} catch (DBException ex) {
ex.printStackTrace();
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
private void handleOnVisibleMenuItemsWidthChanged(int menuItemsWidth) {
if (menuItemsWidth == 0) {
mClearButton.setTranslationX(-Util.dpToPx(4));
int paddingRight = Util.dpToPx(4);
if (mIsFocused) {
paddingRight += Util.dpToPx(CLEAR_BTN_WIDTH_DP);
} else {
paddingRight += Util.dpToPx(14);
}
mSearchInput.setPadding(0, 0, paddingRight, 0);
} else {
mClearButton.setTranslationX(-menuItemsWidth);
int paddingRight = menuItemsWidth;
if (mIsFocused) {
paddingRight += Util.dpToPx(CLEAR_BTN_WIDTH_DP);
}
mSearchInput.setPadding(0, 0, paddingRight, 0);
}
} } | public class class_name {
private void handleOnVisibleMenuItemsWidthChanged(int menuItemsWidth) {
if (menuItemsWidth == 0) {
mClearButton.setTranslationX(-Util.dpToPx(4)); // depends on control dependency: [if], data = [none]
int paddingRight = Util.dpToPx(4);
if (mIsFocused) {
paddingRight += Util.dpToPx(CLEAR_BTN_WIDTH_DP); // depends on control dependency: [if], data = [none]
} else {
paddingRight += Util.dpToPx(14); // depends on control dependency: [if], data = [none]
}
mSearchInput.setPadding(0, 0, paddingRight, 0); // depends on control dependency: [if], data = [0)]
} else {
mClearButton.setTranslationX(-menuItemsWidth); // depends on control dependency: [if], data = [none]
int paddingRight = menuItemsWidth;
if (mIsFocused) {
paddingRight += Util.dpToPx(CLEAR_BTN_WIDTH_DP); // depends on control dependency: [if], data = [none]
}
mSearchInput.setPadding(0, 0, paddingRight, 0); // depends on control dependency: [if], data = [0)]
}
} } |
public class class_name {
static public Enumeration<CommPortIdentifier> getPortIdentifiers() {
LOGGER.fine("static CommPortIdentifier:getPortIdentifiers()");
//Do not allow anybody get any ports while we are re-initializing
//because the CommPortIndex points to invalid instances during that time
synchronized (Sync) {
//Remember old ports in order to restore them for ownership events later
HashMap oldPorts = new HashMap();
CommPortIdentifier p = CommPortIndex;
while (p != null) {
oldPorts.put(p.portName, p);
p = p.next;
}
CommPortIndex = null;
try {
//Initialize RXTX: This leads to detecting all ports
//and writing them into our CommPortIndex through our method
//{@link #addPortName(java.lang.String, int, gnu.io.CommDriver)}
//This works while lock on Sync is held
CommDriver RXTXDriver = (CommDriver) Class.forName("gnu.io.RXTXCommDriver").newInstance();
RXTXDriver.initialize();
//Restore old CommPortIdentifier objects where possible,
//in order to support proper ownership event handling.
//Clients might still have references to old identifiers!
CommPortIdentifier curPort = CommPortIndex;
CommPortIdentifier prevPort = null;
while (curPort != null) {
CommPortIdentifier matchingOldPort = (CommPortIdentifier) oldPorts.get(curPort.portName);
if (matchingOldPort != null && matchingOldPort.portType == curPort.portType) {
//replace new port by old one
matchingOldPort.RXTXDriver = curPort.RXTXDriver;
matchingOldPort.next = curPort.next;
if (prevPort == null) {
CommPortIndex = matchingOldPort;
} else {
prevPort.next = matchingOldPort;
}
prevPort = matchingOldPort;
} else {
prevPort = curPort;
}
curPort = curPort.next;
}
} catch (Throwable e) {
System.err.println(e + " thrown while loading " + "gnu.io.RXTXCommDriver");
System.err.flush();
}
}
return new CommPortEnumerator();
} } | public class class_name {
static public Enumeration<CommPortIdentifier> getPortIdentifiers() {
LOGGER.fine("static CommPortIdentifier:getPortIdentifiers()");
//Do not allow anybody get any ports while we are re-initializing
//because the CommPortIndex points to invalid instances during that time
synchronized (Sync) {
//Remember old ports in order to restore them for ownership events later
HashMap oldPorts = new HashMap();
CommPortIdentifier p = CommPortIndex;
while (p != null) {
oldPorts.put(p.portName, p); // depends on control dependency: [while], data = [(p]
p = p.next; // depends on control dependency: [while], data = [none]
}
CommPortIndex = null;
try {
//Initialize RXTX: This leads to detecting all ports
//and writing them into our CommPortIndex through our method
//{@link #addPortName(java.lang.String, int, gnu.io.CommDriver)}
//This works while lock on Sync is held
CommDriver RXTXDriver = (CommDriver) Class.forName("gnu.io.RXTXCommDriver").newInstance();
RXTXDriver.initialize(); // depends on control dependency: [try], data = [none]
//Restore old CommPortIdentifier objects where possible,
//in order to support proper ownership event handling.
//Clients might still have references to old identifiers!
CommPortIdentifier curPort = CommPortIndex;
CommPortIdentifier prevPort = null;
while (curPort != null) {
CommPortIdentifier matchingOldPort = (CommPortIdentifier) oldPorts.get(curPort.portName);
if (matchingOldPort != null && matchingOldPort.portType == curPort.portType) {
//replace new port by old one
matchingOldPort.RXTXDriver = curPort.RXTXDriver; // depends on control dependency: [if], data = [none]
matchingOldPort.next = curPort.next; // depends on control dependency: [if], data = [none]
if (prevPort == null) {
CommPortIndex = matchingOldPort; // depends on control dependency: [if], data = [none]
} else {
prevPort.next = matchingOldPort; // depends on control dependency: [if], data = [none]
}
prevPort = matchingOldPort; // depends on control dependency: [if], data = [none]
} else {
prevPort = curPort; // depends on control dependency: [if], data = [none]
}
curPort = curPort.next; // depends on control dependency: [while], data = [none]
}
} catch (Throwable e) {
System.err.println(e + " thrown while loading " + "gnu.io.RXTXCommDriver");
System.err.flush();
} // depends on control dependency: [catch], data = [none]
}
return new CommPortEnumerator();
} } |
public class class_name {
private boolean setChild1(N newChild) {
if (this.child1 == newChild) {
return false;
}
if (this.child1 != null) {
this.child1.setParentNodeReference(null, true);
--this.notNullChildCount;
firePropertyChildRemoved(0, this.child1);
}
if (newChild != null) {
final N oldParent = newChild.getParentNode();
if (oldParent != this) {
newChild.removeFromParent();
}
}
this.child1 = newChild;
if (newChild != null) {
newChild.setParentNodeReference(toN(), true);
++this.notNullChildCount;
firePropertyChildAdded(0, newChild);
}
return true;
} } | public class class_name {
private boolean setChild1(N newChild) {
if (this.child1 == newChild) {
return false; // depends on control dependency: [if], data = [none]
}
if (this.child1 != null) {
this.child1.setParentNodeReference(null, true); // depends on control dependency: [if], data = [none]
--this.notNullChildCount; // depends on control dependency: [if], data = [none]
firePropertyChildRemoved(0, this.child1); // depends on control dependency: [if], data = [none]
}
if (newChild != null) {
final N oldParent = newChild.getParentNode();
if (oldParent != this) {
newChild.removeFromParent(); // depends on control dependency: [if], data = [none]
}
}
this.child1 = newChild;
if (newChild != null) {
newChild.setParentNodeReference(toN(), true); // depends on control dependency: [if], data = [none]
++this.notNullChildCount; // depends on control dependency: [if], data = [none]
firePropertyChildAdded(0, newChild); // depends on control dependency: [if], data = [none]
}
return true;
} } |
public class class_name {
public static List<Kontonummer> getKontonummerListForAccountType(String accountType, int length) {
KontonummerValidator.validateAccountTypeSyntax(accountType);
final class AccountTypeKontonrDigitGenerator extends KontonummerDigitGenerator {
private final String accountType;
AccountTypeKontonrDigitGenerator(String accountType) {
this.accountType = accountType;
}
@Override
String generateKontonummer() {
StringBuilder kontonrBuffer = new StringBuilder(LENGTH);
for (int i = 0; i < LENGTH;) {
if (i == ACCOUNTTYPE_START_DIGIT) {
kontonrBuffer.append(accountType);
i += accountType.length();
} else {
kontonrBuffer.append((int) (Math.random() * 10));
i++;
}
}
return kontonrBuffer.toString();
}
}
return getKontonummerListUsingGenerator(new AccountTypeKontonrDigitGenerator(accountType), length);
} } | public class class_name {
public static List<Kontonummer> getKontonummerListForAccountType(String accountType, int length) {
KontonummerValidator.validateAccountTypeSyntax(accountType);
final class AccountTypeKontonrDigitGenerator extends KontonummerDigitGenerator {
private final String accountType;
AccountTypeKontonrDigitGenerator(String accountType) {
this.accountType = accountType;
}
@Override
String generateKontonummer() {
StringBuilder kontonrBuffer = new StringBuilder(LENGTH);
for (int i = 0; i < LENGTH;) {
if (i == ACCOUNTTYPE_START_DIGIT) {
kontonrBuffer.append(accountType);
// depends on control dependency: [if], data = [none]
i += accountType.length();
// depends on control dependency: [if], data = [none]
} else {
kontonrBuffer.append((int) (Math.random() * 10));
// depends on control dependency: [if], data = [(i]
i++;
// depends on control dependency: [if], data = [none]
}
}
return kontonrBuffer.toString();
}
}
return getKontonummerListUsingGenerator(new AccountTypeKontonrDigitGenerator(accountType), length);
} } |
public class class_name {
public void endDocument() throws org.xml.sax.SAXException
{
flushPending();
if (m_doIndent && !m_isprevtext)
{
try
{
outputLineSep();
}
catch(IOException e)
{
throw new SAXException(e);
}
}
flushWriter();
if (m_tracer != null)
super.fireEndDoc();
} } | public class class_name {
public void endDocument() throws org.xml.sax.SAXException
{
flushPending();
if (m_doIndent && !m_isprevtext)
{
try
{
outputLineSep(); // depends on control dependency: [try], data = [none]
}
catch(IOException e)
{
throw new SAXException(e);
} // depends on control dependency: [catch], data = [none]
}
flushWriter();
if (m_tracer != null)
super.fireEndDoc();
} } |
public class class_name {
void writeCoreInDirectory(String dir, String fwk) {
if (dir != null) { // if developper specify a directory for get js we write them too inside jsdir
fws.copyResourceToDir(ProcessorConstants.SEPARATORCHAR + "js", getFilename("core", fwk), dir);
}
} } | public class class_name {
void writeCoreInDirectory(String dir, String fwk) {
if (dir != null) { // if developper specify a directory for get js we write them too inside jsdir
fws.copyResourceToDir(ProcessorConstants.SEPARATORCHAR + "js", getFilename("core", fwk), dir);
// depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
@Override
public void setZ(double min, double max) {
if (min <= max) {
this.minzProperty.set(min);
this.maxzProperty.set(max);
} else {
this.minzProperty.set(max);
this.maxzProperty.set(min);
}
} } | public class class_name {
@Override
public void setZ(double min, double max) {
if (min <= max) {
this.minzProperty.set(min); // depends on control dependency: [if], data = [(min]
this.maxzProperty.set(max); // depends on control dependency: [if], data = [none]
} else {
this.minzProperty.set(max); // depends on control dependency: [if], data = [none]
this.maxzProperty.set(min); // depends on control dependency: [if], data = [(min]
}
} } |
public class class_name {
public String toQueryString(Criteria criteria, CriteriaQueryBuilder queryBuilder) {
// query builder
StringBuilder builder = new StringBuilder();
// build the basic query
builder.append( queryBuilder.getAbsolutePath(criteria, relativePath) );
builder.append( " IN (");
// We must add each value as a parameter, because not all JPA
// implementations allow lists or arrays as parameters.
if( values != null ) {
for( int i = 0; i < values.length; i++) {
builder.append( queryBuilder.createPositionalParameter() );
if( i < values.length - 1 ) {
builder.append(',');
}
}
}
builder.append(")");
// return result
return builder.toString();
} } | public class class_name {
public String toQueryString(Criteria criteria, CriteriaQueryBuilder queryBuilder) {
// query builder
StringBuilder builder = new StringBuilder();
// build the basic query
builder.append( queryBuilder.getAbsolutePath(criteria, relativePath) );
builder.append( " IN (");
// We must add each value as a parameter, because not all JPA
// implementations allow lists or arrays as parameters.
if( values != null ) {
for( int i = 0; i < values.length; i++) {
builder.append( queryBuilder.createPositionalParameter() ); // depends on control dependency: [for], data = [none]
if( i < values.length - 1 ) {
builder.append(','); // depends on control dependency: [if], data = [none]
}
}
}
builder.append(")");
// return result
return builder.toString();
} } |
public class class_name {
private String uniqueKey(String key) {
boolean generateOne = false;
key = StringUtil.trimToNull(key);
if (key == null) {
generateOne = true;
} else if (clauses.containsKey(key.toLowerCase())) {
generateOne = true;
}
while (generateOne) {
key = StringUtil.leftPad(new BigInteger(50, random).toString(32), 6).replace(" ", "0").substring(0,6);
generateOne = clauses.containsKey(key);
}
return key;
} } | public class class_name {
private String uniqueKey(String key) {
boolean generateOne = false;
key = StringUtil.trimToNull(key);
if (key == null) {
generateOne = true; // depends on control dependency: [if], data = [none]
} else if (clauses.containsKey(key.toLowerCase())) {
generateOne = true; // depends on control dependency: [if], data = [none]
}
while (generateOne) {
key = StringUtil.leftPad(new BigInteger(50, random).toString(32), 6).replace(" ", "0").substring(0,6); // depends on control dependency: [while], data = [none]
generateOne = clauses.containsKey(key); // depends on control dependency: [while], data = [none]
}
return key;
} } |
public class class_name {
protected void specificHelp(AsciiTable at, String toHelp){
if(this.skbShell.getCommandMap().containsKey(toHelp)){
//we have a command to show help for, collect all information and present help
SkbShellCommand ssc = this.skbShell.getCommandMap().get(toHelp).getCommands().get(toHelp);
TreeMap<String, SkbShellArgument> args = new TreeMap<>();
if(ssc.getArguments()!=null){
for(SkbShellArgument ssa : ssc.getArguments()){
if(ssa.isOptional()){
args.put("[" + ssa.getKey() + "]", ssa);
}
else{
args.put("<" + ssa.getKey() + ">", ssa);
}
}
}
at.addRow(ssc.getCommand(), new StrBuilder().appendWithSeparators(args.keySet(), ", "));
at.addRow("", ssc.getDescription());
for(SkbShellArgument ssa : args.values()){
if(ssa.valueSet()!=null && ssa.addedHelp()!=null){
at.addRow("", FormattingTupleWrapper.create(" -- <{}> of type {} - {} - {} - value set {}", ssa.getKey(), ssa.getType().name(), ssa.getDescription(), ssa.addedHelp(), ArrayUtils.toString(ssa.valueSet())));
}
else if(ssa.valueSet()!=null && ssa.addedHelp()==null){
at.addRow("", FormattingTupleWrapper.create(" -- <{}> of type {} - {} - value set {}", ssa.getKey(), ssa.getType().name(), ssa.getDescription(), ArrayUtils.toString(ssa.valueSet())));
}
else if(ssa.valueSet()==null && ssa.addedHelp()!=null){
at.addRow("", FormattingTupleWrapper.create(" -- <{}> of type {} - {} - {}", ssa.getKey(), ssa.getType().name(), ssa.getDescription(), ssa.addedHelp()));
}
else{
at.addRow("", FormattingTupleWrapper.create(" -- <{}> of type {} - {}", ssa.getKey(), ssa.getType().name(), ssa.getDescription()));
}
}
if(ssc.addedHelp()!=null){
at.addRow("", ssc.addedHelp());
}
}
else{
MessageConsole.conInfo("");
MessageConsole.conInfo("{}: no command {} found for help, try 'help' to see all available commands", new Object[]{this.skbShell.getPromptName(), toHelp});
}
} } | public class class_name {
protected void specificHelp(AsciiTable at, String toHelp){
if(this.skbShell.getCommandMap().containsKey(toHelp)){
//we have a command to show help for, collect all information and present help
SkbShellCommand ssc = this.skbShell.getCommandMap().get(toHelp).getCommands().get(toHelp);
TreeMap<String, SkbShellArgument> args = new TreeMap<>();
if(ssc.getArguments()!=null){
for(SkbShellArgument ssa : ssc.getArguments()){
if(ssa.isOptional()){
args.put("[" + ssa.getKey() + "]", ssa); // depends on control dependency: [if], data = [none]
}
else{
args.put("<" + ssa.getKey() + ">", ssa); // depends on control dependency: [if], data = [none]
}
}
}
at.addRow(ssc.getCommand(), new StrBuilder().appendWithSeparators(args.keySet(), ", ")); // depends on control dependency: [if], data = [none]
at.addRow("", ssc.getDescription()); // depends on control dependency: [if], data = [none]
for(SkbShellArgument ssa : args.values()){
if(ssa.valueSet()!=null && ssa.addedHelp()!=null){
at.addRow("", FormattingTupleWrapper.create(" -- <{}> of type {} - {} - {} - value set {}", ssa.getKey(), ssa.getType().name(), ssa.getDescription(), ssa.addedHelp(), ArrayUtils.toString(ssa.valueSet()))); // depends on control dependency: [if], data = [(ssa.valueSet()]
}
else if(ssa.valueSet()!=null && ssa.addedHelp()==null){
at.addRow("", FormattingTupleWrapper.create(" -- <{}> of type {} - {} - value set {}", ssa.getKey(), ssa.getType().name(), ssa.getDescription(), ArrayUtils.toString(ssa.valueSet()))); // depends on control dependency: [if], data = [none]
}
else if(ssa.valueSet()==null && ssa.addedHelp()!=null){
at.addRow("", FormattingTupleWrapper.create(" -- <{}> of type {} - {} - {}", ssa.getKey(), ssa.getType().name(), ssa.getDescription(), ssa.addedHelp())); // depends on control dependency: [if], data = [none]
}
else{
at.addRow("", FormattingTupleWrapper.create(" -- <{}> of type {} - {}", ssa.getKey(), ssa.getType().name(), ssa.getDescription())); // depends on control dependency: [if], data = [none]
}
}
if(ssc.addedHelp()!=null){
at.addRow("", ssc.addedHelp()); // depends on control dependency: [if], data = [none]
}
}
else{
MessageConsole.conInfo(""); // depends on control dependency: [if], data = [none]
MessageConsole.conInfo("{}: no command {} found for help, try 'help' to see all available commands", new Object[]{this.skbShell.getPromptName(), toHelp}); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public static base_responses delete(nitro_service client, lbmonitor resources[]) throws Exception {
base_responses result = null;
if (resources != null && resources.length > 0) {
lbmonitor deleteresources[] = new lbmonitor[resources.length];
for (int i=0;i<resources.length;i++){
deleteresources[i] = new lbmonitor();
deleteresources[i].monitorname = resources[i].monitorname;
deleteresources[i].type = resources[i].type;
deleteresources[i].respcode = resources[i].respcode;
}
result = delete_bulk_request(client, deleteresources);
}
return result;
} } | public class class_name {
public static base_responses delete(nitro_service client, lbmonitor resources[]) throws Exception {
base_responses result = null;
if (resources != null && resources.length > 0) {
lbmonitor deleteresources[] = new lbmonitor[resources.length];
for (int i=0;i<resources.length;i++){
deleteresources[i] = new lbmonitor(); // depends on control dependency: [for], data = [i]
deleteresources[i].monitorname = resources[i].monitorname; // depends on control dependency: [for], data = [i]
deleteresources[i].type = resources[i].type; // depends on control dependency: [for], data = [i]
deleteresources[i].respcode = resources[i].respcode; // depends on control dependency: [for], data = [i]
}
result = delete_bulk_request(client, deleteresources);
}
return result;
} } |
public class class_name {
public MetricFilter metricsFilter() {
if (meterName == null) {
return (name, metric) -> false;
}
return new MetricUtils.SingleMetricFilter(meterName);
} } | public class class_name {
public MetricFilter metricsFilter() {
if (meterName == null) {
return (name, metric) -> false; // depends on control dependency: [if], data = [none]
}
return new MetricUtils.SingleMetricFilter(meterName);
} } |
public class class_name {
public void marshall(FileSystemDescription fileSystemDescription, ProtocolMarshaller protocolMarshaller) {
if (fileSystemDescription == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(fileSystemDescription.getOwnerId(), OWNERID_BINDING);
protocolMarshaller.marshall(fileSystemDescription.getCreationToken(), CREATIONTOKEN_BINDING);
protocolMarshaller.marshall(fileSystemDescription.getFileSystemId(), FILESYSTEMID_BINDING);
protocolMarshaller.marshall(fileSystemDescription.getCreationTime(), CREATIONTIME_BINDING);
protocolMarshaller.marshall(fileSystemDescription.getLifeCycleState(), LIFECYCLESTATE_BINDING);
protocolMarshaller.marshall(fileSystemDescription.getName(), NAME_BINDING);
protocolMarshaller.marshall(fileSystemDescription.getNumberOfMountTargets(), NUMBEROFMOUNTTARGETS_BINDING);
protocolMarshaller.marshall(fileSystemDescription.getSizeInBytes(), SIZEINBYTES_BINDING);
protocolMarshaller.marshall(fileSystemDescription.getPerformanceMode(), PERFORMANCEMODE_BINDING);
protocolMarshaller.marshall(fileSystemDescription.getEncrypted(), ENCRYPTED_BINDING);
protocolMarshaller.marshall(fileSystemDescription.getKmsKeyId(), KMSKEYID_BINDING);
protocolMarshaller.marshall(fileSystemDescription.getThroughputMode(), THROUGHPUTMODE_BINDING);
protocolMarshaller.marshall(fileSystemDescription.getProvisionedThroughputInMibps(), PROVISIONEDTHROUGHPUTINMIBPS_BINDING);
protocolMarshaller.marshall(fileSystemDescription.getTags(), TAGS_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(FileSystemDescription fileSystemDescription, ProtocolMarshaller protocolMarshaller) {
if (fileSystemDescription == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(fileSystemDescription.getOwnerId(), OWNERID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(fileSystemDescription.getCreationToken(), CREATIONTOKEN_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(fileSystemDescription.getFileSystemId(), FILESYSTEMID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(fileSystemDescription.getCreationTime(), CREATIONTIME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(fileSystemDescription.getLifeCycleState(), LIFECYCLESTATE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(fileSystemDescription.getName(), NAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(fileSystemDescription.getNumberOfMountTargets(), NUMBEROFMOUNTTARGETS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(fileSystemDescription.getSizeInBytes(), SIZEINBYTES_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(fileSystemDescription.getPerformanceMode(), PERFORMANCEMODE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(fileSystemDescription.getEncrypted(), ENCRYPTED_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(fileSystemDescription.getKmsKeyId(), KMSKEYID_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(fileSystemDescription.getThroughputMode(), THROUGHPUTMODE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(fileSystemDescription.getProvisionedThroughputInMibps(), PROVISIONEDTHROUGHPUTINMIBPS_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(fileSystemDescription.getTags(), TAGS_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 String getPath(boolean p_includeQueryString,
boolean p_includeFragment)
{
StringBuffer pathString = new StringBuffer(m_path);
if (p_includeQueryString && m_queryString != null)
{
pathString.append('?');
pathString.append(m_queryString);
}
if (p_includeFragment && m_fragment != null)
{
pathString.append('#');
pathString.append(m_fragment);
}
return pathString.toString();
} } | public class class_name {
public String getPath(boolean p_includeQueryString,
boolean p_includeFragment)
{
StringBuffer pathString = new StringBuffer(m_path);
if (p_includeQueryString && m_queryString != null)
{
pathString.append('?'); // depends on control dependency: [if], data = [none]
pathString.append(m_queryString); // depends on control dependency: [if], data = [none]
}
if (p_includeFragment && m_fragment != null)
{
pathString.append('#'); // depends on control dependency: [if], data = [none]
pathString.append(m_fragment); // depends on control dependency: [if], data = [none]
}
return pathString.toString();
} } |
public class class_name {
private static void updatePartialIndex(IndexScanPlanNode scan) {
if (scan.getPredicate() == null && scan.getPartialIndexPredicate() != null) {
if (scan.isForSortOrderOnly()) {
scan.setPredicate(Collections.singletonList(scan.getPartialIndexPredicate()));
}
scan.setForPartialIndexOnly();
}
} } | public class class_name {
private static void updatePartialIndex(IndexScanPlanNode scan) {
if (scan.getPredicate() == null && scan.getPartialIndexPredicate() != null) {
if (scan.isForSortOrderOnly()) {
scan.setPredicate(Collections.singletonList(scan.getPartialIndexPredicate())); // depends on control dependency: [if], data = [none]
}
scan.setForPartialIndexOnly(); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public static void close(Closeable...closeable) {
for(Closeable c : closeable)
try { if( c != null ) c.close(); } catch( IOException ex ) {
Log.err(ex);
}
} } | public class class_name {
public static void close(Closeable...closeable) {
for(Closeable c : closeable)
try { if( c != null ) c.close(); } catch( IOException ex ) {
Log.err(ex);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
private void importRow(Row row) {
this.cells = new ArrayList();
this.width = this.document.getDocumentHeader().getPageSetting().getPageWidth() - this.document.getDocumentHeader().getPageSetting().getMarginLeft() - this.document.getDocumentHeader().getPageSetting().getMarginRight();
this.width = (int) (this.width * this.parentTable.getTableWidthPercent() / 100);
int cellRight = 0;
int cellWidth = 0;
for(int i = 0; i < row.getColumns(); i++) {
cellWidth = (int) (this.width * this.parentTable.getProportionalWidths()[i] / 100);
cellRight = cellRight + cellWidth;
Cell cell = (Cell) row.getCell(i);
RtfCell rtfCell = new RtfCell(this.document, this, cell);
rtfCell.setCellRight(cellRight);
rtfCell.setCellWidth(cellWidth);
this.cells.add(rtfCell);
}
} } | public class class_name {
private void importRow(Row row) {
this.cells = new ArrayList();
this.width = this.document.getDocumentHeader().getPageSetting().getPageWidth() - this.document.getDocumentHeader().getPageSetting().getMarginLeft() - this.document.getDocumentHeader().getPageSetting().getMarginRight();
this.width = (int) (this.width * this.parentTable.getTableWidthPercent() / 100);
int cellRight = 0;
int cellWidth = 0;
for(int i = 0; i < row.getColumns(); i++) {
cellWidth = (int) (this.width * this.parentTable.getProportionalWidths()[i] / 100); // depends on control dependency: [for], data = [i]
cellRight = cellRight + cellWidth; // depends on control dependency: [for], data = [none]
Cell cell = (Cell) row.getCell(i);
RtfCell rtfCell = new RtfCell(this.document, this, cell);
rtfCell.setCellRight(cellRight); // depends on control dependency: [for], data = [none]
rtfCell.setCellWidth(cellWidth); // depends on control dependency: [for], data = [none]
this.cells.add(rtfCell); // depends on control dependency: [for], data = [none]
}
} } |
public class class_name {
public void setAdd(java.util.Collection<CreateVolumePermission> add) {
if (add == null) {
this.add = null;
return;
}
this.add = new com.amazonaws.internal.SdkInternalList<CreateVolumePermission>(add);
} } | public class class_name {
public void setAdd(java.util.Collection<CreateVolumePermission> add) {
if (add == null) {
this.add = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.add = new com.amazonaws.internal.SdkInternalList<CreateVolumePermission>(add);
} } |
public class class_name {
public String getRootPath() {
if (metadata.getFilters().size() == 1) {
return metadata.getFilters().get(0).getRootPath();
}
else {
throw new IllegalStateException("Content package has more than one package filter - please use getFilters().");
}
} } | public class class_name {
public String getRootPath() {
if (metadata.getFilters().size() == 1) {
return metadata.getFilters().get(0).getRootPath(); // depends on control dependency: [if], data = [none]
}
else {
throw new IllegalStateException("Content package has more than one package filter - please use getFilters().");
}
} } |
public class class_name {
public MatchRule getMatchRule(int index) {
if (index < rules.size()) {
return rules.get(index);
}
return null;
} } | public class class_name {
public MatchRule getMatchRule(int index) {
if (index < rules.size()) {
return rules.get(index); // depends on control dependency: [if], data = [(index]
}
return null;
} } |
public class class_name {
@Override
public <E> List<E> getColumnsById(String schemaName, String tableName, String pKeyColumnName,
String inverseJoinColumnName, Object pKeyColumnValue, Class columnJavaType)
{
List<E> foreignKeys = new ArrayList<E>();
URI uri = null;
HttpResponse response = null;
try
{
String q = "key=" + CouchDBUtils.appendQuotes(pKeyColumnValue);
uri = new URI(CouchDBConstants.PROTOCOL, null, httpHost.getHostName(), httpHost.getPort(),
CouchDBConstants.URL_SEPARATOR + schemaName.toLowerCase() + CouchDBConstants.URL_SEPARATOR
+ CouchDBConstants.DESIGN + tableName + CouchDBConstants.VIEW + pKeyColumnName, q, null);
HttpGet get = new HttpGet(uri);
get.addHeader("Accept", "application/json");
response = httpClient.execute(get);
InputStream content = response.getEntity().getContent();
Reader reader = new InputStreamReader(content);
JsonObject json = gson.fromJson(reader, JsonObject.class);
JsonElement jsonElement = json.get("rows");
if (jsonElement == null)
{
return foreignKeys;
}
JsonArray array = jsonElement.getAsJsonArray();
for (JsonElement element : array)
{
JsonElement value = element.getAsJsonObject().get("value").getAsJsonObject().get(inverseJoinColumnName);
if (value != null)
{
foreignKeys.add((E) PropertyAccessorHelper.fromSourceToTargetClass(columnJavaType, String.class,
value.getAsString()));
}
}
}
catch (Exception e)
{
log.error("Error while fetching column by id {}, Caused by {}.", pKeyColumnValue, e);
throw new KunderaException(e);
}
finally
{
closeContent(response);
}
return foreignKeys;
} } | public class class_name {
@Override
public <E> List<E> getColumnsById(String schemaName, String tableName, String pKeyColumnName,
String inverseJoinColumnName, Object pKeyColumnValue, Class columnJavaType)
{
List<E> foreignKeys = new ArrayList<E>();
URI uri = null;
HttpResponse response = null;
try
{
String q = "key=" + CouchDBUtils.appendQuotes(pKeyColumnValue);
uri = new URI(CouchDBConstants.PROTOCOL, null, httpHost.getHostName(), httpHost.getPort(),
CouchDBConstants.URL_SEPARATOR + schemaName.toLowerCase() + CouchDBConstants.URL_SEPARATOR
+ CouchDBConstants.DESIGN + tableName + CouchDBConstants.VIEW + pKeyColumnName, q, null); // depends on control dependency: [try], data = [none]
HttpGet get = new HttpGet(uri);
get.addHeader("Accept", "application/json"); // depends on control dependency: [try], data = [none]
response = httpClient.execute(get); // depends on control dependency: [try], data = [none]
InputStream content = response.getEntity().getContent();
Reader reader = new InputStreamReader(content);
JsonObject json = gson.fromJson(reader, JsonObject.class);
JsonElement jsonElement = json.get("rows");
if (jsonElement == null)
{
return foreignKeys; // depends on control dependency: [if], data = [none]
}
JsonArray array = jsonElement.getAsJsonArray();
for (JsonElement element : array)
{
JsonElement value = element.getAsJsonObject().get("value").getAsJsonObject().get(inverseJoinColumnName);
if (value != null)
{
foreignKeys.add((E) PropertyAccessorHelper.fromSourceToTargetClass(columnJavaType, String.class,
value.getAsString())); // depends on control dependency: [if], data = [none]
}
}
}
catch (Exception e)
{
log.error("Error while fetching column by id {}, Caused by {}.", pKeyColumnValue, e);
throw new KunderaException(e);
} // depends on control dependency: [catch], data = [none]
finally
{
closeContent(response);
}
return foreignKeys;
} } |
public class class_name {
public SearchNode search(QueueSearchState<O, T> initSearch, Collection<T> startStates, int maxSteps,
int searchSteps) throws SearchNotExhaustiveException
{
// Initialize the queue with the start states set up in search nodes.
Queue<SearchNode<O, T>> queue = initSearch.enqueueStartStates(startStates);
// Get the goal predicate configured as part of the enqueueing start states process.
UnaryPredicate<T> goalPredicate = initSearch.getGoalPredicate();
// Flag used to indicate whether there are unexplored successor states known to exist beyond the max depth
// fringe.
boolean beyondFringe = false;
// Reset the minimum beyond the fringe boundary value.
minBeyondBound = Float.POSITIVE_INFINITY;
// Keep running until the queue becomes empty or a goal state is found.
while (!queue.isEmpty())
{
// Extract the head element from the queue.
SearchNode<O, T> headNode = peekAtHead ? queue.peek() : queue.remove();
// Expand the successors into the queue whether the current node is a goal state or not.
// This prepares the queue for subsequent searches, ensuring that goal states do not block
// subsequent goal states that exist beyond them.
// Add the successors to the queue provided that they are below or at the maximum bounded property.
// Get all the successor states.
Queue<SearchNode<O, T>> successors = new LinkedList<SearchNode<O, T>>();
headNode.expandSuccessors(successors, reverseEnqueue);
// Loop over all the successor states checking how they stand with respect to the bounded property.
for (SearchNode<O, T> successor : successors)
{
// Get the value of the bound property for the successor node.
float boundProperty = boundPropertyExtractor.getBoundProperty(successor);
// Check if the successor is below or on the bound.
if (boundProperty <= maxBound)
{
// Add it to the queue to be searched.
queue.offer(successor);
}
// The successor state is above the bound.
else
{
// Set the flag to indicate that there is at least one search node known to exist beyond the
// bound.
beyondFringe = true;
// Compare to the best minimum beyond the bound property found so far to see if
// this is a new minimum and update the minimum to the new minimum if so.
minBeyondBound = (boundProperty < minBeyondBound) ? boundProperty : minBeyondBound;
}
}
// Get the node to be goal checked, either the head node or the new top of queue, depending on the
// peek at head flag.
SearchNode<O, T> currentNode = peekAtHead ? queue.remove() : headNode;
// Check if the current node is a goal state.
// Only goal check leaves, or nodes already expanded. (The expanded flag will be set on leaves anyway).
if (currentNode.isExpanded() && goalPredicate.evaluate(currentNode.getState()))
{
return currentNode;
}
// Check if there is a maximum number of steps limit and increase the step count and check the limit if so.
if (maxSteps > 0)
{
// Increase the search step count because a goal test was performed.
searchSteps++;
// Update the search state with the number of steps taken so far.
initSearch.setStepsTaken(searchSteps);
if (searchSteps >= maxSteps)
{
// The maximum number of steps has been reached, however if the queue is now empty then the search
// has just completed within the maximum. Check if the queue is empty and return null if so.
if (queue.isEmpty())
{
return null;
}
// Quit without a solution as the max number of steps has been reached but because there are still
// more states in the queue then raise a search failure exception.
else
{
throw new SearchNotExhaustiveException("Maximum number of steps reached.", null);
}
}
}
}
// No goal state was found. Check if there known successors beyond the max depth fringe and if so throw
// a SearchNotExhaustiveException to indicate that the search failed rather than exhausted the search space.
if (beyondFringe)
{
throw new MaxBoundException("Max bound reached.", null);
}
else
{
// The search space was exhausted so return null to indicate that no goal could be found.
return null;
}
} } | public class class_name {
public SearchNode search(QueueSearchState<O, T> initSearch, Collection<T> startStates, int maxSteps,
int searchSteps) throws SearchNotExhaustiveException
{
// Initialize the queue with the start states set up in search nodes.
Queue<SearchNode<O, T>> queue = initSearch.enqueueStartStates(startStates);
// Get the goal predicate configured as part of the enqueueing start states process.
UnaryPredicate<T> goalPredicate = initSearch.getGoalPredicate();
// Flag used to indicate whether there are unexplored successor states known to exist beyond the max depth
// fringe.
boolean beyondFringe = false;
// Reset the minimum beyond the fringe boundary value.
minBeyondBound = Float.POSITIVE_INFINITY;
// Keep running until the queue becomes empty or a goal state is found.
while (!queue.isEmpty())
{
// Extract the head element from the queue.
SearchNode<O, T> headNode = peekAtHead ? queue.peek() : queue.remove();
// Expand the successors into the queue whether the current node is a goal state or not.
// This prepares the queue for subsequent searches, ensuring that goal states do not block
// subsequent goal states that exist beyond them.
// Add the successors to the queue provided that they are below or at the maximum bounded property.
// Get all the successor states.
Queue<SearchNode<O, T>> successors = new LinkedList<SearchNode<O, T>>();
headNode.expandSuccessors(successors, reverseEnqueue);
// Loop over all the successor states checking how they stand with respect to the bounded property.
for (SearchNode<O, T> successor : successors)
{
// Get the value of the bound property for the successor node.
float boundProperty = boundPropertyExtractor.getBoundProperty(successor);
// Check if the successor is below or on the bound.
if (boundProperty <= maxBound)
{
// Add it to the queue to be searched.
queue.offer(successor); // depends on control dependency: [if], data = [none]
}
// The successor state is above the bound.
else
{
// Set the flag to indicate that there is at least one search node known to exist beyond the
// bound.
beyondFringe = true; // depends on control dependency: [if], data = [none]
// Compare to the best minimum beyond the bound property found so far to see if
// this is a new minimum and update the minimum to the new minimum if so.
minBeyondBound = (boundProperty < minBeyondBound) ? boundProperty : minBeyondBound; // depends on control dependency: [if], data = [(boundProperty]
}
}
// Get the node to be goal checked, either the head node or the new top of queue, depending on the
// peek at head flag.
SearchNode<O, T> currentNode = peekAtHead ? queue.remove() : headNode;
// Check if the current node is a goal state.
// Only goal check leaves, or nodes already expanded. (The expanded flag will be set on leaves anyway).
if (currentNode.isExpanded() && goalPredicate.evaluate(currentNode.getState()))
{
return currentNode;
}
// Check if there is a maximum number of steps limit and increase the step count and check the limit if so.
if (maxSteps > 0)
{
// Increase the search step count because a goal test was performed.
searchSteps++;
// Update the search state with the number of steps taken so far.
initSearch.setStepsTaken(searchSteps);
if (searchSteps >= maxSteps)
{
// The maximum number of steps has been reached, however if the queue is now empty then the search
// has just completed within the maximum. Check if the queue is empty and return null if so.
if (queue.isEmpty())
{
return null; // depends on control dependency: [if], data = [none]
}
// Quit without a solution as the max number of steps has been reached but because there are still
// more states in the queue then raise a search failure exception.
else
{
throw new SearchNotExhaustiveException("Maximum number of steps reached.", null);
}
}
}
}
// No goal state was found. Check if there known successors beyond the max depth fringe and if so throw
// a SearchNotExhaustiveException to indicate that the search failed rather than exhausted the search space.
if (beyondFringe)
{
throw new MaxBoundException("Max bound reached.", null);
}
else
{
// The search space was exhausted so return null to indicate that no goal could be found.
return null;
}
} } |
public class class_name {
public PagedList<PoolUsageMetrics> listUsageMetrics(final PoolListUsageMetricsOptions poolListUsageMetricsOptions) {
ServiceResponseWithHeaders<Page<PoolUsageMetrics>, PoolListUsageMetricsHeaders> response = listUsageMetricsSinglePageAsync(poolListUsageMetricsOptions).toBlocking().single();
return new PagedList<PoolUsageMetrics>(response.body()) {
@Override
public Page<PoolUsageMetrics> nextPage(String nextPageLink) {
PoolListUsageMetricsNextOptions poolListUsageMetricsNextOptions = null;
if (poolListUsageMetricsOptions != null) {
poolListUsageMetricsNextOptions = new PoolListUsageMetricsNextOptions();
poolListUsageMetricsNextOptions.withClientRequestId(poolListUsageMetricsOptions.clientRequestId());
poolListUsageMetricsNextOptions.withReturnClientRequestId(poolListUsageMetricsOptions.returnClientRequestId());
poolListUsageMetricsNextOptions.withOcpDate(poolListUsageMetricsOptions.ocpDate());
}
return listUsageMetricsNextSinglePageAsync(nextPageLink, poolListUsageMetricsNextOptions).toBlocking().single().body();
}
};
} } | public class class_name {
public PagedList<PoolUsageMetrics> listUsageMetrics(final PoolListUsageMetricsOptions poolListUsageMetricsOptions) {
ServiceResponseWithHeaders<Page<PoolUsageMetrics>, PoolListUsageMetricsHeaders> response = listUsageMetricsSinglePageAsync(poolListUsageMetricsOptions).toBlocking().single();
return new PagedList<PoolUsageMetrics>(response.body()) {
@Override
public Page<PoolUsageMetrics> nextPage(String nextPageLink) {
PoolListUsageMetricsNextOptions poolListUsageMetricsNextOptions = null;
if (poolListUsageMetricsOptions != null) {
poolListUsageMetricsNextOptions = new PoolListUsageMetricsNextOptions(); // depends on control dependency: [if], data = [none]
poolListUsageMetricsNextOptions.withClientRequestId(poolListUsageMetricsOptions.clientRequestId()); // depends on control dependency: [if], data = [(poolListUsageMetricsOptions]
poolListUsageMetricsNextOptions.withReturnClientRequestId(poolListUsageMetricsOptions.returnClientRequestId()); // depends on control dependency: [if], data = [(poolListUsageMetricsOptions]
poolListUsageMetricsNextOptions.withOcpDate(poolListUsageMetricsOptions.ocpDate()); // depends on control dependency: [if], data = [(poolListUsageMetricsOptions]
}
return listUsageMetricsNextSinglePageAsync(nextPageLink, poolListUsageMetricsNextOptions).toBlocking().single().body();
}
};
} } |
public class class_name {
private static String byteArrayToHexString(byte[] b)
{
StringBuilder sb = new StringBuilder(b.length * 2);
for (int i = 0; i < b.length; i++)
{
int v = b[i] & 0xff;
if (v < 16)
{
sb.append('0');
}
sb.append(Integer.toHexString(v));
}
return sb.toString().toUpperCase();
} } | public class class_name {
private static String byteArrayToHexString(byte[] b)
{
StringBuilder sb = new StringBuilder(b.length * 2);
for (int i = 0; i < b.length; i++)
{
int v = b[i] & 0xff;
if (v < 16)
{
sb.append('0'); // depends on control dependency: [if], data = [none]
}
sb.append(Integer.toHexString(v)); // depends on control dependency: [for], data = [none]
}
return sb.toString().toUpperCase();
} } |
public class class_name {
public void saveAndDeleteEntities(
final CmsEntity lastEditedEntity,
final List<String> deletedEntites,
final boolean clearOnSuccess,
final I_CmsSimpleCallback<Boolean> callback) {
CmsRpcAction<CmsSaveResult> asyncCallback = new CmsRpcAction<CmsSaveResult>() {
@Override
public void execute() {
start(200, true);
getService().saveAndDeleteEntities(
lastEditedEntity,
m_clientId,
deletedEntites,
getSkipPaths(),
m_locale,
clearOnSuccess,
this);
}
@Override
protected void onResponse(CmsSaveResult result) {
stop(false);
if ((result != null) && result.hasErrors()) {
showValidationErrorDialog(result.getValidationResult());
} else {
callback.execute(Boolean.valueOf((result != null) && result.isHasChangedSettings()));
if (clearOnSuccess) {
destroyForm(true);
}
}
}
};
asyncCallback.execute();
} } | public class class_name {
public void saveAndDeleteEntities(
final CmsEntity lastEditedEntity,
final List<String> deletedEntites,
final boolean clearOnSuccess,
final I_CmsSimpleCallback<Boolean> callback) {
CmsRpcAction<CmsSaveResult> asyncCallback = new CmsRpcAction<CmsSaveResult>() {
@Override
public void execute() {
start(200, true);
getService().saveAndDeleteEntities(
lastEditedEntity,
m_clientId,
deletedEntites,
getSkipPaths(),
m_locale,
clearOnSuccess,
this);
}
@Override
protected void onResponse(CmsSaveResult result) {
stop(false);
if ((result != null) && result.hasErrors()) {
showValidationErrorDialog(result.getValidationResult());
// depends on control dependency: [if], data = [none]
} else {
callback.execute(Boolean.valueOf((result != null) && result.isHasChangedSettings()));
// depends on control dependency: [if], data = [((result]
if (clearOnSuccess) {
destroyForm(true);
// depends on control dependency: [if], data = [none]
}
}
}
};
asyncCallback.execute();
} } |
public class class_name {
public DescribeScalingPlanResourcesResult withScalingPlanResources(ScalingPlanResource... scalingPlanResources) {
if (this.scalingPlanResources == null) {
setScalingPlanResources(new java.util.ArrayList<ScalingPlanResource>(scalingPlanResources.length));
}
for (ScalingPlanResource ele : scalingPlanResources) {
this.scalingPlanResources.add(ele);
}
return this;
} } | public class class_name {
public DescribeScalingPlanResourcesResult withScalingPlanResources(ScalingPlanResource... scalingPlanResources) {
if (this.scalingPlanResources == null) {
setScalingPlanResources(new java.util.ArrayList<ScalingPlanResource>(scalingPlanResources.length)); // depends on control dependency: [if], data = [none]
}
for (ScalingPlanResource ele : scalingPlanResources) {
this.scalingPlanResources.add(ele); // depends on control dependency: [for], data = [ele]
}
return this;
} } |
public class class_name {
@Override
public void run() {
// The file pointer keeps track of where we are in the file
long filePointer = 0;
long startTime = new Date().getTime();
// Determine start point
if (this.startAtBeginning) {
filePointer = 0;
} else {
filePointer = this.file.length();
}
try {
// Start tailing
this.tailing = true;
RandomAccessFile file = new RandomAccessFile(this.file, "r");
while (isTailing()) {
//check to see if maxActiveInterval has been exceeded
if (new Date().getTime() - startTime > this.maxActiveInterval) {
if (log.isWarnEnabled()) {
log.warn("FileTailer exceeded maxActiveInterval: " + this.maxActiveInterval);
}
stopTailing();
fireMaxActiveIntervalExceeded();
}
try {
// Compare the length of the file to the file pointer
long fileLength = this.file.length();
if (fileLength < filePointer) {
// file must have been rotated or deleted;
// reopen the file and reset the file pointer
file = new RandomAccessFile(this.file, "r");
filePointer = 0;
}
if (fileLength > filePointer) {
// There is data to read
file.seek(filePointer);
String line = file.readLine();
while (line != null) {
fireNewFileLine(line);
line = file.readLine();
}
filePointer = file.getFilePointer();
}
// Sleep for the specified interval
Thread.sleep(this.interval);
} catch (Exception e) {
log.error(e.getMessage(), e);
}
}
// Close the file that we are tailing
file.close();
} catch (Exception e) {
log.error(e.getMessage(), e);
}
} } | public class class_name {
@Override
public void run() {
// The file pointer keeps track of where we are in the file
long filePointer = 0;
long startTime = new Date().getTime();
// Determine start point
if (this.startAtBeginning) {
filePointer = 0; // depends on control dependency: [if], data = [none]
} else {
filePointer = this.file.length(); // depends on control dependency: [if], data = [none]
}
try {
// Start tailing
this.tailing = true; // depends on control dependency: [try], data = [none]
RandomAccessFile file = new RandomAccessFile(this.file, "r");
while (isTailing()) {
//check to see if maxActiveInterval has been exceeded
if (new Date().getTime() - startTime > this.maxActiveInterval) {
if (log.isWarnEnabled()) {
log.warn("FileTailer exceeded maxActiveInterval: " + this.maxActiveInterval); // depends on control dependency: [if], data = [none]
}
stopTailing(); // depends on control dependency: [if], data = [none]
fireMaxActiveIntervalExceeded(); // depends on control dependency: [if], data = [none]
}
try {
// Compare the length of the file to the file pointer
long fileLength = this.file.length();
if (fileLength < filePointer) {
// file must have been rotated or deleted;
// reopen the file and reset the file pointer
file = new RandomAccessFile(this.file, "r"); // depends on control dependency: [if], data = [none]
filePointer = 0; // depends on control dependency: [if], data = [none]
}
if (fileLength > filePointer) {
// There is data to read
file.seek(filePointer); // depends on control dependency: [if], data = [filePointer)]
String line = file.readLine();
while (line != null) {
fireNewFileLine(line); // depends on control dependency: [while], data = [(line]
line = file.readLine(); // depends on control dependency: [while], data = [none]
}
filePointer = file.getFilePointer(); // depends on control dependency: [if], data = [none]
}
// Sleep for the specified interval
Thread.sleep(this.interval); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
log.error(e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
}
// Close the file that we are tailing
file.close(); // depends on control dependency: [try], data = [none]
} catch (Exception e) {
log.error(e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public static void addMsgConnection(final String _sessionId,
final IKey _key)
{
if (RegistryManager.getCache().containsKey(_sessionId)) {
RegistryManager.getCache().get(_sessionId).setConnectionKey(_key);
}
RegistryManager.LOG.debug("Added Message Connection for Session: {}", _sessionId);
} } | public class class_name {
public static void addMsgConnection(final String _sessionId,
final IKey _key)
{
if (RegistryManager.getCache().containsKey(_sessionId)) {
RegistryManager.getCache().get(_sessionId).setConnectionKey(_key); // depends on control dependency: [if], data = [none]
}
RegistryManager.LOG.debug("Added Message Connection for Session: {}", _sessionId);
} } |
public class class_name {
private void deliverWaveformDetailUpdate(final int player, final WaveformDetail detail) {
if (!getWaveformListeners().isEmpty()) {
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
final WaveformDetailUpdate update = new WaveformDetailUpdate(player, detail);
for (final WaveformListener listener : getWaveformListeners()) {
try {
listener.detailChanged(update);
} catch (Throwable t) {
logger.warn("Problem delivering waveform detail update to listener", t);
}
}
}
});
}
} } | public class class_name {
private void deliverWaveformDetailUpdate(final int player, final WaveformDetail detail) {
if (!getWaveformListeners().isEmpty()) {
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
final WaveformDetailUpdate update = new WaveformDetailUpdate(player, detail);
for (final WaveformListener listener : getWaveformListeners()) {
try {
listener.detailChanged(update); // depends on control dependency: [try], data = [none]
} catch (Throwable t) {
logger.warn("Problem delivering waveform detail update to listener", t);
} // depends on control dependency: [catch], data = [none]
}
}
}); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public static void setVisibility(EfficientCacheView cacheView, int viewId, int visibility) {
View view = cacheView.findViewByIdEfficient(viewId);
if (view != null) {
view.setVisibility(visibility);
}
} } | public class class_name {
public static void setVisibility(EfficientCacheView cacheView, int viewId, int visibility) {
View view = cacheView.findViewByIdEfficient(viewId);
if (view != null) {
view.setVisibility(visibility); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
protected String urlDecode(String value) {
final String encoding = requestManager.getCharacterEncoding().get(); // should be already set
try {
return URLDecoder.decode(value, encoding);
} catch (UnsupportedEncodingException e) {
String msg = "Unsupported encoding: value=" + value + ", encoding=" + encoding;
throw new IllegalStateException(msg, e);
}
} } | public class class_name {
protected String urlDecode(String value) {
final String encoding = requestManager.getCharacterEncoding().get(); // should be already set
try {
return URLDecoder.decode(value, encoding); // depends on control dependency: [try], data = [none]
} catch (UnsupportedEncodingException e) {
String msg = "Unsupported encoding: value=" + value + ", encoding=" + encoding;
throw new IllegalStateException(msg, e);
} // depends on control dependency: [catch], data = [none]
} } |
public class class_name {
public static <I extends ImageGray<I>, T extends ImageGray>
T transform( I input , T transformed ) {
if( input instanceof GrayF32) {
return (T)IntegralImageOps.transform((GrayF32)input,(GrayF32)transformed);
} else if( input instanceof GrayF64) {
return (T)IntegralImageOps.transform((GrayF64)input,(GrayF64)transformed);
} else if( input instanceof GrayU8) {
return (T)IntegralImageOps.transform((GrayU8)input,(GrayS32)transformed);
} else if( input instanceof GrayS32) {
return (T)IntegralImageOps.transform((GrayS32)input,(GrayS32)transformed);
} else if( input instanceof GrayS64) {
return (T)IntegralImageOps.transform((GrayS64)input,(GrayS64)transformed);
} else {
throw new IllegalArgumentException("Unknown input type: "+input.getClass().getSimpleName());
}
} } | public class class_name {
public static <I extends ImageGray<I>, T extends ImageGray>
T transform( I input , T transformed ) {
if( input instanceof GrayF32) {
return (T)IntegralImageOps.transform((GrayF32)input,(GrayF32)transformed); // depends on control dependency: [if], data = [none]
} else if( input instanceof GrayF64) {
return (T)IntegralImageOps.transform((GrayF64)input,(GrayF64)transformed); // depends on control dependency: [if], data = [none]
} else if( input instanceof GrayU8) {
return (T)IntegralImageOps.transform((GrayU8)input,(GrayS32)transformed); // depends on control dependency: [if], data = [none]
} else if( input instanceof GrayS32) {
return (T)IntegralImageOps.transform((GrayS32)input,(GrayS32)transformed); // depends on control dependency: [if], data = [none]
} else if( input instanceof GrayS64) {
return (T)IntegralImageOps.transform((GrayS64)input,(GrayS64)transformed); // depends on control dependency: [if], data = [none]
} else {
throw new IllegalArgumentException("Unknown input type: "+input.getClass().getSimpleName());
}
} } |
public class class_name {
protected <T extends ConnectFuture> ConnectFuture connectInternal(final ResourceAddress address, final IoHandler handler, final IoSessionInitializer<T> initializer) {
// TODO: throw exception if address contains more then one resource
ResourceAddress transport = address.getTransport();
if (transport != null) {
return getTransportConnectFuture(address, handler, initializer, transport);
}
final URI resource = address.getResource();
final InetSocketAddress inetAddress = new InetSocketAddress(resource.getHost(), resource.getPort());
if (logger.isTraceEnabled()) {
logger.trace(format("AbstractNioConnector.connectInternal(), resource: %s", resource));
}
// KG-1452: Avoid deadlock between dispose and connectInternal
IoConnector connector = this.connectorReference.get();
if (connector == null) {
return DefaultConnectFuture.newFailedFuture(new IllegalStateException("Connector is being shut down"));
}
final String nextProtocol = address.getOption(ResourceAddress.NEXT_PROTOCOL);
ConnectFuture future = connector.connect(inetAddress, new IoSessionInitializer<T>() {
@Override
public void initializeSession(IoSession session, T future) {
if (logger.isTraceEnabled()) {
logger.trace(format("AbstractNioConnector.connectInternal()$initializeSession(), session: %s, resource: %s", session, resource));
}
registerConnectFilters(address, session);
// connectors don't need lookup so set this directly on the session
session.setAttribute(BridgeConnectHandler.DELEGATE_KEY, handler);
// Currrently, the underlying TCP session has the remote
// address being an InetSocketAddress. Our top-level
// ResourceAddress has more information than just that
// remote InetSocketAddress -- so we set that as the
// remote address in the created session.
REMOTE_ADDRESS.set(session, address);
LOCAL_ADDRESS.set(session, createResourceAddress(inetAddress, nextProtocol));
if (initializer != null) {
initializer.initializeSession(session, future);
}
}
});
future.addListener(new IoFutureListener<ConnectFuture>() {
@Override
public void operationComplete(ConnectFuture future) {
if (future.isConnected()) {
IoSession session = future.getSession();
SocketAddress localAddress = session.getLocalAddress();
if (localAddress instanceof InetSocketAddress) {
InetSocketAddress inetSocketAddress = (InetSocketAddress) localAddress;
ResourceAddress resourceAddress = createResourceAddress(inetSocketAddress, nextProtocol);
LOCAL_ADDRESS.set(session, resourceAddress);
}
else if (localAddress instanceof NamedPipeAddress) {
NamedPipeAddress namedPipeAddress = (NamedPipeAddress) localAddress;
ResourceAddress resourceAddress = createResourceAddress(namedPipeAddress, nextProtocol);
LOCAL_ADDRESS.set(session, resourceAddress);
}
}
}
});
return future;
} } | public class class_name {
protected <T extends ConnectFuture> ConnectFuture connectInternal(final ResourceAddress address, final IoHandler handler, final IoSessionInitializer<T> initializer) {
// TODO: throw exception if address contains more then one resource
ResourceAddress transport = address.getTransport();
if (transport != null) {
return getTransportConnectFuture(address, handler, initializer, transport); // depends on control dependency: [if], data = [none]
}
final URI resource = address.getResource();
final InetSocketAddress inetAddress = new InetSocketAddress(resource.getHost(), resource.getPort());
if (logger.isTraceEnabled()) {
logger.trace(format("AbstractNioConnector.connectInternal(), resource: %s", resource)); // depends on control dependency: [if], data = [none]
}
// KG-1452: Avoid deadlock between dispose and connectInternal
IoConnector connector = this.connectorReference.get();
if (connector == null) {
return DefaultConnectFuture.newFailedFuture(new IllegalStateException("Connector is being shut down")); // depends on control dependency: [if], data = [none]
}
final String nextProtocol = address.getOption(ResourceAddress.NEXT_PROTOCOL);
ConnectFuture future = connector.connect(inetAddress, new IoSessionInitializer<T>() {
@Override
public void initializeSession(IoSession session, T future) {
if (logger.isTraceEnabled()) {
logger.trace(format("AbstractNioConnector.connectInternal()$initializeSession(), session: %s, resource: %s", session, resource)); // depends on control dependency: [if], data = [none]
}
registerConnectFilters(address, session);
// connectors don't need lookup so set this directly on the session
session.setAttribute(BridgeConnectHandler.DELEGATE_KEY, handler);
// Currrently, the underlying TCP session has the remote
// address being an InetSocketAddress. Our top-level
// ResourceAddress has more information than just that
// remote InetSocketAddress -- so we set that as the
// remote address in the created session.
REMOTE_ADDRESS.set(session, address);
LOCAL_ADDRESS.set(session, createResourceAddress(inetAddress, nextProtocol));
if (initializer != null) {
initializer.initializeSession(session, future); // depends on control dependency: [if], data = [none]
}
}
});
future.addListener(new IoFutureListener<ConnectFuture>() {
@Override
public void operationComplete(ConnectFuture future) {
if (future.isConnected()) {
IoSession session = future.getSession();
SocketAddress localAddress = session.getLocalAddress();
if (localAddress instanceof InetSocketAddress) {
InetSocketAddress inetSocketAddress = (InetSocketAddress) localAddress;
ResourceAddress resourceAddress = createResourceAddress(inetSocketAddress, nextProtocol);
LOCAL_ADDRESS.set(session, resourceAddress); // depends on control dependency: [if], data = [none]
}
else if (localAddress instanceof NamedPipeAddress) {
NamedPipeAddress namedPipeAddress = (NamedPipeAddress) localAddress;
ResourceAddress resourceAddress = createResourceAddress(namedPipeAddress, nextProtocol);
LOCAL_ADDRESS.set(session, resourceAddress); // depends on control dependency: [if], data = [none]
}
}
}
});
return future;
} } |
public class class_name {
public AT_Row setPaddingLeftRight(int paddingLeft, int paddingRight){
if(this.hasCells()){
for(AT_Cell cell : this.getCells()){
cell.getContext().setPaddingLeftRight(paddingLeft, paddingRight);
}
}
return this;
} } | public class class_name {
public AT_Row setPaddingLeftRight(int paddingLeft, int paddingRight){
if(this.hasCells()){
for(AT_Cell cell : this.getCells()){
cell.getContext().setPaddingLeftRight(paddingLeft, paddingRight);
// depends on control dependency: [for], data = [cell]
}
}
return this;
} } |
public class class_name {
private void initBuckets() {
if (buckets != null) {
return;
}
buckets = createBucketList();
if (inputList == null || inputList.isEmpty()) {
return;
}
// Sort the records by name.
// Stable sort preserves input order of collation duplicates.
Collections.sort(inputList, recordComparator);
// Now, we traverse all of the input, which is now sorted.
// If the item doesn't go in the current bucket, we find the next bucket that contains it.
// This makes the process order n*log(n), since we just sort the list and then do a linear process.
// However, if the user adds an item at a time and then gets the buckets, this isn't efficient, so
// we need to improve it for that case.
Iterator<Bucket<V>> bucketIterator = buckets.fullIterator();
Bucket<V> currentBucket = bucketIterator.next();
Bucket<V> nextBucket;
String upperBoundary;
if (bucketIterator.hasNext()) {
nextBucket = bucketIterator.next();
upperBoundary = nextBucket.lowerBoundary;
} else {
nextBucket = null;
upperBoundary = null;
}
for (Record<V> r : inputList) {
// if the current bucket isn't the right one, find the one that is
// We have a special flag for the last bucket so that we don't look any further
while (upperBoundary != null &&
collatorPrimaryOnly.compare(r.name, upperBoundary) >= 0) {
currentBucket = nextBucket;
// now reset the boundary that we compare against
if (bucketIterator.hasNext()) {
nextBucket = bucketIterator.next();
upperBoundary = nextBucket.lowerBoundary;
} else {
upperBoundary = null;
}
}
// now put the record into the bucket.
Bucket<V> bucket = currentBucket;
if (bucket.displayBucket != null) {
bucket = bucket.displayBucket;
}
if (bucket.records == null) {
bucket.records = new ArrayList<Record<V>>();
}
bucket.records.add(r);
}
} } | public class class_name {
private void initBuckets() {
if (buckets != null) {
return; // depends on control dependency: [if], data = [none]
}
buckets = createBucketList();
if (inputList == null || inputList.isEmpty()) {
return; // depends on control dependency: [if], data = [none]
}
// Sort the records by name.
// Stable sort preserves input order of collation duplicates.
Collections.sort(inputList, recordComparator);
// Now, we traverse all of the input, which is now sorted.
// If the item doesn't go in the current bucket, we find the next bucket that contains it.
// This makes the process order n*log(n), since we just sort the list and then do a linear process.
// However, if the user adds an item at a time and then gets the buckets, this isn't efficient, so
// we need to improve it for that case.
Iterator<Bucket<V>> bucketIterator = buckets.fullIterator();
Bucket<V> currentBucket = bucketIterator.next();
Bucket<V> nextBucket;
String upperBoundary;
if (bucketIterator.hasNext()) {
nextBucket = bucketIterator.next(); // depends on control dependency: [if], data = [none]
upperBoundary = nextBucket.lowerBoundary; // depends on control dependency: [if], data = [none]
} else {
nextBucket = null; // depends on control dependency: [if], data = [none]
upperBoundary = null; // depends on control dependency: [if], data = [none]
}
for (Record<V> r : inputList) {
// if the current bucket isn't the right one, find the one that is
// We have a special flag for the last bucket so that we don't look any further
while (upperBoundary != null &&
collatorPrimaryOnly.compare(r.name, upperBoundary) >= 0) {
currentBucket = nextBucket; // depends on control dependency: [while], data = [none]
// now reset the boundary that we compare against
if (bucketIterator.hasNext()) {
nextBucket = bucketIterator.next(); // depends on control dependency: [if], data = [none]
upperBoundary = nextBucket.lowerBoundary; // depends on control dependency: [if], data = [none]
} else {
upperBoundary = null; // depends on control dependency: [if], data = [none]
}
}
// now put the record into the bucket.
Bucket<V> bucket = currentBucket;
if (bucket.displayBucket != null) {
bucket = bucket.displayBucket; // depends on control dependency: [if], data = [none]
}
if (bucket.records == null) {
bucket.records = new ArrayList<Record<V>>(); // depends on control dependency: [if], data = [none]
}
bucket.records.add(r); // depends on control dependency: [for], data = [r]
}
} } |
public class class_name {
public static <K> void makeAuditableCopies(Map<K, Copier> aFormMap, Map<K, Copier> aToMap,
Auditable aAuditable)
{
if (aFormMap == null || aToMap == null)
return;
// for thru froms
K fromKey = null;
Copier to = null;
Copier from = null;
for (Map.Entry<K, Copier> entry : aFormMap.entrySet())
{
fromKey = entry.getKey();
if (aToMap.keySet().contains(fromKey))
{
// copy existening data
to = (Copier) aToMap.get(fromKey);
to.copy((Copier) entry.getValue());
// copy auditing info
if (aAuditable != null && to instanceof Auditable)
{
AbstractAuditable.copy(aAuditable, (Auditable) to);
}
}
else
{
from = (Copier) aFormMap.get(fromKey);
// copy auditing info
if (aAuditable != null && from instanceof Auditable)
{
AbstractAuditable.copy(aAuditable, (Auditable) from);
}
// add to
aToMap.put(fromKey, from);
}
}
} } | public class class_name {
public static <K> void makeAuditableCopies(Map<K, Copier> aFormMap, Map<K, Copier> aToMap,
Auditable aAuditable)
{
if (aFormMap == null || aToMap == null)
return;
// for thru froms
K fromKey = null;
Copier to = null;
Copier from = null;
for (Map.Entry<K, Copier> entry : aFormMap.entrySet())
{
fromKey = entry.getKey();
// depends on control dependency: [for], data = [entry]
if (aToMap.keySet().contains(fromKey))
{
// copy existening data
to = (Copier) aToMap.get(fromKey);
// depends on control dependency: [if], data = [none]
to.copy((Copier) entry.getValue());
// depends on control dependency: [if], data = [none]
// copy auditing info
if (aAuditable != null && to instanceof Auditable)
{
AbstractAuditable.copy(aAuditable, (Auditable) to);
// depends on control dependency: [if], data = [(aAuditable]
}
}
else
{
from = (Copier) aFormMap.get(fromKey);
// depends on control dependency: [if], data = [none]
// copy auditing info
if (aAuditable != null && from instanceof Auditable)
{
AbstractAuditable.copy(aAuditable, (Auditable) from);
// depends on control dependency: [if], data = [(aAuditable]
}
// add to
aToMap.put(fromKey, from);
// depends on control dependency: [if], data = [none]
}
}
} } |
public class class_name {
public static String getDefaultFileName(final String name) {
String result;
File f = new File(name);
if (!f.exists()) {
result = f.getAbsolutePath();
} else {
final Map.Entry<String, String> cut = FileUtil.cutExtension(name);
final String prefix = cut.getKey();
final String suffix = cut.getValue();
int num = 0;
while (f.exists()) {
f = new File(prefix + '_' + num + '.' + suffix);
num++;
}
result = f.getAbsolutePath();
}
return result;
} } | public class class_name {
public static String getDefaultFileName(final String name) {
String result;
File f = new File(name);
if (!f.exists()) {
result = f.getAbsolutePath(); // depends on control dependency: [if], data = [none]
} else {
final Map.Entry<String, String> cut = FileUtil.cutExtension(name);
final String prefix = cut.getKey();
final String suffix = cut.getValue();
int num = 0;
while (f.exists()) {
f = new File(prefix + '_' + num + '.' + suffix); // depends on control dependency: [while], data = [none]
num++; // depends on control dependency: [while], data = [none]
}
result = f.getAbsolutePath(); // depends on control dependency: [if], data = [none]
}
return result;
} } |
public class class_name {
static String getAccessTokenForUserId(String userId) {
if (userId == null && getUserId() == null
|| userId != null && userId.equals(getUserId())) {
return getAccessToken();
} else {
JSONObject usersArchive = getJSONObject(PER_USER_ARCHIVE_PREF_NAME);
if (usersArchive == null) usersArchive = new JSONObject();
JSONObject userArchive = usersArchive.optJSONObject(userId == null ? "" : userId);
if (userArchive == null) userArchive = new JSONObject();
return JSONUtil.optString(userArchive, ACCESS_TOKEN_PREF_NAME);
}
} } | public class class_name {
static String getAccessTokenForUserId(String userId) {
if (userId == null && getUserId() == null
|| userId != null && userId.equals(getUserId())) {
return getAccessToken(); // depends on control dependency: [if], data = [none]
} else {
JSONObject usersArchive = getJSONObject(PER_USER_ARCHIVE_PREF_NAME);
if (usersArchive == null) usersArchive = new JSONObject();
JSONObject userArchive = usersArchive.optJSONObject(userId == null ? "" : userId);
if (userArchive == null) userArchive = new JSONObject();
return JSONUtil.optString(userArchive, ACCESS_TOKEN_PREF_NAME); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
private void parse(String propKey, String propValue) {
if (ARG_TAG.equals(propValue)) {
String value = System.getProperty(propKey);
if (StringUtils.isNotBlank(value) && value.startsWith(CRYPTEX_TAG)) {
value = decrypt(value);
}
if (StringUtils.isNotBlank(value)) {
this.props.setValue(propKey, value, Application.getMode().toString());
}
}
if (propValue.startsWith(CRYPTEX_TAG)) {
this.props.setValue(propKey, decrypt(propValue), Application.getMode().toString());
}
} } | public class class_name {
private void parse(String propKey, String propValue) {
if (ARG_TAG.equals(propValue)) {
String value = System.getProperty(propKey);
if (StringUtils.isNotBlank(value) && value.startsWith(CRYPTEX_TAG)) {
value = decrypt(value); // depends on control dependency: [if], data = [none]
}
if (StringUtils.isNotBlank(value)) {
this.props.setValue(propKey, value, Application.getMode().toString()); // depends on control dependency: [if], data = [none]
}
}
if (propValue.startsWith(CRYPTEX_TAG)) {
this.props.setValue(propKey, decrypt(propValue), Application.getMode().toString()); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
private List<String> getDomainsFromUrl(URL url) {
String host = url.getHost();
String[] paths = new String[] {};
if (url.getPath() != null) {
paths = url.getPath().split("/");
}
List<String> domains = new ArrayList<String>(paths.length + 1);
StringBuilder relative = new StringBuilder().append("http://").append(host).append("/");
domains.add(relative.toString());
for (String path : paths) {
if (path.length() > 0) {
relative.append(path).append("/");
domains.add(relative.toString());
}
}
return domains;
} } | public class class_name {
private List<String> getDomainsFromUrl(URL url) {
String host = url.getHost();
String[] paths = new String[] {};
if (url.getPath() != null) {
paths = url.getPath().split("/"); // depends on control dependency: [if], data = [none]
}
List<String> domains = new ArrayList<String>(paths.length + 1);
StringBuilder relative = new StringBuilder().append("http://").append(host).append("/");
domains.add(relative.toString());
for (String path : paths) {
if (path.length() > 0) {
relative.append(path).append("/"); // depends on control dependency: [if], data = [none]
domains.add(relative.toString()); // depends on control dependency: [if], data = [none]
}
}
return domains;
} } |
public class class_name {
public static FsPermission getUMask(Configuration conf) {
int umask = DEFAULT_UMASK;
// To ensure backward compatibility first use the deprecated key.
// If the deprecated key is not present then check for the new key
if(conf != null) {
String confUmask = conf.get(UMASK_LABEL);
if(confUmask != null) {
umask = new UmaskParser(confUmask).getUMask();
}
int oldUmask = conf.getInt(DEPRECATED_UMASK_LABEL, Integer.MIN_VALUE);
if(oldUmask != Integer.MIN_VALUE) { // Property was set with old key
if (umask != oldUmask) {
LOG.warn(DEPRECATED_UMASK_LABEL
+ " configuration key is deprecated. " + "Convert to "
+ UMASK_LABEL + ", using octal or symbolic umask "
+ "specifications.");
// Old and new umask values do not match - Use old umask
umask = oldUmask;
}
}
}
return new FsPermission((short)umask);
} } | public class class_name {
public static FsPermission getUMask(Configuration conf) {
int umask = DEFAULT_UMASK;
// To ensure backward compatibility first use the deprecated key.
// If the deprecated key is not present then check for the new key
if(conf != null) {
String confUmask = conf.get(UMASK_LABEL);
if(confUmask != null) {
umask = new UmaskParser(confUmask).getUMask(); // depends on control dependency: [if], data = [(confUmask]
}
int oldUmask = conf.getInt(DEPRECATED_UMASK_LABEL, Integer.MIN_VALUE);
if(oldUmask != Integer.MIN_VALUE) { // Property was set with old key
if (umask != oldUmask) {
LOG.warn(DEPRECATED_UMASK_LABEL
+ " configuration key is deprecated. " + "Convert to "
+ UMASK_LABEL + ", using octal or symbolic umask "
+ "specifications."); // depends on control dependency: [if], data = [none]
// Old and new umask values do not match - Use old umask
umask = oldUmask; // depends on control dependency: [if], data = [none]
}
}
}
return new FsPermission((short)umask);
} } |
public class class_name {
public static void transpose( ZMatrixRMaj mat ) {
if( mat.numCols == mat.numRows ){
TransposeAlgs_ZDRM.square(mat);
} else {
ZMatrixRMaj b = new ZMatrixRMaj(mat.numCols,mat.numRows);
transpose(mat, b);
mat.reshape(b.numRows, b.numCols);
mat.set(b);
}
} } | public class class_name {
public static void transpose( ZMatrixRMaj mat ) {
if( mat.numCols == mat.numRows ){
TransposeAlgs_ZDRM.square(mat); // depends on control dependency: [if], data = [none]
} else {
ZMatrixRMaj b = new ZMatrixRMaj(mat.numCols,mat.numRows);
transpose(mat, b); // depends on control dependency: [if], data = [none]
mat.reshape(b.numRows, b.numCols); // depends on control dependency: [if], data = [none]
mat.set(b); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
private Connection getConnectionViaDriverMangaer(String driver, String url, String user, String password) {
Connection conn = null;
try {
Class.forName(driver);
conn = DriverManager.getConnection(url, user, password);
} catch (ClassNotFoundException e) {
e.printStackTrace();
} catch (SQLException e) {
e.printStackTrace();
}
return conn;
} } | public class class_name {
private Connection getConnectionViaDriverMangaer(String driver, String url, String user, String password) {
Connection conn = null;
try {
Class.forName(driver);
conn = DriverManager.getConnection(url, user, password);
} catch (ClassNotFoundException e) {
e.printStackTrace();
} catch (SQLException e) {
// depends on control dependency: [catch], data = [none]
e.printStackTrace();
}
// depends on control dependency: [catch], data = [none]
return conn;
} } |
public class class_name {
public void marshall(UpdateServicePrimaryTaskSetRequest updateServicePrimaryTaskSetRequest, ProtocolMarshaller protocolMarshaller) {
if (updateServicePrimaryTaskSetRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(updateServicePrimaryTaskSetRequest.getCluster(), CLUSTER_BINDING);
protocolMarshaller.marshall(updateServicePrimaryTaskSetRequest.getService(), SERVICE_BINDING);
protocolMarshaller.marshall(updateServicePrimaryTaskSetRequest.getPrimaryTaskSet(), PRIMARYTASKSET_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(UpdateServicePrimaryTaskSetRequest updateServicePrimaryTaskSetRequest, ProtocolMarshaller protocolMarshaller) {
if (updateServicePrimaryTaskSetRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(updateServicePrimaryTaskSetRequest.getCluster(), CLUSTER_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(updateServicePrimaryTaskSetRequest.getService(), SERVICE_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(updateServicePrimaryTaskSetRequest.getPrimaryTaskSet(), PRIMARYTASKSET_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 StorageDirView cascadingEvict(long bytesToBeAvailable, BlockStoreLocation location,
EvictionPlan plan, Mode mode) {
location = updateBlockStoreLocation(bytesToBeAvailable, location);
// 1. If bytesToBeAvailable can already be satisfied without eviction, return the eligible
// StoargeDirView
StorageDirView candidateDirView =
EvictorUtils.selectDirWithRequestedSpace(bytesToBeAvailable, location, mManagerView);
if (candidateDirView != null) {
return candidateDirView;
}
// 2. Iterate over blocks in order until we find a StorageDirView that is in the range of
// location and can satisfy bytesToBeAvailable after evicting its blocks iterated so far
EvictionDirCandidates dirCandidates = new EvictionDirCandidates();
Iterator<Long> it = getBlockIterator();
while (it.hasNext() && dirCandidates.candidateSize() < bytesToBeAvailable) {
long blockId = it.next();
try {
BlockMeta block = mManagerView.getBlockMeta(blockId);
if (block != null) { // might not present in this view
if (block.getBlockLocation().belongsTo(location)) {
String tierAlias = block.getParentDir().getParentTier().getTierAlias();
int dirIndex = block.getParentDir().getDirIndex();
dirCandidates.add(mManagerView.getTierView(tierAlias).getDirView(dirIndex), blockId,
block.getBlockSize());
}
}
} catch (BlockDoesNotExistException e) {
LOG.warn("Remove block {} from evictor cache because {}", blockId, e);
it.remove();
onRemoveBlockFromIterator(blockId);
}
}
// 3. If there is no eligible StorageDirView, return null
if (mode == Mode.GUARANTEED && dirCandidates.candidateSize() < bytesToBeAvailable) {
return null;
}
// 4. cascading eviction: try to allocate space in the next tier to move candidate blocks
// there. If allocation fails, the next tier will continue to evict its blocks to free space.
// Blocks are only evicted from the last tier or it can not be moved to the next tier.
candidateDirView = dirCandidates.candidateDir();
if (candidateDirView == null) {
return null;
}
List<Long> candidateBlocks = dirCandidates.candidateBlocks();
StorageTierView nextTierView = mManagerView.getNextTier(candidateDirView.getParentTierView());
if (nextTierView == null) {
// This is the last tier, evict all the blocks.
for (Long blockId : candidateBlocks) {
try {
BlockMeta block = mManagerView.getBlockMeta(blockId);
if (block != null) {
candidateDirView.markBlockMoveOut(blockId, block.getBlockSize());
plan.toEvict().add(new Pair<>(blockId, candidateDirView.toBlockStoreLocation()));
}
} catch (BlockDoesNotExistException e) {
continue;
}
}
} else {
for (Long blockId : candidateBlocks) {
try {
BlockMeta block = mManagerView.getBlockMeta(blockId);
if (block == null) {
continue;
}
StorageDirView nextDirView = mAllocator.allocateBlockWithView(
Sessions.MIGRATE_DATA_SESSION_ID, block.getBlockSize(),
BlockStoreLocation.anyDirInTier(nextTierView.getTierViewAlias()), mManagerView);
if (nextDirView == null) {
nextDirView = cascadingEvict(block.getBlockSize(),
BlockStoreLocation.anyDirInTier(nextTierView.getTierViewAlias()), plan, mode);
}
if (nextDirView == null) {
// If we failed to find a dir in the next tier to move this block, evict it and
// continue. Normally this should not happen.
plan.toEvict().add(new Pair<>(blockId, block.getBlockLocation()));
candidateDirView.markBlockMoveOut(blockId, block.getBlockSize());
continue;
}
plan.toMove().add(new BlockTransferInfo(blockId, block.getBlockLocation(),
nextDirView.toBlockStoreLocation()));
candidateDirView.markBlockMoveOut(blockId, block.getBlockSize());
nextDirView.markBlockMoveIn(blockId, block.getBlockSize());
} catch (BlockDoesNotExistException e) {
continue;
}
}
}
return candidateDirView;
} } | public class class_name {
protected StorageDirView cascadingEvict(long bytesToBeAvailable, BlockStoreLocation location,
EvictionPlan plan, Mode mode) {
location = updateBlockStoreLocation(bytesToBeAvailable, location);
// 1. If bytesToBeAvailable can already be satisfied without eviction, return the eligible
// StoargeDirView
StorageDirView candidateDirView =
EvictorUtils.selectDirWithRequestedSpace(bytesToBeAvailable, location, mManagerView);
if (candidateDirView != null) {
return candidateDirView; // depends on control dependency: [if], data = [none]
}
// 2. Iterate over blocks in order until we find a StorageDirView that is in the range of
// location and can satisfy bytesToBeAvailable after evicting its blocks iterated so far
EvictionDirCandidates dirCandidates = new EvictionDirCandidates();
Iterator<Long> it = getBlockIterator();
while (it.hasNext() && dirCandidates.candidateSize() < bytesToBeAvailable) {
long blockId = it.next();
try {
BlockMeta block = mManagerView.getBlockMeta(blockId);
if (block != null) { // might not present in this view
if (block.getBlockLocation().belongsTo(location)) {
String tierAlias = block.getParentDir().getParentTier().getTierAlias();
int dirIndex = block.getParentDir().getDirIndex();
dirCandidates.add(mManagerView.getTierView(tierAlias).getDirView(dirIndex), blockId,
block.getBlockSize()); // depends on control dependency: [if], data = [none]
}
}
} catch (BlockDoesNotExistException e) {
LOG.warn("Remove block {} from evictor cache because {}", blockId, e);
it.remove();
onRemoveBlockFromIterator(blockId);
}
}
// 3. If there is no eligible StorageDirView, return null
if (mode == Mode.GUARANTEED && dirCandidates.candidateSize() < bytesToBeAvailable) {
return null;
}
// 4. cascading eviction: try to allocate space in the next tier to move candidate blocks
// there. If allocation fails, the next tier will continue to evict its blocks to free space.
// Blocks are only evicted from the last tier or it can not be moved to the next tier.
candidateDirView = dirCandidates.candidateDir();
if (candidateDirView == null) {
return null;
}
List<Long> candidateBlocks = dirCandidates.candidateBlocks();
StorageTierView nextTierView = mManagerView.getNextTier(candidateDirView.getParentTierView());
if (nextTierView == null) {
// This is the last tier, evict all the blocks.
for (Long blockId : candidateBlocks) {
try {
BlockMeta block = mManagerView.getBlockMeta(blockId);
if (block != null) {
candidateDirView.markBlockMoveOut(blockId, block.getBlockSize());
plan.toEvict().add(new Pair<>(blockId, candidateDirView.toBlockStoreLocation()));
}
} catch (BlockDoesNotExistException e) {
continue;
}
}
} else {
for (Long blockId : candidateBlocks) {
try {
BlockMeta block = mManagerView.getBlockMeta(blockId);
if (block == null) {
continue;
}
StorageDirView nextDirView = mAllocator.allocateBlockWithView(
Sessions.MIGRATE_DATA_SESSION_ID, block.getBlockSize(),
BlockStoreLocation.anyDirInTier(nextTierView.getTierViewAlias()), mManagerView);
if (nextDirView == null) {
nextDirView = cascadingEvict(block.getBlockSize(),
BlockStoreLocation.anyDirInTier(nextTierView.getTierViewAlias()), plan, mode);
}
if (nextDirView == null) {
// If we failed to find a dir in the next tier to move this block, evict it and
// continue. Normally this should not happen.
plan.toEvict().add(new Pair<>(blockId, block.getBlockLocation()));
candidateDirView.markBlockMoveOut(blockId, block.getBlockSize());
continue;
}
plan.toMove().add(new BlockTransferInfo(blockId, block.getBlockLocation(),
nextDirView.toBlockStoreLocation()));
candidateDirView.markBlockMoveOut(blockId, block.getBlockSize());
nextDirView.markBlockMoveIn(blockId, block.getBlockSize());
} catch (BlockDoesNotExistException e) {
continue;
}
}
}
return candidateDirView;
} } |
public class class_name {
public String modifyData(String data, String type, DataTable modifications) throws Exception {
String modifiedData = data;
String typeJsonObject = "";
String nullValue = "";
JSONArray jArray;
JSONObject jObject;
Double jNumber;
Long jLong;
Boolean jBoolean;
boolean array = false;
if ("json".equals(type) || "gov".equals(type)) {
LinkedHashMap jsonAsMap = new LinkedHashMap();
for (int i = 0; i < modifications.raw().size(); i++) {
String composeKey = modifications.raw().get(i).get(0);
String operation = modifications.raw().get(i).get(1);
String newValue = modifications.raw().get(i).get(2);
if (modifications.raw().get(0).size() == 4) {
typeJsonObject = modifications.raw().get(i).get(3);
}
if (modifiedData.startsWith("[") && modifiedData.endsWith("]")) {
modifiedData = "{\"content\":" + modifiedData + "}";
array = true;
} else {
JsonObject object = new JsonObject(JsonValue.readHjson(modifiedData).asObject());
removeNulls(object);
modifiedData = JsonValue.readHjson(object.toString()).toString();
}
switch (operation.toUpperCase()) {
case "DELETE":
if (array) {
composeKey = "$.content" + composeKey.substring(1, composeKey.length());
}
jsonAsMap = JsonPath.parse(modifiedData).delete(composeKey).json();
break;
case "ADD":
if (array) {
composeKey = "$.content" + composeKey.substring(1, composeKey.length());
}
// Get the last key
String newKey;
String newComposeKey;
if (composeKey.contains(".")) {
newKey = composeKey.substring(composeKey.lastIndexOf('.') + 1);
newComposeKey = composeKey.substring(0, composeKey.lastIndexOf('.'));
} else {
newKey = composeKey;
newComposeKey = "$";
}
if ("array".equals(typeJsonObject)) {
jArray = new JSONArray();
if (!"[]".equals(newValue)) {
jArray = new JSONArray(newValue);
}
jsonAsMap = JsonPath.parse(modifiedData).put(newComposeKey, newKey, jArray).json();
break;
} else if ("object".equals(typeJsonObject)) {
jObject = new JSONObject();
if (!"{}".equals(newValue)) {
jObject = new JSONObject(newValue);
}
jsonAsMap = JsonPath.parse(modifiedData).put(newComposeKey, newKey, jObject).json();
break;
} else if ("string".equals(typeJsonObject)) {
jsonAsMap = JsonPath.parse(modifiedData).put(newComposeKey, newKey, newValue).json();
break;
} else if ("number".equals(typeJsonObject)) {
jNumber = new Double(newValue);
jsonAsMap = JsonPath.parse(modifiedData).put(newComposeKey, newKey, jNumber).json();
break;
} else if ("long".equals(typeJsonObject)) {
jLong = new Long(newValue);
jsonAsMap = JsonPath.parse(modifiedData).set(composeKey, jLong).json();
break;
} else if ("boolean".equals(typeJsonObject)) {
jBoolean = new Boolean(newValue);
jsonAsMap = JsonPath.parse(modifiedData).put(newComposeKey, newKey, jBoolean).json();
break;
} else if ("null".equals(typeJsonObject)) {
nullValue = JsonPath.parse(modifiedData).put(newComposeKey, newKey, null).jsonString();
break;
} else {
String replaceValue = JsonPath.parse(modifiedData).read(composeKey);
String toBeReplaced = newValue.split("->")[0];
String replacement = newValue.split("->")[1];
newValue = replaceValue.replace(toBeReplaced, replacement);
jsonAsMap = JsonPath.parse(modifiedData).put(newComposeKey, newKey, newValue).json();
break;
}
// jsonAsMap = JsonPath.parse(modifiedData).put(newComposeKey, newKey, newValue).json();
// break;
case "UPDATE":
if (array) {
composeKey = "$.content" + composeKey.substring(1, composeKey.length());
}
jsonAsMap = JsonPath.parse(modifiedData).set(composeKey, newValue).json();
break;
case "APPEND":
if (array) {
composeKey = "$.content" + composeKey.substring(1, composeKey.length());
}
String appendValue = JsonPath.parse(modifiedData).read(composeKey);
jsonAsMap = JsonPath.parse(modifiedData).set(composeKey, appendValue + newValue).json();
break;
case "PREPEND":
if (array) {
composeKey = "$.content" + composeKey.substring(1, composeKey.length());
}
String prependValue = JsonPath.parse(modifiedData).read(composeKey);
jsonAsMap = JsonPath.parse(modifiedData).set(composeKey, newValue + prependValue).json();
break;
case "REPLACE":
if (array) {
composeKey = "$.content" + composeKey.substring(1, composeKey.length());
}
if ("array".equals(typeJsonObject)) {
jArray = new JSONArray();
if (!"[]".equals(newValue)) {
jArray = new JSONArray(newValue);
}
jsonAsMap = JsonPath.parse(modifiedData).set(composeKey, jArray).json();
break;
} else if ("object".equals(typeJsonObject)) {
jObject = new JSONObject();
if (!"{}".equals(newValue)) {
jObject = new JSONObject(newValue);
}
jsonAsMap = JsonPath.parse(modifiedData).set(composeKey, jObject).json();
break;
} else if ("string".equals(typeJsonObject)) {
jsonAsMap = JsonPath.parse(modifiedData).set(composeKey, newValue).json();
break;
} else if ("number".equals(typeJsonObject)) {
jNumber = new Double(newValue);
jsonAsMap = JsonPath.parse(modifiedData).set(composeKey, jNumber).json();
break;
} else if ("long".equals(typeJsonObject)) {
jLong = new Long(newValue);
jsonAsMap = JsonPath.parse(modifiedData).set(composeKey, jLong).json();
break;
} else if ("boolean".equals(typeJsonObject)) {
jBoolean = new Boolean(newValue);
jsonAsMap = JsonPath.parse(modifiedData).set(composeKey, jBoolean).json();
break;
} else if ("null".equals(typeJsonObject)) {
nullValue = JsonPath.parse(modifiedData).set(composeKey, null).jsonString();
break;
} else {
String replaceValue = JsonPath.parse(modifiedData).read(composeKey);
String toBeReplaced = newValue.split("->")[0];
String replacement = newValue.split("->")[1];
newValue = replaceValue.replace(toBeReplaced, replacement);
jsonAsMap = JsonPath.parse(modifiedData).set(composeKey, newValue).json();
break;
}
case "ADDTO":
if (array) {
composeKey = "$.content" + composeKey.substring(1, composeKey.length());
}
if ("array".equals(typeJsonObject)) {
jArray = new JSONArray();
if (!"[]".equals(newValue)) {
jArray = new JSONArray(newValue);
}
jsonAsMap = JsonPath.parse(modifiedData).add(composeKey, jArray).json();
break;
} else if ("object".equals(typeJsonObject)) {
jObject = new JSONObject();
if (!"{}".equals(newValue)) {
jObject = new JSONObject(newValue);
}
jsonAsMap = JsonPath.parse(modifiedData).add(composeKey, jObject).json();
break;
} else if ("string".equals(typeJsonObject)) {
jsonAsMap = JsonPath.parse(modifiedData).add(composeKey, newValue).json();
break;
} else if ("number".equals(typeJsonObject)) {
jNumber = new Double(newValue);
jsonAsMap = JsonPath.parse(modifiedData).add(composeKey, jNumber).json();
break;
} else if ("long".equals(typeJsonObject)) {
jLong = new Long(newValue);
jsonAsMap = JsonPath.parse(modifiedData).set(composeKey, jLong).json();
break;
} else if ("boolean".equals(typeJsonObject)) {
jBoolean = new Boolean(newValue);
jsonAsMap = JsonPath.parse(modifiedData).add(composeKey, jBoolean).json();
break;
} else if ("null".equals(typeJsonObject)) {
nullValue = JsonPath.parse(modifiedData).add(composeKey, null).jsonString();
break;
} else {
// TO-DO: understand newValue.split("->")[0]; and newValue.split("->")[1];
break;
}
case "HEADER":
if (array) {
composeKey = "$.content" + composeKey.substring(1, composeKey.length());
}
this.headers.put(composeKey, newValue);
break;
default:
throw new Exception("Modification type does not exist: " + operation);
}
modifiedData = new JSONObject(jsonAsMap).toString();
if (!"".equals(nullValue)) {
modifiedData = nullValue;
}
modifiedData = modifiedData.replaceAll("\"TO_BE_NULL\"", "null");
}
} else {
for (int i = 0; i < modifications.raw().size(); i++) {
String value = modifications.raw().get(i).get(0);
String operation = modifications.raw().get(i).get(1);
String newValue = modifications.raw().get(i).get(2);
switch (operation.toUpperCase()) {
case "DELETE":
modifiedData = modifiedData.replace(value, "");
break;
case "ADD":
case "APPEND":
modifiedData = modifiedData + newValue;
break;
case "UPDATE":
case "REPLACE":
modifiedData = modifiedData.replace(value, newValue);
break;
case "PREPEND":
modifiedData = newValue + modifiedData;
break;
case "HEADER":
this.headers.put(value, newValue);
break;
default:
throw new Exception("Modification type does not exist: " + operation);
}
}
}
if (array) {
modifiedData = modifiedData.substring(11, modifiedData.length() - 1);
}
return modifiedData;
} } | public class class_name {
public String modifyData(String data, String type, DataTable modifications) throws Exception {
String modifiedData = data;
String typeJsonObject = "";
String nullValue = "";
JSONArray jArray;
JSONObject jObject;
Double jNumber;
Long jLong;
Boolean jBoolean;
boolean array = false;
if ("json".equals(type) || "gov".equals(type)) {
LinkedHashMap jsonAsMap = new LinkedHashMap();
for (int i = 0; i < modifications.raw().size(); i++) {
String composeKey = modifications.raw().get(i).get(0);
String operation = modifications.raw().get(i).get(1);
String newValue = modifications.raw().get(i).get(2);
if (modifications.raw().get(0).size() == 4) {
typeJsonObject = modifications.raw().get(i).get(3); // depends on control dependency: [if], data = [none]
}
if (modifiedData.startsWith("[") && modifiedData.endsWith("]")) {
modifiedData = "{\"content\":" + modifiedData + "}"; // depends on control dependency: [if], data = [none]
array = true; // depends on control dependency: [if], data = [none]
} else {
JsonObject object = new JsonObject(JsonValue.readHjson(modifiedData).asObject());
removeNulls(object); // depends on control dependency: [if], data = [none]
modifiedData = JsonValue.readHjson(object.toString()).toString(); // depends on control dependency: [if], data = [none]
}
switch (operation.toUpperCase()) {
case "DELETE":
if (array) {
composeKey = "$.content" + composeKey.substring(1, composeKey.length()); // depends on control dependency: [if], data = [none]
}
jsonAsMap = JsonPath.parse(modifiedData).delete(composeKey).json(); // depends on control dependency: [for], data = [none]
break;
case "ADD":
if (array) {
composeKey = "$.content" + composeKey.substring(1, composeKey.length()); // depends on control dependency: [if], data = [none]
}
// Get the last key
String newKey;
String newComposeKey;
if (composeKey.contains(".")) {
newKey = composeKey.substring(composeKey.lastIndexOf('.') + 1); // depends on control dependency: [if], data = [none]
newComposeKey = composeKey.substring(0, composeKey.lastIndexOf('.')); // depends on control dependency: [if], data = [none]
} else {
newKey = composeKey; // depends on control dependency: [if], data = [none]
newComposeKey = "$"; // depends on control dependency: [if], data = [none]
}
if ("array".equals(typeJsonObject)) {
jArray = new JSONArray(); // depends on control dependency: [if], data = [none]
if (!"[]".equals(newValue)) {
jArray = new JSONArray(newValue); // depends on control dependency: [if], data = [none]
}
jsonAsMap = JsonPath.parse(modifiedData).put(newComposeKey, newKey, jArray).json(); // depends on control dependency: [if], data = [none]
break;
} else if ("object".equals(typeJsonObject)) {
jObject = new JSONObject(); // depends on control dependency: [if], data = [none]
if (!"{}".equals(newValue)) {
jObject = new JSONObject(newValue); // depends on control dependency: [if], data = [none]
}
jsonAsMap = JsonPath.parse(modifiedData).put(newComposeKey, newKey, jObject).json(); // depends on control dependency: [if], data = [none]
break;
} else if ("string".equals(typeJsonObject)) {
jsonAsMap = JsonPath.parse(modifiedData).put(newComposeKey, newKey, newValue).json(); // depends on control dependency: [if], data = [none]
break;
} else if ("number".equals(typeJsonObject)) {
jNumber = new Double(newValue); // depends on control dependency: [if], data = [none]
jsonAsMap = JsonPath.parse(modifiedData).put(newComposeKey, newKey, jNumber).json(); // depends on control dependency: [if], data = [none]
break;
} else if ("long".equals(typeJsonObject)) {
jLong = new Long(newValue); // depends on control dependency: [if], data = [none]
jsonAsMap = JsonPath.parse(modifiedData).set(composeKey, jLong).json(); // depends on control dependency: [if], data = [none]
break;
} else if ("boolean".equals(typeJsonObject)) {
jBoolean = new Boolean(newValue); // depends on control dependency: [if], data = [none]
jsonAsMap = JsonPath.parse(modifiedData).put(newComposeKey, newKey, jBoolean).json(); // depends on control dependency: [if], data = [none]
break;
} else if ("null".equals(typeJsonObject)) {
nullValue = JsonPath.parse(modifiedData).put(newComposeKey, newKey, null).jsonString(); // depends on control dependency: [if], data = [none]
break;
} else {
String replaceValue = JsonPath.parse(modifiedData).read(composeKey);
String toBeReplaced = newValue.split("->")[0];
String replacement = newValue.split("->")[1];
newValue = replaceValue.replace(toBeReplaced, replacement); // depends on control dependency: [if], data = [none]
jsonAsMap = JsonPath.parse(modifiedData).put(newComposeKey, newKey, newValue).json(); // depends on control dependency: [if], data = [none]
break;
}
// jsonAsMap = JsonPath.parse(modifiedData).put(newComposeKey, newKey, newValue).json();
// break;
case "UPDATE":
if (array) {
composeKey = "$.content" + composeKey.substring(1, composeKey.length()); // depends on control dependency: [if], data = [none]
}
jsonAsMap = JsonPath.parse(modifiedData).set(composeKey, newValue).json(); // depends on control dependency: [for], data = [none]
break;
case "APPEND":
if (array) {
composeKey = "$.content" + composeKey.substring(1, composeKey.length()); // depends on control dependency: [if], data = [none]
}
String appendValue = JsonPath.parse(modifiedData).read(composeKey);
jsonAsMap = JsonPath.parse(modifiedData).set(composeKey, appendValue + newValue).json(); // depends on control dependency: [for], data = [none]
break;
case "PREPEND":
if (array) {
composeKey = "$.content" + composeKey.substring(1, composeKey.length()); // depends on control dependency: [if], data = [none]
}
String prependValue = JsonPath.parse(modifiedData).read(composeKey);
jsonAsMap = JsonPath.parse(modifiedData).set(composeKey, newValue + prependValue).json(); // depends on control dependency: [for], data = [none]
break;
case "REPLACE":
if (array) {
composeKey = "$.content" + composeKey.substring(1, composeKey.length()); // depends on control dependency: [if], data = [none]
}
if ("array".equals(typeJsonObject)) {
jArray = new JSONArray(); // depends on control dependency: [if], data = [none]
if (!"[]".equals(newValue)) {
jArray = new JSONArray(newValue); // depends on control dependency: [if], data = [none]
}
jsonAsMap = JsonPath.parse(modifiedData).set(composeKey, jArray).json(); // depends on control dependency: [if], data = [none]
break;
} else if ("object".equals(typeJsonObject)) {
jObject = new JSONObject(); // depends on control dependency: [if], data = [none]
if (!"{}".equals(newValue)) {
jObject = new JSONObject(newValue); // depends on control dependency: [if], data = [none]
}
jsonAsMap = JsonPath.parse(modifiedData).set(composeKey, jObject).json(); // depends on control dependency: [if], data = [none]
break;
} else if ("string".equals(typeJsonObject)) {
jsonAsMap = JsonPath.parse(modifiedData).set(composeKey, newValue).json(); // depends on control dependency: [if], data = [none]
break;
} else if ("number".equals(typeJsonObject)) {
jNumber = new Double(newValue); // depends on control dependency: [if], data = [none]
jsonAsMap = JsonPath.parse(modifiedData).set(composeKey, jNumber).json(); // depends on control dependency: [if], data = [none]
break;
} else if ("long".equals(typeJsonObject)) {
jLong = new Long(newValue); // depends on control dependency: [if], data = [none]
jsonAsMap = JsonPath.parse(modifiedData).set(composeKey, jLong).json(); // depends on control dependency: [if], data = [none]
break;
} else if ("boolean".equals(typeJsonObject)) {
jBoolean = new Boolean(newValue); // depends on control dependency: [if], data = [none]
jsonAsMap = JsonPath.parse(modifiedData).set(composeKey, jBoolean).json(); // depends on control dependency: [if], data = [none]
break;
} else if ("null".equals(typeJsonObject)) {
nullValue = JsonPath.parse(modifiedData).set(composeKey, null).jsonString(); // depends on control dependency: [if], data = [none]
break;
} else {
String replaceValue = JsonPath.parse(modifiedData).read(composeKey);
String toBeReplaced = newValue.split("->")[0];
String replacement = newValue.split("->")[1];
newValue = replaceValue.replace(toBeReplaced, replacement); // depends on control dependency: [if], data = [none]
jsonAsMap = JsonPath.parse(modifiedData).set(composeKey, newValue).json(); // depends on control dependency: [if], data = [none]
break;
}
case "ADDTO":
if (array) {
composeKey = "$.content" + composeKey.substring(1, composeKey.length()); // depends on control dependency: [if], data = [none]
}
if ("array".equals(typeJsonObject)) {
jArray = new JSONArray(); // depends on control dependency: [if], data = [none]
if (!"[]".equals(newValue)) {
jArray = new JSONArray(newValue); // depends on control dependency: [if], data = [none]
}
jsonAsMap = JsonPath.parse(modifiedData).add(composeKey, jArray).json(); // depends on control dependency: [if], data = [none]
break;
} else if ("object".equals(typeJsonObject)) {
jObject = new JSONObject(); // depends on control dependency: [if], data = [none]
if (!"{}".equals(newValue)) {
jObject = new JSONObject(newValue); // depends on control dependency: [if], data = [none]
}
jsonAsMap = JsonPath.parse(modifiedData).add(composeKey, jObject).json(); // depends on control dependency: [if], data = [none]
break;
} else if ("string".equals(typeJsonObject)) {
jsonAsMap = JsonPath.parse(modifiedData).add(composeKey, newValue).json(); // depends on control dependency: [if], data = [none]
break;
} else if ("number".equals(typeJsonObject)) {
jNumber = new Double(newValue); // depends on control dependency: [if], data = [none]
jsonAsMap = JsonPath.parse(modifiedData).add(composeKey, jNumber).json(); // depends on control dependency: [if], data = [none]
break;
} else if ("long".equals(typeJsonObject)) {
jLong = new Long(newValue); // depends on control dependency: [if], data = [none]
jsonAsMap = JsonPath.parse(modifiedData).set(composeKey, jLong).json(); // depends on control dependency: [if], data = [none]
break;
} else if ("boolean".equals(typeJsonObject)) {
jBoolean = new Boolean(newValue); // depends on control dependency: [if], data = [none]
jsonAsMap = JsonPath.parse(modifiedData).add(composeKey, jBoolean).json(); // depends on control dependency: [if], data = [none]
break;
} else if ("null".equals(typeJsonObject)) {
nullValue = JsonPath.parse(modifiedData).add(composeKey, null).jsonString(); // depends on control dependency: [if], data = [none]
break;
} else {
// TO-DO: understand newValue.split("->")[0]; and newValue.split("->")[1];
break;
}
case "HEADER":
if (array) {
composeKey = "$.content" + composeKey.substring(1, composeKey.length()); // depends on control dependency: [if], data = [none]
}
this.headers.put(composeKey, newValue); // depends on control dependency: [for], data = [none]
break;
default:
throw new Exception("Modification type does not exist: " + operation);
}
modifiedData = new JSONObject(jsonAsMap).toString();
if (!"".equals(nullValue)) {
modifiedData = nullValue; // depends on control dependency: [if], data = [none]
}
modifiedData = modifiedData.replaceAll("\"TO_BE_NULL\"", "null");
}
} else {
for (int i = 0; i < modifications.raw().size(); i++) {
String value = modifications.raw().get(i).get(0);
String operation = modifications.raw().get(i).get(1);
String newValue = modifications.raw().get(i).get(2);
switch (operation.toUpperCase()) {
case "DELETE":
modifiedData = modifiedData.replace(value, "");
break;
case "ADD":
case "APPEND":
modifiedData = modifiedData + newValue;
break;
case "UPDATE":
case "REPLACE":
modifiedData = modifiedData.replace(value, newValue);
break;
case "PREPEND":
modifiedData = newValue + modifiedData;
break;
case "HEADER":
this.headers.put(value, newValue);
break;
default:
throw new Exception("Modification type does not exist: " + operation);
}
}
}
if (array) {
modifiedData = modifiedData.substring(11, modifiedData.length() - 1);
}
return modifiedData;
} } |
public class class_name {
public <T> Collection<T> speciesNew(Collection<?> collection, int size)
{
if (size < 0)
{
throw new IllegalArgumentException("size may not be < 0 but was " + size);
}
if (collection instanceof Proxy
|| collection instanceof PriorityQueue
|| collection instanceof PriorityBlockingQueue
|| collection instanceof SortedSet)
{
return DefaultSpeciesNewStrategy.createNewInstanceForCollectionType(collection);
}
Constructor<?> constructor = ReflectionHelper.getConstructor(collection.getClass(), SIZE_CONSTRUCTOR_TYPES);
if (constructor != null)
{
return (Collection<T>) ReflectionHelper.newInstance(constructor, size);
}
return this.speciesNew(collection);
} } | public class class_name {
public <T> Collection<T> speciesNew(Collection<?> collection, int size)
{
if (size < 0)
{
throw new IllegalArgumentException("size may not be < 0 but was " + size);
}
if (collection instanceof Proxy
|| collection instanceof PriorityQueue
|| collection instanceof PriorityBlockingQueue
|| collection instanceof SortedSet)
{
return DefaultSpeciesNewStrategy.createNewInstanceForCollectionType(collection); // depends on control dependency: [if], data = [none]
}
Constructor<?> constructor = ReflectionHelper.getConstructor(collection.getClass(), SIZE_CONSTRUCTOR_TYPES);
if (constructor != null)
{
return (Collection<T>) ReflectionHelper.newInstance(constructor, size); // depends on control dependency: [if], data = [(constructor]
}
return this.speciesNew(collection);
} } |
public class class_name {
public void addStoreDefinition(StoreDefinition storeDef) {
// acquire write lock
writeLock.lock();
try {
// Check if store already exists
if(this.storeNames.contains(storeDef.getName())) {
throw new VoldemortException("Store already exists !");
}
// Check for backwards compatibility
StoreDefinitionUtils.validateSchemaAsNeeded(storeDef);
// Otherwise add to the STORES directory
StoreDefinitionsMapper mapper = new StoreDefinitionsMapper();
String storeDefStr = mapper.writeStore(storeDef);
Versioned<String> versionedValueStr = new Versioned<String>(storeDefStr);
this.storeDefinitionsStorageEngine.put(storeDef.getName(), versionedValueStr, null);
// Update the metadata cache
this.metadataCache.put(storeDef.getName(), new Versioned<Object>(storeDefStr));
// Re-initialize the store definitions. This is primarily required
// to re-create the value for key: 'stores.xml'. This is necessary
// for backwards compatibility.
initStoreDefinitions(null);
updateRoutingStrategies(getCluster(), getStoreDefList());
} finally {
writeLock.unlock();
}
} } | public class class_name {
public void addStoreDefinition(StoreDefinition storeDef) {
// acquire write lock
writeLock.lock();
try {
// Check if store already exists
if(this.storeNames.contains(storeDef.getName())) {
throw new VoldemortException("Store already exists !");
}
// Check for backwards compatibility
StoreDefinitionUtils.validateSchemaAsNeeded(storeDef); // depends on control dependency: [try], data = [none]
// Otherwise add to the STORES directory
StoreDefinitionsMapper mapper = new StoreDefinitionsMapper();
String storeDefStr = mapper.writeStore(storeDef);
Versioned<String> versionedValueStr = new Versioned<String>(storeDefStr);
this.storeDefinitionsStorageEngine.put(storeDef.getName(), versionedValueStr, null); // depends on control dependency: [try], data = [none]
// Update the metadata cache
this.metadataCache.put(storeDef.getName(), new Versioned<Object>(storeDefStr)); // depends on control dependency: [try], data = [none]
// Re-initialize the store definitions. This is primarily required
// to re-create the value for key: 'stores.xml'. This is necessary
// for backwards compatibility.
initStoreDefinitions(null); // depends on control dependency: [try], data = [none]
updateRoutingStrategies(getCluster(), getStoreDefList()); // depends on control dependency: [try], data = [none]
} finally {
writeLock.unlock();
}
} } |
public class class_name {
public CoverageBuilder analyzeFiles(ExecutionDataStore executionDataStore, Collection<File> classFiles) {
CoverageBuilder coverageBuilder = new CoverageBuilder();
if (useCurrentBinaryFormat) {
Analyzer analyzer = new Analyzer(executionDataStore, coverageBuilder);
for (File classFile : classFiles) {
analyzeClassFile(analyzer, classFile);
}
} else {
org.jacoco.previous.core.analysis.Analyzer analyzer = new org.jacoco.previous.core.analysis.Analyzer(executionDataStore, coverageBuilder);
for (File classFile : classFiles) {
analyzeClassFile(analyzer, classFile);
}
}
return coverageBuilder;
} } | public class class_name {
public CoverageBuilder analyzeFiles(ExecutionDataStore executionDataStore, Collection<File> classFiles) {
CoverageBuilder coverageBuilder = new CoverageBuilder();
if (useCurrentBinaryFormat) {
Analyzer analyzer = new Analyzer(executionDataStore, coverageBuilder);
for (File classFile : classFiles) {
analyzeClassFile(analyzer, classFile); // depends on control dependency: [for], data = [classFile]
}
} else {
org.jacoco.previous.core.analysis.Analyzer analyzer = new org.jacoco.previous.core.analysis.Analyzer(executionDataStore, coverageBuilder);
for (File classFile : classFiles) {
analyzeClassFile(analyzer, classFile); // depends on control dependency: [for], data = [classFile]
}
}
return coverageBuilder;
} } |
public class class_name {
public String getLabel(final String caption, final boolean captizliseFirstLetter) {
if (captizliseFirstLetter) {
return JKFormatUtil.capitalizeFirstLetters(getLabel(caption));
} else {
return getLabel(caption);
}
} } | public class class_name {
public String getLabel(final String caption, final boolean captizliseFirstLetter) {
if (captizliseFirstLetter) {
return JKFormatUtil.capitalizeFirstLetters(getLabel(caption));
// depends on control dependency: [if], data = [none]
} else {
return getLabel(caption);
// depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
private List<String> getFileNames() throws IOException {
if (fileNames == null) {
fileNames = new ArrayList<>();
timeStepsPerFile = tDim.getSize();
if (!isTemplate()) { // single file
fileNames.add(getFullPath(getDataFile()));
} else { // figure out template type
long start = System.currentTimeMillis();
List<String> fileSet = new ArrayList<>();
String template = getDataFile();
if (GradsTimeDimension.hasTimeTemplate(template)) {
if (template.contains(GradsEnsembleDimension.ENS_TEMPLATE_ID)) {
templateType = ENS_TIME_TEMPLATE;
} else {
templateType = TIME_TEMPLATE;
}
} else { // not time - either ens or chsub
if (template.contains(GradsEnsembleDimension.ENS_TEMPLATE_ID)) {
templateType = ENS_TEMPLATE;
} else {
templateType = TIME_TEMPLATE;
}
}
if (templateType == ENS_TEMPLATE) {
for (int e = 0; e < eDim.getSize(); e++) {
fileSet.add(
getFullPath(
eDim.replaceFileTemplate(template, e)));
}
} else if ((templateType == TIME_TEMPLATE)
|| (templateType == ENS_TIME_TEMPLATE)) {
int numens = (templateType == TIME_TEMPLATE)
? 1
: eDim.getSize();
for (int t = 0; t < tDim.getSize(); t++) {
for (int e = 0; e < numens; e++) {
String file = getFileName(e, t);
if (!fileSet.contains(file)) {
fileSet.add(file);
}
}
}
// this'll be a bogus number if chsub was used
timeStepsPerFile = tDim.getSize()
/ (fileSet.size() / numens);
}
//System.out.println("Time to generate file list = "
// + (System.currentTimeMillis() - start));
fileNames.addAll(fileSet);
}
//long start2 = System.currentTimeMillis();
// now make sure they exist
for (String file : fileNames) {
File f = new File(file);
if (!f.exists()) {
log.error("File: " + f + " does not exist");
throw new IOException("File: " + f + " does not exist");
}
}
//System.out.println("Time to check file list = "
// + (System.currentTimeMillis() - start2));
}
return fileNames;
} } | public class class_name {
private List<String> getFileNames() throws IOException {
if (fileNames == null) {
fileNames = new ArrayList<>();
timeStepsPerFile = tDim.getSize();
if (!isTemplate()) { // single file
fileNames.add(getFullPath(getDataFile()));
} else { // figure out template type
long start = System.currentTimeMillis();
List<String> fileSet = new ArrayList<>();
String template = getDataFile();
if (GradsTimeDimension.hasTimeTemplate(template)) {
if (template.contains(GradsEnsembleDimension.ENS_TEMPLATE_ID)) {
templateType = ENS_TIME_TEMPLATE;
// depends on control dependency: [if], data = [none]
} else {
templateType = TIME_TEMPLATE;
// depends on control dependency: [if], data = [none]
}
} else { // not time - either ens or chsub
if (template.contains(GradsEnsembleDimension.ENS_TEMPLATE_ID)) {
templateType = ENS_TEMPLATE;
// depends on control dependency: [if], data = [none]
} else {
templateType = TIME_TEMPLATE;
// depends on control dependency: [if], data = [none]
}
}
if (templateType == ENS_TEMPLATE) {
for (int e = 0; e < eDim.getSize(); e++) {
fileSet.add(
getFullPath(
eDim.replaceFileTemplate(template, e)));
// depends on control dependency: [for], data = [none]
}
} else if ((templateType == TIME_TEMPLATE)
|| (templateType == ENS_TIME_TEMPLATE)) {
int numens = (templateType == TIME_TEMPLATE)
? 1
: eDim.getSize();
for (int t = 0; t < tDim.getSize(); t++) {
for (int e = 0; e < numens; e++) {
String file = getFileName(e, t);
if (!fileSet.contains(file)) {
fileSet.add(file);
// depends on control dependency: [if], data = [none]
}
}
}
// this'll be a bogus number if chsub was used
timeStepsPerFile = tDim.getSize()
/ (fileSet.size() / numens);
// depends on control dependency: [if], data = [none]
}
//System.out.println("Time to generate file list = "
// + (System.currentTimeMillis() - start));
fileNames.addAll(fileSet);
}
//long start2 = System.currentTimeMillis();
// now make sure they exist
for (String file : fileNames) {
File f = new File(file);
if (!f.exists()) {
log.error("File: " + f + " does not exist");
// depends on control dependency: [if], data = [none]
throw new IOException("File: " + f + " does not exist");
}
}
//System.out.println("Time to check file list = "
// + (System.currentTimeMillis() - start2));
}
return fileNames;
} } |
public class class_name {
private OnItemSelectedListener createItemSelectedListener() {
return new OnItemSelectedListener() {
@Override
public void onItemSelected(final AdapterView<?> parent, final View view,
final int position, final long id) {
if (getOnItemSelectedListener() != null) {
getOnItemSelectedListener().onItemSelected(parent, view, position, id);
}
if (isValidatedOnValueChange() && position != 0) {
validate();
}
}
@Override
public void onNothingSelected(final AdapterView<?> parent) {
if (getOnItemSelectedListener() != null) {
getOnItemSelectedListener().onNothingSelected(parent);
}
}
};
} } | public class class_name {
private OnItemSelectedListener createItemSelectedListener() {
return new OnItemSelectedListener() {
@Override
public void onItemSelected(final AdapterView<?> parent, final View view,
final int position, final long id) {
if (getOnItemSelectedListener() != null) {
getOnItemSelectedListener().onItemSelected(parent, view, position, id); // depends on control dependency: [if], data = [none]
}
if (isValidatedOnValueChange() && position != 0) {
validate(); // depends on control dependency: [if], data = [none]
}
}
@Override
public void onNothingSelected(final AdapterView<?> parent) {
if (getOnItemSelectedListener() != null) {
getOnItemSelectedListener().onNothingSelected(parent); // depends on control dependency: [if], data = [none]
}
}
};
} } |
public class class_name {
private String[] createArchivesArray() {
Collection<String> archiveExtensions = new ArrayList<>();
archiveExtensions.addAll(ZIP_EXTENSIONS);
archiveExtensions.addAll(GEM_EXTENSIONS);
archiveExtensions.addAll(TAR_EXTENSIONS);
String[] archiveIncludesPattern = new String[archiveExtensions.size()];
int i = 0;
for (String extension : archiveExtensions) {
archiveIncludesPattern[i++] = GLOB_PATTERN_PREFIX + extension;
}
return archiveIncludesPattern;
} } | public class class_name {
private String[] createArchivesArray() {
Collection<String> archiveExtensions = new ArrayList<>();
archiveExtensions.addAll(ZIP_EXTENSIONS);
archiveExtensions.addAll(GEM_EXTENSIONS);
archiveExtensions.addAll(TAR_EXTENSIONS);
String[] archiveIncludesPattern = new String[archiveExtensions.size()];
int i = 0;
for (String extension : archiveExtensions) {
archiveIncludesPattern[i++] = GLOB_PATTERN_PREFIX + extension; // depends on control dependency: [for], data = [extension]
}
return archiveIncludesPattern;
} } |
public class class_name {
@Nullable
public static String getRowValue (@Nonnull final Row aRow, @Nonnull final String sColumnID)
{
for (final Value aValue : aRow.getValue ())
{
final String sID = getColumnElementID (aValue.getColumnRef ());
if (sID.equals (sColumnID))
{
final SimpleValue aSimpleValue = aValue.getSimpleValue ();
return aSimpleValue != null ? aSimpleValue.getValue () : null;
}
}
return null;
} } | public class class_name {
@Nullable
public static String getRowValue (@Nonnull final Row aRow, @Nonnull final String sColumnID)
{
for (final Value aValue : aRow.getValue ())
{
final String sID = getColumnElementID (aValue.getColumnRef ());
if (sID.equals (sColumnID))
{
final SimpleValue aSimpleValue = aValue.getSimpleValue ();
return aSimpleValue != null ? aSimpleValue.getValue () : null; // depends on control dependency: [if], data = [none]
}
}
return null;
} } |
public class class_name {
public static void close(final HttpResponse response) {
if (response instanceof CloseableHttpResponse) {
val closeableHttpResponse = (CloseableHttpResponse) response;
try {
closeableHttpResponse.close();
} catch (final IOException e) {
LOGGER.error(e.getMessage(), e);
}
}
} } | public class class_name {
public static void close(final HttpResponse response) {
if (response instanceof CloseableHttpResponse) {
val closeableHttpResponse = (CloseableHttpResponse) response;
try {
closeableHttpResponse.close(); // depends on control dependency: [try], data = [none]
} catch (final IOException e) {
LOGGER.error(e.getMessage(), e);
} // depends on control dependency: [catch], data = [none]
}
} } |
public class class_name {
public static Pair<String, String> decodeDelegationKey(String encodedValue) {
List<String> split = Strings.split(encodedValue, DEFAULT_SEVERITY_SEPARATOR);
if (split.size() == 2) {
return Tuples.create(split.get(0), split.get(1));
} else if (split.size() == 1) {
return Tuples.create(split.get(0), SeverityConverter.SEVERITY_WARNING);
} else {
return null;
}
} } | public class class_name {
public static Pair<String, String> decodeDelegationKey(String encodedValue) {
List<String> split = Strings.split(encodedValue, DEFAULT_SEVERITY_SEPARATOR);
if (split.size() == 2) {
return Tuples.create(split.get(0), split.get(1)); // depends on control dependency: [if], data = [none]
} else if (split.size() == 1) {
return Tuples.create(split.get(0), SeverityConverter.SEVERITY_WARNING); // depends on control dependency: [if], data = [none]
} else {
return null; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
private boolean fillBuffer(int minimum) throws IOException {
char[] buffer = this.buffer;
// Before clobbering the old characters, update where buffer starts
// Using locals here saves ~2%.
int line = bufferStartLine;
int column = bufferStartColumn;
for (int i = 0, p = pos; i < p; i++) {
if (buffer[i] == '\n') {
line++;
column = 1;
} else {
column++;
}
}
bufferStartLine = line;
bufferStartColumn = column;
if (limit != pos) {
limit -= pos;
System.arraycopy(buffer, pos, buffer, 0, limit);
} else {
limit = 0;
}
pos = 0;
int total;
while ((total = in.read(buffer, limit, buffer.length - limit)) != -1) {
limit += total;
// if this is the first read, consume an optional byte order mark (BOM) if it exists
if (bufferStartLine == 1 && bufferStartColumn == 1 && limit > 0 && buffer[0] == '\ufeff') {
pos++;
bufferStartColumn--;
}
if (limit >= minimum) {
return true;
}
}
return false;
} } | public class class_name {
private boolean fillBuffer(int minimum) throws IOException {
char[] buffer = this.buffer;
// Before clobbering the old characters, update where buffer starts
// Using locals here saves ~2%.
int line = bufferStartLine;
int column = bufferStartColumn;
for (int i = 0, p = pos; i < p; i++) {
if (buffer[i] == '\n') {
line++; // depends on control dependency: [if], data = [none]
column = 1; // depends on control dependency: [if], data = [none]
} else {
column++; // depends on control dependency: [if], data = [none]
}
}
bufferStartLine = line;
bufferStartColumn = column;
if (limit != pos) {
limit -= pos;
System.arraycopy(buffer, pos, buffer, 0, limit);
} else {
limit = 0;
}
pos = 0;
int total;
while ((total = in.read(buffer, limit, buffer.length - limit)) != -1) {
limit += total;
// if this is the first read, consume an optional byte order mark (BOM) if it exists
if (bufferStartLine == 1 && bufferStartColumn == 1 && limit > 0 && buffer[0] == '\ufeff') {
pos++; // depends on control dependency: [if], data = [none]
bufferStartColumn--; // depends on control dependency: [if], data = [none]
}
if (limit >= minimum) {
return true; // depends on control dependency: [if], data = [none]
}
}
return false;
} } |
public class class_name {
public boolean recordConstancy() {
if (!currentInfo.hasConstAnnotation()) {
currentInfo.setConstant(true);
populated = true;
return true;
} else {
return false;
}
} } | public class class_name {
public boolean recordConstancy() {
if (!currentInfo.hasConstAnnotation()) {
currentInfo.setConstant(true); // depends on control dependency: [if], data = [none]
populated = true; // depends on control dependency: [if], data = [none]
return true; // depends on control dependency: [if], data = [none]
} else {
return false; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
private Map<String, String> collectModuleSpecificProps(DefaultInputModule module) {
Map<String, String> moduleSpecificProps = new HashMap<>();
AbstractProjectOrModule parent = hierarchy.parent(module);
if (parent == null) {
moduleSpecificProps.putAll(module.properties());
} else {
Map<String, String> parentProps = parent.properties();
for (Map.Entry<String, String> entry : module.properties().entrySet()) {
if (!parentProps.containsKey(entry.getKey()) || !parentProps.get(entry.getKey()).equals(entry.getValue())) {
moduleSpecificProps.put(entry.getKey(), entry.getValue());
}
}
}
return moduleSpecificProps;
} } | public class class_name {
private Map<String, String> collectModuleSpecificProps(DefaultInputModule module) {
Map<String, String> moduleSpecificProps = new HashMap<>();
AbstractProjectOrModule parent = hierarchy.parent(module);
if (parent == null) {
moduleSpecificProps.putAll(module.properties()); // depends on control dependency: [if], data = [none]
} else {
Map<String, String> parentProps = parent.properties();
for (Map.Entry<String, String> entry : module.properties().entrySet()) {
if (!parentProps.containsKey(entry.getKey()) || !parentProps.get(entry.getKey()).equals(entry.getValue())) {
moduleSpecificProps.put(entry.getKey(), entry.getValue()); // depends on control dependency: [if], data = [none]
}
}
}
return moduleSpecificProps;
} } |
public class class_name {
public int compareKeys(int iAreaDesc)
{
int iCompareValue = 0;
int iKeyFields = this.getKeyFields() + Constants.MAIN_KEY_FIELD;
for (int iKeyFieldSeq = Constants.MAIN_KEY_FIELD; iKeyFieldSeq < iKeyFields; iKeyFieldSeq++)
{
FieldInfo fldCurrent = this.getField(iKeyFieldSeq);
Object fldTemp = m_rgobjTempData != null ? m_rgobjTempData[iKeyFieldSeq] : null;
iCompareValue = fldCurrent.compareTo(fldTemp);
if (iCompareValue != 0)
break;
}
return iCompareValue;
} } | public class class_name {
public int compareKeys(int iAreaDesc)
{
int iCompareValue = 0;
int iKeyFields = this.getKeyFields() + Constants.MAIN_KEY_FIELD;
for (int iKeyFieldSeq = Constants.MAIN_KEY_FIELD; iKeyFieldSeq < iKeyFields; iKeyFieldSeq++)
{
FieldInfo fldCurrent = this.getField(iKeyFieldSeq);
Object fldTemp = m_rgobjTempData != null ? m_rgobjTempData[iKeyFieldSeq] : null;
iCompareValue = fldCurrent.compareTo(fldTemp); // depends on control dependency: [for], data = [none]
if (iCompareValue != 0)
break;
}
return iCompareValue;
} } |
public class class_name {
public void execute(Runnable task) {
if (stats == null) {
executor.execute(task);
} else {
executor.execute(new MiscTaskStatsCollector(task));
}
} } | public class class_name {
public void execute(Runnable task) {
if (stats == null) {
executor.execute(task); // depends on control dependency: [if], data = [none]
} else {
executor.execute(new MiscTaskStatsCollector(task)); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
@Override
public NetworkConnectionServiceMessage decode(final byte[] data) {
try (final ByteArrayInputStream bais = new ByteArrayInputStream(data)) {
try (final DataInputStream dais = new DataInputStream(bais)) {
final String connFactoryId = dais.readUTF();
final Identifier srcId = factory.getNewInstance(dais.readUTF());
final Identifier destId = factory.getNewInstance(dais.readUTF());
final int size = dais.readInt();
final List list = new ArrayList(size);
final Codec codec = connFactoryMap.get(connFactoryId).getCodec();
Boolean isStreamingCodec = isStreamingCodecMap.get(codec);
if (isStreamingCodec == null) {
isStreamingCodec = codec instanceof StreamingCodec;
isStreamingCodecMap.putIfAbsent(codec, isStreamingCodec);
}
if (isStreamingCodec) {
for (int i = 0; i < size; i++) {
list.add(((StreamingCodec) codec).decodeFromStream(dais));
}
} else {
for (int i = 0; i < size; i++) {
final int byteSize = dais.readInt();
final byte[] bytes = new byte[byteSize];
if (dais.read(bytes) == -1) {
LOG.log(Level.FINE, "No data read because end of stream was reached");
}
list.add(codec.decode(bytes));
}
}
return new NetworkConnectionServiceMessage(
connFactoryId,
srcId,
destId,
list
);
}
} catch (final IOException e) {
throw new RuntimeException("IOException", e);
}
} } | public class class_name {
@Override
public NetworkConnectionServiceMessage decode(final byte[] data) {
try (final ByteArrayInputStream bais = new ByteArrayInputStream(data)) {
try (final DataInputStream dais = new DataInputStream(bais)) {
final String connFactoryId = dais.readUTF();
final Identifier srcId = factory.getNewInstance(dais.readUTF());
final Identifier destId = factory.getNewInstance(dais.readUTF());
final int size = dais.readInt();
final List list = new ArrayList(size);
final Codec codec = connFactoryMap.get(connFactoryId).getCodec();
Boolean isStreamingCodec = isStreamingCodecMap.get(codec);
if (isStreamingCodec == null) {
isStreamingCodec = codec instanceof StreamingCodec; // depends on control dependency: [if], data = [none]
isStreamingCodecMap.putIfAbsent(codec, isStreamingCodec); // depends on control dependency: [if], data = [none]
}
if (isStreamingCodec) {
for (int i = 0; i < size; i++) {
list.add(((StreamingCodec) codec).decodeFromStream(dais)); // depends on control dependency: [for], data = [none]
}
} else {
for (int i = 0; i < size; i++) {
final int byteSize = dais.readInt();
final byte[] bytes = new byte[byteSize];
if (dais.read(bytes) == -1) {
LOG.log(Level.FINE, "No data read because end of stream was reached"); // depends on control dependency: [if], data = [none]
}
list.add(codec.decode(bytes)); // depends on control dependency: [for], data = [none]
}
}
return new NetworkConnectionServiceMessage(
connFactoryId,
srcId,
destId,
list
);
}
} catch (final IOException e) {
throw new RuntimeException("IOException", e);
}
} } |
public class class_name {
private Promise<PublicKey> fetchUserPreKey(final int uid, final int keyGroupId) {
return pickUserGroup(uid, keyGroupId)
.flatMap(new Function<Tuple2<UserKeysGroup, UserKeys>, Promise<PublicKey>>() {
@Override
public Promise<PublicKey> apply(final Tuple2<UserKeysGroup, UserKeys> keyGroups) {
return api(new RequestLoadPrePublicKeys(new ApiUserOutPeer(uid, getUser(uid).getAccessHash()), keyGroupId))
.map(new Function<ResponsePublicKeys, PublicKey>() {
@Override
public PublicKey apply(ResponsePublicKeys response) {
if (response.getPublicKey().size() == 0) {
throw new RuntimeException("User doesn't have pre keys");
}
ApiEncryptionKey key = response.getPublicKey().get(0);
ApiEncryptionKeySignature sig = null;
for (ApiEncryptionKeySignature s : response.getSignatures()) {
if (s.getKeyId() == key.getKeyId() && "Ed25519".equals(s.getSignatureAlg())) {
sig = s;
break;
}
}
if (sig == null) {
throw new RuntimeException("Unable to find public key on server");
}
byte[] keyHash = RatchetKeySignature.hashForSignature(key.getKeyId(), key.getKeyAlg(),
key.getKeyMaterial());
if (!Curve25519.verifySignature(keyGroups.getT1().getIdentityKey().getPublicKey(),
keyHash, sig.getSignature())) {
throw new RuntimeException("Key signature does not isMatch");
}
return new PublicKey(key.getKeyId(), key.getKeyAlg(), key.getKeyMaterial());
}
});
}
});
} } | public class class_name {
private Promise<PublicKey> fetchUserPreKey(final int uid, final int keyGroupId) {
return pickUserGroup(uid, keyGroupId)
.flatMap(new Function<Tuple2<UserKeysGroup, UserKeys>, Promise<PublicKey>>() {
@Override
public Promise<PublicKey> apply(final Tuple2<UserKeysGroup, UserKeys> keyGroups) {
return api(new RequestLoadPrePublicKeys(new ApiUserOutPeer(uid, getUser(uid).getAccessHash()), keyGroupId))
.map(new Function<ResponsePublicKeys, PublicKey>() {
@Override
public PublicKey apply(ResponsePublicKeys response) {
if (response.getPublicKey().size() == 0) {
throw new RuntimeException("User doesn't have pre keys");
}
ApiEncryptionKey key = response.getPublicKey().get(0);
ApiEncryptionKeySignature sig = null;
for (ApiEncryptionKeySignature s : response.getSignatures()) {
if (s.getKeyId() == key.getKeyId() && "Ed25519".equals(s.getSignatureAlg())) {
sig = s; // depends on control dependency: [if], data = [none]
break;
}
}
if (sig == null) {
throw new RuntimeException("Unable to find public key on server");
}
byte[] keyHash = RatchetKeySignature.hashForSignature(key.getKeyId(), key.getKeyAlg(),
key.getKeyMaterial());
if (!Curve25519.verifySignature(keyGroups.getT1().getIdentityKey().getPublicKey(),
keyHash, sig.getSignature())) {
throw new RuntimeException("Key signature does not isMatch");
}
return new PublicKey(key.getKeyId(), key.getKeyAlg(), key.getKeyMaterial());
}
});
}
});
} } |
public class class_name {
protected static double computeH(DoubleArray dist_i, double[] pij_row, double mbeta) {
final int len = dist_i.size();
assert (pij_row.length == len);
double sumP = 0.;
for(int j = 0; j < len; j++) {
sumP += (pij_row[j] = FastMath.exp(dist_i.get(j) * mbeta));
}
if(!(sumP > 0)) {
// All pij are zero. Bad news.
return Double.NEGATIVE_INFINITY;
}
final double s = 1. / sumP; // Scaling factor
double sum = 0.;
// While we could skip pi[i], it should be 0 anyway.
for(int j = 0; j < len; j++) {
sum += dist_i.get(j) * (pij_row[j] *= s);
}
return FastMath.log(sumP) - mbeta * sum;
} } | public class class_name {
protected static double computeH(DoubleArray dist_i, double[] pij_row, double mbeta) {
final int len = dist_i.size();
assert (pij_row.length == len);
double sumP = 0.;
for(int j = 0; j < len; j++) {
sumP += (pij_row[j] = FastMath.exp(dist_i.get(j) * mbeta)); // depends on control dependency: [for], data = [j]
}
if(!(sumP > 0)) {
// All pij are zero. Bad news.
return Double.NEGATIVE_INFINITY; // depends on control dependency: [if], data = [none]
}
final double s = 1. / sumP; // Scaling factor
double sum = 0.;
// While we could skip pi[i], it should be 0 anyway.
for(int j = 0; j < len; j++) {
sum += dist_i.get(j) * (pij_row[j] *= s); // depends on control dependency: [for], data = [j]
}
return FastMath.log(sumP) - mbeta * sum;
} } |
public class class_name {
private static void run(String sourceName, InputStream in, ImageInfo imageInfo, boolean verbose) {
imageInfo.setInput(in);
imageInfo.setDetermineImageNumber(true);
imageInfo.setCollectComments(verbose);
if (imageInfo.check()) {
print(sourceName, imageInfo, verbose);
}
} } | public class class_name {
private static void run(String sourceName, InputStream in, ImageInfo imageInfo, boolean verbose) {
imageInfo.setInput(in);
imageInfo.setDetermineImageNumber(true);
imageInfo.setCollectComments(verbose);
if (imageInfo.check()) {
print(sourceName, imageInfo, verbose); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public void setValueAt( int col, int row, double value ) {
if (makeNew) {
if (isInRaster(col, row)) {
((WritableRandomIter) iter).setSample(col, row, 0, value);
} else {
throw new RuntimeException("Setting value outside of raster.");
}
} else {
throw new RuntimeException("Writing not allowed.");
}
} } | public class class_name {
public void setValueAt( int col, int row, double value ) {
if (makeNew) {
if (isInRaster(col, row)) {
((WritableRandomIter) iter).setSample(col, row, 0, value); // depends on control dependency: [if], data = [none]
} else {
throw new RuntimeException("Setting value outside of raster.");
}
} else {
throw new RuntimeException("Writing not allowed.");
}
} } |
public class class_name {
public void marshall(DisassociateFleetRequest disassociateFleetRequest, ProtocolMarshaller protocolMarshaller) {
if (disassociateFleetRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(disassociateFleetRequest.getFleetName(), FLEETNAME_BINDING);
protocolMarshaller.marshall(disassociateFleetRequest.getStackName(), STACKNAME_BINDING);
} catch (Exception e) {
throw new SdkClientException("Unable to marshall request to JSON: " + e.getMessage(), e);
}
} } | public class class_name {
public void marshall(DisassociateFleetRequest disassociateFleetRequest, ProtocolMarshaller protocolMarshaller) {
if (disassociateFleetRequest == null) {
throw new SdkClientException("Invalid argument passed to marshall(...)");
}
try {
protocolMarshaller.marshall(disassociateFleetRequest.getFleetName(), FLEETNAME_BINDING); // depends on control dependency: [try], data = [none]
protocolMarshaller.marshall(disassociateFleetRequest.getStackName(), STACKNAME_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 boolean processMVBasedQueryFix(StmtTableScan mvTableScan, Set<SchemaColumn> scanColumns, JoinNode joinTree,
List<ParsedColInfo> displayColumns, List<ParsedColInfo> groupByColumns) {
// Check valid cases first
//@TODO
if ( ! (mvTableScan instanceof StmtTargetTableScan)) {
return false;
}
Table table = ((StmtTargetTableScan)mvTableScan).getTargetTable();
assert (table != null);
String mvTableName = table.getTypeName();
Table srcTable = table.getMaterializer();
if (srcTable == null) {
return false;
}
if (table.getIsreplicated()) {
return false;
}
// Justify whether partition column is in group by column list or not
if (table.getPartitioncolumn() != null) {
return false;
}
m_mvTableScan = mvTableScan;
Set<String> mvDDLGroupbyColumnNames = new HashSet<>();
List<Column> mvColumnArray =
CatalogUtil.getSortedCatalogItems(table.getColumns(), "index");
String mvTableAlias = getMVTableAlias();
// Get the number of group-by columns.
int numOfGroupByColumns;
MaterializedViewInfo mvInfo = srcTable.getViews().get(mvTableName);
if (mvInfo != null) {
// single table view
String complexGroupbyJson = mvInfo.getGroupbyexpressionsjson();
if (complexGroupbyJson.length() > 0) {
List<AbstractExpression> mvComplexGroupbyCols = null;
try {
mvComplexGroupbyCols = AbstractExpression.fromJSONArrayString(complexGroupbyJson, null);
}
catch (JSONException e) {
e.printStackTrace();
}
numOfGroupByColumns = mvComplexGroupbyCols.size();
}
else {
numOfGroupByColumns = mvInfo.getGroupbycols().size();
}
}
else {
// joined table view
MaterializedViewHandlerInfo mvHandlerInfo = table.getMvhandlerinfo().get("mvHandlerInfo");
numOfGroupByColumns = mvHandlerInfo.getGroupbycolumncount();
}
if (scanColumns.isEmpty() && numOfGroupByColumns == 0) {
// This is an edge case that can happen if the view
// has no group by keys, and we are just
// doing a count(*) on the output of the view.
//
// Having no GB keys or scan columns would cause us to
// produce plan nodes that have a 0-column output schema.
// We can't handle this in several places, so add the
// count(*) column from the view to the scan columns.
Column mvCol = mvColumnArray.get(0); // this is the "count(*)" column.
TupleValueExpression tve = new TupleValueExpression(
mvTableName, mvTableAlias, mvCol, 0);
tve.setOrigStmtId(mvTableScan.getStatementId());
String colName = mvCol.getName();
SchemaColumn scol = new SchemaColumn(mvTableName, mvTableAlias,
colName, colName, tve);
scanColumns.add(scol);
}
// Start to do real materialized view processing to fix the duplicates problem.
// (1) construct new projection columns for scan plan node.
Set<SchemaColumn> mvDDLGroupbyColumns = new HashSet<>();
NodeSchema inlineProjSchema = new NodeSchema();
for (SchemaColumn scol: scanColumns) {
inlineProjSchema.addColumn(scol);
}
for (int i = 0; i < numOfGroupByColumns; i++) {
Column mvCol = mvColumnArray.get(i);
String colName = mvCol.getName();
TupleValueExpression tve = new TupleValueExpression(
mvTableName, mvTableAlias, mvCol, i);
tve.setOrigStmtId(mvTableScan.getStatementId());
mvDDLGroupbyColumnNames.add(colName);
SchemaColumn scol = new SchemaColumn(mvTableName, mvTableAlias,
colName, colName, tve);
mvDDLGroupbyColumns.add(scol);
if (!scanColumns.contains(scol)) {
scanColumns.add(scol);
// construct new projection columns for scan plan node.
inlineProjSchema.addColumn(scol);
}
}
// Record the re-aggregation type for each scan columns.
Map<String, ExpressionType> mvColumnReAggType = new HashMap<>();
for (int i = numOfGroupByColumns; i < mvColumnArray.size(); i++) {
Column mvCol = mvColumnArray.get(i);
ExpressionType reAggType = ExpressionType.get(mvCol.getAggregatetype());
if (reAggType == ExpressionType.AGGREGATE_COUNT_STAR ||
reAggType == ExpressionType.AGGREGATE_COUNT) {
reAggType = ExpressionType.AGGREGATE_SUM;
}
mvColumnReAggType.put(mvCol.getName(), reAggType);
}
assert (inlineProjSchema.size() > 0);
m_scanInlinedProjectionNode =
new ProjectionPlanNode(inlineProjSchema);
// (2) Construct the reAggregation Node.
// Construct the reAggregation plan node's aggSchema
m_reAggNode = new HashAggregatePlanNode();
int outputColumnIndex = 0;
// inlineProjSchema contains the group by columns, while aggSchema may do not.
NodeSchema aggSchema = new NodeSchema();
// Construct reAggregation node's aggregation and group by list.
for (SchemaColumn scol: inlineProjSchema) {
if (mvDDLGroupbyColumns.contains(scol)) {
// Add group by expression.
m_reAggNode.addGroupByExpression(scol.getExpression());
}
else {
ExpressionType reAggType = mvColumnReAggType.get(scol.getColumnName());
assert(reAggType != null);
AbstractExpression agg_input_expr = scol.getExpression();
assert(agg_input_expr instanceof TupleValueExpression);
// Add aggregation information.
m_reAggNode.addAggregate(reAggType, false, outputColumnIndex, agg_input_expr);
}
aggSchema.addColumn(scol);
outputColumnIndex++;
}
assert (aggSchema.size() > 0);
m_reAggNode.setOutputSchema(aggSchema);
// Collect all TVEs that need to be do re-aggregation in coordinator.
List<TupleValueExpression> needReAggTVEs = new ArrayList<>();
List<AbstractExpression> aggPostExprs = new ArrayList<>();
for (int i = numOfGroupByColumns; i < mvColumnArray.size(); i++) {
Column mvCol = mvColumnArray.get(i);
TupleValueExpression tve = new TupleValueExpression(
mvTableName, mvTableAlias, mvCol, -1);
tve.setOrigStmtId(mvTableScan.getStatementId());
needReAggTVEs.add(tve);
}
collectReAggNodePostExpressions(joinTree, needReAggTVEs, aggPostExprs);
AbstractExpression aggPostExpr = ExpressionUtil.combinePredicates(aggPostExprs);
// Add post filters for the reAggregation node.
m_reAggNode.setPostPredicate(aggPostExpr);
// ENG-5386
if (m_edgeCaseQueryNoFixNeeded &&
edgeCaseQueryNoFixNeeded(mvDDLGroupbyColumnNames, mvColumnReAggType, displayColumns, groupByColumns)) {
return false;
}
m_needed = true;
return true;
} } | public class class_name {
public boolean processMVBasedQueryFix(StmtTableScan mvTableScan, Set<SchemaColumn> scanColumns, JoinNode joinTree,
List<ParsedColInfo> displayColumns, List<ParsedColInfo> groupByColumns) {
// Check valid cases first
//@TODO
if ( ! (mvTableScan instanceof StmtTargetTableScan)) {
return false; // depends on control dependency: [if], data = [none]
}
Table table = ((StmtTargetTableScan)mvTableScan).getTargetTable();
assert (table != null);
String mvTableName = table.getTypeName();
Table srcTable = table.getMaterializer();
if (srcTable == null) {
return false; // depends on control dependency: [if], data = [none]
}
if (table.getIsreplicated()) {
return false; // depends on control dependency: [if], data = [none]
}
// Justify whether partition column is in group by column list or not
if (table.getPartitioncolumn() != null) {
return false; // depends on control dependency: [if], data = [none]
}
m_mvTableScan = mvTableScan;
Set<String> mvDDLGroupbyColumnNames = new HashSet<>();
List<Column> mvColumnArray =
CatalogUtil.getSortedCatalogItems(table.getColumns(), "index");
String mvTableAlias = getMVTableAlias();
// Get the number of group-by columns.
int numOfGroupByColumns;
MaterializedViewInfo mvInfo = srcTable.getViews().get(mvTableName);
if (mvInfo != null) {
// single table view
String complexGroupbyJson = mvInfo.getGroupbyexpressionsjson();
if (complexGroupbyJson.length() > 0) {
List<AbstractExpression> mvComplexGroupbyCols = null;
try {
mvComplexGroupbyCols = AbstractExpression.fromJSONArrayString(complexGroupbyJson, null); // depends on control dependency: [try], data = [none]
}
catch (JSONException e) {
e.printStackTrace();
} // depends on control dependency: [catch], data = [none]
numOfGroupByColumns = mvComplexGroupbyCols.size(); // depends on control dependency: [if], data = [none]
}
else {
numOfGroupByColumns = mvInfo.getGroupbycols().size(); // depends on control dependency: [if], data = [none]
}
}
else {
// joined table view
MaterializedViewHandlerInfo mvHandlerInfo = table.getMvhandlerinfo().get("mvHandlerInfo");
numOfGroupByColumns = mvHandlerInfo.getGroupbycolumncount(); // depends on control dependency: [if], data = [none]
}
if (scanColumns.isEmpty() && numOfGroupByColumns == 0) {
// This is an edge case that can happen if the view
// has no group by keys, and we are just
// doing a count(*) on the output of the view.
//
// Having no GB keys or scan columns would cause us to
// produce plan nodes that have a 0-column output schema.
// We can't handle this in several places, so add the
// count(*) column from the view to the scan columns.
Column mvCol = mvColumnArray.get(0); // this is the "count(*)" column.
TupleValueExpression tve = new TupleValueExpression(
mvTableName, mvTableAlias, mvCol, 0);
tve.setOrigStmtId(mvTableScan.getStatementId()); // depends on control dependency: [if], data = [none]
String colName = mvCol.getName();
SchemaColumn scol = new SchemaColumn(mvTableName, mvTableAlias,
colName, colName, tve);
scanColumns.add(scol); // depends on control dependency: [if], data = [none]
}
// Start to do real materialized view processing to fix the duplicates problem.
// (1) construct new projection columns for scan plan node.
Set<SchemaColumn> mvDDLGroupbyColumns = new HashSet<>();
NodeSchema inlineProjSchema = new NodeSchema();
for (SchemaColumn scol: scanColumns) {
inlineProjSchema.addColumn(scol); // depends on control dependency: [for], data = [scol]
}
for (int i = 0; i < numOfGroupByColumns; i++) {
Column mvCol = mvColumnArray.get(i);
String colName = mvCol.getName();
TupleValueExpression tve = new TupleValueExpression(
mvTableName, mvTableAlias, mvCol, i);
tve.setOrigStmtId(mvTableScan.getStatementId()); // depends on control dependency: [for], data = [none]
mvDDLGroupbyColumnNames.add(colName); // depends on control dependency: [for], data = [none]
SchemaColumn scol = new SchemaColumn(mvTableName, mvTableAlias,
colName, colName, tve);
mvDDLGroupbyColumns.add(scol); // depends on control dependency: [for], data = [none]
if (!scanColumns.contains(scol)) {
scanColumns.add(scol); // depends on control dependency: [if], data = [none]
// construct new projection columns for scan plan node.
inlineProjSchema.addColumn(scol); // depends on control dependency: [if], data = [none]
}
}
// Record the re-aggregation type for each scan columns.
Map<String, ExpressionType> mvColumnReAggType = new HashMap<>();
for (int i = numOfGroupByColumns; i < mvColumnArray.size(); i++) {
Column mvCol = mvColumnArray.get(i);
ExpressionType reAggType = ExpressionType.get(mvCol.getAggregatetype());
if (reAggType == ExpressionType.AGGREGATE_COUNT_STAR ||
reAggType == ExpressionType.AGGREGATE_COUNT) {
reAggType = ExpressionType.AGGREGATE_SUM; // depends on control dependency: [if], data = [none]
}
mvColumnReAggType.put(mvCol.getName(), reAggType); // depends on control dependency: [for], data = [none]
}
assert (inlineProjSchema.size() > 0);
m_scanInlinedProjectionNode =
new ProjectionPlanNode(inlineProjSchema);
// (2) Construct the reAggregation Node.
// Construct the reAggregation plan node's aggSchema
m_reAggNode = new HashAggregatePlanNode();
int outputColumnIndex = 0;
// inlineProjSchema contains the group by columns, while aggSchema may do not.
NodeSchema aggSchema = new NodeSchema();
// Construct reAggregation node's aggregation and group by list.
for (SchemaColumn scol: inlineProjSchema) {
if (mvDDLGroupbyColumns.contains(scol)) {
// Add group by expression.
m_reAggNode.addGroupByExpression(scol.getExpression()); // depends on control dependency: [if], data = [none]
}
else {
ExpressionType reAggType = mvColumnReAggType.get(scol.getColumnName());
assert(reAggType != null); // depends on control dependency: [if], data = [none]
AbstractExpression agg_input_expr = scol.getExpression();
assert(agg_input_expr instanceof TupleValueExpression); // depends on control dependency: [if], data = [none]
// Add aggregation information.
m_reAggNode.addAggregate(reAggType, false, outputColumnIndex, agg_input_expr); // depends on control dependency: [if], data = [none]
}
aggSchema.addColumn(scol); // depends on control dependency: [for], data = [scol]
outputColumnIndex++; // depends on control dependency: [for], data = [none]
}
assert (aggSchema.size() > 0);
m_reAggNode.setOutputSchema(aggSchema);
// Collect all TVEs that need to be do re-aggregation in coordinator.
List<TupleValueExpression> needReAggTVEs = new ArrayList<>();
List<AbstractExpression> aggPostExprs = new ArrayList<>();
for (int i = numOfGroupByColumns; i < mvColumnArray.size(); i++) {
Column mvCol = mvColumnArray.get(i);
TupleValueExpression tve = new TupleValueExpression(
mvTableName, mvTableAlias, mvCol, -1);
tve.setOrigStmtId(mvTableScan.getStatementId()); // depends on control dependency: [for], data = [none]
needReAggTVEs.add(tve); // depends on control dependency: [for], data = [none]
}
collectReAggNodePostExpressions(joinTree, needReAggTVEs, aggPostExprs);
AbstractExpression aggPostExpr = ExpressionUtil.combinePredicates(aggPostExprs);
// Add post filters for the reAggregation node.
m_reAggNode.setPostPredicate(aggPostExpr);
// ENG-5386
if (m_edgeCaseQueryNoFixNeeded &&
edgeCaseQueryNoFixNeeded(mvDDLGroupbyColumnNames, mvColumnReAggType, displayColumns, groupByColumns)) {
return false; // depends on control dependency: [if], data = [none]
}
m_needed = true;
return true;
} } |
public class class_name {
public static String repeat(String s, int count) {
if (s == null) {
return null;
}
StringBuilder builder = new StringBuilder();
for (int i = 0; i < count; i++) {
builder.append(s);
}
return builder.toString();
} } | public class class_name {
public static String repeat(String s, int count) {
if (s == null) {
return null; // depends on control dependency: [if], data = [none]
}
StringBuilder builder = new StringBuilder();
for (int i = 0; i < count; i++) {
builder.append(s); // depends on control dependency: [for], data = [none]
}
return builder.toString();
} } |
public class class_name {
public boolean isExceptionToday() {
if (daysOfWeek != null && daysOfWeek.length > 0) {
int dayOfWeekNow = Calendar.getInstance().get(Calendar.DAY_OF_WEEK);
for (int exceptionDay : daysOfWeek) {
if (exceptionDay == dayOfWeekNow) {
return true;
}
}
}
return false;
} } | public class class_name {
public boolean isExceptionToday() {
if (daysOfWeek != null && daysOfWeek.length > 0) {
int dayOfWeekNow = Calendar.getInstance().get(Calendar.DAY_OF_WEEK);
for (int exceptionDay : daysOfWeek) {
if (exceptionDay == dayOfWeekNow) {
return true; // depends on control dependency: [if], data = [none]
}
}
}
return false;
} } |
public class class_name {
@Override
public String toFullString() {
String result;
if(hasNoStringCache() || (result = stringCache.fullString) == null) {
stringCache.fullString = result = toNormalizedString(IPv4StringCache.fullParams);
}
return result;
} } | public class class_name {
@Override
public String toFullString() {
String result;
if(hasNoStringCache() || (result = stringCache.fullString) == null) {
stringCache.fullString = result = toNormalizedString(IPv4StringCache.fullParams); // depends on control dependency: [if], data = [none]
}
return result;
} } |
public class class_name {
void modify(final Deployment dep) {
final JBossWebMetaData jbossWebMD = WSHelper.getOptionalAttachment(dep, JBossWebMetaData.class);
if (jbossWebMD != null) {
this.configureEndpoints(dep, jbossWebMD);
this.modifyContextRoot(dep, jbossWebMD);
}
} } | public class class_name {
void modify(final Deployment dep) {
final JBossWebMetaData jbossWebMD = WSHelper.getOptionalAttachment(dep, JBossWebMetaData.class);
if (jbossWebMD != null) {
this.configureEndpoints(dep, jbossWebMD); // depends on control dependency: [if], data = [none]
this.modifyContextRoot(dep, jbossWebMD); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public static String getRelativeInsideWebInf(Resource resource) {
if (resource == null) return null;
try {
String url = resource.getURL().toString();
int i = url.indexOf(WEB_INF);
if (i > -1) {
return url.substring(i);
}
Matcher m = PLUGIN_PATTERN.matcher(url);
if (m.find()) {
return WEB_INF + m.group(1);
}
i = url.lastIndexOf(GRAILS_APP_DIR);
if (i > -1) {
return WEB_INF + "/" + url.substring(i);
}
}
catch (IOException e) {
return null;
}
return null;
} } | public class class_name {
public static String getRelativeInsideWebInf(Resource resource) {
if (resource == null) return null;
try {
String url = resource.getURL().toString();
int i = url.indexOf(WEB_INF);
if (i > -1) {
return url.substring(i); // depends on control dependency: [if], data = [(i]
}
Matcher m = PLUGIN_PATTERN.matcher(url);
if (m.find()) {
return WEB_INF + m.group(1); // depends on control dependency: [if], data = [none]
}
i = url.lastIndexOf(GRAILS_APP_DIR); // depends on control dependency: [try], data = [none]
if (i > -1) {
return WEB_INF + "/" + url.substring(i); // depends on control dependency: [if], data = [(i]
}
}
catch (IOException e) {
return null;
} // depends on control dependency: [catch], data = [none]
return null;
} } |
public class class_name {
private void gossip(Collection<ImmutableMember> updates) {
// Get a list of available peers. If peers are available, randomize the peer list and select a subset of
// peers with which to gossip updates.
List<SwimMember> members = Lists.newArrayList(randomMembers);
if (!members.isEmpty()) {
Collections.shuffle(members);
for (int i = 0; i < Math.min(members.size(), config.getGossipFanout()); i++) {
gossip(members.get(i), updates);
}
}
} } | public class class_name {
private void gossip(Collection<ImmutableMember> updates) {
// Get a list of available peers. If peers are available, randomize the peer list and select a subset of
// peers with which to gossip updates.
List<SwimMember> members = Lists.newArrayList(randomMembers);
if (!members.isEmpty()) {
Collections.shuffle(members); // depends on control dependency: [if], data = [none]
for (int i = 0; i < Math.min(members.size(), config.getGossipFanout()); i++) {
gossip(members.get(i), updates); // depends on control dependency: [for], data = [i]
}
}
} } |
public class class_name {
public void setSecurityProfileIdentifiers(java.util.Collection<SecurityProfileIdentifier> securityProfileIdentifiers) {
if (securityProfileIdentifiers == null) {
this.securityProfileIdentifiers = null;
return;
}
this.securityProfileIdentifiers = new java.util.ArrayList<SecurityProfileIdentifier>(securityProfileIdentifiers);
} } | public class class_name {
public void setSecurityProfileIdentifiers(java.util.Collection<SecurityProfileIdentifier> securityProfileIdentifiers) {
if (securityProfileIdentifiers == null) {
this.securityProfileIdentifiers = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.securityProfileIdentifiers = new java.util.ArrayList<SecurityProfileIdentifier>(securityProfileIdentifiers);
} } |
public class class_name {
public static <T, P> void forEachWith(
Iterable<T> iterable,
Procedure2<? super T, ? super P> procedure,
P parameter)
{
if (iterable instanceof InternalIterable)
{
((InternalIterable<T>) iterable).forEachWith(procedure, parameter);
}
else if (iterable instanceof ArrayList)
{
ArrayListIterate.forEachWith((ArrayList<T>) iterable, procedure, parameter);
}
else if (iterable instanceof List)
{
ListIterate.forEachWith((List<T>) iterable, procedure, parameter);
}
else if (iterable != null)
{
IterableIterate.forEachWith(iterable, procedure, parameter);
}
else
{
throw new IllegalArgumentException("Cannot perform a forEachWith on null");
}
} } | public class class_name {
public static <T, P> void forEachWith(
Iterable<T> iterable,
Procedure2<? super T, ? super P> procedure,
P parameter)
{
if (iterable instanceof InternalIterable)
{
((InternalIterable<T>) iterable).forEachWith(procedure, parameter); // depends on control dependency: [if], data = [none]
}
else if (iterable instanceof ArrayList)
{
ArrayListIterate.forEachWith((ArrayList<T>) iterable, procedure, parameter); // depends on control dependency: [if], data = [none]
}
else if (iterable instanceof List)
{
ListIterate.forEachWith((List<T>) iterable, procedure, parameter); // depends on control dependency: [if], data = [none]
}
else if (iterable != null)
{
IterableIterate.forEachWith(iterable, procedure, parameter); // depends on control dependency: [if], data = [(iterable]
}
else
{
throw new IllegalArgumentException("Cannot perform a forEachWith on null");
}
} } |
public class class_name {
protected String[] getCacheDomains(Method method) {
if (null == method.getData().get(Domain.CACHE_DOMAIN_KEY)) {
return null;
}
JSONValue jsonValue = JSONParser.parseStrict(method.getData().get(Domain.CACHE_DOMAIN_KEY));
if (null == jsonValue) {
return null;
}
JSONArray jsonArray = jsonValue.isArray();
if (null != jsonArray) {
String[] dd = new String[jsonArray.size()];
for (int i = 0; i < jsonArray.size(); ++i) {
dd[i] = jsonArray.get(i).isString().stringValue();
}
return dd;
}
return null;
} } | public class class_name {
protected String[] getCacheDomains(Method method) {
if (null == method.getData().get(Domain.CACHE_DOMAIN_KEY)) {
return null; // depends on control dependency: [if], data = [none]
}
JSONValue jsonValue = JSONParser.parseStrict(method.getData().get(Domain.CACHE_DOMAIN_KEY));
if (null == jsonValue) {
return null; // depends on control dependency: [if], data = [none]
}
JSONArray jsonArray = jsonValue.isArray();
if (null != jsonArray) {
String[] dd = new String[jsonArray.size()];
for (int i = 0; i < jsonArray.size(); ++i) {
dd[i] = jsonArray.get(i).isString().stringValue(); // depends on control dependency: [for], data = [i]
}
return dd; // depends on control dependency: [if], data = [none]
}
return null;
} } |
public class class_name {
public void bufferPacket(OggPacket packet, long granulePosition) {
if(closed) {
throw new IllegalStateException("Can't buffer packets on a closed stream!");
}
if(! doneFirstPacket) {
packet.setIsBOS();
doneFirstPacket = true;
}
int size = packet.getData().length;
boolean emptyPacket = (size==0);
// Add to pages in turn
OggPage page = getCurrentPage(false);
int pos = 0;
while( pos < size || emptyPacket) {
pos = page.addPacket(packet, pos);
if(pos < size) {
page = getCurrentPage(true);
page.setIsContinuation();
}
page.setGranulePosition(granulePosition);
emptyPacket = false;
}
currentGranulePosition = granulePosition;
packet.setParent(page);
} } | public class class_name {
public void bufferPacket(OggPacket packet, long granulePosition) {
if(closed) {
throw new IllegalStateException("Can't buffer packets on a closed stream!");
}
if(! doneFirstPacket) {
packet.setIsBOS(); // depends on control dependency: [if], data = [none]
doneFirstPacket = true; // depends on control dependency: [if], data = [none]
}
int size = packet.getData().length;
boolean emptyPacket = (size==0);
// Add to pages in turn
OggPage page = getCurrentPage(false);
int pos = 0;
while( pos < size || emptyPacket) {
pos = page.addPacket(packet, pos); // depends on control dependency: [while], data = [none]
if(pos < size) {
page = getCurrentPage(true); // depends on control dependency: [if], data = [none]
page.setIsContinuation(); // depends on control dependency: [if], data = [none]
}
page.setGranulePosition(granulePosition); // depends on control dependency: [while], data = [none]
emptyPacket = false; // depends on control dependency: [while], data = [none]
}
currentGranulePosition = granulePosition;
packet.setParent(page);
} } |
public class class_name {
protected void removeCachedExtensionVersion(String feature, E extension)
{
// versions
List<E> extensionVersions = this.extensionsVersions.get(feature);
extensionVersions.remove(extension);
if (extensionVersions.isEmpty()) {
this.extensionsVersions.remove(feature);
}
} } | public class class_name {
protected void removeCachedExtensionVersion(String feature, E extension)
{
// versions
List<E> extensionVersions = this.extensionsVersions.get(feature);
extensionVersions.remove(extension);
if (extensionVersions.isEmpty()) {
this.extensionsVersions.remove(feature); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
static void zSetPopupLocation(CustomPopup popup, int defaultX, int defaultY, JComponent picker,
JComponent verticalFlipReference, int verticalFlipDistance, int bottomOverlapAllowed) {
// Gather some variables that we will need.
Window topWindowOrNull = SwingUtilities.getWindowAncestor(picker);
Rectangle workingArea = InternalUtilities.getScreenWorkingArea(topWindowOrNull);
int popupWidth = popup.getBounds().width;
int popupHeight = popup.getBounds().height;
// Calculate the default rectangle for the popup.
Rectangle popupRectangle = new Rectangle(defaultX, defaultY, popupWidth, popupHeight);
// If the popup rectangle is below the bottom of the working area, then move it upwards by
// the minimum amount which will ensure that it will never cover the picker component.
if (popupRectangle.getMaxY() > (workingArea.getMaxY() + bottomOverlapAllowed)) {
popupRectangle.y = verticalFlipReference.getLocationOnScreen().y - popupHeight
- verticalFlipDistance;
}
// Confine the popup to be within the working area.
if (popupRectangle.getMaxX() > (workingArea.getMaxX())) {
popupRectangle.x -= (popupRectangle.getMaxX() - workingArea.getMaxX());
}
if (popupRectangle.getMaxY() > (workingArea.getMaxY() + bottomOverlapAllowed)) {
popupRectangle.y -= (popupRectangle.getMaxY() - workingArea.getMaxY());
}
if (popupRectangle.x < workingArea.x) {
popupRectangle.x += (workingArea.x - popupRectangle.x);
}
if (popupRectangle.y < workingArea.y) {
popupRectangle.y += (workingArea.y - popupRectangle.y);
}
// Set the location of the popup.
popup.setLocation(popupRectangle.x, popupRectangle.y);
} } | public class class_name {
static void zSetPopupLocation(CustomPopup popup, int defaultX, int defaultY, JComponent picker,
JComponent verticalFlipReference, int verticalFlipDistance, int bottomOverlapAllowed) {
// Gather some variables that we will need.
Window topWindowOrNull = SwingUtilities.getWindowAncestor(picker);
Rectangle workingArea = InternalUtilities.getScreenWorkingArea(topWindowOrNull);
int popupWidth = popup.getBounds().width;
int popupHeight = popup.getBounds().height;
// Calculate the default rectangle for the popup.
Rectangle popupRectangle = new Rectangle(defaultX, defaultY, popupWidth, popupHeight);
// If the popup rectangle is below the bottom of the working area, then move it upwards by
// the minimum amount which will ensure that it will never cover the picker component.
if (popupRectangle.getMaxY() > (workingArea.getMaxY() + bottomOverlapAllowed)) {
popupRectangle.y = verticalFlipReference.getLocationOnScreen().y - popupHeight
- verticalFlipDistance; // depends on control dependency: [if], data = [none]
}
// Confine the popup to be within the working area.
if (popupRectangle.getMaxX() > (workingArea.getMaxX())) {
popupRectangle.x -= (popupRectangle.getMaxX() - workingArea.getMaxX()); // depends on control dependency: [if], data = [(popupRectangle.getMaxX()]
}
if (popupRectangle.getMaxY() > (workingArea.getMaxY() + bottomOverlapAllowed)) {
popupRectangle.y -= (popupRectangle.getMaxY() - workingArea.getMaxY()); // depends on control dependency: [if], data = [(popupRectangle.getMaxY()]
}
if (popupRectangle.x < workingArea.x) {
popupRectangle.x += (workingArea.x - popupRectangle.x); // depends on control dependency: [if], data = [none]
}
if (popupRectangle.y < workingArea.y) {
popupRectangle.y += (workingArea.y - popupRectangle.y); // depends on control dependency: [if], data = [none]
}
// Set the location of the popup.
popup.setLocation(popupRectangle.x, popupRectangle.y);
} } |
public class class_name {
public List<Complex_F64> getEigenvalues() {
List<Complex_F64> ret = new ArrayList<Complex_F64>();
if( is64 ) {
EigenDecomposition_F64 d = (EigenDecomposition_F64)eig;
for (int i = 0; i < eig.getNumberOfEigenvalues(); i++) {
ret.add(d.getEigenvalue(i));
}
} else {
EigenDecomposition_F32 d = (EigenDecomposition_F32)eig;
for (int i = 0; i < eig.getNumberOfEigenvalues(); i++) {
Complex_F32 c = d.getEigenvalue(i);
ret.add(new Complex_F64(c.real, c.imaginary));
}
}
return ret;
} } | public class class_name {
public List<Complex_F64> getEigenvalues() {
List<Complex_F64> ret = new ArrayList<Complex_F64>();
if( is64 ) {
EigenDecomposition_F64 d = (EigenDecomposition_F64)eig;
for (int i = 0; i < eig.getNumberOfEigenvalues(); i++) {
ret.add(d.getEigenvalue(i)); // depends on control dependency: [for], data = [i]
}
} else {
EigenDecomposition_F32 d = (EigenDecomposition_F32)eig;
for (int i = 0; i < eig.getNumberOfEigenvalues(); i++) {
Complex_F32 c = d.getEigenvalue(i);
ret.add(new Complex_F64(c.real, c.imaginary)); // depends on control dependency: [for], data = [none]
}
}
return ret;
} } |
public class class_name {
@SuppressWarnings("fallthrough")
protected int handleGetLimit(int field, int limitType) {
switch (field) {
case ERA:
if (limitType == MINIMUM || limitType == GREATEST_MINIMUM) {
return 0;
}
return CURRENT_ERA;
case YEAR:
{
switch (limitType) {
case MINIMUM:
case GREATEST_MINIMUM:
return 1;
case LEAST_MAXIMUM:
return 1;
case MAXIMUM:
return super.handleGetLimit(field, MAXIMUM) - ERAS[CURRENT_ERA*3];
}
//Fall through to the default if not handled above
}
default:
return super.handleGetLimit(field, limitType);
}
} } | public class class_name {
@SuppressWarnings("fallthrough")
protected int handleGetLimit(int field, int limitType) {
switch (field) {
case ERA:
if (limitType == MINIMUM || limitType == GREATEST_MINIMUM) {
return 0; // depends on control dependency: [if], data = [none]
}
return CURRENT_ERA;
case YEAR:
{
switch (limitType) {
case MINIMUM:
case GREATEST_MINIMUM:
return 1;
case LEAST_MAXIMUM:
return 1;
case MAXIMUM:
return super.handleGetLimit(field, MAXIMUM) - ERAS[CURRENT_ERA*3];
}
//Fall through to the default if not handled above
}
default:
return super.handleGetLimit(field, limitType);
}
} } |
public class class_name {
protected void surround(final Parse node, final int i, final String type,
final Collection<Parse> punctuation, final List<String> features) {
final StringBuilder feat = new StringBuilder(20);
feat.append("s").append(i).append("=");
if (punctuation != null) {
for (final Parse punct : punctuation) {
if (node != null) {
feat.append(node.getHead().getCoveredText()).append("|").append(type)
.append("|").append(node.getType()).append("|")
.append(punct.getType());
} else {
feat.append(type).append("|").append(EOS).append("|")
.append(punct.getType());
}
features.add(feat.toString());
feat.setLength(0);
feat.append("s").append(i).append("*=");
if (node != null) {
feat.append(type).append("|").append(node.getType()).append("|")
.append(punct.getType());
} else {
feat.append(type).append("|").append(EOS).append("|")
.append(punct.getType());
}
features.add(feat.toString());
feat.setLength(0);
feat.append("s").append(i).append("*=");
feat.append(type).append("|").append(punct.getType());
features.add(feat.toString());
}
} else {
if (node != null) {
feat.append(node.getHead().getCoveredText()).append("|").append(type)
.append("|").append(node.getType());
} else {
feat.append(type).append("|").append(EOS);
}
features.add(feat.toString());
feat.setLength(0);
feat.append("s").append(i).append("*=");
if (node != null) {
feat.append(type).append("|").append(node.getType());
} else {
feat.append(type).append("|").append(EOS);
}
features.add(feat.toString());
}
} } | public class class_name {
protected void surround(final Parse node, final int i, final String type,
final Collection<Parse> punctuation, final List<String> features) {
final StringBuilder feat = new StringBuilder(20);
feat.append("s").append(i).append("=");
if (punctuation != null) {
for (final Parse punct : punctuation) {
if (node != null) {
feat.append(node.getHead().getCoveredText()).append("|").append(type)
.append("|").append(node.getType()).append("|")
.append(punct.getType()); // depends on control dependency: [if], data = [(node]
} else {
feat.append(type).append("|").append(EOS).append("|")
.append(punct.getType()); // depends on control dependency: [if], data = [none]
}
features.add(feat.toString()); // depends on control dependency: [for], data = [none]
feat.setLength(0); // depends on control dependency: [for], data = [none]
feat.append("s").append(i).append("*="); // depends on control dependency: [for], data = [none]
if (node != null) {
feat.append(type).append("|").append(node.getType()).append("|")
.append(punct.getType()); // depends on control dependency: [if], data = [none]
} else {
feat.append(type).append("|").append(EOS).append("|")
.append(punct.getType()); // depends on control dependency: [if], data = [none]
}
features.add(feat.toString()); // depends on control dependency: [for], data = [none]
feat.setLength(0); // depends on control dependency: [for], data = [none]
feat.append("s").append(i).append("*="); // depends on control dependency: [for], data = [none]
feat.append(type).append("|").append(punct.getType()); // depends on control dependency: [for], data = [punct]
features.add(feat.toString()); // depends on control dependency: [for], data = [none]
}
} else {
if (node != null) {
feat.append(node.getHead().getCoveredText()).append("|").append(type)
.append("|").append(node.getType()); // depends on control dependency: [if], data = [(node]
} else {
feat.append(type).append("|").append(EOS); // depends on control dependency: [if], data = [none]
}
features.add(feat.toString()); // depends on control dependency: [if], data = [none]
feat.setLength(0); // depends on control dependency: [if], data = [none]
feat.append("s").append(i).append("*="); // depends on control dependency: [if], data = [none]
if (node != null) {
feat.append(type).append("|").append(node.getType()); // depends on control dependency: [if], data = [(node]
} else {
feat.append(type).append("|").append(EOS); // depends on control dependency: [if], data = [none]
}
features.add(feat.toString()); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
private void addQueryParams(final Request request) {
if (bindingType != null) {
for (UserBinding.BindingType prop : bindingType) {
request.addQueryParam("BindingType", prop.toString());
}
}
if (getPageSize() != null) {
request.addQueryParam("PageSize", Integer.toString(getPageSize()));
}
} } | public class class_name {
private void addQueryParams(final Request request) {
if (bindingType != null) {
for (UserBinding.BindingType prop : bindingType) {
request.addQueryParam("BindingType", prop.toString()); // depends on control dependency: [for], data = [prop]
}
}
if (getPageSize() != null) {
request.addQueryParam("PageSize", Integer.toString(getPageSize())); // depends on control dependency: [if], data = [(getPageSize()]
}
} } |
public class class_name {
public static VariablePattern fromPlate(String plateName, VariableNumMap plateVariables,
VariableNumMap fixedVariables) {
List<VariableNameMatcher> matchers = Lists.newArrayList();
for (String variableName : plateVariables.getVariableNamesArray()) {
matchers.add(new VariableNameMatcher(plateName + "/", "/" + variableName, 0));
}
return new VariableNamePattern(matchers, plateVariables, fixedVariables);
} } | public class class_name {
public static VariablePattern fromPlate(String plateName, VariableNumMap plateVariables,
VariableNumMap fixedVariables) {
List<VariableNameMatcher> matchers = Lists.newArrayList();
for (String variableName : plateVariables.getVariableNamesArray()) {
matchers.add(new VariableNameMatcher(plateName + "/", "/" + variableName, 0)); // depends on control dependency: [for], data = [variableName]
}
return new VariableNamePattern(matchers, plateVariables, fixedVariables);
} } |
public class class_name {
public final String encode() {
StringBuffer buffer = new StringBuffer();
DefaultAlignment alignmentDefault = isHorizontal()
? ColumnSpec.DEFAULT
: RowSpec.DEFAULT;
if (!alignmentDefault.equals(defaultAlignment)) {
buffer.append(defaultAlignment.abbreviation());
buffer.append(":");
}
buffer.append(size.encode());
if (resizeWeight == NO_GROW) {
// Omit the resize part
} else if (resizeWeight == DEFAULT_GROW) {
buffer.append(':');
buffer.append("g");
} else {
buffer.append(':');
buffer.append("g(");
buffer.append(resizeWeight);
buffer.append(')');
}
return buffer.toString();
} } | public class class_name {
public final String encode() {
StringBuffer buffer = new StringBuffer();
DefaultAlignment alignmentDefault = isHorizontal()
? ColumnSpec.DEFAULT
: RowSpec.DEFAULT;
if (!alignmentDefault.equals(defaultAlignment)) {
buffer.append(defaultAlignment.abbreviation()); // depends on control dependency: [if], data = [none]
buffer.append(":"); // depends on control dependency: [if], data = [none]
}
buffer.append(size.encode());
if (resizeWeight == NO_GROW) {
// Omit the resize part
} else if (resizeWeight == DEFAULT_GROW) {
buffer.append(':'); // depends on control dependency: [if], data = [none]
buffer.append("g"); // depends on control dependency: [if], data = [none]
} else {
buffer.append(':'); // depends on control dependency: [if], data = [none]
buffer.append("g(");
buffer.append(resizeWeight);
buffer.append(')'); // depends on control dependency: [if], data = [none]
}
return buffer.toString();
} } |
public class class_name {
public static Element getMonomerElement(Monomer monomer)
throws MonomerException {
Element element = new Element(MONOMER_ELEMENT);
if (null != monomer.getAlternateId()) {
Element e = new Element(MONOMER_ID_ELEMENT);
e.setText(monomer.getAlternateId());
element.getChildren().add(e);
}
if (null != monomer.getCanSMILES()) {
Element e = new Element(MONOMER_SMILES_ELEMENT);
e.setText(monomer.getCanSMILES());
element.getChildren().add(e);
}
if (null != monomer.getMolfile()) {
Element e = new Element(MONOMER_MOL_FILE_ELEMENT);
String encodedMolfile = null;
try {
encodedMolfile = MolfileEncoder.encode(monomer.getMolfile());
} catch (EncoderException ex) {
throw new MonomerException("Invalid monomer molfile");
}
// CDATA cdata = new CDATA(monomer.getMolfile());
// e.setContent(cdata);
e.setText(encodedMolfile);
element.getChildren().add(e);
}
if (null != monomer.getMonomerType()) {
Element e = new Element(MONOMER_TYPE_ELEMENT);
e.setText(monomer.getMonomerType());
element.getChildren().add(e);
}
if (null != monomer.getPolymerType()) {
Element e = new Element(POLYMER_TYPE_ELEMENT);
e.setText(monomer.getPolymerType());
element.getChildren().add(e);
}
if (null != monomer.getNaturalAnalog()) {
Element e = new Element(NATURAL_ANALOG_ELEMENT);
e.setText(monomer.getNaturalAnalog());
element.getChildren().add(e);
}
if (null != monomer.getName()) {
Element e = new Element(MONOMER_NAME_ELEMENT);
e.setText(monomer.getName());
element.getChildren().add(e);
}
List<Attachment> l = monomer.getAttachmentList();
if (null != l && l.size() > 0) {
Element attachments = new Element(ATTACHEMENTS_ELEMENT);
for (int i = 0; i < l.size(); i++) {
Attachment att = l.get(i);
Element attachment = getAttachementElement(att);
attachments.getChildren().add(attachment);
}
element.getChildren().add(attachments);
}
return element;
} } | public class class_name {
public static Element getMonomerElement(Monomer monomer)
throws MonomerException {
Element element = new Element(MONOMER_ELEMENT);
if (null != monomer.getAlternateId()) {
Element e = new Element(MONOMER_ID_ELEMENT);
e.setText(monomer.getAlternateId());
element.getChildren().add(e);
}
if (null != monomer.getCanSMILES()) {
Element e = new Element(MONOMER_SMILES_ELEMENT);
e.setText(monomer.getCanSMILES());
element.getChildren().add(e);
}
if (null != monomer.getMolfile()) {
Element e = new Element(MONOMER_MOL_FILE_ELEMENT);
String encodedMolfile = null;
try {
encodedMolfile = MolfileEncoder.encode(monomer.getMolfile());
// depends on control dependency: [try], data = [none]
} catch (EncoderException ex) {
throw new MonomerException("Invalid monomer molfile");
}
// depends on control dependency: [catch], data = [none]
// CDATA cdata = new CDATA(monomer.getMolfile());
// e.setContent(cdata);
e.setText(encodedMolfile);
element.getChildren().add(e);
}
if (null != monomer.getMonomerType()) {
Element e = new Element(MONOMER_TYPE_ELEMENT);
e.setText(monomer.getMonomerType());
element.getChildren().add(e);
}
if (null != monomer.getPolymerType()) {
Element e = new Element(POLYMER_TYPE_ELEMENT);
e.setText(monomer.getPolymerType());
element.getChildren().add(e);
}
if (null != monomer.getNaturalAnalog()) {
Element e = new Element(NATURAL_ANALOG_ELEMENT);
e.setText(monomer.getNaturalAnalog());
element.getChildren().add(e);
}
if (null != monomer.getName()) {
Element e = new Element(MONOMER_NAME_ELEMENT);
e.setText(monomer.getName());
element.getChildren().add(e);
}
List<Attachment> l = monomer.getAttachmentList();
if (null != l && l.size() > 0) {
Element attachments = new Element(ATTACHEMENTS_ELEMENT);
for (int i = 0; i < l.size(); i++) {
Attachment att = l.get(i);
Element attachment = getAttachementElement(att);
attachments.getChildren().add(attachment);
// depends on control dependency: [for], data = [none]
}
element.getChildren().add(attachments);
}
return element;
} } |
public class class_name {
public void md5final(byte[] digest) {
/* "final" is a poor method name in Java. :v) */
int count;
int p; // in original code, this is a pointer; in this java code
// it's an index into the array this->in.
/* Compute number of bytes mod 64 */
count = (int) ((bits >>> 3) & 0x3F);
/* Set the first char of padding to 0x80. This is safe since there is
always at least one byte free */
p = count;
in[p++] = (byte) 0x80;
/* Bytes of padding needed to make 64 bytes */
count = 64 - 1 - count;
/* Pad out to 56 mod 64 */
if (count < 8) {
/* Two lots of padding: Pad the first block to 64 bytes */
zeroByteArray(in, p, count);
transform();
/* Now fill the next block with 56 bytes */
zeroByteArray(in, 0, 56);
} else {
/* Pad block to 56 bytes */
zeroByteArray(in, p, count - 8);
}
/* Append length in bits and transform */
// Could use a PUT_64BIT... func here. This is a fairly
// direct translation from the C code, where bits was an array
// of two 32-bit ints.
int lowbits = (int) bits;
int highbits = (int) (bits >>> 32);
PUT_32BIT_LSB_FIRST(in, 56, lowbits);
PUT_32BIT_LSB_FIRST(in, 60, highbits);
transform();
PUT_32BIT_LSB_FIRST(digest, 0, buf[0]);
PUT_32BIT_LSB_FIRST(digest, 4, buf[1]);
PUT_32BIT_LSB_FIRST(digest, 8, buf[2]);
PUT_32BIT_LSB_FIRST(digest, 12, buf[3]);
/* zero sensitive data */
/* notice this misses any sneaking out on the stack. The C
* version uses registers in some spots, perhaps because
* they care about this.
*/
zeroByteArray(in);
zeroIntArray(buf);
bits = 0;
zeroIntArray(inint);
} } | public class class_name {
public void md5final(byte[] digest) {
/* "final" is a poor method name in Java. :v) */
int count;
int p; // in original code, this is a pointer; in this java code
// it's an index into the array this->in.
/* Compute number of bytes mod 64 */
count = (int) ((bits >>> 3) & 0x3F);
/* Set the first char of padding to 0x80. This is safe since there is
always at least one byte free */
p = count;
in[p++] = (byte) 0x80;
/* Bytes of padding needed to make 64 bytes */
count = 64 - 1 - count;
/* Pad out to 56 mod 64 */
if (count < 8) {
/* Two lots of padding: Pad the first block to 64 bytes */
zeroByteArray(in, p, count); // depends on control dependency: [if], data = [none]
transform(); // depends on control dependency: [if], data = [none]
/* Now fill the next block with 56 bytes */
zeroByteArray(in, 0, 56); // depends on control dependency: [if], data = [none]
} else {
/* Pad block to 56 bytes */
zeroByteArray(in, p, count - 8); // depends on control dependency: [if], data = [8)]
}
/* Append length in bits and transform */
// Could use a PUT_64BIT... func here. This is a fairly
// direct translation from the C code, where bits was an array
// of two 32-bit ints.
int lowbits = (int) bits;
int highbits = (int) (bits >>> 32);
PUT_32BIT_LSB_FIRST(in, 56, lowbits);
PUT_32BIT_LSB_FIRST(in, 60, highbits);
transform();
PUT_32BIT_LSB_FIRST(digest, 0, buf[0]);
PUT_32BIT_LSB_FIRST(digest, 4, buf[1]);
PUT_32BIT_LSB_FIRST(digest, 8, buf[2]);
PUT_32BIT_LSB_FIRST(digest, 12, buf[3]);
/* zero sensitive data */
/* notice this misses any sneaking out on the stack. The C
* version uses registers in some spots, perhaps because
* they care about this.
*/
zeroByteArray(in);
zeroIntArray(buf);
bits = 0;
zeroIntArray(inint);
} } |
public class class_name {
static List<String> iterateDownPids(List<String> segments) {
List<String> res = new ArrayList<>();
for (int i = segments.size(); i > 0; i--) {
StringBuilder sb = new StringBuilder();
sb.append(JMX_ACL_PID_PREFIX);
for (int j = 0; j < i; j++) {
sb.append('.');
sb.append(segments.get(j));
}
res.add(sb.toString());
}
res.add(JMX_ACL_PID_PREFIX); // this is the top PID (aka jmx.acl)
return res;
} } | public class class_name {
static List<String> iterateDownPids(List<String> segments) {
List<String> res = new ArrayList<>();
for (int i = segments.size(); i > 0; i--) {
StringBuilder sb = new StringBuilder();
sb.append(JMX_ACL_PID_PREFIX); // depends on control dependency: [for], data = [none]
for (int j = 0; j < i; j++) {
sb.append('.'); // depends on control dependency: [for], data = [none]
sb.append(segments.get(j)); // depends on control dependency: [for], data = [j]
}
res.add(sb.toString()); // depends on control dependency: [for], data = [none]
}
res.add(JMX_ACL_PID_PREFIX); // this is the top PID (aka jmx.acl)
return res;
} } |
public class class_name {
protected boolean isStale() throws IOException {
boolean isStale = true;
if (isOpen) {
// the connection is open, but now we have to see if we can read it
// assume the connection is not stale.
isStale = false;
try {
if (inputStream.available() <= 0) {
try {
socket.setSoTimeout(1);
inputStream.mark(1);
int byteRead = inputStream.read();
if (byteRead == -1) {
// again - if the socket is reporting all data read,
// probably stale
isStale = true;
} else {
inputStream.reset();
}
} finally {
socket.setSoTimeout(this.params.getSoTimeout());
}
}
} catch (InterruptedIOException e) {
if (!ExceptionUtil.isSocketTimeoutException(e)) {
throw e;
}
// aha - the connection is NOT stale - continue on!
} catch (IOException e) {
// oops - the connection is stale, the read or soTimeout failed.
LOG.debug(
"An error occurred while reading from the socket, is appears to be stale",
e
);
isStale = true;
}
}
return isStale;
} } | public class class_name {
protected boolean isStale() throws IOException {
boolean isStale = true;
if (isOpen) {
// the connection is open, but now we have to see if we can read it
// assume the connection is not stale.
isStale = false;
try {
if (inputStream.available() <= 0) {
try {
socket.setSoTimeout(1); // depends on control dependency: [try], data = [none]
inputStream.mark(1); // depends on control dependency: [try], data = [none]
int byteRead = inputStream.read();
if (byteRead == -1) {
// again - if the socket is reporting all data read,
// probably stale
isStale = true; // depends on control dependency: [if], data = [none]
} else {
inputStream.reset(); // depends on control dependency: [if], data = [none]
}
} finally {
socket.setSoTimeout(this.params.getSoTimeout());
}
}
} catch (InterruptedIOException e) {
if (!ExceptionUtil.isSocketTimeoutException(e)) {
throw e;
}
// aha - the connection is NOT stale - continue on!
} catch (IOException e) { // depends on control dependency: [catch], data = [none]
// oops - the connection is stale, the read or soTimeout failed.
LOG.debug(
"An error occurred while reading from the socket, is appears to be stale",
e
);
isStale = true;
} // depends on control dependency: [catch], data = [none]
}
return isStale;
} } |
public class class_name {
public static int copyProperty(
final Object dst,
final Object src,
final String propertyName
)
{
int count = 0;
if (isPropertyGettable( src, propertyName )
&& isPropertySettable( dst, propertyName )) {
Object value = getProperty( src, propertyName );
setProperty( dst, propertyName, value );
count++;
}
return count;
} } | public class class_name {
public static int copyProperty(
final Object dst,
final Object src,
final String propertyName
)
{
int count = 0;
if (isPropertyGettable( src, propertyName )
&& isPropertySettable( dst, propertyName )) {
Object value = getProperty( src, propertyName );
setProperty( dst, propertyName, value ); // depends on control dependency: [if], data = [none]
count++; // depends on control dependency: [if], data = [none]
}
return count;
} } |
public class class_name {
@Override
public void deleteAttributeAt(int position) {
int index = locateIndex(position);
this.numberAttributes--;
if ((index >= 0) && (indexValues[index] == position)) {
int[] tempIndices = new int[indexValues.length - 1];
double[] tempValues = new double[attributeValues.length - 1];
System.arraycopy(indexValues, 0, tempIndices, 0, index);
System.arraycopy(attributeValues, 0, tempValues, 0, index);
for (int i = index; i < indexValues.length - 1; i++) {
tempIndices[i] = indexValues[i + 1] - 1;
tempValues[i] = attributeValues[i + 1];
}
indexValues = tempIndices;
attributeValues = tempValues;
} else {
int[] tempIndices = new int[indexValues.length];
double[] tempValues = new double[attributeValues.length];
System.arraycopy(indexValues, 0, tempIndices, 0, index + 1);
System.arraycopy(attributeValues, 0, tempValues, 0, index + 1);
for (int i = index + 1; i < indexValues.length; i++) {
tempIndices[i] = indexValues[i] - 1;
tempValues[i] = attributeValues[i];
}
indexValues = tempIndices;
attributeValues = tempValues;
}
} } | public class class_name {
@Override
public void deleteAttributeAt(int position) {
int index = locateIndex(position);
this.numberAttributes--;
if ((index >= 0) && (indexValues[index] == position)) {
int[] tempIndices = new int[indexValues.length - 1];
double[] tempValues = new double[attributeValues.length - 1];
System.arraycopy(indexValues, 0, tempIndices, 0, index); // depends on control dependency: [if], data = [none]
System.arraycopy(attributeValues, 0, tempValues, 0, index); // depends on control dependency: [if], data = [none]
for (int i = index; i < indexValues.length - 1; i++) {
tempIndices[i] = indexValues[i + 1] - 1; // depends on control dependency: [for], data = [i]
tempValues[i] = attributeValues[i + 1]; // depends on control dependency: [for], data = [i]
}
indexValues = tempIndices; // depends on control dependency: [if], data = [none]
attributeValues = tempValues; // depends on control dependency: [if], data = [none]
} else {
int[] tempIndices = new int[indexValues.length];
double[] tempValues = new double[attributeValues.length];
System.arraycopy(indexValues, 0, tempIndices, 0, index + 1); // depends on control dependency: [if], data = [none]
System.arraycopy(attributeValues, 0, tempValues, 0, index + 1); // depends on control dependency: [if], data = [none]
for (int i = index + 1; i < indexValues.length; i++) {
tempIndices[i] = indexValues[i] - 1; // depends on control dependency: [for], data = [i]
tempValues[i] = attributeValues[i]; // depends on control dependency: [for], data = [i]
}
indexValues = tempIndices; // depends on control dependency: [if], data = [none]
attributeValues = tempValues; // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
protected boolean isIncludeStackTrace(HttpServletRequest request,
MediaType produces) {
IncludeStacktrace include = getErrorProperties().getIncludeStacktrace();
if (include == IncludeStacktrace.ALWAYS) {
return true;
}
if (include == IncludeStacktrace.ON_TRACE_PARAM) {
return getTraceParameter(request);
}
return false;
} } | public class class_name {
protected boolean isIncludeStackTrace(HttpServletRequest request,
MediaType produces) {
IncludeStacktrace include = getErrorProperties().getIncludeStacktrace();
if (include == IncludeStacktrace.ALWAYS) {
return true; // depends on control dependency: [if], data = [none]
}
if (include == IncludeStacktrace.ON_TRACE_PARAM) {
return getTraceParameter(request); // depends on control dependency: [if], data = [none]
}
return false;
} } |
public class class_name {
void invalidate() {
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
SibTr.entry(this, TRACE, "invalidate");
}
_sessionInvalidated = true;
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
SibTr.exit(this, TRACE, "invalidate");
}
} } | public class class_name {
void invalidate() {
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
SibTr.entry(this, TRACE, "invalidate"); // depends on control dependency: [if], data = [none]
}
_sessionInvalidated = true;
if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
SibTr.exit(this, TRACE, "invalidate"); // depends on control dependency: [if], data = [none]
}
} } |
public class class_name {
public static long toPackedDate(long mjd) {
long y;
int m;
int d;
long days = Math.addExact(mjd, OFFSET);
if (days >= 694266 && days < 766950) { // year range 1901-2099
days += 15;
long q4 = Math.floorDiv(days, 1461);
int r4 = (int) Math.floorMod(days, 1461);
if (r4 == 1460) {
y = (q4 + 1) * 4;
m = 2;
d = 29;
} else {
int q1 = (r4 / 365);
int r1 = (r4 % 365);
y = q4 * 4 + q1;
m = (((r1 + 31) * 5) / 153) + 2;
d = r1 - (((m + 1) * 153) / 5) + 123;
if (m > 12) {
y++;
m -= 12;
}
}
} else {
long q400 = Math.floorDiv(days, 146097);
int r400 = (int) Math.floorMod(days, 146097);
if (r400 == 146096) {
y = (q400 + 1) * 400;
m = 2;
d = 29;
} else {
int q100 = (r400 / 36524);
int r100 = (r400 % 36524);
int q4 = (r100 / 1461);
int r4 = (r100 % 1461);
if (r4 == 1460) {
y = (q400 * 400 + q100 * 100 + (q4 + 1) * 4);
m = 2;
d = 29;
} else {
int q1 = (r4 / 365);
int r1 = (r4 % 365);
y = (q400 * 400 + q100 * 100 + q4 * 4 + q1);
m = (((r1 + 31) * 5) / 153) + 2;
d = r1 - (((m + 1) * 153) / 5) + 123;
if (m > 12) {
y++;
m -= 12;
}
}
}
if (y < GregorianMath.MIN_YEAR || y > GregorianMath.MAX_YEAR) {
throw new IllegalArgumentException("Year out of range: " + y);
}
}
long result = (y << 32);
result |= (m << 16);
result |= d;
return result;
} } | public class class_name {
public static long toPackedDate(long mjd) {
long y;
int m;
int d;
long days = Math.addExact(mjd, OFFSET);
if (days >= 694266 && days < 766950) { // year range 1901-2099
days += 15; // depends on control dependency: [if], data = [none]
long q4 = Math.floorDiv(days, 1461);
int r4 = (int) Math.floorMod(days, 1461);
if (r4 == 1460) {
y = (q4 + 1) * 4; // depends on control dependency: [if], data = [none]
m = 2; // depends on control dependency: [if], data = [none]
d = 29; // depends on control dependency: [if], data = [none]
} else {
int q1 = (r4 / 365);
int r1 = (r4 % 365);
y = q4 * 4 + q1; // depends on control dependency: [if], data = [none]
m = (((r1 + 31) * 5) / 153) + 2; // depends on control dependency: [if], data = [none]
d = r1 - (((m + 1) * 153) / 5) + 123; // depends on control dependency: [if], data = [none]
if (m > 12) {
y++; // depends on control dependency: [if], data = [none]
m -= 12; // depends on control dependency: [if], data = [none]
}
}
} else {
long q400 = Math.floorDiv(days, 146097);
int r400 = (int) Math.floorMod(days, 146097);
if (r400 == 146096) {
y = (q400 + 1) * 400; // depends on control dependency: [if], data = [none]
m = 2; // depends on control dependency: [if], data = [none]
d = 29; // depends on control dependency: [if], data = [none]
} else {
int q100 = (r400 / 36524);
int r100 = (r400 % 36524);
int q4 = (r100 / 1461);
int r4 = (r100 % 1461);
if (r4 == 1460) {
y = (q400 * 400 + q100 * 100 + (q4 + 1) * 4); // depends on control dependency: [if], data = [none]
m = 2; // depends on control dependency: [if], data = [none]
d = 29; // depends on control dependency: [if], data = [none]
} else {
int q1 = (r4 / 365);
int r1 = (r4 % 365);
y = (q400 * 400 + q100 * 100 + q4 * 4 + q1); // depends on control dependency: [if], data = [none]
m = (((r1 + 31) * 5) / 153) + 2; // depends on control dependency: [if], data = [none]
d = r1 - (((m + 1) * 153) / 5) + 123; // depends on control dependency: [if], data = [none]
if (m > 12) {
y++; // depends on control dependency: [if], data = [none]
m -= 12; // depends on control dependency: [if], data = [none]
}
}
}
if (y < GregorianMath.MIN_YEAR || y > GregorianMath.MAX_YEAR) {
throw new IllegalArgumentException("Year out of range: " + y);
}
}
long result = (y << 32);
result |= (m << 16);
result |= d;
return result;
} } |
public class class_name {
public void setAlgorithmSummaryList(java.util.Collection<AlgorithmSummary> algorithmSummaryList) {
if (algorithmSummaryList == null) {
this.algorithmSummaryList = null;
return;
}
this.algorithmSummaryList = new java.util.ArrayList<AlgorithmSummary>(algorithmSummaryList);
} } | public class class_name {
public void setAlgorithmSummaryList(java.util.Collection<AlgorithmSummary> algorithmSummaryList) {
if (algorithmSummaryList == null) {
this.algorithmSummaryList = null; // depends on control dependency: [if], data = [none]
return; // depends on control dependency: [if], data = [none]
}
this.algorithmSummaryList = new java.util.ArrayList<AlgorithmSummary>(algorithmSummaryList);
} } |
public class class_name {
private Sql[] generateMSSQLSql(AddPrimaryKeyStatementMSSQL statement, Database database, SqlGeneratorChain sqlGeneratorChain) {
String sql;
if (statement.getConstraintName() == null) {
sql = "ALTER TABLE " + database.escapeTableName(statement.getCatalogName(), statement.getSchemaName(), statement.getTableName()) + " ADD PRIMARY KEY (" + database.escapeColumnNameList(statement.getColumnNames()) + ")";
} else {
sql = "ALTER TABLE " + database.escapeTableName(statement.getCatalogName(), statement.getSchemaName(), statement.getTableName()) + " ADD CONSTRAINT " + database.escapeConstraintName(statement.getConstraintName())+" PRIMARY KEY";
if (!statement.isClustered()) {
sql += " NONCLUSTERED";
}
sql += " (" + database.escapeColumnNameList(statement.getColumnNames()) + ")";
}
// the only new feature being added is support for fillFactor
sql += " WITH (FILLFACTOR = " + statement.getFillFactor() + ")";
if (StringUtils.trimToNull(statement.getTablespace()) != null && database.supportsTablespaces()) {
sql += " ON "+statement.getTablespace();
}
if (statement.getForIndexName() != null) {
sql += " USING INDEX "+database.escapeObjectName(statement.getForIndexCatalogName(), statement.getForIndexSchemaName(), statement.getForIndexName(), Index.class);
}
return new Sql[] {
new UnparsedSql(sql, getAffectedPrimaryKey(statement))
};
} } | public class class_name {
private Sql[] generateMSSQLSql(AddPrimaryKeyStatementMSSQL statement, Database database, SqlGeneratorChain sqlGeneratorChain) {
String sql;
if (statement.getConstraintName() == null) {
sql = "ALTER TABLE " + database.escapeTableName(statement.getCatalogName(), statement.getSchemaName(), statement.getTableName()) + " ADD PRIMARY KEY (" + database.escapeColumnNameList(statement.getColumnNames()) + ")";
} else {
sql = "ALTER TABLE " + database.escapeTableName(statement.getCatalogName(), statement.getSchemaName(), statement.getTableName()) + " ADD CONSTRAINT " + database.escapeConstraintName(statement.getConstraintName())+" PRIMARY KEY";
if (!statement.isClustered()) {
sql += " NONCLUSTERED"; // depends on control dependency: [if], data = [none]
}
sql += " (" + database.escapeColumnNameList(statement.getColumnNames()) + ")";
}
// the only new feature being added is support for fillFactor
sql += " WITH (FILLFACTOR = " + statement.getFillFactor() + ")";
if (StringUtils.trimToNull(statement.getTablespace()) != null && database.supportsTablespaces()) {
sql += " ON "+statement.getTablespace();
}
if (statement.getForIndexName() != null) {
sql += " USING INDEX "+database.escapeObjectName(statement.getForIndexCatalogName(), statement.getForIndexSchemaName(), statement.getForIndexName(), Index.class);
}
return new Sql[] {
new UnparsedSql(sql, getAffectedPrimaryKey(statement))
};
} } |
public class class_name {
public static boolean delete(Descriptor desc, Set<Component> components)
{
// remove the DATA component first if it exists
if (components.contains(Component.DATA))
FileUtils.deleteWithConfirm(desc.filenameFor(Component.DATA));
for (Component component : components)
{
if (component.equals(Component.DATA) || component.equals(Component.SUMMARY))
continue;
FileUtils.deleteWithConfirm(desc.filenameFor(component));
}
FileUtils.delete(desc.filenameFor(Component.SUMMARY));
logger.debug("Deleted {}", desc);
return true;
} } | public class class_name {
public static boolean delete(Descriptor desc, Set<Component> components)
{
// remove the DATA component first if it exists
if (components.contains(Component.DATA))
FileUtils.deleteWithConfirm(desc.filenameFor(Component.DATA));
for (Component component : components)
{
if (component.equals(Component.DATA) || component.equals(Component.SUMMARY))
continue;
FileUtils.deleteWithConfirm(desc.filenameFor(component)); // depends on control dependency: [for], data = [component]
}
FileUtils.delete(desc.filenameFor(Component.SUMMARY));
logger.debug("Deleted {}", desc);
return true;
} } |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.